"use strict";
var __esbuild_esm_mermaid_nm;
(__esbuild_esm_mermaid_nm ||= {}).mermaid = (() => {
  var __create = Object.create;
  var __defProp = Object.defineProperty;
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  var __getOwnPropNames = Object.getOwnPropertyNames;
  var __getProtoOf = Object.getPrototypeOf;
  var __hasOwnProp = Object.prototype.hasOwnProperty;
  var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true });
  var __esm = (fn3, res) => function __init() {
    return fn3 && (res = (0, fn3[__getOwnPropNames(fn3)[0]])(fn3 = 0)), res;
  };
  var __commonJS = (cb, mod) => function __require() {
    return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  };
  var __export = (target, all) => {
    for (var name in all)
      __defProp(target, name, { get: all[name], enumerable: true });
  };
  var __copyProps = (to, from2, except, desc) => {
    if (from2 && typeof from2 === "object" || typeof from2 === "function") {
      for (let key of __getOwnPropNames(from2))
        if (!__hasOwnProp.call(to, key) && key !== except)
          __defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
    }
    return to;
  };
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
    // If the importer is in node compatibility mode or this is not an ESM
    // file that has been converted to a CommonJS file using a Babel-
    // compatible transform (i.e. "__esModule" has not been set), then set
    // "default" to the CommonJS "module.exports" for node compatibility.
    isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
    mod
  ));
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

  // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/defaults.js
  var defaultIconDimensions, defaultIconTransformations, defaultIconProps, defaultExtendedIconProps;
  var init_defaults = __esm({
    "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/defaults.js"() {
      "use strict";
      defaultIconDimensions = Object.freeze({
        left: 0,
        top: 0,
        width: 16,
        height: 16
      });
      defaultIconTransformations = Object.freeze({
        rotate: 0,
        vFlip: false,
        hFlip: false
      });
      defaultIconProps = Object.freeze({
        ...defaultIconDimensions,
        ...defaultIconTransformations
      });
      defaultExtendedIconProps = Object.freeze({
        ...defaultIconProps,
        body: "",
        hidden: false
      });
    }
  });

  // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/customisations/defaults.js
  var defaultIconSizeCustomisations, defaultIconCustomisations;
  var init_defaults2 = __esm({
    "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/customisations/defaults.js"() {
      "use strict";
      init_defaults();
      defaultIconSizeCustomisations = Object.freeze({
        width: null,
        height: null
      });
      defaultIconCustomisations = Object.freeze({
        ...defaultIconSizeCustomisations,
        ...defaultIconTransformations
      });
    }
  });

  // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/name.js
  var stringToIcon, validateIconName;
  var init_name = __esm({
    "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/name.js"() {
      "use strict";
      stringToIcon = /* @__PURE__ */ __name((value2, validate, allowSimpleName, provider = "") => {
        const colonSeparated = value2.split(":");
        if (value2.slice(0, 1) === "@") {
          if (colonSeparated.length < 2 || colonSeparated.length > 3) return null;
          provider = colonSeparated.shift().slice(1);
        }
        if (colonSeparated.length > 3 || !colonSeparated.length) return null;
        if (colonSeparated.length > 1) {
          const name$1 = colonSeparated.pop();
          const prefix = colonSeparated.pop();
          const result = {
            provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
            prefix,
            name: name$1
          };
          return validate && !validateIconName(result) ? null : result;
        }
        const name = colonSeparated[0];
        const dashSeparated = name.split("-");
        if (dashSeparated.length > 1) {
          const result = {
            provider,
            prefix: dashSeparated.shift(),
            name: dashSeparated.join("-")
          };
          return validate && !validateIconName(result) ? null : result;
        }
        if (allowSimpleName && provider === "") {
          const result = {
            provider,
            prefix: "",
            name
          };
          return validate && !validateIconName(result, allowSimpleName) ? null : result;
        }
        return null;
      }, "stringToIcon");
      validateIconName = /* @__PURE__ */ __name((icon2, allowSimpleName) => {
        if (!icon2) return false;
        return !!((allowSimpleName && icon2.prefix === "" || !!icon2.prefix) && !!icon2.name);
      }, "validateIconName");
    }
  });

  // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/transformations.js
  function mergeIconTransformations(obj1, obj2) {
    const result = {};
    if (!obj1.hFlip !== !obj2.hFlip) result.hFlip = true;
    if (!obj1.vFlip !== !obj2.vFlip) result.vFlip = true;
    const rotate2 = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
    if (rotate2) result.rotate = rotate2;
    return result;
  }
  var init_transformations = __esm({
    "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/transformations.js"() {
      "use strict";
      __name(mergeIconTransformations, "mergeIconTransformations");
    }
  });

  // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/merge.js
  function mergeIconData(parent4, child) {
    const result = mergeIconTransformations(parent4, child);
    for (const key in defaultExtendedIconProps) if (key in defaultIconTransformations) {
      if (key in parent4 && !(key in result)) result[key] = defaultIconTransformations[key];
    } else if (key in child) result[key] = child[key];
    else if (key in parent4) result[key] = parent4[key];
    return result;
  }
  var init_merge = __esm({
    "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/merge.js"() {
      "use strict";
      init_defaults();
      init_transformations();
      __name(mergeIconData, "mergeIconData");
    }
  });

  // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon-set/tree.js
  function getIconsTree(data5, names) {
    const icons = data5.icons;
    const aliases = data5.aliases || /* @__PURE__ */ Object.create(null);
    const resolved = /* @__PURE__ */ Object.create(null);
    function resolve2(name) {
      if (icons[name]) return resolved[name] = [];
      if (!(name in resolved)) {
        resolved[name] = null;
        const parent4 = aliases[name] && aliases[name].parent;
        const value2 = parent4 && resolve2(parent4);
        if (value2) resolved[name] = [parent4].concat(value2);
      }
      return resolved[name];
    }
    __name(resolve2, "resolve");
    (names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve2);
    return resolved;
  }
  var init_tree = __esm({
    "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon-set/tree.js"() {
      "use strict";
      __name(getIconsTree, "getIconsTree");
    }
  });

  // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon-set/get-icon.js
  function internalGetIconData(data5, name, tree) {
    const icons = data5.icons;
    const aliases = data5.aliases || /* @__PURE__ */ Object.create(null);
    let currentProps = {};
    function parse7(name$1) {
      currentProps = mergeIconData(icons[name$1] || aliases[name$1], currentProps);
    }
    __name(parse7, "parse");
    parse7(name);
    tree.forEach(parse7);
    return mergeIconData(data5, currentProps);
  }
  function getIconData(data5, name) {
    if (data5.icons[name]) return internalGetIconData(data5, name, []);
    const tree = getIconsTree(data5, [name])[name];
    return tree ? internalGetIconData(data5, name, tree) : null;
  }
  var init_get_icon = __esm({
    "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon-set/get-icon.js"() {
      "use strict";
      init_merge();
      init_tree();
      __name(internalGetIconData, "internalGetIconData");
      __name(getIconData, "getIconData");
    }
  });

  // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/size.js
  function calculateSize(size4, ratio, precision) {
    if (ratio === 1) return size4;
    precision = precision || 100;
    if (typeof size4 === "number") return Math.ceil(size4 * ratio * precision) / precision;
    if (typeof size4 !== "string") return size4;
    const oldParts = size4.split(unitsSplit);
    if (oldParts === null || !oldParts.length) return size4;
    const newParts = [];
    let code = oldParts.shift();
    let isNumber = unitsTest.test(code);
    while (true) {
      if (isNumber) {
        const num = parseFloat(code);
        if (isNaN(num)) newParts.push(code);
        else newParts.push(Math.ceil(num * ratio * precision) / precision);
      } else newParts.push(code);
      code = oldParts.shift();
      if (code === void 0) return newParts.join("");
      isNumber = !isNumber;
    }
  }
  var unitsSplit, unitsTest;
  var init_size = __esm({
    "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/size.js"() {
      "use strict";
      unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
      unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
      __name(calculateSize, "calculateSize");
    }
  });

  // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/defs.js
  function splitSVGDefs(content, tag = "defs") {
    let defs2 = "";
    const index = content.indexOf("<" + tag);
    while (index >= 0) {
      const start3 = content.indexOf(">", index);
      const end2 = content.indexOf("</" + tag);
      if (start3 === -1 || end2 === -1) break;
      const endEnd = content.indexOf(">", end2);
      if (endEnd === -1) break;
      defs2 += content.slice(start3 + 1, end2).trim();
      content = content.slice(0, index).trim() + content.slice(endEnd + 1);
    }
    return {
      defs: defs2,
      content
    };
  }
  function mergeDefsAndContent(defs2, content) {
    return defs2 ? "<defs>" + defs2 + "</defs>" + content : content;
  }
  function wrapSVGContent(body, start3, end2) {
    const split = splitSVGDefs(body);
    return mergeDefsAndContent(split.defs, start3 + split.content + end2);
  }
  var init_defs = __esm({
    "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/defs.js"() {
      "use strict";
      __name(splitSVGDefs, "splitSVGDefs");
      __name(mergeDefsAndContent, "mergeDefsAndContent");
      __name(wrapSVGContent, "wrapSVGContent");
    }
  });

  // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/build.js
  function iconToSVG(icon2, customisations) {
    const fullIcon = {
      ...defaultIconProps,
      ...icon2
    };
    const fullCustomisations = {
      ...defaultIconCustomisations,
      ...customisations
    };
    const box = {
      left: fullIcon.left,
      top: fullIcon.top,
      width: fullIcon.width,
      height: fullIcon.height
    };
    let body = fullIcon.body;
    [fullIcon, fullCustomisations].forEach((props) => {
      const transformations = [];
      const hFlip = props.hFlip;
      const vFlip = props.vFlip;
      let rotation = props.rotate;
      if (hFlip) if (vFlip) rotation += 2;
      else {
        transformations.push("translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")");
        transformations.push("scale(-1 1)");
        box.top = box.left = 0;
      }
      else if (vFlip) {
        transformations.push("translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")");
        transformations.push("scale(1 -1)");
        box.top = box.left = 0;
      }
      let tempValue;
      if (rotation < 0) rotation -= Math.floor(rotation / 4) * 4;
      rotation = rotation % 4;
      switch (rotation) {
        case 1:
          tempValue = box.height / 2 + box.top;
          transformations.unshift("rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")");
          break;
        case 2:
          transformations.unshift("rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")");
          break;
        case 3:
          tempValue = box.width / 2 + box.left;
          transformations.unshift("rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")");
          break;
      }
      if (rotation % 2 === 1) {
        if (box.left !== box.top) {
          tempValue = box.left;
          box.left = box.top;
          box.top = tempValue;
        }
        if (box.width !== box.height) {
          tempValue = box.width;
          box.width = box.height;
          box.height = tempValue;
        }
      }
      if (transformations.length) body = wrapSVGContent(body, '<g transform="' + transformations.join(" ") + '">', "</g>");
    });
    const customisationsWidth = fullCustomisations.width;
    const customisationsHeight = fullCustomisations.height;
    const boxWidth = box.width;
    const boxHeight = box.height;
    let width3;
    let height2;
    if (customisationsWidth === null) {
      height2 = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
      width3 = calculateSize(height2, boxWidth / boxHeight);
    } else {
      width3 = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
      height2 = customisationsHeight === null ? calculateSize(width3, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
    }
    const attributes = {};
    const setAttr = /* @__PURE__ */ __name((prop, value2) => {
      if (!isUnsetKeyword(value2)) attributes[prop] = value2.toString();
    }, "setAttr");
    setAttr("width", width3);
    setAttr("height", height2);
    const viewBox = [
      box.left,
      box.top,
      boxWidth,
      boxHeight
    ];
    attributes.viewBox = viewBox.join(" ");
    return {
      attributes,
      viewBox,
      body
    };
  }
  var isUnsetKeyword;
  var init_build = __esm({
    "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/build.js"() {
      "use strict";
      init_defaults();
      init_defaults2();
      init_size();
      init_defs();
      isUnsetKeyword = /* @__PURE__ */ __name((value2) => value2 === "unset" || value2 === "undefined" || value2 === "none", "isUnsetKeyword");
      __name(iconToSVG, "iconToSVG");
    }
  });

  // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/id.js
  function replaceIDs(body, prefix = randomPrefix) {
    const ids = [];
    let match2;
    while (match2 = regex.exec(body)) ids.push(match2[1]);
    if (!ids.length) return body;
    const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
    ids.forEach((id34) => {
      const newID = typeof prefix === "function" ? prefix(id34) : prefix + (counter++).toString();
      const escapedID = id34.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
      body = body.replace(new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"), "$1" + newID + suffix + "$3");
    });
    body = body.replace(new RegExp(suffix, "g"), "");
    return body;
  }
  var regex, randomPrefix, counter;
  var init_id = __esm({
    "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/id.js"() {
      "use strict";
      regex = /\sid="(\S+)"/g;
      randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
      counter = 0;
      __name(replaceIDs, "replaceIDs");
    }
  });

  // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/html.js
  function iconToHTML(body, attributes) {
    let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
    for (const attr in attributes) renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
    return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
  }
  var init_html = __esm({
    "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/html.js"() {
      "use strict";
      __name(iconToHTML, "iconToHTML");
    }
  });

  // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/index.js
  var init_lib = __esm({
    "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/index.js"() {
      "use strict";
      init_name();
      init_get_icon();
      init_build();
      init_id();
      init_html();
    }
  });

  // src/assignWithDepth.ts
  var assignWithDepth, assignWithDepth_default;
  var init_assignWithDepth = __esm({
    "src/assignWithDepth.ts"() {
      "use strict";
      assignWithDepth = /* @__PURE__ */ __name((dst, src, { depth = 2, clobber = false } = {}) => {
        const config5 = { depth, clobber };
        if (Array.isArray(src) && !Array.isArray(dst)) {
          src.forEach((s2) => assignWithDepth(dst, s2, config5));
          return dst;
        } else if (Array.isArray(src) && Array.isArray(dst)) {
          src.forEach((s2) => {
            if (!dst.includes(s2)) {
              dst.push(s2);
            }
          });
          return dst;
        }
        if (dst === void 0 || depth <= 0) {
          if (dst !== void 0 && dst !== null && typeof dst === "object" && typeof src === "object") {
            return Object.assign(dst, src);
          } else {
            return src;
          }
        }
        if (src !== void 0 && typeof dst === "object" && typeof src === "object") {
          Object.keys(src).forEach((key) => {
            if (typeof src[key] === "object" && src[key] !== null && (dst[key] === void 0 || typeof dst[key] === "object")) {
              if (dst[key] === void 0) {
                dst[key] = Array.isArray(src[key]) ? [] : {};
              }
              dst[key] = assignWithDepth(dst[key], src[key], { depth: depth - 1, clobber });
            } else if (clobber || typeof dst[key] !== "object" && typeof src[key] !== "object") {
              dst[key] = src[key];
            }
          });
        }
        return dst;
      }, "assignWithDepth");
      assignWithDepth_default = assignWithDepth;
    }
  });

  // ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.js
  var require_dayjs_min = __commonJS({
    "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.js"(exports2, module2) {
      "use strict";
      !(function(t4, e3) {
        "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = e3() : "function" == typeof define && define.amd ? define(e3) : (t4 = "undefined" != typeof globalThis ? globalThis : t4 || self).dayjs = e3();
      })(exports2, (function() {
        "use strict";
        var t4 = 1e3, e3 = 6e4, n2 = 36e5, r2 = "millisecond", i2 = "second", s2 = "minute", u2 = "hour", a2 = "day", o2 = "week", c3 = "month", f2 = "quarter", h3 = "year", d3 = "date", l4 = "Invalid Date", $4 = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y6 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M3 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: /* @__PURE__ */ __name(function(t5) {
          var e4 = ["th", "st", "nd", "rd"], n3 = t5 % 100;
          return "[" + t5 + (e4[(n3 - 20) % 10] || e4[n3] || e4[0]) + "]";
        }, "ordinal") }, m3 = /* @__PURE__ */ __name(function(t5, e4, n3) {
          var r3 = String(t5);
          return !r3 || r3.length >= e4 ? t5 : "" + Array(e4 + 1 - r3.length).join(n3) + t5;
        }, "m"), v3 = { s: m3, z: /* @__PURE__ */ __name(function(t5) {
          var e4 = -t5.utcOffset(), n3 = Math.abs(e4), r3 = Math.floor(n3 / 60), i3 = n3 % 60;
          return (e4 <= 0 ? "+" : "-") + m3(r3, 2, "0") + ":" + m3(i3, 2, "0");
        }, "z"), m: /* @__PURE__ */ __name(function t5(e4, n3) {
          if (e4.date() < n3.date()) return -t5(n3, e4);
          var r3 = 12 * (n3.year() - e4.year()) + (n3.month() - e4.month()), i3 = e4.clone().add(r3, c3), s3 = n3 - i3 < 0, u3 = e4.clone().add(r3 + (s3 ? -1 : 1), c3);
          return +(-(r3 + (n3 - i3) / (s3 ? i3 - u3 : u3 - i3)) || 0);
        }, "t"), a: /* @__PURE__ */ __name(function(t5) {
          return t5 < 0 ? Math.ceil(t5) || 0 : Math.floor(t5);
        }, "a"), p: /* @__PURE__ */ __name(function(t5) {
          return { M: c3, y: h3, w: o2, d: a2, D: d3, h: u2, m: s2, s: i2, ms: r2, Q: f2 }[t5] || String(t5 || "").toLowerCase().replace(/s$/, "");
        }, "p"), u: /* @__PURE__ */ __name(function(t5) {
          return void 0 === t5;
        }, "u") }, g2 = "en", D4 = {};
        D4[g2] = M3;
        var p3 = "$isDayjsObject", S4 = /* @__PURE__ */ __name(function(t5) {
          return t5 instanceof _3 || !(!t5 || !t5[p3]);
        }, "S"), w4 = /* @__PURE__ */ __name(function t5(e4, n3, r3) {
          var i3;
          if (!e4) return g2;
          if ("string" == typeof e4) {
            var s3 = e4.toLowerCase();
            D4[s3] && (i3 = s3), n3 && (D4[s3] = n3, i3 = s3);
            var u3 = e4.split("-");
            if (!i3 && u3.length > 1) return t5(u3[0]);
          } else {
            var a3 = e4.name;
            D4[a3] = e4, i3 = a3;
          }
          return !r3 && i3 && (g2 = i3), i3 || !r3 && g2;
        }, "t"), O3 = /* @__PURE__ */ __name(function(t5, e4) {
          if (S4(t5)) return t5.clone();
          var n3 = "object" == typeof e4 ? e4 : {};
          return n3.date = t5, n3.args = arguments, new _3(n3);
        }, "O"), b3 = v3;
        b3.l = w4, b3.i = S4, b3.w = function(t5, e4) {
          return O3(t5, { locale: e4.$L, utc: e4.$u, x: e4.$x, $offset: e4.$offset });
        };
        var _3 = (function() {
          function M4(t5) {
            this.$L = w4(t5.locale, null, true), this.parse(t5), this.$x = this.$x || t5.x || {}, this[p3] = true;
          }
          __name(M4, "M");
          var m4 = M4.prototype;
          return m4.parse = function(t5) {
            this.$d = (function(t6) {
              var e4 = t6.date, n3 = t6.utc;
              if (null === e4) return /* @__PURE__ */ new Date(NaN);
              if (b3.u(e4)) return /* @__PURE__ */ new Date();
              if (e4 instanceof Date) return new Date(e4);
              if ("string" == typeof e4 && !/Z$/i.test(e4)) {
                var r3 = e4.match($4);
                if (r3) {
                  var i3 = r3[2] - 1 || 0, s3 = (r3[7] || "0").substring(0, 3);
                  return n3 ? new Date(Date.UTC(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3)) : new Date(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3);
                }
              }
              return new Date(e4);
            })(t5), this.init();
          }, m4.init = function() {
            var t5 = this.$d;
            this.$y = t5.getFullYear(), this.$M = t5.getMonth(), this.$D = t5.getDate(), this.$W = t5.getDay(), this.$H = t5.getHours(), this.$m = t5.getMinutes(), this.$s = t5.getSeconds(), this.$ms = t5.getMilliseconds();
          }, m4.$utils = function() {
            return b3;
          }, m4.isValid = function() {
            return !(this.$d.toString() === l4);
          }, m4.isSame = function(t5, e4) {
            var n3 = O3(t5);
            return this.startOf(e4) <= n3 && n3 <= this.endOf(e4);
          }, m4.isAfter = function(t5, e4) {
            return O3(t5) < this.startOf(e4);
          }, m4.isBefore = function(t5, e4) {
            return this.endOf(e4) < O3(t5);
          }, m4.$g = function(t5, e4, n3) {
            return b3.u(t5) ? this[e4] : this.set(n3, t5);
          }, m4.unix = function() {
            return Math.floor(this.valueOf() / 1e3);
          }, m4.valueOf = function() {
            return this.$d.getTime();
          }, m4.startOf = function(t5, e4) {
            var n3 = this, r3 = !!b3.u(e4) || e4, f3 = b3.p(t5), l5 = /* @__PURE__ */ __name(function(t6, e6) {
              var i3 = b3.w(n3.$u ? Date.UTC(n3.$y, e6, t6) : new Date(n3.$y, e6, t6), n3);
              return r3 ? i3 : i3.endOf(a2);
            }, "l"), $5 = /* @__PURE__ */ __name(function(t6, e6) {
              return b3.w(n3.toDate()[t6].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e6)), n3);
            }, "$"), y7 = this.$W, M5 = this.$M, m5 = this.$D, v5 = "set" + (this.$u ? "UTC" : "");
            switch (f3) {
              case h3:
                return r3 ? l5(1, 0) : l5(31, 11);
              case c3:
                return r3 ? l5(1, M5) : l5(0, M5 + 1);
              case o2:
                var g3 = this.$locale().weekStart || 0, D5 = (y7 < g3 ? y7 + 7 : y7) - g3;
                return l5(r3 ? m5 - D5 : m5 + (6 - D5), M5);
              case a2:
              case d3:
                return $5(v5 + "Hours", 0);
              case u2:
                return $5(v5 + "Minutes", 1);
              case s2:
                return $5(v5 + "Seconds", 2);
              case i2:
                return $5(v5 + "Milliseconds", 3);
              default:
                return this.clone();
            }
          }, m4.endOf = function(t5) {
            return this.startOf(t5, false);
          }, m4.$set = function(t5, e4) {
            var n3, o3 = b3.p(t5), f3 = "set" + (this.$u ? "UTC" : ""), l5 = (n3 = {}, n3[a2] = f3 + "Date", n3[d3] = f3 + "Date", n3[c3] = f3 + "Month", n3[h3] = f3 + "FullYear", n3[u2] = f3 + "Hours", n3[s2] = f3 + "Minutes", n3[i2] = f3 + "Seconds", n3[r2] = f3 + "Milliseconds", n3)[o3], $5 = o3 === a2 ? this.$D + (e4 - this.$W) : e4;
            if (o3 === c3 || o3 === h3) {
              var y7 = this.clone().set(d3, 1);
              y7.$d[l5]($5), y7.init(), this.$d = y7.set(d3, Math.min(this.$D, y7.daysInMonth())).$d;
            } else l5 && this.$d[l5]($5);
            return this.init(), this;
          }, m4.set = function(t5, e4) {
            return this.clone().$set(t5, e4);
          }, m4.get = function(t5) {
            return this[b3.p(t5)]();
          }, m4.add = function(r3, f3) {
            var d4, l5 = this;
            r3 = Number(r3);
            var $5 = b3.p(f3), y7 = /* @__PURE__ */ __name(function(t5) {
              var e4 = O3(l5);
              return b3.w(e4.date(e4.date() + Math.round(t5 * r3)), l5);
            }, "y");
            if ($5 === c3) return this.set(c3, this.$M + r3);
            if ($5 === h3) return this.set(h3, this.$y + r3);
            if ($5 === a2) return y7(1);
            if ($5 === o2) return y7(7);
            var M5 = (d4 = {}, d4[s2] = e3, d4[u2] = n2, d4[i2] = t4, d4)[$5] || 1, m5 = this.$d.getTime() + r3 * M5;
            return b3.w(m5, this);
          }, m4.subtract = function(t5, e4) {
            return this.add(-1 * t5, e4);
          }, m4.format = function(t5) {
            var e4 = this, n3 = this.$locale();
            if (!this.isValid()) return n3.invalidDate || l4;
            var r3 = t5 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b3.z(this), s3 = this.$H, u3 = this.$m, a3 = this.$M, o3 = n3.weekdays, c4 = n3.months, f3 = n3.meridiem, h4 = /* @__PURE__ */ __name(function(t6, n4, i4, s4) {
              return t6 && (t6[n4] || t6(e4, r3)) || i4[n4].slice(0, s4);
            }, "h"), d4 = /* @__PURE__ */ __name(function(t6) {
              return b3.s(s3 % 12 || 12, t6, "0");
            }, "d"), $5 = f3 || function(t6, e6, n4) {
              var r4 = t6 < 12 ? "AM" : "PM";
              return n4 ? r4.toLowerCase() : r4;
            };
            return r3.replace(y6, (function(t6, r4) {
              return r4 || (function(t7) {
                switch (t7) {
                  case "YY":
                    return String(e4.$y).slice(-2);
                  case "YYYY":
                    return b3.s(e4.$y, 4, "0");
                  case "M":
                    return a3 + 1;
                  case "MM":
                    return b3.s(a3 + 1, 2, "0");
                  case "MMM":
                    return h4(n3.monthsShort, a3, c4, 3);
                  case "MMMM":
                    return h4(c4, a3);
                  case "D":
                    return e4.$D;
                  case "DD":
                    return b3.s(e4.$D, 2, "0");
                  case "d":
                    return String(e4.$W);
                  case "dd":
                    return h4(n3.weekdaysMin, e4.$W, o3, 2);
                  case "ddd":
                    return h4(n3.weekdaysShort, e4.$W, o3, 3);
                  case "dddd":
                    return o3[e4.$W];
                  case "H":
                    return String(s3);
                  case "HH":
                    return b3.s(s3, 2, "0");
                  case "h":
                    return d4(1);
                  case "hh":
                    return d4(2);
                  case "a":
                    return $5(s3, u3, true);
                  case "A":
                    return $5(s3, u3, false);
                  case "m":
                    return String(u3);
                  case "mm":
                    return b3.s(u3, 2, "0");
                  case "s":
                    return String(e4.$s);
                  case "ss":
                    return b3.s(e4.$s, 2, "0");
                  case "SSS":
                    return b3.s(e4.$ms, 3, "0");
                  case "Z":
                    return i3;
                }
                return null;
              })(t6) || i3.replace(":", "");
            }));
          }, m4.utcOffset = function() {
            return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
          }, m4.diff = function(r3, d4, l5) {
            var $5, y7 = this, M5 = b3.p(d4), m5 = O3(r3), v5 = (m5.utcOffset() - this.utcOffset()) * e3, g3 = this - m5, D5 = /* @__PURE__ */ __name(function() {
              return b3.m(y7, m5);
            }, "D");
            switch (M5) {
              case h3:
                $5 = D5() / 12;
                break;
              case c3:
                $5 = D5();
                break;
              case f2:
                $5 = D5() / 3;
                break;
              case o2:
                $5 = (g3 - v5) / 6048e5;
                break;
              case a2:
                $5 = (g3 - v5) / 864e5;
                break;
              case u2:
                $5 = g3 / n2;
                break;
              case s2:
                $5 = g3 / e3;
                break;
              case i2:
                $5 = g3 / t4;
                break;
              default:
                $5 = g3;
            }
            return l5 ? $5 : b3.a($5);
          }, m4.daysInMonth = function() {
            return this.endOf(c3).$D;
          }, m4.$locale = function() {
            return D4[this.$L];
          }, m4.locale = function(t5, e4) {
            if (!t5) return this.$L;
            var n3 = this.clone(), r3 = w4(t5, e4, true);
            return r3 && (n3.$L = r3), n3;
          }, m4.clone = function() {
            return b3.w(this.$d, this);
          }, m4.toDate = function() {
            return new Date(this.valueOf());
          }, m4.toJSON = function() {
            return this.isValid() ? this.toISOString() : null;
          }, m4.toISOString = function() {
            return this.$d.toISOString();
          }, m4.toString = function() {
            return this.$d.toUTCString();
          }, M4;
        })(), k2 = _3.prototype;
        return O3.prototype = k2, [["$ms", r2], ["$s", i2], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", c3], ["$y", h3], ["$D", d3]].forEach((function(t5) {
          k2[t5[1]] = function(e4) {
            return this.$g(e4, t5[0], t5[1]);
          };
        })), O3.extend = function(t5, e4) {
          return t5.$i || (t5(e4, _3, O3), t5.$i = true), O3;
        }, O3.locale = w4, O3.isDayjs = S4, O3.unix = function(t5) {
          return O3(1e3 * t5);
        }, O3.en = D4[g2], O3.Ls = D4, O3.p = {}, O3;
      }));
    }
  });

  // src/logger.ts
  var import_dayjs, LEVELS, log, setLogLevel, format;
  var init_logger = __esm({
    "src/logger.ts"() {
      "use strict";
      import_dayjs = __toESM(require_dayjs_min(), 1);
      LEVELS = {
        trace: 0,
        debug: 1,
        info: 2,
        warn: 3,
        error: 4,
        fatal: 5
      };
      log = {
        trace: /* @__PURE__ */ __name((..._args) => {
        }, "trace"),
        debug: /* @__PURE__ */ __name((..._args) => {
        }, "debug"),
        info: /* @__PURE__ */ __name((..._args) => {
        }, "info"),
        warn: /* @__PURE__ */ __name((..._args) => {
        }, "warn"),
        error: /* @__PURE__ */ __name((..._args) => {
        }, "error"),
        fatal: /* @__PURE__ */ __name((..._args) => {
        }, "fatal")
      };
      setLogLevel = /* @__PURE__ */ __name(function(level = "fatal") {
        let numericLevel = LEVELS.fatal;
        if (typeof level === "string") {
          if (level.toLowerCase() in LEVELS) {
            numericLevel = LEVELS[level];
          }
        } else if (typeof level === "number") {
          numericLevel = level;
        }
        log.trace = () => {
        };
        log.debug = () => {
        };
        log.info = () => {
        };
        log.warn = () => {
        };
        log.error = () => {
        };
        log.fatal = () => {
        };
        if (numericLevel <= LEVELS.fatal) {
          log.fatal = console.error ? console.error.bind(console, format("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", format("FATAL"));
        }
        if (numericLevel <= LEVELS.error) {
          log.error = console.error ? console.error.bind(console, format("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", format("ERROR"));
        }
        if (numericLevel <= LEVELS.warn) {
          log.warn = console.warn ? console.warn.bind(console, format("WARN"), "color: orange") : console.log.bind(console, `\x1B[33m`, format("WARN"));
        }
        if (numericLevel <= LEVELS.info) {
          log.info = console.info ? console.info.bind(console, format("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", format("INFO"));
        }
        if (numericLevel <= LEVELS.debug) {
          log.debug = console.debug ? console.debug.bind(console, format("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("DEBUG"));
        }
        if (numericLevel <= LEVELS.trace) {
          log.trace = console.debug ? console.debug.bind(console, format("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("TRACE"));
        }
      }, "setLogLevel");
      format = /* @__PURE__ */ __name((level) => {
        const time4 = (0, import_dayjs.default)().format("ss.SSS");
        return `%c${time4} : ${level} : `;
      }, "format");
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/channel.js
  var Channel, channel_default;
  var init_channel = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/channel.js"() {
      "use strict";
      Channel = {
        /* CLAMP */
        min: {
          r: 0,
          g: 0,
          b: 0,
          s: 0,
          l: 0,
          a: 0
        },
        max: {
          r: 255,
          g: 255,
          b: 255,
          h: 360,
          s: 100,
          l: 100,
          a: 1
        },
        clamp: {
          r: /* @__PURE__ */ __name((r2) => r2 >= 255 ? 255 : r2 < 0 ? 0 : r2, "r"),
          g: /* @__PURE__ */ __name((g2) => g2 >= 255 ? 255 : g2 < 0 ? 0 : g2, "g"),
          b: /* @__PURE__ */ __name((b3) => b3 >= 255 ? 255 : b3 < 0 ? 0 : b3, "b"),
          h: /* @__PURE__ */ __name((h3) => h3 % 360, "h"),
          s: /* @__PURE__ */ __name((s2) => s2 >= 100 ? 100 : s2 < 0 ? 0 : s2, "s"),
          l: /* @__PURE__ */ __name((l4) => l4 >= 100 ? 100 : l4 < 0 ? 0 : l4, "l"),
          a: /* @__PURE__ */ __name((a2) => a2 >= 1 ? 1 : a2 < 0 ? 0 : a2, "a")
        },
        /* CONVERSION */
        //SOURCE: https://planetcalc.com/7779
        toLinear: /* @__PURE__ */ __name((c3) => {
          const n2 = c3 / 255;
          return c3 > 0.03928 ? Math.pow((n2 + 0.055) / 1.055, 2.4) : n2 / 12.92;
        }, "toLinear"),
        //SOURCE: https://gist.github.com/mjackson/5311256
        hue2rgb: /* @__PURE__ */ __name((p3, q3, t4) => {
          if (t4 < 0)
            t4 += 1;
          if (t4 > 1)
            t4 -= 1;
          if (t4 < 1 / 6)
            return p3 + (q3 - p3) * 6 * t4;
          if (t4 < 1 / 2)
            return q3;
          if (t4 < 2 / 3)
            return p3 + (q3 - p3) * (2 / 3 - t4) * 6;
          return p3;
        }, "hue2rgb"),
        hsl2rgb: /* @__PURE__ */ __name(({ h: h3, s: s2, l: l4 }, channel2) => {
          if (!s2)
            return l4 * 2.55;
          h3 /= 360;
          s2 /= 100;
          l4 /= 100;
          const q3 = l4 < 0.5 ? l4 * (1 + s2) : l4 + s2 - l4 * s2;
          const p3 = 2 * l4 - q3;
          switch (channel2) {
            case "r":
              return Channel.hue2rgb(p3, q3, h3 + 1 / 3) * 255;
            case "g":
              return Channel.hue2rgb(p3, q3, h3) * 255;
            case "b":
              return Channel.hue2rgb(p3, q3, h3 - 1 / 3) * 255;
          }
        }, "hsl2rgb"),
        rgb2hsl: /* @__PURE__ */ __name(({ r: r2, g: g2, b: b3 }, channel2) => {
          r2 /= 255;
          g2 /= 255;
          b3 /= 255;
          const max10 = Math.max(r2, g2, b3);
          const min9 = Math.min(r2, g2, b3);
          const l4 = (max10 + min9) / 2;
          if (channel2 === "l")
            return l4 * 100;
          if (max10 === min9)
            return 0;
          const d3 = max10 - min9;
          const s2 = l4 > 0.5 ? d3 / (2 - max10 - min9) : d3 / (max10 + min9);
          if (channel2 === "s")
            return s2 * 100;
          switch (max10) {
            case r2:
              return ((g2 - b3) / d3 + (g2 < b3 ? 6 : 0)) * 60;
            case g2:
              return ((b3 - r2) / d3 + 2) * 60;
            case b3:
              return ((r2 - g2) / d3 + 4) * 60;
            default:
              return -1;
          }
        }, "rgb2hsl")
      };
      channel_default = Channel;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/lang.js
  var Lang, lang_default;
  var init_lang = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/lang.js"() {
      "use strict";
      Lang = {
        /* API */
        clamp: /* @__PURE__ */ __name((number7, lower2, upper) => {
          if (lower2 > upper)
            return Math.min(lower2, Math.max(upper, number7));
          return Math.min(upper, Math.max(lower2, number7));
        }, "clamp"),
        round: /* @__PURE__ */ __name((number7) => {
          return Math.round(number7 * 1e10) / 1e10;
        }, "round")
      };
      lang_default = Lang;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/unit.js
  var Unit, unit_default;
  var init_unit = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/unit.js"() {
      "use strict";
      Unit = {
        /* API */
        dec2hex: /* @__PURE__ */ __name((dec) => {
          const hex2 = Math.round(dec).toString(16);
          return hex2.length > 1 ? hex2 : `0${hex2}`;
        }, "dec2hex")
      };
      unit_default = Unit;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/index.js
  var Utils, utils_default;
  var init_utils = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/index.js"() {
      "use strict";
      init_channel();
      init_lang();
      init_unit();
      Utils = {
        channel: channel_default,
        lang: lang_default,
        unit: unit_default
      };
      utils_default = Utils;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/constants.js
  var DEC2HEX, TYPE;
  var init_constants = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/constants.js"() {
      "use strict";
      init_utils();
      DEC2HEX = {};
      for (let i2 = 0; i2 <= 255; i2++)
        DEC2HEX[i2] = utils_default.unit.dec2hex(i2);
      TYPE = {
        ALL: 0,
        RGB: 1,
        HSL: 2
      };
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/type.js
  var Type, type_default;
  var init_type = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/type.js"() {
      "use strict";
      init_constants();
      Type = class {
        static {
          __name(this, "Type");
        }
        constructor() {
          this.type = TYPE.ALL;
        }
        /* API */
        get() {
          return this.type;
        }
        set(type3) {
          if (this.type && this.type !== type3)
            throw new Error("Cannot change both RGB and HSL channels at the same time");
          this.type = type3;
        }
        reset() {
          this.type = TYPE.ALL;
        }
        is(type3) {
          return this.type === type3;
        }
      };
      type_default = Type;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/index.js
  var Channels, channels_default;
  var init_channels = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/index.js"() {
      "use strict";
      init_utils();
      init_type();
      init_constants();
      Channels = class {
        static {
          __name(this, "Channels");
        }
        /* CONSTRUCTOR */
        constructor(data5, color2) {
          this.color = color2;
          this.changed = false;
          this.data = data5;
          this.type = new type_default();
        }
        /* API */
        set(data5, color2) {
          this.color = color2;
          this.changed = false;
          this.data = data5;
          this.type.type = TYPE.ALL;
          return this;
        }
        /* HELPERS */
        _ensureHSL() {
          const data5 = this.data;
          const { h: h3, s: s2, l: l4 } = data5;
          if (h3 === void 0)
            data5.h = utils_default.channel.rgb2hsl(data5, "h");
          if (s2 === void 0)
            data5.s = utils_default.channel.rgb2hsl(data5, "s");
          if (l4 === void 0)
            data5.l = utils_default.channel.rgb2hsl(data5, "l");
        }
        _ensureRGB() {
          const data5 = this.data;
          const { r: r2, g: g2, b: b3 } = data5;
          if (r2 === void 0)
            data5.r = utils_default.channel.hsl2rgb(data5, "r");
          if (g2 === void 0)
            data5.g = utils_default.channel.hsl2rgb(data5, "g");
          if (b3 === void 0)
            data5.b = utils_default.channel.hsl2rgb(data5, "b");
        }
        /* GETTERS */
        get r() {
          const data5 = this.data;
          const r2 = data5.r;
          if (!this.type.is(TYPE.HSL) && r2 !== void 0)
            return r2;
          this._ensureHSL();
          return utils_default.channel.hsl2rgb(data5, "r");
        }
        get g() {
          const data5 = this.data;
          const g2 = data5.g;
          if (!this.type.is(TYPE.HSL) && g2 !== void 0)
            return g2;
          this._ensureHSL();
          return utils_default.channel.hsl2rgb(data5, "g");
        }
        get b() {
          const data5 = this.data;
          const b3 = data5.b;
          if (!this.type.is(TYPE.HSL) && b3 !== void 0)
            return b3;
          this._ensureHSL();
          return utils_default.channel.hsl2rgb(data5, "b");
        }
        get h() {
          const data5 = this.data;
          const h3 = data5.h;
          if (!this.type.is(TYPE.RGB) && h3 !== void 0)
            return h3;
          this._ensureRGB();
          return utils_default.channel.rgb2hsl(data5, "h");
        }
        get s() {
          const data5 = this.data;
          const s2 = data5.s;
          if (!this.type.is(TYPE.RGB) && s2 !== void 0)
            return s2;
          this._ensureRGB();
          return utils_default.channel.rgb2hsl(data5, "s");
        }
        get l() {
          const data5 = this.data;
          const l4 = data5.l;
          if (!this.type.is(TYPE.RGB) && l4 !== void 0)
            return l4;
          this._ensureRGB();
          return utils_default.channel.rgb2hsl(data5, "l");
        }
        get a() {
          return this.data.a;
        }
        /* SETTERS */
        set r(r2) {
          this.type.set(TYPE.RGB);
          this.changed = true;
          this.data.r = r2;
        }
        set g(g2) {
          this.type.set(TYPE.RGB);
          this.changed = true;
          this.data.g = g2;
        }
        set b(b3) {
          this.type.set(TYPE.RGB);
          this.changed = true;
          this.data.b = b3;
        }
        set h(h3) {
          this.type.set(TYPE.HSL);
          this.changed = true;
          this.data.h = h3;
        }
        set s(s2) {
          this.type.set(TYPE.HSL);
          this.changed = true;
          this.data.s = s2;
        }
        set l(l4) {
          this.type.set(TYPE.HSL);
          this.changed = true;
          this.data.l = l4;
        }
        set a(a2) {
          this.changed = true;
          this.data.a = a2;
        }
      };
      channels_default = Channels;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/reusable.js
  var channels, reusable_default;
  var init_reusable = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/reusable.js"() {
      "use strict";
      init_channels();
      channels = new channels_default({ r: 0, g: 0, b: 0, a: 0 }, "transparent");
      reusable_default = channels;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/hex.js
  var Hex, hex_default;
  var init_hex = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/hex.js"() {
      "use strict";
      init_reusable();
      init_constants();
      Hex = {
        /* VARIABLES */
        re: /^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,
        /* API */
        parse: /* @__PURE__ */ __name((color2) => {
          if (color2.charCodeAt(0) !== 35)
            return;
          const match2 = color2.match(Hex.re);
          if (!match2)
            return;
          const hex2 = match2[1];
          const dec = parseInt(hex2, 16);
          const length2 = hex2.length;
          const hasAlpha = length2 % 4 === 0;
          const isFullLength = length2 > 4;
          const multiplier = isFullLength ? 1 : 17;
          const bits = isFullLength ? 8 : 4;
          const bitsOffset = hasAlpha ? 0 : -1;
          const mask = isFullLength ? 255 : 15;
          return reusable_default.set({
            r: (dec >> bits * (bitsOffset + 3) & mask) * multiplier,
            g: (dec >> bits * (bitsOffset + 2) & mask) * multiplier,
            b: (dec >> bits * (bitsOffset + 1) & mask) * multiplier,
            a: hasAlpha ? (dec & mask) * multiplier / 255 : 1
          }, color2);
        }, "parse"),
        stringify: /* @__PURE__ */ __name((channels2) => {
          const { r: r2, g: g2, b: b3, a: a2 } = channels2;
          if (a2 < 1) {
            return `#${DEC2HEX[Math.round(r2)]}${DEC2HEX[Math.round(g2)]}${DEC2HEX[Math.round(b3)]}${DEC2HEX[Math.round(a2 * 255)]}`;
          } else {
            return `#${DEC2HEX[Math.round(r2)]}${DEC2HEX[Math.round(g2)]}${DEC2HEX[Math.round(b3)]}`;
          }
        }, "stringify")
      };
      hex_default = Hex;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/hsl.js
  var HSL, hsl_default;
  var init_hsl = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/hsl.js"() {
      "use strict";
      init_utils();
      init_reusable();
      HSL = {
        /* VARIABLES */
        re: /^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,
        hueRe: /^(.+?)(deg|grad|rad|turn)$/i,
        /* HELPERS */
        _hue2deg: /* @__PURE__ */ __name((hue2) => {
          const match2 = hue2.match(HSL.hueRe);
          if (match2) {
            const [, number7, unit2] = match2;
            switch (unit2) {
              case "grad":
                return utils_default.channel.clamp.h(parseFloat(number7) * 0.9);
              case "rad":
                return utils_default.channel.clamp.h(parseFloat(number7) * 180 / Math.PI);
              case "turn":
                return utils_default.channel.clamp.h(parseFloat(number7) * 360);
            }
          }
          return utils_default.channel.clamp.h(parseFloat(hue2));
        }, "_hue2deg"),
        /* API */
        parse: /* @__PURE__ */ __name((color2) => {
          const charCode = color2.charCodeAt(0);
          if (charCode !== 104 && charCode !== 72)
            return;
          const match2 = color2.match(HSL.re);
          if (!match2)
            return;
          const [, h3, s2, l4, a2, isAlphaPercentage] = match2;
          return reusable_default.set({
            h: HSL._hue2deg(h3),
            s: utils_default.channel.clamp.s(parseFloat(s2)),
            l: utils_default.channel.clamp.l(parseFloat(l4)),
            a: a2 ? utils_default.channel.clamp.a(isAlphaPercentage ? parseFloat(a2) / 100 : parseFloat(a2)) : 1
          }, color2);
        }, "parse"),
        stringify: /* @__PURE__ */ __name((channels2) => {
          const { h: h3, s: s2, l: l4, a: a2 } = channels2;
          if (a2 < 1) {
            return `hsla(${utils_default.lang.round(h3)}, ${utils_default.lang.round(s2)}%, ${utils_default.lang.round(l4)}%, ${a2})`;
          } else {
            return `hsl(${utils_default.lang.round(h3)}, ${utils_default.lang.round(s2)}%, ${utils_default.lang.round(l4)}%)`;
          }
        }, "stringify")
      };
      hsl_default = HSL;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/keyword.js
  var Keyword, keyword_default;
  var init_keyword = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/keyword.js"() {
      "use strict";
      init_hex();
      Keyword = {
        /* VARIABLES */
        colors: {
          aliceblue: "#f0f8ff",
          antiquewhite: "#faebd7",
          aqua: "#00ffff",
          aquamarine: "#7fffd4",
          azure: "#f0ffff",
          beige: "#f5f5dc",
          bisque: "#ffe4c4",
          black: "#000000",
          blanchedalmond: "#ffebcd",
          blue: "#0000ff",
          blueviolet: "#8a2be2",
          brown: "#a52a2a",
          burlywood: "#deb887",
          cadetblue: "#5f9ea0",
          chartreuse: "#7fff00",
          chocolate: "#d2691e",
          coral: "#ff7f50",
          cornflowerblue: "#6495ed",
          cornsilk: "#fff8dc",
          crimson: "#dc143c",
          cyanaqua: "#00ffff",
          darkblue: "#00008b",
          darkcyan: "#008b8b",
          darkgoldenrod: "#b8860b",
          darkgray: "#a9a9a9",
          darkgreen: "#006400",
          darkgrey: "#a9a9a9",
          darkkhaki: "#bdb76b",
          darkmagenta: "#8b008b",
          darkolivegreen: "#556b2f",
          darkorange: "#ff8c00",
          darkorchid: "#9932cc",
          darkred: "#8b0000",
          darksalmon: "#e9967a",
          darkseagreen: "#8fbc8f",
          darkslateblue: "#483d8b",
          darkslategray: "#2f4f4f",
          darkslategrey: "#2f4f4f",
          darkturquoise: "#00ced1",
          darkviolet: "#9400d3",
          deeppink: "#ff1493",
          deepskyblue: "#00bfff",
          dimgray: "#696969",
          dimgrey: "#696969",
          dodgerblue: "#1e90ff",
          firebrick: "#b22222",
          floralwhite: "#fffaf0",
          forestgreen: "#228b22",
          fuchsia: "#ff00ff",
          gainsboro: "#dcdcdc",
          ghostwhite: "#f8f8ff",
          gold: "#ffd700",
          goldenrod: "#daa520",
          gray: "#808080",
          green: "#008000",
          greenyellow: "#adff2f",
          grey: "#808080",
          honeydew: "#f0fff0",
          hotpink: "#ff69b4",
          indianred: "#cd5c5c",
          indigo: "#4b0082",
          ivory: "#fffff0",
          khaki: "#f0e68c",
          lavender: "#e6e6fa",
          lavenderblush: "#fff0f5",
          lawngreen: "#7cfc00",
          lemonchiffon: "#fffacd",
          lightblue: "#add8e6",
          lightcoral: "#f08080",
          lightcyan: "#e0ffff",
          lightgoldenrodyellow: "#fafad2",
          lightgray: "#d3d3d3",
          lightgreen: "#90ee90",
          lightgrey: "#d3d3d3",
          lightpink: "#ffb6c1",
          lightsalmon: "#ffa07a",
          lightseagreen: "#20b2aa",
          lightskyblue: "#87cefa",
          lightslategray: "#778899",
          lightslategrey: "#778899",
          lightsteelblue: "#b0c4de",
          lightyellow: "#ffffe0",
          lime: "#00ff00",
          limegreen: "#32cd32",
          linen: "#faf0e6",
          magenta: "#ff00ff",
          maroon: "#800000",
          mediumaquamarine: "#66cdaa",
          mediumblue: "#0000cd",
          mediumorchid: "#ba55d3",
          mediumpurple: "#9370db",
          mediumseagreen: "#3cb371",
          mediumslateblue: "#7b68ee",
          mediumspringgreen: "#00fa9a",
          mediumturquoise: "#48d1cc",
          mediumvioletred: "#c71585",
          midnightblue: "#191970",
          mintcream: "#f5fffa",
          mistyrose: "#ffe4e1",
          moccasin: "#ffe4b5",
          navajowhite: "#ffdead",
          navy: "#000080",
          oldlace: "#fdf5e6",
          olive: "#808000",
          olivedrab: "#6b8e23",
          orange: "#ffa500",
          orangered: "#ff4500",
          orchid: "#da70d6",
          palegoldenrod: "#eee8aa",
          palegreen: "#98fb98",
          paleturquoise: "#afeeee",
          palevioletred: "#db7093",
          papayawhip: "#ffefd5",
          peachpuff: "#ffdab9",
          peru: "#cd853f",
          pink: "#ffc0cb",
          plum: "#dda0dd",
          powderblue: "#b0e0e6",
          purple: "#800080",
          rebeccapurple: "#663399",
          red: "#ff0000",
          rosybrown: "#bc8f8f",
          royalblue: "#4169e1",
          saddlebrown: "#8b4513",
          salmon: "#fa8072",
          sandybrown: "#f4a460",
          seagreen: "#2e8b57",
          seashell: "#fff5ee",
          sienna: "#a0522d",
          silver: "#c0c0c0",
          skyblue: "#87ceeb",
          slateblue: "#6a5acd",
          slategray: "#708090",
          slategrey: "#708090",
          snow: "#fffafa",
          springgreen: "#00ff7f",
          tan: "#d2b48c",
          teal: "#008080",
          thistle: "#d8bfd8",
          transparent: "#00000000",
          turquoise: "#40e0d0",
          violet: "#ee82ee",
          wheat: "#f5deb3",
          white: "#ffffff",
          whitesmoke: "#f5f5f5",
          yellow: "#ffff00",
          yellowgreen: "#9acd32"
        },
        /* API */
        parse: /* @__PURE__ */ __name((color2) => {
          color2 = color2.toLowerCase();
          const hex2 = Keyword.colors[color2];
          if (!hex2)
            return;
          return hex_default.parse(hex2);
        }, "parse"),
        stringify: /* @__PURE__ */ __name((channels2) => {
          const hex2 = hex_default.stringify(channels2);
          for (const name in Keyword.colors) {
            if (Keyword.colors[name] === hex2)
              return name;
          }
          return;
        }, "stringify")
      };
      keyword_default = Keyword;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/rgb.js
  var RGB, rgb_default;
  var init_rgb = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/rgb.js"() {
      "use strict";
      init_utils();
      init_reusable();
      RGB = {
        /* VARIABLES */
        re: /^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,
        /* API */
        parse: /* @__PURE__ */ __name((color2) => {
          const charCode = color2.charCodeAt(0);
          if (charCode !== 114 && charCode !== 82)
            return;
          const match2 = color2.match(RGB.re);
          if (!match2)
            return;
          const [, r2, isRedPercentage, g2, isGreenPercentage, b3, isBluePercentage, a2, isAlphaPercentage] = match2;
          return reusable_default.set({
            r: utils_default.channel.clamp.r(isRedPercentage ? parseFloat(r2) * 2.55 : parseFloat(r2)),
            g: utils_default.channel.clamp.g(isGreenPercentage ? parseFloat(g2) * 2.55 : parseFloat(g2)),
            b: utils_default.channel.clamp.b(isBluePercentage ? parseFloat(b3) * 2.55 : parseFloat(b3)),
            a: a2 ? utils_default.channel.clamp.a(isAlphaPercentage ? parseFloat(a2) / 100 : parseFloat(a2)) : 1
          }, color2);
        }, "parse"),
        stringify: /* @__PURE__ */ __name((channels2) => {
          const { r: r2, g: g2, b: b3, a: a2 } = channels2;
          if (a2 < 1) {
            return `rgba(${utils_default.lang.round(r2)}, ${utils_default.lang.round(g2)}, ${utils_default.lang.round(b3)}, ${utils_default.lang.round(a2)})`;
          } else {
            return `rgb(${utils_default.lang.round(r2)}, ${utils_default.lang.round(g2)}, ${utils_default.lang.round(b3)})`;
          }
        }, "stringify")
      };
      rgb_default = RGB;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/index.js
  var Color, color_default;
  var init_color = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/index.js"() {
      "use strict";
      init_hex();
      init_hsl();
      init_keyword();
      init_rgb();
      init_constants();
      Color = {
        /* VARIABLES */
        format: {
          keyword: keyword_default,
          hex: hex_default,
          rgb: rgb_default,
          rgba: rgb_default,
          hsl: hsl_default,
          hsla: hsl_default
        },
        /* API */
        parse: /* @__PURE__ */ __name((color2) => {
          if (typeof color2 !== "string")
            return color2;
          const channels2 = hex_default.parse(color2) || rgb_default.parse(color2) || hsl_default.parse(color2) || keyword_default.parse(color2);
          if (channels2)
            return channels2;
          throw new Error(`Unsupported color format: "${color2}"`);
        }, "parse"),
        stringify: /* @__PURE__ */ __name((channels2) => {
          if (!channels2.changed && channels2.color)
            return channels2.color;
          if (channels2.type.is(TYPE.HSL) || channels2.data.r === void 0) {
            return hsl_default.stringify(channels2);
          } else if (channels2.a < 1 || !Number.isInteger(channels2.r) || !Number.isInteger(channels2.g) || !Number.isInteger(channels2.b)) {
            return rgb_default.stringify(channels2);
          } else {
            return hex_default.stringify(channels2);
          }
        }, "stringify")
      };
      color_default = Color;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/change.js
  var change, change_default;
  var init_change = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/change.js"() {
      "use strict";
      init_utils();
      init_color();
      change = /* @__PURE__ */ __name((color2, channels2) => {
        const ch = color_default.parse(color2);
        for (const c3 in channels2) {
          ch[c3] = utils_default.channel.clamp[c3](channels2[c3]);
        }
        return color_default.stringify(ch);
      }, "change");
      change_default = change;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/rgba.js
  var rgba, rgba_default;
  var init_rgba = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/rgba.js"() {
      "use strict";
      init_utils();
      init_reusable();
      init_color();
      init_change();
      rgba = /* @__PURE__ */ __name((r2, g2, b3 = 0, a2 = 1) => {
        if (typeof r2 !== "number")
          return change_default(r2, { a: g2 });
        const channels2 = reusable_default.set({
          r: utils_default.channel.clamp.r(r2),
          g: utils_default.channel.clamp.g(g2),
          b: utils_default.channel.clamp.b(b3),
          a: utils_default.channel.clamp.a(a2)
        });
        return color_default.stringify(channels2);
      }, "rgba");
      rgba_default = rgba;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/channel.js
  var channel, channel_default2;
  var init_channel2 = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/channel.js"() {
      "use strict";
      init_utils();
      init_color();
      channel = /* @__PURE__ */ __name((color2, channel2) => {
        return utils_default.lang.round(color_default.parse(color2)[channel2]);
      }, "channel");
      channel_default2 = channel;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/luminance.js
  var luminance, luminance_default;
  var init_luminance = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/luminance.js"() {
      "use strict";
      init_utils();
      init_color();
      luminance = /* @__PURE__ */ __name((color2) => {
        const { r: r2, g: g2, b: b3 } = color_default.parse(color2);
        const luminance2 = 0.2126 * utils_default.channel.toLinear(r2) + 0.7152 * utils_default.channel.toLinear(g2) + 0.0722 * utils_default.channel.toLinear(b3);
        return utils_default.lang.round(luminance2);
      }, "luminance");
      luminance_default = luminance;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/is_light.js
  var isLight, is_light_default;
  var init_is_light = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/is_light.js"() {
      "use strict";
      init_luminance();
      isLight = /* @__PURE__ */ __name((color2) => {
        return luminance_default(color2) >= 0.5;
      }, "isLight");
      is_light_default = isLight;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/is_dark.js
  var isDark, is_dark_default;
  var init_is_dark = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/is_dark.js"() {
      "use strict";
      init_is_light();
      isDark = /* @__PURE__ */ __name((color2) => {
        return !is_light_default(color2);
      }, "isDark");
      is_dark_default = isDark;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/adjust_channel.js
  var adjustChannel, adjust_channel_default;
  var init_adjust_channel = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/adjust_channel.js"() {
      "use strict";
      init_utils();
      init_color();
      adjustChannel = /* @__PURE__ */ __name((color2, channel2, amount) => {
        const channels2 = color_default.parse(color2);
        const amountCurrent = channels2[channel2];
        const amountNext = utils_default.channel.clamp[channel2](amountCurrent + amount);
        if (amountCurrent !== amountNext)
          channels2[channel2] = amountNext;
        return color_default.stringify(channels2);
      }, "adjustChannel");
      adjust_channel_default = adjustChannel;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/lighten.js
  var lighten, lighten_default;
  var init_lighten = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/lighten.js"() {
      "use strict";
      init_adjust_channel();
      lighten = /* @__PURE__ */ __name((color2, amount) => {
        return adjust_channel_default(color2, "l", amount);
      }, "lighten");
      lighten_default = lighten;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/darken.js
  var darken, darken_default;
  var init_darken = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/darken.js"() {
      "use strict";
      init_adjust_channel();
      darken = /* @__PURE__ */ __name((color2, amount) => {
        return adjust_channel_default(color2, "l", -amount);
      }, "darken");
      darken_default = darken;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/transparentize.js
  var transparentize, transparentize_default;
  var init_transparentize = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/transparentize.js"() {
      "use strict";
      init_adjust_channel();
      transparentize = /* @__PURE__ */ __name((color2, amount) => {
        return adjust_channel_default(color2, "a", -amount);
      }, "transparentize");
      transparentize_default = transparentize;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/adjust.js
  var adjust, adjust_default;
  var init_adjust = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/adjust.js"() {
      "use strict";
      init_color();
      init_change();
      adjust = /* @__PURE__ */ __name((color2, channels2) => {
        const ch = color_default.parse(color2);
        const changes = {};
        for (const c3 in channels2) {
          if (!channels2[c3])
            continue;
          changes[c3] = ch[c3] + channels2[c3];
        }
        return change_default(color2, changes);
      }, "adjust");
      adjust_default = adjust;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/mix.js
  var mix, mix_default;
  var init_mix = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/mix.js"() {
      "use strict";
      init_color();
      init_rgba();
      mix = /* @__PURE__ */ __name((color1, color2, weight8 = 50) => {
        const { r: r1, g: g1, b: b1, a: a1 } = color_default.parse(color1);
        const { r: r2, g: g2, b: b22, a: a2 } = color_default.parse(color2);
        const weightScale = weight8 / 100;
        const weightNormalized = weightScale * 2 - 1;
        const alphaDelta = a1 - a2;
        const weight1combined = weightNormalized * alphaDelta === -1 ? weightNormalized : (weightNormalized + alphaDelta) / (1 + weightNormalized * alphaDelta);
        const weight1 = (weight1combined + 1) / 2;
        const weight22 = 1 - weight1;
        const r3 = r1 * weight1 + r2 * weight22;
        const g3 = g1 * weight1 + g2 * weight22;
        const b3 = b1 * weight1 + b22 * weight22;
        const a3 = a1 * weightScale + a2 * (1 - weightScale);
        return rgba_default(r3, g3, b3, a3);
      }, "mix");
      mix_default = mix;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/invert.js
  var invert, invert_default;
  var init_invert = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/invert.js"() {
      "use strict";
      init_color();
      init_mix();
      invert = /* @__PURE__ */ __name((color2, weight8 = 100) => {
        const inverse = color_default.parse(color2);
        inverse.r = 255 - inverse.r;
        inverse.g = 255 - inverse.g;
        inverse.b = 255 - inverse.b;
        return mix_default(inverse, color2, weight8);
      }, "invert");
      invert_default = invert;
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/index.js
  var init_methods = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/index.js"() {
      "use strict";
      init_rgba();
      init_channel2();
      init_is_dark();
      init_lighten();
      init_darken();
      init_transparentize();
      init_adjust();
      init_invert();
    }
  });

  // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/index.js
  var init_dist = __esm({
    "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/index.js"() {
      "use strict";
      init_methods();
    }
  });

  // src/themes/erDiagram-oldHardcodedValues.ts
  var oldAttributeBackgroundColorOdd, oldAttributeBackgroundColorEven;
  var init_erDiagram_oldHardcodedValues = __esm({
    "src/themes/erDiagram-oldHardcodedValues.ts"() {
      "use strict";
      oldAttributeBackgroundColorOdd = "#ffffff";
      oldAttributeBackgroundColorEven = "#f2f2f2";
    }
  });

  // src/themes/theme-helpers.js
  var mkBorder;
  var init_theme_helpers = __esm({
    "src/themes/theme-helpers.js"() {
      "use strict";
      init_dist();
      mkBorder = /* @__PURE__ */ __name((col, darkMode) => darkMode ? adjust_default(col, { s: -40, l: 10 }) : adjust_default(col, { s: -40, l: -10 }), "mkBorder");
    }
  });

  // src/themes/theme-base.js
  var Theme, getThemeVariables;
  var init_theme_base = __esm({
    "src/themes/theme-base.js"() {
      "use strict";
      init_dist();
      init_erDiagram_oldHardcodedValues();
      init_theme_helpers();
      Theme = class {
        static {
          __name(this, "Theme");
        }
        constructor() {
          this.background = "#f4f4f4";
          this.primaryColor = "#fff4dd";
          this.noteBkgColor = "#fff5ad";
          this.noteTextColor = "#333";
          this.THEME_COLOR_LIMIT = 12;
          this.radius = 5;
          this.strokeWidth = 1;
          this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
          this.fontSize = "16px";
          this.useGradient = true;
          this.dropShadow = "drop-shadow( 1px 2px 2px rgba(185,185,185,1))";
        }
        updateColors() {
          this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#333");
          this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 });
          this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 });
          this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode);
          this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode);
          this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode);
          this.noteBkgColor = this.noteBkgColor || "#fff5ad";
          this.noteTextColor = this.noteTextColor || "#333";
          this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor);
          this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor);
          this.lineColor = this.lineColor || invert_default(this.background);
          this.arrowheadColor = this.arrowheadColor || invert_default(this.background);
          this.textColor = this.textColor || this.primaryTextColor;
          this.border2 = this.border2 || this.tertiaryBorderColor;
          this.nodeBkg = this.nodeBkg || this.primaryColor;
          this.mainBkg = this.mainBkg || this.primaryColor;
          this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
          this.clusterBkg = this.clusterBkg || this.tertiaryColor;
          this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
          this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
          this.titleColor = this.titleColor || this.tertiaryTextColor;
          this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
          this.actorBorder = this.actorBorder || this.primaryBorderColor;
          this.actorBkg = this.actorBkg || this.mainBkg;
          this.actorTextColor = this.actorTextColor || this.primaryTextColor;
          this.actorLineColor = this.actorLineColor || this.actorBorder;
          this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
          this.signalColor = this.signalColor || this.textColor;
          this.signalTextColor = this.signalTextColor || this.textColor;
          this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
          this.labelTextColor = this.labelTextColor || this.actorTextColor;
          this.loopTextColor = this.loopTextColor || this.actorTextColor;
          this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10);
          this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
          this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor);
          this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
          this.altSectionBkgColor = this.altSectionBkgColor || "white";
          this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
          this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
          this.excludeBkgColor = this.excludeBkgColor || "#eeeeee";
          this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
          this.taskBkgColor = this.taskBkgColor || this.primaryColor;
          this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
          this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(this.primaryColor, 23);
          this.gridColor = this.gridColor || "lightgrey";
          this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey";
          this.doneTaskBorderColor = this.doneTaskBorderColor || "grey";
          this.critBorderColor = this.critBorderColor || "#ff8888";
          this.critBkgColor = this.critBkgColor || "red";
          this.todayLineColor = this.todayLineColor || "red";
          this.vertLineColor = this.vertLineColor || "navy";
          this.taskTextColor = this.taskTextColor || this.textColor;
          this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
          this.taskTextLightColor = this.taskTextLightColor || this.textColor;
          this.taskTextColor = this.taskTextColor || this.primaryTextColor;
          this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
          this.taskTextClickableColor = this.taskTextClickableColor || "#003163";
          this.noteFontWeight = this.noteFontWeight || "normal";
          this.fontWeight = this.fontWeight || "normal";
          this.personBorder = this.personBorder || this.primaryBorderColor;
          this.personBkg = this.personBkg || this.mainBkg;
          if (this.darkMode) {
            this.rowOdd = this.rowOdd || darken_default(this.mainBkg, 5) || "#ffffff";
            this.rowEven = this.rowEven || darken_default(this.mainBkg, 10);
          } else {
            this.rowOdd = this.rowOdd || lighten_default(this.mainBkg, 75) || "#ffffff";
            this.rowEven = this.rowEven || lighten_default(this.mainBkg, 5);
          }
          this.transitionColor = this.transitionColor || this.lineColor;
          this.transitionLabelColor = this.transitionLabelColor || this.textColor;
          this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
          this.stateBkg = this.stateBkg || this.mainBkg;
          this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
          this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
          this.altBackground = this.altBackground || this.tertiaryColor;
          this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
          this.compositeBorder = this.compositeBorder || this.nodeBorder;
          this.innerEndBackground = this.nodeBorder;
          this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
          this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.specialStateColor = this.lineColor;
          this.cScale0 = this.cScale0 || this.primaryColor;
          this.cScale1 = this.cScale1 || this.secondaryColor;
          this.cScale2 = this.cScale2 || this.tertiaryColor;
          this.cScale3 = this.cScale3 || adjust_default(this.primaryColor, { h: 30 });
          this.cScale4 = this.cScale4 || adjust_default(this.primaryColor, { h: 60 });
          this.cScale5 = this.cScale5 || adjust_default(this.primaryColor, { h: 90 });
          this.cScale6 = this.cScale6 || adjust_default(this.primaryColor, { h: 120 });
          this.cScale7 = this.cScale7 || adjust_default(this.primaryColor, { h: 150 });
          this.cScale8 = this.cScale8 || adjust_default(this.primaryColor, { h: 210, l: 150 });
          this.cScale9 = this.cScale9 || adjust_default(this.primaryColor, { h: 270 });
          this.cScale10 = this.cScale10 || adjust_default(this.primaryColor, { h: 300 });
          this.cScale11 = this.cScale11 || adjust_default(this.primaryColor, { h: 330 });
          if (this.darkMode) {
            for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
              this["cScale" + i2] = darken_default(this["cScale" + i2], 75);
            }
          } else {
            for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
              this["cScale" + i2] = darken_default(this["cScale" + i2], 25);
            }
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]);
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            if (this.darkMode) {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10);
            } else {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10);
            }
          }
          this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor;
          }
          const multiplier = this.darkMode ? -4 : -1;
          for (let i2 = 0; i2 < 5; i2++) {
            this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) });
            this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) });
          }
          this.classText = this.classText || this.textColor;
          this.fillType0 = this.fillType0 || this.primaryColor;
          this.fillType1 = this.fillType1 || this.secondaryColor;
          this.fillType2 = this.fillType2 || adjust_default(this.primaryColor, { h: 64 });
          this.fillType3 = this.fillType3 || adjust_default(this.secondaryColor, { h: 64 });
          this.fillType4 = this.fillType4 || adjust_default(this.primaryColor, { h: -64 });
          this.fillType5 = this.fillType5 || adjust_default(this.secondaryColor, { h: -64 });
          this.fillType6 = this.fillType6 || adjust_default(this.primaryColor, { h: 128 });
          this.fillType7 = this.fillType7 || adjust_default(this.secondaryColor, { h: 128 });
          this.pie1 = this.pie1 || this.primaryColor;
          this.pie2 = this.pie2 || this.secondaryColor;
          this.pie3 = this.pie3 || this.tertiaryColor;
          this.pie4 = this.pie4 || adjust_default(this.primaryColor, { l: -10 });
          this.pie5 = this.pie5 || adjust_default(this.secondaryColor, { l: -10 });
          this.pie6 = this.pie6 || adjust_default(this.tertiaryColor, { l: -10 });
          this.pie7 = this.pie7 || adjust_default(this.primaryColor, { h: 60, l: -10 });
          this.pie8 = this.pie8 || adjust_default(this.primaryColor, { h: -60, l: -10 });
          this.pie9 = this.pie9 || adjust_default(this.primaryColor, { h: 120, l: 0 });
          this.pie10 = this.pie10 || adjust_default(this.primaryColor, { h: 60, l: -20 });
          this.pie11 = this.pie11 || adjust_default(this.primaryColor, { h: -60, l: -20 });
          this.pie12 = this.pie12 || adjust_default(this.primaryColor, { h: 120, l: -10 });
          this.pieTitleTextSize = this.pieTitleTextSize || "25px";
          this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
          this.pieSectionTextSize = this.pieSectionTextSize || "17px";
          this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
          this.pieLegendTextSize = this.pieLegendTextSize || "17px";
          this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
          this.pieStrokeColor = this.pieStrokeColor || "black";
          this.pieStrokeWidth = this.pieStrokeWidth || "2px";
          this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
          this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
          this.pieOpacity = this.pieOpacity || "0.7";
          this.venn1 = this.venn1 ?? adjust_default(this.primaryColor, { l: -30 });
          this.venn2 = this.venn2 ?? adjust_default(this.secondaryColor, { l: -30 });
          this.venn3 = this.venn3 ?? adjust_default(this.tertiaryColor, { l: -30 });
          this.venn4 = this.venn4 ?? adjust_default(this.primaryColor, { h: 60, l: -30 });
          this.venn5 = this.venn5 ?? adjust_default(this.primaryColor, { h: -60, l: -30 });
          this.venn6 = this.venn6 ?? adjust_default(this.secondaryColor, { h: 60, l: -30 });
          this.venn7 = this.venn7 ?? adjust_default(this.primaryColor, { h: 120, l: -30 });
          this.venn8 = this.venn8 ?? adjust_default(this.secondaryColor, { h: 120, l: -30 });
          this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor;
          this.vennSetTextColor = this.vennSetTextColor ?? this.textColor;
          this.radar = {
            axisColor: this.radar?.axisColor || this.lineColor,
            axisStrokeWidth: this.radar?.axisStrokeWidth || 2,
            axisLabelFontSize: this.radar?.axisLabelFontSize || 12,
            curveOpacity: this.radar?.curveOpacity || 0.5,
            curveStrokeWidth: this.radar?.curveStrokeWidth || 2,
            graticuleColor: this.radar?.graticuleColor || "#DEDEDE",
            graticuleStrokeWidth: this.radar?.graticuleStrokeWidth || 1,
            graticuleOpacity: this.radar?.graticuleOpacity || 0.3,
            legendBoxSize: this.radar?.legendBoxSize || 12,
            legendFontSize: this.radar?.legendFontSize || 12
          };
          this.archEdgeColor = this.archEdgeColor || "#777";
          this.archEdgeArrowColor = this.archEdgeArrowColor || "#777";
          this.archEdgeWidth = this.archEdgeWidth || "3";
          this.archGroupBorderColor = this.archGroupBorderColor || "#000";
          this.archGroupBorderWidth = this.archGroupBorderWidth || "2px";
          this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
          this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 });
          this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 });
          this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 });
          this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
          this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 });
          this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 });
          this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 });
          this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill);
          this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
          this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
          this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
          this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
          this.xyChart = {
            backgroundColor: this.xyChart?.backgroundColor || this.background,
            titleColor: this.xyChart?.titleColor || this.primaryTextColor,
            dataLabelColor: this.xyChart?.dataLabelColor || this.primaryTextColor,
            xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
            xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
            xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
            xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
            yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
            yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
            yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
            yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
            plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"
          };
          this.requirementBackground = this.requirementBackground || this.primaryColor;
          this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
          this.requirementBorderSize = this.requirementBorderSize || "1";
          this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
          this.relationColor = this.relationColor || this.lineColor;
          this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
          this.git0 = this.git0 || this.primaryColor;
          this.git1 = this.git1 || this.secondaryColor;
          this.git2 = this.git2 || this.tertiaryColor;
          this.git3 = this.git3 || adjust_default(this.primaryColor, { h: -30 });
          this.git4 = this.git4 || adjust_default(this.primaryColor, { h: -60 });
          this.git5 = this.git5 || adjust_default(this.primaryColor, { h: -90 });
          this.git6 = this.git6 || adjust_default(this.primaryColor, { h: 60 });
          this.git7 = this.git7 || adjust_default(this.primaryColor, { h: 120 });
          if (this.darkMode) {
            this.git0 = lighten_default(this.git0, 25);
            this.git1 = lighten_default(this.git1, 25);
            this.git2 = lighten_default(this.git2, 25);
            this.git3 = lighten_default(this.git3, 25);
            this.git4 = lighten_default(this.git4, 25);
            this.git5 = lighten_default(this.git5, 25);
            this.git6 = lighten_default(this.git6, 25);
            this.git7 = lighten_default(this.git7, 25);
          } else {
            this.git0 = darken_default(this.git0, 25);
            this.git1 = darken_default(this.git1, 25);
            this.git2 = darken_default(this.git2, 25);
            this.git3 = darken_default(this.git3, 25);
            this.git4 = darken_default(this.git4, 25);
            this.git5 = darken_default(this.git5, 25);
            this.git6 = darken_default(this.git6, 25);
            this.git7 = darken_default(this.git7, 25);
          }
          this.gitInv0 = this.gitInv0 || invert_default(this.git0);
          this.gitInv1 = this.gitInv1 || invert_default(this.git1);
          this.gitInv2 = this.gitInv2 || invert_default(this.git2);
          this.gitInv3 = this.gitInv3 || invert_default(this.git3);
          this.gitInv4 = this.gitInv4 || invert_default(this.git4);
          this.gitInv5 = this.gitInv5 || invert_default(this.git5);
          this.gitInv6 = this.gitInv6 || invert_default(this.git6);
          this.gitInv7 = this.gitInv7 || invert_default(this.git7);
          this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor);
          this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor;
          this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor;
          this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor;
          this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor;
          this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor;
          this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor;
          this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor;
          this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor;
          this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
          this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
          this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
          this.tagLabelFontSize = this.tagLabelFontSize || "10px";
          this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
          this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
          this.commitLabelFontSize = this.commitLabelFontSize || "10px";
          this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
          this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
          this.gradientStart = this.primaryBorderColor;
          this.gradientStop = this.secondaryBorderColor;
        }
        calculate(overrides) {
          if (typeof overrides !== "object") {
            this.updateColors();
            return;
          }
          const keys2 = Object.keys(overrides);
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
          this.updateColors();
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
        }
      };
      getThemeVariables = /* @__PURE__ */ __name((userOverrides) => {
        const theme = new Theme();
        theme.calculate(userOverrides);
        return theme;
      }, "getThemeVariables");
    }
  });

  // src/themes/theme-dark.js
  var Theme2, getThemeVariables2;
  var init_theme_dark = __esm({
    "src/themes/theme-dark.js"() {
      "use strict";
      init_dist();
      init_theme_helpers();
      Theme2 = class {
        static {
          __name(this, "Theme");
        }
        constructor() {
          this.background = "#333";
          this.primaryColor = "#1f2020";
          this.secondaryColor = lighten_default(this.primaryColor, 16);
          this.tertiaryColor = adjust_default(this.primaryColor, { h: -160 });
          this.primaryBorderColor = invert_default(this.background);
          this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
          this.primaryTextColor = invert_default(this.primaryColor);
          this.secondaryTextColor = invert_default(this.secondaryColor);
          this.tertiaryTextColor = invert_default(this.tertiaryColor);
          this.lineColor = invert_default(this.background);
          this.textColor = invert_default(this.background);
          this.mainBkg = "#1f2020";
          this.secondBkg = "calculated";
          this.mainContrastColor = "lightgrey";
          this.darkTextColor = lighten_default(invert_default("#323D47"), 10);
          this.lineColor = "calculated";
          this.border1 = "#ccc";
          this.border2 = rgba_default(255, 255, 255, 0.25);
          this.arrowheadColor = "calculated";
          this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
          this.fontSize = "16px";
          this.labelBackground = "#181818";
          this.textColor = "#ccc";
          this.THEME_COLOR_LIMIT = 12;
          this.radius = 5;
          this.strokeWidth = 1;
          this.nodeBkg = "calculated";
          this.nodeBorder = "calculated";
          this.clusterBkg = "calculated";
          this.clusterBorder = "calculated";
          this.defaultLinkColor = "calculated";
          this.titleColor = "#F9FFFE";
          this.edgeLabelBackground = "calculated";
          this.actorBorder = "calculated";
          this.actorBkg = "calculated";
          this.actorTextColor = "calculated";
          this.actorLineColor = "calculated";
          this.signalColor = "calculated";
          this.signalTextColor = "calculated";
          this.labelBoxBkgColor = "calculated";
          this.labelBoxBorderColor = "calculated";
          this.labelTextColor = "calculated";
          this.loopTextColor = "calculated";
          this.noteBorderColor = "calculated";
          this.noteBkgColor = "#fff5ad";
          this.noteTextColor = "calculated";
          this.activationBorderColor = "calculated";
          this.activationBkgColor = "calculated";
          this.sequenceNumberColor = "black";
          this.clusterBkg = "#302F3D";
          this.sectionBkgColor = darken_default("#EAE8D9", 30);
          this.altSectionBkgColor = "calculated";
          this.sectionBkgColor2 = "#EAE8D9";
          this.excludeBkgColor = darken_default(this.sectionBkgColor, 10);
          this.taskBorderColor = rgba_default(255, 255, 255, 70);
          this.taskBkgColor = "calculated";
          this.taskTextColor = "calculated";
          this.taskTextLightColor = "calculated";
          this.taskTextOutsideColor = "calculated";
          this.taskTextClickableColor = "#003163";
          this.activeTaskBorderColor = rgba_default(255, 255, 255, 50);
          this.activeTaskBkgColor = "#81B1DB";
          this.gridColor = "calculated";
          this.doneTaskBkgColor = "calculated";
          this.doneTaskBorderColor = "grey";
          this.critBorderColor = "#E83737";
          this.critBkgColor = "#E83737";
          this.taskTextDarkColor = "calculated";
          this.todayLineColor = "#DB5757";
          this.vertLineColor = "#00BFFF";
          this.personBorder = this.primaryBorderColor;
          this.personBkg = this.mainBkg;
          this.archEdgeColor = "calculated";
          this.archEdgeArrowColor = "calculated";
          this.archEdgeWidth = "3";
          this.archGroupBorderColor = this.primaryBorderColor;
          this.archGroupBorderWidth = "2px";
          this.rowOdd = this.rowOdd || lighten_default(this.mainBkg, 5) || "#ffffff";
          this.rowEven = this.rowEven || darken_default(this.mainBkg, 10);
          this.labelColor = "calculated";
          this.errorBkgColor = "#a44141";
          this.errorTextColor = "#ddd";
          this.useGradient = true;
          this.gradientStart = this.primaryBorderColor;
          this.gradientStop = this.secondaryBorderColor;
          this.dropShadow = "drop-shadow( 1px 2px 2px rgba(185,185,185,1))";
          this.noteFontWeight = this.noteFontWeight || "normal";
          this.fontWeight = this.fontWeight || "normal";
        }
        updateColors() {
          this.secondBkg = lighten_default(this.mainBkg, 16);
          this.lineColor = this.mainContrastColor;
          this.arrowheadColor = this.mainContrastColor;
          this.nodeBkg = this.mainBkg;
          this.nodeBorder = this.border1;
          this.clusterBkg = this.secondBkg;
          this.clusterBorder = this.border2;
          this.defaultLinkColor = this.lineColor;
          this.edgeLabelBackground = lighten_default(this.labelBackground, 25);
          this.actorBorder = this.border1;
          this.actorBkg = this.mainBkg;
          this.actorTextColor = this.mainContrastColor;
          this.actorLineColor = this.actorBorder;
          this.signalColor = this.mainContrastColor;
          this.signalTextColor = this.mainContrastColor;
          this.labelBoxBkgColor = this.actorBkg;
          this.labelBoxBorderColor = this.actorBorder;
          this.labelTextColor = this.mainContrastColor;
          this.loopTextColor = this.mainContrastColor;
          this.noteBorderColor = this.secondaryBorderColor;
          this.noteBkgColor = this.secondBkg;
          this.noteTextColor = this.secondaryTextColor;
          this.activationBorderColor = this.border1;
          this.activationBkgColor = this.secondBkg;
          this.altSectionBkgColor = this.background;
          this.taskBkgColor = lighten_default(this.mainBkg, 23);
          this.taskTextColor = this.darkTextColor;
          this.taskTextLightColor = this.mainContrastColor;
          this.taskTextOutsideColor = this.taskTextLightColor;
          this.gridColor = this.mainContrastColor;
          this.doneTaskBkgColor = this.mainContrastColor;
          this.taskTextDarkColor = invert_default(this.doneTaskBkgColor);
          this.archEdgeColor = this.lineColor;
          this.archEdgeArrowColor = this.lineColor;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.transitionLabelColor = this.transitionLabelColor || this.textColor;
          this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
          this.stateBkg = this.stateBkg || this.mainBkg;
          this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
          this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
          this.altBackground = this.altBackground || "#555";
          this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
          this.compositeBorder = this.compositeBorder || this.nodeBorder;
          this.innerEndBackground = this.primaryBorderColor;
          this.specialStateColor = "#f4f4f4";
          this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
          this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
          this.fillType0 = this.primaryColor;
          this.fillType1 = this.secondaryColor;
          this.fillType2 = adjust_default(this.primaryColor, { h: 64 });
          this.fillType3 = adjust_default(this.secondaryColor, { h: 64 });
          this.fillType4 = adjust_default(this.primaryColor, { h: -64 });
          this.fillType5 = adjust_default(this.secondaryColor, { h: -64 });
          this.fillType6 = adjust_default(this.primaryColor, { h: 128 });
          this.fillType7 = adjust_default(this.secondaryColor, { h: 128 });
          this.cScale1 = this.cScale1 || "#0b0000";
          this.cScale2 = this.cScale2 || "#4d1037";
          this.cScale3 = this.cScale3 || "#3f5258";
          this.cScale4 = this.cScale4 || "#4f2f1b";
          this.cScale5 = this.cScale5 || "#6e0a0a";
          this.cScale6 = this.cScale6 || "#3b0048";
          this.cScale7 = this.cScale7 || "#995a01";
          this.cScale8 = this.cScale8 || "#154706";
          this.cScale9 = this.cScale9 || "#161722";
          this.cScale10 = this.cScale10 || "#00296f";
          this.cScale11 = this.cScale11 || "#01629c";
          this.cScale12 = this.cScale12 || "#010029";
          this.cScale0 = this.cScale0 || this.primaryColor;
          this.cScale1 = this.cScale1 || this.secondaryColor;
          this.cScale2 = this.cScale2 || this.tertiaryColor;
          this.cScale3 = this.cScale3 || adjust_default(this.primaryColor, { h: 30 });
          this.cScale4 = this.cScale4 || adjust_default(this.primaryColor, { h: 60 });
          this.cScale5 = this.cScale5 || adjust_default(this.primaryColor, { h: 90 });
          this.cScale6 = this.cScale6 || adjust_default(this.primaryColor, { h: 120 });
          this.cScale7 = this.cScale7 || adjust_default(this.primaryColor, { h: 150 });
          this.cScale8 = this.cScale8 || adjust_default(this.primaryColor, { h: 210 });
          this.cScale9 = this.cScale9 || adjust_default(this.primaryColor, { h: 270 });
          this.cScale10 = this.cScale10 || adjust_default(this.primaryColor, { h: 300 });
          this.cScale11 = this.cScale11 || adjust_default(this.primaryColor, { h: 330 });
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]);
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10);
          }
          for (let i2 = 0; i2 < 5; i2++) {
            this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 30, s: -30, l: -(-10 + i2 * 4) });
            this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 30, s: -30, l: -(-7 + i2 * 4) });
          }
          this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor);
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor;
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["pie" + i2] = this["cScale" + i2];
          }
          this.pieTitleTextSize = this.pieTitleTextSize || "25px";
          this.pieTitleTextColor = this.pieTitleTextColor || this.mainContrastColor;
          this.pieSectionTextSize = this.pieSectionTextSize || "17px";
          this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
          this.pieLegendTextSize = this.pieLegendTextSize || "17px";
          this.pieLegendTextColor = this.pieLegendTextColor || this.mainContrastColor;
          this.pieStrokeColor = this.pieStrokeColor || "black";
          this.pieStrokeWidth = this.pieStrokeWidth || "2px";
          this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
          this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
          this.pieOpacity = this.pieOpacity || "0.7";
          for (let i2 = 0; i2 < 8; i2++) {
            this["venn" + (i2 + 1)] = this["venn" + (i2 + 1)] ?? lighten_default(this["cScale" + i2], 30);
          }
          this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor;
          this.vennSetTextColor = this.vennSetTextColor ?? this.textColor;
          this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
          this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 });
          this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 });
          this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 });
          this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
          this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 });
          this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 });
          this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 });
          this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill);
          this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
          this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
          this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
          this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
          this.xyChart = {
            backgroundColor: this.xyChart?.backgroundColor || this.background,
            titleColor: this.xyChart?.titleColor || this.primaryTextColor,
            dataLabelColor: this.xyChart?.dataLabelColor || this.primaryTextColor,
            xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
            xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
            xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
            xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
            yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
            yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
            yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
            yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
            plotColorPalette: this.xyChart?.plotColorPalette || "#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"
          };
          this.packet = {
            startByteColor: this.primaryTextColor,
            endByteColor: this.primaryTextColor,
            labelColor: this.primaryTextColor,
            titleColor: this.primaryTextColor,
            blockStrokeColor: this.primaryTextColor,
            blockFillColor: this.background
          };
          this.radar = {
            axisColor: this.radar?.axisColor || this.lineColor,
            axisStrokeWidth: this.radar?.axisStrokeWidth || 2,
            axisLabelFontSize: this.radar?.axisLabelFontSize || 12,
            curveOpacity: this.radar?.curveOpacity || 0.5,
            curveStrokeWidth: this.radar?.curveStrokeWidth || 2,
            graticuleColor: this.radar?.graticuleColor || "#DEDEDE",
            graticuleStrokeWidth: this.radar?.graticuleStrokeWidth || 1,
            graticuleOpacity: this.radar?.graticuleOpacity || 0.3,
            legendBoxSize: this.radar?.legendBoxSize || 12,
            legendFontSize: this.radar?.legendFontSize || 12
          };
          this.classText = this.primaryTextColor;
          this.requirementBackground = this.requirementBackground || this.primaryColor;
          this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
          this.requirementBorderSize = this.requirementBorderSize || "1";
          this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
          this.relationColor = this.relationColor || this.lineColor;
          this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
          this.git0 = lighten_default(this.secondaryColor, 20);
          this.git1 = lighten_default(this.pie2 || this.secondaryColor, 20);
          this.git2 = lighten_default(this.pie3 || this.tertiaryColor, 20);
          this.git3 = lighten_default(this.pie4 || adjust_default(this.primaryColor, { h: -30 }), 20);
          this.git4 = lighten_default(this.pie5 || adjust_default(this.primaryColor, { h: -60 }), 20);
          this.git5 = lighten_default(this.pie6 || adjust_default(this.primaryColor, { h: -90 }), 10);
          this.git6 = lighten_default(this.pie7 || adjust_default(this.primaryColor, { h: 60 }), 10);
          this.git7 = lighten_default(this.pie8 || adjust_default(this.primaryColor, { h: 120 }), 20);
          this.gitInv0 = this.gitInv0 || invert_default(this.git0);
          this.gitInv1 = this.gitInv1 || invert_default(this.git1);
          this.gitInv2 = this.gitInv2 || invert_default(this.git2);
          this.gitInv3 = this.gitInv3 || invert_default(this.git3);
          this.gitInv4 = this.gitInv4 || invert_default(this.git4);
          this.gitInv5 = this.gitInv5 || invert_default(this.git5);
          this.gitInv6 = this.gitInv6 || invert_default(this.git6);
          this.gitInv7 = this.gitInv7 || invert_default(this.git7);
          this.gitBranchLabel0 = this.gitBranchLabel0 || invert_default(this.labelTextColor);
          this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
          this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
          this.gitBranchLabel3 = this.gitBranchLabel3 || invert_default(this.labelTextColor);
          this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
          this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
          this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
          this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
          this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
          this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
          this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
          this.tagLabelFontSize = this.tagLabelFontSize || "10px";
          this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
          this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
          this.commitLabelFontSize = this.commitLabelFontSize || "10px";
          this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || lighten_default(this.background, 12);
          this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || lighten_default(this.background, 2);
          this.nodeBorder = this.nodeBorder || "#999";
        }
        calculate(overrides) {
          if (typeof overrides !== "object") {
            this.updateColors();
            return;
          }
          const keys2 = Object.keys(overrides);
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
          this.updateColors();
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
        }
      };
      getThemeVariables2 = /* @__PURE__ */ __name((userOverrides) => {
        const theme = new Theme2();
        theme.calculate(userOverrides);
        return theme;
      }, "getThemeVariables");
    }
  });

  // src/themes/theme-default.js
  var Theme3, getThemeVariables3;
  var init_theme_default = __esm({
    "src/themes/theme-default.js"() {
      "use strict";
      init_dist();
      init_theme_helpers();
      init_erDiagram_oldHardcodedValues();
      Theme3 = class {
        static {
          __name(this, "Theme");
        }
        constructor() {
          this.background = "#f4f4f4";
          this.primaryColor = "#ECECFF";
          this.secondaryColor = adjust_default(this.primaryColor, { h: 120 });
          this.secondaryColor = "#ffffde";
          this.tertiaryColor = adjust_default(this.primaryColor, { h: -160 });
          this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
          this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
          this.primaryTextColor = invert_default(this.primaryColor);
          this.secondaryTextColor = invert_default(this.secondaryColor);
          this.tertiaryTextColor = invert_default(this.tertiaryColor);
          this.lineColor = invert_default(this.background);
          this.textColor = invert_default(this.background);
          this.background = "white";
          this.mainBkg = "#ECECFF";
          this.secondBkg = "#ffffde";
          this.lineColor = "#333333";
          this.border1 = "#9370DB";
          this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
          this.border2 = "#aaaa33";
          this.arrowheadColor = "#333333";
          this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
          this.fontSize = "16px";
          this.labelBackground = "rgba(232,232,232, 0.8)";
          this.textColor = "#333";
          this.THEME_COLOR_LIMIT = 12;
          this.radius = 5;
          this.strokeWidth = 1;
          this.nodeBkg = "calculated";
          this.nodeBorder = "calculated";
          this.clusterBkg = "calculated";
          this.clusterBorder = "calculated";
          this.defaultLinkColor = "calculated";
          this.titleColor = "calculated";
          this.edgeLabelBackground = "calculated";
          this.actorBorder = "calculated";
          this.actorBkg = "calculated";
          this.actorTextColor = "black";
          this.actorLineColor = "calculated";
          this.signalColor = "calculated";
          this.signalTextColor = "calculated";
          this.labelBoxBkgColor = "calculated";
          this.labelBoxBorderColor = "calculated";
          this.labelTextColor = "calculated";
          this.loopTextColor = "calculated";
          this.noteBorderColor = "calculated";
          this.noteBkgColor = "#fff5ad";
          this.noteTextColor = "calculated";
          this.activationBorderColor = "#666";
          this.activationBkgColor = "#f4f4f4";
          this.sequenceNumberColor = "white";
          this.clusterBkg = "#FBFBFF";
          this.sectionBkgColor = "calculated";
          this.altSectionBkgColor = "calculated";
          this.sectionBkgColor2 = "calculated";
          this.excludeBkgColor = "#eeeeee";
          this.taskBorderColor = "calculated";
          this.taskBkgColor = "calculated";
          this.taskTextLightColor = "calculated";
          this.taskTextColor = this.taskTextLightColor;
          this.taskTextDarkColor = "calculated";
          this.taskTextOutsideColor = this.taskTextDarkColor;
          this.taskTextClickableColor = "calculated";
          this.activeTaskBorderColor = "calculated";
          this.activeTaskBkgColor = "calculated";
          this.gridColor = "calculated";
          this.doneTaskBkgColor = "calculated";
          this.doneTaskBorderColor = "calculated";
          this.critBorderColor = "calculated";
          this.critBkgColor = "calculated";
          this.todayLineColor = "calculated";
          this.vertLineColor = "calculated";
          this.sectionBkgColor = rgba_default(102, 102, 255, 0.49);
          this.altSectionBkgColor = "white";
          this.sectionBkgColor2 = "#fff400";
          this.taskBorderColor = "#534fbc";
          this.taskBkgColor = "#8a90dd";
          this.taskTextLightColor = "white";
          this.taskTextColor = "calculated";
          this.taskTextDarkColor = "black";
          this.taskTextOutsideColor = "calculated";
          this.taskTextClickableColor = "#003163";
          this.activeTaskBorderColor = "#534fbc";
          this.activeTaskBkgColor = "#bfc7ff";
          this.gridColor = "lightgrey";
          this.doneTaskBkgColor = "lightgrey";
          this.doneTaskBorderColor = "grey";
          this.critBorderColor = "#ff8888";
          this.critBkgColor = "red";
          this.todayLineColor = "red";
          this.vertLineColor = "navy";
          this.noteFontWeight = this.noteFontWeight || "normal";
          this.fontWeight = this.fontWeight || "normal";
          this.personBorder = this.primaryBorderColor;
          this.personBkg = this.mainBkg;
          this.archEdgeColor = "calculated";
          this.archEdgeArrowColor = "calculated";
          this.archEdgeWidth = "3";
          this.archGroupBorderColor = this.primaryBorderColor;
          this.archGroupBorderWidth = "2px";
          this.rowOdd = "calculated";
          this.rowEven = "calculated";
          this.labelColor = "black";
          this.errorBkgColor = "#552222";
          this.errorTextColor = "#552222";
          this.useGradient = false;
          this.gradientStart = this.primaryBorderColor;
          this.gradientStop = this.secondaryBorderColor;
          this.dropShadow = "drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))";
          this.updateColors();
        }
        updateColors() {
          this.cScale0 = this.cScale0 || this.primaryColor;
          this.cScale1 = this.cScale1 || this.secondaryColor;
          this.cScale2 = this.cScale2 || this.tertiaryColor;
          this.cScale3 = this.cScale3 || adjust_default(this.primaryColor, { h: 30 });
          this.cScale4 = this.cScale4 || adjust_default(this.primaryColor, { h: 60 });
          this.cScale5 = this.cScale5 || adjust_default(this.primaryColor, { h: 90 });
          this.cScale6 = this.cScale6 || adjust_default(this.primaryColor, { h: 120 });
          this.cScale7 = this.cScale7 || adjust_default(this.primaryColor, { h: 150 });
          this.cScale8 = this.cScale8 || adjust_default(this.primaryColor, { h: 210 });
          this.cScale9 = this.cScale9 || adjust_default(this.primaryColor, { h: 270 });
          this.cScale10 = this.cScale10 || adjust_default(this.primaryColor, { h: 300 });
          this.cScale11 = this.cScale11 || adjust_default(this.primaryColor, { h: 330 });
          this["cScalePeer1"] = this["cScalePeer1"] || darken_default(this.secondaryColor, 45);
          this["cScalePeer2"] = this["cScalePeer2"] || darken_default(this.tertiaryColor, 40);
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScale" + i2] = darken_default(this["cScale" + i2], 10);
            this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 25);
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleInv" + i2] = this["cScaleInv" + i2] || adjust_default(this["cScale" + i2], { h: 180 });
          }
          for (let i2 = 0; i2 < 5; i2++) {
            this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 30, l: -(5 + i2 * 5) });
            this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 30, l: -(7 + i2 * 5) });
          }
          this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor;
          if (this.labelTextColor !== "calculated") {
            this.cScaleLabel0 = this.cScaleLabel0 || invert_default(this.labelTextColor);
            this.cScaleLabel3 = this.cScaleLabel3 || invert_default(this.labelTextColor);
            for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
              this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.labelTextColor;
            }
          }
          this.nodeBkg = this.mainBkg;
          this.nodeBorder = this.border1;
          this.clusterBkg = this.secondBkg;
          this.clusterBorder = this.border2;
          this.defaultLinkColor = this.lineColor;
          this.titleColor = this.textColor;
          this.edgeLabelBackground = this.labelBackground;
          this.actorBorder = this.border1;
          this.actorBkg = this.mainBkg;
          this.labelBoxBkgColor = this.actorBkg;
          this.signalColor = this.textColor;
          this.signalTextColor = this.textColor;
          this.labelBoxBorderColor = this.actorBorder;
          this.labelTextColor = this.actorTextColor;
          this.loopTextColor = this.actorTextColor;
          this.noteBorderColor = this.border2;
          this.noteTextColor = this.actorTextColor;
          this.actorLineColor = this.actorBorder;
          this.taskTextColor = this.taskTextLightColor;
          this.taskTextOutsideColor = this.taskTextDarkColor;
          this.archEdgeColor = this.lineColor;
          this.archEdgeArrowColor = this.lineColor;
          this.rowOdd = this.rowOdd || lighten_default(this.primaryColor, 75) || "#ffffff";
          this.rowEven = this.rowEven || lighten_default(this.primaryColor, 1);
          this.transitionColor = this.transitionColor || this.lineColor;
          this.transitionLabelColor = this.transitionLabelColor || this.textColor;
          this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
          this.stateBkg = this.stateBkg || this.mainBkg;
          this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
          this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
          this.altBackground = this.altBackground || "#f0f0f0";
          this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
          this.compositeBorder = this.compositeBorder || this.nodeBorder;
          this.innerEndBackground = this.nodeBorder;
          this.specialStateColor = this.lineColor;
          this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
          this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.classText = this.primaryTextColor;
          this.fillType0 = this.primaryColor;
          this.fillType1 = this.secondaryColor;
          this.fillType2 = adjust_default(this.primaryColor, { h: 64 });
          this.fillType3 = adjust_default(this.secondaryColor, { h: 64 });
          this.fillType4 = adjust_default(this.primaryColor, { h: -64 });
          this.fillType5 = adjust_default(this.secondaryColor, { h: -64 });
          this.fillType6 = adjust_default(this.primaryColor, { h: 128 });
          this.fillType7 = adjust_default(this.secondaryColor, { h: 128 });
          this.pie1 = this.pie1 || this.primaryColor;
          this.pie2 = this.pie2 || this.secondaryColor;
          this.pie3 = this.pie3 || adjust_default(this.tertiaryColor, { l: -40 });
          this.pie4 = this.pie4 || adjust_default(this.primaryColor, { l: -10 });
          this.pie5 = this.pie5 || adjust_default(this.secondaryColor, { l: -30 });
          this.pie6 = this.pie6 || adjust_default(this.tertiaryColor, { l: -20 });
          this.pie7 = this.pie7 || adjust_default(this.primaryColor, { h: 60, l: -20 });
          this.pie8 = this.pie8 || adjust_default(this.primaryColor, { h: -60, l: -40 });
          this.pie9 = this.pie9 || adjust_default(this.primaryColor, { h: 120, l: -40 });
          this.pie10 = this.pie10 || adjust_default(this.primaryColor, { h: 60, l: -40 });
          this.pie11 = this.pie11 || adjust_default(this.primaryColor, { h: -90, l: -40 });
          this.pie12 = this.pie12 || adjust_default(this.primaryColor, { h: 120, l: -30 });
          this.pieTitleTextSize = this.pieTitleTextSize || "25px";
          this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
          this.pieSectionTextSize = this.pieSectionTextSize || "17px";
          this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
          this.pieLegendTextSize = this.pieLegendTextSize || "17px";
          this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
          this.pieStrokeColor = this.pieStrokeColor || "black";
          this.pieStrokeWidth = this.pieStrokeWidth || "2px";
          this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
          this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
          this.pieOpacity = this.pieOpacity || "0.7";
          this.venn1 = this.venn1 ?? adjust_default(this.primaryColor, { l: -30 });
          this.venn2 = this.venn2 ?? adjust_default(this.secondaryColor, { l: -30 });
          this.venn3 = this.venn3 ?? adjust_default(this.tertiaryColor, { l: -40 });
          this.venn4 = this.venn4 ?? adjust_default(this.primaryColor, { h: 60, l: -30 });
          this.venn5 = this.venn5 ?? adjust_default(this.primaryColor, { h: -60, l: -30 });
          this.venn6 = this.venn6 ?? adjust_default(this.secondaryColor, { h: 60, l: -30 });
          this.venn7 = this.venn7 ?? adjust_default(this.primaryColor, { h: 120, l: -30 });
          this.venn8 = this.venn8 ?? adjust_default(this.secondaryColor, { h: 120, l: -30 });
          this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor;
          this.vennSetTextColor = this.vennSetTextColor ?? this.textColor;
          this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
          this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 });
          this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 });
          this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 });
          this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
          this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 });
          this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 });
          this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 });
          this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill);
          this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
          this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
          this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
          this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
          this.radar = {
            axisColor: this.radar?.axisColor || this.lineColor,
            axisStrokeWidth: this.radar?.axisStrokeWidth || 2,
            axisLabelFontSize: this.radar?.axisLabelFontSize || 12,
            curveOpacity: this.radar?.curveOpacity || 0.5,
            curveStrokeWidth: this.radar?.curveStrokeWidth || 2,
            graticuleColor: this.radar?.graticuleColor || "#DEDEDE",
            graticuleStrokeWidth: this.radar?.graticuleStrokeWidth || 1,
            graticuleOpacity: this.radar?.graticuleOpacity || 0.3,
            legendBoxSize: this.radar?.legendBoxSize || 12,
            legendFontSize: this.radar?.legendFontSize || 12
          };
          this.xyChart = {
            backgroundColor: this.xyChart?.backgroundColor || this.background,
            titleColor: this.xyChart?.titleColor || this.primaryTextColor,
            dataLabelColor: this.xyChart?.dataLabelColor || this.primaryTextColor,
            xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
            xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
            xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
            xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
            yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
            yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
            yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
            yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
            plotColorPalette: this.xyChart?.plotColorPalette || "#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"
          };
          this.requirementBackground = this.requirementBackground || this.primaryColor;
          this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
          this.requirementBorderSize = this.requirementBorderSize || "1";
          this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
          this.relationColor = this.relationColor || this.lineColor;
          this.relationLabelBackground = this.relationLabelBackground || this.labelBackground;
          this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
          this.git0 = this.git0 || this.primaryColor;
          this.git1 = this.git1 || this.secondaryColor;
          this.git2 = this.git2 || this.tertiaryColor;
          this.git3 = this.git3 || adjust_default(this.primaryColor, { h: -30 });
          this.git4 = this.git4 || adjust_default(this.primaryColor, { h: -60 });
          this.git5 = this.git5 || adjust_default(this.primaryColor, { h: -90 });
          this.git6 = this.git6 || adjust_default(this.primaryColor, { h: 60 });
          this.git7 = this.git7 || adjust_default(this.primaryColor, { h: 120 });
          if (this.darkMode) {
            this.git0 = lighten_default(this.git0, 25);
            this.git1 = lighten_default(this.git1, 25);
            this.git2 = lighten_default(this.git2, 25);
            this.git3 = lighten_default(this.git3, 25);
            this.git4 = lighten_default(this.git4, 25);
            this.git5 = lighten_default(this.git5, 25);
            this.git6 = lighten_default(this.git6, 25);
            this.git7 = lighten_default(this.git7, 25);
          } else {
            this.git0 = darken_default(this.git0, 25);
            this.git1 = darken_default(this.git1, 25);
            this.git2 = darken_default(this.git2, 25);
            this.git3 = darken_default(this.git3, 25);
            this.git4 = darken_default(this.git4, 25);
            this.git5 = darken_default(this.git5, 25);
            this.git6 = darken_default(this.git6, 25);
            this.git7 = darken_default(this.git7, 25);
          }
          this.gitInv0 = this.gitInv0 || darken_default(invert_default(this.git0), 25);
          this.gitInv1 = this.gitInv1 || invert_default(this.git1);
          this.gitInv2 = this.gitInv2 || invert_default(this.git2);
          this.gitInv3 = this.gitInv3 || invert_default(this.git3);
          this.gitInv4 = this.gitInv4 || invert_default(this.git4);
          this.gitInv5 = this.gitInv5 || invert_default(this.git5);
          this.gitInv6 = this.gitInv6 || invert_default(this.git6);
          this.gitInv7 = this.gitInv7 || invert_default(this.git7);
          this.gitBranchLabel0 = this.gitBranchLabel0 || invert_default(this.labelTextColor);
          this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
          this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
          this.gitBranchLabel3 = this.gitBranchLabel3 || invert_default(this.labelTextColor);
          this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
          this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
          this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
          this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
          this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
          this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
          this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
          this.tagLabelFontSize = this.tagLabelFontSize || "10px";
          this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
          this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
          this.commitLabelFontSize = this.commitLabelFontSize || "10px";
          this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
          this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
        }
        calculate(overrides) {
          Object.keys(this).forEach((k2) => {
            if (this[k2] === "calculated") {
              this[k2] = void 0;
            }
          });
          if (typeof overrides !== "object") {
            this.updateColors();
            return;
          }
          const keys2 = Object.keys(overrides);
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
          this.updateColors();
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
        }
      };
      getThemeVariables3 = /* @__PURE__ */ __name((userOverrides) => {
        const theme = new Theme3();
        theme.calculate(userOverrides);
        return theme;
      }, "getThemeVariables");
    }
  });

  // src/themes/theme-forest.js
  var Theme4, getThemeVariables4;
  var init_theme_forest = __esm({
    "src/themes/theme-forest.js"() {
      "use strict";
      init_dist();
      init_erDiagram_oldHardcodedValues();
      init_theme_helpers();
      Theme4 = class {
        static {
          __name(this, "Theme");
        }
        constructor() {
          this.background = "#f4f4f4";
          this.primaryColor = "#cde498";
          this.secondaryColor = "#cdffb2";
          this.background = "white";
          this.mainBkg = "#cde498";
          this.secondBkg = "#cdffb2";
          this.lineColor = "green";
          this.border1 = "#13540c";
          this.border2 = "#6eaa49";
          this.arrowheadColor = "green";
          this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
          this.fontSize = "16px";
          this.tertiaryColor = lighten_default("#cde498", 10);
          this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
          this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
          this.primaryTextColor = invert_default(this.primaryColor);
          this.secondaryTextColor = invert_default(this.secondaryColor);
          this.tertiaryTextColor = invert_default(this.primaryColor);
          this.lineColor = invert_default(this.background);
          this.textColor = invert_default(this.background);
          this.THEME_COLOR_LIMIT = 12;
          this.radius = 5;
          this.strokeWidth = 1;
          this.nodeBkg = "calculated";
          this.nodeBorder = "calculated";
          this.clusterBkg = "calculated";
          this.clusterBorder = "calculated";
          this.defaultLinkColor = "calculated";
          this.titleColor = "#333";
          this.edgeLabelBackground = "#e8e8e8";
          this.actorBorder = "calculated";
          this.actorBkg = "calculated";
          this.actorTextColor = "black";
          this.actorLineColor = "calculated";
          this.signalColor = "#333";
          this.signalTextColor = "#333";
          this.labelBoxBkgColor = "calculated";
          this.labelBoxBorderColor = "#326932";
          this.labelTextColor = "calculated";
          this.loopTextColor = "calculated";
          this.noteBorderColor = "calculated";
          this.noteBkgColor = "#fff5ad";
          this.noteTextColor = "calculated";
          this.activationBorderColor = "#666";
          this.activationBkgColor = "#f4f4f4";
          this.sequenceNumberColor = "white";
          this.sectionBkgColor = "#6eaa49";
          this.altSectionBkgColor = "white";
          this.sectionBkgColor2 = "#6eaa49";
          this.excludeBkgColor = "#eeeeee";
          this.taskBorderColor = "calculated";
          this.taskBkgColor = "#487e3a";
          this.taskTextLightColor = "white";
          this.taskTextColor = "calculated";
          this.taskTextDarkColor = "black";
          this.taskTextOutsideColor = "calculated";
          this.taskTextClickableColor = "#003163";
          this.activeTaskBorderColor = "calculated";
          this.activeTaskBkgColor = "calculated";
          this.gridColor = "lightgrey";
          this.doneTaskBkgColor = "lightgrey";
          this.doneTaskBorderColor = "grey";
          this.critBorderColor = "#ff8888";
          this.critBkgColor = "red";
          this.todayLineColor = "red";
          this.vertLineColor = "#00BFFF";
          this.personBorder = this.primaryBorderColor;
          this.personBkg = this.mainBkg;
          this.archEdgeColor = "calculated";
          this.archEdgeArrowColor = "calculated";
          this.archEdgeWidth = "3";
          this.archGroupBorderColor = this.primaryBorderColor;
          this.archGroupBorderWidth = "2px";
          this.noteFontWeight = "normal";
          this.fontWeight = "normal";
          this.labelColor = "black";
          this.errorBkgColor = "#552222";
          this.errorTextColor = "#552222";
          this.useGradient = true;
          this.gradientStart = this.primaryBorderColor;
          this.gradientStop = this.secondaryBorderColor;
          this.dropShadow = "drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))";
        }
        updateColors() {
          this.actorBorder = darken_default(this.mainBkg, 20);
          this.actorBkg = this.mainBkg;
          this.labelBoxBkgColor = this.actorBkg;
          this.labelTextColor = this.actorTextColor;
          this.loopTextColor = this.actorTextColor;
          this.noteBorderColor = this.border2;
          this.noteTextColor = this.actorTextColor;
          this.actorLineColor = this.actorBorder;
          this.cScale0 = this.cScale0 || this.primaryColor;
          this.cScale1 = this.cScale1 || this.secondaryColor;
          this.cScale2 = this.cScale2 || this.tertiaryColor;
          this.cScale3 = this.cScale3 || adjust_default(this.primaryColor, { h: 30 });
          this.cScale4 = this.cScale4 || adjust_default(this.primaryColor, { h: 60 });
          this.cScale5 = this.cScale5 || adjust_default(this.primaryColor, { h: 90 });
          this.cScale6 = this.cScale6 || adjust_default(this.primaryColor, { h: 120 });
          this.cScale7 = this.cScale7 || adjust_default(this.primaryColor, { h: 150 });
          this.cScale8 = this.cScale8 || adjust_default(this.primaryColor, { h: 210 });
          this.cScale9 = this.cScale9 || adjust_default(this.primaryColor, { h: 270 });
          this.cScale10 = this.cScale10 || adjust_default(this.primaryColor, { h: 300 });
          this.cScale11 = this.cScale11 || adjust_default(this.primaryColor, { h: 330 });
          this["cScalePeer1"] = this["cScalePeer1"] || darken_default(this.secondaryColor, 45);
          this["cScalePeer2"] = this["cScalePeer2"] || darken_default(this.tertiaryColor, 40);
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScale" + i2] = darken_default(this["cScale" + i2], 10);
            this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 25);
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleInv" + i2] = this["cScaleInv" + i2] || adjust_default(this["cScale" + i2], { h: 180 });
          }
          this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor;
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor;
          }
          for (let i2 = 0; i2 < 5; i2++) {
            this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 30, s: -30, l: -(5 + i2 * 5) });
            this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 30, s: -30, l: -(8 + i2 * 5) });
          }
          this.nodeBkg = this.mainBkg;
          this.nodeBorder = this.border1;
          this.clusterBkg = this.secondBkg;
          this.clusterBorder = this.border2;
          this.defaultLinkColor = this.lineColor;
          this.taskBorderColor = this.border1;
          this.taskTextColor = this.taskTextLightColor;
          this.taskTextOutsideColor = this.taskTextDarkColor;
          this.activeTaskBorderColor = this.taskBorderColor;
          this.activeTaskBkgColor = this.mainBkg;
          this.archEdgeColor = this.lineColor;
          this.archEdgeArrowColor = this.lineColor;
          this.rowOdd = this.rowOdd || lighten_default(this.mainBkg, 75) || "#ffffff";
          this.rowEven = this.rowEven || lighten_default(this.mainBkg, 20);
          this.transitionColor = this.transitionColor || this.lineColor;
          this.transitionLabelColor = this.transitionLabelColor || this.textColor;
          this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
          this.stateBkg = this.stateBkg || this.mainBkg;
          this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
          this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
          this.altBackground = this.altBackground || "#f0f0f0";
          this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
          this.compositeBorder = this.compositeBorder || this.nodeBorder;
          this.innerEndBackground = this.primaryBorderColor;
          this.specialStateColor = this.lineColor;
          this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
          this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.classText = this.primaryTextColor;
          this.fillType0 = this.primaryColor;
          this.fillType1 = this.secondaryColor;
          this.fillType2 = adjust_default(this.primaryColor, { h: 64 });
          this.fillType3 = adjust_default(this.secondaryColor, { h: 64 });
          this.fillType4 = adjust_default(this.primaryColor, { h: -64 });
          this.fillType5 = adjust_default(this.secondaryColor, { h: -64 });
          this.fillType6 = adjust_default(this.primaryColor, { h: 128 });
          this.fillType7 = adjust_default(this.secondaryColor, { h: 128 });
          this.pie1 = this.pie1 || this.primaryColor;
          this.pie2 = this.pie2 || this.secondaryColor;
          this.pie3 = this.pie3 || this.tertiaryColor;
          this.pie4 = this.pie4 || adjust_default(this.primaryColor, { l: -30 });
          this.pie5 = this.pie5 || adjust_default(this.secondaryColor, { l: -30 });
          this.pie6 = this.pie6 || adjust_default(this.tertiaryColor, { h: 40, l: -40 });
          this.pie7 = this.pie7 || adjust_default(this.primaryColor, { h: 60, l: -10 });
          this.pie8 = this.pie8 || adjust_default(this.primaryColor, { h: -60, l: -10 });
          this.pie9 = this.pie9 || adjust_default(this.primaryColor, { h: 120, l: 0 });
          this.pie10 = this.pie10 || adjust_default(this.primaryColor, { h: 60, l: -50 });
          this.pie11 = this.pie11 || adjust_default(this.primaryColor, { h: -60, l: -50 });
          this.pie12 = this.pie12 || adjust_default(this.primaryColor, { h: 120, l: -50 });
          this.pieTitleTextSize = this.pieTitleTextSize || "25px";
          this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
          this.pieSectionTextSize = this.pieSectionTextSize || "17px";
          this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
          this.pieLegendTextSize = this.pieLegendTextSize || "17px";
          this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
          this.pieStrokeColor = this.pieStrokeColor || "black";
          this.pieStrokeWidth = this.pieStrokeWidth || "2px";
          this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
          this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
          this.pieOpacity = this.pieOpacity || "0.7";
          this.venn1 = this.venn1 ?? adjust_default(this.primaryColor, { l: -30 });
          this.venn2 = this.venn2 ?? adjust_default(this.secondaryColor, { l: -30 });
          this.venn3 = this.venn3 ?? adjust_default(this.tertiaryColor, { l: -30 });
          this.venn4 = this.venn4 ?? adjust_default(this.primaryColor, { h: 60, l: -30 });
          this.venn5 = this.venn5 ?? adjust_default(this.primaryColor, { h: -60, l: -30 });
          this.venn6 = this.venn6 ?? adjust_default(this.secondaryColor, { h: 60, l: -30 });
          this.venn7 = this.venn7 ?? adjust_default(this.primaryColor, { h: 120, l: -30 });
          this.venn8 = this.venn8 ?? adjust_default(this.secondaryColor, { h: 120, l: -30 });
          this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor;
          this.vennSetTextColor = this.vennSetTextColor ?? this.textColor;
          this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
          this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 });
          this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 });
          this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 });
          this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
          this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 });
          this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 });
          this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 });
          this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill);
          this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
          this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
          this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
          this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
          this.packet = {
            startByteColor: this.primaryTextColor,
            endByteColor: this.primaryTextColor,
            labelColor: this.primaryTextColor,
            titleColor: this.primaryTextColor,
            blockStrokeColor: this.primaryTextColor,
            blockFillColor: this.mainBkg
          };
          this.radar = {
            axisColor: this.radar?.axisColor || this.lineColor,
            axisStrokeWidth: this.radar?.axisStrokeWidth || 2,
            axisLabelFontSize: this.radar?.axisLabelFontSize || 12,
            curveOpacity: this.radar?.curveOpacity || 0.5,
            curveStrokeWidth: this.radar?.curveStrokeWidth || 2,
            graticuleColor: this.radar?.graticuleColor || "#DEDEDE",
            graticuleStrokeWidth: this.radar?.graticuleStrokeWidth || 1,
            graticuleOpacity: this.radar?.graticuleOpacity || 0.3,
            legendBoxSize: this.radar?.legendBoxSize || 12,
            legendFontSize: this.radar?.legendFontSize || 12
          };
          this.xyChart = {
            backgroundColor: this.xyChart?.backgroundColor || this.background,
            titleColor: this.xyChart?.titleColor || this.primaryTextColor,
            dataLabelColor: this.xyChart?.dataLabelColor || this.primaryTextColor,
            xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
            xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
            xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
            xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
            yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
            yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
            yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
            yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
            plotColorPalette: this.xyChart?.plotColorPalette || "#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"
          };
          this.requirementBackground = this.requirementBackground || this.primaryColor;
          this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
          this.requirementBorderSize = this.requirementBorderSize || "1";
          this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
          this.relationColor = this.relationColor || this.lineColor;
          this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
          this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
          this.git0 = this.git0 || this.primaryColor;
          this.git1 = this.git1 || this.secondaryColor;
          this.git2 = this.git2 || this.tertiaryColor;
          this.git3 = this.git3 || adjust_default(this.primaryColor, { h: -30 });
          this.git4 = this.git4 || adjust_default(this.primaryColor, { h: -60 });
          this.git5 = this.git5 || adjust_default(this.primaryColor, { h: -90 });
          this.git6 = this.git6 || adjust_default(this.primaryColor, { h: 60 });
          this.git7 = this.git7 || adjust_default(this.primaryColor, { h: 120 });
          if (this.darkMode) {
            this.git0 = lighten_default(this.git0, 25);
            this.git1 = lighten_default(this.git1, 25);
            this.git2 = lighten_default(this.git2, 25);
            this.git3 = lighten_default(this.git3, 25);
            this.git4 = lighten_default(this.git4, 25);
            this.git5 = lighten_default(this.git5, 25);
            this.git6 = lighten_default(this.git6, 25);
            this.git7 = lighten_default(this.git7, 25);
          } else {
            this.git0 = darken_default(this.git0, 25);
            this.git1 = darken_default(this.git1, 25);
            this.git2 = darken_default(this.git2, 25);
            this.git3 = darken_default(this.git3, 25);
            this.git4 = darken_default(this.git4, 25);
            this.git5 = darken_default(this.git5, 25);
            this.git6 = darken_default(this.git6, 25);
            this.git7 = darken_default(this.git7, 25);
          }
          this.gitInv0 = this.gitInv0 || invert_default(this.git0);
          this.gitInv1 = this.gitInv1 || invert_default(this.git1);
          this.gitInv2 = this.gitInv2 || invert_default(this.git2);
          this.gitInv3 = this.gitInv3 || invert_default(this.git3);
          this.gitInv4 = this.gitInv4 || invert_default(this.git4);
          this.gitInv5 = this.gitInv5 || invert_default(this.git5);
          this.gitInv6 = this.gitInv6 || invert_default(this.git6);
          this.gitInv7 = this.gitInv7 || invert_default(this.git7);
          this.gitBranchLabel0 = this.gitBranchLabel0 || invert_default(this.labelTextColor);
          this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
          this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
          this.gitBranchLabel3 = this.gitBranchLabel3 || invert_default(this.labelTextColor);
          this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
          this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
          this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
          this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
          this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
          this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
          this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
          this.tagLabelFontSize = this.tagLabelFontSize || "10px";
          this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
          this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
          this.commitLabelFontSize = this.commitLabelFontSize || "10px";
          this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
          this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
        }
        calculate(overrides) {
          if (typeof overrides !== "object") {
            this.updateColors();
            return;
          }
          const keys2 = Object.keys(overrides);
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
          this.updateColors();
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
        }
      };
      getThemeVariables4 = /* @__PURE__ */ __name((userOverrides) => {
        const theme = new Theme4();
        theme.calculate(userOverrides);
        return theme;
      }, "getThemeVariables");
    }
  });

  // src/themes/theme-neutral.js
  var Theme5, getThemeVariables5;
  var init_theme_neutral = __esm({
    "src/themes/theme-neutral.js"() {
      "use strict";
      init_dist();
      init_theme_helpers();
      init_erDiagram_oldHardcodedValues();
      Theme5 = class {
        static {
          __name(this, "Theme");
        }
        constructor() {
          this.primaryColor = "#eee";
          this.contrast = "#707070";
          this.secondaryColor = lighten_default(this.contrast, 55);
          this.background = "#ffffff";
          this.tertiaryColor = adjust_default(this.primaryColor, { h: -160 });
          this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
          this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
          this.primaryTextColor = invert_default(this.primaryColor);
          this.secondaryTextColor = invert_default(this.secondaryColor);
          this.tertiaryTextColor = invert_default(this.tertiaryColor);
          this.lineColor = invert_default(this.background);
          this.textColor = invert_default(this.background);
          this.mainBkg = "#eee";
          this.secondBkg = "calculated";
          this.lineColor = "#666";
          this.border1 = "#999";
          this.border2 = "calculated";
          this.note = "#ffa";
          this.text = "#333";
          this.critical = "#d42";
          this.done = "#bbb";
          this.arrowheadColor = "#333333";
          this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
          this.fontSize = "16px";
          this.THEME_COLOR_LIMIT = 12;
          this.radius = 5;
          this.strokeWidth = 1;
          this.nodeBkg = "calculated";
          this.nodeBorder = "calculated";
          this.clusterBkg = "calculated";
          this.clusterBorder = "calculated";
          this.defaultLinkColor = "calculated";
          this.titleColor = "calculated";
          this.edgeLabelBackground = "white";
          this.actorBorder = "calculated";
          this.actorBkg = "calculated";
          this.actorTextColor = "calculated";
          this.actorLineColor = this.actorBorder;
          this.signalColor = "calculated";
          this.signalTextColor = "calculated";
          this.labelBoxBkgColor = "calculated";
          this.labelBoxBorderColor = "calculated";
          this.labelTextColor = "calculated";
          this.loopTextColor = "calculated";
          this.noteBorderColor = "calculated";
          this.noteBkgColor = "calculated";
          this.noteTextColor = "calculated";
          this.activationBorderColor = "#666";
          this.activationBkgColor = "#f4f4f4";
          this.sequenceNumberColor = "white";
          this.sectionBkgColor = "calculated";
          this.altSectionBkgColor = "white";
          this.sectionBkgColor2 = "calculated";
          this.excludeBkgColor = "#eeeeee";
          this.taskBorderColor = "calculated";
          this.taskBkgColor = "calculated";
          this.taskTextLightColor = "white";
          this.taskTextColor = "calculated";
          this.taskTextDarkColor = "calculated";
          this.taskTextOutsideColor = "calculated";
          this.taskTextClickableColor = "#003163";
          this.activeTaskBorderColor = "calculated";
          this.activeTaskBkgColor = "calculated";
          this.gridColor = "calculated";
          this.doneTaskBkgColor = "calculated";
          this.doneTaskBorderColor = "calculated";
          this.critBkgColor = "calculated";
          this.critBorderColor = "calculated";
          this.todayLineColor = "calculated";
          this.vertLineColor = "calculated";
          this.personBorder = this.primaryBorderColor;
          this.personBkg = this.mainBkg;
          this.archEdgeColor = "calculated";
          this.archEdgeArrowColor = "calculated";
          this.archEdgeWidth = "3";
          this.archGroupBorderColor = this.primaryBorderColor;
          this.archGroupBorderWidth = "2px";
          this.noteFontWeight = "normal";
          this.fontWeight = "normal";
          this.rowOdd = this.rowOdd || lighten_default(this.mainBkg, 75) || "#ffffff";
          this.rowEven = this.rowEven || "#f4f4f4";
          this.labelColor = "black";
          this.errorBkgColor = "#552222";
          this.errorTextColor = "#552222";
          this.useGradient = true;
          this.gradientStart = this.primaryBorderColor;
          this.gradientStop = this.secondaryBorderColor;
          this.dropShadow = "drop-shadow( 1px 2px 2px rgba(185,185,185,1))";
        }
        updateColors() {
          this.secondBkg = lighten_default(this.contrast, 55);
          this.border2 = this.contrast;
          this.actorBorder = lighten_default(this.border1, 23);
          this.actorBkg = this.mainBkg;
          this.actorTextColor = this.text;
          this.actorLineColor = this.actorBorder;
          this.signalColor = this.text;
          this.signalTextColor = this.text;
          this.labelBoxBkgColor = this.actorBkg;
          this.labelBoxBorderColor = this.actorBorder;
          this.labelTextColor = this.text;
          this.loopTextColor = this.text;
          this.noteBorderColor = "#999";
          this.noteBkgColor = "#666";
          this.noteTextColor = "#fff";
          this.cScale0 = this.cScale0 || "#555";
          this.cScale1 = this.cScale1 || "#F4F4F4";
          this.cScale2 = this.cScale2 || "#555";
          this.cScale3 = this.cScale3 || "#BBB";
          this.cScale4 = this.cScale4 || "#777";
          this.cScale5 = this.cScale5 || "#999";
          this.cScale6 = this.cScale6 || "#DDD";
          this.cScale7 = this.cScale7 || "#FFF";
          this.cScale8 = this.cScale8 || "#DDD";
          this.cScale9 = this.cScale9 || "#BBB";
          this.cScale10 = this.cScale10 || "#999";
          this.cScale11 = this.cScale11 || "#777";
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]);
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            if (this.darkMode) {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10);
            } else {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10);
            }
          }
          this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor);
          this.cScaleLabel0 = this.cScaleLabel0 || this.cScale1;
          this.cScaleLabel2 = this.cScaleLabel2 || this.cScale1;
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor;
          }
          for (let i2 = 0; i2 < 5; i2++) {
            this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { l: -(5 + i2 * 5) });
            this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { l: -(8 + i2 * 5) });
          }
          this.nodeBkg = this.mainBkg;
          this.nodeBorder = this.border1;
          this.clusterBkg = this.secondBkg;
          this.clusterBorder = this.border2;
          this.defaultLinkColor = this.lineColor;
          this.titleColor = this.text;
          this.sectionBkgColor = lighten_default(this.contrast, 30);
          this.sectionBkgColor2 = lighten_default(this.contrast, 30);
          this.taskBorderColor = darken_default(this.contrast, 10);
          this.taskBkgColor = this.contrast;
          this.taskTextColor = this.taskTextLightColor;
          this.taskTextDarkColor = this.text;
          this.taskTextOutsideColor = this.taskTextDarkColor;
          this.activeTaskBorderColor = this.taskBorderColor;
          this.activeTaskBkgColor = this.mainBkg;
          this.gridColor = lighten_default(this.border1, 30);
          this.doneTaskBkgColor = this.done;
          this.doneTaskBorderColor = this.lineColor;
          this.critBkgColor = this.critical;
          this.critBorderColor = darken_default(this.critBkgColor, 10);
          this.todayLineColor = this.critBkgColor;
          this.vertLineColor = this.critBkgColor;
          this.archEdgeColor = this.lineColor;
          this.archEdgeArrowColor = this.lineColor;
          this.transitionColor = this.transitionColor || "#000";
          this.transitionLabelColor = this.transitionLabelColor || this.textColor;
          this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
          this.stateBkg = this.stateBkg || this.mainBkg;
          this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
          this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
          this.altBackground = this.altBackground || "#f4f4f4";
          this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
          this.stateBorder = this.stateBorder || "#000";
          this.innerEndBackground = this.primaryBorderColor;
          this.specialStateColor = "#222";
          this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
          this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
          this.classText = this.primaryTextColor;
          this.fillType0 = this.primaryColor;
          this.fillType1 = this.secondaryColor;
          this.fillType2 = adjust_default(this.primaryColor, { h: 64 });
          this.fillType3 = adjust_default(this.secondaryColor, { h: 64 });
          this.fillType4 = adjust_default(this.primaryColor, { h: -64 });
          this.fillType5 = adjust_default(this.secondaryColor, { h: -64 });
          this.fillType6 = adjust_default(this.primaryColor, { h: 128 });
          this.fillType7 = adjust_default(this.secondaryColor, { h: 128 });
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["pie" + i2] = this["cScale" + i2];
          }
          this.pie12 = this.pie0;
          this.pieTitleTextSize = this.pieTitleTextSize || "25px";
          this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
          this.pieSectionTextSize = this.pieSectionTextSize || "17px";
          this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
          this.pieLegendTextSize = this.pieLegendTextSize || "17px";
          this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
          this.pieStrokeColor = this.pieStrokeColor || "black";
          this.pieStrokeWidth = this.pieStrokeWidth || "2px";
          this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
          this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
          this.pieOpacity = this.pieOpacity || "0.7";
          for (let i2 = 0; i2 < 8; i2++) {
            this["venn" + (i2 + 1)] = this["venn" + (i2 + 1)] ?? this["cScale" + i2];
          }
          this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor;
          this.vennSetTextColor = this.vennSetTextColor ?? this.textColor;
          this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
          this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 });
          this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 });
          this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 });
          this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
          this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 });
          this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 });
          this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 });
          this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill);
          this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
          this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
          this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
          this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
          this.xyChart = {
            backgroundColor: this.xyChart?.backgroundColor || this.background,
            titleColor: this.xyChart?.titleColor || this.primaryTextColor,
            dataLabelColor: this.xyChart?.dataLabelColor || this.primaryTextColor,
            xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
            xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
            xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
            xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
            yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
            yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
            yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
            yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
            plotColorPalette: this.xyChart?.plotColorPalette || "#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"
          };
          this.radar = {
            axisColor: this.radar?.axisColor || this.lineColor,
            axisStrokeWidth: this.radar?.axisStrokeWidth || 2,
            axisLabelFontSize: this.radar?.axisLabelFontSize || 12,
            curveOpacity: this.radar?.curveOpacity || 0.5,
            curveStrokeWidth: this.radar?.curveStrokeWidth || 2,
            graticuleColor: this.radar?.graticuleColor || "#DEDEDE",
            graticuleStrokeWidth: this.radar?.graticuleStrokeWidth || 1,
            graticuleOpacity: this.radar?.graticuleOpacity || 0.3,
            legendBoxSize: this.radar?.legendBoxSize || 12,
            legendFontSize: this.radar?.legendFontSize || 12
          };
          this.requirementBackground = this.requirementBackground || this.primaryColor;
          this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
          this.requirementBorderSize = this.requirementBorderSize || "1";
          this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
          this.relationColor = this.relationColor || this.lineColor;
          this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
          this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
          this.git0 = darken_default(this.pie1, 25) || this.primaryColor;
          this.git1 = this.pie2 || this.secondaryColor;
          this.git2 = this.pie3 || this.tertiaryColor;
          this.git3 = this.pie4 || adjust_default(this.primaryColor, { h: -30 });
          this.git4 = this.pie5 || adjust_default(this.primaryColor, { h: -60 });
          this.git5 = this.pie6 || adjust_default(this.primaryColor, { h: -90 });
          this.git6 = this.pie7 || adjust_default(this.primaryColor, { h: 60 });
          this.git7 = this.pie8 || adjust_default(this.primaryColor, { h: 120 });
          this.gitInv0 = this.gitInv0 || invert_default(this.git0);
          this.gitInv1 = this.gitInv1 || invert_default(this.git1);
          this.gitInv2 = this.gitInv2 || invert_default(this.git2);
          this.gitInv3 = this.gitInv3 || invert_default(this.git3);
          this.gitInv4 = this.gitInv4 || invert_default(this.git4);
          this.gitInv5 = this.gitInv5 || invert_default(this.git5);
          this.gitInv6 = this.gitInv6 || invert_default(this.git6);
          this.gitInv7 = this.gitInv7 || invert_default(this.git7);
          this.branchLabelColor = this.branchLabelColor || this.labelTextColor;
          this.gitBranchLabel0 = this.branchLabelColor;
          this.gitBranchLabel1 = "white";
          this.gitBranchLabel2 = this.branchLabelColor;
          this.gitBranchLabel3 = "white";
          this.gitBranchLabel4 = this.branchLabelColor;
          this.gitBranchLabel5 = this.branchLabelColor;
          this.gitBranchLabel6 = this.branchLabelColor;
          this.gitBranchLabel7 = this.branchLabelColor;
          this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
          this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
          this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
          this.tagLabelFontSize = this.tagLabelFontSize || "10px";
          this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
          this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
          this.commitLabelFontSize = this.commitLabelFontSize || "10px";
          this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
          this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
        }
        calculate(overrides) {
          if (typeof overrides !== "object") {
            this.updateColors();
            return;
          }
          const keys2 = Object.keys(overrides);
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
          this.updateColors();
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
        }
      };
      getThemeVariables5 = /* @__PURE__ */ __name((userOverrides) => {
        const theme = new Theme5();
        theme.calculate(userOverrides);
        return theme;
      }, "getThemeVariables");
    }
  });

  // src/themes/theme-neo.js
  var Theme6, getThemeVariables6;
  var init_theme_neo = __esm({
    "src/themes/theme-neo.js"() {
      "use strict";
      init_dist();
      init_theme_helpers();
      init_erDiagram_oldHardcodedValues();
      Theme6 = class {
        static {
          __name(this, "Theme");
        }
        constructor() {
          this.background = "#ffffff";
          this.primaryColor = "#cccccc";
          this.mainBkg = "#ffffff";
          this.noteBkgColor = "#fff5ad";
          this.noteTextColor = "#333";
          this.THEME_COLOR_LIMIT = 12;
          this.radius = 3;
          this.strokeWidth = 2;
          this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
          this.fontFamily = "arial, sans-serif";
          this.fontSize = "14px";
          this.nodeBorder = "#000000";
          this.stateBorder = "#000000";
          this.useGradient = true;
          this.gradientStart = "#0042eb";
          this.gradientStop = "#eb0042";
          this.dropShadow = "drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));";
          this.tertiaryColor = "#ffffff";
          this.archEdgeColor = "calculated";
          this.archEdgeArrowColor = "calculated";
          this.archEdgeWidth = "3";
          this.archGroupBorderColor = this.primaryBorderColor;
          this.archGroupBorderWidth = "2px";
          this.noteFontWeight = "normal";
          this.fontWeight = "normal";
        }
        updateColors() {
          this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#333");
          this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 });
          this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 });
          this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode);
          this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode);
          this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode);
          this.noteBkgColor = this.noteBkgColor || "#fff5ad";
          this.noteTextColor = this.noteTextColor || "#333";
          this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor);
          this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor);
          this.lineColor = this.lineColor || invert_default(this.background);
          this.arrowheadColor = this.arrowheadColor || invert_default(this.background);
          this.textColor = this.textColor || this.primaryTextColor;
          this.border2 = this.border2 || this.tertiaryBorderColor;
          this.nodeBkg = this.nodeBkg || this.primaryColor;
          this.mainBkg = this.mainBkg || this.primaryColor;
          this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
          this.clusterBkg = this.clusterBkg || this.tertiaryColor;
          this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
          this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
          this.titleColor = this.titleColor || this.tertiaryTextColor;
          this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
          this.actorBorder = this.actorBorder || this.primaryBorderColor;
          this.actorBkg = this.actorBkg || this.mainBkg;
          this.actorTextColor = this.actorTextColor || this.primaryTextColor;
          this.actorLineColor = this.actorLineColor || this.actorBorder;
          this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
          this.signalColor = this.signalColor || this.textColor;
          this.signalTextColor = this.signalTextColor || this.textColor;
          this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
          this.labelTextColor = this.labelTextColor || this.actorTextColor;
          this.loopTextColor = this.loopTextColor || this.actorTextColor;
          this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10);
          this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
          this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor);
          const primaryColor = "#ECECFE";
          const secondaryColor = "#E9E9F1";
          const tertiaryColor = adjust_default(primaryColor, { h: 180, l: 5 });
          this.sectionBkgColor = this.sectionBkgColor || tertiaryColor;
          this.altSectionBkgColor = this.altSectionBkgColor || "white";
          this.sectionBkgColor = this.sectionBkgColor || secondaryColor;
          this.sectionBkgColor2 = this.sectionBkgColor2 || primaryColor;
          this.excludeBkgColor = this.excludeBkgColor || "#eeeeee";
          this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
          this.taskBkgColor = this.taskBkgColor || primaryColor;
          this.activeTaskBorderColor = this.activeTaskBorderColor || primaryColor;
          this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(primaryColor, 23);
          this.gridColor = this.gridColor || "lightgrey";
          this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey";
          this.doneTaskBorderColor = this.doneTaskBorderColor || "grey";
          this.critBorderColor = this.critBorderColor || "#ff8888";
          this.critBkgColor = this.critBkgColor || "red";
          this.todayLineColor = this.todayLineColor || "red";
          this.taskTextColor = this.taskTextColor || this.textColor;
          this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
          this.vertLineColor = this.vertLineColor || this.primaryBorderColor;
          this.taskTextLightColor = this.taskTextLightColor || this.textColor;
          this.taskTextColor = this.taskTextColor || this.primaryTextColor;
          this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
          this.taskTextClickableColor = this.taskTextClickableColor || "#003163";
          this.archEdgeColor = this.lineColor;
          this.archEdgeArrowColor = this.lineColor;
          this.personBorder = this.personBorder || this.primaryBorderColor;
          this.personBkg = this.personBkg || this.mainBkg;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.transitionLabelColor = this.transitionLabelColor || this.textColor;
          this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
          this.stateBkg = this.stateBkg || this.mainBkg;
          this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
          this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
          this.altBackground = this.altBackground || "#f0f0f0";
          this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
          this.compositeBorder = this.compositeBorder || this.nodeBorder;
          this.innerEndBackground = this.nodeBorder;
          this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
          this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.specialStateColor = this.lineColor;
          this.cScale0 = this.cScale0 || primaryColor;
          this.cScale1 = this.cScale1 || secondaryColor;
          this.cScale2 = this.cScale2 || tertiaryColor;
          this.cScale3 = this.cScale3 || adjust_default(primaryColor, { h: 30 });
          this.cScale4 = this.cScale4 || adjust_default(primaryColor, { h: 60 });
          this.cScale5 = this.cScale5 || adjust_default(primaryColor, { h: 90 });
          this.cScale6 = this.cScale6 || adjust_default(primaryColor, { h: 120 });
          this.cScale7 = this.cScale7 || adjust_default(primaryColor, { h: 150 });
          this.cScale8 = this.cScale8 || adjust_default(primaryColor, { h: 210, l: 150 });
          this.cScale9 = this.cScale9 || adjust_default(primaryColor, { h: 270 });
          this.cScale10 = this.cScale10 || adjust_default(primaryColor, { h: 300 });
          this.cScale11 = this.cScale11 || adjust_default(primaryColor, { h: 330 });
          if (this.darkMode) {
            for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
              this["cScale" + i2] = darken_default(this["cScale" + i2], 75);
            }
          } else {
            for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
              this["cScale" + i2] = darken_default(this["cScale" + i2], 25);
            }
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]);
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            if (this.darkMode) {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10);
            } else {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10);
            }
          }
          this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor;
          }
          const multiplier = this.darkMode ? -4 : -1;
          for (let i2 = 0; i2 < 5; i2++) {
            this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) });
            this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) });
          }
          this.classText = this.classText || this.textColor;
          this.fillType0 = this.fillType0 || primaryColor;
          this.fillType1 = this.fillType1 || secondaryColor;
          this.fillType2 = this.fillType2 || adjust_default(primaryColor, { h: 64 });
          this.fillType3 = this.fillType3 || adjust_default(secondaryColor, { h: 64 });
          this.fillType4 = this.fillType4 || adjust_default(primaryColor, { h: -64 });
          this.fillType5 = this.fillType5 || adjust_default(secondaryColor, { h: -64 });
          this.fillType6 = this.fillType6 || adjust_default(primaryColor, { h: 128 });
          this.fillType7 = this.fillType7 || adjust_default(secondaryColor, { h: 128 });
          this.pie1 = this.pie1 || primaryColor;
          this.pie2 = this.pie2 || secondaryColor;
          this.pie3 = this.pie3 || tertiaryColor;
          this.pie4 = this.pie4 || adjust_default(primaryColor, { l: -10 });
          this.pie5 = this.pie5 || adjust_default(secondaryColor, { l: -10 });
          this.pie6 = this.pie6 || adjust_default(tertiaryColor, { l: -10 });
          this.pie7 = this.pie7 || adjust_default(primaryColor, { h: 60, l: -10 });
          this.pie8 = this.pie8 || adjust_default(primaryColor, { h: -60, l: -10 });
          this.pie9 = this.pie9 || adjust_default(primaryColor, { h: 120, l: 0 });
          this.pie10 = this.pie10 || adjust_default(primaryColor, { h: 60, l: -20 });
          this.pie11 = this.pie11 || adjust_default(primaryColor, { h: -60, l: -20 });
          this.pie12 = this.pie12 || adjust_default(primaryColor, { h: 120, l: -10 });
          this.pieTitleTextSize = this.pieTitleTextSize || "25px";
          this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
          this.pieSectionTextSize = this.pieSectionTextSize || "17px";
          this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
          this.pieLegendTextSize = this.pieLegendTextSize || "17px";
          this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
          this.pieStrokeColor = this.pieStrokeColor || "black";
          this.pieStrokeWidth = this.pieStrokeWidth || "2px";
          this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
          this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
          this.pieOpacity = this.pieOpacity || "0.7";
          this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor;
          this.vennSetTextColor = this.vennSetTextColor ?? this.textColor;
          this.quadrant1Fill = this.quadrant1Fill || primaryColor;
          this.quadrant2Fill = this.quadrant2Fill || adjust_default(primaryColor, { r: 5, g: 5, b: 5 });
          this.quadrant3Fill = this.quadrant3Fill || adjust_default(primaryColor, { r: 10, g: 10, b: 10 });
          this.quadrant4Fill = this.quadrant4Fill || adjust_default(primaryColor, { r: 15, g: 15, b: 15 });
          this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
          this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 });
          this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 });
          this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 });
          this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill);
          this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
          this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
          this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
          this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
          this.xyChart = {
            backgroundColor: this.xyChart?.backgroundColor || this.background,
            titleColor: this.xyChart?.titleColor || this.primaryTextColor,
            xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
            xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
            xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
            xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
            yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
            yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
            yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
            yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
            plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"
          };
          this.requirementBackground = this.requirementBackground || primaryColor;
          this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
          this.requirementBorderSize = this.requirementBorderSize || "1";
          this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
          this.relationColor = this.relationColor || this.lineColor;
          this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
          this.git0 = this.git0 || primaryColor;
          this.git1 = this.git1 || secondaryColor;
          this.git2 = this.git2 || tertiaryColor;
          this.git3 = this.git3 || adjust_default(primaryColor, { h: -30 });
          this.git4 = this.git4 || adjust_default(primaryColor, { h: -60 });
          this.git5 = this.git5 || adjust_default(primaryColor, { h: -90 });
          this.git6 = this.git6 || adjust_default(primaryColor, { h: 60 });
          this.git7 = this.git7 || adjust_default(primaryColor, { h: 120 });
          if (this.darkMode) {
            this.git0 = lighten_default(this.git0, 25);
            this.git1 = lighten_default(this.git1, 25);
            this.git2 = lighten_default(this.git2, 25);
            this.git3 = lighten_default(this.git3, 25);
            this.git4 = lighten_default(this.git4, 25);
            this.git5 = lighten_default(this.git5, 25);
            this.git6 = lighten_default(this.git6, 25);
            this.git7 = lighten_default(this.git7, 25);
          } else {
            this.git0 = darken_default(this.git0, 25);
            this.git1 = darken_default(this.git1, 25);
            this.git2 = darken_default(this.git2, 25);
            this.git3 = darken_default(this.git3, 25);
            this.git4 = darken_default(this.git4, 25);
            this.git5 = darken_default(this.git5, 25);
            this.git6 = darken_default(this.git6, 25);
            this.git7 = darken_default(this.git7, 25);
          }
          this.gitInv0 = this.gitInv0 || invert_default(this.git0);
          this.gitInv1 = this.gitInv1 || invert_default(this.git1);
          this.gitInv2 = this.gitInv2 || invert_default(this.git2);
          this.gitInv3 = this.gitInv3 || invert_default(this.git3);
          this.gitInv4 = this.gitInv4 || invert_default(this.git4);
          this.gitInv5 = this.gitInv5 || invert_default(this.git5);
          this.gitInv6 = this.gitInv6 || invert_default(this.git6);
          this.gitInv7 = this.gitInv7 || invert_default(this.git7);
          this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor);
          this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor;
          this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor;
          this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor;
          this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor;
          this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor;
          this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor;
          this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor;
          this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor;
          this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
          this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
          this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
          this.tagLabelFontSize = this.tagLabelFontSize || "10px";
          this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
          this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
          this.commitLabelFontSize = this.commitLabelFontSize || "10px";
          this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
          this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
        }
        calculate(overrides) {
          if (typeof overrides !== "object") {
            this.updateColors();
            return;
          }
          const keys2 = Object.keys(overrides);
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
          this.updateColors();
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
        }
      };
      getThemeVariables6 = /* @__PURE__ */ __name((userOverrides) => {
        const theme = new Theme6();
        theme.calculate(userOverrides);
        return theme;
      }, "getThemeVariables");
    }
  });

  // src/themes/theme-neo-dark.js
  var Theme7, getThemeVariables7;
  var init_theme_neo_dark = __esm({
    "src/themes/theme-neo-dark.js"() {
      "use strict";
      init_dist();
      init_theme_helpers();
      init_erDiagram_oldHardcodedValues();
      Theme7 = class {
        static {
          __name(this, "Theme");
        }
        constructor() {
          this.background = "#333";
          this.primaryColor = "#1f2020";
          this.secondaryColor = lighten_default(this.primaryColor, 16);
          this.tertiaryColor = adjust_default(this.primaryColor, { h: -160 });
          this.primaryBorderColor = invert_default(this.background);
          this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
          this.primaryTextColor = invert_default(this.primaryColor);
          this.secondaryTextColor = invert_default(this.secondaryColor);
          this.tertiaryTextColor = invert_default(this.tertiaryColor);
          this.mainBkg = "#2a2020";
          this.secondBkg = "calculated";
          this.mainContrastColor = "lightgrey";
          this.darkTextColor = lighten_default(invert_default("#323D47"), 10);
          this.border1 = "#ccc";
          this.border2 = rgba_default(255, 255, 255, 0.25);
          this.arrowheadColor = invert_default(this.background);
          this.fontFamily = "arial, sans-serif";
          this.fontSize = "14px";
          this.labelBackground = "#181818";
          this.textColor = "#ccc";
          this.THEME_COLOR_LIMIT = 12;
          this.radius = 3;
          this.strokeWidth = 1;
          this.noteBkgColor = "#fff5ad";
          this.noteTextColor = "#333";
          this.THEME_COLOR_LIMIT = 12;
          this.fontFamily = "arial, sans-serif";
          this.fontSize = "14px";
          this.useGradient = true;
          this.gradientStart = "#0042eb";
          this.gradientStop = "#eb0042";
          this.dropShadow = "drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))";
          this.archEdgeColor = "calculated";
          this.archEdgeArrowColor = "calculated";
          this.archEdgeWidth = "3";
          this.archGroupBorderColor = this.primaryBorderColor;
          this.archGroupBorderWidth = "2px";
          this.noteFontWeight = "normal";
          this.fontWeight = "normal";
        }
        updateColors() {
          this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#333");
          this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 });
          this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 });
          this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode);
          this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode);
          this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode);
          this.noteBkgColor = this.noteBkgColor || "#fff5ad";
          this.noteTextColor = this.noteTextColor || "#333";
          this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor);
          this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor);
          this.lineColor = this.lineColor || invert_default(this.background);
          this.arrowheadColor = this.arrowheadColor || invert_default(this.background);
          this.textColor = this.textColor || this.primaryTextColor;
          this.border2 = this.border2 || this.tertiaryBorderColor;
          this.nodeBkg = this.nodeBkg || this.primaryColor;
          this.mainBkg = this.mainBkg || this.primaryColor;
          this.nodeBorder = this.nodeBorder || this.border1;
          this.clusterBkg = this.clusterBkg || this.tertiaryColor;
          this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
          this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
          this.titleColor = this.titleColor || this.tertiaryTextColor;
          this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
          this.actorBorder = this.actorBorder || this.primaryBorderColor;
          this.actorBkg = this.actorBkg || this.mainBkg;
          this.actorTextColor = this.actorTextColor || this.primaryTextColor;
          this.actorLineColor = this.actorLineColor || this.actorBorder;
          this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
          this.signalColor = this.signalColor || this.textColor;
          this.signalTextColor = this.signalTextColor || this.textColor;
          this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
          this.labelTextColor = this.labelTextColor || this.actorTextColor;
          this.loopTextColor = this.loopTextColor || this.actorTextColor;
          this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10);
          this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
          this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor);
          this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
          this.altSectionBkgColor = this.altSectionBkgColor || "white";
          this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
          this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
          this.excludeBkgColor = this.excludeBkgColor || "#eeeeee";
          this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
          this.taskBkgColor = this.taskBkgColor || this.primaryColor;
          this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
          this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(this.primaryColor, 23);
          this.gridColor = this.gridColor || "lightgrey";
          this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey";
          this.doneTaskBorderColor = this.doneTaskBorderColor || "grey";
          this.critBorderColor = this.critBorderColor || "#ff8888";
          this.critBkgColor = this.critBkgColor || "red";
          this.todayLineColor = this.todayLineColor || "red";
          this.vertLineColor = this.vertLineColor || this.primaryBorderColor;
          this.taskTextColor = this.taskTextColor || this.textColor;
          this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
          this.taskTextLightColor = this.taskTextLightColor || this.textColor;
          this.taskTextColor = this.taskTextColor || this.primaryTextColor;
          this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
          this.taskTextClickableColor = this.taskTextClickableColor || "#003163";
          this.archEdgeColor = this.lineColor;
          this.archEdgeArrowColor = this.lineColor;
          this.personBorder = this.personBorder || this.primaryBorderColor;
          this.personBkg = this.personBkg || this.mainBkg;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.transitionLabelColor = this.transitionLabelColor || this.textColor;
          this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
          this.stateBkg = this.stateBkg || this.mainBkg;
          this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
          this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
          this.altBackground = this.altBackground || "#f0f0f0";
          this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
          this.compositeBorder = this.compositeBorder || this.nodeBorder;
          this.innerEndBackground = this.nodeBorder;
          this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
          this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.specialStateColor = this.lineColor;
          this.cScale0 = this.cScale0 || this.primaryColor;
          this.cScale1 = this.cScale1 || this.secondaryColor;
          this.cScale2 = this.cScale2 || this.tertiaryColor;
          this.cScale3 = this.cScale3 || adjust_default(this.primaryColor, { h: 30 });
          this.cScale4 = this.cScale4 || adjust_default(this.primaryColor, { h: 60 });
          this.cScale5 = this.cScale5 || adjust_default(this.primaryColor, { h: 90 });
          this.cScale6 = this.cScale6 || adjust_default(this.primaryColor, { h: 120 });
          this.cScale7 = this.cScale7 || adjust_default(this.primaryColor, { h: 150 });
          this.cScale8 = this.cScale8 || adjust_default(this.primaryColor, { h: 210, l: 150 });
          this.cScale9 = this.cScale9 || adjust_default(this.primaryColor, { h: 270 });
          this.cScale10 = this.cScale10 || adjust_default(this.primaryColor, { h: 300 });
          this.cScale11 = this.cScale11 || adjust_default(this.primaryColor, { h: 330 });
          if (this.darkMode) {
            for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
              this["cScale" + i2] = darken_default(this["cScale" + i2], 75);
            }
          } else {
            for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
              this["cScale" + i2] = darken_default(this["cScale" + i2], 25);
            }
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]);
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            if (this.darkMode) {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10);
            } else {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10);
            }
          }
          this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor;
          }
          const multiplier = this.darkMode ? -4 : -1;
          for (let i2 = 0; i2 < 5; i2++) {
            this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) });
            this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) });
          }
          this.classText = this.classText || this.textColor;
          this.fillType0 = this.fillType0 || this.primaryColor;
          this.fillType1 = this.fillType1 || this.secondaryColor;
          this.fillType2 = this.fillType2 || adjust_default(this.primaryColor, { h: 64 });
          this.fillType3 = this.fillType3 || adjust_default(this.secondaryColor, { h: 64 });
          this.fillType4 = this.fillType4 || adjust_default(this.primaryColor, { h: -64 });
          this.fillType5 = this.fillType5 || adjust_default(this.secondaryColor, { h: -64 });
          this.fillType6 = this.fillType6 || adjust_default(this.primaryColor, { h: 128 });
          this.fillType7 = this.fillType7 || adjust_default(this.secondaryColor, { h: 128 });
          this.pie1 = this.pie1 || this.primaryColor;
          this.pie2 = this.pie2 || this.secondaryColor;
          this.pie3 = this.pie3 || this.tertiaryColor;
          this.pie4 = this.pie4 || adjust_default(this.primaryColor, { l: -10 });
          this.pie5 = this.pie5 || adjust_default(this.secondaryColor, { l: -10 });
          this.pie6 = this.pie6 || adjust_default(this.tertiaryColor, { l: -10 });
          this.pie7 = this.pie7 || adjust_default(this.primaryColor, { h: 60, l: -10 });
          this.pie8 = this.pie8 || adjust_default(this.primaryColor, { h: -60, l: -10 });
          this.pie9 = this.pie9 || adjust_default(this.primaryColor, { h: 120, l: 0 });
          this.pie10 = this.pie10 || adjust_default(this.primaryColor, { h: 60, l: -20 });
          this.pie11 = this.pie11 || adjust_default(this.primaryColor, { h: -60, l: -20 });
          this.pie12 = this.pie12 || adjust_default(this.primaryColor, { h: 120, l: -10 });
          this.pieTitleTextSize = this.pieTitleTextSize || "25px";
          this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
          this.pieSectionTextSize = this.pieSectionTextSize || "17px";
          this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
          this.pieLegendTextSize = this.pieLegendTextSize || "17px";
          this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
          this.pieStrokeColor = this.pieStrokeColor || "black";
          this.pieStrokeWidth = this.pieStrokeWidth || "2px";
          this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
          this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
          this.pieOpacity = this.pieOpacity || "0.7";
          this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor;
          this.vennSetTextColor = this.vennSetTextColor ?? this.textColor;
          this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
          this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 });
          this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 });
          this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 });
          this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
          this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 });
          this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 });
          this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 });
          this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill);
          this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
          this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
          this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
          this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
          this.xyChart = {
            backgroundColor: this.xyChart?.backgroundColor || this.background,
            titleColor: this.xyChart?.titleColor || this.primaryTextColor,
            xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
            xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
            xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
            xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
            yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
            yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
            yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
            yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
            plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"
          };
          this.requirementBackground = this.requirementBackground || this.primaryColor;
          this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
          this.requirementBorderSize = this.requirementBorderSize || "1";
          this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
          this.relationColor = this.relationColor || this.lineColor;
          this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
          this.git0 = this.git0 || "#0b0000";
          this.git1 = this.git1 || "#4d1037";
          this.git2 = this.git2 || "#3f5258";
          this.git3 = this.git3 || "#4f2f1b";
          this.git4 = this.git4 || "#6e0a0a";
          this.git5 = this.git5 || "#3b0048";
          this.git6 = this.git6 || "#995a01";
          this.git7 = this.git7 || "#154706";
          this.gitDarkMode = true;
          if (this.gitDarkMode) {
            this.git0 = lighten_default(this.git0, 25);
            this.git1 = lighten_default(this.git1, 25);
            this.git2 = lighten_default(this.git2, 25);
            this.git3 = lighten_default(this.git3, 25);
            this.git4 = lighten_default(this.git4, 25);
            this.git5 = lighten_default(this.git5, 25);
            this.git6 = lighten_default(this.git6, 25);
            this.git7 = lighten_default(this.git7, 25);
          } else {
            this.git0 = darken_default(this.git0, 25);
            this.git1 = darken_default(this.git1, 25);
            this.git2 = darken_default(this.git2, 25);
            this.git3 = darken_default(this.git3, 25);
            this.git4 = darken_default(this.git4, 25);
            this.git5 = darken_default(this.git5, 25);
            this.git6 = darken_default(this.git6, 25);
            this.git7 = darken_default(this.git7, 25);
          }
          this.gitInv0 = this.gitInv0 || invert_default(this.git0);
          this.gitInv1 = this.gitInv1 || invert_default(this.git1);
          this.gitInv2 = this.gitInv2 || invert_default(this.git2);
          this.gitInv3 = this.gitInv3 || invert_default(this.git3);
          this.gitInv4 = this.gitInv4 || invert_default(this.git4);
          this.gitInv5 = this.gitInv5 || invert_default(this.git5);
          this.gitInv6 = this.gitInv6 || invert_default(this.git6);
          this.gitInv7 = this.gitInv7 || invert_default(this.git7);
          this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor);
          this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor;
          this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor;
          this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor;
          this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor;
          this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor;
          this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor;
          this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor;
          this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor;
          this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
          this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
          this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
          this.tagLabelFontSize = this.tagLabelFontSize || "10px";
          this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
          this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
          this.commitLabelFontSize = this.commitLabelFontSize || "10px";
          this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
          this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
        }
        calculate(overrides) {
          if (typeof overrides !== "object") {
            this.updateColors();
            return;
          }
          const keys2 = Object.keys(overrides);
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
          this.updateColors();
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
        }
      };
      getThemeVariables7 = /* @__PURE__ */ __name((userOverrides) => {
        const theme = new Theme7();
        theme.calculate(userOverrides);
        return theme;
      }, "getThemeVariables");
    }
  });

  // src/themes/theme-redux.js
  var Theme8, getThemeVariables8;
  var init_theme_redux = __esm({
    "src/themes/theme-redux.js"() {
      "use strict";
      init_dist();
      init_theme_helpers();
      init_erDiagram_oldHardcodedValues();
      Theme8 = class {
        static {
          __name(this, "Theme");
        }
        constructor() {
          this.background = "#ffffff";
          this.primaryColor = "#cccccc";
          this.mainBkg = "#ffffff";
          this.noteBkgColor = "#fff5ad";
          this.noteTextColor = "#28253D";
          this.THEME_COLOR_LIMIT = 12;
          this.radius = 12;
          this.strokeWidth = 2;
          this.primaryBorderColor = mkBorder("#28253D", this.darkMode);
          this.fontFamily = '"Recursive Variable", arial, sans-serif';
          this.fontSize = "14px";
          this.nodeBorder = "#28253D";
          this.stateBorder = "#28253D";
          this.useGradient = false;
          this.gradientStart = "#0042eb";
          this.gradientStop = "#eb0042";
          this.dropShadow = "url(#drop-shadow)";
          this.nodeShadow = true;
          this.tertiaryColor = "#ffffff";
          this.clusterBkg = "#F9F9FB";
          this.clusterBorder = "#BDBCCC";
          this.noteBorderColor = "#FACC15";
          this.archEdgeColor = "calculated";
          this.archEdgeArrowColor = "calculated";
          this.archEdgeWidth = "3";
          this.archGroupBorderColor = this.primaryBorderColor;
          this.archGroupBorderWidth = "2px";
          this.actorBorder = "#28253D";
          this.filterColor = "#000000";
        }
        updateColors() {
          this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#28253D");
          this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 });
          this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 });
          this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode);
          this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode);
          this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode);
          this.noteBkgColor = this.noteBkgColor || "#FEF9C3";
          this.noteTextColor = this.noteTextColor || "#28253D";
          this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor);
          this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor);
          this.lineColor = this.lineColor || invert_default(this.background);
          this.arrowheadColor = this.arrowheadColor || invert_default(this.background);
          this.textColor = this.textColor || this.primaryTextColor;
          this.border2 = this.border2 || this.tertiaryBorderColor;
          this.nodeBkg = this.nodeBkg || this.primaryColor;
          this.mainBkg = this.mainBkg || this.primaryColor;
          this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
          this.clusterBkg = this.clusterBkg || this.tertiaryColor;
          this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
          this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
          this.titleColor = this.titleColor || this.tertiaryTextColor;
          this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
          this.noteFontWeight = 600;
          this.actorBorder = this.actorBorder || this.primaryBorderColor;
          this.actorBkg = this.actorBkg || this.mainBkg;
          this.actorTextColor = this.actorTextColor || this.primaryTextColor;
          this.actorLineColor = this.actorLineColor || this.actorBorder;
          this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
          this.signalColor = this.signalColor || this.textColor;
          this.signalTextColor = this.signalTextColor || this.textColor;
          this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
          this.labelTextColor = this.labelTextColor || this.actorTextColor;
          this.loopTextColor = this.loopTextColor || this.actorTextColor;
          this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10);
          this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
          this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor);
          const primaryColor = "#ECECFE";
          const secondaryColor = "#E9E9F1";
          const tertiaryColor = adjust_default(primaryColor, { h: 180, l: 5 });
          this.sectionBkgColor = this.sectionBkgColor || tertiaryColor;
          this.altSectionBkgColor = this.altSectionBkgColor || "white";
          this.sectionBkgColor = this.sectionBkgColor || secondaryColor;
          this.sectionBkgColor2 = this.sectionBkgColor2 || primaryColor;
          this.excludeBkgColor = this.excludeBkgColor || "#eeeeee";
          this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
          this.taskBkgColor = this.taskBkgColor || primaryColor;
          this.activeTaskBorderColor = this.activeTaskBorderColor || primaryColor;
          this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(primaryColor, 23);
          this.gridColor = this.gridColor || "lightgrey";
          this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey";
          this.doneTaskBorderColor = this.doneTaskBorderColor || "grey";
          this.critBorderColor = this.critBorderColor || "#ff8888";
          this.critBkgColor = this.critBkgColor || "red";
          this.todayLineColor = this.todayLineColor || "red";
          this.taskTextColor = this.taskTextColor || this.textColor;
          this.vertLineColor = this.vertLineColor || this.primaryBorderColor;
          this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
          this.taskTextLightColor = this.taskTextLightColor || this.textColor;
          this.taskTextColor = this.taskTextColor || this.primaryTextColor;
          this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
          this.taskTextClickableColor = this.taskTextClickableColor || "#003163";
          this.archEdgeColor = this.lineColor;
          this.archEdgeArrowColor = this.lineColor;
          this.personBorder = this.personBorder || this.primaryBorderColor;
          this.personBkg = this.personBkg || this.mainBkg;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.transitionLabelColor = this.transitionLabelColor || this.textColor;
          this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
          this.compositeTitleBackground = "#F9F9FB";
          this.altBackground = "#F9F9FB";
          this.stateEdgeLabelBackground = "#FFFFFF";
          this.fontWeight = 600;
          this.stateBkg = this.stateBkg || this.mainBkg;
          this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
          this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
          this.altBackground = this.altBackground || "#f0f0f0";
          this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
          this.compositeBorder = this.compositeBorder || this.nodeBorder;
          this.innerEndBackground = this.nodeBorder;
          this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
          this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.specialStateColor = this.lineColor;
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScale" + i2] = this.mainBkg;
          }
          if (this.darkMode) {
            for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
              this["cScale" + i2] = darken_default(this["cScale" + i2], 75);
            }
          } else {
            for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
              this["cScale" + i2] = darken_default(this["cScale" + i2], 25);
            }
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]);
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            if (this.darkMode) {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10);
            } else {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10);
            }
          }
          this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor;
          }
          const multiplier = this.darkMode ? -4 : -1;
          for (let i2 = 0; i2 < 5; i2++) {
            this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) });
            this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) });
          }
          this.classText = this.classText || this.textColor;
          this.fillType0 = this.fillType0 || primaryColor;
          this.fillType1 = this.fillType1 || secondaryColor;
          this.fillType2 = this.fillType2 || adjust_default(primaryColor, { h: 64 });
          this.fillType3 = this.fillType3 || adjust_default(secondaryColor, { h: 64 });
          this.fillType4 = this.fillType4 || adjust_default(primaryColor, { h: -64 });
          this.fillType5 = this.fillType5 || adjust_default(secondaryColor, { h: -64 });
          this.fillType6 = this.fillType6 || adjust_default(primaryColor, { h: 128 });
          this.fillType7 = this.fillType7 || adjust_default(secondaryColor, { h: 128 });
          this.pie1 = this.pie1 || primaryColor;
          this.pie2 = this.pie2 || secondaryColor;
          this.pie3 = this.pie3 || tertiaryColor;
          this.pie4 = this.pie4 || adjust_default(primaryColor, { l: -10 });
          this.pie5 = this.pie5 || adjust_default(secondaryColor, { l: -10 });
          this.pie6 = this.pie6 || adjust_default(tertiaryColor, { l: -10 });
          this.pie7 = this.pie7 || adjust_default(primaryColor, { h: 60, l: -10 });
          this.pie8 = this.pie8 || adjust_default(primaryColor, { h: -60, l: -10 });
          this.pie9 = this.pie9 || adjust_default(primaryColor, { h: 120, l: 0 });
          this.pie10 = this.pie10 || adjust_default(primaryColor, { h: 60, l: -20 });
          this.pie11 = this.pie11 || adjust_default(primaryColor, { h: -60, l: -20 });
          this.pie12 = this.pie12 || adjust_default(primaryColor, { h: 120, l: -10 });
          this.pieTitleTextSize = this.pieTitleTextSize || "25px";
          this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
          this.pieSectionTextSize = this.pieSectionTextSize || "17px";
          this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
          this.pieLegendTextSize = this.pieLegendTextSize || "17px";
          this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
          this.pieStrokeColor = this.pieStrokeColor || "black";
          this.pieStrokeWidth = this.pieStrokeWidth || "2px";
          this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
          this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
          this.pieOpacity = this.pieOpacity || "0.7";
          this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor;
          this.vennSetTextColor = this.vennSetTextColor ?? this.textColor;
          this.quadrant1Fill = this.quadrant1Fill || primaryColor;
          this.quadrant2Fill = this.quadrant2Fill || adjust_default(primaryColor, { r: 5, g: 5, b: 5 });
          this.quadrant3Fill = this.quadrant3Fill || adjust_default(primaryColor, { r: 10, g: 10, b: 10 });
          this.quadrant4Fill = this.quadrant4Fill || adjust_default(primaryColor, { r: 15, g: 15, b: 15 });
          this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
          this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 });
          this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 });
          this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 });
          this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill);
          this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
          this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
          this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
          this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
          this.xyChart = {
            backgroundColor: this.xyChart?.backgroundColor || this.background,
            titleColor: this.xyChart?.titleColor || this.primaryTextColor,
            xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
            xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
            xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
            xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
            yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
            yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
            yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
            yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
            plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"
          };
          this.requirementBackground = this.requirementBackground || primaryColor;
          this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
          this.requirementBorderSize = this.requirementBorderSize || "1";
          this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
          this.relationColor = this.relationColor || this.lineColor;
          this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
          this.requirementEdgeLabelBackground = "#FFFFFF";
          this.git0 = this.git0 || primaryColor;
          this.git1 = this.git1 || secondaryColor;
          this.git2 = this.git2 || tertiaryColor;
          this.git3 = this.git3 || adjust_default(primaryColor, { h: -30 });
          this.git4 = this.git4 || adjust_default(primaryColor, { h: -60 });
          this.git5 = this.git5 || adjust_default(primaryColor, { h: -90 });
          this.git6 = this.git6 || adjust_default(primaryColor, { h: 60 });
          this.git7 = this.git7 || adjust_default(primaryColor, { h: 120 });
          if (this.darkMode) {
            this.git0 = lighten_default(this.git0, 25);
            this.git1 = lighten_default(this.git1, 25);
            this.git2 = lighten_default(this.git2, 25);
            this.git3 = lighten_default(this.git3, 25);
            this.git4 = lighten_default(this.git4, 25);
            this.git5 = lighten_default(this.git5, 25);
            this.git6 = lighten_default(this.git6, 25);
            this.git7 = lighten_default(this.git7, 25);
          } else {
            this.git0 = darken_default(this.git0, 25);
            this.git1 = darken_default(this.git1, 25);
            this.git2 = darken_default(this.git2, 25);
            this.git3 = darken_default(this.git3, 25);
            this.git4 = darken_default(this.git4, 25);
            this.git5 = darken_default(this.git5, 25);
            this.git6 = darken_default(this.git6, 25);
            this.git7 = darken_default(this.git7, 25);
          }
          this.gitInv0 = this.gitInv0 || invert_default(this.git0);
          this.gitInv1 = this.gitInv1 || invert_default(this.git1);
          this.gitInv2 = this.gitInv2 || invert_default(this.git2);
          this.gitInv3 = this.gitInv3 || invert_default(this.git3);
          this.gitInv4 = this.gitInv4 || invert_default(this.git4);
          this.gitInv5 = this.gitInv5 || invert_default(this.git5);
          this.gitInv6 = this.gitInv6 || invert_default(this.git6);
          this.gitInv7 = this.gitInv7 || invert_default(this.git7);
          this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor);
          this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor;
          this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor;
          this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor;
          this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor;
          this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor;
          this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor;
          this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor;
          this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor;
          this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
          this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
          this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
          this.tagLabelFontSize = this.tagLabelFontSize || "10px";
          this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
          this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
          this.commitLabelFontSize = this.commitLabelFontSize || "10px";
          this.commitLineColor = this.commitLineColor ?? "#BDBCCC";
          this.erEdgeLabelBackground = "#FFFFFF";
          this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
          this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
        }
        calculate(overrides) {
          if (typeof overrides !== "object") {
            this.updateColors();
            return;
          }
          const keys2 = Object.keys(overrides);
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
          this.updateColors();
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
        }
      };
      getThemeVariables8 = /* @__PURE__ */ __name((userOverrides) => {
        const theme = new Theme8();
        theme.calculate(userOverrides);
        return theme;
      }, "getThemeVariables");
    }
  });

  // src/themes/theme-redux-dark.js
  var Theme9, getThemeVariables9;
  var init_theme_redux_dark = __esm({
    "src/themes/theme-redux-dark.js"() {
      "use strict";
      init_dist();
      init_theme_helpers();
      init_erDiagram_oldHardcodedValues();
      Theme9 = class {
        static {
          __name(this, "Theme");
        }
        constructor() {
          this.background = "#333";
          this.primaryColor = "#1f2020";
          this.secondaryColor = lighten_default(this.primaryColor, 16);
          this.tertiaryColor = adjust_default(this.primaryColor, { h: -160 });
          this.primaryBorderColor = invert_default(this.background);
          this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
          this.primaryTextColor = invert_default(this.primaryColor);
          this.secondaryTextColor = invert_default(this.secondaryColor);
          this.tertiaryTextColor = invert_default(this.tertiaryColor);
          this.mainBkg = "#111113";
          this.secondBkg = "calculated";
          this.mainContrastColor = "lightgrey";
          this.darkTextColor = lighten_default(invert_default("#323D47"), 10);
          this.border1 = "#ccc";
          this.border2 = rgba_default(255, 255, 255, 0.25);
          this.arrowheadColor = invert_default(this.background);
          this.fontFamily = '"Recursive Variable", arial, sans-serif';
          this.fontSize = "14px";
          this.labelBackground = "#111113";
          this.textColor = "#ccc";
          this.THEME_COLOR_LIMIT = 12;
          this.radius = 12;
          this.strokeWidth = 2;
          this.noteBkgColor = this.noteBkgColor ?? "#FEF9C3";
          this.noteTextColor = this.noteTextColor ?? "#28253D";
          this.THEME_COLOR_LIMIT = 12;
          this.fontFamily = '"Recursive Variable", arial, sans-serif';
          this.fontSize = "14px";
          this.nodeBorder = "#FFFFFF";
          this.stateBorder = "#FFFFFF";
          this.useGradient = false;
          this.gradientStart = "#0042eb";
          this.gradientStop = "#eb0042";
          this.dropShadow = "url(#drop-shadow)";
          this.nodeShadow = true;
          this.archEdgeColor = "calculated";
          this.archEdgeArrowColor = "calculated";
          this.archEdgeWidth = "3";
          this.archGroupBorderColor = this.primaryBorderColor;
          this.archGroupBorderWidth = "2px";
          this.clusterBkg = "#1E1A2E";
          this.clusterBorder = "#BDBCCC";
          this.noteBorderColor = "#FACC15";
          this.noteFontWeight = 600;
          this.filterColor = "#FFFFFF";
        }
        updateColors() {
          this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#FFFFFF");
          this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 });
          this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 });
          this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode);
          this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode);
          this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode);
          this.noteBkgColor = this.noteBkgColor || "#fff5ad";
          this.noteTextColor = this.noteTextColor || "#FFFFFF";
          this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor);
          this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor);
          this.lineColor = this.lineColor || invert_default(this.background);
          this.arrowheadColor = this.arrowheadColor || invert_default(this.background);
          this.textColor = this.textColor || this.primaryTextColor;
          this.border2 = this.border2 || this.tertiaryBorderColor;
          this.nodeBkg = this.nodeBkg || this.primaryColor;
          this.mainBkg = this.mainBkg || this.primaryColor;
          this.nodeBorder = this.nodeBorder || this.border1;
          this.clusterBkg = this.clusterBkg || this.tertiaryColor;
          this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
          this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
          this.titleColor = this.titleColor || this.tertiaryTextColor;
          this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
          this.actorBorder = "#FFFFFF";
          this.signalColor = "#FFFFFF";
          this.labelBoxBorderColor = "#BDBCCC";
          this.actorBorder = this.actorBorder || this.primaryBorderColor;
          this.actorBkg = this.actorBkg || this.mainBkg;
          this.actorTextColor = this.actorTextColor || this.primaryTextColor;
          this.actorLineColor = this.actorLineColor || this.actorBorder;
          this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
          this.signalColor = this.signalColor || this.textColor;
          this.signalTextColor = this.signalTextColor || this.textColor;
          this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
          this.labelTextColor = this.labelTextColor || this.actorTextColor;
          this.loopTextColor = this.loopTextColor || this.actorTextColor;
          this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10);
          this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
          this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor);
          this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
          this.altSectionBkgColor = this.altSectionBkgColor || "white";
          this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
          this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
          this.excludeBkgColor = this.excludeBkgColor || "#eeeeee";
          this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
          this.taskBkgColor = this.taskBkgColor || this.primaryColor;
          this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
          this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(this.primaryColor, 23);
          this.gridColor = this.gridColor || "lightgrey";
          this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey";
          this.doneTaskBorderColor = this.doneTaskBorderColor || "grey";
          this.critBorderColor = this.critBorderColor || "#ff8888";
          this.critBkgColor = this.critBkgColor || "red";
          this.todayLineColor = this.todayLineColor || "red";
          this.taskTextColor = this.taskTextColor || this.textColor;
          this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
          this.taskTextLightColor = this.taskTextLightColor || this.textColor;
          this.taskTextColor = this.taskTextColor || this.primaryTextColor;
          this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
          this.taskTextClickableColor = this.taskTextClickableColor || "#003163";
          this.archEdgeColor = this.lineColor;
          this.archEdgeArrowColor = this.lineColor;
          this.personBorder = this.personBorder || this.primaryBorderColor;
          this.personBkg = this.personBkg || this.mainBkg;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.transitionLabelColor = this.transitionLabelColor || this.textColor;
          this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
          this.vertLineColor = this.vertLineColor || this.primaryBorderColor;
          this.compositeBackground = "#16141F";
          this.altBackground = "#16141F";
          this.compositeTitleBackground = "#16141F";
          this.stateEdgeLabelBackground = "#16141F";
          this.fontWeight = 600;
          this.stateBkg = this.stateBkg || this.mainBkg;
          this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
          this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
          this.altBackground = this.altBackground || "#f0f0f0";
          this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
          this.compositeBorder = this.compositeBorder || this.nodeBorder;
          this.innerEndBackground = this.nodeBorder;
          this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
          this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.specialStateColor = this.lineColor;
          this.cScale0 = this.cScale0 || this.primaryColor;
          this.cScale1 = this.cScale1 || this.secondaryColor;
          this.cScale2 = this.cScale2 || this.tertiaryColor;
          this.cScale3 = this.cScale3 || adjust_default(this.primaryColor, { h: 30 });
          this.cScale4 = this.cScale4 || adjust_default(this.primaryColor, { h: 60 });
          this.cScale5 = this.cScale5 || adjust_default(this.primaryColor, { h: 90 });
          this.cScale6 = this.cScale6 || adjust_default(this.primaryColor, { h: 120 });
          this.cScale7 = this.cScale7 || adjust_default(this.primaryColor, { h: 150 });
          this.cScale8 = this.cScale8 || adjust_default(this.primaryColor, { h: 210, l: 150 });
          this.cScale9 = this.cScale9 || adjust_default(this.primaryColor, { h: 270 });
          this.cScale10 = this.cScale10 || adjust_default(this.primaryColor, { h: 300 });
          this.cScale11 = this.cScale11 || adjust_default(this.primaryColor, { h: 330 });
          if (this.darkMode) {
            for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
              this["cScale" + i2] = darken_default(this["cScale" + i2], 75);
            }
          } else {
            for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
              this["cScale" + i2] = darken_default(this["cScale" + i2], 25);
            }
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]);
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            if (this.darkMode) {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10);
            } else {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10);
            }
          }
          this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor;
          }
          const multiplier = this.darkMode ? -4 : -1;
          for (let i2 = 0; i2 < 5; i2++) {
            this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) });
            this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) });
          }
          this.classText = this.classText || this.textColor;
          this.fillType0 = this.fillType0 || this.primaryColor;
          this.fillType1 = this.fillType1 || this.secondaryColor;
          this.fillType2 = this.fillType2 || adjust_default(this.primaryColor, { h: 64 });
          this.fillType3 = this.fillType3 || adjust_default(this.secondaryColor, { h: 64 });
          this.fillType4 = this.fillType4 || adjust_default(this.primaryColor, { h: -64 });
          this.fillType5 = this.fillType5 || adjust_default(this.secondaryColor, { h: -64 });
          this.fillType6 = this.fillType6 || adjust_default(this.primaryColor, { h: 128 });
          this.fillType7 = this.fillType7 || adjust_default(this.secondaryColor, { h: 128 });
          this.pie1 = this.pie1 || this.primaryColor;
          this.pie2 = this.pie2 || this.secondaryColor;
          this.pie3 = this.pie3 || this.tertiaryColor;
          this.pie4 = this.pie4 || adjust_default(this.primaryColor, { l: -10 });
          this.pie5 = this.pie5 || adjust_default(this.secondaryColor, { l: -10 });
          this.pie6 = this.pie6 || adjust_default(this.tertiaryColor, { l: -10 });
          this.pie7 = this.pie7 || adjust_default(this.primaryColor, { h: 60, l: -10 });
          this.pie8 = this.pie8 || adjust_default(this.primaryColor, { h: -60, l: -10 });
          this.pie9 = this.pie9 || adjust_default(this.primaryColor, { h: 120, l: 0 });
          this.pie10 = this.pie10 || adjust_default(this.primaryColor, { h: 60, l: -20 });
          this.pie11 = this.pie11 || adjust_default(this.primaryColor, { h: -60, l: -20 });
          this.pie12 = this.pie12 || adjust_default(this.primaryColor, { h: 120, l: -10 });
          this.pieTitleTextSize = this.pieTitleTextSize || "25px";
          this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
          this.pieSectionTextSize = this.pieSectionTextSize || "17px";
          this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
          this.pieLegendTextSize = this.pieLegendTextSize || "17px";
          this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
          this.pieStrokeColor = this.pieStrokeColor || "black";
          this.pieStrokeWidth = this.pieStrokeWidth || "2px";
          this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
          this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
          this.pieOpacity = this.pieOpacity || "0.7";
          this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor;
          this.vennSetTextColor = this.vennSetTextColor ?? this.textColor;
          this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
          this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 });
          this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 });
          this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 });
          this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
          this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 });
          this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 });
          this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 });
          this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill);
          this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
          this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
          this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
          this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
          this.xyChart = {
            backgroundColor: this.xyChart?.backgroundColor || this.background,
            titleColor: this.xyChart?.titleColor || this.primaryTextColor,
            xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
            xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
            xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
            xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
            yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
            yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
            yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
            yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
            plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"
          };
          this.requirementBackground = this.requirementBackground || this.primaryColor;
          this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
          this.requirementBorderSize = this.requirementBorderSize || "1";
          this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
          this.relationColor = this.relationColor || this.lineColor;
          this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
          this.requirementEdgeLabelBackground = "#16141F";
          this.git0 = this.git0 || this.primaryColor;
          this.git1 = this.git1 || this.secondaryColor;
          this.git2 = this.git2 || this.tertiaryColor;
          this.git3 = this.git3 || adjust_default(this.primaryColor, { h: -30 });
          this.git4 = this.git4 || adjust_default(this.primaryColor, { h: -60 });
          this.git5 = this.git5 || adjust_default(this.primaryColor, { h: -90 });
          this.git6 = this.git6 || adjust_default(this.primaryColor, { h: 60 });
          this.git7 = this.git7 || adjust_default(this.primaryColor, { h: 120 });
          if (this.darkMode) {
            this.git0 = lighten_default(this.git0, 25);
            this.git1 = lighten_default(this.git1, 25);
            this.git2 = lighten_default(this.git2, 25);
            this.git3 = lighten_default(this.git3, 25);
            this.git4 = lighten_default(this.git4, 25);
            this.git5 = lighten_default(this.git5, 25);
            this.git6 = lighten_default(this.git6, 25);
            this.git7 = lighten_default(this.git7, 25);
          } else {
            this.git0 = darken_default(this.git0, 25);
            this.git1 = darken_default(this.git1, 25);
            this.git2 = darken_default(this.git2, 25);
            this.git3 = darken_default(this.git3, 25);
            this.git4 = darken_default(this.git4, 25);
            this.git5 = darken_default(this.git5, 25);
            this.git6 = darken_default(this.git6, 25);
            this.git7 = darken_default(this.git7, 25);
          }
          this.gitInv0 = this.gitInv0 || invert_default(this.git0);
          this.gitInv1 = this.gitInv1 || invert_default(this.git1);
          this.gitInv2 = this.gitInv2 || invert_default(this.git2);
          this.gitInv3 = this.gitInv3 || invert_default(this.git3);
          this.gitInv4 = this.gitInv4 || invert_default(this.git4);
          this.gitInv5 = this.gitInv5 || invert_default(this.git5);
          this.gitInv6 = this.gitInv6 || invert_default(this.git6);
          this.gitInv7 = this.gitInv7 || invert_default(this.git7);
          this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor);
          this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor;
          this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor;
          this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor;
          this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor;
          this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor;
          this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor;
          this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor;
          this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor;
          this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
          this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
          this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
          this.tagLabelFontSize = this.tagLabelFontSize || "10px";
          this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
          this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
          this.commitLabelFontSize = this.commitLabelFontSize || "10px";
          this.commitLineColor = this.commitLineColor ?? "#BDBCCC";
          this.erEdgeLabelBackground = "#16141F";
          this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
          this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
        }
        calculate(overrides) {
          if (typeof overrides !== "object") {
            this.updateColors();
            return;
          }
          const keys2 = Object.keys(overrides);
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
          this.updateColors();
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
        }
      };
      getThemeVariables9 = /* @__PURE__ */ __name((userOverrides) => {
        const theme = new Theme9();
        theme.calculate(userOverrides);
        return theme;
      }, "getThemeVariables");
    }
  });

  // src/themes/theme-redux-color.js
  var Theme10, getThemeVariables10;
  var init_theme_redux_color = __esm({
    "src/themes/theme-redux-color.js"() {
      "use strict";
      init_dist();
      init_theme_helpers();
      init_erDiagram_oldHardcodedValues();
      Theme10 = class {
        static {
          __name(this, "Theme");
        }
        constructor() {
          this.background = "#ffffff";
          this.primaryColor = "#cccccc";
          this.mainBkg = "#ffffff";
          this.noteBkgColor = "#fff5ad";
          this.noteTextColor = "#28253D";
          this.THEME_COLOR_LIMIT = 12;
          this.radius = 12;
          this.strokeWidth = 2;
          this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
          this.fontFamily = '"Recursive Variable", arial, sans-serif';
          this.fontSize = "14px";
          this.nodeBorder = "#28253D";
          this.stateBorder = "#28253D";
          this.useGradient = false;
          this.gradientStart = "#0042eb";
          this.gradientStop = "#eb0042";
          this.dropShadow = "url(#drop-shadow)";
          this.nodeShadow = true;
          this.tertiaryColor = "#ffffff";
          this.archEdgeColor = "calculated";
          this.archEdgeArrowColor = "calculated";
          this.archEdgeWidth = "3";
          this.archGroupBorderColor = this.primaryBorderColor;
          this.archGroupBorderWidth = "2px";
          this.actorBorder = "#28253D";
          this.noteBorderColor = "#FACC15";
          this.noteFontWeight = 600;
          this.borderColorArray = [
            "#E879F9",
            //Fuchsia-400
            "#2DD4BF",
            //Teal-400
            "#FB923C",
            //Orange-400
            "#22D3EE",
            // Cyan-400
            "#4ADE80",
            // Green-400
            "#A78BFA",
            //Violet-400
            "#F87171",
            //red-400
            "#FACC15",
            //yellow-400
            "#818CF8",
            //indigo-400
            "#A3E635 ",
            //Lime-400
            "#38BDF8",
            //Sky-400
            "#FB7185"
            //Rose-400
          ];
          this.bkgColorArray = [
            "#FDF4FF",
            //Fuchsia-50
            "#F0FDFA",
            //Teal-50
            "#FFF7ED",
            //Orange-50
            "#ECFEFF",
            // Cyan-50
            "#F0FDF4",
            // Green-50
            "#F5F3FF",
            //Violet-50
            "#FEF2F2",
            //red-50
            "#FEFCE8",
            //yellow-50
            "#EEF2FF",
            //indigo-50
            "#F7FEE7",
            //Lime-50
            "#F0F9FF",
            //Sky-50
            "#FFF1F2"
            //Rose-50
          ];
          this.filterColor = "#000000";
        }
        updateColors() {
          this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#28253D");
          this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 });
          this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 });
          this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode);
          this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode);
          this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode);
          this.noteBkgColor = this.noteBkgColor || "#fff5ad";
          this.noteTextColor = this.noteTextColor || "#28253D";
          this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor);
          this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor);
          this.lineColor = this.lineColor || invert_default(this.background);
          this.arrowheadColor = this.arrowheadColor || invert_default(this.background);
          this.textColor = this.textColor || this.primaryTextColor;
          this.border2 = this.border2 || this.tertiaryBorderColor;
          this.nodeBkg = this.nodeBkg || this.primaryColor;
          this.mainBkg = this.mainBkg || this.primaryColor;
          this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
          this.clusterBkg = this.clusterBkg || this.tertiaryColor;
          this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
          this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
          this.titleColor = this.titleColor || this.tertiaryTextColor;
          this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
          this.actorBorder = this.actorBorder || this.primaryBorderColor;
          this.actorBkg = this.actorBkg || this.mainBkg;
          this.actorTextColor = this.actorTextColor || this.primaryTextColor;
          this.actorLineColor = this.actorLineColor || this.actorBorder;
          this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
          this.signalColor = this.signalColor || this.textColor;
          this.signalTextColor = this.signalTextColor || this.textColor;
          this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
          this.labelTextColor = this.labelTextColor || this.actorTextColor;
          this.loopTextColor = this.loopTextColor || this.actorTextColor;
          this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10);
          this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
          this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor);
          const primaryColor = "#ECECFE";
          const secondaryColor = "#E9E9F1";
          const tertiaryColor = adjust_default(primaryColor, { h: 180, l: 5 });
          this.sectionBkgColor = this.sectionBkgColor || tertiaryColor;
          this.altSectionBkgColor = this.altSectionBkgColor || "white";
          this.sectionBkgColor = this.sectionBkgColor || secondaryColor;
          this.sectionBkgColor2 = this.sectionBkgColor2 || primaryColor;
          this.excludeBkgColor = this.excludeBkgColor || "#eeeeee";
          this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
          this.taskBkgColor = this.taskBkgColor || primaryColor;
          this.activeTaskBorderColor = this.activeTaskBorderColor || primaryColor;
          this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(primaryColor, 23);
          this.gridColor = this.gridColor || "lightgrey";
          this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey";
          this.doneTaskBorderColor = this.doneTaskBorderColor || "grey";
          this.critBorderColor = this.critBorderColor || "#ff8888";
          this.critBkgColor = this.critBkgColor || "red";
          this.todayLineColor = this.todayLineColor || "red";
          this.taskTextColor = this.taskTextColor || this.textColor;
          this.vertLineColor = this.vertLineColor || this.primaryBorderColor;
          this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
          this.taskTextLightColor = this.taskTextLightColor || this.textColor;
          this.taskTextColor = this.taskTextColor || this.primaryTextColor;
          this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
          this.taskTextClickableColor = this.taskTextClickableColor || "#003163";
          this.archEdgeColor = this.lineColor;
          this.archEdgeArrowColor = this.lineColor;
          this.personBorder = this.personBorder || this.primaryBorderColor;
          this.personBkg = this.personBkg || this.mainBkg;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.transitionLabelColor = this.transitionLabelColor || this.textColor;
          this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
          this.stateBkg = this.stateBkg || this.mainBkg;
          this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
          this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
          this.altBackground = this.altBackground || "#f0f0f0";
          this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
          this.compositeBorder = this.compositeBorder || this.nodeBorder;
          this.innerEndBackground = this.nodeBorder;
          this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
          this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.specialStateColor = this.lineColor;
          this.cScale0 = this.cScale0 || "#f4a8ff";
          this.cScale1 = this.cScale1 || "#46ecd5";
          this.cScale2 = this.cScale2 || "#ffb86a";
          this.cScale3 = this.cScale3 || "#dab2ff";
          this.cScale4 = this.cScale4 || "#7bf1a8";
          this.cScale5 = this.cScale5 || "#c4b4ff";
          this.cScale6 = this.cScale6 || "#ffa2a2";
          this.cScale7 = this.cScale7 || "#ffdf20";
          this.cScale8 = this.cScale8 || "#a3b3ff";
          this.cScale9 = this.cScale9 || "#bbf451";
          this.cScale10 = this.cScale10 || "#74d4ff";
          this.cScale11 = this.cScale11 || "#ffa1ad";
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]);
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            if (this.darkMode) {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10);
            } else {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10);
            }
          }
          this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor;
          }
          const multiplier = this.darkMode ? -4 : -1;
          for (let i2 = 0; i2 < 5; i2++) {
            this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) });
            this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) });
          }
          this.classText = this.classText || this.textColor;
          this.fillType0 = this.fillType0 || primaryColor;
          this.fillType1 = this.fillType1 || secondaryColor;
          this.fillType2 = this.fillType2 || adjust_default(primaryColor, { h: 64 });
          this.fillType3 = this.fillType3 || adjust_default(secondaryColor, { h: 64 });
          this.fillType4 = this.fillType4 || adjust_default(primaryColor, { h: -64 });
          this.fillType5 = this.fillType5 || adjust_default(secondaryColor, { h: -64 });
          this.fillType6 = this.fillType6 || adjust_default(primaryColor, { h: 128 });
          this.fillType7 = this.fillType7 || adjust_default(secondaryColor, { h: 128 });
          this.pie1 = this.pie1 || primaryColor;
          this.pie2 = this.pie2 || secondaryColor;
          this.pie3 = this.pie3 || tertiaryColor;
          this.pie4 = this.pie4 || adjust_default(primaryColor, { l: -10 });
          this.pie5 = this.pie5 || adjust_default(secondaryColor, { l: -10 });
          this.pie6 = this.pie6 || adjust_default(tertiaryColor, { l: -10 });
          this.pie7 = this.pie7 || adjust_default(primaryColor, { h: 60, l: -10 });
          this.pie8 = this.pie8 || adjust_default(primaryColor, { h: -60, l: -10 });
          this.pie9 = this.pie9 || adjust_default(primaryColor, { h: 120, l: 0 });
          this.pie10 = this.pie10 || adjust_default(primaryColor, { h: 60, l: -20 });
          this.pie11 = this.pie11 || adjust_default(primaryColor, { h: -60, l: -20 });
          this.pie12 = this.pie12 || adjust_default(primaryColor, { h: 120, l: -10 });
          this.pieTitleTextSize = this.pieTitleTextSize || "25px";
          this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
          this.pieSectionTextSize = this.pieSectionTextSize || "17px";
          this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
          this.pieLegendTextSize = this.pieLegendTextSize || "17px";
          this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
          this.pieStrokeColor = this.pieStrokeColor || "black";
          this.pieStrokeWidth = this.pieStrokeWidth || "2px";
          this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
          this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
          this.pieOpacity = this.pieOpacity || "0.7";
          this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor;
          this.vennSetTextColor = this.vennSetTextColor ?? this.textColor;
          this.quadrant1Fill = this.quadrant1Fill || primaryColor;
          this.quadrant2Fill = this.quadrant2Fill || adjust_default(primaryColor, { r: 5, g: 5, b: 5 });
          this.quadrant3Fill = this.quadrant3Fill || adjust_default(primaryColor, { r: 10, g: 10, b: 10 });
          this.quadrant4Fill = this.quadrant4Fill || adjust_default(primaryColor, { r: 15, g: 15, b: 15 });
          this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
          this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 });
          this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 });
          this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 });
          this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill);
          this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
          this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
          this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
          this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
          this.xyChart = {
            backgroundColor: this.xyChart?.backgroundColor || this.background,
            titleColor: this.xyChart?.titleColor || this.primaryTextColor,
            xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
            xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
            xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
            xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
            yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
            yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
            yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
            yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
            plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"
          };
          this.requirementBackground = this.requirementBackground || primaryColor;
          this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
          this.requirementBorderSize = this.requirementBorderSize || "1";
          this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
          this.relationColor = this.relationColor || this.lineColor;
          this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
          this.git0 = this.git0 || primaryColor;
          this.git1 = this.git1 || secondaryColor;
          this.git2 = this.git2 || tertiaryColor;
          this.git3 = this.git3 || adjust_default(primaryColor, { h: -30 });
          this.git4 = this.git4 || adjust_default(primaryColor, { h: -60 });
          this.git5 = this.git5 || adjust_default(primaryColor, { h: -90 });
          this.git6 = this.git6 || adjust_default(primaryColor, { h: 60 });
          this.git7 = this.git7 || adjust_default(primaryColor, { h: 120 });
          if (this.darkMode) {
            this.git0 = lighten_default(this.git0, 25);
            this.git1 = lighten_default(this.git1, 25);
            this.git2 = lighten_default(this.git2, 25);
            this.git3 = lighten_default(this.git3, 25);
            this.git4 = lighten_default(this.git4, 25);
            this.git5 = lighten_default(this.git5, 25);
            this.git6 = lighten_default(this.git6, 25);
            this.git7 = lighten_default(this.git7, 25);
          } else {
            this.git0 = darken_default(this.git0, 25);
            this.git1 = darken_default(this.git1, 25);
            this.git2 = darken_default(this.git2, 25);
            this.git3 = darken_default(this.git3, 25);
            this.git4 = darken_default(this.git4, 25);
            this.git5 = darken_default(this.git5, 25);
            this.git6 = darken_default(this.git6, 25);
            this.git7 = darken_default(this.git7, 25);
          }
          this.gitInv0 = this.gitInv0 || invert_default(this.git0);
          this.gitInv1 = this.gitInv1 || invert_default(this.git1);
          this.gitInv2 = this.gitInv2 || invert_default(this.git2);
          this.gitInv3 = this.gitInv3 || invert_default(this.git3);
          this.gitInv4 = this.gitInv4 || invert_default(this.git4);
          this.gitInv5 = this.gitInv5 || invert_default(this.git5);
          this.gitInv6 = this.gitInv6 || invert_default(this.git6);
          this.gitInv7 = this.gitInv7 || invert_default(this.git7);
          this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor);
          this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor;
          this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor;
          this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor;
          this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor;
          this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor;
          this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor;
          this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor;
          this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor;
          this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
          this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
          this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
          this.tagLabelFontSize = this.tagLabelFontSize || "10px";
          this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
          this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
          this.commitLineColor = this.commitLineColor ?? "#BDBCCC";
          this.commitLabelFontSize = this.commitLabelFontSize || "10px";
          this.fontWeight = 600;
          this.erEdgeLabelBackground = "#FFFFFF";
          this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
          this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
        }
        calculate(overrides) {
          if (typeof overrides !== "object") {
            this.updateColors();
            return;
          }
          const keys2 = Object.keys(overrides);
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
          this.updateColors();
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
        }
      };
      getThemeVariables10 = /* @__PURE__ */ __name((userOverrides) => {
        const theme = new Theme10();
        theme.calculate(userOverrides);
        return theme;
      }, "getThemeVariables");
    }
  });

  // src/themes/theme-redux-dark-color.js
  var Theme11, getThemeVariables11;
  var init_theme_redux_dark_color = __esm({
    "src/themes/theme-redux-dark-color.js"() {
      "use strict";
      init_dist();
      init_theme_helpers();
      init_erDiagram_oldHardcodedValues();
      Theme11 = class {
        static {
          __name(this, "Theme");
        }
        constructor() {
          this.background = "#333";
          this.primaryColor = "#1f2020";
          this.secondaryColor = lighten_default(this.primaryColor, 16);
          this.tertiaryColor = adjust_default(this.primaryColor, { h: -160 });
          this.primaryBorderColor = invert_default(this.background);
          this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
          this.primaryTextColor = invert_default(this.primaryColor);
          this.secondaryTextColor = invert_default(this.secondaryColor);
          this.tertiaryTextColor = invert_default(this.tertiaryColor);
          this.mainBkg = "#111113";
          this.secondBkg = "calculated";
          this.mainContrastColor = "lightgrey";
          this.darkTextColor = lighten_default(invert_default("#323D47"), 10);
          this.border1 = "#ccc";
          this.border2 = rgba_default(255, 255, 255, 0.25);
          this.arrowheadColor = invert_default(this.background);
          this.fontFamily = '"Recursive Variable", arial, sans-serif';
          this.fontSize = "14px";
          this.labelBackground = "#111113";
          this.textColor = "#ccc";
          this.THEME_COLOR_LIMIT = 12;
          this.radius = 12;
          this.strokeWidth = 2;
          this.noteBkgColor = this.noteBkgColor ?? "#FEF9C3";
          this.noteTextColor = this.noteTextColor ?? "#28253D";
          this.THEME_COLOR_LIMIT = 12;
          this.fontFamily = '"Recursive Variable", arial, sans-serif';
          this.fontSize = "14px";
          this.nodeBorder = "#FFFFFF";
          this.stateBorder = "#FFFFFF";
          this.useGradient = false;
          this.gradientStart = "#0042eb";
          this.gradientStop = "#eb0042";
          this.dropShadow = "url(#drop-shadow)";
          this.nodeShadow = true;
          this.archEdgeColor = "calculated";
          this.archEdgeArrowColor = "calculated";
          this.archEdgeWidth = "3";
          this.archGroupBorderColor = this.primaryBorderColor;
          this.archGroupBorderWidth = "2px";
          this.clusterBkg = "#1E1A2E";
          this.clusterBorder = "#BDBCCC";
          this.noteBorderColor = "#FACC15";
          this.noteFontWeight = 600;
          this.borderColorArray = [
            "#E879F9",
            //Fuchsia-400
            "#2DD4BF",
            //Teal-400
            "#FB923C",
            //Orange-400
            "#22D3EE",
            // Cyan-400
            "#4ADE80",
            // Green-400
            "#A78BFA",
            //Violet-400
            "#F87171",
            //red-400
            "#FACC15",
            //yellow-400
            "#818CF8",
            //indigo-400
            "#A3E635 ",
            //Lime-400
            "#38BDF8",
            //Sky-400
            "#FB7185"
            //Rose-400
          ];
          this.bkgColorArray = [];
          this.filterColor = "#FFFFFF";
        }
        updateColors() {
          this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#FFFFFF");
          this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 });
          this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 });
          this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode);
          this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode);
          this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode);
          this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode);
          this.noteBkgColor = this.noteBkgColor || "#fff5ad";
          this.noteTextColor = this.noteTextColor || "#FFFFFF";
          this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor);
          this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor);
          this.lineColor = this.lineColor || invert_default(this.background);
          this.arrowheadColor = this.arrowheadColor || invert_default(this.background);
          this.textColor = this.textColor || this.primaryTextColor;
          this.border2 = this.border2 || this.tertiaryBorderColor;
          this.nodeBkg = this.nodeBkg || this.primaryColor;
          this.mainBkg = this.mainBkg || this.primaryColor;
          this.nodeBorder = this.nodeBorder || this.border1;
          this.clusterBkg = this.clusterBkg || this.tertiaryColor;
          this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
          this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
          this.titleColor = this.titleColor || this.tertiaryTextColor;
          this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
          this.actorBorder = "#FFFFFF";
          this.signalColor = "#FFFFFF";
          this.labelBoxBorderColor = "#BDBCCC";
          this.actorBorder = this.actorBorder || this.primaryBorderColor;
          this.actorBkg = this.actorBkg || this.mainBkg;
          this.actorTextColor = this.actorTextColor || this.primaryTextColor;
          this.actorLineColor = this.actorLineColor || this.actorBorder;
          this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
          this.signalColor = this.signalColor || this.textColor;
          this.signalTextColor = this.signalTextColor || this.textColor;
          this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
          this.labelTextColor = this.labelTextColor || this.actorTextColor;
          this.loopTextColor = this.loopTextColor || this.actorTextColor;
          this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10);
          this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
          this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor);
          this.rootLabelColor = "#FFFFFF";
          this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
          this.altSectionBkgColor = this.altSectionBkgColor || "white";
          this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
          this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
          this.excludeBkgColor = this.excludeBkgColor || "#eeeeee";
          this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
          this.taskBkgColor = this.taskBkgColor || this.primaryColor;
          this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
          this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(this.primaryColor, 23);
          this.gridColor = this.gridColor || "lightgrey";
          this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey";
          this.doneTaskBorderColor = this.doneTaskBorderColor || "grey";
          this.critBorderColor = this.critBorderColor || "#ff8888";
          this.critBkgColor = this.critBkgColor || "red";
          this.todayLineColor = this.todayLineColor || "red";
          this.taskTextColor = this.taskTextColor || this.textColor;
          this.vertLineColor = this.vertLineColor || this.primaryBorderColor;
          this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
          this.taskTextLightColor = this.taskTextLightColor || this.textColor;
          this.taskTextColor = this.taskTextColor || this.primaryTextColor;
          this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
          this.taskTextClickableColor = this.taskTextClickableColor || "#003163";
          this.archEdgeColor = this.lineColor;
          this.archEdgeArrowColor = this.lineColor;
          this.personBorder = this.personBorder || this.primaryBorderColor;
          this.personBkg = this.personBkg || this.mainBkg;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.transitionLabelColor = this.transitionLabelColor || this.textColor;
          this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
          this.stateBkg = this.stateBkg || this.mainBkg;
          this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
          this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
          this.altBackground = this.altBackground || "#f0f0f0";
          this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
          this.compositeBorder = this.compositeBorder || this.nodeBorder;
          this.innerEndBackground = this.nodeBorder;
          this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
          this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
          this.transitionColor = this.transitionColor || this.lineColor;
          this.specialStateColor = this.lineColor;
          this.cScale0 = this.cScale0 || "#f4a8ff";
          this.cScale1 = this.cScale1 || "#46ecd5";
          this.cScale2 = this.cScale2 || "#ffb86a";
          this.cScale3 = this.cScale3 || "#dab2ff";
          this.cScale4 = this.cScale4 || "#7bf1a8";
          this.cScale5 = this.cScale5 || "#c4b4ff";
          this.cScale6 = this.cScale6 || "#ffa2a2";
          this.cScale7 = this.cScale7 || "#ffdf20";
          this.cScale8 = this.cScale8 || "#a3b3ff";
          this.cScale9 = this.cScale9 || "#bbf451";
          this.cScale10 = this.cScale10 || "#74d4ff";
          this.cScale11 = this.cScale11 || "#ffa1ad";
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]);
          }
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            if (this.darkMode) {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10);
            } else {
              this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10);
            }
          }
          this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
          for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
            this["cScaleLabel" + i2] = darken_default(this["cScale" + i2], 75);
          }
          const multiplier = this.darkMode ? -4 : -1;
          for (let i2 = 0; i2 < 5; i2++) {
            this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) });
            this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) });
          }
          this.classText = this.classText || this.textColor;
          this.fillType0 = this.fillType0 || this.primaryColor;
          this.fillType1 = this.fillType1 || this.secondaryColor;
          this.fillType2 = this.fillType2 || adjust_default(this.primaryColor, { h: 64 });
          this.fillType3 = this.fillType3 || adjust_default(this.secondaryColor, { h: 64 });
          this.fillType4 = this.fillType4 || adjust_default(this.primaryColor, { h: -64 });
          this.fillType5 = this.fillType5 || adjust_default(this.secondaryColor, { h: -64 });
          this.fillType6 = this.fillType6 || adjust_default(this.primaryColor, { h: 128 });
          this.fillType7 = this.fillType7 || adjust_default(this.secondaryColor, { h: 128 });
          this.pie1 = this.pie1 || this.primaryColor;
          this.pie2 = this.pie2 || this.secondaryColor;
          this.pie3 = this.pie3 || this.tertiaryColor;
          this.pie4 = this.pie4 || adjust_default(this.primaryColor, { l: -10 });
          this.pie5 = this.pie5 || adjust_default(this.secondaryColor, { l: -10 });
          this.pie6 = this.pie6 || adjust_default(this.tertiaryColor, { l: -10 });
          this.pie7 = this.pie7 || adjust_default(this.primaryColor, { h: 60, l: -10 });
          this.pie8 = this.pie8 || adjust_default(this.primaryColor, { h: -60, l: -10 });
          this.pie9 = this.pie9 || adjust_default(this.primaryColor, { h: 120, l: 0 });
          this.pie10 = this.pie10 || adjust_default(this.primaryColor, { h: 60, l: -20 });
          this.pie11 = this.pie11 || adjust_default(this.primaryColor, { h: -60, l: -20 });
          this.pie12 = this.pie12 || adjust_default(this.primaryColor, { h: 120, l: -10 });
          this.pieTitleTextSize = this.pieTitleTextSize || "25px";
          this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
          this.pieSectionTextSize = this.pieSectionTextSize || "17px";
          this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
          this.pieLegendTextSize = this.pieLegendTextSize || "17px";
          this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
          this.pieStrokeColor = this.pieStrokeColor || "black";
          this.pieStrokeWidth = this.pieStrokeWidth || "2px";
          this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
          this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
          this.pieOpacity = this.pieOpacity || "0.7";
          this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor;
          this.vennSetTextColor = this.vennSetTextColor ?? this.textColor;
          this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
          this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 });
          this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 });
          this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 });
          this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
          this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 });
          this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 });
          this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 });
          this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill);
          this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
          this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
          this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
          this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
          this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
          this.xyChart = {
            backgroundColor: this.xyChart?.backgroundColor || this.background,
            titleColor: this.xyChart?.titleColor || this.primaryTextColor,
            xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,
            xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,
            xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,
            xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,
            yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,
            yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,
            yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,
            yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,
            plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"
          };
          this.requirementBackground = this.requirementBackground || this.primaryColor;
          this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
          this.requirementBorderSize = this.requirementBorderSize || "1";
          this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
          this.relationColor = this.relationColor || this.lineColor;
          this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
          this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
          this.git0 = this.git0 || this.primaryColor;
          this.git1 = this.git1 || this.secondaryColor;
          this.git2 = this.git2 || this.tertiaryColor;
          this.git3 = this.git3 || adjust_default(this.primaryColor, { h: -30 });
          this.git4 = this.git4 || adjust_default(this.primaryColor, { h: -60 });
          this.git5 = this.git5 || adjust_default(this.primaryColor, { h: -90 });
          this.git6 = this.git6 || adjust_default(this.primaryColor, { h: 60 });
          this.git7 = this.git7 || adjust_default(this.primaryColor, { h: 120 });
          if (this.darkMode) {
            this.git0 = lighten_default(this.git0, 25);
            this.git1 = lighten_default(this.git1, 25);
            this.git2 = lighten_default(this.git2, 25);
            this.git3 = lighten_default(this.git3, 25);
            this.git4 = lighten_default(this.git4, 25);
            this.git5 = lighten_default(this.git5, 25);
            this.git6 = lighten_default(this.git6, 25);
            this.git7 = lighten_default(this.git7, 25);
          } else {
            this.git0 = darken_default(this.git0, 25);
            this.git1 = darken_default(this.git1, 25);
            this.git2 = darken_default(this.git2, 25);
            this.git3 = darken_default(this.git3, 25);
            this.git4 = darken_default(this.git4, 25);
            this.git5 = darken_default(this.git5, 25);
            this.git6 = darken_default(this.git6, 25);
            this.git7 = darken_default(this.git7, 25);
          }
          this.gitInv0 = this.gitInv0 || invert_default(this.git0);
          this.gitInv1 = this.gitInv1 || invert_default(this.git1);
          this.gitInv2 = this.gitInv2 || invert_default(this.git2);
          this.gitInv3 = this.gitInv3 || invert_default(this.git3);
          this.gitInv4 = this.gitInv4 || invert_default(this.git4);
          this.gitInv5 = this.gitInv5 || invert_default(this.git5);
          this.gitInv6 = this.gitInv6 || invert_default(this.git6);
          this.gitInv7 = this.gitInv7 || invert_default(this.git7);
          this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor);
          this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor;
          this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor;
          this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor;
          this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor;
          this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor;
          this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor;
          this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor;
          this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor;
          this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
          this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
          this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
          this.tagLabelFontSize = this.tagLabelFontSize || "10px";
          this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
          this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
          this.commitLabelFontSize = this.commitLabelFontSize || "10px";
          this.commitLineColor = this.commitLineColor ?? "#BDBCCC";
          this.fontWeight = 600;
          this.erEdgeLabelBackground = "#16141F";
          this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
          this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
        }
        calculate(overrides) {
          if (typeof overrides !== "object") {
            this.updateColors();
            return;
          }
          const keys2 = Object.keys(overrides);
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
          this.updateColors();
          keys2.forEach((k2) => {
            this[k2] = overrides[k2];
          });
        }
      };
      getThemeVariables11 = /* @__PURE__ */ __name((userOverrides) => {
        const theme = new Theme11();
        theme.calculate(userOverrides);
        return theme;
      }, "getThemeVariables");
    }
  });

  // src/themes/index.js
  var themes_default;
  var init_themes = __esm({
    "src/themes/index.js"() {
      "use strict";
      init_theme_base();
      init_theme_dark();
      init_theme_default();
      init_theme_forest();
      init_theme_neutral();
      init_theme_neo();
      init_theme_neo_dark();
      init_theme_redux();
      init_theme_redux_dark();
      init_theme_redux_color();
      init_theme_redux_dark_color();
      themes_default = {
        base: {
          getThemeVariables
        },
        dark: {
          getThemeVariables: getThemeVariables2
        },
        default: {
          getThemeVariables: getThemeVariables3
        },
        forest: {
          getThemeVariables: getThemeVariables4
        },
        neutral: {
          getThemeVariables: getThemeVariables5
        },
        neo: {
          getThemeVariables: getThemeVariables6
        },
        "neo-dark": {
          getThemeVariables: getThemeVariables7
        },
        redux: {
          getThemeVariables: getThemeVariables8
        },
        "redux-dark": {
          getThemeVariables: getThemeVariables9
        },
        "redux-color": {
          getThemeVariables: getThemeVariables10
        },
        "redux-dark-color": {
          getThemeVariables: getThemeVariables11
        }
      };
    }
  });

  // src/schemas/config.schema.yaml?only-defaults=true
  var config_schema_default;
  var init_config_schema = __esm({
    "src/schemas/config.schema.yaml?only-defaults=true"() {
      "use strict";
      config_schema_default = {
        "flowchart": {
          "useMaxWidth": true,
          "titleTopMargin": 25,
          "subGraphTitleMargin": {
            "top": 0,
            "bottom": 0
          },
          "diagramPadding": 8,
          "htmlLabels": null,
          "nodeSpacing": 50,
          "rankSpacing": 50,
          "curve": "basis",
          "padding": 15,
          "defaultRenderer": "dagre-wrapper",
          "wrappingWidth": 200,
          "inheritDir": false
        },
        "sequence": {
          "useMaxWidth": true,
          "hideUnusedParticipants": false,
          "activationWidth": 10,
          "diagramMarginX": 50,
          "diagramMarginY": 10,
          "actorMargin": 50,
          "width": 150,
          "height": 65,
          "boxMargin": 10,
          "boxTextMargin": 5,
          "noteMargin": 10,
          "messageMargin": 35,
          "messageAlign": "center",
          "mirrorActors": true,
          "forceMenus": false,
          "bottomMarginAdj": 1,
          "rightAngles": false,
          "showSequenceNumbers": false,
          "actorFontSize": 14,
          "actorFontFamily": '"Open Sans", sans-serif',
          "actorFontWeight": 400,
          "noteFontSize": 14,
          "noteFontFamily": '"trebuchet ms", verdana, arial, sans-serif',
          "noteFontWeight": 400,
          "noteAlign": "center",
          "messageFontSize": 16,
          "messageFontFamily": '"trebuchet ms", verdana, arial, sans-serif',
          "messageFontWeight": 400,
          "wrap": false,
          "wrapPadding": 10,
          "labelBoxWidth": 50,
          "labelBoxHeight": 20
        },
        "gantt": {
          "useMaxWidth": true,
          "titleTopMargin": 25,
          "barHeight": 20,
          "barGap": 4,
          "topPadding": 50,
          "rightPadding": 75,
          "leftPadding": 75,
          "gridLineStartPadding": 35,
          "fontSize": 11,
          "sectionFontSize": 11,
          "numberSectionStyles": 4,
          "axisFormat": "%Y-%m-%d",
          "topAxis": false,
          "displayMode": "",
          "weekday": "sunday"
        },
        "journey": {
          "useMaxWidth": true,
          "diagramMarginX": 50,
          "diagramMarginY": 10,
          "leftMargin": 150,
          "maxLabelWidth": 360,
          "width": 150,
          "height": 50,
          "boxMargin": 10,
          "boxTextMargin": 5,
          "noteMargin": 10,
          "messageMargin": 35,
          "messageAlign": "center",
          "bottomMarginAdj": 1,
          "rightAngles": false,
          "taskFontSize": 14,
          "taskFontFamily": '"Open Sans", sans-serif',
          "taskMargin": 50,
          "activationWidth": 10,
          "textPlacement": "fo",
          "actorColours": [
            "#8FBC8F",
            "#7CFC00",
            "#00FFFF",
            "#20B2AA",
            "#B0E0E6",
            "#FFFFE0"
          ],
          "sectionFills": [
            "#191970",
            "#8B008B",
            "#4B0082",
            "#2F4F4F",
            "#800000",
            "#8B4513",
            "#00008B"
          ],
          "sectionColours": [
            "#fff"
          ],
          "titleColor": "",
          "titleFontFamily": '"trebuchet ms", verdana, arial, sans-serif',
          "titleFontSize": "4ex"
        },
        "class": {
          "useMaxWidth": true,
          "titleTopMargin": 25,
          "arrowMarkerAbsolute": false,
          "dividerMargin": 10,
          "padding": 5,
          "textHeight": 10,
          "defaultRenderer": "dagre-wrapper",
          "htmlLabels": false,
          "hideEmptyMembersBox": false
        },
        "state": {
          "useMaxWidth": true,
          "titleTopMargin": 25,
          "dividerMargin": 10,
          "sizeUnit": 5,
          "padding": 8,
          "textHeight": 10,
          "titleShift": -15,
          "noteMargin": 10,
          "forkWidth": 70,
          "forkHeight": 7,
          "miniPadding": 2,
          "fontSizeFactor": 5.02,
          "fontSize": 24,
          "labelHeight": 16,
          "edgeLengthFactor": "20",
          "compositTitleSize": 35,
          "radius": 5,
          "defaultRenderer": "dagre-wrapper"
        },
        "er": {
          "useMaxWidth": true,
          "titleTopMargin": 25,
          "diagramPadding": 20,
          "layoutDirection": "TB",
          "minEntityWidth": 100,
          "minEntityHeight": 75,
          "entityPadding": 15,
          "nodeSpacing": 140,
          "rankSpacing": 80,
          "stroke": "gray",
          "fill": "honeydew",
          "fontSize": 12
        },
        "pie": {
          "useMaxWidth": true,
          "textPosition": 0.75
        },
        "quadrantChart": {
          "useMaxWidth": true,
          "chartWidth": 500,
          "chartHeight": 500,
          "titleFontSize": 20,
          "titlePadding": 10,
          "quadrantPadding": 5,
          "xAxisLabelPadding": 5,
          "yAxisLabelPadding": 5,
          "xAxisLabelFontSize": 16,
          "yAxisLabelFontSize": 16,
          "quadrantLabelFontSize": 16,
          "quadrantTextTopPadding": 5,
          "pointTextPadding": 5,
          "pointLabelFontSize": 12,
          "pointRadius": 5,
          "xAxisPosition": "top",
          "yAxisPosition": "left",
          "quadrantInternalBorderStrokeWidth": 1,
          "quadrantExternalBorderStrokeWidth": 2
        },
        "xyChart": {
          "useMaxWidth": true,
          "width": 700,
          "height": 500,
          "titleFontSize": 20,
          "titlePadding": 10,
          "showDataLabel": false,
          "showDataLabelOutsideBar": false,
          "showTitle": true,
          "xAxis": {
            "$ref": "#/$defs/XYChartAxisConfig",
            "showLabel": true,
            "labelFontSize": 14,
            "labelPadding": 5,
            "showTitle": true,
            "titleFontSize": 16,
            "titlePadding": 5,
            "showTick": true,
            "tickLength": 5,
            "tickWidth": 2,
            "showAxisLine": true,
            "axisLineWidth": 2
          },
          "yAxis": {
            "$ref": "#/$defs/XYChartAxisConfig",
            "showLabel": true,
            "labelFontSize": 14,
            "labelPadding": 5,
            "showTitle": true,
            "titleFontSize": 16,
            "titlePadding": 5,
            "showTick": true,
            "tickLength": 5,
            "tickWidth": 2,
            "showAxisLine": true,
            "axisLineWidth": 2
          },
          "chartOrientation": "vertical",
          "plotReservedSpacePercent": 50
        },
        "requirement": {
          "useMaxWidth": true,
          "rect_fill": "#f9f9f9",
          "text_color": "#333",
          "rect_border_size": "0.5px",
          "rect_border_color": "#bbb",
          "rect_min_width": 200,
          "rect_min_height": 200,
          "fontSize": 14,
          "rect_padding": 10,
          "line_height": 20
        },
        "mindmap": {
          "useMaxWidth": true,
          "padding": 10,
          "maxNodeWidth": 200,
          "layoutAlgorithm": "cose-bilkent"
        },
        "ishikawa": {
          "useMaxWidth": true,
          "diagramPadding": 20
        },
        "kanban": {
          "useMaxWidth": true,
          "padding": 8,
          "sectionWidth": 200,
          "ticketBaseUrl": ""
        },
        "timeline": {
          "useMaxWidth": true,
          "diagramMarginX": 50,
          "diagramMarginY": 10,
          "leftMargin": 150,
          "width": 150,
          "height": 50,
          "boxMargin": 10,
          "boxTextMargin": 5,
          "noteMargin": 10,
          "messageMargin": 35,
          "messageAlign": "center",
          "bottomMarginAdj": 1,
          "rightAngles": false,
          "taskFontSize": 14,
          "taskFontFamily": '"Open Sans", sans-serif',
          "taskMargin": 50,
          "activationWidth": 10,
          "textPlacement": "fo",
          "actorColours": [
            "#8FBC8F",
            "#7CFC00",
            "#00FFFF",
            "#20B2AA",
            "#B0E0E6",
            "#FFFFE0"
          ],
          "sectionFills": [
            "#191970",
            "#8B008B",
            "#4B0082",
            "#2F4F4F",
            "#800000",
            "#8B4513",
            "#00008B"
          ],
          "sectionColours": [
            "#fff"
          ],
          "disableMulticolor": false
        },
        "gitGraph": {
          "useMaxWidth": true,
          "titleTopMargin": 25,
          "diagramPadding": 8,
          "nodeLabel": {
            "width": 75,
            "height": 100,
            "x": -25,
            "y": 0
          },
          "mainBranchName": "main",
          "mainBranchOrder": 0,
          "showCommitLabel": true,
          "showBranches": true,
          "rotateCommitLabel": true,
          "parallelCommits": false,
          "arrowMarkerAbsolute": false
        },
        "c4": {
          "useMaxWidth": true,
          "diagramMarginX": 50,
          "diagramMarginY": 10,
          "c4ShapeMargin": 50,
          "c4ShapePadding": 20,
          "width": 216,
          "height": 60,
          "boxMargin": 10,
          "c4ShapeInRow": 4,
          "nextLinePaddingX": 0,
          "c4BoundaryInRow": 2,
          "personFontSize": 14,
          "personFontFamily": '"Open Sans", sans-serif',
          "personFontWeight": "normal",
          "external_personFontSize": 14,
          "external_personFontFamily": '"Open Sans", sans-serif',
          "external_personFontWeight": "normal",
          "systemFontSize": 14,
          "systemFontFamily": '"Open Sans", sans-serif',
          "systemFontWeight": "normal",
          "external_systemFontSize": 14,
          "external_systemFontFamily": '"Open Sans", sans-serif',
          "external_systemFontWeight": "normal",
          "system_dbFontSize": 14,
          "system_dbFontFamily": '"Open Sans", sans-serif',
          "system_dbFontWeight": "normal",
          "external_system_dbFontSize": 14,
          "external_system_dbFontFamily": '"Open Sans", sans-serif',
          "external_system_dbFontWeight": "normal",
          "system_queueFontSize": 14,
          "system_queueFontFamily": '"Open Sans", sans-serif',
          "system_queueFontWeight": "normal",
          "external_system_queueFontSize": 14,
          "external_system_queueFontFamily": '"Open Sans", sans-serif',
          "external_system_queueFontWeight": "normal",
          "boundaryFontSize": 14,
          "boundaryFontFamily": '"Open Sans", sans-serif',
          "boundaryFontWeight": "normal",
          "messageFontSize": 12,
          "messageFontFamily": '"Open Sans", sans-serif',
          "messageFontWeight": "normal",
          "containerFontSize": 14,
          "containerFontFamily": '"Open Sans", sans-serif',
          "containerFontWeight": "normal",
          "external_containerFontSize": 14,
          "external_containerFontFamily": '"Open Sans", sans-serif',
          "external_containerFontWeight": "normal",
          "container_dbFontSize": 14,
          "container_dbFontFamily": '"Open Sans", sans-serif',
          "container_dbFontWeight": "normal",
          "external_container_dbFontSize": 14,
          "external_container_dbFontFamily": '"Open Sans", sans-serif',
          "external_container_dbFontWeight": "normal",
          "container_queueFontSize": 14,
          "container_queueFontFamily": '"Open Sans", sans-serif',
          "container_queueFontWeight": "normal",
          "external_container_queueFontSize": 14,
          "external_container_queueFontFamily": '"Open Sans", sans-serif',
          "external_container_queueFontWeight": "normal",
          "componentFontSize": 14,
          "componentFontFamily": '"Open Sans", sans-serif',
          "componentFontWeight": "normal",
          "external_componentFontSize": 14,
          "external_componentFontFamily": '"Open Sans", sans-serif',
          "external_componentFontWeight": "normal",
          "component_dbFontSize": 14,
          "component_dbFontFamily": '"Open Sans", sans-serif',
          "component_dbFontWeight": "normal",
          "external_component_dbFontSize": 14,
          "external_component_dbFontFamily": '"Open Sans", sans-serif',
          "external_component_dbFontWeight": "normal",
          "component_queueFontSize": 14,
          "component_queueFontFamily": '"Open Sans", sans-serif',
          "component_queueFontWeight": "normal",
          "external_component_queueFontSize": 14,
          "external_component_queueFontFamily": '"Open Sans", sans-serif',
          "external_component_queueFontWeight": "normal",
          "wrap": true,
          "wrapPadding": 10,
          "person_bg_color": "#08427B",
          "person_border_color": "#073B6F",
          "external_person_bg_color": "#686868",
          "external_person_border_color": "#8A8A8A",
          "system_bg_color": "#1168BD",
          "system_border_color": "#3C7FC0",
          "system_db_bg_color": "#1168BD",
          "system_db_border_color": "#3C7FC0",
          "system_queue_bg_color": "#1168BD",
          "system_queue_border_color": "#3C7FC0",
          "external_system_bg_color": "#999999",
          "external_system_border_color": "#8A8A8A",
          "external_system_db_bg_color": "#999999",
          "external_system_db_border_color": "#8A8A8A",
          "external_system_queue_bg_color": "#999999",
          "external_system_queue_border_color": "#8A8A8A",
          "container_bg_color": "#438DD5",
          "container_border_color": "#3C7FC0",
          "container_db_bg_color": "#438DD5",
          "container_db_border_color": "#3C7FC0",
          "container_queue_bg_color": "#438DD5",
          "container_queue_border_color": "#3C7FC0",
          "external_container_bg_color": "#B3B3B3",
          "external_container_border_color": "#A6A6A6",
          "external_container_db_bg_color": "#B3B3B3",
          "external_container_db_border_color": "#A6A6A6",
          "external_container_queue_bg_color": "#B3B3B3",
          "external_container_queue_border_color": "#A6A6A6",
          "component_bg_color": "#85BBF0",
          "component_border_color": "#78A8D8",
          "component_db_bg_color": "#85BBF0",
          "component_db_border_color": "#78A8D8",
          "component_queue_bg_color": "#85BBF0",
          "component_queue_border_color": "#78A8D8",
          "external_component_bg_color": "#CCCCCC",
          "external_component_border_color": "#BFBFBF",
          "external_component_db_bg_color": "#CCCCCC",
          "external_component_db_border_color": "#BFBFBF",
          "external_component_queue_bg_color": "#CCCCCC",
          "external_component_queue_border_color": "#BFBFBF"
        },
        "sankey": {
          "useMaxWidth": true,
          "width": 600,
          "height": 400,
          "linkColor": "gradient",
          "nodeAlignment": "justify",
          "showValues": true,
          "prefix": "",
          "suffix": ""
        },
        "block": {
          "useMaxWidth": true,
          "padding": 8
        },
        "packet": {
          "useMaxWidth": true,
          "rowHeight": 32,
          "bitWidth": 32,
          "bitsPerRow": 32,
          "showBits": true,
          "paddingX": 5,
          "paddingY": 5
        },
        "treeView": {
          "useMaxWidth": true,
          "rowIndent": 10,
          "paddingX": 5,
          "paddingY": 5,
          "lineThickness": 1
        },
        "architecture": {
          "useMaxWidth": true,
          "padding": 40,
          "iconSize": 80,
          "fontSize": 16,
          "randomize": false
        },
        "radar": {
          "useMaxWidth": true,
          "width": 600,
          "height": 600,
          "marginTop": 50,
          "marginRight": 50,
          "marginBottom": 50,
          "marginLeft": 50,
          "axisScaleFactor": 1,
          "axisLabelFactor": 1.05,
          "curveTension": 0.17
        },
        "venn": {
          "useMaxWidth": true,
          "width": 800,
          "height": 450,
          "padding": 8,
          "useDebugLayout": false
        },
        "theme": "default",
        "look": "classic",
        "handDrawnSeed": 0,
        "layout": "dagre",
        "maxTextSize": 5e4,
        "maxEdges": 500,
        "darkMode": false,
        "fontFamily": '"trebuchet ms", verdana, arial, sans-serif;',
        "logLevel": 5,
        "securityLevel": "strict",
        "startOnLoad": true,
        "arrowMarkerAbsolute": false,
        "secure": [
          "secure",
          "securityLevel",
          "startOnLoad",
          "maxTextSize",
          "suppressErrorRendering",
          "maxEdges"
        ],
        "legacyMathML": false,
        "forceLegacyMathML": false,
        "deterministicIds": false,
        "fontSize": 16,
        "markdownAutoWrap": true,
        "suppressErrorRendering": false
      };
    }
  });

  // src/defaultConfig.ts
  var config, keyify, configKeys, defaultConfig_default;
  var init_defaultConfig = __esm({
    "src/defaultConfig.ts"() {
      "use strict";
      init_themes();
      init_config_schema();
      config = {
        ...config_schema_default,
        // Set, even though they're `undefined` so that `configKeys` finds these keys
        // TODO: Should we replace these with `null` so that they can go in the JSON Schema?
        deterministicIDSeed: void 0,
        elk: {
          // mergeEdges is needed here to be considered
          mergeEdges: false,
          nodePlacementStrategy: "BRANDES_KOEPF",
          forceNodeModelOrder: false,
          considerModelOrder: "NODES_AND_EDGES"
        },
        themeCSS: void 0,
        // add non-JSON default config values
        themeVariables: themes_default.default.getThemeVariables(),
        sequence: {
          ...config_schema_default.sequence,
          messageFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.messageFontFamily,
              fontSize: this.messageFontSize,
              fontWeight: this.messageFontWeight
            };
          }, "messageFont"),
          noteFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.noteFontFamily,
              fontSize: this.noteFontSize,
              fontWeight: this.noteFontWeight
            };
          }, "noteFont"),
          actorFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.actorFontFamily,
              fontSize: this.actorFontSize,
              fontWeight: this.actorFontWeight
            };
          }, "actorFont")
        },
        class: {
          hideEmptyMembersBox: false
        },
        gantt: {
          ...config_schema_default.gantt,
          tickInterval: void 0,
          useWidth: void 0
          // can probably be removed since `configKeys` already includes this
        },
        c4: {
          ...config_schema_default.c4,
          useWidth: void 0,
          personFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.personFontFamily,
              fontSize: this.personFontSize,
              fontWeight: this.personFontWeight
            };
          }, "personFont"),
          flowchart: {
            ...config_schema_default.flowchart,
            inheritDir: false
            // default to legacy behavior
          },
          external_personFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.external_personFontFamily,
              fontSize: this.external_personFontSize,
              fontWeight: this.external_personFontWeight
            };
          }, "external_personFont"),
          systemFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.systemFontFamily,
              fontSize: this.systemFontSize,
              fontWeight: this.systemFontWeight
            };
          }, "systemFont"),
          external_systemFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.external_systemFontFamily,
              fontSize: this.external_systemFontSize,
              fontWeight: this.external_systemFontWeight
            };
          }, "external_systemFont"),
          system_dbFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.system_dbFontFamily,
              fontSize: this.system_dbFontSize,
              fontWeight: this.system_dbFontWeight
            };
          }, "system_dbFont"),
          external_system_dbFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.external_system_dbFontFamily,
              fontSize: this.external_system_dbFontSize,
              fontWeight: this.external_system_dbFontWeight
            };
          }, "external_system_dbFont"),
          system_queueFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.system_queueFontFamily,
              fontSize: this.system_queueFontSize,
              fontWeight: this.system_queueFontWeight
            };
          }, "system_queueFont"),
          external_system_queueFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.external_system_queueFontFamily,
              fontSize: this.external_system_queueFontSize,
              fontWeight: this.external_system_queueFontWeight
            };
          }, "external_system_queueFont"),
          containerFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.containerFontFamily,
              fontSize: this.containerFontSize,
              fontWeight: this.containerFontWeight
            };
          }, "containerFont"),
          external_containerFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.external_containerFontFamily,
              fontSize: this.external_containerFontSize,
              fontWeight: this.external_containerFontWeight
            };
          }, "external_containerFont"),
          container_dbFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.container_dbFontFamily,
              fontSize: this.container_dbFontSize,
              fontWeight: this.container_dbFontWeight
            };
          }, "container_dbFont"),
          external_container_dbFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.external_container_dbFontFamily,
              fontSize: this.external_container_dbFontSize,
              fontWeight: this.external_container_dbFontWeight
            };
          }, "external_container_dbFont"),
          container_queueFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.container_queueFontFamily,
              fontSize: this.container_queueFontSize,
              fontWeight: this.container_queueFontWeight
            };
          }, "container_queueFont"),
          external_container_queueFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.external_container_queueFontFamily,
              fontSize: this.external_container_queueFontSize,
              fontWeight: this.external_container_queueFontWeight
            };
          }, "external_container_queueFont"),
          componentFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.componentFontFamily,
              fontSize: this.componentFontSize,
              fontWeight: this.componentFontWeight
            };
          }, "componentFont"),
          external_componentFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.external_componentFontFamily,
              fontSize: this.external_componentFontSize,
              fontWeight: this.external_componentFontWeight
            };
          }, "external_componentFont"),
          component_dbFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.component_dbFontFamily,
              fontSize: this.component_dbFontSize,
              fontWeight: this.component_dbFontWeight
            };
          }, "component_dbFont"),
          external_component_dbFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.external_component_dbFontFamily,
              fontSize: this.external_component_dbFontSize,
              fontWeight: this.external_component_dbFontWeight
            };
          }, "external_component_dbFont"),
          component_queueFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.component_queueFontFamily,
              fontSize: this.component_queueFontSize,
              fontWeight: this.component_queueFontWeight
            };
          }, "component_queueFont"),
          external_component_queueFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.external_component_queueFontFamily,
              fontSize: this.external_component_queueFontSize,
              fontWeight: this.external_component_queueFontWeight
            };
          }, "external_component_queueFont"),
          boundaryFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.boundaryFontFamily,
              fontSize: this.boundaryFontSize,
              fontWeight: this.boundaryFontWeight
            };
          }, "boundaryFont"),
          messageFont: /* @__PURE__ */ __name(function() {
            return {
              fontFamily: this.messageFontFamily,
              fontSize: this.messageFontSize,
              fontWeight: this.messageFontWeight
            };
          }, "messageFont")
        },
        pie: {
          ...config_schema_default.pie,
          useWidth: 984
        },
        xyChart: {
          ...config_schema_default.xyChart,
          useWidth: void 0
        },
        requirement: {
          ...config_schema_default.requirement,
          useWidth: void 0
        },
        packet: {
          ...config_schema_default.packet
        },
        treeView: {
          ...config_schema_default.treeView,
          useWidth: void 0
        },
        radar: {
          ...config_schema_default.radar
        },
        ishikawa: {
          ...config_schema_default.ishikawa
        },
        treemap: {
          useMaxWidth: true,
          padding: 10,
          diagramPadding: 8,
          showValues: true,
          nodeWidth: 100,
          nodeHeight: 40,
          borderWidth: 1,
          valueFontSize: 12,
          labelFontSize: 14,
          valueFormat: ","
        },
        venn: {
          ...config_schema_default.venn
        }
      };
      keyify = /* @__PURE__ */ __name((obj, prefix = "") => Object.keys(obj).reduce((res, el) => {
        if (Array.isArray(obj[el])) {
          return res;
        } else if (typeof obj[el] === "object" && obj[el] !== null) {
          return [...res, prefix + el, ...keyify(obj[el], "")];
        }
        return [...res, prefix + el];
      }, []), "keyify");
      configKeys = new Set(keyify(config, ""));
      defaultConfig_default = config;
    }
  });

  // src/utils/sanitizeDirective.ts
  var sanitizeDirective, sanitizeCss;
  var init_sanitizeDirective = __esm({
    "src/utils/sanitizeDirective.ts"() {
      "use strict";
      init_defaultConfig();
      init_logger();
      sanitizeDirective = /* @__PURE__ */ __name((args) => {
        log.debug("sanitizeDirective called with", args);
        if (typeof args !== "object" || args == null) {
          return;
        }
        if (Array.isArray(args)) {
          args.forEach((arg) => sanitizeDirective(arg));
          return;
        }
        for (const key of Object.keys(args)) {
          log.debug("Checking key", key);
          if (key.startsWith("__") || key.includes("proto") || key.includes("constr") || !configKeys.has(key) || args[key] == null) {
            log.debug("sanitize deleting key: ", key);
            delete args[key];
            continue;
          }
          if (typeof args[key] === "object") {
            log.debug("sanitizing object", key);
            sanitizeDirective(args[key]);
            continue;
          }
          const cssMatchers = ["themeCSS", "fontFamily", "altFontFamily"];
          for (const cssKey of cssMatchers) {
            if (key.includes(cssKey)) {
              log.debug("sanitizing css option", key);
              args[key] = sanitizeCss(args[key]);
            }
          }
        }
        if (args.themeVariables) {
          for (const k2 of Object.keys(args.themeVariables)) {
            const val = args.themeVariables[k2];
            if (val?.match && !val.match(/^[\d "#%(),.;A-Za-z]+$/)) {
              args.themeVariables[k2] = "";
            }
          }
        }
        log.debug("After sanitization", args);
      }, "sanitizeDirective");
      sanitizeCss = /* @__PURE__ */ __name((str2) => {
        let startCnt = 0;
        let endCnt = 0;
        for (const element3 of str2) {
          if (startCnt < endCnt) {
            return "{ /* ERROR: Unbalanced CSS */ }";
          }
          if (element3 === "{") {
            startCnt++;
          } else if (element3 === "}") {
            endCnt++;
          }
        }
        if (startCnt !== endCnt) {
          return "{ /* ERROR: Unbalanced CSS */ }";
        }
        return str2;
      }, "sanitizeCss");
    }
  });

  // src/config.ts
  var defaultConfig, evaluate, siteConfig, configFromInitialize, directives, currentConfig, updateCurrentConfig, setSiteConfig, saveConfigFromInitialize, updateSiteConfig, getSiteConfig, setConfig, getConfig, sanitize, addDirective, reset, ConfigWarning, issuedWarnings, issueWarning, checkConfig, getUserDefinedConfig, getEffectiveHtmlLabels;
  var init_config = __esm({
    "src/config.ts"() {
      "use strict";
      init_assignWithDepth();
      init_logger();
      init_themes();
      init_defaultConfig();
      init_sanitizeDirective();
      defaultConfig = Object.freeze(defaultConfig_default);
      evaluate = /* @__PURE__ */ __name((val) => val === false || ["false", "null", "0"].includes(String(val).trim().toLowerCase()) ? false : true, "evaluate");
      siteConfig = assignWithDepth_default({}, defaultConfig);
      directives = [];
      currentConfig = assignWithDepth_default({}, defaultConfig);
      updateCurrentConfig = /* @__PURE__ */ __name((siteCfg, _directives) => {
        let cfg = assignWithDepth_default({}, siteCfg);
        let sumOfDirectives = {};
        for (const d3 of _directives) {
          sanitize(d3);
          sumOfDirectives = assignWithDepth_default(sumOfDirectives, d3);
        }
        cfg = assignWithDepth_default(cfg, sumOfDirectives);
        if (sumOfDirectives.theme && sumOfDirectives.theme in themes_default) {
          const tmpConfigFromInitialize = assignWithDepth_default({}, configFromInitialize);
          const themeVariables = assignWithDepth_default(
            tmpConfigFromInitialize.themeVariables || {},
            sumOfDirectives.themeVariables
          );
          if (cfg.theme && cfg.theme in themes_default) {
            cfg.themeVariables = themes_default[cfg.theme].getThemeVariables(themeVariables);
          }
        }
        currentConfig = cfg;
        checkConfig(currentConfig);
        return currentConfig;
      }, "updateCurrentConfig");
      setSiteConfig = /* @__PURE__ */ __name((conf5) => {
        siteConfig = assignWithDepth_default({}, defaultConfig);
        siteConfig = assignWithDepth_default(siteConfig, conf5);
        if (conf5.theme && themes_default[conf5.theme]) {
          siteConfig.themeVariables = themes_default[conf5.theme].getThemeVariables(conf5.themeVariables);
        }
        updateCurrentConfig(siteConfig, directives);
        return siteConfig;
      }, "setSiteConfig");
      saveConfigFromInitialize = /* @__PURE__ */ __name((conf5) => {
        configFromInitialize = assignWithDepth_default({}, conf5);
      }, "saveConfigFromInitialize");
      updateSiteConfig = /* @__PURE__ */ __name((conf5) => {
        siteConfig = assignWithDepth_default(siteConfig, conf5);
        updateCurrentConfig(siteConfig, directives);
        return siteConfig;
      }, "updateSiteConfig");
      getSiteConfig = /* @__PURE__ */ __name(() => {
        return assignWithDepth_default({}, siteConfig);
      }, "getSiteConfig");
      setConfig = /* @__PURE__ */ __name((conf5) => {
        checkConfig(conf5);
        assignWithDepth_default(currentConfig, conf5);
        return getConfig();
      }, "setConfig");
      getConfig = /* @__PURE__ */ __name(() => {
        return assignWithDepth_default({}, currentConfig);
      }, "getConfig");
      sanitize = /* @__PURE__ */ __name((options2) => {
        if (!options2) {
          return;
        }
        ["secure", ...siteConfig.secure ?? []].forEach((key) => {
          if (Object.hasOwn(options2, key)) {
            log.debug(`Denied attempt to modify a secure key ${key}`, options2[key]);
            delete options2[key];
          }
        });
        Object.keys(options2).forEach((key) => {
          if (key.startsWith("__")) {
            delete options2[key];
          }
        });
        Object.keys(options2).forEach((key) => {
          if (typeof options2[key] === "string" && (options2[key].includes("<") || options2[key].includes(">") || options2[key].includes("url(data:"))) {
            delete options2[key];
          }
          if (typeof options2[key] === "object") {
            sanitize(options2[key]);
          }
        });
      }, "sanitize");
      addDirective = /* @__PURE__ */ __name((directive) => {
        sanitizeDirective(directive);
        if (directive.fontFamily && !directive.themeVariables?.fontFamily) {
          directive.themeVariables = {
            ...directive.themeVariables,
            fontFamily: directive.fontFamily
          };
        }
        directives.push(directive);
        updateCurrentConfig(siteConfig, directives);
      }, "addDirective");
      reset = /* @__PURE__ */ __name((config5 = siteConfig) => {
        directives = [];
        updateCurrentConfig(config5, directives);
      }, "reset");
      ConfigWarning = {
        LAZY_LOAD_DEPRECATED: "The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",
        FLOWCHART_HTML_LABELS_DEPRECATED: "flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."
      };
      issuedWarnings = {};
      issueWarning = /* @__PURE__ */ __name((warning) => {
        if (issuedWarnings[warning]) {
          return;
        }
        log.warn(ConfigWarning[warning]);
        issuedWarnings[warning] = true;
      }, "issueWarning");
      checkConfig = /* @__PURE__ */ __name((config5) => {
        if (!config5) {
          return;
        }
        if (config5.lazyLoadedDiagrams || config5.loadExternalDiagramsAtStartup) {
          issueWarning("LAZY_LOAD_DEPRECATED");
        }
      }, "checkConfig");
      getUserDefinedConfig = /* @__PURE__ */ __name(() => {
        let userConfig = {};
        if (configFromInitialize) {
          userConfig = assignWithDepth_default(userConfig, configFromInitialize);
        }
        for (const d3 of directives) {
          userConfig = assignWithDepth_default(userConfig, d3);
        }
        return userConfig;
      }, "getUserDefinedConfig");
      getEffectiveHtmlLabels = /* @__PURE__ */ __name((config5) => {
        if (config5.flowchart?.htmlLabels != void 0) {
          issueWarning("FLOWCHART_HTML_LABELS_DEPRECATED");
        }
        return evaluate(config5.htmlLabels ?? config5.flowchart?.htmlLabels ?? true);
      }, "getEffectiveHtmlLabels");
    }
  });

  // ../../node_modules/.pnpm/dompurify@3.3.1/node_modules/dompurify/dist/purify.es.mjs
  function unapply(func) {
    return function(thisArg) {
      if (thisArg instanceof RegExp) {
        thisArg.lastIndex = 0;
      }
      for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
        args[_key3 - 1] = arguments[_key3];
      }
      return apply(func, thisArg, args);
    };
  }
  function unconstruct(Func) {
    return function() {
      for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
        args[_key4] = arguments[_key4];
      }
      return construct(Func, args);
    };
  }
  function addToSet(set5, array4) {
    let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
    if (setPrototypeOf) {
      setPrototypeOf(set5, null);
    }
    let l4 = array4.length;
    while (l4--) {
      let element3 = array4[l4];
      if (typeof element3 === "string") {
        const lcElement = transformCaseFunc(element3);
        if (lcElement !== element3) {
          if (!isFrozen(array4)) {
            array4[l4] = lcElement;
          }
          element3 = lcElement;
        }
      }
      set5[element3] = true;
    }
    return set5;
  }
  function cleanArray(array4) {
    for (let index = 0; index < array4.length; index++) {
      const isPropertyExist = objectHasOwnProperty(array4, index);
      if (!isPropertyExist) {
        array4[index] = null;
      }
    }
    return array4;
  }
  function clone(object3) {
    const newObject = create(null);
    for (const [property2, value2] of entries(object3)) {
      const isPropertyExist = objectHasOwnProperty(object3, property2);
      if (isPropertyExist) {
        if (Array.isArray(value2)) {
          newObject[property2] = cleanArray(value2);
        } else if (value2 && typeof value2 === "object" && value2.constructor === Object) {
          newObject[property2] = clone(value2);
        } else {
          newObject[property2] = value2;
        }
      }
    }
    return newObject;
  }
  function lookupGetter(object3, prop) {
    while (object3 !== null) {
      const desc = getOwnPropertyDescriptor(object3, prop);
      if (desc) {
        if (desc.get) {
          return unapply(desc.get);
        }
        if (typeof desc.value === "function") {
          return unapply(desc.value);
        }
      }
      object3 = getPrototypeOf(object3);
    }
    function fallbackValue() {
      return null;
    }
    __name(fallbackValue, "fallbackValue");
    return fallbackValue;
  }
  function createDOMPurify() {
    let window3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
    const DOMPurify = /* @__PURE__ */ __name((root3) => createDOMPurify(root3), "DOMPurify");
    DOMPurify.version = "3.3.1";
    DOMPurify.removed = [];
    if (!window3 || !window3.document || window3.document.nodeType !== NODE_TYPE.document || !window3.Element) {
      DOMPurify.isSupported = false;
      return DOMPurify;
    }
    let {
      document: document2
    } = window3;
    const originalDocument = document2;
    const currentScript = originalDocument.currentScript;
    const {
      DocumentFragment: DocumentFragment2,
      HTMLTemplateElement,
      Node: Node2,
      Element: Element3,
      NodeFilter,
      NamedNodeMap = window3.NamedNodeMap || window3.MozNamedAttrMap,
      HTMLFormElement,
      DOMParser,
      trustedTypes
    } = window3;
    const ElementPrototype = Element3.prototype;
    const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
    const remove3 = lookupGetter(ElementPrototype, "remove");
    const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
    const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
    const getParentNode = lookupGetter(ElementPrototype, "parentNode");
    if (typeof HTMLTemplateElement === "function") {
      const template = document2.createElement("template");
      if (template.content && template.content.ownerDocument) {
        document2 = template.content.ownerDocument;
      }
    }
    let trustedTypesPolicy;
    let emptyHTML = "";
    const {
      implementation,
      createNodeIterator,
      createDocumentFragment,
      getElementsByTagName
    } = document2;
    const {
      importNode
    } = originalDocument;
    let hooks = _createHooksMap();
    DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
    const {
      MUSTACHE_EXPR: MUSTACHE_EXPR2,
      ERB_EXPR: ERB_EXPR2,
      TMPLIT_EXPR: TMPLIT_EXPR2,
      DATA_ATTR: DATA_ATTR2,
      ARIA_ATTR: ARIA_ATTR2,
      IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
      ATTR_WHITESPACE: ATTR_WHITESPACE2,
      CUSTOM_ELEMENT: CUSTOM_ELEMENT2
    } = EXPRESSIONS;
    let {
      IS_ALLOWED_URI: IS_ALLOWED_URI$1
    } = EXPRESSIONS;
    let ALLOWED_TAGS = null;
    const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
    let ALLOWED_ATTR = null;
    const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
    let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
      tagNameCheck: {
        writable: true,
        configurable: false,
        enumerable: true,
        value: null
      },
      attributeNameCheck: {
        writable: true,
        configurable: false,
        enumerable: true,
        value: null
      },
      allowCustomizedBuiltInElements: {
        writable: true,
        configurable: false,
        enumerable: true,
        value: false
      }
    }));
    let FORBID_TAGS = null;
    let FORBID_ATTR = null;
    const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
      tagCheck: {
        writable: true,
        configurable: false,
        enumerable: true,
        value: null
      },
      attributeCheck: {
        writable: true,
        configurable: false,
        enumerable: true,
        value: null
      }
    }));
    let ALLOW_ARIA_ATTR = true;
    let ALLOW_DATA_ATTR = true;
    let ALLOW_UNKNOWN_PROTOCOLS = false;
    let ALLOW_SELF_CLOSE_IN_ATTR = true;
    let SAFE_FOR_TEMPLATES = false;
    let SAFE_FOR_XML = true;
    let WHOLE_DOCUMENT = false;
    let SET_CONFIG = false;
    let FORCE_BODY = false;
    let RETURN_DOM = false;
    let RETURN_DOM_FRAGMENT = false;
    let RETURN_TRUSTED_TYPE = false;
    let SANITIZE_DOM = true;
    let SANITIZE_NAMED_PROPS = false;
    const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
    let KEEP_CONTENT = true;
    let IN_PLACE = false;
    let USE_PROFILES = {};
    let FORBID_CONTENTS = null;
    const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
    let DATA_URI_TAGS = null;
    const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
    let URI_SAFE_ATTRIBUTES = null;
    const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
    const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
    const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
    const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
    let NAMESPACE2 = HTML_NAMESPACE;
    let IS_EMPTY_INPUT = false;
    let ALLOWED_NAMESPACES = null;
    const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
    let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
    let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
    const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
    let PARSER_MEDIA_TYPE = null;
    const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
    const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
    let transformCaseFunc = null;
    let CONFIG = null;
    const formElement = document2.createElement("form");
    const isRegexOrFunction = /* @__PURE__ */ __name(function isRegexOrFunction2(testValue) {
      return testValue instanceof RegExp || testValue instanceof Function;
    }, "isRegexOrFunction");
    const _parseConfig = /* @__PURE__ */ __name(function _parseConfig2() {
      let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
      if (CONFIG && CONFIG === cfg) {
        return;
      }
      if (!cfg || typeof cfg !== "object") {
        cfg = {};
      }
      cfg = clone(cfg);
      PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
      SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
      transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
      ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
      ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
      ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
      URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
      DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
      FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
      FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
      FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
      USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false;
      ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
      ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
      ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
      ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
      SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
      SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
      WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
      RETURN_DOM = cfg.RETURN_DOM || false;
      RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
      RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
      FORCE_BODY = cfg.FORCE_BODY || false;
      SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
      SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
      KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
      IN_PLACE = cfg.IN_PLACE || false;
      IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
      NAMESPACE2 = cfg.NAMESPACE || HTML_NAMESPACE;
      MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
      HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
      CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
      if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
        CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
      }
      if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
        CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
      }
      if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") {
        CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
      }
      if (SAFE_FOR_TEMPLATES) {
        ALLOW_DATA_ATTR = false;
      }
      if (RETURN_DOM_FRAGMENT) {
        RETURN_DOM = true;
      }
      if (USE_PROFILES) {
        ALLOWED_TAGS = addToSet({}, text);
        ALLOWED_ATTR = [];
        if (USE_PROFILES.html === true) {
          addToSet(ALLOWED_TAGS, html$1);
          addToSet(ALLOWED_ATTR, html);
        }
        if (USE_PROFILES.svg === true) {
          addToSet(ALLOWED_TAGS, svg$1);
          addToSet(ALLOWED_ATTR, svg);
          addToSet(ALLOWED_ATTR, xml);
        }
        if (USE_PROFILES.svgFilters === true) {
          addToSet(ALLOWED_TAGS, svgFilters);
          addToSet(ALLOWED_ATTR, svg);
          addToSet(ALLOWED_ATTR, xml);
        }
        if (USE_PROFILES.mathMl === true) {
          addToSet(ALLOWED_TAGS, mathMl$1);
          addToSet(ALLOWED_ATTR, mathMl);
          addToSet(ALLOWED_ATTR, xml);
        }
      }
      if (cfg.ADD_TAGS) {
        if (typeof cfg.ADD_TAGS === "function") {
          EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
        } else {
          if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
            ALLOWED_TAGS = clone(ALLOWED_TAGS);
          }
          addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
        }
      }
      if (cfg.ADD_ATTR) {
        if (typeof cfg.ADD_ATTR === "function") {
          EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
        } else {
          if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
            ALLOWED_ATTR = clone(ALLOWED_ATTR);
          }
          addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
        }
      }
      if (cfg.ADD_URI_SAFE_ATTR) {
        addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
      }
      if (cfg.FORBID_CONTENTS) {
        if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
          FORBID_CONTENTS = clone(FORBID_CONTENTS);
        }
        addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
      }
      if (cfg.ADD_FORBID_CONTENTS) {
        if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
          FORBID_CONTENTS = clone(FORBID_CONTENTS);
        }
        addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
      }
      if (KEEP_CONTENT) {
        ALLOWED_TAGS["#text"] = true;
      }
      if (WHOLE_DOCUMENT) {
        addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
      }
      if (ALLOWED_TAGS.table) {
        addToSet(ALLOWED_TAGS, ["tbody"]);
        delete FORBID_TAGS.tbody;
      }
      if (cfg.TRUSTED_TYPES_POLICY) {
        if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
          throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
        }
        if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
          throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
        }
        trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
        emptyHTML = trustedTypesPolicy.createHTML("");
      } else {
        if (trustedTypesPolicy === void 0) {
          trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
        }
        if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
          emptyHTML = trustedTypesPolicy.createHTML("");
        }
      }
      if (freeze) {
        freeze(cfg);
      }
      CONFIG = cfg;
    }, "_parseConfig");
    const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
    const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
    const _checkValidNamespace = /* @__PURE__ */ __name(function _checkValidNamespace2(element3) {
      let parent4 = getParentNode(element3);
      if (!parent4 || !parent4.tagName) {
        parent4 = {
          namespaceURI: NAMESPACE2,
          tagName: "template"
        };
      }
      const tagName = stringToLowerCase(element3.tagName);
      const parentTagName = stringToLowerCase(parent4.tagName);
      if (!ALLOWED_NAMESPACES[element3.namespaceURI]) {
        return false;
      }
      if (element3.namespaceURI === SVG_NAMESPACE) {
        if (parent4.namespaceURI === HTML_NAMESPACE) {
          return tagName === "svg";
        }
        if (parent4.namespaceURI === MATHML_NAMESPACE) {
          return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
        }
        return Boolean(ALL_SVG_TAGS[tagName]);
      }
      if (element3.namespaceURI === MATHML_NAMESPACE) {
        if (parent4.namespaceURI === HTML_NAMESPACE) {
          return tagName === "math";
        }
        if (parent4.namespaceURI === SVG_NAMESPACE) {
          return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
        }
        return Boolean(ALL_MATHML_TAGS[tagName]);
      }
      if (element3.namespaceURI === HTML_NAMESPACE) {
        if (parent4.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
          return false;
        }
        if (parent4.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
          return false;
        }
        return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
      }
      if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element3.namespaceURI]) {
        return true;
      }
      return false;
    }, "_checkValidNamespace");
    const _forceRemove = /* @__PURE__ */ __name(function _forceRemove2(node2) {
      arrayPush(DOMPurify.removed, {
        element: node2
      });
      try {
        getParentNode(node2).removeChild(node2);
      } catch (_3) {
        remove3(node2);
      }
    }, "_forceRemove");
    const _removeAttribute = /* @__PURE__ */ __name(function _removeAttribute2(name, element3) {
      try {
        arrayPush(DOMPurify.removed, {
          attribute: element3.getAttributeNode(name),
          from: element3
        });
      } catch (_3) {
        arrayPush(DOMPurify.removed, {
          attribute: null,
          from: element3
        });
      }
      element3.removeAttribute(name);
      if (name === "is") {
        if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
          try {
            _forceRemove(element3);
          } catch (_3) {
          }
        } else {
          try {
            element3.setAttribute(name, "");
          } catch (_3) {
          }
        }
      }
    }, "_removeAttribute");
    const _initDocument = /* @__PURE__ */ __name(function _initDocument2(dirty) {
      let doc = null;
      let leadingWhitespace = null;
      if (FORCE_BODY) {
        dirty = "<remove></remove>" + dirty;
      } else {
        const matches33 = stringMatch(dirty, /^[\r\n\t ]+/);
        leadingWhitespace = matches33 && matches33[0];
      }
      if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE2 === HTML_NAMESPACE) {
        dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
      }
      const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
      if (NAMESPACE2 === HTML_NAMESPACE) {
        try {
          doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
        } catch (_3) {
        }
      }
      if (!doc || !doc.documentElement) {
        doc = implementation.createDocument(NAMESPACE2, "template", null);
        try {
          doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
        } catch (_3) {
        }
      }
      const body = doc.body || doc.documentElement;
      if (dirty && leadingWhitespace) {
        body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
      }
      if (NAMESPACE2 === HTML_NAMESPACE) {
        return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
      }
      return WHOLE_DOCUMENT ? doc.documentElement : body;
    }, "_initDocument");
    const _createNodeIterator = /* @__PURE__ */ __name(function _createNodeIterator2(root3) {
      return createNodeIterator.call(
        root3.ownerDocument || root3,
        root3,
        // eslint-disable-next-line no-bitwise
        NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
        null
      );
    }, "_createNodeIterator");
    const _isClobbered = /* @__PURE__ */ __name(function _isClobbered2(element3) {
      return element3 instanceof HTMLFormElement && (typeof element3.nodeName !== "string" || typeof element3.textContent !== "string" || typeof element3.removeChild !== "function" || !(element3.attributes instanceof NamedNodeMap) || typeof element3.removeAttribute !== "function" || typeof element3.setAttribute !== "function" || typeof element3.namespaceURI !== "string" || typeof element3.insertBefore !== "function" || typeof element3.hasChildNodes !== "function");
    }, "_isClobbered");
    const _isNode = /* @__PURE__ */ __name(function _isNode2(value2) {
      return typeof Node2 === "function" && value2 instanceof Node2;
    }, "_isNode");
    function _executeHooks(hooks2, currentNode, data5) {
      arrayForEach(hooks2, (hook2) => {
        hook2.call(DOMPurify, currentNode, data5, CONFIG);
      });
    }
    __name(_executeHooks, "_executeHooks");
    const _sanitizeElements = /* @__PURE__ */ __name(function _sanitizeElements2(currentNode) {
      let content = null;
      _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
      if (_isClobbered(currentNode)) {
        _forceRemove(currentNode);
        return true;
      }
      const tagName = transformCaseFunc(currentNode.nodeName);
      _executeHooks(hooks.uponSanitizeElement, currentNode, {
        tagName,
        allowedTags: ALLOWED_TAGS
      });
      if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
        _forceRemove(currentNode);
        return true;
      }
      if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
        _forceRemove(currentNode);
        return true;
      }
      if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
        _forceRemove(currentNode);
        return true;
      }
      if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
        if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
          if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
            return false;
          }
          if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
            return false;
          }
        }
        if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
          const parentNode = getParentNode(currentNode) || currentNode.parentNode;
          const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
          if (childNodes && parentNode) {
            const childCount = childNodes.length;
            for (let i2 = childCount - 1; i2 >= 0; --i2) {
              const childClone = cloneNode(childNodes[i2], true);
              childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
              parentNode.insertBefore(childClone, getNextSibling(currentNode));
            }
          }
        }
        _forceRemove(currentNode);
        return true;
      }
      if (currentNode instanceof Element3 && !_checkValidNamespace(currentNode)) {
        _forceRemove(currentNode);
        return true;
      }
      if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
        _forceRemove(currentNode);
        return true;
      }
      if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
        content = currentNode.textContent;
        arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
          content = stringReplace(content, expr, " ");
        });
        if (currentNode.textContent !== content) {
          arrayPush(DOMPurify.removed, {
            element: currentNode.cloneNode()
          });
          currentNode.textContent = content;
        }
      }
      _executeHooks(hooks.afterSanitizeElements, currentNode, null);
      return false;
    }, "_sanitizeElements");
    const _isValidAttribute = /* @__PURE__ */ __name(function _isValidAttribute2(lcTag, lcName, value2) {
      if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value2 in document2 || value2 in formElement)) {
        return false;
      }
      if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
      else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ;
      else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ;
      else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
        if (
          // First condition does a very basic check if a) it's basically a valid custom element tagname AND
          // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
          // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
          _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || // Alternative, second condition checks if it's an `is`-attribute, AND
          // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
          lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value2) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value2))
        ) ;
        else {
          return false;
        }
      } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
      else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value2, ATTR_WHITESPACE2, ""))) ;
      else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value2, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
      else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value2, ATTR_WHITESPACE2, ""))) ;
      else if (value2) {
        return false;
      } else ;
      return true;
    }, "_isValidAttribute");
    const _isBasicCustomElement = /* @__PURE__ */ __name(function _isBasicCustomElement2(tagName) {
      return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT2);
    }, "_isBasicCustomElement");
    const _sanitizeAttributes = /* @__PURE__ */ __name(function _sanitizeAttributes2(currentNode) {
      _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
      const {
        attributes
      } = currentNode;
      if (!attributes || _isClobbered(currentNode)) {
        return;
      }
      const hookEvent = {
        attrName: "",
        attrValue: "",
        keepAttr: true,
        allowedAttributes: ALLOWED_ATTR,
        forceKeepAttr: void 0
      };
      let l4 = attributes.length;
      while (l4--) {
        const attr = attributes[l4];
        const {
          name,
          namespaceURI,
          value: attrValue
        } = attr;
        const lcName = transformCaseFunc(name);
        const initValue = attrValue;
        let value2 = name === "value" ? initValue : stringTrim(initValue);
        hookEvent.attrName = lcName;
        hookEvent.attrValue = value2;
        hookEvent.keepAttr = true;
        hookEvent.forceKeepAttr = void 0;
        _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
        value2 = hookEvent.attrValue;
        if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
          _removeAttribute(name, currentNode);
          value2 = SANITIZE_NAMED_PROPS_PREFIX + value2;
        }
        if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value2)) {
          _removeAttribute(name, currentNode);
          continue;
        }
        if (lcName === "attributename" && stringMatch(value2, "href")) {
          _removeAttribute(name, currentNode);
          continue;
        }
        if (hookEvent.forceKeepAttr) {
          continue;
        }
        if (!hookEvent.keepAttr) {
          _removeAttribute(name, currentNode);
          continue;
        }
        if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value2)) {
          _removeAttribute(name, currentNode);
          continue;
        }
        if (SAFE_FOR_TEMPLATES) {
          arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
            value2 = stringReplace(value2, expr, " ");
          });
        }
        const lcTag = transformCaseFunc(currentNode.nodeName);
        if (!_isValidAttribute(lcTag, lcName, value2)) {
          _removeAttribute(name, currentNode);
          continue;
        }
        if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
          if (namespaceURI) ;
          else {
            switch (trustedTypes.getAttributeType(lcTag, lcName)) {
              case "TrustedHTML": {
                value2 = trustedTypesPolicy.createHTML(value2);
                break;
              }
              case "TrustedScriptURL": {
                value2 = trustedTypesPolicy.createScriptURL(value2);
                break;
              }
            }
          }
        }
        if (value2 !== initValue) {
          try {
            if (namespaceURI) {
              currentNode.setAttributeNS(namespaceURI, name, value2);
            } else {
              currentNode.setAttribute(name, value2);
            }
            if (_isClobbered(currentNode)) {
              _forceRemove(currentNode);
            } else {
              arrayPop(DOMPurify.removed);
            }
          } catch (_3) {
            _removeAttribute(name, currentNode);
          }
        }
      }
      _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
    }, "_sanitizeAttributes");
    const _sanitizeShadowDOM = /* @__PURE__ */ __name(function _sanitizeShadowDOM2(fragment) {
      let shadowNode = null;
      const shadowIterator = _createNodeIterator(fragment);
      _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
      while (shadowNode = shadowIterator.nextNode()) {
        _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
        _sanitizeElements(shadowNode);
        _sanitizeAttributes(shadowNode);
        if (shadowNode.content instanceof DocumentFragment2) {
          _sanitizeShadowDOM2(shadowNode.content);
        }
      }
      _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
    }, "_sanitizeShadowDOM");
    DOMPurify.sanitize = function(dirty) {
      let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      let body = null;
      let importedNode = null;
      let currentNode = null;
      let returnNode = null;
      IS_EMPTY_INPUT = !dirty;
      if (IS_EMPTY_INPUT) {
        dirty = "<!-->";
      }
      if (typeof dirty !== "string" && !_isNode(dirty)) {
        if (typeof dirty.toString === "function") {
          dirty = dirty.toString();
          if (typeof dirty !== "string") {
            throw typeErrorCreate("dirty is not a string, aborting");
          }
        } else {
          throw typeErrorCreate("toString is not a function");
        }
      }
      if (!DOMPurify.isSupported) {
        return dirty;
      }
      if (!SET_CONFIG) {
        _parseConfig(cfg);
      }
      DOMPurify.removed = [];
      if (typeof dirty === "string") {
        IN_PLACE = false;
      }
      if (IN_PLACE) {
        if (dirty.nodeName) {
          const tagName = transformCaseFunc(dirty.nodeName);
          if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
            throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
          }
        }
      } else if (dirty instanceof Node2) {
        body = _initDocument("<!---->");
        importedNode = body.ownerDocument.importNode(dirty, true);
        if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
          body = importedNode;
        } else if (importedNode.nodeName === "HTML") {
          body = importedNode;
        } else {
          body.appendChild(importedNode);
        }
      } else {
        if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
        dirty.indexOf("<") === -1) {
          return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
        }
        body = _initDocument(dirty);
        if (!body) {
          return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
        }
      }
      if (body && FORCE_BODY) {
        _forceRemove(body.firstChild);
      }
      const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
      while (currentNode = nodeIterator.nextNode()) {
        _sanitizeElements(currentNode);
        _sanitizeAttributes(currentNode);
        if (currentNode.content instanceof DocumentFragment2) {
          _sanitizeShadowDOM(currentNode.content);
        }
      }
      if (IN_PLACE) {
        return dirty;
      }
      if (RETURN_DOM) {
        if (RETURN_DOM_FRAGMENT) {
          returnNode = createDocumentFragment.call(body.ownerDocument);
          while (body.firstChild) {
            returnNode.appendChild(body.firstChild);
          }
        } else {
          returnNode = body;
        }
        if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
          returnNode = importNode.call(originalDocument, returnNode, true);
        }
        return returnNode;
      }
      let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
      if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
        serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
      }
      if (SAFE_FOR_TEMPLATES) {
        arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
          serializedHTML = stringReplace(serializedHTML, expr, " ");
        });
      }
      return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
    };
    DOMPurify.setConfig = function() {
      let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
      _parseConfig(cfg);
      SET_CONFIG = true;
    };
    DOMPurify.clearConfig = function() {
      CONFIG = null;
      SET_CONFIG = false;
    };
    DOMPurify.isValidAttribute = function(tag, attr, value2) {
      if (!CONFIG) {
        _parseConfig({});
      }
      const lcTag = transformCaseFunc(tag);
      const lcName = transformCaseFunc(attr);
      return _isValidAttribute(lcTag, lcName, value2);
    };
    DOMPurify.addHook = function(entryPoint, hookFunction) {
      if (typeof hookFunction !== "function") {
        return;
      }
      arrayPush(hooks[entryPoint], hookFunction);
    };
    DOMPurify.removeHook = function(entryPoint, hookFunction) {
      if (hookFunction !== void 0) {
        const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
        return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
      }
      return arrayPop(hooks[entryPoint]);
    };
    DOMPurify.removeHooks = function(entryPoint) {
      hooks[entryPoint] = [];
    };
    DOMPurify.removeAllHooks = function() {
      hooks = _createHooksMap();
    };
    return DOMPurify;
  }
  var entries, setPrototypeOf, isFrozen, getPrototypeOf, getOwnPropertyDescriptor, freeze, seal, create, apply, construct, arrayForEach, arrayLastIndexOf, arrayPop, arrayPush, arraySplice, stringToLowerCase, stringToString, stringMatch, stringReplace, stringIndexOf, stringTrim, objectHasOwnProperty, regExpTest, typeErrorCreate, html$1, svg$1, svgFilters, svgDisallowed, mathMl$1, mathMlDisallowed, text, html, svg, mathMl, xml, MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR, DATA_ATTR, ARIA_ATTR, IS_ALLOWED_URI, IS_SCRIPT_OR_DATA, ATTR_WHITESPACE, DOCTYPE_NAME, CUSTOM_ELEMENT, EXPRESSIONS, NODE_TYPE, getGlobal, _createTrustedTypesPolicy, _createHooksMap, purify;
  var init_purify_es = __esm({
    "../../node_modules/.pnpm/dompurify@3.3.1/node_modules/dompurify/dist/purify.es.mjs"() {
      "use strict";
      ({
        entries,
        setPrototypeOf,
        isFrozen,
        getPrototypeOf,
        getOwnPropertyDescriptor
      } = Object);
      ({
        freeze,
        seal,
        create
      } = Object);
      ({
        apply,
        construct
      } = typeof Reflect !== "undefined" && Reflect);
      if (!freeze) {
        freeze = /* @__PURE__ */ __name(function freeze2(x5) {
          return x5;
        }, "freeze");
      }
      if (!seal) {
        seal = /* @__PURE__ */ __name(function seal2(x5) {
          return x5;
        }, "seal");
      }
      if (!apply) {
        apply = /* @__PURE__ */ __name(function apply4(func, thisArg) {
          for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
            args[_key - 2] = arguments[_key];
          }
          return func.apply(thisArg, args);
        }, "apply");
      }
      if (!construct) {
        construct = /* @__PURE__ */ __name(function construct2(Func) {
          for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
            args[_key2 - 1] = arguments[_key2];
          }
          return new Func(...args);
        }, "construct");
      }
      arrayForEach = unapply(Array.prototype.forEach);
      arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
      arrayPop = unapply(Array.prototype.pop);
      arrayPush = unapply(Array.prototype.push);
      arraySplice = unapply(Array.prototype.splice);
      stringToLowerCase = unapply(String.prototype.toLowerCase);
      stringToString = unapply(String.prototype.toString);
      stringMatch = unapply(String.prototype.match);
      stringReplace = unapply(String.prototype.replace);
      stringIndexOf = unapply(String.prototype.indexOf);
      stringTrim = unapply(String.prototype.trim);
      objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
      regExpTest = unapply(RegExp.prototype.test);
      typeErrorCreate = unconstruct(TypeError);
      __name(unapply, "unapply");
      __name(unconstruct, "unconstruct");
      __name(addToSet, "addToSet");
      __name(cleanArray, "cleanArray");
      __name(clone, "clone");
      __name(lookupGetter, "lookupGetter");
      html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
      svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
      svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
      svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
      mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
      mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
      text = freeze(["#text"]);
      html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]);
      svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
      mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
      xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
      MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
      ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
      TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm);
      DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
      ARIA_ATTR = seal(/^aria-[\-\w]+$/);
      IS_ALLOWED_URI = seal(
        /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
        // eslint-disable-line no-useless-escape
      );
      IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
      ATTR_WHITESPACE = seal(
        /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
        // eslint-disable-line no-control-regex
      );
      DOCTYPE_NAME = seal(/^html$/i);
      CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
      EXPRESSIONS = /* @__PURE__ */ Object.freeze({
        __proto__: null,
        ARIA_ATTR,
        ATTR_WHITESPACE,
        CUSTOM_ELEMENT,
        DATA_ATTR,
        DOCTYPE_NAME,
        ERB_EXPR,
        IS_ALLOWED_URI,
        IS_SCRIPT_OR_DATA,
        MUSTACHE_EXPR,
        TMPLIT_EXPR
      });
      NODE_TYPE = {
        element: 1,
        attribute: 2,
        text: 3,
        cdataSection: 4,
        entityReference: 5,
        // Deprecated
        entityNode: 6,
        // Deprecated
        progressingInstruction: 7,
        comment: 8,
        document: 9,
        documentType: 10,
        documentFragment: 11,
        notation: 12
        // Deprecated
      };
      getGlobal = /* @__PURE__ */ __name(function getGlobal2() {
        return typeof window === "undefined" ? null : window;
      }, "getGlobal");
      _createTrustedTypesPolicy = /* @__PURE__ */ __name(function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
        if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
          return null;
        }
        let suffix = null;
        const ATTR_NAME = "data-tt-policy-suffix";
        if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
          suffix = purifyHostElement.getAttribute(ATTR_NAME);
        }
        const policyName = "dompurify" + (suffix ? "#" + suffix : "");
        try {
          return trustedTypes.createPolicy(policyName, {
            createHTML(html2) {
              return html2;
            },
            createScriptURL(scriptUrl) {
              return scriptUrl;
            }
          });
        } catch (_3) {
          console.warn("TrustedTypes policy " + policyName + " could not be created.");
          return null;
        }
      }, "_createTrustedTypesPolicy");
      _createHooksMap = /* @__PURE__ */ __name(function _createHooksMap2() {
        return {
          afterSanitizeAttributes: [],
          afterSanitizeElements: [],
          afterSanitizeShadowDOM: [],
          beforeSanitizeAttributes: [],
          beforeSanitizeElements: [],
          beforeSanitizeShadowDOM: [],
          uponSanitizeAttribute: [],
          uponSanitizeElement: [],
          uponSanitizeShadowNode: []
        };
      }, "_createHooksMap");
      __name(createDOMPurify, "createDOMPurify");
      purify = createDOMPurify();
    }
  });

  // ../../node_modules/.pnpm/katex@0.16.25/node_modules/katex/dist/katex.mjs
  var katex_exports = {};
  __export(katex_exports, {
    ParseError: () => ParseError,
    SETTINGS_SCHEMA: () => SETTINGS_SCHEMA,
    __defineFunction: () => defineFunction,
    __defineMacro: () => defineMacro,
    __defineSymbol: () => defineSymbol,
    __domTree: () => __domTree,
    __parse: () => generateParseTree,
    __renderToDomTree: () => renderToDomTree,
    __renderToHTMLTree: () => renderToHTMLTree,
    __setFontMetrics: () => setFontMetrics,
    default: () => katex,
    render: () => render,
    renderToString: () => renderToString,
    version: () => version
  });
  function escape2(text4) {
    return String(text4).replace(ESCAPE_REGEX, (match2) => ESCAPE_LOOKUP[match2]);
  }
  function getDefaultValue(schema2) {
    if (schema2.default) {
      return schema2.default;
    }
    var type3 = schema2.type;
    var defaultType = Array.isArray(type3) ? type3[0] : type3;
    if (typeof defaultType !== "string") {
      return defaultType.enum[0];
    }
    switch (defaultType) {
      case "boolean":
        return false;
      case "string":
        return "";
      case "number":
        return 0;
      case "object":
        return {};
    }
  }
  function scriptFromCodepoint(codepoint) {
    for (var i2 = 0; i2 < scriptData.length; i2++) {
      var script = scriptData[i2];
      for (var _i = 0; _i < script.blocks.length; _i++) {
        var block2 = script.blocks[_i];
        if (codepoint >= block2[0] && codepoint <= block2[1]) {
          return script.name;
        }
      }
    }
    return null;
  }
  function supportedCodepoint(codepoint) {
    for (var i2 = 0; i2 < allBlocks.length; i2 += 2) {
      if (codepoint >= allBlocks[i2] && codepoint <= allBlocks[i2 + 1]) {
        return true;
      }
    }
    return false;
  }
  function setFontMetrics(fontName, metrics) {
    fontMetricsData[fontName] = metrics;
  }
  function getCharacterMetrics(character2, font, mode) {
    if (!fontMetricsData[font]) {
      throw new Error("Font metrics not found for font: " + font + ".");
    }
    var ch = character2.charCodeAt(0);
    var metrics = fontMetricsData[font][ch];
    if (!metrics && character2[0] in extraCharacterMap) {
      ch = extraCharacterMap[character2[0]].charCodeAt(0);
      metrics = fontMetricsData[font][ch];
    }
    if (!metrics && mode === "text") {
      if (supportedCodepoint(ch)) {
        metrics = fontMetricsData[font][77];
      }
    }
    if (metrics) {
      return {
        depth: metrics[0],
        height: metrics[1],
        italic: metrics[2],
        skew: metrics[3],
        width: metrics[4]
      };
    }
  }
  function getGlobalMetrics(size4) {
    var sizeIndex;
    if (size4 >= 5) {
      sizeIndex = 0;
    } else if (size4 >= 3) {
      sizeIndex = 1;
    } else {
      sizeIndex = 2;
    }
    if (!fontMetricsBySizeIndex[sizeIndex]) {
      var metrics = fontMetricsBySizeIndex[sizeIndex] = {
        cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18
      };
      for (var key in sigmasAndXis) {
        if (sigmasAndXis.hasOwnProperty(key)) {
          metrics[key] = sigmasAndXis[key][sizeIndex];
        }
      }
    }
    return fontMetricsBySizeIndex[sizeIndex];
  }
  function assertSymbolDomNode(group2) {
    if (group2 instanceof SymbolNode) {
      return group2;
    } else {
      throw new Error("Expected symbolNode but got " + String(group2) + ".");
    }
  }
  function assertSpan(group2) {
    if (group2 instanceof Span) {
      return group2;
    } else {
      throw new Error("Expected span<HtmlDomNode> but got " + String(group2) + ".");
    }
  }
  function defineSymbol(mode, font, group2, replace2, name, acceptUnicodeChar) {
    symbols[mode][name] = {
      font,
      group: group2,
      replace: replace2
    };
    if (acceptUnicodeChar && replace2) {
      symbols[mode][replace2] = symbols[mode][name];
    }
  }
  function defineFunction(_ref) {
    var {
      type: type3,
      names,
      props,
      handler,
      htmlBuilder: htmlBuilder3,
      mathmlBuilder: mathmlBuilder3
    } = _ref;
    var data5 = {
      type: type3,
      numArgs: props.numArgs,
      argTypes: props.argTypes,
      allowedInArgument: !!props.allowedInArgument,
      allowedInText: !!props.allowedInText,
      allowedInMath: props.allowedInMath === void 0 ? true : props.allowedInMath,
      numOptionalArgs: props.numOptionalArgs || 0,
      infix: !!props.infix,
      primitive: !!props.primitive,
      handler
    };
    for (var i2 = 0; i2 < names.length; ++i2) {
      _functions[names[i2]] = data5;
    }
    if (type3) {
      if (htmlBuilder3) {
        _htmlGroupBuilders[type3] = htmlBuilder3;
      }
      if (mathmlBuilder3) {
        _mathmlGroupBuilders[type3] = mathmlBuilder3;
      }
    }
  }
  function defineFunctionBuilders(_ref2) {
    var {
      type: type3,
      htmlBuilder: htmlBuilder3,
      mathmlBuilder: mathmlBuilder3
    } = _ref2;
    defineFunction({
      type: type3,
      names: [],
      props: {
        numArgs: 0
      },
      handler() {
        throw new Error("Should never be called.");
      },
      htmlBuilder: htmlBuilder3,
      mathmlBuilder: mathmlBuilder3
    });
  }
  function buildHTMLUnbreakable(children2, options2) {
    var body = makeSpan$1(["base"], children2, options2);
    var strut = makeSpan$1(["strut"]);
    strut.style.height = makeEm(body.height + body.depth);
    if (body.depth) {
      strut.style.verticalAlign = makeEm(-body.depth);
    }
    body.children.unshift(strut);
    return body;
  }
  function buildHTML(tree, options2) {
    var tag = null;
    if (tree.length === 1 && tree[0].type === "tag") {
      tag = tree[0].tag;
      tree = tree[0].body;
    }
    var expression = buildExpression$1(tree, options2, "root");
    var eqnNum;
    if (expression.length === 2 && expression[1].hasClass("tag")) {
      eqnNum = expression.pop();
    }
    var children2 = [];
    var parts = [];
    for (var i2 = 0; i2 < expression.length; i2++) {
      parts.push(expression[i2]);
      if (expression[i2].hasClass("mbin") || expression[i2].hasClass("mrel") || expression[i2].hasClass("allowbreak")) {
        var nobreak = false;
        while (i2 < expression.length - 1 && expression[i2 + 1].hasClass("mspace") && !expression[i2 + 1].hasClass("newline")) {
          i2++;
          parts.push(expression[i2]);
          if (expression[i2].hasClass("nobreak")) {
            nobreak = true;
          }
        }
        if (!nobreak) {
          children2.push(buildHTMLUnbreakable(parts, options2));
          parts = [];
        }
      } else if (expression[i2].hasClass("newline")) {
        parts.pop();
        if (parts.length > 0) {
          children2.push(buildHTMLUnbreakable(parts, options2));
          parts = [];
        }
        children2.push(expression[i2]);
      }
    }
    if (parts.length > 0) {
      children2.push(buildHTMLUnbreakable(parts, options2));
    }
    var tagChild;
    if (tag) {
      tagChild = buildHTMLUnbreakable(buildExpression$1(tag, options2, true));
      tagChild.classes = ["tag"];
      children2.push(tagChild);
    } else if (eqnNum) {
      children2.push(eqnNum);
    }
    var htmlNode = makeSpan$1(["katex-html"], children2);
    htmlNode.setAttribute("aria-hidden", "true");
    if (tagChild) {
      var strut = tagChild.children[0];
      strut.style.height = makeEm(htmlNode.height + htmlNode.depth);
      if (htmlNode.depth) {
        strut.style.verticalAlign = makeEm(-htmlNode.depth);
      }
    }
    return htmlNode;
  }
  function newDocumentFragment(children2) {
    return new DocumentFragment(children2);
  }
  function isNumberPunctuation(group2) {
    if (!group2) {
      return false;
    }
    if (group2.type === "mi" && group2.children.length === 1) {
      var child = group2.children[0];
      return child instanceof TextNode && child.text === ".";
    } else if (group2.type === "mo" && group2.children.length === 1 && group2.getAttribute("separator") === "true" && group2.getAttribute("lspace") === "0em" && group2.getAttribute("rspace") === "0em") {
      var _child = group2.children[0];
      return _child instanceof TextNode && _child.text === ",";
    } else {
      return false;
    }
  }
  function buildMathML(tree, texExpression, options2, isDisplayMode, forMathmlOnly) {
    var expression = buildExpression2(tree, options2);
    var wrapper;
    if (expression.length === 1 && expression[0] instanceof MathNode && ["mrow", "mtable"].includes(expression[0].type)) {
      wrapper = expression[0];
    } else {
      wrapper = new mathMLTree.MathNode("mrow", expression);
    }
    var annotation = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(texExpression)]);
    annotation.setAttribute("encoding", "application/x-tex");
    var semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]);
    var math2 = new mathMLTree.MathNode("math", [semantics]);
    math2.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
    if (isDisplayMode) {
      math2.setAttribute("display", "block");
    }
    var wrapperClass = forMathmlOnly ? "katex" : "katex-mathml";
    return buildCommon.makeSpan([wrapperClass], [math2]);
  }
  function assertNodeType(node2, type3) {
    if (!node2 || node2.type !== type3) {
      throw new Error("Expected node of type " + type3 + ", but got " + (node2 ? "node of type " + node2.type : String(node2)));
    }
    return node2;
  }
  function assertSymbolNodeType(node2) {
    var typedNode = checkSymbolNodeType(node2);
    if (!typedNode) {
      throw new Error("Expected node of symbol group type, but got " + (node2 ? "node of type " + node2.type : String(node2)));
    }
    return typedNode;
  }
  function checkSymbolNodeType(node2) {
    if (node2 && (node2.type === "atom" || NON_ATOMS.hasOwnProperty(node2.type))) {
      return node2;
    }
    return null;
  }
  function htmlBuilder$9(group2, options2) {
    var elements2 = buildExpression$1(group2.body, options2, true);
    return makeSpan2([group2.mclass], elements2, options2);
  }
  function mathmlBuilder$8(group2, options2) {
    var node2;
    var inner2 = buildExpression2(group2.body, options2);
    if (group2.mclass === "minner") {
      node2 = new mathMLTree.MathNode("mpadded", inner2);
    } else if (group2.mclass === "mord") {
      if (group2.isCharacterBox) {
        node2 = inner2[0];
        node2.type = "mi";
      } else {
        node2 = new mathMLTree.MathNode("mi", inner2);
      }
    } else {
      if (group2.isCharacterBox) {
        node2 = inner2[0];
        node2.type = "mo";
      } else {
        node2 = new mathMLTree.MathNode("mo", inner2);
      }
      if (group2.mclass === "mbin") {
        node2.attributes.lspace = "0.22em";
        node2.attributes.rspace = "0.22em";
      } else if (group2.mclass === "mpunct") {
        node2.attributes.lspace = "0em";
        node2.attributes.rspace = "0.17em";
      } else if (group2.mclass === "mopen" || group2.mclass === "mclose") {
        node2.attributes.lspace = "0em";
        node2.attributes.rspace = "0em";
      } else if (group2.mclass === "minner") {
        node2.attributes.lspace = "0.0556em";
        node2.attributes.width = "+0.1111em";
      }
    }
    return node2;
  }
  function cdArrow(arrowChar, labels, parser28) {
    var funcName = cdArrowFunctionName[arrowChar];
    switch (funcName) {
      case "\\\\cdrightarrow":
      case "\\\\cdleftarrow":
        return parser28.callFunction(funcName, [labels[0]], [labels[1]]);
      case "\\uparrow":
      case "\\downarrow": {
        var leftLabel = parser28.callFunction("\\\\cdleft", [labels[0]], []);
        var bareArrow = {
          type: "atom",
          text: funcName,
          mode: "math",
          family: "rel"
        };
        var sizedArrow = parser28.callFunction("\\Big", [bareArrow], []);
        var rightLabel = parser28.callFunction("\\\\cdright", [labels[1]], []);
        var arrowGroup = {
          type: "ordgroup",
          mode: "math",
          body: [leftLabel, sizedArrow, rightLabel]
        };
        return parser28.callFunction("\\\\cdparent", [arrowGroup], []);
      }
      case "\\\\cdlongequal":
        return parser28.callFunction("\\\\cdlongequal", [], []);
      case "\\Vert": {
        var arrow = {
          type: "textord",
          text: "\\Vert",
          mode: "math"
        };
        return parser28.callFunction("\\Big", [arrow], []);
      }
      default:
        return {
          type: "textord",
          text: " ",
          mode: "math"
        };
    }
  }
  function parseCD(parser28) {
    var parsedRows = [];
    parser28.gullet.beginGroup();
    parser28.gullet.macros.set("\\cr", "\\\\\\relax");
    parser28.gullet.beginGroup();
    while (true) {
      parsedRows.push(parser28.parseExpression(false, "\\\\"));
      parser28.gullet.endGroup();
      parser28.gullet.beginGroup();
      var next3 = parser28.fetch().text;
      if (next3 === "&" || next3 === "\\\\") {
        parser28.consume();
      } else if (next3 === "\\end") {
        if (parsedRows[parsedRows.length - 1].length === 0) {
          parsedRows.pop();
        }
        break;
      } else {
        throw new ParseError("Expected \\\\ or \\cr or \\end", parser28.nextToken);
      }
    }
    var row = [];
    var body = [row];
    for (var i2 = 0; i2 < parsedRows.length; i2++) {
      var rowNodes = parsedRows[i2];
      var cell = newCell();
      for (var j3 = 0; j3 < rowNodes.length; j3++) {
        if (!isStartOfArrow(rowNodes[j3])) {
          cell.body.push(rowNodes[j3]);
        } else {
          row.push(cell);
          j3 += 1;
          var arrowChar = assertSymbolNodeType(rowNodes[j3]).text;
          var labels = new Array(2);
          labels[0] = {
            type: "ordgroup",
            mode: "math",
            body: []
          };
          labels[1] = {
            type: "ordgroup",
            mode: "math",
            body: []
          };
          if ("=|.".indexOf(arrowChar) > -1) ;
          else if ("<>AV".indexOf(arrowChar) > -1) {
            for (var labelNum = 0; labelNum < 2; labelNum++) {
              var inLabel = true;
              for (var k2 = j3 + 1; k2 < rowNodes.length; k2++) {
                if (isLabelEnd(rowNodes[k2], arrowChar)) {
                  inLabel = false;
                  j3 = k2;
                  break;
                }
                if (isStartOfArrow(rowNodes[k2])) {
                  throw new ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[k2]);
                }
                labels[labelNum].body.push(rowNodes[k2]);
              }
              if (inLabel) {
                throw new ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[j3]);
              }
            }
          } else {
            throw new ParseError('Expected one of "<>AV=|." after @', rowNodes[j3]);
          }
          var arrow = cdArrow(arrowChar, labels, parser28);
          var wrappedArrow = {
            type: "styling",
            body: [arrow],
            mode: "math",
            style: "display"
            // CD is always displaystyle.
          };
          row.push(wrappedArrow);
          cell = newCell();
        }
      }
      if (i2 % 2 === 0) {
        row.push(cell);
      } else {
        row.shift();
      }
      row = [];
      body.push(row);
    }
    parser28.gullet.endGroup();
    parser28.gullet.endGroup();
    var cols = new Array(body[0].length).fill({
      type: "align",
      align: "c",
      pregap: 0.25,
      // CD package sets \enskip between columns.
      postgap: 0.25
      // So pre and post each get half an \enskip, i.e. 0.25em.
    });
    return {
      type: "array",
      mode: "math",
      body,
      arraystretch: 1,
      addJot: true,
      rowGaps: [null],
      cols,
      colSeparationType: "CD",
      hLinesBeforeRow: new Array(body.length + 1).fill([])
    };
  }
  function checkDelimiter(delim, context) {
    var symDelim = checkSymbolNodeType(delim);
    if (symDelim && delimiters.includes(symDelim.text)) {
      return symDelim;
    } else if (symDelim) {
      throw new ParseError("Invalid delimiter '" + symDelim.text + "' after '" + context.funcName + "'", delim);
    } else {
      throw new ParseError("Invalid delimiter type '" + delim.type + "'", delim);
    }
  }
  function assertParsed(group2) {
    if (!group2.body) {
      throw new Error("Bug: The leftright ParseNode wasn't fully parsed.");
    }
  }
  function defineEnvironment(_ref) {
    var {
      type: type3,
      names,
      props,
      handler,
      htmlBuilder: htmlBuilder3,
      mathmlBuilder: mathmlBuilder3
    } = _ref;
    var data5 = {
      type: type3,
      numArgs: props.numArgs || 0,
      allowedInText: false,
      numOptionalArgs: 0,
      handler
    };
    for (var i2 = 0; i2 < names.length; ++i2) {
      _environments[names[i2]] = data5;
    }
    if (htmlBuilder3) {
      _htmlGroupBuilders[type3] = htmlBuilder3;
    }
    if (mathmlBuilder3) {
      _mathmlGroupBuilders[type3] = mathmlBuilder3;
    }
  }
  function defineMacro(name, body) {
    _macros[name] = body;
  }
  function getHLines(parser28) {
    var hlineInfo = [];
    parser28.consumeSpaces();
    var nxt = parser28.fetch().text;
    if (nxt === "\\relax") {
      parser28.consume();
      parser28.consumeSpaces();
      nxt = parser28.fetch().text;
    }
    while (nxt === "\\hline" || nxt === "\\hdashline") {
      parser28.consume();
      hlineInfo.push(nxt === "\\hdashline");
      parser28.consumeSpaces();
      nxt = parser28.fetch().text;
    }
    return hlineInfo;
  }
  function getAutoTag(name) {
    if (name.indexOf("ed") === -1) {
      return name.indexOf("*") === -1;
    }
  }
  function parseArray(parser28, _ref, style3) {
    var {
      hskipBeforeAndAfter,
      addJot,
      cols,
      arraystretch,
      colSeparationType,
      autoTag,
      singleRow,
      emptySingleRow,
      maxNumCols,
      leqno
    } = _ref;
    parser28.gullet.beginGroup();
    if (!singleRow) {
      parser28.gullet.macros.set("\\cr", "\\\\\\relax");
    }
    if (!arraystretch) {
      var stretch = parser28.gullet.expandMacroAsText("\\arraystretch");
      if (stretch == null) {
        arraystretch = 1;
      } else {
        arraystretch = parseFloat(stretch);
        if (!arraystretch || arraystretch < 0) {
          throw new ParseError("Invalid \\arraystretch: " + stretch);
        }
      }
    }
    parser28.gullet.beginGroup();
    var row = [];
    var body = [row];
    var rowGaps = [];
    var hLinesBeforeRow = [];
    var tags2 = autoTag != null ? [] : void 0;
    function beginRow() {
      if (autoTag) {
        parser28.gullet.macros.set("\\@eqnsw", "1", true);
      }
    }
    __name(beginRow, "beginRow");
    function endRow() {
      if (tags2) {
        if (parser28.gullet.macros.get("\\df@tag")) {
          tags2.push(parser28.subparse([new Token("\\df@tag")]));
          parser28.gullet.macros.set("\\df@tag", void 0, true);
        } else {
          tags2.push(Boolean(autoTag) && parser28.gullet.macros.get("\\@eqnsw") === "1");
        }
      }
    }
    __name(endRow, "endRow");
    beginRow();
    hLinesBeforeRow.push(getHLines(parser28));
    while (true) {
      var cell = parser28.parseExpression(false, singleRow ? "\\end" : "\\\\");
      parser28.gullet.endGroup();
      parser28.gullet.beginGroup();
      cell = {
        type: "ordgroup",
        mode: parser28.mode,
        body: cell
      };
      if (style3) {
        cell = {
          type: "styling",
          mode: parser28.mode,
          style: style3,
          body: [cell]
        };
      }
      row.push(cell);
      var next3 = parser28.fetch().text;
      if (next3 === "&") {
        if (maxNumCols && row.length === maxNumCols) {
          if (singleRow || colSeparationType) {
            throw new ParseError("Too many tab characters: &", parser28.nextToken);
          } else {
            parser28.settings.reportNonstrict("textEnv", "Too few columns specified in the {array} column argument.");
          }
        }
        parser28.consume();
      } else if (next3 === "\\end") {
        endRow();
        if (row.length === 1 && cell.type === "styling" && cell.body[0].body.length === 0 && (body.length > 1 || !emptySingleRow)) {
          body.pop();
        }
        if (hLinesBeforeRow.length < body.length + 1) {
          hLinesBeforeRow.push([]);
        }
        break;
      } else if (next3 === "\\\\") {
        parser28.consume();
        var size4 = void 0;
        if (parser28.gullet.future().text !== " ") {
          size4 = parser28.parseSizeGroup(true);
        }
        rowGaps.push(size4 ? size4.value : null);
        endRow();
        hLinesBeforeRow.push(getHLines(parser28));
        row = [];
        body.push(row);
        beginRow();
      } else {
        throw new ParseError("Expected & or \\\\ or \\cr or \\end", parser28.nextToken);
      }
    }
    parser28.gullet.endGroup();
    parser28.gullet.endGroup();
    return {
      type: "array",
      mode: parser28.mode,
      addJot,
      arraystretch,
      body,
      cols,
      rowGaps,
      hskipBeforeAndAfter,
      hLinesBeforeRow,
      colSeparationType,
      tags: tags2,
      leqno
    };
  }
  function dCellStyle(envName) {
    if (envName.slice(0, 1) === "d") {
      return "display";
    } else {
      return "text";
    }
  }
  function sizingGroup(value2, options2, baseOptions) {
    var inner2 = buildExpression$1(value2, options2, false);
    var multiplier = options2.sizeMultiplier / baseOptions.sizeMultiplier;
    for (var i2 = 0; i2 < inner2.length; i2++) {
      var pos = inner2[i2].classes.indexOf("sizing");
      if (pos < 0) {
        Array.prototype.push.apply(inner2[i2].classes, options2.sizingClasses(baseOptions));
      } else if (inner2[i2].classes[pos + 1] === "reset-size" + options2.size) {
        inner2[i2].classes[pos + 1] = "reset-size" + baseOptions.size;
      }
      inner2[i2].height *= multiplier;
      inner2[i2].depth *= multiplier;
    }
    return buildCommon.makeFragment(inner2);
  }
  var SourceLocation, Token, ParseError, deflt, uppercase, hyphenate, ESCAPE_LOOKUP, ESCAPE_REGEX, getBaseElem, isCharacterBox, assert, protocolFromUrl, utils, SETTINGS_SCHEMA, Settings, Style, D, Dc, T, Tc, S, Sc, SS, SSc, styles, sup, sub, fracNum, fracDen, cramp, text$1, Style$1, scriptData, allBlocks, hLinePad, sqrtMain, sqrtSize1, sqrtSize2, sqrtSize3, sqrtSize4, phasePath, sqrtTall, sqrtPath, innerPath, path, tallDelim, DocumentFragment, fontMetricsData, sigmasAndXis, extraCharacterMap, fontMetricsBySizeIndex, sizeStyleMap, sizeMultipliers, sizeAtStyle, Options, ptPerUnit, relativeUnit, validUnit, calculateSize2, makeEm, createClass, initNode, toNode, invalidAttributeNameRegex, toMarkup, Span, Anchor, Img, iCombinations, SymbolNode, SvgNode, PathNode, LineNode, ATOMS, NON_ATOMS, symbols, math, text2, main, ams, accent, bin, close, inner, mathord, op, open, punct, rel, spacing, textord, ligatures, mathTextSymbols, ch, i2, textSymbols, _ch, _i, letters, _ch2, _i2, wideChar, _ch3, _i3, _ch4, _i4, extraLatin, _ch5, _i5, wideLatinLetterData, wideNumeralData, wideCharacterFont, lookupSymbol, makeSymbol, mathsym, boldsymbol, makeOrd, canCombine, tryCombineChars, sizeElementFromChildren, makeSpan$2, makeSvgSpan, makeLineSpan, makeAnchor, makeFragment, wrapFragment, getVListChildrenAndDepth, makeVList, makeGlue, retrieveTextFontName, fontMap, svgData, staticSvg, buildCommon, thinspace, mediumspace, thickspace, spacings, tightSpacings, _functions, _htmlGroupBuilders, _mathmlGroupBuilders, normalizeArgument, ordargument, makeSpan$1, binLeftCanceller, binRightCanceller, styleMap$1, DomEnum, buildExpression$1, traverseNonSpaceNodes, checkPartialGroup, getOutermostNode, getTypeOfDomTree, makeNullDelimiter, buildGroup$1, MathNode, TextNode, SpaceNode, mathMLTree, makeText, makeRow, getVariant, buildExpression2, buildExpressionRow, buildGroup2, optionsFromSettings, displayWrap, buildTree, buildHTMLTree, stretchyCodePoint, mathMLnode, katexImagesData, groupLength, svgSpan, encloseSpan, stretchy, htmlBuilder$a, mathmlBuilder$9, NON_STRETCHY_ACCENT_REGEX, paddedNode, makeSpan2, binrelClass, cdArrowFunctionName, newCell, isStartOfArrow, isLabelEnd, htmlBuilder$8, mathmlBuilder$7, globalMap, checkControlSequence, getRHS, letCommand, getMetrics, styleWrap, centerSpan, makeSmallDelim, mathrmSize, makeLargeDelim, makeGlyphSpan, makeInner, lapInEms, lap, verts, doubleVerts, makeStackedDelim, vbPad, emPad, sqrtSvg, makeSqrtImage, stackLargeDelimiters, stackAlwaysDelimiters, stackNeverDelimiters, sizeToMaxHeight, makeSizedDelim, stackNeverDelimiterSequence, stackAlwaysDelimiterSequence, stackLargeDelimiterSequence, delimTypeToFont, traverseSequence, makeCustomSizedDelim, makeLeftRightDelim, delimiter, delimiterSizes, delimiters, htmlBuilder$7, mathmlBuilder$6, _environments, _macros, validateAmsEnvironmentContext, htmlBuilder$6, alignMap, mathmlBuilder$5, alignedHandler, environments, htmlBuilder$5, mathmlBuilder$4, fontAliases, adjustStyle, htmlBuilder$4, mathmlBuilder$3, stylArray, delimFromValue, htmlBuilder$3, mathmlBuilder$2, sizeData, chooseMathStyle, assembleSupSub, noSuccessor, htmlBuilder$2, mathmlBuilder$1, singleCharBigOps, singleCharIntegrals, htmlBuilder$1, mathmlBuilder2, sizeFuncs, htmlBuilder2, styleMap, htmlBuilderDelegate, defaultVariant, cssSpace, regularSpace, pad, textFontFamilies, textFontWeights, textFontShapes, optionsWithFont, makeVerb, functions, spaceRegexString, controlWordRegexString, controlSymbolRegexString, controlWordWhitespaceRegexString, controlSpaceRegexString, combiningDiacriticalMarkString, combiningDiacriticalMarksEndRegex, tokenRegexString, Lexer, Namespace, macros, digitToNumber, newcommand, dotsByToken, spaceAfterDots, latexRaiseA, braketHelper, implicitCommands, MacroExpander, unicodeSubRegEx, uSubsAndSups, unicodeAccents, unicodeSymbols, Parser, parseTree, render, renderToString, generateParseTree, renderError, renderToDomTree, renderToHTMLTree, version, __domTree, katex;
  var init_katex = __esm({
    "../../node_modules/.pnpm/katex@0.16.25/node_modules/katex/dist/katex.mjs"() {
      "use strict";
      SourceLocation = class _SourceLocation {
        static {
          __name(this, "SourceLocation");
        }
        // The + prefix indicates that these fields aren't writeable
        // Lexer holding the input string.
        // Start offset, zero-based inclusive.
        // End offset, zero-based exclusive.
        constructor(lexer, start3, end2) {
          this.lexer = void 0;
          this.start = void 0;
          this.end = void 0;
          this.lexer = lexer;
          this.start = start3;
          this.end = end2;
        }
        /**
         * Merges two `SourceLocation`s from location providers, given they are
         * provided in order of appearance.
         * - Returns the first one's location if only the first is provided.
         * - Returns a merged range of the first and the last if both are provided
         *   and their lexers match.
         * - Otherwise, returns null.
         */
        static range(first3, second2) {
          if (!second2) {
            return first3 && first3.loc;
          } else if (!first3 || !first3.loc || !second2.loc || first3.loc.lexer !== second2.loc.lexer) {
            return null;
          } else {
            return new _SourceLocation(first3.loc.lexer, first3.loc.start, second2.loc.end);
          }
        }
      };
      Token = class _Token {
        static {
          __name(this, "Token");
        }
        // don't expand the token
        // used in \noexpand
        constructor(text4, loc) {
          this.text = void 0;
          this.loc = void 0;
          this.noexpand = void 0;
          this.treatAsRelax = void 0;
          this.text = text4;
          this.loc = loc;
        }
        /**
         * Given a pair of tokens (this and endToken), compute a `Token` encompassing
         * the whole input range enclosed by these two.
         */
        range(endToken, text4) {
          return new _Token(text4, SourceLocation.range(this, endToken));
        }
      };
      ParseError = class _ParseError {
        static {
          __name(this, "ParseError");
        }
        // Error start position based on passed-in Token or ParseNode.
        // Length of affected text based on passed-in Token or ParseNode.
        // The underlying error message without any context added.
        constructor(message, token2) {
          this.name = void 0;
          this.position = void 0;
          this.length = void 0;
          this.rawMessage = void 0;
          var error3 = "KaTeX parse error: " + message;
          var start3;
          var end2;
          var loc = token2 && token2.loc;
          if (loc && loc.start <= loc.end) {
            var input = loc.lexer.input;
            start3 = loc.start;
            end2 = loc.end;
            if (start3 === input.length) {
              error3 += " at end of input: ";
            } else {
              error3 += " at position " + (start3 + 1) + ": ";
            }
            var underlined = input.slice(start3, end2).replace(/[^]/g, "$&\u0332");
            var left3;
            if (start3 > 15) {
              left3 = "\u2026" + input.slice(start3 - 15, start3);
            } else {
              left3 = input.slice(0, start3);
            }
            var right3;
            if (end2 + 15 < input.length) {
              right3 = input.slice(end2, end2 + 15) + "\u2026";
            } else {
              right3 = input.slice(end2);
            }
            error3 += left3 + underlined + right3;
          }
          var self2 = new Error(error3);
          self2.name = "ParseError";
          self2.__proto__ = _ParseError.prototype;
          self2.position = start3;
          if (start3 != null && end2 != null) {
            self2.length = end2 - start3;
          }
          self2.rawMessage = message;
          return self2;
        }
      };
      ParseError.prototype.__proto__ = Error.prototype;
      deflt = /* @__PURE__ */ __name(function deflt2(setting, defaultIfUndefined) {
        return setting === void 0 ? defaultIfUndefined : setting;
      }, "deflt");
      uppercase = /([A-Z])/g;
      hyphenate = /* @__PURE__ */ __name(function hyphenate2(str2) {
        return str2.replace(uppercase, "-$1").toLowerCase();
      }, "hyphenate");
      ESCAPE_LOOKUP = {
        "&": "&amp;",
        ">": "&gt;",
        "<": "&lt;",
        '"': "&quot;",
        "'": "&#x27;"
      };
      ESCAPE_REGEX = /[&><"']/g;
      __name(escape2, "escape");
      getBaseElem = /* @__PURE__ */ __name(function getBaseElem2(group2) {
        if (group2.type === "ordgroup") {
          if (group2.body.length === 1) {
            return getBaseElem2(group2.body[0]);
          } else {
            return group2;
          }
        } else if (group2.type === "color") {
          if (group2.body.length === 1) {
            return getBaseElem2(group2.body[0]);
          } else {
            return group2;
          }
        } else if (group2.type === "font") {
          return getBaseElem2(group2.body);
        } else {
          return group2;
        }
      }, "getBaseElem");
      isCharacterBox = /* @__PURE__ */ __name(function isCharacterBox2(group2) {
        var baseElem = getBaseElem(group2);
        return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom";
      }, "isCharacterBox");
      assert = /* @__PURE__ */ __name(function assert2(value2) {
        if (!value2) {
          throw new Error("Expected non-null, but got " + String(value2));
        }
        return value2;
      }, "assert");
      protocolFromUrl = /* @__PURE__ */ __name(function protocolFromUrl2(url) {
        var protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(url);
        if (!protocol) {
          return "_relative";
        }
        if (protocol[2] !== ":") {
          return null;
        }
        if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) {
          return null;
        }
        return protocol[1].toLowerCase();
      }, "protocolFromUrl");
      utils = {
        deflt,
        escape: escape2,
        hyphenate,
        getBaseElem,
        isCharacterBox,
        protocolFromUrl
      };
      SETTINGS_SCHEMA = {
        displayMode: {
          type: "boolean",
          description: "Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",
          cli: "-d, --display-mode"
        },
        output: {
          type: {
            enum: ["htmlAndMathml", "html", "mathml"]
          },
          description: "Determines the markup language of the output.",
          cli: "-F, --format <type>"
        },
        leqno: {
          type: "boolean",
          description: "Render display math in leqno style (left-justified tags)."
        },
        fleqn: {
          type: "boolean",
          description: "Render display math flush left."
        },
        throwOnError: {
          type: "boolean",
          default: true,
          cli: "-t, --no-throw-on-error",
          cliDescription: "Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."
        },
        errorColor: {
          type: "string",
          default: "#cc0000",
          cli: "-c, --error-color <color>",
          cliDescription: "A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",
          cliProcessor: /* @__PURE__ */ __name((color2) => "#" + color2, "cliProcessor")
        },
        macros: {
          type: "object",
          cli: "-m, --macro <def>",
          cliDescription: "Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",
          cliDefault: [],
          cliProcessor: /* @__PURE__ */ __name((def, defs2) => {
            defs2.push(def);
            return defs2;
          }, "cliProcessor")
        },
        minRuleThickness: {
          type: "number",
          description: "Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",
          processor: /* @__PURE__ */ __name((t4) => Math.max(0, t4), "processor"),
          cli: "--min-rule-thickness <size>",
          cliProcessor: parseFloat
        },
        colorIsTextColor: {
          type: "boolean",
          description: "Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",
          cli: "-b, --color-is-text-color"
        },
        strict: {
          type: [{
            enum: ["warn", "ignore", "error"]
          }, "boolean", "function"],
          description: "Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",
          cli: "-S, --strict",
          cliDefault: false
        },
        trust: {
          type: ["boolean", "function"],
          description: "Trust the input, enabling all HTML features such as \\url.",
          cli: "-T, --trust"
        },
        maxSize: {
          type: "number",
          default: Infinity,
          description: "If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",
          processor: /* @__PURE__ */ __name((s2) => Math.max(0, s2), "processor"),
          cli: "-s, --max-size <n>",
          cliProcessor: parseInt
        },
        maxExpand: {
          type: "number",
          default: 1e3,
          description: "Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",
          processor: /* @__PURE__ */ __name((n2) => Math.max(0, n2), "processor"),
          cli: "-e, --max-expand <n>",
          cliProcessor: /* @__PURE__ */ __name((n2) => n2 === "Infinity" ? Infinity : parseInt(n2), "cliProcessor")
        },
        globalGroup: {
          type: "boolean",
          cli: false
        }
      };
      __name(getDefaultValue, "getDefaultValue");
      Settings = class {
        static {
          __name(this, "Settings");
        }
        constructor(options2) {
          this.displayMode = void 0;
          this.output = void 0;
          this.leqno = void 0;
          this.fleqn = void 0;
          this.throwOnError = void 0;
          this.errorColor = void 0;
          this.macros = void 0;
          this.minRuleThickness = void 0;
          this.colorIsTextColor = void 0;
          this.strict = void 0;
          this.trust = void 0;
          this.maxSize = void 0;
          this.maxExpand = void 0;
          this.globalGroup = void 0;
          options2 = options2 || {};
          for (var prop in SETTINGS_SCHEMA) {
            if (SETTINGS_SCHEMA.hasOwnProperty(prop)) {
              var schema2 = SETTINGS_SCHEMA[prop];
              this[prop] = options2[prop] !== void 0 ? schema2.processor ? schema2.processor(options2[prop]) : options2[prop] : getDefaultValue(schema2);
            }
          }
        }
        /**
         * Report nonstrict (non-LaTeX-compatible) input.
         * Can safely not be called if `this.strict` is false in JavaScript.
         */
        reportNonstrict(errorCode, errorMsg, token2) {
          var strict = this.strict;
          if (typeof strict === "function") {
            strict = strict(errorCode, errorMsg, token2);
          }
          if (!strict || strict === "ignore") {
            return;
          } else if (strict === true || strict === "error") {
            throw new ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token2);
          } else if (strict === "warn") {
            typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
          } else {
            typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
          }
        }
        /**
         * Check whether to apply strict (LaTeX-adhering) behavior for unusual
         * input (like `\\`).  Unlike `nonstrict`, will not throw an error;
         * instead, "error" translates to a return value of `true`, while "ignore"
         * translates to a return value of `false`.  May still print a warning:
         * "warn" prints a warning and returns `false`.
         * This is for the second category of `errorCode`s listed in the README.
         */
        useStrictBehavior(errorCode, errorMsg, token2) {
          var strict = this.strict;
          if (typeof strict === "function") {
            try {
              strict = strict(errorCode, errorMsg, token2);
            } catch (error3) {
              strict = "error";
            }
          }
          if (!strict || strict === "ignore") {
            return false;
          } else if (strict === true || strict === "error") {
            return true;
          } else if (strict === "warn") {
            typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
            return false;
          } else {
            typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
            return false;
          }
        }
        /**
         * Check whether to test potentially dangerous input, and return
         * `true` (trusted) or `false` (untrusted).  The sole argument `context`
         * should be an object with `command` field specifying the relevant LaTeX
         * command (as a string starting with `\`), and any other arguments, etc.
         * If `context` has a `url` field, a `protocol` field will automatically
         * get added by this function (changing the specified object).
         */
        isTrusted(context) {
          if (context.url && !context.protocol) {
            var protocol = utils.protocolFromUrl(context.url);
            if (protocol == null) {
              return false;
            }
            context.protocol = protocol;
          }
          var trust = typeof this.trust === "function" ? this.trust(context) : this.trust;
          return Boolean(trust);
        }
      };
      Style = class {
        static {
          __name(this, "Style");
        }
        constructor(id34, size4, cramped) {
          this.id = void 0;
          this.size = void 0;
          this.cramped = void 0;
          this.id = id34;
          this.size = size4;
          this.cramped = cramped;
        }
        /**
         * Get the style of a superscript given a base in the current style.
         */
        sup() {
          return styles[sup[this.id]];
        }
        /**
         * Get the style of a subscript given a base in the current style.
         */
        sub() {
          return styles[sub[this.id]];
        }
        /**
         * Get the style of a fraction numerator given the fraction in the current
         * style.
         */
        fracNum() {
          return styles[fracNum[this.id]];
        }
        /**
         * Get the style of a fraction denominator given the fraction in the current
         * style.
         */
        fracDen() {
          return styles[fracDen[this.id]];
        }
        /**
         * Get the cramped version of a style (in particular, cramping a cramped style
         * doesn't change the style).
         */
        cramp() {
          return styles[cramp[this.id]];
        }
        /**
         * Get a text or display version of this style.
         */
        text() {
          return styles[text$1[this.id]];
        }
        /**
         * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)
         */
        isTight() {
          return this.size >= 2;
        }
      };
      D = 0;
      Dc = 1;
      T = 2;
      Tc = 3;
      S = 4;
      Sc = 5;
      SS = 6;
      SSc = 7;
      styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)];
      sup = [S, Sc, S, Sc, SS, SSc, SS, SSc];
      sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc];
      fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc];
      fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc];
      cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc];
      text$1 = [D, Dc, T, Tc, T, Tc, T, Tc];
      Style$1 = {
        DISPLAY: styles[D],
        TEXT: styles[T],
        SCRIPT: styles[S],
        SCRIPTSCRIPT: styles[SS]
      };
      scriptData = [{
        // Latin characters beyond the Latin-1 characters we have metrics for.
        // Needed for Czech, Hungarian and Turkish text, for example.
        name: "latin",
        blocks: [
          [256, 591],
          // Latin Extended-A and Latin Extended-B
          [768, 879]
          // Combining Diacritical marks
        ]
      }, {
        // The Cyrillic script used by Russian and related languages.
        // A Cyrillic subset used to be supported as explicitly defined
        // symbols in symbols.js
        name: "cyrillic",
        blocks: [[1024, 1279]]
      }, {
        // Armenian
        name: "armenian",
        blocks: [[1328, 1423]]
      }, {
        // The Brahmic scripts of South and Southeast Asia
        // Devanagari (0900–097F)
        // Bengali (0980–09FF)
        // Gurmukhi (0A00–0A7F)
        // Gujarati (0A80–0AFF)
        // Oriya (0B00–0B7F)
        // Tamil (0B80–0BFF)
        // Telugu (0C00–0C7F)
        // Kannada (0C80–0CFF)
        // Malayalam (0D00–0D7F)
        // Sinhala (0D80–0DFF)
        // Thai (0E00–0E7F)
        // Lao (0E80–0EFF)
        // Tibetan (0F00–0FFF)
        // Myanmar (1000–109F)
        name: "brahmic",
        blocks: [[2304, 4255]]
      }, {
        name: "georgian",
        blocks: [[4256, 4351]]
      }, {
        // Chinese and Japanese.
        // The "k" in cjk is for Korean, but we've separated Korean out
        name: "cjk",
        blocks: [
          [12288, 12543],
          // CJK symbols and punctuation, Hiragana, Katakana
          [19968, 40879],
          // CJK ideograms
          [65280, 65376]
          // Fullwidth punctuation
          // TODO: add halfwidth Katakana and Romanji glyphs
        ]
      }, {
        // Korean
        name: "hangul",
        blocks: [[44032, 55215]]
      }];
      __name(scriptFromCodepoint, "scriptFromCodepoint");
      allBlocks = [];
      scriptData.forEach((s2) => s2.blocks.forEach((b3) => allBlocks.push(...b3)));
      __name(supportedCodepoint, "supportedCodepoint");
      hLinePad = 80;
      sqrtMain = /* @__PURE__ */ __name(function sqrtMain2(extraVinculum, hLinePad2) {
        return "M95," + (622 + extraVinculum + hLinePad2) + "\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl" + extraVinculum / 2.075 + " -" + extraVinculum + "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + (40 + extraVinculum) + "H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM" + (834 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "h-400000z";
      }, "sqrtMain");
      sqrtSize1 = /* @__PURE__ */ __name(function sqrtSize12(extraVinculum, hLinePad2) {
        return "M263," + (601 + extraVinculum + hLinePad2) + "c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl" + extraVinculum / 2.084 + " -" + extraVinculum + "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + (40 + extraVinculum) + "H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM" + (1001 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "h-400000z";
      }, "sqrtSize1");
      sqrtSize2 = /* @__PURE__ */ __name(function sqrtSize22(extraVinculum, hLinePad2) {
        return "M983 " + (10 + extraVinculum + hLinePad2) + "\nl" + extraVinculum / 3.13 + " -" + extraVinculum + "\nc4,-6.7,10,-10,18,-10 H400000v" + (40 + extraVinculum) + "\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM" + (1001 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "h-400000z";
      }, "sqrtSize2");
      sqrtSize3 = /* @__PURE__ */ __name(function sqrtSize32(extraVinculum, hLinePad2) {
        return "M424," + (2398 + extraVinculum + hLinePad2) + "\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl" + extraVinculum / 4.223 + " -" + extraVinculum + "c4,-6.7,10,-10,18,-10 H400000\nv" + (40 + extraVinculum) + "H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M" + (1001 + extraVinculum) + " " + hLinePad2 + "\nh400000v" + (40 + extraVinculum) + "h-400000z";
      }, "sqrtSize3");
      sqrtSize4 = /* @__PURE__ */ __name(function sqrtSize42(extraVinculum, hLinePad2) {
        return "M473," + (2713 + extraVinculum + hLinePad2) + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + extraVinculum / 5.298 + " -" + extraVinculum + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + (40 + extraVinculum) + "H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM" + (1001 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "H1017.7z";
      }, "sqrtSize4");
      phasePath = /* @__PURE__ */ __name(function phasePath2(y6) {
        var x5 = y6 / 2;
        return "M400000 " + y6 + " H0 L" + x5 + " 0 l65 45 L145 " + (y6 - 80) + " H400000z";
      }, "phasePath");
      sqrtTall = /* @__PURE__ */ __name(function sqrtTall2(extraVinculum, hLinePad2, viewBoxHeight) {
        var vertSegment = viewBoxHeight - 54 - hLinePad2 - extraVinculum;
        return "M702 " + (extraVinculum + hLinePad2) + "H400000" + (40 + extraVinculum) + "\nH742v" + vertSegment + "l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 " + hLinePad2 + "H400000v" + (40 + extraVinculum) + "H742z";
      }, "sqrtTall");
      sqrtPath = /* @__PURE__ */ __name(function sqrtPath2(size4, extraVinculum, viewBoxHeight) {
        extraVinculum = 1e3 * extraVinculum;
        var path4 = "";
        switch (size4) {
          case "sqrtMain":
            path4 = sqrtMain(extraVinculum, hLinePad);
            break;
          case "sqrtSize1":
            path4 = sqrtSize1(extraVinculum, hLinePad);
            break;
          case "sqrtSize2":
            path4 = sqrtSize2(extraVinculum, hLinePad);
            break;
          case "sqrtSize3":
            path4 = sqrtSize3(extraVinculum, hLinePad);
            break;
          case "sqrtSize4":
            path4 = sqrtSize4(extraVinculum, hLinePad);
            break;
          case "sqrtTall":
            path4 = sqrtTall(extraVinculum, hLinePad, viewBoxHeight);
        }
        return path4;
      }, "sqrtPath");
      innerPath = /* @__PURE__ */ __name(function innerPath2(name, height2) {
        switch (name) {
          case "\u239C":
            return "M291 0 H417 V" + height2 + " H291z M291 0 H417 V" + height2 + " H291z";
          case "\u2223":
            return "M145 0 H188 V" + height2 + " H145z M145 0 H188 V" + height2 + " H145z";
          case "\u2225":
            return "M145 0 H188 V" + height2 + " H145z M145 0 H188 V" + height2 + " H145z" + ("M367 0 H410 V" + height2 + " H367z M367 0 H410 V" + height2 + " H367z");
          case "\u239F":
            return "M457 0 H583 V" + height2 + " H457z M457 0 H583 V" + height2 + " H457z";
          case "\u23A2":
            return "M319 0 H403 V" + height2 + " H319z M319 0 H403 V" + height2 + " H319z";
          case "\u23A5":
            return "M263 0 H347 V" + height2 + " H263z M263 0 H347 V" + height2 + " H263z";
          case "\u23AA":
            return "M384 0 H504 V" + height2 + " H384z M384 0 H504 V" + height2 + " H384z";
          case "\u23D0":
            return "M312 0 H355 V" + height2 + " H312z M312 0 H355 V" + height2 + " H312z";
          case "\u2016":
            return "M257 0 H300 V" + height2 + " H257z M257 0 H300 V" + height2 + " H257z" + ("M478 0 H521 V" + height2 + " H478z M478 0 H521 V" + height2 + " H478z");
          default:
            return "";
        }
      }, "innerPath");
      path = {
        // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main
        doubleleftarrow: "M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",
        // doublerightarrow is from glyph U+21D2 in font KaTeX Main
        doublerightarrow: "M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",
        // leftarrow is from glyph U+2190 in font KaTeX Main
        leftarrow: "M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",
        // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular
        leftbrace: "M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",
        leftbraceunder: "M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",
        // overgroup is from the MnSymbol package (public domain)
        leftgroup: "M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",
        leftgroupunder: "M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",
        // Harpoons are from glyph U+21BD in font KaTeX Main
        leftharpoon: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",
        leftharpoonplus: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",
        leftharpoondown: "M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",
        leftharpoondownplus: "M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",
        // hook is from glyph U+21A9 in font KaTeX Main
        lefthook: "M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",
        leftlinesegment: "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",
        leftmapsto: "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",
        // tofrom is from glyph U+21C4 in font KaTeX AMS Regular
        leftToFrom: "M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",
        longequal: "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",
        midbrace: "M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",
        midbraceunder: "M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",
        oiintSize1: "M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",
        oiintSize2: "M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",
        oiiintSize1: "M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",
        oiiintSize2: "M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",
        rightarrow: "M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",
        rightbrace: "M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",
        rightbraceunder: "M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",
        rightgroup: "M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",
        rightgroupunder: "M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",
        rightharpoon: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",
        rightharpoonplus: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",
        rightharpoondown: "M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",
        rightharpoondownplus: "M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",
        righthook: "M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",
        rightlinesegment: "M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",
        rightToFrom: "M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",
        // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular
        twoheadleftarrow: "M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",
        twoheadrightarrow: "M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",
        // tilde1 is a modified version of a glyph from the MnSymbol package
        tilde1: "M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",
        // ditto tilde2, tilde3, & tilde4
        tilde2: "M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",
        tilde3: "M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",
        tilde4: "M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",
        // vec is from glyph U+20D7 in font KaTeX Main
        vec: "M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",
        // widehat1 is a modified version of a glyph from the MnSymbol package
        widehat1: "M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",
        // ditto widehat2, widehat3, & widehat4
        widehat2: "M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",
        widehat3: "M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",
        widehat4: "M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",
        // widecheck paths are all inverted versions of widehat
        widecheck1: "M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",
        widecheck2: "M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",
        widecheck3: "M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",
        widecheck4: "M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",
        // The next ten paths support reaction arrows from the mhchem package.
        // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX
        // baraboveleftarrow is mostly from glyph U+2190 in font KaTeX Main
        baraboveleftarrow: "M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",
        // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main
        rightarrowabovebar: "M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",
        // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end.
        // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em
        baraboveshortleftharpoon: "M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",
        rightharpoonaboveshortbar: "M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",
        shortbaraboveleftharpoon: "M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",
        shortrightharpoonabovebar: "M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"
      };
      tallDelim = /* @__PURE__ */ __name(function tallDelim2(label, midHeight) {
        switch (label) {
          case "lbrack":
            return "M403 1759 V84 H666 V0 H319 V1759 v" + midHeight + " v1759 h347 v-84\nH403z M403 1759 V0 H319 V1759 v" + midHeight + " v1759 h84z";
          case "rbrack":
            return "M347 1759 V0 H0 V84 H263 V1759 v" + midHeight + " v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v" + midHeight + " v1759 h84z";
          case "vert":
            return "M145 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + midHeight + " v585 h43z";
          case "doublevert":
            return "M145 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + midHeight + " v585 h43z\nM367 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v" + midHeight + " v585 h43z";
          case "lfloor":
            return "M319 602 V0 H403 V602 v" + midHeight + " v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v" + midHeight + " v1715 H319z";
          case "rfloor":
            return "M319 602 V0 H403 V602 v" + midHeight + " v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v" + midHeight + " v1715 H319z";
          case "lceil":
            return "M403 1759 V84 H666 V0 H319 V1759 v" + midHeight + " v602 h84z\nM403 1759 V0 H319 V1759 v" + midHeight + " v602 h84z";
          case "rceil":
            return "M347 1759 V0 H0 V84 H263 V1759 v" + midHeight + " v602 h84z\nM347 1759 V0 h-84 V1759 v" + midHeight + " v602 h84z";
          case "lparen":
            return "M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0," + (midHeight + 84) + "c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-" + (midHeight + 92) + "c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z";
          case "rparen":
            return "M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0," + (midHeight + 9) + "\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-" + (midHeight + 144) + "c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z";
          default:
            throw new Error("Unknown stretchy delimiter.");
        }
      }, "tallDelim");
      DocumentFragment = class {
        static {
          __name(this, "DocumentFragment");
        }
        // Never used; needed for satisfying interface.
        constructor(children2) {
          this.children = void 0;
          this.classes = void 0;
          this.height = void 0;
          this.depth = void 0;
          this.maxFontSize = void 0;
          this.style = void 0;
          this.children = children2;
          this.classes = [];
          this.height = 0;
          this.depth = 0;
          this.maxFontSize = 0;
          this.style = {};
        }
        hasClass(className) {
          return this.classes.includes(className);
        }
        /** Convert the fragment into a node. */
        toNode() {
          var frag = document.createDocumentFragment();
          for (var i2 = 0; i2 < this.children.length; i2++) {
            frag.appendChild(this.children[i2].toNode());
          }
          return frag;
        }
        /** Convert the fragment into HTML markup. */
        toMarkup() {
          var markup = "";
          for (var i2 = 0; i2 < this.children.length; i2++) {
            markup += this.children[i2].toMarkup();
          }
          return markup;
        }
        /**
         * Converts the math node into a string, similar to innerText. Applies to
         * MathDomNode's only.
         */
        toText() {
          var toText = /* @__PURE__ */ __name((child) => child.toText(), "toText");
          return this.children.map(toText).join("");
        }
      };
      fontMetricsData = {
        "AMS-Regular": {
          "32": [0, 0, 0, 0, 0.25],
          "65": [0, 0.68889, 0, 0, 0.72222],
          "66": [0, 0.68889, 0, 0, 0.66667],
          "67": [0, 0.68889, 0, 0, 0.72222],
          "68": [0, 0.68889, 0, 0, 0.72222],
          "69": [0, 0.68889, 0, 0, 0.66667],
          "70": [0, 0.68889, 0, 0, 0.61111],
          "71": [0, 0.68889, 0, 0, 0.77778],
          "72": [0, 0.68889, 0, 0, 0.77778],
          "73": [0, 0.68889, 0, 0, 0.38889],
          "74": [0.16667, 0.68889, 0, 0, 0.5],
          "75": [0, 0.68889, 0, 0, 0.77778],
          "76": [0, 0.68889, 0, 0, 0.66667],
          "77": [0, 0.68889, 0, 0, 0.94445],
          "78": [0, 0.68889, 0, 0, 0.72222],
          "79": [0.16667, 0.68889, 0, 0, 0.77778],
          "80": [0, 0.68889, 0, 0, 0.61111],
          "81": [0.16667, 0.68889, 0, 0, 0.77778],
          "82": [0, 0.68889, 0, 0, 0.72222],
          "83": [0, 0.68889, 0, 0, 0.55556],
          "84": [0, 0.68889, 0, 0, 0.66667],
          "85": [0, 0.68889, 0, 0, 0.72222],
          "86": [0, 0.68889, 0, 0, 0.72222],
          "87": [0, 0.68889, 0, 0, 1],
          "88": [0, 0.68889, 0, 0, 0.72222],
          "89": [0, 0.68889, 0, 0, 0.72222],
          "90": [0, 0.68889, 0, 0, 0.66667],
          "107": [0, 0.68889, 0, 0, 0.55556],
          "160": [0, 0, 0, 0, 0.25],
          "165": [0, 0.675, 0.025, 0, 0.75],
          "174": [0.15559, 0.69224, 0, 0, 0.94666],
          "240": [0, 0.68889, 0, 0, 0.55556],
          "295": [0, 0.68889, 0, 0, 0.54028],
          "710": [0, 0.825, 0, 0, 2.33334],
          "732": [0, 0.9, 0, 0, 2.33334],
          "770": [0, 0.825, 0, 0, 2.33334],
          "771": [0, 0.9, 0, 0, 2.33334],
          "989": [0.08167, 0.58167, 0, 0, 0.77778],
          "1008": [0, 0.43056, 0.04028, 0, 0.66667],
          "8245": [0, 0.54986, 0, 0, 0.275],
          "8463": [0, 0.68889, 0, 0, 0.54028],
          "8487": [0, 0.68889, 0, 0, 0.72222],
          "8498": [0, 0.68889, 0, 0, 0.55556],
          "8502": [0, 0.68889, 0, 0, 0.66667],
          "8503": [0, 0.68889, 0, 0, 0.44445],
          "8504": [0, 0.68889, 0, 0, 0.66667],
          "8513": [0, 0.68889, 0, 0, 0.63889],
          "8592": [-0.03598, 0.46402, 0, 0, 0.5],
          "8594": [-0.03598, 0.46402, 0, 0, 0.5],
          "8602": [-0.13313, 0.36687, 0, 0, 1],
          "8603": [-0.13313, 0.36687, 0, 0, 1],
          "8606": [0.01354, 0.52239, 0, 0, 1],
          "8608": [0.01354, 0.52239, 0, 0, 1],
          "8610": [0.01354, 0.52239, 0, 0, 1.11111],
          "8611": [0.01354, 0.52239, 0, 0, 1.11111],
          "8619": [0, 0.54986, 0, 0, 1],
          "8620": [0, 0.54986, 0, 0, 1],
          "8621": [-0.13313, 0.37788, 0, 0, 1.38889],
          "8622": [-0.13313, 0.36687, 0, 0, 1],
          "8624": [0, 0.69224, 0, 0, 0.5],
          "8625": [0, 0.69224, 0, 0, 0.5],
          "8630": [0, 0.43056, 0, 0, 1],
          "8631": [0, 0.43056, 0, 0, 1],
          "8634": [0.08198, 0.58198, 0, 0, 0.77778],
          "8635": [0.08198, 0.58198, 0, 0, 0.77778],
          "8638": [0.19444, 0.69224, 0, 0, 0.41667],
          "8639": [0.19444, 0.69224, 0, 0, 0.41667],
          "8642": [0.19444, 0.69224, 0, 0, 0.41667],
          "8643": [0.19444, 0.69224, 0, 0, 0.41667],
          "8644": [0.1808, 0.675, 0, 0, 1],
          "8646": [0.1808, 0.675, 0, 0, 1],
          "8647": [0.1808, 0.675, 0, 0, 1],
          "8648": [0.19444, 0.69224, 0, 0, 0.83334],
          "8649": [0.1808, 0.675, 0, 0, 1],
          "8650": [0.19444, 0.69224, 0, 0, 0.83334],
          "8651": [0.01354, 0.52239, 0, 0, 1],
          "8652": [0.01354, 0.52239, 0, 0, 1],
          "8653": [-0.13313, 0.36687, 0, 0, 1],
          "8654": [-0.13313, 0.36687, 0, 0, 1],
          "8655": [-0.13313, 0.36687, 0, 0, 1],
          "8666": [0.13667, 0.63667, 0, 0, 1],
          "8667": [0.13667, 0.63667, 0, 0, 1],
          "8669": [-0.13313, 0.37788, 0, 0, 1],
          "8672": [-0.064, 0.437, 0, 0, 1.334],
          "8674": [-0.064, 0.437, 0, 0, 1.334],
          "8705": [0, 0.825, 0, 0, 0.5],
          "8708": [0, 0.68889, 0, 0, 0.55556],
          "8709": [0.08167, 0.58167, 0, 0, 0.77778],
          "8717": [0, 0.43056, 0, 0, 0.42917],
          "8722": [-0.03598, 0.46402, 0, 0, 0.5],
          "8724": [0.08198, 0.69224, 0, 0, 0.77778],
          "8726": [0.08167, 0.58167, 0, 0, 0.77778],
          "8733": [0, 0.69224, 0, 0, 0.77778],
          "8736": [0, 0.69224, 0, 0, 0.72222],
          "8737": [0, 0.69224, 0, 0, 0.72222],
          "8738": [0.03517, 0.52239, 0, 0, 0.72222],
          "8739": [0.08167, 0.58167, 0, 0, 0.22222],
          "8740": [0.25142, 0.74111, 0, 0, 0.27778],
          "8741": [0.08167, 0.58167, 0, 0, 0.38889],
          "8742": [0.25142, 0.74111, 0, 0, 0.5],
          "8756": [0, 0.69224, 0, 0, 0.66667],
          "8757": [0, 0.69224, 0, 0, 0.66667],
          "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
          "8765": [-0.13313, 0.37788, 0, 0, 0.77778],
          "8769": [-0.13313, 0.36687, 0, 0, 0.77778],
          "8770": [-0.03625, 0.46375, 0, 0, 0.77778],
          "8774": [0.30274, 0.79383, 0, 0, 0.77778],
          "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
          "8778": [0.08167, 0.58167, 0, 0, 0.77778],
          "8782": [0.06062, 0.54986, 0, 0, 0.77778],
          "8783": [0.06062, 0.54986, 0, 0, 0.77778],
          "8785": [0.08198, 0.58198, 0, 0, 0.77778],
          "8786": [0.08198, 0.58198, 0, 0, 0.77778],
          "8787": [0.08198, 0.58198, 0, 0, 0.77778],
          "8790": [0, 0.69224, 0, 0, 0.77778],
          "8791": [0.22958, 0.72958, 0, 0, 0.77778],
          "8796": [0.08198, 0.91667, 0, 0, 0.77778],
          "8806": [0.25583, 0.75583, 0, 0, 0.77778],
          "8807": [0.25583, 0.75583, 0, 0, 0.77778],
          "8808": [0.25142, 0.75726, 0, 0, 0.77778],
          "8809": [0.25142, 0.75726, 0, 0, 0.77778],
          "8812": [0.25583, 0.75583, 0, 0, 0.5],
          "8814": [0.20576, 0.70576, 0, 0, 0.77778],
          "8815": [0.20576, 0.70576, 0, 0, 0.77778],
          "8816": [0.30274, 0.79383, 0, 0, 0.77778],
          "8817": [0.30274, 0.79383, 0, 0, 0.77778],
          "8818": [0.22958, 0.72958, 0, 0, 0.77778],
          "8819": [0.22958, 0.72958, 0, 0, 0.77778],
          "8822": [0.1808, 0.675, 0, 0, 0.77778],
          "8823": [0.1808, 0.675, 0, 0, 0.77778],
          "8828": [0.13667, 0.63667, 0, 0, 0.77778],
          "8829": [0.13667, 0.63667, 0, 0, 0.77778],
          "8830": [0.22958, 0.72958, 0, 0, 0.77778],
          "8831": [0.22958, 0.72958, 0, 0, 0.77778],
          "8832": [0.20576, 0.70576, 0, 0, 0.77778],
          "8833": [0.20576, 0.70576, 0, 0, 0.77778],
          "8840": [0.30274, 0.79383, 0, 0, 0.77778],
          "8841": [0.30274, 0.79383, 0, 0, 0.77778],
          "8842": [0.13597, 0.63597, 0, 0, 0.77778],
          "8843": [0.13597, 0.63597, 0, 0, 0.77778],
          "8847": [0.03517, 0.54986, 0, 0, 0.77778],
          "8848": [0.03517, 0.54986, 0, 0, 0.77778],
          "8858": [0.08198, 0.58198, 0, 0, 0.77778],
          "8859": [0.08198, 0.58198, 0, 0, 0.77778],
          "8861": [0.08198, 0.58198, 0, 0, 0.77778],
          "8862": [0, 0.675, 0, 0, 0.77778],
          "8863": [0, 0.675, 0, 0, 0.77778],
          "8864": [0, 0.675, 0, 0, 0.77778],
          "8865": [0, 0.675, 0, 0, 0.77778],
          "8872": [0, 0.69224, 0, 0, 0.61111],
          "8873": [0, 0.69224, 0, 0, 0.72222],
          "8874": [0, 0.69224, 0, 0, 0.88889],
          "8876": [0, 0.68889, 0, 0, 0.61111],
          "8877": [0, 0.68889, 0, 0, 0.61111],
          "8878": [0, 0.68889, 0, 0, 0.72222],
          "8879": [0, 0.68889, 0, 0, 0.72222],
          "8882": [0.03517, 0.54986, 0, 0, 0.77778],
          "8883": [0.03517, 0.54986, 0, 0, 0.77778],
          "8884": [0.13667, 0.63667, 0, 0, 0.77778],
          "8885": [0.13667, 0.63667, 0, 0, 0.77778],
          "8888": [0, 0.54986, 0, 0, 1.11111],
          "8890": [0.19444, 0.43056, 0, 0, 0.55556],
          "8891": [0.19444, 0.69224, 0, 0, 0.61111],
          "8892": [0.19444, 0.69224, 0, 0, 0.61111],
          "8901": [0, 0.54986, 0, 0, 0.27778],
          "8903": [0.08167, 0.58167, 0, 0, 0.77778],
          "8905": [0.08167, 0.58167, 0, 0, 0.77778],
          "8906": [0.08167, 0.58167, 0, 0, 0.77778],
          "8907": [0, 0.69224, 0, 0, 0.77778],
          "8908": [0, 0.69224, 0, 0, 0.77778],
          "8909": [-0.03598, 0.46402, 0, 0, 0.77778],
          "8910": [0, 0.54986, 0, 0, 0.76042],
          "8911": [0, 0.54986, 0, 0, 0.76042],
          "8912": [0.03517, 0.54986, 0, 0, 0.77778],
          "8913": [0.03517, 0.54986, 0, 0, 0.77778],
          "8914": [0, 0.54986, 0, 0, 0.66667],
          "8915": [0, 0.54986, 0, 0, 0.66667],
          "8916": [0, 0.69224, 0, 0, 0.66667],
          "8918": [0.0391, 0.5391, 0, 0, 0.77778],
          "8919": [0.0391, 0.5391, 0, 0, 0.77778],
          "8920": [0.03517, 0.54986, 0, 0, 1.33334],
          "8921": [0.03517, 0.54986, 0, 0, 1.33334],
          "8922": [0.38569, 0.88569, 0, 0, 0.77778],
          "8923": [0.38569, 0.88569, 0, 0, 0.77778],
          "8926": [0.13667, 0.63667, 0, 0, 0.77778],
          "8927": [0.13667, 0.63667, 0, 0, 0.77778],
          "8928": [0.30274, 0.79383, 0, 0, 0.77778],
          "8929": [0.30274, 0.79383, 0, 0, 0.77778],
          "8934": [0.23222, 0.74111, 0, 0, 0.77778],
          "8935": [0.23222, 0.74111, 0, 0, 0.77778],
          "8936": [0.23222, 0.74111, 0, 0, 0.77778],
          "8937": [0.23222, 0.74111, 0, 0, 0.77778],
          "8938": [0.20576, 0.70576, 0, 0, 0.77778],
          "8939": [0.20576, 0.70576, 0, 0, 0.77778],
          "8940": [0.30274, 0.79383, 0, 0, 0.77778],
          "8941": [0.30274, 0.79383, 0, 0, 0.77778],
          "8994": [0.19444, 0.69224, 0, 0, 0.77778],
          "8995": [0.19444, 0.69224, 0, 0, 0.77778],
          "9416": [0.15559, 0.69224, 0, 0, 0.90222],
          "9484": [0, 0.69224, 0, 0, 0.5],
          "9488": [0, 0.69224, 0, 0, 0.5],
          "9492": [0, 0.37788, 0, 0, 0.5],
          "9496": [0, 0.37788, 0, 0, 0.5],
          "9585": [0.19444, 0.68889, 0, 0, 0.88889],
          "9586": [0.19444, 0.74111, 0, 0, 0.88889],
          "9632": [0, 0.675, 0, 0, 0.77778],
          "9633": [0, 0.675, 0, 0, 0.77778],
          "9650": [0, 0.54986, 0, 0, 0.72222],
          "9651": [0, 0.54986, 0, 0, 0.72222],
          "9654": [0.03517, 0.54986, 0, 0, 0.77778],
          "9660": [0, 0.54986, 0, 0, 0.72222],
          "9661": [0, 0.54986, 0, 0, 0.72222],
          "9664": [0.03517, 0.54986, 0, 0, 0.77778],
          "9674": [0.11111, 0.69224, 0, 0, 0.66667],
          "9733": [0.19444, 0.69224, 0, 0, 0.94445],
          "10003": [0, 0.69224, 0, 0, 0.83334],
          "10016": [0, 0.69224, 0, 0, 0.83334],
          "10731": [0.11111, 0.69224, 0, 0, 0.66667],
          "10846": [0.19444, 0.75583, 0, 0, 0.61111],
          "10877": [0.13667, 0.63667, 0, 0, 0.77778],
          "10878": [0.13667, 0.63667, 0, 0, 0.77778],
          "10885": [0.25583, 0.75583, 0, 0, 0.77778],
          "10886": [0.25583, 0.75583, 0, 0, 0.77778],
          "10887": [0.13597, 0.63597, 0, 0, 0.77778],
          "10888": [0.13597, 0.63597, 0, 0, 0.77778],
          "10889": [0.26167, 0.75726, 0, 0, 0.77778],
          "10890": [0.26167, 0.75726, 0, 0, 0.77778],
          "10891": [0.48256, 0.98256, 0, 0, 0.77778],
          "10892": [0.48256, 0.98256, 0, 0, 0.77778],
          "10901": [0.13667, 0.63667, 0, 0, 0.77778],
          "10902": [0.13667, 0.63667, 0, 0, 0.77778],
          "10933": [0.25142, 0.75726, 0, 0, 0.77778],
          "10934": [0.25142, 0.75726, 0, 0, 0.77778],
          "10935": [0.26167, 0.75726, 0, 0, 0.77778],
          "10936": [0.26167, 0.75726, 0, 0, 0.77778],
          "10937": [0.26167, 0.75726, 0, 0, 0.77778],
          "10938": [0.26167, 0.75726, 0, 0, 0.77778],
          "10949": [0.25583, 0.75583, 0, 0, 0.77778],
          "10950": [0.25583, 0.75583, 0, 0, 0.77778],
          "10955": [0.28481, 0.79383, 0, 0, 0.77778],
          "10956": [0.28481, 0.79383, 0, 0, 0.77778],
          "57350": [0.08167, 0.58167, 0, 0, 0.22222],
          "57351": [0.08167, 0.58167, 0, 0, 0.38889],
          "57352": [0.08167, 0.58167, 0, 0, 0.77778],
          "57353": [0, 0.43056, 0.04028, 0, 0.66667],
          "57356": [0.25142, 0.75726, 0, 0, 0.77778],
          "57357": [0.25142, 0.75726, 0, 0, 0.77778],
          "57358": [0.41951, 0.91951, 0, 0, 0.77778],
          "57359": [0.30274, 0.79383, 0, 0, 0.77778],
          "57360": [0.30274, 0.79383, 0, 0, 0.77778],
          "57361": [0.41951, 0.91951, 0, 0, 0.77778],
          "57366": [0.25142, 0.75726, 0, 0, 0.77778],
          "57367": [0.25142, 0.75726, 0, 0, 0.77778],
          "57368": [0.25142, 0.75726, 0, 0, 0.77778],
          "57369": [0.25142, 0.75726, 0, 0, 0.77778],
          "57370": [0.13597, 0.63597, 0, 0, 0.77778],
          "57371": [0.13597, 0.63597, 0, 0, 0.77778]
        },
        "Caligraphic-Regular": {
          "32": [0, 0, 0, 0, 0.25],
          "65": [0, 0.68333, 0, 0.19445, 0.79847],
          "66": [0, 0.68333, 0.03041, 0.13889, 0.65681],
          "67": [0, 0.68333, 0.05834, 0.13889, 0.52653],
          "68": [0, 0.68333, 0.02778, 0.08334, 0.77139],
          "69": [0, 0.68333, 0.08944, 0.11111, 0.52778],
          "70": [0, 0.68333, 0.09931, 0.11111, 0.71875],
          "71": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487],
          "72": [0, 0.68333, 965e-5, 0.11111, 0.84452],
          "73": [0, 0.68333, 0.07382, 0, 0.54452],
          "74": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778],
          "75": [0, 0.68333, 0.01445, 0.05556, 0.76195],
          "76": [0, 0.68333, 0, 0.13889, 0.68972],
          "77": [0, 0.68333, 0, 0.13889, 1.2009],
          "78": [0, 0.68333, 0.14736, 0.08334, 0.82049],
          "79": [0, 0.68333, 0.02778, 0.11111, 0.79611],
          "80": [0, 0.68333, 0.08222, 0.08334, 0.69556],
          "81": [0.09722, 0.68333, 0, 0.11111, 0.81667],
          "82": [0, 0.68333, 0, 0.08334, 0.8475],
          "83": [0, 0.68333, 0.075, 0.13889, 0.60556],
          "84": [0, 0.68333, 0.25417, 0, 0.54464],
          "85": [0, 0.68333, 0.09931, 0.08334, 0.62583],
          "86": [0, 0.68333, 0.08222, 0, 0.61278],
          "87": [0, 0.68333, 0.08222, 0.08334, 0.98778],
          "88": [0, 0.68333, 0.14643, 0.13889, 0.7133],
          "89": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834],
          "90": [0, 0.68333, 0.07944, 0.13889, 0.72473],
          "160": [0, 0, 0, 0, 0.25]
        },
        "Fraktur-Regular": {
          "32": [0, 0, 0, 0, 0.25],
          "33": [0, 0.69141, 0, 0, 0.29574],
          "34": [0, 0.69141, 0, 0, 0.21471],
          "38": [0, 0.69141, 0, 0, 0.73786],
          "39": [0, 0.69141, 0, 0, 0.21201],
          "40": [0.24982, 0.74947, 0, 0, 0.38865],
          "41": [0.24982, 0.74947, 0, 0, 0.38865],
          "42": [0, 0.62119, 0, 0, 0.27764],
          "43": [0.08319, 0.58283, 0, 0, 0.75623],
          "44": [0, 0.10803, 0, 0, 0.27764],
          "45": [0.08319, 0.58283, 0, 0, 0.75623],
          "46": [0, 0.10803, 0, 0, 0.27764],
          "47": [0.24982, 0.74947, 0, 0, 0.50181],
          "48": [0, 0.47534, 0, 0, 0.50181],
          "49": [0, 0.47534, 0, 0, 0.50181],
          "50": [0, 0.47534, 0, 0, 0.50181],
          "51": [0.18906, 0.47534, 0, 0, 0.50181],
          "52": [0.18906, 0.47534, 0, 0, 0.50181],
          "53": [0.18906, 0.47534, 0, 0, 0.50181],
          "54": [0, 0.69141, 0, 0, 0.50181],
          "55": [0.18906, 0.47534, 0, 0, 0.50181],
          "56": [0, 0.69141, 0, 0, 0.50181],
          "57": [0.18906, 0.47534, 0, 0, 0.50181],
          "58": [0, 0.47534, 0, 0, 0.21606],
          "59": [0.12604, 0.47534, 0, 0, 0.21606],
          "61": [-0.13099, 0.36866, 0, 0, 0.75623],
          "63": [0, 0.69141, 0, 0, 0.36245],
          "65": [0, 0.69141, 0, 0, 0.7176],
          "66": [0, 0.69141, 0, 0, 0.88397],
          "67": [0, 0.69141, 0, 0, 0.61254],
          "68": [0, 0.69141, 0, 0, 0.83158],
          "69": [0, 0.69141, 0, 0, 0.66278],
          "70": [0.12604, 0.69141, 0, 0, 0.61119],
          "71": [0, 0.69141, 0, 0, 0.78539],
          "72": [0.06302, 0.69141, 0, 0, 0.7203],
          "73": [0, 0.69141, 0, 0, 0.55448],
          "74": [0.12604, 0.69141, 0, 0, 0.55231],
          "75": [0, 0.69141, 0, 0, 0.66845],
          "76": [0, 0.69141, 0, 0, 0.66602],
          "77": [0, 0.69141, 0, 0, 1.04953],
          "78": [0, 0.69141, 0, 0, 0.83212],
          "79": [0, 0.69141, 0, 0, 0.82699],
          "80": [0.18906, 0.69141, 0, 0, 0.82753],
          "81": [0.03781, 0.69141, 0, 0, 0.82699],
          "82": [0, 0.69141, 0, 0, 0.82807],
          "83": [0, 0.69141, 0, 0, 0.82861],
          "84": [0, 0.69141, 0, 0, 0.66899],
          "85": [0, 0.69141, 0, 0, 0.64576],
          "86": [0, 0.69141, 0, 0, 0.83131],
          "87": [0, 0.69141, 0, 0, 1.04602],
          "88": [0, 0.69141, 0, 0, 0.71922],
          "89": [0.18906, 0.69141, 0, 0, 0.83293],
          "90": [0.12604, 0.69141, 0, 0, 0.60201],
          "91": [0.24982, 0.74947, 0, 0, 0.27764],
          "93": [0.24982, 0.74947, 0, 0, 0.27764],
          "94": [0, 0.69141, 0, 0, 0.49965],
          "97": [0, 0.47534, 0, 0, 0.50046],
          "98": [0, 0.69141, 0, 0, 0.51315],
          "99": [0, 0.47534, 0, 0, 0.38946],
          "100": [0, 0.62119, 0, 0, 0.49857],
          "101": [0, 0.47534, 0, 0, 0.40053],
          "102": [0.18906, 0.69141, 0, 0, 0.32626],
          "103": [0.18906, 0.47534, 0, 0, 0.5037],
          "104": [0.18906, 0.69141, 0, 0, 0.52126],
          "105": [0, 0.69141, 0, 0, 0.27899],
          "106": [0, 0.69141, 0, 0, 0.28088],
          "107": [0, 0.69141, 0, 0, 0.38946],
          "108": [0, 0.69141, 0, 0, 0.27953],
          "109": [0, 0.47534, 0, 0, 0.76676],
          "110": [0, 0.47534, 0, 0, 0.52666],
          "111": [0, 0.47534, 0, 0, 0.48885],
          "112": [0.18906, 0.52396, 0, 0, 0.50046],
          "113": [0.18906, 0.47534, 0, 0, 0.48912],
          "114": [0, 0.47534, 0, 0, 0.38919],
          "115": [0, 0.47534, 0, 0, 0.44266],
          "116": [0, 0.62119, 0, 0, 0.33301],
          "117": [0, 0.47534, 0, 0, 0.5172],
          "118": [0, 0.52396, 0, 0, 0.5118],
          "119": [0, 0.52396, 0, 0, 0.77351],
          "120": [0.18906, 0.47534, 0, 0, 0.38865],
          "121": [0.18906, 0.47534, 0, 0, 0.49884],
          "122": [0.18906, 0.47534, 0, 0, 0.39054],
          "160": [0, 0, 0, 0, 0.25],
          "8216": [0, 0.69141, 0, 0, 0.21471],
          "8217": [0, 0.69141, 0, 0, 0.21471],
          "58112": [0, 0.62119, 0, 0, 0.49749],
          "58113": [0, 0.62119, 0, 0, 0.4983],
          "58114": [0.18906, 0.69141, 0, 0, 0.33328],
          "58115": [0.18906, 0.69141, 0, 0, 0.32923],
          "58116": [0.18906, 0.47534, 0, 0, 0.50343],
          "58117": [0, 0.69141, 0, 0, 0.33301],
          "58118": [0, 0.62119, 0, 0, 0.33409],
          "58119": [0, 0.47534, 0, 0, 0.50073]
        },
        "Main-Bold": {
          "32": [0, 0, 0, 0, 0.25],
          "33": [0, 0.69444, 0, 0, 0.35],
          "34": [0, 0.69444, 0, 0, 0.60278],
          "35": [0.19444, 0.69444, 0, 0, 0.95833],
          "36": [0.05556, 0.75, 0, 0, 0.575],
          "37": [0.05556, 0.75, 0, 0, 0.95833],
          "38": [0, 0.69444, 0, 0, 0.89444],
          "39": [0, 0.69444, 0, 0, 0.31944],
          "40": [0.25, 0.75, 0, 0, 0.44722],
          "41": [0.25, 0.75, 0, 0, 0.44722],
          "42": [0, 0.75, 0, 0, 0.575],
          "43": [0.13333, 0.63333, 0, 0, 0.89444],
          "44": [0.19444, 0.15556, 0, 0, 0.31944],
          "45": [0, 0.44444, 0, 0, 0.38333],
          "46": [0, 0.15556, 0, 0, 0.31944],
          "47": [0.25, 0.75, 0, 0, 0.575],
          "48": [0, 0.64444, 0, 0, 0.575],
          "49": [0, 0.64444, 0, 0, 0.575],
          "50": [0, 0.64444, 0, 0, 0.575],
          "51": [0, 0.64444, 0, 0, 0.575],
          "52": [0, 0.64444, 0, 0, 0.575],
          "53": [0, 0.64444, 0, 0, 0.575],
          "54": [0, 0.64444, 0, 0, 0.575],
          "55": [0, 0.64444, 0, 0, 0.575],
          "56": [0, 0.64444, 0, 0, 0.575],
          "57": [0, 0.64444, 0, 0, 0.575],
          "58": [0, 0.44444, 0, 0, 0.31944],
          "59": [0.19444, 0.44444, 0, 0, 0.31944],
          "60": [0.08556, 0.58556, 0, 0, 0.89444],
          "61": [-0.10889, 0.39111, 0, 0, 0.89444],
          "62": [0.08556, 0.58556, 0, 0, 0.89444],
          "63": [0, 0.69444, 0, 0, 0.54305],
          "64": [0, 0.69444, 0, 0, 0.89444],
          "65": [0, 0.68611, 0, 0, 0.86944],
          "66": [0, 0.68611, 0, 0, 0.81805],
          "67": [0, 0.68611, 0, 0, 0.83055],
          "68": [0, 0.68611, 0, 0, 0.88194],
          "69": [0, 0.68611, 0, 0, 0.75555],
          "70": [0, 0.68611, 0, 0, 0.72361],
          "71": [0, 0.68611, 0, 0, 0.90416],
          "72": [0, 0.68611, 0, 0, 0.9],
          "73": [0, 0.68611, 0, 0, 0.43611],
          "74": [0, 0.68611, 0, 0, 0.59444],
          "75": [0, 0.68611, 0, 0, 0.90138],
          "76": [0, 0.68611, 0, 0, 0.69166],
          "77": [0, 0.68611, 0, 0, 1.09166],
          "78": [0, 0.68611, 0, 0, 0.9],
          "79": [0, 0.68611, 0, 0, 0.86388],
          "80": [0, 0.68611, 0, 0, 0.78611],
          "81": [0.19444, 0.68611, 0, 0, 0.86388],
          "82": [0, 0.68611, 0, 0, 0.8625],
          "83": [0, 0.68611, 0, 0, 0.63889],
          "84": [0, 0.68611, 0, 0, 0.8],
          "85": [0, 0.68611, 0, 0, 0.88472],
          "86": [0, 0.68611, 0.01597, 0, 0.86944],
          "87": [0, 0.68611, 0.01597, 0, 1.18888],
          "88": [0, 0.68611, 0, 0, 0.86944],
          "89": [0, 0.68611, 0.02875, 0, 0.86944],
          "90": [0, 0.68611, 0, 0, 0.70277],
          "91": [0.25, 0.75, 0, 0, 0.31944],
          "92": [0.25, 0.75, 0, 0, 0.575],
          "93": [0.25, 0.75, 0, 0, 0.31944],
          "94": [0, 0.69444, 0, 0, 0.575],
          "95": [0.31, 0.13444, 0.03194, 0, 0.575],
          "97": [0, 0.44444, 0, 0, 0.55902],
          "98": [0, 0.69444, 0, 0, 0.63889],
          "99": [0, 0.44444, 0, 0, 0.51111],
          "100": [0, 0.69444, 0, 0, 0.63889],
          "101": [0, 0.44444, 0, 0, 0.52708],
          "102": [0, 0.69444, 0.10903, 0, 0.35139],
          "103": [0.19444, 0.44444, 0.01597, 0, 0.575],
          "104": [0, 0.69444, 0, 0, 0.63889],
          "105": [0, 0.69444, 0, 0, 0.31944],
          "106": [0.19444, 0.69444, 0, 0, 0.35139],
          "107": [0, 0.69444, 0, 0, 0.60694],
          "108": [0, 0.69444, 0, 0, 0.31944],
          "109": [0, 0.44444, 0, 0, 0.95833],
          "110": [0, 0.44444, 0, 0, 0.63889],
          "111": [0, 0.44444, 0, 0, 0.575],
          "112": [0.19444, 0.44444, 0, 0, 0.63889],
          "113": [0.19444, 0.44444, 0, 0, 0.60694],
          "114": [0, 0.44444, 0, 0, 0.47361],
          "115": [0, 0.44444, 0, 0, 0.45361],
          "116": [0, 0.63492, 0, 0, 0.44722],
          "117": [0, 0.44444, 0, 0, 0.63889],
          "118": [0, 0.44444, 0.01597, 0, 0.60694],
          "119": [0, 0.44444, 0.01597, 0, 0.83055],
          "120": [0, 0.44444, 0, 0, 0.60694],
          "121": [0.19444, 0.44444, 0.01597, 0, 0.60694],
          "122": [0, 0.44444, 0, 0, 0.51111],
          "123": [0.25, 0.75, 0, 0, 0.575],
          "124": [0.25, 0.75, 0, 0, 0.31944],
          "125": [0.25, 0.75, 0, 0, 0.575],
          "126": [0.35, 0.34444, 0, 0, 0.575],
          "160": [0, 0, 0, 0, 0.25],
          "163": [0, 0.69444, 0, 0, 0.86853],
          "168": [0, 0.69444, 0, 0, 0.575],
          "172": [0, 0.44444, 0, 0, 0.76666],
          "176": [0, 0.69444, 0, 0, 0.86944],
          "177": [0.13333, 0.63333, 0, 0, 0.89444],
          "184": [0.17014, 0, 0, 0, 0.51111],
          "198": [0, 0.68611, 0, 0, 1.04166],
          "215": [0.13333, 0.63333, 0, 0, 0.89444],
          "216": [0.04861, 0.73472, 0, 0, 0.89444],
          "223": [0, 0.69444, 0, 0, 0.59722],
          "230": [0, 0.44444, 0, 0, 0.83055],
          "247": [0.13333, 0.63333, 0, 0, 0.89444],
          "248": [0.09722, 0.54167, 0, 0, 0.575],
          "305": [0, 0.44444, 0, 0, 0.31944],
          "338": [0, 0.68611, 0, 0, 1.16944],
          "339": [0, 0.44444, 0, 0, 0.89444],
          "567": [0.19444, 0.44444, 0, 0, 0.35139],
          "710": [0, 0.69444, 0, 0, 0.575],
          "711": [0, 0.63194, 0, 0, 0.575],
          "713": [0, 0.59611, 0, 0, 0.575],
          "714": [0, 0.69444, 0, 0, 0.575],
          "715": [0, 0.69444, 0, 0, 0.575],
          "728": [0, 0.69444, 0, 0, 0.575],
          "729": [0, 0.69444, 0, 0, 0.31944],
          "730": [0, 0.69444, 0, 0, 0.86944],
          "732": [0, 0.69444, 0, 0, 0.575],
          "733": [0, 0.69444, 0, 0, 0.575],
          "915": [0, 0.68611, 0, 0, 0.69166],
          "916": [0, 0.68611, 0, 0, 0.95833],
          "920": [0, 0.68611, 0, 0, 0.89444],
          "923": [0, 0.68611, 0, 0, 0.80555],
          "926": [0, 0.68611, 0, 0, 0.76666],
          "928": [0, 0.68611, 0, 0, 0.9],
          "931": [0, 0.68611, 0, 0, 0.83055],
          "933": [0, 0.68611, 0, 0, 0.89444],
          "934": [0, 0.68611, 0, 0, 0.83055],
          "936": [0, 0.68611, 0, 0, 0.89444],
          "937": [0, 0.68611, 0, 0, 0.83055],
          "8211": [0, 0.44444, 0.03194, 0, 0.575],
          "8212": [0, 0.44444, 0.03194, 0, 1.14999],
          "8216": [0, 0.69444, 0, 0, 0.31944],
          "8217": [0, 0.69444, 0, 0, 0.31944],
          "8220": [0, 0.69444, 0, 0, 0.60278],
          "8221": [0, 0.69444, 0, 0, 0.60278],
          "8224": [0.19444, 0.69444, 0, 0, 0.51111],
          "8225": [0.19444, 0.69444, 0, 0, 0.51111],
          "8242": [0, 0.55556, 0, 0, 0.34444],
          "8407": [0, 0.72444, 0.15486, 0, 0.575],
          "8463": [0, 0.69444, 0, 0, 0.66759],
          "8465": [0, 0.69444, 0, 0, 0.83055],
          "8467": [0, 0.69444, 0, 0, 0.47361],
          "8472": [0.19444, 0.44444, 0, 0, 0.74027],
          "8476": [0, 0.69444, 0, 0, 0.83055],
          "8501": [0, 0.69444, 0, 0, 0.70277],
          "8592": [-0.10889, 0.39111, 0, 0, 1.14999],
          "8593": [0.19444, 0.69444, 0, 0, 0.575],
          "8594": [-0.10889, 0.39111, 0, 0, 1.14999],
          "8595": [0.19444, 0.69444, 0, 0, 0.575],
          "8596": [-0.10889, 0.39111, 0, 0, 1.14999],
          "8597": [0.25, 0.75, 0, 0, 0.575],
          "8598": [0.19444, 0.69444, 0, 0, 1.14999],
          "8599": [0.19444, 0.69444, 0, 0, 1.14999],
          "8600": [0.19444, 0.69444, 0, 0, 1.14999],
          "8601": [0.19444, 0.69444, 0, 0, 1.14999],
          "8636": [-0.10889, 0.39111, 0, 0, 1.14999],
          "8637": [-0.10889, 0.39111, 0, 0, 1.14999],
          "8640": [-0.10889, 0.39111, 0, 0, 1.14999],
          "8641": [-0.10889, 0.39111, 0, 0, 1.14999],
          "8656": [-0.10889, 0.39111, 0, 0, 1.14999],
          "8657": [0.19444, 0.69444, 0, 0, 0.70277],
          "8658": [-0.10889, 0.39111, 0, 0, 1.14999],
          "8659": [0.19444, 0.69444, 0, 0, 0.70277],
          "8660": [-0.10889, 0.39111, 0, 0, 1.14999],
          "8661": [0.25, 0.75, 0, 0, 0.70277],
          "8704": [0, 0.69444, 0, 0, 0.63889],
          "8706": [0, 0.69444, 0.06389, 0, 0.62847],
          "8707": [0, 0.69444, 0, 0, 0.63889],
          "8709": [0.05556, 0.75, 0, 0, 0.575],
          "8711": [0, 0.68611, 0, 0, 0.95833],
          "8712": [0.08556, 0.58556, 0, 0, 0.76666],
          "8715": [0.08556, 0.58556, 0, 0, 0.76666],
          "8722": [0.13333, 0.63333, 0, 0, 0.89444],
          "8723": [0.13333, 0.63333, 0, 0, 0.89444],
          "8725": [0.25, 0.75, 0, 0, 0.575],
          "8726": [0.25, 0.75, 0, 0, 0.575],
          "8727": [-0.02778, 0.47222, 0, 0, 0.575],
          "8728": [-0.02639, 0.47361, 0, 0, 0.575],
          "8729": [-0.02639, 0.47361, 0, 0, 0.575],
          "8730": [0.18, 0.82, 0, 0, 0.95833],
          "8733": [0, 0.44444, 0, 0, 0.89444],
          "8734": [0, 0.44444, 0, 0, 1.14999],
          "8736": [0, 0.69224, 0, 0, 0.72222],
          "8739": [0.25, 0.75, 0, 0, 0.31944],
          "8741": [0.25, 0.75, 0, 0, 0.575],
          "8743": [0, 0.55556, 0, 0, 0.76666],
          "8744": [0, 0.55556, 0, 0, 0.76666],
          "8745": [0, 0.55556, 0, 0, 0.76666],
          "8746": [0, 0.55556, 0, 0, 0.76666],
          "8747": [0.19444, 0.69444, 0.12778, 0, 0.56875],
          "8764": [-0.10889, 0.39111, 0, 0, 0.89444],
          "8768": [0.19444, 0.69444, 0, 0, 0.31944],
          "8771": [222e-5, 0.50222, 0, 0, 0.89444],
          "8773": [0.027, 0.638, 0, 0, 0.894],
          "8776": [0.02444, 0.52444, 0, 0, 0.89444],
          "8781": [222e-5, 0.50222, 0, 0, 0.89444],
          "8801": [222e-5, 0.50222, 0, 0, 0.89444],
          "8804": [0.19667, 0.69667, 0, 0, 0.89444],
          "8805": [0.19667, 0.69667, 0, 0, 0.89444],
          "8810": [0.08556, 0.58556, 0, 0, 1.14999],
          "8811": [0.08556, 0.58556, 0, 0, 1.14999],
          "8826": [0.08556, 0.58556, 0, 0, 0.89444],
          "8827": [0.08556, 0.58556, 0, 0, 0.89444],
          "8834": [0.08556, 0.58556, 0, 0, 0.89444],
          "8835": [0.08556, 0.58556, 0, 0, 0.89444],
          "8838": [0.19667, 0.69667, 0, 0, 0.89444],
          "8839": [0.19667, 0.69667, 0, 0, 0.89444],
          "8846": [0, 0.55556, 0, 0, 0.76666],
          "8849": [0.19667, 0.69667, 0, 0, 0.89444],
          "8850": [0.19667, 0.69667, 0, 0, 0.89444],
          "8851": [0, 0.55556, 0, 0, 0.76666],
          "8852": [0, 0.55556, 0, 0, 0.76666],
          "8853": [0.13333, 0.63333, 0, 0, 0.89444],
          "8854": [0.13333, 0.63333, 0, 0, 0.89444],
          "8855": [0.13333, 0.63333, 0, 0, 0.89444],
          "8856": [0.13333, 0.63333, 0, 0, 0.89444],
          "8857": [0.13333, 0.63333, 0, 0, 0.89444],
          "8866": [0, 0.69444, 0, 0, 0.70277],
          "8867": [0, 0.69444, 0, 0, 0.70277],
          "8868": [0, 0.69444, 0, 0, 0.89444],
          "8869": [0, 0.69444, 0, 0, 0.89444],
          "8900": [-0.02639, 0.47361, 0, 0, 0.575],
          "8901": [-0.02639, 0.47361, 0, 0, 0.31944],
          "8902": [-0.02778, 0.47222, 0, 0, 0.575],
          "8968": [0.25, 0.75, 0, 0, 0.51111],
          "8969": [0.25, 0.75, 0, 0, 0.51111],
          "8970": [0.25, 0.75, 0, 0, 0.51111],
          "8971": [0.25, 0.75, 0, 0, 0.51111],
          "8994": [-0.13889, 0.36111, 0, 0, 1.14999],
          "8995": [-0.13889, 0.36111, 0, 0, 1.14999],
          "9651": [0.19444, 0.69444, 0, 0, 1.02222],
          "9657": [-0.02778, 0.47222, 0, 0, 0.575],
          "9661": [0.19444, 0.69444, 0, 0, 1.02222],
          "9667": [-0.02778, 0.47222, 0, 0, 0.575],
          "9711": [0.19444, 0.69444, 0, 0, 1.14999],
          "9824": [0.12963, 0.69444, 0, 0, 0.89444],
          "9825": [0.12963, 0.69444, 0, 0, 0.89444],
          "9826": [0.12963, 0.69444, 0, 0, 0.89444],
          "9827": [0.12963, 0.69444, 0, 0, 0.89444],
          "9837": [0, 0.75, 0, 0, 0.44722],
          "9838": [0.19444, 0.69444, 0, 0, 0.44722],
          "9839": [0.19444, 0.69444, 0, 0, 0.44722],
          "10216": [0.25, 0.75, 0, 0, 0.44722],
          "10217": [0.25, 0.75, 0, 0, 0.44722],
          "10815": [0, 0.68611, 0, 0, 0.9],
          "10927": [0.19667, 0.69667, 0, 0, 0.89444],
          "10928": [0.19667, 0.69667, 0, 0, 0.89444],
          "57376": [0.19444, 0.69444, 0, 0, 0]
        },
        "Main-BoldItalic": {
          "32": [0, 0, 0, 0, 0.25],
          "33": [0, 0.69444, 0.11417, 0, 0.38611],
          "34": [0, 0.69444, 0.07939, 0, 0.62055],
          "35": [0.19444, 0.69444, 0.06833, 0, 0.94444],
          "37": [0.05556, 0.75, 0.12861, 0, 0.94444],
          "38": [0, 0.69444, 0.08528, 0, 0.88555],
          "39": [0, 0.69444, 0.12945, 0, 0.35555],
          "40": [0.25, 0.75, 0.15806, 0, 0.47333],
          "41": [0.25, 0.75, 0.03306, 0, 0.47333],
          "42": [0, 0.75, 0.14333, 0, 0.59111],
          "43": [0.10333, 0.60333, 0.03306, 0, 0.88555],
          "44": [0.19444, 0.14722, 0, 0, 0.35555],
          "45": [0, 0.44444, 0.02611, 0, 0.41444],
          "46": [0, 0.14722, 0, 0, 0.35555],
          "47": [0.25, 0.75, 0.15806, 0, 0.59111],
          "48": [0, 0.64444, 0.13167, 0, 0.59111],
          "49": [0, 0.64444, 0.13167, 0, 0.59111],
          "50": [0, 0.64444, 0.13167, 0, 0.59111],
          "51": [0, 0.64444, 0.13167, 0, 0.59111],
          "52": [0.19444, 0.64444, 0.13167, 0, 0.59111],
          "53": [0, 0.64444, 0.13167, 0, 0.59111],
          "54": [0, 0.64444, 0.13167, 0, 0.59111],
          "55": [0.19444, 0.64444, 0.13167, 0, 0.59111],
          "56": [0, 0.64444, 0.13167, 0, 0.59111],
          "57": [0, 0.64444, 0.13167, 0, 0.59111],
          "58": [0, 0.44444, 0.06695, 0, 0.35555],
          "59": [0.19444, 0.44444, 0.06695, 0, 0.35555],
          "61": [-0.10889, 0.39111, 0.06833, 0, 0.88555],
          "63": [0, 0.69444, 0.11472, 0, 0.59111],
          "64": [0, 0.69444, 0.09208, 0, 0.88555],
          "65": [0, 0.68611, 0, 0, 0.86555],
          "66": [0, 0.68611, 0.0992, 0, 0.81666],
          "67": [0, 0.68611, 0.14208, 0, 0.82666],
          "68": [0, 0.68611, 0.09062, 0, 0.87555],
          "69": [0, 0.68611, 0.11431, 0, 0.75666],
          "70": [0, 0.68611, 0.12903, 0, 0.72722],
          "71": [0, 0.68611, 0.07347, 0, 0.89527],
          "72": [0, 0.68611, 0.17208, 0, 0.8961],
          "73": [0, 0.68611, 0.15681, 0, 0.47166],
          "74": [0, 0.68611, 0.145, 0, 0.61055],
          "75": [0, 0.68611, 0.14208, 0, 0.89499],
          "76": [0, 0.68611, 0, 0, 0.69777],
          "77": [0, 0.68611, 0.17208, 0, 1.07277],
          "78": [0, 0.68611, 0.17208, 0, 0.8961],
          "79": [0, 0.68611, 0.09062, 0, 0.85499],
          "80": [0, 0.68611, 0.0992, 0, 0.78721],
          "81": [0.19444, 0.68611, 0.09062, 0, 0.85499],
          "82": [0, 0.68611, 0.02559, 0, 0.85944],
          "83": [0, 0.68611, 0.11264, 0, 0.64999],
          "84": [0, 0.68611, 0.12903, 0, 0.7961],
          "85": [0, 0.68611, 0.17208, 0, 0.88083],
          "86": [0, 0.68611, 0.18625, 0, 0.86555],
          "87": [0, 0.68611, 0.18625, 0, 1.15999],
          "88": [0, 0.68611, 0.15681, 0, 0.86555],
          "89": [0, 0.68611, 0.19803, 0, 0.86555],
          "90": [0, 0.68611, 0.14208, 0, 0.70888],
          "91": [0.25, 0.75, 0.1875, 0, 0.35611],
          "93": [0.25, 0.75, 0.09972, 0, 0.35611],
          "94": [0, 0.69444, 0.06709, 0, 0.59111],
          "95": [0.31, 0.13444, 0.09811, 0, 0.59111],
          "97": [0, 0.44444, 0.09426, 0, 0.59111],
          "98": [0, 0.69444, 0.07861, 0, 0.53222],
          "99": [0, 0.44444, 0.05222, 0, 0.53222],
          "100": [0, 0.69444, 0.10861, 0, 0.59111],
          "101": [0, 0.44444, 0.085, 0, 0.53222],
          "102": [0.19444, 0.69444, 0.21778, 0, 0.4],
          "103": [0.19444, 0.44444, 0.105, 0, 0.53222],
          "104": [0, 0.69444, 0.09426, 0, 0.59111],
          "105": [0, 0.69326, 0.11387, 0, 0.35555],
          "106": [0.19444, 0.69326, 0.1672, 0, 0.35555],
          "107": [0, 0.69444, 0.11111, 0, 0.53222],
          "108": [0, 0.69444, 0.10861, 0, 0.29666],
          "109": [0, 0.44444, 0.09426, 0, 0.94444],
          "110": [0, 0.44444, 0.09426, 0, 0.64999],
          "111": [0, 0.44444, 0.07861, 0, 0.59111],
          "112": [0.19444, 0.44444, 0.07861, 0, 0.59111],
          "113": [0.19444, 0.44444, 0.105, 0, 0.53222],
          "114": [0, 0.44444, 0.11111, 0, 0.50167],
          "115": [0, 0.44444, 0.08167, 0, 0.48694],
          "116": [0, 0.63492, 0.09639, 0, 0.385],
          "117": [0, 0.44444, 0.09426, 0, 0.62055],
          "118": [0, 0.44444, 0.11111, 0, 0.53222],
          "119": [0, 0.44444, 0.11111, 0, 0.76777],
          "120": [0, 0.44444, 0.12583, 0, 0.56055],
          "121": [0.19444, 0.44444, 0.105, 0, 0.56166],
          "122": [0, 0.44444, 0.13889, 0, 0.49055],
          "126": [0.35, 0.34444, 0.11472, 0, 0.59111],
          "160": [0, 0, 0, 0, 0.25],
          "168": [0, 0.69444, 0.11473, 0, 0.59111],
          "176": [0, 0.69444, 0, 0, 0.94888],
          "184": [0.17014, 0, 0, 0, 0.53222],
          "198": [0, 0.68611, 0.11431, 0, 1.02277],
          "216": [0.04861, 0.73472, 0.09062, 0, 0.88555],
          "223": [0.19444, 0.69444, 0.09736, 0, 0.665],
          "230": [0, 0.44444, 0.085, 0, 0.82666],
          "248": [0.09722, 0.54167, 0.09458, 0, 0.59111],
          "305": [0, 0.44444, 0.09426, 0, 0.35555],
          "338": [0, 0.68611, 0.11431, 0, 1.14054],
          "339": [0, 0.44444, 0.085, 0, 0.82666],
          "567": [0.19444, 0.44444, 0.04611, 0, 0.385],
          "710": [0, 0.69444, 0.06709, 0, 0.59111],
          "711": [0, 0.63194, 0.08271, 0, 0.59111],
          "713": [0, 0.59444, 0.10444, 0, 0.59111],
          "714": [0, 0.69444, 0.08528, 0, 0.59111],
          "715": [0, 0.69444, 0, 0, 0.59111],
          "728": [0, 0.69444, 0.10333, 0, 0.59111],
          "729": [0, 0.69444, 0.12945, 0, 0.35555],
          "730": [0, 0.69444, 0, 0, 0.94888],
          "732": [0, 0.69444, 0.11472, 0, 0.59111],
          "733": [0, 0.69444, 0.11472, 0, 0.59111],
          "915": [0, 0.68611, 0.12903, 0, 0.69777],
          "916": [0, 0.68611, 0, 0, 0.94444],
          "920": [0, 0.68611, 0.09062, 0, 0.88555],
          "923": [0, 0.68611, 0, 0, 0.80666],
          "926": [0, 0.68611, 0.15092, 0, 0.76777],
          "928": [0, 0.68611, 0.17208, 0, 0.8961],
          "931": [0, 0.68611, 0.11431, 0, 0.82666],
          "933": [0, 0.68611, 0.10778, 0, 0.88555],
          "934": [0, 0.68611, 0.05632, 0, 0.82666],
          "936": [0, 0.68611, 0.10778, 0, 0.88555],
          "937": [0, 0.68611, 0.0992, 0, 0.82666],
          "8211": [0, 0.44444, 0.09811, 0, 0.59111],
          "8212": [0, 0.44444, 0.09811, 0, 1.18221],
          "8216": [0, 0.69444, 0.12945, 0, 0.35555],
          "8217": [0, 0.69444, 0.12945, 0, 0.35555],
          "8220": [0, 0.69444, 0.16772, 0, 0.62055],
          "8221": [0, 0.69444, 0.07939, 0, 0.62055]
        },
        "Main-Italic": {
          "32": [0, 0, 0, 0, 0.25],
          "33": [0, 0.69444, 0.12417, 0, 0.30667],
          "34": [0, 0.69444, 0.06961, 0, 0.51444],
          "35": [0.19444, 0.69444, 0.06616, 0, 0.81777],
          "37": [0.05556, 0.75, 0.13639, 0, 0.81777],
          "38": [0, 0.69444, 0.09694, 0, 0.76666],
          "39": [0, 0.69444, 0.12417, 0, 0.30667],
          "40": [0.25, 0.75, 0.16194, 0, 0.40889],
          "41": [0.25, 0.75, 0.03694, 0, 0.40889],
          "42": [0, 0.75, 0.14917, 0, 0.51111],
          "43": [0.05667, 0.56167, 0.03694, 0, 0.76666],
          "44": [0.19444, 0.10556, 0, 0, 0.30667],
          "45": [0, 0.43056, 0.02826, 0, 0.35778],
          "46": [0, 0.10556, 0, 0, 0.30667],
          "47": [0.25, 0.75, 0.16194, 0, 0.51111],
          "48": [0, 0.64444, 0.13556, 0, 0.51111],
          "49": [0, 0.64444, 0.13556, 0, 0.51111],
          "50": [0, 0.64444, 0.13556, 0, 0.51111],
          "51": [0, 0.64444, 0.13556, 0, 0.51111],
          "52": [0.19444, 0.64444, 0.13556, 0, 0.51111],
          "53": [0, 0.64444, 0.13556, 0, 0.51111],
          "54": [0, 0.64444, 0.13556, 0, 0.51111],
          "55": [0.19444, 0.64444, 0.13556, 0, 0.51111],
          "56": [0, 0.64444, 0.13556, 0, 0.51111],
          "57": [0, 0.64444, 0.13556, 0, 0.51111],
          "58": [0, 0.43056, 0.0582, 0, 0.30667],
          "59": [0.19444, 0.43056, 0.0582, 0, 0.30667],
          "61": [-0.13313, 0.36687, 0.06616, 0, 0.76666],
          "63": [0, 0.69444, 0.1225, 0, 0.51111],
          "64": [0, 0.69444, 0.09597, 0, 0.76666],
          "65": [0, 0.68333, 0, 0, 0.74333],
          "66": [0, 0.68333, 0.10257, 0, 0.70389],
          "67": [0, 0.68333, 0.14528, 0, 0.71555],
          "68": [0, 0.68333, 0.09403, 0, 0.755],
          "69": [0, 0.68333, 0.12028, 0, 0.67833],
          "70": [0, 0.68333, 0.13305, 0, 0.65277],
          "71": [0, 0.68333, 0.08722, 0, 0.77361],
          "72": [0, 0.68333, 0.16389, 0, 0.74333],
          "73": [0, 0.68333, 0.15806, 0, 0.38555],
          "74": [0, 0.68333, 0.14028, 0, 0.525],
          "75": [0, 0.68333, 0.14528, 0, 0.76888],
          "76": [0, 0.68333, 0, 0, 0.62722],
          "77": [0, 0.68333, 0.16389, 0, 0.89666],
          "78": [0, 0.68333, 0.16389, 0, 0.74333],
          "79": [0, 0.68333, 0.09403, 0, 0.76666],
          "80": [0, 0.68333, 0.10257, 0, 0.67833],
          "81": [0.19444, 0.68333, 0.09403, 0, 0.76666],
          "82": [0, 0.68333, 0.03868, 0, 0.72944],
          "83": [0, 0.68333, 0.11972, 0, 0.56222],
          "84": [0, 0.68333, 0.13305, 0, 0.71555],
          "85": [0, 0.68333, 0.16389, 0, 0.74333],
          "86": [0, 0.68333, 0.18361, 0, 0.74333],
          "87": [0, 0.68333, 0.18361, 0, 0.99888],
          "88": [0, 0.68333, 0.15806, 0, 0.74333],
          "89": [0, 0.68333, 0.19383, 0, 0.74333],
          "90": [0, 0.68333, 0.14528, 0, 0.61333],
          "91": [0.25, 0.75, 0.1875, 0, 0.30667],
          "93": [0.25, 0.75, 0.10528, 0, 0.30667],
          "94": [0, 0.69444, 0.06646, 0, 0.51111],
          "95": [0.31, 0.12056, 0.09208, 0, 0.51111],
          "97": [0, 0.43056, 0.07671, 0, 0.51111],
          "98": [0, 0.69444, 0.06312, 0, 0.46],
          "99": [0, 0.43056, 0.05653, 0, 0.46],
          "100": [0, 0.69444, 0.10333, 0, 0.51111],
          "101": [0, 0.43056, 0.07514, 0, 0.46],
          "102": [0.19444, 0.69444, 0.21194, 0, 0.30667],
          "103": [0.19444, 0.43056, 0.08847, 0, 0.46],
          "104": [0, 0.69444, 0.07671, 0, 0.51111],
          "105": [0, 0.65536, 0.1019, 0, 0.30667],
          "106": [0.19444, 0.65536, 0.14467, 0, 0.30667],
          "107": [0, 0.69444, 0.10764, 0, 0.46],
          "108": [0, 0.69444, 0.10333, 0, 0.25555],
          "109": [0, 0.43056, 0.07671, 0, 0.81777],
          "110": [0, 0.43056, 0.07671, 0, 0.56222],
          "111": [0, 0.43056, 0.06312, 0, 0.51111],
          "112": [0.19444, 0.43056, 0.06312, 0, 0.51111],
          "113": [0.19444, 0.43056, 0.08847, 0, 0.46],
          "114": [0, 0.43056, 0.10764, 0, 0.42166],
          "115": [0, 0.43056, 0.08208, 0, 0.40889],
          "116": [0, 0.61508, 0.09486, 0, 0.33222],
          "117": [0, 0.43056, 0.07671, 0, 0.53666],
          "118": [0, 0.43056, 0.10764, 0, 0.46],
          "119": [0, 0.43056, 0.10764, 0, 0.66444],
          "120": [0, 0.43056, 0.12042, 0, 0.46389],
          "121": [0.19444, 0.43056, 0.08847, 0, 0.48555],
          "122": [0, 0.43056, 0.12292, 0, 0.40889],
          "126": [0.35, 0.31786, 0.11585, 0, 0.51111],
          "160": [0, 0, 0, 0, 0.25],
          "168": [0, 0.66786, 0.10474, 0, 0.51111],
          "176": [0, 0.69444, 0, 0, 0.83129],
          "184": [0.17014, 0, 0, 0, 0.46],
          "198": [0, 0.68333, 0.12028, 0, 0.88277],
          "216": [0.04861, 0.73194, 0.09403, 0, 0.76666],
          "223": [0.19444, 0.69444, 0.10514, 0, 0.53666],
          "230": [0, 0.43056, 0.07514, 0, 0.71555],
          "248": [0.09722, 0.52778, 0.09194, 0, 0.51111],
          "338": [0, 0.68333, 0.12028, 0, 0.98499],
          "339": [0, 0.43056, 0.07514, 0, 0.71555],
          "710": [0, 0.69444, 0.06646, 0, 0.51111],
          "711": [0, 0.62847, 0.08295, 0, 0.51111],
          "713": [0, 0.56167, 0.10333, 0, 0.51111],
          "714": [0, 0.69444, 0.09694, 0, 0.51111],
          "715": [0, 0.69444, 0, 0, 0.51111],
          "728": [0, 0.69444, 0.10806, 0, 0.51111],
          "729": [0, 0.66786, 0.11752, 0, 0.30667],
          "730": [0, 0.69444, 0, 0, 0.83129],
          "732": [0, 0.66786, 0.11585, 0, 0.51111],
          "733": [0, 0.69444, 0.1225, 0, 0.51111],
          "915": [0, 0.68333, 0.13305, 0, 0.62722],
          "916": [0, 0.68333, 0, 0, 0.81777],
          "920": [0, 0.68333, 0.09403, 0, 0.76666],
          "923": [0, 0.68333, 0, 0, 0.69222],
          "926": [0, 0.68333, 0.15294, 0, 0.66444],
          "928": [0, 0.68333, 0.16389, 0, 0.74333],
          "931": [0, 0.68333, 0.12028, 0, 0.71555],
          "933": [0, 0.68333, 0.11111, 0, 0.76666],
          "934": [0, 0.68333, 0.05986, 0, 0.71555],
          "936": [0, 0.68333, 0.11111, 0, 0.76666],
          "937": [0, 0.68333, 0.10257, 0, 0.71555],
          "8211": [0, 0.43056, 0.09208, 0, 0.51111],
          "8212": [0, 0.43056, 0.09208, 0, 1.02222],
          "8216": [0, 0.69444, 0.12417, 0, 0.30667],
          "8217": [0, 0.69444, 0.12417, 0, 0.30667],
          "8220": [0, 0.69444, 0.1685, 0, 0.51444],
          "8221": [0, 0.69444, 0.06961, 0, 0.51444],
          "8463": [0, 0.68889, 0, 0, 0.54028]
        },
        "Main-Regular": {
          "32": [0, 0, 0, 0, 0.25],
          "33": [0, 0.69444, 0, 0, 0.27778],
          "34": [0, 0.69444, 0, 0, 0.5],
          "35": [0.19444, 0.69444, 0, 0, 0.83334],
          "36": [0.05556, 0.75, 0, 0, 0.5],
          "37": [0.05556, 0.75, 0, 0, 0.83334],
          "38": [0, 0.69444, 0, 0, 0.77778],
          "39": [0, 0.69444, 0, 0, 0.27778],
          "40": [0.25, 0.75, 0, 0, 0.38889],
          "41": [0.25, 0.75, 0, 0, 0.38889],
          "42": [0, 0.75, 0, 0, 0.5],
          "43": [0.08333, 0.58333, 0, 0, 0.77778],
          "44": [0.19444, 0.10556, 0, 0, 0.27778],
          "45": [0, 0.43056, 0, 0, 0.33333],
          "46": [0, 0.10556, 0, 0, 0.27778],
          "47": [0.25, 0.75, 0, 0, 0.5],
          "48": [0, 0.64444, 0, 0, 0.5],
          "49": [0, 0.64444, 0, 0, 0.5],
          "50": [0, 0.64444, 0, 0, 0.5],
          "51": [0, 0.64444, 0, 0, 0.5],
          "52": [0, 0.64444, 0, 0, 0.5],
          "53": [0, 0.64444, 0, 0, 0.5],
          "54": [0, 0.64444, 0, 0, 0.5],
          "55": [0, 0.64444, 0, 0, 0.5],
          "56": [0, 0.64444, 0, 0, 0.5],
          "57": [0, 0.64444, 0, 0, 0.5],
          "58": [0, 0.43056, 0, 0, 0.27778],
          "59": [0.19444, 0.43056, 0, 0, 0.27778],
          "60": [0.0391, 0.5391, 0, 0, 0.77778],
          "61": [-0.13313, 0.36687, 0, 0, 0.77778],
          "62": [0.0391, 0.5391, 0, 0, 0.77778],
          "63": [0, 0.69444, 0, 0, 0.47222],
          "64": [0, 0.69444, 0, 0, 0.77778],
          "65": [0, 0.68333, 0, 0, 0.75],
          "66": [0, 0.68333, 0, 0, 0.70834],
          "67": [0, 0.68333, 0, 0, 0.72222],
          "68": [0, 0.68333, 0, 0, 0.76389],
          "69": [0, 0.68333, 0, 0, 0.68056],
          "70": [0, 0.68333, 0, 0, 0.65278],
          "71": [0, 0.68333, 0, 0, 0.78472],
          "72": [0, 0.68333, 0, 0, 0.75],
          "73": [0, 0.68333, 0, 0, 0.36111],
          "74": [0, 0.68333, 0, 0, 0.51389],
          "75": [0, 0.68333, 0, 0, 0.77778],
          "76": [0, 0.68333, 0, 0, 0.625],
          "77": [0, 0.68333, 0, 0, 0.91667],
          "78": [0, 0.68333, 0, 0, 0.75],
          "79": [0, 0.68333, 0, 0, 0.77778],
          "80": [0, 0.68333, 0, 0, 0.68056],
          "81": [0.19444, 0.68333, 0, 0, 0.77778],
          "82": [0, 0.68333, 0, 0, 0.73611],
          "83": [0, 0.68333, 0, 0, 0.55556],
          "84": [0, 0.68333, 0, 0, 0.72222],
          "85": [0, 0.68333, 0, 0, 0.75],
          "86": [0, 0.68333, 0.01389, 0, 0.75],
          "87": [0, 0.68333, 0.01389, 0, 1.02778],
          "88": [0, 0.68333, 0, 0, 0.75],
          "89": [0, 0.68333, 0.025, 0, 0.75],
          "90": [0, 0.68333, 0, 0, 0.61111],
          "91": [0.25, 0.75, 0, 0, 0.27778],
          "92": [0.25, 0.75, 0, 0, 0.5],
          "93": [0.25, 0.75, 0, 0, 0.27778],
          "94": [0, 0.69444, 0, 0, 0.5],
          "95": [0.31, 0.12056, 0.02778, 0, 0.5],
          "97": [0, 0.43056, 0, 0, 0.5],
          "98": [0, 0.69444, 0, 0, 0.55556],
          "99": [0, 0.43056, 0, 0, 0.44445],
          "100": [0, 0.69444, 0, 0, 0.55556],
          "101": [0, 0.43056, 0, 0, 0.44445],
          "102": [0, 0.69444, 0.07778, 0, 0.30556],
          "103": [0.19444, 0.43056, 0.01389, 0, 0.5],
          "104": [0, 0.69444, 0, 0, 0.55556],
          "105": [0, 0.66786, 0, 0, 0.27778],
          "106": [0.19444, 0.66786, 0, 0, 0.30556],
          "107": [0, 0.69444, 0, 0, 0.52778],
          "108": [0, 0.69444, 0, 0, 0.27778],
          "109": [0, 0.43056, 0, 0, 0.83334],
          "110": [0, 0.43056, 0, 0, 0.55556],
          "111": [0, 0.43056, 0, 0, 0.5],
          "112": [0.19444, 0.43056, 0, 0, 0.55556],
          "113": [0.19444, 0.43056, 0, 0, 0.52778],
          "114": [0, 0.43056, 0, 0, 0.39167],
          "115": [0, 0.43056, 0, 0, 0.39445],
          "116": [0, 0.61508, 0, 0, 0.38889],
          "117": [0, 0.43056, 0, 0, 0.55556],
          "118": [0, 0.43056, 0.01389, 0, 0.52778],
          "119": [0, 0.43056, 0.01389, 0, 0.72222],
          "120": [0, 0.43056, 0, 0, 0.52778],
          "121": [0.19444, 0.43056, 0.01389, 0, 0.52778],
          "122": [0, 0.43056, 0, 0, 0.44445],
          "123": [0.25, 0.75, 0, 0, 0.5],
          "124": [0.25, 0.75, 0, 0, 0.27778],
          "125": [0.25, 0.75, 0, 0, 0.5],
          "126": [0.35, 0.31786, 0, 0, 0.5],
          "160": [0, 0, 0, 0, 0.25],
          "163": [0, 0.69444, 0, 0, 0.76909],
          "167": [0.19444, 0.69444, 0, 0, 0.44445],
          "168": [0, 0.66786, 0, 0, 0.5],
          "172": [0, 0.43056, 0, 0, 0.66667],
          "176": [0, 0.69444, 0, 0, 0.75],
          "177": [0.08333, 0.58333, 0, 0, 0.77778],
          "182": [0.19444, 0.69444, 0, 0, 0.61111],
          "184": [0.17014, 0, 0, 0, 0.44445],
          "198": [0, 0.68333, 0, 0, 0.90278],
          "215": [0.08333, 0.58333, 0, 0, 0.77778],
          "216": [0.04861, 0.73194, 0, 0, 0.77778],
          "223": [0, 0.69444, 0, 0, 0.5],
          "230": [0, 0.43056, 0, 0, 0.72222],
          "247": [0.08333, 0.58333, 0, 0, 0.77778],
          "248": [0.09722, 0.52778, 0, 0, 0.5],
          "305": [0, 0.43056, 0, 0, 0.27778],
          "338": [0, 0.68333, 0, 0, 1.01389],
          "339": [0, 0.43056, 0, 0, 0.77778],
          "567": [0.19444, 0.43056, 0, 0, 0.30556],
          "710": [0, 0.69444, 0, 0, 0.5],
          "711": [0, 0.62847, 0, 0, 0.5],
          "713": [0, 0.56778, 0, 0, 0.5],
          "714": [0, 0.69444, 0, 0, 0.5],
          "715": [0, 0.69444, 0, 0, 0.5],
          "728": [0, 0.69444, 0, 0, 0.5],
          "729": [0, 0.66786, 0, 0, 0.27778],
          "730": [0, 0.69444, 0, 0, 0.75],
          "732": [0, 0.66786, 0, 0, 0.5],
          "733": [0, 0.69444, 0, 0, 0.5],
          "915": [0, 0.68333, 0, 0, 0.625],
          "916": [0, 0.68333, 0, 0, 0.83334],
          "920": [0, 0.68333, 0, 0, 0.77778],
          "923": [0, 0.68333, 0, 0, 0.69445],
          "926": [0, 0.68333, 0, 0, 0.66667],
          "928": [0, 0.68333, 0, 0, 0.75],
          "931": [0, 0.68333, 0, 0, 0.72222],
          "933": [0, 0.68333, 0, 0, 0.77778],
          "934": [0, 0.68333, 0, 0, 0.72222],
          "936": [0, 0.68333, 0, 0, 0.77778],
          "937": [0, 0.68333, 0, 0, 0.72222],
          "8211": [0, 0.43056, 0.02778, 0, 0.5],
          "8212": [0, 0.43056, 0.02778, 0, 1],
          "8216": [0, 0.69444, 0, 0, 0.27778],
          "8217": [0, 0.69444, 0, 0, 0.27778],
          "8220": [0, 0.69444, 0, 0, 0.5],
          "8221": [0, 0.69444, 0, 0, 0.5],
          "8224": [0.19444, 0.69444, 0, 0, 0.44445],
          "8225": [0.19444, 0.69444, 0, 0, 0.44445],
          "8230": [0, 0.123, 0, 0, 1.172],
          "8242": [0, 0.55556, 0, 0, 0.275],
          "8407": [0, 0.71444, 0.15382, 0, 0.5],
          "8463": [0, 0.68889, 0, 0, 0.54028],
          "8465": [0, 0.69444, 0, 0, 0.72222],
          "8467": [0, 0.69444, 0, 0.11111, 0.41667],
          "8472": [0.19444, 0.43056, 0, 0.11111, 0.63646],
          "8476": [0, 0.69444, 0, 0, 0.72222],
          "8501": [0, 0.69444, 0, 0, 0.61111],
          "8592": [-0.13313, 0.36687, 0, 0, 1],
          "8593": [0.19444, 0.69444, 0, 0, 0.5],
          "8594": [-0.13313, 0.36687, 0, 0, 1],
          "8595": [0.19444, 0.69444, 0, 0, 0.5],
          "8596": [-0.13313, 0.36687, 0, 0, 1],
          "8597": [0.25, 0.75, 0, 0, 0.5],
          "8598": [0.19444, 0.69444, 0, 0, 1],
          "8599": [0.19444, 0.69444, 0, 0, 1],
          "8600": [0.19444, 0.69444, 0, 0, 1],
          "8601": [0.19444, 0.69444, 0, 0, 1],
          "8614": [0.011, 0.511, 0, 0, 1],
          "8617": [0.011, 0.511, 0, 0, 1.126],
          "8618": [0.011, 0.511, 0, 0, 1.126],
          "8636": [-0.13313, 0.36687, 0, 0, 1],
          "8637": [-0.13313, 0.36687, 0, 0, 1],
          "8640": [-0.13313, 0.36687, 0, 0, 1],
          "8641": [-0.13313, 0.36687, 0, 0, 1],
          "8652": [0.011, 0.671, 0, 0, 1],
          "8656": [-0.13313, 0.36687, 0, 0, 1],
          "8657": [0.19444, 0.69444, 0, 0, 0.61111],
          "8658": [-0.13313, 0.36687, 0, 0, 1],
          "8659": [0.19444, 0.69444, 0, 0, 0.61111],
          "8660": [-0.13313, 0.36687, 0, 0, 1],
          "8661": [0.25, 0.75, 0, 0, 0.61111],
          "8704": [0, 0.69444, 0, 0, 0.55556],
          "8706": [0, 0.69444, 0.05556, 0.08334, 0.5309],
          "8707": [0, 0.69444, 0, 0, 0.55556],
          "8709": [0.05556, 0.75, 0, 0, 0.5],
          "8711": [0, 0.68333, 0, 0, 0.83334],
          "8712": [0.0391, 0.5391, 0, 0, 0.66667],
          "8715": [0.0391, 0.5391, 0, 0, 0.66667],
          "8722": [0.08333, 0.58333, 0, 0, 0.77778],
          "8723": [0.08333, 0.58333, 0, 0, 0.77778],
          "8725": [0.25, 0.75, 0, 0, 0.5],
          "8726": [0.25, 0.75, 0, 0, 0.5],
          "8727": [-0.03472, 0.46528, 0, 0, 0.5],
          "8728": [-0.05555, 0.44445, 0, 0, 0.5],
          "8729": [-0.05555, 0.44445, 0, 0, 0.5],
          "8730": [0.2, 0.8, 0, 0, 0.83334],
          "8733": [0, 0.43056, 0, 0, 0.77778],
          "8734": [0, 0.43056, 0, 0, 1],
          "8736": [0, 0.69224, 0, 0, 0.72222],
          "8739": [0.25, 0.75, 0, 0, 0.27778],
          "8741": [0.25, 0.75, 0, 0, 0.5],
          "8743": [0, 0.55556, 0, 0, 0.66667],
          "8744": [0, 0.55556, 0, 0, 0.66667],
          "8745": [0, 0.55556, 0, 0, 0.66667],
          "8746": [0, 0.55556, 0, 0, 0.66667],
          "8747": [0.19444, 0.69444, 0.11111, 0, 0.41667],
          "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
          "8768": [0.19444, 0.69444, 0, 0, 0.27778],
          "8771": [-0.03625, 0.46375, 0, 0, 0.77778],
          "8773": [-0.022, 0.589, 0, 0, 0.778],
          "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
          "8781": [-0.03625, 0.46375, 0, 0, 0.77778],
          "8784": [-0.133, 0.673, 0, 0, 0.778],
          "8801": [-0.03625, 0.46375, 0, 0, 0.77778],
          "8804": [0.13597, 0.63597, 0, 0, 0.77778],
          "8805": [0.13597, 0.63597, 0, 0, 0.77778],
          "8810": [0.0391, 0.5391, 0, 0, 1],
          "8811": [0.0391, 0.5391, 0, 0, 1],
          "8826": [0.0391, 0.5391, 0, 0, 0.77778],
          "8827": [0.0391, 0.5391, 0, 0, 0.77778],
          "8834": [0.0391, 0.5391, 0, 0, 0.77778],
          "8835": [0.0391, 0.5391, 0, 0, 0.77778],
          "8838": [0.13597, 0.63597, 0, 0, 0.77778],
          "8839": [0.13597, 0.63597, 0, 0, 0.77778],
          "8846": [0, 0.55556, 0, 0, 0.66667],
          "8849": [0.13597, 0.63597, 0, 0, 0.77778],
          "8850": [0.13597, 0.63597, 0, 0, 0.77778],
          "8851": [0, 0.55556, 0, 0, 0.66667],
          "8852": [0, 0.55556, 0, 0, 0.66667],
          "8853": [0.08333, 0.58333, 0, 0, 0.77778],
          "8854": [0.08333, 0.58333, 0, 0, 0.77778],
          "8855": [0.08333, 0.58333, 0, 0, 0.77778],
          "8856": [0.08333, 0.58333, 0, 0, 0.77778],
          "8857": [0.08333, 0.58333, 0, 0, 0.77778],
          "8866": [0, 0.69444, 0, 0, 0.61111],
          "8867": [0, 0.69444, 0, 0, 0.61111],
          "8868": [0, 0.69444, 0, 0, 0.77778],
          "8869": [0, 0.69444, 0, 0, 0.77778],
          "8872": [0.249, 0.75, 0, 0, 0.867],
          "8900": [-0.05555, 0.44445, 0, 0, 0.5],
          "8901": [-0.05555, 0.44445, 0, 0, 0.27778],
          "8902": [-0.03472, 0.46528, 0, 0, 0.5],
          "8904": [5e-3, 0.505, 0, 0, 0.9],
          "8942": [0.03, 0.903, 0, 0, 0.278],
          "8943": [-0.19, 0.313, 0, 0, 1.172],
          "8945": [-0.1, 0.823, 0, 0, 1.282],
          "8968": [0.25, 0.75, 0, 0, 0.44445],
          "8969": [0.25, 0.75, 0, 0, 0.44445],
          "8970": [0.25, 0.75, 0, 0, 0.44445],
          "8971": [0.25, 0.75, 0, 0, 0.44445],
          "8994": [-0.14236, 0.35764, 0, 0, 1],
          "8995": [-0.14236, 0.35764, 0, 0, 1],
          "9136": [0.244, 0.744, 0, 0, 0.412],
          "9137": [0.244, 0.745, 0, 0, 0.412],
          "9651": [0.19444, 0.69444, 0, 0, 0.88889],
          "9657": [-0.03472, 0.46528, 0, 0, 0.5],
          "9661": [0.19444, 0.69444, 0, 0, 0.88889],
          "9667": [-0.03472, 0.46528, 0, 0, 0.5],
          "9711": [0.19444, 0.69444, 0, 0, 1],
          "9824": [0.12963, 0.69444, 0, 0, 0.77778],
          "9825": [0.12963, 0.69444, 0, 0, 0.77778],
          "9826": [0.12963, 0.69444, 0, 0, 0.77778],
          "9827": [0.12963, 0.69444, 0, 0, 0.77778],
          "9837": [0, 0.75, 0, 0, 0.38889],
          "9838": [0.19444, 0.69444, 0, 0, 0.38889],
          "9839": [0.19444, 0.69444, 0, 0, 0.38889],
          "10216": [0.25, 0.75, 0, 0, 0.38889],
          "10217": [0.25, 0.75, 0, 0, 0.38889],
          "10222": [0.244, 0.744, 0, 0, 0.412],
          "10223": [0.244, 0.745, 0, 0, 0.412],
          "10229": [0.011, 0.511, 0, 0, 1.609],
          "10230": [0.011, 0.511, 0, 0, 1.638],
          "10231": [0.011, 0.511, 0, 0, 1.859],
          "10232": [0.024, 0.525, 0, 0, 1.609],
          "10233": [0.024, 0.525, 0, 0, 1.638],
          "10234": [0.024, 0.525, 0, 0, 1.858],
          "10236": [0.011, 0.511, 0, 0, 1.638],
          "10815": [0, 0.68333, 0, 0, 0.75],
          "10927": [0.13597, 0.63597, 0, 0, 0.77778],
          "10928": [0.13597, 0.63597, 0, 0, 0.77778],
          "57376": [0.19444, 0.69444, 0, 0, 0]
        },
        "Math-BoldItalic": {
          "32": [0, 0, 0, 0, 0.25],
          "48": [0, 0.44444, 0, 0, 0.575],
          "49": [0, 0.44444, 0, 0, 0.575],
          "50": [0, 0.44444, 0, 0, 0.575],
          "51": [0.19444, 0.44444, 0, 0, 0.575],
          "52": [0.19444, 0.44444, 0, 0, 0.575],
          "53": [0.19444, 0.44444, 0, 0, 0.575],
          "54": [0, 0.64444, 0, 0, 0.575],
          "55": [0.19444, 0.44444, 0, 0, 0.575],
          "56": [0, 0.64444, 0, 0, 0.575],
          "57": [0.19444, 0.44444, 0, 0, 0.575],
          "65": [0, 0.68611, 0, 0, 0.86944],
          "66": [0, 0.68611, 0.04835, 0, 0.8664],
          "67": [0, 0.68611, 0.06979, 0, 0.81694],
          "68": [0, 0.68611, 0.03194, 0, 0.93812],
          "69": [0, 0.68611, 0.05451, 0, 0.81007],
          "70": [0, 0.68611, 0.15972, 0, 0.68889],
          "71": [0, 0.68611, 0, 0, 0.88673],
          "72": [0, 0.68611, 0.08229, 0, 0.98229],
          "73": [0, 0.68611, 0.07778, 0, 0.51111],
          "74": [0, 0.68611, 0.10069, 0, 0.63125],
          "75": [0, 0.68611, 0.06979, 0, 0.97118],
          "76": [0, 0.68611, 0, 0, 0.75555],
          "77": [0, 0.68611, 0.11424, 0, 1.14201],
          "78": [0, 0.68611, 0.11424, 0, 0.95034],
          "79": [0, 0.68611, 0.03194, 0, 0.83666],
          "80": [0, 0.68611, 0.15972, 0, 0.72309],
          "81": [0.19444, 0.68611, 0, 0, 0.86861],
          "82": [0, 0.68611, 421e-5, 0, 0.87235],
          "83": [0, 0.68611, 0.05382, 0, 0.69271],
          "84": [0, 0.68611, 0.15972, 0, 0.63663],
          "85": [0, 0.68611, 0.11424, 0, 0.80027],
          "86": [0, 0.68611, 0.25555, 0, 0.67778],
          "87": [0, 0.68611, 0.15972, 0, 1.09305],
          "88": [0, 0.68611, 0.07778, 0, 0.94722],
          "89": [0, 0.68611, 0.25555, 0, 0.67458],
          "90": [0, 0.68611, 0.06979, 0, 0.77257],
          "97": [0, 0.44444, 0, 0, 0.63287],
          "98": [0, 0.69444, 0, 0, 0.52083],
          "99": [0, 0.44444, 0, 0, 0.51342],
          "100": [0, 0.69444, 0, 0, 0.60972],
          "101": [0, 0.44444, 0, 0, 0.55361],
          "102": [0.19444, 0.69444, 0.11042, 0, 0.56806],
          "103": [0.19444, 0.44444, 0.03704, 0, 0.5449],
          "104": [0, 0.69444, 0, 0, 0.66759],
          "105": [0, 0.69326, 0, 0, 0.4048],
          "106": [0.19444, 0.69326, 0.0622, 0, 0.47083],
          "107": [0, 0.69444, 0.01852, 0, 0.6037],
          "108": [0, 0.69444, 88e-4, 0, 0.34815],
          "109": [0, 0.44444, 0, 0, 1.0324],
          "110": [0, 0.44444, 0, 0, 0.71296],
          "111": [0, 0.44444, 0, 0, 0.58472],
          "112": [0.19444, 0.44444, 0, 0, 0.60092],
          "113": [0.19444, 0.44444, 0.03704, 0, 0.54213],
          "114": [0, 0.44444, 0.03194, 0, 0.5287],
          "115": [0, 0.44444, 0, 0, 0.53125],
          "116": [0, 0.63492, 0, 0, 0.41528],
          "117": [0, 0.44444, 0, 0, 0.68102],
          "118": [0, 0.44444, 0.03704, 0, 0.56666],
          "119": [0, 0.44444, 0.02778, 0, 0.83148],
          "120": [0, 0.44444, 0, 0, 0.65903],
          "121": [0.19444, 0.44444, 0.03704, 0, 0.59028],
          "122": [0, 0.44444, 0.04213, 0, 0.55509],
          "160": [0, 0, 0, 0, 0.25],
          "915": [0, 0.68611, 0.15972, 0, 0.65694],
          "916": [0, 0.68611, 0, 0, 0.95833],
          "920": [0, 0.68611, 0.03194, 0, 0.86722],
          "923": [0, 0.68611, 0, 0, 0.80555],
          "926": [0, 0.68611, 0.07458, 0, 0.84125],
          "928": [0, 0.68611, 0.08229, 0, 0.98229],
          "931": [0, 0.68611, 0.05451, 0, 0.88507],
          "933": [0, 0.68611, 0.15972, 0, 0.67083],
          "934": [0, 0.68611, 0, 0, 0.76666],
          "936": [0, 0.68611, 0.11653, 0, 0.71402],
          "937": [0, 0.68611, 0.04835, 0, 0.8789],
          "945": [0, 0.44444, 0, 0, 0.76064],
          "946": [0.19444, 0.69444, 0.03403, 0, 0.65972],
          "947": [0.19444, 0.44444, 0.06389, 0, 0.59003],
          "948": [0, 0.69444, 0.03819, 0, 0.52222],
          "949": [0, 0.44444, 0, 0, 0.52882],
          "950": [0.19444, 0.69444, 0.06215, 0, 0.50833],
          "951": [0.19444, 0.44444, 0.03704, 0, 0.6],
          "952": [0, 0.69444, 0.03194, 0, 0.5618],
          "953": [0, 0.44444, 0, 0, 0.41204],
          "954": [0, 0.44444, 0, 0, 0.66759],
          "955": [0, 0.69444, 0, 0, 0.67083],
          "956": [0.19444, 0.44444, 0, 0, 0.70787],
          "957": [0, 0.44444, 0.06898, 0, 0.57685],
          "958": [0.19444, 0.69444, 0.03021, 0, 0.50833],
          "959": [0, 0.44444, 0, 0, 0.58472],
          "960": [0, 0.44444, 0.03704, 0, 0.68241],
          "961": [0.19444, 0.44444, 0, 0, 0.6118],
          "962": [0.09722, 0.44444, 0.07917, 0, 0.42361],
          "963": [0, 0.44444, 0.03704, 0, 0.68588],
          "964": [0, 0.44444, 0.13472, 0, 0.52083],
          "965": [0, 0.44444, 0.03704, 0, 0.63055],
          "966": [0.19444, 0.44444, 0, 0, 0.74722],
          "967": [0.19444, 0.44444, 0, 0, 0.71805],
          "968": [0.19444, 0.69444, 0.03704, 0, 0.75833],
          "969": [0, 0.44444, 0.03704, 0, 0.71782],
          "977": [0, 0.69444, 0, 0, 0.69155],
          "981": [0.19444, 0.69444, 0, 0, 0.7125],
          "982": [0, 0.44444, 0.03194, 0, 0.975],
          "1009": [0.19444, 0.44444, 0, 0, 0.6118],
          "1013": [0, 0.44444, 0, 0, 0.48333],
          "57649": [0, 0.44444, 0, 0, 0.39352],
          "57911": [0.19444, 0.44444, 0, 0, 0.43889]
        },
        "Math-Italic": {
          "32": [0, 0, 0, 0, 0.25],
          "48": [0, 0.43056, 0, 0, 0.5],
          "49": [0, 0.43056, 0, 0, 0.5],
          "50": [0, 0.43056, 0, 0, 0.5],
          "51": [0.19444, 0.43056, 0, 0, 0.5],
          "52": [0.19444, 0.43056, 0, 0, 0.5],
          "53": [0.19444, 0.43056, 0, 0, 0.5],
          "54": [0, 0.64444, 0, 0, 0.5],
          "55": [0.19444, 0.43056, 0, 0, 0.5],
          "56": [0, 0.64444, 0, 0, 0.5],
          "57": [0.19444, 0.43056, 0, 0, 0.5],
          "65": [0, 0.68333, 0, 0.13889, 0.75],
          "66": [0, 0.68333, 0.05017, 0.08334, 0.75851],
          "67": [0, 0.68333, 0.07153, 0.08334, 0.71472],
          "68": [0, 0.68333, 0.02778, 0.05556, 0.82792],
          "69": [0, 0.68333, 0.05764, 0.08334, 0.7382],
          "70": [0, 0.68333, 0.13889, 0.08334, 0.64306],
          "71": [0, 0.68333, 0, 0.08334, 0.78625],
          "72": [0, 0.68333, 0.08125, 0.05556, 0.83125],
          "73": [0, 0.68333, 0.07847, 0.11111, 0.43958],
          "74": [0, 0.68333, 0.09618, 0.16667, 0.55451],
          "75": [0, 0.68333, 0.07153, 0.05556, 0.84931],
          "76": [0, 0.68333, 0, 0.02778, 0.68056],
          "77": [0, 0.68333, 0.10903, 0.08334, 0.97014],
          "78": [0, 0.68333, 0.10903, 0.08334, 0.80347],
          "79": [0, 0.68333, 0.02778, 0.08334, 0.76278],
          "80": [0, 0.68333, 0.13889, 0.08334, 0.64201],
          "81": [0.19444, 0.68333, 0, 0.08334, 0.79056],
          "82": [0, 0.68333, 773e-5, 0.08334, 0.75929],
          "83": [0, 0.68333, 0.05764, 0.08334, 0.6132],
          "84": [0, 0.68333, 0.13889, 0.08334, 0.58438],
          "85": [0, 0.68333, 0.10903, 0.02778, 0.68278],
          "86": [0, 0.68333, 0.22222, 0, 0.58333],
          "87": [0, 0.68333, 0.13889, 0, 0.94445],
          "88": [0, 0.68333, 0.07847, 0.08334, 0.82847],
          "89": [0, 0.68333, 0.22222, 0, 0.58056],
          "90": [0, 0.68333, 0.07153, 0.08334, 0.68264],
          "97": [0, 0.43056, 0, 0, 0.52859],
          "98": [0, 0.69444, 0, 0, 0.42917],
          "99": [0, 0.43056, 0, 0.05556, 0.43276],
          "100": [0, 0.69444, 0, 0.16667, 0.52049],
          "101": [0, 0.43056, 0, 0.05556, 0.46563],
          "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959],
          "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697],
          "104": [0, 0.69444, 0, 0, 0.57616],
          "105": [0, 0.65952, 0, 0, 0.34451],
          "106": [0.19444, 0.65952, 0.05724, 0, 0.41181],
          "107": [0, 0.69444, 0.03148, 0, 0.5206],
          "108": [0, 0.69444, 0.01968, 0.08334, 0.29838],
          "109": [0, 0.43056, 0, 0, 0.87801],
          "110": [0, 0.43056, 0, 0, 0.60023],
          "111": [0, 0.43056, 0, 0.05556, 0.48472],
          "112": [0.19444, 0.43056, 0, 0.08334, 0.50313],
          "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641],
          "114": [0, 0.43056, 0.02778, 0.05556, 0.45116],
          "115": [0, 0.43056, 0, 0.05556, 0.46875],
          "116": [0, 0.61508, 0, 0.08334, 0.36111],
          "117": [0, 0.43056, 0, 0.02778, 0.57246],
          "118": [0, 0.43056, 0.03588, 0.02778, 0.48472],
          "119": [0, 0.43056, 0.02691, 0.08334, 0.71592],
          "120": [0, 0.43056, 0, 0.02778, 0.57153],
          "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028],
          "122": [0, 0.43056, 0.04398, 0.05556, 0.46505],
          "160": [0, 0, 0, 0, 0.25],
          "915": [0, 0.68333, 0.13889, 0.08334, 0.61528],
          "916": [0, 0.68333, 0, 0.16667, 0.83334],
          "920": [0, 0.68333, 0.02778, 0.08334, 0.76278],
          "923": [0, 0.68333, 0, 0.16667, 0.69445],
          "926": [0, 0.68333, 0.07569, 0.08334, 0.74236],
          "928": [0, 0.68333, 0.08125, 0.05556, 0.83125],
          "931": [0, 0.68333, 0.05764, 0.08334, 0.77986],
          "933": [0, 0.68333, 0.13889, 0.05556, 0.58333],
          "934": [0, 0.68333, 0, 0.08334, 0.66667],
          "936": [0, 0.68333, 0.11, 0.05556, 0.61222],
          "937": [0, 0.68333, 0.05017, 0.08334, 0.7724],
          "945": [0, 0.43056, 37e-4, 0.02778, 0.6397],
          "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563],
          "947": [0.19444, 0.43056, 0.05556, 0, 0.51773],
          "948": [0, 0.69444, 0.03785, 0.05556, 0.44444],
          "949": [0, 0.43056, 0, 0.08334, 0.46632],
          "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375],
          "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653],
          "952": [0, 0.69444, 0.02778, 0.08334, 0.46944],
          "953": [0, 0.43056, 0, 0.05556, 0.35394],
          "954": [0, 0.43056, 0, 0, 0.57616],
          "955": [0, 0.69444, 0, 0, 0.58334],
          "956": [0.19444, 0.43056, 0, 0.02778, 0.60255],
          "957": [0, 0.43056, 0.06366, 0.02778, 0.49398],
          "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375],
          "959": [0, 0.43056, 0, 0.05556, 0.48472],
          "960": [0, 0.43056, 0.03588, 0, 0.57003],
          "961": [0.19444, 0.43056, 0, 0.08334, 0.51702],
          "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285],
          "963": [0, 0.43056, 0.03588, 0, 0.57141],
          "964": [0, 0.43056, 0.1132, 0.02778, 0.43715],
          "965": [0, 0.43056, 0.03588, 0.02778, 0.54028],
          "966": [0.19444, 0.43056, 0, 0.08334, 0.65417],
          "967": [0.19444, 0.43056, 0, 0.05556, 0.62569],
          "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139],
          "969": [0, 0.43056, 0.03588, 0, 0.62245],
          "977": [0, 0.69444, 0, 0.08334, 0.59144],
          "981": [0.19444, 0.69444, 0, 0.08334, 0.59583],
          "982": [0, 0.43056, 0.02778, 0, 0.82813],
          "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702],
          "1013": [0, 0.43056, 0, 0.05556, 0.4059],
          "57649": [0, 0.43056, 0, 0.02778, 0.32246],
          "57911": [0.19444, 0.43056, 0, 0.08334, 0.38403]
        },
        "SansSerif-Bold": {
          "32": [0, 0, 0, 0, 0.25],
          "33": [0, 0.69444, 0, 0, 0.36667],
          "34": [0, 0.69444, 0, 0, 0.55834],
          "35": [0.19444, 0.69444, 0, 0, 0.91667],
          "36": [0.05556, 0.75, 0, 0, 0.55],
          "37": [0.05556, 0.75, 0, 0, 1.02912],
          "38": [0, 0.69444, 0, 0, 0.83056],
          "39": [0, 0.69444, 0, 0, 0.30556],
          "40": [0.25, 0.75, 0, 0, 0.42778],
          "41": [0.25, 0.75, 0, 0, 0.42778],
          "42": [0, 0.75, 0, 0, 0.55],
          "43": [0.11667, 0.61667, 0, 0, 0.85556],
          "44": [0.10556, 0.13056, 0, 0, 0.30556],
          "45": [0, 0.45833, 0, 0, 0.36667],
          "46": [0, 0.13056, 0, 0, 0.30556],
          "47": [0.25, 0.75, 0, 0, 0.55],
          "48": [0, 0.69444, 0, 0, 0.55],
          "49": [0, 0.69444, 0, 0, 0.55],
          "50": [0, 0.69444, 0, 0, 0.55],
          "51": [0, 0.69444, 0, 0, 0.55],
          "52": [0, 0.69444, 0, 0, 0.55],
          "53": [0, 0.69444, 0, 0, 0.55],
          "54": [0, 0.69444, 0, 0, 0.55],
          "55": [0, 0.69444, 0, 0, 0.55],
          "56": [0, 0.69444, 0, 0, 0.55],
          "57": [0, 0.69444, 0, 0, 0.55],
          "58": [0, 0.45833, 0, 0, 0.30556],
          "59": [0.10556, 0.45833, 0, 0, 0.30556],
          "61": [-0.09375, 0.40625, 0, 0, 0.85556],
          "63": [0, 0.69444, 0, 0, 0.51945],
          "64": [0, 0.69444, 0, 0, 0.73334],
          "65": [0, 0.69444, 0, 0, 0.73334],
          "66": [0, 0.69444, 0, 0, 0.73334],
          "67": [0, 0.69444, 0, 0, 0.70278],
          "68": [0, 0.69444, 0, 0, 0.79445],
          "69": [0, 0.69444, 0, 0, 0.64167],
          "70": [0, 0.69444, 0, 0, 0.61111],
          "71": [0, 0.69444, 0, 0, 0.73334],
          "72": [0, 0.69444, 0, 0, 0.79445],
          "73": [0, 0.69444, 0, 0, 0.33056],
          "74": [0, 0.69444, 0, 0, 0.51945],
          "75": [0, 0.69444, 0, 0, 0.76389],
          "76": [0, 0.69444, 0, 0, 0.58056],
          "77": [0, 0.69444, 0, 0, 0.97778],
          "78": [0, 0.69444, 0, 0, 0.79445],
          "79": [0, 0.69444, 0, 0, 0.79445],
          "80": [0, 0.69444, 0, 0, 0.70278],
          "81": [0.10556, 0.69444, 0, 0, 0.79445],
          "82": [0, 0.69444, 0, 0, 0.70278],
          "83": [0, 0.69444, 0, 0, 0.61111],
          "84": [0, 0.69444, 0, 0, 0.73334],
          "85": [0, 0.69444, 0, 0, 0.76389],
          "86": [0, 0.69444, 0.01528, 0, 0.73334],
          "87": [0, 0.69444, 0.01528, 0, 1.03889],
          "88": [0, 0.69444, 0, 0, 0.73334],
          "89": [0, 0.69444, 0.0275, 0, 0.73334],
          "90": [0, 0.69444, 0, 0, 0.67223],
          "91": [0.25, 0.75, 0, 0, 0.34306],
          "93": [0.25, 0.75, 0, 0, 0.34306],
          "94": [0, 0.69444, 0, 0, 0.55],
          "95": [0.35, 0.10833, 0.03056, 0, 0.55],
          "97": [0, 0.45833, 0, 0, 0.525],
          "98": [0, 0.69444, 0, 0, 0.56111],
          "99": [0, 0.45833, 0, 0, 0.48889],
          "100": [0, 0.69444, 0, 0, 0.56111],
          "101": [0, 0.45833, 0, 0, 0.51111],
          "102": [0, 0.69444, 0.07639, 0, 0.33611],
          "103": [0.19444, 0.45833, 0.01528, 0, 0.55],
          "104": [0, 0.69444, 0, 0, 0.56111],
          "105": [0, 0.69444, 0, 0, 0.25556],
          "106": [0.19444, 0.69444, 0, 0, 0.28611],
          "107": [0, 0.69444, 0, 0, 0.53056],
          "108": [0, 0.69444, 0, 0, 0.25556],
          "109": [0, 0.45833, 0, 0, 0.86667],
          "110": [0, 0.45833, 0, 0, 0.56111],
          "111": [0, 0.45833, 0, 0, 0.55],
          "112": [0.19444, 0.45833, 0, 0, 0.56111],
          "113": [0.19444, 0.45833, 0, 0, 0.56111],
          "114": [0, 0.45833, 0.01528, 0, 0.37222],
          "115": [0, 0.45833, 0, 0, 0.42167],
          "116": [0, 0.58929, 0, 0, 0.40417],
          "117": [0, 0.45833, 0, 0, 0.56111],
          "118": [0, 0.45833, 0.01528, 0, 0.5],
          "119": [0, 0.45833, 0.01528, 0, 0.74445],
          "120": [0, 0.45833, 0, 0, 0.5],
          "121": [0.19444, 0.45833, 0.01528, 0, 0.5],
          "122": [0, 0.45833, 0, 0, 0.47639],
          "126": [0.35, 0.34444, 0, 0, 0.55],
          "160": [0, 0, 0, 0, 0.25],
          "168": [0, 0.69444, 0, 0, 0.55],
          "176": [0, 0.69444, 0, 0, 0.73334],
          "180": [0, 0.69444, 0, 0, 0.55],
          "184": [0.17014, 0, 0, 0, 0.48889],
          "305": [0, 0.45833, 0, 0, 0.25556],
          "567": [0.19444, 0.45833, 0, 0, 0.28611],
          "710": [0, 0.69444, 0, 0, 0.55],
          "711": [0, 0.63542, 0, 0, 0.55],
          "713": [0, 0.63778, 0, 0, 0.55],
          "728": [0, 0.69444, 0, 0, 0.55],
          "729": [0, 0.69444, 0, 0, 0.30556],
          "730": [0, 0.69444, 0, 0, 0.73334],
          "732": [0, 0.69444, 0, 0, 0.55],
          "733": [0, 0.69444, 0, 0, 0.55],
          "915": [0, 0.69444, 0, 0, 0.58056],
          "916": [0, 0.69444, 0, 0, 0.91667],
          "920": [0, 0.69444, 0, 0, 0.85556],
          "923": [0, 0.69444, 0, 0, 0.67223],
          "926": [0, 0.69444, 0, 0, 0.73334],
          "928": [0, 0.69444, 0, 0, 0.79445],
          "931": [0, 0.69444, 0, 0, 0.79445],
          "933": [0, 0.69444, 0, 0, 0.85556],
          "934": [0, 0.69444, 0, 0, 0.79445],
          "936": [0, 0.69444, 0, 0, 0.85556],
          "937": [0, 0.69444, 0, 0, 0.79445],
          "8211": [0, 0.45833, 0.03056, 0, 0.55],
          "8212": [0, 0.45833, 0.03056, 0, 1.10001],
          "8216": [0, 0.69444, 0, 0, 0.30556],
          "8217": [0, 0.69444, 0, 0, 0.30556],
          "8220": [0, 0.69444, 0, 0, 0.55834],
          "8221": [0, 0.69444, 0, 0, 0.55834]
        },
        "SansSerif-Italic": {
          "32": [0, 0, 0, 0, 0.25],
          "33": [0, 0.69444, 0.05733, 0, 0.31945],
          "34": [0, 0.69444, 316e-5, 0, 0.5],
          "35": [0.19444, 0.69444, 0.05087, 0, 0.83334],
          "36": [0.05556, 0.75, 0.11156, 0, 0.5],
          "37": [0.05556, 0.75, 0.03126, 0, 0.83334],
          "38": [0, 0.69444, 0.03058, 0, 0.75834],
          "39": [0, 0.69444, 0.07816, 0, 0.27778],
          "40": [0.25, 0.75, 0.13164, 0, 0.38889],
          "41": [0.25, 0.75, 0.02536, 0, 0.38889],
          "42": [0, 0.75, 0.11775, 0, 0.5],
          "43": [0.08333, 0.58333, 0.02536, 0, 0.77778],
          "44": [0.125, 0.08333, 0, 0, 0.27778],
          "45": [0, 0.44444, 0.01946, 0, 0.33333],
          "46": [0, 0.08333, 0, 0, 0.27778],
          "47": [0.25, 0.75, 0.13164, 0, 0.5],
          "48": [0, 0.65556, 0.11156, 0, 0.5],
          "49": [0, 0.65556, 0.11156, 0, 0.5],
          "50": [0, 0.65556, 0.11156, 0, 0.5],
          "51": [0, 0.65556, 0.11156, 0, 0.5],
          "52": [0, 0.65556, 0.11156, 0, 0.5],
          "53": [0, 0.65556, 0.11156, 0, 0.5],
          "54": [0, 0.65556, 0.11156, 0, 0.5],
          "55": [0, 0.65556, 0.11156, 0, 0.5],
          "56": [0, 0.65556, 0.11156, 0, 0.5],
          "57": [0, 0.65556, 0.11156, 0, 0.5],
          "58": [0, 0.44444, 0.02502, 0, 0.27778],
          "59": [0.125, 0.44444, 0.02502, 0, 0.27778],
          "61": [-0.13, 0.37, 0.05087, 0, 0.77778],
          "63": [0, 0.69444, 0.11809, 0, 0.47222],
          "64": [0, 0.69444, 0.07555, 0, 0.66667],
          "65": [0, 0.69444, 0, 0, 0.66667],
          "66": [0, 0.69444, 0.08293, 0, 0.66667],
          "67": [0, 0.69444, 0.11983, 0, 0.63889],
          "68": [0, 0.69444, 0.07555, 0, 0.72223],
          "69": [0, 0.69444, 0.11983, 0, 0.59722],
          "70": [0, 0.69444, 0.13372, 0, 0.56945],
          "71": [0, 0.69444, 0.11983, 0, 0.66667],
          "72": [0, 0.69444, 0.08094, 0, 0.70834],
          "73": [0, 0.69444, 0.13372, 0, 0.27778],
          "74": [0, 0.69444, 0.08094, 0, 0.47222],
          "75": [0, 0.69444, 0.11983, 0, 0.69445],
          "76": [0, 0.69444, 0, 0, 0.54167],
          "77": [0, 0.69444, 0.08094, 0, 0.875],
          "78": [0, 0.69444, 0.08094, 0, 0.70834],
          "79": [0, 0.69444, 0.07555, 0, 0.73611],
          "80": [0, 0.69444, 0.08293, 0, 0.63889],
          "81": [0.125, 0.69444, 0.07555, 0, 0.73611],
          "82": [0, 0.69444, 0.08293, 0, 0.64584],
          "83": [0, 0.69444, 0.09205, 0, 0.55556],
          "84": [0, 0.69444, 0.13372, 0, 0.68056],
          "85": [0, 0.69444, 0.08094, 0, 0.6875],
          "86": [0, 0.69444, 0.1615, 0, 0.66667],
          "87": [0, 0.69444, 0.1615, 0, 0.94445],
          "88": [0, 0.69444, 0.13372, 0, 0.66667],
          "89": [0, 0.69444, 0.17261, 0, 0.66667],
          "90": [0, 0.69444, 0.11983, 0, 0.61111],
          "91": [0.25, 0.75, 0.15942, 0, 0.28889],
          "93": [0.25, 0.75, 0.08719, 0, 0.28889],
          "94": [0, 0.69444, 0.0799, 0, 0.5],
          "95": [0.35, 0.09444, 0.08616, 0, 0.5],
          "97": [0, 0.44444, 981e-5, 0, 0.48056],
          "98": [0, 0.69444, 0.03057, 0, 0.51667],
          "99": [0, 0.44444, 0.08336, 0, 0.44445],
          "100": [0, 0.69444, 0.09483, 0, 0.51667],
          "101": [0, 0.44444, 0.06778, 0, 0.44445],
          "102": [0, 0.69444, 0.21705, 0, 0.30556],
          "103": [0.19444, 0.44444, 0.10836, 0, 0.5],
          "104": [0, 0.69444, 0.01778, 0, 0.51667],
          "105": [0, 0.67937, 0.09718, 0, 0.23889],
          "106": [0.19444, 0.67937, 0.09162, 0, 0.26667],
          "107": [0, 0.69444, 0.08336, 0, 0.48889],
          "108": [0, 0.69444, 0.09483, 0, 0.23889],
          "109": [0, 0.44444, 0.01778, 0, 0.79445],
          "110": [0, 0.44444, 0.01778, 0, 0.51667],
          "111": [0, 0.44444, 0.06613, 0, 0.5],
          "112": [0.19444, 0.44444, 0.0389, 0, 0.51667],
          "113": [0.19444, 0.44444, 0.04169, 0, 0.51667],
          "114": [0, 0.44444, 0.10836, 0, 0.34167],
          "115": [0, 0.44444, 0.0778, 0, 0.38333],
          "116": [0, 0.57143, 0.07225, 0, 0.36111],
          "117": [0, 0.44444, 0.04169, 0, 0.51667],
          "118": [0, 0.44444, 0.10836, 0, 0.46111],
          "119": [0, 0.44444, 0.10836, 0, 0.68334],
          "120": [0, 0.44444, 0.09169, 0, 0.46111],
          "121": [0.19444, 0.44444, 0.10836, 0, 0.46111],
          "122": [0, 0.44444, 0.08752, 0, 0.43472],
          "126": [0.35, 0.32659, 0.08826, 0, 0.5],
          "160": [0, 0, 0, 0, 0.25],
          "168": [0, 0.67937, 0.06385, 0, 0.5],
          "176": [0, 0.69444, 0, 0, 0.73752],
          "184": [0.17014, 0, 0, 0, 0.44445],
          "305": [0, 0.44444, 0.04169, 0, 0.23889],
          "567": [0.19444, 0.44444, 0.04169, 0, 0.26667],
          "710": [0, 0.69444, 0.0799, 0, 0.5],
          "711": [0, 0.63194, 0.08432, 0, 0.5],
          "713": [0, 0.60889, 0.08776, 0, 0.5],
          "714": [0, 0.69444, 0.09205, 0, 0.5],
          "715": [0, 0.69444, 0, 0, 0.5],
          "728": [0, 0.69444, 0.09483, 0, 0.5],
          "729": [0, 0.67937, 0.07774, 0, 0.27778],
          "730": [0, 0.69444, 0, 0, 0.73752],
          "732": [0, 0.67659, 0.08826, 0, 0.5],
          "733": [0, 0.69444, 0.09205, 0, 0.5],
          "915": [0, 0.69444, 0.13372, 0, 0.54167],
          "916": [0, 0.69444, 0, 0, 0.83334],
          "920": [0, 0.69444, 0.07555, 0, 0.77778],
          "923": [0, 0.69444, 0, 0, 0.61111],
          "926": [0, 0.69444, 0.12816, 0, 0.66667],
          "928": [0, 0.69444, 0.08094, 0, 0.70834],
          "931": [0, 0.69444, 0.11983, 0, 0.72222],
          "933": [0, 0.69444, 0.09031, 0, 0.77778],
          "934": [0, 0.69444, 0.04603, 0, 0.72222],
          "936": [0, 0.69444, 0.09031, 0, 0.77778],
          "937": [0, 0.69444, 0.08293, 0, 0.72222],
          "8211": [0, 0.44444, 0.08616, 0, 0.5],
          "8212": [0, 0.44444, 0.08616, 0, 1],
          "8216": [0, 0.69444, 0.07816, 0, 0.27778],
          "8217": [0, 0.69444, 0.07816, 0, 0.27778],
          "8220": [0, 0.69444, 0.14205, 0, 0.5],
          "8221": [0, 0.69444, 316e-5, 0, 0.5]
        },
        "SansSerif-Regular": {
          "32": [0, 0, 0, 0, 0.25],
          "33": [0, 0.69444, 0, 0, 0.31945],
          "34": [0, 0.69444, 0, 0, 0.5],
          "35": [0.19444, 0.69444, 0, 0, 0.83334],
          "36": [0.05556, 0.75, 0, 0, 0.5],
          "37": [0.05556, 0.75, 0, 0, 0.83334],
          "38": [0, 0.69444, 0, 0, 0.75834],
          "39": [0, 0.69444, 0, 0, 0.27778],
          "40": [0.25, 0.75, 0, 0, 0.38889],
          "41": [0.25, 0.75, 0, 0, 0.38889],
          "42": [0, 0.75, 0, 0, 0.5],
          "43": [0.08333, 0.58333, 0, 0, 0.77778],
          "44": [0.125, 0.08333, 0, 0, 0.27778],
          "45": [0, 0.44444, 0, 0, 0.33333],
          "46": [0, 0.08333, 0, 0, 0.27778],
          "47": [0.25, 0.75, 0, 0, 0.5],
          "48": [0, 0.65556, 0, 0, 0.5],
          "49": [0, 0.65556, 0, 0, 0.5],
          "50": [0, 0.65556, 0, 0, 0.5],
          "51": [0, 0.65556, 0, 0, 0.5],
          "52": [0, 0.65556, 0, 0, 0.5],
          "53": [0, 0.65556, 0, 0, 0.5],
          "54": [0, 0.65556, 0, 0, 0.5],
          "55": [0, 0.65556, 0, 0, 0.5],
          "56": [0, 0.65556, 0, 0, 0.5],
          "57": [0, 0.65556, 0, 0, 0.5],
          "58": [0, 0.44444, 0, 0, 0.27778],
          "59": [0.125, 0.44444, 0, 0, 0.27778],
          "61": [-0.13, 0.37, 0, 0, 0.77778],
          "63": [0, 0.69444, 0, 0, 0.47222],
          "64": [0, 0.69444, 0, 0, 0.66667],
          "65": [0, 0.69444, 0, 0, 0.66667],
          "66": [0, 0.69444, 0, 0, 0.66667],
          "67": [0, 0.69444, 0, 0, 0.63889],
          "68": [0, 0.69444, 0, 0, 0.72223],
          "69": [0, 0.69444, 0, 0, 0.59722],
          "70": [0, 0.69444, 0, 0, 0.56945],
          "71": [0, 0.69444, 0, 0, 0.66667],
          "72": [0, 0.69444, 0, 0, 0.70834],
          "73": [0, 0.69444, 0, 0, 0.27778],
          "74": [0, 0.69444, 0, 0, 0.47222],
          "75": [0, 0.69444, 0, 0, 0.69445],
          "76": [0, 0.69444, 0, 0, 0.54167],
          "77": [0, 0.69444, 0, 0, 0.875],
          "78": [0, 0.69444, 0, 0, 0.70834],
          "79": [0, 0.69444, 0, 0, 0.73611],
          "80": [0, 0.69444, 0, 0, 0.63889],
          "81": [0.125, 0.69444, 0, 0, 0.73611],
          "82": [0, 0.69444, 0, 0, 0.64584],
          "83": [0, 0.69444, 0, 0, 0.55556],
          "84": [0, 0.69444, 0, 0, 0.68056],
          "85": [0, 0.69444, 0, 0, 0.6875],
          "86": [0, 0.69444, 0.01389, 0, 0.66667],
          "87": [0, 0.69444, 0.01389, 0, 0.94445],
          "88": [0, 0.69444, 0, 0, 0.66667],
          "89": [0, 0.69444, 0.025, 0, 0.66667],
          "90": [0, 0.69444, 0, 0, 0.61111],
          "91": [0.25, 0.75, 0, 0, 0.28889],
          "93": [0.25, 0.75, 0, 0, 0.28889],
          "94": [0, 0.69444, 0, 0, 0.5],
          "95": [0.35, 0.09444, 0.02778, 0, 0.5],
          "97": [0, 0.44444, 0, 0, 0.48056],
          "98": [0, 0.69444, 0, 0, 0.51667],
          "99": [0, 0.44444, 0, 0, 0.44445],
          "100": [0, 0.69444, 0, 0, 0.51667],
          "101": [0, 0.44444, 0, 0, 0.44445],
          "102": [0, 0.69444, 0.06944, 0, 0.30556],
          "103": [0.19444, 0.44444, 0.01389, 0, 0.5],
          "104": [0, 0.69444, 0, 0, 0.51667],
          "105": [0, 0.67937, 0, 0, 0.23889],
          "106": [0.19444, 0.67937, 0, 0, 0.26667],
          "107": [0, 0.69444, 0, 0, 0.48889],
          "108": [0, 0.69444, 0, 0, 0.23889],
          "109": [0, 0.44444, 0, 0, 0.79445],
          "110": [0, 0.44444, 0, 0, 0.51667],
          "111": [0, 0.44444, 0, 0, 0.5],
          "112": [0.19444, 0.44444, 0, 0, 0.51667],
          "113": [0.19444, 0.44444, 0, 0, 0.51667],
          "114": [0, 0.44444, 0.01389, 0, 0.34167],
          "115": [0, 0.44444, 0, 0, 0.38333],
          "116": [0, 0.57143, 0, 0, 0.36111],
          "117": [0, 0.44444, 0, 0, 0.51667],
          "118": [0, 0.44444, 0.01389, 0, 0.46111],
          "119": [0, 0.44444, 0.01389, 0, 0.68334],
          "120": [0, 0.44444, 0, 0, 0.46111],
          "121": [0.19444, 0.44444, 0.01389, 0, 0.46111],
          "122": [0, 0.44444, 0, 0, 0.43472],
          "126": [0.35, 0.32659, 0, 0, 0.5],
          "160": [0, 0, 0, 0, 0.25],
          "168": [0, 0.67937, 0, 0, 0.5],
          "176": [0, 0.69444, 0, 0, 0.66667],
          "184": [0.17014, 0, 0, 0, 0.44445],
          "305": [0, 0.44444, 0, 0, 0.23889],
          "567": [0.19444, 0.44444, 0, 0, 0.26667],
          "710": [0, 0.69444, 0, 0, 0.5],
          "711": [0, 0.63194, 0, 0, 0.5],
          "713": [0, 0.60889, 0, 0, 0.5],
          "714": [0, 0.69444, 0, 0, 0.5],
          "715": [0, 0.69444, 0, 0, 0.5],
          "728": [0, 0.69444, 0, 0, 0.5],
          "729": [0, 0.67937, 0, 0, 0.27778],
          "730": [0, 0.69444, 0, 0, 0.66667],
          "732": [0, 0.67659, 0, 0, 0.5],
          "733": [0, 0.69444, 0, 0, 0.5],
          "915": [0, 0.69444, 0, 0, 0.54167],
          "916": [0, 0.69444, 0, 0, 0.83334],
          "920": [0, 0.69444, 0, 0, 0.77778],
          "923": [0, 0.69444, 0, 0, 0.61111],
          "926": [0, 0.69444, 0, 0, 0.66667],
          "928": [0, 0.69444, 0, 0, 0.70834],
          "931": [0, 0.69444, 0, 0, 0.72222],
          "933": [0, 0.69444, 0, 0, 0.77778],
          "934": [0, 0.69444, 0, 0, 0.72222],
          "936": [0, 0.69444, 0, 0, 0.77778],
          "937": [0, 0.69444, 0, 0, 0.72222],
          "8211": [0, 0.44444, 0.02778, 0, 0.5],
          "8212": [0, 0.44444, 0.02778, 0, 1],
          "8216": [0, 0.69444, 0, 0, 0.27778],
          "8217": [0, 0.69444, 0, 0, 0.27778],
          "8220": [0, 0.69444, 0, 0, 0.5],
          "8221": [0, 0.69444, 0, 0, 0.5]
        },
        "Script-Regular": {
          "32": [0, 0, 0, 0, 0.25],
          "65": [0, 0.7, 0.22925, 0, 0.80253],
          "66": [0, 0.7, 0.04087, 0, 0.90757],
          "67": [0, 0.7, 0.1689, 0, 0.66619],
          "68": [0, 0.7, 0.09371, 0, 0.77443],
          "69": [0, 0.7, 0.18583, 0, 0.56162],
          "70": [0, 0.7, 0.13634, 0, 0.89544],
          "71": [0, 0.7, 0.17322, 0, 0.60961],
          "72": [0, 0.7, 0.29694, 0, 0.96919],
          "73": [0, 0.7, 0.19189, 0, 0.80907],
          "74": [0.27778, 0.7, 0.19189, 0, 1.05159],
          "75": [0, 0.7, 0.31259, 0, 0.91364],
          "76": [0, 0.7, 0.19189, 0, 0.87373],
          "77": [0, 0.7, 0.15981, 0, 1.08031],
          "78": [0, 0.7, 0.3525, 0, 0.9015],
          "79": [0, 0.7, 0.08078, 0, 0.73787],
          "80": [0, 0.7, 0.08078, 0, 1.01262],
          "81": [0, 0.7, 0.03305, 0, 0.88282],
          "82": [0, 0.7, 0.06259, 0, 0.85],
          "83": [0, 0.7, 0.19189, 0, 0.86767],
          "84": [0, 0.7, 0.29087, 0, 0.74697],
          "85": [0, 0.7, 0.25815, 0, 0.79996],
          "86": [0, 0.7, 0.27523, 0, 0.62204],
          "87": [0, 0.7, 0.27523, 0, 0.80532],
          "88": [0, 0.7, 0.26006, 0, 0.94445],
          "89": [0, 0.7, 0.2939, 0, 0.70961],
          "90": [0, 0.7, 0.24037, 0, 0.8212],
          "160": [0, 0, 0, 0, 0.25]
        },
        "Size1-Regular": {
          "32": [0, 0, 0, 0, 0.25],
          "40": [0.35001, 0.85, 0, 0, 0.45834],
          "41": [0.35001, 0.85, 0, 0, 0.45834],
          "47": [0.35001, 0.85, 0, 0, 0.57778],
          "91": [0.35001, 0.85, 0, 0, 0.41667],
          "92": [0.35001, 0.85, 0, 0, 0.57778],
          "93": [0.35001, 0.85, 0, 0, 0.41667],
          "123": [0.35001, 0.85, 0, 0, 0.58334],
          "125": [0.35001, 0.85, 0, 0, 0.58334],
          "160": [0, 0, 0, 0, 0.25],
          "710": [0, 0.72222, 0, 0, 0.55556],
          "732": [0, 0.72222, 0, 0, 0.55556],
          "770": [0, 0.72222, 0, 0, 0.55556],
          "771": [0, 0.72222, 0, 0, 0.55556],
          "8214": [-99e-5, 0.601, 0, 0, 0.77778],
          "8593": [1e-5, 0.6, 0, 0, 0.66667],
          "8595": [1e-5, 0.6, 0, 0, 0.66667],
          "8657": [1e-5, 0.6, 0, 0, 0.77778],
          "8659": [1e-5, 0.6, 0, 0, 0.77778],
          "8719": [0.25001, 0.75, 0, 0, 0.94445],
          "8720": [0.25001, 0.75, 0, 0, 0.94445],
          "8721": [0.25001, 0.75, 0, 0, 1.05556],
          "8730": [0.35001, 0.85, 0, 0, 1],
          "8739": [-599e-5, 0.606, 0, 0, 0.33333],
          "8741": [-599e-5, 0.606, 0, 0, 0.55556],
          "8747": [0.30612, 0.805, 0.19445, 0, 0.47222],
          "8748": [0.306, 0.805, 0.19445, 0, 0.47222],
          "8749": [0.306, 0.805, 0.19445, 0, 0.47222],
          "8750": [0.30612, 0.805, 0.19445, 0, 0.47222],
          "8896": [0.25001, 0.75, 0, 0, 0.83334],
          "8897": [0.25001, 0.75, 0, 0, 0.83334],
          "8898": [0.25001, 0.75, 0, 0, 0.83334],
          "8899": [0.25001, 0.75, 0, 0, 0.83334],
          "8968": [0.35001, 0.85, 0, 0, 0.47222],
          "8969": [0.35001, 0.85, 0, 0, 0.47222],
          "8970": [0.35001, 0.85, 0, 0, 0.47222],
          "8971": [0.35001, 0.85, 0, 0, 0.47222],
          "9168": [-99e-5, 0.601, 0, 0, 0.66667],
          "10216": [0.35001, 0.85, 0, 0, 0.47222],
          "10217": [0.35001, 0.85, 0, 0, 0.47222],
          "10752": [0.25001, 0.75, 0, 0, 1.11111],
          "10753": [0.25001, 0.75, 0, 0, 1.11111],
          "10754": [0.25001, 0.75, 0, 0, 1.11111],
          "10756": [0.25001, 0.75, 0, 0, 0.83334],
          "10758": [0.25001, 0.75, 0, 0, 0.83334]
        },
        "Size2-Regular": {
          "32": [0, 0, 0, 0, 0.25],
          "40": [0.65002, 1.15, 0, 0, 0.59722],
          "41": [0.65002, 1.15, 0, 0, 0.59722],
          "47": [0.65002, 1.15, 0, 0, 0.81111],
          "91": [0.65002, 1.15, 0, 0, 0.47222],
          "92": [0.65002, 1.15, 0, 0, 0.81111],
          "93": [0.65002, 1.15, 0, 0, 0.47222],
          "123": [0.65002, 1.15, 0, 0, 0.66667],
          "125": [0.65002, 1.15, 0, 0, 0.66667],
          "160": [0, 0, 0, 0, 0.25],
          "710": [0, 0.75, 0, 0, 1],
          "732": [0, 0.75, 0, 0, 1],
          "770": [0, 0.75, 0, 0, 1],
          "771": [0, 0.75, 0, 0, 1],
          "8719": [0.55001, 1.05, 0, 0, 1.27778],
          "8720": [0.55001, 1.05, 0, 0, 1.27778],
          "8721": [0.55001, 1.05, 0, 0, 1.44445],
          "8730": [0.65002, 1.15, 0, 0, 1],
          "8747": [0.86225, 1.36, 0.44445, 0, 0.55556],
          "8748": [0.862, 1.36, 0.44445, 0, 0.55556],
          "8749": [0.862, 1.36, 0.44445, 0, 0.55556],
          "8750": [0.86225, 1.36, 0.44445, 0, 0.55556],
          "8896": [0.55001, 1.05, 0, 0, 1.11111],
          "8897": [0.55001, 1.05, 0, 0, 1.11111],
          "8898": [0.55001, 1.05, 0, 0, 1.11111],
          "8899": [0.55001, 1.05, 0, 0, 1.11111],
          "8968": [0.65002, 1.15, 0, 0, 0.52778],
          "8969": [0.65002, 1.15, 0, 0, 0.52778],
          "8970": [0.65002, 1.15, 0, 0, 0.52778],
          "8971": [0.65002, 1.15, 0, 0, 0.52778],
          "10216": [0.65002, 1.15, 0, 0, 0.61111],
          "10217": [0.65002, 1.15, 0, 0, 0.61111],
          "10752": [0.55001, 1.05, 0, 0, 1.51112],
          "10753": [0.55001, 1.05, 0, 0, 1.51112],
          "10754": [0.55001, 1.05, 0, 0, 1.51112],
          "10756": [0.55001, 1.05, 0, 0, 1.11111],
          "10758": [0.55001, 1.05, 0, 0, 1.11111]
        },
        "Size3-Regular": {
          "32": [0, 0, 0, 0, 0.25],
          "40": [0.95003, 1.45, 0, 0, 0.73611],
          "41": [0.95003, 1.45, 0, 0, 0.73611],
          "47": [0.95003, 1.45, 0, 0, 1.04445],
          "91": [0.95003, 1.45, 0, 0, 0.52778],
          "92": [0.95003, 1.45, 0, 0, 1.04445],
          "93": [0.95003, 1.45, 0, 0, 0.52778],
          "123": [0.95003, 1.45, 0, 0, 0.75],
          "125": [0.95003, 1.45, 0, 0, 0.75],
          "160": [0, 0, 0, 0, 0.25],
          "710": [0, 0.75, 0, 0, 1.44445],
          "732": [0, 0.75, 0, 0, 1.44445],
          "770": [0, 0.75, 0, 0, 1.44445],
          "771": [0, 0.75, 0, 0, 1.44445],
          "8730": [0.95003, 1.45, 0, 0, 1],
          "8968": [0.95003, 1.45, 0, 0, 0.58334],
          "8969": [0.95003, 1.45, 0, 0, 0.58334],
          "8970": [0.95003, 1.45, 0, 0, 0.58334],
          "8971": [0.95003, 1.45, 0, 0, 0.58334],
          "10216": [0.95003, 1.45, 0, 0, 0.75],
          "10217": [0.95003, 1.45, 0, 0, 0.75]
        },
        "Size4-Regular": {
          "32": [0, 0, 0, 0, 0.25],
          "40": [1.25003, 1.75, 0, 0, 0.79167],
          "41": [1.25003, 1.75, 0, 0, 0.79167],
          "47": [1.25003, 1.75, 0, 0, 1.27778],
          "91": [1.25003, 1.75, 0, 0, 0.58334],
          "92": [1.25003, 1.75, 0, 0, 1.27778],
          "93": [1.25003, 1.75, 0, 0, 0.58334],
          "123": [1.25003, 1.75, 0, 0, 0.80556],
          "125": [1.25003, 1.75, 0, 0, 0.80556],
          "160": [0, 0, 0, 0, 0.25],
          "710": [0, 0.825, 0, 0, 1.8889],
          "732": [0, 0.825, 0, 0, 1.8889],
          "770": [0, 0.825, 0, 0, 1.8889],
          "771": [0, 0.825, 0, 0, 1.8889],
          "8730": [1.25003, 1.75, 0, 0, 1],
          "8968": [1.25003, 1.75, 0, 0, 0.63889],
          "8969": [1.25003, 1.75, 0, 0, 0.63889],
          "8970": [1.25003, 1.75, 0, 0, 0.63889],
          "8971": [1.25003, 1.75, 0, 0, 0.63889],
          "9115": [0.64502, 1.155, 0, 0, 0.875],
          "9116": [1e-5, 0.6, 0, 0, 0.875],
          "9117": [0.64502, 1.155, 0, 0, 0.875],
          "9118": [0.64502, 1.155, 0, 0, 0.875],
          "9119": [1e-5, 0.6, 0, 0, 0.875],
          "9120": [0.64502, 1.155, 0, 0, 0.875],
          "9121": [0.64502, 1.155, 0, 0, 0.66667],
          "9122": [-99e-5, 0.601, 0, 0, 0.66667],
          "9123": [0.64502, 1.155, 0, 0, 0.66667],
          "9124": [0.64502, 1.155, 0, 0, 0.66667],
          "9125": [-99e-5, 0.601, 0, 0, 0.66667],
          "9126": [0.64502, 1.155, 0, 0, 0.66667],
          "9127": [1e-5, 0.9, 0, 0, 0.88889],
          "9128": [0.65002, 1.15, 0, 0, 0.88889],
          "9129": [0.90001, 0, 0, 0, 0.88889],
          "9130": [0, 0.3, 0, 0, 0.88889],
          "9131": [1e-5, 0.9, 0, 0, 0.88889],
          "9132": [0.65002, 1.15, 0, 0, 0.88889],
          "9133": [0.90001, 0, 0, 0, 0.88889],
          "9143": [0.88502, 0.915, 0, 0, 1.05556],
          "10216": [1.25003, 1.75, 0, 0, 0.80556],
          "10217": [1.25003, 1.75, 0, 0, 0.80556],
          "57344": [-499e-5, 0.605, 0, 0, 1.05556],
          "57345": [-499e-5, 0.605, 0, 0, 1.05556],
          "57680": [0, 0.12, 0, 0, 0.45],
          "57681": [0, 0.12, 0, 0, 0.45],
          "57682": [0, 0.12, 0, 0, 0.45],
          "57683": [0, 0.12, 0, 0, 0.45]
        },
        "Typewriter-Regular": {
          "32": [0, 0, 0, 0, 0.525],
          "33": [0, 0.61111, 0, 0, 0.525],
          "34": [0, 0.61111, 0, 0, 0.525],
          "35": [0, 0.61111, 0, 0, 0.525],
          "36": [0.08333, 0.69444, 0, 0, 0.525],
          "37": [0.08333, 0.69444, 0, 0, 0.525],
          "38": [0, 0.61111, 0, 0, 0.525],
          "39": [0, 0.61111, 0, 0, 0.525],
          "40": [0.08333, 0.69444, 0, 0, 0.525],
          "41": [0.08333, 0.69444, 0, 0, 0.525],
          "42": [0, 0.52083, 0, 0, 0.525],
          "43": [-0.08056, 0.53055, 0, 0, 0.525],
          "44": [0.13889, 0.125, 0, 0, 0.525],
          "45": [-0.08056, 0.53055, 0, 0, 0.525],
          "46": [0, 0.125, 0, 0, 0.525],
          "47": [0.08333, 0.69444, 0, 0, 0.525],
          "48": [0, 0.61111, 0, 0, 0.525],
          "49": [0, 0.61111, 0, 0, 0.525],
          "50": [0, 0.61111, 0, 0, 0.525],
          "51": [0, 0.61111, 0, 0, 0.525],
          "52": [0, 0.61111, 0, 0, 0.525],
          "53": [0, 0.61111, 0, 0, 0.525],
          "54": [0, 0.61111, 0, 0, 0.525],
          "55": [0, 0.61111, 0, 0, 0.525],
          "56": [0, 0.61111, 0, 0, 0.525],
          "57": [0, 0.61111, 0, 0, 0.525],
          "58": [0, 0.43056, 0, 0, 0.525],
          "59": [0.13889, 0.43056, 0, 0, 0.525],
          "60": [-0.05556, 0.55556, 0, 0, 0.525],
          "61": [-0.19549, 0.41562, 0, 0, 0.525],
          "62": [-0.05556, 0.55556, 0, 0, 0.525],
          "63": [0, 0.61111, 0, 0, 0.525],
          "64": [0, 0.61111, 0, 0, 0.525],
          "65": [0, 0.61111, 0, 0, 0.525],
          "66": [0, 0.61111, 0, 0, 0.525],
          "67": [0, 0.61111, 0, 0, 0.525],
          "68": [0, 0.61111, 0, 0, 0.525],
          "69": [0, 0.61111, 0, 0, 0.525],
          "70": [0, 0.61111, 0, 0, 0.525],
          "71": [0, 0.61111, 0, 0, 0.525],
          "72": [0, 0.61111, 0, 0, 0.525],
          "73": [0, 0.61111, 0, 0, 0.525],
          "74": [0, 0.61111, 0, 0, 0.525],
          "75": [0, 0.61111, 0, 0, 0.525],
          "76": [0, 0.61111, 0, 0, 0.525],
          "77": [0, 0.61111, 0, 0, 0.525],
          "78": [0, 0.61111, 0, 0, 0.525],
          "79": [0, 0.61111, 0, 0, 0.525],
          "80": [0, 0.61111, 0, 0, 0.525],
          "81": [0.13889, 0.61111, 0, 0, 0.525],
          "82": [0, 0.61111, 0, 0, 0.525],
          "83": [0, 0.61111, 0, 0, 0.525],
          "84": [0, 0.61111, 0, 0, 0.525],
          "85": [0, 0.61111, 0, 0, 0.525],
          "86": [0, 0.61111, 0, 0, 0.525],
          "87": [0, 0.61111, 0, 0, 0.525],
          "88": [0, 0.61111, 0, 0, 0.525],
          "89": [0, 0.61111, 0, 0, 0.525],
          "90": [0, 0.61111, 0, 0, 0.525],
          "91": [0.08333, 0.69444, 0, 0, 0.525],
          "92": [0.08333, 0.69444, 0, 0, 0.525],
          "93": [0.08333, 0.69444, 0, 0, 0.525],
          "94": [0, 0.61111, 0, 0, 0.525],
          "95": [0.09514, 0, 0, 0, 0.525],
          "96": [0, 0.61111, 0, 0, 0.525],
          "97": [0, 0.43056, 0, 0, 0.525],
          "98": [0, 0.61111, 0, 0, 0.525],
          "99": [0, 0.43056, 0, 0, 0.525],
          "100": [0, 0.61111, 0, 0, 0.525],
          "101": [0, 0.43056, 0, 0, 0.525],
          "102": [0, 0.61111, 0, 0, 0.525],
          "103": [0.22222, 0.43056, 0, 0, 0.525],
          "104": [0, 0.61111, 0, 0, 0.525],
          "105": [0, 0.61111, 0, 0, 0.525],
          "106": [0.22222, 0.61111, 0, 0, 0.525],
          "107": [0, 0.61111, 0, 0, 0.525],
          "108": [0, 0.61111, 0, 0, 0.525],
          "109": [0, 0.43056, 0, 0, 0.525],
          "110": [0, 0.43056, 0, 0, 0.525],
          "111": [0, 0.43056, 0, 0, 0.525],
          "112": [0.22222, 0.43056, 0, 0, 0.525],
          "113": [0.22222, 0.43056, 0, 0, 0.525],
          "114": [0, 0.43056, 0, 0, 0.525],
          "115": [0, 0.43056, 0, 0, 0.525],
          "116": [0, 0.55358, 0, 0, 0.525],
          "117": [0, 0.43056, 0, 0, 0.525],
          "118": [0, 0.43056, 0, 0, 0.525],
          "119": [0, 0.43056, 0, 0, 0.525],
          "120": [0, 0.43056, 0, 0, 0.525],
          "121": [0.22222, 0.43056, 0, 0, 0.525],
          "122": [0, 0.43056, 0, 0, 0.525],
          "123": [0.08333, 0.69444, 0, 0, 0.525],
          "124": [0.08333, 0.69444, 0, 0, 0.525],
          "125": [0.08333, 0.69444, 0, 0, 0.525],
          "126": [0, 0.61111, 0, 0, 0.525],
          "127": [0, 0.61111, 0, 0, 0.525],
          "160": [0, 0, 0, 0, 0.525],
          "176": [0, 0.61111, 0, 0, 0.525],
          "184": [0.19445, 0, 0, 0, 0.525],
          "305": [0, 0.43056, 0, 0, 0.525],
          "567": [0.22222, 0.43056, 0, 0, 0.525],
          "711": [0, 0.56597, 0, 0, 0.525],
          "713": [0, 0.56555, 0, 0, 0.525],
          "714": [0, 0.61111, 0, 0, 0.525],
          "715": [0, 0.61111, 0, 0, 0.525],
          "728": [0, 0.61111, 0, 0, 0.525],
          "730": [0, 0.61111, 0, 0, 0.525],
          "770": [0, 0.61111, 0, 0, 0.525],
          "771": [0, 0.61111, 0, 0, 0.525],
          "776": [0, 0.61111, 0, 0, 0.525],
          "915": [0, 0.61111, 0, 0, 0.525],
          "916": [0, 0.61111, 0, 0, 0.525],
          "920": [0, 0.61111, 0, 0, 0.525],
          "923": [0, 0.61111, 0, 0, 0.525],
          "926": [0, 0.61111, 0, 0, 0.525],
          "928": [0, 0.61111, 0, 0, 0.525],
          "931": [0, 0.61111, 0, 0, 0.525],
          "933": [0, 0.61111, 0, 0, 0.525],
          "934": [0, 0.61111, 0, 0, 0.525],
          "936": [0, 0.61111, 0, 0, 0.525],
          "937": [0, 0.61111, 0, 0, 0.525],
          "8216": [0, 0.61111, 0, 0, 0.525],
          "8217": [0, 0.61111, 0, 0, 0.525],
          "8242": [0, 0.61111, 0, 0, 0.525],
          "9251": [0.11111, 0.21944, 0, 0, 0.525]
        }
      };
      sigmasAndXis = {
        slant: [0.25, 0.25, 0.25],
        // sigma1
        space: [0, 0, 0],
        // sigma2
        stretch: [0, 0, 0],
        // sigma3
        shrink: [0, 0, 0],
        // sigma4
        xHeight: [0.431, 0.431, 0.431],
        // sigma5
        quad: [1, 1.171, 1.472],
        // sigma6
        extraSpace: [0, 0, 0],
        // sigma7
        num1: [0.677, 0.732, 0.925],
        // sigma8
        num2: [0.394, 0.384, 0.387],
        // sigma9
        num3: [0.444, 0.471, 0.504],
        // sigma10
        denom1: [0.686, 0.752, 1.025],
        // sigma11
        denom2: [0.345, 0.344, 0.532],
        // sigma12
        sup1: [0.413, 0.503, 0.504],
        // sigma13
        sup2: [0.363, 0.431, 0.404],
        // sigma14
        sup3: [0.289, 0.286, 0.294],
        // sigma15
        sub1: [0.15, 0.143, 0.2],
        // sigma16
        sub2: [0.247, 0.286, 0.4],
        // sigma17
        supDrop: [0.386, 0.353, 0.494],
        // sigma18
        subDrop: [0.05, 0.071, 0.1],
        // sigma19
        delim1: [2.39, 1.7, 1.98],
        // sigma20
        delim2: [1.01, 1.157, 1.42],
        // sigma21
        axisHeight: [0.25, 0.25, 0.25],
        // sigma22
        // These font metrics are extracted from TeX by using tftopl on cmex10.tfm;
        // they correspond to the font parameters of the extension fonts (family 3).
        // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to
        // match cmex7, we'd use cmex7.tfm values for script and scriptscript
        // values.
        defaultRuleThickness: [0.04, 0.049, 0.049],
        // xi8; cmex7: 0.049
        bigOpSpacing1: [0.111, 0.111, 0.111],
        // xi9
        bigOpSpacing2: [0.166, 0.166, 0.166],
        // xi10
        bigOpSpacing3: [0.2, 0.2, 0.2],
        // xi11
        bigOpSpacing4: [0.6, 0.611, 0.611],
        // xi12; cmex7: 0.611
        bigOpSpacing5: [0.1, 0.143, 0.143],
        // xi13; cmex7: 0.143
        // The \sqrt rule width is taken from the height of the surd character.
        // Since we use the same font at all sizes, this thickness doesn't scale.
        sqrtRuleThickness: [0.04, 0.04, 0.04],
        // This value determines how large a pt is, for metrics which are defined
        // in terms of pts.
        // This value is also used in katex.scss; if you change it make sure the
        // values match.
        ptPerEm: [10, 10, 10],
        // The space between adjacent `|` columns in an array definition. From
        // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.
        doubleRuleSep: [0.2, 0.2, 0.2],
        // The width of separator lines in {array} environments. From
        // `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm.
        arrayRuleWidth: [0.04, 0.04, 0.04],
        // Two values from LaTeX source2e:
        fboxsep: [0.3, 0.3, 0.3],
        //        3 pt / ptPerEm
        fboxrule: [0.04, 0.04, 0.04]
        // 0.4 pt / ptPerEm
      };
      extraCharacterMap = {
        // Latin-1
        "\xC5": "A",
        "\xD0": "D",
        "\xDE": "o",
        "\xE5": "a",
        "\xF0": "d",
        "\xFE": "o",
        // Cyrillic
        "\u0410": "A",
        "\u0411": "B",
        "\u0412": "B",
        "\u0413": "F",
        "\u0414": "A",
        "\u0415": "E",
        "\u0416": "K",
        "\u0417": "3",
        "\u0418": "N",
        "\u0419": "N",
        "\u041A": "K",
        "\u041B": "N",
        "\u041C": "M",
        "\u041D": "H",
        "\u041E": "O",
        "\u041F": "N",
        "\u0420": "P",
        "\u0421": "C",
        "\u0422": "T",
        "\u0423": "y",
        "\u0424": "O",
        "\u0425": "X",
        "\u0426": "U",
        "\u0427": "h",
        "\u0428": "W",
        "\u0429": "W",
        "\u042A": "B",
        "\u042B": "X",
        "\u042C": "B",
        "\u042D": "3",
        "\u042E": "X",
        "\u042F": "R",
        "\u0430": "a",
        "\u0431": "b",
        "\u0432": "a",
        "\u0433": "r",
        "\u0434": "y",
        "\u0435": "e",
        "\u0436": "m",
        "\u0437": "e",
        "\u0438": "n",
        "\u0439": "n",
        "\u043A": "n",
        "\u043B": "n",
        "\u043C": "m",
        "\u043D": "n",
        "\u043E": "o",
        "\u043F": "n",
        "\u0440": "p",
        "\u0441": "c",
        "\u0442": "o",
        "\u0443": "y",
        "\u0444": "b",
        "\u0445": "x",
        "\u0446": "n",
        "\u0447": "n",
        "\u0448": "w",
        "\u0449": "w",
        "\u044A": "a",
        "\u044B": "m",
        "\u044C": "a",
        "\u044D": "e",
        "\u044E": "m",
        "\u044F": "r"
      };
      __name(setFontMetrics, "setFontMetrics");
      __name(getCharacterMetrics, "getCharacterMetrics");
      fontMetricsBySizeIndex = {};
      __name(getGlobalMetrics, "getGlobalMetrics");
      sizeStyleMap = [
        // Each element contains [textsize, scriptsize, scriptscriptsize].
        // The size mappings are taken from TeX with \normalsize=10pt.
        [1, 1, 1],
        // size1: [5, 5, 5]              \tiny
        [2, 1, 1],
        // size2: [6, 5, 5]
        [3, 1, 1],
        // size3: [7, 5, 5]              \scriptsize
        [4, 2, 1],
        // size4: [8, 6, 5]              \footnotesize
        [5, 2, 1],
        // size5: [9, 6, 5]              \small
        [6, 3, 1],
        // size6: [10, 7, 5]             \normalsize
        [7, 4, 2],
        // size7: [12, 8, 6]             \large
        [8, 6, 3],
        // size8: [14.4, 10, 7]          \Large
        [9, 7, 6],
        // size9: [17.28, 12, 10]        \LARGE
        [10, 8, 7],
        // size10: [20.74, 14.4, 12]     \huge
        [11, 10, 9]
        // size11: [24.88, 20.74, 17.28] \HUGE
      ];
      sizeMultipliers = [
        // fontMetrics.js:getGlobalMetrics also uses size indexes, so if
        // you change size indexes, change that function.
        0.5,
        0.6,
        0.7,
        0.8,
        0.9,
        1,
        1.2,
        1.44,
        1.728,
        2.074,
        2.488
      ];
      sizeAtStyle = /* @__PURE__ */ __name(function sizeAtStyle2(size4, style3) {
        return style3.size < 2 ? size4 : sizeStyleMap[size4 - 1][style3.size - 1];
      }, "sizeAtStyle");
      Options = class _Options {
        static {
          __name(this, "Options");
        }
        // A font family applies to a group of fonts (i.e. SansSerif), while a font
        // represents a specific font (i.e. SansSerif Bold).
        // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm
        /**
         * The base size index.
         */
        constructor(data5) {
          this.style = void 0;
          this.color = void 0;
          this.size = void 0;
          this.textSize = void 0;
          this.phantom = void 0;
          this.font = void 0;
          this.fontFamily = void 0;
          this.fontWeight = void 0;
          this.fontShape = void 0;
          this.sizeMultiplier = void 0;
          this.maxSize = void 0;
          this.minRuleThickness = void 0;
          this._fontMetrics = void 0;
          this.style = data5.style;
          this.color = data5.color;
          this.size = data5.size || _Options.BASESIZE;
          this.textSize = data5.textSize || this.size;
          this.phantom = !!data5.phantom;
          this.font = data5.font || "";
          this.fontFamily = data5.fontFamily || "";
          this.fontWeight = data5.fontWeight || "";
          this.fontShape = data5.fontShape || "";
          this.sizeMultiplier = sizeMultipliers[this.size - 1];
          this.maxSize = data5.maxSize;
          this.minRuleThickness = data5.minRuleThickness;
          this._fontMetrics = void 0;
        }
        /**
         * Returns a new options object with the same properties as "this".  Properties
         * from "extension" will be copied to the new options object.
         */
        extend(extension5) {
          var data5 = {
            style: this.style,
            size: this.size,
            textSize: this.textSize,
            color: this.color,
            phantom: this.phantom,
            font: this.font,
            fontFamily: this.fontFamily,
            fontWeight: this.fontWeight,
            fontShape: this.fontShape,
            maxSize: this.maxSize,
            minRuleThickness: this.minRuleThickness
          };
          for (var key in extension5) {
            if (extension5.hasOwnProperty(key)) {
              data5[key] = extension5[key];
            }
          }
          return new _Options(data5);
        }
        /**
         * Return an options object with the given style. If `this.style === style`,
         * returns `this`.
         */
        havingStyle(style3) {
          if (this.style === style3) {
            return this;
          } else {
            return this.extend({
              style: style3,
              size: sizeAtStyle(this.textSize, style3)
            });
          }
        }
        /**
         * Return an options object with a cramped version of the current style. If
         * the current style is cramped, returns `this`.
         */
        havingCrampedStyle() {
          return this.havingStyle(this.style.cramp());
        }
        /**
         * Return an options object with the given size and in at least `\textstyle`.
         * Returns `this` if appropriate.
         */
        havingSize(size4) {
          if (this.size === size4 && this.textSize === size4) {
            return this;
          } else {
            return this.extend({
              style: this.style.text(),
              size: size4,
              textSize: size4,
              sizeMultiplier: sizeMultipliers[size4 - 1]
            });
          }
        }
        /**
         * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,
         * changes to at least `\textstyle`.
         */
        havingBaseStyle(style3) {
          style3 = style3 || this.style.text();
          var wantSize = sizeAtStyle(_Options.BASESIZE, style3);
          if (this.size === wantSize && this.textSize === _Options.BASESIZE && this.style === style3) {
            return this;
          } else {
            return this.extend({
              style: style3,
              size: wantSize
            });
          }
        }
        /**
         * Remove the effect of sizing changes such as \Huge.
         * Keep the effect of the current style, such as \scriptstyle.
         */
        havingBaseSizing() {
          var size4;
          switch (this.style.id) {
            case 4:
            case 5:
              size4 = 3;
              break;
            case 6:
            case 7:
              size4 = 1;
              break;
            default:
              size4 = 6;
          }
          return this.extend({
            style: this.style.text(),
            size: size4
          });
        }
        /**
         * Create a new options object with the given color.
         */
        withColor(color2) {
          return this.extend({
            color: color2
          });
        }
        /**
         * Create a new options object with "phantom" set to true.
         */
        withPhantom() {
          return this.extend({
            phantom: true
          });
        }
        /**
         * Creates a new options object with the given math font or old text font.
         * @type {[type]}
         */
        withFont(font) {
          return this.extend({
            font
          });
        }
        /**
         * Create a new options objects with the given fontFamily.
         */
        withTextFontFamily(fontFamily) {
          return this.extend({
            fontFamily,
            font: ""
          });
        }
        /**
         * Creates a new options object with the given font weight
         */
        withTextFontWeight(fontWeight) {
          return this.extend({
            fontWeight,
            font: ""
          });
        }
        /**
         * Creates a new options object with the given font weight
         */
        withTextFontShape(fontShape) {
          return this.extend({
            fontShape,
            font: ""
          });
        }
        /**
         * Return the CSS sizing classes required to switch from enclosing options
         * `oldOptions` to `this`. Returns an array of classes.
         */
        sizingClasses(oldOptions) {
          if (oldOptions.size !== this.size) {
            return ["sizing", "reset-size" + oldOptions.size, "size" + this.size];
          } else {
            return [];
          }
        }
        /**
         * Return the CSS sizing classes required to switch to the base size. Like
         * `this.havingSize(BASESIZE).sizingClasses(this)`.
         */
        baseSizingClasses() {
          if (this.size !== _Options.BASESIZE) {
            return ["sizing", "reset-size" + this.size, "size" + _Options.BASESIZE];
          } else {
            return [];
          }
        }
        /**
         * Return the font metrics for this size.
         */
        fontMetrics() {
          if (!this._fontMetrics) {
            this._fontMetrics = getGlobalMetrics(this.size);
          }
          return this._fontMetrics;
        }
        /**
         * Gets the CSS color of the current options object
         */
        getColor() {
          if (this.phantom) {
            return "transparent";
          } else {
            return this.color;
          }
        }
      };
      Options.BASESIZE = 6;
      ptPerUnit = {
        // https://en.wikibooks.org/wiki/LaTeX/Lengths and
        // https://tex.stackexchange.com/a/8263
        "pt": 1,
        // TeX point
        "mm": 7227 / 2540,
        // millimeter
        "cm": 7227 / 254,
        // centimeter
        "in": 72.27,
        // inch
        "bp": 803 / 800,
        // big (PostScript) points
        "pc": 12,
        // pica
        "dd": 1238 / 1157,
        // didot
        "cc": 14856 / 1157,
        // cicero (12 didot)
        "nd": 685 / 642,
        // new didot
        "nc": 1370 / 107,
        // new cicero (12 new didot)
        "sp": 1 / 65536,
        // scaled point (TeX's internal smallest unit)
        // https://tex.stackexchange.com/a/41371
        "px": 803 / 800
        // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX
      };
      relativeUnit = {
        "ex": true,
        "em": true,
        "mu": true
      };
      validUnit = /* @__PURE__ */ __name(function validUnit2(unit2) {
        if (typeof unit2 !== "string") {
          unit2 = unit2.unit;
        }
        return unit2 in ptPerUnit || unit2 in relativeUnit || unit2 === "ex";
      }, "validUnit");
      calculateSize2 = /* @__PURE__ */ __name(function calculateSize3(sizeValue, options2) {
        var scale3;
        if (sizeValue.unit in ptPerUnit) {
          scale3 = ptPerUnit[sizeValue.unit] / options2.fontMetrics().ptPerEm / options2.sizeMultiplier;
        } else if (sizeValue.unit === "mu") {
          scale3 = options2.fontMetrics().cssEmPerMu;
        } else {
          var unitOptions;
          if (options2.style.isTight()) {
            unitOptions = options2.havingStyle(options2.style.text());
          } else {
            unitOptions = options2;
          }
          if (sizeValue.unit === "ex") {
            scale3 = unitOptions.fontMetrics().xHeight;
          } else if (sizeValue.unit === "em") {
            scale3 = unitOptions.fontMetrics().quad;
          } else {
            throw new ParseError("Invalid unit: '" + sizeValue.unit + "'");
          }
          if (unitOptions !== options2) {
            scale3 *= unitOptions.sizeMultiplier / options2.sizeMultiplier;
          }
        }
        return Math.min(sizeValue.number * scale3, options2.maxSize);
      }, "calculateSize");
      makeEm = /* @__PURE__ */ __name(function makeEm2(n2) {
        return +n2.toFixed(4) + "em";
      }, "makeEm");
      createClass = /* @__PURE__ */ __name(function createClass2(classes3) {
        return classes3.filter((cls) => cls).join(" ");
      }, "createClass");
      initNode = /* @__PURE__ */ __name(function initNode2(classes3, options2, style3) {
        this.classes = classes3 || [];
        this.attributes = {};
        this.height = 0;
        this.depth = 0;
        this.maxFontSize = 0;
        this.style = style3 || {};
        if (options2) {
          if (options2.style.isTight()) {
            this.classes.push("mtight");
          }
          var color2 = options2.getColor();
          if (color2) {
            this.style.color = color2;
          }
        }
      }, "initNode");
      toNode = /* @__PURE__ */ __name(function toNode2(tagName) {
        var node2 = document.createElement(tagName);
        node2.className = createClass(this.classes);
        for (var style3 in this.style) {
          if (this.style.hasOwnProperty(style3)) {
            node2.style[style3] = this.style[style3];
          }
        }
        for (var attr in this.attributes) {
          if (this.attributes.hasOwnProperty(attr)) {
            node2.setAttribute(attr, this.attributes[attr]);
          }
        }
        for (var i2 = 0; i2 < this.children.length; i2++) {
          node2.appendChild(this.children[i2].toNode());
        }
        return node2;
      }, "toNode");
      invalidAttributeNameRegex = /[\s"'>/=\x00-\x1f]/;
      toMarkup = /* @__PURE__ */ __name(function toMarkup2(tagName) {
        var markup = "<" + tagName;
        if (this.classes.length) {
          markup += ' class="' + utils.escape(createClass(this.classes)) + '"';
        }
        var styles5 = "";
        for (var style3 in this.style) {
          if (this.style.hasOwnProperty(style3)) {
            styles5 += utils.hyphenate(style3) + ":" + this.style[style3] + ";";
          }
        }
        if (styles5) {
          markup += ' style="' + utils.escape(styles5) + '"';
        }
        for (var attr in this.attributes) {
          if (this.attributes.hasOwnProperty(attr)) {
            if (invalidAttributeNameRegex.test(attr)) {
              throw new ParseError("Invalid attribute name '" + attr + "'");
            }
            markup += " " + attr + '="' + utils.escape(this.attributes[attr]) + '"';
          }
        }
        markup += ">";
        for (var i2 = 0; i2 < this.children.length; i2++) {
          markup += this.children[i2].toMarkup();
        }
        markup += "</" + tagName + ">";
        return markup;
      }, "toMarkup");
      Span = class {
        static {
          __name(this, "Span");
        }
        constructor(classes3, children2, options2, style3) {
          this.children = void 0;
          this.attributes = void 0;
          this.classes = void 0;
          this.height = void 0;
          this.depth = void 0;
          this.width = void 0;
          this.maxFontSize = void 0;
          this.style = void 0;
          initNode.call(this, classes3, options2, style3);
          this.children = children2 || [];
        }
        /**
         * Sets an arbitrary attribute on the span. Warning: use this wisely. Not
         * all browsers support attributes the same, and having too many custom
         * attributes is probably bad.
         */
        setAttribute(attribute, value2) {
          this.attributes[attribute] = value2;
        }
        hasClass(className) {
          return this.classes.includes(className);
        }
        toNode() {
          return toNode.call(this, "span");
        }
        toMarkup() {
          return toMarkup.call(this, "span");
        }
      };
      Anchor = class {
        static {
          __name(this, "Anchor");
        }
        constructor(href, classes3, children2, options2) {
          this.children = void 0;
          this.attributes = void 0;
          this.classes = void 0;
          this.height = void 0;
          this.depth = void 0;
          this.maxFontSize = void 0;
          this.style = void 0;
          initNode.call(this, classes3, options2);
          this.children = children2 || [];
          this.setAttribute("href", href);
        }
        setAttribute(attribute, value2) {
          this.attributes[attribute] = value2;
        }
        hasClass(className) {
          return this.classes.includes(className);
        }
        toNode() {
          return toNode.call(this, "a");
        }
        toMarkup() {
          return toMarkup.call(this, "a");
        }
      };
      Img = class {
        static {
          __name(this, "Img");
        }
        constructor(src, alt, style3) {
          this.src = void 0;
          this.alt = void 0;
          this.classes = void 0;
          this.height = void 0;
          this.depth = void 0;
          this.maxFontSize = void 0;
          this.style = void 0;
          this.alt = alt;
          this.src = src;
          this.classes = ["mord"];
          this.style = style3;
        }
        hasClass(className) {
          return this.classes.includes(className);
        }
        toNode() {
          var node2 = document.createElement("img");
          node2.src = this.src;
          node2.alt = this.alt;
          node2.className = "mord";
          for (var style3 in this.style) {
            if (this.style.hasOwnProperty(style3)) {
              node2.style[style3] = this.style[style3];
            }
          }
          return node2;
        }
        toMarkup() {
          var markup = '<img src="' + utils.escape(this.src) + '"' + (' alt="' + utils.escape(this.alt) + '"');
          var styles5 = "";
          for (var style3 in this.style) {
            if (this.style.hasOwnProperty(style3)) {
              styles5 += utils.hyphenate(style3) + ":" + this.style[style3] + ";";
            }
          }
          if (styles5) {
            markup += ' style="' + utils.escape(styles5) + '"';
          }
          markup += "'/>";
          return markup;
        }
      };
      iCombinations = {
        "\xEE": "\u0131\u0302",
        "\xEF": "\u0131\u0308",
        "\xED": "\u0131\u0301",
        // 'ī': '\u0131\u0304', // enable when we add Extended Latin
        "\xEC": "\u0131\u0300"
      };
      SymbolNode = class {
        static {
          __name(this, "SymbolNode");
        }
        constructor(text4, height2, depth, italic, skew, width3, classes3, style3) {
          this.text = void 0;
          this.height = void 0;
          this.depth = void 0;
          this.italic = void 0;
          this.skew = void 0;
          this.width = void 0;
          this.maxFontSize = void 0;
          this.classes = void 0;
          this.style = void 0;
          this.text = text4;
          this.height = height2 || 0;
          this.depth = depth || 0;
          this.italic = italic || 0;
          this.skew = skew || 0;
          this.width = width3 || 0;
          this.classes = classes3 || [];
          this.style = style3 || {};
          this.maxFontSize = 0;
          var script = scriptFromCodepoint(this.text.charCodeAt(0));
          if (script) {
            this.classes.push(script + "_fallback");
          }
          if (/[îïíì]/.test(this.text)) {
            this.text = iCombinations[this.text];
          }
        }
        hasClass(className) {
          return this.classes.includes(className);
        }
        /**
         * Creates a text node or span from a symbol node. Note that a span is only
         * created if it is needed.
         */
        toNode() {
          var node2 = document.createTextNode(this.text);
          var span = null;
          if (this.italic > 0) {
            span = document.createElement("span");
            span.style.marginRight = makeEm(this.italic);
          }
          if (this.classes.length > 0) {
            span = span || document.createElement("span");
            span.className = createClass(this.classes);
          }
          for (var style3 in this.style) {
            if (this.style.hasOwnProperty(style3)) {
              span = span || document.createElement("span");
              span.style[style3] = this.style[style3];
            }
          }
          if (span) {
            span.appendChild(node2);
            return span;
          } else {
            return node2;
          }
        }
        /**
         * Creates markup for a symbol node.
         */
        toMarkup() {
          var needsSpan = false;
          var markup = "<span";
          if (this.classes.length) {
            needsSpan = true;
            markup += ' class="';
            markup += utils.escape(createClass(this.classes));
            markup += '"';
          }
          var styles5 = "";
          if (this.italic > 0) {
            styles5 += "margin-right:" + this.italic + "em;";
          }
          for (var style3 in this.style) {
            if (this.style.hasOwnProperty(style3)) {
              styles5 += utils.hyphenate(style3) + ":" + this.style[style3] + ";";
            }
          }
          if (styles5) {
            needsSpan = true;
            markup += ' style="' + utils.escape(styles5) + '"';
          }
          var escaped = utils.escape(this.text);
          if (needsSpan) {
            markup += ">";
            markup += escaped;
            markup += "</span>";
            return markup;
          } else {
            return escaped;
          }
        }
      };
      SvgNode = class {
        static {
          __name(this, "SvgNode");
        }
        constructor(children2, attributes) {
          this.children = void 0;
          this.attributes = void 0;
          this.children = children2 || [];
          this.attributes = attributes || {};
        }
        toNode() {
          var svgNS = "http://www.w3.org/2000/svg";
          var node2 = document.createElementNS(svgNS, "svg");
          for (var attr in this.attributes) {
            if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
              node2.setAttribute(attr, this.attributes[attr]);
            }
          }
          for (var i2 = 0; i2 < this.children.length; i2++) {
            node2.appendChild(this.children[i2].toNode());
          }
          return node2;
        }
        toMarkup() {
          var markup = '<svg xmlns="http://www.w3.org/2000/svg"';
          for (var attr in this.attributes) {
            if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
              markup += " " + attr + '="' + utils.escape(this.attributes[attr]) + '"';
            }
          }
          markup += ">";
          for (var i2 = 0; i2 < this.children.length; i2++) {
            markup += this.children[i2].toMarkup();
          }
          markup += "</svg>";
          return markup;
        }
      };
      PathNode = class {
        static {
          __name(this, "PathNode");
        }
        constructor(pathName, alternate) {
          this.pathName = void 0;
          this.alternate = void 0;
          this.pathName = pathName;
          this.alternate = alternate;
        }
        toNode() {
          var svgNS = "http://www.w3.org/2000/svg";
          var node2 = document.createElementNS(svgNS, "path");
          if (this.alternate) {
            node2.setAttribute("d", this.alternate);
          } else {
            node2.setAttribute("d", path[this.pathName]);
          }
          return node2;
        }
        toMarkup() {
          if (this.alternate) {
            return '<path d="' + utils.escape(this.alternate) + '"/>';
          } else {
            return '<path d="' + utils.escape(path[this.pathName]) + '"/>';
          }
        }
      };
      LineNode = class {
        static {
          __name(this, "LineNode");
        }
        constructor(attributes) {
          this.attributes = void 0;
          this.attributes = attributes || {};
        }
        toNode() {
          var svgNS = "http://www.w3.org/2000/svg";
          var node2 = document.createElementNS(svgNS, "line");
          for (var attr in this.attributes) {
            if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
              node2.setAttribute(attr, this.attributes[attr]);
            }
          }
          return node2;
        }
        toMarkup() {
          var markup = "<line";
          for (var attr in this.attributes) {
            if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
              markup += " " + attr + '="' + utils.escape(this.attributes[attr]) + '"';
            }
          }
          markup += "/>";
          return markup;
        }
      };
      __name(assertSymbolDomNode, "assertSymbolDomNode");
      __name(assertSpan, "assertSpan");
      ATOMS = {
        "bin": 1,
        "close": 1,
        "inner": 1,
        "open": 1,
        "punct": 1,
        "rel": 1
      };
      NON_ATOMS = {
        "accent-token": 1,
        "mathord": 1,
        "op-token": 1,
        "spacing": 1,
        "textord": 1
      };
      symbols = {
        "math": {},
        "text": {}
      };
      __name(defineSymbol, "defineSymbol");
      math = "math";
      text2 = "text";
      main = "main";
      ams = "ams";
      accent = "accent-token";
      bin = "bin";
      close = "close";
      inner = "inner";
      mathord = "mathord";
      op = "op-token";
      open = "open";
      punct = "punct";
      rel = "rel";
      spacing = "spacing";
      textord = "textord";
      defineSymbol(math, main, rel, "\u2261", "\\equiv", true);
      defineSymbol(math, main, rel, "\u227A", "\\prec", true);
      defineSymbol(math, main, rel, "\u227B", "\\succ", true);
      defineSymbol(math, main, rel, "\u223C", "\\sim", true);
      defineSymbol(math, main, rel, "\u22A5", "\\perp");
      defineSymbol(math, main, rel, "\u2AAF", "\\preceq", true);
      defineSymbol(math, main, rel, "\u2AB0", "\\succeq", true);
      defineSymbol(math, main, rel, "\u2243", "\\simeq", true);
      defineSymbol(math, main, rel, "\u2223", "\\mid", true);
      defineSymbol(math, main, rel, "\u226A", "\\ll", true);
      defineSymbol(math, main, rel, "\u226B", "\\gg", true);
      defineSymbol(math, main, rel, "\u224D", "\\asymp", true);
      defineSymbol(math, main, rel, "\u2225", "\\parallel");
      defineSymbol(math, main, rel, "\u22C8", "\\bowtie", true);
      defineSymbol(math, main, rel, "\u2323", "\\smile", true);
      defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq", true);
      defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq", true);
      defineSymbol(math, main, rel, "\u2250", "\\doteq", true);
      defineSymbol(math, main, rel, "\u2322", "\\frown", true);
      defineSymbol(math, main, rel, "\u220B", "\\ni", true);
      defineSymbol(math, main, rel, "\u221D", "\\propto", true);
      defineSymbol(math, main, rel, "\u22A2", "\\vdash", true);
      defineSymbol(math, main, rel, "\u22A3", "\\dashv", true);
      defineSymbol(math, main, rel, "\u220B", "\\owns");
      defineSymbol(math, main, punct, ".", "\\ldotp");
      defineSymbol(math, main, punct, "\u22C5", "\\cdotp");
      defineSymbol(math, main, textord, "#", "\\#");
      defineSymbol(text2, main, textord, "#", "\\#");
      defineSymbol(math, main, textord, "&", "\\&");
      defineSymbol(text2, main, textord, "&", "\\&");
      defineSymbol(math, main, textord, "\u2135", "\\aleph", true);
      defineSymbol(math, main, textord, "\u2200", "\\forall", true);
      defineSymbol(math, main, textord, "\u210F", "\\hbar", true);
      defineSymbol(math, main, textord, "\u2203", "\\exists", true);
      defineSymbol(math, main, textord, "\u2207", "\\nabla", true);
      defineSymbol(math, main, textord, "\u266D", "\\flat", true);
      defineSymbol(math, main, textord, "\u2113", "\\ell", true);
      defineSymbol(math, main, textord, "\u266E", "\\natural", true);
      defineSymbol(math, main, textord, "\u2663", "\\clubsuit", true);
      defineSymbol(math, main, textord, "\u2118", "\\wp", true);
      defineSymbol(math, main, textord, "\u266F", "\\sharp", true);
      defineSymbol(math, main, textord, "\u2662", "\\diamondsuit", true);
      defineSymbol(math, main, textord, "\u211C", "\\Re", true);
      defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true);
      defineSymbol(math, main, textord, "\u2111", "\\Im", true);
      defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true);
      defineSymbol(math, main, textord, "\xA7", "\\S", true);
      defineSymbol(text2, main, textord, "\xA7", "\\S");
      defineSymbol(math, main, textord, "\xB6", "\\P", true);
      defineSymbol(text2, main, textord, "\xB6", "\\P");
      defineSymbol(math, main, textord, "\u2020", "\\dag");
      defineSymbol(text2, main, textord, "\u2020", "\\dag");
      defineSymbol(text2, main, textord, "\u2020", "\\textdagger");
      defineSymbol(math, main, textord, "\u2021", "\\ddag");
      defineSymbol(text2, main, textord, "\u2021", "\\ddag");
      defineSymbol(text2, main, textord, "\u2021", "\\textdaggerdbl");
      defineSymbol(math, main, close, "\u23B1", "\\rmoustache", true);
      defineSymbol(math, main, open, "\u23B0", "\\lmoustache", true);
      defineSymbol(math, main, close, "\u27EF", "\\rgroup", true);
      defineSymbol(math, main, open, "\u27EE", "\\lgroup", true);
      defineSymbol(math, main, bin, "\u2213", "\\mp", true);
      defineSymbol(math, main, bin, "\u2296", "\\ominus", true);
      defineSymbol(math, main, bin, "\u228E", "\\uplus", true);
      defineSymbol(math, main, bin, "\u2293", "\\sqcap", true);
      defineSymbol(math, main, bin, "\u2217", "\\ast");
      defineSymbol(math, main, bin, "\u2294", "\\sqcup", true);
      defineSymbol(math, main, bin, "\u25EF", "\\bigcirc", true);
      defineSymbol(math, main, bin, "\u2219", "\\bullet", true);
      defineSymbol(math, main, bin, "\u2021", "\\ddagger");
      defineSymbol(math, main, bin, "\u2240", "\\wr", true);
      defineSymbol(math, main, bin, "\u2A3F", "\\amalg");
      defineSymbol(math, main, bin, "&", "\\And");
      defineSymbol(math, main, rel, "\u27F5", "\\longleftarrow", true);
      defineSymbol(math, main, rel, "\u21D0", "\\Leftarrow", true);
      defineSymbol(math, main, rel, "\u27F8", "\\Longleftarrow", true);
      defineSymbol(math, main, rel, "\u27F6", "\\longrightarrow", true);
      defineSymbol(math, main, rel, "\u21D2", "\\Rightarrow", true);
      defineSymbol(math, main, rel, "\u27F9", "\\Longrightarrow", true);
      defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow", true);
      defineSymbol(math, main, rel, "\u27F7", "\\longleftrightarrow", true);
      defineSymbol(math, main, rel, "\u21D4", "\\Leftrightarrow", true);
      defineSymbol(math, main, rel, "\u27FA", "\\Longleftrightarrow", true);
      defineSymbol(math, main, rel, "\u21A6", "\\mapsto", true);
      defineSymbol(math, main, rel, "\u27FC", "\\longmapsto", true);
      defineSymbol(math, main, rel, "\u2197", "\\nearrow", true);
      defineSymbol(math, main, rel, "\u21A9", "\\hookleftarrow", true);
      defineSymbol(math, main, rel, "\u21AA", "\\hookrightarrow", true);
      defineSymbol(math, main, rel, "\u2198", "\\searrow", true);
      defineSymbol(math, main, rel, "\u21BC", "\\leftharpoonup", true);
      defineSymbol(math, main, rel, "\u21C0", "\\rightharpoonup", true);
      defineSymbol(math, main, rel, "\u2199", "\\swarrow", true);
      defineSymbol(math, main, rel, "\u21BD", "\\leftharpoondown", true);
      defineSymbol(math, main, rel, "\u21C1", "\\rightharpoondown", true);
      defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true);
      defineSymbol(math, main, rel, "\u21CC", "\\rightleftharpoons", true);
      defineSymbol(math, ams, rel, "\u226E", "\\nless", true);
      defineSymbol(math, ams, rel, "\uE010", "\\@nleqslant");
      defineSymbol(math, ams, rel, "\uE011", "\\@nleqq");
      defineSymbol(math, ams, rel, "\u2A87", "\\lneq", true);
      defineSymbol(math, ams, rel, "\u2268", "\\lneqq", true);
      defineSymbol(math, ams, rel, "\uE00C", "\\@lvertneqq");
      defineSymbol(math, ams, rel, "\u22E6", "\\lnsim", true);
      defineSymbol(math, ams, rel, "\u2A89", "\\lnapprox", true);
      defineSymbol(math, ams, rel, "\u2280", "\\nprec", true);
      defineSymbol(math, ams, rel, "\u22E0", "\\npreceq", true);
      defineSymbol(math, ams, rel, "\u22E8", "\\precnsim", true);
      defineSymbol(math, ams, rel, "\u2AB9", "\\precnapprox", true);
      defineSymbol(math, ams, rel, "\u2241", "\\nsim", true);
      defineSymbol(math, ams, rel, "\uE006", "\\@nshortmid");
      defineSymbol(math, ams, rel, "\u2224", "\\nmid", true);
      defineSymbol(math, ams, rel, "\u22AC", "\\nvdash", true);
      defineSymbol(math, ams, rel, "\u22AD", "\\nvDash", true);
      defineSymbol(math, ams, rel, "\u22EA", "\\ntriangleleft");
      defineSymbol(math, ams, rel, "\u22EC", "\\ntrianglelefteq", true);
      defineSymbol(math, ams, rel, "\u228A", "\\subsetneq", true);
      defineSymbol(math, ams, rel, "\uE01A", "\\@varsubsetneq");
      defineSymbol(math, ams, rel, "\u2ACB", "\\subsetneqq", true);
      defineSymbol(math, ams, rel, "\uE017", "\\@varsubsetneqq");
      defineSymbol(math, ams, rel, "\u226F", "\\ngtr", true);
      defineSymbol(math, ams, rel, "\uE00F", "\\@ngeqslant");
      defineSymbol(math, ams, rel, "\uE00E", "\\@ngeqq");
      defineSymbol(math, ams, rel, "\u2A88", "\\gneq", true);
      defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true);
      defineSymbol(math, ams, rel, "\uE00D", "\\@gvertneqq");
      defineSymbol(math, ams, rel, "\u22E7", "\\gnsim", true);
      defineSymbol(math, ams, rel, "\u2A8A", "\\gnapprox", true);
      defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true);
      defineSymbol(math, ams, rel, "\u22E1", "\\nsucceq", true);
      defineSymbol(math, ams, rel, "\u22E9", "\\succnsim", true);
      defineSymbol(math, ams, rel, "\u2ABA", "\\succnapprox", true);
      defineSymbol(math, ams, rel, "\u2246", "\\ncong", true);
      defineSymbol(math, ams, rel, "\uE007", "\\@nshortparallel");
      defineSymbol(math, ams, rel, "\u2226", "\\nparallel", true);
      defineSymbol(math, ams, rel, "\u22AF", "\\nVDash", true);
      defineSymbol(math, ams, rel, "\u22EB", "\\ntriangleright");
      defineSymbol(math, ams, rel, "\u22ED", "\\ntrianglerighteq", true);
      defineSymbol(math, ams, rel, "\uE018", "\\@nsupseteqq");
      defineSymbol(math, ams, rel, "\u228B", "\\supsetneq", true);
      defineSymbol(math, ams, rel, "\uE01B", "\\@varsupsetneq");
      defineSymbol(math, ams, rel, "\u2ACC", "\\supsetneqq", true);
      defineSymbol(math, ams, rel, "\uE019", "\\@varsupsetneqq");
      defineSymbol(math, ams, rel, "\u22AE", "\\nVdash", true);
      defineSymbol(math, ams, rel, "\u2AB5", "\\precneqq", true);
      defineSymbol(math, ams, rel, "\u2AB6", "\\succneqq", true);
      defineSymbol(math, ams, rel, "\uE016", "\\@nsubseteqq");
      defineSymbol(math, ams, bin, "\u22B4", "\\unlhd");
      defineSymbol(math, ams, bin, "\u22B5", "\\unrhd");
      defineSymbol(math, ams, rel, "\u219A", "\\nleftarrow", true);
      defineSymbol(math, ams, rel, "\u219B", "\\nrightarrow", true);
      defineSymbol(math, ams, rel, "\u21CD", "\\nLeftarrow", true);
      defineSymbol(math, ams, rel, "\u21CF", "\\nRightarrow", true);
      defineSymbol(math, ams, rel, "\u21AE", "\\nleftrightarrow", true);
      defineSymbol(math, ams, rel, "\u21CE", "\\nLeftrightarrow", true);
      defineSymbol(math, ams, rel, "\u25B3", "\\vartriangle");
      defineSymbol(math, ams, textord, "\u210F", "\\hslash");
      defineSymbol(math, ams, textord, "\u25BD", "\\triangledown");
      defineSymbol(math, ams, textord, "\u25CA", "\\lozenge");
      defineSymbol(math, ams, textord, "\u24C8", "\\circledS");
      defineSymbol(math, ams, textord, "\xAE", "\\circledR");
      defineSymbol(text2, ams, textord, "\xAE", "\\circledR");
      defineSymbol(math, ams, textord, "\u2221", "\\measuredangle", true);
      defineSymbol(math, ams, textord, "\u2204", "\\nexists");
      defineSymbol(math, ams, textord, "\u2127", "\\mho");
      defineSymbol(math, ams, textord, "\u2132", "\\Finv", true);
      defineSymbol(math, ams, textord, "\u2141", "\\Game", true);
      defineSymbol(math, ams, textord, "\u2035", "\\backprime");
      defineSymbol(math, ams, textord, "\u25B2", "\\blacktriangle");
      defineSymbol(math, ams, textord, "\u25BC", "\\blacktriangledown");
      defineSymbol(math, ams, textord, "\u25A0", "\\blacksquare");
      defineSymbol(math, ams, textord, "\u29EB", "\\blacklozenge");
      defineSymbol(math, ams, textord, "\u2605", "\\bigstar");
      defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle", true);
      defineSymbol(math, ams, textord, "\u2201", "\\complement", true);
      defineSymbol(math, ams, textord, "\xF0", "\\eth", true);
      defineSymbol(text2, main, textord, "\xF0", "\xF0");
      defineSymbol(math, ams, textord, "\u2571", "\\diagup");
      defineSymbol(math, ams, textord, "\u2572", "\\diagdown");
      defineSymbol(math, ams, textord, "\u25A1", "\\square");
      defineSymbol(math, ams, textord, "\u25A1", "\\Box");
      defineSymbol(math, ams, textord, "\u25CA", "\\Diamond");
      defineSymbol(math, ams, textord, "\xA5", "\\yen", true);
      defineSymbol(text2, ams, textord, "\xA5", "\\yen", true);
      defineSymbol(math, ams, textord, "\u2713", "\\checkmark", true);
      defineSymbol(text2, ams, textord, "\u2713", "\\checkmark");
      defineSymbol(math, ams, textord, "\u2136", "\\beth", true);
      defineSymbol(math, ams, textord, "\u2138", "\\daleth", true);
      defineSymbol(math, ams, textord, "\u2137", "\\gimel", true);
      defineSymbol(math, ams, textord, "\u03DD", "\\digamma", true);
      defineSymbol(math, ams, textord, "\u03F0", "\\varkappa");
      defineSymbol(math, ams, open, "\u250C", "\\@ulcorner", true);
      defineSymbol(math, ams, close, "\u2510", "\\@urcorner", true);
      defineSymbol(math, ams, open, "\u2514", "\\@llcorner", true);
      defineSymbol(math, ams, close, "\u2518", "\\@lrcorner", true);
      defineSymbol(math, ams, rel, "\u2266", "\\leqq", true);
      defineSymbol(math, ams, rel, "\u2A7D", "\\leqslant", true);
      defineSymbol(math, ams, rel, "\u2A95", "\\eqslantless", true);
      defineSymbol(math, ams, rel, "\u2272", "\\lesssim", true);
      defineSymbol(math, ams, rel, "\u2A85", "\\lessapprox", true);
      defineSymbol(math, ams, rel, "\u224A", "\\approxeq", true);
      defineSymbol(math, ams, bin, "\u22D6", "\\lessdot");
      defineSymbol(math, ams, rel, "\u22D8", "\\lll", true);
      defineSymbol(math, ams, rel, "\u2276", "\\lessgtr", true);
      defineSymbol(math, ams, rel, "\u22DA", "\\lesseqgtr", true);
      defineSymbol(math, ams, rel, "\u2A8B", "\\lesseqqgtr", true);
      defineSymbol(math, ams, rel, "\u2251", "\\doteqdot");
      defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq", true);
      defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq", true);
      defineSymbol(math, ams, rel, "\u223D", "\\backsim", true);
      defineSymbol(math, ams, rel, "\u22CD", "\\backsimeq", true);
      defineSymbol(math, ams, rel, "\u2AC5", "\\subseteqq", true);
      defineSymbol(math, ams, rel, "\u22D0", "\\Subset", true);
      defineSymbol(math, ams, rel, "\u228F", "\\sqsubset", true);
      defineSymbol(math, ams, rel, "\u227C", "\\preccurlyeq", true);
      defineSymbol(math, ams, rel, "\u22DE", "\\curlyeqprec", true);
      defineSymbol(math, ams, rel, "\u227E", "\\precsim", true);
      defineSymbol(math, ams, rel, "\u2AB7", "\\precapprox", true);
      defineSymbol(math, ams, rel, "\u22B2", "\\vartriangleleft");
      defineSymbol(math, ams, rel, "\u22B4", "\\trianglelefteq");
      defineSymbol(math, ams, rel, "\u22A8", "\\vDash", true);
      defineSymbol(math, ams, rel, "\u22AA", "\\Vvdash", true);
      defineSymbol(math, ams, rel, "\u2323", "\\smallsmile");
      defineSymbol(math, ams, rel, "\u2322", "\\smallfrown");
      defineSymbol(math, ams, rel, "\u224F", "\\bumpeq", true);
      defineSymbol(math, ams, rel, "\u224E", "\\Bumpeq", true);
      defineSymbol(math, ams, rel, "\u2267", "\\geqq", true);
      defineSymbol(math, ams, rel, "\u2A7E", "\\geqslant", true);
      defineSymbol(math, ams, rel, "\u2A96", "\\eqslantgtr", true);
      defineSymbol(math, ams, rel, "\u2273", "\\gtrsim", true);
      defineSymbol(math, ams, rel, "\u2A86", "\\gtrapprox", true);
      defineSymbol(math, ams, bin, "\u22D7", "\\gtrdot");
      defineSymbol(math, ams, rel, "\u22D9", "\\ggg", true);
      defineSymbol(math, ams, rel, "\u2277", "\\gtrless", true);
      defineSymbol(math, ams, rel, "\u22DB", "\\gtreqless", true);
      defineSymbol(math, ams, rel, "\u2A8C", "\\gtreqqless", true);
      defineSymbol(math, ams, rel, "\u2256", "\\eqcirc", true);
      defineSymbol(math, ams, rel, "\u2257", "\\circeq", true);
      defineSymbol(math, ams, rel, "\u225C", "\\triangleq", true);
      defineSymbol(math, ams, rel, "\u223C", "\\thicksim");
      defineSymbol(math, ams, rel, "\u2248", "\\thickapprox");
      defineSymbol(math, ams, rel, "\u2AC6", "\\supseteqq", true);
      defineSymbol(math, ams, rel, "\u22D1", "\\Supset", true);
      defineSymbol(math, ams, rel, "\u2290", "\\sqsupset", true);
      defineSymbol(math, ams, rel, "\u227D", "\\succcurlyeq", true);
      defineSymbol(math, ams, rel, "\u22DF", "\\curlyeqsucc", true);
      defineSymbol(math, ams, rel, "\u227F", "\\succsim", true);
      defineSymbol(math, ams, rel, "\u2AB8", "\\succapprox", true);
      defineSymbol(math, ams, rel, "\u22B3", "\\vartriangleright");
      defineSymbol(math, ams, rel, "\u22B5", "\\trianglerighteq");
      defineSymbol(math, ams, rel, "\u22A9", "\\Vdash", true);
      defineSymbol(math, ams, rel, "\u2223", "\\shortmid");
      defineSymbol(math, ams, rel, "\u2225", "\\shortparallel");
      defineSymbol(math, ams, rel, "\u226C", "\\between", true);
      defineSymbol(math, ams, rel, "\u22D4", "\\pitchfork", true);
      defineSymbol(math, ams, rel, "\u221D", "\\varpropto");
      defineSymbol(math, ams, rel, "\u25C0", "\\blacktriangleleft");
      defineSymbol(math, ams, rel, "\u2234", "\\therefore", true);
      defineSymbol(math, ams, rel, "\u220D", "\\backepsilon");
      defineSymbol(math, ams, rel, "\u25B6", "\\blacktriangleright");
      defineSymbol(math, ams, rel, "\u2235", "\\because", true);
      defineSymbol(math, ams, rel, "\u22D8", "\\llless");
      defineSymbol(math, ams, rel, "\u22D9", "\\gggtr");
      defineSymbol(math, ams, bin, "\u22B2", "\\lhd");
      defineSymbol(math, ams, bin, "\u22B3", "\\rhd");
      defineSymbol(math, ams, rel, "\u2242", "\\eqsim", true);
      defineSymbol(math, main, rel, "\u22C8", "\\Join");
      defineSymbol(math, ams, rel, "\u2251", "\\Doteq", true);
      defineSymbol(math, ams, bin, "\u2214", "\\dotplus", true);
      defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus");
      defineSymbol(math, ams, bin, "\u22D2", "\\Cap", true);
      defineSymbol(math, ams, bin, "\u22D3", "\\Cup", true);
      defineSymbol(math, ams, bin, "\u2A5E", "\\doublebarwedge", true);
      defineSymbol(math, ams, bin, "\u229F", "\\boxminus", true);
      defineSymbol(math, ams, bin, "\u229E", "\\boxplus", true);
      defineSymbol(math, ams, bin, "\u22C7", "\\divideontimes", true);
      defineSymbol(math, ams, bin, "\u22C9", "\\ltimes", true);
      defineSymbol(math, ams, bin, "\u22CA", "\\rtimes", true);
      defineSymbol(math, ams, bin, "\u22CB", "\\leftthreetimes", true);
      defineSymbol(math, ams, bin, "\u22CC", "\\rightthreetimes", true);
      defineSymbol(math, ams, bin, "\u22CF", "\\curlywedge", true);
      defineSymbol(math, ams, bin, "\u22CE", "\\curlyvee", true);
      defineSymbol(math, ams, bin, "\u229D", "\\circleddash", true);
      defineSymbol(math, ams, bin, "\u229B", "\\circledast", true);
      defineSymbol(math, ams, bin, "\u22C5", "\\centerdot");
      defineSymbol(math, ams, bin, "\u22BA", "\\intercal", true);
      defineSymbol(math, ams, bin, "\u22D2", "\\doublecap");
      defineSymbol(math, ams, bin, "\u22D3", "\\doublecup");
      defineSymbol(math, ams, bin, "\u22A0", "\\boxtimes", true);
      defineSymbol(math, ams, rel, "\u21E2", "\\dashrightarrow", true);
      defineSymbol(math, ams, rel, "\u21E0", "\\dashleftarrow", true);
      defineSymbol(math, ams, rel, "\u21C7", "\\leftleftarrows", true);
      defineSymbol(math, ams, rel, "\u21C6", "\\leftrightarrows", true);
      defineSymbol(math, ams, rel, "\u21DA", "\\Lleftarrow", true);
      defineSymbol(math, ams, rel, "\u219E", "\\twoheadleftarrow", true);
      defineSymbol(math, ams, rel, "\u21A2", "\\leftarrowtail", true);
      defineSymbol(math, ams, rel, "\u21AB", "\\looparrowleft", true);
      defineSymbol(math, ams, rel, "\u21CB", "\\leftrightharpoons", true);
      defineSymbol(math, ams, rel, "\u21B6", "\\curvearrowleft", true);
      defineSymbol(math, ams, rel, "\u21BA", "\\circlearrowleft", true);
      defineSymbol(math, ams, rel, "\u21B0", "\\Lsh", true);
      defineSymbol(math, ams, rel, "\u21C8", "\\upuparrows", true);
      defineSymbol(math, ams, rel, "\u21BF", "\\upharpoonleft", true);
      defineSymbol(math, ams, rel, "\u21C3", "\\downharpoonleft", true);
      defineSymbol(math, main, rel, "\u22B6", "\\origof", true);
      defineSymbol(math, main, rel, "\u22B7", "\\imageof", true);
      defineSymbol(math, ams, rel, "\u22B8", "\\multimap", true);
      defineSymbol(math, ams, rel, "\u21AD", "\\leftrightsquigarrow", true);
      defineSymbol(math, ams, rel, "\u21C9", "\\rightrightarrows", true);
      defineSymbol(math, ams, rel, "\u21C4", "\\rightleftarrows", true);
      defineSymbol(math, ams, rel, "\u21A0", "\\twoheadrightarrow", true);
      defineSymbol(math, ams, rel, "\u21A3", "\\rightarrowtail", true);
      defineSymbol(math, ams, rel, "\u21AC", "\\looparrowright", true);
      defineSymbol(math, ams, rel, "\u21B7", "\\curvearrowright", true);
      defineSymbol(math, ams, rel, "\u21BB", "\\circlearrowright", true);
      defineSymbol(math, ams, rel, "\u21B1", "\\Rsh", true);
      defineSymbol(math, ams, rel, "\u21CA", "\\downdownarrows", true);
      defineSymbol(math, ams, rel, "\u21BE", "\\upharpoonright", true);
      defineSymbol(math, ams, rel, "\u21C2", "\\downharpoonright", true);
      defineSymbol(math, ams, rel, "\u21DD", "\\rightsquigarrow", true);
      defineSymbol(math, ams, rel, "\u21DD", "\\leadsto");
      defineSymbol(math, ams, rel, "\u21DB", "\\Rrightarrow", true);
      defineSymbol(math, ams, rel, "\u21BE", "\\restriction");
      defineSymbol(math, main, textord, "\u2018", "`");
      defineSymbol(math, main, textord, "$", "\\$");
      defineSymbol(text2, main, textord, "$", "\\$");
      defineSymbol(text2, main, textord, "$", "\\textdollar");
      defineSymbol(math, main, textord, "%", "\\%");
      defineSymbol(text2, main, textord, "%", "\\%");
      defineSymbol(math, main, textord, "_", "\\_");
      defineSymbol(text2, main, textord, "_", "\\_");
      defineSymbol(text2, main, textord, "_", "\\textunderscore");
      defineSymbol(math, main, textord, "\u2220", "\\angle", true);
      defineSymbol(math, main, textord, "\u221E", "\\infty", true);
      defineSymbol(math, main, textord, "\u2032", "\\prime");
      defineSymbol(math, main, textord, "\u25B3", "\\triangle");
      defineSymbol(math, main, textord, "\u0393", "\\Gamma", true);
      defineSymbol(math, main, textord, "\u0394", "\\Delta", true);
      defineSymbol(math, main, textord, "\u0398", "\\Theta", true);
      defineSymbol(math, main, textord, "\u039B", "\\Lambda", true);
      defineSymbol(math, main, textord, "\u039E", "\\Xi", true);
      defineSymbol(math, main, textord, "\u03A0", "\\Pi", true);
      defineSymbol(math, main, textord, "\u03A3", "\\Sigma", true);
      defineSymbol(math, main, textord, "\u03A5", "\\Upsilon", true);
      defineSymbol(math, main, textord, "\u03A6", "\\Phi", true);
      defineSymbol(math, main, textord, "\u03A8", "\\Psi", true);
      defineSymbol(math, main, textord, "\u03A9", "\\Omega", true);
      defineSymbol(math, main, textord, "A", "\u0391");
      defineSymbol(math, main, textord, "B", "\u0392");
      defineSymbol(math, main, textord, "E", "\u0395");
      defineSymbol(math, main, textord, "Z", "\u0396");
      defineSymbol(math, main, textord, "H", "\u0397");
      defineSymbol(math, main, textord, "I", "\u0399");
      defineSymbol(math, main, textord, "K", "\u039A");
      defineSymbol(math, main, textord, "M", "\u039C");
      defineSymbol(math, main, textord, "N", "\u039D");
      defineSymbol(math, main, textord, "O", "\u039F");
      defineSymbol(math, main, textord, "P", "\u03A1");
      defineSymbol(math, main, textord, "T", "\u03A4");
      defineSymbol(math, main, textord, "X", "\u03A7");
      defineSymbol(math, main, textord, "\xAC", "\\neg", true);
      defineSymbol(math, main, textord, "\xAC", "\\lnot");
      defineSymbol(math, main, textord, "\u22A4", "\\top");
      defineSymbol(math, main, textord, "\u22A5", "\\bot");
      defineSymbol(math, main, textord, "\u2205", "\\emptyset");
      defineSymbol(math, ams, textord, "\u2205", "\\varnothing");
      defineSymbol(math, main, mathord, "\u03B1", "\\alpha", true);
      defineSymbol(math, main, mathord, "\u03B2", "\\beta", true);
      defineSymbol(math, main, mathord, "\u03B3", "\\gamma", true);
      defineSymbol(math, main, mathord, "\u03B4", "\\delta", true);
      defineSymbol(math, main, mathord, "\u03F5", "\\epsilon", true);
      defineSymbol(math, main, mathord, "\u03B6", "\\zeta", true);
      defineSymbol(math, main, mathord, "\u03B7", "\\eta", true);
      defineSymbol(math, main, mathord, "\u03B8", "\\theta", true);
      defineSymbol(math, main, mathord, "\u03B9", "\\iota", true);
      defineSymbol(math, main, mathord, "\u03BA", "\\kappa", true);
      defineSymbol(math, main, mathord, "\u03BB", "\\lambda", true);
      defineSymbol(math, main, mathord, "\u03BC", "\\mu", true);
      defineSymbol(math, main, mathord, "\u03BD", "\\nu", true);
      defineSymbol(math, main, mathord, "\u03BE", "\\xi", true);
      defineSymbol(math, main, mathord, "\u03BF", "\\omicron", true);
      defineSymbol(math, main, mathord, "\u03C0", "\\pi", true);
      defineSymbol(math, main, mathord, "\u03C1", "\\rho", true);
      defineSymbol(math, main, mathord, "\u03C3", "\\sigma", true);
      defineSymbol(math, main, mathord, "\u03C4", "\\tau", true);
      defineSymbol(math, main, mathord, "\u03C5", "\\upsilon", true);
      defineSymbol(math, main, mathord, "\u03D5", "\\phi", true);
      defineSymbol(math, main, mathord, "\u03C7", "\\chi", true);
      defineSymbol(math, main, mathord, "\u03C8", "\\psi", true);
      defineSymbol(math, main, mathord, "\u03C9", "\\omega", true);
      defineSymbol(math, main, mathord, "\u03B5", "\\varepsilon", true);
      defineSymbol(math, main, mathord, "\u03D1", "\\vartheta", true);
      defineSymbol(math, main, mathord, "\u03D6", "\\varpi", true);
      defineSymbol(math, main, mathord, "\u03F1", "\\varrho", true);
      defineSymbol(math, main, mathord, "\u03C2", "\\varsigma", true);
      defineSymbol(math, main, mathord, "\u03C6", "\\varphi", true);
      defineSymbol(math, main, bin, "\u2217", "*", true);
      defineSymbol(math, main, bin, "+", "+");
      defineSymbol(math, main, bin, "\u2212", "-", true);
      defineSymbol(math, main, bin, "\u22C5", "\\cdot", true);
      defineSymbol(math, main, bin, "\u2218", "\\circ", true);
      defineSymbol(math, main, bin, "\xF7", "\\div", true);
      defineSymbol(math, main, bin, "\xB1", "\\pm", true);
      defineSymbol(math, main, bin, "\xD7", "\\times", true);
      defineSymbol(math, main, bin, "\u2229", "\\cap", true);
      defineSymbol(math, main, bin, "\u222A", "\\cup", true);
      defineSymbol(math, main, bin, "\u2216", "\\setminus", true);
      defineSymbol(math, main, bin, "\u2227", "\\land");
      defineSymbol(math, main, bin, "\u2228", "\\lor");
      defineSymbol(math, main, bin, "\u2227", "\\wedge", true);
      defineSymbol(math, main, bin, "\u2228", "\\vee", true);
      defineSymbol(math, main, textord, "\u221A", "\\surd");
      defineSymbol(math, main, open, "\u27E8", "\\langle", true);
      defineSymbol(math, main, open, "\u2223", "\\lvert");
      defineSymbol(math, main, open, "\u2225", "\\lVert");
      defineSymbol(math, main, close, "?", "?");
      defineSymbol(math, main, close, "!", "!");
      defineSymbol(math, main, close, "\u27E9", "\\rangle", true);
      defineSymbol(math, main, close, "\u2223", "\\rvert");
      defineSymbol(math, main, close, "\u2225", "\\rVert");
      defineSymbol(math, main, rel, "=", "=");
      defineSymbol(math, main, rel, ":", ":");
      defineSymbol(math, main, rel, "\u2248", "\\approx", true);
      defineSymbol(math, main, rel, "\u2245", "\\cong", true);
      defineSymbol(math, main, rel, "\u2265", "\\ge");
      defineSymbol(math, main, rel, "\u2265", "\\geq", true);
      defineSymbol(math, main, rel, "\u2190", "\\gets");
      defineSymbol(math, main, rel, ">", "\\gt", true);
      defineSymbol(math, main, rel, "\u2208", "\\in", true);
      defineSymbol(math, main, rel, "\uE020", "\\@not");
      defineSymbol(math, main, rel, "\u2282", "\\subset", true);
      defineSymbol(math, main, rel, "\u2283", "\\supset", true);
      defineSymbol(math, main, rel, "\u2286", "\\subseteq", true);
      defineSymbol(math, main, rel, "\u2287", "\\supseteq", true);
      defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true);
      defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true);
      defineSymbol(math, main, rel, "\u22A8", "\\models");
      defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true);
      defineSymbol(math, main, rel, "\u2264", "\\le");
      defineSymbol(math, main, rel, "\u2264", "\\leq", true);
      defineSymbol(math, main, rel, "<", "\\lt", true);
      defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true);
      defineSymbol(math, main, rel, "\u2192", "\\to");
      defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true);
      defineSymbol(math, ams, rel, "\u2270", "\\nleq", true);
      defineSymbol(math, main, spacing, "\xA0", "\\ ");
      defineSymbol(math, main, spacing, "\xA0", "\\space");
      defineSymbol(math, main, spacing, "\xA0", "\\nobreakspace");
      defineSymbol(text2, main, spacing, "\xA0", "\\ ");
      defineSymbol(text2, main, spacing, "\xA0", " ");
      defineSymbol(text2, main, spacing, "\xA0", "\\space");
      defineSymbol(text2, main, spacing, "\xA0", "\\nobreakspace");
      defineSymbol(math, main, spacing, null, "\\nobreak");
      defineSymbol(math, main, spacing, null, "\\allowbreak");
      defineSymbol(math, main, punct, ",", ",");
      defineSymbol(math, main, punct, ";", ";");
      defineSymbol(math, ams, bin, "\u22BC", "\\barwedge", true);
      defineSymbol(math, ams, bin, "\u22BB", "\\veebar", true);
      defineSymbol(math, main, bin, "\u2299", "\\odot", true);
      defineSymbol(math, main, bin, "\u2295", "\\oplus", true);
      defineSymbol(math, main, bin, "\u2297", "\\otimes", true);
      defineSymbol(math, main, textord, "\u2202", "\\partial", true);
      defineSymbol(math, main, bin, "\u2298", "\\oslash", true);
      defineSymbol(math, ams, bin, "\u229A", "\\circledcirc", true);
      defineSymbol(math, ams, bin, "\u22A1", "\\boxdot", true);
      defineSymbol(math, main, bin, "\u25B3", "\\bigtriangleup");
      defineSymbol(math, main, bin, "\u25BD", "\\bigtriangledown");
      defineSymbol(math, main, bin, "\u2020", "\\dagger");
      defineSymbol(math, main, bin, "\u22C4", "\\diamond");
      defineSymbol(math, main, bin, "\u22C6", "\\star");
      defineSymbol(math, main, bin, "\u25C3", "\\triangleleft");
      defineSymbol(math, main, bin, "\u25B9", "\\triangleright");
      defineSymbol(math, main, open, "{", "\\{");
      defineSymbol(text2, main, textord, "{", "\\{");
      defineSymbol(text2, main, textord, "{", "\\textbraceleft");
      defineSymbol(math, main, close, "}", "\\}");
      defineSymbol(text2, main, textord, "}", "\\}");
      defineSymbol(text2, main, textord, "}", "\\textbraceright");
      defineSymbol(math, main, open, "{", "\\lbrace");
      defineSymbol(math, main, close, "}", "\\rbrace");
      defineSymbol(math, main, open, "[", "\\lbrack", true);
      defineSymbol(text2, main, textord, "[", "\\lbrack", true);
      defineSymbol(math, main, close, "]", "\\rbrack", true);
      defineSymbol(text2, main, textord, "]", "\\rbrack", true);
      defineSymbol(math, main, open, "(", "\\lparen", true);
      defineSymbol(math, main, close, ")", "\\rparen", true);
      defineSymbol(text2, main, textord, "<", "\\textless", true);
      defineSymbol(text2, main, textord, ">", "\\textgreater", true);
      defineSymbol(math, main, open, "\u230A", "\\lfloor", true);
      defineSymbol(math, main, close, "\u230B", "\\rfloor", true);
      defineSymbol(math, main, open, "\u2308", "\\lceil", true);
      defineSymbol(math, main, close, "\u2309", "\\rceil", true);
      defineSymbol(math, main, textord, "\\", "\\backslash");
      defineSymbol(math, main, textord, "\u2223", "|");
      defineSymbol(math, main, textord, "\u2223", "\\vert");
      defineSymbol(text2, main, textord, "|", "\\textbar", true);
      defineSymbol(math, main, textord, "\u2225", "\\|");
      defineSymbol(math, main, textord, "\u2225", "\\Vert");
      defineSymbol(text2, main, textord, "\u2225", "\\textbardbl");
      defineSymbol(text2, main, textord, "~", "\\textasciitilde");
      defineSymbol(text2, main, textord, "\\", "\\textbackslash");
      defineSymbol(text2, main, textord, "^", "\\textasciicircum");
      defineSymbol(math, main, rel, "\u2191", "\\uparrow", true);
      defineSymbol(math, main, rel, "\u21D1", "\\Uparrow", true);
      defineSymbol(math, main, rel, "\u2193", "\\downarrow", true);
      defineSymbol(math, main, rel, "\u21D3", "\\Downarrow", true);
      defineSymbol(math, main, rel, "\u2195", "\\updownarrow", true);
      defineSymbol(math, main, rel, "\u21D5", "\\Updownarrow", true);
      defineSymbol(math, main, op, "\u2210", "\\coprod");
      defineSymbol(math, main, op, "\u22C1", "\\bigvee");
      defineSymbol(math, main, op, "\u22C0", "\\bigwedge");
      defineSymbol(math, main, op, "\u2A04", "\\biguplus");
      defineSymbol(math, main, op, "\u22C2", "\\bigcap");
      defineSymbol(math, main, op, "\u22C3", "\\bigcup");
      defineSymbol(math, main, op, "\u222B", "\\int");
      defineSymbol(math, main, op, "\u222B", "\\intop");
      defineSymbol(math, main, op, "\u222C", "\\iint");
      defineSymbol(math, main, op, "\u222D", "\\iiint");
      defineSymbol(math, main, op, "\u220F", "\\prod");
      defineSymbol(math, main, op, "\u2211", "\\sum");
      defineSymbol(math, main, op, "\u2A02", "\\bigotimes");
      defineSymbol(math, main, op, "\u2A01", "\\bigoplus");
      defineSymbol(math, main, op, "\u2A00", "\\bigodot");
      defineSymbol(math, main, op, "\u222E", "\\oint");
      defineSymbol(math, main, op, "\u222F", "\\oiint");
      defineSymbol(math, main, op, "\u2230", "\\oiiint");
      defineSymbol(math, main, op, "\u2A06", "\\bigsqcup");
      defineSymbol(math, main, op, "\u222B", "\\smallint");
      defineSymbol(text2, main, inner, "\u2026", "\\textellipsis");
      defineSymbol(math, main, inner, "\u2026", "\\mathellipsis");
      defineSymbol(text2, main, inner, "\u2026", "\\ldots", true);
      defineSymbol(math, main, inner, "\u2026", "\\ldots", true);
      defineSymbol(math, main, inner, "\u22EF", "\\@cdots", true);
      defineSymbol(math, main, inner, "\u22F1", "\\ddots", true);
      defineSymbol(math, main, textord, "\u22EE", "\\varvdots");
      defineSymbol(text2, main, textord, "\u22EE", "\\varvdots");
      defineSymbol(math, main, accent, "\u02CA", "\\acute");
      defineSymbol(math, main, accent, "\u02CB", "\\grave");
      defineSymbol(math, main, accent, "\xA8", "\\ddot");
      defineSymbol(math, main, accent, "~", "\\tilde");
      defineSymbol(math, main, accent, "\u02C9", "\\bar");
      defineSymbol(math, main, accent, "\u02D8", "\\breve");
      defineSymbol(math, main, accent, "\u02C7", "\\check");
      defineSymbol(math, main, accent, "^", "\\hat");
      defineSymbol(math, main, accent, "\u20D7", "\\vec");
      defineSymbol(math, main, accent, "\u02D9", "\\dot");
      defineSymbol(math, main, accent, "\u02DA", "\\mathring");
      defineSymbol(math, main, mathord, "\uE131", "\\@imath");
      defineSymbol(math, main, mathord, "\uE237", "\\@jmath");
      defineSymbol(math, main, textord, "\u0131", "\u0131");
      defineSymbol(math, main, textord, "\u0237", "\u0237");
      defineSymbol(text2, main, textord, "\u0131", "\\i", true);
      defineSymbol(text2, main, textord, "\u0237", "\\j", true);
      defineSymbol(text2, main, textord, "\xDF", "\\ss", true);
      defineSymbol(text2, main, textord, "\xE6", "\\ae", true);
      defineSymbol(text2, main, textord, "\u0153", "\\oe", true);
      defineSymbol(text2, main, textord, "\xF8", "\\o", true);
      defineSymbol(text2, main, textord, "\xC6", "\\AE", true);
      defineSymbol(text2, main, textord, "\u0152", "\\OE", true);
      defineSymbol(text2, main, textord, "\xD8", "\\O", true);
      defineSymbol(text2, main, accent, "\u02CA", "\\'");
      defineSymbol(text2, main, accent, "\u02CB", "\\`");
      defineSymbol(text2, main, accent, "\u02C6", "\\^");
      defineSymbol(text2, main, accent, "\u02DC", "\\~");
      defineSymbol(text2, main, accent, "\u02C9", "\\=");
      defineSymbol(text2, main, accent, "\u02D8", "\\u");
      defineSymbol(text2, main, accent, "\u02D9", "\\.");
      defineSymbol(text2, main, accent, "\xB8", "\\c");
      defineSymbol(text2, main, accent, "\u02DA", "\\r");
      defineSymbol(text2, main, accent, "\u02C7", "\\v");
      defineSymbol(text2, main, accent, "\xA8", '\\"');
      defineSymbol(text2, main, accent, "\u02DD", "\\H");
      defineSymbol(text2, main, accent, "\u25EF", "\\textcircled");
      ligatures = {
        "--": true,
        "---": true,
        "``": true,
        "''": true
      };
      defineSymbol(text2, main, textord, "\u2013", "--", true);
      defineSymbol(text2, main, textord, "\u2013", "\\textendash");
      defineSymbol(text2, main, textord, "\u2014", "---", true);
      defineSymbol(text2, main, textord, "\u2014", "\\textemdash");
      defineSymbol(text2, main, textord, "\u2018", "`", true);
      defineSymbol(text2, main, textord, "\u2018", "\\textquoteleft");
      defineSymbol(text2, main, textord, "\u2019", "'", true);
      defineSymbol(text2, main, textord, "\u2019", "\\textquoteright");
      defineSymbol(text2, main, textord, "\u201C", "``", true);
      defineSymbol(text2, main, textord, "\u201C", "\\textquotedblleft");
      defineSymbol(text2, main, textord, "\u201D", "''", true);
      defineSymbol(text2, main, textord, "\u201D", "\\textquotedblright");
      defineSymbol(math, main, textord, "\xB0", "\\degree", true);
      defineSymbol(text2, main, textord, "\xB0", "\\degree");
      defineSymbol(text2, main, textord, "\xB0", "\\textdegree", true);
      defineSymbol(math, main, textord, "\xA3", "\\pounds");
      defineSymbol(math, main, textord, "\xA3", "\\mathsterling", true);
      defineSymbol(text2, main, textord, "\xA3", "\\pounds");
      defineSymbol(text2, main, textord, "\xA3", "\\textsterling", true);
      defineSymbol(math, ams, textord, "\u2720", "\\maltese");
      defineSymbol(text2, ams, textord, "\u2720", "\\maltese");
      mathTextSymbols = '0123456789/@."';
      for (i2 = 0; i2 < mathTextSymbols.length; i2++) {
        ch = mathTextSymbols.charAt(i2);
        defineSymbol(math, main, textord, ch, ch);
      }
      textSymbols = '0123456789!@*()-=+";:?/.,';
      for (_i = 0; _i < textSymbols.length; _i++) {
        _ch = textSymbols.charAt(_i);
        defineSymbol(text2, main, textord, _ch, _ch);
      }
      letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
      for (_i2 = 0; _i2 < letters.length; _i2++) {
        _ch2 = letters.charAt(_i2);
        defineSymbol(math, main, mathord, _ch2, _ch2);
        defineSymbol(text2, main, textord, _ch2, _ch2);
      }
      defineSymbol(math, ams, textord, "C", "\u2102");
      defineSymbol(text2, ams, textord, "C", "\u2102");
      defineSymbol(math, ams, textord, "H", "\u210D");
      defineSymbol(text2, ams, textord, "H", "\u210D");
      defineSymbol(math, ams, textord, "N", "\u2115");
      defineSymbol(text2, ams, textord, "N", "\u2115");
      defineSymbol(math, ams, textord, "P", "\u2119");
      defineSymbol(text2, ams, textord, "P", "\u2119");
      defineSymbol(math, ams, textord, "Q", "\u211A");
      defineSymbol(text2, ams, textord, "Q", "\u211A");
      defineSymbol(math, ams, textord, "R", "\u211D");
      defineSymbol(text2, ams, textord, "R", "\u211D");
      defineSymbol(math, ams, textord, "Z", "\u2124");
      defineSymbol(text2, ams, textord, "Z", "\u2124");
      defineSymbol(math, main, mathord, "h", "\u210E");
      defineSymbol(text2, main, mathord, "h", "\u210E");
      wideChar = "";
      for (_i3 = 0; _i3 < letters.length; _i3++) {
        _ch3 = letters.charAt(_i3);
        wideChar = String.fromCharCode(55349, 56320 + _i3);
        defineSymbol(math, main, mathord, _ch3, wideChar);
        defineSymbol(text2, main, textord, _ch3, wideChar);
        wideChar = String.fromCharCode(55349, 56372 + _i3);
        defineSymbol(math, main, mathord, _ch3, wideChar);
        defineSymbol(text2, main, textord, _ch3, wideChar);
        wideChar = String.fromCharCode(55349, 56424 + _i3);
        defineSymbol(math, main, mathord, _ch3, wideChar);
        defineSymbol(text2, main, textord, _ch3, wideChar);
        wideChar = String.fromCharCode(55349, 56580 + _i3);
        defineSymbol(math, main, mathord, _ch3, wideChar);
        defineSymbol(text2, main, textord, _ch3, wideChar);
        wideChar = String.fromCharCode(55349, 56684 + _i3);
        defineSymbol(math, main, mathord, _ch3, wideChar);
        defineSymbol(text2, main, textord, _ch3, wideChar);
        wideChar = String.fromCharCode(55349, 56736 + _i3);
        defineSymbol(math, main, mathord, _ch3, wideChar);
        defineSymbol(text2, main, textord, _ch3, wideChar);
        wideChar = String.fromCharCode(55349, 56788 + _i3);
        defineSymbol(math, main, mathord, _ch3, wideChar);
        defineSymbol(text2, main, textord, _ch3, wideChar);
        wideChar = String.fromCharCode(55349, 56840 + _i3);
        defineSymbol(math, main, mathord, _ch3, wideChar);
        defineSymbol(text2, main, textord, _ch3, wideChar);
        wideChar = String.fromCharCode(55349, 56944 + _i3);
        defineSymbol(math, main, mathord, _ch3, wideChar);
        defineSymbol(text2, main, textord, _ch3, wideChar);
        if (_i3 < 26) {
          wideChar = String.fromCharCode(55349, 56632 + _i3);
          defineSymbol(math, main, mathord, _ch3, wideChar);
          defineSymbol(text2, main, textord, _ch3, wideChar);
          wideChar = String.fromCharCode(55349, 56476 + _i3);
          defineSymbol(math, main, mathord, _ch3, wideChar);
          defineSymbol(text2, main, textord, _ch3, wideChar);
        }
      }
      wideChar = String.fromCharCode(55349, 56668);
      defineSymbol(math, main, mathord, "k", wideChar);
      defineSymbol(text2, main, textord, "k", wideChar);
      for (_i4 = 0; _i4 < 10; _i4++) {
        _ch4 = _i4.toString();
        wideChar = String.fromCharCode(55349, 57294 + _i4);
        defineSymbol(math, main, mathord, _ch4, wideChar);
        defineSymbol(text2, main, textord, _ch4, wideChar);
        wideChar = String.fromCharCode(55349, 57314 + _i4);
        defineSymbol(math, main, mathord, _ch4, wideChar);
        defineSymbol(text2, main, textord, _ch4, wideChar);
        wideChar = String.fromCharCode(55349, 57324 + _i4);
        defineSymbol(math, main, mathord, _ch4, wideChar);
        defineSymbol(text2, main, textord, _ch4, wideChar);
        wideChar = String.fromCharCode(55349, 57334 + _i4);
        defineSymbol(math, main, mathord, _ch4, wideChar);
        defineSymbol(text2, main, textord, _ch4, wideChar);
      }
      extraLatin = "\xD0\xDE\xFE";
      for (_i5 = 0; _i5 < extraLatin.length; _i5++) {
        _ch5 = extraLatin.charAt(_i5);
        defineSymbol(math, main, mathord, _ch5, _ch5);
        defineSymbol(text2, main, textord, _ch5, _ch5);
      }
      wideLatinLetterData = [
        ["mathbf", "textbf", "Main-Bold"],
        // A-Z bold upright
        ["mathbf", "textbf", "Main-Bold"],
        // a-z bold upright
        ["mathnormal", "textit", "Math-Italic"],
        // A-Z italic
        ["mathnormal", "textit", "Math-Italic"],
        // a-z italic
        ["boldsymbol", "boldsymbol", "Main-BoldItalic"],
        // A-Z bold italic
        ["boldsymbol", "boldsymbol", "Main-BoldItalic"],
        // a-z bold italic
        // Map fancy A-Z letters to script, not calligraphic.
        // This aligns with unicode-math and math fonts (except Cambria Math).
        ["mathscr", "textscr", "Script-Regular"],
        // A-Z script
        ["", "", ""],
        // a-z script.  No font
        ["", "", ""],
        // A-Z bold script. No font
        ["", "", ""],
        // a-z bold script. No font
        ["mathfrak", "textfrak", "Fraktur-Regular"],
        // A-Z Fraktur
        ["mathfrak", "textfrak", "Fraktur-Regular"],
        // a-z Fraktur
        ["mathbb", "textbb", "AMS-Regular"],
        // A-Z double-struck
        ["mathbb", "textbb", "AMS-Regular"],
        // k double-struck
        // Note that we are using a bold font, but font metrics for regular Fraktur.
        ["mathboldfrak", "textboldfrak", "Fraktur-Regular"],
        // A-Z bold Fraktur
        ["mathboldfrak", "textboldfrak", "Fraktur-Regular"],
        // a-z bold Fraktur
        ["mathsf", "textsf", "SansSerif-Regular"],
        // A-Z sans-serif
        ["mathsf", "textsf", "SansSerif-Regular"],
        // a-z sans-serif
        ["mathboldsf", "textboldsf", "SansSerif-Bold"],
        // A-Z bold sans-serif
        ["mathboldsf", "textboldsf", "SansSerif-Bold"],
        // a-z bold sans-serif
        ["mathitsf", "textitsf", "SansSerif-Italic"],
        // A-Z italic sans-serif
        ["mathitsf", "textitsf", "SansSerif-Italic"],
        // a-z italic sans-serif
        ["", "", ""],
        // A-Z bold italic sans. No font
        ["", "", ""],
        // a-z bold italic sans. No font
        ["mathtt", "texttt", "Typewriter-Regular"],
        // A-Z monospace
        ["mathtt", "texttt", "Typewriter-Regular"]
        // a-z monospace
      ];
      wideNumeralData = [
        ["mathbf", "textbf", "Main-Bold"],
        // 0-9 bold
        ["", "", ""],
        // 0-9 double-struck. No KaTeX font.
        ["mathsf", "textsf", "SansSerif-Regular"],
        // 0-9 sans-serif
        ["mathboldsf", "textboldsf", "SansSerif-Bold"],
        // 0-9 bold sans-serif
        ["mathtt", "texttt", "Typewriter-Regular"]
        // 0-9 monospace
      ];
      wideCharacterFont = /* @__PURE__ */ __name(function wideCharacterFont2(wideChar2, mode) {
        var H2 = wideChar2.charCodeAt(0);
        var L3 = wideChar2.charCodeAt(1);
        var codePoint = (H2 - 55296) * 1024 + (L3 - 56320) + 65536;
        var j3 = mode === "math" ? 0 : 1;
        if (119808 <= codePoint && codePoint < 120484) {
          var i2 = Math.floor((codePoint - 119808) / 26);
          return [wideLatinLetterData[i2][2], wideLatinLetterData[i2][j3]];
        } else if (120782 <= codePoint && codePoint <= 120831) {
          var _i = Math.floor((codePoint - 120782) / 10);
          return [wideNumeralData[_i][2], wideNumeralData[_i][j3]];
        } else if (codePoint === 120485 || codePoint === 120486) {
          return [wideLatinLetterData[0][2], wideLatinLetterData[0][j3]];
        } else if (120486 < codePoint && codePoint < 120782) {
          return ["", ""];
        } else {
          throw new ParseError("Unsupported character: " + wideChar2);
        }
      }, "wideCharacterFont");
      lookupSymbol = /* @__PURE__ */ __name(function lookupSymbol2(value2, fontName, mode) {
        if (symbols[mode][value2] && symbols[mode][value2].replace) {
          value2 = symbols[mode][value2].replace;
        }
        return {
          value: value2,
          metrics: getCharacterMetrics(value2, fontName, mode)
        };
      }, "lookupSymbol");
      makeSymbol = /* @__PURE__ */ __name(function makeSymbol2(value2, fontName, mode, options2, classes3) {
        var lookup2 = lookupSymbol(value2, fontName, mode);
        var metrics = lookup2.metrics;
        value2 = lookup2.value;
        var symbolNode;
        if (metrics) {
          var italic = metrics.italic;
          if (mode === "text" || options2 && options2.font === "mathit") {
            italic = 0;
          }
          symbolNode = new SymbolNode(value2, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes3);
        } else {
          typeof console !== "undefined" && console.warn("No character metrics " + ("for '" + value2 + "' in style '" + fontName + "' and mode '" + mode + "'"));
          symbolNode = new SymbolNode(value2, 0, 0, 0, 0, 0, classes3);
        }
        if (options2) {
          symbolNode.maxFontSize = options2.sizeMultiplier;
          if (options2.style.isTight()) {
            symbolNode.classes.push("mtight");
          }
          var color2 = options2.getColor();
          if (color2) {
            symbolNode.style.color = color2;
          }
        }
        return symbolNode;
      }, "makeSymbol");
      mathsym = /* @__PURE__ */ __name(function mathsym2(value2, mode, options2, classes3) {
        if (classes3 === void 0) {
          classes3 = [];
        }
        if (options2.font === "boldsymbol" && lookupSymbol(value2, "Main-Bold", mode).metrics) {
          return makeSymbol(value2, "Main-Bold", mode, options2, classes3.concat(["mathbf"]));
        } else if (value2 === "\\" || symbols[mode][value2].font === "main") {
          return makeSymbol(value2, "Main-Regular", mode, options2, classes3);
        } else {
          return makeSymbol(value2, "AMS-Regular", mode, options2, classes3.concat(["amsrm"]));
        }
      }, "mathsym");
      boldsymbol = /* @__PURE__ */ __name(function boldsymbol2(value2, mode, options2, classes3, type3) {
        if (type3 !== "textord" && lookupSymbol(value2, "Math-BoldItalic", mode).metrics) {
          return {
            fontName: "Math-BoldItalic",
            fontClass: "boldsymbol"
          };
        } else {
          return {
            fontName: "Main-Bold",
            fontClass: "mathbf"
          };
        }
      }, "boldsymbol");
      makeOrd = /* @__PURE__ */ __name(function makeOrd2(group2, options2, type3) {
        var mode = group2.mode;
        var text4 = group2.text;
        var classes3 = ["mord"];
        var isFont = mode === "math" || mode === "text" && options2.font;
        var fontOrFamily = isFont ? options2.font : options2.fontFamily;
        var wideFontName = "";
        var wideFontClass = "";
        if (text4.charCodeAt(0) === 55349) {
          [wideFontName, wideFontClass] = wideCharacterFont(text4, mode);
        }
        if (wideFontName.length > 0) {
          return makeSymbol(text4, wideFontName, mode, options2, classes3.concat(wideFontClass));
        } else if (fontOrFamily) {
          var fontName;
          var fontClasses;
          if (fontOrFamily === "boldsymbol") {
            var fontData = boldsymbol(text4, mode, options2, classes3, type3);
            fontName = fontData.fontName;
            fontClasses = [fontData.fontClass];
          } else if (isFont) {
            fontName = fontMap[fontOrFamily].fontName;
            fontClasses = [fontOrFamily];
          } else {
            fontName = retrieveTextFontName(fontOrFamily, options2.fontWeight, options2.fontShape);
            fontClasses = [fontOrFamily, options2.fontWeight, options2.fontShape];
          }
          if (lookupSymbol(text4, fontName, mode).metrics) {
            return makeSymbol(text4, fontName, mode, options2, classes3.concat(fontClasses));
          } else if (ligatures.hasOwnProperty(text4) && fontName.slice(0, 10) === "Typewriter") {
            var parts = [];
            for (var i2 = 0; i2 < text4.length; i2++) {
              parts.push(makeSymbol(text4[i2], fontName, mode, options2, classes3.concat(fontClasses)));
            }
            return makeFragment(parts);
          }
        }
        if (type3 === "mathord") {
          return makeSymbol(text4, "Math-Italic", mode, options2, classes3.concat(["mathnormal"]));
        } else if (type3 === "textord") {
          var font = symbols[mode][text4] && symbols[mode][text4].font;
          if (font === "ams") {
            var _fontName = retrieveTextFontName("amsrm", options2.fontWeight, options2.fontShape);
            return makeSymbol(text4, _fontName, mode, options2, classes3.concat("amsrm", options2.fontWeight, options2.fontShape));
          } else if (font === "main" || !font) {
            var _fontName2 = retrieveTextFontName("textrm", options2.fontWeight, options2.fontShape);
            return makeSymbol(text4, _fontName2, mode, options2, classes3.concat(options2.fontWeight, options2.fontShape));
          } else {
            var _fontName3 = retrieveTextFontName(font, options2.fontWeight, options2.fontShape);
            return makeSymbol(text4, _fontName3, mode, options2, classes3.concat(_fontName3, options2.fontWeight, options2.fontShape));
          }
        } else {
          throw new Error("unexpected type: " + type3 + " in makeOrd");
        }
      }, "makeOrd");
      canCombine = /* @__PURE__ */ __name((prev2, next3) => {
        if (createClass(prev2.classes) !== createClass(next3.classes) || prev2.skew !== next3.skew || prev2.maxFontSize !== next3.maxFontSize) {
          return false;
        }
        if (prev2.classes.length === 1) {
          var cls = prev2.classes[0];
          if (cls === "mbin" || cls === "mord") {
            return false;
          }
        }
        for (var style3 in prev2.style) {
          if (prev2.style.hasOwnProperty(style3) && prev2.style[style3] !== next3.style[style3]) {
            return false;
          }
        }
        for (var _style in next3.style) {
          if (next3.style.hasOwnProperty(_style) && prev2.style[_style] !== next3.style[_style]) {
            return false;
          }
        }
        return true;
      }, "canCombine");
      tryCombineChars = /* @__PURE__ */ __name((chars) => {
        for (var i2 = 0; i2 < chars.length - 1; i2++) {
          var prev2 = chars[i2];
          var next3 = chars[i2 + 1];
          if (prev2 instanceof SymbolNode && next3 instanceof SymbolNode && canCombine(prev2, next3)) {
            prev2.text += next3.text;
            prev2.height = Math.max(prev2.height, next3.height);
            prev2.depth = Math.max(prev2.depth, next3.depth);
            prev2.italic = next3.italic;
            chars.splice(i2 + 1, 1);
            i2--;
          }
        }
        return chars;
      }, "tryCombineChars");
      sizeElementFromChildren = /* @__PURE__ */ __name(function sizeElementFromChildren2(elem) {
        var height2 = 0;
        var depth = 0;
        var maxFontSize = 0;
        for (var i2 = 0; i2 < elem.children.length; i2++) {
          var child = elem.children[i2];
          if (child.height > height2) {
            height2 = child.height;
          }
          if (child.depth > depth) {
            depth = child.depth;
          }
          if (child.maxFontSize > maxFontSize) {
            maxFontSize = child.maxFontSize;
          }
        }
        elem.height = height2;
        elem.depth = depth;
        elem.maxFontSize = maxFontSize;
      }, "sizeElementFromChildren");
      makeSpan$2 = /* @__PURE__ */ __name(function makeSpan(classes3, children2, options2, style3) {
        var span = new Span(classes3, children2, options2, style3);
        sizeElementFromChildren(span);
        return span;
      }, "makeSpan");
      makeSvgSpan = /* @__PURE__ */ __name((classes3, children2, options2, style3) => new Span(classes3, children2, options2, style3), "makeSvgSpan");
      makeLineSpan = /* @__PURE__ */ __name(function makeLineSpan2(className, options2, thickness) {
        var line2 = makeSpan$2([className], [], options2);
        line2.height = Math.max(thickness || options2.fontMetrics().defaultRuleThickness, options2.minRuleThickness);
        line2.style.borderBottomWidth = makeEm(line2.height);
        line2.maxFontSize = 1;
        return line2;
      }, "makeLineSpan");
      makeAnchor = /* @__PURE__ */ __name(function makeAnchor2(href, classes3, children2, options2) {
        var anchor2 = new Anchor(href, classes3, children2, options2);
        sizeElementFromChildren(anchor2);
        return anchor2;
      }, "makeAnchor");
      makeFragment = /* @__PURE__ */ __name(function makeFragment2(children2) {
        var fragment = new DocumentFragment(children2);
        sizeElementFromChildren(fragment);
        return fragment;
      }, "makeFragment");
      wrapFragment = /* @__PURE__ */ __name(function wrapFragment2(group2, options2) {
        if (group2 instanceof DocumentFragment) {
          return makeSpan$2([], [group2], options2);
        }
        return group2;
      }, "wrapFragment");
      getVListChildrenAndDepth = /* @__PURE__ */ __name(function getVListChildrenAndDepth2(params) {
        if (params.positionType === "individualShift") {
          var oldChildren = params.children;
          var children2 = [oldChildren[0]];
          var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth;
          var currPos = _depth;
          for (var i2 = 1; i2 < oldChildren.length; i2++) {
            var diff2 = -oldChildren[i2].shift - currPos - oldChildren[i2].elem.depth;
            var size4 = diff2 - (oldChildren[i2 - 1].elem.height + oldChildren[i2 - 1].elem.depth);
            currPos = currPos + diff2;
            children2.push({
              type: "kern",
              size: size4
            });
            children2.push(oldChildren[i2]);
          }
          return {
            children: children2,
            depth: _depth
          };
        }
        var depth;
        if (params.positionType === "top") {
          var bottom2 = params.positionData;
          for (var _i = 0; _i < params.children.length; _i++) {
            var child = params.children[_i];
            bottom2 -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth;
          }
          depth = bottom2;
        } else if (params.positionType === "bottom") {
          depth = -params.positionData;
        } else {
          var firstChild = params.children[0];
          if (firstChild.type !== "elem") {
            throw new Error('First child must have type "elem".');
          }
          if (params.positionType === "shift") {
            depth = -firstChild.elem.depth - params.positionData;
          } else if (params.positionType === "firstBaseline") {
            depth = -firstChild.elem.depth;
          } else {
            throw new Error("Invalid positionType " + params.positionType + ".");
          }
        }
        return {
          children: params.children,
          depth
        };
      }, "getVListChildrenAndDepth");
      makeVList = /* @__PURE__ */ __name(function makeVList2(params, options2) {
        var {
          children: children2,
          depth
        } = getVListChildrenAndDepth(params);
        var pstrutSize = 0;
        for (var i2 = 0; i2 < children2.length; i2++) {
          var child = children2[i2];
          if (child.type === "elem") {
            var elem = child.elem;
            pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height);
          }
        }
        pstrutSize += 2;
        var pstrut = makeSpan$2(["pstrut"], []);
        pstrut.style.height = makeEm(pstrutSize);
        var realChildren = [];
        var minPos = depth;
        var maxPos2 = depth;
        var currPos = depth;
        for (var _i2 = 0; _i2 < children2.length; _i2++) {
          var _child = children2[_i2];
          if (_child.type === "kern") {
            currPos += _child.size;
          } else {
            var _elem = _child.elem;
            var classes3 = _child.wrapperClasses || [];
            var style3 = _child.wrapperStyle || {};
            var childWrap = makeSpan$2(classes3, [pstrut, _elem], void 0, style3);
            childWrap.style.top = makeEm(-pstrutSize - currPos - _elem.depth);
            if (_child.marginLeft) {
              childWrap.style.marginLeft = _child.marginLeft;
            }
            if (_child.marginRight) {
              childWrap.style.marginRight = _child.marginRight;
            }
            realChildren.push(childWrap);
            currPos += _elem.height + _elem.depth;
          }
          minPos = Math.min(minPos, currPos);
          maxPos2 = Math.max(maxPos2, currPos);
        }
        var vlist = makeSpan$2(["vlist"], realChildren);
        vlist.style.height = makeEm(maxPos2);
        var rows;
        if (minPos < 0) {
          var emptySpan = makeSpan$2([], []);
          var depthStrut = makeSpan$2(["vlist"], [emptySpan]);
          depthStrut.style.height = makeEm(-minPos);
          var topStrut = makeSpan$2(["vlist-s"], [new SymbolNode("\u200B")]);
          rows = [makeSpan$2(["vlist-r"], [vlist, topStrut]), makeSpan$2(["vlist-r"], [depthStrut])];
        } else {
          rows = [makeSpan$2(["vlist-r"], [vlist])];
        }
        var vtable = makeSpan$2(["vlist-t"], rows);
        if (rows.length === 2) {
          vtable.classes.push("vlist-t2");
        }
        vtable.height = maxPos2;
        vtable.depth = -minPos;
        return vtable;
      }, "makeVList");
      makeGlue = /* @__PURE__ */ __name((measurement, options2) => {
        var rule = makeSpan$2(["mspace"], [], options2);
        var size4 = calculateSize2(measurement, options2);
        rule.style.marginRight = makeEm(size4);
        return rule;
      }, "makeGlue");
      retrieveTextFontName = /* @__PURE__ */ __name(function retrieveTextFontName2(fontFamily, fontWeight, fontShape) {
        var baseFontName = "";
        switch (fontFamily) {
          case "amsrm":
            baseFontName = "AMS";
            break;
          case "textrm":
            baseFontName = "Main";
            break;
          case "textsf":
            baseFontName = "SansSerif";
            break;
          case "texttt":
            baseFontName = "Typewriter";
            break;
          default:
            baseFontName = fontFamily;
        }
        var fontStylesName;
        if (fontWeight === "textbf" && fontShape === "textit") {
          fontStylesName = "BoldItalic";
        } else if (fontWeight === "textbf") {
          fontStylesName = "Bold";
        } else if (fontWeight === "textit") {
          fontStylesName = "Italic";
        } else {
          fontStylesName = "Regular";
        }
        return baseFontName + "-" + fontStylesName;
      }, "retrieveTextFontName");
      fontMap = {
        // styles
        "mathbf": {
          variant: "bold",
          fontName: "Main-Bold"
        },
        "mathrm": {
          variant: "normal",
          fontName: "Main-Regular"
        },
        "textit": {
          variant: "italic",
          fontName: "Main-Italic"
        },
        "mathit": {
          variant: "italic",
          fontName: "Main-Italic"
        },
        "mathnormal": {
          variant: "italic",
          fontName: "Math-Italic"
        },
        "mathsfit": {
          variant: "sans-serif-italic",
          fontName: "SansSerif-Italic"
        },
        // "boldsymbol" is missing because they require the use of multiple fonts:
        // Math-BoldItalic and Main-Bold.  This is handled by a special case in
        // makeOrd which ends up calling boldsymbol.
        // families
        "mathbb": {
          variant: "double-struck",
          fontName: "AMS-Regular"
        },
        "mathcal": {
          variant: "script",
          fontName: "Caligraphic-Regular"
        },
        "mathfrak": {
          variant: "fraktur",
          fontName: "Fraktur-Regular"
        },
        "mathscr": {
          variant: "script",
          fontName: "Script-Regular"
        },
        "mathsf": {
          variant: "sans-serif",
          fontName: "SansSerif-Regular"
        },
        "mathtt": {
          variant: "monospace",
          fontName: "Typewriter-Regular"
        }
      };
      svgData = {
        //   path, width, height
        vec: ["vec", 0.471, 0.714],
        // values from the font glyph
        oiintSize1: ["oiintSize1", 0.957, 0.499],
        // oval to overlay the integrand
        oiintSize2: ["oiintSize2", 1.472, 0.659],
        oiiintSize1: ["oiiintSize1", 1.304, 0.499],
        oiiintSize2: ["oiiintSize2", 1.98, 0.659]
      };
      staticSvg = /* @__PURE__ */ __name(function staticSvg2(value2, options2) {
        var [pathName, width3, height2] = svgData[value2];
        var path4 = new PathNode(pathName);
        var svgNode2 = new SvgNode([path4], {
          "width": makeEm(width3),
          "height": makeEm(height2),
          // Override CSS rule `.katex svg { width: 100% }`
          "style": "width:" + makeEm(width3),
          "viewBox": "0 0 " + 1e3 * width3 + " " + 1e3 * height2,
          "preserveAspectRatio": "xMinYMin"
        });
        var span = makeSvgSpan(["overlay"], [svgNode2], options2);
        span.height = height2;
        span.style.height = makeEm(height2);
        span.style.width = makeEm(width3);
        return span;
      }, "staticSvg");
      buildCommon = {
        fontMap,
        makeSymbol,
        mathsym,
        makeSpan: makeSpan$2,
        makeSvgSpan,
        makeLineSpan,
        makeAnchor,
        makeFragment,
        wrapFragment,
        makeVList,
        makeOrd,
        makeGlue,
        staticSvg,
        svgData,
        tryCombineChars
      };
      thinspace = {
        number: 3,
        unit: "mu"
      };
      mediumspace = {
        number: 4,
        unit: "mu"
      };
      thickspace = {
        number: 5,
        unit: "mu"
      };
      spacings = {
        mord: {
          mop: thinspace,
          mbin: mediumspace,
          mrel: thickspace,
          minner: thinspace
        },
        mop: {
          mord: thinspace,
          mop: thinspace,
          mrel: thickspace,
          minner: thinspace
        },
        mbin: {
          mord: mediumspace,
          mop: mediumspace,
          mopen: mediumspace,
          minner: mediumspace
        },
        mrel: {
          mord: thickspace,
          mop: thickspace,
          mopen: thickspace,
          minner: thickspace
        },
        mopen: {},
        mclose: {
          mop: thinspace,
          mbin: mediumspace,
          mrel: thickspace,
          minner: thinspace
        },
        mpunct: {
          mord: thinspace,
          mop: thinspace,
          mrel: thickspace,
          mopen: thinspace,
          mclose: thinspace,
          mpunct: thinspace,
          minner: thinspace
        },
        minner: {
          mord: thinspace,
          mop: thinspace,
          mbin: mediumspace,
          mrel: thickspace,
          mopen: thinspace,
          mpunct: thinspace,
          minner: thinspace
        }
      };
      tightSpacings = {
        mord: {
          mop: thinspace
        },
        mop: {
          mord: thinspace,
          mop: thinspace
        },
        mbin: {},
        mrel: {},
        mopen: {},
        mclose: {
          mop: thinspace
        },
        mpunct: {},
        minner: {
          mop: thinspace
        }
      };
      _functions = {};
      _htmlGroupBuilders = {};
      _mathmlGroupBuilders = {};
      __name(defineFunction, "defineFunction");
      __name(defineFunctionBuilders, "defineFunctionBuilders");
      normalizeArgument = /* @__PURE__ */ __name(function normalizeArgument2(arg) {
        return arg.type === "ordgroup" && arg.body.length === 1 ? arg.body[0] : arg;
      }, "normalizeArgument");
      ordargument = /* @__PURE__ */ __name(function ordargument2(arg) {
        return arg.type === "ordgroup" ? arg.body : [arg];
      }, "ordargument");
      makeSpan$1 = buildCommon.makeSpan;
      binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"];
      binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"];
      styleMap$1 = {
        "display": Style$1.DISPLAY,
        "text": Style$1.TEXT,
        "script": Style$1.SCRIPT,
        "scriptscript": Style$1.SCRIPTSCRIPT
      };
      DomEnum = {
        mord: "mord",
        mop: "mop",
        mbin: "mbin",
        mrel: "mrel",
        mopen: "mopen",
        mclose: "mclose",
        mpunct: "mpunct",
        minner: "minner"
      };
      buildExpression$1 = /* @__PURE__ */ __name(function buildExpression(expression, options2, isRealGroup, surrounding) {
        if (surrounding === void 0) {
          surrounding = [null, null];
        }
        var groups = [];
        for (var i2 = 0; i2 < expression.length; i2++) {
          var output2 = buildGroup$1(expression[i2], options2);
          if (output2 instanceof DocumentFragment) {
            var children2 = output2.children;
            groups.push(...children2);
          } else {
            groups.push(output2);
          }
        }
        buildCommon.tryCombineChars(groups);
        if (!isRealGroup) {
          return groups;
        }
        var glueOptions = options2;
        if (expression.length === 1) {
          var node2 = expression[0];
          if (node2.type === "sizing") {
            glueOptions = options2.havingSize(node2.size);
          } else if (node2.type === "styling") {
            glueOptions = options2.havingStyle(styleMap$1[node2.style]);
          }
        }
        var dummyPrev = makeSpan$1([surrounding[0] || "leftmost"], [], options2);
        var dummyNext = makeSpan$1([surrounding[1] || "rightmost"], [], options2);
        var isRoot = isRealGroup === "root";
        traverseNonSpaceNodes(groups, (node3, prev2) => {
          var prevType = prev2.classes[0];
          var type3 = node3.classes[0];
          if (prevType === "mbin" && binRightCanceller.includes(type3)) {
            prev2.classes[0] = "mord";
          } else if (type3 === "mbin" && binLeftCanceller.includes(prevType)) {
            node3.classes[0] = "mord";
          }
        }, {
          node: dummyPrev
        }, dummyNext, isRoot);
        traverseNonSpaceNodes(groups, (node3, prev2) => {
          var prevType = getTypeOfDomTree(prev2);
          var type3 = getTypeOfDomTree(node3);
          var space = prevType && type3 ? node3.hasClass("mtight") ? tightSpacings[prevType][type3] : spacings[prevType][type3] : null;
          if (space) {
            return buildCommon.makeGlue(space, glueOptions);
          }
        }, {
          node: dummyPrev
        }, dummyNext, isRoot);
        return groups;
      }, "buildExpression");
      traverseNonSpaceNodes = /* @__PURE__ */ __name(function traverseNonSpaceNodes2(nodes5, callback, prev2, next3, isRoot) {
        if (next3) {
          nodes5.push(next3);
        }
        var i2 = 0;
        for (; i2 < nodes5.length; i2++) {
          var node2 = nodes5[i2];
          var partialGroup = checkPartialGroup(node2);
          if (partialGroup) {
            traverseNonSpaceNodes2(partialGroup.children, callback, prev2, null, isRoot);
            continue;
          }
          var nonspace = !node2.hasClass("mspace");
          if (nonspace) {
            var result = callback(node2, prev2.node);
            if (result) {
              if (prev2.insertAfter) {
                prev2.insertAfter(result);
              } else {
                nodes5.unshift(result);
                i2++;
              }
            }
          }
          if (nonspace) {
            prev2.node = node2;
          } else if (isRoot && node2.hasClass("newline")) {
            prev2.node = makeSpan$1(["leftmost"]);
          }
          prev2.insertAfter = /* @__PURE__ */ ((index) => (n2) => {
            nodes5.splice(index + 1, 0, n2);
            i2++;
          })(i2);
        }
        if (next3) {
          nodes5.pop();
        }
      }, "traverseNonSpaceNodes");
      checkPartialGroup = /* @__PURE__ */ __name(function checkPartialGroup2(node2) {
        if (node2 instanceof DocumentFragment || node2 instanceof Anchor || node2 instanceof Span && node2.hasClass("enclosing")) {
          return node2;
        }
        return null;
      }, "checkPartialGroup");
      getOutermostNode = /* @__PURE__ */ __name(function getOutermostNode2(node2, side) {
        var partialGroup = checkPartialGroup(node2);
        if (partialGroup) {
          var children2 = partialGroup.children;
          if (children2.length) {
            if (side === "right") {
              return getOutermostNode2(children2[children2.length - 1], "right");
            } else if (side === "left") {
              return getOutermostNode2(children2[0], "left");
            }
          }
        }
        return node2;
      }, "getOutermostNode");
      getTypeOfDomTree = /* @__PURE__ */ __name(function getTypeOfDomTree2(node2, side) {
        if (!node2) {
          return null;
        }
        if (side) {
          node2 = getOutermostNode(node2, side);
        }
        return DomEnum[node2.classes[0]] || null;
      }, "getTypeOfDomTree");
      makeNullDelimiter = /* @__PURE__ */ __name(function makeNullDelimiter2(options2, classes3) {
        var moreClasses = ["nulldelimiter"].concat(options2.baseSizingClasses());
        return makeSpan$1(classes3.concat(moreClasses));
      }, "makeNullDelimiter");
      buildGroup$1 = /* @__PURE__ */ __name(function buildGroup(group2, options2, baseOptions) {
        if (!group2) {
          return makeSpan$1();
        }
        if (_htmlGroupBuilders[group2.type]) {
          var groupNode = _htmlGroupBuilders[group2.type](group2, options2);
          if (baseOptions && options2.size !== baseOptions.size) {
            groupNode = makeSpan$1(options2.sizingClasses(baseOptions), [groupNode], options2);
            var multiplier = options2.sizeMultiplier / baseOptions.sizeMultiplier;
            groupNode.height *= multiplier;
            groupNode.depth *= multiplier;
          }
          return groupNode;
        } else {
          throw new ParseError("Got group of unknown type: '" + group2.type + "'");
        }
      }, "buildGroup");
      __name(buildHTMLUnbreakable, "buildHTMLUnbreakable");
      __name(buildHTML, "buildHTML");
      __name(newDocumentFragment, "newDocumentFragment");
      MathNode = class {
        static {
          __name(this, "MathNode");
        }
        constructor(type3, children2, classes3) {
          this.type = void 0;
          this.attributes = void 0;
          this.children = void 0;
          this.classes = void 0;
          this.type = type3;
          this.attributes = {};
          this.children = children2 || [];
          this.classes = classes3 || [];
        }
        /**
         * Sets an attribute on a MathML node. MathML depends on attributes to convey a
         * semantic content, so this is used heavily.
         */
        setAttribute(name, value2) {
          this.attributes[name] = value2;
        }
        /**
         * Gets an attribute on a MathML node.
         */
        getAttribute(name) {
          return this.attributes[name];
        }
        /**
         * Converts the math node into a MathML-namespaced DOM element.
         */
        toNode() {
          var node2 = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type);
          for (var attr in this.attributes) {
            if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
              node2.setAttribute(attr, this.attributes[attr]);
            }
          }
          if (this.classes.length > 0) {
            node2.className = createClass(this.classes);
          }
          for (var i2 = 0; i2 < this.children.length; i2++) {
            if (this.children[i2] instanceof TextNode && this.children[i2 + 1] instanceof TextNode) {
              var text4 = this.children[i2].toText() + this.children[++i2].toText();
              while (this.children[i2 + 1] instanceof TextNode) {
                text4 += this.children[++i2].toText();
              }
              node2.appendChild(new TextNode(text4).toNode());
            } else {
              node2.appendChild(this.children[i2].toNode());
            }
          }
          return node2;
        }
        /**
         * Converts the math node into an HTML markup string.
         */
        toMarkup() {
          var markup = "<" + this.type;
          for (var attr in this.attributes) {
            if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
              markup += " " + attr + '="';
              markup += utils.escape(this.attributes[attr]);
              markup += '"';
            }
          }
          if (this.classes.length > 0) {
            markup += ' class ="' + utils.escape(createClass(this.classes)) + '"';
          }
          markup += ">";
          for (var i2 = 0; i2 < this.children.length; i2++) {
            markup += this.children[i2].toMarkup();
          }
          markup += "</" + this.type + ">";
          return markup;
        }
        /**
         * Converts the math node into a string, similar to innerText, but escaped.
         */
        toText() {
          return this.children.map((child) => child.toText()).join("");
        }
      };
      TextNode = class {
        static {
          __name(this, "TextNode");
        }
        constructor(text4) {
          this.text = void 0;
          this.text = text4;
        }
        /**
         * Converts the text node into a DOM text node.
         */
        toNode() {
          return document.createTextNode(this.text);
        }
        /**
         * Converts the text node into escaped HTML markup
         * (representing the text itself).
         */
        toMarkup() {
          return utils.escape(this.toText());
        }
        /**
         * Converts the text node into a string
         * (representing the text itself).
         */
        toText() {
          return this.text;
        }
      };
      SpaceNode = class {
        static {
          __name(this, "SpaceNode");
        }
        /**
         * Create a Space node with width given in CSS ems.
         */
        constructor(width3) {
          this.width = void 0;
          this.character = void 0;
          this.width = width3;
          if (width3 >= 0.05555 && width3 <= 0.05556) {
            this.character = "\u200A";
          } else if (width3 >= 0.1666 && width3 <= 0.1667) {
            this.character = "\u2009";
          } else if (width3 >= 0.2222 && width3 <= 0.2223) {
            this.character = "\u2005";
          } else if (width3 >= 0.2777 && width3 <= 0.2778) {
            this.character = "\u2005\u200A";
          } else if (width3 >= -0.05556 && width3 <= -0.05555) {
            this.character = "\u200A\u2063";
          } else if (width3 >= -0.1667 && width3 <= -0.1666) {
            this.character = "\u2009\u2063";
          } else if (width3 >= -0.2223 && width3 <= -0.2222) {
            this.character = "\u205F\u2063";
          } else if (width3 >= -0.2778 && width3 <= -0.2777) {
            this.character = "\u2005\u2063";
          } else {
            this.character = null;
          }
        }
        /**
         * Converts the math node into a MathML-namespaced DOM element.
         */
        toNode() {
          if (this.character) {
            return document.createTextNode(this.character);
          } else {
            var node2 = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace");
            node2.setAttribute("width", makeEm(this.width));
            return node2;
          }
        }
        /**
         * Converts the math node into an HTML markup string.
         */
        toMarkup() {
          if (this.character) {
            return "<mtext>" + this.character + "</mtext>";
          } else {
            return '<mspace width="' + makeEm(this.width) + '"/>';
          }
        }
        /**
         * Converts the math node into a string, similar to innerText.
         */
        toText() {
          if (this.character) {
            return this.character;
          } else {
            return " ";
          }
        }
      };
      mathMLTree = {
        MathNode,
        TextNode,
        SpaceNode,
        newDocumentFragment
      };
      makeText = /* @__PURE__ */ __name(function makeText2(text4, mode, options2) {
        if (symbols[mode][text4] && symbols[mode][text4].replace && text4.charCodeAt(0) !== 55349 && !(ligatures.hasOwnProperty(text4) && options2 && (options2.fontFamily && options2.fontFamily.slice(4, 6) === "tt" || options2.font && options2.font.slice(4, 6) === "tt"))) {
          text4 = symbols[mode][text4].replace;
        }
        return new mathMLTree.TextNode(text4);
      }, "makeText");
      makeRow = /* @__PURE__ */ __name(function makeRow2(body) {
        if (body.length === 1) {
          return body[0];
        } else {
          return new mathMLTree.MathNode("mrow", body);
        }
      }, "makeRow");
      getVariant = /* @__PURE__ */ __name(function getVariant2(group2, options2) {
        if (options2.fontFamily === "texttt") {
          return "monospace";
        } else if (options2.fontFamily === "textsf") {
          if (options2.fontShape === "textit" && options2.fontWeight === "textbf") {
            return "sans-serif-bold-italic";
          } else if (options2.fontShape === "textit") {
            return "sans-serif-italic";
          } else if (options2.fontWeight === "textbf") {
            return "bold-sans-serif";
          } else {
            return "sans-serif";
          }
        } else if (options2.fontShape === "textit" && options2.fontWeight === "textbf") {
          return "bold-italic";
        } else if (options2.fontShape === "textit") {
          return "italic";
        } else if (options2.fontWeight === "textbf") {
          return "bold";
        }
        var font = options2.font;
        if (!font || font === "mathnormal") {
          return null;
        }
        var mode = group2.mode;
        if (font === "mathit") {
          return "italic";
        } else if (font === "boldsymbol") {
          return group2.type === "textord" ? "bold" : "bold-italic";
        } else if (font === "mathbf") {
          return "bold";
        } else if (font === "mathbb") {
          return "double-struck";
        } else if (font === "mathsfit") {
          return "sans-serif-italic";
        } else if (font === "mathfrak") {
          return "fraktur";
        } else if (font === "mathscr" || font === "mathcal") {
          return "script";
        } else if (font === "mathsf") {
          return "sans-serif";
        } else if (font === "mathtt") {
          return "monospace";
        }
        var text4 = group2.text;
        if (["\\imath", "\\jmath"].includes(text4)) {
          return null;
        }
        if (symbols[mode][text4] && symbols[mode][text4].replace) {
          text4 = symbols[mode][text4].replace;
        }
        var fontName = buildCommon.fontMap[font].fontName;
        if (getCharacterMetrics(text4, fontName, mode)) {
          return buildCommon.fontMap[font].variant;
        }
        return null;
      }, "getVariant");
      __name(isNumberPunctuation, "isNumberPunctuation");
      buildExpression2 = /* @__PURE__ */ __name(function buildExpression3(expression, options2, isOrdgroup) {
        if (expression.length === 1) {
          var group2 = buildGroup2(expression[0], options2);
          if (isOrdgroup && group2 instanceof MathNode && group2.type === "mo") {
            group2.setAttribute("lspace", "0em");
            group2.setAttribute("rspace", "0em");
          }
          return [group2];
        }
        var groups = [];
        var lastGroup;
        for (var i2 = 0; i2 < expression.length; i2++) {
          var _group = buildGroup2(expression[i2], options2);
          if (_group instanceof MathNode && lastGroup instanceof MathNode) {
            if (_group.type === "mtext" && lastGroup.type === "mtext" && _group.getAttribute("mathvariant") === lastGroup.getAttribute("mathvariant")) {
              lastGroup.children.push(..._group.children);
              continue;
            } else if (_group.type === "mn" && lastGroup.type === "mn") {
              lastGroup.children.push(..._group.children);
              continue;
            } else if (isNumberPunctuation(_group) && lastGroup.type === "mn") {
              lastGroup.children.push(..._group.children);
              continue;
            } else if (_group.type === "mn" && isNumberPunctuation(lastGroup)) {
              _group.children = [...lastGroup.children, ..._group.children];
              groups.pop();
            } else if ((_group.type === "msup" || _group.type === "msub") && _group.children.length >= 1 && (lastGroup.type === "mn" || isNumberPunctuation(lastGroup))) {
              var base = _group.children[0];
              if (base instanceof MathNode && base.type === "mn") {
                base.children = [...lastGroup.children, ...base.children];
                groups.pop();
              }
            } else if (lastGroup.type === "mi" && lastGroup.children.length === 1) {
              var lastChild = lastGroup.children[0];
              if (lastChild instanceof TextNode && lastChild.text === "\u0338" && (_group.type === "mo" || _group.type === "mi" || _group.type === "mn")) {
                var child = _group.children[0];
                if (child instanceof TextNode && child.text.length > 0) {
                  child.text = child.text.slice(0, 1) + "\u0338" + child.text.slice(1);
                  groups.pop();
                }
              }
            }
          }
          groups.push(_group);
          lastGroup = _group;
        }
        return groups;
      }, "buildExpression");
      buildExpressionRow = /* @__PURE__ */ __name(function buildExpressionRow2(expression, options2, isOrdgroup) {
        return makeRow(buildExpression2(expression, options2, isOrdgroup));
      }, "buildExpressionRow");
      buildGroup2 = /* @__PURE__ */ __name(function buildGroup3(group2, options2) {
        if (!group2) {
          return new mathMLTree.MathNode("mrow");
        }
        if (_mathmlGroupBuilders[group2.type]) {
          var result = _mathmlGroupBuilders[group2.type](group2, options2);
          return result;
        } else {
          throw new ParseError("Got group of unknown type: '" + group2.type + "'");
        }
      }, "buildGroup");
      __name(buildMathML, "buildMathML");
      optionsFromSettings = /* @__PURE__ */ __name(function optionsFromSettings2(settings) {
        return new Options({
          style: settings.displayMode ? Style$1.DISPLAY : Style$1.TEXT,
          maxSize: settings.maxSize,
          minRuleThickness: settings.minRuleThickness
        });
      }, "optionsFromSettings");
      displayWrap = /* @__PURE__ */ __name(function displayWrap2(node2, settings) {
        if (settings.displayMode) {
          var classes3 = ["katex-display"];
          if (settings.leqno) {
            classes3.push("leqno");
          }
          if (settings.fleqn) {
            classes3.push("fleqn");
          }
          node2 = buildCommon.makeSpan(classes3, [node2]);
        }
        return node2;
      }, "displayWrap");
      buildTree = /* @__PURE__ */ __name(function buildTree2(tree, expression, settings) {
        var options2 = optionsFromSettings(settings);
        var katexNode;
        if (settings.output === "mathml") {
          return buildMathML(tree, expression, options2, settings.displayMode, true);
        } else if (settings.output === "html") {
          var htmlNode = buildHTML(tree, options2);
          katexNode = buildCommon.makeSpan(["katex"], [htmlNode]);
        } else {
          var mathMLNode = buildMathML(tree, expression, options2, settings.displayMode, false);
          var _htmlNode = buildHTML(tree, options2);
          katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, _htmlNode]);
        }
        return displayWrap(katexNode, settings);
      }, "buildTree");
      buildHTMLTree = /* @__PURE__ */ __name(function buildHTMLTree2(tree, expression, settings) {
        var options2 = optionsFromSettings(settings);
        var htmlNode = buildHTML(tree, options2);
        var katexNode = buildCommon.makeSpan(["katex"], [htmlNode]);
        return displayWrap(katexNode, settings);
      }, "buildHTMLTree");
      stretchyCodePoint = {
        widehat: "^",
        widecheck: "\u02C7",
        widetilde: "~",
        utilde: "~",
        overleftarrow: "\u2190",
        underleftarrow: "\u2190",
        xleftarrow: "\u2190",
        overrightarrow: "\u2192",
        underrightarrow: "\u2192",
        xrightarrow: "\u2192",
        underbrace: "\u23DF",
        overbrace: "\u23DE",
        overgroup: "\u23E0",
        undergroup: "\u23E1",
        overleftrightarrow: "\u2194",
        underleftrightarrow: "\u2194",
        xleftrightarrow: "\u2194",
        Overrightarrow: "\u21D2",
        xRightarrow: "\u21D2",
        overleftharpoon: "\u21BC",
        xleftharpoonup: "\u21BC",
        overrightharpoon: "\u21C0",
        xrightharpoonup: "\u21C0",
        xLeftarrow: "\u21D0",
        xLeftrightarrow: "\u21D4",
        xhookleftarrow: "\u21A9",
        xhookrightarrow: "\u21AA",
        xmapsto: "\u21A6",
        xrightharpoondown: "\u21C1",
        xleftharpoondown: "\u21BD",
        xrightleftharpoons: "\u21CC",
        xleftrightharpoons: "\u21CB",
        xtwoheadleftarrow: "\u219E",
        xtwoheadrightarrow: "\u21A0",
        xlongequal: "=",
        xtofrom: "\u21C4",
        xrightleftarrows: "\u21C4",
        xrightequilibrium: "\u21CC",
        // Not a perfect match.
        xleftequilibrium: "\u21CB",
        // None better available.
        "\\cdrightarrow": "\u2192",
        "\\cdleftarrow": "\u2190",
        "\\cdlongequal": "="
      };
      mathMLnode = /* @__PURE__ */ __name(function mathMLnode2(label) {
        var node2 = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.replace(/^\\/, "")])]);
        node2.setAttribute("stretchy", "true");
        return node2;
      }, "mathMLnode");
      katexImagesData = {
        //   path(s), minWidth, height, align
        overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
        overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
        underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
        underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
        xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"],
        "\\cdrightarrow": [["rightarrow"], 3, 522, "xMaxYMin"],
        // CD minwwidth2.5pc
        xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"],
        "\\cdleftarrow": [["leftarrow"], 3, 522, "xMinYMin"],
        Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"],
        xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"],
        xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"],
        overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"],
        xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"],
        xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"],
        overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
        xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
        xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"],
        xlongequal: [["longequal"], 0.888, 334, "xMinYMin"],
        "\\cdlongequal": [["longequal"], 3, 334, "xMinYMin"],
        xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"],
        xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"],
        overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
        overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548],
        underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548],
        underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
        xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522],
        xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560],
        xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716],
        xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716],
        xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522],
        xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522],
        overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
        underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
        overgroup: [["leftgroup", "rightgroup"], 0.888, 342],
        undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342],
        xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522],
        xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528],
        // The next three arrows are from the mhchem package.
        // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the
        // document as \xrightarrow or \xrightleftharpoons. Those have
        // min-length = 1.75em, so we set min-length on these next three to match.
        xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901],
        xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716],
        xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716]
      };
      groupLength = /* @__PURE__ */ __name(function groupLength2(arg) {
        if (arg.type === "ordgroup") {
          return arg.body.length;
        } else {
          return 1;
        }
      }, "groupLength");
      svgSpan = /* @__PURE__ */ __name(function svgSpan2(group2, options2) {
        function buildSvgSpan_() {
          var viewBoxWidth = 4e5;
          var label = group2.label.slice(1);
          if (["widehat", "widecheck", "widetilde", "utilde"].includes(label)) {
            var grp = group2;
            var numChars = groupLength(grp.base);
            var viewBoxHeight;
            var pathName;
            var _height;
            if (numChars > 5) {
              if (label === "widehat" || label === "widecheck") {
                viewBoxHeight = 420;
                viewBoxWidth = 2364;
                _height = 0.42;
                pathName = label + "4";
              } else {
                viewBoxHeight = 312;
                viewBoxWidth = 2340;
                _height = 0.34;
                pathName = "tilde4";
              }
            } else {
              var imgIndex = [1, 1, 2, 2, 3, 3][numChars];
              if (label === "widehat" || label === "widecheck") {
                viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex];
                viewBoxHeight = [0, 239, 300, 360, 420][imgIndex];
                _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex];
                pathName = label + imgIndex;
              } else {
                viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex];
                viewBoxHeight = [0, 260, 286, 306, 312][imgIndex];
                _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex];
                pathName = "tilde" + imgIndex;
              }
            }
            var path4 = new PathNode(pathName);
            var svgNode2 = new SvgNode([path4], {
              "width": "100%",
              "height": makeEm(_height),
              "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight,
              "preserveAspectRatio": "none"
            });
            return {
              span: buildCommon.makeSvgSpan([], [svgNode2], options2),
              minWidth: 0,
              height: _height
            };
          } else {
            var spans = [];
            var data5 = katexImagesData[label];
            var [paths, _minWidth, _viewBoxHeight] = data5;
            var _height2 = _viewBoxHeight / 1e3;
            var numSvgChildren = paths.length;
            var widthClasses;
            var aligns;
            if (numSvgChildren === 1) {
              var align1 = data5[3];
              widthClasses = ["hide-tail"];
              aligns = [align1];
            } else if (numSvgChildren === 2) {
              widthClasses = ["halfarrow-left", "halfarrow-right"];
              aligns = ["xMinYMin", "xMaxYMin"];
            } else if (numSvgChildren === 3) {
              widthClasses = ["brace-left", "brace-center", "brace-right"];
              aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"];
            } else {
              throw new Error("Correct katexImagesData or update code here to support\n                    " + numSvgChildren + " children.");
            }
            for (var i2 = 0; i2 < numSvgChildren; i2++) {
              var _path = new PathNode(paths[i2]);
              var _svgNode = new SvgNode([_path], {
                "width": "400em",
                "height": makeEm(_height2),
                "viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight,
                "preserveAspectRatio": aligns[i2] + " slice"
              });
              var _span = buildCommon.makeSvgSpan([widthClasses[i2]], [_svgNode], options2);
              if (numSvgChildren === 1) {
                return {
                  span: _span,
                  minWidth: _minWidth,
                  height: _height2
                };
              } else {
                _span.style.height = makeEm(_height2);
                spans.push(_span);
              }
            }
            return {
              span: buildCommon.makeSpan(["stretchy"], spans, options2),
              minWidth: _minWidth,
              height: _height2
            };
          }
        }
        __name(buildSvgSpan_, "buildSvgSpan_");
        var {
          span,
          minWidth,
          height: height2
        } = buildSvgSpan_();
        span.height = height2;
        span.style.height = makeEm(height2);
        if (minWidth > 0) {
          span.style.minWidth = makeEm(minWidth);
        }
        return span;
      }, "svgSpan");
      encloseSpan = /* @__PURE__ */ __name(function encloseSpan2(inner2, label, topPad, bottomPad, options2) {
        var img;
        var totalHeight = inner2.height + inner2.depth + topPad + bottomPad;
        if (/fbox|color|angl/.test(label)) {
          img = buildCommon.makeSpan(["stretchy", label], [], options2);
          if (label === "fbox") {
            var color2 = options2.color && options2.getColor();
            if (color2) {
              img.style.borderColor = color2;
            }
          }
        } else {
          var lines = [];
          if (/^[bx]cancel$/.test(label)) {
            lines.push(new LineNode({
              "x1": "0",
              "y1": "0",
              "x2": "100%",
              "y2": "100%",
              "stroke-width": "0.046em"
            }));
          }
          if (/^x?cancel$/.test(label)) {
            lines.push(new LineNode({
              "x1": "0",
              "y1": "100%",
              "x2": "100%",
              "y2": "0",
              "stroke-width": "0.046em"
            }));
          }
          var svgNode2 = new SvgNode(lines, {
            "width": "100%",
            "height": makeEm(totalHeight)
          });
          img = buildCommon.makeSvgSpan([], [svgNode2], options2);
        }
        img.height = totalHeight;
        img.style.height = makeEm(totalHeight);
        return img;
      }, "encloseSpan");
      stretchy = {
        encloseSpan,
        mathMLnode,
        svgSpan
      };
      __name(assertNodeType, "assertNodeType");
      __name(assertSymbolNodeType, "assertSymbolNodeType");
      __name(checkSymbolNodeType, "checkSymbolNodeType");
      htmlBuilder$a = /* @__PURE__ */ __name((grp, options2) => {
        var base;
        var group2;
        var supSubGroup;
        if (grp && grp.type === "supsub") {
          group2 = assertNodeType(grp.base, "accent");
          base = group2.base;
          grp.base = base;
          supSubGroup = assertSpan(buildGroup$1(grp, options2));
          grp.base = group2;
        } else {
          group2 = assertNodeType(grp, "accent");
          base = group2.base;
        }
        var body = buildGroup$1(base, options2.havingCrampedStyle());
        var mustShift = group2.isShifty && utils.isCharacterBox(base);
        var skew = 0;
        if (mustShift) {
          var baseChar = utils.getBaseElem(base);
          var baseGroup = buildGroup$1(baseChar, options2.havingCrampedStyle());
          skew = assertSymbolDomNode(baseGroup).skew;
        }
        var accentBelow = group2.label === "\\c";
        var clearance = accentBelow ? body.height + body.depth : Math.min(body.height, options2.fontMetrics().xHeight);
        var accentBody;
        if (!group2.isStretchy) {
          var accent2;
          var width3;
          if (group2.label === "\\vec") {
            accent2 = buildCommon.staticSvg("vec", options2);
            width3 = buildCommon.svgData.vec[1];
          } else {
            accent2 = buildCommon.makeOrd({
              mode: group2.mode,
              text: group2.label
            }, options2, "textord");
            accent2 = assertSymbolDomNode(accent2);
            accent2.italic = 0;
            width3 = accent2.width;
            if (accentBelow) {
              clearance += accent2.depth;
            }
          }
          accentBody = buildCommon.makeSpan(["accent-body"], [accent2]);
          var accentFull = group2.label === "\\textcircled";
          if (accentFull) {
            accentBody.classes.push("accent-full");
            clearance = body.height;
          }
          var left3 = skew;
          if (!accentFull) {
            left3 -= width3 / 2;
          }
          accentBody.style.left = makeEm(left3);
          if (group2.label === "\\textcircled") {
            accentBody.style.top = ".2em";
          }
          accentBody = buildCommon.makeVList({
            positionType: "firstBaseline",
            children: [{
              type: "elem",
              elem: body
            }, {
              type: "kern",
              size: -clearance
            }, {
              type: "elem",
              elem: accentBody
            }]
          }, options2);
        } else {
          accentBody = stretchy.svgSpan(group2, options2);
          accentBody = buildCommon.makeVList({
            positionType: "firstBaseline",
            children: [{
              type: "elem",
              elem: body
            }, {
              type: "elem",
              elem: accentBody,
              wrapperClasses: ["svg-align"],
              wrapperStyle: skew > 0 ? {
                width: "calc(100% - " + makeEm(2 * skew) + ")",
                marginLeft: makeEm(2 * skew)
              } : void 0
            }]
          }, options2);
        }
        var accentWrap = buildCommon.makeSpan(["mord", "accent"], [accentBody], options2);
        if (supSubGroup) {
          supSubGroup.children[0] = accentWrap;
          supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height);
          supSubGroup.classes[0] = "mord";
          return supSubGroup;
        } else {
          return accentWrap;
        }
      }, "htmlBuilder$a");
      mathmlBuilder$9 = /* @__PURE__ */ __name((group2, options2) => {
        var accentNode = group2.isStretchy ? stretchy.mathMLnode(group2.label) : new mathMLTree.MathNode("mo", [makeText(group2.label, group2.mode)]);
        var node2 = new mathMLTree.MathNode("mover", [buildGroup2(group2.base, options2), accentNode]);
        node2.setAttribute("accent", "true");
        return node2;
      }, "mathmlBuilder$9");
      NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map((accent2) => "\\" + accent2).join("|"));
      defineFunction({
        type: "accent",
        names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"],
        props: {
          numArgs: 1
        },
        handler: /* @__PURE__ */ __name((context, args) => {
          var base = normalizeArgument(args[0]);
          var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName);
          var isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck";
          return {
            type: "accent",
            mode: context.parser.mode,
            label: context.funcName,
            isStretchy,
            isShifty,
            base
          };
        }, "handler"),
        htmlBuilder: htmlBuilder$a,
        mathmlBuilder: mathmlBuilder$9
      });
      defineFunction({
        type: "accent",
        names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\c", "\\r", "\\H", "\\v", "\\textcircled"],
        props: {
          numArgs: 1,
          allowedInText: true,
          allowedInMath: true,
          // unless in strict mode
          argTypes: ["primitive"]
        },
        handler: /* @__PURE__ */ __name((context, args) => {
          var base = args[0];
          var mode = context.parser.mode;
          if (mode === "math") {
            context.parser.settings.reportNonstrict("mathVsTextAccents", "LaTeX's accent " + context.funcName + " works only in text mode");
            mode = "text";
          }
          return {
            type: "accent",
            mode,
            label: context.funcName,
            isStretchy: false,
            isShifty: true,
            base
          };
        }, "handler"),
        htmlBuilder: htmlBuilder$a,
        mathmlBuilder: mathmlBuilder$9
      });
      defineFunction({
        type: "accentUnder",
        names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"],
        props: {
          numArgs: 1
        },
        handler: /* @__PURE__ */ __name((_ref, args) => {
          var {
            parser: parser28,
            funcName
          } = _ref;
          var base = args[0];
          return {
            type: "accentUnder",
            mode: parser28.mode,
            label: funcName,
            base
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var innerGroup = buildGroup$1(group2.base, options2);
          var accentBody = stretchy.svgSpan(group2, options2);
          var kern = group2.label === "\\utilde" ? 0.12 : 0;
          var vlist = buildCommon.makeVList({
            positionType: "top",
            positionData: innerGroup.height,
            children: [{
              type: "elem",
              elem: accentBody,
              wrapperClasses: ["svg-align"]
            }, {
              type: "kern",
              size: kern
            }, {
              type: "elem",
              elem: innerGroup
            }]
          }, options2);
          return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options2);
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var accentNode = stretchy.mathMLnode(group2.label);
          var node2 = new mathMLTree.MathNode("munder", [buildGroup2(group2.base, options2), accentNode]);
          node2.setAttribute("accentunder", "true");
          return node2;
        }, "mathmlBuilder")
      });
      paddedNode = /* @__PURE__ */ __name((group2) => {
        var node2 = new mathMLTree.MathNode("mpadded", group2 ? [group2] : []);
        node2.setAttribute("width", "+0.6em");
        node2.setAttribute("lspace", "0.3em");
        return node2;
      }, "paddedNode");
      defineFunction({
        type: "xArrow",
        names: [
          "\\xleftarrow",
          "\\xrightarrow",
          "\\xLeftarrow",
          "\\xRightarrow",
          "\\xleftrightarrow",
          "\\xLeftrightarrow",
          "\\xhookleftarrow",
          "\\xhookrightarrow",
          "\\xmapsto",
          "\\xrightharpoondown",
          "\\xrightharpoonup",
          "\\xleftharpoondown",
          "\\xleftharpoonup",
          "\\xrightleftharpoons",
          "\\xleftrightharpoons",
          "\\xlongequal",
          "\\xtwoheadrightarrow",
          "\\xtwoheadleftarrow",
          "\\xtofrom",
          // The next 3 functions are here to support the mhchem extension.
          // Direct use of these functions is discouraged and may break someday.
          "\\xrightleftarrows",
          "\\xrightequilibrium",
          "\\xleftequilibrium",
          // The next 3 functions are here only to support the {CD} environment.
          "\\\\cdrightarrow",
          "\\\\cdleftarrow",
          "\\\\cdlongequal"
        ],
        props: {
          numArgs: 1,
          numOptionalArgs: 1
        },
        handler(_ref, args, optArgs) {
          var {
            parser: parser28,
            funcName
          } = _ref;
          return {
            type: "xArrow",
            mode: parser28.mode,
            label: funcName,
            body: args[0],
            below: optArgs[0]
          };
        },
        // Flow is unable to correctly infer the type of `group`, even though it's
        // unambiguously determined from the passed-in `type` above.
        htmlBuilder(group2, options2) {
          var style3 = options2.style;
          var newOptions = options2.havingStyle(style3.sup());
          var upperGroup = buildCommon.wrapFragment(buildGroup$1(group2.body, newOptions, options2), options2);
          var arrowPrefix = group2.label.slice(0, 2) === "\\x" ? "x" : "cd";
          upperGroup.classes.push(arrowPrefix + "-arrow-pad");
          var lowerGroup;
          if (group2.below) {
            newOptions = options2.havingStyle(style3.sub());
            lowerGroup = buildCommon.wrapFragment(buildGroup$1(group2.below, newOptions, options2), options2);
            lowerGroup.classes.push(arrowPrefix + "-arrow-pad");
          }
          var arrowBody = stretchy.svgSpan(group2, options2);
          var arrowShift = -options2.fontMetrics().axisHeight + 0.5 * arrowBody.height;
          var upperShift = -options2.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111;
          if (upperGroup.depth > 0.25 || group2.label === "\\xleftequilibrium") {
            upperShift -= upperGroup.depth;
          }
          var vlist;
          if (lowerGroup) {
            var lowerShift = -options2.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111;
            vlist = buildCommon.makeVList({
              positionType: "individualShift",
              children: [{
                type: "elem",
                elem: upperGroup,
                shift: upperShift
              }, {
                type: "elem",
                elem: arrowBody,
                shift: arrowShift
              }, {
                type: "elem",
                elem: lowerGroup,
                shift: lowerShift
              }]
            }, options2);
          } else {
            vlist = buildCommon.makeVList({
              positionType: "individualShift",
              children: [{
                type: "elem",
                elem: upperGroup,
                shift: upperShift
              }, {
                type: "elem",
                elem: arrowBody,
                shift: arrowShift
              }]
            }, options2);
          }
          vlist.children[0].children[0].children[1].classes.push("svg-align");
          return buildCommon.makeSpan(["mrel", "x-arrow"], [vlist], options2);
        },
        mathmlBuilder(group2, options2) {
          var arrowNode = stretchy.mathMLnode(group2.label);
          arrowNode.setAttribute("minsize", group2.label.charAt(0) === "x" ? "1.75em" : "3.0em");
          var node2;
          if (group2.body) {
            var upperNode = paddedNode(buildGroup2(group2.body, options2));
            if (group2.below) {
              var lowerNode = paddedNode(buildGroup2(group2.below, options2));
              node2 = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]);
            } else {
              node2 = new mathMLTree.MathNode("mover", [arrowNode, upperNode]);
            }
          } else if (group2.below) {
            var _lowerNode = paddedNode(buildGroup2(group2.below, options2));
            node2 = new mathMLTree.MathNode("munder", [arrowNode, _lowerNode]);
          } else {
            node2 = paddedNode();
            node2 = new mathMLTree.MathNode("mover", [arrowNode, node2]);
          }
          return node2;
        }
      });
      makeSpan2 = buildCommon.makeSpan;
      __name(htmlBuilder$9, "htmlBuilder$9");
      __name(mathmlBuilder$8, "mathmlBuilder$8");
      defineFunction({
        type: "mclass",
        names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"],
        props: {
          numArgs: 1,
          primitive: true
        },
        handler(_ref, args) {
          var {
            parser: parser28,
            funcName
          } = _ref;
          var body = args[0];
          return {
            type: "mclass",
            mode: parser28.mode,
            mclass: "m" + funcName.slice(5),
            // TODO(kevinb): don't prefix with 'm'
            body: ordargument(body),
            isCharacterBox: utils.isCharacterBox(body)
          };
        },
        htmlBuilder: htmlBuilder$9,
        mathmlBuilder: mathmlBuilder$8
      });
      binrelClass = /* @__PURE__ */ __name((arg) => {
        var atom2 = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg;
        if (atom2.type === "atom" && (atom2.family === "bin" || atom2.family === "rel")) {
          return "m" + atom2.family;
        } else {
          return "mord";
        }
      }, "binrelClass");
      defineFunction({
        type: "mclass",
        names: ["\\@binrel"],
        props: {
          numArgs: 2
        },
        handler(_ref2, args) {
          var {
            parser: parser28
          } = _ref2;
          return {
            type: "mclass",
            mode: parser28.mode,
            mclass: binrelClass(args[0]),
            body: ordargument(args[1]),
            isCharacterBox: utils.isCharacterBox(args[1])
          };
        }
      });
      defineFunction({
        type: "mclass",
        names: ["\\stackrel", "\\overset", "\\underset"],
        props: {
          numArgs: 2
        },
        handler(_ref3, args) {
          var {
            parser: parser28,
            funcName
          } = _ref3;
          var baseArg = args[1];
          var shiftedArg = args[0];
          var mclass;
          if (funcName !== "\\stackrel") {
            mclass = binrelClass(baseArg);
          } else {
            mclass = "mrel";
          }
          var baseOp = {
            type: "op",
            mode: baseArg.mode,
            limits: true,
            alwaysHandleSupSub: true,
            parentIsSupSub: false,
            symbol: false,
            suppressBaseShift: funcName !== "\\stackrel",
            body: ordargument(baseArg)
          };
          var supsub = {
            type: "supsub",
            mode: shiftedArg.mode,
            base: baseOp,
            sup: funcName === "\\underset" ? null : shiftedArg,
            sub: funcName === "\\underset" ? shiftedArg : null
          };
          return {
            type: "mclass",
            mode: parser28.mode,
            mclass,
            body: [supsub],
            isCharacterBox: utils.isCharacterBox(supsub)
          };
        },
        htmlBuilder: htmlBuilder$9,
        mathmlBuilder: mathmlBuilder$8
      });
      defineFunction({
        type: "pmb",
        names: ["\\pmb"],
        props: {
          numArgs: 1,
          allowedInText: true
        },
        handler(_ref, args) {
          var {
            parser: parser28
          } = _ref;
          return {
            type: "pmb",
            mode: parser28.mode,
            mclass: binrelClass(args[0]),
            body: ordargument(args[0])
          };
        },
        htmlBuilder(group2, options2) {
          var elements2 = buildExpression$1(group2.body, options2, true);
          var node2 = buildCommon.makeSpan([group2.mclass], elements2, options2);
          node2.style.textShadow = "0.02em 0.01em 0.04px";
          return node2;
        },
        mathmlBuilder(group2, style3) {
          var inner2 = buildExpression2(group2.body, style3);
          var node2 = new mathMLTree.MathNode("mstyle", inner2);
          node2.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px");
          return node2;
        }
      });
      cdArrowFunctionName = {
        ">": "\\\\cdrightarrow",
        "<": "\\\\cdleftarrow",
        "=": "\\\\cdlongequal",
        "A": "\\uparrow",
        "V": "\\downarrow",
        "|": "\\Vert",
        ".": "no arrow"
      };
      newCell = /* @__PURE__ */ __name(() => {
        return {
          type: "styling",
          body: [],
          mode: "math",
          style: "display"
        };
      }, "newCell");
      isStartOfArrow = /* @__PURE__ */ __name((node2) => {
        return node2.type === "textord" && node2.text === "@";
      }, "isStartOfArrow");
      isLabelEnd = /* @__PURE__ */ __name((node2, endChar) => {
        return (node2.type === "mathord" || node2.type === "atom") && node2.text === endChar;
      }, "isLabelEnd");
      __name(cdArrow, "cdArrow");
      __name(parseCD, "parseCD");
      defineFunction({
        type: "cdlabel",
        names: ["\\\\cdleft", "\\\\cdright"],
        props: {
          numArgs: 1
        },
        handler(_ref, args) {
          var {
            parser: parser28,
            funcName
          } = _ref;
          return {
            type: "cdlabel",
            mode: parser28.mode,
            side: funcName.slice(4),
            label: args[0]
          };
        },
        htmlBuilder(group2, options2) {
          var newOptions = options2.havingStyle(options2.style.sup());
          var label = buildCommon.wrapFragment(buildGroup$1(group2.label, newOptions, options2), options2);
          label.classes.push("cd-label-" + group2.side);
          label.style.bottom = makeEm(0.8 - label.depth);
          label.height = 0;
          label.depth = 0;
          return label;
        },
        mathmlBuilder(group2, options2) {
          var label = new mathMLTree.MathNode("mrow", [buildGroup2(group2.label, options2)]);
          label = new mathMLTree.MathNode("mpadded", [label]);
          label.setAttribute("width", "0");
          if (group2.side === "left") {
            label.setAttribute("lspace", "-1width");
          }
          label.setAttribute("voffset", "0.7em");
          label = new mathMLTree.MathNode("mstyle", [label]);
          label.setAttribute("displaystyle", "false");
          label.setAttribute("scriptlevel", "1");
          return label;
        }
      });
      defineFunction({
        type: "cdlabelparent",
        names: ["\\\\cdparent"],
        props: {
          numArgs: 1
        },
        handler(_ref2, args) {
          var {
            parser: parser28
          } = _ref2;
          return {
            type: "cdlabelparent",
            mode: parser28.mode,
            fragment: args[0]
          };
        },
        htmlBuilder(group2, options2) {
          var parent4 = buildCommon.wrapFragment(buildGroup$1(group2.fragment, options2), options2);
          parent4.classes.push("cd-vert-arrow");
          return parent4;
        },
        mathmlBuilder(group2, options2) {
          return new mathMLTree.MathNode("mrow", [buildGroup2(group2.fragment, options2)]);
        }
      });
      defineFunction({
        type: "textord",
        names: ["\\@char"],
        props: {
          numArgs: 1,
          allowedInText: true
        },
        handler(_ref, args) {
          var {
            parser: parser28
          } = _ref;
          var arg = assertNodeType(args[0], "ordgroup");
          var group2 = arg.body;
          var number7 = "";
          for (var i2 = 0; i2 < group2.length; i2++) {
            var node2 = assertNodeType(group2[i2], "textord");
            number7 += node2.text;
          }
          var code = parseInt(number7);
          var text4;
          if (isNaN(code)) {
            throw new ParseError("\\@char has non-numeric argument " + number7);
          } else if (code < 0 || code >= 1114111) {
            throw new ParseError("\\@char with invalid code point " + number7);
          } else if (code <= 65535) {
            text4 = String.fromCharCode(code);
          } else {
            code -= 65536;
            text4 = String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320);
          }
          return {
            type: "textord",
            mode: parser28.mode,
            text: text4
          };
        }
      });
      htmlBuilder$8 = /* @__PURE__ */ __name((group2, options2) => {
        var elements2 = buildExpression$1(group2.body, options2.withColor(group2.color), false);
        return buildCommon.makeFragment(elements2);
      }, "htmlBuilder$8");
      mathmlBuilder$7 = /* @__PURE__ */ __name((group2, options2) => {
        var inner2 = buildExpression2(group2.body, options2.withColor(group2.color));
        var node2 = new mathMLTree.MathNode("mstyle", inner2);
        node2.setAttribute("mathcolor", group2.color);
        return node2;
      }, "mathmlBuilder$7");
      defineFunction({
        type: "color",
        names: ["\\textcolor"],
        props: {
          numArgs: 2,
          allowedInText: true,
          argTypes: ["color", "original"]
        },
        handler(_ref, args) {
          var {
            parser: parser28
          } = _ref;
          var color2 = assertNodeType(args[0], "color-token").color;
          var body = args[1];
          return {
            type: "color",
            mode: parser28.mode,
            color: color2,
            body: ordargument(body)
          };
        },
        htmlBuilder: htmlBuilder$8,
        mathmlBuilder: mathmlBuilder$7
      });
      defineFunction({
        type: "color",
        names: ["\\color"],
        props: {
          numArgs: 1,
          allowedInText: true,
          argTypes: ["color"]
        },
        handler(_ref2, args) {
          var {
            parser: parser28,
            breakOnTokenText
          } = _ref2;
          var color2 = assertNodeType(args[0], "color-token").color;
          parser28.gullet.macros.set("\\current@color", color2);
          var body = parser28.parseExpression(true, breakOnTokenText);
          return {
            type: "color",
            mode: parser28.mode,
            color: color2,
            body
          };
        },
        htmlBuilder: htmlBuilder$8,
        mathmlBuilder: mathmlBuilder$7
      });
      defineFunction({
        type: "cr",
        names: ["\\\\"],
        props: {
          numArgs: 0,
          numOptionalArgs: 0,
          allowedInText: true
        },
        handler(_ref, args, optArgs) {
          var {
            parser: parser28
          } = _ref;
          var size4 = parser28.gullet.future().text === "[" ? parser28.parseSizeGroup(true) : null;
          var newLine = !parser28.settings.displayMode || !parser28.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline does nothing in display mode");
          return {
            type: "cr",
            mode: parser28.mode,
            newLine,
            size: size4 && assertNodeType(size4, "size").value
          };
        },
        // The following builders are called only at the top level,
        // not within tabular/array environments.
        htmlBuilder(group2, options2) {
          var span = buildCommon.makeSpan(["mspace"], [], options2);
          if (group2.newLine) {
            span.classes.push("newline");
            if (group2.size) {
              span.style.marginTop = makeEm(calculateSize2(group2.size, options2));
            }
          }
          return span;
        },
        mathmlBuilder(group2, options2) {
          var node2 = new mathMLTree.MathNode("mspace");
          if (group2.newLine) {
            node2.setAttribute("linebreak", "newline");
            if (group2.size) {
              node2.setAttribute("height", makeEm(calculateSize2(group2.size, options2)));
            }
          }
          return node2;
        }
      });
      globalMap = {
        "\\global": "\\global",
        "\\long": "\\\\globallong",
        "\\\\globallong": "\\\\globallong",
        "\\def": "\\gdef",
        "\\gdef": "\\gdef",
        "\\edef": "\\xdef",
        "\\xdef": "\\xdef",
        "\\let": "\\\\globallet",
        "\\futurelet": "\\\\globalfuture"
      };
      checkControlSequence = /* @__PURE__ */ __name((tok) => {
        var name = tok.text;
        if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) {
          throw new ParseError("Expected a control sequence", tok);
        }
        return name;
      }, "checkControlSequence");
      getRHS = /* @__PURE__ */ __name((parser28) => {
        var tok = parser28.gullet.popToken();
        if (tok.text === "=") {
          tok = parser28.gullet.popToken();
          if (tok.text === " ") {
            tok = parser28.gullet.popToken();
          }
        }
        return tok;
      }, "getRHS");
      letCommand = /* @__PURE__ */ __name((parser28, name, tok, global2) => {
        var macro = parser28.gullet.macros.get(tok.text);
        if (macro == null) {
          tok.noexpand = true;
          macro = {
            tokens: [tok],
            numArgs: 0,
            // reproduce the same behavior in expansion
            unexpandable: !parser28.gullet.isExpandable(tok.text)
          };
        }
        parser28.gullet.macros.set(name, macro, global2);
      }, "letCommand");
      defineFunction({
        type: "internal",
        names: [
          "\\global",
          "\\long",
          "\\\\globallong"
          // can’t be entered directly
        ],
        props: {
          numArgs: 0,
          allowedInText: true
        },
        handler(_ref) {
          var {
            parser: parser28,
            funcName
          } = _ref;
          parser28.consumeSpaces();
          var token2 = parser28.fetch();
          if (globalMap[token2.text]) {
            if (funcName === "\\global" || funcName === "\\\\globallong") {
              token2.text = globalMap[token2.text];
            }
            return assertNodeType(parser28.parseFunction(), "internal");
          }
          throw new ParseError("Invalid token after macro prefix", token2);
        }
      });
      defineFunction({
        type: "internal",
        names: ["\\def", "\\gdef", "\\edef", "\\xdef"],
        props: {
          numArgs: 0,
          allowedInText: true,
          primitive: true
        },
        handler(_ref2) {
          var {
            parser: parser28,
            funcName
          } = _ref2;
          var tok = parser28.gullet.popToken();
          var name = tok.text;
          if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) {
            throw new ParseError("Expected a control sequence", tok);
          }
          var numArgs = 0;
          var insert;
          var delimiters2 = [[]];
          while (parser28.gullet.future().text !== "{") {
            tok = parser28.gullet.popToken();
            if (tok.text === "#") {
              if (parser28.gullet.future().text === "{") {
                insert = parser28.gullet.future();
                delimiters2[numArgs].push("{");
                break;
              }
              tok = parser28.gullet.popToken();
              if (!/^[1-9]$/.test(tok.text)) {
                throw new ParseError('Invalid argument number "' + tok.text + '"');
              }
              if (parseInt(tok.text) !== numArgs + 1) {
                throw new ParseError('Argument number "' + tok.text + '" out of order');
              }
              numArgs++;
              delimiters2.push([]);
            } else if (tok.text === "EOF") {
              throw new ParseError("Expected a macro definition");
            } else {
              delimiters2[numArgs].push(tok.text);
            }
          }
          var {
            tokens: tokens2
          } = parser28.gullet.consumeArg();
          if (insert) {
            tokens2.unshift(insert);
          }
          if (funcName === "\\edef" || funcName === "\\xdef") {
            tokens2 = parser28.gullet.expandTokens(tokens2);
            tokens2.reverse();
          }
          parser28.gullet.macros.set(name, {
            tokens: tokens2,
            numArgs,
            delimiters: delimiters2
          }, funcName === globalMap[funcName]);
          return {
            type: "internal",
            mode: parser28.mode
          };
        }
      });
      defineFunction({
        type: "internal",
        names: [
          "\\let",
          "\\\\globallet"
          // can’t be entered directly
        ],
        props: {
          numArgs: 0,
          allowedInText: true,
          primitive: true
        },
        handler(_ref3) {
          var {
            parser: parser28,
            funcName
          } = _ref3;
          var name = checkControlSequence(parser28.gullet.popToken());
          parser28.gullet.consumeSpaces();
          var tok = getRHS(parser28);
          letCommand(parser28, name, tok, funcName === "\\\\globallet");
          return {
            type: "internal",
            mode: parser28.mode
          };
        }
      });
      defineFunction({
        type: "internal",
        names: [
          "\\futurelet",
          "\\\\globalfuture"
          // can’t be entered directly
        ],
        props: {
          numArgs: 0,
          allowedInText: true,
          primitive: true
        },
        handler(_ref4) {
          var {
            parser: parser28,
            funcName
          } = _ref4;
          var name = checkControlSequence(parser28.gullet.popToken());
          var middle = parser28.gullet.popToken();
          var tok = parser28.gullet.popToken();
          letCommand(parser28, name, tok, funcName === "\\\\globalfuture");
          parser28.gullet.pushToken(tok);
          parser28.gullet.pushToken(middle);
          return {
            type: "internal",
            mode: parser28.mode
          };
        }
      });
      getMetrics = /* @__PURE__ */ __name(function getMetrics2(symbol, font, mode) {
        var replace2 = symbols.math[symbol] && symbols.math[symbol].replace;
        var metrics = getCharacterMetrics(replace2 || symbol, font, mode);
        if (!metrics) {
          throw new Error("Unsupported symbol " + symbol + " and font size " + font + ".");
        }
        return metrics;
      }, "getMetrics");
      styleWrap = /* @__PURE__ */ __name(function styleWrap2(delim, toStyle, options2, classes3) {
        var newOptions = options2.havingBaseStyle(toStyle);
        var span = buildCommon.makeSpan(classes3.concat(newOptions.sizingClasses(options2)), [delim], options2);
        var delimSizeMultiplier = newOptions.sizeMultiplier / options2.sizeMultiplier;
        span.height *= delimSizeMultiplier;
        span.depth *= delimSizeMultiplier;
        span.maxFontSize = newOptions.sizeMultiplier;
        return span;
      }, "styleWrap");
      centerSpan = /* @__PURE__ */ __name(function centerSpan2(span, options2, style3) {
        var newOptions = options2.havingBaseStyle(style3);
        var shift2 = (1 - options2.sizeMultiplier / newOptions.sizeMultiplier) * options2.fontMetrics().axisHeight;
        span.classes.push("delimcenter");
        span.style.top = makeEm(shift2);
        span.height -= shift2;
        span.depth += shift2;
      }, "centerSpan");
      makeSmallDelim = /* @__PURE__ */ __name(function makeSmallDelim2(delim, style3, center4, options2, mode, classes3) {
        var text4 = buildCommon.makeSymbol(delim, "Main-Regular", mode, options2);
        var span = styleWrap(text4, style3, options2, classes3);
        if (center4) {
          centerSpan(span, options2, style3);
        }
        return span;
      }, "makeSmallDelim");
      mathrmSize = /* @__PURE__ */ __name(function mathrmSize2(value2, size4, mode, options2) {
        return buildCommon.makeSymbol(value2, "Size" + size4 + "-Regular", mode, options2);
      }, "mathrmSize");
      makeLargeDelim = /* @__PURE__ */ __name(function makeLargeDelim2(delim, size4, center4, options2, mode, classes3) {
        var inner2 = mathrmSize(delim, size4, mode, options2);
        var span = styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size4], [inner2], options2), Style$1.TEXT, options2, classes3);
        if (center4) {
          centerSpan(span, options2, Style$1.TEXT);
        }
        return span;
      }, "makeLargeDelim");
      makeGlyphSpan = /* @__PURE__ */ __name(function makeGlyphSpan2(symbol, font, mode) {
        var sizeClass;
        if (font === "Size1-Regular") {
          sizeClass = "delim-size1";
        } else {
          sizeClass = "delim-size4";
        }
        var corner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]);
        return {
          type: "elem",
          elem: corner
        };
      }, "makeGlyphSpan");
      makeInner = /* @__PURE__ */ __name(function makeInner2(ch, height2, options2) {
        var width3 = fontMetricsData["Size4-Regular"][ch.charCodeAt(0)] ? fontMetricsData["Size4-Regular"][ch.charCodeAt(0)][4] : fontMetricsData["Size1-Regular"][ch.charCodeAt(0)][4];
        var path4 = new PathNode("inner", innerPath(ch, Math.round(1e3 * height2)));
        var svgNode2 = new SvgNode([path4], {
          "width": makeEm(width3),
          "height": makeEm(height2),
          // Override CSS rule `.katex svg { width: 100% }`
          "style": "width:" + makeEm(width3),
          "viewBox": "0 0 " + 1e3 * width3 + " " + Math.round(1e3 * height2),
          "preserveAspectRatio": "xMinYMin"
        });
        var span = buildCommon.makeSvgSpan([], [svgNode2], options2);
        span.height = height2;
        span.style.height = makeEm(height2);
        span.style.width = makeEm(width3);
        return {
          type: "elem",
          elem: span
        };
      }, "makeInner");
      lapInEms = 8e-3;
      lap = {
        type: "kern",
        size: -1 * lapInEms
      };
      verts = ["|", "\\lvert", "\\rvert", "\\vert"];
      doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"];
      makeStackedDelim = /* @__PURE__ */ __name(function makeStackedDelim2(delim, heightTotal, center4, options2, mode, classes3) {
        var top2;
        var middle;
        var repeat2;
        var bottom2;
        var svgLabel = "";
        var viewBoxWidth = 0;
        top2 = repeat2 = bottom2 = delim;
        middle = null;
        var font = "Size1-Regular";
        if (delim === "\\uparrow") {
          repeat2 = bottom2 = "\u23D0";
        } else if (delim === "\\Uparrow") {
          repeat2 = bottom2 = "\u2016";
        } else if (delim === "\\downarrow") {
          top2 = repeat2 = "\u23D0";
        } else if (delim === "\\Downarrow") {
          top2 = repeat2 = "\u2016";
        } else if (delim === "\\updownarrow") {
          top2 = "\\uparrow";
          repeat2 = "\u23D0";
          bottom2 = "\\downarrow";
        } else if (delim === "\\Updownarrow") {
          top2 = "\\Uparrow";
          repeat2 = "\u2016";
          bottom2 = "\\Downarrow";
        } else if (verts.includes(delim)) {
          repeat2 = "\u2223";
          svgLabel = "vert";
          viewBoxWidth = 333;
        } else if (doubleVerts.includes(delim)) {
          repeat2 = "\u2225";
          svgLabel = "doublevert";
          viewBoxWidth = 556;
        } else if (delim === "[" || delim === "\\lbrack") {
          top2 = "\u23A1";
          repeat2 = "\u23A2";
          bottom2 = "\u23A3";
          font = "Size4-Regular";
          svgLabel = "lbrack";
          viewBoxWidth = 667;
        } else if (delim === "]" || delim === "\\rbrack") {
          top2 = "\u23A4";
          repeat2 = "\u23A5";
          bottom2 = "\u23A6";
          font = "Size4-Regular";
          svgLabel = "rbrack";
          viewBoxWidth = 667;
        } else if (delim === "\\lfloor" || delim === "\u230A") {
          repeat2 = top2 = "\u23A2";
          bottom2 = "\u23A3";
          font = "Size4-Regular";
          svgLabel = "lfloor";
          viewBoxWidth = 667;
        } else if (delim === "\\lceil" || delim === "\u2308") {
          top2 = "\u23A1";
          repeat2 = bottom2 = "\u23A2";
          font = "Size4-Regular";
          svgLabel = "lceil";
          viewBoxWidth = 667;
        } else if (delim === "\\rfloor" || delim === "\u230B") {
          repeat2 = top2 = "\u23A5";
          bottom2 = "\u23A6";
          font = "Size4-Regular";
          svgLabel = "rfloor";
          viewBoxWidth = 667;
        } else if (delim === "\\rceil" || delim === "\u2309") {
          top2 = "\u23A4";
          repeat2 = bottom2 = "\u23A5";
          font = "Size4-Regular";
          svgLabel = "rceil";
          viewBoxWidth = 667;
        } else if (delim === "(" || delim === "\\lparen") {
          top2 = "\u239B";
          repeat2 = "\u239C";
          bottom2 = "\u239D";
          font = "Size4-Regular";
          svgLabel = "lparen";
          viewBoxWidth = 875;
        } else if (delim === ")" || delim === "\\rparen") {
          top2 = "\u239E";
          repeat2 = "\u239F";
          bottom2 = "\u23A0";
          font = "Size4-Regular";
          svgLabel = "rparen";
          viewBoxWidth = 875;
        } else if (delim === "\\{" || delim === "\\lbrace") {
          top2 = "\u23A7";
          middle = "\u23A8";
          bottom2 = "\u23A9";
          repeat2 = "\u23AA";
          font = "Size4-Regular";
        } else if (delim === "\\}" || delim === "\\rbrace") {
          top2 = "\u23AB";
          middle = "\u23AC";
          bottom2 = "\u23AD";
          repeat2 = "\u23AA";
          font = "Size4-Regular";
        } else if (delim === "\\lgroup" || delim === "\u27EE") {
          top2 = "\u23A7";
          bottom2 = "\u23A9";
          repeat2 = "\u23AA";
          font = "Size4-Regular";
        } else if (delim === "\\rgroup" || delim === "\u27EF") {
          top2 = "\u23AB";
          bottom2 = "\u23AD";
          repeat2 = "\u23AA";
          font = "Size4-Regular";
        } else if (delim === "\\lmoustache" || delim === "\u23B0") {
          top2 = "\u23A7";
          bottom2 = "\u23AD";
          repeat2 = "\u23AA";
          font = "Size4-Regular";
        } else if (delim === "\\rmoustache" || delim === "\u23B1") {
          top2 = "\u23AB";
          bottom2 = "\u23A9";
          repeat2 = "\u23AA";
          font = "Size4-Regular";
        }
        var topMetrics = getMetrics(top2, font, mode);
        var topHeightTotal = topMetrics.height + topMetrics.depth;
        var repeatMetrics = getMetrics(repeat2, font, mode);
        var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth;
        var bottomMetrics = getMetrics(bottom2, font, mode);
        var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth;
        var middleHeightTotal = 0;
        var middleFactor = 1;
        if (middle !== null) {
          var middleMetrics = getMetrics(middle, font, mode);
          middleHeightTotal = middleMetrics.height + middleMetrics.depth;
          middleFactor = 2;
        }
        var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal;
        var repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal)));
        var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal;
        var axisHeight = options2.fontMetrics().axisHeight;
        if (center4) {
          axisHeight *= options2.sizeMultiplier;
        }
        var depth = realHeightTotal / 2 - axisHeight;
        var stack = [];
        if (svgLabel.length > 0) {
          var midHeight = realHeightTotal - topHeightTotal - bottomHeightTotal;
          var viewBoxHeight = Math.round(realHeightTotal * 1e3);
          var pathStr = tallDelim(svgLabel, Math.round(midHeight * 1e3));
          var path4 = new PathNode(svgLabel, pathStr);
          var width3 = (viewBoxWidth / 1e3).toFixed(3) + "em";
          var height2 = (viewBoxHeight / 1e3).toFixed(3) + "em";
          var svg2 = new SvgNode([path4], {
            "width": width3,
            "height": height2,
            "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight
          });
          var wrapper = buildCommon.makeSvgSpan([], [svg2], options2);
          wrapper.height = viewBoxHeight / 1e3;
          wrapper.style.width = width3;
          wrapper.style.height = height2;
          stack.push({
            type: "elem",
            elem: wrapper
          });
        } else {
          stack.push(makeGlyphSpan(bottom2, font, mode));
          stack.push(lap);
          if (middle === null) {
            var innerHeight = realHeightTotal - topHeightTotal - bottomHeightTotal + 2 * lapInEms;
            stack.push(makeInner(repeat2, innerHeight, options2));
          } else {
            var _innerHeight = (realHeightTotal - topHeightTotal - bottomHeightTotal - middleHeightTotal) / 2 + 2 * lapInEms;
            stack.push(makeInner(repeat2, _innerHeight, options2));
            stack.push(lap);
            stack.push(makeGlyphSpan(middle, font, mode));
            stack.push(lap);
            stack.push(makeInner(repeat2, _innerHeight, options2));
          }
          stack.push(lap);
          stack.push(makeGlyphSpan(top2, font, mode));
        }
        var newOptions = options2.havingBaseStyle(Style$1.TEXT);
        var inner2 = buildCommon.makeVList({
          positionType: "bottom",
          positionData: depth,
          children: stack
        }, newOptions);
        return styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner2], newOptions), Style$1.TEXT, options2, classes3);
      }, "makeStackedDelim");
      vbPad = 80;
      emPad = 0.08;
      sqrtSvg = /* @__PURE__ */ __name(function sqrtSvg2(sqrtName, height2, viewBoxHeight, extraVinculum, options2) {
        var path4 = sqrtPath(sqrtName, extraVinculum, viewBoxHeight);
        var pathNode = new PathNode(sqrtName, path4);
        var svg2 = new SvgNode([pathNode], {
          // Note: 1000:1 ratio of viewBox to document em width.
          "width": "400em",
          "height": makeEm(height2),
          "viewBox": "0 0 400000 " + viewBoxHeight,
          "preserveAspectRatio": "xMinYMin slice"
        });
        return buildCommon.makeSvgSpan(["hide-tail"], [svg2], options2);
      }, "sqrtSvg");
      makeSqrtImage = /* @__PURE__ */ __name(function makeSqrtImage2(height2, options2) {
        var newOptions = options2.havingBaseSizing();
        var delim = traverseSequence("\\surd", height2 * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions);
        var sizeMultiplier = newOptions.sizeMultiplier;
        var extraVinculum = Math.max(0, options2.minRuleThickness - options2.fontMetrics().sqrtRuleThickness);
        var span;
        var spanHeight = 0;
        var texHeight = 0;
        var viewBoxHeight = 0;
        var advanceWidth;
        if (delim.type === "small") {
          viewBoxHeight = 1e3 + 1e3 * extraVinculum + vbPad;
          if (height2 < 1) {
            sizeMultiplier = 1;
          } else if (height2 < 1.4) {
            sizeMultiplier = 0.7;
          }
          spanHeight = (1 + extraVinculum + emPad) / sizeMultiplier;
          texHeight = (1 + extraVinculum) / sizeMultiplier;
          span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraVinculum, options2);
          span.style.minWidth = "0.853em";
          advanceWidth = 0.833 / sizeMultiplier;
        } else if (delim.type === "large") {
          viewBoxHeight = (1e3 + vbPad) * sizeToMaxHeight[delim.size];
          texHeight = (sizeToMaxHeight[delim.size] + extraVinculum) / sizeMultiplier;
          spanHeight = (sizeToMaxHeight[delim.size] + extraVinculum + emPad) / sizeMultiplier;
          span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraVinculum, options2);
          span.style.minWidth = "1.02em";
          advanceWidth = 1 / sizeMultiplier;
        } else {
          spanHeight = height2 + extraVinculum + emPad;
          texHeight = height2 + extraVinculum;
          viewBoxHeight = Math.floor(1e3 * height2 + extraVinculum) + vbPad;
          span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraVinculum, options2);
          span.style.minWidth = "0.742em";
          advanceWidth = 1.056;
        }
        span.height = texHeight;
        span.style.height = makeEm(spanHeight);
        return {
          span,
          advanceWidth,
          // Calculate the actual line width.
          // This actually should depend on the chosen font -- e.g. \boldmath
          // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and
          // have thicker rules.
          ruleWidth: (options2.fontMetrics().sqrtRuleThickness + extraVinculum) * sizeMultiplier
        };
      }, "makeSqrtImage");
      stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"];
      stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27EE", "\u27EF", "\\lmoustache", "\\rmoustache", "\u23B0", "\u23B1"];
      stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"];
      sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3];
      makeSizedDelim = /* @__PURE__ */ __name(function makeSizedDelim2(delim, size4, options2, mode, classes3) {
        if (delim === "<" || delim === "\\lt" || delim === "\u27E8") {
          delim = "\\langle";
        } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") {
          delim = "\\rangle";
        }
        if (stackLargeDelimiters.includes(delim) || stackNeverDelimiters.includes(delim)) {
          return makeLargeDelim(delim, size4, false, options2, mode, classes3);
        } else if (stackAlwaysDelimiters.includes(delim)) {
          return makeStackedDelim(delim, sizeToMaxHeight[size4], false, options2, mode, classes3);
        } else {
          throw new ParseError("Illegal delimiter: '" + delim + "'");
        }
      }, "makeSizedDelim");
      stackNeverDelimiterSequence = [{
        type: "small",
        style: Style$1.SCRIPTSCRIPT
      }, {
        type: "small",
        style: Style$1.SCRIPT
      }, {
        type: "small",
        style: Style$1.TEXT
      }, {
        type: "large",
        size: 1
      }, {
        type: "large",
        size: 2
      }, {
        type: "large",
        size: 3
      }, {
        type: "large",
        size: 4
      }];
      stackAlwaysDelimiterSequence = [{
        type: "small",
        style: Style$1.SCRIPTSCRIPT
      }, {
        type: "small",
        style: Style$1.SCRIPT
      }, {
        type: "small",
        style: Style$1.TEXT
      }, {
        type: "stack"
      }];
      stackLargeDelimiterSequence = [{
        type: "small",
        style: Style$1.SCRIPTSCRIPT
      }, {
        type: "small",
        style: Style$1.SCRIPT
      }, {
        type: "small",
        style: Style$1.TEXT
      }, {
        type: "large",
        size: 1
      }, {
        type: "large",
        size: 2
      }, {
        type: "large",
        size: 3
      }, {
        type: "large",
        size: 4
      }, {
        type: "stack"
      }];
      delimTypeToFont = /* @__PURE__ */ __name(function delimTypeToFont2(type3) {
        if (type3.type === "small") {
          return "Main-Regular";
        } else if (type3.type === "large") {
          return "Size" + type3.size + "-Regular";
        } else if (type3.type === "stack") {
          return "Size4-Regular";
        } else {
          throw new Error("Add support for delim type '" + type3.type + "' here.");
        }
      }, "delimTypeToFont");
      traverseSequence = /* @__PURE__ */ __name(function traverseSequence2(delim, height2, sequence, options2) {
        var start3 = Math.min(2, 3 - options2.style.size);
        for (var i2 = start3; i2 < sequence.length; i2++) {
          if (sequence[i2].type === "stack") {
            break;
          }
          var metrics = getMetrics(delim, delimTypeToFont(sequence[i2]), "math");
          var heightDepth = metrics.height + metrics.depth;
          if (sequence[i2].type === "small") {
            var newOptions = options2.havingBaseStyle(sequence[i2].style);
            heightDepth *= newOptions.sizeMultiplier;
          }
          if (heightDepth > height2) {
            return sequence[i2];
          }
        }
        return sequence[sequence.length - 1];
      }, "traverseSequence");
      makeCustomSizedDelim = /* @__PURE__ */ __name(function makeCustomSizedDelim2(delim, height2, center4, options2, mode, classes3) {
        if (delim === "<" || delim === "\\lt" || delim === "\u27E8") {
          delim = "\\langle";
        } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") {
          delim = "\\rangle";
        }
        var sequence;
        if (stackNeverDelimiters.includes(delim)) {
          sequence = stackNeverDelimiterSequence;
        } else if (stackLargeDelimiters.includes(delim)) {
          sequence = stackLargeDelimiterSequence;
        } else {
          sequence = stackAlwaysDelimiterSequence;
        }
        var delimType = traverseSequence(delim, height2, sequence, options2);
        if (delimType.type === "small") {
          return makeSmallDelim(delim, delimType.style, center4, options2, mode, classes3);
        } else if (delimType.type === "large") {
          return makeLargeDelim(delim, delimType.size, center4, options2, mode, classes3);
        } else {
          return makeStackedDelim(delim, height2, center4, options2, mode, classes3);
        }
      }, "makeCustomSizedDelim");
      makeLeftRightDelim = /* @__PURE__ */ __name(function makeLeftRightDelim2(delim, height2, depth, options2, mode, classes3) {
        var axisHeight = options2.fontMetrics().axisHeight * options2.sizeMultiplier;
        var delimiterFactor = 901;
        var delimiterExtend = 5 / options2.fontMetrics().ptPerEm;
        var maxDistFromAxis = Math.max(height2 - axisHeight, depth + axisHeight);
        var totalHeight = Math.max(
          // In real TeX, calculations are done using integral values which are
          // 65536 per pt, or 655360 per em. So, the division here truncates in
          // TeX but doesn't here, producing different results. If we wanted to
          // exactly match TeX's calculation, we could do
          //   Math.floor(655360 * maxDistFromAxis / 500) *
          //    delimiterFactor / 655360
          // (To see the difference, compare
          //    x^{x^{\left(\rule{0.1em}{0.68em}\right)}}
          // in TeX and KaTeX)
          maxDistFromAxis / 500 * delimiterFactor,
          2 * maxDistFromAxis - delimiterExtend
        );
        return makeCustomSizedDelim(delim, totalHeight, true, options2, mode, classes3);
      }, "makeLeftRightDelim");
      delimiter = {
        sqrtImage: makeSqrtImage,
        sizedDelim: makeSizedDelim,
        sizeToMaxHeight,
        customSizedDelim: makeCustomSizedDelim,
        leftRightDelim: makeLeftRightDelim
      };
      delimiterSizes = {
        "\\bigl": {
          mclass: "mopen",
          size: 1
        },
        "\\Bigl": {
          mclass: "mopen",
          size: 2
        },
        "\\biggl": {
          mclass: "mopen",
          size: 3
        },
        "\\Biggl": {
          mclass: "mopen",
          size: 4
        },
        "\\bigr": {
          mclass: "mclose",
          size: 1
        },
        "\\Bigr": {
          mclass: "mclose",
          size: 2
        },
        "\\biggr": {
          mclass: "mclose",
          size: 3
        },
        "\\Biggr": {
          mclass: "mclose",
          size: 4
        },
        "\\bigm": {
          mclass: "mrel",
          size: 1
        },
        "\\Bigm": {
          mclass: "mrel",
          size: 2
        },
        "\\biggm": {
          mclass: "mrel",
          size: 3
        },
        "\\Biggm": {
          mclass: "mrel",
          size: 4
        },
        "\\big": {
          mclass: "mord",
          size: 1
        },
        "\\Big": {
          mclass: "mord",
          size: 2
        },
        "\\bigg": {
          mclass: "mord",
          size: 3
        },
        "\\Bigg": {
          mclass: "mord",
          size: 4
        }
      };
      delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "<", ">", "\\langle", "\u27E8", "\\rangle", "\u27E9", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27EE", "\u27EF", "\\lmoustache", "\\rmoustache", "\u23B0", "\u23B1", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."];
      __name(checkDelimiter, "checkDelimiter");
      defineFunction({
        type: "delimsizing",
        names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"],
        props: {
          numArgs: 1,
          argTypes: ["primitive"]
        },
        handler: /* @__PURE__ */ __name((context, args) => {
          var delim = checkDelimiter(args[0], context);
          return {
            type: "delimsizing",
            mode: context.parser.mode,
            size: delimiterSizes[context.funcName].size,
            mclass: delimiterSizes[context.funcName].mclass,
            delim: delim.text
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          if (group2.delim === ".") {
            return buildCommon.makeSpan([group2.mclass]);
          }
          return delimiter.sizedDelim(group2.delim, group2.size, options2, group2.mode, [group2.mclass]);
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2) => {
          var children2 = [];
          if (group2.delim !== ".") {
            children2.push(makeText(group2.delim, group2.mode));
          }
          var node2 = new mathMLTree.MathNode("mo", children2);
          if (group2.mclass === "mopen" || group2.mclass === "mclose") {
            node2.setAttribute("fence", "true");
          } else {
            node2.setAttribute("fence", "false");
          }
          node2.setAttribute("stretchy", "true");
          var size4 = makeEm(delimiter.sizeToMaxHeight[group2.size]);
          node2.setAttribute("minsize", size4);
          node2.setAttribute("maxsize", size4);
          return node2;
        }, "mathmlBuilder")
      });
      __name(assertParsed, "assertParsed");
      defineFunction({
        type: "leftright-right",
        names: ["\\right"],
        props: {
          numArgs: 1,
          primitive: true
        },
        handler: /* @__PURE__ */ __name((context, args) => {
          var color2 = context.parser.gullet.macros.get("\\current@color");
          if (color2 && typeof color2 !== "string") {
            throw new ParseError("\\current@color set to non-string in \\right");
          }
          return {
            type: "leftright-right",
            mode: context.parser.mode,
            delim: checkDelimiter(args[0], context).text,
            color: color2
            // undefined if not set via \color
          };
        }, "handler")
      });
      defineFunction({
        type: "leftright",
        names: ["\\left"],
        props: {
          numArgs: 1,
          primitive: true
        },
        handler: /* @__PURE__ */ __name((context, args) => {
          var delim = checkDelimiter(args[0], context);
          var parser28 = context.parser;
          ++parser28.leftrightDepth;
          var body = parser28.parseExpression(false);
          --parser28.leftrightDepth;
          parser28.expect("\\right", false);
          var right3 = assertNodeType(parser28.parseFunction(), "leftright-right");
          return {
            type: "leftright",
            mode: parser28.mode,
            body,
            left: delim.text,
            right: right3.delim,
            rightColor: right3.color
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          assertParsed(group2);
          var inner2 = buildExpression$1(group2.body, options2, true, ["mopen", "mclose"]);
          var innerHeight = 0;
          var innerDepth = 0;
          var hadMiddle = false;
          for (var i2 = 0; i2 < inner2.length; i2++) {
            if (inner2[i2].isMiddle) {
              hadMiddle = true;
            } else {
              innerHeight = Math.max(inner2[i2].height, innerHeight);
              innerDepth = Math.max(inner2[i2].depth, innerDepth);
            }
          }
          innerHeight *= options2.sizeMultiplier;
          innerDepth *= options2.sizeMultiplier;
          var leftDelim;
          if (group2.left === ".") {
            leftDelim = makeNullDelimiter(options2, ["mopen"]);
          } else {
            leftDelim = delimiter.leftRightDelim(group2.left, innerHeight, innerDepth, options2, group2.mode, ["mopen"]);
          }
          inner2.unshift(leftDelim);
          if (hadMiddle) {
            for (var _i = 1; _i < inner2.length; _i++) {
              var middleDelim = inner2[_i];
              var isMiddle = middleDelim.isMiddle;
              if (isMiddle) {
                inner2[_i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group2.mode, []);
              }
            }
          }
          var rightDelim;
          if (group2.right === ".") {
            rightDelim = makeNullDelimiter(options2, ["mclose"]);
          } else {
            var colorOptions = group2.rightColor ? options2.withColor(group2.rightColor) : options2;
            rightDelim = delimiter.leftRightDelim(group2.right, innerHeight, innerDepth, colorOptions, group2.mode, ["mclose"]);
          }
          inner2.push(rightDelim);
          return buildCommon.makeSpan(["minner"], inner2, options2);
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          assertParsed(group2);
          var inner2 = buildExpression2(group2.body, options2);
          if (group2.left !== ".") {
            var leftNode = new mathMLTree.MathNode("mo", [makeText(group2.left, group2.mode)]);
            leftNode.setAttribute("fence", "true");
            inner2.unshift(leftNode);
          }
          if (group2.right !== ".") {
            var rightNode = new mathMLTree.MathNode("mo", [makeText(group2.right, group2.mode)]);
            rightNode.setAttribute("fence", "true");
            if (group2.rightColor) {
              rightNode.setAttribute("mathcolor", group2.rightColor);
            }
            inner2.push(rightNode);
          }
          return makeRow(inner2);
        }, "mathmlBuilder")
      });
      defineFunction({
        type: "middle",
        names: ["\\middle"],
        props: {
          numArgs: 1,
          primitive: true
        },
        handler: /* @__PURE__ */ __name((context, args) => {
          var delim = checkDelimiter(args[0], context);
          if (!context.parser.leftrightDepth) {
            throw new ParseError("\\middle without preceding \\left", delim);
          }
          return {
            type: "middle",
            mode: context.parser.mode,
            delim: delim.text
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var middleDelim;
          if (group2.delim === ".") {
            middleDelim = makeNullDelimiter(options2, []);
          } else {
            middleDelim = delimiter.sizedDelim(group2.delim, 1, options2, group2.mode, []);
            var isMiddle = {
              delim: group2.delim,
              options: options2
            };
            middleDelim.isMiddle = isMiddle;
          }
          return middleDelim;
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var textNode = group2.delim === "\\vert" || group2.delim === "|" ? makeText("|", "text") : makeText(group2.delim, group2.mode);
          var middleNode = new mathMLTree.MathNode("mo", [textNode]);
          middleNode.setAttribute("fence", "true");
          middleNode.setAttribute("lspace", "0.05em");
          middleNode.setAttribute("rspace", "0.05em");
          return middleNode;
        }, "mathmlBuilder")
      });
      htmlBuilder$7 = /* @__PURE__ */ __name((group2, options2) => {
        var inner2 = buildCommon.wrapFragment(buildGroup$1(group2.body, options2), options2);
        var label = group2.label.slice(1);
        var scale3 = options2.sizeMultiplier;
        var img;
        var imgShift = 0;
        var isSingleChar = utils.isCharacterBox(group2.body);
        if (label === "sout") {
          img = buildCommon.makeSpan(["stretchy", "sout"]);
          img.height = options2.fontMetrics().defaultRuleThickness / scale3;
          imgShift = -0.5 * options2.fontMetrics().xHeight;
        } else if (label === "phase") {
          var lineWeight = calculateSize2({
            number: 0.6,
            unit: "pt"
          }, options2);
          var clearance = calculateSize2({
            number: 0.35,
            unit: "ex"
          }, options2);
          var newOptions = options2.havingBaseSizing();
          scale3 = scale3 / newOptions.sizeMultiplier;
          var angleHeight = inner2.height + inner2.depth + lineWeight + clearance;
          inner2.style.paddingLeft = makeEm(angleHeight / 2 + lineWeight);
          var viewBoxHeight = Math.floor(1e3 * angleHeight * scale3);
          var path4 = phasePath(viewBoxHeight);
          var svgNode2 = new SvgNode([new PathNode("phase", path4)], {
            "width": "400em",
            "height": makeEm(viewBoxHeight / 1e3),
            "viewBox": "0 0 400000 " + viewBoxHeight,
            "preserveAspectRatio": "xMinYMin slice"
          });
          img = buildCommon.makeSvgSpan(["hide-tail"], [svgNode2], options2);
          img.style.height = makeEm(angleHeight);
          imgShift = inner2.depth + lineWeight + clearance;
        } else {
          if (/cancel/.test(label)) {
            if (!isSingleChar) {
              inner2.classes.push("cancel-pad");
            }
          } else if (label === "angl") {
            inner2.classes.push("anglpad");
          } else {
            inner2.classes.push("boxpad");
          }
          var topPad = 0;
          var bottomPad = 0;
          var ruleThickness = 0;
          if (/box/.test(label)) {
            ruleThickness = Math.max(
              options2.fontMetrics().fboxrule,
              // default
              options2.minRuleThickness
              // User override.
            );
            topPad = options2.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness);
            bottomPad = topPad;
          } else if (label === "angl") {
            ruleThickness = Math.max(options2.fontMetrics().defaultRuleThickness, options2.minRuleThickness);
            topPad = 4 * ruleThickness;
            bottomPad = Math.max(0, 0.25 - inner2.depth);
          } else {
            topPad = isSingleChar ? 0.2 : 0;
            bottomPad = topPad;
          }
          img = stretchy.encloseSpan(inner2, label, topPad, bottomPad, options2);
          if (/fbox|boxed|fcolorbox/.test(label)) {
            img.style.borderStyle = "solid";
            img.style.borderWidth = makeEm(ruleThickness);
          } else if (label === "angl" && ruleThickness !== 0.049) {
            img.style.borderTopWidth = makeEm(ruleThickness);
            img.style.borderRightWidth = makeEm(ruleThickness);
          }
          imgShift = inner2.depth + bottomPad;
          if (group2.backgroundColor) {
            img.style.backgroundColor = group2.backgroundColor;
            if (group2.borderColor) {
              img.style.borderColor = group2.borderColor;
            }
          }
        }
        var vlist;
        if (group2.backgroundColor) {
          vlist = buildCommon.makeVList({
            positionType: "individualShift",
            children: [
              // Put the color background behind inner;
              {
                type: "elem",
                elem: img,
                shift: imgShift
              },
              {
                type: "elem",
                elem: inner2,
                shift: 0
              }
            ]
          }, options2);
        } else {
          var classes3 = /cancel|phase/.test(label) ? ["svg-align"] : [];
          vlist = buildCommon.makeVList({
            positionType: "individualShift",
            children: [
              // Write the \cancel stroke on top of inner.
              {
                type: "elem",
                elem: inner2,
                shift: 0
              },
              {
                type: "elem",
                elem: img,
                shift: imgShift,
                wrapperClasses: classes3
              }
            ]
          }, options2);
        }
        if (/cancel/.test(label)) {
          vlist.height = inner2.height;
          vlist.depth = inner2.depth;
        }
        if (/cancel/.test(label) && !isSingleChar) {
          return buildCommon.makeSpan(["mord", "cancel-lap"], [vlist], options2);
        } else {
          return buildCommon.makeSpan(["mord"], [vlist], options2);
        }
      }, "htmlBuilder$7");
      mathmlBuilder$6 = /* @__PURE__ */ __name((group2, options2) => {
        var fboxsep = 0;
        var node2 = new mathMLTree.MathNode(group2.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildGroup2(group2.body, options2)]);
        switch (group2.label) {
          case "\\cancel":
            node2.setAttribute("notation", "updiagonalstrike");
            break;
          case "\\bcancel":
            node2.setAttribute("notation", "downdiagonalstrike");
            break;
          case "\\phase":
            node2.setAttribute("notation", "phasorangle");
            break;
          case "\\sout":
            node2.setAttribute("notation", "horizontalstrike");
            break;
          case "\\fbox":
            node2.setAttribute("notation", "box");
            break;
          case "\\angl":
            node2.setAttribute("notation", "actuarial");
            break;
          case "\\fcolorbox":
          case "\\colorbox":
            fboxsep = options2.fontMetrics().fboxsep * options2.fontMetrics().ptPerEm;
            node2.setAttribute("width", "+" + 2 * fboxsep + "pt");
            node2.setAttribute("height", "+" + 2 * fboxsep + "pt");
            node2.setAttribute("lspace", fboxsep + "pt");
            node2.setAttribute("voffset", fboxsep + "pt");
            if (group2.label === "\\fcolorbox") {
              var thk = Math.max(
                options2.fontMetrics().fboxrule,
                // default
                options2.minRuleThickness
                // user override
              );
              node2.setAttribute("style", "border: " + thk + "em solid " + String(group2.borderColor));
            }
            break;
          case "\\xcancel":
            node2.setAttribute("notation", "updiagonalstrike downdiagonalstrike");
            break;
        }
        if (group2.backgroundColor) {
          node2.setAttribute("mathbackground", group2.backgroundColor);
        }
        return node2;
      }, "mathmlBuilder$6");
      defineFunction({
        type: "enclose",
        names: ["\\colorbox"],
        props: {
          numArgs: 2,
          allowedInText: true,
          argTypes: ["color", "text"]
        },
        handler(_ref, args, optArgs) {
          var {
            parser: parser28,
            funcName
          } = _ref;
          var color2 = assertNodeType(args[0], "color-token").color;
          var body = args[1];
          return {
            type: "enclose",
            mode: parser28.mode,
            label: funcName,
            backgroundColor: color2,
            body
          };
        },
        htmlBuilder: htmlBuilder$7,
        mathmlBuilder: mathmlBuilder$6
      });
      defineFunction({
        type: "enclose",
        names: ["\\fcolorbox"],
        props: {
          numArgs: 3,
          allowedInText: true,
          argTypes: ["color", "color", "text"]
        },
        handler(_ref2, args, optArgs) {
          var {
            parser: parser28,
            funcName
          } = _ref2;
          var borderColor = assertNodeType(args[0], "color-token").color;
          var backgroundColor = assertNodeType(args[1], "color-token").color;
          var body = args[2];
          return {
            type: "enclose",
            mode: parser28.mode,
            label: funcName,
            backgroundColor,
            borderColor,
            body
          };
        },
        htmlBuilder: htmlBuilder$7,
        mathmlBuilder: mathmlBuilder$6
      });
      defineFunction({
        type: "enclose",
        names: ["\\fbox"],
        props: {
          numArgs: 1,
          argTypes: ["hbox"],
          allowedInText: true
        },
        handler(_ref3, args) {
          var {
            parser: parser28
          } = _ref3;
          return {
            type: "enclose",
            mode: parser28.mode,
            label: "\\fbox",
            body: args[0]
          };
        }
      });
      defineFunction({
        type: "enclose",
        names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"],
        props: {
          numArgs: 1
        },
        handler(_ref4, args) {
          var {
            parser: parser28,
            funcName
          } = _ref4;
          var body = args[0];
          return {
            type: "enclose",
            mode: parser28.mode,
            label: funcName,
            body
          };
        },
        htmlBuilder: htmlBuilder$7,
        mathmlBuilder: mathmlBuilder$6
      });
      defineFunction({
        type: "enclose",
        names: ["\\angl"],
        props: {
          numArgs: 1,
          argTypes: ["hbox"],
          allowedInText: false
        },
        handler(_ref5, args) {
          var {
            parser: parser28
          } = _ref5;
          return {
            type: "enclose",
            mode: parser28.mode,
            label: "\\angl",
            body: args[0]
          };
        }
      });
      _environments = {};
      __name(defineEnvironment, "defineEnvironment");
      _macros = {};
      __name(defineMacro, "defineMacro");
      __name(getHLines, "getHLines");
      validateAmsEnvironmentContext = /* @__PURE__ */ __name((context) => {
        var settings = context.parser.settings;
        if (!settings.displayMode) {
          throw new ParseError("{" + context.envName + "} can be used only in display mode.");
        }
      }, "validateAmsEnvironmentContext");
      __name(getAutoTag, "getAutoTag");
      __name(parseArray, "parseArray");
      __name(dCellStyle, "dCellStyle");
      htmlBuilder$6 = /* @__PURE__ */ __name(function htmlBuilder(group2, options2) {
        var r2;
        var c3;
        var nr = group2.body.length;
        var hLinesBeforeRow = group2.hLinesBeforeRow;
        var nc = 0;
        var body = new Array(nr);
        var hlines = [];
        var ruleThickness = Math.max(
          // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em.
          options2.fontMetrics().arrayRuleWidth,
          options2.minRuleThickness
          // User override.
        );
        var pt = 1 / options2.fontMetrics().ptPerEm;
        var arraycolsep = 5 * pt;
        if (group2.colSeparationType && group2.colSeparationType === "small") {
          var localMultiplier = options2.havingStyle(Style$1.SCRIPT).sizeMultiplier;
          arraycolsep = 0.2778 * (localMultiplier / options2.sizeMultiplier);
        }
        var baselineskip = group2.colSeparationType === "CD" ? calculateSize2({
          number: 3,
          unit: "ex"
        }, options2) : 12 * pt;
        var jot = 3 * pt;
        var arrayskip = group2.arraystretch * baselineskip;
        var arstrutHeight = 0.7 * arrayskip;
        var arstrutDepth = 0.3 * arrayskip;
        var totalHeight = 0;
        function setHLinePos(hlinesInGap) {
          for (var i2 = 0; i2 < hlinesInGap.length; ++i2) {
            if (i2 > 0) {
              totalHeight += 0.25;
            }
            hlines.push({
              pos: totalHeight,
              isDashed: hlinesInGap[i2]
            });
          }
        }
        __name(setHLinePos, "setHLinePos");
        setHLinePos(hLinesBeforeRow[0]);
        for (r2 = 0; r2 < group2.body.length; ++r2) {
          var inrow = group2.body[r2];
          var height2 = arstrutHeight;
          var depth = arstrutDepth;
          if (nc < inrow.length) {
            nc = inrow.length;
          }
          var outrow = new Array(inrow.length);
          for (c3 = 0; c3 < inrow.length; ++c3) {
            var elt = buildGroup$1(inrow[c3], options2);
            if (depth < elt.depth) {
              depth = elt.depth;
            }
            if (height2 < elt.height) {
              height2 = elt.height;
            }
            outrow[c3] = elt;
          }
          var rowGap = group2.rowGaps[r2];
          var gap = 0;
          if (rowGap) {
            gap = calculateSize2(rowGap, options2);
            if (gap > 0) {
              gap += arstrutDepth;
              if (depth < gap) {
                depth = gap;
              }
              gap = 0;
            }
          }
          if (group2.addJot) {
            depth += jot;
          }
          outrow.height = height2;
          outrow.depth = depth;
          totalHeight += height2;
          outrow.pos = totalHeight;
          totalHeight += depth + gap;
          body[r2] = outrow;
          setHLinePos(hLinesBeforeRow[r2 + 1]);
        }
        var offset = totalHeight / 2 + options2.fontMetrics().axisHeight;
        var colDescriptions = group2.cols || [];
        var cols = [];
        var colSep;
        var colDescrNum;
        var tagSpans = [];
        if (group2.tags && group2.tags.some((tag2) => tag2)) {
          for (r2 = 0; r2 < nr; ++r2) {
            var rw = body[r2];
            var shift2 = rw.pos - offset;
            var tag = group2.tags[r2];
            var tagSpan = void 0;
            if (tag === true) {
              tagSpan = buildCommon.makeSpan(["eqn-num"], [], options2);
            } else if (tag === false) {
              tagSpan = buildCommon.makeSpan([], [], options2);
            } else {
              tagSpan = buildCommon.makeSpan([], buildExpression$1(tag, options2, true), options2);
            }
            tagSpan.depth = rw.depth;
            tagSpan.height = rw.height;
            tagSpans.push({
              type: "elem",
              elem: tagSpan,
              shift: shift2
            });
          }
        }
        for (
          c3 = 0, colDescrNum = 0;
          // Continue while either there are more columns or more column
          // descriptions, so trailing separators don't get lost.
          c3 < nc || colDescrNum < colDescriptions.length;
          ++c3, ++colDescrNum
        ) {
          var colDescr = colDescriptions[colDescrNum] || {};
          var firstSeparator = true;
          while (colDescr.type === "separator") {
            if (!firstSeparator) {
              colSep = buildCommon.makeSpan(["arraycolsep"], []);
              colSep.style.width = makeEm(options2.fontMetrics().doubleRuleSep);
              cols.push(colSep);
            }
            if (colDescr.separator === "|" || colDescr.separator === ":") {
              var lineType = colDescr.separator === "|" ? "solid" : "dashed";
              var separator = buildCommon.makeSpan(["vertical-separator"], [], options2);
              separator.style.height = makeEm(totalHeight);
              separator.style.borderRightWidth = makeEm(ruleThickness);
              separator.style.borderRightStyle = lineType;
              separator.style.margin = "0 " + makeEm(-ruleThickness / 2);
              var _shift = totalHeight - offset;
              if (_shift) {
                separator.style.verticalAlign = makeEm(-_shift);
              }
              cols.push(separator);
            } else {
              throw new ParseError("Invalid separator type: " + colDescr.separator);
            }
            colDescrNum++;
            colDescr = colDescriptions[colDescrNum] || {};
            firstSeparator = false;
          }
          if (c3 >= nc) {
            continue;
          }
          var sepwidth = void 0;
          if (c3 > 0 || group2.hskipBeforeAndAfter) {
            sepwidth = utils.deflt(colDescr.pregap, arraycolsep);
            if (sepwidth !== 0) {
              colSep = buildCommon.makeSpan(["arraycolsep"], []);
              colSep.style.width = makeEm(sepwidth);
              cols.push(colSep);
            }
          }
          var col = [];
          for (r2 = 0; r2 < nr; ++r2) {
            var row = body[r2];
            var elem = row[c3];
            if (!elem) {
              continue;
            }
            var _shift2 = row.pos - offset;
            elem.depth = row.depth;
            elem.height = row.height;
            col.push({
              type: "elem",
              elem,
              shift: _shift2
            });
          }
          col = buildCommon.makeVList({
            positionType: "individualShift",
            children: col
          }, options2);
          col = buildCommon.makeSpan(["col-align-" + (colDescr.align || "c")], [col]);
          cols.push(col);
          if (c3 < nc - 1 || group2.hskipBeforeAndAfter) {
            sepwidth = utils.deflt(colDescr.postgap, arraycolsep);
            if (sepwidth !== 0) {
              colSep = buildCommon.makeSpan(["arraycolsep"], []);
              colSep.style.width = makeEm(sepwidth);
              cols.push(colSep);
            }
          }
        }
        body = buildCommon.makeSpan(["mtable"], cols);
        if (hlines.length > 0) {
          var line2 = buildCommon.makeLineSpan("hline", options2, ruleThickness);
          var dashes = buildCommon.makeLineSpan("hdashline", options2, ruleThickness);
          var vListElems = [{
            type: "elem",
            elem: body,
            shift: 0
          }];
          while (hlines.length > 0) {
            var hline = hlines.pop();
            var lineShift = hline.pos - offset;
            if (hline.isDashed) {
              vListElems.push({
                type: "elem",
                elem: dashes,
                shift: lineShift
              });
            } else {
              vListElems.push({
                type: "elem",
                elem: line2,
                shift: lineShift
              });
            }
          }
          body = buildCommon.makeVList({
            positionType: "individualShift",
            children: vListElems
          }, options2);
        }
        if (tagSpans.length === 0) {
          return buildCommon.makeSpan(["mord"], [body], options2);
        } else {
          var eqnNumCol = buildCommon.makeVList({
            positionType: "individualShift",
            children: tagSpans
          }, options2);
          eqnNumCol = buildCommon.makeSpan(["tag"], [eqnNumCol], options2);
          return buildCommon.makeFragment([body, eqnNumCol]);
        }
      }, "htmlBuilder");
      alignMap = {
        c: "center ",
        l: "left ",
        r: "right "
      };
      mathmlBuilder$5 = /* @__PURE__ */ __name(function mathmlBuilder(group2, options2) {
        var tbl = [];
        var glue = new mathMLTree.MathNode("mtd", [], ["mtr-glue"]);
        var tag = new mathMLTree.MathNode("mtd", [], ["mml-eqn-num"]);
        for (var i2 = 0; i2 < group2.body.length; i2++) {
          var rw = group2.body[i2];
          var row = [];
          for (var j3 = 0; j3 < rw.length; j3++) {
            row.push(new mathMLTree.MathNode("mtd", [buildGroup2(rw[j3], options2)]));
          }
          if (group2.tags && group2.tags[i2]) {
            row.unshift(glue);
            row.push(glue);
            if (group2.leqno) {
              row.unshift(tag);
            } else {
              row.push(tag);
            }
          }
          tbl.push(new mathMLTree.MathNode("mtr", row));
        }
        var table = new mathMLTree.MathNode("mtable", tbl);
        var gap = group2.arraystretch === 0.5 ? 0.1 : 0.16 + group2.arraystretch - 1 + (group2.addJot ? 0.09 : 0);
        table.setAttribute("rowspacing", makeEm(gap));
        var menclose = "";
        var align = "";
        if (group2.cols && group2.cols.length > 0) {
          var cols = group2.cols;
          var columnLines = "";
          var prevTypeWasAlign = false;
          var iStart = 0;
          var iEnd = cols.length;
          if (cols[0].type === "separator") {
            menclose += "top ";
            iStart = 1;
          }
          if (cols[cols.length - 1].type === "separator") {
            menclose += "bottom ";
            iEnd -= 1;
          }
          for (var _i = iStart; _i < iEnd; _i++) {
            if (cols[_i].type === "align") {
              align += alignMap[cols[_i].align];
              if (prevTypeWasAlign) {
                columnLines += "none ";
              }
              prevTypeWasAlign = true;
            } else if (cols[_i].type === "separator") {
              if (prevTypeWasAlign) {
                columnLines += cols[_i].separator === "|" ? "solid " : "dashed ";
                prevTypeWasAlign = false;
              }
            }
          }
          table.setAttribute("columnalign", align.trim());
          if (/[sd]/.test(columnLines)) {
            table.setAttribute("columnlines", columnLines.trim());
          }
        }
        if (group2.colSeparationType === "align") {
          var _cols = group2.cols || [];
          var spacing2 = "";
          for (var _i2 = 1; _i2 < _cols.length; _i2++) {
            spacing2 += _i2 % 2 ? "0em " : "1em ";
          }
          table.setAttribute("columnspacing", spacing2.trim());
        } else if (group2.colSeparationType === "alignat" || group2.colSeparationType === "gather") {
          table.setAttribute("columnspacing", "0em");
        } else if (group2.colSeparationType === "small") {
          table.setAttribute("columnspacing", "0.2778em");
        } else if (group2.colSeparationType === "CD") {
          table.setAttribute("columnspacing", "0.5em");
        } else {
          table.setAttribute("columnspacing", "1em");
        }
        var rowLines = "";
        var hlines = group2.hLinesBeforeRow;
        menclose += hlines[0].length > 0 ? "left " : "";
        menclose += hlines[hlines.length - 1].length > 0 ? "right " : "";
        for (var _i3 = 1; _i3 < hlines.length - 1; _i3++) {
          rowLines += hlines[_i3].length === 0 ? "none " : hlines[_i3][0] ? "dashed " : "solid ";
        }
        if (/[sd]/.test(rowLines)) {
          table.setAttribute("rowlines", rowLines.trim());
        }
        if (menclose !== "") {
          table = new mathMLTree.MathNode("menclose", [table]);
          table.setAttribute("notation", menclose.trim());
        }
        if (group2.arraystretch && group2.arraystretch < 1) {
          table = new mathMLTree.MathNode("mstyle", [table]);
          table.setAttribute("scriptlevel", "1");
        }
        return table;
      }, "mathmlBuilder");
      alignedHandler = /* @__PURE__ */ __name(function alignedHandler2(context, args) {
        if (context.envName.indexOf("ed") === -1) {
          validateAmsEnvironmentContext(context);
        }
        var cols = [];
        var separationType = context.envName.indexOf("at") > -1 ? "alignat" : "align";
        var isSplit = context.envName === "split";
        var res = parseArray(context.parser, {
          cols,
          addJot: true,
          autoTag: isSplit ? void 0 : getAutoTag(context.envName),
          emptySingleRow: true,
          colSeparationType: separationType,
          maxNumCols: isSplit ? 2 : void 0,
          leqno: context.parser.settings.leqno
        }, "display");
        var numMaths;
        var numCols = 0;
        var emptyGroup = {
          type: "ordgroup",
          mode: context.mode,
          body: []
        };
        if (args[0] && args[0].type === "ordgroup") {
          var arg0 = "";
          for (var i2 = 0; i2 < args[0].body.length; i2++) {
            var textord2 = assertNodeType(args[0].body[i2], "textord");
            arg0 += textord2.text;
          }
          numMaths = Number(arg0);
          numCols = numMaths * 2;
        }
        var isAligned = !numCols;
        res.body.forEach(function(row) {
          for (var _i4 = 1; _i4 < row.length; _i4 += 2) {
            var styling = assertNodeType(row[_i4], "styling");
            var ordgroup = assertNodeType(styling.body[0], "ordgroup");
            ordgroup.body.unshift(emptyGroup);
          }
          if (!isAligned) {
            var curMaths = row.length / 2;
            if (numMaths < curMaths) {
              throw new ParseError("Too many math in a row: " + ("expected " + numMaths + ", but got " + curMaths), row[0]);
            }
          } else if (numCols < row.length) {
            numCols = row.length;
          }
        });
        for (var _i5 = 0; _i5 < numCols; ++_i5) {
          var align = "r";
          var pregap = 0;
          if (_i5 % 2 === 1) {
            align = "l";
          } else if (_i5 > 0 && isAligned) {
            pregap = 1;
          }
          cols[_i5] = {
            type: "align",
            align,
            pregap,
            postgap: 0
          };
        }
        res.colSeparationType = isAligned ? "align" : "alignat";
        return res;
      }, "alignedHandler");
      defineEnvironment({
        type: "array",
        names: ["array", "darray"],
        props: {
          numArgs: 1
        },
        handler(context, args) {
          var symNode = checkSymbolNodeType(args[0]);
          var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body;
          var cols = colalign.map(function(nde) {
            var node2 = assertSymbolNodeType(nde);
            var ca = node2.text;
            if ("lcr".indexOf(ca) !== -1) {
              return {
                type: "align",
                align: ca
              };
            } else if (ca === "|") {
              return {
                type: "separator",
                separator: "|"
              };
            } else if (ca === ":") {
              return {
                type: "separator",
                separator: ":"
              };
            }
            throw new ParseError("Unknown column alignment: " + ca, nde);
          });
          var res = {
            cols,
            hskipBeforeAndAfter: true,
            // \@preamble in lttab.dtx
            maxNumCols: cols.length
          };
          return parseArray(context.parser, res, dCellStyle(context.envName));
        },
        htmlBuilder: htmlBuilder$6,
        mathmlBuilder: mathmlBuilder$5
      });
      defineEnvironment({
        type: "array",
        names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"],
        props: {
          numArgs: 0
        },
        handler(context) {
          var delimiters2 = {
            "matrix": null,
            "pmatrix": ["(", ")"],
            "bmatrix": ["[", "]"],
            "Bmatrix": ["\\{", "\\}"],
            "vmatrix": ["|", "|"],
            "Vmatrix": ["\\Vert", "\\Vert"]
          }[context.envName.replace("*", "")];
          var colAlign = "c";
          var payload = {
            hskipBeforeAndAfter: false,
            cols: [{
              type: "align",
              align: colAlign
            }]
          };
          if (context.envName.charAt(context.envName.length - 1) === "*") {
            var parser28 = context.parser;
            parser28.consumeSpaces();
            if (parser28.fetch().text === "[") {
              parser28.consume();
              parser28.consumeSpaces();
              colAlign = parser28.fetch().text;
              if ("lcr".indexOf(colAlign) === -1) {
                throw new ParseError("Expected l or c or r", parser28.nextToken);
              }
              parser28.consume();
              parser28.consumeSpaces();
              parser28.expect("]");
              parser28.consume();
              payload.cols = [{
                type: "align",
                align: colAlign
              }];
            }
          }
          var res = parseArray(context.parser, payload, dCellStyle(context.envName));
          var numCols = Math.max(0, ...res.body.map((row) => row.length));
          res.cols = new Array(numCols).fill({
            type: "align",
            align: colAlign
          });
          return delimiters2 ? {
            type: "leftright",
            mode: context.mode,
            body: [res],
            left: delimiters2[0],
            right: delimiters2[1],
            rightColor: void 0
            // \right uninfluenced by \color in array
          } : res;
        },
        htmlBuilder: htmlBuilder$6,
        mathmlBuilder: mathmlBuilder$5
      });
      defineEnvironment({
        type: "array",
        names: ["smallmatrix"],
        props: {
          numArgs: 0
        },
        handler(context) {
          var payload = {
            arraystretch: 0.5
          };
          var res = parseArray(context.parser, payload, "script");
          res.colSeparationType = "small";
          return res;
        },
        htmlBuilder: htmlBuilder$6,
        mathmlBuilder: mathmlBuilder$5
      });
      defineEnvironment({
        type: "array",
        names: ["subarray"],
        props: {
          numArgs: 1
        },
        handler(context, args) {
          var symNode = checkSymbolNodeType(args[0]);
          var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body;
          var cols = colalign.map(function(nde) {
            var node2 = assertSymbolNodeType(nde);
            var ca = node2.text;
            if ("lc".indexOf(ca) !== -1) {
              return {
                type: "align",
                align: ca
              };
            }
            throw new ParseError("Unknown column alignment: " + ca, nde);
          });
          if (cols.length > 1) {
            throw new ParseError("{subarray} can contain only one column");
          }
          var res = {
            cols,
            hskipBeforeAndAfter: false,
            arraystretch: 0.5
          };
          res = parseArray(context.parser, res, "script");
          if (res.body.length > 0 && res.body[0].length > 1) {
            throw new ParseError("{subarray} can contain only one column");
          }
          return res;
        },
        htmlBuilder: htmlBuilder$6,
        mathmlBuilder: mathmlBuilder$5
      });
      defineEnvironment({
        type: "array",
        names: ["cases", "dcases", "rcases", "drcases"],
        props: {
          numArgs: 0
        },
        handler(context) {
          var payload = {
            arraystretch: 1.2,
            cols: [{
              type: "align",
              align: "l",
              pregap: 0,
              // TODO(kevinb) get the current style.
              // For now we use the metrics for TEXT style which is what we were
              // doing before.  Before attempting to get the current style we
              // should look at TeX's behavior especially for \over and matrices.
              postgap: 1
              /* 1em quad */
            }, {
              type: "align",
              align: "l",
              pregap: 0,
              postgap: 0
            }]
          };
          var res = parseArray(context.parser, payload, dCellStyle(context.envName));
          return {
            type: "leftright",
            mode: context.mode,
            body: [res],
            left: context.envName.indexOf("r") > -1 ? "." : "\\{",
            right: context.envName.indexOf("r") > -1 ? "\\}" : ".",
            rightColor: void 0
          };
        },
        htmlBuilder: htmlBuilder$6,
        mathmlBuilder: mathmlBuilder$5
      });
      defineEnvironment({
        type: "array",
        names: ["align", "align*", "aligned", "split"],
        props: {
          numArgs: 0
        },
        handler: alignedHandler,
        htmlBuilder: htmlBuilder$6,
        mathmlBuilder: mathmlBuilder$5
      });
      defineEnvironment({
        type: "array",
        names: ["gathered", "gather", "gather*"],
        props: {
          numArgs: 0
        },
        handler(context) {
          if (["gather", "gather*"].includes(context.envName)) {
            validateAmsEnvironmentContext(context);
          }
          var res = {
            cols: [{
              type: "align",
              align: "c"
            }],
            addJot: true,
            colSeparationType: "gather",
            autoTag: getAutoTag(context.envName),
            emptySingleRow: true,
            leqno: context.parser.settings.leqno
          };
          return parseArray(context.parser, res, "display");
        },
        htmlBuilder: htmlBuilder$6,
        mathmlBuilder: mathmlBuilder$5
      });
      defineEnvironment({
        type: "array",
        names: ["alignat", "alignat*", "alignedat"],
        props: {
          numArgs: 1
        },
        handler: alignedHandler,
        htmlBuilder: htmlBuilder$6,
        mathmlBuilder: mathmlBuilder$5
      });
      defineEnvironment({
        type: "array",
        names: ["equation", "equation*"],
        props: {
          numArgs: 0
        },
        handler(context) {
          validateAmsEnvironmentContext(context);
          var res = {
            autoTag: getAutoTag(context.envName),
            emptySingleRow: true,
            singleRow: true,
            maxNumCols: 1,
            leqno: context.parser.settings.leqno
          };
          return parseArray(context.parser, res, "display");
        },
        htmlBuilder: htmlBuilder$6,
        mathmlBuilder: mathmlBuilder$5
      });
      defineEnvironment({
        type: "array",
        names: ["CD"],
        props: {
          numArgs: 0
        },
        handler(context) {
          validateAmsEnvironmentContext(context);
          return parseCD(context.parser);
        },
        htmlBuilder: htmlBuilder$6,
        mathmlBuilder: mathmlBuilder$5
      });
      defineMacro("\\nonumber", "\\gdef\\@eqnsw{0}");
      defineMacro("\\notag", "\\nonumber");
      defineFunction({
        type: "text",
        // Doesn't matter what this is.
        names: ["\\hline", "\\hdashline"],
        props: {
          numArgs: 0,
          allowedInText: true,
          allowedInMath: true
        },
        handler(context, args) {
          throw new ParseError(context.funcName + " valid only within array environment");
        }
      });
      environments = _environments;
      defineFunction({
        type: "environment",
        names: ["\\begin", "\\end"],
        props: {
          numArgs: 1,
          argTypes: ["text"]
        },
        handler(_ref, args) {
          var {
            parser: parser28,
            funcName
          } = _ref;
          var nameGroup = args[0];
          if (nameGroup.type !== "ordgroup") {
            throw new ParseError("Invalid environment name", nameGroup);
          }
          var envName = "";
          for (var i2 = 0; i2 < nameGroup.body.length; ++i2) {
            envName += assertNodeType(nameGroup.body[i2], "textord").text;
          }
          if (funcName === "\\begin") {
            if (!environments.hasOwnProperty(envName)) {
              throw new ParseError("No such environment: " + envName, nameGroup);
            }
            var env = environments[envName];
            var {
              args: _args,
              optArgs
            } = parser28.parseArguments("\\begin{" + envName + "}", env);
            var context = {
              mode: parser28.mode,
              envName,
              parser: parser28
            };
            var result = env.handler(context, _args, optArgs);
            parser28.expect("\\end", false);
            var endNameToken = parser28.nextToken;
            var end2 = assertNodeType(parser28.parseFunction(), "environment");
            if (end2.name !== envName) {
              throw new ParseError("Mismatch: \\begin{" + envName + "} matched by \\end{" + end2.name + "}", endNameToken);
            }
            return result;
          }
          return {
            type: "environment",
            mode: parser28.mode,
            name: envName,
            nameGroup
          };
        }
      });
      htmlBuilder$5 = /* @__PURE__ */ __name((group2, options2) => {
        var font = group2.font;
        var newOptions = options2.withFont(font);
        return buildGroup$1(group2.body, newOptions);
      }, "htmlBuilder$5");
      mathmlBuilder$4 = /* @__PURE__ */ __name((group2, options2) => {
        var font = group2.font;
        var newOptions = options2.withFont(font);
        return buildGroup2(group2.body, newOptions);
      }, "mathmlBuilder$4");
      fontAliases = {
        "\\Bbb": "\\mathbb",
        "\\bold": "\\mathbf",
        "\\frak": "\\mathfrak",
        "\\bm": "\\boldsymbol"
      };
      defineFunction({
        type: "font",
        names: [
          // styles, except \boldsymbol defined below
          "\\mathrm",
          "\\mathit",
          "\\mathbf",
          "\\mathnormal",
          "\\mathsfit",
          // families
          "\\mathbb",
          "\\mathcal",
          "\\mathfrak",
          "\\mathscr",
          "\\mathsf",
          "\\mathtt",
          // aliases, except \bm defined below
          "\\Bbb",
          "\\bold",
          "\\frak"
        ],
        props: {
          numArgs: 1,
          allowedInArgument: true
        },
        handler: /* @__PURE__ */ __name((_ref, args) => {
          var {
            parser: parser28,
            funcName
          } = _ref;
          var body = normalizeArgument(args[0]);
          var func = funcName;
          if (func in fontAliases) {
            func = fontAliases[func];
          }
          return {
            type: "font",
            mode: parser28.mode,
            font: func.slice(1),
            body
          };
        }, "handler"),
        htmlBuilder: htmlBuilder$5,
        mathmlBuilder: mathmlBuilder$4
      });
      defineFunction({
        type: "mclass",
        names: ["\\boldsymbol", "\\bm"],
        props: {
          numArgs: 1
        },
        handler: /* @__PURE__ */ __name((_ref2, args) => {
          var {
            parser: parser28
          } = _ref2;
          var body = args[0];
          var isCharacterBox3 = utils.isCharacterBox(body);
          return {
            type: "mclass",
            mode: parser28.mode,
            mclass: binrelClass(body),
            body: [{
              type: "font",
              mode: parser28.mode,
              font: "boldsymbol",
              body
            }],
            isCharacterBox: isCharacterBox3
          };
        }, "handler")
      });
      defineFunction({
        type: "font",
        names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"],
        props: {
          numArgs: 0,
          allowedInText: true
        },
        handler: /* @__PURE__ */ __name((_ref3, args) => {
          var {
            parser: parser28,
            funcName,
            breakOnTokenText
          } = _ref3;
          var {
            mode
          } = parser28;
          var body = parser28.parseExpression(true, breakOnTokenText);
          var style3 = "math" + funcName.slice(1);
          return {
            type: "font",
            mode,
            font: style3,
            body: {
              type: "ordgroup",
              mode: parser28.mode,
              body
            }
          };
        }, "handler"),
        htmlBuilder: htmlBuilder$5,
        mathmlBuilder: mathmlBuilder$4
      });
      adjustStyle = /* @__PURE__ */ __name((size4, originalStyle) => {
        var style3 = originalStyle;
        if (size4 === "display") {
          style3 = style3.id >= Style$1.SCRIPT.id ? style3.text() : Style$1.DISPLAY;
        } else if (size4 === "text" && style3.size === Style$1.DISPLAY.size) {
          style3 = Style$1.TEXT;
        } else if (size4 === "script") {
          style3 = Style$1.SCRIPT;
        } else if (size4 === "scriptscript") {
          style3 = Style$1.SCRIPTSCRIPT;
        }
        return style3;
      }, "adjustStyle");
      htmlBuilder$4 = /* @__PURE__ */ __name((group2, options2) => {
        var style3 = adjustStyle(group2.size, options2.style);
        var nstyle = style3.fracNum();
        var dstyle = style3.fracDen();
        var newOptions;
        newOptions = options2.havingStyle(nstyle);
        var numerm = buildGroup$1(group2.numer, newOptions, options2);
        if (group2.continued) {
          var hStrut = 8.5 / options2.fontMetrics().ptPerEm;
          var dStrut = 3.5 / options2.fontMetrics().ptPerEm;
          numerm.height = numerm.height < hStrut ? hStrut : numerm.height;
          numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth;
        }
        newOptions = options2.havingStyle(dstyle);
        var denomm = buildGroup$1(group2.denom, newOptions, options2);
        var rule;
        var ruleWidth;
        var ruleSpacing;
        if (group2.hasBarLine) {
          if (group2.barSize) {
            ruleWidth = calculateSize2(group2.barSize, options2);
            rule = buildCommon.makeLineSpan("frac-line", options2, ruleWidth);
          } else {
            rule = buildCommon.makeLineSpan("frac-line", options2);
          }
          ruleWidth = rule.height;
          ruleSpacing = rule.height;
        } else {
          rule = null;
          ruleWidth = 0;
          ruleSpacing = options2.fontMetrics().defaultRuleThickness;
        }
        var numShift;
        var clearance;
        var denomShift;
        if (style3.size === Style$1.DISPLAY.size || group2.size === "display") {
          numShift = options2.fontMetrics().num1;
          if (ruleWidth > 0) {
            clearance = 3 * ruleSpacing;
          } else {
            clearance = 7 * ruleSpacing;
          }
          denomShift = options2.fontMetrics().denom1;
        } else {
          if (ruleWidth > 0) {
            numShift = options2.fontMetrics().num2;
            clearance = ruleSpacing;
          } else {
            numShift = options2.fontMetrics().num3;
            clearance = 3 * ruleSpacing;
          }
          denomShift = options2.fontMetrics().denom2;
        }
        var frac;
        if (!rule) {
          var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift);
          if (candidateClearance < clearance) {
            numShift += 0.5 * (clearance - candidateClearance);
            denomShift += 0.5 * (clearance - candidateClearance);
          }
          frac = buildCommon.makeVList({
            positionType: "individualShift",
            children: [{
              type: "elem",
              elem: denomm,
              shift: denomShift
            }, {
              type: "elem",
              elem: numerm,
              shift: -numShift
            }]
          }, options2);
        } else {
          var axisHeight = options2.fontMetrics().axisHeight;
          if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) {
            numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth));
          }
          if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) {
            denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift));
          }
          var midShift = -(axisHeight - 0.5 * ruleWidth);
          frac = buildCommon.makeVList({
            positionType: "individualShift",
            children: [{
              type: "elem",
              elem: denomm,
              shift: denomShift
            }, {
              type: "elem",
              elem: rule,
              shift: midShift
            }, {
              type: "elem",
              elem: numerm,
              shift: -numShift
            }]
          }, options2);
        }
        newOptions = options2.havingStyle(style3);
        frac.height *= newOptions.sizeMultiplier / options2.sizeMultiplier;
        frac.depth *= newOptions.sizeMultiplier / options2.sizeMultiplier;
        var delimSize;
        if (style3.size === Style$1.DISPLAY.size) {
          delimSize = options2.fontMetrics().delim1;
        } else if (style3.size === Style$1.SCRIPTSCRIPT.size) {
          delimSize = options2.havingStyle(Style$1.SCRIPT).fontMetrics().delim2;
        } else {
          delimSize = options2.fontMetrics().delim2;
        }
        var leftDelim;
        var rightDelim;
        if (group2.leftDelim == null) {
          leftDelim = makeNullDelimiter(options2, ["mopen"]);
        } else {
          leftDelim = delimiter.customSizedDelim(group2.leftDelim, delimSize, true, options2.havingStyle(style3), group2.mode, ["mopen"]);
        }
        if (group2.continued) {
          rightDelim = buildCommon.makeSpan([]);
        } else if (group2.rightDelim == null) {
          rightDelim = makeNullDelimiter(options2, ["mclose"]);
        } else {
          rightDelim = delimiter.customSizedDelim(group2.rightDelim, delimSize, true, options2.havingStyle(style3), group2.mode, ["mclose"]);
        }
        return buildCommon.makeSpan(["mord"].concat(newOptions.sizingClasses(options2)), [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], options2);
      }, "htmlBuilder$4");
      mathmlBuilder$3 = /* @__PURE__ */ __name((group2, options2) => {
        var node2 = new mathMLTree.MathNode("mfrac", [buildGroup2(group2.numer, options2), buildGroup2(group2.denom, options2)]);
        if (!group2.hasBarLine) {
          node2.setAttribute("linethickness", "0px");
        } else if (group2.barSize) {
          var ruleWidth = calculateSize2(group2.barSize, options2);
          node2.setAttribute("linethickness", makeEm(ruleWidth));
        }
        var style3 = adjustStyle(group2.size, options2.style);
        if (style3.size !== options2.style.size) {
          node2 = new mathMLTree.MathNode("mstyle", [node2]);
          var isDisplay = style3.size === Style$1.DISPLAY.size ? "true" : "false";
          node2.setAttribute("displaystyle", isDisplay);
          node2.setAttribute("scriptlevel", "0");
        }
        if (group2.leftDelim != null || group2.rightDelim != null) {
          var withDelims = [];
          if (group2.leftDelim != null) {
            var leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group2.leftDelim.replace("\\", ""))]);
            leftOp.setAttribute("fence", "true");
            withDelims.push(leftOp);
          }
          withDelims.push(node2);
          if (group2.rightDelim != null) {
            var rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group2.rightDelim.replace("\\", ""))]);
            rightOp.setAttribute("fence", "true");
            withDelims.push(rightOp);
          }
          return makeRow(withDelims);
        }
        return node2;
      }, "mathmlBuilder$3");
      defineFunction({
        type: "genfrac",
        names: [
          "\\dfrac",
          "\\frac",
          "\\tfrac",
          "\\dbinom",
          "\\binom",
          "\\tbinom",
          "\\\\atopfrac",
          // can’t be entered directly
          "\\\\bracefrac",
          "\\\\brackfrac"
          // ditto
        ],
        props: {
          numArgs: 2,
          allowedInArgument: true
        },
        handler: /* @__PURE__ */ __name((_ref, args) => {
          var {
            parser: parser28,
            funcName
          } = _ref;
          var numer = args[0];
          var denom = args[1];
          var hasBarLine;
          var leftDelim = null;
          var rightDelim = null;
          var size4 = "auto";
          switch (funcName) {
            case "\\dfrac":
            case "\\frac":
            case "\\tfrac":
              hasBarLine = true;
              break;
            case "\\\\atopfrac":
              hasBarLine = false;
              break;
            case "\\dbinom":
            case "\\binom":
            case "\\tbinom":
              hasBarLine = false;
              leftDelim = "(";
              rightDelim = ")";
              break;
            case "\\\\bracefrac":
              hasBarLine = false;
              leftDelim = "\\{";
              rightDelim = "\\}";
              break;
            case "\\\\brackfrac":
              hasBarLine = false;
              leftDelim = "[";
              rightDelim = "]";
              break;
            default:
              throw new Error("Unrecognized genfrac command");
          }
          switch (funcName) {
            case "\\dfrac":
            case "\\dbinom":
              size4 = "display";
              break;
            case "\\tfrac":
            case "\\tbinom":
              size4 = "text";
              break;
          }
          return {
            type: "genfrac",
            mode: parser28.mode,
            continued: false,
            numer,
            denom,
            hasBarLine,
            leftDelim,
            rightDelim,
            size: size4,
            barSize: null
          };
        }, "handler"),
        htmlBuilder: htmlBuilder$4,
        mathmlBuilder: mathmlBuilder$3
      });
      defineFunction({
        type: "genfrac",
        names: ["\\cfrac"],
        props: {
          numArgs: 2
        },
        handler: /* @__PURE__ */ __name((_ref2, args) => {
          var {
            parser: parser28,
            funcName
          } = _ref2;
          var numer = args[0];
          var denom = args[1];
          return {
            type: "genfrac",
            mode: parser28.mode,
            continued: true,
            numer,
            denom,
            hasBarLine: true,
            leftDelim: null,
            rightDelim: null,
            size: "display",
            barSize: null
          };
        }, "handler")
      });
      defineFunction({
        type: "infix",
        names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"],
        props: {
          numArgs: 0,
          infix: true
        },
        handler(_ref3) {
          var {
            parser: parser28,
            funcName,
            token: token2
          } = _ref3;
          var replaceWith;
          switch (funcName) {
            case "\\over":
              replaceWith = "\\frac";
              break;
            case "\\choose":
              replaceWith = "\\binom";
              break;
            case "\\atop":
              replaceWith = "\\\\atopfrac";
              break;
            case "\\brace":
              replaceWith = "\\\\bracefrac";
              break;
            case "\\brack":
              replaceWith = "\\\\brackfrac";
              break;
            default:
              throw new Error("Unrecognized infix genfrac command");
          }
          return {
            type: "infix",
            mode: parser28.mode,
            replaceWith,
            token: token2
          };
        }
      });
      stylArray = ["display", "text", "script", "scriptscript"];
      delimFromValue = /* @__PURE__ */ __name(function delimFromValue2(delimString) {
        var delim = null;
        if (delimString.length > 0) {
          delim = delimString;
          delim = delim === "." ? null : delim;
        }
        return delim;
      }, "delimFromValue");
      defineFunction({
        type: "genfrac",
        names: ["\\genfrac"],
        props: {
          numArgs: 6,
          allowedInArgument: true,
          argTypes: ["math", "math", "size", "text", "math", "math"]
        },
        handler(_ref4, args) {
          var {
            parser: parser28
          } = _ref4;
          var numer = args[4];
          var denom = args[5];
          var leftNode = normalizeArgument(args[0]);
          var leftDelim = leftNode.type === "atom" && leftNode.family === "open" ? delimFromValue(leftNode.text) : null;
          var rightNode = normalizeArgument(args[1]);
          var rightDelim = rightNode.type === "atom" && rightNode.family === "close" ? delimFromValue(rightNode.text) : null;
          var barNode = assertNodeType(args[2], "size");
          var hasBarLine;
          var barSize = null;
          if (barNode.isBlank) {
            hasBarLine = true;
          } else {
            barSize = barNode.value;
            hasBarLine = barSize.number > 0;
          }
          var size4 = "auto";
          var styl = args[3];
          if (styl.type === "ordgroup") {
            if (styl.body.length > 0) {
              var textOrd = assertNodeType(styl.body[0], "textord");
              size4 = stylArray[Number(textOrd.text)];
            }
          } else {
            styl = assertNodeType(styl, "textord");
            size4 = stylArray[Number(styl.text)];
          }
          return {
            type: "genfrac",
            mode: parser28.mode,
            numer,
            denom,
            continued: false,
            hasBarLine,
            barSize,
            leftDelim,
            rightDelim,
            size: size4
          };
        },
        htmlBuilder: htmlBuilder$4,
        mathmlBuilder: mathmlBuilder$3
      });
      defineFunction({
        type: "infix",
        names: ["\\above"],
        props: {
          numArgs: 1,
          argTypes: ["size"],
          infix: true
        },
        handler(_ref5, args) {
          var {
            parser: parser28,
            funcName,
            token: token2
          } = _ref5;
          return {
            type: "infix",
            mode: parser28.mode,
            replaceWith: "\\\\abovefrac",
            size: assertNodeType(args[0], "size").value,
            token: token2
          };
        }
      });
      defineFunction({
        type: "genfrac",
        names: ["\\\\abovefrac"],
        props: {
          numArgs: 3,
          argTypes: ["math", "size", "math"]
        },
        handler: /* @__PURE__ */ __name((_ref6, args) => {
          var {
            parser: parser28,
            funcName
          } = _ref6;
          var numer = args[0];
          var barSize = assert(assertNodeType(args[1], "infix").size);
          var denom = args[2];
          var hasBarLine = barSize.number > 0;
          return {
            type: "genfrac",
            mode: parser28.mode,
            numer,
            denom,
            continued: false,
            hasBarLine,
            barSize,
            leftDelim: null,
            rightDelim: null,
            size: "auto"
          };
        }, "handler"),
        htmlBuilder: htmlBuilder$4,
        mathmlBuilder: mathmlBuilder$3
      });
      htmlBuilder$3 = /* @__PURE__ */ __name((grp, options2) => {
        var style3 = options2.style;
        var supSubGroup;
        var group2;
        if (grp.type === "supsub") {
          supSubGroup = grp.sup ? buildGroup$1(grp.sup, options2.havingStyle(style3.sup()), options2) : buildGroup$1(grp.sub, options2.havingStyle(style3.sub()), options2);
          group2 = assertNodeType(grp.base, "horizBrace");
        } else {
          group2 = assertNodeType(grp, "horizBrace");
        }
        var body = buildGroup$1(group2.base, options2.havingBaseStyle(Style$1.DISPLAY));
        var braceBody = stretchy.svgSpan(group2, options2);
        var vlist;
        if (group2.isOver) {
          vlist = buildCommon.makeVList({
            positionType: "firstBaseline",
            children: [{
              type: "elem",
              elem: body
            }, {
              type: "kern",
              size: 0.1
            }, {
              type: "elem",
              elem: braceBody
            }]
          }, options2);
          vlist.children[0].children[0].children[1].classes.push("svg-align");
        } else {
          vlist = buildCommon.makeVList({
            positionType: "bottom",
            positionData: body.depth + 0.1 + braceBody.height,
            children: [{
              type: "elem",
              elem: braceBody
            }, {
              type: "kern",
              size: 0.1
            }, {
              type: "elem",
              elem: body
            }]
          }, options2);
          vlist.children[0].children[0].children[0].classes.push("svg-align");
        }
        if (supSubGroup) {
          var vSpan = buildCommon.makeSpan(["mord", group2.isOver ? "mover" : "munder"], [vlist], options2);
          if (group2.isOver) {
            vlist = buildCommon.makeVList({
              positionType: "firstBaseline",
              children: [{
                type: "elem",
                elem: vSpan
              }, {
                type: "kern",
                size: 0.2
              }, {
                type: "elem",
                elem: supSubGroup
              }]
            }, options2);
          } else {
            vlist = buildCommon.makeVList({
              positionType: "bottom",
              positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth,
              children: [{
                type: "elem",
                elem: supSubGroup
              }, {
                type: "kern",
                size: 0.2
              }, {
                type: "elem",
                elem: vSpan
              }]
            }, options2);
          }
        }
        return buildCommon.makeSpan(["mord", group2.isOver ? "mover" : "munder"], [vlist], options2);
      }, "htmlBuilder$3");
      mathmlBuilder$2 = /* @__PURE__ */ __name((group2, options2) => {
        var accentNode = stretchy.mathMLnode(group2.label);
        return new mathMLTree.MathNode(group2.isOver ? "mover" : "munder", [buildGroup2(group2.base, options2), accentNode]);
      }, "mathmlBuilder$2");
      defineFunction({
        type: "horizBrace",
        names: ["\\overbrace", "\\underbrace"],
        props: {
          numArgs: 1
        },
        handler(_ref, args) {
          var {
            parser: parser28,
            funcName
          } = _ref;
          return {
            type: "horizBrace",
            mode: parser28.mode,
            label: funcName,
            isOver: /^\\over/.test(funcName),
            base: args[0]
          };
        },
        htmlBuilder: htmlBuilder$3,
        mathmlBuilder: mathmlBuilder$2
      });
      defineFunction({
        type: "href",
        names: ["\\href"],
        props: {
          numArgs: 2,
          argTypes: ["url", "original"],
          allowedInText: true
        },
        handler: /* @__PURE__ */ __name((_ref, args) => {
          var {
            parser: parser28
          } = _ref;
          var body = args[1];
          var href = assertNodeType(args[0], "url").url;
          if (!parser28.settings.isTrusted({
            command: "\\href",
            url: href
          })) {
            return parser28.formatUnsupportedCmd("\\href");
          }
          return {
            type: "href",
            mode: parser28.mode,
            href,
            body: ordargument(body)
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var elements2 = buildExpression$1(group2.body, options2, false);
          return buildCommon.makeAnchor(group2.href, [], elements2, options2);
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var math2 = buildExpressionRow(group2.body, options2);
          if (!(math2 instanceof MathNode)) {
            math2 = new MathNode("mrow", [math2]);
          }
          math2.setAttribute("href", group2.href);
          return math2;
        }, "mathmlBuilder")
      });
      defineFunction({
        type: "href",
        names: ["\\url"],
        props: {
          numArgs: 1,
          argTypes: ["url"],
          allowedInText: true
        },
        handler: /* @__PURE__ */ __name((_ref2, args) => {
          var {
            parser: parser28
          } = _ref2;
          var href = assertNodeType(args[0], "url").url;
          if (!parser28.settings.isTrusted({
            command: "\\url",
            url: href
          })) {
            return parser28.formatUnsupportedCmd("\\url");
          }
          var chars = [];
          for (var i2 = 0; i2 < href.length; i2++) {
            var c3 = href[i2];
            if (c3 === "~") {
              c3 = "\\textasciitilde";
            }
            chars.push({
              type: "textord",
              mode: "text",
              text: c3
            });
          }
          var body = {
            type: "text",
            mode: parser28.mode,
            font: "\\texttt",
            body: chars
          };
          return {
            type: "href",
            mode: parser28.mode,
            href,
            body: ordargument(body)
          };
        }, "handler")
      });
      defineFunction({
        type: "hbox",
        names: ["\\hbox"],
        props: {
          numArgs: 1,
          argTypes: ["text"],
          allowedInText: true,
          primitive: true
        },
        handler(_ref, args) {
          var {
            parser: parser28
          } = _ref;
          return {
            type: "hbox",
            mode: parser28.mode,
            body: ordargument(args[0])
          };
        },
        htmlBuilder(group2, options2) {
          var elements2 = buildExpression$1(group2.body, options2, false);
          return buildCommon.makeFragment(elements2);
        },
        mathmlBuilder(group2, options2) {
          return new mathMLTree.MathNode("mrow", buildExpression2(group2.body, options2));
        }
      });
      defineFunction({
        type: "html",
        names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"],
        props: {
          numArgs: 2,
          argTypes: ["raw", "original"],
          allowedInText: true
        },
        handler: /* @__PURE__ */ __name((_ref, args) => {
          var {
            parser: parser28,
            funcName,
            token: token2
          } = _ref;
          var value2 = assertNodeType(args[0], "raw").string;
          var body = args[1];
          if (parser28.settings.strict) {
            parser28.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode");
          }
          var trustContext;
          var attributes = {};
          switch (funcName) {
            case "\\htmlClass":
              attributes.class = value2;
              trustContext = {
                command: "\\htmlClass",
                class: value2
              };
              break;
            case "\\htmlId":
              attributes.id = value2;
              trustContext = {
                command: "\\htmlId",
                id: value2
              };
              break;
            case "\\htmlStyle":
              attributes.style = value2;
              trustContext = {
                command: "\\htmlStyle",
                style: value2
              };
              break;
            case "\\htmlData": {
              var data5 = value2.split(",");
              for (var i2 = 0; i2 < data5.length; i2++) {
                var keyVal = data5[i2].split("=");
                if (keyVal.length !== 2) {
                  throw new ParseError("Error parsing key-value for \\htmlData");
                }
                attributes["data-" + keyVal[0].trim()] = keyVal[1].trim();
              }
              trustContext = {
                command: "\\htmlData",
                attributes
              };
              break;
            }
            default:
              throw new Error("Unrecognized html command");
          }
          if (!parser28.settings.isTrusted(trustContext)) {
            return parser28.formatUnsupportedCmd(funcName);
          }
          return {
            type: "html",
            mode: parser28.mode,
            attributes,
            body: ordargument(body)
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var elements2 = buildExpression$1(group2.body, options2, false);
          var classes3 = ["enclosing"];
          if (group2.attributes.class) {
            classes3.push(...group2.attributes.class.trim().split(/\s+/));
          }
          var span = buildCommon.makeSpan(classes3, elements2, options2);
          for (var attr in group2.attributes) {
            if (attr !== "class" && group2.attributes.hasOwnProperty(attr)) {
              span.setAttribute(attr, group2.attributes[attr]);
            }
          }
          return span;
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          return buildExpressionRow(group2.body, options2);
        }, "mathmlBuilder")
      });
      defineFunction({
        type: "htmlmathml",
        names: ["\\html@mathml"],
        props: {
          numArgs: 2,
          allowedInText: true
        },
        handler: /* @__PURE__ */ __name((_ref, args) => {
          var {
            parser: parser28
          } = _ref;
          return {
            type: "htmlmathml",
            mode: parser28.mode,
            html: ordargument(args[0]),
            mathml: ordargument(args[1])
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var elements2 = buildExpression$1(group2.html, options2, false);
          return buildCommon.makeFragment(elements2);
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          return buildExpressionRow(group2.mathml, options2);
        }, "mathmlBuilder")
      });
      sizeData = /* @__PURE__ */ __name(function sizeData2(str2) {
        if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str2)) {
          return {
            number: +str2,
            unit: "bp"
          };
        } else {
          var match2 = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str2);
          if (!match2) {
            throw new ParseError("Invalid size: '" + str2 + "' in \\includegraphics");
          }
          var data5 = {
            number: +(match2[1] + match2[2]),
            // sign + magnitude, cast to number
            unit: match2[3]
          };
          if (!validUnit(data5)) {
            throw new ParseError("Invalid unit: '" + data5.unit + "' in \\includegraphics.");
          }
          return data5;
        }
      }, "sizeData");
      defineFunction({
        type: "includegraphics",
        names: ["\\includegraphics"],
        props: {
          numArgs: 1,
          numOptionalArgs: 1,
          argTypes: ["raw", "url"],
          allowedInText: false
        },
        handler: /* @__PURE__ */ __name((_ref, args, optArgs) => {
          var {
            parser: parser28
          } = _ref;
          var width3 = {
            number: 0,
            unit: "em"
          };
          var height2 = {
            number: 0.9,
            unit: "em"
          };
          var totalheight = {
            number: 0,
            unit: "em"
          };
          var alt = "";
          if (optArgs[0]) {
            var attributeStr = assertNodeType(optArgs[0], "raw").string;
            var attributes = attributeStr.split(",");
            for (var i2 = 0; i2 < attributes.length; i2++) {
              var keyVal = attributes[i2].split("=");
              if (keyVal.length === 2) {
                var str2 = keyVal[1].trim();
                switch (keyVal[0].trim()) {
                  case "alt":
                    alt = str2;
                    break;
                  case "width":
                    width3 = sizeData(str2);
                    break;
                  case "height":
                    height2 = sizeData(str2);
                    break;
                  case "totalheight":
                    totalheight = sizeData(str2);
                    break;
                  default:
                    throw new ParseError("Invalid key: '" + keyVal[0] + "' in \\includegraphics.");
                }
              }
            }
          }
          var src = assertNodeType(args[0], "url").url;
          if (alt === "") {
            alt = src;
            alt = alt.replace(/^.*[\\/]/, "");
            alt = alt.substring(0, alt.lastIndexOf("."));
          }
          if (!parser28.settings.isTrusted({
            command: "\\includegraphics",
            url: src
          })) {
            return parser28.formatUnsupportedCmd("\\includegraphics");
          }
          return {
            type: "includegraphics",
            mode: parser28.mode,
            alt,
            width: width3,
            height: height2,
            totalheight,
            src
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var height2 = calculateSize2(group2.height, options2);
          var depth = 0;
          if (group2.totalheight.number > 0) {
            depth = calculateSize2(group2.totalheight, options2) - height2;
          }
          var width3 = 0;
          if (group2.width.number > 0) {
            width3 = calculateSize2(group2.width, options2);
          }
          var style3 = {
            height: makeEm(height2 + depth)
          };
          if (width3 > 0) {
            style3.width = makeEm(width3);
          }
          if (depth > 0) {
            style3.verticalAlign = makeEm(-depth);
          }
          var node2 = new Img(group2.src, group2.alt, style3);
          node2.height = height2;
          node2.depth = depth;
          return node2;
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var node2 = new mathMLTree.MathNode("mglyph", []);
          node2.setAttribute("alt", group2.alt);
          var height2 = calculateSize2(group2.height, options2);
          var depth = 0;
          if (group2.totalheight.number > 0) {
            depth = calculateSize2(group2.totalheight, options2) - height2;
            node2.setAttribute("valign", makeEm(-depth));
          }
          node2.setAttribute("height", makeEm(height2 + depth));
          if (group2.width.number > 0) {
            var width3 = calculateSize2(group2.width, options2);
            node2.setAttribute("width", makeEm(width3));
          }
          node2.setAttribute("src", group2.src);
          return node2;
        }, "mathmlBuilder")
      });
      defineFunction({
        type: "kern",
        names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"],
        props: {
          numArgs: 1,
          argTypes: ["size"],
          primitive: true,
          allowedInText: true
        },
        handler(_ref, args) {
          var {
            parser: parser28,
            funcName
          } = _ref;
          var size4 = assertNodeType(args[0], "size");
          if (parser28.settings.strict) {
            var mathFunction = funcName[1] === "m";
            var muUnit = size4.value.unit === "mu";
            if (mathFunction) {
              if (!muUnit) {
                parser28.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " supports only mu units, " + ("not " + size4.value.unit + " units"));
              }
              if (parser28.mode !== "math") {
                parser28.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " works only in math mode");
              }
            } else {
              if (muUnit) {
                parser28.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " doesn't support mu units");
              }
            }
          }
          return {
            type: "kern",
            mode: parser28.mode,
            dimension: size4.value
          };
        },
        htmlBuilder(group2, options2) {
          return buildCommon.makeGlue(group2.dimension, options2);
        },
        mathmlBuilder(group2, options2) {
          var dimension = calculateSize2(group2.dimension, options2);
          return new mathMLTree.SpaceNode(dimension);
        }
      });
      defineFunction({
        type: "lap",
        names: ["\\mathllap", "\\mathrlap", "\\mathclap"],
        props: {
          numArgs: 1,
          allowedInText: true
        },
        handler: /* @__PURE__ */ __name((_ref, args) => {
          var {
            parser: parser28,
            funcName
          } = _ref;
          var body = args[0];
          return {
            type: "lap",
            mode: parser28.mode,
            alignment: funcName.slice(5),
            body
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var inner2;
          if (group2.alignment === "clap") {
            inner2 = buildCommon.makeSpan([], [buildGroup$1(group2.body, options2)]);
            inner2 = buildCommon.makeSpan(["inner"], [inner2], options2);
          } else {
            inner2 = buildCommon.makeSpan(["inner"], [buildGroup$1(group2.body, options2)]);
          }
          var fix = buildCommon.makeSpan(["fix"], []);
          var node2 = buildCommon.makeSpan([group2.alignment], [inner2, fix], options2);
          var strut = buildCommon.makeSpan(["strut"]);
          strut.style.height = makeEm(node2.height + node2.depth);
          if (node2.depth) {
            strut.style.verticalAlign = makeEm(-node2.depth);
          }
          node2.children.unshift(strut);
          node2 = buildCommon.makeSpan(["thinbox"], [node2], options2);
          return buildCommon.makeSpan(["mord", "vbox"], [node2], options2);
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var node2 = new mathMLTree.MathNode("mpadded", [buildGroup2(group2.body, options2)]);
          if (group2.alignment !== "rlap") {
            var offset = group2.alignment === "llap" ? "-1" : "-0.5";
            node2.setAttribute("lspace", offset + "width");
          }
          node2.setAttribute("width", "0px");
          return node2;
        }, "mathmlBuilder")
      });
      defineFunction({
        type: "styling",
        names: ["\\(", "$"],
        props: {
          numArgs: 0,
          allowedInText: true,
          allowedInMath: false
        },
        handler(_ref, args) {
          var {
            funcName,
            parser: parser28
          } = _ref;
          var outerMode = parser28.mode;
          parser28.switchMode("math");
          var close2 = funcName === "\\(" ? "\\)" : "$";
          var body = parser28.parseExpression(false, close2);
          parser28.expect(close2);
          parser28.switchMode(outerMode);
          return {
            type: "styling",
            mode: parser28.mode,
            style: "text",
            body
          };
        }
      });
      defineFunction({
        type: "text",
        // Doesn't matter what this is.
        names: ["\\)", "\\]"],
        props: {
          numArgs: 0,
          allowedInText: true,
          allowedInMath: false
        },
        handler(context, args) {
          throw new ParseError("Mismatched " + context.funcName);
        }
      });
      chooseMathStyle = /* @__PURE__ */ __name((group2, options2) => {
        switch (options2.style.size) {
          case Style$1.DISPLAY.size:
            return group2.display;
          case Style$1.TEXT.size:
            return group2.text;
          case Style$1.SCRIPT.size:
            return group2.script;
          case Style$1.SCRIPTSCRIPT.size:
            return group2.scriptscript;
          default:
            return group2.text;
        }
      }, "chooseMathStyle");
      defineFunction({
        type: "mathchoice",
        names: ["\\mathchoice"],
        props: {
          numArgs: 4,
          primitive: true
        },
        handler: /* @__PURE__ */ __name((_ref, args) => {
          var {
            parser: parser28
          } = _ref;
          return {
            type: "mathchoice",
            mode: parser28.mode,
            display: ordargument(args[0]),
            text: ordargument(args[1]),
            script: ordargument(args[2]),
            scriptscript: ordargument(args[3])
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var body = chooseMathStyle(group2, options2);
          var elements2 = buildExpression$1(body, options2, false);
          return buildCommon.makeFragment(elements2);
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var body = chooseMathStyle(group2, options2);
          return buildExpressionRow(body, options2);
        }, "mathmlBuilder")
      });
      assembleSupSub = /* @__PURE__ */ __name((base, supGroup, subGroup, options2, style3, slant, baseShift) => {
        base = buildCommon.makeSpan([], [base]);
        var subIsSingleCharacter = subGroup && utils.isCharacterBox(subGroup);
        var sub2;
        var sup2;
        if (supGroup) {
          var elem = buildGroup$1(supGroup, options2.havingStyle(style3.sup()), options2);
          sup2 = {
            elem,
            kern: Math.max(options2.fontMetrics().bigOpSpacing1, options2.fontMetrics().bigOpSpacing3 - elem.depth)
          };
        }
        if (subGroup) {
          var _elem = buildGroup$1(subGroup, options2.havingStyle(style3.sub()), options2);
          sub2 = {
            elem: _elem,
            kern: Math.max(options2.fontMetrics().bigOpSpacing2, options2.fontMetrics().bigOpSpacing4 - _elem.height)
          };
        }
        var finalGroup;
        if (sup2 && sub2) {
          var bottom2 = options2.fontMetrics().bigOpSpacing5 + sub2.elem.height + sub2.elem.depth + sub2.kern + base.depth + baseShift;
          finalGroup = buildCommon.makeVList({
            positionType: "bottom",
            positionData: bottom2,
            children: [{
              type: "kern",
              size: options2.fontMetrics().bigOpSpacing5
            }, {
              type: "elem",
              elem: sub2.elem,
              marginLeft: makeEm(-slant)
            }, {
              type: "kern",
              size: sub2.kern
            }, {
              type: "elem",
              elem: base
            }, {
              type: "kern",
              size: sup2.kern
            }, {
              type: "elem",
              elem: sup2.elem,
              marginLeft: makeEm(slant)
            }, {
              type: "kern",
              size: options2.fontMetrics().bigOpSpacing5
            }]
          }, options2);
        } else if (sub2) {
          var top2 = base.height - baseShift;
          finalGroup = buildCommon.makeVList({
            positionType: "top",
            positionData: top2,
            children: [{
              type: "kern",
              size: options2.fontMetrics().bigOpSpacing5
            }, {
              type: "elem",
              elem: sub2.elem,
              marginLeft: makeEm(-slant)
            }, {
              type: "kern",
              size: sub2.kern
            }, {
              type: "elem",
              elem: base
            }]
          }, options2);
        } else if (sup2) {
          var _bottom = base.depth + baseShift;
          finalGroup = buildCommon.makeVList({
            positionType: "bottom",
            positionData: _bottom,
            children: [{
              type: "elem",
              elem: base
            }, {
              type: "kern",
              size: sup2.kern
            }, {
              type: "elem",
              elem: sup2.elem,
              marginLeft: makeEm(slant)
            }, {
              type: "kern",
              size: options2.fontMetrics().bigOpSpacing5
            }]
          }, options2);
        } else {
          return base;
        }
        var parts = [finalGroup];
        if (sub2 && slant !== 0 && !subIsSingleCharacter) {
          var spacer = buildCommon.makeSpan(["mspace"], [], options2);
          spacer.style.marginRight = makeEm(slant);
          parts.unshift(spacer);
        }
        return buildCommon.makeSpan(["mop", "op-limits"], parts, options2);
      }, "assembleSupSub");
      noSuccessor = ["\\smallint"];
      htmlBuilder$2 = /* @__PURE__ */ __name((grp, options2) => {
        var supGroup;
        var subGroup;
        var hasLimits = false;
        var group2;
        if (grp.type === "supsub") {
          supGroup = grp.sup;
          subGroup = grp.sub;
          group2 = assertNodeType(grp.base, "op");
          hasLimits = true;
        } else {
          group2 = assertNodeType(grp, "op");
        }
        var style3 = options2.style;
        var large = false;
        if (style3.size === Style$1.DISPLAY.size && group2.symbol && !noSuccessor.includes(group2.name)) {
          large = true;
        }
        var base;
        if (group2.symbol) {
          var fontName = large ? "Size2-Regular" : "Size1-Regular";
          var stash = "";
          if (group2.name === "\\oiint" || group2.name === "\\oiiint") {
            stash = group2.name.slice(1);
            group2.name = stash === "oiint" ? "\\iint" : "\\iiint";
          }
          base = buildCommon.makeSymbol(group2.name, fontName, "math", options2, ["mop", "op-symbol", large ? "large-op" : "small-op"]);
          if (stash.length > 0) {
            var italic = base.italic;
            var oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options2);
            base = buildCommon.makeVList({
              positionType: "individualShift",
              children: [{
                type: "elem",
                elem: base,
                shift: 0
              }, {
                type: "elem",
                elem: oval,
                shift: large ? 0.08 : 0
              }]
            }, options2);
            group2.name = "\\" + stash;
            base.classes.unshift("mop");
            base.italic = italic;
          }
        } else if (group2.body) {
          var inner2 = buildExpression$1(group2.body, options2, true);
          if (inner2.length === 1 && inner2[0] instanceof SymbolNode) {
            base = inner2[0];
            base.classes[0] = "mop";
          } else {
            base = buildCommon.makeSpan(["mop"], inner2, options2);
          }
        } else {
          var output2 = [];
          for (var i2 = 1; i2 < group2.name.length; i2++) {
            output2.push(buildCommon.mathsym(group2.name[i2], group2.mode, options2));
          }
          base = buildCommon.makeSpan(["mop"], output2, options2);
        }
        var baseShift = 0;
        var slant = 0;
        if ((base instanceof SymbolNode || group2.name === "\\oiint" || group2.name === "\\oiiint") && !group2.suppressBaseShift) {
          baseShift = (base.height - base.depth) / 2 - options2.fontMetrics().axisHeight;
          slant = base.italic;
        }
        if (hasLimits) {
          return assembleSupSub(base, supGroup, subGroup, options2, style3, slant, baseShift);
        } else {
          if (baseShift) {
            base.style.position = "relative";
            base.style.top = makeEm(baseShift);
          }
          return base;
        }
      }, "htmlBuilder$2");
      mathmlBuilder$1 = /* @__PURE__ */ __name((group2, options2) => {
        var node2;
        if (group2.symbol) {
          node2 = new MathNode("mo", [makeText(group2.name, group2.mode)]);
          if (noSuccessor.includes(group2.name)) {
            node2.setAttribute("largeop", "false");
          }
        } else if (group2.body) {
          node2 = new MathNode("mo", buildExpression2(group2.body, options2));
        } else {
          node2 = new MathNode("mi", [new TextNode(group2.name.slice(1))]);
          var operator = new MathNode("mo", [makeText("\u2061", "text")]);
          if (group2.parentIsSupSub) {
            node2 = new MathNode("mrow", [node2, operator]);
          } else {
            node2 = newDocumentFragment([node2, operator]);
          }
        }
        return node2;
      }, "mathmlBuilder$1");
      singleCharBigOps = {
        "\u220F": "\\prod",
        "\u2210": "\\coprod",
        "\u2211": "\\sum",
        "\u22C0": "\\bigwedge",
        "\u22C1": "\\bigvee",
        "\u22C2": "\\bigcap",
        "\u22C3": "\\bigcup",
        "\u2A00": "\\bigodot",
        "\u2A01": "\\bigoplus",
        "\u2A02": "\\bigotimes",
        "\u2A04": "\\biguplus",
        "\u2A06": "\\bigsqcup"
      };
      defineFunction({
        type: "op",
        names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "\u220F", "\u2210", "\u2211", "\u22C0", "\u22C1", "\u22C2", "\u22C3", "\u2A00", "\u2A01", "\u2A02", "\u2A04", "\u2A06"],
        props: {
          numArgs: 0
        },
        handler: /* @__PURE__ */ __name((_ref, args) => {
          var {
            parser: parser28,
            funcName
          } = _ref;
          var fName = funcName;
          if (fName.length === 1) {
            fName = singleCharBigOps[fName];
          }
          return {
            type: "op",
            mode: parser28.mode,
            limits: true,
            parentIsSupSub: false,
            symbol: true,
            name: fName
          };
        }, "handler"),
        htmlBuilder: htmlBuilder$2,
        mathmlBuilder: mathmlBuilder$1
      });
      defineFunction({
        type: "op",
        names: ["\\mathop"],
        props: {
          numArgs: 1,
          primitive: true
        },
        handler: /* @__PURE__ */ __name((_ref2, args) => {
          var {
            parser: parser28
          } = _ref2;
          var body = args[0];
          return {
            type: "op",
            mode: parser28.mode,
            limits: false,
            parentIsSupSub: false,
            symbol: false,
            body: ordargument(body)
          };
        }, "handler"),
        htmlBuilder: htmlBuilder$2,
        mathmlBuilder: mathmlBuilder$1
      });
      singleCharIntegrals = {
        "\u222B": "\\int",
        "\u222C": "\\iint",
        "\u222D": "\\iiint",
        "\u222E": "\\oint",
        "\u222F": "\\oiint",
        "\u2230": "\\oiiint"
      };
      defineFunction({
        type: "op",
        names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"],
        props: {
          numArgs: 0
        },
        handler(_ref3) {
          var {
            parser: parser28,
            funcName
          } = _ref3;
          return {
            type: "op",
            mode: parser28.mode,
            limits: false,
            parentIsSupSub: false,
            symbol: false,
            name: funcName
          };
        },
        htmlBuilder: htmlBuilder$2,
        mathmlBuilder: mathmlBuilder$1
      });
      defineFunction({
        type: "op",
        names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"],
        props: {
          numArgs: 0
        },
        handler(_ref4) {
          var {
            parser: parser28,
            funcName
          } = _ref4;
          return {
            type: "op",
            mode: parser28.mode,
            limits: true,
            parentIsSupSub: false,
            symbol: false,
            name: funcName
          };
        },
        htmlBuilder: htmlBuilder$2,
        mathmlBuilder: mathmlBuilder$1
      });
      defineFunction({
        type: "op",
        names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "\u222B", "\u222C", "\u222D", "\u222E", "\u222F", "\u2230"],
        props: {
          numArgs: 0
        },
        handler(_ref5) {
          var {
            parser: parser28,
            funcName
          } = _ref5;
          var fName = funcName;
          if (fName.length === 1) {
            fName = singleCharIntegrals[fName];
          }
          return {
            type: "op",
            mode: parser28.mode,
            limits: false,
            parentIsSupSub: false,
            symbol: true,
            name: fName
          };
        },
        htmlBuilder: htmlBuilder$2,
        mathmlBuilder: mathmlBuilder$1
      });
      htmlBuilder$1 = /* @__PURE__ */ __name((grp, options2) => {
        var supGroup;
        var subGroup;
        var hasLimits = false;
        var group2;
        if (grp.type === "supsub") {
          supGroup = grp.sup;
          subGroup = grp.sub;
          group2 = assertNodeType(grp.base, "operatorname");
          hasLimits = true;
        } else {
          group2 = assertNodeType(grp, "operatorname");
        }
        var base;
        if (group2.body.length > 0) {
          var body = group2.body.map((child2) => {
            var childText = child2.text;
            if (typeof childText === "string") {
              return {
                type: "textord",
                mode: child2.mode,
                text: childText
              };
            } else {
              return child2;
            }
          });
          var expression = buildExpression$1(body, options2.withFont("mathrm"), true);
          for (var i2 = 0; i2 < expression.length; i2++) {
            var child = expression[i2];
            if (child instanceof SymbolNode) {
              child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
            }
          }
          base = buildCommon.makeSpan(["mop"], expression, options2);
        } else {
          base = buildCommon.makeSpan(["mop"], [], options2);
        }
        if (hasLimits) {
          return assembleSupSub(base, supGroup, subGroup, options2, options2.style, 0, 0);
        } else {
          return base;
        }
      }, "htmlBuilder$1");
      mathmlBuilder2 = /* @__PURE__ */ __name((group2, options2) => {
        var expression = buildExpression2(group2.body, options2.withFont("mathrm"));
        var isAllString = true;
        for (var i2 = 0; i2 < expression.length; i2++) {
          var node2 = expression[i2];
          if (node2 instanceof mathMLTree.SpaceNode) ;
          else if (node2 instanceof mathMLTree.MathNode) {
            switch (node2.type) {
              case "mi":
              case "mn":
              case "ms":
              case "mspace":
              case "mtext":
                break;
              // Do nothing yet.
              case "mo": {
                var child = node2.children[0];
                if (node2.children.length === 1 && child instanceof mathMLTree.TextNode) {
                  child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
                } else {
                  isAllString = false;
                }
                break;
              }
              default:
                isAllString = false;
            }
          } else {
            isAllString = false;
          }
        }
        if (isAllString) {
          var word = expression.map((node3) => node3.toText()).join("");
          expression = [new mathMLTree.TextNode(word)];
        }
        var identifier2 = new mathMLTree.MathNode("mi", expression);
        identifier2.setAttribute("mathvariant", "normal");
        var operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]);
        if (group2.parentIsSupSub) {
          return new mathMLTree.MathNode("mrow", [identifier2, operator]);
        } else {
          return mathMLTree.newDocumentFragment([identifier2, operator]);
        }
      }, "mathmlBuilder");
      defineFunction({
        type: "operatorname",
        names: ["\\operatorname@", "\\operatornamewithlimits"],
        props: {
          numArgs: 1
        },
        handler: /* @__PURE__ */ __name((_ref, args) => {
          var {
            parser: parser28,
            funcName
          } = _ref;
          var body = args[0];
          return {
            type: "operatorname",
            mode: parser28.mode,
            body: ordargument(body),
            alwaysHandleSupSub: funcName === "\\operatornamewithlimits",
            limits: false,
            parentIsSupSub: false
          };
        }, "handler"),
        htmlBuilder: htmlBuilder$1,
        mathmlBuilder: mathmlBuilder2
      });
      defineMacro("\\operatorname", "\\@ifstar\\operatornamewithlimits\\operatorname@");
      defineFunctionBuilders({
        type: "ordgroup",
        htmlBuilder(group2, options2) {
          if (group2.semisimple) {
            return buildCommon.makeFragment(buildExpression$1(group2.body, options2, false));
          }
          return buildCommon.makeSpan(["mord"], buildExpression$1(group2.body, options2, true), options2);
        },
        mathmlBuilder(group2, options2) {
          return buildExpressionRow(group2.body, options2, true);
        }
      });
      defineFunction({
        type: "overline",
        names: ["\\overline"],
        props: {
          numArgs: 1
        },
        handler(_ref, args) {
          var {
            parser: parser28
          } = _ref;
          var body = args[0];
          return {
            type: "overline",
            mode: parser28.mode,
            body
          };
        },
        htmlBuilder(group2, options2) {
          var innerGroup = buildGroup$1(group2.body, options2.havingCrampedStyle());
          var line2 = buildCommon.makeLineSpan("overline-line", options2);
          var defaultRuleThickness = options2.fontMetrics().defaultRuleThickness;
          var vlist = buildCommon.makeVList({
            positionType: "firstBaseline",
            children: [{
              type: "elem",
              elem: innerGroup
            }, {
              type: "kern",
              size: 3 * defaultRuleThickness
            }, {
              type: "elem",
              elem: line2
            }, {
              type: "kern",
              size: defaultRuleThickness
            }]
          }, options2);
          return buildCommon.makeSpan(["mord", "overline"], [vlist], options2);
        },
        mathmlBuilder(group2, options2) {
          var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]);
          operator.setAttribute("stretchy", "true");
          var node2 = new mathMLTree.MathNode("mover", [buildGroup2(group2.body, options2), operator]);
          node2.setAttribute("accent", "true");
          return node2;
        }
      });
      defineFunction({
        type: "phantom",
        names: ["\\phantom"],
        props: {
          numArgs: 1,
          allowedInText: true
        },
        handler: /* @__PURE__ */ __name((_ref, args) => {
          var {
            parser: parser28
          } = _ref;
          var body = args[0];
          return {
            type: "phantom",
            mode: parser28.mode,
            body: ordargument(body)
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var elements2 = buildExpression$1(group2.body, options2.withPhantom(), false);
          return buildCommon.makeFragment(elements2);
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var inner2 = buildExpression2(group2.body, options2);
          return new mathMLTree.MathNode("mphantom", inner2);
        }, "mathmlBuilder")
      });
      defineFunction({
        type: "hphantom",
        names: ["\\hphantom"],
        props: {
          numArgs: 1,
          allowedInText: true
        },
        handler: /* @__PURE__ */ __name((_ref2, args) => {
          var {
            parser: parser28
          } = _ref2;
          var body = args[0];
          return {
            type: "hphantom",
            mode: parser28.mode,
            body
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var node2 = buildCommon.makeSpan([], [buildGroup$1(group2.body, options2.withPhantom())]);
          node2.height = 0;
          node2.depth = 0;
          if (node2.children) {
            for (var i2 = 0; i2 < node2.children.length; i2++) {
              node2.children[i2].height = 0;
              node2.children[i2].depth = 0;
            }
          }
          node2 = buildCommon.makeVList({
            positionType: "firstBaseline",
            children: [{
              type: "elem",
              elem: node2
            }]
          }, options2);
          return buildCommon.makeSpan(["mord"], [node2], options2);
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var inner2 = buildExpression2(ordargument(group2.body), options2);
          var phantom = new mathMLTree.MathNode("mphantom", inner2);
          var node2 = new mathMLTree.MathNode("mpadded", [phantom]);
          node2.setAttribute("height", "0px");
          node2.setAttribute("depth", "0px");
          return node2;
        }, "mathmlBuilder")
      });
      defineFunction({
        type: "vphantom",
        names: ["\\vphantom"],
        props: {
          numArgs: 1,
          allowedInText: true
        },
        handler: /* @__PURE__ */ __name((_ref3, args) => {
          var {
            parser: parser28
          } = _ref3;
          var body = args[0];
          return {
            type: "vphantom",
            mode: parser28.mode,
            body
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var inner2 = buildCommon.makeSpan(["inner"], [buildGroup$1(group2.body, options2.withPhantom())]);
          var fix = buildCommon.makeSpan(["fix"], []);
          return buildCommon.makeSpan(["mord", "rlap"], [inner2, fix], options2);
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var inner2 = buildExpression2(ordargument(group2.body), options2);
          var phantom = new mathMLTree.MathNode("mphantom", inner2);
          var node2 = new mathMLTree.MathNode("mpadded", [phantom]);
          node2.setAttribute("width", "0px");
          return node2;
        }, "mathmlBuilder")
      });
      defineFunction({
        type: "raisebox",
        names: ["\\raisebox"],
        props: {
          numArgs: 2,
          argTypes: ["size", "hbox"],
          allowedInText: true
        },
        handler(_ref, args) {
          var {
            parser: parser28
          } = _ref;
          var amount = assertNodeType(args[0], "size").value;
          var body = args[1];
          return {
            type: "raisebox",
            mode: parser28.mode,
            dy: amount,
            body
          };
        },
        htmlBuilder(group2, options2) {
          var body = buildGroup$1(group2.body, options2);
          var dy = calculateSize2(group2.dy, options2);
          return buildCommon.makeVList({
            positionType: "shift",
            positionData: -dy,
            children: [{
              type: "elem",
              elem: body
            }]
          }, options2);
        },
        mathmlBuilder(group2, options2) {
          var node2 = new mathMLTree.MathNode("mpadded", [buildGroup2(group2.body, options2)]);
          var dy = group2.dy.number + group2.dy.unit;
          node2.setAttribute("voffset", dy);
          return node2;
        }
      });
      defineFunction({
        type: "internal",
        names: ["\\relax"],
        props: {
          numArgs: 0,
          allowedInText: true,
          allowedInArgument: true
        },
        handler(_ref) {
          var {
            parser: parser28
          } = _ref;
          return {
            type: "internal",
            mode: parser28.mode
          };
        }
      });
      defineFunction({
        type: "rule",
        names: ["\\rule"],
        props: {
          numArgs: 2,
          numOptionalArgs: 1,
          allowedInText: true,
          allowedInMath: true,
          argTypes: ["size", "size", "size"]
        },
        handler(_ref, args, optArgs) {
          var {
            parser: parser28
          } = _ref;
          var shift2 = optArgs[0];
          var width3 = assertNodeType(args[0], "size");
          var height2 = assertNodeType(args[1], "size");
          return {
            type: "rule",
            mode: parser28.mode,
            shift: shift2 && assertNodeType(shift2, "size").value,
            width: width3.value,
            height: height2.value
          };
        },
        htmlBuilder(group2, options2) {
          var rule = buildCommon.makeSpan(["mord", "rule"], [], options2);
          var width3 = calculateSize2(group2.width, options2);
          var height2 = calculateSize2(group2.height, options2);
          var shift2 = group2.shift ? calculateSize2(group2.shift, options2) : 0;
          rule.style.borderRightWidth = makeEm(width3);
          rule.style.borderTopWidth = makeEm(height2);
          rule.style.bottom = makeEm(shift2);
          rule.width = width3;
          rule.height = height2 + shift2;
          rule.depth = -shift2;
          rule.maxFontSize = height2 * 1.125 * options2.sizeMultiplier;
          return rule;
        },
        mathmlBuilder(group2, options2) {
          var width3 = calculateSize2(group2.width, options2);
          var height2 = calculateSize2(group2.height, options2);
          var shift2 = group2.shift ? calculateSize2(group2.shift, options2) : 0;
          var color2 = options2.color && options2.getColor() || "black";
          var rule = new mathMLTree.MathNode("mspace");
          rule.setAttribute("mathbackground", color2);
          rule.setAttribute("width", makeEm(width3));
          rule.setAttribute("height", makeEm(height2));
          var wrapper = new mathMLTree.MathNode("mpadded", [rule]);
          if (shift2 >= 0) {
            wrapper.setAttribute("height", makeEm(shift2));
          } else {
            wrapper.setAttribute("height", makeEm(shift2));
            wrapper.setAttribute("depth", makeEm(-shift2));
          }
          wrapper.setAttribute("voffset", makeEm(shift2));
          return wrapper;
        }
      });
      __name(sizingGroup, "sizingGroup");
      sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"];
      htmlBuilder2 = /* @__PURE__ */ __name((group2, options2) => {
        var newOptions = options2.havingSize(group2.size);
        return sizingGroup(group2.body, newOptions, options2);
      }, "htmlBuilder");
      defineFunction({
        type: "sizing",
        names: sizeFuncs,
        props: {
          numArgs: 0,
          allowedInText: true
        },
        handler: /* @__PURE__ */ __name((_ref, args) => {
          var {
            breakOnTokenText,
            funcName,
            parser: parser28
          } = _ref;
          var body = parser28.parseExpression(false, breakOnTokenText);
          return {
            type: "sizing",
            mode: parser28.mode,
            // Figure out what size to use based on the list of functions above
            size: sizeFuncs.indexOf(funcName) + 1,
            body
          };
        }, "handler"),
        htmlBuilder: htmlBuilder2,
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var newOptions = options2.havingSize(group2.size);
          var inner2 = buildExpression2(group2.body, newOptions);
          var node2 = new mathMLTree.MathNode("mstyle", inner2);
          node2.setAttribute("mathsize", makeEm(newOptions.sizeMultiplier));
          return node2;
        }, "mathmlBuilder")
      });
      defineFunction({
        type: "smash",
        names: ["\\smash"],
        props: {
          numArgs: 1,
          numOptionalArgs: 1,
          allowedInText: true
        },
        handler: /* @__PURE__ */ __name((_ref, args, optArgs) => {
          var {
            parser: parser28
          } = _ref;
          var smashHeight = false;
          var smashDepth = false;
          var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup");
          if (tbArg) {
            var letter = "";
            for (var i2 = 0; i2 < tbArg.body.length; ++i2) {
              var node2 = tbArg.body[i2];
              letter = node2.text;
              if (letter === "t") {
                smashHeight = true;
              } else if (letter === "b") {
                smashDepth = true;
              } else {
                smashHeight = false;
                smashDepth = false;
                break;
              }
            }
          } else {
            smashHeight = true;
            smashDepth = true;
          }
          var body = args[0];
          return {
            type: "smash",
            mode: parser28.mode,
            body,
            smashHeight,
            smashDepth
          };
        }, "handler"),
        htmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var node2 = buildCommon.makeSpan([], [buildGroup$1(group2.body, options2)]);
          if (!group2.smashHeight && !group2.smashDepth) {
            return node2;
          }
          if (group2.smashHeight) {
            node2.height = 0;
            if (node2.children) {
              for (var i2 = 0; i2 < node2.children.length; i2++) {
                node2.children[i2].height = 0;
              }
            }
          }
          if (group2.smashDepth) {
            node2.depth = 0;
            if (node2.children) {
              for (var _i = 0; _i < node2.children.length; _i++) {
                node2.children[_i].depth = 0;
              }
            }
          }
          var smashedNode = buildCommon.makeVList({
            positionType: "firstBaseline",
            children: [{
              type: "elem",
              elem: node2
            }]
          }, options2);
          return buildCommon.makeSpan(["mord"], [smashedNode], options2);
        }, "htmlBuilder"),
        mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => {
          var node2 = new mathMLTree.MathNode("mpadded", [buildGroup2(group2.body, options2)]);
          if (group2.smashHeight) {
            node2.setAttribute("height", "0px");
          }
          if (group2.smashDepth) {
            node2.setAttribute("depth", "0px");
          }
          return node2;
        }, "mathmlBuilder")
      });
      defineFunction({
        type: "sqrt",
        names: ["\\sqrt"],
        props: {
          numArgs: 1,
          numOptionalArgs: 1
        },
        handler(_ref, args, optArgs) {
          var {
            parser: parser28
          } = _ref;
          var index = optArgs[0];
          var body = args[0];
          return {
            type: "sqrt",
            mode: parser28.mode,
            body,
            index
          };
        },
        htmlBuilder(group2, options2) {
          var inner2 = buildGroup$1(group2.body, options2.havingCrampedStyle());
          if (inner2.height === 0) {
            inner2.height = options2.fontMetrics().xHeight;
          }
          inner2 = buildCommon.wrapFragment(inner2, options2);
          var metrics = options2.fontMetrics();
          var theta = metrics.defaultRuleThickness;
          var phi2 = theta;
          if (options2.style.id < Style$1.TEXT.id) {
            phi2 = options2.fontMetrics().xHeight;
          }
          var lineClearance = theta + phi2 / 4;
          var minDelimiterHeight = inner2.height + inner2.depth + lineClearance + theta;
          var {
            span: img,
            ruleWidth,
            advanceWidth
          } = delimiter.sqrtImage(minDelimiterHeight, options2);
          var delimDepth = img.height - ruleWidth;
          if (delimDepth > inner2.height + inner2.depth + lineClearance) {
            lineClearance = (lineClearance + delimDepth - inner2.height - inner2.depth) / 2;
          }
          var imgShift = img.height - inner2.height - lineClearance - ruleWidth;
          inner2.style.paddingLeft = makeEm(advanceWidth);
          var body = buildCommon.makeVList({
            positionType: "firstBaseline",
            children: [{
              type: "elem",
              elem: inner2,
              wrapperClasses: ["svg-align"]
            }, {
              type: "kern",
              size: -(inner2.height + imgShift)
            }, {
              type: "elem",
              elem: img
            }, {
              type: "kern",
              size: ruleWidth
            }]
          }, options2);
          if (!group2.index) {
            return buildCommon.makeSpan(["mord", "sqrt"], [body], options2);
          } else {
            var newOptions = options2.havingStyle(Style$1.SCRIPTSCRIPT);
            var rootm = buildGroup$1(group2.index, newOptions, options2);
            var toShift = 0.6 * (body.height - body.depth);
            var rootVList = buildCommon.makeVList({
              positionType: "shift",
              positionData: -toShift,
              children: [{
                type: "elem",
                elem: rootm
              }]
            }, options2);
            var rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]);
            return buildCommon.makeSpan(["mord", "sqrt"], [rootVListWrap, body], options2);
          }
        },
        mathmlBuilder(group2, options2) {
          var {
            body,
            index
          } = group2;
          return index ? new mathMLTree.MathNode("mroot", [buildGroup2(body, options2), buildGroup2(index, options2)]) : new mathMLTree.MathNode("msqrt", [buildGroup2(body, options2)]);
        }
      });
      styleMap = {
        "display": Style$1.DISPLAY,
        "text": Style$1.TEXT,
        "script": Style$1.SCRIPT,
        "scriptscript": Style$1.SCRIPTSCRIPT
      };
      defineFunction({
        type: "styling",
        names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"],
        props: {
          numArgs: 0,
          allowedInText: true,
          primitive: true
        },
        handler(_ref, args) {
          var {
            breakOnTokenText,
            funcName,
            parser: parser28
          } = _ref;
          var body = parser28.parseExpression(true, breakOnTokenText);
          var style3 = funcName.slice(1, funcName.length - 5);
          return {
            type: "styling",
            mode: parser28.mode,
            // Figure out what style to use by pulling out the style from
            // the function name
            style: style3,
            body
          };
        },
        htmlBuilder(group2, options2) {
          var newStyle = styleMap[group2.style];
          var newOptions = options2.havingStyle(newStyle).withFont("");
          return sizingGroup(group2.body, newOptions, options2);
        },
        mathmlBuilder(group2, options2) {
          var newStyle = styleMap[group2.style];
          var newOptions = options2.havingStyle(newStyle);
          var inner2 = buildExpression2(group2.body, newOptions);
          var node2 = new mathMLTree.MathNode("mstyle", inner2);
          var styleAttributes = {
            "display": ["0", "true"],
            "text": ["0", "false"],
            "script": ["1", "false"],
            "scriptscript": ["2", "false"]
          };
          var attr = styleAttributes[group2.style];
          node2.setAttribute("scriptlevel", attr[0]);
          node2.setAttribute("displaystyle", attr[1]);
          return node2;
        }
      });
      htmlBuilderDelegate = /* @__PURE__ */ __name(function htmlBuilderDelegate2(group2, options2) {
        var base = group2.base;
        if (!base) {
          return null;
        } else if (base.type === "op") {
          var delegate = base.limits && (options2.style.size === Style$1.DISPLAY.size || base.alwaysHandleSupSub);
          return delegate ? htmlBuilder$2 : null;
        } else if (base.type === "operatorname") {
          var _delegate = base.alwaysHandleSupSub && (options2.style.size === Style$1.DISPLAY.size || base.limits);
          return _delegate ? htmlBuilder$1 : null;
        } else if (base.type === "accent") {
          return utils.isCharacterBox(base.base) ? htmlBuilder$a : null;
        } else if (base.type === "horizBrace") {
          var isSup = !group2.sub;
          return isSup === base.isOver ? htmlBuilder$3 : null;
        } else {
          return null;
        }
      }, "htmlBuilderDelegate");
      defineFunctionBuilders({
        type: "supsub",
        htmlBuilder(group2, options2) {
          var builderDelegate = htmlBuilderDelegate(group2, options2);
          if (builderDelegate) {
            return builderDelegate(group2, options2);
          }
          var {
            base: valueBase,
            sup: valueSup,
            sub: valueSub
          } = group2;
          var base = buildGroup$1(valueBase, options2);
          var supm;
          var subm;
          var metrics = options2.fontMetrics();
          var supShift = 0;
          var subShift = 0;
          var isCharacterBox3 = valueBase && utils.isCharacterBox(valueBase);
          if (valueSup) {
            var newOptions = options2.havingStyle(options2.style.sup());
            supm = buildGroup$1(valueSup, newOptions, options2);
            if (!isCharacterBox3) {
              supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options2.sizeMultiplier;
            }
          }
          if (valueSub) {
            var _newOptions = options2.havingStyle(options2.style.sub());
            subm = buildGroup$1(valueSub, _newOptions, options2);
            if (!isCharacterBox3) {
              subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options2.sizeMultiplier;
            }
          }
          var minSupShift;
          if (options2.style === Style$1.DISPLAY) {
            minSupShift = metrics.sup1;
          } else if (options2.style.cramped) {
            minSupShift = metrics.sup3;
          } else {
            minSupShift = metrics.sup2;
          }
          var multiplier = options2.sizeMultiplier;
          var marginRight = makeEm(0.5 / metrics.ptPerEm / multiplier);
          var marginLeft = null;
          if (subm) {
            var isOiint = group2.base && group2.base.type === "op" && group2.base.name && (group2.base.name === "\\oiint" || group2.base.name === "\\oiiint");
            if (base instanceof SymbolNode || isOiint) {
              marginLeft = makeEm(-base.italic);
            }
          }
          var supsub;
          if (supm && subm) {
            supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
            subShift = Math.max(subShift, metrics.sub2);
            var ruleWidth = metrics.defaultRuleThickness;
            var maxWidth2 = 4 * ruleWidth;
            if (supShift - supm.depth - (subm.height - subShift) < maxWidth2) {
              subShift = maxWidth2 - (supShift - supm.depth) + subm.height;
              var psi = 0.8 * metrics.xHeight - (supShift - supm.depth);
              if (psi > 0) {
                supShift += psi;
                subShift -= psi;
              }
            }
            var vlistElem = [{
              type: "elem",
              elem: subm,
              shift: subShift,
              marginRight,
              marginLeft
            }, {
              type: "elem",
              elem: supm,
              shift: -supShift,
              marginRight
            }];
            supsub = buildCommon.makeVList({
              positionType: "individualShift",
              children: vlistElem
            }, options2);
          } else if (subm) {
            subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight);
            var _vlistElem = [{
              type: "elem",
              elem: subm,
              marginLeft,
              marginRight
            }];
            supsub = buildCommon.makeVList({
              positionType: "shift",
              positionData: subShift,
              children: _vlistElem
            }, options2);
          } else if (supm) {
            supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
            supsub = buildCommon.makeVList({
              positionType: "shift",
              positionData: -supShift,
              children: [{
                type: "elem",
                elem: supm,
                marginRight
              }]
            }, options2);
          } else {
            throw new Error("supsub must have either sup or sub.");
          }
          var mclass = getTypeOfDomTree(base, "right") || "mord";
          return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan(["msupsub"], [supsub])], options2);
        },
        mathmlBuilder(group2, options2) {
          var isBrace = false;
          var isOver;
          var isSup;
          if (group2.base && group2.base.type === "horizBrace") {
            isSup = !!group2.sup;
            if (isSup === group2.base.isOver) {
              isBrace = true;
              isOver = group2.base.isOver;
            }
          }
          if (group2.base && (group2.base.type === "op" || group2.base.type === "operatorname")) {
            group2.base.parentIsSupSub = true;
          }
          var children2 = [buildGroup2(group2.base, options2)];
          if (group2.sub) {
            children2.push(buildGroup2(group2.sub, options2));
          }
          if (group2.sup) {
            children2.push(buildGroup2(group2.sup, options2));
          }
          var nodeType3;
          if (isBrace) {
            nodeType3 = isOver ? "mover" : "munder";
          } else if (!group2.sub) {
            var base = group2.base;
            if (base && base.type === "op" && base.limits && (options2.style === Style$1.DISPLAY || base.alwaysHandleSupSub)) {
              nodeType3 = "mover";
            } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (base.limits || options2.style === Style$1.DISPLAY)) {
              nodeType3 = "mover";
            } else {
              nodeType3 = "msup";
            }
          } else if (!group2.sup) {
            var _base = group2.base;
            if (_base && _base.type === "op" && _base.limits && (options2.style === Style$1.DISPLAY || _base.alwaysHandleSupSub)) {
              nodeType3 = "munder";
            } else if (_base && _base.type === "operatorname" && _base.alwaysHandleSupSub && (_base.limits || options2.style === Style$1.DISPLAY)) {
              nodeType3 = "munder";
            } else {
              nodeType3 = "msub";
            }
          } else {
            var _base2 = group2.base;
            if (_base2 && _base2.type === "op" && _base2.limits && options2.style === Style$1.DISPLAY) {
              nodeType3 = "munderover";
            } else if (_base2 && _base2.type === "operatorname" && _base2.alwaysHandleSupSub && (options2.style === Style$1.DISPLAY || _base2.limits)) {
              nodeType3 = "munderover";
            } else {
              nodeType3 = "msubsup";
            }
          }
          return new mathMLTree.MathNode(nodeType3, children2);
        }
      });
      defineFunctionBuilders({
        type: "atom",
        htmlBuilder(group2, options2) {
          return buildCommon.mathsym(group2.text, group2.mode, options2, ["m" + group2.family]);
        },
        mathmlBuilder(group2, options2) {
          var node2 = new mathMLTree.MathNode("mo", [makeText(group2.text, group2.mode)]);
          if (group2.family === "bin") {
            var variant = getVariant(group2, options2);
            if (variant === "bold-italic") {
              node2.setAttribute("mathvariant", variant);
            }
          } else if (group2.family === "punct") {
            node2.setAttribute("separator", "true");
          } else if (group2.family === "open" || group2.family === "close") {
            node2.setAttribute("stretchy", "false");
          }
          return node2;
        }
      });
      defaultVariant = {
        "mi": "italic",
        "mn": "normal",
        "mtext": "normal"
      };
      defineFunctionBuilders({
        type: "mathord",
        htmlBuilder(group2, options2) {
          return buildCommon.makeOrd(group2, options2, "mathord");
        },
        mathmlBuilder(group2, options2) {
          var node2 = new mathMLTree.MathNode("mi", [makeText(group2.text, group2.mode, options2)]);
          var variant = getVariant(group2, options2) || "italic";
          if (variant !== defaultVariant[node2.type]) {
            node2.setAttribute("mathvariant", variant);
          }
          return node2;
        }
      });
      defineFunctionBuilders({
        type: "textord",
        htmlBuilder(group2, options2) {
          return buildCommon.makeOrd(group2, options2, "textord");
        },
        mathmlBuilder(group2, options2) {
          var text4 = makeText(group2.text, group2.mode, options2);
          var variant = getVariant(group2, options2) || "normal";
          var node2;
          if (group2.mode === "text") {
            node2 = new mathMLTree.MathNode("mtext", [text4]);
          } else if (/[0-9]/.test(group2.text)) {
            node2 = new mathMLTree.MathNode("mn", [text4]);
          } else if (group2.text === "\\prime") {
            node2 = new mathMLTree.MathNode("mo", [text4]);
          } else {
            node2 = new mathMLTree.MathNode("mi", [text4]);
          }
          if (variant !== defaultVariant[node2.type]) {
            node2.setAttribute("mathvariant", variant);
          }
          return node2;
        }
      });
      cssSpace = {
        "\\nobreak": "nobreak",
        "\\allowbreak": "allowbreak"
      };
      regularSpace = {
        " ": {},
        "\\ ": {},
        "~": {
          className: "nobreak"
        },
        "\\space": {},
        "\\nobreakspace": {
          className: "nobreak"
        }
      };
      defineFunctionBuilders({
        type: "spacing",
        htmlBuilder(group2, options2) {
          if (regularSpace.hasOwnProperty(group2.text)) {
            var className = regularSpace[group2.text].className || "";
            if (group2.mode === "text") {
              var ord = buildCommon.makeOrd(group2, options2, "textord");
              ord.classes.push(className);
              return ord;
            } else {
              return buildCommon.makeSpan(["mspace", className], [buildCommon.mathsym(group2.text, group2.mode, options2)], options2);
            }
          } else if (cssSpace.hasOwnProperty(group2.text)) {
            return buildCommon.makeSpan(["mspace", cssSpace[group2.text]], [], options2);
          } else {
            throw new ParseError('Unknown type of space "' + group2.text + '"');
          }
        },
        mathmlBuilder(group2, options2) {
          var node2;
          if (regularSpace.hasOwnProperty(group2.text)) {
            node2 = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode("\xA0")]);
          } else if (cssSpace.hasOwnProperty(group2.text)) {
            return new mathMLTree.MathNode("mspace");
          } else {
            throw new ParseError('Unknown type of space "' + group2.text + '"');
          }
          return node2;
        }
      });
      pad = /* @__PURE__ */ __name(() => {
        var padNode = new mathMLTree.MathNode("mtd", []);
        padNode.setAttribute("width", "50%");
        return padNode;
      }, "pad");
      defineFunctionBuilders({
        type: "tag",
        mathmlBuilder(group2, options2) {
          var table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group2.body, options2)]), pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group2.tag, options2)])])]);
          table.setAttribute("width", "100%");
          return table;
        }
      });
      textFontFamilies = {
        "\\text": void 0,
        "\\textrm": "textrm",
        "\\textsf": "textsf",
        "\\texttt": "texttt",
        "\\textnormal": "textrm"
      };
      textFontWeights = {
        "\\textbf": "textbf",
        "\\textmd": "textmd"
      };
      textFontShapes = {
        "\\textit": "textit",
        "\\textup": "textup"
      };
      optionsWithFont = /* @__PURE__ */ __name((group2, options2) => {
        var font = group2.font;
        if (!font) {
          return options2;
        } else if (textFontFamilies[font]) {
          return options2.withTextFontFamily(textFontFamilies[font]);
        } else if (textFontWeights[font]) {
          return options2.withTextFontWeight(textFontWeights[font]);
        } else if (font === "\\emph") {
          return options2.fontShape === "textit" ? options2.withTextFontShape("textup") : options2.withTextFontShape("textit");
        }
        return options2.withTextFontShape(textFontShapes[font]);
      }, "optionsWithFont");
      defineFunction({
        type: "text",
        names: [
          // Font families
          "\\text",
          "\\textrm",
          "\\textsf",
          "\\texttt",
          "\\textnormal",
          // Font weights
          "\\textbf",
          "\\textmd",
          // Font Shapes
          "\\textit",
          "\\textup",
          "\\emph"
        ],
        props: {
          numArgs: 1,
          argTypes: ["text"],
          allowedInArgument: true,
          allowedInText: true
        },
        handler(_ref, args) {
          var {
            parser: parser28,
            funcName
          } = _ref;
          var body = args[0];
          return {
            type: "text",
            mode: parser28.mode,
            body: ordargument(body),
            font: funcName
          };
        },
        htmlBuilder(group2, options2) {
          var newOptions = optionsWithFont(group2, options2);
          var inner2 = buildExpression$1(group2.body, newOptions, true);
          return buildCommon.makeSpan(["mord", "text"], inner2, newOptions);
        },
        mathmlBuilder(group2, options2) {
          var newOptions = optionsWithFont(group2, options2);
          return buildExpressionRow(group2.body, newOptions);
        }
      });
      defineFunction({
        type: "underline",
        names: ["\\underline"],
        props: {
          numArgs: 1,
          allowedInText: true
        },
        handler(_ref, args) {
          var {
            parser: parser28
          } = _ref;
          return {
            type: "underline",
            mode: parser28.mode,
            body: args[0]
          };
        },
        htmlBuilder(group2, options2) {
          var innerGroup = buildGroup$1(group2.body, options2);
          var line2 = buildCommon.makeLineSpan("underline-line", options2);
          var defaultRuleThickness = options2.fontMetrics().defaultRuleThickness;
          var vlist = buildCommon.makeVList({
            positionType: "top",
            positionData: innerGroup.height,
            children: [{
              type: "kern",
              size: defaultRuleThickness
            }, {
              type: "elem",
              elem: line2
            }, {
              type: "kern",
              size: 3 * defaultRuleThickness
            }, {
              type: "elem",
              elem: innerGroup
            }]
          }, options2);
          return buildCommon.makeSpan(["mord", "underline"], [vlist], options2);
        },
        mathmlBuilder(group2, options2) {
          var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]);
          operator.setAttribute("stretchy", "true");
          var node2 = new mathMLTree.MathNode("munder", [buildGroup2(group2.body, options2), operator]);
          node2.setAttribute("accentunder", "true");
          return node2;
        }
      });
      defineFunction({
        type: "vcenter",
        names: ["\\vcenter"],
        props: {
          numArgs: 1,
          argTypes: ["original"],
          // In LaTeX, \vcenter can act only on a box.
          allowedInText: false
        },
        handler(_ref, args) {
          var {
            parser: parser28
          } = _ref;
          return {
            type: "vcenter",
            mode: parser28.mode,
            body: args[0]
          };
        },
        htmlBuilder(group2, options2) {
          var body = buildGroup$1(group2.body, options2);
          var axisHeight = options2.fontMetrics().axisHeight;
          var dy = 0.5 * (body.height - axisHeight - (body.depth + axisHeight));
          return buildCommon.makeVList({
            positionType: "shift",
            positionData: dy,
            children: [{
              type: "elem",
              elem: body
            }]
          }, options2);
        },
        mathmlBuilder(group2, options2) {
          return new mathMLTree.MathNode("mpadded", [buildGroup2(group2.body, options2)], ["vcenter"]);
        }
      });
      defineFunction({
        type: "verb",
        names: ["\\verb"],
        props: {
          numArgs: 0,
          allowedInText: true
        },
        handler(context, args, optArgs) {
          throw new ParseError("\\verb ended by end of line instead of matching delimiter");
        },
        htmlBuilder(group2, options2) {
          var text4 = makeVerb(group2);
          var body = [];
          var newOptions = options2.havingStyle(options2.style.text());
          for (var i2 = 0; i2 < text4.length; i2++) {
            var c3 = text4[i2];
            if (c3 === "~") {
              c3 = "\\textasciitilde";
            }
            body.push(buildCommon.makeSymbol(c3, "Typewriter-Regular", group2.mode, newOptions, ["mord", "texttt"]));
          }
          return buildCommon.makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options2)), buildCommon.tryCombineChars(body), newOptions);
        },
        mathmlBuilder(group2, options2) {
          var text4 = new mathMLTree.TextNode(makeVerb(group2));
          var node2 = new mathMLTree.MathNode("mtext", [text4]);
          node2.setAttribute("mathvariant", "monospace");
          return node2;
        }
      });
      makeVerb = /* @__PURE__ */ __name((group2) => group2.body.replace(/ /g, group2.star ? "\u2423" : "\xA0"), "makeVerb");
      functions = _functions;
      spaceRegexString = "[ \r\n	]";
      controlWordRegexString = "\\\\[a-zA-Z@]+";
      controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]";
      controlWordWhitespaceRegexString = "(" + controlWordRegexString + ")" + spaceRegexString + "*";
      controlSpaceRegexString = "\\\\(\n|[ \r	]+\n?)[ \r	]*";
      combiningDiacriticalMarkString = "[\u0300-\u036F]";
      combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + "+$");
      tokenRegexString = "(" + spaceRegexString + "+)|" + // whitespace
      (controlSpaceRegexString + "|") + // \whitespace
      "([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + // single codepoint
      (combiningDiacriticalMarkString + "*") + // ...plus accents
      "|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair
      (combiningDiacriticalMarkString + "*") + // ...plus accents
      "|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5" + // \verb unstarred
      ("|" + controlWordWhitespaceRegexString) + // \macroName + spaces
      ("|" + controlSymbolRegexString + ")");
      Lexer = class {
        static {
          __name(this, "Lexer");
        }
        // Category codes. The lexer only supports comment characters (14) for now.
        // MacroExpander additionally distinguishes active (13).
        constructor(input, settings) {
          this.input = void 0;
          this.settings = void 0;
          this.tokenRegex = void 0;
          this.catcodes = void 0;
          this.input = input;
          this.settings = settings;
          this.tokenRegex = new RegExp(tokenRegexString, "g");
          this.catcodes = {
            "%": 14,
            // comment character
            "~": 13
            // active character
          };
        }
        setCatcode(char2, code) {
          this.catcodes[char2] = code;
        }
        /**
         * This function lexes a single token.
         */
        lex() {
          var input = this.input;
          var pos = this.tokenRegex.lastIndex;
          if (pos === input.length) {
            return new Token("EOF", new SourceLocation(this, pos, pos));
          }
          var match2 = this.tokenRegex.exec(input);
          if (match2 === null || match2.index !== pos) {
            throw new ParseError("Unexpected character: '" + input[pos] + "'", new Token(input[pos], new SourceLocation(this, pos, pos + 1)));
          }
          var text4 = match2[6] || match2[3] || (match2[2] ? "\\ " : " ");
          if (this.catcodes[text4] === 14) {
            var nlIndex = input.indexOf("\n", this.tokenRegex.lastIndex);
            if (nlIndex === -1) {
              this.tokenRegex.lastIndex = input.length;
              this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)");
            } else {
              this.tokenRegex.lastIndex = nlIndex + 1;
            }
            return this.lex();
          }
          return new Token(text4, new SourceLocation(this, pos, this.tokenRegex.lastIndex));
        }
      };
      Namespace = class {
        static {
          __name(this, "Namespace");
        }
        /**
         * Both arguments are optional.  The first argument is an object of
         * built-in mappings which never change.  The second argument is an object
         * of initial (global-level) mappings, which will constantly change
         * according to any global/top-level `set`s done.
         */
        constructor(builtins, globalMacros) {
          if (builtins === void 0) {
            builtins = {};
          }
          if (globalMacros === void 0) {
            globalMacros = {};
          }
          this.current = void 0;
          this.builtins = void 0;
          this.undefStack = void 0;
          this.current = globalMacros;
          this.builtins = builtins;
          this.undefStack = [];
        }
        /**
         * Start a new nested group, affecting future local `set`s.
         */
        beginGroup() {
          this.undefStack.push({});
        }
        /**
         * End current nested group, restoring values before the group began.
         */
        endGroup() {
          if (this.undefStack.length === 0) {
            throw new ParseError("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");
          }
          var undefs = this.undefStack.pop();
          for (var undef2 in undefs) {
            if (undefs.hasOwnProperty(undef2)) {
              if (undefs[undef2] == null) {
                delete this.current[undef2];
              } else {
                this.current[undef2] = undefs[undef2];
              }
            }
          }
        }
        /**
         * Ends all currently nested groups (if any), restoring values before the
         * groups began.  Useful in case of an error in the middle of parsing.
         */
        endGroups() {
          while (this.undefStack.length > 0) {
            this.endGroup();
          }
        }
        /**
         * Detect whether `name` has a definition.  Equivalent to
         * `get(name) != null`.
         */
        has(name) {
          return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name);
        }
        /**
         * Get the current value of a name, or `undefined` if there is no value.
         *
         * Note: Do not use `if (namespace.get(...))` to detect whether a macro
         * is defined, as the definition may be the empty string which evaluates
         * to `false` in JavaScript.  Use `if (namespace.get(...) != null)` or
         * `if (namespace.has(...))`.
         */
        get(name) {
          if (this.current.hasOwnProperty(name)) {
            return this.current[name];
          } else {
            return this.builtins[name];
          }
        }
        /**
         * Set the current value of a name, and optionally set it globally too.
         * Local set() sets the current value and (when appropriate) adds an undo
         * operation to the undo stack.  Global set() may change the undo
         * operation at every level, so takes time linear in their number.
         * A value of undefined means to delete existing definitions.
         */
        set(name, value2, global2) {
          if (global2 === void 0) {
            global2 = false;
          }
          if (global2) {
            for (var i2 = 0; i2 < this.undefStack.length; i2++) {
              delete this.undefStack[i2][name];
            }
            if (this.undefStack.length > 0) {
              this.undefStack[this.undefStack.length - 1][name] = value2;
            }
          } else {
            var top2 = this.undefStack[this.undefStack.length - 1];
            if (top2 && !top2.hasOwnProperty(name)) {
              top2[name] = this.current[name];
            }
          }
          if (value2 == null) {
            delete this.current[name];
          } else {
            this.current[name] = value2;
          }
        }
      };
      macros = _macros;
      defineMacro("\\noexpand", function(context) {
        var t4 = context.popToken();
        if (context.isExpandable(t4.text)) {
          t4.noexpand = true;
          t4.treatAsRelax = true;
        }
        return {
          tokens: [t4],
          numArgs: 0
        };
      });
      defineMacro("\\expandafter", function(context) {
        var t4 = context.popToken();
        context.expandOnce(true);
        return {
          tokens: [t4],
          numArgs: 0
        };
      });
      defineMacro("\\@firstoftwo", function(context) {
        var args = context.consumeArgs(2);
        return {
          tokens: args[0],
          numArgs: 0
        };
      });
      defineMacro("\\@secondoftwo", function(context) {
        var args = context.consumeArgs(2);
        return {
          tokens: args[1],
          numArgs: 0
        };
      });
      defineMacro("\\@ifnextchar", function(context) {
        var args = context.consumeArgs(3);
        context.consumeSpaces();
        var nextToken = context.future();
        if (args[0].length === 1 && args[0][0].text === nextToken.text) {
          return {
            tokens: args[1],
            numArgs: 0
          };
        } else {
          return {
            tokens: args[2],
            numArgs: 0
          };
        }
      });
      defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}");
      defineMacro("\\TextOrMath", function(context) {
        var args = context.consumeArgs(2);
        if (context.mode === "text") {
          return {
            tokens: args[0],
            numArgs: 0
          };
        } else {
          return {
            tokens: args[1],
            numArgs: 0
          };
        }
      });
      digitToNumber = {
        "0": 0,
        "1": 1,
        "2": 2,
        "3": 3,
        "4": 4,
        "5": 5,
        "6": 6,
        "7": 7,
        "8": 8,
        "9": 9,
        "a": 10,
        "A": 10,
        "b": 11,
        "B": 11,
        "c": 12,
        "C": 12,
        "d": 13,
        "D": 13,
        "e": 14,
        "E": 14,
        "f": 15,
        "F": 15
      };
      defineMacro("\\char", function(context) {
        var token2 = context.popToken();
        var base;
        var number7 = "";
        if (token2.text === "'") {
          base = 8;
          token2 = context.popToken();
        } else if (token2.text === '"') {
          base = 16;
          token2 = context.popToken();
        } else if (token2.text === "`") {
          token2 = context.popToken();
          if (token2.text[0] === "\\") {
            number7 = token2.text.charCodeAt(1);
          } else if (token2.text === "EOF") {
            throw new ParseError("\\char` missing argument");
          } else {
            number7 = token2.text.charCodeAt(0);
          }
        } else {
          base = 10;
        }
        if (base) {
          number7 = digitToNumber[token2.text];
          if (number7 == null || number7 >= base) {
            throw new ParseError("Invalid base-" + base + " digit " + token2.text);
          }
          var digit;
          while ((digit = digitToNumber[context.future().text]) != null && digit < base) {
            number7 *= base;
            number7 += digit;
            context.popToken();
          }
        }
        return "\\@char{" + number7 + "}";
      });
      newcommand = /* @__PURE__ */ __name((context, existsOK, nonexistsOK, skipIfExists) => {
        var arg = context.consumeArg().tokens;
        if (arg.length !== 1) {
          throw new ParseError("\\newcommand's first argument must be a macro name");
        }
        var name = arg[0].text;
        var exists = context.isDefined(name);
        if (exists && !existsOK) {
          throw new ParseError("\\newcommand{" + name + "} attempting to redefine " + (name + "; use \\renewcommand"));
        }
        if (!exists && !nonexistsOK) {
          throw new ParseError("\\renewcommand{" + name + "} when command " + name + " does not yet exist; use \\newcommand");
        }
        var numArgs = 0;
        arg = context.consumeArg().tokens;
        if (arg.length === 1 && arg[0].text === "[") {
          var argText = "";
          var token2 = context.expandNextToken();
          while (token2.text !== "]" && token2.text !== "EOF") {
            argText += token2.text;
            token2 = context.expandNextToken();
          }
          if (!argText.match(/^\s*[0-9]+\s*$/)) {
            throw new ParseError("Invalid number of arguments: " + argText);
          }
          numArgs = parseInt(argText);
          arg = context.consumeArg().tokens;
        }
        if (!(exists && skipIfExists)) {
          context.macros.set(name, {
            tokens: arg,
            numArgs
          });
        }
        return "";
      }, "newcommand");
      defineMacro("\\newcommand", (context) => newcommand(context, false, true, false));
      defineMacro("\\renewcommand", (context) => newcommand(context, true, false, false));
      defineMacro("\\providecommand", (context) => newcommand(context, true, true, true));
      defineMacro("\\message", (context) => {
        var arg = context.consumeArgs(1)[0];
        console.log(arg.reverse().map((token2) => token2.text).join(""));
        return "";
      });
      defineMacro("\\errmessage", (context) => {
        var arg = context.consumeArgs(1)[0];
        console.error(arg.reverse().map((token2) => token2.text).join(""));
        return "";
      });
      defineMacro("\\show", (context) => {
        var tok = context.popToken();
        var name = tok.text;
        console.log(tok, context.macros.get(name), functions[name], symbols.math[name], symbols.text[name]);
        return "";
      });
      defineMacro("\\bgroup", "{");
      defineMacro("\\egroup", "}");
      defineMacro("~", "\\nobreakspace");
      defineMacro("\\lq", "`");
      defineMacro("\\rq", "'");
      defineMacro("\\aa", "\\r a");
      defineMacro("\\AA", "\\r A");
      defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`\xA9}");
      defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");
      defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}");
      defineMacro("\u212C", "\\mathscr{B}");
      defineMacro("\u2130", "\\mathscr{E}");
      defineMacro("\u2131", "\\mathscr{F}");
      defineMacro("\u210B", "\\mathscr{H}");
      defineMacro("\u2110", "\\mathscr{I}");
      defineMacro("\u2112", "\\mathscr{L}");
      defineMacro("\u2133", "\\mathscr{M}");
      defineMacro("\u211B", "\\mathscr{R}");
      defineMacro("\u212D", "\\mathfrak{C}");
      defineMacro("\u210C", "\\mathfrak{H}");
      defineMacro("\u2128", "\\mathfrak{Z}");
      defineMacro("\\Bbbk", "\\Bbb{k}");
      defineMacro("\xB7", "\\cdotp");
      defineMacro("\\llap", "\\mathllap{\\textrm{#1}}");
      defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}");
      defineMacro("\\clap", "\\mathclap{\\textrm{#1}}");
      defineMacro("\\mathstrut", "\\vphantom{(}");
      defineMacro("\\underbar", "\\underline{\\text{#1}}");
      defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');
      defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}");
      defineMacro("\\ne", "\\neq");
      defineMacro("\u2260", "\\neq");
      defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`\u2209}}");
      defineMacro("\u2209", "\\notin");
      defineMacro("\u2258", "\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`\u2258}}");
      defineMacro("\u2259", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");
      defineMacro("\u225A", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");
      defineMacro("\u225B", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`\u225B}}");
      defineMacro("\u225D", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`\u225D}}");
      defineMacro("\u225E", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`\u225E}}");
      defineMacro("\u225F", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}");
      defineMacro("\u27C2", "\\perp");
      defineMacro("\u203C", "\\mathclose{!\\mkern-0.8mu!}");
      defineMacro("\u220C", "\\notni");
      defineMacro("\u231C", "\\ulcorner");
      defineMacro("\u231D", "\\urcorner");
      defineMacro("\u231E", "\\llcorner");
      defineMacro("\u231F", "\\lrcorner");
      defineMacro("\xA9", "\\copyright");
      defineMacro("\xAE", "\\textregistered");
      defineMacro("\uFE0F", "\\textregistered");
      defineMacro("\\ulcorner", '\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');
      defineMacro("\\urcorner", '\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');
      defineMacro("\\llcorner", '\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');
      defineMacro("\\lrcorner", '\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');
      defineMacro("\\vdots", "{\\varvdots\\rule{0pt}{15pt}}");
      defineMacro("\u22EE", "\\vdots");
      defineMacro("\\varGamma", "\\mathit{\\Gamma}");
      defineMacro("\\varDelta", "\\mathit{\\Delta}");
      defineMacro("\\varTheta", "\\mathit{\\Theta}");
      defineMacro("\\varLambda", "\\mathit{\\Lambda}");
      defineMacro("\\varXi", "\\mathit{\\Xi}");
      defineMacro("\\varPi", "\\mathit{\\Pi}");
      defineMacro("\\varSigma", "\\mathit{\\Sigma}");
      defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}");
      defineMacro("\\varPhi", "\\mathit{\\Phi}");
      defineMacro("\\varPsi", "\\mathit{\\Psi}");
      defineMacro("\\varOmega", "\\mathit{\\Omega}");
      defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}");
      defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");
      defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}");
      defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;");
      defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;");
      defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;");
      defineMacro("\\dddot", "{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");
      defineMacro("\\ddddot", "{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");
      dotsByToken = {
        ",": "\\dotsc",
        "\\not": "\\dotsb",
        // \keybin@ checks for the following:
        "+": "\\dotsb",
        "=": "\\dotsb",
        "<": "\\dotsb",
        ">": "\\dotsb",
        "-": "\\dotsb",
        "*": "\\dotsb",
        ":": "\\dotsb",
        // Symbols whose definition starts with \DOTSB:
        "\\DOTSB": "\\dotsb",
        "\\coprod": "\\dotsb",
        "\\bigvee": "\\dotsb",
        "\\bigwedge": "\\dotsb",
        "\\biguplus": "\\dotsb",
        "\\bigcap": "\\dotsb",
        "\\bigcup": "\\dotsb",
        "\\prod": "\\dotsb",
        "\\sum": "\\dotsb",
        "\\bigotimes": "\\dotsb",
        "\\bigoplus": "\\dotsb",
        "\\bigodot": "\\dotsb",
        "\\bigsqcup": "\\dotsb",
        "\\And": "\\dotsb",
        "\\longrightarrow": "\\dotsb",
        "\\Longrightarrow": "\\dotsb",
        "\\longleftarrow": "\\dotsb",
        "\\Longleftarrow": "\\dotsb",
        "\\longleftrightarrow": "\\dotsb",
        "\\Longleftrightarrow": "\\dotsb",
        "\\mapsto": "\\dotsb",
        "\\longmapsto": "\\dotsb",
        "\\hookrightarrow": "\\dotsb",
        "\\doteq": "\\dotsb",
        // Symbols whose definition starts with \mathbin:
        "\\mathbin": "\\dotsb",
        // Symbols whose definition starts with \mathrel:
        "\\mathrel": "\\dotsb",
        "\\relbar": "\\dotsb",
        "\\Relbar": "\\dotsb",
        "\\xrightarrow": "\\dotsb",
        "\\xleftarrow": "\\dotsb",
        // Symbols whose definition starts with \DOTSI:
        "\\DOTSI": "\\dotsi",
        "\\int": "\\dotsi",
        "\\oint": "\\dotsi",
        "\\iint": "\\dotsi",
        "\\iiint": "\\dotsi",
        "\\iiiint": "\\dotsi",
        "\\idotsint": "\\dotsi",
        // Symbols whose definition starts with \DOTSX:
        "\\DOTSX": "\\dotsx"
      };
      defineMacro("\\dots", function(context) {
        var thedots = "\\dotso";
        var next3 = context.expandAfterFuture().text;
        if (next3 in dotsByToken) {
          thedots = dotsByToken[next3];
        } else if (next3.slice(0, 4) === "\\not") {
          thedots = "\\dotsb";
        } else if (next3 in symbols.math) {
          if (["bin", "rel"].includes(symbols.math[next3].group)) {
            thedots = "\\dotsb";
          }
        }
        return thedots;
      });
      spaceAfterDots = {
        // \rightdelim@ checks for the following:
        ")": true,
        "]": true,
        "\\rbrack": true,
        "\\}": true,
        "\\rbrace": true,
        "\\rangle": true,
        "\\rceil": true,
        "\\rfloor": true,
        "\\rgroup": true,
        "\\rmoustache": true,
        "\\right": true,
        "\\bigr": true,
        "\\biggr": true,
        "\\Bigr": true,
        "\\Biggr": true,
        // \extra@ also tests for the following:
        "$": true,
        // \extrap@ checks for the following:
        ";": true,
        ".": true,
        ",": true
      };
      defineMacro("\\dotso", function(context) {
        var next3 = context.future().text;
        if (next3 in spaceAfterDots) {
          return "\\ldots\\,";
        } else {
          return "\\ldots";
        }
      });
      defineMacro("\\dotsc", function(context) {
        var next3 = context.future().text;
        if (next3 in spaceAfterDots && next3 !== ",") {
          return "\\ldots\\,";
        } else {
          return "\\ldots";
        }
      });
      defineMacro("\\cdots", function(context) {
        var next3 = context.future().text;
        if (next3 in spaceAfterDots) {
          return "\\@cdots\\,";
        } else {
          return "\\@cdots";
        }
      });
      defineMacro("\\dotsb", "\\cdots");
      defineMacro("\\dotsm", "\\cdots");
      defineMacro("\\dotsi", "\\!\\cdots");
      defineMacro("\\dotsx", "\\ldots\\,");
      defineMacro("\\DOTSI", "\\relax");
      defineMacro("\\DOTSB", "\\relax");
      defineMacro("\\DOTSX", "\\relax");
      defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");
      defineMacro("\\,", "\\tmspace+{3mu}{.1667em}");
      defineMacro("\\thinspace", "\\,");
      defineMacro("\\>", "\\mskip{4mu}");
      defineMacro("\\:", "\\tmspace+{4mu}{.2222em}");
      defineMacro("\\medspace", "\\:");
      defineMacro("\\;", "\\tmspace+{5mu}{.2777em}");
      defineMacro("\\thickspace", "\\;");
      defineMacro("\\!", "\\tmspace-{3mu}{.1667em}");
      defineMacro("\\negthinspace", "\\!");
      defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}");
      defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}");
      defineMacro("\\enspace", "\\kern.5em ");
      defineMacro("\\enskip", "\\hskip.5em\\relax");
      defineMacro("\\quad", "\\hskip1em\\relax");
      defineMacro("\\qquad", "\\hskip2em\\relax");
      defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren");
      defineMacro("\\tag@paren", "\\tag@literal{({#1})}");
      defineMacro("\\tag@literal", (context) => {
        if (context.macros.get("\\df@tag")) {
          throw new ParseError("Multiple \\tag");
        }
        return "\\gdef\\df@tag{\\text{#1}}";
      });
      defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");
      defineMacro("\\pod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");
      defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}");
      defineMacro("\\mod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");
      defineMacro("\\newline", "\\\\\\relax");
      defineMacro("\\TeX", "\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");
      latexRaiseA = makeEm(fontMetricsData["Main-Regular"]["T".charCodeAt(0)][1] - 0.7 * fontMetricsData["Main-Regular"]["A".charCodeAt(0)][1]);
      defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}");
      defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}");
      defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace");
      defineMacro("\\@hspace", "\\hskip #1\\relax");
      defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax");
      defineMacro("\\ordinarycolon", ":");
      defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}");
      defineMacro("\\dblcolon", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');
      defineMacro("\\coloneqq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');
      defineMacro("\\Coloneqq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');
      defineMacro("\\coloneq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');
      defineMacro("\\Coloneq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');
      defineMacro("\\eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');
      defineMacro("\\Eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');
      defineMacro("\\eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');
      defineMacro("\\Eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');
      defineMacro("\\colonapprox", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');
      defineMacro("\\Colonapprox", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');
      defineMacro("\\colonsim", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');
      defineMacro("\\Colonsim", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');
      defineMacro("\u2237", "\\dblcolon");
      defineMacro("\u2239", "\\eqcolon");
      defineMacro("\u2254", "\\coloneqq");
      defineMacro("\u2255", "\\eqqcolon");
      defineMacro("\u2A74", "\\Coloneqq");
      defineMacro("\\ratio", "\\vcentcolon");
      defineMacro("\\coloncolon", "\\dblcolon");
      defineMacro("\\colonequals", "\\coloneqq");
      defineMacro("\\coloncolonequals", "\\Coloneqq");
      defineMacro("\\equalscolon", "\\eqqcolon");
      defineMacro("\\equalscoloncolon", "\\Eqqcolon");
      defineMacro("\\colonminus", "\\coloneq");
      defineMacro("\\coloncolonminus", "\\Coloneq");
      defineMacro("\\minuscolon", "\\eqcolon");
      defineMacro("\\minuscoloncolon", "\\Eqcolon");
      defineMacro("\\coloncolonapprox", "\\Colonapprox");
      defineMacro("\\coloncolonsim", "\\Colonsim");
      defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
      defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");
      defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
      defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");
      defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");
      defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}");
      defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}");
      defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}");
      defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}");
      defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}");
      defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}");
      defineMacro("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}");
      defineMacro("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}");
      defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}");
      defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{\u2268}");
      defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{\u2271}");
      defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{\u2271}");
      defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{\u2270}");
      defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{\u2270}");
      defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{\u2224}");
      defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{\u2226}");
      defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{\u2288}");
      defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{\u2289}");
      defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{\u228A}");
      defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{\u2ACB}");
      defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{\u228B}");
      defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{\u2ACC}");
      defineMacro("\\imath", "\\html@mathml{\\@imath}{\u0131}");
      defineMacro("\\jmath", "\\html@mathml{\\@jmath}{\u0237}");
      defineMacro("\\llbracket", "\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27E6}}");
      defineMacro("\\rrbracket", "\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27E7}}");
      defineMacro("\u27E6", "\\llbracket");
      defineMacro("\u27E7", "\\rrbracket");
      defineMacro("\\lBrace", "\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}");
      defineMacro("\\rBrace", "\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}");
      defineMacro("\u2983", "\\lBrace");
      defineMacro("\u2984", "\\rBrace");
      defineMacro("\\minuso", "\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29B5}}");
      defineMacro("\u29B5", "\\minuso");
      defineMacro("\\darr", "\\downarrow");
      defineMacro("\\dArr", "\\Downarrow");
      defineMacro("\\Darr", "\\Downarrow");
      defineMacro("\\lang", "\\langle");
      defineMacro("\\rang", "\\rangle");
      defineMacro("\\uarr", "\\uparrow");
      defineMacro("\\uArr", "\\Uparrow");
      defineMacro("\\Uarr", "\\Uparrow");
      defineMacro("\\N", "\\mathbb{N}");
      defineMacro("\\R", "\\mathbb{R}");
      defineMacro("\\Z", "\\mathbb{Z}");
      defineMacro("\\alef", "\\aleph");
      defineMacro("\\alefsym", "\\aleph");
      defineMacro("\\Alpha", "\\mathrm{A}");
      defineMacro("\\Beta", "\\mathrm{B}");
      defineMacro("\\bull", "\\bullet");
      defineMacro("\\Chi", "\\mathrm{X}");
      defineMacro("\\clubs", "\\clubsuit");
      defineMacro("\\cnums", "\\mathbb{C}");
      defineMacro("\\Complex", "\\mathbb{C}");
      defineMacro("\\Dagger", "\\ddagger");
      defineMacro("\\diamonds", "\\diamondsuit");
      defineMacro("\\empty", "\\emptyset");
      defineMacro("\\Epsilon", "\\mathrm{E}");
      defineMacro("\\Eta", "\\mathrm{H}");
      defineMacro("\\exist", "\\exists");
      defineMacro("\\harr", "\\leftrightarrow");
      defineMacro("\\hArr", "\\Leftrightarrow");
      defineMacro("\\Harr", "\\Leftrightarrow");
      defineMacro("\\hearts", "\\heartsuit");
      defineMacro("\\image", "\\Im");
      defineMacro("\\infin", "\\infty");
      defineMacro("\\Iota", "\\mathrm{I}");
      defineMacro("\\isin", "\\in");
      defineMacro("\\Kappa", "\\mathrm{K}");
      defineMacro("\\larr", "\\leftarrow");
      defineMacro("\\lArr", "\\Leftarrow");
      defineMacro("\\Larr", "\\Leftarrow");
      defineMacro("\\lrarr", "\\leftrightarrow");
      defineMacro("\\lrArr", "\\Leftrightarrow");
      defineMacro("\\Lrarr", "\\Leftrightarrow");
      defineMacro("\\Mu", "\\mathrm{M}");
      defineMacro("\\natnums", "\\mathbb{N}");
      defineMacro("\\Nu", "\\mathrm{N}");
      defineMacro("\\Omicron", "\\mathrm{O}");
      defineMacro("\\plusmn", "\\pm");
      defineMacro("\\rarr", "\\rightarrow");
      defineMacro("\\rArr", "\\Rightarrow");
      defineMacro("\\Rarr", "\\Rightarrow");
      defineMacro("\\real", "\\Re");
      defineMacro("\\reals", "\\mathbb{R}");
      defineMacro("\\Reals", "\\mathbb{R}");
      defineMacro("\\Rho", "\\mathrm{P}");
      defineMacro("\\sdot", "\\cdot");
      defineMacro("\\sect", "\\S");
      defineMacro("\\spades", "\\spadesuit");
      defineMacro("\\sub", "\\subset");
      defineMacro("\\sube", "\\subseteq");
      defineMacro("\\supe", "\\supseteq");
      defineMacro("\\Tau", "\\mathrm{T}");
      defineMacro("\\thetasym", "\\vartheta");
      defineMacro("\\weierp", "\\wp");
      defineMacro("\\Zeta", "\\mathrm{Z}");
      defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}");
      defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}");
      defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits");
      defineMacro("\\bra", "\\mathinner{\\langle{#1}|}");
      defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}");
      defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}");
      defineMacro("\\Bra", "\\left\\langle#1\\right|");
      defineMacro("\\Ket", "\\left|#1\\right\\rangle");
      braketHelper = /* @__PURE__ */ __name((one4) => (context) => {
        var left3 = context.consumeArg().tokens;
        var middle = context.consumeArg().tokens;
        var middleDouble = context.consumeArg().tokens;
        var right3 = context.consumeArg().tokens;
        var oldMiddle = context.macros.get("|");
        var oldMiddleDouble = context.macros.get("\\|");
        context.macros.beginGroup();
        var midMacro = /* @__PURE__ */ __name((double) => (context2) => {
          if (one4) {
            context2.macros.set("|", oldMiddle);
            if (middleDouble.length) {
              context2.macros.set("\\|", oldMiddleDouble);
            }
          }
          var doubled = double;
          if (!double && middleDouble.length) {
            var nextToken = context2.future();
            if (nextToken.text === "|") {
              context2.popToken();
              doubled = true;
            }
          }
          return {
            tokens: doubled ? middleDouble : middle,
            numArgs: 0
          };
        }, "midMacro");
        context.macros.set("|", midMacro(false));
        if (middleDouble.length) {
          context.macros.set("\\|", midMacro(true));
        }
        var arg = context.consumeArg().tokens;
        var expanded = context.expandTokens([
          ...right3,
          ...arg,
          ...left3
          // reversed
        ]);
        context.macros.endGroup();
        return {
          tokens: expanded.reverse(),
          numArgs: 0
        };
      }, "braketHelper");
      defineMacro("\\bra@ket", braketHelper(false));
      defineMacro("\\bra@set", braketHelper(true));
      defineMacro("\\Braket", "\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");
      defineMacro("\\Set", "\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");
      defineMacro("\\set", "\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");
      defineMacro("\\angln", "{\\angl n}");
      defineMacro("\\blue", "\\textcolor{##6495ed}{#1}");
      defineMacro("\\orange", "\\textcolor{##ffa500}{#1}");
      defineMacro("\\pink", "\\textcolor{##ff00af}{#1}");
      defineMacro("\\red", "\\textcolor{##df0030}{#1}");
      defineMacro("\\green", "\\textcolor{##28ae7b}{#1}");
      defineMacro("\\gray", "\\textcolor{gray}{#1}");
      defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}");
      defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}");
      defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}");
      defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}");
      defineMacro("\\blueD", "\\textcolor{##11accd}{#1}");
      defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}");
      defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}");
      defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}");
      defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}");
      defineMacro("\\tealD", "\\textcolor{##01a995}{#1}");
      defineMacro("\\tealE", "\\textcolor{##208170}{#1}");
      defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}");
      defineMacro("\\greenB", "\\textcolor{##8af281}{#1}");
      defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}");
      defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}");
      defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}");
      defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}");
      defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}");
      defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}");
      defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}");
      defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}");
      defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}");
      defineMacro("\\redB", "\\textcolor{##ff8482}{#1}");
      defineMacro("\\redC", "\\textcolor{##f9685d}{#1}");
      defineMacro("\\redD", "\\textcolor{##e84d39}{#1}");
      defineMacro("\\redE", "\\textcolor{##bc2612}{#1}");
      defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}");
      defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}");
      defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}");
      defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}");
      defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}");
      defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}");
      defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}");
      defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}");
      defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}");
      defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}");
      defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}");
      defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}");
      defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}");
      defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}");
      defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}");
      defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}");
      defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}");
      defineMacro("\\grayE", "\\textcolor{##babec2}{#1}");
      defineMacro("\\grayF", "\\textcolor{##888d93}{#1}");
      defineMacro("\\grayG", "\\textcolor{##626569}{#1}");
      defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}");
      defineMacro("\\grayI", "\\textcolor{##21242c}{#1}");
      defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}");
      defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}");
      implicitCommands = {
        "^": true,
        // Parser.js
        "_": true,
        // Parser.js
        "\\limits": true,
        // Parser.js
        "\\nolimits": true
        // Parser.js
      };
      MacroExpander = class {
        static {
          __name(this, "MacroExpander");
        }
        constructor(input, settings, mode) {
          this.settings = void 0;
          this.expansionCount = void 0;
          this.lexer = void 0;
          this.macros = void 0;
          this.stack = void 0;
          this.mode = void 0;
          this.settings = settings;
          this.expansionCount = 0;
          this.feed(input);
          this.macros = new Namespace(macros, settings.macros);
          this.mode = mode;
          this.stack = [];
        }
        /**
         * Feed a new input string to the same MacroExpander
         * (with existing macros etc.).
         */
        feed(input) {
          this.lexer = new Lexer(input, this.settings);
        }
        /**
         * Switches between "text" and "math" modes.
         */
        switchMode(newMode) {
          this.mode = newMode;
        }
        /**
         * Start a new group nesting within all namespaces.
         */
        beginGroup() {
          this.macros.beginGroup();
        }
        /**
         * End current group nesting within all namespaces.
         */
        endGroup() {
          this.macros.endGroup();
        }
        /**
         * Ends all currently nested groups (if any), restoring values before the
         * groups began.  Useful in case of an error in the middle of parsing.
         */
        endGroups() {
          this.macros.endGroups();
        }
        /**
         * Returns the topmost token on the stack, without expanding it.
         * Similar in behavior to TeX's `\futurelet`.
         */
        future() {
          if (this.stack.length === 0) {
            this.pushToken(this.lexer.lex());
          }
          return this.stack[this.stack.length - 1];
        }
        /**
         * Remove and return the next unexpanded token.
         */
        popToken() {
          this.future();
          return this.stack.pop();
        }
        /**
         * Add a given token to the token stack.  In particular, this get be used
         * to put back a token returned from one of the other methods.
         */
        pushToken(token2) {
          this.stack.push(token2);
        }
        /**
         * Append an array of tokens to the token stack.
         */
        pushTokens(tokens2) {
          this.stack.push(...tokens2);
        }
        /**
         * Find an macro argument without expanding tokens and append the array of
         * tokens to the token stack. Uses Token as a container for the result.
         */
        scanArgument(isOptional) {
          var start3;
          var end2;
          var tokens2;
          if (isOptional) {
            this.consumeSpaces();
            if (this.future().text !== "[") {
              return null;
            }
            start3 = this.popToken();
            ({
              tokens: tokens2,
              end: end2
            } = this.consumeArg(["]"]));
          } else {
            ({
              tokens: tokens2,
              start: start3,
              end: end2
            } = this.consumeArg());
          }
          this.pushToken(new Token("EOF", end2.loc));
          this.pushTokens(tokens2);
          return new Token("", SourceLocation.range(start3, end2));
        }
        /**
         * Consume all following space tokens, without expansion.
         */
        consumeSpaces() {
          for (; ; ) {
            var token2 = this.future();
            if (token2.text === " ") {
              this.stack.pop();
            } else {
              break;
            }
          }
        }
        /**
         * Consume an argument from the token stream, and return the resulting array
         * of tokens and start/end token.
         */
        consumeArg(delims) {
          var tokens2 = [];
          var isDelimited = delims && delims.length > 0;
          if (!isDelimited) {
            this.consumeSpaces();
          }
          var start3 = this.future();
          var tok;
          var depth = 0;
          var match2 = 0;
          do {
            tok = this.popToken();
            tokens2.push(tok);
            if (tok.text === "{") {
              ++depth;
            } else if (tok.text === "}") {
              --depth;
              if (depth === -1) {
                throw new ParseError("Extra }", tok);
              }
            } else if (tok.text === "EOF") {
              throw new ParseError("Unexpected end of input in a macro argument, expected '" + (delims && isDelimited ? delims[match2] : "}") + "'", tok);
            }
            if (delims && isDelimited) {
              if ((depth === 0 || depth === 1 && delims[match2] === "{") && tok.text === delims[match2]) {
                ++match2;
                if (match2 === delims.length) {
                  tokens2.splice(-match2, match2);
                  break;
                }
              } else {
                match2 = 0;
              }
            }
          } while (depth !== 0 || isDelimited);
          if (start3.text === "{" && tokens2[tokens2.length - 1].text === "}") {
            tokens2.pop();
            tokens2.shift();
          }
          tokens2.reverse();
          return {
            tokens: tokens2,
            start: start3,
            end: tok
          };
        }
        /**
         * Consume the specified number of (delimited) arguments from the token
         * stream and return the resulting array of arguments.
         */
        consumeArgs(numArgs, delimiters2) {
          if (delimiters2) {
            if (delimiters2.length !== numArgs + 1) {
              throw new ParseError("The length of delimiters doesn't match the number of args!");
            }
            var delims = delimiters2[0];
            for (var i2 = 0; i2 < delims.length; i2++) {
              var tok = this.popToken();
              if (delims[i2] !== tok.text) {
                throw new ParseError("Use of the macro doesn't match its definition", tok);
              }
            }
          }
          var args = [];
          for (var _i = 0; _i < numArgs; _i++) {
            args.push(this.consumeArg(delimiters2 && delimiters2[_i + 1]).tokens);
          }
          return args;
        }
        /**
         * Increment `expansionCount` by the specified amount.
         * Throw an error if it exceeds `maxExpand`.
         */
        countExpansion(amount) {
          this.expansionCount += amount;
          if (this.expansionCount > this.settings.maxExpand) {
            throw new ParseError("Too many expansions: infinite loop or need to increase maxExpand setting");
          }
        }
        /**
         * Expand the next token only once if possible.
         *
         * If the token is expanded, the resulting tokens will be pushed onto
         * the stack in reverse order, and the number of such tokens will be
         * returned.  This number might be zero or positive.
         *
         * If not, the return value is `false`, and the next token remains at the
         * top of the stack.
         *
         * In either case, the next token will be on the top of the stack,
         * or the stack will be empty (in case of empty expansion
         * and no other tokens).
         *
         * Used to implement `expandAfterFuture` and `expandNextToken`.
         *
         * If expandableOnly, only expandable tokens are expanded and
         * an undefined control sequence results in an error.
         */
        expandOnce(expandableOnly) {
          var topToken = this.popToken();
          var name = topToken.text;
          var expansion = !topToken.noexpand ? this._getExpansion(name) : null;
          if (expansion == null || expandableOnly && expansion.unexpandable) {
            if (expandableOnly && expansion == null && name[0] === "\\" && !this.isDefined(name)) {
              throw new ParseError("Undefined control sequence: " + name);
            }
            this.pushToken(topToken);
            return false;
          }
          this.countExpansion(1);
          var tokens2 = expansion.tokens;
          var args = this.consumeArgs(expansion.numArgs, expansion.delimiters);
          if (expansion.numArgs) {
            tokens2 = tokens2.slice();
            for (var i2 = tokens2.length - 1; i2 >= 0; --i2) {
              var tok = tokens2[i2];
              if (tok.text === "#") {
                if (i2 === 0) {
                  throw new ParseError("Incomplete placeholder at end of macro body", tok);
                }
                tok = tokens2[--i2];
                if (tok.text === "#") {
                  tokens2.splice(i2 + 1, 1);
                } else if (/^[1-9]$/.test(tok.text)) {
                  tokens2.splice(i2, 2, ...args[+tok.text - 1]);
                } else {
                  throw new ParseError("Not a valid argument number", tok);
                }
              }
            }
          }
          this.pushTokens(tokens2);
          return tokens2.length;
        }
        /**
         * Expand the next token only once (if possible), and return the resulting
         * top token on the stack (without removing anything from the stack).
         * Similar in behavior to TeX's `\expandafter\futurelet`.
         * Equivalent to expandOnce() followed by future().
         */
        expandAfterFuture() {
          this.expandOnce();
          return this.future();
        }
        /**
         * Recursively expand first token, then return first non-expandable token.
         */
        expandNextToken() {
          for (; ; ) {
            if (this.expandOnce() === false) {
              var token2 = this.stack.pop();
              if (token2.treatAsRelax) {
                token2.text = "\\relax";
              }
              return token2;
            }
          }
          throw new Error();
        }
        /**
         * Fully expand the given macro name and return the resulting list of
         * tokens, or return `undefined` if no such macro is defined.
         */
        expandMacro(name) {
          return this.macros.has(name) ? this.expandTokens([new Token(name)]) : void 0;
        }
        /**
         * Fully expand the given token stream and return the resulting list of
         * tokens.  Note that the input tokens are in reverse order, but the
         * output tokens are in forward order.
         */
        expandTokens(tokens2) {
          var output2 = [];
          var oldStackLength = this.stack.length;
          this.pushTokens(tokens2);
          while (this.stack.length > oldStackLength) {
            if (this.expandOnce(true) === false) {
              var token2 = this.stack.pop();
              if (token2.treatAsRelax) {
                token2.noexpand = false;
                token2.treatAsRelax = false;
              }
              output2.push(token2);
            }
          }
          this.countExpansion(output2.length);
          return output2;
        }
        /**
         * Fully expand the given macro name and return the result as a string,
         * or return `undefined` if no such macro is defined.
         */
        expandMacroAsText(name) {
          var tokens2 = this.expandMacro(name);
          if (tokens2) {
            return tokens2.map((token2) => token2.text).join("");
          } else {
            return tokens2;
          }
        }
        /**
         * Returns the expanded macro as a reversed array of tokens and a macro
         * argument count.  Or returns `null` if no such macro.
         */
        _getExpansion(name) {
          var definition = this.macros.get(name);
          if (definition == null) {
            return definition;
          }
          if (name.length === 1) {
            var catcode = this.lexer.catcodes[name];
            if (catcode != null && catcode !== 13) {
              return;
            }
          }
          var expansion = typeof definition === "function" ? definition(this) : definition;
          if (typeof expansion === "string") {
            var numArgs = 0;
            if (expansion.indexOf("#") !== -1) {
              var stripped = expansion.replace(/##/g, "");
              while (stripped.indexOf("#" + (numArgs + 1)) !== -1) {
                ++numArgs;
              }
            }
            var bodyLexer = new Lexer(expansion, this.settings);
            var tokens2 = [];
            var tok = bodyLexer.lex();
            while (tok.text !== "EOF") {
              tokens2.push(tok);
              tok = bodyLexer.lex();
            }
            tokens2.reverse();
            var expanded = {
              tokens: tokens2,
              numArgs
            };
            return expanded;
          }
          return expansion;
        }
        /**
         * Determine whether a command is currently "defined" (has some
         * functionality), meaning that it's a macro (in the current group),
         * a function, a symbol, or one of the special commands listed in
         * `implicitCommands`.
         */
        isDefined(name) {
          return this.macros.has(name) || functions.hasOwnProperty(name) || symbols.math.hasOwnProperty(name) || symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name);
        }
        /**
         * Determine whether a command is expandable.
         */
        isExpandable(name) {
          var macro = this.macros.get(name);
          return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable : functions.hasOwnProperty(name) && !functions[name].primitive;
        }
      };
      unicodeSubRegEx = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/;
      uSubsAndSups = Object.freeze({
        "\u208A": "+",
        "\u208B": "-",
        "\u208C": "=",
        "\u208D": "(",
        "\u208E": ")",
        "\u2080": "0",
        "\u2081": "1",
        "\u2082": "2",
        "\u2083": "3",
        "\u2084": "4",
        "\u2085": "5",
        "\u2086": "6",
        "\u2087": "7",
        "\u2088": "8",
        "\u2089": "9",
        "\u2090": "a",
        "\u2091": "e",
        "\u2095": "h",
        "\u1D62": "i",
        "\u2C7C": "j",
        "\u2096": "k",
        "\u2097": "l",
        "\u2098": "m",
        "\u2099": "n",
        "\u2092": "o",
        "\u209A": "p",
        "\u1D63": "r",
        "\u209B": "s",
        "\u209C": "t",
        "\u1D64": "u",
        "\u1D65": "v",
        "\u2093": "x",
        "\u1D66": "\u03B2",
        "\u1D67": "\u03B3",
        "\u1D68": "\u03C1",
        "\u1D69": "\u03D5",
        "\u1D6A": "\u03C7",
        "\u207A": "+",
        "\u207B": "-",
        "\u207C": "=",
        "\u207D": "(",
        "\u207E": ")",
        "\u2070": "0",
        "\xB9": "1",
        "\xB2": "2",
        "\xB3": "3",
        "\u2074": "4",
        "\u2075": "5",
        "\u2076": "6",
        "\u2077": "7",
        "\u2078": "8",
        "\u2079": "9",
        "\u1D2C": "A",
        "\u1D2E": "B",
        "\u1D30": "D",
        "\u1D31": "E",
        "\u1D33": "G",
        "\u1D34": "H",
        "\u1D35": "I",
        "\u1D36": "J",
        "\u1D37": "K",
        "\u1D38": "L",
        "\u1D39": "M",
        "\u1D3A": "N",
        "\u1D3C": "O",
        "\u1D3E": "P",
        "\u1D3F": "R",
        "\u1D40": "T",
        "\u1D41": "U",
        "\u2C7D": "V",
        "\u1D42": "W",
        "\u1D43": "a",
        "\u1D47": "b",
        "\u1D9C": "c",
        "\u1D48": "d",
        "\u1D49": "e",
        "\u1DA0": "f",
        "\u1D4D": "g",
        "\u02B0": "h",
        "\u2071": "i",
        "\u02B2": "j",
        "\u1D4F": "k",
        "\u02E1": "l",
        "\u1D50": "m",
        "\u207F": "n",
        "\u1D52": "o",
        "\u1D56": "p",
        "\u02B3": "r",
        "\u02E2": "s",
        "\u1D57": "t",
        "\u1D58": "u",
        "\u1D5B": "v",
        "\u02B7": "w",
        "\u02E3": "x",
        "\u02B8": "y",
        "\u1DBB": "z",
        "\u1D5D": "\u03B2",
        "\u1D5E": "\u03B3",
        "\u1D5F": "\u03B4",
        "\u1D60": "\u03D5",
        "\u1D61": "\u03C7",
        "\u1DBF": "\u03B8"
      });
      unicodeAccents = {
        "\u0301": {
          "text": "\\'",
          "math": "\\acute"
        },
        "\u0300": {
          "text": "\\`",
          "math": "\\grave"
        },
        "\u0308": {
          "text": '\\"',
          "math": "\\ddot"
        },
        "\u0303": {
          "text": "\\~",
          "math": "\\tilde"
        },
        "\u0304": {
          "text": "\\=",
          "math": "\\bar"
        },
        "\u0306": {
          "text": "\\u",
          "math": "\\breve"
        },
        "\u030C": {
          "text": "\\v",
          "math": "\\check"
        },
        "\u0302": {
          "text": "\\^",
          "math": "\\hat"
        },
        "\u0307": {
          "text": "\\.",
          "math": "\\dot"
        },
        "\u030A": {
          "text": "\\r",
          "math": "\\mathring"
        },
        "\u030B": {
          "text": "\\H"
        },
        "\u0327": {
          "text": "\\c"
        }
      };
      unicodeSymbols = {
        "\xE1": "a\u0301",
        "\xE0": "a\u0300",
        "\xE4": "a\u0308",
        "\u01DF": "a\u0308\u0304",
        "\xE3": "a\u0303",
        "\u0101": "a\u0304",
        "\u0103": "a\u0306",
        "\u1EAF": "a\u0306\u0301",
        "\u1EB1": "a\u0306\u0300",
        "\u1EB5": "a\u0306\u0303",
        "\u01CE": "a\u030C",
        "\xE2": "a\u0302",
        "\u1EA5": "a\u0302\u0301",
        "\u1EA7": "a\u0302\u0300",
        "\u1EAB": "a\u0302\u0303",
        "\u0227": "a\u0307",
        "\u01E1": "a\u0307\u0304",
        "\xE5": "a\u030A",
        "\u01FB": "a\u030A\u0301",
        "\u1E03": "b\u0307",
        "\u0107": "c\u0301",
        "\u1E09": "c\u0327\u0301",
        "\u010D": "c\u030C",
        "\u0109": "c\u0302",
        "\u010B": "c\u0307",
        "\xE7": "c\u0327",
        "\u010F": "d\u030C",
        "\u1E0B": "d\u0307",
        "\u1E11": "d\u0327",
        "\xE9": "e\u0301",
        "\xE8": "e\u0300",
        "\xEB": "e\u0308",
        "\u1EBD": "e\u0303",
        "\u0113": "e\u0304",
        "\u1E17": "e\u0304\u0301",
        "\u1E15": "e\u0304\u0300",
        "\u0115": "e\u0306",
        "\u1E1D": "e\u0327\u0306",
        "\u011B": "e\u030C",
        "\xEA": "e\u0302",
        "\u1EBF": "e\u0302\u0301",
        "\u1EC1": "e\u0302\u0300",
        "\u1EC5": "e\u0302\u0303",
        "\u0117": "e\u0307",
        "\u0229": "e\u0327",
        "\u1E1F": "f\u0307",
        "\u01F5": "g\u0301",
        "\u1E21": "g\u0304",
        "\u011F": "g\u0306",
        "\u01E7": "g\u030C",
        "\u011D": "g\u0302",
        "\u0121": "g\u0307",
        "\u0123": "g\u0327",
        "\u1E27": "h\u0308",
        "\u021F": "h\u030C",
        "\u0125": "h\u0302",
        "\u1E23": "h\u0307",
        "\u1E29": "h\u0327",
        "\xED": "i\u0301",
        "\xEC": "i\u0300",
        "\xEF": "i\u0308",
        "\u1E2F": "i\u0308\u0301",
        "\u0129": "i\u0303",
        "\u012B": "i\u0304",
        "\u012D": "i\u0306",
        "\u01D0": "i\u030C",
        "\xEE": "i\u0302",
        "\u01F0": "j\u030C",
        "\u0135": "j\u0302",
        "\u1E31": "k\u0301",
        "\u01E9": "k\u030C",
        "\u0137": "k\u0327",
        "\u013A": "l\u0301",
        "\u013E": "l\u030C",
        "\u013C": "l\u0327",
        "\u1E3F": "m\u0301",
        "\u1E41": "m\u0307",
        "\u0144": "n\u0301",
        "\u01F9": "n\u0300",
        "\xF1": "n\u0303",
        "\u0148": "n\u030C",
        "\u1E45": "n\u0307",
        "\u0146": "n\u0327",
        "\xF3": "o\u0301",
        "\xF2": "o\u0300",
        "\xF6": "o\u0308",
        "\u022B": "o\u0308\u0304",
        "\xF5": "o\u0303",
        "\u1E4D": "o\u0303\u0301",
        "\u1E4F": "o\u0303\u0308",
        "\u022D": "o\u0303\u0304",
        "\u014D": "o\u0304",
        "\u1E53": "o\u0304\u0301",
        "\u1E51": "o\u0304\u0300",
        "\u014F": "o\u0306",
        "\u01D2": "o\u030C",
        "\xF4": "o\u0302",
        "\u1ED1": "o\u0302\u0301",
        "\u1ED3": "o\u0302\u0300",
        "\u1ED7": "o\u0302\u0303",
        "\u022F": "o\u0307",
        "\u0231": "o\u0307\u0304",
        "\u0151": "o\u030B",
        "\u1E55": "p\u0301",
        "\u1E57": "p\u0307",
        "\u0155": "r\u0301",
        "\u0159": "r\u030C",
        "\u1E59": "r\u0307",
        "\u0157": "r\u0327",
        "\u015B": "s\u0301",
        "\u1E65": "s\u0301\u0307",
        "\u0161": "s\u030C",
        "\u1E67": "s\u030C\u0307",
        "\u015D": "s\u0302",
        "\u1E61": "s\u0307",
        "\u015F": "s\u0327",
        "\u1E97": "t\u0308",
        "\u0165": "t\u030C",
        "\u1E6B": "t\u0307",
        "\u0163": "t\u0327",
        "\xFA": "u\u0301",
        "\xF9": "u\u0300",
        "\xFC": "u\u0308",
        "\u01D8": "u\u0308\u0301",
        "\u01DC": "u\u0308\u0300",
        "\u01D6": "u\u0308\u0304",
        "\u01DA": "u\u0308\u030C",
        "\u0169": "u\u0303",
        "\u1E79": "u\u0303\u0301",
        "\u016B": "u\u0304",
        "\u1E7B": "u\u0304\u0308",
        "\u016D": "u\u0306",
        "\u01D4": "u\u030C",
        "\xFB": "u\u0302",
        "\u016F": "u\u030A",
        "\u0171": "u\u030B",
        "\u1E7D": "v\u0303",
        "\u1E83": "w\u0301",
        "\u1E81": "w\u0300",
        "\u1E85": "w\u0308",
        "\u0175": "w\u0302",
        "\u1E87": "w\u0307",
        "\u1E98": "w\u030A",
        "\u1E8D": "x\u0308",
        "\u1E8B": "x\u0307",
        "\xFD": "y\u0301",
        "\u1EF3": "y\u0300",
        "\xFF": "y\u0308",
        "\u1EF9": "y\u0303",
        "\u0233": "y\u0304",
        "\u0177": "y\u0302",
        "\u1E8F": "y\u0307",
        "\u1E99": "y\u030A",
        "\u017A": "z\u0301",
        "\u017E": "z\u030C",
        "\u1E91": "z\u0302",
        "\u017C": "z\u0307",
        "\xC1": "A\u0301",
        "\xC0": "A\u0300",
        "\xC4": "A\u0308",
        "\u01DE": "A\u0308\u0304",
        "\xC3": "A\u0303",
        "\u0100": "A\u0304",
        "\u0102": "A\u0306",
        "\u1EAE": "A\u0306\u0301",
        "\u1EB0": "A\u0306\u0300",
        "\u1EB4": "A\u0306\u0303",
        "\u01CD": "A\u030C",
        "\xC2": "A\u0302",
        "\u1EA4": "A\u0302\u0301",
        "\u1EA6": "A\u0302\u0300",
        "\u1EAA": "A\u0302\u0303",
        "\u0226": "A\u0307",
        "\u01E0": "A\u0307\u0304",
        "\xC5": "A\u030A",
        "\u01FA": "A\u030A\u0301",
        "\u1E02": "B\u0307",
        "\u0106": "C\u0301",
        "\u1E08": "C\u0327\u0301",
        "\u010C": "C\u030C",
        "\u0108": "C\u0302",
        "\u010A": "C\u0307",
        "\xC7": "C\u0327",
        "\u010E": "D\u030C",
        "\u1E0A": "D\u0307",
        "\u1E10": "D\u0327",
        "\xC9": "E\u0301",
        "\xC8": "E\u0300",
        "\xCB": "E\u0308",
        "\u1EBC": "E\u0303",
        "\u0112": "E\u0304",
        "\u1E16": "E\u0304\u0301",
        "\u1E14": "E\u0304\u0300",
        "\u0114": "E\u0306",
        "\u1E1C": "E\u0327\u0306",
        "\u011A": "E\u030C",
        "\xCA": "E\u0302",
        "\u1EBE": "E\u0302\u0301",
        "\u1EC0": "E\u0302\u0300",
        "\u1EC4": "E\u0302\u0303",
        "\u0116": "E\u0307",
        "\u0228": "E\u0327",
        "\u1E1E": "F\u0307",
        "\u01F4": "G\u0301",
        "\u1E20": "G\u0304",
        "\u011E": "G\u0306",
        "\u01E6": "G\u030C",
        "\u011C": "G\u0302",
        "\u0120": "G\u0307",
        "\u0122": "G\u0327",
        "\u1E26": "H\u0308",
        "\u021E": "H\u030C",
        "\u0124": "H\u0302",
        "\u1E22": "H\u0307",
        "\u1E28": "H\u0327",
        "\xCD": "I\u0301",
        "\xCC": "I\u0300",
        "\xCF": "I\u0308",
        "\u1E2E": "I\u0308\u0301",
        "\u0128": "I\u0303",
        "\u012A": "I\u0304",
        "\u012C": "I\u0306",
        "\u01CF": "I\u030C",
        "\xCE": "I\u0302",
        "\u0130": "I\u0307",
        "\u0134": "J\u0302",
        "\u1E30": "K\u0301",
        "\u01E8": "K\u030C",
        "\u0136": "K\u0327",
        "\u0139": "L\u0301",
        "\u013D": "L\u030C",
        "\u013B": "L\u0327",
        "\u1E3E": "M\u0301",
        "\u1E40": "M\u0307",
        "\u0143": "N\u0301",
        "\u01F8": "N\u0300",
        "\xD1": "N\u0303",
        "\u0147": "N\u030C",
        "\u1E44": "N\u0307",
        "\u0145": "N\u0327",
        "\xD3": "O\u0301",
        "\xD2": "O\u0300",
        "\xD6": "O\u0308",
        "\u022A": "O\u0308\u0304",
        "\xD5": "O\u0303",
        "\u1E4C": "O\u0303\u0301",
        "\u1E4E": "O\u0303\u0308",
        "\u022C": "O\u0303\u0304",
        "\u014C": "O\u0304",
        "\u1E52": "O\u0304\u0301",
        "\u1E50": "O\u0304\u0300",
        "\u014E": "O\u0306",
        "\u01D1": "O\u030C",
        "\xD4": "O\u0302",
        "\u1ED0": "O\u0302\u0301",
        "\u1ED2": "O\u0302\u0300",
        "\u1ED6": "O\u0302\u0303",
        "\u022E": "O\u0307",
        "\u0230": "O\u0307\u0304",
        "\u0150": "O\u030B",
        "\u1E54": "P\u0301",
        "\u1E56": "P\u0307",
        "\u0154": "R\u0301",
        "\u0158": "R\u030C",
        "\u1E58": "R\u0307",
        "\u0156": "R\u0327",
        "\u015A": "S\u0301",
        "\u1E64": "S\u0301\u0307",
        "\u0160": "S\u030C",
        "\u1E66": "S\u030C\u0307",
        "\u015C": "S\u0302",
        "\u1E60": "S\u0307",
        "\u015E": "S\u0327",
        "\u0164": "T\u030C",
        "\u1E6A": "T\u0307",
        "\u0162": "T\u0327",
        "\xDA": "U\u0301",
        "\xD9": "U\u0300",
        "\xDC": "U\u0308",
        "\u01D7": "U\u0308\u0301",
        "\u01DB": "U\u0308\u0300",
        "\u01D5": "U\u0308\u0304",
        "\u01D9": "U\u0308\u030C",
        "\u0168": "U\u0303",
        "\u1E78": "U\u0303\u0301",
        "\u016A": "U\u0304",
        "\u1E7A": "U\u0304\u0308",
        "\u016C": "U\u0306",
        "\u01D3": "U\u030C",
        "\xDB": "U\u0302",
        "\u016E": "U\u030A",
        "\u0170": "U\u030B",
        "\u1E7C": "V\u0303",
        "\u1E82": "W\u0301",
        "\u1E80": "W\u0300",
        "\u1E84": "W\u0308",
        "\u0174": "W\u0302",
        "\u1E86": "W\u0307",
        "\u1E8C": "X\u0308",
        "\u1E8A": "X\u0307",
        "\xDD": "Y\u0301",
        "\u1EF2": "Y\u0300",
        "\u0178": "Y\u0308",
        "\u1EF8": "Y\u0303",
        "\u0232": "Y\u0304",
        "\u0176": "Y\u0302",
        "\u1E8E": "Y\u0307",
        "\u0179": "Z\u0301",
        "\u017D": "Z\u030C",
        "\u1E90": "Z\u0302",
        "\u017B": "Z\u0307",
        "\u03AC": "\u03B1\u0301",
        "\u1F70": "\u03B1\u0300",
        "\u1FB1": "\u03B1\u0304",
        "\u1FB0": "\u03B1\u0306",
        "\u03AD": "\u03B5\u0301",
        "\u1F72": "\u03B5\u0300",
        "\u03AE": "\u03B7\u0301",
        "\u1F74": "\u03B7\u0300",
        "\u03AF": "\u03B9\u0301",
        "\u1F76": "\u03B9\u0300",
        "\u03CA": "\u03B9\u0308",
        "\u0390": "\u03B9\u0308\u0301",
        "\u1FD2": "\u03B9\u0308\u0300",
        "\u1FD1": "\u03B9\u0304",
        "\u1FD0": "\u03B9\u0306",
        "\u03CC": "\u03BF\u0301",
        "\u1F78": "\u03BF\u0300",
        "\u03CD": "\u03C5\u0301",
        "\u1F7A": "\u03C5\u0300",
        "\u03CB": "\u03C5\u0308",
        "\u03B0": "\u03C5\u0308\u0301",
        "\u1FE2": "\u03C5\u0308\u0300",
        "\u1FE1": "\u03C5\u0304",
        "\u1FE0": "\u03C5\u0306",
        "\u03CE": "\u03C9\u0301",
        "\u1F7C": "\u03C9\u0300",
        "\u038E": "\u03A5\u0301",
        "\u1FEA": "\u03A5\u0300",
        "\u03AB": "\u03A5\u0308",
        "\u1FE9": "\u03A5\u0304",
        "\u1FE8": "\u03A5\u0306",
        "\u038F": "\u03A9\u0301",
        "\u1FFA": "\u03A9\u0300"
      };
      Parser = class _Parser {
        static {
          __name(this, "Parser");
        }
        constructor(input, settings) {
          this.mode = void 0;
          this.gullet = void 0;
          this.settings = void 0;
          this.leftrightDepth = void 0;
          this.nextToken = void 0;
          this.mode = "math";
          this.gullet = new MacroExpander(input, settings, this.mode);
          this.settings = settings;
          this.leftrightDepth = 0;
        }
        /**
         * Checks a result to make sure it has the right type, and throws an
         * appropriate error otherwise.
         */
        expect(text4, consume) {
          if (consume === void 0) {
            consume = true;
          }
          if (this.fetch().text !== text4) {
            throw new ParseError("Expected '" + text4 + "', got '" + this.fetch().text + "'", this.fetch());
          }
          if (consume) {
            this.consume();
          }
        }
        /**
         * Discards the current lookahead token, considering it consumed.
         */
        consume() {
          this.nextToken = null;
        }
        /**
         * Return the current lookahead token, or if there isn't one (at the
         * beginning, or if the previous lookahead token was consume()d),
         * fetch the next token as the new lookahead token and return it.
         */
        fetch() {
          if (this.nextToken == null) {
            this.nextToken = this.gullet.expandNextToken();
          }
          return this.nextToken;
        }
        /**
         * Switches between "text" and "math" modes.
         */
        switchMode(newMode) {
          this.mode = newMode;
          this.gullet.switchMode(newMode);
        }
        /**
         * Main parsing function, which parses an entire input.
         */
        parse() {
          if (!this.settings.globalGroup) {
            this.gullet.beginGroup();
          }
          if (this.settings.colorIsTextColor) {
            this.gullet.macros.set("\\color", "\\textcolor");
          }
          try {
            var parse7 = this.parseExpression(false);
            this.expect("EOF");
            if (!this.settings.globalGroup) {
              this.gullet.endGroup();
            }
            return parse7;
          } finally {
            this.gullet.endGroups();
          }
        }
        /**
         * Fully parse a separate sequence of tokens as a separate job.
         * Tokens should be specified in reverse order, as in a MacroDefinition.
         */
        subparse(tokens2) {
          var oldToken = this.nextToken;
          this.consume();
          this.gullet.pushToken(new Token("}"));
          this.gullet.pushTokens(tokens2);
          var parse7 = this.parseExpression(false);
          this.expect("}");
          this.nextToken = oldToken;
          return parse7;
        }
        /**
         * Parses an "expression", which is a list of atoms.
         *
         * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This
         *                 happens when functions have higher precedence han infix
         *                 nodes in implicit parses.
         *
         * `breakOnTokenText`: The text of the token that the expression should end
         *                     with, or `null` if something else should end the
         *                     expression.
         */
        parseExpression(breakOnInfix, breakOnTokenText) {
          var body = [];
          while (true) {
            if (this.mode === "math") {
              this.consumeSpaces();
            }
            var lex = this.fetch();
            if (_Parser.endOfExpression.indexOf(lex.text) !== -1) {
              break;
            }
            if (breakOnTokenText && lex.text === breakOnTokenText) {
              break;
            }
            if (breakOnInfix && functions[lex.text] && functions[lex.text].infix) {
              break;
            }
            var atom2 = this.parseAtom(breakOnTokenText);
            if (!atom2) {
              break;
            } else if (atom2.type === "internal") {
              continue;
            }
            body.push(atom2);
          }
          if (this.mode === "text") {
            this.formLigatures(body);
          }
          return this.handleInfixNodes(body);
        }
        /**
         * Rewrites infix operators such as \over with corresponding commands such
         * as \frac.
         *
         * There can only be one infix operator per group.  If there's more than one
         * then the expression is ambiguous.  This can be resolved by adding {}.
         */
        handleInfixNodes(body) {
          var overIndex = -1;
          var funcName;
          for (var i2 = 0; i2 < body.length; i2++) {
            if (body[i2].type === "infix") {
              if (overIndex !== -1) {
                throw new ParseError("only one infix operator per group", body[i2].token);
              }
              overIndex = i2;
              funcName = body[i2].replaceWith;
            }
          }
          if (overIndex !== -1 && funcName) {
            var numerNode;
            var denomNode;
            var numerBody = body.slice(0, overIndex);
            var denomBody = body.slice(overIndex + 1);
            if (numerBody.length === 1 && numerBody[0].type === "ordgroup") {
              numerNode = numerBody[0];
            } else {
              numerNode = {
                type: "ordgroup",
                mode: this.mode,
                body: numerBody
              };
            }
            if (denomBody.length === 1 && denomBody[0].type === "ordgroup") {
              denomNode = denomBody[0];
            } else {
              denomNode = {
                type: "ordgroup",
                mode: this.mode,
                body: denomBody
              };
            }
            var node2;
            if (funcName === "\\\\abovefrac") {
              node2 = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []);
            } else {
              node2 = this.callFunction(funcName, [numerNode, denomNode], []);
            }
            return [node2];
          } else {
            return body;
          }
        }
        /**
         * Handle a subscript or superscript with nice errors.
         */
        handleSupSubscript(name) {
          var symbolToken = this.fetch();
          var symbol = symbolToken.text;
          this.consume();
          this.consumeSpaces();
          var group2;
          do {
            var _group;
            group2 = this.parseGroup(name);
          } while (((_group = group2) == null ? void 0 : _group.type) === "internal");
          if (!group2) {
            throw new ParseError("Expected group after '" + symbol + "'", symbolToken);
          }
          return group2;
        }
        /**
         * Converts the textual input of an unsupported command into a text node
         * contained within a color node whose color is determined by errorColor
         */
        formatUnsupportedCmd(text4) {
          var textordArray = [];
          for (var i2 = 0; i2 < text4.length; i2++) {
            textordArray.push({
              type: "textord",
              mode: "text",
              text: text4[i2]
            });
          }
          var textNode = {
            type: "text",
            mode: this.mode,
            body: textordArray
          };
          var colorNode = {
            type: "color",
            mode: this.mode,
            color: this.settings.errorColor,
            body: [textNode]
          };
          return colorNode;
        }
        /**
         * Parses a group with optional super/subscripts.
         */
        parseAtom(breakOnTokenText) {
          var base = this.parseGroup("atom", breakOnTokenText);
          if ((base == null ? void 0 : base.type) === "internal") {
            return base;
          }
          if (this.mode === "text") {
            return base;
          }
          var superscript;
          var subscript;
          while (true) {
            this.consumeSpaces();
            var lex = this.fetch();
            if (lex.text === "\\limits" || lex.text === "\\nolimits") {
              if (base && base.type === "op") {
                var limits = lex.text === "\\limits";
                base.limits = limits;
                base.alwaysHandleSupSub = true;
              } else if (base && base.type === "operatorname") {
                if (base.alwaysHandleSupSub) {
                  base.limits = lex.text === "\\limits";
                }
              } else {
                throw new ParseError("Limit controls must follow a math operator", lex);
              }
              this.consume();
            } else if (lex.text === "^") {
              if (superscript) {
                throw new ParseError("Double superscript", lex);
              }
              superscript = this.handleSupSubscript("superscript");
            } else if (lex.text === "_") {
              if (subscript) {
                throw new ParseError("Double subscript", lex);
              }
              subscript = this.handleSupSubscript("subscript");
            } else if (lex.text === "'") {
              if (superscript) {
                throw new ParseError("Double superscript", lex);
              }
              var prime = {
                type: "textord",
                mode: this.mode,
                text: "\\prime"
              };
              var primes = [prime];
              this.consume();
              while (this.fetch().text === "'") {
                primes.push(prime);
                this.consume();
              }
              if (this.fetch().text === "^") {
                primes.push(this.handleSupSubscript("superscript"));
              }
              superscript = {
                type: "ordgroup",
                mode: this.mode,
                body: primes
              };
            } else if (uSubsAndSups[lex.text]) {
              var isSub = unicodeSubRegEx.test(lex.text);
              var subsupTokens = [];
              subsupTokens.push(new Token(uSubsAndSups[lex.text]));
              this.consume();
              while (true) {
                var token2 = this.fetch().text;
                if (!uSubsAndSups[token2]) {
                  break;
                }
                if (unicodeSubRegEx.test(token2) !== isSub) {
                  break;
                }
                subsupTokens.unshift(new Token(uSubsAndSups[token2]));
                this.consume();
              }
              var body = this.subparse(subsupTokens);
              if (isSub) {
                subscript = {
                  type: "ordgroup",
                  mode: "math",
                  body
                };
              } else {
                superscript = {
                  type: "ordgroup",
                  mode: "math",
                  body
                };
              }
            } else {
              break;
            }
          }
          if (superscript || subscript) {
            return {
              type: "supsub",
              mode: this.mode,
              base,
              sup: superscript,
              sub: subscript
            };
          } else {
            return base;
          }
        }
        /**
         * Parses an entire function, including its base and all of its arguments.
         */
        parseFunction(breakOnTokenText, name) {
          var token2 = this.fetch();
          var func = token2.text;
          var funcData = functions[func];
          if (!funcData) {
            return null;
          }
          this.consume();
          if (name && name !== "atom" && !funcData.allowedInArgument) {
            throw new ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token2);
          } else if (this.mode === "text" && !funcData.allowedInText) {
            throw new ParseError("Can't use function '" + func + "' in text mode", token2);
          } else if (this.mode === "math" && funcData.allowedInMath === false) {
            throw new ParseError("Can't use function '" + func + "' in math mode", token2);
          }
          var {
            args,
            optArgs
          } = this.parseArguments(func, funcData);
          return this.callFunction(func, args, optArgs, token2, breakOnTokenText);
        }
        /**
         * Call a function handler with a suitable context and arguments.
         */
        callFunction(name, args, optArgs, token2, breakOnTokenText) {
          var context = {
            funcName: name,
            parser: this,
            token: token2,
            breakOnTokenText
          };
          var func = functions[name];
          if (func && func.handler) {
            return func.handler(context, args, optArgs);
          } else {
            throw new ParseError("No function handler for " + name);
          }
        }
        /**
         * Parses the arguments of a function or environment
         */
        parseArguments(func, funcData) {
          var totalArgs = funcData.numArgs + funcData.numOptionalArgs;
          if (totalArgs === 0) {
            return {
              args: [],
              optArgs: []
            };
          }
          var args = [];
          var optArgs = [];
          for (var i2 = 0; i2 < totalArgs; i2++) {
            var argType = funcData.argTypes && funcData.argTypes[i2];
            var isOptional = i2 < funcData.numOptionalArgs;
            if (funcData.primitive && argType == null || // \sqrt expands into primitive if optional argument doesn't exist
            funcData.type === "sqrt" && i2 === 1 && optArgs[0] == null) {
              argType = "primitive";
            }
            var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional);
            if (isOptional) {
              optArgs.push(arg);
            } else if (arg != null) {
              args.push(arg);
            } else {
              throw new ParseError("Null argument, please report this as a bug");
            }
          }
          return {
            args,
            optArgs
          };
        }
        /**
         * Parses a group when the mode is changing.
         */
        parseGroupOfType(name, type3, optional2) {
          switch (type3) {
            case "color":
              return this.parseColorGroup(optional2);
            case "size":
              return this.parseSizeGroup(optional2);
            case "url":
              return this.parseUrlGroup(optional2);
            case "math":
            case "text":
              return this.parseArgumentGroup(optional2, type3);
            case "hbox": {
              var group2 = this.parseArgumentGroup(optional2, "text");
              return group2 != null ? {
                type: "styling",
                mode: group2.mode,
                body: [group2],
                style: "text"
                // simulate \textstyle
              } : null;
            }
            case "raw": {
              var token2 = this.parseStringGroup("raw", optional2);
              return token2 != null ? {
                type: "raw",
                mode: "text",
                string: token2.text
              } : null;
            }
            case "primitive": {
              if (optional2) {
                throw new ParseError("A primitive argument cannot be optional");
              }
              var _group2 = this.parseGroup(name);
              if (_group2 == null) {
                throw new ParseError("Expected group as " + name, this.fetch());
              }
              return _group2;
            }
            case "original":
            case null:
            case void 0:
              return this.parseArgumentGroup(optional2);
            default:
              throw new ParseError("Unknown group type as " + name, this.fetch());
          }
        }
        /**
         * Discard any space tokens, fetching the next non-space token.
         */
        consumeSpaces() {
          while (this.fetch().text === " ") {
            this.consume();
          }
        }
        /**
         * Parses a group, essentially returning the string formed by the
         * brace-enclosed tokens plus some position information.
         */
        parseStringGroup(modeName, optional2) {
          var argToken = this.gullet.scanArgument(optional2);
          if (argToken == null) {
            return null;
          }
          var str2 = "";
          var nextToken;
          while ((nextToken = this.fetch()).text !== "EOF") {
            str2 += nextToken.text;
            this.consume();
          }
          this.consume();
          argToken.text = str2;
          return argToken;
        }
        /**
         * Parses a regex-delimited group: the largest sequence of tokens
         * whose concatenated strings match `regex`. Returns the string
         * formed by the tokens plus some position information.
         */
        parseRegexGroup(regex2, modeName) {
          var firstToken = this.fetch();
          var lastToken = firstToken;
          var str2 = "";
          var nextToken;
          while ((nextToken = this.fetch()).text !== "EOF" && regex2.test(str2 + nextToken.text)) {
            lastToken = nextToken;
            str2 += lastToken.text;
            this.consume();
          }
          if (str2 === "") {
            throw new ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken);
          }
          return firstToken.range(lastToken, str2);
        }
        /**
         * Parses a color description.
         */
        parseColorGroup(optional2) {
          var res = this.parseStringGroup("color", optional2);
          if (res == null) {
            return null;
          }
          var match2 = /^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(res.text);
          if (!match2) {
            throw new ParseError("Invalid color: '" + res.text + "'", res);
          }
          var color2 = match2[0];
          if (/^[0-9a-f]{6}$/i.test(color2)) {
            color2 = "#" + color2;
          }
          return {
            type: "color-token",
            mode: this.mode,
            color: color2
          };
        }
        /**
         * Parses a size specification, consisting of magnitude and unit.
         */
        parseSizeGroup(optional2) {
          var res;
          var isBlank = false;
          this.gullet.consumeSpaces();
          if (!optional2 && this.gullet.future().text !== "{") {
            res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size");
          } else {
            res = this.parseStringGroup("size", optional2);
          }
          if (!res) {
            return null;
          }
          if (!optional2 && res.text.length === 0) {
            res.text = "0pt";
            isBlank = true;
          }
          var match2 = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text);
          if (!match2) {
            throw new ParseError("Invalid size: '" + res.text + "'", res);
          }
          var data5 = {
            number: +(match2[1] + match2[2]),
            // sign + magnitude, cast to number
            unit: match2[3]
          };
          if (!validUnit(data5)) {
            throw new ParseError("Invalid unit: '" + data5.unit + "'", res);
          }
          return {
            type: "size",
            mode: this.mode,
            value: data5,
            isBlank
          };
        }
        /**
         * Parses an URL, checking escaped letters and allowed protocols,
         * and setting the catcode of % as an active character (as in \hyperref).
         */
        parseUrlGroup(optional2) {
          this.gullet.lexer.setCatcode("%", 13);
          this.gullet.lexer.setCatcode("~", 12);
          var res = this.parseStringGroup("url", optional2);
          this.gullet.lexer.setCatcode("%", 14);
          this.gullet.lexer.setCatcode("~", 13);
          if (res == null) {
            return null;
          }
          var url = res.text.replace(/\\([#$%&~_^{}])/g, "$1");
          return {
            type: "url",
            mode: this.mode,
            url
          };
        }
        /**
         * Parses an argument with the mode specified.
         */
        parseArgumentGroup(optional2, mode) {
          var argToken = this.gullet.scanArgument(optional2);
          if (argToken == null) {
            return null;
          }
          var outerMode = this.mode;
          if (mode) {
            this.switchMode(mode);
          }
          this.gullet.beginGroup();
          var expression = this.parseExpression(false, "EOF");
          this.expect("EOF");
          this.gullet.endGroup();
          var result = {
            type: "ordgroup",
            mode: this.mode,
            loc: argToken.loc,
            body: expression
          };
          if (mode) {
            this.switchMode(outerMode);
          }
          return result;
        }
        /**
         * Parses an ordinary group, which is either a single nucleus (like "x")
         * or an expression in braces (like "{x+y}") or an implicit group, a group
         * that starts at the current position, and ends right before a higher explicit
         * group ends, or at EOF.
         */
        parseGroup(name, breakOnTokenText) {
          var firstToken = this.fetch();
          var text4 = firstToken.text;
          var result;
          if (text4 === "{" || text4 === "\\begingroup") {
            this.consume();
            var groupEnd = text4 === "{" ? "}" : "\\endgroup";
            this.gullet.beginGroup();
            var expression = this.parseExpression(false, groupEnd);
            var lastToken = this.fetch();
            this.expect(groupEnd);
            this.gullet.endGroup();
            result = {
              type: "ordgroup",
              mode: this.mode,
              loc: SourceLocation.range(firstToken, lastToken),
              body: expression,
              // A group formed by \begingroup...\endgroup is a semi-simple group
              // which doesn't affect spacing in math mode, i.e., is transparent.
              // https://tex.stackexchange.com/questions/1930/when-should-one-
              // use-begingroup-instead-of-bgroup
              semisimple: text4 === "\\begingroup" || void 0
            };
          } else {
            result = this.parseFunction(breakOnTokenText, name) || this.parseSymbol();
            if (result == null && text4[0] === "\\" && !implicitCommands.hasOwnProperty(text4)) {
              if (this.settings.throwOnError) {
                throw new ParseError("Undefined control sequence: " + text4, firstToken);
              }
              result = this.formatUnsupportedCmd(text4);
              this.consume();
            }
          }
          return result;
        }
        /**
         * Form ligature-like combinations of characters for text mode.
         * This includes inputs like "--", "---", "``" and "''".
         * The result will simply replace multiple textord nodes with a single
         * character in each value by a single textord node having multiple
         * characters in its value.  The representation is still ASCII source.
         * The group will be modified in place.
         */
        formLigatures(group2) {
          var n2 = group2.length - 1;
          for (var i2 = 0; i2 < n2; ++i2) {
            var a2 = group2[i2];
            var v3 = a2.text;
            if (v3 === "-" && group2[i2 + 1].text === "-") {
              if (i2 + 1 < n2 && group2[i2 + 2].text === "-") {
                group2.splice(i2, 3, {
                  type: "textord",
                  mode: "text",
                  loc: SourceLocation.range(a2, group2[i2 + 2]),
                  text: "---"
                });
                n2 -= 2;
              } else {
                group2.splice(i2, 2, {
                  type: "textord",
                  mode: "text",
                  loc: SourceLocation.range(a2, group2[i2 + 1]),
                  text: "--"
                });
                n2 -= 1;
              }
            }
            if ((v3 === "'" || v3 === "`") && group2[i2 + 1].text === v3) {
              group2.splice(i2, 2, {
                type: "textord",
                mode: "text",
                loc: SourceLocation.range(a2, group2[i2 + 1]),
                text: v3 + v3
              });
              n2 -= 1;
            }
          }
        }
        /**
         * Parse a single symbol out of the string. Here, we handle single character
         * symbols and special functions like \verb.
         */
        parseSymbol() {
          var nucleus = this.fetch();
          var text4 = nucleus.text;
          if (/^\\verb[^a-zA-Z]/.test(text4)) {
            this.consume();
            var arg = text4.slice(5);
            var star2 = arg.charAt(0) === "*";
            if (star2) {
              arg = arg.slice(1);
            }
            if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) {
              throw new ParseError("\\verb assertion failed --\n                    please report what input caused this bug");
            }
            arg = arg.slice(1, -1);
            return {
              type: "verb",
              mode: "text",
              body: arg,
              star: star2
            };
          }
          if (unicodeSymbols.hasOwnProperty(text4[0]) && !symbols[this.mode][text4[0]]) {
            if (this.settings.strict && this.mode === "math") {
              this.settings.reportNonstrict("unicodeTextInMathMode", 'Accented Unicode text character "' + text4[0] + '" used in math mode', nucleus);
            }
            text4 = unicodeSymbols[text4[0]] + text4.slice(1);
          }
          var match2 = combiningDiacriticalMarksEndRegex.exec(text4);
          if (match2) {
            text4 = text4.substring(0, match2.index);
            if (text4 === "i") {
              text4 = "\u0131";
            } else if (text4 === "j") {
              text4 = "\u0237";
            }
          }
          var symbol;
          if (symbols[this.mode][text4]) {
            if (this.settings.strict && this.mode === "math" && extraLatin.indexOf(text4) >= 0) {
              this.settings.reportNonstrict("unicodeTextInMathMode", 'Latin-1/Unicode text character "' + text4[0] + '" used in math mode', nucleus);
            }
            var group2 = symbols[this.mode][text4].group;
            var loc = SourceLocation.range(nucleus);
            var s2;
            if (ATOMS.hasOwnProperty(group2)) {
              var family = group2;
              s2 = {
                type: "atom",
                mode: this.mode,
                family,
                loc,
                text: text4
              };
            } else {
              s2 = {
                type: group2,
                mode: this.mode,
                loc,
                text: text4
              };
            }
            symbol = s2;
          } else if (text4.charCodeAt(0) >= 128) {
            if (this.settings.strict) {
              if (!supportedCodepoint(text4.charCodeAt(0))) {
                this.settings.reportNonstrict("unknownSymbol", 'Unrecognized Unicode character "' + text4[0] + '"' + (" (" + text4.charCodeAt(0) + ")"), nucleus);
              } else if (this.mode === "math") {
                this.settings.reportNonstrict("unicodeTextInMathMode", 'Unicode text character "' + text4[0] + '" used in math mode', nucleus);
              }
            }
            symbol = {
              type: "textord",
              mode: "text",
              loc: SourceLocation.range(nucleus),
              text: text4
            };
          } else {
            return null;
          }
          this.consume();
          if (match2) {
            for (var i2 = 0; i2 < match2[0].length; i2++) {
              var accent2 = match2[0][i2];
              if (!unicodeAccents[accent2]) {
                throw new ParseError("Unknown accent ' " + accent2 + "'", nucleus);
              }
              var command = unicodeAccents[accent2][this.mode] || unicodeAccents[accent2].text;
              if (!command) {
                throw new ParseError("Accent " + accent2 + " unsupported in " + this.mode + " mode", nucleus);
              }
              symbol = {
                type: "accent",
                mode: this.mode,
                loc: SourceLocation.range(nucleus),
                label: command,
                isStretchy: false,
                isShifty: true,
                // $FlowFixMe
                base: symbol
              };
            }
          }
          return symbol;
        }
      };
      Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"];
      parseTree = /* @__PURE__ */ __name(function parseTree2(toParse, settings) {
        if (!(typeof toParse === "string" || toParse instanceof String)) {
          throw new TypeError("KaTeX can only parse string typed expression");
        }
        var parser28 = new Parser(toParse, settings);
        delete parser28.gullet.macros.current["\\df@tag"];
        var tree = parser28.parse();
        delete parser28.gullet.macros.current["\\current@color"];
        delete parser28.gullet.macros.current["\\color"];
        if (parser28.gullet.macros.get("\\df@tag")) {
          if (!settings.displayMode) {
            throw new ParseError("\\tag works only in display equations");
          }
          tree = [{
            type: "tag",
            mode: "text",
            body: tree,
            tag: parser28.subparse([new Token("\\df@tag")])
          }];
        }
        return tree;
      }, "parseTree");
      render = /* @__PURE__ */ __name(function render2(expression, baseNode, options2) {
        baseNode.textContent = "";
        var node2 = renderToDomTree(expression, options2).toNode();
        baseNode.appendChild(node2);
      }, "render");
      if (typeof document !== "undefined") {
        if (document.compatMode !== "CSS1Compat") {
          typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype.");
          render = /* @__PURE__ */ __name(function render9() {
            throw new ParseError("KaTeX doesn't work in quirks mode.");
          }, "render");
        }
      }
      renderToString = /* @__PURE__ */ __name(function renderToString2(expression, options2) {
        var markup = renderToDomTree(expression, options2).toMarkup();
        return markup;
      }, "renderToString");
      generateParseTree = /* @__PURE__ */ __name(function generateParseTree2(expression, options2) {
        var settings = new Settings(options2);
        return parseTree(expression, settings);
      }, "generateParseTree");
      renderError = /* @__PURE__ */ __name(function renderError2(error3, expression, options2) {
        if (options2.throwOnError || !(error3 instanceof ParseError)) {
          throw error3;
        }
        var node2 = buildCommon.makeSpan(["katex-error"], [new SymbolNode(expression)]);
        node2.setAttribute("title", error3.toString());
        node2.setAttribute("style", "color:" + options2.errorColor);
        return node2;
      }, "renderError");
      renderToDomTree = /* @__PURE__ */ __name(function renderToDomTree2(expression, options2) {
        var settings = new Settings(options2);
        try {
          var tree = parseTree(expression, settings);
          return buildTree(tree, expression, settings);
        } catch (error3) {
          return renderError(error3, expression, settings);
        }
      }, "renderToDomTree");
      renderToHTMLTree = /* @__PURE__ */ __name(function renderToHTMLTree2(expression, options2) {
        var settings = new Settings(options2);
        try {
          var tree = parseTree(expression, settings);
          return buildHTMLTree(tree, expression, settings);
        } catch (error3) {
          return renderError(error3, expression, settings);
        }
      }, "renderToHTMLTree");
      version = "0.16.25";
      __domTree = {
        Span,
        Anchor,
        SymbolNode,
        SvgNode,
        PathNode,
        LineNode
      };
      katex = {
        /**
         * Current KaTeX version
         */
        version,
        /**
         * Renders the given LaTeX into an HTML+MathML combination, and adds
         * it as a child to the specified DOM node.
         */
        render,
        /**
         * Renders the given LaTeX into an HTML+MathML combination string,
         * for sending to the client.
         */
        renderToString,
        /**
         * KaTeX error, usually during parsing.
         */
        ParseError,
        /**
         * The schema of Settings
         */
        SETTINGS_SCHEMA,
        /**
         * Parses the given LaTeX into KaTeX's internal parse tree structure,
         * without rendering to HTML or MathML.
         *
         * NOTE: This method is not currently recommended for public use.
         * The internal tree representation is unstable and is very likely
         * to change. Use at your own risk.
         */
        __parse: generateParseTree,
        /**
         * Renders the given LaTeX into an HTML+MathML internal DOM tree
         * representation, without flattening that representation to a string.
         *
         * NOTE: This method is not currently recommended for public use.
         * The internal tree representation is unstable and is very likely
         * to change. Use at your own risk.
         */
        __renderToDomTree: renderToDomTree,
        /**
         * Renders the given LaTeX into an HTML internal DOM tree representation,
         * without MathML and without flattening that representation to a string.
         *
         * NOTE: This method is not currently recommended for public use.
         * The internal tree representation is unstable and is very likely
         * to change. Use at your own risk.
         */
        __renderToHTMLTree: renderToHTMLTree,
        /**
         * extends internal font metrics object with a new object
         * each key in the new object represents a font name
        */
        __setFontMetrics: setFontMetrics,
        /**
         * adds a new symbol to builtin symbols table
         */
        __defineSymbol: defineSymbol,
        /**
         * adds a new function to builtin function list,
         * which directly produce parse tree elements
         * and have their own html/mathml builders
         */
        __defineFunction: defineFunction,
        /**
         * adds a new macro to builtin macro list
         */
        __defineMacro: defineMacro,
        /**
         * Expose the dom tree node types, which can be useful for type checking nodes.
         *
         * NOTE: These methods are not currently recommended for public use.
         * The internal tree representation is unstable and is very likely
         * to change. Use at your own risk.
         */
        __domTree
      };
    }
  });

  // src/diagrams/common/common.ts
  function setupDompurifyHooks() {
    const TEMPORARY_ATTRIBUTE = "data-temp-href-target";
    purify.addHook("beforeSanitizeAttributes", (node2) => {
      if (node2.tagName === "A" && node2.hasAttribute("target")) {
        node2.setAttribute(TEMPORARY_ATTRIBUTE, node2.getAttribute("target") ?? "");
      }
    });
    purify.addHook("afterSanitizeAttributes", (node2) => {
      if (node2.tagName === "A" && node2.hasAttribute(TEMPORARY_ATTRIBUTE)) {
        node2.setAttribute("target", node2.getAttribute(TEMPORARY_ATTRIBUTE) ?? "");
        node2.removeAttribute(TEMPORARY_ATTRIBUTE);
        if (node2.getAttribute("target") === "_blank") {
          node2.setAttribute("rel", "noopener");
        }
      }
    });
  }
  var lineBreakRegex, getRows, setupDompurifyHooksIfNotSetup, removeScript, sanitizeMore, sanitizeText, sanitizeTextOrArray, hasBreaks, splitBreaks, placeholderToBreak, breakToPlaceholder, getUrl, getMax, getMin, parseGenericTypes, countOccurrence, shouldCombineSets, processSet, isMathMLSupported, katexRegex, hasKatex, calculateMathMLDimensions, renderKatexUnsanitized, renderKatexSanitized, common_default;
  var init_common = __esm({
    "src/diagrams/common/common.ts"() {
      "use strict";
      init_purify_es();
      init_config();
      lineBreakRegex = /<br\s*\/?>/gi;
      getRows = /* @__PURE__ */ __name((s2) => {
        if (!s2) {
          return [""];
        }
        const str2 = breakToPlaceholder(s2).replace(/\\n/g, "#br#");
        return str2.split("#br#");
      }, "getRows");
      setupDompurifyHooksIfNotSetup = /* @__PURE__ */ (() => {
        let setup = false;
        return () => {
          if (!setup) {
            setupDompurifyHooks();
            setup = true;
          }
        };
      })();
      __name(setupDompurifyHooks, "setupDompurifyHooks");
      removeScript = /* @__PURE__ */ __name((txt) => {
        setupDompurifyHooksIfNotSetup();
        const sanitizedText = purify.sanitize(txt);
        return sanitizedText;
      }, "removeScript");
      sanitizeMore = /* @__PURE__ */ __name((text4, config5) => {
        if (getEffectiveHtmlLabels(config5)) {
          const level = config5.securityLevel;
          if (level === "antiscript" || level === "strict" || level === "sandbox") {
            text4 = removeScript(text4);
          } else if (level !== "loose") {
            text4 = breakToPlaceholder(text4);
            text4 = text4.replace(/</g, "&lt;").replace(/>/g, "&gt;");
            text4 = text4.replace(/=/g, "&equals;");
            text4 = placeholderToBreak(text4);
          }
        }
        return text4;
      }, "sanitizeMore");
      sanitizeText = /* @__PURE__ */ __name((text4, config5) => {
        if (!text4) {
          return text4;
        }
        if (config5.dompurifyConfig) {
          text4 = purify.sanitize(sanitizeMore(text4, config5), config5.dompurifyConfig).toString();
        } else {
          text4 = purify.sanitize(sanitizeMore(text4, config5), {
            FORBID_TAGS: ["style"]
          }).toString();
        }
        return text4;
      }, "sanitizeText");
      sanitizeTextOrArray = /* @__PURE__ */ __name((a2, config5) => {
        if (typeof a2 === "string") {
          return sanitizeText(a2, config5);
        }
        return a2.flat().map((x5) => sanitizeText(x5, config5));
      }, "sanitizeTextOrArray");
      hasBreaks = /* @__PURE__ */ __name((text4) => {
        return lineBreakRegex.test(text4);
      }, "hasBreaks");
      splitBreaks = /* @__PURE__ */ __name((text4) => {
        return text4.split(lineBreakRegex);
      }, "splitBreaks");
      placeholderToBreak = /* @__PURE__ */ __name((s2) => {
        return s2.replace(/#br#/g, "<br/>");
      }, "placeholderToBreak");
      breakToPlaceholder = /* @__PURE__ */ __name((s2) => {
        return s2.replace(lineBreakRegex, "#br#");
      }, "breakToPlaceholder");
      getUrl = /* @__PURE__ */ __name((useAbsolute) => {
        let url = "";
        if (useAbsolute) {
          url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
          url = CSS.escape(url);
        }
        return url;
      }, "getUrl");
      getMax = /* @__PURE__ */ __name(function(...values2) {
        const newValues = values2.filter((value2) => {
          return !isNaN(value2);
        });
        return Math.max(...newValues);
      }, "getMax");
      getMin = /* @__PURE__ */ __name(function(...values2) {
        const newValues = values2.filter((value2) => {
          return !isNaN(value2);
        });
        return Math.min(...newValues);
      }, "getMin");
      parseGenericTypes = /* @__PURE__ */ __name(function(input) {
        const inputSets = input.split(/(,)/);
        const output2 = [];
        for (let i2 = 0; i2 < inputSets.length; i2++) {
          let thisSet = inputSets[i2];
          if (thisSet === "," && i2 > 0 && i2 + 1 < inputSets.length) {
            const previousSet = inputSets[i2 - 1];
            const nextSet = inputSets[i2 + 1];
            if (shouldCombineSets(previousSet, nextSet)) {
              thisSet = previousSet + "," + nextSet;
              i2++;
              output2.pop();
            }
          }
          output2.push(processSet(thisSet));
        }
        return output2.join("");
      }, "parseGenericTypes");
      countOccurrence = /* @__PURE__ */ __name((string3, substring) => {
        return Math.max(0, string3.split(substring).length - 1);
      }, "countOccurrence");
      shouldCombineSets = /* @__PURE__ */ __name((previousSet, nextSet) => {
        const prevCount = countOccurrence(previousSet, "~");
        const nextCount = countOccurrence(nextSet, "~");
        return prevCount === 1 && nextCount === 1;
      }, "shouldCombineSets");
      processSet = /* @__PURE__ */ __name((input) => {
        const tildeCount = countOccurrence(input, "~");
        let hasStartingTilde = false;
        if (tildeCount <= 1) {
          return input;
        }
        if (tildeCount % 2 !== 0 && input.startsWith("~")) {
          input = input.substring(1);
          hasStartingTilde = true;
        }
        const chars = [...input];
        let first3 = chars.indexOf("~");
        let last3 = chars.lastIndexOf("~");
        while (first3 !== -1 && last3 !== -1 && first3 !== last3) {
          chars[first3] = "<";
          chars[last3] = ">";
          first3 = chars.indexOf("~");
          last3 = chars.lastIndexOf("~");
        }
        if (hasStartingTilde) {
          chars.unshift("~");
        }
        return chars.join("");
      }, "processSet");
      isMathMLSupported = /* @__PURE__ */ __name(() => window.MathMLElement !== void 0, "isMathMLSupported");
      katexRegex = /\$\$(.*)\$\$/g;
      hasKatex = /* @__PURE__ */ __name((text4) => (text4.match(katexRegex)?.length ?? 0) > 0, "hasKatex");
      calculateMathMLDimensions = /* @__PURE__ */ __name(async (text4, config5) => {
        const divElem = document.createElement("div");
        divElem.innerHTML = await renderKatexSanitized(text4, config5);
        divElem.id = "katex-temp";
        divElem.style.visibility = "hidden";
        divElem.style.position = "absolute";
        divElem.style.top = "0";
        const body = document.querySelector("body");
        body?.insertAdjacentElement("beforeend", divElem);
        const dim = { width: divElem.clientWidth, height: divElem.clientHeight };
        divElem.remove();
        return dim;
      }, "calculateMathMLDimensions");
      renderKatexUnsanitized = /* @__PURE__ */ __name(async (text4, config5) => {
        if (!hasKatex(text4)) {
          return text4;
        }
        if (!(isMathMLSupported() || config5.legacyMathML || config5.forceLegacyMathML)) {
          return text4.replace(katexRegex, "MathML is unsupported in this environment.");
        }
        if (true) {
          const { default: katex2 } = await Promise.resolve().then(() => (init_katex(), katex_exports));
          const outputMode = config5.forceLegacyMathML || !isMathMLSupported() && config5.legacyMathML ? "htmlAndMathml" : "mathml";
          return text4.split(lineBreakRegex).map(
            (line2) => hasKatex(line2) ? `<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${line2}</div>` : `<div>${line2}</div>`
          ).join("").replace(
            katexRegex,
            (_3, c3) => katex2.renderToString(c3, {
              throwOnError: true,
              displayMode: true,
              output: outputMode
            }).replace(/\n/g, " ").replace(/<annotation.*<\/annotation>/g, "")
          );
        }
        return text4.replace(
          katexRegex,
          "Katex is not supported in @mermaid-js/tiny. Please use the full mermaid library."
        );
      }, "renderKatexUnsanitized");
      renderKatexSanitized = /* @__PURE__ */ __name(async (text4, config5) => {
        return sanitizeText(await renderKatexUnsanitized(text4, config5), config5);
      }, "renderKatexSanitized");
      common_default = {
        getRows,
        sanitizeText,
        sanitizeTextOrArray,
        hasBreaks,
        splitBreaks,
        lineBreakRegex,
        removeScript,
        getUrl,
        evaluate,
        getMax,
        getMin
      };
    }
  });

  // src/rendering-util/icons.ts
  var unknownIcon, iconsStore, loaderStore, registerIconPacks, getRegisteredIconData, isIconAvailable, getIconSVG;
  var init_icons = __esm({
    "src/rendering-util/icons.ts"() {
      "use strict";
      init_lib();
      init_config();
      init_common();
      init_logger();
      unknownIcon = {
        body: '<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/><text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;"><tspan x="0" y="0">?</tspan></text></g>',
        height: 80,
        width: 80
      };
      iconsStore = /* @__PURE__ */ new Map();
      loaderStore = /* @__PURE__ */ new Map();
      registerIconPacks = /* @__PURE__ */ __name((iconLoaders) => {
        for (const iconLoader of iconLoaders) {
          if (!iconLoader.name) {
            throw new Error(
              'Invalid icon loader. Must have a "name" property with non-empty string value.'
            );
          }
          log.debug("Registering icon pack:", iconLoader.name);
          if ("loader" in iconLoader) {
            loaderStore.set(iconLoader.name, iconLoader.loader);
          } else if ("icons" in iconLoader) {
            iconsStore.set(iconLoader.name, iconLoader.icons);
          } else {
            log.error("Invalid icon loader:", iconLoader);
            throw new Error('Invalid icon loader. Must have either "icons" or "loader" property.');
          }
        }
      }, "registerIconPacks");
      getRegisteredIconData = /* @__PURE__ */ __name(async (iconName, fallbackPrefix) => {
        const data5 = stringToIcon(iconName, true, fallbackPrefix !== void 0);
        if (!data5) {
          throw new Error(`Invalid icon name: ${iconName}`);
        }
        const prefix = data5.prefix || fallbackPrefix;
        if (!prefix) {
          throw new Error(`Icon name must contain a prefix: ${iconName}`);
        }
        let icons = iconsStore.get(prefix);
        if (!icons) {
          const loader33 = loaderStore.get(prefix);
          if (!loader33) {
            throw new Error(`Icon set not found: ${data5.prefix}`);
          }
          try {
            const loaded = await loader33();
            icons = { ...loaded, prefix };
            iconsStore.set(prefix, icons);
          } catch (e3) {
            log.error(e3);
            throw new Error(`Failed to load icon set: ${data5.prefix}`);
          }
        }
        const iconData = getIconData(icons, data5.name);
        if (!iconData) {
          throw new Error(`Icon not found: ${iconName}`);
        }
        return iconData;
      }, "getRegisteredIconData");
      isIconAvailable = /* @__PURE__ */ __name(async (iconName) => {
        try {
          await getRegisteredIconData(iconName);
          return true;
        } catch {
          return false;
        }
      }, "isIconAvailable");
      getIconSVG = /* @__PURE__ */ __name(async (iconName, customisations, extraAttributes) => {
        let iconData;
        try {
          iconData = await getRegisteredIconData(iconName, customisations?.fallbackPrefix);
        } catch (e3) {
          log.error(e3);
          iconData = unknownIcon;
        }
        const renderData = iconToSVG(iconData, customisations);
        const svg2 = iconToHTML(replaceIDs(renderData.body), {
          ...renderData.attributes,
          ...extraAttributes
        });
        return sanitizeText(svg2, getConfig());
      }, "getIconSVG");
    }
  });

  // ../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/esm/index.js
  function dedent(templ) {
    var values2 = [];
    for (var _i = 1; _i < arguments.length; _i++) {
      values2[_i - 1] = arguments[_i];
    }
    var strings = Array.from(typeof templ === "string" ? [templ] : templ);
    strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
    var indentLengths = strings.reduce(function(arr, str2) {
      var matches33 = str2.match(/\n([\t ]+|(?!\s).)/g);
      if (matches33) {
        return arr.concat(matches33.map(function(match2) {
          var _a, _b;
          return (_b = (_a = match2.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
        }));
      }
      return arr;
    }, []);
    if (indentLengths.length) {
      var pattern_1 = new RegExp("\n[	 ]{" + Math.min.apply(Math, indentLengths) + "}", "g");
      strings = strings.map(function(str2) {
        return str2.replace(pattern_1, "\n");
      });
    }
    strings[0] = strings[0].replace(/^\r?\n/, "");
    var string3 = strings[0];
    values2.forEach(function(value2, i2) {
      var endentations = string3.match(/(?:^|\n)( *)$/);
      var endentation = endentations ? endentations[1] : "";
      var indentedValue = value2;
      if (typeof value2 === "string" && value2.includes("\n")) {
        indentedValue = String(value2).split("\n").map(function(str2, i3) {
          return i3 === 0 ? str2 : "" + endentation + str2;
        }).join("\n");
      }
      string3 += indentedValue + strings[i2 + 1];
    });
    return string3;
  }
  var init_esm = __esm({
    "../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/esm/index.js"() {
      "use strict";
      __name(dedent, "dedent");
    }
  });

  // src/diagram-api/regexes.ts
  var frontMatterRegex, directiveRegex, anyCommentRegex;
  var init_regexes = __esm({
    "src/diagram-api/regexes.ts"() {
      "use strict";
      frontMatterRegex = /^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s;
      directiveRegex = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
      anyCommentRegex = /\s*%%.*\n/gm;
    }
  });

  // src/errors.ts
  var UnknownDiagramError;
  var init_errors = __esm({
    "src/errors.ts"() {
      "use strict";
      UnknownDiagramError = class extends Error {
        static {
          __name(this, "UnknownDiagramError");
        }
        constructor(message) {
          super(message);
          this.name = "UnknownDiagramError";
        }
      };
    }
  });

  // src/diagram-api/detectType.ts
  var detectors, detectType, registerLazyLoadedDiagrams, addDetector, getDiagramLoader;
  var init_detectType = __esm({
    "src/diagram-api/detectType.ts"() {
      "use strict";
      init_logger();
      init_regexes();
      init_errors();
      detectors = {};
      detectType = /* @__PURE__ */ __name(function(text4, config5) {
        text4 = text4.replace(frontMatterRegex, "").replace(directiveRegex, "").replace(anyCommentRegex, "\n");
        for (const [key, { detector: detector32 }] of Object.entries(detectors)) {
          const diagram31 = detector32(text4, config5);
          if (diagram31) {
            return key;
          }
        }
        throw new UnknownDiagramError(
          `No diagram type detected matching given configuration for text: ${text4}`
        );
      }, "detectType");
      registerLazyLoadedDiagrams = /* @__PURE__ */ __name((...diagrams2) => {
        for (const { id: id34, detector: detector32, loader: loader33 } of diagrams2) {
          addDetector(id34, detector32, loader33);
        }
      }, "registerLazyLoadedDiagrams");
      addDetector = /* @__PURE__ */ __name((key, detector32, loader33) => {
        if (detectors[key]) {
          log.warn(`Detector with key ${key} already exists. Overwriting.`);
        }
        detectors[key] = { detector: detector32, loader: loader33 };
        log.debug(`Detector with key ${key} added${loader33 ? " with loader" : ""}`);
      }, "addDetector");
      getDiagramLoader = /* @__PURE__ */ __name((key) => {
        return detectors[key].loader;
      }, "getDiagramLoader");
    }
  });

  // src/diagrams/c4/parser/c4Diagram.jison
  var parser, c4Diagram_default;
  var init_c4Diagram = __esm({
    "src/diagrams/c4/parser/c4Diagram.jison"() {
      "use strict";
      parser = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [1, 24], $V1 = [1, 25], $V2 = [1, 26], $V3 = [1, 27], $V4 = [1, 28], $V5 = [1, 63], $V6 = [1, 64], $V7 = [1, 65], $V8 = [1, 66], $V9 = [1, 67], $Va = [1, 68], $Vb = [1, 69], $Vc = [1, 29], $Vd = [1, 30], $Ve = [1, 31], $Vf = [1, 32], $Vg = [1, 33], $Vh = [1, 34], $Vi = [1, 35], $Vj = [1, 36], $Vk = [1, 37], $Vl = [1, 38], $Vm = [1, 39], $Vn = [1, 40], $Vo = [1, 41], $Vp = [1, 42], $Vq = [1, 43], $Vr = [1, 44], $Vs = [1, 45], $Vt = [1, 46], $Vu = [1, 47], $Vv = [1, 48], $Vw = [1, 50], $Vx = [1, 51], $Vy = [1, 52], $Vz = [1, 53], $VA = [1, 54], $VB = [1, 55], $VC = [1, 56], $VD = [1, 57], $VE = [1, 58], $VF = [1, 59], $VG = [1, 60], $VH = [14, 42], $VI = [14, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], $VJ = [12, 14, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], $VK = [1, 82], $VL = [1, 83], $VM = [1, 84], $VN = [1, 85], $VO = [12, 14, 42], $VP = [12, 14, 33, 42], $VQ = [12, 14, 33, 42, 76, 77, 79, 80], $VR = [12, 33], $VS = [34, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "mermaidDoc": 4, "direction": 5, "direction_tb": 6, "direction_bt": 7, "direction_rl": 8, "direction_lr": 9, "graphConfig": 10, "C4_CONTEXT": 11, "NEWLINE": 12, "statements": 13, "EOF": 14, "C4_CONTAINER": 15, "C4_COMPONENT": 16, "C4_DYNAMIC": 17, "C4_DEPLOYMENT": 18, "otherStatements": 19, "diagramStatements": 20, "otherStatement": 21, "title": 22, "accDescription": 23, "acc_title": 24, "acc_title_value": 25, "acc_descr": 26, "acc_descr_value": 27, "acc_descr_multiline_value": 28, "boundaryStatement": 29, "boundaryStartStatement": 30, "boundaryStopStatement": 31, "boundaryStart": 32, "LBRACE": 33, "ENTERPRISE_BOUNDARY": 34, "attributes": 35, "SYSTEM_BOUNDARY": 36, "BOUNDARY": 37, "CONTAINER_BOUNDARY": 38, "NODE": 39, "NODE_L": 40, "NODE_R": 41, "RBRACE": 42, "diagramStatement": 43, "PERSON": 44, "PERSON_EXT": 45, "SYSTEM": 46, "SYSTEM_DB": 47, "SYSTEM_QUEUE": 48, "SYSTEM_EXT": 49, "SYSTEM_EXT_DB": 50, "SYSTEM_EXT_QUEUE": 51, "CONTAINER": 52, "CONTAINER_DB": 53, "CONTAINER_QUEUE": 54, "CONTAINER_EXT": 55, "CONTAINER_EXT_DB": 56, "CONTAINER_EXT_QUEUE": 57, "COMPONENT": 58, "COMPONENT_DB": 59, "COMPONENT_QUEUE": 60, "COMPONENT_EXT": 61, "COMPONENT_EXT_DB": 62, "COMPONENT_EXT_QUEUE": 63, "REL": 64, "BIREL": 65, "REL_U": 66, "REL_D": 67, "REL_L": 68, "REL_R": 69, "REL_B": 70, "REL_INDEX": 71, "UPDATE_EL_STYLE": 72, "UPDATE_REL_STYLE": 73, "UPDATE_LAYOUT_CONFIG": 74, "attribute": 75, "STR": 76, "STR_KEY": 77, "STR_VALUE": 78, "ATTRIBUTE": 79, "ATTRIBUTE_EMPTY": 80, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 6: "direction_tb", 7: "direction_bt", 8: "direction_rl", 9: "direction_lr", 11: "C4_CONTEXT", 12: "NEWLINE", 14: "EOF", 15: "C4_CONTAINER", 16: "C4_COMPONENT", 17: "C4_DYNAMIC", 18: "C4_DEPLOYMENT", 22: "title", 23: "accDescription", 24: "acc_title", 25: "acc_title_value", 26: "acc_descr", 27: "acc_descr_value", 28: "acc_descr_multiline_value", 33: "LBRACE", 34: "ENTERPRISE_BOUNDARY", 36: "SYSTEM_BOUNDARY", 37: "BOUNDARY", 38: "CONTAINER_BOUNDARY", 39: "NODE", 40: "NODE_L", 41: "NODE_R", 42: "RBRACE", 44: "PERSON", 45: "PERSON_EXT", 46: "SYSTEM", 47: "SYSTEM_DB", 48: "SYSTEM_QUEUE", 49: "SYSTEM_EXT", 50: "SYSTEM_EXT_DB", 51: "SYSTEM_EXT_QUEUE", 52: "CONTAINER", 53: "CONTAINER_DB", 54: "CONTAINER_QUEUE", 55: "CONTAINER_EXT", 56: "CONTAINER_EXT_DB", 57: "CONTAINER_EXT_QUEUE", 58: "COMPONENT", 59: "COMPONENT_DB", 60: "COMPONENT_QUEUE", 61: "COMPONENT_EXT", 62: "COMPONENT_EXT_DB", 63: "COMPONENT_EXT_QUEUE", 64: "REL", 65: "BIREL", 66: "REL_U", 67: "REL_D", 68: "REL_L", 69: "REL_R", 70: "REL_B", 71: "REL_INDEX", 72: "UPDATE_EL_STYLE", 73: "UPDATE_REL_STYLE", 74: "UPDATE_LAYOUT_CONFIG", 76: "STR", 77: "STR_KEY", 78: "STR_VALUE", 79: "ATTRIBUTE", 80: "ATTRIBUTE_EMPTY" },
          productions_: [0, [3, 1], [3, 1], [5, 1], [5, 1], [5, 1], [5, 1], [4, 1], [10, 4], [10, 4], [10, 4], [10, 4], [10, 4], [13, 1], [13, 1], [13, 2], [19, 1], [19, 2], [19, 3], [21, 1], [21, 1], [21, 2], [21, 2], [21, 1], [29, 3], [30, 3], [30, 3], [30, 4], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [31, 1], [20, 1], [20, 2], [20, 3], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 1], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [35, 1], [35, 2], [75, 1], [75, 2], [75, 1], [75, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 3:
                yy.setDirection("TB");
                break;
              case 4:
                yy.setDirection("BT");
                break;
              case 5:
                yy.setDirection("RL");
                break;
              case 6:
                yy.setDirection("LR");
                break;
              case 8:
              case 9:
              case 10:
              case 11:
              case 12:
                yy.setC4Type($$[$0 - 3]);
                break;
              case 19:
                yy.setTitle($$[$0].substring(6));
                this.$ = $$[$0].substring(6);
                break;
              case 20:
                yy.setAccDescription($$[$0].substring(15));
                this.$ = $$[$0].substring(15);
                break;
              case 21:
                this.$ = $$[$0].trim();
                yy.setTitle(this.$);
                break;
              case 22:
              case 23:
                this.$ = $$[$0].trim();
                yy.setAccDescription(this.$);
                break;
              case 28:
                $$[$0].splice(2, 0, "ENTERPRISE");
                yy.addPersonOrSystemBoundary(...$$[$0]);
                this.$ = $$[$0];
                break;
              case 29:
                $$[$0].splice(2, 0, "SYSTEM");
                yy.addPersonOrSystemBoundary(...$$[$0]);
                this.$ = $$[$0];
                break;
              case 30:
                yy.addPersonOrSystemBoundary(...$$[$0]);
                this.$ = $$[$0];
                break;
              case 31:
                $$[$0].splice(2, 0, "CONTAINER");
                yy.addContainerBoundary(...$$[$0]);
                this.$ = $$[$0];
                break;
              case 32:
                yy.addDeploymentNode("node", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 33:
                yy.addDeploymentNode("nodeL", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 34:
                yy.addDeploymentNode("nodeR", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 35:
                yy.popBoundaryParseStack();
                break;
              case 39:
                yy.addPersonOrSystem("person", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 40:
                yy.addPersonOrSystem("external_person", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 41:
                yy.addPersonOrSystem("system", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 42:
                yy.addPersonOrSystem("system_db", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 43:
                yy.addPersonOrSystem("system_queue", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 44:
                yy.addPersonOrSystem("external_system", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 45:
                yy.addPersonOrSystem("external_system_db", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 46:
                yy.addPersonOrSystem("external_system_queue", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 47:
                yy.addContainer("container", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 48:
                yy.addContainer("container_db", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 49:
                yy.addContainer("container_queue", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 50:
                yy.addContainer("external_container", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 51:
                yy.addContainer("external_container_db", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 52:
                yy.addContainer("external_container_queue", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 53:
                yy.addComponent("component", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 54:
                yy.addComponent("component_db", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 55:
                yy.addComponent("component_queue", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 56:
                yy.addComponent("external_component", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 57:
                yy.addComponent("external_component_db", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 58:
                yy.addComponent("external_component_queue", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 60:
                yy.addRel("rel", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 61:
                yy.addRel("birel", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 62:
                yy.addRel("rel_u", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 63:
                yy.addRel("rel_d", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 64:
                yy.addRel("rel_l", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 65:
                yy.addRel("rel_r", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 66:
                yy.addRel("rel_b", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 67:
                $$[$0].splice(0, 1);
                yy.addRel("rel", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 68:
                yy.updateElStyle("update_el_style", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 69:
                yy.updateRelStyle("update_rel_style", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 70:
                yy.updateLayoutConfig("update_layout_config", ...$$[$0]);
                this.$ = $$[$0];
                break;
              case 71:
                this.$ = [$$[$0]];
                break;
              case 72:
                $$[$0].unshift($$[$0 - 1]);
                this.$ = $$[$0];
                break;
              case 73:
              case 75:
                this.$ = $$[$0].trim();
                break;
              case 74:
                let kv = {};
                kv[$$[$0 - 1].trim()] = $$[$0].trim();
                this.$ = kv;
                break;
              case 76:
                this.$ = "";
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 7: [1, 6], 8: [1, 7], 9: [1, 8], 10: 4, 11: [1, 9], 15: [1, 10], 16: [1, 11], 17: [1, 12], 18: [1, 13] }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 7] }, { 1: [2, 3] }, { 1: [2, 4] }, { 1: [2, 5] }, { 1: [2, 6] }, { 12: [1, 14] }, { 12: [1, 15] }, { 12: [1, 16] }, { 12: [1, 17] }, { 12: [1, 18] }, { 13: 19, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 70, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 71, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 72, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 73, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 14: [1, 74] }, o2($VH, [2, 13], { 43: 23, 29: 49, 30: 61, 32: 62, 20: 75, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }), o2($VH, [2, 14]), o2($VI, [2, 16], { 12: [1, 76] }), o2($VH, [2, 36], { 12: [1, 77] }), o2($VJ, [2, 19]), o2($VJ, [2, 20]), { 25: [1, 78] }, { 27: [1, 79] }, o2($VJ, [2, 23]), { 35: 80, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 86, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 87, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 88, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 89, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 90, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 91, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 92, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 93, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 94, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 95, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 96, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 97, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 98, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 99, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 100, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 101, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 102, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 103, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 104, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, o2($VO, [2, 59]), { 35: 105, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 106, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 107, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 108, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 109, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 110, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 111, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 112, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 113, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 114, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 115, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 20: 116, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 12: [1, 118], 33: [1, 117] }, { 35: 119, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 120, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 121, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 122, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 123, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 124, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 125, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 14: [1, 126] }, { 14: [1, 127] }, { 14: [1, 128] }, { 14: [1, 129] }, { 1: [2, 8] }, o2($VH, [2, 15]), o2($VI, [2, 17], { 21: 22, 19: 130, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4 }), o2($VH, [2, 37], { 19: 20, 20: 21, 21: 22, 43: 23, 29: 49, 30: 61, 32: 62, 13: 131, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }), o2($VJ, [2, 21]), o2($VJ, [2, 22]), o2($VO, [2, 39]), o2($VP, [2, 71], { 75: 81, 35: 132, 76: $VK, 77: $VL, 79: $VM, 80: $VN }), o2($VQ, [2, 73]), { 78: [1, 133] }, o2($VQ, [2, 75]), o2($VQ, [2, 76]), o2($VO, [2, 40]), o2($VO, [2, 41]), o2($VO, [2, 42]), o2($VO, [2, 43]), o2($VO, [2, 44]), o2($VO, [2, 45]), o2($VO, [2, 46]), o2($VO, [2, 47]), o2($VO, [2, 48]), o2($VO, [2, 49]), o2($VO, [2, 50]), o2($VO, [2, 51]), o2($VO, [2, 52]), o2($VO, [2, 53]), o2($VO, [2, 54]), o2($VO, [2, 55]), o2($VO, [2, 56]), o2($VO, [2, 57]), o2($VO, [2, 58]), o2($VO, [2, 60]), o2($VO, [2, 61]), o2($VO, [2, 62]), o2($VO, [2, 63]), o2($VO, [2, 64]), o2($VO, [2, 65]), o2($VO, [2, 66]), o2($VO, [2, 67]), o2($VO, [2, 68]), o2($VO, [2, 69]), o2($VO, [2, 70]), { 31: 134, 42: [1, 135] }, { 12: [1, 136] }, { 33: [1, 137] }, o2($VR, [2, 28]), o2($VR, [2, 29]), o2($VR, [2, 30]), o2($VR, [2, 31]), o2($VR, [2, 32]), o2($VR, [2, 33]), o2($VR, [2, 34]), { 1: [2, 9] }, { 1: [2, 10] }, { 1: [2, 11] }, { 1: [2, 12] }, o2($VI, [2, 18]), o2($VH, [2, 38]), o2($VP, [2, 72]), o2($VQ, [2, 74]), o2($VO, [2, 24]), o2($VO, [2, 35]), o2($VS, [2, 25]), o2($VS, [2, 26], { 12: [1, 138] }), o2($VS, [2, 27])],
          defaultActions: { 2: [2, 1], 3: [2, 2], 4: [2, 7], 5: [2, 3], 6: [2, 4], 7: [2, 5], 8: [2, 6], 74: [2, 8], 126: [2, 9], 127: [2, 10], 128: [2, 11], 129: [2, 12] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: {},
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  return 6;
                  break;
                case 1:
                  return 7;
                  break;
                case 2:
                  return 8;
                  break;
                case 3:
                  return 9;
                  break;
                case 4:
                  return 22;
                  break;
                case 5:
                  return 23;
                  break;
                case 6:
                  this.begin("acc_title");
                  return 24;
                  break;
                case 7:
                  this.popState();
                  return "acc_title_value";
                  break;
                case 8:
                  this.begin("acc_descr");
                  return 26;
                  break;
                case 9:
                  this.popState();
                  return "acc_descr_value";
                  break;
                case 10:
                  this.begin("acc_descr_multiline");
                  break;
                case 11:
                  this.popState();
                  break;
                case 12:
                  return "acc_descr_multiline_value";
                  break;
                case 13:
                  break;
                case 14:
                  c;
                  break;
                case 15:
                  return 12;
                  break;
                case 16:
                  break;
                case 17:
                  return 11;
                  break;
                case 18:
                  return 15;
                  break;
                case 19:
                  return 16;
                  break;
                case 20:
                  return 17;
                  break;
                case 21:
                  return 18;
                  break;
                case 22:
                  this.begin("person_ext");
                  return 45;
                  break;
                case 23:
                  this.begin("person");
                  return 44;
                  break;
                case 24:
                  this.begin("system_ext_queue");
                  return 51;
                  break;
                case 25:
                  this.begin("system_ext_db");
                  return 50;
                  break;
                case 26:
                  this.begin("system_ext");
                  return 49;
                  break;
                case 27:
                  this.begin("system_queue");
                  return 48;
                  break;
                case 28:
                  this.begin("system_db");
                  return 47;
                  break;
                case 29:
                  this.begin("system");
                  return 46;
                  break;
                case 30:
                  this.begin("boundary");
                  return 37;
                  break;
                case 31:
                  this.begin("enterprise_boundary");
                  return 34;
                  break;
                case 32:
                  this.begin("system_boundary");
                  return 36;
                  break;
                case 33:
                  this.begin("container_ext_queue");
                  return 57;
                  break;
                case 34:
                  this.begin("container_ext_db");
                  return 56;
                  break;
                case 35:
                  this.begin("container_ext");
                  return 55;
                  break;
                case 36:
                  this.begin("container_queue");
                  return 54;
                  break;
                case 37:
                  this.begin("container_db");
                  return 53;
                  break;
                case 38:
                  this.begin("container");
                  return 52;
                  break;
                case 39:
                  this.begin("container_boundary");
                  return 38;
                  break;
                case 40:
                  this.begin("component_ext_queue");
                  return 63;
                  break;
                case 41:
                  this.begin("component_ext_db");
                  return 62;
                  break;
                case 42:
                  this.begin("component_ext");
                  return 61;
                  break;
                case 43:
                  this.begin("component_queue");
                  return 60;
                  break;
                case 44:
                  this.begin("component_db");
                  return 59;
                  break;
                case 45:
                  this.begin("component");
                  return 58;
                  break;
                case 46:
                  this.begin("node");
                  return 39;
                  break;
                case 47:
                  this.begin("node");
                  return 39;
                  break;
                case 48:
                  this.begin("node_l");
                  return 40;
                  break;
                case 49:
                  this.begin("node_r");
                  return 41;
                  break;
                case 50:
                  this.begin("rel");
                  return 64;
                  break;
                case 51:
                  this.begin("birel");
                  return 65;
                  break;
                case 52:
                  this.begin("rel_u");
                  return 66;
                  break;
                case 53:
                  this.begin("rel_u");
                  return 66;
                  break;
                case 54:
                  this.begin("rel_d");
                  return 67;
                  break;
                case 55:
                  this.begin("rel_d");
                  return 67;
                  break;
                case 56:
                  this.begin("rel_l");
                  return 68;
                  break;
                case 57:
                  this.begin("rel_l");
                  return 68;
                  break;
                case 58:
                  this.begin("rel_r");
                  return 69;
                  break;
                case 59:
                  this.begin("rel_r");
                  return 69;
                  break;
                case 60:
                  this.begin("rel_b");
                  return 70;
                  break;
                case 61:
                  this.begin("rel_index");
                  return 71;
                  break;
                case 62:
                  this.begin("update_el_style");
                  return 72;
                  break;
                case 63:
                  this.begin("update_rel_style");
                  return 73;
                  break;
                case 64:
                  this.begin("update_layout_config");
                  return 74;
                  break;
                case 65:
                  return "EOF_IN_STRUCT";
                  break;
                case 66:
                  this.begin("attribute");
                  return "ATTRIBUTE_EMPTY";
                  break;
                case 67:
                  this.begin("attribute");
                  break;
                case 68:
                  this.popState();
                  this.popState();
                  break;
                case 69:
                  return 80;
                  break;
                case 70:
                  break;
                case 71:
                  return 80;
                  break;
                case 72:
                  this.begin("string");
                  break;
                case 73:
                  this.popState();
                  break;
                case 74:
                  return "STR";
                  break;
                case 75:
                  this.begin("string_kv");
                  break;
                case 76:
                  this.begin("string_kv_key");
                  return "STR_KEY";
                  break;
                case 77:
                  this.popState();
                  this.begin("string_kv_value");
                  break;
                case 78:
                  return "STR_VALUE";
                  break;
                case 79:
                  this.popState();
                  this.popState();
                  break;
                case 80:
                  return "STR";
                  break;
                case 81:
                  return "LBRACE";
                  break;
                case 82:
                  return "RBRACE";
                  break;
                case 83:
                  return "SPACE";
                  break;
                case 84:
                  return "EOL";
                  break;
                case 85:
                  return 14;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:title\s[^#\n;]+)/, /^(?:accDescription\s[^#\n;]+)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/, /^(?:%%[^\n]*(\r?\n)*)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:C4Context\b)/, /^(?:C4Container\b)/, /^(?:C4Component\b)/, /^(?:C4Dynamic\b)/, /^(?:C4Deployment\b)/, /^(?:Person_Ext\b)/, /^(?:Person\b)/, /^(?:SystemQueue_Ext\b)/, /^(?:SystemDb_Ext\b)/, /^(?:System_Ext\b)/, /^(?:SystemQueue\b)/, /^(?:SystemDb\b)/, /^(?:System\b)/, /^(?:Boundary\b)/, /^(?:Enterprise_Boundary\b)/, /^(?:System_Boundary\b)/, /^(?:ContainerQueue_Ext\b)/, /^(?:ContainerDb_Ext\b)/, /^(?:Container_Ext\b)/, /^(?:ContainerQueue\b)/, /^(?:ContainerDb\b)/, /^(?:Container\b)/, /^(?:Container_Boundary\b)/, /^(?:ComponentQueue_Ext\b)/, /^(?:ComponentDb_Ext\b)/, /^(?:Component_Ext\b)/, /^(?:ComponentQueue\b)/, /^(?:ComponentDb\b)/, /^(?:Component\b)/, /^(?:Deployment_Node\b)/, /^(?:Node\b)/, /^(?:Node_L\b)/, /^(?:Node_R\b)/, /^(?:Rel\b)/, /^(?:BiRel\b)/, /^(?:Rel_Up\b)/, /^(?:Rel_U\b)/, /^(?:Rel_Down\b)/, /^(?:Rel_D\b)/, /^(?:Rel_Left\b)/, /^(?:Rel_L\b)/, /^(?:Rel_Right\b)/, /^(?:Rel_R\b)/, /^(?:Rel_Back\b)/, /^(?:RelIndex\b)/, /^(?:UpdateElementStyle\b)/, /^(?:UpdateRelStyle\b)/, /^(?:UpdateLayoutConfig\b)/, /^(?:$)/, /^(?:[(][ ]*[,])/, /^(?:[(])/, /^(?:[)])/, /^(?:,,)/, /^(?:,)/, /^(?:[ ]*["]["])/, /^(?:[ ]*["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:[ ]*[\$])/, /^(?:[^=]*)/, /^(?:[=][ ]*["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:[^,]+)/, /^(?:\{)/, /^(?:\})/, /^(?:[\s]+)/, /^(?:[\n\r]+)/, /^(?:$)/],
            conditions: { "acc_descr_multiline": { "rules": [11, 12], "inclusive": false }, "acc_descr": { "rules": [9], "inclusive": false }, "acc_title": { "rules": [7], "inclusive": false }, "string_kv_value": { "rules": [78, 79], "inclusive": false }, "string_kv_key": { "rules": [77], "inclusive": false }, "string_kv": { "rules": [76], "inclusive": false }, "string": { "rules": [73, 74], "inclusive": false }, "attribute": { "rules": [68, 69, 70, 71, 72, 75, 80], "inclusive": false }, "update_layout_config": { "rules": [65, 66, 67, 68], "inclusive": false }, "update_rel_style": { "rules": [65, 66, 67, 68], "inclusive": false }, "update_el_style": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_b": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_r": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_l": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_d": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_u": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_bi": { "rules": [], "inclusive": false }, "rel": { "rules": [65, 66, 67, 68], "inclusive": false }, "node_r": { "rules": [65, 66, 67, 68], "inclusive": false }, "node_l": { "rules": [65, 66, 67, 68], "inclusive": false }, "node": { "rules": [65, 66, 67, 68], "inclusive": false }, "index": { "rules": [], "inclusive": false }, "rel_index": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_ext_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_ext_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_ext": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "component": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_boundary": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_ext_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_ext_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_ext": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "container": { "rules": [65, 66, 67, 68], "inclusive": false }, "birel": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_boundary": { "rules": [65, 66, 67, 68], "inclusive": false }, "enterprise_boundary": { "rules": [65, 66, 67, 68], "inclusive": false }, "boundary": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_ext_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_ext_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_ext": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "system": { "rules": [65, 66, 67, 68], "inclusive": false }, "person_ext": { "rules": [65, 66, 67, 68], "inclusive": false }, "person": { "rules": [65, 66, 67, 68], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 81, 82, 83, 84, 85], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser.parser = parser;
      c4Diagram_default = parser;
    }
  });

  // src/setupGraphViewbox.js
  var d3Attrs, calculateSvgSizeAttrs, configureSvgSize, setupGraphViewbox;
  var init_setupGraphViewbox = __esm({
    "src/setupGraphViewbox.js"() {
      "use strict";
      init_logger();
      d3Attrs = /* @__PURE__ */ __name(function(d3Elem, attrs) {
        for (let attr of attrs) {
          d3Elem.attr(attr[0], attr[1]);
        }
      }, "d3Attrs");
      calculateSvgSizeAttrs = /* @__PURE__ */ __name(function(height2, width3, useMaxWidth) {
        let attrs = /* @__PURE__ */ new Map();
        if (useMaxWidth) {
          attrs.set("width", "100%");
          attrs.set("style", `max-width: ${width3}px;`);
        } else {
          attrs.set("height", height2);
          attrs.set("width", width3);
        }
        return attrs;
      }, "calculateSvgSizeAttrs");
      configureSvgSize = /* @__PURE__ */ __name(function(svgElem, height2, width3, useMaxWidth) {
        const attrs = calculateSvgSizeAttrs(height2, width3, useMaxWidth);
        d3Attrs(svgElem, attrs);
      }, "configureSvgSize");
      setupGraphViewbox = /* @__PURE__ */ __name(function(graph, svgElem, padding2, useMaxWidth) {
        const svgBounds = svgElem.node().getBBox();
        const sWidth = svgBounds.width;
        const sHeight = svgBounds.height;
        log.info(`SVG bounds: ${sWidth}x${sHeight}`, svgBounds);
        let width3 = 0;
        let height2 = 0;
        log.info(`Graph bounds: ${width3}x${height2}`, graph);
        width3 = sWidth + padding2 * 2;
        height2 = sHeight + padding2 * 2;
        log.info(`Calculated bounds: ${width3}x${height2}`);
        configureSvgSize(svgElem, height2, width3, useMaxWidth);
        const vBox = `${svgBounds.x - padding2} ${svgBounds.y - padding2} ${svgBounds.width + 2 * padding2} ${svgBounds.height + 2 * padding2}`;
        svgElem.attr("viewBox", vBox);
      }, "setupGraphViewbox");
    }
  });

  // src/styles.ts
  var themes, getStyles, addStylesForDiagram, styles_default;
  var init_styles = __esm({
    "src/styles.ts"() {
      "use strict";
      init_logger();
      themes = {};
      getStyles = /* @__PURE__ */ __name((type3, userStyles, options2, svgId) => {
        let diagramStyles = "";
        if (type3 in themes && themes[type3]) {
          diagramStyles = themes[type3]({ ...options2, svgId });
        } else {
          log.warn(`No theme found for ${type3}`);
        }
        return ` & {
    font-family: ${options2.fontFamily};
    font-size: ${options2.fontSize};
    fill: ${options2.textColor}
  }
  @keyframes edge-animation-frame {
    from {
      stroke-dashoffset: 0;
    }
  }
  @keyframes dash {
    to {
      stroke-dashoffset: 0;
    }
  }
  & .edge-animation-slow {
    stroke-dasharray: 9,5 !important;
    stroke-dashoffset: 900;
    animation: dash 50s linear infinite;
    stroke-linecap: round;
  }
  & .edge-animation-fast {
    stroke-dasharray: 9,5 !important;
    stroke-dashoffset: 900;
    animation: dash 20s linear infinite;
    stroke-linecap: round;
  }
  /* Classes common for multiple diagrams */

  & .error-icon {
    fill: ${options2.errorBkgColor};
  }
  & .error-text {
    fill: ${options2.errorTextColor};
    stroke: ${options2.errorTextColor};
  }

  & .edge-thickness-normal {
    stroke-width: ${options2.strokeWidth ?? 1}px;
  }
  & .edge-thickness-thick {
    stroke-width: 3.5px
  }
  & .edge-pattern-solid {
    stroke-dasharray: 0;
  }
  & .edge-thickness-invisible {
    stroke-width: 0;
    fill: none;
  }
  & .edge-pattern-dashed{
    stroke-dasharray: 3;
  }
  .edge-pattern-dotted {
    stroke-dasharray: 2;
  }

  & .marker {
    fill: ${options2.lineColor};
    stroke: ${options2.lineColor};
  }
  & .marker.cross {
    stroke: ${options2.lineColor};
  }

  & svg {
    font-family: ${options2.fontFamily};
    font-size: ${options2.fontSize};
  }
   & p {
    margin: 0
   }

  ${diagramStyles}
  .node .neo-node {
    stroke: ${options2.nodeBorder};
  }

  [data-look="neo"].node rect, [data-look="neo"].cluster rect, [data-look="neo"].node polygon {
    stroke: ${options2.useGradient ? "url(" + svgId + "-gradient)" : options2.nodeBorder};
    filter: ${options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none"};
  }


  [data-look="neo"].node path {
    stroke: ${options2.useGradient ? "url(" + svgId + "-gradient)" : options2.nodeBorder};
    stroke-width: ${options2.strokeWidth ?? 1}px;
  }

  [data-look="neo"].node .outer-path {
    filter: ${options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none"};
  }

  [data-look="neo"].node .neo-line path {
    stroke: ${options2.nodeBorder};
    filter: none;
  }

  [data-look="neo"].node circle{
    stroke: ${options2.useGradient ? "url(" + svgId + "-gradient)" : options2.nodeBorder};
    filter: ${options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none"};
  }

  [data-look="neo"].node circle .state-start{
    fill: #000000;
  }

  [data-look="neo"].icon-shape .icon {
    fill: ${options2.useGradient ? "url(" + svgId + "-gradient)" : options2.nodeBorder};
    filter: ${options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none"};
  }

    [data-look="neo"].icon-shape .icon-neo path {
    stroke: ${options2.useGradient ? "url(" + svgId + "-gradient)" : options2.nodeBorder};
    filter: ${options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none"};
  }

  ${userStyles}
`;
      }, "getStyles");
      addStylesForDiagram = /* @__PURE__ */ __name((type3, diagramTheme) => {
        if (diagramTheme !== void 0) {
          themes[type3] = diagramTheme;
        }
      }, "addStylesForDiagram");
      styles_default = getStyles;
    }
  });

  // src/diagrams/common/commonDb.ts
  var commonDb_exports = {};
  __export(commonDb_exports, {
    clear: () => clear,
    getAccDescription: () => getAccDescription,
    getAccTitle: () => getAccTitle,
    getDiagramTitle: () => getDiagramTitle,
    setAccDescription: () => setAccDescription,
    setAccTitle: () => setAccTitle,
    setDiagramTitle: () => setDiagramTitle
  });
  var accTitle, diagramTitle, accDescription, sanitizeText2, clear, setAccTitle, getAccTitle, setAccDescription, getAccDescription, setDiagramTitle, getDiagramTitle;
  var init_commonDb = __esm({
    "src/diagrams/common/commonDb.ts"() {
      "use strict";
      init_common();
      init_config();
      accTitle = "";
      diagramTitle = "";
      accDescription = "";
      sanitizeText2 = /* @__PURE__ */ __name((txt) => sanitizeText(txt, getConfig()), "sanitizeText");
      clear = /* @__PURE__ */ __name(() => {
        accTitle = "";
        accDescription = "";
        diagramTitle = "";
      }, "clear");
      setAccTitle = /* @__PURE__ */ __name((txt) => {
        accTitle = sanitizeText2(txt).replace(/^\s+/g, "");
      }, "setAccTitle");
      getAccTitle = /* @__PURE__ */ __name(() => accTitle, "getAccTitle");
      setAccDescription = /* @__PURE__ */ __name((txt) => {
        accDescription = sanitizeText2(txt).replace(/\n\s+/g, "\n");
      }, "setAccDescription");
      getAccDescription = /* @__PURE__ */ __name(() => accDescription, "getAccDescription");
      setDiagramTitle = /* @__PURE__ */ __name((txt) => {
        diagramTitle = sanitizeText2(txt);
      }, "setDiagramTitle");
      getDiagramTitle = /* @__PURE__ */ __name(() => diagramTitle, "getDiagramTitle");
    }
  });

  // src/diagram-api/diagramAPI.ts
  var log2, setLogLevel2, getConfig2, setConfig2, defaultConfig2, sanitizeText3, setupGraphViewbox2, getCommonDb, diagrams, registerDiagram, getDiagram, DiagramNotFoundError;
  var init_diagramAPI = __esm({
    "src/diagram-api/diagramAPI.ts"() {
      "use strict";
      init_detectType();
      init_logger();
      init_config();
      init_common();
      init_setupGraphViewbox();
      init_styles();
      init_commonDb();
      log2 = log;
      setLogLevel2 = setLogLevel;
      getConfig2 = getConfig;
      setConfig2 = setConfig;
      defaultConfig2 = defaultConfig;
      sanitizeText3 = /* @__PURE__ */ __name((text4) => sanitizeText(text4, getConfig2()), "sanitizeText");
      setupGraphViewbox2 = setupGraphViewbox;
      getCommonDb = /* @__PURE__ */ __name(() => {
        return commonDb_exports;
      }, "getCommonDb");
      diagrams = {};
      registerDiagram = /* @__PURE__ */ __name((id34, diagram31, detector32) => {
        if (diagrams[id34]) {
          log2.warn(`Diagram with id ${id34} already registered. Overwriting.`);
        }
        diagrams[id34] = diagram31;
        if (detector32) {
          addDetector(id34, detector32);
        }
        addStylesForDiagram(id34, diagram31.styles);
        diagram31.injectUtils?.(
          log2,
          setLogLevel2,
          getConfig2,
          sanitizeText3,
          setupGraphViewbox2,
          getCommonDb(),
          () => {
          }
        );
      }, "registerDiagram");
      getDiagram = /* @__PURE__ */ __name((name) => {
        if (name in diagrams) {
          return diagrams[name];
        }
        throw new DiagramNotFoundError(name);
      }, "getDiagram");
      DiagramNotFoundError = class extends Error {
        static {
          __name(this, "DiagramNotFoundError");
        }
        constructor(name) {
          super(`Diagram ${name} not found.`);
        }
      };
    }
  });

  // src/diagrams/c4/c4Db.js
  var c4ShapeArray, boundaryParseStack, currentBoundaryParse, parentBoundaryParse, boundaries, rels, title, wrapEnabled, c4ShapeInRow, c4BoundaryInRow, c4Type, getC4Type, setC4Type, addRel, addPersonOrSystem, addContainer, addComponent, addPersonOrSystemBoundary, addContainerBoundary, addDeploymentNode, popBoundaryParseStack, updateElStyle, updateRelStyle, updateLayoutConfig, getC4ShapeInRow, getC4BoundaryInRow, getCurrentBoundaryParse, getParentBoundaryParse, getC4ShapeArray, getC4Shape, getC4ShapeKeys, getBoundaries, getBoundarys, getRels, getTitle, setWrap, autoWrap, clear2, LINETYPE, ARROWTYPE, PLACEMENT, setTitle, c4Db_default;
  var init_c4Db = __esm({
    "src/diagrams/c4/c4Db.js"() {
      "use strict";
      init_diagramAPI();
      init_common();
      init_commonDb();
      c4ShapeArray = [];
      boundaryParseStack = [""];
      currentBoundaryParse = "global";
      parentBoundaryParse = "";
      boundaries = [
        {
          alias: "global",
          label: { text: "global" },
          type: { text: "global" },
          tags: null,
          link: null,
          parentBoundary: ""
        }
      ];
      rels = [];
      title = "";
      wrapEnabled = false;
      c4ShapeInRow = 4;
      c4BoundaryInRow = 2;
      getC4Type = /* @__PURE__ */ __name(function() {
        return c4Type;
      }, "getC4Type");
      setC4Type = /* @__PURE__ */ __name(function(c4TypeParam) {
        let sanitizedText = sanitizeText(c4TypeParam, getConfig2());
        c4Type = sanitizedText;
      }, "setC4Type");
      addRel = /* @__PURE__ */ __name(function(type3, from2, to, label, techn, descr, sprite, tags2, link2) {
        if (type3 === void 0 || type3 === null || from2 === void 0 || from2 === null || to === void 0 || to === null || label === void 0 || label === null) {
          return;
        }
        let rel2 = {};
        const old = rels.find((rel3) => rel3.from === from2 && rel3.to === to);
        if (old) {
          rel2 = old;
        } else {
          rels.push(rel2);
        }
        rel2.type = type3;
        rel2.from = from2;
        rel2.to = to;
        rel2.label = { text: label };
        if (techn === void 0 || techn === null) {
          rel2.techn = { text: "" };
        } else {
          if (typeof techn === "object") {
            let [key, value2] = Object.entries(techn)[0];
            rel2[key] = { text: value2 };
          } else {
            rel2.techn = { text: techn };
          }
        }
        if (descr === void 0 || descr === null) {
          rel2.descr = { text: "" };
        } else {
          if (typeof descr === "object") {
            let [key, value2] = Object.entries(descr)[0];
            rel2[key] = { text: value2 };
          } else {
            rel2.descr = { text: descr };
          }
        }
        if (typeof sprite === "object") {
          let [key, value2] = Object.entries(sprite)[0];
          rel2[key] = value2;
        } else {
          rel2.sprite = sprite;
        }
        if (typeof tags2 === "object") {
          let [key, value2] = Object.entries(tags2)[0];
          rel2[key] = value2;
        } else {
          rel2.tags = tags2;
        }
        if (typeof link2 === "object") {
          let [key, value2] = Object.entries(link2)[0];
          rel2[key] = value2;
        } else {
          rel2.link = link2;
        }
        rel2.wrap = autoWrap();
      }, "addRel");
      addPersonOrSystem = /* @__PURE__ */ __name(function(typeC4Shape, alias, label, descr, sprite, tags2, link2) {
        if (alias === null || label === null) {
          return;
        }
        let personOrSystem = {};
        const old = c4ShapeArray.find((personOrSystem2) => personOrSystem2.alias === alias);
        if (old && alias === old.alias) {
          personOrSystem = old;
        } else {
          personOrSystem.alias = alias;
          c4ShapeArray.push(personOrSystem);
        }
        if (label === void 0 || label === null) {
          personOrSystem.label = { text: "" };
        } else {
          personOrSystem.label = { text: label };
        }
        if (descr === void 0 || descr === null) {
          personOrSystem.descr = { text: "" };
        } else {
          if (typeof descr === "object") {
            let [key, value2] = Object.entries(descr)[0];
            personOrSystem[key] = { text: value2 };
          } else {
            personOrSystem.descr = { text: descr };
          }
        }
        if (typeof sprite === "object") {
          let [key, value2] = Object.entries(sprite)[0];
          personOrSystem[key] = value2;
        } else {
          personOrSystem.sprite = sprite;
        }
        if (typeof tags2 === "object") {
          let [key, value2] = Object.entries(tags2)[0];
          personOrSystem[key] = value2;
        } else {
          personOrSystem.tags = tags2;
        }
        if (typeof link2 === "object") {
          let [key, value2] = Object.entries(link2)[0];
          personOrSystem[key] = value2;
        } else {
          personOrSystem.link = link2;
        }
        personOrSystem.typeC4Shape = { text: typeC4Shape };
        personOrSystem.parentBoundary = currentBoundaryParse;
        personOrSystem.wrap = autoWrap();
      }, "addPersonOrSystem");
      addContainer = /* @__PURE__ */ __name(function(typeC4Shape, alias, label, techn, descr, sprite, tags2, link2) {
        if (alias === null || label === null) {
          return;
        }
        let container2 = {};
        const old = c4ShapeArray.find((container3) => container3.alias === alias);
        if (old && alias === old.alias) {
          container2 = old;
        } else {
          container2.alias = alias;
          c4ShapeArray.push(container2);
        }
        if (label === void 0 || label === null) {
          container2.label = { text: "" };
        } else {
          container2.label = { text: label };
        }
        if (techn === void 0 || techn === null) {
          container2.techn = { text: "" };
        } else {
          if (typeof techn === "object") {
            let [key, value2] = Object.entries(techn)[0];
            container2[key] = { text: value2 };
          } else {
            container2.techn = { text: techn };
          }
        }
        if (descr === void 0 || descr === null) {
          container2.descr = { text: "" };
        } else {
          if (typeof descr === "object") {
            let [key, value2] = Object.entries(descr)[0];
            container2[key] = { text: value2 };
          } else {
            container2.descr = { text: descr };
          }
        }
        if (typeof sprite === "object") {
          let [key, value2] = Object.entries(sprite)[0];
          container2[key] = value2;
        } else {
          container2.sprite = sprite;
        }
        if (typeof tags2 === "object") {
          let [key, value2] = Object.entries(tags2)[0];
          container2[key] = value2;
        } else {
          container2.tags = tags2;
        }
        if (typeof link2 === "object") {
          let [key, value2] = Object.entries(link2)[0];
          container2[key] = value2;
        } else {
          container2.link = link2;
        }
        container2.wrap = autoWrap();
        container2.typeC4Shape = { text: typeC4Shape };
        container2.parentBoundary = currentBoundaryParse;
      }, "addContainer");
      addComponent = /* @__PURE__ */ __name(function(typeC4Shape, alias, label, techn, descr, sprite, tags2, link2) {
        if (alias === null || label === null) {
          return;
        }
        let component2 = {};
        const old = c4ShapeArray.find((component3) => component3.alias === alias);
        if (old && alias === old.alias) {
          component2 = old;
        } else {
          component2.alias = alias;
          c4ShapeArray.push(component2);
        }
        if (label === void 0 || label === null) {
          component2.label = { text: "" };
        } else {
          component2.label = { text: label };
        }
        if (techn === void 0 || techn === null) {
          component2.techn = { text: "" };
        } else {
          if (typeof techn === "object") {
            let [key, value2] = Object.entries(techn)[0];
            component2[key] = { text: value2 };
          } else {
            component2.techn = { text: techn };
          }
        }
        if (descr === void 0 || descr === null) {
          component2.descr = { text: "" };
        } else {
          if (typeof descr === "object") {
            let [key, value2] = Object.entries(descr)[0];
            component2[key] = { text: value2 };
          } else {
            component2.descr = { text: descr };
          }
        }
        if (typeof sprite === "object") {
          let [key, value2] = Object.entries(sprite)[0];
          component2[key] = value2;
        } else {
          component2.sprite = sprite;
        }
        if (typeof tags2 === "object") {
          let [key, value2] = Object.entries(tags2)[0];
          component2[key] = value2;
        } else {
          component2.tags = tags2;
        }
        if (typeof link2 === "object") {
          let [key, value2] = Object.entries(link2)[0];
          component2[key] = value2;
        } else {
          component2.link = link2;
        }
        component2.wrap = autoWrap();
        component2.typeC4Shape = { text: typeC4Shape };
        component2.parentBoundary = currentBoundaryParse;
      }, "addComponent");
      addPersonOrSystemBoundary = /* @__PURE__ */ __name(function(alias, label, type3, tags2, link2) {
        if (alias === null || label === null) {
          return;
        }
        let boundary = {};
        const old = boundaries.find((boundary2) => boundary2.alias === alias);
        if (old && alias === old.alias) {
          boundary = old;
        } else {
          boundary.alias = alias;
          boundaries.push(boundary);
        }
        if (label === void 0 || label === null) {
          boundary.label = { text: "" };
        } else {
          boundary.label = { text: label };
        }
        if (type3 === void 0 || type3 === null) {
          boundary.type = { text: "system" };
        } else {
          if (typeof type3 === "object") {
            let [key, value2] = Object.entries(type3)[0];
            boundary[key] = { text: value2 };
          } else {
            boundary.type = { text: type3 };
          }
        }
        if (typeof tags2 === "object") {
          let [key, value2] = Object.entries(tags2)[0];
          boundary[key] = value2;
        } else {
          boundary.tags = tags2;
        }
        if (typeof link2 === "object") {
          let [key, value2] = Object.entries(link2)[0];
          boundary[key] = value2;
        } else {
          boundary.link = link2;
        }
        boundary.parentBoundary = currentBoundaryParse;
        boundary.wrap = autoWrap();
        parentBoundaryParse = currentBoundaryParse;
        currentBoundaryParse = alias;
        boundaryParseStack.push(parentBoundaryParse);
      }, "addPersonOrSystemBoundary");
      addContainerBoundary = /* @__PURE__ */ __name(function(alias, label, type3, tags2, link2) {
        if (alias === null || label === null) {
          return;
        }
        let boundary = {};
        const old = boundaries.find((boundary2) => boundary2.alias === alias);
        if (old && alias === old.alias) {
          boundary = old;
        } else {
          boundary.alias = alias;
          boundaries.push(boundary);
        }
        if (label === void 0 || label === null) {
          boundary.label = { text: "" };
        } else {
          boundary.label = { text: label };
        }
        if (type3 === void 0 || type3 === null) {
          boundary.type = { text: "container" };
        } else {
          if (typeof type3 === "object") {
            let [key, value2] = Object.entries(type3)[0];
            boundary[key] = { text: value2 };
          } else {
            boundary.type = { text: type3 };
          }
        }
        if (typeof tags2 === "object") {
          let [key, value2] = Object.entries(tags2)[0];
          boundary[key] = value2;
        } else {
          boundary.tags = tags2;
        }
        if (typeof link2 === "object") {
          let [key, value2] = Object.entries(link2)[0];
          boundary[key] = value2;
        } else {
          boundary.link = link2;
        }
        boundary.parentBoundary = currentBoundaryParse;
        boundary.wrap = autoWrap();
        parentBoundaryParse = currentBoundaryParse;
        currentBoundaryParse = alias;
        boundaryParseStack.push(parentBoundaryParse);
      }, "addContainerBoundary");
      addDeploymentNode = /* @__PURE__ */ __name(function(nodeType3, alias, label, type3, descr, sprite, tags2, link2) {
        if (alias === null || label === null) {
          return;
        }
        let boundary = {};
        const old = boundaries.find((boundary2) => boundary2.alias === alias);
        if (old && alias === old.alias) {
          boundary = old;
        } else {
          boundary.alias = alias;
          boundaries.push(boundary);
        }
        if (label === void 0 || label === null) {
          boundary.label = { text: "" };
        } else {
          boundary.label = { text: label };
        }
        if (type3 === void 0 || type3 === null) {
          boundary.type = { text: "node" };
        } else {
          if (typeof type3 === "object") {
            let [key, value2] = Object.entries(type3)[0];
            boundary[key] = { text: value2 };
          } else {
            boundary.type = { text: type3 };
          }
        }
        if (descr === void 0 || descr === null) {
          boundary.descr = { text: "" };
        } else {
          if (typeof descr === "object") {
            let [key, value2] = Object.entries(descr)[0];
            boundary[key] = { text: value2 };
          } else {
            boundary.descr = { text: descr };
          }
        }
        if (typeof tags2 === "object") {
          let [key, value2] = Object.entries(tags2)[0];
          boundary[key] = value2;
        } else {
          boundary.tags = tags2;
        }
        if (typeof link2 === "object") {
          let [key, value2] = Object.entries(link2)[0];
          boundary[key] = value2;
        } else {
          boundary.link = link2;
        }
        boundary.nodeType = nodeType3;
        boundary.parentBoundary = currentBoundaryParse;
        boundary.wrap = autoWrap();
        parentBoundaryParse = currentBoundaryParse;
        currentBoundaryParse = alias;
        boundaryParseStack.push(parentBoundaryParse);
      }, "addDeploymentNode");
      popBoundaryParseStack = /* @__PURE__ */ __name(function() {
        currentBoundaryParse = parentBoundaryParse;
        boundaryParseStack.pop();
        parentBoundaryParse = boundaryParseStack.pop();
        boundaryParseStack.push(parentBoundaryParse);
      }, "popBoundaryParseStack");
      updateElStyle = /* @__PURE__ */ __name(function(typeC4Shape, elementName, bgColor, fontColor, borderColor, shadowing, shape, sprite, techn, legendText, legendSprite) {
        let old = c4ShapeArray.find((element3) => element3.alias === elementName);
        if (old === void 0) {
          old = boundaries.find((element3) => element3.alias === elementName);
          if (old === void 0) {
            return;
          }
        }
        if (bgColor !== void 0 && bgColor !== null) {
          if (typeof bgColor === "object") {
            let [key, value2] = Object.entries(bgColor)[0];
            old[key] = value2;
          } else {
            old.bgColor = bgColor;
          }
        }
        if (fontColor !== void 0 && fontColor !== null) {
          if (typeof fontColor === "object") {
            let [key, value2] = Object.entries(fontColor)[0];
            old[key] = value2;
          } else {
            old.fontColor = fontColor;
          }
        }
        if (borderColor !== void 0 && borderColor !== null) {
          if (typeof borderColor === "object") {
            let [key, value2] = Object.entries(borderColor)[0];
            old[key] = value2;
          } else {
            old.borderColor = borderColor;
          }
        }
        if (shadowing !== void 0 && shadowing !== null) {
          if (typeof shadowing === "object") {
            let [key, value2] = Object.entries(shadowing)[0];
            old[key] = value2;
          } else {
            old.shadowing = shadowing;
          }
        }
        if (shape !== void 0 && shape !== null) {
          if (typeof shape === "object") {
            let [key, value2] = Object.entries(shape)[0];
            old[key] = value2;
          } else {
            old.shape = shape;
          }
        }
        if (sprite !== void 0 && sprite !== null) {
          if (typeof sprite === "object") {
            let [key, value2] = Object.entries(sprite)[0];
            old[key] = value2;
          } else {
            old.sprite = sprite;
          }
        }
        if (techn !== void 0 && techn !== null) {
          if (typeof techn === "object") {
            let [key, value2] = Object.entries(techn)[0];
            old[key] = value2;
          } else {
            old.techn = techn;
          }
        }
        if (legendText !== void 0 && legendText !== null) {
          if (typeof legendText === "object") {
            let [key, value2] = Object.entries(legendText)[0];
            old[key] = value2;
          } else {
            old.legendText = legendText;
          }
        }
        if (legendSprite !== void 0 && legendSprite !== null) {
          if (typeof legendSprite === "object") {
            let [key, value2] = Object.entries(legendSprite)[0];
            old[key] = value2;
          } else {
            old.legendSprite = legendSprite;
          }
        }
      }, "updateElStyle");
      updateRelStyle = /* @__PURE__ */ __name(function(typeC4Shape, from2, to, textColor, lineColor, offsetX, offsetY) {
        const old = rels.find((rel2) => rel2.from === from2 && rel2.to === to);
        if (old === void 0) {
          return;
        }
        if (textColor !== void 0 && textColor !== null) {
          if (typeof textColor === "object") {
            let [key, value2] = Object.entries(textColor)[0];
            old[key] = value2;
          } else {
            old.textColor = textColor;
          }
        }
        if (lineColor !== void 0 && lineColor !== null) {
          if (typeof lineColor === "object") {
            let [key, value2] = Object.entries(lineColor)[0];
            old[key] = value2;
          } else {
            old.lineColor = lineColor;
          }
        }
        if (offsetX !== void 0 && offsetX !== null) {
          if (typeof offsetX === "object") {
            let [key, value2] = Object.entries(offsetX)[0];
            old[key] = parseInt(value2);
          } else {
            old.offsetX = parseInt(offsetX);
          }
        }
        if (offsetY !== void 0 && offsetY !== null) {
          if (typeof offsetY === "object") {
            let [key, value2] = Object.entries(offsetY)[0];
            old[key] = parseInt(value2);
          } else {
            old.offsetY = parseInt(offsetY);
          }
        }
      }, "updateRelStyle");
      updateLayoutConfig = /* @__PURE__ */ __name(function(typeC4Shape, c4ShapeInRowParam, c4BoundaryInRowParam) {
        let c4ShapeInRowValue = c4ShapeInRow;
        let c4BoundaryInRowValue = c4BoundaryInRow;
        if (typeof c4ShapeInRowParam === "object") {
          const value2 = Object.values(c4ShapeInRowParam)[0];
          c4ShapeInRowValue = parseInt(value2);
        } else {
          c4ShapeInRowValue = parseInt(c4ShapeInRowParam);
        }
        if (typeof c4BoundaryInRowParam === "object") {
          const value2 = Object.values(c4BoundaryInRowParam)[0];
          c4BoundaryInRowValue = parseInt(value2);
        } else {
          c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam);
        }
        if (c4ShapeInRowValue >= 1) {
          c4ShapeInRow = c4ShapeInRowValue;
        }
        if (c4BoundaryInRowValue >= 1) {
          c4BoundaryInRow = c4BoundaryInRowValue;
        }
      }, "updateLayoutConfig");
      getC4ShapeInRow = /* @__PURE__ */ __name(function() {
        return c4ShapeInRow;
      }, "getC4ShapeInRow");
      getC4BoundaryInRow = /* @__PURE__ */ __name(function() {
        return c4BoundaryInRow;
      }, "getC4BoundaryInRow");
      getCurrentBoundaryParse = /* @__PURE__ */ __name(function() {
        return currentBoundaryParse;
      }, "getCurrentBoundaryParse");
      getParentBoundaryParse = /* @__PURE__ */ __name(function() {
        return parentBoundaryParse;
      }, "getParentBoundaryParse");
      getC4ShapeArray = /* @__PURE__ */ __name(function(parentBoundary) {
        if (parentBoundary === void 0 || parentBoundary === null) {
          return c4ShapeArray;
        } else {
          return c4ShapeArray.filter((personOrSystem) => {
            return personOrSystem.parentBoundary === parentBoundary;
          });
        }
      }, "getC4ShapeArray");
      getC4Shape = /* @__PURE__ */ __name(function(alias) {
        return c4ShapeArray.find((personOrSystem) => personOrSystem.alias === alias);
      }, "getC4Shape");
      getC4ShapeKeys = /* @__PURE__ */ __name(function(parentBoundary) {
        return Object.keys(getC4ShapeArray(parentBoundary));
      }, "getC4ShapeKeys");
      getBoundaries = /* @__PURE__ */ __name(function(parentBoundary) {
        if (parentBoundary === void 0 || parentBoundary === null) {
          return boundaries;
        } else {
          return boundaries.filter((boundary) => boundary.parentBoundary === parentBoundary);
        }
      }, "getBoundaries");
      getBoundarys = getBoundaries;
      getRels = /* @__PURE__ */ __name(function() {
        return rels;
      }, "getRels");
      getTitle = /* @__PURE__ */ __name(function() {
        return title;
      }, "getTitle");
      setWrap = /* @__PURE__ */ __name(function(wrapSetting) {
        wrapEnabled = wrapSetting;
      }, "setWrap");
      autoWrap = /* @__PURE__ */ __name(function() {
        return wrapEnabled;
      }, "autoWrap");
      clear2 = /* @__PURE__ */ __name(function() {
        c4ShapeArray = [];
        boundaries = [
          {
            alias: "global",
            label: { text: "global" },
            type: { text: "global" },
            tags: null,
            link: null,
            parentBoundary: ""
          }
        ];
        parentBoundaryParse = "";
        currentBoundaryParse = "global";
        boundaryParseStack = [""];
        rels = [];
        boundaryParseStack = [""];
        title = "";
        wrapEnabled = false;
        c4ShapeInRow = 4;
        c4BoundaryInRow = 2;
      }, "clear");
      LINETYPE = {
        SOLID: 0,
        DOTTED: 1,
        NOTE: 2,
        SOLID_CROSS: 3,
        DOTTED_CROSS: 4,
        SOLID_OPEN: 5,
        DOTTED_OPEN: 6,
        LOOP_START: 10,
        LOOP_END: 11,
        ALT_START: 12,
        ALT_ELSE: 13,
        ALT_END: 14,
        OPT_START: 15,
        OPT_END: 16,
        ACTIVE_START: 17,
        ACTIVE_END: 18,
        PAR_START: 19,
        PAR_AND: 20,
        PAR_END: 21,
        RECT_START: 22,
        RECT_END: 23,
        SOLID_POINT: 24,
        DOTTED_POINT: 25
      };
      ARROWTYPE = {
        FILLED: 0,
        OPEN: 1
      };
      PLACEMENT = {
        LEFTOF: 0,
        RIGHTOF: 1,
        OVER: 2
      };
      setTitle = /* @__PURE__ */ __name(function(txt) {
        let sanitizedText = sanitizeText(txt, getConfig2());
        title = sanitizedText;
      }, "setTitle");
      c4Db_default = {
        addPersonOrSystem,
        addPersonOrSystemBoundary,
        addContainer,
        addContainerBoundary,
        addComponent,
        addDeploymentNode,
        popBoundaryParseStack,
        addRel,
        updateElStyle,
        updateRelStyle,
        updateLayoutConfig,
        autoWrap,
        setWrap,
        getC4ShapeArray,
        getC4Shape,
        getC4ShapeKeys,
        getBoundaries,
        getBoundarys,
        getCurrentBoundaryParse,
        getParentBoundaryParse,
        getRels,
        getTitle,
        getC4Type,
        getC4ShapeInRow,
        getC4BoundaryInRow,
        setAccTitle,
        getAccTitle,
        getAccDescription,
        setAccDescription,
        getConfig: /* @__PURE__ */ __name(() => getConfig2().c4, "getConfig"),
        clear: clear2,
        LINETYPE,
        ARROWTYPE,
        PLACEMENT,
        setTitle,
        setC4Type
        // apply,
      };
    }
  });

  // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/ascending.js
  function ascending(a2, b3) {
    return a2 == null || b3 == null ? NaN : a2 < b3 ? -1 : a2 > b3 ? 1 : a2 >= b3 ? 0 : NaN;
  }
  var init_ascending = __esm({
    "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/ascending.js"() {
      "use strict";
      __name(ascending, "ascending");
    }
  });

  // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/descending.js
  function descending(a2, b3) {
    return a2 == null || b3 == null ? NaN : b3 < a2 ? -1 : b3 > a2 ? 1 : b3 >= a2 ? 0 : NaN;
  }
  var init_descending = __esm({
    "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/descending.js"() {
      "use strict";
      __name(descending, "descending");
    }
  });

  // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/bisector.js
  function bisector(f2) {
    let compare1, compare2, delta;
    if (f2.length !== 2) {
      compare1 = ascending;
      compare2 = /* @__PURE__ */ __name((d3, x5) => ascending(f2(d3), x5), "compare2");
      delta = /* @__PURE__ */ __name((d3, x5) => f2(d3) - x5, "delta");
    } else {
      compare1 = f2 === ascending || f2 === descending ? f2 : zero;
      compare2 = f2;
      delta = f2;
    }
    function left3(a2, x5, lo = 0, hi = a2.length) {
      if (lo < hi) {
        if (compare1(x5, x5) !== 0) return hi;
        do {
          const mid = lo + hi >>> 1;
          if (compare2(a2[mid], x5) < 0) lo = mid + 1;
          else hi = mid;
        } while (lo < hi);
      }
      return lo;
    }
    __name(left3, "left");
    function right3(a2, x5, lo = 0, hi = a2.length) {
      if (lo < hi) {
        if (compare1(x5, x5) !== 0) return hi;
        do {
          const mid = lo + hi >>> 1;
          if (compare2(a2[mid], x5) <= 0) lo = mid + 1;
          else hi = mid;
        } while (lo < hi);
      }
      return lo;
    }
    __name(right3, "right");
    function center4(a2, x5, lo = 0, hi = a2.length) {
      const i2 = left3(a2, x5, lo, hi - 1);
      return i2 > lo && delta(a2[i2 - 1], x5) > -delta(a2[i2], x5) ? i2 - 1 : i2;
    }
    __name(center4, "center");
    return { left: left3, center: center4, right: right3 };
  }
  function zero() {
    return 0;
  }
  var init_bisector = __esm({
    "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/bisector.js"() {
      "use strict";
      init_ascending();
      init_descending();
      __name(bisector, "bisector");
      __name(zero, "zero");
    }
  });

  // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/number.js
  function number(x5) {
    return x5 === null ? NaN : +x5;
  }
  var init_number = __esm({
    "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/number.js"() {
      "use strict";
      __name(number, "number");
    }
  });

  // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/bisect.js
  var ascendingBisect, bisectRight, bisectLeft, bisectCenter, bisect_default;
  var init_bisect = __esm({
    "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/bisect.js"() {
      "use strict";
      init_ascending();
      init_bisector();
      init_number();
      ascendingBisect = bisector(ascending);
      bisectRight = ascendingBisect.right;
      bisectLeft = ascendingBisect.left;
      bisectCenter = bisector(number).center;
      bisect_default = bisectRight;
    }
  });

  // ../../node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js
  function intern_get({ _intern, _key }, value2) {
    const key = _key(value2);
    return _intern.has(key) ? _intern.get(key) : value2;
  }
  function intern_set({ _intern, _key }, value2) {
    const key = _key(value2);
    if (_intern.has(key)) return _intern.get(key);
    _intern.set(key, value2);
    return value2;
  }
  function intern_delete({ _intern, _key }, value2) {
    const key = _key(value2);
    if (_intern.has(key)) {
      value2 = _intern.get(key);
      _intern.delete(key);
    }
    return value2;
  }
  function keyof(value2) {
    return value2 !== null && typeof value2 === "object" ? value2.valueOf() : value2;
  }
  var InternMap;
  var init_src = __esm({
    "../../node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js"() {
      "use strict";
      InternMap = class extends Map {
        static {
          __name(this, "InternMap");
        }
        constructor(entries2, key = keyof) {
          super();
          Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } });
          if (entries2 != null) for (const [key2, value2] of entries2) this.set(key2, value2);
        }
        get(key) {
          return super.get(intern_get(this, key));
        }
        has(key) {
          return super.has(intern_get(this, key));
        }
        set(key, value2) {
          return super.set(intern_set(this, key), value2);
        }
        delete(key) {
          return super.delete(intern_delete(this, key));
        }
      };
      __name(intern_get, "intern_get");
      __name(intern_set, "intern_set");
      __name(intern_delete, "intern_delete");
      __name(keyof, "keyof");
    }
  });

  // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/ticks.js
  function tickSpec(start3, stop5, count2) {
    const step3 = (stop5 - start3) / Math.max(0, count2), power = Math.floor(Math.log10(step3)), error3 = step3 / Math.pow(10, power), factor = error3 >= e10 ? 10 : error3 >= e5 ? 5 : error3 >= e2 ? 2 : 1;
    let i1, i2, inc;
    if (power < 0) {
      inc = Math.pow(10, -power) / factor;
      i1 = Math.round(start3 * inc);
      i2 = Math.round(stop5 * inc);
      if (i1 / inc < start3) ++i1;
      if (i2 / inc > stop5) --i2;
      inc = -inc;
    } else {
      inc = Math.pow(10, power) * factor;
      i1 = Math.round(start3 / inc);
      i2 = Math.round(stop5 / inc);
      if (i1 * inc < start3) ++i1;
      if (i2 * inc > stop5) --i2;
    }
    if (i2 < i1 && 0.5 <= count2 && count2 < 2) return tickSpec(start3, stop5, count2 * 2);
    return [i1, i2, inc];
  }
  function ticks(start3, stop5, count2) {
    stop5 = +stop5, start3 = +start3, count2 = +count2;
    if (!(count2 > 0)) return [];
    if (start3 === stop5) return [start3];
    const reverse2 = stop5 < start3, [i1, i2, inc] = reverse2 ? tickSpec(stop5, start3, count2) : tickSpec(start3, stop5, count2);
    if (!(i2 >= i1)) return [];
    const n2 = i2 - i1 + 1, ticks2 = new Array(n2);
    if (reverse2) {
      if (inc < 0) for (let i3 = 0; i3 < n2; ++i3) ticks2[i3] = (i2 - i3) / -inc;
      else for (let i3 = 0; i3 < n2; ++i3) ticks2[i3] = (i2 - i3) * inc;
    } else {
      if (inc < 0) for (let i3 = 0; i3 < n2; ++i3) ticks2[i3] = (i1 + i3) / -inc;
      else for (let i3 = 0; i3 < n2; ++i3) ticks2[i3] = (i1 + i3) * inc;
    }
    return ticks2;
  }
  function tickIncrement(start3, stop5, count2) {
    stop5 = +stop5, start3 = +start3, count2 = +count2;
    return tickSpec(start3, stop5, count2)[2];
  }
  function tickStep(start3, stop5, count2) {
    stop5 = +stop5, start3 = +start3, count2 = +count2;
    const reverse2 = stop5 < start3, inc = reverse2 ? tickIncrement(stop5, start3, count2) : tickIncrement(start3, stop5, count2);
    return (reverse2 ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
  }
  var e10, e5, e2;
  var init_ticks = __esm({
    "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/ticks.js"() {
      "use strict";
      e10 = Math.sqrt(50);
      e5 = Math.sqrt(10);
      e2 = Math.sqrt(2);
      __name(tickSpec, "tickSpec");
      __name(ticks, "ticks");
      __name(tickIncrement, "tickIncrement");
      __name(tickStep, "tickStep");
    }
  });

  // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/max.js
  function max(values2, valueof) {
    let max10;
    if (valueof === void 0) {
      for (const value2 of values2) {
        if (value2 != null && (max10 < value2 || max10 === void 0 && value2 >= value2)) {
          max10 = value2;
        }
      }
    } else {
      let index = -1;
      for (let value2 of values2) {
        if ((value2 = valueof(value2, ++index, values2)) != null && (max10 < value2 || max10 === void 0 && value2 >= value2)) {
          max10 = value2;
        }
      }
    }
    return max10;
  }
  var init_max = __esm({
    "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/max.js"() {
      "use strict";
      __name(max, "max");
    }
  });

  // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/min.js
  function min(values2, valueof) {
    let min9;
    if (valueof === void 0) {
      for (const value2 of values2) {
        if (value2 != null && (min9 > value2 || min9 === void 0 && value2 >= value2)) {
          min9 = value2;
        }
      }
    } else {
      let index = -1;
      for (let value2 of values2) {
        if ((value2 = valueof(value2, ++index, values2)) != null && (min9 > value2 || min9 === void 0 && value2 >= value2)) {
          min9 = value2;
        }
      }
    }
    return min9;
  }
  var init_min = __esm({
    "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/min.js"() {
      "use strict";
      __name(min, "min");
    }
  });

  // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/range.js
  function range(start3, stop5, step3) {
    start3 = +start3, stop5 = +stop5, step3 = (n2 = arguments.length) < 2 ? (stop5 = start3, start3 = 0, 1) : n2 < 3 ? 1 : +step3;
    var i2 = -1, n2 = Math.max(0, Math.ceil((stop5 - start3) / step3)) | 0, range3 = new Array(n2);
    while (++i2 < n2) {
      range3[i2] = start3 + i2 * step3;
    }
    return range3;
  }
  var init_range = __esm({
    "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/range.js"() {
      "use strict";
      __name(range, "range");
    }
  });

  // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/index.js
  var init_src2 = __esm({
    "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/index.js"() {
      "use strict";
      init_bisect();
      init_bisector();
      init_max();
      init_min();
      init_range();
      init_ticks();
      init_src();
    }
  });

  // ../../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/identity.js
  function identity_default(x5) {
    return x5;
  }
  var init_identity = __esm({
    "../../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/identity.js"() {
      "use strict";
      __name(identity_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/axis.js
  function translateX(x5) {
    return "translate(" + x5 + ",0)";
  }
  function translateY(y6) {
    return "translate(0," + y6 + ")";
  }
  function number2(scale3) {
    return (d3) => +scale3(d3);
  }
  function center(scale3, offset) {
    offset = Math.max(0, scale3.bandwidth() - offset * 2) / 2;
    if (scale3.round()) offset = Math.round(offset);
    return (d3) => +scale3(d3) + offset;
  }
  function entering() {
    return !this.__axis;
  }
  function axis(orient, scale3) {
    var tickArguments = [], tickValues = null, tickFormat2 = null, tickSizeInner = 6, tickSizeOuter = 6, tickPadding = 3, offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5, k2 = orient === top || orient === left ? -1 : 1, x5 = orient === left || orient === right ? "x" : "y", transform8 = orient === top || orient === bottom ? translateX : translateY;
    function axis2(context) {
      var values2 = tickValues == null ? scale3.ticks ? scale3.ticks.apply(scale3, tickArguments) : scale3.domain() : tickValues, format3 = tickFormat2 == null ? scale3.tickFormat ? scale3.tickFormat.apply(scale3, tickArguments) : identity_default : tickFormat2, spacing2 = Math.max(tickSizeInner, 0) + tickPadding, range3 = scale3.range(), range0 = +range3[0] + offset, range1 = +range3[range3.length - 1] + offset, position5 = (scale3.bandwidth ? center : number2)(scale3.copy(), offset), selection2 = context.selection ? context.selection() : context, path4 = selection2.selectAll(".domain").data([null]), tick = selection2.selectAll(".tick").data(values2, scale3).order(), tickExit = tick.exit(), tickEnter = tick.enter().append("g").attr("class", "tick"), line2 = tick.select("line"), text4 = tick.select("text");
      path4 = path4.merge(path4.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor"));
      tick = tick.merge(tickEnter);
      line2 = line2.merge(tickEnter.append("line").attr("stroke", "currentColor").attr(x5 + "2", k2 * tickSizeInner));
      text4 = text4.merge(tickEnter.append("text").attr("fill", "currentColor").attr(x5, k2 * spacing2).attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
      if (context !== selection2) {
        path4 = path4.transition(context);
        tick = tick.transition(context);
        line2 = line2.transition(context);
        text4 = text4.transition(context);
        tickExit = tickExit.transition(context).attr("opacity", epsilon).attr("transform", function(d3) {
          return isFinite(d3 = position5(d3)) ? transform8(d3 + offset) : this.getAttribute("transform");
        });
        tickEnter.attr("opacity", epsilon).attr("transform", function(d3) {
          var p3 = this.parentNode.__axis;
          return transform8((p3 && isFinite(p3 = p3(d3)) ? p3 : position5(d3)) + offset);
        });
      }
      tickExit.remove();
      path4.attr("d", orient === left || orient === right ? tickSizeOuter ? "M" + k2 * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k2 * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1 : tickSizeOuter ? "M" + range0 + "," + k2 * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k2 * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1);
      tick.attr("opacity", 1).attr("transform", function(d3) {
        return transform8(position5(d3) + offset);
      });
      line2.attr(x5 + "2", k2 * tickSizeInner);
      text4.attr(x5, k2 * spacing2).text(format3);
      selection2.filter(entering).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle");
      selection2.each(function() {
        this.__axis = position5;
      });
    }
    __name(axis2, "axis");
    axis2.scale = function(_3) {
      return arguments.length ? (scale3 = _3, axis2) : scale3;
    };
    axis2.ticks = function() {
      return tickArguments = Array.from(arguments), axis2;
    };
    axis2.tickArguments = function(_3) {
      return arguments.length ? (tickArguments = _3 == null ? [] : Array.from(_3), axis2) : tickArguments.slice();
    };
    axis2.tickValues = function(_3) {
      return arguments.length ? (tickValues = _3 == null ? null : Array.from(_3), axis2) : tickValues && tickValues.slice();
    };
    axis2.tickFormat = function(_3) {
      return arguments.length ? (tickFormat2 = _3, axis2) : tickFormat2;
    };
    axis2.tickSize = function(_3) {
      return arguments.length ? (tickSizeInner = tickSizeOuter = +_3, axis2) : tickSizeInner;
    };
    axis2.tickSizeInner = function(_3) {
      return arguments.length ? (tickSizeInner = +_3, axis2) : tickSizeInner;
    };
    axis2.tickSizeOuter = function(_3) {
      return arguments.length ? (tickSizeOuter = +_3, axis2) : tickSizeOuter;
    };
    axis2.tickPadding = function(_3) {
      return arguments.length ? (tickPadding = +_3, axis2) : tickPadding;
    };
    axis2.offset = function(_3) {
      return arguments.length ? (offset = +_3, axis2) : offset;
    };
    return axis2;
  }
  function axisTop(scale3) {
    return axis(top, scale3);
  }
  function axisBottom(scale3) {
    return axis(bottom, scale3);
  }
  var top, right, bottom, left, epsilon;
  var init_axis = __esm({
    "../../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/axis.js"() {
      "use strict";
      init_identity();
      top = 1;
      right = 2;
      bottom = 3;
      left = 4;
      epsilon = 1e-6;
      __name(translateX, "translateX");
      __name(translateY, "translateY");
      __name(number2, "number");
      __name(center, "center");
      __name(entering, "entering");
      __name(axis, "axis");
      __name(axisTop, "axisTop");
      __name(axisBottom, "axisBottom");
    }
  });

  // ../../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/index.js
  var init_src3 = __esm({
    "../../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/index.js"() {
      "use strict";
      init_axis();
    }
  });

  // ../../node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js
  function dispatch() {
    for (var i2 = 0, n2 = arguments.length, _3 = {}, t4; i2 < n2; ++i2) {
      if (!(t4 = arguments[i2] + "") || t4 in _3 || /[\s.]/.test(t4)) throw new Error("illegal type: " + t4);
      _3[t4] = [];
    }
    return new Dispatch(_3);
  }
  function Dispatch(_3) {
    this._ = _3;
  }
  function parseTypenames(typenames, types) {
    return typenames.trim().split(/^|\s+/).map(function(t4) {
      var name = "", i2 = t4.indexOf(".");
      if (i2 >= 0) name = t4.slice(i2 + 1), t4 = t4.slice(0, i2);
      if (t4 && !types.hasOwnProperty(t4)) throw new Error("unknown type: " + t4);
      return { type: t4, name };
    });
  }
  function get(type3, name) {
    for (var i2 = 0, n2 = type3.length, c3; i2 < n2; ++i2) {
      if ((c3 = type3[i2]).name === name) {
        return c3.value;
      }
    }
  }
  function set(type3, name, callback) {
    for (var i2 = 0, n2 = type3.length; i2 < n2; ++i2) {
      if (type3[i2].name === name) {
        type3[i2] = noop, type3 = type3.slice(0, i2).concat(type3.slice(i2 + 1));
        break;
      }
    }
    if (callback != null) type3.push({ name, value: callback });
    return type3;
  }
  var noop, dispatch_default;
  var init_dispatch = __esm({
    "../../node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js"() {
      "use strict";
      noop = { value: /* @__PURE__ */ __name(() => {
      }, "value") };
      __name(dispatch, "dispatch");
      __name(Dispatch, "Dispatch");
      __name(parseTypenames, "parseTypenames");
      Dispatch.prototype = dispatch.prototype = {
        constructor: Dispatch,
        on: /* @__PURE__ */ __name(function(typename, callback) {
          var _3 = this._, T3 = parseTypenames(typename + "", _3), t4, i2 = -1, n2 = T3.length;
          if (arguments.length < 2) {
            while (++i2 < n2) if ((t4 = (typename = T3[i2]).type) && (t4 = get(_3[t4], typename.name))) return t4;
            return;
          }
          if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
          while (++i2 < n2) {
            if (t4 = (typename = T3[i2]).type) _3[t4] = set(_3[t4], typename.name, callback);
            else if (callback == null) for (t4 in _3) _3[t4] = set(_3[t4], typename.name, null);
          }
          return this;
        }, "on"),
        copy: /* @__PURE__ */ __name(function() {
          var copy5 = {}, _3 = this._;
          for (var t4 in _3) copy5[t4] = _3[t4].slice();
          return new Dispatch(copy5);
        }, "copy"),
        call: /* @__PURE__ */ __name(function(type3, that) {
          if ((n2 = arguments.length - 2) > 0) for (var args = new Array(n2), i2 = 0, n2, t4; i2 < n2; ++i2) args[i2] = arguments[i2 + 2];
          if (!this._.hasOwnProperty(type3)) throw new Error("unknown type: " + type3);
          for (t4 = this._[type3], i2 = 0, n2 = t4.length; i2 < n2; ++i2) t4[i2].value.apply(that, args);
        }, "call"),
        apply: /* @__PURE__ */ __name(function(type3, that, args) {
          if (!this._.hasOwnProperty(type3)) throw new Error("unknown type: " + type3);
          for (var t4 = this._[type3], i2 = 0, n2 = t4.length; i2 < n2; ++i2) t4[i2].value.apply(that, args);
        }, "apply")
      };
      __name(get, "get");
      __name(set, "set");
      dispatch_default = dispatch;
    }
  });

  // ../../node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/index.js
  var init_src4 = __esm({
    "../../node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/index.js"() {
      "use strict";
      init_dispatch();
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespaces.js
  var xhtml, namespaces_default;
  var init_namespaces = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespaces.js"() {
      "use strict";
      xhtml = "http://www.w3.org/1999/xhtml";
      namespaces_default = {
        svg: "http://www.w3.org/2000/svg",
        xhtml,
        xlink: "http://www.w3.org/1999/xlink",
        xml: "http://www.w3.org/XML/1998/namespace",
        xmlns: "http://www.w3.org/2000/xmlns/"
      };
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespace.js
  function namespace_default(name) {
    var prefix = name += "", i2 = prefix.indexOf(":");
    if (i2 >= 0 && (prefix = name.slice(0, i2)) !== "xmlns") name = name.slice(i2 + 1);
    return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
  }
  var init_namespace = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespace.js"() {
      "use strict";
      init_namespaces();
      __name(namespace_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/creator.js
  function creatorInherit(name) {
    return function() {
      var document2 = this.ownerDocument, uri = this.namespaceURI;
      return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
    };
  }
  function creatorFixed(fullname) {
    return function() {
      return this.ownerDocument.createElementNS(fullname.space, fullname.local);
    };
  }
  function creator_default(name) {
    var fullname = namespace_default(name);
    return (fullname.local ? creatorFixed : creatorInherit)(fullname);
  }
  var init_creator = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/creator.js"() {
      "use strict";
      init_namespace();
      init_namespaces();
      __name(creatorInherit, "creatorInherit");
      __name(creatorFixed, "creatorFixed");
      __name(creator_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selector.js
  function none() {
  }
  function selector_default(selector) {
    return selector == null ? none : function() {
      return this.querySelector(selector);
    };
  }
  var init_selector = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selector.js"() {
      "use strict";
      __name(none, "none");
      __name(selector_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/select.js
  function select_default(select) {
    if (typeof select !== "function") select = selector_default(select);
    for (var groups = this._groups, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
      for (var group2 = groups[j3], n2 = group2.length, subgroup = subgroups[j3] = new Array(n2), node2, subnode, i2 = 0; i2 < n2; ++i2) {
        if ((node2 = group2[i2]) && (subnode = select.call(node2, node2.__data__, i2, group2))) {
          if ("__data__" in node2) subnode.__data__ = node2.__data__;
          subgroup[i2] = subnode;
        }
      }
    }
    return new Selection(subgroups, this._parents);
  }
  var init_select = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/select.js"() {
      "use strict";
      init_selection();
      init_selector();
      __name(select_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/array.js
  function array(x5) {
    return x5 == null ? [] : Array.isArray(x5) ? x5 : Array.from(x5);
  }
  var init_array = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/array.js"() {
      "use strict";
      __name(array, "array");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selectorAll.js
  function empty() {
    return [];
  }
  function selectorAll_default(selector) {
    return selector == null ? empty : function() {
      return this.querySelectorAll(selector);
    };
  }
  var init_selectorAll = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selectorAll.js"() {
      "use strict";
      __name(empty, "empty");
      __name(selectorAll_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectAll.js
  function arrayAll(select) {
    return function() {
      return array(select.apply(this, arguments));
    };
  }
  function selectAll_default(select) {
    if (typeof select === "function") select = arrayAll(select);
    else select = selectorAll_default(select);
    for (var groups = this._groups, m3 = groups.length, subgroups = [], parents3 = [], j3 = 0; j3 < m3; ++j3) {
      for (var group2 = groups[j3], n2 = group2.length, node2, i2 = 0; i2 < n2; ++i2) {
        if (node2 = group2[i2]) {
          subgroups.push(select.call(node2, node2.__data__, i2, group2));
          parents3.push(node2);
        }
      }
    }
    return new Selection(subgroups, parents3);
  }
  var init_selectAll = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectAll.js"() {
      "use strict";
      init_selection();
      init_array();
      init_selectorAll();
      __name(arrayAll, "arrayAll");
      __name(selectAll_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/matcher.js
  function matcher_default(selector) {
    return function() {
      return this.matches(selector);
    };
  }
  function childMatcher(selector) {
    return function(node2) {
      return node2.matches(selector);
    };
  }
  var init_matcher = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/matcher.js"() {
      "use strict";
      __name(matcher_default, "default");
      __name(childMatcher, "childMatcher");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChild.js
  function childFind(match2) {
    return function() {
      return find.call(this.children, match2);
    };
  }
  function childFirst() {
    return this.firstElementChild;
  }
  function selectChild_default(match2) {
    return this.select(match2 == null ? childFirst : childFind(typeof match2 === "function" ? match2 : childMatcher(match2)));
  }
  var find;
  var init_selectChild = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChild.js"() {
      "use strict";
      init_matcher();
      find = Array.prototype.find;
      __name(childFind, "childFind");
      __name(childFirst, "childFirst");
      __name(selectChild_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChildren.js
  function children() {
    return Array.from(this.children);
  }
  function childrenFilter(match2) {
    return function() {
      return filter.call(this.children, match2);
    };
  }
  function selectChildren_default(match2) {
    return this.selectAll(match2 == null ? children : childrenFilter(typeof match2 === "function" ? match2 : childMatcher(match2)));
  }
  var filter;
  var init_selectChildren = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChildren.js"() {
      "use strict";
      init_matcher();
      filter = Array.prototype.filter;
      __name(children, "children");
      __name(childrenFilter, "childrenFilter");
      __name(selectChildren_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/filter.js
  function filter_default(match2) {
    if (typeof match2 !== "function") match2 = matcher_default(match2);
    for (var groups = this._groups, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
      for (var group2 = groups[j3], n2 = group2.length, subgroup = subgroups[j3] = [], node2, i2 = 0; i2 < n2; ++i2) {
        if ((node2 = group2[i2]) && match2.call(node2, node2.__data__, i2, group2)) {
          subgroup.push(node2);
        }
      }
    }
    return new Selection(subgroups, this._parents);
  }
  var init_filter = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/filter.js"() {
      "use strict";
      init_selection();
      init_matcher();
      __name(filter_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sparse.js
  function sparse_default(update2) {
    return new Array(update2.length);
  }
  var init_sparse = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sparse.js"() {
      "use strict";
      __name(sparse_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/enter.js
  function enter_default() {
    return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
  }
  function EnterNode(parent4, datum2) {
    this.ownerDocument = parent4.ownerDocument;
    this.namespaceURI = parent4.namespaceURI;
    this._next = null;
    this._parent = parent4;
    this.__data__ = datum2;
  }
  var init_enter = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/enter.js"() {
      "use strict";
      init_sparse();
      init_selection();
      __name(enter_default, "default");
      __name(EnterNode, "EnterNode");
      EnterNode.prototype = {
        constructor: EnterNode,
        appendChild: /* @__PURE__ */ __name(function(child) {
          return this._parent.insertBefore(child, this._next);
        }, "appendChild"),
        insertBefore: /* @__PURE__ */ __name(function(child, next3) {
          return this._parent.insertBefore(child, next3);
        }, "insertBefore"),
        querySelector: /* @__PURE__ */ __name(function(selector) {
          return this._parent.querySelector(selector);
        }, "querySelector"),
        querySelectorAll: /* @__PURE__ */ __name(function(selector) {
          return this._parent.querySelectorAll(selector);
        }, "querySelectorAll")
      };
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/constant.js
  function constant_default(x5) {
    return function() {
      return x5;
    };
  }
  var init_constant = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/constant.js"() {
      "use strict";
      __name(constant_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/data.js
  function bindIndex(parent4, group2, enter, update2, exit, data5) {
    var i2 = 0, node2, groupLength3 = group2.length, dataLength = data5.length;
    for (; i2 < dataLength; ++i2) {
      if (node2 = group2[i2]) {
        node2.__data__ = data5[i2];
        update2[i2] = node2;
      } else {
        enter[i2] = new EnterNode(parent4, data5[i2]);
      }
    }
    for (; i2 < groupLength3; ++i2) {
      if (node2 = group2[i2]) {
        exit[i2] = node2;
      }
    }
  }
  function bindKey(parent4, group2, enter, update2, exit, data5, key) {
    var i2, node2, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength3 = group2.length, dataLength = data5.length, keyValues = new Array(groupLength3), keyValue;
    for (i2 = 0; i2 < groupLength3; ++i2) {
      if (node2 = group2[i2]) {
        keyValues[i2] = keyValue = key.call(node2, node2.__data__, i2, group2) + "";
        if (nodeByKeyValue.has(keyValue)) {
          exit[i2] = node2;
        } else {
          nodeByKeyValue.set(keyValue, node2);
        }
      }
    }
    for (i2 = 0; i2 < dataLength; ++i2) {
      keyValue = key.call(parent4, data5[i2], i2, data5) + "";
      if (node2 = nodeByKeyValue.get(keyValue)) {
        update2[i2] = node2;
        node2.__data__ = data5[i2];
        nodeByKeyValue.delete(keyValue);
      } else {
        enter[i2] = new EnterNode(parent4, data5[i2]);
      }
    }
    for (i2 = 0; i2 < groupLength3; ++i2) {
      if ((node2 = group2[i2]) && nodeByKeyValue.get(keyValues[i2]) === node2) {
        exit[i2] = node2;
      }
    }
  }
  function datum(node2) {
    return node2.__data__;
  }
  function data_default(value2, key) {
    if (!arguments.length) return Array.from(this, datum);
    var bind = key ? bindKey : bindIndex, parents3 = this._parents, groups = this._groups;
    if (typeof value2 !== "function") value2 = constant_default(value2);
    for (var m3 = groups.length, update2 = new Array(m3), enter = new Array(m3), exit = new Array(m3), j3 = 0; j3 < m3; ++j3) {
      var parent4 = parents3[j3], group2 = groups[j3], groupLength3 = group2.length, data5 = arraylike(value2.call(parent4, parent4 && parent4.__data__, j3, parents3)), dataLength = data5.length, enterGroup = enter[j3] = new Array(dataLength), updateGroup = update2[j3] = new Array(dataLength), exitGroup = exit[j3] = new Array(groupLength3);
      bind(parent4, group2, enterGroup, updateGroup, exitGroup, data5, key);
      for (var i0 = 0, i1 = 0, previous, next3; i0 < dataLength; ++i0) {
        if (previous = enterGroup[i0]) {
          if (i0 >= i1) i1 = i0 + 1;
          while (!(next3 = updateGroup[i1]) && ++i1 < dataLength) ;
          previous._next = next3 || null;
        }
      }
    }
    update2 = new Selection(update2, parents3);
    update2._enter = enter;
    update2._exit = exit;
    return update2;
  }
  function arraylike(data5) {
    return typeof data5 === "object" && "length" in data5 ? data5 : Array.from(data5);
  }
  var init_data = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/data.js"() {
      "use strict";
      init_selection();
      init_enter();
      init_constant();
      __name(bindIndex, "bindIndex");
      __name(bindKey, "bindKey");
      __name(datum, "datum");
      __name(data_default, "default");
      __name(arraylike, "arraylike");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/exit.js
  function exit_default() {
    return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
  }
  var init_exit = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/exit.js"() {
      "use strict";
      init_sparse();
      init_selection();
      __name(exit_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/join.js
  function join_default(onenter, onupdate, onexit) {
    var enter = this.enter(), update2 = this, exit = this.exit();
    if (typeof onenter === "function") {
      enter = onenter(enter);
      if (enter) enter = enter.selection();
    } else {
      enter = enter.append(onenter + "");
    }
    if (onupdate != null) {
      update2 = onupdate(update2);
      if (update2) update2 = update2.selection();
    }
    if (onexit == null) exit.remove();
    else onexit(exit);
    return enter && update2 ? enter.merge(update2).order() : update2;
  }
  var init_join = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/join.js"() {
      "use strict";
      __name(join_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/merge.js
  function merge_default(context) {
    var selection2 = context.selection ? context.selection() : context;
    for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m3 = Math.min(m0, m1), merges = new Array(m0), j3 = 0; j3 < m3; ++j3) {
      for (var group0 = groups0[j3], group1 = groups1[j3], n2 = group0.length, merge5 = merges[j3] = new Array(n2), node2, i2 = 0; i2 < n2; ++i2) {
        if (node2 = group0[i2] || group1[i2]) {
          merge5[i2] = node2;
        }
      }
    }
    for (; j3 < m0; ++j3) {
      merges[j3] = groups0[j3];
    }
    return new Selection(merges, this._parents);
  }
  var init_merge2 = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/merge.js"() {
      "use strict";
      init_selection();
      __name(merge_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/order.js
  function order_default() {
    for (var groups = this._groups, j3 = -1, m3 = groups.length; ++j3 < m3; ) {
      for (var group2 = groups[j3], i2 = group2.length - 1, next3 = group2[i2], node2; --i2 >= 0; ) {
        if (node2 = group2[i2]) {
          if (next3 && node2.compareDocumentPosition(next3) ^ 4) next3.parentNode.insertBefore(node2, next3);
          next3 = node2;
        }
      }
    }
    return this;
  }
  var init_order = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/order.js"() {
      "use strict";
      __name(order_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sort.js
  function sort_default(compare) {
    if (!compare) compare = ascending2;
    function compareNode(a2, b3) {
      return a2 && b3 ? compare(a2.__data__, b3.__data__) : !a2 - !b3;
    }
    __name(compareNode, "compareNode");
    for (var groups = this._groups, m3 = groups.length, sortgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
      for (var group2 = groups[j3], n2 = group2.length, sortgroup = sortgroups[j3] = new Array(n2), node2, i2 = 0; i2 < n2; ++i2) {
        if (node2 = group2[i2]) {
          sortgroup[i2] = node2;
        }
      }
      sortgroup.sort(compareNode);
    }
    return new Selection(sortgroups, this._parents).order();
  }
  function ascending2(a2, b3) {
    return a2 < b3 ? -1 : a2 > b3 ? 1 : a2 >= b3 ? 0 : NaN;
  }
  var init_sort = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sort.js"() {
      "use strict";
      init_selection();
      __name(sort_default, "default");
      __name(ascending2, "ascending");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/call.js
  function call_default() {
    var callback = arguments[0];
    arguments[0] = this;
    callback.apply(null, arguments);
    return this;
  }
  var init_call = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/call.js"() {
      "use strict";
      __name(call_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/nodes.js
  function nodes_default() {
    return Array.from(this);
  }
  var init_nodes = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/nodes.js"() {
      "use strict";
      __name(nodes_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/node.js
  function node_default() {
    for (var groups = this._groups, j3 = 0, m3 = groups.length; j3 < m3; ++j3) {
      for (var group2 = groups[j3], i2 = 0, n2 = group2.length; i2 < n2; ++i2) {
        var node2 = group2[i2];
        if (node2) return node2;
      }
    }
    return null;
  }
  var init_node = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/node.js"() {
      "use strict";
      __name(node_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/size.js
  function size_default() {
    let size4 = 0;
    for (const node2 of this) ++size4;
    return size4;
  }
  var init_size2 = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/size.js"() {
      "use strict";
      __name(size_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/empty.js
  function empty_default() {
    return !this.node();
  }
  var init_empty = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/empty.js"() {
      "use strict";
      __name(empty_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/each.js
  function each_default(callback) {
    for (var groups = this._groups, j3 = 0, m3 = groups.length; j3 < m3; ++j3) {
      for (var group2 = groups[j3], i2 = 0, n2 = group2.length, node2; i2 < n2; ++i2) {
        if (node2 = group2[i2]) callback.call(node2, node2.__data__, i2, group2);
      }
    }
    return this;
  }
  var init_each = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/each.js"() {
      "use strict";
      __name(each_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/attr.js
  function attrRemove(name) {
    return function() {
      this.removeAttribute(name);
    };
  }
  function attrRemoveNS(fullname) {
    return function() {
      this.removeAttributeNS(fullname.space, fullname.local);
    };
  }
  function attrConstant(name, value2) {
    return function() {
      this.setAttribute(name, value2);
    };
  }
  function attrConstantNS(fullname, value2) {
    return function() {
      this.setAttributeNS(fullname.space, fullname.local, value2);
    };
  }
  function attrFunction(name, value2) {
    return function() {
      var v3 = value2.apply(this, arguments);
      if (v3 == null) this.removeAttribute(name);
      else this.setAttribute(name, v3);
    };
  }
  function attrFunctionNS(fullname, value2) {
    return function() {
      var v3 = value2.apply(this, arguments);
      if (v3 == null) this.removeAttributeNS(fullname.space, fullname.local);
      else this.setAttributeNS(fullname.space, fullname.local, v3);
    };
  }
  function attr_default(name, value2) {
    var fullname = namespace_default(name);
    if (arguments.length < 2) {
      var node2 = this.node();
      return fullname.local ? node2.getAttributeNS(fullname.space, fullname.local) : node2.getAttribute(fullname);
    }
    return this.each((value2 == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value2 === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value2));
  }
  var init_attr = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/attr.js"() {
      "use strict";
      init_namespace();
      __name(attrRemove, "attrRemove");
      __name(attrRemoveNS, "attrRemoveNS");
      __name(attrConstant, "attrConstant");
      __name(attrConstantNS, "attrConstantNS");
      __name(attrFunction, "attrFunction");
      __name(attrFunctionNS, "attrFunctionNS");
      __name(attr_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/window.js
  function window_default(node2) {
    return node2.ownerDocument && node2.ownerDocument.defaultView || node2.document && node2 || node2.defaultView;
  }
  var init_window = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/window.js"() {
      "use strict";
      __name(window_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/style.js
  function styleRemove(name) {
    return function() {
      this.style.removeProperty(name);
    };
  }
  function styleConstant(name, value2, priority3) {
    return function() {
      this.style.setProperty(name, value2, priority3);
    };
  }
  function styleFunction(name, value2, priority3) {
    return function() {
      var v3 = value2.apply(this, arguments);
      if (v3 == null) this.style.removeProperty(name);
      else this.style.setProperty(name, v3, priority3);
    };
  }
  function style_default(name, value2, priority3) {
    return arguments.length > 1 ? this.each((value2 == null ? styleRemove : typeof value2 === "function" ? styleFunction : styleConstant)(name, value2, priority3 == null ? "" : priority3)) : styleValue(this.node(), name);
  }
  function styleValue(node2, name) {
    return node2.style.getPropertyValue(name) || window_default(node2).getComputedStyle(node2, null).getPropertyValue(name);
  }
  var init_style = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/style.js"() {
      "use strict";
      init_window();
      __name(styleRemove, "styleRemove");
      __name(styleConstant, "styleConstant");
      __name(styleFunction, "styleFunction");
      __name(style_default, "default");
      __name(styleValue, "styleValue");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/property.js
  function propertyRemove(name) {
    return function() {
      delete this[name];
    };
  }
  function propertyConstant(name, value2) {
    return function() {
      this[name] = value2;
    };
  }
  function propertyFunction(name, value2) {
    return function() {
      var v3 = value2.apply(this, arguments);
      if (v3 == null) delete this[name];
      else this[name] = v3;
    };
  }
  function property_default(name, value2) {
    return arguments.length > 1 ? this.each((value2 == null ? propertyRemove : typeof value2 === "function" ? propertyFunction : propertyConstant)(name, value2)) : this.node()[name];
  }
  var init_property = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/property.js"() {
      "use strict";
      __name(propertyRemove, "propertyRemove");
      __name(propertyConstant, "propertyConstant");
      __name(propertyFunction, "propertyFunction");
      __name(property_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/classed.js
  function classArray(string3) {
    return string3.trim().split(/^|\s+/);
  }
  function classList(node2) {
    return node2.classList || new ClassList(node2);
  }
  function ClassList(node2) {
    this._node = node2;
    this._names = classArray(node2.getAttribute("class") || "");
  }
  function classedAdd(node2, names) {
    var list = classList(node2), i2 = -1, n2 = names.length;
    while (++i2 < n2) list.add(names[i2]);
  }
  function classedRemove(node2, names) {
    var list = classList(node2), i2 = -1, n2 = names.length;
    while (++i2 < n2) list.remove(names[i2]);
  }
  function classedTrue(names) {
    return function() {
      classedAdd(this, names);
    };
  }
  function classedFalse(names) {
    return function() {
      classedRemove(this, names);
    };
  }
  function classedFunction(names, value2) {
    return function() {
      (value2.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
    };
  }
  function classed_default(name, value2) {
    var names = classArray(name + "");
    if (arguments.length < 2) {
      var list = classList(this.node()), i2 = -1, n2 = names.length;
      while (++i2 < n2) if (!list.contains(names[i2])) return false;
      return true;
    }
    return this.each((typeof value2 === "function" ? classedFunction : value2 ? classedTrue : classedFalse)(names, value2));
  }
  var init_classed = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/classed.js"() {
      "use strict";
      __name(classArray, "classArray");
      __name(classList, "classList");
      __name(ClassList, "ClassList");
      ClassList.prototype = {
        add: /* @__PURE__ */ __name(function(name) {
          var i2 = this._names.indexOf(name);
          if (i2 < 0) {
            this._names.push(name);
            this._node.setAttribute("class", this._names.join(" "));
          }
        }, "add"),
        remove: /* @__PURE__ */ __name(function(name) {
          var i2 = this._names.indexOf(name);
          if (i2 >= 0) {
            this._names.splice(i2, 1);
            this._node.setAttribute("class", this._names.join(" "));
          }
        }, "remove"),
        contains: /* @__PURE__ */ __name(function(name) {
          return this._names.indexOf(name) >= 0;
        }, "contains")
      };
      __name(classedAdd, "classedAdd");
      __name(classedRemove, "classedRemove");
      __name(classedTrue, "classedTrue");
      __name(classedFalse, "classedFalse");
      __name(classedFunction, "classedFunction");
      __name(classed_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/text.js
  function textRemove() {
    this.textContent = "";
  }
  function textConstant(value2) {
    return function() {
      this.textContent = value2;
    };
  }
  function textFunction(value2) {
    return function() {
      var v3 = value2.apply(this, arguments);
      this.textContent = v3 == null ? "" : v3;
    };
  }
  function text_default(value2) {
    return arguments.length ? this.each(value2 == null ? textRemove : (typeof value2 === "function" ? textFunction : textConstant)(value2)) : this.node().textContent;
  }
  var init_text = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/text.js"() {
      "use strict";
      __name(textRemove, "textRemove");
      __name(textConstant, "textConstant");
      __name(textFunction, "textFunction");
      __name(text_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/html.js
  function htmlRemove() {
    this.innerHTML = "";
  }
  function htmlConstant(value2) {
    return function() {
      this.innerHTML = value2;
    };
  }
  function htmlFunction(value2) {
    return function() {
      var v3 = value2.apply(this, arguments);
      this.innerHTML = v3 == null ? "" : v3;
    };
  }
  function html_default(value2) {
    return arguments.length ? this.each(value2 == null ? htmlRemove : (typeof value2 === "function" ? htmlFunction : htmlConstant)(value2)) : this.node().innerHTML;
  }
  var init_html2 = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/html.js"() {
      "use strict";
      __name(htmlRemove, "htmlRemove");
      __name(htmlConstant, "htmlConstant");
      __name(htmlFunction, "htmlFunction");
      __name(html_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/raise.js
  function raise() {
    if (this.nextSibling) this.parentNode.appendChild(this);
  }
  function raise_default() {
    return this.each(raise);
  }
  var init_raise = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/raise.js"() {
      "use strict";
      __name(raise, "raise");
      __name(raise_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/lower.js
  function lower() {
    if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
  }
  function lower_default() {
    return this.each(lower);
  }
  var init_lower = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/lower.js"() {
      "use strict";
      __name(lower, "lower");
      __name(lower_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/append.js
  function append_default(name) {
    var create4 = typeof name === "function" ? name : creator_default(name);
    return this.select(function() {
      return this.appendChild(create4.apply(this, arguments));
    });
  }
  var init_append = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/append.js"() {
      "use strict";
      init_creator();
      __name(append_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/insert.js
  function constantNull() {
    return null;
  }
  function insert_default(name, before) {
    var create4 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
    return this.select(function() {
      return this.insertBefore(create4.apply(this, arguments), select.apply(this, arguments) || null);
    });
  }
  var init_insert = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/insert.js"() {
      "use strict";
      init_creator();
      init_selector();
      __name(constantNull, "constantNull");
      __name(insert_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/remove.js
  function remove() {
    var parent4 = this.parentNode;
    if (parent4) parent4.removeChild(this);
  }
  function remove_default() {
    return this.each(remove);
  }
  var init_remove = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/remove.js"() {
      "use strict";
      __name(remove, "remove");
      __name(remove_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/clone.js
  function selection_cloneShallow() {
    var clone6 = this.cloneNode(false), parent4 = this.parentNode;
    return parent4 ? parent4.insertBefore(clone6, this.nextSibling) : clone6;
  }
  function selection_cloneDeep() {
    var clone6 = this.cloneNode(true), parent4 = this.parentNode;
    return parent4 ? parent4.insertBefore(clone6, this.nextSibling) : clone6;
  }
  function clone_default(deep) {
    return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
  }
  var init_clone = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/clone.js"() {
      "use strict";
      __name(selection_cloneShallow, "selection_cloneShallow");
      __name(selection_cloneDeep, "selection_cloneDeep");
      __name(clone_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/datum.js
  function datum_default(value2) {
    return arguments.length ? this.property("__data__", value2) : this.node().__data__;
  }
  var init_datum = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/datum.js"() {
      "use strict";
      __name(datum_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/on.js
  function contextListener(listener) {
    return function(event3) {
      listener.call(this, event3, this.__data__);
    };
  }
  function parseTypenames2(typenames) {
    return typenames.trim().split(/^|\s+/).map(function(t4) {
      var name = "", i2 = t4.indexOf(".");
      if (i2 >= 0) name = t4.slice(i2 + 1), t4 = t4.slice(0, i2);
      return { type: t4, name };
    });
  }
  function onRemove(typename) {
    return function() {
      var on3 = this.__on;
      if (!on3) return;
      for (var j3 = 0, i2 = -1, m3 = on3.length, o2; j3 < m3; ++j3) {
        if (o2 = on3[j3], (!typename.type || o2.type === typename.type) && o2.name === typename.name) {
          this.removeEventListener(o2.type, o2.listener, o2.options);
        } else {
          on3[++i2] = o2;
        }
      }
      if (++i2) on3.length = i2;
      else delete this.__on;
    };
  }
  function onAdd(typename, value2, options2) {
    return function() {
      var on3 = this.__on, o2, listener = contextListener(value2);
      if (on3) for (var j3 = 0, m3 = on3.length; j3 < m3; ++j3) {
        if ((o2 = on3[j3]).type === typename.type && o2.name === typename.name) {
          this.removeEventListener(o2.type, o2.listener, o2.options);
          this.addEventListener(o2.type, o2.listener = listener, o2.options = options2);
          o2.value = value2;
          return;
        }
      }
      this.addEventListener(typename.type, listener, options2);
      o2 = { type: typename.type, name: typename.name, value: value2, listener, options: options2 };
      if (!on3) this.__on = [o2];
      else on3.push(o2);
    };
  }
  function on_default(typename, value2, options2) {
    var typenames = parseTypenames2(typename + ""), i2, n2 = typenames.length, t4;
    if (arguments.length < 2) {
      var on3 = this.node().__on;
      if (on3) for (var j3 = 0, m3 = on3.length, o2; j3 < m3; ++j3) {
        for (i2 = 0, o2 = on3[j3]; i2 < n2; ++i2) {
          if ((t4 = typenames[i2]).type === o2.type && t4.name === o2.name) {
            return o2.value;
          }
        }
      }
      return;
    }
    on3 = value2 ? onAdd : onRemove;
    for (i2 = 0; i2 < n2; ++i2) this.each(on3(typenames[i2], value2, options2));
    return this;
  }
  var init_on = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/on.js"() {
      "use strict";
      __name(contextListener, "contextListener");
      __name(parseTypenames2, "parseTypenames");
      __name(onRemove, "onRemove");
      __name(onAdd, "onAdd");
      __name(on_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/dispatch.js
  function dispatchEvent(node2, type3, params) {
    var window3 = window_default(node2), event3 = window3.CustomEvent;
    if (typeof event3 === "function") {
      event3 = new event3(type3, params);
    } else {
      event3 = window3.document.createEvent("Event");
      if (params) event3.initEvent(type3, params.bubbles, params.cancelable), event3.detail = params.detail;
      else event3.initEvent(type3, false, false);
    }
    node2.dispatchEvent(event3);
  }
  function dispatchConstant(type3, params) {
    return function() {
      return dispatchEvent(this, type3, params);
    };
  }
  function dispatchFunction(type3, params) {
    return function() {
      return dispatchEvent(this, type3, params.apply(this, arguments));
    };
  }
  function dispatch_default2(type3, params) {
    return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type3, params));
  }
  var init_dispatch2 = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/dispatch.js"() {
      "use strict";
      init_window();
      __name(dispatchEvent, "dispatchEvent");
      __name(dispatchConstant, "dispatchConstant");
      __name(dispatchFunction, "dispatchFunction");
      __name(dispatch_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/iterator.js
  function* iterator_default() {
    for (var groups = this._groups, j3 = 0, m3 = groups.length; j3 < m3; ++j3) {
      for (var group2 = groups[j3], i2 = 0, n2 = group2.length, node2; i2 < n2; ++i2) {
        if (node2 = group2[i2]) yield node2;
      }
    }
  }
  var init_iterator = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/iterator.js"() {
      "use strict";
      __name(iterator_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/index.js
  function Selection(groups, parents3) {
    this._groups = groups;
    this._parents = parents3;
  }
  function selection() {
    return new Selection([[document.documentElement]], root);
  }
  function selection_selection() {
    return this;
  }
  var root, selection_default;
  var init_selection = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/index.js"() {
      "use strict";
      init_select();
      init_selectAll();
      init_selectChild();
      init_selectChildren();
      init_filter();
      init_data();
      init_enter();
      init_exit();
      init_join();
      init_merge2();
      init_order();
      init_sort();
      init_call();
      init_nodes();
      init_node();
      init_size2();
      init_empty();
      init_each();
      init_attr();
      init_style();
      init_property();
      init_classed();
      init_text();
      init_html2();
      init_raise();
      init_lower();
      init_append();
      init_insert();
      init_remove();
      init_clone();
      init_datum();
      init_on();
      init_dispatch2();
      init_iterator();
      root = [null];
      __name(Selection, "Selection");
      __name(selection, "selection");
      __name(selection_selection, "selection_selection");
      Selection.prototype = selection.prototype = {
        constructor: Selection,
        select: select_default,
        selectAll: selectAll_default,
        selectChild: selectChild_default,
        selectChildren: selectChildren_default,
        filter: filter_default,
        data: data_default,
        enter: enter_default,
        exit: exit_default,
        join: join_default,
        merge: merge_default,
        selection: selection_selection,
        order: order_default,
        sort: sort_default,
        call: call_default,
        nodes: nodes_default,
        node: node_default,
        size: size_default,
        empty: empty_default,
        each: each_default,
        attr: attr_default,
        style: style_default,
        property: property_default,
        classed: classed_default,
        text: text_default,
        html: html_default,
        raise: raise_default,
        lower: lower_default,
        append: append_default,
        insert: insert_default,
        remove: remove_default,
        clone: clone_default,
        datum: datum_default,
        on: on_default,
        dispatch: dispatch_default2,
        [Symbol.iterator]: iterator_default
      };
      selection_default = selection;
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/select.js
  function select_default2(selector) {
    return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
  }
  var init_select2 = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/select.js"() {
      "use strict";
      init_selection();
      __name(select_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/index.js
  var init_src5 = __esm({
    "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/index.js"() {
      "use strict";
      init_matcher();
      init_namespace();
      init_select2();
      init_selection();
      init_selector();
      init_selectorAll();
      init_style();
    }
  });

  // ../../node_modules/.pnpm/d3-drag@3.0.0/node_modules/d3-drag/src/index.js
  var init_src6 = __esm({
    "../../node_modules/.pnpm/d3-drag@3.0.0/node_modules/d3-drag/src/index.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js
  function define_default(constructor, factory, prototype) {
    constructor.prototype = factory.prototype = prototype;
    prototype.constructor = constructor;
  }
  function extend(parent4, definition) {
    var prototype = Object.create(parent4.prototype);
    for (var key in definition) prototype[key] = definition[key];
    return prototype;
  }
  var init_define = __esm({
    "../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js"() {
      "use strict";
      __name(define_default, "default");
      __name(extend, "extend");
    }
  });

  // ../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js
  function Color2() {
  }
  function color_formatHex() {
    return this.rgb().formatHex();
  }
  function color_formatHex8() {
    return this.rgb().formatHex8();
  }
  function color_formatHsl() {
    return hslConvert(this).formatHsl();
  }
  function color_formatRgb() {
    return this.rgb().formatRgb();
  }
  function color(format3) {
    var m3, l4;
    format3 = (format3 + "").trim().toLowerCase();
    return (m3 = reHex.exec(format3)) ? (l4 = m3[1].length, m3 = parseInt(m3[1], 16), l4 === 6 ? rgbn(m3) : l4 === 3 ? new Rgb(m3 >> 8 & 15 | m3 >> 4 & 240, m3 >> 4 & 15 | m3 & 240, (m3 & 15) << 4 | m3 & 15, 1) : l4 === 8 ? rgba2(m3 >> 24 & 255, m3 >> 16 & 255, m3 >> 8 & 255, (m3 & 255) / 255) : l4 === 4 ? rgba2(m3 >> 12 & 15 | m3 >> 8 & 240, m3 >> 8 & 15 | m3 >> 4 & 240, m3 >> 4 & 15 | m3 & 240, ((m3 & 15) << 4 | m3 & 15) / 255) : null) : (m3 = reRgbInteger.exec(format3)) ? new Rgb(m3[1], m3[2], m3[3], 1) : (m3 = reRgbPercent.exec(format3)) ? new Rgb(m3[1] * 255 / 100, m3[2] * 255 / 100, m3[3] * 255 / 100, 1) : (m3 = reRgbaInteger.exec(format3)) ? rgba2(m3[1], m3[2], m3[3], m3[4]) : (m3 = reRgbaPercent.exec(format3)) ? rgba2(m3[1] * 255 / 100, m3[2] * 255 / 100, m3[3] * 255 / 100, m3[4]) : (m3 = reHslPercent.exec(format3)) ? hsla(m3[1], m3[2] / 100, m3[3] / 100, 1) : (m3 = reHslaPercent.exec(format3)) ? hsla(m3[1], m3[2] / 100, m3[3] / 100, m3[4]) : named.hasOwnProperty(format3) ? rgbn(named[format3]) : format3 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
  }
  function rgbn(n2) {
    return new Rgb(n2 >> 16 & 255, n2 >> 8 & 255, n2 & 255, 1);
  }
  function rgba2(r2, g2, b3, a2) {
    if (a2 <= 0) r2 = g2 = b3 = NaN;
    return new Rgb(r2, g2, b3, a2);
  }
  function rgbConvert(o2) {
    if (!(o2 instanceof Color2)) o2 = color(o2);
    if (!o2) return new Rgb();
    o2 = o2.rgb();
    return new Rgb(o2.r, o2.g, o2.b, o2.opacity);
  }
  function rgb(r2, g2, b3, opacity) {
    return arguments.length === 1 ? rgbConvert(r2) : new Rgb(r2, g2, b3, opacity == null ? 1 : opacity);
  }
  function Rgb(r2, g2, b3, opacity) {
    this.r = +r2;
    this.g = +g2;
    this.b = +b3;
    this.opacity = +opacity;
  }
  function rgb_formatHex() {
    return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
  }
  function rgb_formatHex8() {
    return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
  }
  function rgb_formatRgb() {
    const a2 = clampa(this.opacity);
    return `${a2 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a2 === 1 ? ")" : `, ${a2})`}`;
  }
  function clampa(opacity) {
    return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
  }
  function clampi(value2) {
    return Math.max(0, Math.min(255, Math.round(value2) || 0));
  }
  function hex(value2) {
    value2 = clampi(value2);
    return (value2 < 16 ? "0" : "") + value2.toString(16);
  }
  function hsla(h3, s2, l4, a2) {
    if (a2 <= 0) h3 = s2 = l4 = NaN;
    else if (l4 <= 0 || l4 >= 1) h3 = s2 = NaN;
    else if (s2 <= 0) h3 = NaN;
    return new Hsl(h3, s2, l4, a2);
  }
  function hslConvert(o2) {
    if (o2 instanceof Hsl) return new Hsl(o2.h, o2.s, o2.l, o2.opacity);
    if (!(o2 instanceof Color2)) o2 = color(o2);
    if (!o2) return new Hsl();
    if (o2 instanceof Hsl) return o2;
    o2 = o2.rgb();
    var r2 = o2.r / 255, g2 = o2.g / 255, b3 = o2.b / 255, min9 = Math.min(r2, g2, b3), max10 = Math.max(r2, g2, b3), h3 = NaN, s2 = max10 - min9, l4 = (max10 + min9) / 2;
    if (s2) {
      if (r2 === max10) h3 = (g2 - b3) / s2 + (g2 < b3) * 6;
      else if (g2 === max10) h3 = (b3 - r2) / s2 + 2;
      else h3 = (r2 - g2) / s2 + 4;
      s2 /= l4 < 0.5 ? max10 + min9 : 2 - max10 - min9;
      h3 *= 60;
    } else {
      s2 = l4 > 0 && l4 < 1 ? 0 : h3;
    }
    return new Hsl(h3, s2, l4, o2.opacity);
  }
  function hsl(h3, s2, l4, opacity) {
    return arguments.length === 1 ? hslConvert(h3) : new Hsl(h3, s2, l4, opacity == null ? 1 : opacity);
  }
  function Hsl(h3, s2, l4, opacity) {
    this.h = +h3;
    this.s = +s2;
    this.l = +l4;
    this.opacity = +opacity;
  }
  function clamph(value2) {
    value2 = (value2 || 0) % 360;
    return value2 < 0 ? value2 + 360 : value2;
  }
  function clampt(value2) {
    return Math.max(0, Math.min(1, value2 || 0));
  }
  function hsl2rgb(h3, m1, m22) {
    return (h3 < 60 ? m1 + (m22 - m1) * h3 / 60 : h3 < 180 ? m22 : h3 < 240 ? m1 + (m22 - m1) * (240 - h3) / 60 : m1) * 255;
  }
  var darker, brighter, reI, reN, reP, reHex, reRgbInteger, reRgbPercent, reRgbaInteger, reRgbaPercent, reHslPercent, reHslaPercent, named;
  var init_color2 = __esm({
    "../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js"() {
      "use strict";
      init_define();
      __name(Color2, "Color");
      darker = 0.7;
      brighter = 1 / darker;
      reI = "\\s*([+-]?\\d+)\\s*";
      reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
      reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
      reHex = /^#([0-9a-f]{3,8})$/;
      reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
      reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
      reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
      reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
      reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
      reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
      named = {
        aliceblue: 15792383,
        antiquewhite: 16444375,
        aqua: 65535,
        aquamarine: 8388564,
        azure: 15794175,
        beige: 16119260,
        bisque: 16770244,
        black: 0,
        blanchedalmond: 16772045,
        blue: 255,
        blueviolet: 9055202,
        brown: 10824234,
        burlywood: 14596231,
        cadetblue: 6266528,
        chartreuse: 8388352,
        chocolate: 13789470,
        coral: 16744272,
        cornflowerblue: 6591981,
        cornsilk: 16775388,
        crimson: 14423100,
        cyan: 65535,
        darkblue: 139,
        darkcyan: 35723,
        darkgoldenrod: 12092939,
        darkgray: 11119017,
        darkgreen: 25600,
        darkgrey: 11119017,
        darkkhaki: 12433259,
        darkmagenta: 9109643,
        darkolivegreen: 5597999,
        darkorange: 16747520,
        darkorchid: 10040012,
        darkred: 9109504,
        darksalmon: 15308410,
        darkseagreen: 9419919,
        darkslateblue: 4734347,
        darkslategray: 3100495,
        darkslategrey: 3100495,
        darkturquoise: 52945,
        darkviolet: 9699539,
        deeppink: 16716947,
        deepskyblue: 49151,
        dimgray: 6908265,
        dimgrey: 6908265,
        dodgerblue: 2003199,
        firebrick: 11674146,
        floralwhite: 16775920,
        forestgreen: 2263842,
        fuchsia: 16711935,
        gainsboro: 14474460,
        ghostwhite: 16316671,
        gold: 16766720,
        goldenrod: 14329120,
        gray: 8421504,
        green: 32768,
        greenyellow: 11403055,
        grey: 8421504,
        honeydew: 15794160,
        hotpink: 16738740,
        indianred: 13458524,
        indigo: 4915330,
        ivory: 16777200,
        khaki: 15787660,
        lavender: 15132410,
        lavenderblush: 16773365,
        lawngreen: 8190976,
        lemonchiffon: 16775885,
        lightblue: 11393254,
        lightcoral: 15761536,
        lightcyan: 14745599,
        lightgoldenrodyellow: 16448210,
        lightgray: 13882323,
        lightgreen: 9498256,
        lightgrey: 13882323,
        lightpink: 16758465,
        lightsalmon: 16752762,
        lightseagreen: 2142890,
        lightskyblue: 8900346,
        lightslategray: 7833753,
        lightslategrey: 7833753,
        lightsteelblue: 11584734,
        lightyellow: 16777184,
        lime: 65280,
        limegreen: 3329330,
        linen: 16445670,
        magenta: 16711935,
        maroon: 8388608,
        mediumaquamarine: 6737322,
        mediumblue: 205,
        mediumorchid: 12211667,
        mediumpurple: 9662683,
        mediumseagreen: 3978097,
        mediumslateblue: 8087790,
        mediumspringgreen: 64154,
        mediumturquoise: 4772300,
        mediumvioletred: 13047173,
        midnightblue: 1644912,
        mintcream: 16121850,
        mistyrose: 16770273,
        moccasin: 16770229,
        navajowhite: 16768685,
        navy: 128,
        oldlace: 16643558,
        olive: 8421376,
        olivedrab: 7048739,
        orange: 16753920,
        orangered: 16729344,
        orchid: 14315734,
        palegoldenrod: 15657130,
        palegreen: 10025880,
        paleturquoise: 11529966,
        palevioletred: 14381203,
        papayawhip: 16773077,
        peachpuff: 16767673,
        peru: 13468991,
        pink: 16761035,
        plum: 14524637,
        powderblue: 11591910,
        purple: 8388736,
        rebeccapurple: 6697881,
        red: 16711680,
        rosybrown: 12357519,
        royalblue: 4286945,
        saddlebrown: 9127187,
        salmon: 16416882,
        sandybrown: 16032864,
        seagreen: 3050327,
        seashell: 16774638,
        sienna: 10506797,
        silver: 12632256,
        skyblue: 8900331,
        slateblue: 6970061,
        slategray: 7372944,
        slategrey: 7372944,
        snow: 16775930,
        springgreen: 65407,
        steelblue: 4620980,
        tan: 13808780,
        teal: 32896,
        thistle: 14204888,
        tomato: 16737095,
        turquoise: 4251856,
        violet: 15631086,
        wheat: 16113331,
        white: 16777215,
        whitesmoke: 16119285,
        yellow: 16776960,
        yellowgreen: 10145074
      };
      define_default(Color2, color, {
        copy(channels2) {
          return Object.assign(new this.constructor(), this, channels2);
        },
        displayable() {
          return this.rgb().displayable();
        },
        hex: color_formatHex,
        // Deprecated! Use color.formatHex.
        formatHex: color_formatHex,
        formatHex8: color_formatHex8,
        formatHsl: color_formatHsl,
        formatRgb: color_formatRgb,
        toString: color_formatRgb
      });
      __name(color_formatHex, "color_formatHex");
      __name(color_formatHex8, "color_formatHex8");
      __name(color_formatHsl, "color_formatHsl");
      __name(color_formatRgb, "color_formatRgb");
      __name(color, "color");
      __name(rgbn, "rgbn");
      __name(rgba2, "rgba");
      __name(rgbConvert, "rgbConvert");
      __name(rgb, "rgb");
      __name(Rgb, "Rgb");
      define_default(Rgb, rgb, extend(Color2, {
        brighter(k2) {
          k2 = k2 == null ? brighter : Math.pow(brighter, k2);
          return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
        },
        darker(k2) {
          k2 = k2 == null ? darker : Math.pow(darker, k2);
          return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
        },
        rgb() {
          return this;
        },
        clamp() {
          return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
        },
        displayable() {
          return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
        },
        hex: rgb_formatHex,
        // Deprecated! Use color.formatHex.
        formatHex: rgb_formatHex,
        formatHex8: rgb_formatHex8,
        formatRgb: rgb_formatRgb,
        toString: rgb_formatRgb
      }));
      __name(rgb_formatHex, "rgb_formatHex");
      __name(rgb_formatHex8, "rgb_formatHex8");
      __name(rgb_formatRgb, "rgb_formatRgb");
      __name(clampa, "clampa");
      __name(clampi, "clampi");
      __name(hex, "hex");
      __name(hsla, "hsla");
      __name(hslConvert, "hslConvert");
      __name(hsl, "hsl");
      __name(Hsl, "Hsl");
      define_default(Hsl, hsl, extend(Color2, {
        brighter(k2) {
          k2 = k2 == null ? brighter : Math.pow(brighter, k2);
          return new Hsl(this.h, this.s, this.l * k2, this.opacity);
        },
        darker(k2) {
          k2 = k2 == null ? darker : Math.pow(darker, k2);
          return new Hsl(this.h, this.s, this.l * k2, this.opacity);
        },
        rgb() {
          var h3 = this.h % 360 + (this.h < 0) * 360, s2 = isNaN(h3) || isNaN(this.s) ? 0 : this.s, l4 = this.l, m22 = l4 + (l4 < 0.5 ? l4 : 1 - l4) * s2, m1 = 2 * l4 - m22;
          return new Rgb(
            hsl2rgb(h3 >= 240 ? h3 - 240 : h3 + 120, m1, m22),
            hsl2rgb(h3, m1, m22),
            hsl2rgb(h3 < 120 ? h3 + 240 : h3 - 120, m1, m22),
            this.opacity
          );
        },
        clamp() {
          return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
        },
        displayable() {
          return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
        },
        formatHsl() {
          const a2 = clampa(this.opacity);
          return `${a2 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a2 === 1 ? ")" : `, ${a2})`}`;
        }
      }));
      __name(clamph, "clamph");
      __name(clampt, "clampt");
      __name(hsl2rgb, "hsl2rgb");
    }
  });

  // ../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/math.js
  var radians, degrees;
  var init_math = __esm({
    "../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/math.js"() {
      "use strict";
      radians = Math.PI / 180;
      degrees = 180 / Math.PI;
    }
  });

  // ../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/lab.js
  function labConvert(o2) {
    if (o2 instanceof Lab) return new Lab(o2.l, o2.a, o2.b, o2.opacity);
    if (o2 instanceof Hcl) return hcl2lab(o2);
    if (!(o2 instanceof Rgb)) o2 = rgbConvert(o2);
    var r2 = rgb2lrgb(o2.r), g2 = rgb2lrgb(o2.g), b3 = rgb2lrgb(o2.b), y6 = xyz2lab((0.2225045 * r2 + 0.7168786 * g2 + 0.0606169 * b3) / Yn), x5, z3;
    if (r2 === g2 && g2 === b3) x5 = z3 = y6;
    else {
      x5 = xyz2lab((0.4360747 * r2 + 0.3850649 * g2 + 0.1430804 * b3) / Xn);
      z3 = xyz2lab((0.0139322 * r2 + 0.0971045 * g2 + 0.7141733 * b3) / Zn);
    }
    return new Lab(116 * y6 - 16, 500 * (x5 - y6), 200 * (y6 - z3), o2.opacity);
  }
  function lab(l4, a2, b3, opacity) {
    return arguments.length === 1 ? labConvert(l4) : new Lab(l4, a2, b3, opacity == null ? 1 : opacity);
  }
  function Lab(l4, a2, b3, opacity) {
    this.l = +l4;
    this.a = +a2;
    this.b = +b3;
    this.opacity = +opacity;
  }
  function xyz2lab(t4) {
    return t4 > t3 ? Math.pow(t4, 1 / 3) : t4 / t2 + t0;
  }
  function lab2xyz(t4) {
    return t4 > t1 ? t4 * t4 * t4 : t2 * (t4 - t0);
  }
  function lrgb2rgb(x5) {
    return 255 * (x5 <= 31308e-7 ? 12.92 * x5 : 1.055 * Math.pow(x5, 1 / 2.4) - 0.055);
  }
  function rgb2lrgb(x5) {
    return (x5 /= 255) <= 0.04045 ? x5 / 12.92 : Math.pow((x5 + 0.055) / 1.055, 2.4);
  }
  function hclConvert(o2) {
    if (o2 instanceof Hcl) return new Hcl(o2.h, o2.c, o2.l, o2.opacity);
    if (!(o2 instanceof Lab)) o2 = labConvert(o2);
    if (o2.a === 0 && o2.b === 0) return new Hcl(NaN, 0 < o2.l && o2.l < 100 ? 0 : NaN, o2.l, o2.opacity);
    var h3 = Math.atan2(o2.b, o2.a) * degrees;
    return new Hcl(h3 < 0 ? h3 + 360 : h3, Math.sqrt(o2.a * o2.a + o2.b * o2.b), o2.l, o2.opacity);
  }
  function hcl(h3, c3, l4, opacity) {
    return arguments.length === 1 ? hclConvert(h3) : new Hcl(h3, c3, l4, opacity == null ? 1 : opacity);
  }
  function Hcl(h3, c3, l4, opacity) {
    this.h = +h3;
    this.c = +c3;
    this.l = +l4;
    this.opacity = +opacity;
  }
  function hcl2lab(o2) {
    if (isNaN(o2.h)) return new Lab(o2.l, 0, 0, o2.opacity);
    var h3 = o2.h * radians;
    return new Lab(o2.l, Math.cos(h3) * o2.c, Math.sin(h3) * o2.c, o2.opacity);
  }
  var K, Xn, Yn, Zn, t0, t1, t2, t3;
  var init_lab = __esm({
    "../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/lab.js"() {
      "use strict";
      init_define();
      init_color2();
      init_math();
      K = 18;
      Xn = 0.96422;
      Yn = 1;
      Zn = 0.82521;
      t0 = 4 / 29;
      t1 = 6 / 29;
      t2 = 3 * t1 * t1;
      t3 = t1 * t1 * t1;
      __name(labConvert, "labConvert");
      __name(lab, "lab");
      __name(Lab, "Lab");
      define_default(Lab, lab, extend(Color2, {
        brighter(k2) {
          return new Lab(this.l + K * (k2 == null ? 1 : k2), this.a, this.b, this.opacity);
        },
        darker(k2) {
          return new Lab(this.l - K * (k2 == null ? 1 : k2), this.a, this.b, this.opacity);
        },
        rgb() {
          var y6 = (this.l + 16) / 116, x5 = isNaN(this.a) ? y6 : y6 + this.a / 500, z3 = isNaN(this.b) ? y6 : y6 - this.b / 200;
          x5 = Xn * lab2xyz(x5);
          y6 = Yn * lab2xyz(y6);
          z3 = Zn * lab2xyz(z3);
          return new Rgb(
            lrgb2rgb(3.1338561 * x5 - 1.6168667 * y6 - 0.4906146 * z3),
            lrgb2rgb(-0.9787684 * x5 + 1.9161415 * y6 + 0.033454 * z3),
            lrgb2rgb(0.0719453 * x5 - 0.2289914 * y6 + 1.4052427 * z3),
            this.opacity
          );
        }
      }));
      __name(xyz2lab, "xyz2lab");
      __name(lab2xyz, "lab2xyz");
      __name(lrgb2rgb, "lrgb2rgb");
      __name(rgb2lrgb, "rgb2lrgb");
      __name(hclConvert, "hclConvert");
      __name(hcl, "hcl");
      __name(Hcl, "Hcl");
      __name(hcl2lab, "hcl2lab");
      define_default(Hcl, hcl, extend(Color2, {
        brighter(k2) {
          return new Hcl(this.h, this.c, this.l + K * (k2 == null ? 1 : k2), this.opacity);
        },
        darker(k2) {
          return new Hcl(this.h, this.c, this.l - K * (k2 == null ? 1 : k2), this.opacity);
        },
        rgb() {
          return hcl2lab(this).rgb();
        }
      }));
    }
  });

  // ../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/index.js
  var init_src7 = __esm({
    "../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/index.js"() {
      "use strict";
      init_color2();
      init_lab();
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basis.js
  function basis(t13, v0, v12, v23, v3) {
    var t22 = t13 * t13, t32 = t22 * t13;
    return ((1 - 3 * t13 + 3 * t22 - t32) * v0 + (4 - 6 * t22 + 3 * t32) * v12 + (1 + 3 * t13 + 3 * t22 - 3 * t32) * v23 + t32 * v3) / 6;
  }
  function basis_default(values2) {
    var n2 = values2.length - 1;
    return function(t4) {
      var i2 = t4 <= 0 ? t4 = 0 : t4 >= 1 ? (t4 = 1, n2 - 1) : Math.floor(t4 * n2), v12 = values2[i2], v23 = values2[i2 + 1], v0 = i2 > 0 ? values2[i2 - 1] : 2 * v12 - v23, v3 = i2 < n2 - 1 ? values2[i2 + 2] : 2 * v23 - v12;
      return basis((t4 - i2 / n2) * n2, v0, v12, v23, v3);
    };
  }
  var init_basis = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basis.js"() {
      "use strict";
      __name(basis, "basis");
      __name(basis_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basisClosed.js
  function basisClosed_default(values2) {
    var n2 = values2.length;
    return function(t4) {
      var i2 = Math.floor(((t4 %= 1) < 0 ? ++t4 : t4) * n2), v0 = values2[(i2 + n2 - 1) % n2], v12 = values2[i2 % n2], v23 = values2[(i2 + 1) % n2], v3 = values2[(i2 + 2) % n2];
      return basis((t4 - i2 / n2) * n2, v0, v12, v23, v3);
    };
  }
  var init_basisClosed = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basisClosed.js"() {
      "use strict";
      init_basis();
      __name(basisClosed_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/constant.js
  var constant_default2;
  var init_constant2 = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/constant.js"() {
      "use strict";
      constant_default2 = /* @__PURE__ */ __name((x5) => () => x5, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/color.js
  function linear(a2, d3) {
    return function(t4) {
      return a2 + t4 * d3;
    };
  }
  function exponential(a2, b3, y6) {
    return a2 = Math.pow(a2, y6), b3 = Math.pow(b3, y6) - a2, y6 = 1 / y6, function(t4) {
      return Math.pow(a2 + t4 * b3, y6);
    };
  }
  function hue(a2, b3) {
    var d3 = b3 - a2;
    return d3 ? linear(a2, d3 > 180 || d3 < -180 ? d3 - 360 * Math.round(d3 / 360) : d3) : constant_default2(isNaN(a2) ? b3 : a2);
  }
  function gamma(y6) {
    return (y6 = +y6) === 1 ? nogamma : function(a2, b3) {
      return b3 - a2 ? exponential(a2, b3, y6) : constant_default2(isNaN(a2) ? b3 : a2);
    };
  }
  function nogamma(a2, b3) {
    var d3 = b3 - a2;
    return d3 ? linear(a2, d3) : constant_default2(isNaN(a2) ? b3 : a2);
  }
  var init_color3 = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/color.js"() {
      "use strict";
      init_constant2();
      __name(linear, "linear");
      __name(exponential, "exponential");
      __name(hue, "hue");
      __name(gamma, "gamma");
      __name(nogamma, "nogamma");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/rgb.js
  function rgbSpline(spline) {
    return function(colors2) {
      var n2 = colors2.length, r2 = new Array(n2), g2 = new Array(n2), b3 = new Array(n2), i2, color2;
      for (i2 = 0; i2 < n2; ++i2) {
        color2 = rgb(colors2[i2]);
        r2[i2] = color2.r || 0;
        g2[i2] = color2.g || 0;
        b3[i2] = color2.b || 0;
      }
      r2 = spline(r2);
      g2 = spline(g2);
      b3 = spline(b3);
      color2.opacity = 1;
      return function(t4) {
        color2.r = r2(t4);
        color2.g = g2(t4);
        color2.b = b3(t4);
        return color2 + "";
      };
    };
  }
  var rgb_default2, rgbBasis, rgbBasisClosed;
  var init_rgb2 = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/rgb.js"() {
      "use strict";
      init_src7();
      init_basis();
      init_basisClosed();
      init_color3();
      rgb_default2 = (/* @__PURE__ */ __name((function rgbGamma(y6) {
        var color2 = gamma(y6);
        function rgb2(start3, end2) {
          var r2 = color2((start3 = rgb(start3)).r, (end2 = rgb(end2)).r), g2 = color2(start3.g, end2.g), b3 = color2(start3.b, end2.b), opacity = nogamma(start3.opacity, end2.opacity);
          return function(t4) {
            start3.r = r2(t4);
            start3.g = g2(t4);
            start3.b = b3(t4);
            start3.opacity = opacity(t4);
            return start3 + "";
          };
        }
        __name(rgb2, "rgb");
        rgb2.gamma = rgbGamma;
        return rgb2;
      }), "rgbGamma"))(1);
      __name(rgbSpline, "rgbSpline");
      rgbBasis = rgbSpline(basis_default);
      rgbBasisClosed = rgbSpline(basisClosed_default);
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/numberArray.js
  function numberArray_default(a2, b3) {
    if (!b3) b3 = [];
    var n2 = a2 ? Math.min(b3.length, a2.length) : 0, c3 = b3.slice(), i2;
    return function(t4) {
      for (i2 = 0; i2 < n2; ++i2) c3[i2] = a2[i2] * (1 - t4) + b3[i2] * t4;
      return c3;
    };
  }
  function isNumberArray(x5) {
    return ArrayBuffer.isView(x5) && !(x5 instanceof DataView);
  }
  var init_numberArray = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/numberArray.js"() {
      "use strict";
      __name(numberArray_default, "default");
      __name(isNumberArray, "isNumberArray");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/array.js
  function genericArray(a2, b3) {
    var nb = b3 ? b3.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x5 = new Array(na), c3 = new Array(nb), i2;
    for (i2 = 0; i2 < na; ++i2) x5[i2] = value_default(a2[i2], b3[i2]);
    for (; i2 < nb; ++i2) c3[i2] = b3[i2];
    return function(t4) {
      for (i2 = 0; i2 < na; ++i2) c3[i2] = x5[i2](t4);
      return c3;
    };
  }
  var init_array2 = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/array.js"() {
      "use strict";
      init_value();
      __name(genericArray, "genericArray");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/date.js
  function date_default(a2, b3) {
    var d3 = /* @__PURE__ */ new Date();
    return a2 = +a2, b3 = +b3, function(t4) {
      return d3.setTime(a2 * (1 - t4) + b3 * t4), d3;
    };
  }
  var init_date = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/date.js"() {
      "use strict";
      __name(date_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/number.js
  function number_default(a2, b3) {
    return a2 = +a2, b3 = +b3, function(t4) {
      return a2 * (1 - t4) + b3 * t4;
    };
  }
  var init_number2 = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/number.js"() {
      "use strict";
      __name(number_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/object.js
  function object_default(a2, b3) {
    var i2 = {}, c3 = {}, k2;
    if (a2 === null || typeof a2 !== "object") a2 = {};
    if (b3 === null || typeof b3 !== "object") b3 = {};
    for (k2 in b3) {
      if (k2 in a2) {
        i2[k2] = value_default(a2[k2], b3[k2]);
      } else {
        c3[k2] = b3[k2];
      }
    }
    return function(t4) {
      for (k2 in i2) c3[k2] = i2[k2](t4);
      return c3;
    };
  }
  var init_object = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/object.js"() {
      "use strict";
      init_value();
      __name(object_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/string.js
  function zero2(b3) {
    return function() {
      return b3;
    };
  }
  function one(b3) {
    return function(t4) {
      return b3(t4) + "";
    };
  }
  function string_default(a2, b3) {
    var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i2 = -1, s2 = [], q3 = [];
    a2 = a2 + "", b3 = b3 + "";
    while ((am = reA.exec(a2)) && (bm = reB.exec(b3))) {
      if ((bs = bm.index) > bi) {
        bs = b3.slice(bi, bs);
        if (s2[i2]) s2[i2] += bs;
        else s2[++i2] = bs;
      }
      if ((am = am[0]) === (bm = bm[0])) {
        if (s2[i2]) s2[i2] += bm;
        else s2[++i2] = bm;
      } else {
        s2[++i2] = null;
        q3.push({ i: i2, x: number_default(am, bm) });
      }
      bi = reB.lastIndex;
    }
    if (bi < b3.length) {
      bs = b3.slice(bi);
      if (s2[i2]) s2[i2] += bs;
      else s2[++i2] = bs;
    }
    return s2.length < 2 ? q3[0] ? one(q3[0].x) : zero2(b3) : (b3 = q3.length, function(t4) {
      for (var i3 = 0, o2; i3 < b3; ++i3) s2[(o2 = q3[i3]).i] = o2.x(t4);
      return s2.join("");
    });
  }
  var reA, reB;
  var init_string = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/string.js"() {
      "use strict";
      init_number2();
      reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
      reB = new RegExp(reA.source, "g");
      __name(zero2, "zero");
      __name(one, "one");
      __name(string_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/value.js
  function value_default(a2, b3) {
    var t4 = typeof b3, c3;
    return b3 == null || t4 === "boolean" ? constant_default2(b3) : (t4 === "number" ? number_default : t4 === "string" ? (c3 = color(b3)) ? (b3 = c3, rgb_default2) : string_default : b3 instanceof color ? rgb_default2 : b3 instanceof Date ? date_default : isNumberArray(b3) ? numberArray_default : Array.isArray(b3) ? genericArray : typeof b3.valueOf !== "function" && typeof b3.toString !== "function" || isNaN(b3) ? object_default : number_default)(a2, b3);
  }
  var init_value = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/value.js"() {
      "use strict";
      init_src7();
      init_rgb2();
      init_array2();
      init_date();
      init_number2();
      init_object();
      init_string();
      init_constant2();
      init_numberArray();
      __name(value_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/round.js
  function round_default(a2, b3) {
    return a2 = +a2, b3 = +b3, function(t4) {
      return Math.round(a2 * (1 - t4) + b3 * t4);
    };
  }
  var init_round = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/round.js"() {
      "use strict";
      __name(round_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/decompose.js
  function decompose_default(a2, b3, c3, d3, e3, f2) {
    var scaleX, scaleY, skewX;
    if (scaleX = Math.sqrt(a2 * a2 + b3 * b3)) a2 /= scaleX, b3 /= scaleX;
    if (skewX = a2 * c3 + b3 * d3) c3 -= a2 * skewX, d3 -= b3 * skewX;
    if (scaleY = Math.sqrt(c3 * c3 + d3 * d3)) c3 /= scaleY, d3 /= scaleY, skewX /= scaleY;
    if (a2 * d3 < b3 * c3) a2 = -a2, b3 = -b3, skewX = -skewX, scaleX = -scaleX;
    return {
      translateX: e3,
      translateY: f2,
      rotate: Math.atan2(b3, a2) * degrees2,
      skewX: Math.atan(skewX) * degrees2,
      scaleX,
      scaleY
    };
  }
  var degrees2, identity;
  var init_decompose = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/decompose.js"() {
      "use strict";
      degrees2 = 180 / Math.PI;
      identity = {
        translateX: 0,
        translateY: 0,
        rotate: 0,
        skewX: 0,
        scaleX: 1,
        scaleY: 1
      };
      __name(decompose_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/parse.js
  function parseCss(value2) {
    const m3 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value2 + "");
    return m3.isIdentity ? identity : decompose_default(m3.a, m3.b, m3.c, m3.d, m3.e, m3.f);
  }
  function parseSvg(value2) {
    if (value2 == null) return identity;
    if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
    svgNode.setAttribute("transform", value2);
    if (!(value2 = svgNode.transform.baseVal.consolidate())) return identity;
    value2 = value2.matrix;
    return decompose_default(value2.a, value2.b, value2.c, value2.d, value2.e, value2.f);
  }
  var svgNode;
  var init_parse = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/parse.js"() {
      "use strict";
      init_decompose();
      __name(parseCss, "parseCss");
      __name(parseSvg, "parseSvg");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/index.js
  function interpolateTransform(parse7, pxComma, pxParen, degParen) {
    function pop(s2) {
      return s2.length ? s2.pop() + " " : "";
    }
    __name(pop, "pop");
    function translate2(xa, ya, xb, yb, s2, q3) {
      if (xa !== xb || ya !== yb) {
        var i2 = s2.push("translate(", null, pxComma, null, pxParen);
        q3.push({ i: i2 - 4, x: number_default(xa, xb) }, { i: i2 - 2, x: number_default(ya, yb) });
      } else if (xb || yb) {
        s2.push("translate(" + xb + pxComma + yb + pxParen);
      }
    }
    __name(translate2, "translate");
    function rotate2(a2, b3, s2, q3) {
      if (a2 !== b3) {
        if (a2 - b3 > 180) b3 += 360;
        else if (b3 - a2 > 180) a2 += 360;
        q3.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: number_default(a2, b3) });
      } else if (b3) {
        s2.push(pop(s2) + "rotate(" + b3 + degParen);
      }
    }
    __name(rotate2, "rotate");
    function skewX(a2, b3, s2, q3) {
      if (a2 !== b3) {
        q3.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: number_default(a2, b3) });
      } else if (b3) {
        s2.push(pop(s2) + "skewX(" + b3 + degParen);
      }
    }
    __name(skewX, "skewX");
    function scale3(xa, ya, xb, yb, s2, q3) {
      if (xa !== xb || ya !== yb) {
        var i2 = s2.push(pop(s2) + "scale(", null, ",", null, ")");
        q3.push({ i: i2 - 4, x: number_default(xa, xb) }, { i: i2 - 2, x: number_default(ya, yb) });
      } else if (xb !== 1 || yb !== 1) {
        s2.push(pop(s2) + "scale(" + xb + "," + yb + ")");
      }
    }
    __name(scale3, "scale");
    return function(a2, b3) {
      var s2 = [], q3 = [];
      a2 = parse7(a2), b3 = parse7(b3);
      translate2(a2.translateX, a2.translateY, b3.translateX, b3.translateY, s2, q3);
      rotate2(a2.rotate, b3.rotate, s2, q3);
      skewX(a2.skewX, b3.skewX, s2, q3);
      scale3(a2.scaleX, a2.scaleY, b3.scaleX, b3.scaleY, s2, q3);
      a2 = b3 = null;
      return function(t4) {
        var i2 = -1, n2 = q3.length, o2;
        while (++i2 < n2) s2[(o2 = q3[i2]).i] = o2.x(t4);
        return s2.join("");
      };
    };
  }
  var interpolateTransformCss, interpolateTransformSvg;
  var init_transform = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/index.js"() {
      "use strict";
      init_number2();
      init_parse();
      __name(interpolateTransform, "interpolateTransform");
      interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
      interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/hcl.js
  function hcl2(hue2) {
    return function(start3, end2) {
      var h3 = hue2((start3 = hcl(start3)).h, (end2 = hcl(end2)).h), c3 = nogamma(start3.c, end2.c), l4 = nogamma(start3.l, end2.l), opacity = nogamma(start3.opacity, end2.opacity);
      return function(t4) {
        start3.h = h3(t4);
        start3.c = c3(t4);
        start3.l = l4(t4);
        start3.opacity = opacity(t4);
        return start3 + "";
      };
    };
  }
  var hcl_default, hclLong;
  var init_hcl = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/hcl.js"() {
      "use strict";
      init_src7();
      init_color3();
      __name(hcl2, "hcl");
      hcl_default = hcl2(hue);
      hclLong = hcl2(nogamma);
    }
  });

  // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/index.js
  var init_src8 = __esm({
    "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/index.js"() {
      "use strict";
      init_value();
      init_number2();
      init_round();
      init_string();
      init_transform();
      init_rgb2();
      init_hcl();
    }
  });

  // ../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js
  function now() {
    return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
  }
  function clearNow() {
    clockNow = 0;
  }
  function Timer() {
    this._call = this._time = this._next = null;
  }
  function timer(callback, delay2, time4) {
    var t4 = new Timer();
    t4.restart(callback, delay2, time4);
    return t4;
  }
  function timerFlush() {
    now();
    ++frame;
    var t4 = taskHead, e3;
    while (t4) {
      if ((e3 = clockNow - t4._time) >= 0) t4._call.call(void 0, e3);
      t4 = t4._next;
    }
    --frame;
  }
  function wake() {
    clockNow = (clockLast = clock.now()) + clockSkew;
    frame = timeout = 0;
    try {
      timerFlush();
    } finally {
      frame = 0;
      nap();
      clockNow = 0;
    }
  }
  function poke() {
    var now3 = clock.now(), delay2 = now3 - clockLast;
    if (delay2 > pokeDelay) clockSkew -= delay2, clockLast = now3;
  }
  function nap() {
    var t03, t13 = taskHead, t22, time4 = Infinity;
    while (t13) {
      if (t13._call) {
        if (time4 > t13._time) time4 = t13._time;
        t03 = t13, t13 = t13._next;
      } else {
        t22 = t13._next, t13._next = null;
        t13 = t03 ? t03._next = t22 : taskHead = t22;
      }
    }
    taskTail = t03;
    sleep(time4);
  }
  function sleep(time4) {
    if (frame) return;
    if (timeout) timeout = clearTimeout(timeout);
    var delay2 = time4 - clockNow;
    if (delay2 > 24) {
      if (time4 < Infinity) timeout = setTimeout(wake, time4 - clock.now() - clockSkew);
      if (interval) interval = clearInterval(interval);
    } else {
      if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
      frame = 1, setFrame(wake);
    }
  }
  var frame, timeout, interval, pokeDelay, taskHead, taskTail, clockLast, clockNow, clockSkew, clock, setFrame;
  var init_timer = __esm({
    "../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js"() {
      "use strict";
      frame = 0;
      timeout = 0;
      interval = 0;
      pokeDelay = 1e3;
      clockLast = 0;
      clockNow = 0;
      clockSkew = 0;
      clock = typeof performance === "object" && performance.now ? performance : Date;
      setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f2) {
        setTimeout(f2, 17);
      };
      __name(now, "now");
      __name(clearNow, "clearNow");
      __name(Timer, "Timer");
      Timer.prototype = timer.prototype = {
        constructor: Timer,
        restart: /* @__PURE__ */ __name(function(callback, delay2, time4) {
          if (typeof callback !== "function") throw new TypeError("callback is not a function");
          time4 = (time4 == null ? now() : +time4) + (delay2 == null ? 0 : +delay2);
          if (!this._next && taskTail !== this) {
            if (taskTail) taskTail._next = this;
            else taskHead = this;
            taskTail = this;
          }
          this._call = callback;
          this._time = time4;
          sleep();
        }, "restart"),
        stop: /* @__PURE__ */ __name(function() {
          if (this._call) {
            this._call = null;
            this._time = Infinity;
            sleep();
          }
        }, "stop")
      };
      __name(timer, "timer");
      __name(timerFlush, "timerFlush");
      __name(wake, "wake");
      __name(poke, "poke");
      __name(nap, "nap");
      __name(sleep, "sleep");
    }
  });

  // ../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js
  function timeout_default(callback, delay2, time4) {
    var t4 = new Timer();
    delay2 = delay2 == null ? 0 : +delay2;
    t4.restart((elapsed) => {
      t4.stop();
      callback(elapsed + delay2);
    }, delay2, time4);
    return t4;
  }
  var init_timeout = __esm({
    "../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js"() {
      "use strict";
      init_timer();
      __name(timeout_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/index.js
  var init_src9 = __esm({
    "../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/index.js"() {
      "use strict";
      init_timer();
      init_timeout();
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/schedule.js
  function schedule_default(node2, name, id34, index, group2, timing) {
    var schedules = node2.__transition;
    if (!schedules) node2.__transition = {};
    else if (id34 in schedules) return;
    create2(node2, id34, {
      name,
      index,
      // For context during callback.
      group: group2,
      // For context during callback.
      on: emptyOn,
      tween: emptyTween,
      time: timing.time,
      delay: timing.delay,
      duration: timing.duration,
      ease: timing.ease,
      timer: null,
      state: CREATED
    });
  }
  function init(node2, id34) {
    var schedule = get2(node2, id34);
    if (schedule.state > CREATED) throw new Error("too late; already scheduled");
    return schedule;
  }
  function set2(node2, id34) {
    var schedule = get2(node2, id34);
    if (schedule.state > STARTED) throw new Error("too late; already running");
    return schedule;
  }
  function get2(node2, id34) {
    var schedule = node2.__transition;
    if (!schedule || !(schedule = schedule[id34])) throw new Error("transition not found");
    return schedule;
  }
  function create2(node2, id34, self2) {
    var schedules = node2.__transition, tween;
    schedules[id34] = self2;
    self2.timer = timer(schedule, 0, self2.time);
    function schedule(elapsed) {
      self2.state = SCHEDULED;
      self2.timer.restart(start3, self2.delay, self2.time);
      if (self2.delay <= elapsed) start3(elapsed - self2.delay);
    }
    __name(schedule, "schedule");
    function start3(elapsed) {
      var i2, j3, n2, o2;
      if (self2.state !== SCHEDULED) return stop5();
      for (i2 in schedules) {
        o2 = schedules[i2];
        if (o2.name !== self2.name) continue;
        if (o2.state === STARTED) return timeout_default(start3);
        if (o2.state === RUNNING) {
          o2.state = ENDED;
          o2.timer.stop();
          o2.on.call("interrupt", node2, node2.__data__, o2.index, o2.group);
          delete schedules[i2];
        } else if (+i2 < id34) {
          o2.state = ENDED;
          o2.timer.stop();
          o2.on.call("cancel", node2, node2.__data__, o2.index, o2.group);
          delete schedules[i2];
        }
      }
      timeout_default(function() {
        if (self2.state === STARTED) {
          self2.state = RUNNING;
          self2.timer.restart(tick, self2.delay, self2.time);
          tick(elapsed);
        }
      });
      self2.state = STARTING;
      self2.on.call("start", node2, node2.__data__, self2.index, self2.group);
      if (self2.state !== STARTING) return;
      self2.state = STARTED;
      tween = new Array(n2 = self2.tween.length);
      for (i2 = 0, j3 = -1; i2 < n2; ++i2) {
        if (o2 = self2.tween[i2].value.call(node2, node2.__data__, self2.index, self2.group)) {
          tween[++j3] = o2;
        }
      }
      tween.length = j3 + 1;
    }
    __name(start3, "start");
    function tick(elapsed) {
      var t4 = elapsed < self2.duration ? self2.ease.call(null, elapsed / self2.duration) : (self2.timer.restart(stop5), self2.state = ENDING, 1), i2 = -1, n2 = tween.length;
      while (++i2 < n2) {
        tween[i2].call(node2, t4);
      }
      if (self2.state === ENDING) {
        self2.on.call("end", node2, node2.__data__, self2.index, self2.group);
        stop5();
      }
    }
    __name(tick, "tick");
    function stop5() {
      self2.state = ENDED;
      self2.timer.stop();
      delete schedules[id34];
      for (var i2 in schedules) return;
      delete node2.__transition;
    }
    __name(stop5, "stop");
  }
  var emptyOn, emptyTween, CREATED, SCHEDULED, STARTING, STARTED, RUNNING, ENDING, ENDED;
  var init_schedule = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/schedule.js"() {
      "use strict";
      init_src4();
      init_src9();
      emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
      emptyTween = [];
      CREATED = 0;
      SCHEDULED = 1;
      STARTING = 2;
      STARTED = 3;
      RUNNING = 4;
      ENDING = 5;
      ENDED = 6;
      __name(schedule_default, "default");
      __name(init, "init");
      __name(set2, "set");
      __name(get2, "get");
      __name(create2, "create");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/interrupt.js
  function interrupt_default(node2, name) {
    var schedules = node2.__transition, schedule, active, empty3 = true, i2;
    if (!schedules) return;
    name = name == null ? null : name + "";
    for (i2 in schedules) {
      if ((schedule = schedules[i2]).name !== name) {
        empty3 = false;
        continue;
      }
      active = schedule.state > STARTING && schedule.state < ENDING;
      schedule.state = ENDED;
      schedule.timer.stop();
      schedule.on.call(active ? "interrupt" : "cancel", node2, node2.__data__, schedule.index, schedule.group);
      delete schedules[i2];
    }
    if (empty3) delete node2.__transition;
  }
  var init_interrupt = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/interrupt.js"() {
      "use strict";
      init_schedule();
      __name(interrupt_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/interrupt.js
  function interrupt_default2(name) {
    return this.each(function() {
      interrupt_default(this, name);
    });
  }
  var init_interrupt2 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/interrupt.js"() {
      "use strict";
      init_interrupt();
      __name(interrupt_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/tween.js
  function tweenRemove(id34, name) {
    var tween0, tween1;
    return function() {
      var schedule = set2(this, id34), tween = schedule.tween;
      if (tween !== tween0) {
        tween1 = tween0 = tween;
        for (var i2 = 0, n2 = tween1.length; i2 < n2; ++i2) {
          if (tween1[i2].name === name) {
            tween1 = tween1.slice();
            tween1.splice(i2, 1);
            break;
          }
        }
      }
      schedule.tween = tween1;
    };
  }
  function tweenFunction(id34, name, value2) {
    var tween0, tween1;
    if (typeof value2 !== "function") throw new Error();
    return function() {
      var schedule = set2(this, id34), tween = schedule.tween;
      if (tween !== tween0) {
        tween1 = (tween0 = tween).slice();
        for (var t4 = { name, value: value2 }, i2 = 0, n2 = tween1.length; i2 < n2; ++i2) {
          if (tween1[i2].name === name) {
            tween1[i2] = t4;
            break;
          }
        }
        if (i2 === n2) tween1.push(t4);
      }
      schedule.tween = tween1;
    };
  }
  function tween_default(name, value2) {
    var id34 = this._id;
    name += "";
    if (arguments.length < 2) {
      var tween = get2(this.node(), id34).tween;
      for (var i2 = 0, n2 = tween.length, t4; i2 < n2; ++i2) {
        if ((t4 = tween[i2]).name === name) {
          return t4.value;
        }
      }
      return null;
    }
    return this.each((value2 == null ? tweenRemove : tweenFunction)(id34, name, value2));
  }
  function tweenValue(transition2, name, value2) {
    var id34 = transition2._id;
    transition2.each(function() {
      var schedule = set2(this, id34);
      (schedule.value || (schedule.value = {}))[name] = value2.apply(this, arguments);
    });
    return function(node2) {
      return get2(node2, id34).value[name];
    };
  }
  var init_tween = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/tween.js"() {
      "use strict";
      init_schedule();
      __name(tweenRemove, "tweenRemove");
      __name(tweenFunction, "tweenFunction");
      __name(tween_default, "default");
      __name(tweenValue, "tweenValue");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/interpolate.js
  function interpolate_default(a2, b3) {
    var c3;
    return (typeof b3 === "number" ? number_default : b3 instanceof color ? rgb_default2 : (c3 = color(b3)) ? (b3 = c3, rgb_default2) : string_default)(a2, b3);
  }
  var init_interpolate = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/interpolate.js"() {
      "use strict";
      init_src7();
      init_src8();
      __name(interpolate_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attr.js
  function attrRemove2(name) {
    return function() {
      this.removeAttribute(name);
    };
  }
  function attrRemoveNS2(fullname) {
    return function() {
      this.removeAttributeNS(fullname.space, fullname.local);
    };
  }
  function attrConstant2(name, interpolate, value1) {
    var string00, string1 = value1 + "", interpolate0;
    return function() {
      var string0 = this.getAttribute(name);
      return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
    };
  }
  function attrConstantNS2(fullname, interpolate, value1) {
    var string00, string1 = value1 + "", interpolate0;
    return function() {
      var string0 = this.getAttributeNS(fullname.space, fullname.local);
      return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
    };
  }
  function attrFunction2(name, interpolate, value2) {
    var string00, string10, interpolate0;
    return function() {
      var string0, value1 = value2(this), string1;
      if (value1 == null) return void this.removeAttribute(name);
      string0 = this.getAttribute(name);
      string1 = value1 + "";
      return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
    };
  }
  function attrFunctionNS2(fullname, interpolate, value2) {
    var string00, string10, interpolate0;
    return function() {
      var string0, value1 = value2(this), string1;
      if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
      string0 = this.getAttributeNS(fullname.space, fullname.local);
      string1 = value1 + "";
      return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
    };
  }
  function attr_default2(name, value2) {
    var fullname = namespace_default(name), i2 = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
    return this.attrTween(name, typeof value2 === "function" ? (fullname.local ? attrFunctionNS2 : attrFunction2)(fullname, i2, tweenValue(this, "attr." + name, value2)) : value2 == null ? (fullname.local ? attrRemoveNS2 : attrRemove2)(fullname) : (fullname.local ? attrConstantNS2 : attrConstant2)(fullname, i2, value2));
  }
  var init_attr2 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attr.js"() {
      "use strict";
      init_src8();
      init_src5();
      init_tween();
      init_interpolate();
      __name(attrRemove2, "attrRemove");
      __name(attrRemoveNS2, "attrRemoveNS");
      __name(attrConstant2, "attrConstant");
      __name(attrConstantNS2, "attrConstantNS");
      __name(attrFunction2, "attrFunction");
      __name(attrFunctionNS2, "attrFunctionNS");
      __name(attr_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attrTween.js
  function attrInterpolate(name, i2) {
    return function(t4) {
      this.setAttribute(name, i2.call(this, t4));
    };
  }
  function attrInterpolateNS(fullname, i2) {
    return function(t4) {
      this.setAttributeNS(fullname.space, fullname.local, i2.call(this, t4));
    };
  }
  function attrTweenNS(fullname, value2) {
    var t03, i0;
    function tween() {
      var i2 = value2.apply(this, arguments);
      if (i2 !== i0) t03 = (i0 = i2) && attrInterpolateNS(fullname, i2);
      return t03;
    }
    __name(tween, "tween");
    tween._value = value2;
    return tween;
  }
  function attrTween(name, value2) {
    var t03, i0;
    function tween() {
      var i2 = value2.apply(this, arguments);
      if (i2 !== i0) t03 = (i0 = i2) && attrInterpolate(name, i2);
      return t03;
    }
    __name(tween, "tween");
    tween._value = value2;
    return tween;
  }
  function attrTween_default(name, value2) {
    var key = "attr." + name;
    if (arguments.length < 2) return (key = this.tween(key)) && key._value;
    if (value2 == null) return this.tween(key, null);
    if (typeof value2 !== "function") throw new Error();
    var fullname = namespace_default(name);
    return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value2));
  }
  var init_attrTween = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attrTween.js"() {
      "use strict";
      init_src5();
      __name(attrInterpolate, "attrInterpolate");
      __name(attrInterpolateNS, "attrInterpolateNS");
      __name(attrTweenNS, "attrTweenNS");
      __name(attrTween, "attrTween");
      __name(attrTween_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/delay.js
  function delayFunction(id34, value2) {
    return function() {
      init(this, id34).delay = +value2.apply(this, arguments);
    };
  }
  function delayConstant(id34, value2) {
    return value2 = +value2, function() {
      init(this, id34).delay = value2;
    };
  }
  function delay_default(value2) {
    var id34 = this._id;
    return arguments.length ? this.each((typeof value2 === "function" ? delayFunction : delayConstant)(id34, value2)) : get2(this.node(), id34).delay;
  }
  var init_delay = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/delay.js"() {
      "use strict";
      init_schedule();
      __name(delayFunction, "delayFunction");
      __name(delayConstant, "delayConstant");
      __name(delay_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/duration.js
  function durationFunction(id34, value2) {
    return function() {
      set2(this, id34).duration = +value2.apply(this, arguments);
    };
  }
  function durationConstant(id34, value2) {
    return value2 = +value2, function() {
      set2(this, id34).duration = value2;
    };
  }
  function duration_default(value2) {
    var id34 = this._id;
    return arguments.length ? this.each((typeof value2 === "function" ? durationFunction : durationConstant)(id34, value2)) : get2(this.node(), id34).duration;
  }
  var init_duration = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/duration.js"() {
      "use strict";
      init_schedule();
      __name(durationFunction, "durationFunction");
      __name(durationConstant, "durationConstant");
      __name(duration_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/ease.js
  function easeConstant(id34, value2) {
    if (typeof value2 !== "function") throw new Error();
    return function() {
      set2(this, id34).ease = value2;
    };
  }
  function ease_default(value2) {
    var id34 = this._id;
    return arguments.length ? this.each(easeConstant(id34, value2)) : get2(this.node(), id34).ease;
  }
  var init_ease = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/ease.js"() {
      "use strict";
      init_schedule();
      __name(easeConstant, "easeConstant");
      __name(ease_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/easeVarying.js
  function easeVarying(id34, value2) {
    return function() {
      var v3 = value2.apply(this, arguments);
      if (typeof v3 !== "function") throw new Error();
      set2(this, id34).ease = v3;
    };
  }
  function easeVarying_default(value2) {
    if (typeof value2 !== "function") throw new Error();
    return this.each(easeVarying(this._id, value2));
  }
  var init_easeVarying = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/easeVarying.js"() {
      "use strict";
      init_schedule();
      __name(easeVarying, "easeVarying");
      __name(easeVarying_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/filter.js
  function filter_default2(match2) {
    if (typeof match2 !== "function") match2 = matcher_default(match2);
    for (var groups = this._groups, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
      for (var group2 = groups[j3], n2 = group2.length, subgroup = subgroups[j3] = [], node2, i2 = 0; i2 < n2; ++i2) {
        if ((node2 = group2[i2]) && match2.call(node2, node2.__data__, i2, group2)) {
          subgroup.push(node2);
        }
      }
    }
    return new Transition(subgroups, this._parents, this._name, this._id);
  }
  var init_filter2 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/filter.js"() {
      "use strict";
      init_src5();
      init_transition2();
      __name(filter_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/merge.js
  function merge_default2(transition2) {
    if (transition2._id !== this._id) throw new Error();
    for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m3 = Math.min(m0, m1), merges = new Array(m0), j3 = 0; j3 < m3; ++j3) {
      for (var group0 = groups0[j3], group1 = groups1[j3], n2 = group0.length, merge5 = merges[j3] = new Array(n2), node2, i2 = 0; i2 < n2; ++i2) {
        if (node2 = group0[i2] || group1[i2]) {
          merge5[i2] = node2;
        }
      }
    }
    for (; j3 < m0; ++j3) {
      merges[j3] = groups0[j3];
    }
    return new Transition(merges, this._parents, this._name, this._id);
  }
  var init_merge3 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/merge.js"() {
      "use strict";
      init_transition2();
      __name(merge_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/on.js
  function start(name) {
    return (name + "").trim().split(/^|\s+/).every(function(t4) {
      var i2 = t4.indexOf(".");
      if (i2 >= 0) t4 = t4.slice(0, i2);
      return !t4 || t4 === "start";
    });
  }
  function onFunction(id34, name, listener) {
    var on0, on1, sit = start(name) ? init : set2;
    return function() {
      var schedule = sit(this, id34), on3 = schedule.on;
      if (on3 !== on0) (on1 = (on0 = on3).copy()).on(name, listener);
      schedule.on = on1;
    };
  }
  function on_default2(name, listener) {
    var id34 = this._id;
    return arguments.length < 2 ? get2(this.node(), id34).on.on(name) : this.each(onFunction(id34, name, listener));
  }
  var init_on2 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/on.js"() {
      "use strict";
      init_schedule();
      __name(start, "start");
      __name(onFunction, "onFunction");
      __name(on_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/remove.js
  function removeFunction(id34) {
    return function() {
      var parent4 = this.parentNode;
      for (var i2 in this.__transition) if (+i2 !== id34) return;
      if (parent4) parent4.removeChild(this);
    };
  }
  function remove_default2() {
    return this.on("end.remove", removeFunction(this._id));
  }
  var init_remove2 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/remove.js"() {
      "use strict";
      __name(removeFunction, "removeFunction");
      __name(remove_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/select.js
  function select_default3(select) {
    var name = this._name, id34 = this._id;
    if (typeof select !== "function") select = selector_default(select);
    for (var groups = this._groups, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
      for (var group2 = groups[j3], n2 = group2.length, subgroup = subgroups[j3] = new Array(n2), node2, subnode, i2 = 0; i2 < n2; ++i2) {
        if ((node2 = group2[i2]) && (subnode = select.call(node2, node2.__data__, i2, group2))) {
          if ("__data__" in node2) subnode.__data__ = node2.__data__;
          subgroup[i2] = subnode;
          schedule_default(subgroup[i2], name, id34, i2, subgroup, get2(node2, id34));
        }
      }
    }
    return new Transition(subgroups, this._parents, name, id34);
  }
  var init_select3 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/select.js"() {
      "use strict";
      init_src5();
      init_transition2();
      init_schedule();
      __name(select_default3, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selectAll.js
  function selectAll_default2(select) {
    var name = this._name, id34 = this._id;
    if (typeof select !== "function") select = selectorAll_default(select);
    for (var groups = this._groups, m3 = groups.length, subgroups = [], parents3 = [], j3 = 0; j3 < m3; ++j3) {
      for (var group2 = groups[j3], n2 = group2.length, node2, i2 = 0; i2 < n2; ++i2) {
        if (node2 = group2[i2]) {
          for (var children2 = select.call(node2, node2.__data__, i2, group2), child, inherit2 = get2(node2, id34), k2 = 0, l4 = children2.length; k2 < l4; ++k2) {
            if (child = children2[k2]) {
              schedule_default(child, name, id34, k2, children2, inherit2);
            }
          }
          subgroups.push(children2);
          parents3.push(node2);
        }
      }
    }
    return new Transition(subgroups, parents3, name, id34);
  }
  var init_selectAll2 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selectAll.js"() {
      "use strict";
      init_src5();
      init_transition2();
      init_schedule();
      __name(selectAll_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selection.js
  function selection_default2() {
    return new Selection2(this._groups, this._parents);
  }
  var Selection2;
  var init_selection2 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selection.js"() {
      "use strict";
      init_src5();
      Selection2 = selection_default.prototype.constructor;
      __name(selection_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/style.js
  function styleNull(name, interpolate) {
    var string00, string10, interpolate0;
    return function() {
      var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
      return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
    };
  }
  function styleRemove2(name) {
    return function() {
      this.style.removeProperty(name);
    };
  }
  function styleConstant2(name, interpolate, value1) {
    var string00, string1 = value1 + "", interpolate0;
    return function() {
      var string0 = styleValue(this, name);
      return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
    };
  }
  function styleFunction2(name, interpolate, value2) {
    var string00, string10, interpolate0;
    return function() {
      var string0 = styleValue(this, name), value1 = value2(this), string1 = value1 + "";
      if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
      return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
    };
  }
  function styleMaybeRemove(id34, name) {
    var on0, on1, listener0, key = "style." + name, event3 = "end." + key, remove3;
    return function() {
      var schedule = set2(this, id34), on3 = schedule.on, listener = schedule.value[key] == null ? remove3 || (remove3 = styleRemove2(name)) : void 0;
      if (on3 !== on0 || listener0 !== listener) (on1 = (on0 = on3).copy()).on(event3, listener0 = listener);
      schedule.on = on1;
    };
  }
  function style_default2(name, value2, priority3) {
    var i2 = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
    return value2 == null ? this.styleTween(name, styleNull(name, i2)).on("end.style." + name, styleRemove2(name)) : typeof value2 === "function" ? this.styleTween(name, styleFunction2(name, i2, tweenValue(this, "style." + name, value2))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant2(name, i2, value2), priority3).on("end.style." + name, null);
  }
  var init_style2 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/style.js"() {
      "use strict";
      init_src8();
      init_src5();
      init_schedule();
      init_tween();
      init_interpolate();
      __name(styleNull, "styleNull");
      __name(styleRemove2, "styleRemove");
      __name(styleConstant2, "styleConstant");
      __name(styleFunction2, "styleFunction");
      __name(styleMaybeRemove, "styleMaybeRemove");
      __name(style_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/styleTween.js
  function styleInterpolate(name, i2, priority3) {
    return function(t4) {
      this.style.setProperty(name, i2.call(this, t4), priority3);
    };
  }
  function styleTween(name, value2, priority3) {
    var t4, i0;
    function tween() {
      var i2 = value2.apply(this, arguments);
      if (i2 !== i0) t4 = (i0 = i2) && styleInterpolate(name, i2, priority3);
      return t4;
    }
    __name(tween, "tween");
    tween._value = value2;
    return tween;
  }
  function styleTween_default(name, value2, priority3) {
    var key = "style." + (name += "");
    if (arguments.length < 2) return (key = this.tween(key)) && key._value;
    if (value2 == null) return this.tween(key, null);
    if (typeof value2 !== "function") throw new Error();
    return this.tween(key, styleTween(name, value2, priority3 == null ? "" : priority3));
  }
  var init_styleTween = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/styleTween.js"() {
      "use strict";
      __name(styleInterpolate, "styleInterpolate");
      __name(styleTween, "styleTween");
      __name(styleTween_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/text.js
  function textConstant2(value2) {
    return function() {
      this.textContent = value2;
    };
  }
  function textFunction2(value2) {
    return function() {
      var value1 = value2(this);
      this.textContent = value1 == null ? "" : value1;
    };
  }
  function text_default2(value2) {
    return this.tween("text", typeof value2 === "function" ? textFunction2(tweenValue(this, "text", value2)) : textConstant2(value2 == null ? "" : value2 + ""));
  }
  var init_text2 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/text.js"() {
      "use strict";
      init_tween();
      __name(textConstant2, "textConstant");
      __name(textFunction2, "textFunction");
      __name(text_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/textTween.js
  function textInterpolate(i2) {
    return function(t4) {
      this.textContent = i2.call(this, t4);
    };
  }
  function textTween(value2) {
    var t03, i0;
    function tween() {
      var i2 = value2.apply(this, arguments);
      if (i2 !== i0) t03 = (i0 = i2) && textInterpolate(i2);
      return t03;
    }
    __name(tween, "tween");
    tween._value = value2;
    return tween;
  }
  function textTween_default(value2) {
    var key = "text";
    if (arguments.length < 1) return (key = this.tween(key)) && key._value;
    if (value2 == null) return this.tween(key, null);
    if (typeof value2 !== "function") throw new Error();
    return this.tween(key, textTween(value2));
  }
  var init_textTween = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/textTween.js"() {
      "use strict";
      __name(textInterpolate, "textInterpolate");
      __name(textTween, "textTween");
      __name(textTween_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/transition.js
  function transition_default() {
    var name = this._name, id0 = this._id, id1 = newId();
    for (var groups = this._groups, m3 = groups.length, j3 = 0; j3 < m3; ++j3) {
      for (var group2 = groups[j3], n2 = group2.length, node2, i2 = 0; i2 < n2; ++i2) {
        if (node2 = group2[i2]) {
          var inherit2 = get2(node2, id0);
          schedule_default(node2, name, id1, i2, group2, {
            time: inherit2.time + inherit2.delay + inherit2.duration,
            delay: 0,
            duration: inherit2.duration,
            ease: inherit2.ease
          });
        }
      }
    }
    return new Transition(groups, this._parents, name, id1);
  }
  var init_transition = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/transition.js"() {
      "use strict";
      init_transition2();
      init_schedule();
      __name(transition_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/end.js
  function end_default() {
    var on0, on1, that = this, id34 = that._id, size4 = that.size();
    return new Promise(function(resolve2, reject3) {
      var cancel = { value: reject3 }, end2 = { value: /* @__PURE__ */ __name(function() {
        if (--size4 === 0) resolve2();
      }, "value") };
      that.each(function() {
        var schedule = set2(this, id34), on3 = schedule.on;
        if (on3 !== on0) {
          on1 = (on0 = on3).copy();
          on1._.cancel.push(cancel);
          on1._.interrupt.push(cancel);
          on1._.end.push(end2);
        }
        schedule.on = on1;
      });
      if (size4 === 0) resolve2();
    });
  }
  var init_end = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/end.js"() {
      "use strict";
      init_schedule();
      __name(end_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/index.js
  function Transition(groups, parents3, name, id34) {
    this._groups = groups;
    this._parents = parents3;
    this._name = name;
    this._id = id34;
  }
  function transition(name) {
    return selection_default().transition(name);
  }
  function newId() {
    return ++id;
  }
  var id, selection_prototype;
  var init_transition2 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/index.js"() {
      "use strict";
      init_src5();
      init_attr2();
      init_attrTween();
      init_delay();
      init_duration();
      init_ease();
      init_easeVarying();
      init_filter2();
      init_merge3();
      init_on2();
      init_remove2();
      init_select3();
      init_selectAll2();
      init_selection2();
      init_style2();
      init_styleTween();
      init_text2();
      init_textTween();
      init_transition();
      init_tween();
      init_end();
      id = 0;
      __name(Transition, "Transition");
      __name(transition, "transition");
      __name(newId, "newId");
      selection_prototype = selection_default.prototype;
      Transition.prototype = transition.prototype = {
        constructor: Transition,
        select: select_default3,
        selectAll: selectAll_default2,
        selectChild: selection_prototype.selectChild,
        selectChildren: selection_prototype.selectChildren,
        filter: filter_default2,
        merge: merge_default2,
        selection: selection_default2,
        transition: transition_default,
        call: selection_prototype.call,
        nodes: selection_prototype.nodes,
        node: selection_prototype.node,
        size: selection_prototype.size,
        empty: selection_prototype.empty,
        each: selection_prototype.each,
        on: on_default2,
        attr: attr_default2,
        attrTween: attrTween_default,
        style: style_default2,
        styleTween: styleTween_default,
        text: text_default2,
        textTween: textTween_default,
        remove: remove_default2,
        tween: tween_default,
        delay: delay_default,
        duration: duration_default,
        ease: ease_default,
        easeVarying: easeVarying_default,
        end: end_default,
        [Symbol.iterator]: selection_prototype[Symbol.iterator]
      };
    }
  });

  // ../../node_modules/.pnpm/d3-ease@3.0.1/node_modules/d3-ease/src/cubic.js
  function cubicInOut(t4) {
    return ((t4 *= 2) <= 1 ? t4 * t4 * t4 : (t4 -= 2) * t4 * t4 + 2) / 2;
  }
  var init_cubic = __esm({
    "../../node_modules/.pnpm/d3-ease@3.0.1/node_modules/d3-ease/src/cubic.js"() {
      "use strict";
      __name(cubicInOut, "cubicInOut");
    }
  });

  // ../../node_modules/.pnpm/d3-ease@3.0.1/node_modules/d3-ease/src/index.js
  var init_src10 = __esm({
    "../../node_modules/.pnpm/d3-ease@3.0.1/node_modules/d3-ease/src/index.js"() {
      "use strict";
      init_cubic();
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/transition.js
  function inherit(node2, id34) {
    var timing;
    while (!(timing = node2.__transition) || !(timing = timing[id34])) {
      if (!(node2 = node2.parentNode)) {
        throw new Error(`transition ${id34} not found`);
      }
    }
    return timing;
  }
  function transition_default2(name) {
    var id34, timing;
    if (name instanceof Transition) {
      id34 = name._id, name = name._name;
    } else {
      id34 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
    }
    for (var groups = this._groups, m3 = groups.length, j3 = 0; j3 < m3; ++j3) {
      for (var group2 = groups[j3], n2 = group2.length, node2, i2 = 0; i2 < n2; ++i2) {
        if (node2 = group2[i2]) {
          schedule_default(node2, name, id34, i2, group2, timing || inherit(node2, id34));
        }
      }
    }
    return new Transition(groups, this._parents, name, id34);
  }
  var defaultTiming;
  var init_transition3 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/transition.js"() {
      "use strict";
      init_transition2();
      init_schedule();
      init_src10();
      init_src9();
      defaultTiming = {
        time: null,
        // Set on use.
        delay: 0,
        duration: 250,
        ease: cubicInOut
      };
      __name(inherit, "inherit");
      __name(transition_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js
  var init_selection3 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js"() {
      "use strict";
      init_src5();
      init_interrupt2();
      init_transition3();
      selection_default.prototype.interrupt = interrupt_default2;
      selection_default.prototype.transition = transition_default2;
    }
  });

  // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/index.js
  var init_src11 = __esm({
    "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/index.js"() {
      "use strict";
      init_selection3();
    }
  });

  // ../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/constant.js
  var init_constant3 = __esm({
    "../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/constant.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/event.js
  var init_event = __esm({
    "../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/event.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/noevent.js
  var init_noevent = __esm({
    "../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/noevent.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/brush.js
  function number1(e3) {
    return [+e3[0], +e3[1]];
  }
  function number22(e3) {
    return [number1(e3[0]), number1(e3[1])];
  }
  function type(t4) {
    return { type: t4 };
  }
  var abs, max2, min2, X, Y, XY;
  var init_brush = __esm({
    "../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/brush.js"() {
      "use strict";
      init_src11();
      init_constant3();
      init_event();
      init_noevent();
      ({ abs, max: max2, min: min2 } = Math);
      __name(number1, "number1");
      __name(number22, "number2");
      X = {
        name: "x",
        handles: ["w", "e"].map(type),
        input: /* @__PURE__ */ __name(function(x5, e3) {
          return x5 == null ? null : [[+x5[0], e3[0][1]], [+x5[1], e3[1][1]]];
        }, "input"),
        output: /* @__PURE__ */ __name(function(xy) {
          return xy && [xy[0][0], xy[1][0]];
        }, "output")
      };
      Y = {
        name: "y",
        handles: ["n", "s"].map(type),
        input: /* @__PURE__ */ __name(function(y6, e3) {
          return y6 == null ? null : [[e3[0][0], +y6[0]], [e3[1][0], +y6[1]]];
        }, "input"),
        output: /* @__PURE__ */ __name(function(xy) {
          return xy && [xy[0][1], xy[1][1]];
        }, "output")
      };
      XY = {
        name: "xy",
        handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
        input: /* @__PURE__ */ __name(function(xy) {
          return xy == null ? null : number22(xy);
        }, "input"),
        output: /* @__PURE__ */ __name(function(xy) {
          return xy;
        }, "output")
      };
      __name(type, "type");
    }
  });

  // ../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/index.js
  var init_src12 = __esm({
    "../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/index.js"() {
      "use strict";
      init_brush();
    }
  });

  // ../../node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js
  function append(strings) {
    this._ += strings[0];
    for (let i2 = 1, n2 = strings.length; i2 < n2; ++i2) {
      this._ += arguments[i2] + strings[i2];
    }
  }
  function appendRound(digits) {
    let d3 = Math.floor(digits);
    if (!(d3 >= 0)) throw new Error(`invalid digits: ${digits}`);
    if (d3 > 15) return append;
    const k2 = 10 ** d3;
    return function(strings) {
      this._ += strings[0];
      for (let i2 = 1, n2 = strings.length; i2 < n2; ++i2) {
        this._ += Math.round(arguments[i2] * k2) / k2 + strings[i2];
      }
    };
  }
  function path2() {
    return new Path();
  }
  var pi, tau, epsilon2, tauEpsilon, Path;
  var init_path = __esm({
    "../../node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js"() {
      "use strict";
      pi = Math.PI;
      tau = 2 * pi;
      epsilon2 = 1e-6;
      tauEpsilon = tau - epsilon2;
      __name(append, "append");
      __name(appendRound, "appendRound");
      Path = class {
        static {
          __name(this, "Path");
        }
        constructor(digits) {
          this._x0 = this._y0 = // start of current subpath
          this._x1 = this._y1 = null;
          this._ = "";
          this._append = digits == null ? append : appendRound(digits);
        }
        moveTo(x5, y6) {
          this._append`M${this._x0 = this._x1 = +x5},${this._y0 = this._y1 = +y6}`;
        }
        closePath() {
          if (this._x1 !== null) {
            this._x1 = this._x0, this._y1 = this._y0;
            this._append`Z`;
          }
        }
        lineTo(x5, y6) {
          this._append`L${this._x1 = +x5},${this._y1 = +y6}`;
        }
        quadraticCurveTo(x1, y1, x5, y6) {
          this._append`Q${+x1},${+y1},${this._x1 = +x5},${this._y1 = +y6}`;
        }
        bezierCurveTo(x1, y1, x22, y22, x5, y6) {
          this._append`C${+x1},${+y1},${+x22},${+y22},${this._x1 = +x5},${this._y1 = +y6}`;
        }
        arcTo(x1, y1, x22, y22, r2) {
          x1 = +x1, y1 = +y1, x22 = +x22, y22 = +y22, r2 = +r2;
          if (r2 < 0) throw new Error(`negative radius: ${r2}`);
          let x0 = this._x1, y0 = this._y1, x21 = x22 - x1, y21 = y22 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
          if (this._x1 === null) {
            this._append`M${this._x1 = x1},${this._y1 = y1}`;
          } else if (!(l01_2 > epsilon2)) ;
          else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon2) || !r2) {
            this._append`L${this._x1 = x1},${this._y1 = y1}`;
          } else {
            let x20 = x22 - x0, y20 = y22 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l4 = r2 * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l4 / l01, t21 = l4 / l21;
            if (Math.abs(t01 - 1) > epsilon2) {
              this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;
            }
            this._append`A${r2},${r2},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;
          }
        }
        arc(x5, y6, r2, a0, a1, ccw) {
          x5 = +x5, y6 = +y6, r2 = +r2, ccw = !!ccw;
          if (r2 < 0) throw new Error(`negative radius: ${r2}`);
          let dx = r2 * Math.cos(a0), dy = r2 * Math.sin(a0), x0 = x5 + dx, y0 = y6 + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
          if (this._x1 === null) {
            this._append`M${x0},${y0}`;
          } else if (Math.abs(this._x1 - x0) > epsilon2 || Math.abs(this._y1 - y0) > epsilon2) {
            this._append`L${x0},${y0}`;
          }
          if (!r2) return;
          if (da < 0) da = da % tau + tau;
          if (da > tauEpsilon) {
            this._append`A${r2},${r2},0,1,${cw},${x5 - dx},${y6 - dy}A${r2},${r2},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;
          } else if (da > epsilon2) {
            this._append`A${r2},${r2},0,${+(da >= pi)},${cw},${this._x1 = x5 + r2 * Math.cos(a1)},${this._y1 = y6 + r2 * Math.sin(a1)}`;
          }
        }
        rect(x5, y6, w4, h3) {
          this._append`M${this._x0 = this._x1 = +x5},${this._y0 = this._y1 = +y6}h${w4 = +w4}v${+h3}h${-w4}Z`;
        }
        toString() {
          return this._;
        }
      };
      __name(path2, "path");
      path2.prototype = Path.prototype;
    }
  });

  // ../../node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/index.js
  var init_src13 = __esm({
    "../../node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/index.js"() {
      "use strict";
      init_path();
    }
  });

  // ../../node_modules/.pnpm/d3-chord@3.0.1/node_modules/d3-chord/src/index.js
  var init_src14 = __esm({
    "../../node_modules/.pnpm/d3-chord@3.0.1/node_modules/d3-chord/src/index.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-contour@4.0.2/node_modules/d3-contour/src/index.js
  var init_src15 = __esm({
    "../../node_modules/.pnpm/d3-contour@4.0.2/node_modules/d3-contour/src/index.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-delaunay@6.0.4/node_modules/d3-delaunay/src/index.js
  var init_src16 = __esm({
    "../../node_modules/.pnpm/d3-delaunay@6.0.4/node_modules/d3-delaunay/src/index.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-dsv@3.0.1/node_modules/d3-dsv/src/index.js
  var init_src17 = __esm({
    "../../node_modules/.pnpm/d3-dsv@3.0.1/node_modules/d3-dsv/src/index.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-fetch@3.0.1/node_modules/d3-fetch/src/index.js
  var init_src18 = __esm({
    "../../node_modules/.pnpm/d3-fetch@3.0.1/node_modules/d3-fetch/src/index.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/index.js
  var init_src19 = __esm({
    "../../node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/index.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-force@3.0.0/node_modules/d3-force/src/index.js
  var init_src20 = __esm({
    "../../node_modules/.pnpm/d3-force@3.0.0/node_modules/d3-force/src/index.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatDecimal.js
  function formatDecimal_default(x5) {
    return Math.abs(x5 = Math.round(x5)) >= 1e21 ? x5.toLocaleString("en").replace(/,/g, "") : x5.toString(10);
  }
  function formatDecimalParts(x5, p3) {
    if ((i2 = (x5 = p3 ? x5.toExponential(p3 - 1) : x5.toExponential()).indexOf("e")) < 0) return null;
    var i2, coefficient = x5.slice(0, i2);
    return [
      coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
      +x5.slice(i2 + 1)
    ];
  }
  var init_formatDecimal = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatDecimal.js"() {
      "use strict";
      __name(formatDecimal_default, "default");
      __name(formatDecimalParts, "formatDecimalParts");
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/exponent.js
  function exponent_default(x5) {
    return x5 = formatDecimalParts(Math.abs(x5)), x5 ? x5[1] : NaN;
  }
  var init_exponent = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/exponent.js"() {
      "use strict";
      init_formatDecimal();
      __name(exponent_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatGroup.js
  function formatGroup_default(grouping, thousands) {
    return function(value2, width3) {
      var i2 = value2.length, t4 = [], j3 = 0, g2 = grouping[0], length2 = 0;
      while (i2 > 0 && g2 > 0) {
        if (length2 + g2 + 1 > width3) g2 = Math.max(1, width3 - length2);
        t4.push(value2.substring(i2 -= g2, i2 + g2));
        if ((length2 += g2 + 1) > width3) break;
        g2 = grouping[j3 = (j3 + 1) % grouping.length];
      }
      return t4.reverse().join(thousands);
    };
  }
  var init_formatGroup = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatGroup.js"() {
      "use strict";
      __name(formatGroup_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatNumerals.js
  function formatNumerals_default(numerals) {
    return function(value2) {
      return value2.replace(/[0-9]/g, function(i2) {
        return numerals[+i2];
      });
    };
  }
  var init_formatNumerals = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatNumerals.js"() {
      "use strict";
      __name(formatNumerals_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatSpecifier.js
  function formatSpecifier(specifier) {
    if (!(match2 = re.exec(specifier))) throw new Error("invalid format: " + specifier);
    var match2;
    return new FormatSpecifier({
      fill: match2[1],
      align: match2[2],
      sign: match2[3],
      symbol: match2[4],
      zero: match2[5],
      width: match2[6],
      comma: match2[7],
      precision: match2[8] && match2[8].slice(1),
      trim: match2[9],
      type: match2[10]
    });
  }
  function FormatSpecifier(specifier) {
    this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
    this.align = specifier.align === void 0 ? ">" : specifier.align + "";
    this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
    this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
    this.zero = !!specifier.zero;
    this.width = specifier.width === void 0 ? void 0 : +specifier.width;
    this.comma = !!specifier.comma;
    this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
    this.trim = !!specifier.trim;
    this.type = specifier.type === void 0 ? "" : specifier.type + "";
  }
  var re;
  var init_formatSpecifier = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatSpecifier.js"() {
      "use strict";
      re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
      __name(formatSpecifier, "formatSpecifier");
      formatSpecifier.prototype = FormatSpecifier.prototype;
      __name(FormatSpecifier, "FormatSpecifier");
      FormatSpecifier.prototype.toString = function() {
        return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
      };
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatTrim.js
  function formatTrim_default(s2) {
    out: for (var n2 = s2.length, i2 = 1, i0 = -1, i1; i2 < n2; ++i2) {
      switch (s2[i2]) {
        case ".":
          i0 = i1 = i2;
          break;
        case "0":
          if (i0 === 0) i0 = i2;
          i1 = i2;
          break;
        default:
          if (!+s2[i2]) break out;
          if (i0 > 0) i0 = 0;
          break;
      }
    }
    return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2;
  }
  var init_formatTrim = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatTrim.js"() {
      "use strict";
      __name(formatTrim_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatPrefixAuto.js
  function formatPrefixAuto_default(x5, p3) {
    var d3 = formatDecimalParts(x5, p3);
    if (!d3) return x5 + "";
    var coefficient = d3[0], exponent = d3[1], i2 = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n2 = coefficient.length;
    return i2 === n2 ? coefficient : i2 > n2 ? coefficient + new Array(i2 - n2 + 1).join("0") : i2 > 0 ? coefficient.slice(0, i2) + "." + coefficient.slice(i2) : "0." + new Array(1 - i2).join("0") + formatDecimalParts(x5, Math.max(0, p3 + i2 - 1))[0];
  }
  var prefixExponent;
  var init_formatPrefixAuto = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatPrefixAuto.js"() {
      "use strict";
      init_formatDecimal();
      __name(formatPrefixAuto_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatRounded.js
  function formatRounded_default(x5, p3) {
    var d3 = formatDecimalParts(x5, p3);
    if (!d3) return x5 + "";
    var coefficient = d3[0], exponent = d3[1];
    return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0");
  }
  var init_formatRounded = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatRounded.js"() {
      "use strict";
      init_formatDecimal();
      __name(formatRounded_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatTypes.js
  var formatTypes_default;
  var init_formatTypes = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatTypes.js"() {
      "use strict";
      init_formatDecimal();
      init_formatPrefixAuto();
      init_formatRounded();
      formatTypes_default = {
        "%": /* @__PURE__ */ __name((x5, p3) => (x5 * 100).toFixed(p3), "%"),
        "b": /* @__PURE__ */ __name((x5) => Math.round(x5).toString(2), "b"),
        "c": /* @__PURE__ */ __name((x5) => x5 + "", "c"),
        "d": formatDecimal_default,
        "e": /* @__PURE__ */ __name((x5, p3) => x5.toExponential(p3), "e"),
        "f": /* @__PURE__ */ __name((x5, p3) => x5.toFixed(p3), "f"),
        "g": /* @__PURE__ */ __name((x5, p3) => x5.toPrecision(p3), "g"),
        "o": /* @__PURE__ */ __name((x5) => Math.round(x5).toString(8), "o"),
        "p": /* @__PURE__ */ __name((x5, p3) => formatRounded_default(x5 * 100, p3), "p"),
        "r": formatRounded_default,
        "s": formatPrefixAuto_default,
        "X": /* @__PURE__ */ __name((x5) => Math.round(x5).toString(16).toUpperCase(), "X"),
        "x": /* @__PURE__ */ __name((x5) => Math.round(x5).toString(16), "x")
      };
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/identity.js
  function identity_default2(x5) {
    return x5;
  }
  var init_identity2 = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/identity.js"() {
      "use strict";
      __name(identity_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/locale.js
  function locale_default(locale3) {
    var group2 = locale3.grouping === void 0 || locale3.thousands === void 0 ? identity_default2 : formatGroup_default(map.call(locale3.grouping, Number), locale3.thousands + ""), currencyPrefix = locale3.currency === void 0 ? "" : locale3.currency[0] + "", currencySuffix = locale3.currency === void 0 ? "" : locale3.currency[1] + "", decimal = locale3.decimal === void 0 ? "." : locale3.decimal + "", numerals = locale3.numerals === void 0 ? identity_default2 : formatNumerals_default(map.call(locale3.numerals, String)), percent = locale3.percent === void 0 ? "%" : locale3.percent + "", minus = locale3.minus === void 0 ? "\u2212" : locale3.minus + "", nan = locale3.nan === void 0 ? "NaN" : locale3.nan + "";
    function newFormat(specifier) {
      specifier = formatSpecifier(specifier);
      var fill = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol = specifier.symbol, zero3 = specifier.zero, width3 = specifier.width, comma = specifier.comma, precision = specifier.precision, trim2 = specifier.trim, type3 = specifier.type;
      if (type3 === "n") comma = true, type3 = "g";
      else if (!formatTypes_default[type3]) precision === void 0 && (precision = 12), trim2 = true, type3 = "g";
      if (zero3 || fill === "0" && align === "=") zero3 = true, fill = "0", align = "=";
      var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type3) ? "0" + type3.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type3) ? percent : "";
      var formatType = formatTypes_default[type3], maybeSuffix = /[defgprs%]/.test(type3);
      precision = precision === void 0 ? 6 : /[gprs]/.test(type3) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
      function format3(value2) {
        var valuePrefix = prefix, valueSuffix = suffix, i2, n2, c3;
        if (type3 === "c") {
          valueSuffix = formatType(value2) + valueSuffix;
          value2 = "";
        } else {
          value2 = +value2;
          var valueNegative = value2 < 0 || 1 / value2 < 0;
          value2 = isNaN(value2) ? nan : formatType(Math.abs(value2), precision);
          if (trim2) value2 = formatTrim_default(value2);
          if (valueNegative && +value2 === 0 && sign2 !== "+") valueNegative = false;
          valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
          valueSuffix = (type3 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
          if (maybeSuffix) {
            i2 = -1, n2 = value2.length;
            while (++i2 < n2) {
              if (c3 = value2.charCodeAt(i2), 48 > c3 || c3 > 57) {
                valueSuffix = (c3 === 46 ? decimal + value2.slice(i2 + 1) : value2.slice(i2)) + valueSuffix;
                value2 = value2.slice(0, i2);
                break;
              }
            }
          }
        }
        if (comma && !zero3) value2 = group2(value2, Infinity);
        var length2 = valuePrefix.length + value2.length + valueSuffix.length, padding2 = length2 < width3 ? new Array(width3 - length2 + 1).join(fill) : "";
        if (comma && zero3) value2 = group2(padding2 + value2, padding2.length ? width3 - valueSuffix.length : Infinity), padding2 = "";
        switch (align) {
          case "<":
            value2 = valuePrefix + value2 + valueSuffix + padding2;
            break;
          case "=":
            value2 = valuePrefix + padding2 + value2 + valueSuffix;
            break;
          case "^":
            value2 = padding2.slice(0, length2 = padding2.length >> 1) + valuePrefix + value2 + valueSuffix + padding2.slice(length2);
            break;
          default:
            value2 = padding2 + valuePrefix + value2 + valueSuffix;
            break;
        }
        return numerals(value2);
      }
      __name(format3, "format");
      format3.toString = function() {
        return specifier + "";
      };
      return format3;
    }
    __name(newFormat, "newFormat");
    function formatPrefix2(specifier, value2) {
      var f2 = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e3 = Math.max(-8, Math.min(8, Math.floor(exponent_default(value2) / 3))) * 3, k2 = Math.pow(10, -e3), prefix = prefixes[8 + e3 / 3];
      return function(value3) {
        return f2(k2 * value3) + prefix;
      };
    }
    __name(formatPrefix2, "formatPrefix");
    return {
      format: newFormat,
      formatPrefix: formatPrefix2
    };
  }
  var map, prefixes;
  var init_locale = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/locale.js"() {
      "use strict";
      init_exponent();
      init_formatGroup();
      init_formatNumerals();
      init_formatSpecifier();
      init_formatTrim();
      init_formatTypes();
      init_formatPrefixAuto();
      init_identity2();
      map = Array.prototype.map;
      prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
      __name(locale_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/defaultLocale.js
  function defaultLocale(definition) {
    locale = locale_default(definition);
    format2 = locale.format;
    formatPrefix = locale.formatPrefix;
    return locale;
  }
  var locale, format2, formatPrefix;
  var init_defaultLocale = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/defaultLocale.js"() {
      "use strict";
      init_locale();
      defaultLocale({
        thousands: ",",
        grouping: [3],
        currency: ["$", ""]
      });
      __name(defaultLocale, "defaultLocale");
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionFixed.js
  function precisionFixed_default(step3) {
    return Math.max(0, -exponent_default(Math.abs(step3)));
  }
  var init_precisionFixed = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionFixed.js"() {
      "use strict";
      init_exponent();
      __name(precisionFixed_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionPrefix.js
  function precisionPrefix_default(step3, value2) {
    return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value2) / 3))) * 3 - exponent_default(Math.abs(step3)));
  }
  var init_precisionPrefix = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionPrefix.js"() {
      "use strict";
      init_exponent();
      __name(precisionPrefix_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionRound.js
  function precisionRound_default(step3, max10) {
    step3 = Math.abs(step3), max10 = Math.abs(max10) - step3;
    return Math.max(0, exponent_default(max10) - exponent_default(step3)) + 1;
  }
  var init_precisionRound = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionRound.js"() {
      "use strict";
      init_exponent();
      __name(precisionRound_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/index.js
  var init_src21 = __esm({
    "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/index.js"() {
      "use strict";
      init_defaultLocale();
      init_formatSpecifier();
      init_precisionFixed();
      init_precisionPrefix();
      init_precisionRound();
    }
  });

  // ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/index.js
  var init_src22 = __esm({
    "../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/index.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/count.js
  function count(node2) {
    var sum2 = 0, children2 = node2.children, i2 = children2 && children2.length;
    if (!i2) sum2 = 1;
    else while (--i2 >= 0) sum2 += children2[i2].value;
    node2.value = sum2;
  }
  function count_default() {
    return this.eachAfter(count);
  }
  var init_count = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/count.js"() {
      "use strict";
      __name(count, "count");
      __name(count_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/each.js
  function each_default2(callback, that) {
    let index = -1;
    for (const node2 of this) {
      callback.call(that, node2, ++index, this);
    }
    return this;
  }
  var init_each2 = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/each.js"() {
      "use strict";
      __name(each_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/eachBefore.js
  function eachBefore_default(callback, that) {
    var node2 = this, nodes5 = [node2], children2, i2, index = -1;
    while (node2 = nodes5.pop()) {
      callback.call(that, node2, ++index, this);
      if (children2 = node2.children) {
        for (i2 = children2.length - 1; i2 >= 0; --i2) {
          nodes5.push(children2[i2]);
        }
      }
    }
    return this;
  }
  var init_eachBefore = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/eachBefore.js"() {
      "use strict";
      __name(eachBefore_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/eachAfter.js
  function eachAfter_default(callback, that) {
    var node2 = this, nodes5 = [node2], next3 = [], children2, i2, n2, index = -1;
    while (node2 = nodes5.pop()) {
      next3.push(node2);
      if (children2 = node2.children) {
        for (i2 = 0, n2 = children2.length; i2 < n2; ++i2) {
          nodes5.push(children2[i2]);
        }
      }
    }
    while (node2 = next3.pop()) {
      callback.call(that, node2, ++index, this);
    }
    return this;
  }
  var init_eachAfter = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/eachAfter.js"() {
      "use strict";
      __name(eachAfter_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/find.js
  function find_default(callback, that) {
    let index = -1;
    for (const node2 of this) {
      if (callback.call(that, node2, ++index, this)) {
        return node2;
      }
    }
  }
  var init_find = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/find.js"() {
      "use strict";
      __name(find_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/sum.js
  function sum_default(value2) {
    return this.eachAfter(function(node2) {
      var sum2 = +value2(node2.data) || 0, children2 = node2.children, i2 = children2 && children2.length;
      while (--i2 >= 0) sum2 += children2[i2].value;
      node2.value = sum2;
    });
  }
  var init_sum = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/sum.js"() {
      "use strict";
      __name(sum_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/sort.js
  function sort_default2(compare) {
    return this.eachBefore(function(node2) {
      if (node2.children) {
        node2.children.sort(compare);
      }
    });
  }
  var init_sort2 = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/sort.js"() {
      "use strict";
      __name(sort_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/path.js
  function path_default(end2) {
    var start3 = this, ancestor = leastCommonAncestor(start3, end2), nodes5 = [start3];
    while (start3 !== ancestor) {
      start3 = start3.parent;
      nodes5.push(start3);
    }
    var k2 = nodes5.length;
    while (end2 !== ancestor) {
      nodes5.splice(k2, 0, end2);
      end2 = end2.parent;
    }
    return nodes5;
  }
  function leastCommonAncestor(a2, b3) {
    if (a2 === b3) return a2;
    var aNodes = a2.ancestors(), bNodes = b3.ancestors(), c3 = null;
    a2 = aNodes.pop();
    b3 = bNodes.pop();
    while (a2 === b3) {
      c3 = a2;
      a2 = aNodes.pop();
      b3 = bNodes.pop();
    }
    return c3;
  }
  var init_path2 = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/path.js"() {
      "use strict";
      __name(path_default, "default");
      __name(leastCommonAncestor, "leastCommonAncestor");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/ancestors.js
  function ancestors_default() {
    var node2 = this, nodes5 = [node2];
    while (node2 = node2.parent) {
      nodes5.push(node2);
    }
    return nodes5;
  }
  var init_ancestors = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/ancestors.js"() {
      "use strict";
      __name(ancestors_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/descendants.js
  function descendants_default() {
    return Array.from(this);
  }
  var init_descendants = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/descendants.js"() {
      "use strict";
      __name(descendants_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/leaves.js
  function leaves_default() {
    var leaves = [];
    this.eachBefore(function(node2) {
      if (!node2.children) {
        leaves.push(node2);
      }
    });
    return leaves;
  }
  var init_leaves = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/leaves.js"() {
      "use strict";
      __name(leaves_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/links.js
  function links_default() {
    var root3 = this, links3 = [];
    root3.each(function(node2) {
      if (node2 !== root3) {
        links3.push({ source: node2.parent, target: node2 });
      }
    });
    return links3;
  }
  var init_links = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/links.js"() {
      "use strict";
      __name(links_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/iterator.js
  function* iterator_default2() {
    var node2 = this, current, next3 = [node2], children2, i2, n2;
    do {
      current = next3.reverse(), next3 = [];
      while (node2 = current.pop()) {
        yield node2;
        if (children2 = node2.children) {
          for (i2 = 0, n2 = children2.length; i2 < n2; ++i2) {
            next3.push(children2[i2]);
          }
        }
      }
    } while (next3.length);
  }
  var init_iterator2 = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/iterator.js"() {
      "use strict";
      __name(iterator_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/index.js
  function hierarchy(data5, children2) {
    if (data5 instanceof Map) {
      data5 = [void 0, data5];
      if (children2 === void 0) children2 = mapChildren;
    } else if (children2 === void 0) {
      children2 = objectChildren;
    }
    var root3 = new Node(data5), node2, nodes5 = [root3], child, childs, i2, n2;
    while (node2 = nodes5.pop()) {
      if ((childs = children2(node2.data)) && (n2 = (childs = Array.from(childs)).length)) {
        node2.children = childs;
        for (i2 = n2 - 1; i2 >= 0; --i2) {
          nodes5.push(child = childs[i2] = new Node(childs[i2]));
          child.parent = node2;
          child.depth = node2.depth + 1;
        }
      }
    }
    return root3.eachBefore(computeHeight);
  }
  function node_copy() {
    return hierarchy(this).eachBefore(copyData);
  }
  function objectChildren(d3) {
    return d3.children;
  }
  function mapChildren(d3) {
    return Array.isArray(d3) ? d3[1] : null;
  }
  function copyData(node2) {
    if (node2.data.value !== void 0) node2.value = node2.data.value;
    node2.data = node2.data.data;
  }
  function computeHeight(node2) {
    var height2 = 0;
    do
      node2.height = height2;
    while ((node2 = node2.parent) && node2.height < ++height2);
  }
  function Node(data5) {
    this.data = data5;
    this.depth = this.height = 0;
    this.parent = null;
  }
  var init_hierarchy = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/index.js"() {
      "use strict";
      init_count();
      init_each2();
      init_eachBefore();
      init_eachAfter();
      init_find();
      init_sum();
      init_sort2();
      init_path2();
      init_ancestors();
      init_descendants();
      init_leaves();
      init_links();
      init_iterator2();
      __name(hierarchy, "hierarchy");
      __name(node_copy, "node_copy");
      __name(objectChildren, "objectChildren");
      __name(mapChildren, "mapChildren");
      __name(copyData, "copyData");
      __name(computeHeight, "computeHeight");
      __name(Node, "Node");
      Node.prototype = hierarchy.prototype = {
        constructor: Node,
        count: count_default,
        each: each_default2,
        eachAfter: eachAfter_default,
        eachBefore: eachBefore_default,
        find: find_default,
        sum: sum_default,
        sort: sort_default2,
        path: path_default,
        ancestors: ancestors_default,
        descendants: descendants_default,
        leaves: leaves_default,
        links: links_default,
        copy: node_copy,
        [Symbol.iterator]: iterator_default2
      };
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/accessors.js
  function required(f2) {
    if (typeof f2 !== "function") throw new Error();
    return f2;
  }
  var init_accessors = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/accessors.js"() {
      "use strict";
      __name(required, "required");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/constant.js
  function constantZero() {
    return 0;
  }
  function constant_default4(x5) {
    return function() {
      return x5;
    };
  }
  var init_constant4 = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/constant.js"() {
      "use strict";
      __name(constantZero, "constantZero");
      __name(constant_default4, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/round.js
  function round_default2(node2) {
    node2.x0 = Math.round(node2.x0);
    node2.y0 = Math.round(node2.y0);
    node2.x1 = Math.round(node2.x1);
    node2.y1 = Math.round(node2.y1);
  }
  var init_round2 = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/round.js"() {
      "use strict";
      __name(round_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/dice.js
  function dice_default(parent4, x0, y0, x1, y1) {
    var nodes5 = parent4.children, node2, i2 = -1, n2 = nodes5.length, k2 = parent4.value && (x1 - x0) / parent4.value;
    while (++i2 < n2) {
      node2 = nodes5[i2], node2.y0 = y0, node2.y1 = y1;
      node2.x0 = x0, node2.x1 = x0 += node2.value * k2;
    }
  }
  var init_dice = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/dice.js"() {
      "use strict";
      __name(dice_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/slice.js
  function slice_default(parent4, x0, y0, x1, y1) {
    var nodes5 = parent4.children, node2, i2 = -1, n2 = nodes5.length, k2 = parent4.value && (y1 - y0) / parent4.value;
    while (++i2 < n2) {
      node2 = nodes5[i2], node2.x0 = x0, node2.x1 = x1;
      node2.y0 = y0, node2.y1 = y0 += node2.value * k2;
    }
  }
  var init_slice = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/slice.js"() {
      "use strict";
      __name(slice_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/squarify.js
  function squarifyRatio(ratio, parent4, x0, y0, x1, y1) {
    var rows = [], nodes5 = parent4.children, row, nodeValue, i0 = 0, i1 = 0, n2 = nodes5.length, dx, dy, value2 = parent4.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta;
    while (i0 < n2) {
      dx = x1 - x0, dy = y1 - y0;
      do
        sumValue = nodes5[i1++].value;
      while (!sumValue && i1 < n2);
      minValue = maxValue = sumValue;
      alpha = Math.max(dy / dx, dx / dy) / (value2 * ratio);
      beta = sumValue * sumValue * alpha;
      minRatio = Math.max(maxValue / beta, beta / minValue);
      for (; i1 < n2; ++i1) {
        sumValue += nodeValue = nodes5[i1].value;
        if (nodeValue < minValue) minValue = nodeValue;
        if (nodeValue > maxValue) maxValue = nodeValue;
        beta = sumValue * sumValue * alpha;
        newRatio = Math.max(maxValue / beta, beta / minValue);
        if (newRatio > minRatio) {
          sumValue -= nodeValue;
          break;
        }
        minRatio = newRatio;
      }
      rows.push(row = { value: sumValue, dice: dx < dy, children: nodes5.slice(i0, i1) });
      if (row.dice) dice_default(row, x0, y0, x1, value2 ? y0 += dy * sumValue / value2 : y1);
      else slice_default(row, x0, y0, value2 ? x0 += dx * sumValue / value2 : x1, y1);
      value2 -= sumValue, i0 = i1;
    }
    return rows;
  }
  var phi, squarify_default;
  var init_squarify = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/squarify.js"() {
      "use strict";
      init_dice();
      init_slice();
      phi = (1 + Math.sqrt(5)) / 2;
      __name(squarifyRatio, "squarifyRatio");
      squarify_default = (/* @__PURE__ */ __name((function custom(ratio) {
        function squarify(parent4, x0, y0, x1, y1) {
          squarifyRatio(ratio, parent4, x0, y0, x1, y1);
        }
        __name(squarify, "squarify");
        squarify.ratio = function(x5) {
          return custom((x5 = +x5) > 1 ? x5 : 1);
        };
        return squarify;
      }), "custom"))(phi);
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/index.js
  function treemap_default() {
    var tile = squarify_default, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero;
    function treemap2(root3) {
      root3.x0 = root3.y0 = 0;
      root3.x1 = dx;
      root3.y1 = dy;
      root3.eachBefore(positionNode3);
      paddingStack = [0];
      if (round) root3.eachBefore(round_default2);
      return root3;
    }
    __name(treemap2, "treemap");
    function positionNode3(node2) {
      var p3 = paddingStack[node2.depth], x0 = node2.x0 + p3, y0 = node2.y0 + p3, x1 = node2.x1 - p3, y1 = node2.y1 - p3;
      if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
      if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
      node2.x0 = x0;
      node2.y0 = y0;
      node2.x1 = x1;
      node2.y1 = y1;
      if (node2.children) {
        p3 = paddingStack[node2.depth + 1] = paddingInner(node2) / 2;
        x0 += paddingLeft(node2) - p3;
        y0 += paddingTop(node2) - p3;
        x1 -= paddingRight(node2) - p3;
        y1 -= paddingBottom(node2) - p3;
        if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
        if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
        tile(node2, x0, y0, x1, y1);
      }
    }
    __name(positionNode3, "positionNode");
    treemap2.round = function(x5) {
      return arguments.length ? (round = !!x5, treemap2) : round;
    };
    treemap2.size = function(x5) {
      return arguments.length ? (dx = +x5[0], dy = +x5[1], treemap2) : [dx, dy];
    };
    treemap2.tile = function(x5) {
      return arguments.length ? (tile = required(x5), treemap2) : tile;
    };
    treemap2.padding = function(x5) {
      return arguments.length ? treemap2.paddingInner(x5).paddingOuter(x5) : treemap2.paddingInner();
    };
    treemap2.paddingInner = function(x5) {
      return arguments.length ? (paddingInner = typeof x5 === "function" ? x5 : constant_default4(+x5), treemap2) : paddingInner;
    };
    treemap2.paddingOuter = function(x5) {
      return arguments.length ? treemap2.paddingTop(x5).paddingRight(x5).paddingBottom(x5).paddingLeft(x5) : treemap2.paddingTop();
    };
    treemap2.paddingTop = function(x5) {
      return arguments.length ? (paddingTop = typeof x5 === "function" ? x5 : constant_default4(+x5), treemap2) : paddingTop;
    };
    treemap2.paddingRight = function(x5) {
      return arguments.length ? (paddingRight = typeof x5 === "function" ? x5 : constant_default4(+x5), treemap2) : paddingRight;
    };
    treemap2.paddingBottom = function(x5) {
      return arguments.length ? (paddingBottom = typeof x5 === "function" ? x5 : constant_default4(+x5), treemap2) : paddingBottom;
    };
    treemap2.paddingLeft = function(x5) {
      return arguments.length ? (paddingLeft = typeof x5 === "function" ? x5 : constant_default4(+x5), treemap2) : paddingLeft;
    };
    return treemap2;
  }
  var init_treemap = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/index.js"() {
      "use strict";
      init_round2();
      init_squarify();
      init_accessors();
      init_constant4();
      __name(treemap_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/index.js
  var init_src23 = __esm({
    "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/index.js"() {
      "use strict";
      init_hierarchy();
      init_treemap();
    }
  });

  // ../../node_modules/.pnpm/d3-polygon@3.0.1/node_modules/d3-polygon/src/index.js
  var init_src24 = __esm({
    "../../node_modules/.pnpm/d3-polygon@3.0.1/node_modules/d3-polygon/src/index.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-random@3.0.1/node_modules/d3-random/src/index.js
  var init_src25 = __esm({
    "../../node_modules/.pnpm/d3-random@3.0.1/node_modules/d3-random/src/index.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/init.js
  function initRange(domain, range3) {
    switch (arguments.length) {
      case 0:
        break;
      case 1:
        this.range(domain);
        break;
      default:
        this.range(range3).domain(domain);
        break;
    }
    return this;
  }
  var init_init = __esm({
    "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/init.js"() {
      "use strict";
      __name(initRange, "initRange");
    }
  });

  // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js
  function ordinal() {
    var index = new InternMap(), domain = [], range3 = [], unknown = implicit;
    function scale3(d3) {
      let i2 = index.get(d3);
      if (i2 === void 0) {
        if (unknown !== implicit) return unknown;
        index.set(d3, i2 = domain.push(d3) - 1);
      }
      return range3[i2 % range3.length];
    }
    __name(scale3, "scale");
    scale3.domain = function(_3) {
      if (!arguments.length) return domain.slice();
      domain = [], index = new InternMap();
      for (const value2 of _3) {
        if (index.has(value2)) continue;
        index.set(value2, domain.push(value2) - 1);
      }
      return scale3;
    };
    scale3.range = function(_3) {
      return arguments.length ? (range3 = Array.from(_3), scale3) : range3.slice();
    };
    scale3.unknown = function(_3) {
      return arguments.length ? (unknown = _3, scale3) : unknown;
    };
    scale3.copy = function() {
      return ordinal(domain, range3).unknown(unknown);
    };
    initRange.apply(scale3, arguments);
    return scale3;
  }
  var implicit;
  var init_ordinal = __esm({
    "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js"() {
      "use strict";
      init_src2();
      init_init();
      implicit = Symbol("implicit");
      __name(ordinal, "ordinal");
    }
  });

  // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/band.js
  function band() {
    var scale3 = ordinal().unknown(void 0), domain = scale3.domain, ordinalRange = scale3.range, r0 = 0, r1 = 1, step3, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5;
    delete scale3.unknown;
    function rescale() {
      var n2 = domain().length, reverse2 = r1 < r0, start3 = reverse2 ? r1 : r0, stop5 = reverse2 ? r0 : r1;
      step3 = (stop5 - start3) / Math.max(1, n2 - paddingInner + paddingOuter * 2);
      if (round) step3 = Math.floor(step3);
      start3 += (stop5 - start3 - step3 * (n2 - paddingInner)) * align;
      bandwidth = step3 * (1 - paddingInner);
      if (round) start3 = Math.round(start3), bandwidth = Math.round(bandwidth);
      var values2 = range(n2).map(function(i2) {
        return start3 + step3 * i2;
      });
      return ordinalRange(reverse2 ? values2.reverse() : values2);
    }
    __name(rescale, "rescale");
    scale3.domain = function(_3) {
      return arguments.length ? (domain(_3), rescale()) : domain();
    };
    scale3.range = function(_3) {
      return arguments.length ? ([r0, r1] = _3, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];
    };
    scale3.rangeRound = function(_3) {
      return [r0, r1] = _3, r0 = +r0, r1 = +r1, round = true, rescale();
    };
    scale3.bandwidth = function() {
      return bandwidth;
    };
    scale3.step = function() {
      return step3;
    };
    scale3.round = function(_3) {
      return arguments.length ? (round = !!_3, rescale()) : round;
    };
    scale3.padding = function(_3) {
      return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_3), rescale()) : paddingInner;
    };
    scale3.paddingInner = function(_3) {
      return arguments.length ? (paddingInner = Math.min(1, _3), rescale()) : paddingInner;
    };
    scale3.paddingOuter = function(_3) {
      return arguments.length ? (paddingOuter = +_3, rescale()) : paddingOuter;
    };
    scale3.align = function(_3) {
      return arguments.length ? (align = Math.max(0, Math.min(1, _3)), rescale()) : align;
    };
    scale3.copy = function() {
      return band(domain(), [r0, r1]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
    };
    return initRange.apply(rescale(), arguments);
  }
  var init_band = __esm({
    "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/band.js"() {
      "use strict";
      init_src2();
      init_init();
      init_ordinal();
      __name(band, "band");
    }
  });

  // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/constant.js
  function constants(x5) {
    return function() {
      return x5;
    };
  }
  var init_constant5 = __esm({
    "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/constant.js"() {
      "use strict";
      __name(constants, "constants");
    }
  });

  // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/number.js
  function number3(x5) {
    return +x5;
  }
  var init_number3 = __esm({
    "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/number.js"() {
      "use strict";
      __name(number3, "number");
    }
  });

  // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/continuous.js
  function identity2(x5) {
    return x5;
  }
  function normalize(a2, b3) {
    return (b3 -= a2 = +a2) ? function(x5) {
      return (x5 - a2) / b3;
    } : constants(isNaN(b3) ? NaN : 0.5);
  }
  function clamper(a2, b3) {
    var t4;
    if (a2 > b3) t4 = a2, a2 = b3, b3 = t4;
    return function(x5) {
      return Math.max(a2, Math.min(b3, x5));
    };
  }
  function bimap(domain, range3, interpolate) {
    var d0 = domain[0], d1 = domain[1], r0 = range3[0], r1 = range3[1];
    if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
    else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
    return function(x5) {
      return r0(d0(x5));
    };
  }
  function polymap(domain, range3, interpolate) {
    var j3 = Math.min(domain.length, range3.length) - 1, d3 = new Array(j3), r2 = new Array(j3), i2 = -1;
    if (domain[j3] < domain[0]) {
      domain = domain.slice().reverse();
      range3 = range3.slice().reverse();
    }
    while (++i2 < j3) {
      d3[i2] = normalize(domain[i2], domain[i2 + 1]);
      r2[i2] = interpolate(range3[i2], range3[i2 + 1]);
    }
    return function(x5) {
      var i3 = bisect_default(domain, x5, 1, j3) - 1;
      return r2[i3](d3[i3](x5));
    };
  }
  function copy(source, target) {
    return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
  }
  function transformer() {
    var domain = unit, range3 = unit, interpolate = value_default, transform8, untransform, unknown, clamp = identity2, piecewise, output2, input;
    function rescale() {
      var n2 = Math.min(domain.length, range3.length);
      if (clamp !== identity2) clamp = clamper(domain[0], domain[n2 - 1]);
      piecewise = n2 > 2 ? polymap : bimap;
      output2 = input = null;
      return scale3;
    }
    __name(rescale, "rescale");
    function scale3(x5) {
      return x5 == null || isNaN(x5 = +x5) ? unknown : (output2 || (output2 = piecewise(domain.map(transform8), range3, interpolate)))(transform8(clamp(x5)));
    }
    __name(scale3, "scale");
    scale3.invert = function(y6) {
      return clamp(untransform((input || (input = piecewise(range3, domain.map(transform8), number_default)))(y6)));
    };
    scale3.domain = function(_3) {
      return arguments.length ? (domain = Array.from(_3, number3), rescale()) : domain.slice();
    };
    scale3.range = function(_3) {
      return arguments.length ? (range3 = Array.from(_3), rescale()) : range3.slice();
    };
    scale3.rangeRound = function(_3) {
      return range3 = Array.from(_3), interpolate = round_default, rescale();
    };
    scale3.clamp = function(_3) {
      return arguments.length ? (clamp = _3 ? true : identity2, rescale()) : clamp !== identity2;
    };
    scale3.interpolate = function(_3) {
      return arguments.length ? (interpolate = _3, rescale()) : interpolate;
    };
    scale3.unknown = function(_3) {
      return arguments.length ? (unknown = _3, scale3) : unknown;
    };
    return function(t4, u2) {
      transform8 = t4, untransform = u2;
      return rescale();
    };
  }
  function continuous() {
    return transformer()(identity2, identity2);
  }
  var unit;
  var init_continuous = __esm({
    "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/continuous.js"() {
      "use strict";
      init_src2();
      init_src8();
      init_constant5();
      init_number3();
      unit = [0, 1];
      __name(identity2, "identity");
      __name(normalize, "normalize");
      __name(clamper, "clamper");
      __name(bimap, "bimap");
      __name(polymap, "polymap");
      __name(copy, "copy");
      __name(transformer, "transformer");
      __name(continuous, "continuous");
    }
  });

  // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/tickFormat.js
  function tickFormat(start3, stop5, count2, specifier) {
    var step3 = tickStep(start3, stop5, count2), precision;
    specifier = formatSpecifier(specifier == null ? ",f" : specifier);
    switch (specifier.type) {
      case "s": {
        var value2 = Math.max(Math.abs(start3), Math.abs(stop5));
        if (specifier.precision == null && !isNaN(precision = precisionPrefix_default(step3, value2))) specifier.precision = precision;
        return formatPrefix(specifier, value2);
      }
      case "":
      case "e":
      case "g":
      case "p":
      case "r": {
        if (specifier.precision == null && !isNaN(precision = precisionRound_default(step3, Math.max(Math.abs(start3), Math.abs(stop5))))) specifier.precision = precision - (specifier.type === "e");
        break;
      }
      case "f":
      case "%": {
        if (specifier.precision == null && !isNaN(precision = precisionFixed_default(step3))) specifier.precision = precision - (specifier.type === "%") * 2;
        break;
      }
    }
    return format2(specifier);
  }
  var init_tickFormat = __esm({
    "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/tickFormat.js"() {
      "use strict";
      init_src2();
      init_src21();
      __name(tickFormat, "tickFormat");
    }
  });

  // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/linear.js
  function linearish(scale3) {
    var domain = scale3.domain;
    scale3.ticks = function(count2) {
      var d3 = domain();
      return ticks(d3[0], d3[d3.length - 1], count2 == null ? 10 : count2);
    };
    scale3.tickFormat = function(count2, specifier) {
      var d3 = domain();
      return tickFormat(d3[0], d3[d3.length - 1], count2 == null ? 10 : count2, specifier);
    };
    scale3.nice = function(count2) {
      if (count2 == null) count2 = 10;
      var d3 = domain();
      var i0 = 0;
      var i1 = d3.length - 1;
      var start3 = d3[i0];
      var stop5 = d3[i1];
      var prestep;
      var step3;
      var maxIter = 10;
      if (stop5 < start3) {
        step3 = start3, start3 = stop5, stop5 = step3;
        step3 = i0, i0 = i1, i1 = step3;
      }
      while (maxIter-- > 0) {
        step3 = tickIncrement(start3, stop5, count2);
        if (step3 === prestep) {
          d3[i0] = start3;
          d3[i1] = stop5;
          return domain(d3);
        } else if (step3 > 0) {
          start3 = Math.floor(start3 / step3) * step3;
          stop5 = Math.ceil(stop5 / step3) * step3;
        } else if (step3 < 0) {
          start3 = Math.ceil(start3 * step3) / step3;
          stop5 = Math.floor(stop5 * step3) / step3;
        } else {
          break;
        }
        prestep = step3;
      }
      return scale3;
    };
    return scale3;
  }
  function linear2() {
    var scale3 = continuous();
    scale3.copy = function() {
      return copy(scale3, linear2());
    };
    initRange.apply(scale3, arguments);
    return linearish(scale3);
  }
  var init_linear = __esm({
    "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/linear.js"() {
      "use strict";
      init_src2();
      init_continuous();
      init_init();
      init_tickFormat();
      __name(linearish, "linearish");
      __name(linear2, "linear");
    }
  });

  // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/nice.js
  function nice(domain, interval2) {
    domain = domain.slice();
    var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], t4;
    if (x1 < x0) {
      t4 = i0, i0 = i1, i1 = t4;
      t4 = x0, x0 = x1, x1 = t4;
    }
    domain[i0] = interval2.floor(x0);
    domain[i1] = interval2.ceil(x1);
    return domain;
  }
  var init_nice = __esm({
    "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/nice.js"() {
      "use strict";
      __name(nice, "nice");
    }
  });

  // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/interval.js
  function timeInterval(floori, offseti, count2, field) {
    function interval2(date2) {
      return floori(date2 = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date2)), date2;
    }
    __name(interval2, "interval");
    interval2.floor = (date2) => {
      return floori(date2 = /* @__PURE__ */ new Date(+date2)), date2;
    };
    interval2.ceil = (date2) => {
      return floori(date2 = new Date(date2 - 1)), offseti(date2, 1), floori(date2), date2;
    };
    interval2.round = (date2) => {
      const d0 = interval2(date2), d1 = interval2.ceil(date2);
      return date2 - d0 < d1 - date2 ? d0 : d1;
    };
    interval2.offset = (date2, step3) => {
      return offseti(date2 = /* @__PURE__ */ new Date(+date2), step3 == null ? 1 : Math.floor(step3)), date2;
    };
    interval2.range = (start3, stop5, step3) => {
      const range3 = [];
      start3 = interval2.ceil(start3);
      step3 = step3 == null ? 1 : Math.floor(step3);
      if (!(start3 < stop5) || !(step3 > 0)) return range3;
      let previous;
      do
        range3.push(previous = /* @__PURE__ */ new Date(+start3)), offseti(start3, step3), floori(start3);
      while (previous < start3 && start3 < stop5);
      return range3;
    };
    interval2.filter = (test) => {
      return timeInterval((date2) => {
        if (date2 >= date2) while (floori(date2), !test(date2)) date2.setTime(date2 - 1);
      }, (date2, step3) => {
        if (date2 >= date2) {
          if (step3 < 0) while (++step3 <= 0) {
            while (offseti(date2, -1), !test(date2)) {
            }
          }
          else while (--step3 >= 0) {
            while (offseti(date2, 1), !test(date2)) {
            }
          }
        }
      });
    };
    if (count2) {
      interval2.count = (start3, end2) => {
        t02.setTime(+start3), t12.setTime(+end2);
        floori(t02), floori(t12);
        return Math.floor(count2(t02, t12));
      };
      interval2.every = (step3) => {
        step3 = Math.floor(step3);
        return !isFinite(step3) || !(step3 > 0) ? null : !(step3 > 1) ? interval2 : interval2.filter(field ? (d3) => field(d3) % step3 === 0 : (d3) => interval2.count(0, d3) % step3 === 0);
      };
    }
    return interval2;
  }
  var t02, t12;
  var init_interval = __esm({
    "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/interval.js"() {
      "use strict";
      t02 = /* @__PURE__ */ new Date();
      t12 = /* @__PURE__ */ new Date();
      __name(timeInterval, "timeInterval");
    }
  });

  // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/millisecond.js
  var millisecond, milliseconds;
  var init_millisecond = __esm({
    "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/millisecond.js"() {
      "use strict";
      init_interval();
      millisecond = timeInterval(() => {
      }, (date2, step3) => {
        date2.setTime(+date2 + step3);
      }, (start3, end2) => {
        return end2 - start3;
      });
      millisecond.every = (k2) => {
        k2 = Math.floor(k2);
        if (!isFinite(k2) || !(k2 > 0)) return null;
        if (!(k2 > 1)) return millisecond;
        return timeInterval((date2) => {
          date2.setTime(Math.floor(date2 / k2) * k2);
        }, (date2, step3) => {
          date2.setTime(+date2 + step3 * k2);
        }, (start3, end2) => {
          return (end2 - start3) / k2;
        });
      };
      milliseconds = millisecond.range;
    }
  });

  // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/duration.js
  var durationSecond, durationMinute, durationHour, durationDay, durationWeek, durationMonth, durationYear;
  var init_duration2 = __esm({
    "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/duration.js"() {
      "use strict";
      durationSecond = 1e3;
      durationMinute = durationSecond * 60;
      durationHour = durationMinute * 60;
      durationDay = durationHour * 24;
      durationWeek = durationDay * 7;
      durationMonth = durationDay * 30;
      durationYear = durationDay * 365;
    }
  });

  // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/second.js
  var second, seconds;
  var init_second = __esm({
    "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/second.js"() {
      "use strict";
      init_interval();
      init_duration2();
      second = timeInterval((date2) => {
        date2.setTime(date2 - date2.getMilliseconds());
      }, (date2, step3) => {
        date2.setTime(+date2 + step3 * durationSecond);
      }, (start3, end2) => {
        return (end2 - start3) / durationSecond;
      }, (date2) => {
        return date2.getUTCSeconds();
      });
      seconds = second.range;
    }
  });

  // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/minute.js
  var timeMinute, timeMinutes, utcMinute, utcMinutes;
  var init_minute = __esm({
    "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/minute.js"() {
      "use strict";
      init_interval();
      init_duration2();
      timeMinute = timeInterval((date2) => {
        date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond);
      }, (date2, step3) => {
        date2.setTime(+date2 + step3 * durationMinute);
      }, (start3, end2) => {
        return (end2 - start3) / durationMinute;
      }, (date2) => {
        return date2.getMinutes();
      });
      timeMinutes = timeMinute.range;
      utcMinute = timeInterval((date2) => {
        date2.setUTCSeconds(0, 0);
      }, (date2, step3) => {
        date2.setTime(+date2 + step3 * durationMinute);
      }, (start3, end2) => {
        return (end2 - start3) / durationMinute;
      }, (date2) => {
        return date2.getUTCMinutes();
      });
      utcMinutes = utcMinute.range;
    }
  });

  // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/hour.js
  var timeHour, timeHours, utcHour, utcHours;
  var init_hour = __esm({
    "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/hour.js"() {
      "use strict";
      init_interval();
      init_duration2();
      timeHour = timeInterval((date2) => {
        date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond - date2.getMinutes() * durationMinute);
      }, (date2, step3) => {
        date2.setTime(+date2 + step3 * durationHour);
      }, (start3, end2) => {
        return (end2 - start3) / durationHour;
      }, (date2) => {
        return date2.getHours();
      });
      timeHours = timeHour.range;
      utcHour = timeInterval((date2) => {
        date2.setUTCMinutes(0, 0, 0);
      }, (date2, step3) => {
        date2.setTime(+date2 + step3 * durationHour);
      }, (start3, end2) => {
        return (end2 - start3) / durationHour;
      }, (date2) => {
        return date2.getUTCHours();
      });
      utcHours = utcHour.range;
    }
  });

  // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/day.js
  var timeDay, timeDays, utcDay, utcDays, unixDay, unixDays;
  var init_day = __esm({
    "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/day.js"() {
      "use strict";
      init_interval();
      init_duration2();
      timeDay = timeInterval(
        (date2) => date2.setHours(0, 0, 0, 0),
        (date2, step3) => date2.setDate(date2.getDate() + step3),
        (start3, end2) => (end2 - start3 - (end2.getTimezoneOffset() - start3.getTimezoneOffset()) * durationMinute) / durationDay,
        (date2) => date2.getDate() - 1
      );
      timeDays = timeDay.range;
      utcDay = timeInterval((date2) => {
        date2.setUTCHours(0, 0, 0, 0);
      }, (date2, step3) => {
        date2.setUTCDate(date2.getUTCDate() + step3);
      }, (start3, end2) => {
        return (end2 - start3) / durationDay;
      }, (date2) => {
        return date2.getUTCDate() - 1;
      });
      utcDays = utcDay.range;
      unixDay = timeInterval((date2) => {
        date2.setUTCHours(0, 0, 0, 0);
      }, (date2, step3) => {
        date2.setUTCDate(date2.getUTCDate() + step3);
      }, (start3, end2) => {
        return (end2 - start3) / durationDay;
      }, (date2) => {
        return Math.floor(date2 / durationDay);
      });
      unixDays = unixDay.range;
    }
  });

  // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/week.js
  function timeWeekday(i2) {
    return timeInterval((date2) => {
      date2.setDate(date2.getDate() - (date2.getDay() + 7 - i2) % 7);
      date2.setHours(0, 0, 0, 0);
    }, (date2, step3) => {
      date2.setDate(date2.getDate() + step3 * 7);
    }, (start3, end2) => {
      return (end2 - start3 - (end2.getTimezoneOffset() - start3.getTimezoneOffset()) * durationMinute) / durationWeek;
    });
  }
  function utcWeekday(i2) {
    return timeInterval((date2) => {
      date2.setUTCDate(date2.getUTCDate() - (date2.getUTCDay() + 7 - i2) % 7);
      date2.setUTCHours(0, 0, 0, 0);
    }, (date2, step3) => {
      date2.setUTCDate(date2.getUTCDate() + step3 * 7);
    }, (start3, end2) => {
      return (end2 - start3) / durationWeek;
    });
  }
  var timeSunday, timeMonday, timeTuesday, timeWednesday, timeThursday, timeFriday, timeSaturday, timeSundays, timeMondays, timeTuesdays, timeWednesdays, timeThursdays, timeFridays, timeSaturdays, utcSunday, utcMonday, utcTuesday, utcWednesday, utcThursday, utcFriday, utcSaturday, utcSundays, utcMondays, utcTuesdays, utcWednesdays, utcThursdays, utcFridays, utcSaturdays;
  var init_week = __esm({
    "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/week.js"() {
      "use strict";
      init_interval();
      init_duration2();
      __name(timeWeekday, "timeWeekday");
      timeSunday = timeWeekday(0);
      timeMonday = timeWeekday(1);
      timeTuesday = timeWeekday(2);
      timeWednesday = timeWeekday(3);
      timeThursday = timeWeekday(4);
      timeFriday = timeWeekday(5);
      timeSaturday = timeWeekday(6);
      timeSundays = timeSunday.range;
      timeMondays = timeMonday.range;
      timeTuesdays = timeTuesday.range;
      timeWednesdays = timeWednesday.range;
      timeThursdays = timeThursday.range;
      timeFridays = timeFriday.range;
      timeSaturdays = timeSaturday.range;
      __name(utcWeekday, "utcWeekday");
      utcSunday = utcWeekday(0);
      utcMonday = utcWeekday(1);
      utcTuesday = utcWeekday(2);
      utcWednesday = utcWeekday(3);
      utcThursday = utcWeekday(4);
      utcFriday = utcWeekday(5);
      utcSaturday = utcWeekday(6);
      utcSundays = utcSunday.range;
      utcMondays = utcMonday.range;
      utcTuesdays = utcTuesday.range;
      utcWednesdays = utcWednesday.range;
      utcThursdays = utcThursday.range;
      utcFridays = utcFriday.range;
      utcSaturdays = utcSaturday.range;
    }
  });

  // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/month.js
  var timeMonth, timeMonths, utcMonth, utcMonths;
  var init_month = __esm({
    "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/month.js"() {
      "use strict";
      init_interval();
      timeMonth = timeInterval((date2) => {
        date2.setDate(1);
        date2.setHours(0, 0, 0, 0);
      }, (date2, step3) => {
        date2.setMonth(date2.getMonth() + step3);
      }, (start3, end2) => {
        return end2.getMonth() - start3.getMonth() + (end2.getFullYear() - start3.getFullYear()) * 12;
      }, (date2) => {
        return date2.getMonth();
      });
      timeMonths = timeMonth.range;
      utcMonth = timeInterval((date2) => {
        date2.setUTCDate(1);
        date2.setUTCHours(0, 0, 0, 0);
      }, (date2, step3) => {
        date2.setUTCMonth(date2.getUTCMonth() + step3);
      }, (start3, end2) => {
        return end2.getUTCMonth() - start3.getUTCMonth() + (end2.getUTCFullYear() - start3.getUTCFullYear()) * 12;
      }, (date2) => {
        return date2.getUTCMonth();
      });
      utcMonths = utcMonth.range;
    }
  });

  // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/year.js
  var timeYear, timeYears, utcYear, utcYears;
  var init_year = __esm({
    "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/year.js"() {
      "use strict";
      init_interval();
      timeYear = timeInterval((date2) => {
        date2.setMonth(0, 1);
        date2.setHours(0, 0, 0, 0);
      }, (date2, step3) => {
        date2.setFullYear(date2.getFullYear() + step3);
      }, (start3, end2) => {
        return end2.getFullYear() - start3.getFullYear();
      }, (date2) => {
        return date2.getFullYear();
      });
      timeYear.every = (k2) => {
        return !isFinite(k2 = Math.floor(k2)) || !(k2 > 0) ? null : timeInterval((date2) => {
          date2.setFullYear(Math.floor(date2.getFullYear() / k2) * k2);
          date2.setMonth(0, 1);
          date2.setHours(0, 0, 0, 0);
        }, (date2, step3) => {
          date2.setFullYear(date2.getFullYear() + step3 * k2);
        });
      };
      timeYears = timeYear.range;
      utcYear = timeInterval((date2) => {
        date2.setUTCMonth(0, 1);
        date2.setUTCHours(0, 0, 0, 0);
      }, (date2, step3) => {
        date2.setUTCFullYear(date2.getUTCFullYear() + step3);
      }, (start3, end2) => {
        return end2.getUTCFullYear() - start3.getUTCFullYear();
      }, (date2) => {
        return date2.getUTCFullYear();
      });
      utcYear.every = (k2) => {
        return !isFinite(k2 = Math.floor(k2)) || !(k2 > 0) ? null : timeInterval((date2) => {
          date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / k2) * k2);
          date2.setUTCMonth(0, 1);
          date2.setUTCHours(0, 0, 0, 0);
        }, (date2, step3) => {
          date2.setUTCFullYear(date2.getUTCFullYear() + step3 * k2);
        });
      };
      utcYears = utcYear.range;
    }
  });

  // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/ticks.js
  function ticker(year, month, week, day, hour, minute) {
    const tickIntervals = [
      [second, 1, durationSecond],
      [second, 5, 5 * durationSecond],
      [second, 15, 15 * durationSecond],
      [second, 30, 30 * durationSecond],
      [minute, 1, durationMinute],
      [minute, 5, 5 * durationMinute],
      [minute, 15, 15 * durationMinute],
      [minute, 30, 30 * durationMinute],
      [hour, 1, durationHour],
      [hour, 3, 3 * durationHour],
      [hour, 6, 6 * durationHour],
      [hour, 12, 12 * durationHour],
      [day, 1, durationDay],
      [day, 2, 2 * durationDay],
      [week, 1, durationWeek],
      [month, 1, durationMonth],
      [month, 3, 3 * durationMonth],
      [year, 1, durationYear]
    ];
    function ticks2(start3, stop5, count2) {
      const reverse2 = stop5 < start3;
      if (reverse2) [start3, stop5] = [stop5, start3];
      const interval2 = count2 && typeof count2.range === "function" ? count2 : tickInterval2(start3, stop5, count2);
      const ticks3 = interval2 ? interval2.range(start3, +stop5 + 1) : [];
      return reverse2 ? ticks3.reverse() : ticks3;
    }
    __name(ticks2, "ticks");
    function tickInterval2(start3, stop5, count2) {
      const target = Math.abs(stop5 - start3) / count2;
      const i2 = bisector(([, , step4]) => step4).right(tickIntervals, target);
      if (i2 === tickIntervals.length) return year.every(tickStep(start3 / durationYear, stop5 / durationYear, count2));
      if (i2 === 0) return millisecond.every(Math.max(tickStep(start3, stop5, count2), 1));
      const [t4, step3] = tickIntervals[target / tickIntervals[i2 - 1][2] < tickIntervals[i2][2] / target ? i2 - 1 : i2];
      return t4.every(step3);
    }
    __name(tickInterval2, "tickInterval");
    return [ticks2, tickInterval2];
  }
  var utcTicks, utcTickInterval, timeTicks, timeTickInterval;
  var init_ticks2 = __esm({
    "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/ticks.js"() {
      "use strict";
      init_src2();
      init_duration2();
      init_millisecond();
      init_second();
      init_minute();
      init_hour();
      init_day();
      init_week();
      init_month();
      init_year();
      __name(ticker, "ticker");
      [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute);
      [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);
    }
  });

  // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/index.js
  var init_src26 = __esm({
    "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/index.js"() {
      "use strict";
      init_millisecond();
      init_second();
      init_minute();
      init_hour();
      init_day();
      init_week();
      init_month();
      init_year();
      init_ticks2();
    }
  });

  // ../../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/locale.js
  function localDate(d3) {
    if (0 <= d3.y && d3.y < 100) {
      var date2 = new Date(-1, d3.m, d3.d, d3.H, d3.M, d3.S, d3.L);
      date2.setFullYear(d3.y);
      return date2;
    }
    return new Date(d3.y, d3.m, d3.d, d3.H, d3.M, d3.S, d3.L);
  }
  function utcDate(d3) {
    if (0 <= d3.y && d3.y < 100) {
      var date2 = new Date(Date.UTC(-1, d3.m, d3.d, d3.H, d3.M, d3.S, d3.L));
      date2.setUTCFullYear(d3.y);
      return date2;
    }
    return new Date(Date.UTC(d3.y, d3.m, d3.d, d3.H, d3.M, d3.S, d3.L));
  }
  function newDate(y6, m3, d3) {
    return { y: y6, m: m3, d: d3, H: 0, M: 0, S: 0, L: 0 };
  }
  function formatLocale(locale3) {
    var locale_dateTime = locale3.dateTime, locale_date = locale3.date, locale_time = locale3.time, locale_periods = locale3.periods, locale_weekdays = locale3.days, locale_shortWeekdays = locale3.shortDays, locale_months = locale3.months, locale_shortMonths = locale3.shortMonths;
    var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths);
    var formats = {
      "a": formatShortWeekday,
      "A": formatWeekday,
      "b": formatShortMonth,
      "B": formatMonth,
      "c": null,
      "d": formatDayOfMonth,
      "e": formatDayOfMonth,
      "f": formatMicroseconds,
      "g": formatYearISO,
      "G": formatFullYearISO,
      "H": formatHour24,
      "I": formatHour12,
      "j": formatDayOfYear,
      "L": formatMilliseconds,
      "m": formatMonthNumber,
      "M": formatMinutes,
      "p": formatPeriod,
      "q": formatQuarter,
      "Q": formatUnixTimestamp,
      "s": formatUnixTimestampSeconds,
      "S": formatSeconds,
      "u": formatWeekdayNumberMonday,
      "U": formatWeekNumberSunday,
      "V": formatWeekNumberISO,
      "w": formatWeekdayNumberSunday,
      "W": formatWeekNumberMonday,
      "x": null,
      "X": null,
      "y": formatYear,
      "Y": formatFullYear,
      "Z": formatZone,
      "%": formatLiteralPercent
    };
    var utcFormats = {
      "a": formatUTCShortWeekday,
      "A": formatUTCWeekday,
      "b": formatUTCShortMonth,
      "B": formatUTCMonth,
      "c": null,
      "d": formatUTCDayOfMonth,
      "e": formatUTCDayOfMonth,
      "f": formatUTCMicroseconds,
      "g": formatUTCYearISO,
      "G": formatUTCFullYearISO,
      "H": formatUTCHour24,
      "I": formatUTCHour12,
      "j": formatUTCDayOfYear,
      "L": formatUTCMilliseconds,
      "m": formatUTCMonthNumber,
      "M": formatUTCMinutes,
      "p": formatUTCPeriod,
      "q": formatUTCQuarter,
      "Q": formatUnixTimestamp,
      "s": formatUnixTimestampSeconds,
      "S": formatUTCSeconds,
      "u": formatUTCWeekdayNumberMonday,
      "U": formatUTCWeekNumberSunday,
      "V": formatUTCWeekNumberISO,
      "w": formatUTCWeekdayNumberSunday,
      "W": formatUTCWeekNumberMonday,
      "x": null,
      "X": null,
      "y": formatUTCYear,
      "Y": formatUTCFullYear,
      "Z": formatUTCZone,
      "%": formatLiteralPercent
    };
    var parses = {
      "a": parseShortWeekday,
      "A": parseWeekday,
      "b": parseShortMonth,
      "B": parseMonth,
      "c": parseLocaleDateTime,
      "d": parseDayOfMonth,
      "e": parseDayOfMonth,
      "f": parseMicroseconds,
      "g": parseYear,
      "G": parseFullYear,
      "H": parseHour24,
      "I": parseHour24,
      "j": parseDayOfYear,
      "L": parseMilliseconds,
      "m": parseMonthNumber,
      "M": parseMinutes,
      "p": parsePeriod,
      "q": parseQuarter,
      "Q": parseUnixTimestamp,
      "s": parseUnixTimestampSeconds,
      "S": parseSeconds,
      "u": parseWeekdayNumberMonday,
      "U": parseWeekNumberSunday,
      "V": parseWeekNumberISO,
      "w": parseWeekdayNumberSunday,
      "W": parseWeekNumberMonday,
      "x": parseLocaleDate,
      "X": parseLocaleTime,
      "y": parseYear,
      "Y": parseFullYear,
      "Z": parseZone,
      "%": parseLiteralPercent
    };
    formats.x = newFormat(locale_date, formats);
    formats.X = newFormat(locale_time, formats);
    formats.c = newFormat(locale_dateTime, formats);
    utcFormats.x = newFormat(locale_date, utcFormats);
    utcFormats.X = newFormat(locale_time, utcFormats);
    utcFormats.c = newFormat(locale_dateTime, utcFormats);
    function newFormat(specifier, formats2) {
      return function(date2) {
        var string3 = [], i2 = -1, j3 = 0, n2 = specifier.length, c3, pad3, format3;
        if (!(date2 instanceof Date)) date2 = /* @__PURE__ */ new Date(+date2);
        while (++i2 < n2) {
          if (specifier.charCodeAt(i2) === 37) {
            string3.push(specifier.slice(j3, i2));
            if ((pad3 = pads[c3 = specifier.charAt(++i2)]) != null) c3 = specifier.charAt(++i2);
            else pad3 = c3 === "e" ? " " : "0";
            if (format3 = formats2[c3]) c3 = format3(date2, pad3);
            string3.push(c3);
            j3 = i2 + 1;
          }
        }
        string3.push(specifier.slice(j3, i2));
        return string3.join("");
      };
    }
    __name(newFormat, "newFormat");
    function newParse(specifier, Z2) {
      return function(string3) {
        var d3 = newDate(1900, void 0, 1), i2 = parseSpecifier(d3, specifier, string3 += "", 0), week, day;
        if (i2 != string3.length) return null;
        if ("Q" in d3) return new Date(d3.Q);
        if ("s" in d3) return new Date(d3.s * 1e3 + ("L" in d3 ? d3.L : 0));
        if (Z2 && !("Z" in d3)) d3.Z = 0;
        if ("p" in d3) d3.H = d3.H % 12 + d3.p * 12;
        if (d3.m === void 0) d3.m = "q" in d3 ? d3.q : 0;
        if ("V" in d3) {
          if (d3.V < 1 || d3.V > 53) return null;
          if (!("w" in d3)) d3.w = 1;
          if ("Z" in d3) {
            week = utcDate(newDate(d3.y, 0, 1)), day = week.getUTCDay();
            week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
            week = utcDay.offset(week, (d3.V - 1) * 7);
            d3.y = week.getUTCFullYear();
            d3.m = week.getUTCMonth();
            d3.d = week.getUTCDate() + (d3.w + 6) % 7;
          } else {
            week = localDate(newDate(d3.y, 0, 1)), day = week.getDay();
            week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);
            week = timeDay.offset(week, (d3.V - 1) * 7);
            d3.y = week.getFullYear();
            d3.m = week.getMonth();
            d3.d = week.getDate() + (d3.w + 6) % 7;
          }
        } else if ("W" in d3 || "U" in d3) {
          if (!("w" in d3)) d3.w = "u" in d3 ? d3.u % 7 : "W" in d3 ? 1 : 0;
          day = "Z" in d3 ? utcDate(newDate(d3.y, 0, 1)).getUTCDay() : localDate(newDate(d3.y, 0, 1)).getDay();
          d3.m = 0;
          d3.d = "W" in d3 ? (d3.w + 6) % 7 + d3.W * 7 - (day + 5) % 7 : d3.w + d3.U * 7 - (day + 6) % 7;
        }
        if ("Z" in d3) {
          d3.H += d3.Z / 100 | 0;
          d3.M += d3.Z % 100;
          return utcDate(d3);
        }
        return localDate(d3);
      };
    }
    __name(newParse, "newParse");
    function parseSpecifier(d3, specifier, string3, j3) {
      var i2 = 0, n2 = specifier.length, m3 = string3.length, c3, parse7;
      while (i2 < n2) {
        if (j3 >= m3) return -1;
        c3 = specifier.charCodeAt(i2++);
        if (c3 === 37) {
          c3 = specifier.charAt(i2++);
          parse7 = parses[c3 in pads ? specifier.charAt(i2++) : c3];
          if (!parse7 || (j3 = parse7(d3, string3, j3)) < 0) return -1;
        } else if (c3 != string3.charCodeAt(j3++)) {
          return -1;
        }
      }
      return j3;
    }
    __name(parseSpecifier, "parseSpecifier");
    function parsePeriod(d3, string3, i2) {
      var n2 = periodRe.exec(string3.slice(i2));
      return n2 ? (d3.p = periodLookup.get(n2[0].toLowerCase()), i2 + n2[0].length) : -1;
    }
    __name(parsePeriod, "parsePeriod");
    function parseShortWeekday(d3, string3, i2) {
      var n2 = shortWeekdayRe.exec(string3.slice(i2));
      return n2 ? (d3.w = shortWeekdayLookup.get(n2[0].toLowerCase()), i2 + n2[0].length) : -1;
    }
    __name(parseShortWeekday, "parseShortWeekday");
    function parseWeekday(d3, string3, i2) {
      var n2 = weekdayRe.exec(string3.slice(i2));
      return n2 ? (d3.w = weekdayLookup.get(n2[0].toLowerCase()), i2 + n2[0].length) : -1;
    }
    __name(parseWeekday, "parseWeekday");
    function parseShortMonth(d3, string3, i2) {
      var n2 = shortMonthRe.exec(string3.slice(i2));
      return n2 ? (d3.m = shortMonthLookup.get(n2[0].toLowerCase()), i2 + n2[0].length) : -1;
    }
    __name(parseShortMonth, "parseShortMonth");
    function parseMonth(d3, string3, i2) {
      var n2 = monthRe.exec(string3.slice(i2));
      return n2 ? (d3.m = monthLookup.get(n2[0].toLowerCase()), i2 + n2[0].length) : -1;
    }
    __name(parseMonth, "parseMonth");
    function parseLocaleDateTime(d3, string3, i2) {
      return parseSpecifier(d3, locale_dateTime, string3, i2);
    }
    __name(parseLocaleDateTime, "parseLocaleDateTime");
    function parseLocaleDate(d3, string3, i2) {
      return parseSpecifier(d3, locale_date, string3, i2);
    }
    __name(parseLocaleDate, "parseLocaleDate");
    function parseLocaleTime(d3, string3, i2) {
      return parseSpecifier(d3, locale_time, string3, i2);
    }
    __name(parseLocaleTime, "parseLocaleTime");
    function formatShortWeekday(d3) {
      return locale_shortWeekdays[d3.getDay()];
    }
    __name(formatShortWeekday, "formatShortWeekday");
    function formatWeekday(d3) {
      return locale_weekdays[d3.getDay()];
    }
    __name(formatWeekday, "formatWeekday");
    function formatShortMonth(d3) {
      return locale_shortMonths[d3.getMonth()];
    }
    __name(formatShortMonth, "formatShortMonth");
    function formatMonth(d3) {
      return locale_months[d3.getMonth()];
    }
    __name(formatMonth, "formatMonth");
    function formatPeriod(d3) {
      return locale_periods[+(d3.getHours() >= 12)];
    }
    __name(formatPeriod, "formatPeriod");
    function formatQuarter(d3) {
      return 1 + ~~(d3.getMonth() / 3);
    }
    __name(formatQuarter, "formatQuarter");
    function formatUTCShortWeekday(d3) {
      return locale_shortWeekdays[d3.getUTCDay()];
    }
    __name(formatUTCShortWeekday, "formatUTCShortWeekday");
    function formatUTCWeekday(d3) {
      return locale_weekdays[d3.getUTCDay()];
    }
    __name(formatUTCWeekday, "formatUTCWeekday");
    function formatUTCShortMonth(d3) {
      return locale_shortMonths[d3.getUTCMonth()];
    }
    __name(formatUTCShortMonth, "formatUTCShortMonth");
    function formatUTCMonth(d3) {
      return locale_months[d3.getUTCMonth()];
    }
    __name(formatUTCMonth, "formatUTCMonth");
    function formatUTCPeriod(d3) {
      return locale_periods[+(d3.getUTCHours() >= 12)];
    }
    __name(formatUTCPeriod, "formatUTCPeriod");
    function formatUTCQuarter(d3) {
      return 1 + ~~(d3.getUTCMonth() / 3);
    }
    __name(formatUTCQuarter, "formatUTCQuarter");
    return {
      format: /* @__PURE__ */ __name(function(specifier) {
        var f2 = newFormat(specifier += "", formats);
        f2.toString = function() {
          return specifier;
        };
        return f2;
      }, "format"),
      parse: /* @__PURE__ */ __name(function(specifier) {
        var p3 = newParse(specifier += "", false);
        p3.toString = function() {
          return specifier;
        };
        return p3;
      }, "parse"),
      utcFormat: /* @__PURE__ */ __name(function(specifier) {
        var f2 = newFormat(specifier += "", utcFormats);
        f2.toString = function() {
          return specifier;
        };
        return f2;
      }, "utcFormat"),
      utcParse: /* @__PURE__ */ __name(function(specifier) {
        var p3 = newParse(specifier += "", true);
        p3.toString = function() {
          return specifier;
        };
        return p3;
      }, "utcParse")
    };
  }
  function pad2(value2, fill, width3) {
    var sign2 = value2 < 0 ? "-" : "", string3 = (sign2 ? -value2 : value2) + "", length2 = string3.length;
    return sign2 + (length2 < width3 ? new Array(width3 - length2 + 1).join(fill) + string3 : string3);
  }
  function requote(s2) {
    return s2.replace(requoteRe, "\\$&");
  }
  function formatRe(names) {
    return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
  }
  function formatLookup(names) {
    return new Map(names.map((name, i2) => [name.toLowerCase(), i2]));
  }
  function parseWeekdayNumberSunday(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 1));
    return n2 ? (d3.w = +n2[0], i2 + n2[0].length) : -1;
  }
  function parseWeekdayNumberMonday(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 1));
    return n2 ? (d3.u = +n2[0], i2 + n2[0].length) : -1;
  }
  function parseWeekNumberSunday(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 2));
    return n2 ? (d3.U = +n2[0], i2 + n2[0].length) : -1;
  }
  function parseWeekNumberISO(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 2));
    return n2 ? (d3.V = +n2[0], i2 + n2[0].length) : -1;
  }
  function parseWeekNumberMonday(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 2));
    return n2 ? (d3.W = +n2[0], i2 + n2[0].length) : -1;
  }
  function parseFullYear(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 4));
    return n2 ? (d3.y = +n2[0], i2 + n2[0].length) : -1;
  }
  function parseYear(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 2));
    return n2 ? (d3.y = +n2[0] + (+n2[0] > 68 ? 1900 : 2e3), i2 + n2[0].length) : -1;
  }
  function parseZone(d3, string3, i2) {
    var n2 = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string3.slice(i2, i2 + 6));
    return n2 ? (d3.Z = n2[1] ? 0 : -(n2[2] + (n2[3] || "00")), i2 + n2[0].length) : -1;
  }
  function parseQuarter(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 1));
    return n2 ? (d3.q = n2[0] * 3 - 3, i2 + n2[0].length) : -1;
  }
  function parseMonthNumber(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 2));
    return n2 ? (d3.m = n2[0] - 1, i2 + n2[0].length) : -1;
  }
  function parseDayOfMonth(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 2));
    return n2 ? (d3.d = +n2[0], i2 + n2[0].length) : -1;
  }
  function parseDayOfYear(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 3));
    return n2 ? (d3.m = 0, d3.d = +n2[0], i2 + n2[0].length) : -1;
  }
  function parseHour24(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 2));
    return n2 ? (d3.H = +n2[0], i2 + n2[0].length) : -1;
  }
  function parseMinutes(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 2));
    return n2 ? (d3.M = +n2[0], i2 + n2[0].length) : -1;
  }
  function parseSeconds(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 2));
    return n2 ? (d3.S = +n2[0], i2 + n2[0].length) : -1;
  }
  function parseMilliseconds(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 3));
    return n2 ? (d3.L = +n2[0], i2 + n2[0].length) : -1;
  }
  function parseMicroseconds(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2, i2 + 6));
    return n2 ? (d3.L = Math.floor(n2[0] / 1e3), i2 + n2[0].length) : -1;
  }
  function parseLiteralPercent(d3, string3, i2) {
    var n2 = percentRe.exec(string3.slice(i2, i2 + 1));
    return n2 ? i2 + n2[0].length : -1;
  }
  function parseUnixTimestamp(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2));
    return n2 ? (d3.Q = +n2[0], i2 + n2[0].length) : -1;
  }
  function parseUnixTimestampSeconds(d3, string3, i2) {
    var n2 = numberRe.exec(string3.slice(i2));
    return n2 ? (d3.s = +n2[0], i2 + n2[0].length) : -1;
  }
  function formatDayOfMonth(d3, p3) {
    return pad2(d3.getDate(), p3, 2);
  }
  function formatHour24(d3, p3) {
    return pad2(d3.getHours(), p3, 2);
  }
  function formatHour12(d3, p3) {
    return pad2(d3.getHours() % 12 || 12, p3, 2);
  }
  function formatDayOfYear(d3, p3) {
    return pad2(1 + timeDay.count(timeYear(d3), d3), p3, 3);
  }
  function formatMilliseconds(d3, p3) {
    return pad2(d3.getMilliseconds(), p3, 3);
  }
  function formatMicroseconds(d3, p3) {
    return formatMilliseconds(d3, p3) + "000";
  }
  function formatMonthNumber(d3, p3) {
    return pad2(d3.getMonth() + 1, p3, 2);
  }
  function formatMinutes(d3, p3) {
    return pad2(d3.getMinutes(), p3, 2);
  }
  function formatSeconds(d3, p3) {
    return pad2(d3.getSeconds(), p3, 2);
  }
  function formatWeekdayNumberMonday(d3) {
    var day = d3.getDay();
    return day === 0 ? 7 : day;
  }
  function formatWeekNumberSunday(d3, p3) {
    return pad2(timeSunday.count(timeYear(d3) - 1, d3), p3, 2);
  }
  function dISO(d3) {
    var day = d3.getDay();
    return day >= 4 || day === 0 ? timeThursday(d3) : timeThursday.ceil(d3);
  }
  function formatWeekNumberISO(d3, p3) {
    d3 = dISO(d3);
    return pad2(timeThursday.count(timeYear(d3), d3) + (timeYear(d3).getDay() === 4), p3, 2);
  }
  function formatWeekdayNumberSunday(d3) {
    return d3.getDay();
  }
  function formatWeekNumberMonday(d3, p3) {
    return pad2(timeMonday.count(timeYear(d3) - 1, d3), p3, 2);
  }
  function formatYear(d3, p3) {
    return pad2(d3.getFullYear() % 100, p3, 2);
  }
  function formatYearISO(d3, p3) {
    d3 = dISO(d3);
    return pad2(d3.getFullYear() % 100, p3, 2);
  }
  function formatFullYear(d3, p3) {
    return pad2(d3.getFullYear() % 1e4, p3, 4);
  }
  function formatFullYearISO(d3, p3) {
    var day = d3.getDay();
    d3 = day >= 4 || day === 0 ? timeThursday(d3) : timeThursday.ceil(d3);
    return pad2(d3.getFullYear() % 1e4, p3, 4);
  }
  function formatZone(d3) {
    var z3 = d3.getTimezoneOffset();
    return (z3 > 0 ? "-" : (z3 *= -1, "+")) + pad2(z3 / 60 | 0, "0", 2) + pad2(z3 % 60, "0", 2);
  }
  function formatUTCDayOfMonth(d3, p3) {
    return pad2(d3.getUTCDate(), p3, 2);
  }
  function formatUTCHour24(d3, p3) {
    return pad2(d3.getUTCHours(), p3, 2);
  }
  function formatUTCHour12(d3, p3) {
    return pad2(d3.getUTCHours() % 12 || 12, p3, 2);
  }
  function formatUTCDayOfYear(d3, p3) {
    return pad2(1 + utcDay.count(utcYear(d3), d3), p3, 3);
  }
  function formatUTCMilliseconds(d3, p3) {
    return pad2(d3.getUTCMilliseconds(), p3, 3);
  }
  function formatUTCMicroseconds(d3, p3) {
    return formatUTCMilliseconds(d3, p3) + "000";
  }
  function formatUTCMonthNumber(d3, p3) {
    return pad2(d3.getUTCMonth() + 1, p3, 2);
  }
  function formatUTCMinutes(d3, p3) {
    return pad2(d3.getUTCMinutes(), p3, 2);
  }
  function formatUTCSeconds(d3, p3) {
    return pad2(d3.getUTCSeconds(), p3, 2);
  }
  function formatUTCWeekdayNumberMonday(d3) {
    var dow = d3.getUTCDay();
    return dow === 0 ? 7 : dow;
  }
  function formatUTCWeekNumberSunday(d3, p3) {
    return pad2(utcSunday.count(utcYear(d3) - 1, d3), p3, 2);
  }
  function UTCdISO(d3) {
    var day = d3.getUTCDay();
    return day >= 4 || day === 0 ? utcThursday(d3) : utcThursday.ceil(d3);
  }
  function formatUTCWeekNumberISO(d3, p3) {
    d3 = UTCdISO(d3);
    return pad2(utcThursday.count(utcYear(d3), d3) + (utcYear(d3).getUTCDay() === 4), p3, 2);
  }
  function formatUTCWeekdayNumberSunday(d3) {
    return d3.getUTCDay();
  }
  function formatUTCWeekNumberMonday(d3, p3) {
    return pad2(utcMonday.count(utcYear(d3) - 1, d3), p3, 2);
  }
  function formatUTCYear(d3, p3) {
    return pad2(d3.getUTCFullYear() % 100, p3, 2);
  }
  function formatUTCYearISO(d3, p3) {
    d3 = UTCdISO(d3);
    return pad2(d3.getUTCFullYear() % 100, p3, 2);
  }
  function formatUTCFullYear(d3, p3) {
    return pad2(d3.getUTCFullYear() % 1e4, p3, 4);
  }
  function formatUTCFullYearISO(d3, p3) {
    var day = d3.getUTCDay();
    d3 = day >= 4 || day === 0 ? utcThursday(d3) : utcThursday.ceil(d3);
    return pad2(d3.getUTCFullYear() % 1e4, p3, 4);
  }
  function formatUTCZone() {
    return "+0000";
  }
  function formatLiteralPercent() {
    return "%";
  }
  function formatUnixTimestamp(d3) {
    return +d3;
  }
  function formatUnixTimestampSeconds(d3) {
    return Math.floor(+d3 / 1e3);
  }
  var pads, numberRe, percentRe, requoteRe;
  var init_locale2 = __esm({
    "../../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/locale.js"() {
      "use strict";
      init_src26();
      __name(localDate, "localDate");
      __name(utcDate, "utcDate");
      __name(newDate, "newDate");
      __name(formatLocale, "formatLocale");
      pads = { "-": "", "_": " ", "0": "0" };
      numberRe = /^\s*\d+/;
      percentRe = /^%/;
      requoteRe = /[\\^$*+?|[\]().{}]/g;
      __name(pad2, "pad");
      __name(requote, "requote");
      __name(formatRe, "formatRe");
      __name(formatLookup, "formatLookup");
      __name(parseWeekdayNumberSunday, "parseWeekdayNumberSunday");
      __name(parseWeekdayNumberMonday, "parseWeekdayNumberMonday");
      __name(parseWeekNumberSunday, "parseWeekNumberSunday");
      __name(parseWeekNumberISO, "parseWeekNumberISO");
      __name(parseWeekNumberMonday, "parseWeekNumberMonday");
      __name(parseFullYear, "parseFullYear");
      __name(parseYear, "parseYear");
      __name(parseZone, "parseZone");
      __name(parseQuarter, "parseQuarter");
      __name(parseMonthNumber, "parseMonthNumber");
      __name(parseDayOfMonth, "parseDayOfMonth");
      __name(parseDayOfYear, "parseDayOfYear");
      __name(parseHour24, "parseHour24");
      __name(parseMinutes, "parseMinutes");
      __name(parseSeconds, "parseSeconds");
      __name(parseMilliseconds, "parseMilliseconds");
      __name(parseMicroseconds, "parseMicroseconds");
      __name(parseLiteralPercent, "parseLiteralPercent");
      __name(parseUnixTimestamp, "parseUnixTimestamp");
      __name(parseUnixTimestampSeconds, "parseUnixTimestampSeconds");
      __name(formatDayOfMonth, "formatDayOfMonth");
      __name(formatHour24, "formatHour24");
      __name(formatHour12, "formatHour12");
      __name(formatDayOfYear, "formatDayOfYear");
      __name(formatMilliseconds, "formatMilliseconds");
      __name(formatMicroseconds, "formatMicroseconds");
      __name(formatMonthNumber, "formatMonthNumber");
      __name(formatMinutes, "formatMinutes");
      __name(formatSeconds, "formatSeconds");
      __name(formatWeekdayNumberMonday, "formatWeekdayNumberMonday");
      __name(formatWeekNumberSunday, "formatWeekNumberSunday");
      __name(dISO, "dISO");
      __name(formatWeekNumberISO, "formatWeekNumberISO");
      __name(formatWeekdayNumberSunday, "formatWeekdayNumberSunday");
      __name(formatWeekNumberMonday, "formatWeekNumberMonday");
      __name(formatYear, "formatYear");
      __name(formatYearISO, "formatYearISO");
      __name(formatFullYear, "formatFullYear");
      __name(formatFullYearISO, "formatFullYearISO");
      __name(formatZone, "formatZone");
      __name(formatUTCDayOfMonth, "formatUTCDayOfMonth");
      __name(formatUTCHour24, "formatUTCHour24");
      __name(formatUTCHour12, "formatUTCHour12");
      __name(formatUTCDayOfYear, "formatUTCDayOfYear");
      __name(formatUTCMilliseconds, "formatUTCMilliseconds");
      __name(formatUTCMicroseconds, "formatUTCMicroseconds");
      __name(formatUTCMonthNumber, "formatUTCMonthNumber");
      __name(formatUTCMinutes, "formatUTCMinutes");
      __name(formatUTCSeconds, "formatUTCSeconds");
      __name(formatUTCWeekdayNumberMonday, "formatUTCWeekdayNumberMonday");
      __name(formatUTCWeekNumberSunday, "formatUTCWeekNumberSunday");
      __name(UTCdISO, "UTCdISO");
      __name(formatUTCWeekNumberISO, "formatUTCWeekNumberISO");
      __name(formatUTCWeekdayNumberSunday, "formatUTCWeekdayNumberSunday");
      __name(formatUTCWeekNumberMonday, "formatUTCWeekNumberMonday");
      __name(formatUTCYear, "formatUTCYear");
      __name(formatUTCYearISO, "formatUTCYearISO");
      __name(formatUTCFullYear, "formatUTCFullYear");
      __name(formatUTCFullYearISO, "formatUTCFullYearISO");
      __name(formatUTCZone, "formatUTCZone");
      __name(formatLiteralPercent, "formatLiteralPercent");
      __name(formatUnixTimestamp, "formatUnixTimestamp");
      __name(formatUnixTimestampSeconds, "formatUnixTimestampSeconds");
    }
  });

  // ../../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/defaultLocale.js
  function defaultLocale2(definition) {
    locale2 = formatLocale(definition);
    timeFormat = locale2.format;
    timeParse = locale2.parse;
    utcFormat = locale2.utcFormat;
    utcParse = locale2.utcParse;
    return locale2;
  }
  var locale2, timeFormat, timeParse, utcFormat, utcParse;
  var init_defaultLocale2 = __esm({
    "../../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/defaultLocale.js"() {
      "use strict";
      init_locale2();
      defaultLocale2({
        dateTime: "%x, %X",
        date: "%-m/%-d/%Y",
        time: "%-I:%M:%S %p",
        periods: ["AM", "PM"],
        days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
        shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
        months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
        shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
      });
      __name(defaultLocale2, "defaultLocale");
    }
  });

  // ../../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/index.js
  var init_src27 = __esm({
    "../../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/index.js"() {
      "use strict";
      init_defaultLocale2();
    }
  });

  // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/time.js
  function date(t4) {
    return new Date(t4);
  }
  function number4(t4) {
    return t4 instanceof Date ? +t4 : +/* @__PURE__ */ new Date(+t4);
  }
  function calendar(ticks2, tickInterval2, year, month, week, day, hour, minute, second2, format3) {
    var scale3 = continuous(), invert2 = scale3.invert, domain = scale3.domain;
    var formatMillisecond = format3(".%L"), formatSecond = format3(":%S"), formatMinute = format3("%I:%M"), formatHour = format3("%I %p"), formatDay = format3("%a %d"), formatWeek = format3("%b %d"), formatMonth = format3("%B"), formatYear2 = format3("%Y");
    function tickFormat2(date2) {
      return (second2(date2) < date2 ? formatMillisecond : minute(date2) < date2 ? formatSecond : hour(date2) < date2 ? formatMinute : day(date2) < date2 ? formatHour : month(date2) < date2 ? week(date2) < date2 ? formatDay : formatWeek : year(date2) < date2 ? formatMonth : formatYear2)(date2);
    }
    __name(tickFormat2, "tickFormat");
    scale3.invert = function(y6) {
      return new Date(invert2(y6));
    };
    scale3.domain = function(_3) {
      return arguments.length ? domain(Array.from(_3, number4)) : domain().map(date);
    };
    scale3.ticks = function(interval2) {
      var d3 = domain();
      return ticks2(d3[0], d3[d3.length - 1], interval2 == null ? 10 : interval2);
    };
    scale3.tickFormat = function(count2, specifier) {
      return specifier == null ? tickFormat2 : format3(specifier);
    };
    scale3.nice = function(interval2) {
      var d3 = domain();
      if (!interval2 || typeof interval2.range !== "function") interval2 = tickInterval2(d3[0], d3[d3.length - 1], interval2 == null ? 10 : interval2);
      return interval2 ? domain(nice(d3, interval2)) : scale3;
    };
    scale3.copy = function() {
      return copy(scale3, calendar(ticks2, tickInterval2, year, month, week, day, hour, minute, second2, format3));
    };
    return scale3;
  }
  function time() {
    return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute, second, timeFormat).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments);
  }
  var init_time = __esm({
    "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/time.js"() {
      "use strict";
      init_src26();
      init_src27();
      init_continuous();
      init_init();
      init_nice();
      __name(date, "date");
      __name(number4, "number");
      __name(calendar, "calendar");
      __name(time, "time");
    }
  });

  // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/index.js
  var init_src28 = __esm({
    "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/index.js"() {
      "use strict";
      init_band();
      init_linear();
      init_ordinal();
      init_time();
    }
  });

  // ../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/colors.js
  function colors_default(specifier) {
    var n2 = specifier.length / 6 | 0, colors2 = new Array(n2), i2 = 0;
    while (i2 < n2) colors2[i2] = "#" + specifier.slice(i2 * 6, ++i2 * 6);
    return colors2;
  }
  var init_colors = __esm({
    "../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/colors.js"() {
      "use strict";
      __name(colors_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Tableau10.js
  var Tableau10_default;
  var init_Tableau10 = __esm({
    "../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Tableau10.js"() {
      "use strict";
      init_colors();
      Tableau10_default = colors_default("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
    }
  });

  // ../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/index.js
  var init_src29 = __esm({
    "../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/index.js"() {
      "use strict";
      init_Tableau10();
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js
  function constant_default5(x5) {
    return /* @__PURE__ */ __name(function constant3() {
      return x5;
    }, "constant");
  }
  var init_constant6 = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js"() {
      "use strict";
      __name(constant_default5, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/math.js
  function acos(x5) {
    return x5 > 1 ? 0 : x5 < -1 ? pi2 : Math.acos(x5);
  }
  function asin(x5) {
    return x5 >= 1 ? halfPi : x5 <= -1 ? -halfPi : Math.asin(x5);
  }
  var abs2, atan2, cos, max3, min3, sin, sqrt, epsilon3, pi2, halfPi, tau2;
  var init_math2 = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/math.js"() {
      "use strict";
      abs2 = Math.abs;
      atan2 = Math.atan2;
      cos = Math.cos;
      max3 = Math.max;
      min3 = Math.min;
      sin = Math.sin;
      sqrt = Math.sqrt;
      epsilon3 = 1e-12;
      pi2 = Math.PI;
      halfPi = pi2 / 2;
      tau2 = 2 * pi2;
      __name(acos, "acos");
      __name(asin, "asin");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js
  function withPath(shape) {
    let digits = 3;
    shape.digits = function(_3) {
      if (!arguments.length) return digits;
      if (_3 == null) {
        digits = null;
      } else {
        const d3 = Math.floor(_3);
        if (!(d3 >= 0)) throw new RangeError(`invalid digits: ${_3}`);
        digits = d3;
      }
      return shape;
    };
    return () => new Path(digits);
  }
  var init_path3 = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js"() {
      "use strict";
      init_src13();
      __name(withPath, "withPath");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/arc.js
  function arcInnerRadius(d3) {
    return d3.innerRadius;
  }
  function arcOuterRadius(d3) {
    return d3.outerRadius;
  }
  function arcStartAngle(d3) {
    return d3.startAngle;
  }
  function arcEndAngle(d3) {
    return d3.endAngle;
  }
  function arcPadAngle(d3) {
    return d3 && d3.padAngle;
  }
  function intersect(x0, y0, x1, y1, x22, y22, x32, y32) {
    var x10 = x1 - x0, y10 = y1 - y0, x322 = x32 - x22, y322 = y32 - y22, t4 = y322 * x10 - x322 * y10;
    if (t4 * t4 < epsilon3) return;
    t4 = (x322 * (y0 - y22) - y322 * (x0 - x22)) / t4;
    return [x0 + t4 * x10, y0 + t4 * y10];
  }
  function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
    var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d22 = dx * dx + dy * dy, r2 = r1 - rc, D4 = x11 * y10 - x10 * y11, d3 = (dy < 0 ? -1 : 1) * sqrt(max3(0, r2 * r2 * d22 - D4 * D4)), cx0 = (D4 * dy - dx * d3) / d22, cy0 = (-D4 * dx - dy * d3) / d22, cx1 = (D4 * dy + dx * d3) / d22, cy1 = (-D4 * dx + dy * d3) / d22, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
    if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
    return {
      cx: cx0,
      cy: cy0,
      x01: -ox,
      y01: -oy,
      x11: cx0 * (r1 / r2 - 1),
      y11: cy0 * (r1 / r2 - 1)
    };
  }
  function arc_default() {
    var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant_default5(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null, path4 = withPath(arc);
    function arc() {
      var buffer, r2, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs2(a1 - a0), cw = a1 > a0;
      if (!context) context = buffer = path4();
      if (r1 < r0) r2 = r1, r1 = r0, r0 = r2;
      if (!(r1 > epsilon3)) context.moveTo(0, 0);
      else if (da > tau2 - epsilon3) {
        context.moveTo(r1 * cos(a0), r1 * sin(a0));
        context.arc(0, 0, r1, a0, a1, !cw);
        if (r0 > epsilon3) {
          context.moveTo(r0 * cos(a1), r0 * sin(a1));
          context.arc(0, 0, r0, a1, a0, cw);
        }
      } else {
        var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon3 && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min3(abs2(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t03, t13;
        if (rp > epsilon3) {
          var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));
          if ((da0 -= p0 * 2) > epsilon3) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;
          else da0 = 0, a00 = a10 = (a0 + a1) / 2;
          if ((da1 -= p1 * 2) > epsilon3) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;
          else da1 = 0, a01 = a11 = (a0 + a1) / 2;
        }
        var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10);
        if (rc > epsilon3) {
          var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;
          if (da < pi2) {
            if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
              var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
              rc0 = min3(rc, (r0 - lc) / (kc - 1));
              rc1 = min3(rc, (r1 - lc) / (kc + 1));
            } else {
              rc0 = rc1 = 0;
            }
          }
        }
        if (!(da1 > epsilon3)) context.moveTo(x01, y01);
        else if (rc1 > epsilon3) {
          t03 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
          t13 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
          context.moveTo(t03.cx + t03.x01, t03.cy + t03.y01);
          if (rc1 < rc) context.arc(t03.cx, t03.cy, rc1, atan2(t03.y01, t03.x01), atan2(t13.y01, t13.x01), !cw);
          else {
            context.arc(t03.cx, t03.cy, rc1, atan2(t03.y01, t03.x01), atan2(t03.y11, t03.x11), !cw);
            context.arc(0, 0, r1, atan2(t03.cy + t03.y11, t03.cx + t03.x11), atan2(t13.cy + t13.y11, t13.cx + t13.x11), !cw);
            context.arc(t13.cx, t13.cy, rc1, atan2(t13.y11, t13.x11), atan2(t13.y01, t13.x01), !cw);
          }
        } else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
        if (!(r0 > epsilon3) || !(da0 > epsilon3)) context.lineTo(x10, y10);
        else if (rc0 > epsilon3) {
          t03 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
          t13 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
          context.lineTo(t03.cx + t03.x01, t03.cy + t03.y01);
          if (rc0 < rc) context.arc(t03.cx, t03.cy, rc0, atan2(t03.y01, t03.x01), atan2(t13.y01, t13.x01), !cw);
          else {
            context.arc(t03.cx, t03.cy, rc0, atan2(t03.y01, t03.x01), atan2(t03.y11, t03.x11), !cw);
            context.arc(0, 0, r0, atan2(t03.cy + t03.y11, t03.cx + t03.x11), atan2(t13.cy + t13.y11, t13.cx + t13.x11), cw);
            context.arc(t13.cx, t13.cy, rc0, atan2(t13.y11, t13.x11), atan2(t13.y01, t13.x01), !cw);
          }
        } else context.arc(0, 0, r0, a10, a00, cw);
      }
      context.closePath();
      if (buffer) return context = null, buffer + "" || null;
    }
    __name(arc, "arc");
    arc.centroid = function() {
      var r2 = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a2 = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi2 / 2;
      return [cos(a2) * r2, sin(a2) * r2];
    };
    arc.innerRadius = function(_3) {
      return arguments.length ? (innerRadius = typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : innerRadius;
    };
    arc.outerRadius = function(_3) {
      return arguments.length ? (outerRadius = typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : outerRadius;
    };
    arc.cornerRadius = function(_3) {
      return arguments.length ? (cornerRadius = typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : cornerRadius;
    };
    arc.padRadius = function(_3) {
      return arguments.length ? (padRadius = _3 == null ? null : typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : padRadius;
    };
    arc.startAngle = function(_3) {
      return arguments.length ? (startAngle = typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : startAngle;
    };
    arc.endAngle = function(_3) {
      return arguments.length ? (endAngle = typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : endAngle;
    };
    arc.padAngle = function(_3) {
      return arguments.length ? (padAngle = typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : padAngle;
    };
    arc.context = function(_3) {
      return arguments.length ? (context = _3 == null ? null : _3, arc) : context;
    };
    return arc;
  }
  var init_arc = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/arc.js"() {
      "use strict";
      init_constant6();
      init_math2();
      init_path3();
      __name(arcInnerRadius, "arcInnerRadius");
      __name(arcOuterRadius, "arcOuterRadius");
      __name(arcStartAngle, "arcStartAngle");
      __name(arcEndAngle, "arcEndAngle");
      __name(arcPadAngle, "arcPadAngle");
      __name(intersect, "intersect");
      __name(cornerTangents, "cornerTangents");
      __name(arc_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.js
  function array_default(x5) {
    return typeof x5 === "object" && "length" in x5 ? x5 : Array.from(x5);
  }
  var slice;
  var init_array3 = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.js"() {
      "use strict";
      slice = Array.prototype.slice;
      __name(array_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js
  function Linear(context) {
    this._context = context;
  }
  function linear_default(context) {
    return new Linear(context);
  }
  var init_linear2 = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js"() {
      "use strict";
      __name(Linear, "Linear");
      Linear.prototype = {
        areaStart: /* @__PURE__ */ __name(function() {
          this._line = 0;
        }, "areaStart"),
        areaEnd: /* @__PURE__ */ __name(function() {
          this._line = NaN;
        }, "areaEnd"),
        lineStart: /* @__PURE__ */ __name(function() {
          this._point = 0;
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
          this._line = 1 - this._line;
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          x5 = +x5, y6 = +y6;
          switch (this._point) {
            case 0:
              this._point = 1;
              this._line ? this._context.lineTo(x5, y6) : this._context.moveTo(x5, y6);
              break;
            case 1:
              this._point = 2;
            // falls through
            default:
              this._context.lineTo(x5, y6);
              break;
          }
        }, "point")
      };
      __name(linear_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.js
  function x(p3) {
    return p3[0];
  }
  function y(p3) {
    return p3[1];
  }
  var init_point = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.js"() {
      "use strict";
      __name(x, "x");
      __name(y, "y");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.js
  function line_default(x5, y6) {
    var defined = constant_default5(true), context = null, curve = linear_default, output2 = null, path4 = withPath(line2);
    x5 = typeof x5 === "function" ? x5 : x5 === void 0 ? x : constant_default5(x5);
    y6 = typeof y6 === "function" ? y6 : y6 === void 0 ? y : constant_default5(y6);
    function line2(data5) {
      var i2, n2 = (data5 = array_default(data5)).length, d3, defined0 = false, buffer;
      if (context == null) output2 = curve(buffer = path4());
      for (i2 = 0; i2 <= n2; ++i2) {
        if (!(i2 < n2 && defined(d3 = data5[i2], i2, data5)) === defined0) {
          if (defined0 = !defined0) output2.lineStart();
          else output2.lineEnd();
        }
        if (defined0) output2.point(+x5(d3, i2, data5), +y6(d3, i2, data5));
      }
      if (buffer) return output2 = null, buffer + "" || null;
    }
    __name(line2, "line");
    line2.x = function(_3) {
      return arguments.length ? (x5 = typeof _3 === "function" ? _3 : constant_default5(+_3), line2) : x5;
    };
    line2.y = function(_3) {
      return arguments.length ? (y6 = typeof _3 === "function" ? _3 : constant_default5(+_3), line2) : y6;
    };
    line2.defined = function(_3) {
      return arguments.length ? (defined = typeof _3 === "function" ? _3 : constant_default5(!!_3), line2) : defined;
    };
    line2.curve = function(_3) {
      return arguments.length ? (curve = _3, context != null && (output2 = curve(context)), line2) : curve;
    };
    line2.context = function(_3) {
      return arguments.length ? (_3 == null ? context = output2 = null : output2 = curve(context = _3), line2) : context;
    };
    return line2;
  }
  var init_line = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.js"() {
      "use strict";
      init_array3();
      init_constant6();
      init_linear2();
      init_path3();
      init_point();
      __name(line_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/descending.js
  function descending_default(a2, b3) {
    return b3 < a2 ? -1 : b3 > a2 ? 1 : b3 >= a2 ? 0 : NaN;
  }
  var init_descending2 = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/descending.js"() {
      "use strict";
      __name(descending_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/identity.js
  function identity_default3(d3) {
    return d3;
  }
  var init_identity3 = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/identity.js"() {
      "use strict";
      __name(identity_default3, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/pie.js
  function pie_default() {
    var value2 = identity_default3, sortValues = descending_default, sort3 = null, startAngle = constant_default5(0), endAngle = constant_default5(tau2), padAngle = constant_default5(0);
    function pie2(data5) {
      var i2, n2 = (data5 = array_default(data5)).length, j3, k2, sum2 = 0, index = new Array(n2), arcs = new Array(n2), a0 = +startAngle.apply(this, arguments), da = Math.min(tau2, Math.max(-tau2, endAngle.apply(this, arguments) - a0)), a1, p3 = Math.min(Math.abs(da) / n2, padAngle.apply(this, arguments)), pa = p3 * (da < 0 ? -1 : 1), v3;
      for (i2 = 0; i2 < n2; ++i2) {
        if ((v3 = arcs[index[i2] = i2] = +value2(data5[i2], i2, data5)) > 0) {
          sum2 += v3;
        }
      }
      if (sortValues != null) index.sort(function(i3, j4) {
        return sortValues(arcs[i3], arcs[j4]);
      });
      else if (sort3 != null) index.sort(function(i3, j4) {
        return sort3(data5[i3], data5[j4]);
      });
      for (i2 = 0, k2 = sum2 ? (da - n2 * pa) / sum2 : 0; i2 < n2; ++i2, a0 = a1) {
        j3 = index[i2], v3 = arcs[j3], a1 = a0 + (v3 > 0 ? v3 * k2 : 0) + pa, arcs[j3] = {
          data: data5[j3],
          index: i2,
          value: v3,
          startAngle: a0,
          endAngle: a1,
          padAngle: p3
        };
      }
      return arcs;
    }
    __name(pie2, "pie");
    pie2.value = function(_3) {
      return arguments.length ? (value2 = typeof _3 === "function" ? _3 : constant_default5(+_3), pie2) : value2;
    };
    pie2.sortValues = function(_3) {
      return arguments.length ? (sortValues = _3, sort3 = null, pie2) : sortValues;
    };
    pie2.sort = function(_3) {
      return arguments.length ? (sort3 = _3, sortValues = null, pie2) : sort3;
    };
    pie2.startAngle = function(_3) {
      return arguments.length ? (startAngle = typeof _3 === "function" ? _3 : constant_default5(+_3), pie2) : startAngle;
    };
    pie2.endAngle = function(_3) {
      return arguments.length ? (endAngle = typeof _3 === "function" ? _3 : constant_default5(+_3), pie2) : endAngle;
    };
    pie2.padAngle = function(_3) {
      return arguments.length ? (padAngle = typeof _3 === "function" ? _3 : constant_default5(+_3), pie2) : padAngle;
    };
    return pie2;
  }
  var init_pie = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/pie.js"() {
      "use strict";
      init_array3();
      init_constant6();
      init_descending2();
      init_identity3();
      init_math2();
      __name(pie_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/bump.js
  function bumpX(context) {
    return new Bump(context, true);
  }
  function bumpY(context) {
    return new Bump(context, false);
  }
  var Bump;
  var init_bump = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/bump.js"() {
      "use strict";
      Bump = class {
        static {
          __name(this, "Bump");
        }
        constructor(context, x5) {
          this._context = context;
          this._x = x5;
        }
        areaStart() {
          this._line = 0;
        }
        areaEnd() {
          this._line = NaN;
        }
        lineStart() {
          this._point = 0;
        }
        lineEnd() {
          if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
          this._line = 1 - this._line;
        }
        point(x5, y6) {
          x5 = +x5, y6 = +y6;
          switch (this._point) {
            case 0: {
              this._point = 1;
              if (this._line) this._context.lineTo(x5, y6);
              else this._context.moveTo(x5, y6);
              break;
            }
            case 1:
              this._point = 2;
            // falls through
            default: {
              if (this._x) this._context.bezierCurveTo(this._x0 = (this._x0 + x5) / 2, this._y0, this._x0, y6, x5, y6);
              else this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y6) / 2, x5, this._y0, x5, y6);
              break;
            }
          }
          this._x0 = x5, this._y0 = y6;
        }
      };
      __name(bumpX, "bumpX");
      __name(bumpY, "bumpY");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/noop.js
  function noop_default() {
  }
  var init_noop = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/noop.js"() {
      "use strict";
      __name(noop_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basis.js
  function point2(that, x5, y6) {
    that._context.bezierCurveTo(
      (2 * that._x0 + that._x1) / 3,
      (2 * that._y0 + that._y1) / 3,
      (that._x0 + 2 * that._x1) / 3,
      (that._y0 + 2 * that._y1) / 3,
      (that._x0 + 4 * that._x1 + x5) / 6,
      (that._y0 + 4 * that._y1 + y6) / 6
    );
  }
  function Basis(context) {
    this._context = context;
  }
  function basis_default2(context) {
    return new Basis(context);
  }
  var init_basis2 = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basis.js"() {
      "use strict";
      __name(point2, "point");
      __name(Basis, "Basis");
      Basis.prototype = {
        areaStart: /* @__PURE__ */ __name(function() {
          this._line = 0;
        }, "areaStart"),
        areaEnd: /* @__PURE__ */ __name(function() {
          this._line = NaN;
        }, "areaEnd"),
        lineStart: /* @__PURE__ */ __name(function() {
          this._x0 = this._x1 = this._y0 = this._y1 = NaN;
          this._point = 0;
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          switch (this._point) {
            case 3:
              point2(this, this._x1, this._y1);
            // falls through
            case 2:
              this._context.lineTo(this._x1, this._y1);
              break;
          }
          if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
          this._line = 1 - this._line;
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          x5 = +x5, y6 = +y6;
          switch (this._point) {
            case 0:
              this._point = 1;
              this._line ? this._context.lineTo(x5, y6) : this._context.moveTo(x5, y6);
              break;
            case 1:
              this._point = 2;
              break;
            case 2:
              this._point = 3;
              this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
            // falls through
            default:
              point2(this, x5, y6);
              break;
          }
          this._x0 = this._x1, this._x1 = x5;
          this._y0 = this._y1, this._y1 = y6;
        }, "point")
      };
      __name(basis_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basisClosed.js
  function BasisClosed(context) {
    this._context = context;
  }
  function basisClosed_default2(context) {
    return new BasisClosed(context);
  }
  var init_basisClosed2 = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basisClosed.js"() {
      "use strict";
      init_noop();
      init_basis2();
      __name(BasisClosed, "BasisClosed");
      BasisClosed.prototype = {
        areaStart: noop_default,
        areaEnd: noop_default,
        lineStart: /* @__PURE__ */ __name(function() {
          this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;
          this._point = 0;
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          switch (this._point) {
            case 1: {
              this._context.moveTo(this._x2, this._y2);
              this._context.closePath();
              break;
            }
            case 2: {
              this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);
              this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);
              this._context.closePath();
              break;
            }
            case 3: {
              this.point(this._x2, this._y2);
              this.point(this._x3, this._y3);
              this.point(this._x4, this._y4);
              break;
            }
          }
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          x5 = +x5, y6 = +y6;
          switch (this._point) {
            case 0:
              this._point = 1;
              this._x2 = x5, this._y2 = y6;
              break;
            case 1:
              this._point = 2;
              this._x3 = x5, this._y3 = y6;
              break;
            case 2:
              this._point = 3;
              this._x4 = x5, this._y4 = y6;
              this._context.moveTo((this._x0 + 4 * this._x1 + x5) / 6, (this._y0 + 4 * this._y1 + y6) / 6);
              break;
            default:
              point2(this, x5, y6);
              break;
          }
          this._x0 = this._x1, this._x1 = x5;
          this._y0 = this._y1, this._y1 = y6;
        }, "point")
      };
      __name(basisClosed_default2, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basisOpen.js
  function BasisOpen(context) {
    this._context = context;
  }
  function basisOpen_default(context) {
    return new BasisOpen(context);
  }
  var init_basisOpen = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basisOpen.js"() {
      "use strict";
      init_basis2();
      __name(BasisOpen, "BasisOpen");
      BasisOpen.prototype = {
        areaStart: /* @__PURE__ */ __name(function() {
          this._line = 0;
        }, "areaStart"),
        areaEnd: /* @__PURE__ */ __name(function() {
          this._line = NaN;
        }, "areaEnd"),
        lineStart: /* @__PURE__ */ __name(function() {
          this._x0 = this._x1 = this._y0 = this._y1 = NaN;
          this._point = 0;
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();
          this._line = 1 - this._line;
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          x5 = +x5, y6 = +y6;
          switch (this._point) {
            case 0:
              this._point = 1;
              break;
            case 1:
              this._point = 2;
              break;
            case 2:
              this._point = 3;
              var x0 = (this._x0 + 4 * this._x1 + x5) / 6, y0 = (this._y0 + 4 * this._y1 + y6) / 6;
              this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0);
              break;
            case 3:
              this._point = 4;
            // falls through
            default:
              point2(this, x5, y6);
              break;
          }
          this._x0 = this._x1, this._x1 = x5;
          this._y0 = this._y1, this._y1 = y6;
        }, "point")
      };
      __name(basisOpen_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/bundle.js
  function Bundle(context, beta) {
    this._basis = new Basis(context);
    this._beta = beta;
  }
  var bundle_default;
  var init_bundle = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/bundle.js"() {
      "use strict";
      init_basis2();
      __name(Bundle, "Bundle");
      Bundle.prototype = {
        lineStart: /* @__PURE__ */ __name(function() {
          this._x = [];
          this._y = [];
          this._basis.lineStart();
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          var x5 = this._x, y6 = this._y, j3 = x5.length - 1;
          if (j3 > 0) {
            var x0 = x5[0], y0 = y6[0], dx = x5[j3] - x0, dy = y6[j3] - y0, i2 = -1, t4;
            while (++i2 <= j3) {
              t4 = i2 / j3;
              this._basis.point(
                this._beta * x5[i2] + (1 - this._beta) * (x0 + t4 * dx),
                this._beta * y6[i2] + (1 - this._beta) * (y0 + t4 * dy)
              );
            }
          }
          this._x = this._y = null;
          this._basis.lineEnd();
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          this._x.push(+x5);
          this._y.push(+y6);
        }, "point")
      };
      bundle_default = (/* @__PURE__ */ __name((function custom2(beta) {
        function bundle(context) {
          return beta === 1 ? new Basis(context) : new Bundle(context, beta);
        }
        __name(bundle, "bundle");
        bundle.beta = function(beta2) {
          return custom2(+beta2);
        };
        return bundle;
      }), "custom"))(0.85);
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinal.js
  function point3(that, x5, y6) {
    that._context.bezierCurveTo(
      that._x1 + that._k * (that._x2 - that._x0),
      that._y1 + that._k * (that._y2 - that._y0),
      that._x2 + that._k * (that._x1 - x5),
      that._y2 + that._k * (that._y1 - y6),
      that._x2,
      that._y2
    );
  }
  function Cardinal(context, tension) {
    this._context = context;
    this._k = (1 - tension) / 6;
  }
  var cardinal_default;
  var init_cardinal = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinal.js"() {
      "use strict";
      __name(point3, "point");
      __name(Cardinal, "Cardinal");
      Cardinal.prototype = {
        areaStart: /* @__PURE__ */ __name(function() {
          this._line = 0;
        }, "areaStart"),
        areaEnd: /* @__PURE__ */ __name(function() {
          this._line = NaN;
        }, "areaEnd"),
        lineStart: /* @__PURE__ */ __name(function() {
          this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
          this._point = 0;
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          switch (this._point) {
            case 2:
              this._context.lineTo(this._x2, this._y2);
              break;
            case 3:
              point3(this, this._x1, this._y1);
              break;
          }
          if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
          this._line = 1 - this._line;
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          x5 = +x5, y6 = +y6;
          switch (this._point) {
            case 0:
              this._point = 1;
              this._line ? this._context.lineTo(x5, y6) : this._context.moveTo(x5, y6);
              break;
            case 1:
              this._point = 2;
              this._x1 = x5, this._y1 = y6;
              break;
            case 2:
              this._point = 3;
            // falls through
            default:
              point3(this, x5, y6);
              break;
          }
          this._x0 = this._x1, this._x1 = this._x2, this._x2 = x5;
          this._y0 = this._y1, this._y1 = this._y2, this._y2 = y6;
        }, "point")
      };
      cardinal_default = (/* @__PURE__ */ __name((function custom3(tension) {
        function cardinal(context) {
          return new Cardinal(context, tension);
        }
        __name(cardinal, "cardinal");
        cardinal.tension = function(tension2) {
          return custom3(+tension2);
        };
        return cardinal;
      }), "custom"))(0);
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinalClosed.js
  function CardinalClosed(context, tension) {
    this._context = context;
    this._k = (1 - tension) / 6;
  }
  var cardinalClosed_default;
  var init_cardinalClosed = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinalClosed.js"() {
      "use strict";
      init_noop();
      init_cardinal();
      __name(CardinalClosed, "CardinalClosed");
      CardinalClosed.prototype = {
        areaStart: noop_default,
        areaEnd: noop_default,
        lineStart: /* @__PURE__ */ __name(function() {
          this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
          this._point = 0;
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          switch (this._point) {
            case 1: {
              this._context.moveTo(this._x3, this._y3);
              this._context.closePath();
              break;
            }
            case 2: {
              this._context.lineTo(this._x3, this._y3);
              this._context.closePath();
              break;
            }
            case 3: {
              this.point(this._x3, this._y3);
              this.point(this._x4, this._y4);
              this.point(this._x5, this._y5);
              break;
            }
          }
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          x5 = +x5, y6 = +y6;
          switch (this._point) {
            case 0:
              this._point = 1;
              this._x3 = x5, this._y3 = y6;
              break;
            case 1:
              this._point = 2;
              this._context.moveTo(this._x4 = x5, this._y4 = y6);
              break;
            case 2:
              this._point = 3;
              this._x5 = x5, this._y5 = y6;
              break;
            default:
              point3(this, x5, y6);
              break;
          }
          this._x0 = this._x1, this._x1 = this._x2, this._x2 = x5;
          this._y0 = this._y1, this._y1 = this._y2, this._y2 = y6;
        }, "point")
      };
      cardinalClosed_default = (/* @__PURE__ */ __name((function custom4(tension) {
        function cardinal(context) {
          return new CardinalClosed(context, tension);
        }
        __name(cardinal, "cardinal");
        cardinal.tension = function(tension2) {
          return custom4(+tension2);
        };
        return cardinal;
      }), "custom"))(0);
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinalOpen.js
  function CardinalOpen(context, tension) {
    this._context = context;
    this._k = (1 - tension) / 6;
  }
  var cardinalOpen_default;
  var init_cardinalOpen = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinalOpen.js"() {
      "use strict";
      init_cardinal();
      __name(CardinalOpen, "CardinalOpen");
      CardinalOpen.prototype = {
        areaStart: /* @__PURE__ */ __name(function() {
          this._line = 0;
        }, "areaStart"),
        areaEnd: /* @__PURE__ */ __name(function() {
          this._line = NaN;
        }, "areaEnd"),
        lineStart: /* @__PURE__ */ __name(function() {
          this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
          this._point = 0;
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();
          this._line = 1 - this._line;
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          x5 = +x5, y6 = +y6;
          switch (this._point) {
            case 0:
              this._point = 1;
              break;
            case 1:
              this._point = 2;
              break;
            case 2:
              this._point = 3;
              this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
              break;
            case 3:
              this._point = 4;
            // falls through
            default:
              point3(this, x5, y6);
              break;
          }
          this._x0 = this._x1, this._x1 = this._x2, this._x2 = x5;
          this._y0 = this._y1, this._y1 = this._y2, this._y2 = y6;
        }, "point")
      };
      cardinalOpen_default = (/* @__PURE__ */ __name((function custom5(tension) {
        function cardinal(context) {
          return new CardinalOpen(context, tension);
        }
        __name(cardinal, "cardinal");
        cardinal.tension = function(tension2) {
          return custom5(+tension2);
        };
        return cardinal;
      }), "custom"))(0);
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRom.js
  function point4(that, x5, y6) {
    var x1 = that._x1, y1 = that._y1, x22 = that._x2, y22 = that._y2;
    if (that._l01_a > epsilon3) {
      var a2 = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n2 = 3 * that._l01_a * (that._l01_a + that._l12_a);
      x1 = (x1 * a2 - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n2;
      y1 = (y1 * a2 - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n2;
    }
    if (that._l23_a > epsilon3) {
      var b3 = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m3 = 3 * that._l23_a * (that._l23_a + that._l12_a);
      x22 = (x22 * b3 + that._x1 * that._l23_2a - x5 * that._l12_2a) / m3;
      y22 = (y22 * b3 + that._y1 * that._l23_2a - y6 * that._l12_2a) / m3;
    }
    that._context.bezierCurveTo(x1, y1, x22, y22, that._x2, that._y2);
  }
  function CatmullRom(context, alpha) {
    this._context = context;
    this._alpha = alpha;
  }
  var catmullRom_default;
  var init_catmullRom = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRom.js"() {
      "use strict";
      init_math2();
      init_cardinal();
      __name(point4, "point");
      __name(CatmullRom, "CatmullRom");
      CatmullRom.prototype = {
        areaStart: /* @__PURE__ */ __name(function() {
          this._line = 0;
        }, "areaStart"),
        areaEnd: /* @__PURE__ */ __name(function() {
          this._line = NaN;
        }, "areaEnd"),
        lineStart: /* @__PURE__ */ __name(function() {
          this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
          this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          switch (this._point) {
            case 2:
              this._context.lineTo(this._x2, this._y2);
              break;
            case 3:
              this.point(this._x2, this._y2);
              break;
          }
          if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
          this._line = 1 - this._line;
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          x5 = +x5, y6 = +y6;
          if (this._point) {
            var x23 = this._x2 - x5, y23 = this._y2 - y6;
            this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
          }
          switch (this._point) {
            case 0:
              this._point = 1;
              this._line ? this._context.lineTo(x5, y6) : this._context.moveTo(x5, y6);
              break;
            case 1:
              this._point = 2;
              break;
            case 2:
              this._point = 3;
            // falls through
            default:
              point4(this, x5, y6);
              break;
          }
          this._l01_a = this._l12_a, this._l12_a = this._l23_a;
          this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
          this._x0 = this._x1, this._x1 = this._x2, this._x2 = x5;
          this._y0 = this._y1, this._y1 = this._y2, this._y2 = y6;
        }, "point")
      };
      catmullRom_default = (/* @__PURE__ */ __name((function custom6(alpha) {
        function catmullRom(context) {
          return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);
        }
        __name(catmullRom, "catmullRom");
        catmullRom.alpha = function(alpha2) {
          return custom6(+alpha2);
        };
        return catmullRom;
      }), "custom"))(0.5);
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRomClosed.js
  function CatmullRomClosed(context, alpha) {
    this._context = context;
    this._alpha = alpha;
  }
  var catmullRomClosed_default;
  var init_catmullRomClosed = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRomClosed.js"() {
      "use strict";
      init_cardinalClosed();
      init_noop();
      init_catmullRom();
      __name(CatmullRomClosed, "CatmullRomClosed");
      CatmullRomClosed.prototype = {
        areaStart: noop_default,
        areaEnd: noop_default,
        lineStart: /* @__PURE__ */ __name(function() {
          this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
          this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          switch (this._point) {
            case 1: {
              this._context.moveTo(this._x3, this._y3);
              this._context.closePath();
              break;
            }
            case 2: {
              this._context.lineTo(this._x3, this._y3);
              this._context.closePath();
              break;
            }
            case 3: {
              this.point(this._x3, this._y3);
              this.point(this._x4, this._y4);
              this.point(this._x5, this._y5);
              break;
            }
          }
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          x5 = +x5, y6 = +y6;
          if (this._point) {
            var x23 = this._x2 - x5, y23 = this._y2 - y6;
            this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
          }
          switch (this._point) {
            case 0:
              this._point = 1;
              this._x3 = x5, this._y3 = y6;
              break;
            case 1:
              this._point = 2;
              this._context.moveTo(this._x4 = x5, this._y4 = y6);
              break;
            case 2:
              this._point = 3;
              this._x5 = x5, this._y5 = y6;
              break;
            default:
              point4(this, x5, y6);
              break;
          }
          this._l01_a = this._l12_a, this._l12_a = this._l23_a;
          this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
          this._x0 = this._x1, this._x1 = this._x2, this._x2 = x5;
          this._y0 = this._y1, this._y1 = this._y2, this._y2 = y6;
        }, "point")
      };
      catmullRomClosed_default = (/* @__PURE__ */ __name((function custom7(alpha) {
        function catmullRom(context) {
          return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);
        }
        __name(catmullRom, "catmullRom");
        catmullRom.alpha = function(alpha2) {
          return custom7(+alpha2);
        };
        return catmullRom;
      }), "custom"))(0.5);
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRomOpen.js
  function CatmullRomOpen(context, alpha) {
    this._context = context;
    this._alpha = alpha;
  }
  var catmullRomOpen_default;
  var init_catmullRomOpen = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRomOpen.js"() {
      "use strict";
      init_cardinalOpen();
      init_catmullRom();
      __name(CatmullRomOpen, "CatmullRomOpen");
      CatmullRomOpen.prototype = {
        areaStart: /* @__PURE__ */ __name(function() {
          this._line = 0;
        }, "areaStart"),
        areaEnd: /* @__PURE__ */ __name(function() {
          this._line = NaN;
        }, "areaEnd"),
        lineStart: /* @__PURE__ */ __name(function() {
          this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
          this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();
          this._line = 1 - this._line;
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          x5 = +x5, y6 = +y6;
          if (this._point) {
            var x23 = this._x2 - x5, y23 = this._y2 - y6;
            this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
          }
          switch (this._point) {
            case 0:
              this._point = 1;
              break;
            case 1:
              this._point = 2;
              break;
            case 2:
              this._point = 3;
              this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
              break;
            case 3:
              this._point = 4;
            // falls through
            default:
              point4(this, x5, y6);
              break;
          }
          this._l01_a = this._l12_a, this._l12_a = this._l23_a;
          this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
          this._x0 = this._x1, this._x1 = this._x2, this._x2 = x5;
          this._y0 = this._y1, this._y1 = this._y2, this._y2 = y6;
        }, "point")
      };
      catmullRomOpen_default = (/* @__PURE__ */ __name((function custom8(alpha) {
        function catmullRom(context) {
          return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);
        }
        __name(catmullRom, "catmullRom");
        catmullRom.alpha = function(alpha2) {
          return custom8(+alpha2);
        };
        return catmullRom;
      }), "custom"))(0.5);
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linearClosed.js
  function LinearClosed(context) {
    this._context = context;
  }
  function linearClosed_default(context) {
    return new LinearClosed(context);
  }
  var init_linearClosed = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linearClosed.js"() {
      "use strict";
      init_noop();
      __name(LinearClosed, "LinearClosed");
      LinearClosed.prototype = {
        areaStart: noop_default,
        areaEnd: noop_default,
        lineStart: /* @__PURE__ */ __name(function() {
          this._point = 0;
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          if (this._point) this._context.closePath();
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          x5 = +x5, y6 = +y6;
          if (this._point) this._context.lineTo(x5, y6);
          else this._point = 1, this._context.moveTo(x5, y6);
        }, "point")
      };
      __name(linearClosed_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/monotone.js
  function sign(x5) {
    return x5 < 0 ? -1 : 1;
  }
  function slope3(that, x22, y22) {
    var h0 = that._x1 - that._x0, h1 = x22 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y22 - that._y1) / (h1 || h0 < 0 && -0), p3 = (s0 * h1 + s1 * h0) / (h0 + h1);
    return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p3)) || 0;
  }
  function slope2(that, t4) {
    var h3 = that._x1 - that._x0;
    return h3 ? (3 * (that._y1 - that._y0) / h3 - t4) / 2 : t4;
  }
  function point5(that, t03, t13) {
    var x0 = that._x0, y0 = that._y0, x1 = that._x1, y1 = that._y1, dx = (x1 - x0) / 3;
    that._context.bezierCurveTo(x0 + dx, y0 + dx * t03, x1 - dx, y1 - dx * t13, x1, y1);
  }
  function MonotoneX(context) {
    this._context = context;
  }
  function MonotoneY(context) {
    this._context = new ReflectContext(context);
  }
  function ReflectContext(context) {
    this._context = context;
  }
  function monotoneX(context) {
    return new MonotoneX(context);
  }
  function monotoneY(context) {
    return new MonotoneY(context);
  }
  var init_monotone = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/monotone.js"() {
      "use strict";
      __name(sign, "sign");
      __name(slope3, "slope3");
      __name(slope2, "slope2");
      __name(point5, "point");
      __name(MonotoneX, "MonotoneX");
      MonotoneX.prototype = {
        areaStart: /* @__PURE__ */ __name(function() {
          this._line = 0;
        }, "areaStart"),
        areaEnd: /* @__PURE__ */ __name(function() {
          this._line = NaN;
        }, "areaEnd"),
        lineStart: /* @__PURE__ */ __name(function() {
          this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN;
          this._point = 0;
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          switch (this._point) {
            case 2:
              this._context.lineTo(this._x1, this._y1);
              break;
            case 3:
              point5(this, this._t0, slope2(this, this._t0));
              break;
          }
          if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
          this._line = 1 - this._line;
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          var t13 = NaN;
          x5 = +x5, y6 = +y6;
          if (x5 === this._x1 && y6 === this._y1) return;
          switch (this._point) {
            case 0:
              this._point = 1;
              this._line ? this._context.lineTo(x5, y6) : this._context.moveTo(x5, y6);
              break;
            case 1:
              this._point = 2;
              break;
            case 2:
              this._point = 3;
              point5(this, slope2(this, t13 = slope3(this, x5, y6)), t13);
              break;
            default:
              point5(this, this._t0, t13 = slope3(this, x5, y6));
              break;
          }
          this._x0 = this._x1, this._x1 = x5;
          this._y0 = this._y1, this._y1 = y6;
          this._t0 = t13;
        }, "point")
      };
      __name(MonotoneY, "MonotoneY");
      (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x5, y6) {
        MonotoneX.prototype.point.call(this, y6, x5);
      };
      __name(ReflectContext, "ReflectContext");
      ReflectContext.prototype = {
        moveTo: /* @__PURE__ */ __name(function(x5, y6) {
          this._context.moveTo(y6, x5);
        }, "moveTo"),
        closePath: /* @__PURE__ */ __name(function() {
          this._context.closePath();
        }, "closePath"),
        lineTo: /* @__PURE__ */ __name(function(x5, y6) {
          this._context.lineTo(y6, x5);
        }, "lineTo"),
        bezierCurveTo: /* @__PURE__ */ __name(function(x1, y1, x22, y22, x5, y6) {
          this._context.bezierCurveTo(y1, x1, y22, x22, y6, x5);
        }, "bezierCurveTo")
      };
      __name(monotoneX, "monotoneX");
      __name(monotoneY, "monotoneY");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/natural.js
  function Natural(context) {
    this._context = context;
  }
  function controlPoints(x5) {
    var i2, n2 = x5.length - 1, m3, a2 = new Array(n2), b3 = new Array(n2), r2 = new Array(n2);
    a2[0] = 0, b3[0] = 2, r2[0] = x5[0] + 2 * x5[1];
    for (i2 = 1; i2 < n2 - 1; ++i2) a2[i2] = 1, b3[i2] = 4, r2[i2] = 4 * x5[i2] + 2 * x5[i2 + 1];
    a2[n2 - 1] = 2, b3[n2 - 1] = 7, r2[n2 - 1] = 8 * x5[n2 - 1] + x5[n2];
    for (i2 = 1; i2 < n2; ++i2) m3 = a2[i2] / b3[i2 - 1], b3[i2] -= m3, r2[i2] -= m3 * r2[i2 - 1];
    a2[n2 - 1] = r2[n2 - 1] / b3[n2 - 1];
    for (i2 = n2 - 2; i2 >= 0; --i2) a2[i2] = (r2[i2] - a2[i2 + 1]) / b3[i2];
    b3[n2 - 1] = (x5[n2] + a2[n2 - 1]) / 2;
    for (i2 = 0; i2 < n2 - 1; ++i2) b3[i2] = 2 * x5[i2 + 1] - a2[i2 + 1];
    return [a2, b3];
  }
  function natural_default(context) {
    return new Natural(context);
  }
  var init_natural = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/natural.js"() {
      "use strict";
      __name(Natural, "Natural");
      Natural.prototype = {
        areaStart: /* @__PURE__ */ __name(function() {
          this._line = 0;
        }, "areaStart"),
        areaEnd: /* @__PURE__ */ __name(function() {
          this._line = NaN;
        }, "areaEnd"),
        lineStart: /* @__PURE__ */ __name(function() {
          this._x = [];
          this._y = [];
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          var x5 = this._x, y6 = this._y, n2 = x5.length;
          if (n2) {
            this._line ? this._context.lineTo(x5[0], y6[0]) : this._context.moveTo(x5[0], y6[0]);
            if (n2 === 2) {
              this._context.lineTo(x5[1], y6[1]);
            } else {
              var px = controlPoints(x5), py = controlPoints(y6);
              for (var i0 = 0, i1 = 1; i1 < n2; ++i0, ++i1) {
                this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x5[i1], y6[i1]);
              }
            }
          }
          if (this._line || this._line !== 0 && n2 === 1) this._context.closePath();
          this._line = 1 - this._line;
          this._x = this._y = null;
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          this._x.push(+x5);
          this._y.push(+y6);
        }, "point")
      };
      __name(controlPoints, "controlPoints");
      __name(natural_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/step.js
  function Step(context, t4) {
    this._context = context;
    this._t = t4;
  }
  function step_default(context) {
    return new Step(context, 0.5);
  }
  function stepBefore(context) {
    return new Step(context, 0);
  }
  function stepAfter(context) {
    return new Step(context, 1);
  }
  var init_step = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/step.js"() {
      "use strict";
      __name(Step, "Step");
      Step.prototype = {
        areaStart: /* @__PURE__ */ __name(function() {
          this._line = 0;
        }, "areaStart"),
        areaEnd: /* @__PURE__ */ __name(function() {
          this._line = NaN;
        }, "areaEnd"),
        lineStart: /* @__PURE__ */ __name(function() {
          this._x = this._y = NaN;
          this._point = 0;
        }, "lineStart"),
        lineEnd: /* @__PURE__ */ __name(function() {
          if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);
          if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
          if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;
        }, "lineEnd"),
        point: /* @__PURE__ */ __name(function(x5, y6) {
          x5 = +x5, y6 = +y6;
          switch (this._point) {
            case 0:
              this._point = 1;
              this._line ? this._context.lineTo(x5, y6) : this._context.moveTo(x5, y6);
              break;
            case 1:
              this._point = 2;
            // falls through
            default: {
              if (this._t <= 0) {
                this._context.lineTo(this._x, y6);
                this._context.lineTo(x5, y6);
              } else {
                var x1 = this._x * (1 - this._t) + x5 * this._t;
                this._context.lineTo(x1, this._y);
                this._context.lineTo(x1, y6);
              }
              break;
            }
          }
          this._x = x5, this._y = y6;
        }, "point")
      };
      __name(step_default, "default");
      __name(stepBefore, "stepBefore");
      __name(stepAfter, "stepAfter");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/index.js
  var init_src30 = __esm({
    "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/index.js"() {
      "use strict";
      init_arc();
      init_line();
      init_pie();
      init_basisClosed2();
      init_basisOpen();
      init_basis2();
      init_bump();
      init_bundle();
      init_cardinalClosed();
      init_cardinalOpen();
      init_cardinal();
      init_catmullRomClosed();
      init_catmullRomOpen();
      init_catmullRom();
      init_linearClosed();
      init_linear2();
      init_monotone();
      init_natural();
      init_step();
    }
  });

  // ../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/constant.js
  var init_constant7 = __esm({
    "../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/constant.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/event.js
  var init_event2 = __esm({
    "../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/event.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js
  function Transform(k2, x5, y6) {
    this.k = k2;
    this.x = x5;
    this.y = y6;
  }
  function transform(node2) {
    while (!node2.__zoom) if (!(node2 = node2.parentNode)) return identity3;
    return node2.__zoom;
  }
  var identity3;
  var init_transform2 = __esm({
    "../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js"() {
      "use strict";
      __name(Transform, "Transform");
      Transform.prototype = {
        constructor: Transform,
        scale: /* @__PURE__ */ __name(function(k2) {
          return k2 === 1 ? this : new Transform(this.k * k2, this.x, this.y);
        }, "scale"),
        translate: /* @__PURE__ */ __name(function(x5, y6) {
          return x5 === 0 & y6 === 0 ? this : new Transform(this.k, this.x + this.k * x5, this.y + this.k * y6);
        }, "translate"),
        apply: /* @__PURE__ */ __name(function(point8) {
          return [point8[0] * this.k + this.x, point8[1] * this.k + this.y];
        }, "apply"),
        applyX: /* @__PURE__ */ __name(function(x5) {
          return x5 * this.k + this.x;
        }, "applyX"),
        applyY: /* @__PURE__ */ __name(function(y6) {
          return y6 * this.k + this.y;
        }, "applyY"),
        invert: /* @__PURE__ */ __name(function(location) {
          return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
        }, "invert"),
        invertX: /* @__PURE__ */ __name(function(x5) {
          return (x5 - this.x) / this.k;
        }, "invertX"),
        invertY: /* @__PURE__ */ __name(function(y6) {
          return (y6 - this.y) / this.k;
        }, "invertY"),
        rescaleX: /* @__PURE__ */ __name(function(x5) {
          return x5.copy().domain(x5.range().map(this.invertX, this).map(x5.invert, x5));
        }, "rescaleX"),
        rescaleY: /* @__PURE__ */ __name(function(y6) {
          return y6.copy().domain(y6.range().map(this.invertY, this).map(y6.invert, y6));
        }, "rescaleY"),
        toString: /* @__PURE__ */ __name(function() {
          return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
        }, "toString")
      };
      identity3 = new Transform(1, 0, 0);
      transform.prototype = Transform.prototype;
      __name(transform, "transform");
    }
  });

  // ../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/noevent.js
  var init_noevent2 = __esm({
    "../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/noevent.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/zoom.js
  var init_zoom = __esm({
    "../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/zoom.js"() {
      "use strict";
      init_src11();
      init_constant7();
      init_event2();
      init_transform2();
      init_noevent2();
    }
  });

  // ../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/index.js
  var init_src31 = __esm({
    "../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/index.js"() {
      "use strict";
      init_zoom();
      init_transform2();
    }
  });

  // ../../node_modules/.pnpm/d3@7.9.0/node_modules/d3/src/index.js
  var init_src32 = __esm({
    "../../node_modules/.pnpm/d3@7.9.0/node_modules/d3/src/index.js"() {
      "use strict";
      init_src2();
      init_src3();
      init_src12();
      init_src14();
      init_src7();
      init_src15();
      init_src16();
      init_src4();
      init_src6();
      init_src17();
      init_src10();
      init_src18();
      init_src20();
      init_src21();
      init_src22();
      init_src23();
      init_src8();
      init_src13();
      init_src24();
      init_src19();
      init_src25();
      init_src28();
      init_src29();
      init_src5();
      init_src30();
      init_src26();
      init_src27();
      init_src9();
      init_src11();
      init_src31();
    }
  });

  // ../../node_modules/.pnpm/@braintree+sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/constants.js
  var require_constants = __commonJS({
    "../../node_modules/.pnpm/@braintree+sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/constants.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.BLANK_URL = exports2.relativeFirstCharacters = exports2.whitespaceEscapeCharsRegex = exports2.urlSchemeRegex = exports2.ctrlCharactersRegex = exports2.htmlCtrlEntityRegex = exports2.htmlEntitiesRegex = exports2.invalidProtocolRegex = void 0;
      exports2.invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im;
      exports2.htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g;
      exports2.htmlCtrlEntityRegex = /&(newline|tab);/gi;
      exports2.ctrlCharactersRegex = /[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;
      exports2.urlSchemeRegex = /^.+(:|&colon;)/gim;
      exports2.whitespaceEscapeCharsRegex = /(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;
      exports2.relativeFirstCharacters = [".", "/"];
      exports2.BLANK_URL = "about:blank";
    }
  });

  // ../../node_modules/.pnpm/@braintree+sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.js
  var require_dist = __commonJS({
    "../../node_modules/.pnpm/@braintree+sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.sanitizeUrl = void 0;
      var constants_1 = require_constants();
      function isRelativeUrlWithoutProtocol(url) {
        return constants_1.relativeFirstCharacters.indexOf(url[0]) > -1;
      }
      __name(isRelativeUrlWithoutProtocol, "isRelativeUrlWithoutProtocol");
      function decodeHtmlCharacters(str2) {
        var removedNullByte = str2.replace(constants_1.ctrlCharactersRegex, "");
        return removedNullByte.replace(constants_1.htmlEntitiesRegex, function(match2, dec) {
          return String.fromCharCode(dec);
        });
      }
      __name(decodeHtmlCharacters, "decodeHtmlCharacters");
      function isValidUrl(url) {
        return URL.canParse(url);
      }
      __name(isValidUrl, "isValidUrl");
      function decodeURI(uri) {
        try {
          return decodeURIComponent(uri);
        } catch (e3) {
          return uri;
        }
      }
      __name(decodeURI, "decodeURI");
      function sanitizeUrl6(url) {
        if (!url) {
          return constants_1.BLANK_URL;
        }
        var charsToDecode;
        var decodedUrl = decodeURI(url.trim());
        do {
          decodedUrl = decodeHtmlCharacters(decodedUrl).replace(constants_1.htmlCtrlEntityRegex, "").replace(constants_1.ctrlCharactersRegex, "").replace(constants_1.whitespaceEscapeCharsRegex, "").trim();
          decodedUrl = decodeURI(decodedUrl);
          charsToDecode = decodedUrl.match(constants_1.ctrlCharactersRegex) || decodedUrl.match(constants_1.htmlEntitiesRegex) || decodedUrl.match(constants_1.htmlCtrlEntityRegex) || decodedUrl.match(constants_1.whitespaceEscapeCharsRegex);
        } while (charsToDecode && charsToDecode.length > 0);
        var sanitizedUrl = decodedUrl;
        if (!sanitizedUrl) {
          return constants_1.BLANK_URL;
        }
        if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
          return sanitizedUrl;
        }
        var trimmedUrl = sanitizedUrl.trimStart();
        var urlSchemeParseResults = trimmedUrl.match(constants_1.urlSchemeRegex);
        if (!urlSchemeParseResults) {
          return sanitizedUrl;
        }
        var urlScheme = urlSchemeParseResults[0].toLowerCase().trim();
        if (constants_1.invalidProtocolRegex.test(urlScheme)) {
          return constants_1.BLANK_URL;
        }
        var backSanitized = trimmedUrl.replace(/\\/g, "/");
        if (urlScheme === "mailto:" || urlScheme.includes("://")) {
          return backSanitized;
        }
        if (urlScheme === "http:" || urlScheme === "https:") {
          if (!isValidUrl(backSanitized)) {
            return constants_1.BLANK_URL;
          }
          var url_1 = new URL(backSanitized);
          url_1.protocol = url_1.protocol.toLowerCase();
          url_1.hostname = url_1.hostname.toLowerCase();
          return url_1.toString();
        }
        return backSanitized;
      }
      __name(sanitizeUrl6, "sanitizeUrl");
      exports2.sanitizeUrl = sanitizeUrl6;
    }
  });

  // src/diagrams/common/svgDrawCommon.ts
  var import_sanitize_url, drawRect, drawBackgroundRect, drawText, drawImage, drawEmbeddedImage, getNoteRect, getTextObj, createTooltip;
  var init_svgDrawCommon = __esm({
    "src/diagrams/common/svgDrawCommon.ts"() {
      "use strict";
      import_sanitize_url = __toESM(require_dist(), 1);
      init_src32();
      init_common();
      drawRect = /* @__PURE__ */ __name((element3, rectData) => {
        const rectElement = element3.append("rect");
        rectElement.attr("x", rectData.x);
        rectElement.attr("y", rectData.y);
        rectElement.attr("fill", rectData.fill);
        rectElement.attr("stroke", rectData.stroke);
        rectElement.attr("width", rectData.width);
        rectElement.attr("height", rectData.height);
        if (rectData.name) {
          rectElement.attr("name", rectData.name);
        }
        if (rectData.rx) {
          rectElement.attr("rx", rectData.rx);
        }
        if (rectData.ry) {
          rectElement.attr("ry", rectData.ry);
        }
        if (rectData.attrs !== void 0) {
          for (const attrKey in rectData.attrs) {
            rectElement.attr(attrKey, rectData.attrs[attrKey]);
          }
        }
        if (rectData.class) {
          rectElement.attr("class", rectData.class);
        }
        return rectElement;
      }, "drawRect");
      drawBackgroundRect = /* @__PURE__ */ __name((element3, bounds4) => {
        const rectData = {
          x: bounds4.startx,
          y: bounds4.starty,
          width: bounds4.stopx - bounds4.startx,
          height: bounds4.stopy - bounds4.starty,
          fill: bounds4.fill,
          stroke: bounds4.stroke,
          class: "rect"
        };
        const rectElement = drawRect(element3, rectData);
        rectElement.lower();
      }, "drawBackgroundRect");
      drawText = /* @__PURE__ */ __name((element3, textData) => {
        const nText = textData.text.replace(lineBreakRegex, " ");
        const textElem = element3.append("text");
        textElem.attr("x", textData.x);
        textElem.attr("y", textData.y);
        textElem.attr("class", "legend");
        textElem.style("text-anchor", textData.anchor);
        if (textData.class) {
          textElem.attr("class", textData.class);
        }
        const tspan = textElem.append("tspan");
        tspan.attr("x", textData.x + textData.textMargin * 2);
        tspan.text(nText);
        return textElem;
      }, "drawText");
      drawImage = /* @__PURE__ */ __name((elem, x5, y6, link2) => {
        const imageElement = elem.append("image");
        imageElement.attr("x", x5);
        imageElement.attr("y", y6);
        const sanitizedLink = (0, import_sanitize_url.sanitizeUrl)(link2);
        imageElement.attr("xlink:href", sanitizedLink);
      }, "drawImage");
      drawEmbeddedImage = /* @__PURE__ */ __name((element3, x5, y6, link2) => {
        const imageElement = element3.append("use");
        imageElement.attr("x", x5);
        imageElement.attr("y", y6);
        const sanitizedLink = (0, import_sanitize_url.sanitizeUrl)(link2);
        imageElement.attr("xlink:href", `#${sanitizedLink}`);
      }, "drawEmbeddedImage");
      getNoteRect = /* @__PURE__ */ __name(() => {
        const noteRectData = {
          x: 0,
          y: 0,
          width: 100,
          height: 100,
          fill: "#EDF2AE",
          stroke: "#666",
          anchor: "start",
          rx: 0,
          ry: 0
        };
        return noteRectData;
      }, "getNoteRect");
      getTextObj = /* @__PURE__ */ __name(() => {
        const testObject = {
          x: 0,
          y: 0,
          width: 100,
          height: 100,
          "text-anchor": "start",
          style: "#666",
          textMargin: 0,
          rx: 0,
          ry: 0,
          tspan: true
        };
        return testObject;
      }, "getTextObj");
      createTooltip = /* @__PURE__ */ __name(() => {
        let tooltipElem = select_default2(".mermaidTooltip");
        if (tooltipElem.empty()) {
          tooltipElem = select_default2("body").append("div").attr("class", "mermaidTooltip").style("opacity", 0).style("position", "absolute").style("text-align", "center").style("max-width", "200px").style("padding", "2px").style("font-size", "12px").style("background", "#ffffde").style("border", "1px solid #333").style("border-radius", "2px").style("pointer-events", "none").style("z-index", "100");
        }
        return tooltipElem;
      }, "createTooltip");
    }
  });

  // src/diagrams/c4/svgDraw.js
  var import_sanitize_url2, drawRect2, drawImage2, drawRels, drawBoundary, drawC4Shape, insertDatabaseIcon, insertComputerIcon, insertClockIcon, insertArrowHead, insertArrowEnd, insertArrowFilledHead, insertArrowCrossHead, getC4ShapeFont, _drawTextCandidateFunc, svgDraw_default;
  var init_svgDraw = __esm({
    "src/diagrams/c4/svgDraw.js"() {
      "use strict";
      init_common();
      init_svgDrawCommon();
      import_sanitize_url2 = __toESM(require_dist(), 1);
      drawRect2 = /* @__PURE__ */ __name(function(elem, rectData) {
        return drawRect(elem, rectData);
      }, "drawRect");
      drawImage2 = /* @__PURE__ */ __name(function(elem, width3, height2, x5, y6, link2) {
        const imageElem = elem.append("image");
        imageElem.attr("width", width3);
        imageElem.attr("height", height2);
        imageElem.attr("x", x5);
        imageElem.attr("y", y6);
        let sanitizedLink = link2.startsWith("data:image/png;base64") ? link2 : (0, import_sanitize_url2.sanitizeUrl)(link2);
        imageElem.attr("xlink:href", sanitizedLink);
      }, "drawImage");
      drawRels = /* @__PURE__ */ __name((elem, rels2, conf5, diagramId3) => {
        const relsElem = elem.append("g");
        let i2 = 0;
        for (let rel2 of rels2) {
          let textColor = rel2.textColor ? rel2.textColor : "#444444";
          let strokeColor = rel2.lineColor ? rel2.lineColor : "#444444";
          let offsetX = rel2.offsetX ? parseInt(rel2.offsetX) : 0;
          let offsetY = rel2.offsetY ? parseInt(rel2.offsetY) : 0;
          let url = "";
          if (i2 === 0) {
            let line2 = relsElem.append("line");
            line2.attr("x1", rel2.startPoint.x);
            line2.attr("y1", rel2.startPoint.y);
            line2.attr("x2", rel2.endPoint.x);
            line2.attr("y2", rel2.endPoint.y);
            line2.attr("stroke-width", "1");
            line2.attr("stroke", strokeColor);
            line2.style("fill", "none");
            if (rel2.type !== "rel_b") {
              line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-arrowhead)");
            }
            if (rel2.type === "birel" || rel2.type === "rel_b") {
              line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-arrowend)");
            }
            i2 = -1;
          } else {
            let line2 = relsElem.append("path");
            line2.attr("fill", "none").attr("stroke-width", "1").attr("stroke", strokeColor).attr(
              "d",
              "Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx", rel2.startPoint.x).replaceAll("starty", rel2.startPoint.y).replaceAll(
                "controlx",
                rel2.startPoint.x + (rel2.endPoint.x - rel2.startPoint.x) / 2 - (rel2.endPoint.x - rel2.startPoint.x) / 4
              ).replaceAll("controly", rel2.startPoint.y + (rel2.endPoint.y - rel2.startPoint.y) / 2).replaceAll("stopx", rel2.endPoint.x).replaceAll("stopy", rel2.endPoint.y)
            );
            if (rel2.type !== "rel_b") {
              line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-arrowhead)");
            }
            if (rel2.type === "birel" || rel2.type === "rel_b") {
              line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-arrowend)");
            }
          }
          let messageConf = conf5.messageFont();
          _drawTextCandidateFunc(conf5)(
            rel2.label.text,
            relsElem,
            Math.min(rel2.startPoint.x, rel2.endPoint.x) + Math.abs(rel2.endPoint.x - rel2.startPoint.x) / 2 + offsetX,
            Math.min(rel2.startPoint.y, rel2.endPoint.y) + Math.abs(rel2.endPoint.y - rel2.startPoint.y) / 2 + offsetY,
            rel2.label.width,
            rel2.label.height,
            { fill: textColor },
            messageConf
          );
          if (rel2.techn && rel2.techn.text !== "") {
            messageConf = conf5.messageFont();
            _drawTextCandidateFunc(conf5)(
              "[" + rel2.techn.text + "]",
              relsElem,
              Math.min(rel2.startPoint.x, rel2.endPoint.x) + Math.abs(rel2.endPoint.x - rel2.startPoint.x) / 2 + offsetX,
              Math.min(rel2.startPoint.y, rel2.endPoint.y) + Math.abs(rel2.endPoint.y - rel2.startPoint.y) / 2 + conf5.messageFontSize + 5 + offsetY,
              Math.max(rel2.label.width, rel2.techn.width),
              rel2.techn.height,
              { fill: textColor, "font-style": "italic" },
              messageConf
            );
          }
        }
      }, "drawRels");
      drawBoundary = /* @__PURE__ */ __name(function(elem, boundary, conf5) {
        const boundaryElem = elem.append("g");
        let fillColor = boundary.bgColor ? boundary.bgColor : "none";
        let strokeColor = boundary.borderColor ? boundary.borderColor : "#444444";
        let fontColor = boundary.fontColor ? boundary.fontColor : "black";
        let attrsValue = { "stroke-width": 1, "stroke-dasharray": "7.0,7.0" };
        if (boundary.nodeType) {
          attrsValue = { "stroke-width": 1 };
        }
        let rectData = {
          x: boundary.x,
          y: boundary.y,
          fill: fillColor,
          stroke: strokeColor,
          width: boundary.width,
          height: boundary.height,
          rx: 2.5,
          ry: 2.5,
          attrs: attrsValue
        };
        drawRect2(boundaryElem, rectData);
        let boundaryConf = conf5.boundaryFont();
        boundaryConf.fontWeight = "bold";
        boundaryConf.fontSize = boundaryConf.fontSize + 2;
        boundaryConf.fontColor = fontColor;
        _drawTextCandidateFunc(conf5)(
          boundary.label.text,
          boundaryElem,
          boundary.x,
          boundary.y + boundary.label.Y,
          boundary.width,
          boundary.height,
          { fill: "#444444" },
          boundaryConf
        );
        if (boundary.type && boundary.type.text !== "") {
          boundaryConf = conf5.boundaryFont();
          boundaryConf.fontColor = fontColor;
          _drawTextCandidateFunc(conf5)(
            boundary.type.text,
            boundaryElem,
            boundary.x,
            boundary.y + boundary.type.Y,
            boundary.width,
            boundary.height,
            { fill: "#444444" },
            boundaryConf
          );
        }
        if (boundary.descr && boundary.descr.text !== "") {
          boundaryConf = conf5.boundaryFont();
          boundaryConf.fontSize = boundaryConf.fontSize - 2;
          boundaryConf.fontColor = fontColor;
          _drawTextCandidateFunc(conf5)(
            boundary.descr.text,
            boundaryElem,
            boundary.x,
            boundary.y + boundary.descr.Y,
            boundary.width,
            boundary.height,
            { fill: "#444444" },
            boundaryConf
          );
        }
      }, "drawBoundary");
      drawC4Shape = /* @__PURE__ */ __name(function(elem, c4Shape, conf5) {
        let fillColor = c4Shape.bgColor ? c4Shape.bgColor : conf5[c4Shape.typeC4Shape.text + "_bg_color"];
        let strokeColor = c4Shape.borderColor ? c4Shape.borderColor : conf5[c4Shape.typeC4Shape.text + "_border_color"];
        let fontColor = c4Shape.fontColor ? c4Shape.fontColor : "#FFFFFF";
        let personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";
        switch (c4Shape.typeC4Shape.text) {
          case "person":
            personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";
            break;
          case "external_person":
            personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=";
            break;
        }
        const c4ShapeElem = elem.append("g");
        c4ShapeElem.attr("class", "person-man");
        const rect3 = getNoteRect();
        switch (c4Shape.typeC4Shape.text) {
          case "person":
          case "external_person":
          case "system":
          case "external_system":
          case "container":
          case "external_container":
          case "component":
          case "external_component":
            rect3.x = c4Shape.x;
            rect3.y = c4Shape.y;
            rect3.fill = fillColor;
            rect3.width = c4Shape.width;
            rect3.height = c4Shape.height;
            rect3.stroke = strokeColor;
            rect3.rx = 2.5;
            rect3.ry = 2.5;
            rect3.attrs = { "stroke-width": 0.5 };
            drawRect2(c4ShapeElem, rect3);
            break;
          case "system_db":
          case "external_system_db":
          case "container_db":
          case "external_container_db":
          case "component_db":
          case "external_component_db":
            c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).attr(
              "d",
              "Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2).replaceAll("height", c4Shape.height)
            );
            c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr(
              "d",
              "Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2)
            );
            break;
          case "system_queue":
          case "external_system_queue":
          case "container_queue":
          case "external_container_queue":
          case "component_queue":
          case "external_component_queue":
            c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).attr(
              "d",
              "Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("width", c4Shape.width).replaceAll("half", c4Shape.height / 2)
            );
            c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr(
              "d",
              "Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx", c4Shape.x + c4Shape.width).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.height / 2)
            );
            break;
        }
        let c4ShapeFontConf = getC4ShapeFont(conf5, c4Shape.typeC4Shape.text);
        c4ShapeElem.append("text").attr("fill", fontColor).attr("font-family", c4ShapeFontConf.fontFamily).attr("font-size", c4ShapeFontConf.fontSize - 2).attr("font-style", "italic").attr("lengthAdjust", "spacing").attr("textLength", c4Shape.typeC4Shape.width).attr("x", c4Shape.x + c4Shape.width / 2 - c4Shape.typeC4Shape.width / 2).attr("y", c4Shape.y + c4Shape.typeC4Shape.Y).text("<<" + c4Shape.typeC4Shape.text + ">>");
        switch (c4Shape.typeC4Shape.text) {
          case "person":
          case "external_person":
            drawImage2(
              c4ShapeElem,
              48,
              48,
              c4Shape.x + c4Shape.width / 2 - 24,
              c4Shape.y + c4Shape.image.Y,
              personImg
            );
            break;
        }
        let textFontConf = conf5[c4Shape.typeC4Shape.text + "Font"]();
        textFontConf.fontWeight = "bold";
        textFontConf.fontSize = textFontConf.fontSize + 2;
        textFontConf.fontColor = fontColor;
        _drawTextCandidateFunc(conf5)(
          c4Shape.label.text,
          c4ShapeElem,
          c4Shape.x,
          c4Shape.y + c4Shape.label.Y,
          c4Shape.width,
          c4Shape.height,
          { fill: fontColor },
          textFontConf
        );
        textFontConf = conf5[c4Shape.typeC4Shape.text + "Font"]();
        textFontConf.fontColor = fontColor;
        if (c4Shape.techn && c4Shape.techn?.text !== "") {
          _drawTextCandidateFunc(conf5)(
            c4Shape.techn.text,
            c4ShapeElem,
            c4Shape.x,
            c4Shape.y + c4Shape.techn.Y,
            c4Shape.width,
            c4Shape.height,
            { fill: fontColor, "font-style": "italic" },
            textFontConf
          );
        } else if (c4Shape.type && c4Shape.type.text !== "") {
          _drawTextCandidateFunc(conf5)(
            c4Shape.type.text,
            c4ShapeElem,
            c4Shape.x,
            c4Shape.y + c4Shape.type.Y,
            c4Shape.width,
            c4Shape.height,
            { fill: fontColor, "font-style": "italic" },
            textFontConf
          );
        }
        if (c4Shape.descr && c4Shape.descr.text !== "") {
          textFontConf = conf5.personFont();
          textFontConf.fontColor = fontColor;
          _drawTextCandidateFunc(conf5)(
            c4Shape.descr.text,
            c4ShapeElem,
            c4Shape.x,
            c4Shape.y + c4Shape.descr.Y,
            c4Shape.width,
            c4Shape.height,
            { fill: fontColor },
            textFontConf
          );
        }
        return c4Shape.height;
      }, "drawC4Shape");
      insertDatabaseIcon = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("symbol").attr("id", id34 + "-database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
          "d",
          "M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z"
        );
      }, "insertDatabaseIcon");
      insertComputerIcon = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("symbol").attr("id", id34 + "-computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
          "d",
          "M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z"
        );
      }, "insertComputerIcon");
      insertClockIcon = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("symbol").attr("id", id34 + "-clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
          "d",
          "M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z"
        );
      }, "insertClockIcon");
      insertArrowHead = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("marker").attr("id", id34 + "-arrowhead").attr("refX", 9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z");
      }, "insertArrowHead");
      insertArrowEnd = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("marker").attr("id", id34 + "-arrowend").attr("refX", 1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 z");
      }, "insertArrowEnd");
      insertArrowFilledHead = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("marker").attr("id", id34 + "-filled-head").attr("refX", 18).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
      }, "insertArrowFilledHead");
      insertArrowCrossHead = /* @__PURE__ */ __name(function(elem, id34) {
        const defs2 = elem.append("defs");
        const marker = defs2.append("marker").attr("id", id34 + "-crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 16).attr("refY", 4);
        marker.append("path").attr("fill", "black").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 9,2 V 6 L16,4 Z");
        marker.append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 0,1 L 6,7 M 6,1 L 0,7");
      }, "insertArrowCrossHead");
      getC4ShapeFont = /* @__PURE__ */ __name((cnf, typeC4Shape) => {
        return {
          fontFamily: cnf[typeC4Shape + "FontFamily"],
          fontSize: cnf[typeC4Shape + "FontSize"],
          fontWeight: cnf[typeC4Shape + "FontWeight"]
        };
      }, "getC4ShapeFont");
      _drawTextCandidateFunc = /* @__PURE__ */ (function() {
        function byText(content, g2, x5, y6, width3, height2, textAttrs) {
          const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6 + height2 / 2 + 5).style("text-anchor", "middle").text(content);
          _setTextAttrs(text4, textAttrs);
        }
        __name(byText, "byText");
        function byTspan(content, g2, x5, y6, width3, height2, textAttrs, conf5) {
          const { fontSize, fontFamily, fontWeight } = conf5;
          const lines = content.split(common_default.lineBreakRegex);
          for (let i2 = 0; i2 < lines.length; i2++) {
            const dy = i2 * fontSize - fontSize * (lines.length - 1) / 2;
            const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6).style("text-anchor", "middle").attr("dominant-baseline", "middle").style("font-size", fontSize).style("font-weight", fontWeight).style("font-family", fontFamily);
            text4.append("tspan").attr("dy", dy).text(lines[i2]).attr("alignment-baseline", "mathematical");
            _setTextAttrs(text4, textAttrs);
          }
        }
        __name(byTspan, "byTspan");
        function byFo(content, g2, x5, y6, width3, height2, textAttrs, conf5) {
          const s2 = g2.append("switch");
          const f2 = s2.append("foreignObject").attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2);
          const text4 = f2.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
          text4.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
          byTspan(content, s2, x5, y6, width3, height2, textAttrs, conf5);
          _setTextAttrs(text4, textAttrs);
        }
        __name(byFo, "byFo");
        function _setTextAttrs(toText, fromTextAttrsDict) {
          for (const key in fromTextAttrsDict) {
            if (fromTextAttrsDict.hasOwnProperty(key)) {
              toText.attr(key, fromTextAttrsDict[key]);
            }
          }
        }
        __name(_setTextAttrs, "_setTextAttrs");
        return function(conf5) {
          return conf5.textPlacement === "fo" ? byFo : conf5.textPlacement === "old" ? byText : byTspan;
        };
      })();
      svgDraw_default = {
        drawRect: drawRect2,
        drawBoundary,
        drawC4Shape,
        drawRels,
        drawImage: drawImage2,
        insertArrowHead,
        insertArrowEnd,
        insertArrowFilledHead,
        insertArrowCrossHead,
        insertDatabaseIcon,
        insertComputerIcon,
        insertClockIcon
      };
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js
  var freeGlobal, freeGlobal_default;
  var init_freeGlobal = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js"() {
      "use strict";
      freeGlobal = typeof global == "object" && global && global.Object === Object && global;
      freeGlobal_default = freeGlobal;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_root.js
  var freeSelf, root2, root_default;
  var init_root = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_root.js"() {
      "use strict";
      init_freeGlobal();
      freeSelf = typeof self == "object" && self && self.Object === Object && self;
      root2 = freeGlobal_default || freeSelf || Function("return this")();
      root_default = root2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js
  var Symbol2, Symbol_default;
  var init_Symbol = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js"() {
      "use strict";
      init_root();
      Symbol2 = root_default.Symbol;
      Symbol_default = Symbol2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js
  function getRawTag(value2) {
    var isOwn = hasOwnProperty.call(value2, symToStringTag), tag = value2[symToStringTag];
    try {
      value2[symToStringTag] = void 0;
      var unmasked = true;
    } catch (e3) {
    }
    var result = nativeObjectToString.call(value2);
    if (unmasked) {
      if (isOwn) {
        value2[symToStringTag] = tag;
      } else {
        delete value2[symToStringTag];
      }
    }
    return result;
  }
  var objectProto, hasOwnProperty, nativeObjectToString, symToStringTag, getRawTag_default;
  var init_getRawTag = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js"() {
      "use strict";
      init_Symbol();
      objectProto = Object.prototype;
      hasOwnProperty = objectProto.hasOwnProperty;
      nativeObjectToString = objectProto.toString;
      symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
      __name(getRawTag, "getRawTag");
      getRawTag_default = getRawTag;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js
  function objectToString(value2) {
    return nativeObjectToString2.call(value2);
  }
  var objectProto2, nativeObjectToString2, objectToString_default;
  var init_objectToString = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js"() {
      "use strict";
      objectProto2 = Object.prototype;
      nativeObjectToString2 = objectProto2.toString;
      __name(objectToString, "objectToString");
      objectToString_default = objectToString;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js
  function baseGetTag(value2) {
    if (value2 == null) {
      return value2 === void 0 ? undefinedTag : nullTag;
    }
    return symToStringTag2 && symToStringTag2 in Object(value2) ? getRawTag_default(value2) : objectToString_default(value2);
  }
  var nullTag, undefinedTag, symToStringTag2, baseGetTag_default;
  var init_baseGetTag = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js"() {
      "use strict";
      init_Symbol();
      init_getRawTag();
      init_objectToString();
      nullTag = "[object Null]";
      undefinedTag = "[object Undefined]";
      symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
      __name(baseGetTag, "baseGetTag");
      baseGetTag_default = baseGetTag;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObject.js
  function isObject(value2) {
    var type3 = typeof value2;
    return value2 != null && (type3 == "object" || type3 == "function");
  }
  var isObject_default;
  var init_isObject = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObject.js"() {
      "use strict";
      __name(isObject, "isObject");
      isObject_default = isObject;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js
  function isFunction(value2) {
    if (!isObject_default(value2)) {
      return false;
    }
    var tag = baseGetTag_default(value2);
    return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  }
  var asyncTag, funcTag, genTag, proxyTag, isFunction_default;
  var init_isFunction = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js"() {
      "use strict";
      init_baseGetTag();
      init_isObject();
      asyncTag = "[object AsyncFunction]";
      funcTag = "[object Function]";
      genTag = "[object GeneratorFunction]";
      proxyTag = "[object Proxy]";
      __name(isFunction, "isFunction");
      isFunction_default = isFunction;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js
  var coreJsData, coreJsData_default;
  var init_coreJsData = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js"() {
      "use strict";
      init_root();
      coreJsData = root_default["__core-js_shared__"];
      coreJsData_default = coreJsData;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js
  function isMasked(func) {
    return !!maskSrcKey && maskSrcKey in func;
  }
  var maskSrcKey, isMasked_default;
  var init_isMasked = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js"() {
      "use strict";
      init_coreJsData();
      maskSrcKey = (function() {
        var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
        return uid ? "Symbol(src)_1." + uid : "";
      })();
      __name(isMasked, "isMasked");
      isMasked_default = isMasked;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js
  function toSource(func) {
    if (func != null) {
      try {
        return funcToString.call(func);
      } catch (e3) {
      }
      try {
        return func + "";
      } catch (e3) {
      }
    }
    return "";
  }
  var funcProto, funcToString, toSource_default;
  var init_toSource = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js"() {
      "use strict";
      funcProto = Function.prototype;
      funcToString = funcProto.toString;
      __name(toSource, "toSource");
      toSource_default = toSource;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js
  function baseIsNative(value2) {
    if (!isObject_default(value2) || isMasked_default(value2)) {
      return false;
    }
    var pattern = isFunction_default(value2) ? reIsNative : reIsHostCtor;
    return pattern.test(toSource_default(value2));
  }
  var reRegExpChar, reIsHostCtor, funcProto2, objectProto3, funcToString2, hasOwnProperty2, reIsNative, baseIsNative_default;
  var init_baseIsNative = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js"() {
      "use strict";
      init_isFunction();
      init_isMasked();
      init_isObject();
      init_toSource();
      reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
      reIsHostCtor = /^\[object .+?Constructor\]$/;
      funcProto2 = Function.prototype;
      objectProto3 = Object.prototype;
      funcToString2 = funcProto2.toString;
      hasOwnProperty2 = objectProto3.hasOwnProperty;
      reIsNative = RegExp(
        "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
      );
      __name(baseIsNative, "baseIsNative");
      baseIsNative_default = baseIsNative;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js
  function getValue(object3, key) {
    return object3 == null ? void 0 : object3[key];
  }
  var getValue_default;
  var init_getValue = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js"() {
      "use strict";
      __name(getValue, "getValue");
      getValue_default = getValue;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js
  function getNative(object3, key) {
    var value2 = getValue_default(object3, key);
    return baseIsNative_default(value2) ? value2 : void 0;
  }
  var getNative_default;
  var init_getNative = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js"() {
      "use strict";
      init_baseIsNative();
      init_getValue();
      __name(getNative, "getNative");
      getNative_default = getNative;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js
  var nativeCreate, nativeCreate_default;
  var init_nativeCreate = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js"() {
      "use strict";
      init_getNative();
      nativeCreate = getNative_default(Object, "create");
      nativeCreate_default = nativeCreate;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js
  function hashClear() {
    this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
    this.size = 0;
  }
  var hashClear_default;
  var init_hashClear = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js"() {
      "use strict";
      init_nativeCreate();
      __name(hashClear, "hashClear");
      hashClear_default = hashClear;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js
  function hashDelete(key) {
    var result = this.has(key) && delete this.__data__[key];
    this.size -= result ? 1 : 0;
    return result;
  }
  var hashDelete_default;
  var init_hashDelete = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js"() {
      "use strict";
      __name(hashDelete, "hashDelete");
      hashDelete_default = hashDelete;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js
  function hashGet(key) {
    var data5 = this.__data__;
    if (nativeCreate_default) {
      var result = data5[key];
      return result === HASH_UNDEFINED ? void 0 : result;
    }
    return hasOwnProperty3.call(data5, key) ? data5[key] : void 0;
  }
  var HASH_UNDEFINED, objectProto4, hasOwnProperty3, hashGet_default;
  var init_hashGet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js"() {
      "use strict";
      init_nativeCreate();
      HASH_UNDEFINED = "__lodash_hash_undefined__";
      objectProto4 = Object.prototype;
      hasOwnProperty3 = objectProto4.hasOwnProperty;
      __name(hashGet, "hashGet");
      hashGet_default = hashGet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js
  function hashHas(key) {
    var data5 = this.__data__;
    return nativeCreate_default ? data5[key] !== void 0 : hasOwnProperty4.call(data5, key);
  }
  var objectProto5, hasOwnProperty4, hashHas_default;
  var init_hashHas = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js"() {
      "use strict";
      init_nativeCreate();
      objectProto5 = Object.prototype;
      hasOwnProperty4 = objectProto5.hasOwnProperty;
      __name(hashHas, "hashHas");
      hashHas_default = hashHas;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js
  function hashSet(key, value2) {
    var data5 = this.__data__;
    this.size += this.has(key) ? 0 : 1;
    data5[key] = nativeCreate_default && value2 === void 0 ? HASH_UNDEFINED2 : value2;
    return this;
  }
  var HASH_UNDEFINED2, hashSet_default;
  var init_hashSet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js"() {
      "use strict";
      init_nativeCreate();
      HASH_UNDEFINED2 = "__lodash_hash_undefined__";
      __name(hashSet, "hashSet");
      hashSet_default = hashSet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js
  function Hash(entries2) {
    var index = -1, length2 = entries2 == null ? 0 : entries2.length;
    this.clear();
    while (++index < length2) {
      var entry = entries2[index];
      this.set(entry[0], entry[1]);
    }
  }
  var Hash_default;
  var init_Hash = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js"() {
      "use strict";
      init_hashClear();
      init_hashDelete();
      init_hashGet();
      init_hashHas();
      init_hashSet();
      __name(Hash, "Hash");
      Hash.prototype.clear = hashClear_default;
      Hash.prototype["delete"] = hashDelete_default;
      Hash.prototype.get = hashGet_default;
      Hash.prototype.has = hashHas_default;
      Hash.prototype.set = hashSet_default;
      Hash_default = Hash;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js
  function listCacheClear() {
    this.__data__ = [];
    this.size = 0;
  }
  var listCacheClear_default;
  var init_listCacheClear = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js"() {
      "use strict";
      __name(listCacheClear, "listCacheClear");
      listCacheClear_default = listCacheClear;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/eq.js
  function eq(value2, other) {
    return value2 === other || value2 !== value2 && other !== other;
  }
  var eq_default;
  var init_eq = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/eq.js"() {
      "use strict";
      __name(eq, "eq");
      eq_default = eq;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js
  function assocIndexOf(array4, key) {
    var length2 = array4.length;
    while (length2--) {
      if (eq_default(array4[length2][0], key)) {
        return length2;
      }
    }
    return -1;
  }
  var assocIndexOf_default;
  var init_assocIndexOf = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js"() {
      "use strict";
      init_eq();
      __name(assocIndexOf, "assocIndexOf");
      assocIndexOf_default = assocIndexOf;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js
  function listCacheDelete(key) {
    var data5 = this.__data__, index = assocIndexOf_default(data5, key);
    if (index < 0) {
      return false;
    }
    var lastIndex = data5.length - 1;
    if (index == lastIndex) {
      data5.pop();
    } else {
      splice.call(data5, index, 1);
    }
    --this.size;
    return true;
  }
  var arrayProto, splice, listCacheDelete_default;
  var init_listCacheDelete = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js"() {
      "use strict";
      init_assocIndexOf();
      arrayProto = Array.prototype;
      splice = arrayProto.splice;
      __name(listCacheDelete, "listCacheDelete");
      listCacheDelete_default = listCacheDelete;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js
  function listCacheGet(key) {
    var data5 = this.__data__, index = assocIndexOf_default(data5, key);
    return index < 0 ? void 0 : data5[index][1];
  }
  var listCacheGet_default;
  var init_listCacheGet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js"() {
      "use strict";
      init_assocIndexOf();
      __name(listCacheGet, "listCacheGet");
      listCacheGet_default = listCacheGet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js
  function listCacheHas(key) {
    return assocIndexOf_default(this.__data__, key) > -1;
  }
  var listCacheHas_default;
  var init_listCacheHas = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js"() {
      "use strict";
      init_assocIndexOf();
      __name(listCacheHas, "listCacheHas");
      listCacheHas_default = listCacheHas;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js
  function listCacheSet(key, value2) {
    var data5 = this.__data__, index = assocIndexOf_default(data5, key);
    if (index < 0) {
      ++this.size;
      data5.push([key, value2]);
    } else {
      data5[index][1] = value2;
    }
    return this;
  }
  var listCacheSet_default;
  var init_listCacheSet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js"() {
      "use strict";
      init_assocIndexOf();
      __name(listCacheSet, "listCacheSet");
      listCacheSet_default = listCacheSet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js
  function ListCache(entries2) {
    var index = -1, length2 = entries2 == null ? 0 : entries2.length;
    this.clear();
    while (++index < length2) {
      var entry = entries2[index];
      this.set(entry[0], entry[1]);
    }
  }
  var ListCache_default;
  var init_ListCache = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js"() {
      "use strict";
      init_listCacheClear();
      init_listCacheDelete();
      init_listCacheGet();
      init_listCacheHas();
      init_listCacheSet();
      __name(ListCache, "ListCache");
      ListCache.prototype.clear = listCacheClear_default;
      ListCache.prototype["delete"] = listCacheDelete_default;
      ListCache.prototype.get = listCacheGet_default;
      ListCache.prototype.has = listCacheHas_default;
      ListCache.prototype.set = listCacheSet_default;
      ListCache_default = ListCache;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Map.js
  var Map2, Map_default;
  var init_Map = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Map.js"() {
      "use strict";
      init_getNative();
      init_root();
      Map2 = getNative_default(root_default, "Map");
      Map_default = Map2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js
  function mapCacheClear() {
    this.size = 0;
    this.__data__ = {
      "hash": new Hash_default(),
      "map": new (Map_default || ListCache_default)(),
      "string": new Hash_default()
    };
  }
  var mapCacheClear_default;
  var init_mapCacheClear = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js"() {
      "use strict";
      init_Hash();
      init_ListCache();
      init_Map();
      __name(mapCacheClear, "mapCacheClear");
      mapCacheClear_default = mapCacheClear;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js
  function isKeyable(value2) {
    var type3 = typeof value2;
    return type3 == "string" || type3 == "number" || type3 == "symbol" || type3 == "boolean" ? value2 !== "__proto__" : value2 === null;
  }
  var isKeyable_default;
  var init_isKeyable = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js"() {
      "use strict";
      __name(isKeyable, "isKeyable");
      isKeyable_default = isKeyable;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js
  function getMapData(map5, key) {
    var data5 = map5.__data__;
    return isKeyable_default(key) ? data5[typeof key == "string" ? "string" : "hash"] : data5.map;
  }
  var getMapData_default;
  var init_getMapData = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js"() {
      "use strict";
      init_isKeyable();
      __name(getMapData, "getMapData");
      getMapData_default = getMapData;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js
  function mapCacheDelete(key) {
    var result = getMapData_default(this, key)["delete"](key);
    this.size -= result ? 1 : 0;
    return result;
  }
  var mapCacheDelete_default;
  var init_mapCacheDelete = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js"() {
      "use strict";
      init_getMapData();
      __name(mapCacheDelete, "mapCacheDelete");
      mapCacheDelete_default = mapCacheDelete;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js
  function mapCacheGet(key) {
    return getMapData_default(this, key).get(key);
  }
  var mapCacheGet_default;
  var init_mapCacheGet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js"() {
      "use strict";
      init_getMapData();
      __name(mapCacheGet, "mapCacheGet");
      mapCacheGet_default = mapCacheGet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js
  function mapCacheHas(key) {
    return getMapData_default(this, key).has(key);
  }
  var mapCacheHas_default;
  var init_mapCacheHas = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js"() {
      "use strict";
      init_getMapData();
      __name(mapCacheHas, "mapCacheHas");
      mapCacheHas_default = mapCacheHas;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js
  function mapCacheSet(key, value2) {
    var data5 = getMapData_default(this, key), size4 = data5.size;
    data5.set(key, value2);
    this.size += data5.size == size4 ? 0 : 1;
    return this;
  }
  var mapCacheSet_default;
  var init_mapCacheSet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js"() {
      "use strict";
      init_getMapData();
      __name(mapCacheSet, "mapCacheSet");
      mapCacheSet_default = mapCacheSet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js
  function MapCache(entries2) {
    var index = -1, length2 = entries2 == null ? 0 : entries2.length;
    this.clear();
    while (++index < length2) {
      var entry = entries2[index];
      this.set(entry[0], entry[1]);
    }
  }
  var MapCache_default;
  var init_MapCache = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js"() {
      "use strict";
      init_mapCacheClear();
      init_mapCacheDelete();
      init_mapCacheGet();
      init_mapCacheHas();
      init_mapCacheSet();
      __name(MapCache, "MapCache");
      MapCache.prototype.clear = mapCacheClear_default;
      MapCache.prototype["delete"] = mapCacheDelete_default;
      MapCache.prototype.get = mapCacheGet_default;
      MapCache.prototype.has = mapCacheHas_default;
      MapCache.prototype.set = mapCacheSet_default;
      MapCache_default = MapCache;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/memoize.js
  function memoize(func, resolver3) {
    if (typeof func != "function" || resolver3 != null && typeof resolver3 != "function") {
      throw new TypeError(FUNC_ERROR_TEXT);
    }
    var memoized = /* @__PURE__ */ __name(function() {
      var args = arguments, key = resolver3 ? resolver3.apply(this, args) : args[0], cache3 = memoized.cache;
      if (cache3.has(key)) {
        return cache3.get(key);
      }
      var result = func.apply(this, args);
      memoized.cache = cache3.set(key, result) || cache3;
      return result;
    }, "memoized");
    memoized.cache = new (memoize.Cache || MapCache_default)();
    return memoized;
  }
  var FUNC_ERROR_TEXT, memoize_default;
  var init_memoize = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/memoize.js"() {
      "use strict";
      init_MapCache();
      FUNC_ERROR_TEXT = "Expected a function";
      __name(memoize, "memoize");
      memoize.Cache = MapCache_default;
      memoize_default = memoize;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js
  function stackClear() {
    this.__data__ = new ListCache_default();
    this.size = 0;
  }
  var stackClear_default;
  var init_stackClear = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js"() {
      "use strict";
      init_ListCache();
      __name(stackClear, "stackClear");
      stackClear_default = stackClear;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js
  function stackDelete(key) {
    var data5 = this.__data__, result = data5["delete"](key);
    this.size = data5.size;
    return result;
  }
  var stackDelete_default;
  var init_stackDelete = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js"() {
      "use strict";
      __name(stackDelete, "stackDelete");
      stackDelete_default = stackDelete;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js
  function stackGet(key) {
    return this.__data__.get(key);
  }
  var stackGet_default;
  var init_stackGet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js"() {
      "use strict";
      __name(stackGet, "stackGet");
      stackGet_default = stackGet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js
  function stackHas(key) {
    return this.__data__.has(key);
  }
  var stackHas_default;
  var init_stackHas = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js"() {
      "use strict";
      __name(stackHas, "stackHas");
      stackHas_default = stackHas;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js
  function stackSet(key, value2) {
    var data5 = this.__data__;
    if (data5 instanceof ListCache_default) {
      var pairs2 = data5.__data__;
      if (!Map_default || pairs2.length < LARGE_ARRAY_SIZE - 1) {
        pairs2.push([key, value2]);
        this.size = ++data5.size;
        return this;
      }
      data5 = this.__data__ = new MapCache_default(pairs2);
    }
    data5.set(key, value2);
    this.size = data5.size;
    return this;
  }
  var LARGE_ARRAY_SIZE, stackSet_default;
  var init_stackSet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js"() {
      "use strict";
      init_ListCache();
      init_Map();
      init_MapCache();
      LARGE_ARRAY_SIZE = 200;
      __name(stackSet, "stackSet");
      stackSet_default = stackSet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js
  function Stack(entries2) {
    var data5 = this.__data__ = new ListCache_default(entries2);
    this.size = data5.size;
  }
  var Stack_default;
  var init_Stack = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js"() {
      "use strict";
      init_ListCache();
      init_stackClear();
      init_stackDelete();
      init_stackGet();
      init_stackHas();
      init_stackSet();
      __name(Stack, "Stack");
      Stack.prototype.clear = stackClear_default;
      Stack.prototype["delete"] = stackDelete_default;
      Stack.prototype.get = stackGet_default;
      Stack.prototype.has = stackHas_default;
      Stack.prototype.set = stackSet_default;
      Stack_default = Stack;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js
  var defineProperty, defineProperty_default;
  var init_defineProperty = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js"() {
      "use strict";
      init_getNative();
      defineProperty = (function() {
        try {
          var func = getNative_default(Object, "defineProperty");
          func({}, "", {});
          return func;
        } catch (e3) {
        }
      })();
      defineProperty_default = defineProperty;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js
  function baseAssignValue(object3, key, value2) {
    if (key == "__proto__" && defineProperty_default) {
      defineProperty_default(object3, key, {
        "configurable": true,
        "enumerable": true,
        "value": value2,
        "writable": true
      });
    } else {
      object3[key] = value2;
    }
  }
  var baseAssignValue_default;
  var init_baseAssignValue = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js"() {
      "use strict";
      init_defineProperty();
      __name(baseAssignValue, "baseAssignValue");
      baseAssignValue_default = baseAssignValue;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_assignMergeValue.js
  function assignMergeValue(object3, key, value2) {
    if (value2 !== void 0 && !eq_default(object3[key], value2) || value2 === void 0 && !(key in object3)) {
      baseAssignValue_default(object3, key, value2);
    }
  }
  var assignMergeValue_default;
  var init_assignMergeValue = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_assignMergeValue.js"() {
      "use strict";
      init_baseAssignValue();
      init_eq();
      __name(assignMergeValue, "assignMergeValue");
      assignMergeValue_default = assignMergeValue;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createBaseFor.js
  function createBaseFor(fromRight) {
    return function(object3, iteratee, keysFunc) {
      var index = -1, iterable = Object(object3), props = keysFunc(object3), length2 = props.length;
      while (length2--) {
        var key = props[fromRight ? length2 : ++index];
        if (iteratee(iterable[key], key, iterable) === false) {
          break;
        }
      }
      return object3;
    };
  }
  var createBaseFor_default;
  var init_createBaseFor = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createBaseFor.js"() {
      "use strict";
      __name(createBaseFor, "createBaseFor");
      createBaseFor_default = createBaseFor;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseFor.js
  var baseFor, baseFor_default;
  var init_baseFor = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseFor.js"() {
      "use strict";
      init_createBaseFor();
      baseFor = createBaseFor_default();
      baseFor_default = baseFor;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js
  function cloneBuffer(buffer, isDeep) {
    if (isDeep) {
      return buffer.slice();
    }
    var length2 = buffer.length, result = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
    buffer.copy(result);
    return result;
  }
  var freeExports, freeModule, moduleExports, Buffer2, allocUnsafe, cloneBuffer_default;
  var init_cloneBuffer = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js"() {
      "use strict";
      init_root();
      freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
      freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
      moduleExports = freeModule && freeModule.exports === freeExports;
      Buffer2 = moduleExports ? root_default.Buffer : void 0;
      allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
      __name(cloneBuffer, "cloneBuffer");
      cloneBuffer_default = cloneBuffer;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js
  var Uint8Array2, Uint8Array_default;
  var init_Uint8Array = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js"() {
      "use strict";
      init_root();
      Uint8Array2 = root_default.Uint8Array;
      Uint8Array_default = Uint8Array2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js
  function cloneArrayBuffer(arrayBuffer) {
    var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
    new Uint8Array_default(result).set(new Uint8Array_default(arrayBuffer));
    return result;
  }
  var cloneArrayBuffer_default;
  var init_cloneArrayBuffer = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js"() {
      "use strict";
      init_Uint8Array();
      __name(cloneArrayBuffer, "cloneArrayBuffer");
      cloneArrayBuffer_default = cloneArrayBuffer;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js
  function cloneTypedArray(typedArray, isDeep) {
    var buffer = isDeep ? cloneArrayBuffer_default(typedArray.buffer) : typedArray.buffer;
    return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  }
  var cloneTypedArray_default;
  var init_cloneTypedArray = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js"() {
      "use strict";
      init_cloneArrayBuffer();
      __name(cloneTypedArray, "cloneTypedArray");
      cloneTypedArray_default = cloneTypedArray;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js
  function copyArray(source, array4) {
    var index = -1, length2 = source.length;
    array4 || (array4 = Array(length2));
    while (++index < length2) {
      array4[index] = source[index];
    }
    return array4;
  }
  var copyArray_default;
  var init_copyArray = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js"() {
      "use strict";
      __name(copyArray, "copyArray");
      copyArray_default = copyArray;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js
  var objectCreate, baseCreate, baseCreate_default;
  var init_baseCreate = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js"() {
      "use strict";
      init_isObject();
      objectCreate = Object.create;
      baseCreate = /* @__PURE__ */ (function() {
        function object3() {
        }
        __name(object3, "object");
        return function(proto) {
          if (!isObject_default(proto)) {
            return {};
          }
          if (objectCreate) {
            return objectCreate(proto);
          }
          object3.prototype = proto;
          var result = new object3();
          object3.prototype = void 0;
          return result;
        };
      })();
      baseCreate_default = baseCreate;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js
  function overArg(func, transform8) {
    return function(arg) {
      return func(transform8(arg));
    };
  }
  var overArg_default;
  var init_overArg = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js"() {
      "use strict";
      __name(overArg, "overArg");
      overArg_default = overArg;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js
  var getPrototype, getPrototype_default;
  var init_getPrototype = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js"() {
      "use strict";
      init_overArg();
      getPrototype = overArg_default(Object.getPrototypeOf, Object);
      getPrototype_default = getPrototype;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js
  function isPrototype(value2) {
    var Ctor = value2 && value2.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto6;
    return value2 === proto;
  }
  var objectProto6, isPrototype_default;
  var init_isPrototype = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js"() {
      "use strict";
      objectProto6 = Object.prototype;
      __name(isPrototype, "isPrototype");
      isPrototype_default = isPrototype;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js
  function initCloneObject(object3) {
    return typeof object3.constructor == "function" && !isPrototype_default(object3) ? baseCreate_default(getPrototype_default(object3)) : {};
  }
  var initCloneObject_default;
  var init_initCloneObject = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js"() {
      "use strict";
      init_baseCreate();
      init_getPrototype();
      init_isPrototype();
      __name(initCloneObject, "initCloneObject");
      initCloneObject_default = initCloneObject;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js
  function isObjectLike(value2) {
    return value2 != null && typeof value2 == "object";
  }
  var isObjectLike_default;
  var init_isObjectLike = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js"() {
      "use strict";
      __name(isObjectLike, "isObjectLike");
      isObjectLike_default = isObjectLike;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js
  function baseIsArguments(value2) {
    return isObjectLike_default(value2) && baseGetTag_default(value2) == argsTag;
  }
  var argsTag, baseIsArguments_default;
  var init_baseIsArguments = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js"() {
      "use strict";
      init_baseGetTag();
      init_isObjectLike();
      argsTag = "[object Arguments]";
      __name(baseIsArguments, "baseIsArguments");
      baseIsArguments_default = baseIsArguments;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js
  var objectProto7, hasOwnProperty5, propertyIsEnumerable, isArguments, isArguments_default;
  var init_isArguments = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js"() {
      "use strict";
      init_baseIsArguments();
      init_isObjectLike();
      objectProto7 = Object.prototype;
      hasOwnProperty5 = objectProto7.hasOwnProperty;
      propertyIsEnumerable = objectProto7.propertyIsEnumerable;
      isArguments = baseIsArguments_default(/* @__PURE__ */ (function() {
        return arguments;
      })()) ? baseIsArguments_default : function(value2) {
        return isObjectLike_default(value2) && hasOwnProperty5.call(value2, "callee") && !propertyIsEnumerable.call(value2, "callee");
      };
      isArguments_default = isArguments;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArray.js
  var isArray, isArray_default;
  var init_isArray = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArray.js"() {
      "use strict";
      isArray = Array.isArray;
      isArray_default = isArray;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isLength.js
  function isLength(value2) {
    return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER;
  }
  var MAX_SAFE_INTEGER, isLength_default;
  var init_isLength = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isLength.js"() {
      "use strict";
      MAX_SAFE_INTEGER = 9007199254740991;
      __name(isLength, "isLength");
      isLength_default = isLength;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js
  function isArrayLike(value2) {
    return value2 != null && isLength_default(value2.length) && !isFunction_default(value2);
  }
  var isArrayLike_default;
  var init_isArrayLike = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js"() {
      "use strict";
      init_isFunction();
      init_isLength();
      __name(isArrayLike, "isArrayLike");
      isArrayLike_default = isArrayLike;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArrayLikeObject.js
  function isArrayLikeObject(value2) {
    return isObjectLike_default(value2) && isArrayLike_default(value2);
  }
  var isArrayLikeObject_default;
  var init_isArrayLikeObject = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArrayLikeObject.js"() {
      "use strict";
      init_isArrayLike();
      init_isObjectLike();
      __name(isArrayLikeObject, "isArrayLikeObject");
      isArrayLikeObject_default = isArrayLikeObject;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js
  function stubFalse() {
    return false;
  }
  var stubFalse_default;
  var init_stubFalse = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js"() {
      "use strict";
      __name(stubFalse, "stubFalse");
      stubFalse_default = stubFalse;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js
  var freeExports2, freeModule2, moduleExports2, Buffer3, nativeIsBuffer, isBuffer, isBuffer_default;
  var init_isBuffer = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js"() {
      "use strict";
      init_root();
      init_stubFalse();
      freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports;
      freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
      moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
      Buffer3 = moduleExports2 ? root_default.Buffer : void 0;
      nativeIsBuffer = Buffer3 ? Buffer3.isBuffer : void 0;
      isBuffer = nativeIsBuffer || stubFalse_default;
      isBuffer_default = isBuffer;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isPlainObject.js
  function isPlainObject(value2) {
    if (!isObjectLike_default(value2) || baseGetTag_default(value2) != objectTag) {
      return false;
    }
    var proto = getPrototype_default(value2);
    if (proto === null) {
      return true;
    }
    var Ctor = hasOwnProperty6.call(proto, "constructor") && proto.constructor;
    return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
  }
  var objectTag, funcProto3, objectProto8, funcToString3, hasOwnProperty6, objectCtorString, isPlainObject_default;
  var init_isPlainObject = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isPlainObject.js"() {
      "use strict";
      init_baseGetTag();
      init_getPrototype();
      init_isObjectLike();
      objectTag = "[object Object]";
      funcProto3 = Function.prototype;
      objectProto8 = Object.prototype;
      funcToString3 = funcProto3.toString;
      hasOwnProperty6 = objectProto8.hasOwnProperty;
      objectCtorString = funcToString3.call(Object);
      __name(isPlainObject, "isPlainObject");
      isPlainObject_default = isPlainObject;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js
  function baseIsTypedArray(value2) {
    return isObjectLike_default(value2) && isLength_default(value2.length) && !!typedArrayTags[baseGetTag_default(value2)];
  }
  var argsTag2, arrayTag, boolTag, dateTag, errorTag, funcTag2, mapTag, numberTag, objectTag2, regexpTag, setTag, stringTag, weakMapTag, arrayBufferTag, dataViewTag, float32Tag, float64Tag, int8Tag, int16Tag, int32Tag, uint8Tag, uint8ClampedTag, uint16Tag, uint32Tag, typedArrayTags, baseIsTypedArray_default;
  var init_baseIsTypedArray = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js"() {
      "use strict";
      init_baseGetTag();
      init_isLength();
      init_isObjectLike();
      argsTag2 = "[object Arguments]";
      arrayTag = "[object Array]";
      boolTag = "[object Boolean]";
      dateTag = "[object Date]";
      errorTag = "[object Error]";
      funcTag2 = "[object Function]";
      mapTag = "[object Map]";
      numberTag = "[object Number]";
      objectTag2 = "[object Object]";
      regexpTag = "[object RegExp]";
      setTag = "[object Set]";
      stringTag = "[object String]";
      weakMapTag = "[object WeakMap]";
      arrayBufferTag = "[object ArrayBuffer]";
      dataViewTag = "[object DataView]";
      float32Tag = "[object Float32Array]";
      float64Tag = "[object Float64Array]";
      int8Tag = "[object Int8Array]";
      int16Tag = "[object Int16Array]";
      int32Tag = "[object Int32Array]";
      uint8Tag = "[object Uint8Array]";
      uint8ClampedTag = "[object Uint8ClampedArray]";
      uint16Tag = "[object Uint16Array]";
      uint32Tag = "[object Uint32Array]";
      typedArrayTags = {};
      typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
      typedArrayTags[argsTag2] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag2] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag2] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
      __name(baseIsTypedArray, "baseIsTypedArray");
      baseIsTypedArray_default = baseIsTypedArray;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js
  function baseUnary(func) {
    return function(value2) {
      return func(value2);
    };
  }
  var baseUnary_default;
  var init_baseUnary = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js"() {
      "use strict";
      __name(baseUnary, "baseUnary");
      baseUnary_default = baseUnary;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js
  var freeExports3, freeModule3, moduleExports3, freeProcess, nodeUtil, nodeUtil_default;
  var init_nodeUtil = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js"() {
      "use strict";
      init_freeGlobal();
      freeExports3 = typeof exports == "object" && exports && !exports.nodeType && exports;
      freeModule3 = freeExports3 && typeof module == "object" && module && !module.nodeType && module;
      moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
      freeProcess = moduleExports3 && freeGlobal_default.process;
      nodeUtil = (function() {
        try {
          var types = freeModule3 && freeModule3.require && freeModule3.require("util").types;
          if (types) {
            return types;
          }
          return freeProcess && freeProcess.binding && freeProcess.binding("util");
        } catch (e3) {
        }
      })();
      nodeUtil_default = nodeUtil;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js
  var nodeIsTypedArray, isTypedArray, isTypedArray_default;
  var init_isTypedArray = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js"() {
      "use strict";
      init_baseIsTypedArray();
      init_baseUnary();
      init_nodeUtil();
      nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
      isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
      isTypedArray_default = isTypedArray;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_safeGet.js
  function safeGet(object3, key) {
    if (key === "constructor" && typeof object3[key] === "function") {
      return;
    }
    if (key == "__proto__") {
      return;
    }
    return object3[key];
  }
  var safeGet_default;
  var init_safeGet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_safeGet.js"() {
      "use strict";
      __name(safeGet, "safeGet");
      safeGet_default = safeGet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js
  function assignValue(object3, key, value2) {
    var objValue = object3[key];
    if (!(hasOwnProperty7.call(object3, key) && eq_default(objValue, value2)) || value2 === void 0 && !(key in object3)) {
      baseAssignValue_default(object3, key, value2);
    }
  }
  var objectProto9, hasOwnProperty7, assignValue_default;
  var init_assignValue = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js"() {
      "use strict";
      init_baseAssignValue();
      init_eq();
      objectProto9 = Object.prototype;
      hasOwnProperty7 = objectProto9.hasOwnProperty;
      __name(assignValue, "assignValue");
      assignValue_default = assignValue;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js
  function copyObject(source, props, object3, customizer) {
    var isNew = !object3;
    object3 || (object3 = {});
    var index = -1, length2 = props.length;
    while (++index < length2) {
      var key = props[index];
      var newValue = customizer ? customizer(object3[key], source[key], key, object3, source) : void 0;
      if (newValue === void 0) {
        newValue = source[key];
      }
      if (isNew) {
        baseAssignValue_default(object3, key, newValue);
      } else {
        assignValue_default(object3, key, newValue);
      }
    }
    return object3;
  }
  var copyObject_default;
  var init_copyObject = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js"() {
      "use strict";
      init_assignValue();
      init_baseAssignValue();
      __name(copyObject, "copyObject");
      copyObject_default = copyObject;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js
  function baseTimes(n2, iteratee) {
    var index = -1, result = Array(n2);
    while (++index < n2) {
      result[index] = iteratee(index);
    }
    return result;
  }
  var baseTimes_default;
  var init_baseTimes = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js"() {
      "use strict";
      __name(baseTimes, "baseTimes");
      baseTimes_default = baseTimes;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js
  function isIndex(value2, length2) {
    var type3 = typeof value2;
    length2 = length2 == null ? MAX_SAFE_INTEGER2 : length2;
    return !!length2 && (type3 == "number" || type3 != "symbol" && reIsUint.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2);
  }
  var MAX_SAFE_INTEGER2, reIsUint, isIndex_default;
  var init_isIndex = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js"() {
      "use strict";
      MAX_SAFE_INTEGER2 = 9007199254740991;
      reIsUint = /^(?:0|[1-9]\d*)$/;
      __name(isIndex, "isIndex");
      isIndex_default = isIndex;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js
  function arrayLikeKeys(value2, inherited) {
    var isArr = isArray_default(value2), isArg = !isArr && isArguments_default(value2), isBuff = !isArr && !isArg && isBuffer_default(value2), isType2 = !isArr && !isArg && !isBuff && isTypedArray_default(value2), skipIndexes = isArr || isArg || isBuff || isType2, result = skipIndexes ? baseTimes_default(value2.length, String) : [], length2 = result.length;
    for (var key in value2) {
      if ((inherited || hasOwnProperty8.call(value2, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
      (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
      isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
      isType2 && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
      isIndex_default(key, length2)))) {
        result.push(key);
      }
    }
    return result;
  }
  var objectProto10, hasOwnProperty8, arrayLikeKeys_default;
  var init_arrayLikeKeys = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js"() {
      "use strict";
      init_baseTimes();
      init_isArguments();
      init_isArray();
      init_isBuffer();
      init_isIndex();
      init_isTypedArray();
      objectProto10 = Object.prototype;
      hasOwnProperty8 = objectProto10.hasOwnProperty;
      __name(arrayLikeKeys, "arrayLikeKeys");
      arrayLikeKeys_default = arrayLikeKeys;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js
  function nativeKeysIn(object3) {
    var result = [];
    if (object3 != null) {
      for (var key in Object(object3)) {
        result.push(key);
      }
    }
    return result;
  }
  var nativeKeysIn_default;
  var init_nativeKeysIn = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js"() {
      "use strict";
      __name(nativeKeysIn, "nativeKeysIn");
      nativeKeysIn_default = nativeKeysIn;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js
  function baseKeysIn(object3) {
    if (!isObject_default(object3)) {
      return nativeKeysIn_default(object3);
    }
    var isProto = isPrototype_default(object3), result = [];
    for (var key in object3) {
      if (!(key == "constructor" && (isProto || !hasOwnProperty9.call(object3, key)))) {
        result.push(key);
      }
    }
    return result;
  }
  var objectProto11, hasOwnProperty9, baseKeysIn_default;
  var init_baseKeysIn = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js"() {
      "use strict";
      init_isObject();
      init_isPrototype();
      init_nativeKeysIn();
      objectProto11 = Object.prototype;
      hasOwnProperty9 = objectProto11.hasOwnProperty;
      __name(baseKeysIn, "baseKeysIn");
      baseKeysIn_default = baseKeysIn;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js
  function keysIn(object3) {
    return isArrayLike_default(object3) ? arrayLikeKeys_default(object3, true) : baseKeysIn_default(object3);
  }
  var keysIn_default;
  var init_keysIn = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js"() {
      "use strict";
      init_arrayLikeKeys();
      init_baseKeysIn();
      init_isArrayLike();
      __name(keysIn, "keysIn");
      keysIn_default = keysIn;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toPlainObject.js
  function toPlainObject(value2) {
    return copyObject_default(value2, keysIn_default(value2));
  }
  var toPlainObject_default;
  var init_toPlainObject = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toPlainObject.js"() {
      "use strict";
      init_copyObject();
      init_keysIn();
      __name(toPlainObject, "toPlainObject");
      toPlainObject_default = toPlainObject;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMergeDeep.js
  function baseMergeDeep(object3, source, key, srcIndex, mergeFunc, customizer, stack) {
    var objValue = safeGet_default(object3, key), srcValue = safeGet_default(source, key), stacked = stack.get(srcValue);
    if (stacked) {
      assignMergeValue_default(object3, key, stacked);
      return;
    }
    var newValue = customizer ? customizer(objValue, srcValue, key + "", object3, source, stack) : void 0;
    var isCommon = newValue === void 0;
    if (isCommon) {
      var isArr = isArray_default(srcValue), isBuff = !isArr && isBuffer_default(srcValue), isTyped = !isArr && !isBuff && isTypedArray_default(srcValue);
      newValue = srcValue;
      if (isArr || isBuff || isTyped) {
        if (isArray_default(objValue)) {
          newValue = objValue;
        } else if (isArrayLikeObject_default(objValue)) {
          newValue = copyArray_default(objValue);
        } else if (isBuff) {
          isCommon = false;
          newValue = cloneBuffer_default(srcValue, true);
        } else if (isTyped) {
          isCommon = false;
          newValue = cloneTypedArray_default(srcValue, true);
        } else {
          newValue = [];
        }
      } else if (isPlainObject_default(srcValue) || isArguments_default(srcValue)) {
        newValue = objValue;
        if (isArguments_default(objValue)) {
          newValue = toPlainObject_default(objValue);
        } else if (!isObject_default(objValue) || isFunction_default(objValue)) {
          newValue = initCloneObject_default(srcValue);
        }
      } else {
        isCommon = false;
      }
    }
    if (isCommon) {
      stack.set(srcValue, newValue);
      mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
      stack["delete"](srcValue);
    }
    assignMergeValue_default(object3, key, newValue);
  }
  var baseMergeDeep_default;
  var init_baseMergeDeep = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMergeDeep.js"() {
      "use strict";
      init_assignMergeValue();
      init_cloneBuffer();
      init_cloneTypedArray();
      init_copyArray();
      init_initCloneObject();
      init_isArguments();
      init_isArray();
      init_isArrayLikeObject();
      init_isBuffer();
      init_isFunction();
      init_isObject();
      init_isPlainObject();
      init_isTypedArray();
      init_safeGet();
      init_toPlainObject();
      __name(baseMergeDeep, "baseMergeDeep");
      baseMergeDeep_default = baseMergeDeep;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMerge.js
  function baseMerge(object3, source, srcIndex, customizer, stack) {
    if (object3 === source) {
      return;
    }
    baseFor_default(source, function(srcValue, key) {
      stack || (stack = new Stack_default());
      if (isObject_default(srcValue)) {
        baseMergeDeep_default(object3, source, key, srcIndex, baseMerge, customizer, stack);
      } else {
        var newValue = customizer ? customizer(safeGet_default(object3, key), srcValue, key + "", object3, source, stack) : void 0;
        if (newValue === void 0) {
          newValue = srcValue;
        }
        assignMergeValue_default(object3, key, newValue);
      }
    }, keysIn_default);
  }
  var baseMerge_default;
  var init_baseMerge = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMerge.js"() {
      "use strict";
      init_Stack();
      init_assignMergeValue();
      init_baseFor();
      init_baseMergeDeep();
      init_isObject();
      init_keysIn();
      init_safeGet();
      __name(baseMerge, "baseMerge");
      baseMerge_default = baseMerge;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/identity.js
  function identity4(value2) {
    return value2;
  }
  var identity_default4;
  var init_identity4 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/identity.js"() {
      "use strict";
      __name(identity4, "identity");
      identity_default4 = identity4;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_apply.js
  function apply2(func, thisArg, args) {
    switch (args.length) {
      case 0:
        return func.call(thisArg);
      case 1:
        return func.call(thisArg, args[0]);
      case 2:
        return func.call(thisArg, args[0], args[1]);
      case 3:
        return func.call(thisArg, args[0], args[1], args[2]);
    }
    return func.apply(thisArg, args);
  }
  var apply_default;
  var init_apply = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_apply.js"() {
      "use strict";
      __name(apply2, "apply");
      apply_default = apply2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js
  function overRest(func, start3, transform8) {
    start3 = nativeMax(start3 === void 0 ? func.length - 1 : start3, 0);
    return function() {
      var args = arguments, index = -1, length2 = nativeMax(args.length - start3, 0), array4 = Array(length2);
      while (++index < length2) {
        array4[index] = args[start3 + index];
      }
      index = -1;
      var otherArgs = Array(start3 + 1);
      while (++index < start3) {
        otherArgs[index] = args[index];
      }
      otherArgs[start3] = transform8(array4);
      return apply_default(func, this, otherArgs);
    };
  }
  var nativeMax, overRest_default;
  var init_overRest = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js"() {
      "use strict";
      init_apply();
      nativeMax = Math.max;
      __name(overRest, "overRest");
      overRest_default = overRest;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/constant.js
  function constant(value2) {
    return function() {
      return value2;
    };
  }
  var constant_default7;
  var init_constant8 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/constant.js"() {
      "use strict";
      __name(constant, "constant");
      constant_default7 = constant;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js
  var baseSetToString, baseSetToString_default;
  var init_baseSetToString = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js"() {
      "use strict";
      init_constant8();
      init_defineProperty();
      init_identity4();
      baseSetToString = !defineProperty_default ? identity_default4 : function(func, string3) {
        return defineProperty_default(func, "toString", {
          "configurable": true,
          "enumerable": false,
          "value": constant_default7(string3),
          "writable": true
        });
      };
      baseSetToString_default = baseSetToString;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js
  function shortOut(func) {
    var count2 = 0, lastCalled = 0;
    return function() {
      var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
      lastCalled = stamp;
      if (remaining > 0) {
        if (++count2 >= HOT_COUNT) {
          return arguments[0];
        }
      } else {
        count2 = 0;
      }
      return func.apply(void 0, arguments);
    };
  }
  var HOT_COUNT, HOT_SPAN, nativeNow, shortOut_default;
  var init_shortOut = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js"() {
      "use strict";
      HOT_COUNT = 800;
      HOT_SPAN = 16;
      nativeNow = Date.now;
      __name(shortOut, "shortOut");
      shortOut_default = shortOut;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js
  var setToString, setToString_default;
  var init_setToString = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js"() {
      "use strict";
      init_baseSetToString();
      init_shortOut();
      setToString = shortOut_default(baseSetToString_default);
      setToString_default = setToString;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js
  function baseRest(func, start3) {
    return setToString_default(overRest_default(func, start3, identity_default4), func + "");
  }
  var baseRest_default;
  var init_baseRest = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js"() {
      "use strict";
      init_identity4();
      init_overRest();
      init_setToString();
      __name(baseRest, "baseRest");
      baseRest_default = baseRest;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js
  function isIterateeCall(value2, index, object3) {
    if (!isObject_default(object3)) {
      return false;
    }
    var type3 = typeof index;
    if (type3 == "number" ? isArrayLike_default(object3) && isIndex_default(index, object3.length) : type3 == "string" && index in object3) {
      return eq_default(object3[index], value2);
    }
    return false;
  }
  var isIterateeCall_default;
  var init_isIterateeCall = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js"() {
      "use strict";
      init_eq();
      init_isArrayLike();
      init_isIndex();
      init_isObject();
      __name(isIterateeCall, "isIterateeCall");
      isIterateeCall_default = isIterateeCall;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createAssigner.js
  function createAssigner(assigner) {
    return baseRest_default(function(object3, sources) {
      var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : void 0, guard = length2 > 2 ? sources[2] : void 0;
      customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : void 0;
      if (guard && isIterateeCall_default(sources[0], sources[1], guard)) {
        customizer = length2 < 3 ? void 0 : customizer;
        length2 = 1;
      }
      object3 = Object(object3);
      while (++index < length2) {
        var source = sources[index];
        if (source) {
          assigner(object3, source, index, customizer);
        }
      }
      return object3;
    });
  }
  var createAssigner_default;
  var init_createAssigner = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createAssigner.js"() {
      "use strict";
      init_baseRest();
      init_isIterateeCall();
      __name(createAssigner, "createAssigner");
      createAssigner_default = createAssigner;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/merge.js
  var merge, merge_default3;
  var init_merge4 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/merge.js"() {
      "use strict";
      init_baseMerge();
      init_createAssigner();
      merge = createAssigner_default(function(object3, source, srcIndex) {
        baseMerge_default(object3, source, srcIndex);
      });
      merge_default3 = merge;
    }
  });

  // src/utils.ts
  function interpolateToCurve(interpolate, defaultCurve) {
    if (!interpolate) {
      return defaultCurve;
    }
    const curveName = `curve${interpolate.charAt(0).toUpperCase() + interpolate.slice(1)}`;
    return d3CurveTypes[curveName] ?? defaultCurve;
  }
  function formatUrl(linkStr, config5) {
    const url = linkStr.trim();
    if (!url) {
      return void 0;
    }
    if (config5.securityLevel !== "loose") {
      return (0, import_sanitize_url3.sanitizeUrl)(url);
    }
    return url;
  }
  function distance(p1, p22) {
    if (!p1 || !p22) {
      return 0;
    }
    return Math.sqrt(Math.pow(p22.x - p1.x, 2) + Math.pow(p22.y - p1.y, 2));
  }
  function traverseEdge(points) {
    let prevPoint;
    let totalDistance = 0;
    points.forEach((point8) => {
      totalDistance += distance(point8, prevPoint);
      prevPoint = point8;
    });
    const remainingDistance = totalDistance / 2;
    return calculatePoint(points, remainingDistance);
  }
  function calcLabelPosition(points) {
    if (points.length === 1) {
      return points[0];
    }
    return traverseEdge(points);
  }
  function calcTerminalLabelPosition(terminalMarkerSize, position5, _points) {
    const points = structuredClone(_points);
    log.info("our points", points);
    if (position5 !== "start_left" && position5 !== "start_right") {
      points.reverse();
    }
    const distanceToCardinalityPoint = 25 + terminalMarkerSize;
    const center4 = calculatePoint(points, distanceToCardinalityPoint);
    const d3 = 10 + terminalMarkerSize * 0.5;
    const angle2 = Math.atan2(points[0].y - center4.y, points[0].x - center4.x);
    const cardinalityPosition = { x: 0, y: 0 };
    if (position5 === "start_left") {
      cardinalityPosition.x = Math.sin(angle2 + Math.PI) * d3 + (points[0].x + center4.x) / 2;
      cardinalityPosition.y = -Math.cos(angle2 + Math.PI) * d3 + (points[0].y + center4.y) / 2;
    } else if (position5 === "end_right") {
      cardinalityPosition.x = Math.sin(angle2 - Math.PI) * d3 + (points[0].x + center4.x) / 2 - 5;
      cardinalityPosition.y = -Math.cos(angle2 - Math.PI) * d3 + (points[0].y + center4.y) / 2 - 5;
    } else if (position5 === "end_left") {
      cardinalityPosition.x = Math.sin(angle2) * d3 + (points[0].x + center4.x) / 2 - 5;
      cardinalityPosition.y = -Math.cos(angle2) * d3 + (points[0].y + center4.y) / 2 - 5;
    } else {
      cardinalityPosition.x = Math.sin(angle2) * d3 + (points[0].x + center4.x) / 2;
      cardinalityPosition.y = -Math.cos(angle2) * d3 + (points[0].y + center4.y) / 2;
    }
    return cardinalityPosition;
  }
  function getStylesFromArray(arr) {
    let style3 = "";
    let labelStyle = "";
    for (const element3 of arr) {
      if (element3 !== void 0) {
        if (element3.startsWith("color:") || element3.startsWith("text-align:")) {
          labelStyle = labelStyle + element3 + ";";
        } else {
          style3 = style3 + element3 + ";";
        }
      }
    }
    return { style: style3, labelStyle };
  }
  function makeRandomHex(length2) {
    let result = "";
    const characters2 = "0123456789abcdef";
    const charactersLength = characters2.length;
    for (let i2 = 0; i2 < length2; i2++) {
      result += characters2.charAt(Math.floor(Math.random() * charactersLength));
    }
    return result;
  }
  function calculateTextHeight(text4, config5) {
    return calculateTextDimensions(text4, config5).height;
  }
  function calculateTextWidth(text4, config5) {
    return calculateTextDimensions(text4, config5).width;
  }
  function isDetailedError(error3) {
    return "str" in error3;
  }
  function cleanAndMerge(defaultData, data5) {
    return merge_default3({}, defaultData, data5);
  }
  function handleUndefinedAttr(attrValue) {
    return attrValue ?? null;
  }
  function isLabelCoordinateInPath(point8, dAttr) {
    const roundedX = Math.round(point8.x);
    const roundedY = Math.round(point8.y);
    const sanitizedD = dAttr.replace(
      /(\d+\.\d+)/g,
      (match2) => Math.round(parseFloat(match2)).toString()
    );
    return sanitizedD.includes(roundedX.toString()) || sanitizedD.includes(roundedY.toString());
  }
  var import_sanitize_url3, ZERO_WIDTH_SPACE, d3CurveTypes, directiveWithoutOpen, detectInit, detectDirective, removeDirectives, isSubstringInArray, runFunc, roundNumber, calculatePoint, calcCardinalityPosition, cnt, generateId, random, getTextObj2, drawSimpleText, wrapLabel, breakString, calculateTextDimensions, InitIDGenerator, decoder, entityDecode, insertTitle, parseFontSize, utils_default2, encodeEntities, decodeEntities, getEdgeId;
  var init_utils2 = __esm({
    "src/utils.ts"() {
      "use strict";
      import_sanitize_url3 = __toESM(require_dist(), 1);
      init_src32();
      init_common();
      init_sanitizeDirective();
      init_logger();
      init_detectType();
      init_assignWithDepth();
      init_memoize();
      init_merge4();
      init_regexes();
      ZERO_WIDTH_SPACE = "\u200B";
      d3CurveTypes = {
        curveBasis: basis_default2,
        curveBasisClosed: basisClosed_default2,
        curveBasisOpen: basisOpen_default,
        curveBumpX: bumpX,
        curveBumpY: bumpY,
        curveBundle: bundle_default,
        curveCardinalClosed: cardinalClosed_default,
        curveCardinalOpen: cardinalOpen_default,
        curveCardinal: cardinal_default,
        curveCatmullRomClosed: catmullRomClosed_default,
        curveCatmullRomOpen: catmullRomOpen_default,
        curveCatmullRom: catmullRom_default,
        curveLinear: linear_default,
        curveLinearClosed: linearClosed_default,
        curveMonotoneX: monotoneX,
        curveMonotoneY: monotoneY,
        curveNatural: natural_default,
        curveStep: step_default,
        curveStepAfter: stepAfter,
        curveStepBefore: stepBefore
      };
      directiveWithoutOpen = /\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
      detectInit = /* @__PURE__ */ __name(function(text4, config5) {
        const inits = detectDirective(text4, /(?:init\b)|(?:initialize\b)/);
        let results = {};
        if (Array.isArray(inits)) {
          const args = inits.map((init3) => init3.args);
          sanitizeDirective(args);
          results = assignWithDepth_default(results, [...args]);
        } else {
          results = inits.args;
        }
        if (!results) {
          return;
        }
        let type3 = detectType(text4, config5);
        const prop = "config";
        if (results[prop] !== void 0) {
          if (type3 === "flowchart-v2") {
            type3 = "flowchart";
          }
          results[type3] = results[prop];
          delete results[prop];
        }
        return results;
      }, "detectInit");
      detectDirective = /* @__PURE__ */ __name(function(text4, type3 = null) {
        try {
          const commentWithoutDirectives = new RegExp(
            `[%]{2}(?![{]${directiveWithoutOpen.source})(?=[}][%]{2}).*
`,
            "ig"
          );
          text4 = text4.trim().replace(commentWithoutDirectives, "").replace(/'/gm, '"');
          log.debug(
            `Detecting diagram directive${type3 !== null ? " type:" + type3 : ""} based on the text:${text4}`
          );
          let match2;
          const result = [];
          while ((match2 = directiveRegex.exec(text4)) !== null) {
            if (match2.index === directiveRegex.lastIndex) {
              directiveRegex.lastIndex++;
            }
            if (match2 && !type3 || type3 && match2[1]?.match(type3) || type3 && match2[2]?.match(type3)) {
              const type4 = match2[1] ? match2[1] : match2[2];
              const args = match2[3] ? match2[3].trim() : match2[4] ? JSON.parse(match2[4].trim()) : null;
              result.push({ type: type4, args });
            }
          }
          if (result.length === 0) {
            return { type: text4, args: null };
          }
          return result.length === 1 ? result[0] : result;
        } catch (error3) {
          log.error(
            `ERROR: ${error3.message} - Unable to parse directive type: '${type3}' based on the text: '${text4}'`
          );
          return { type: void 0, args: null };
        }
      }, "detectDirective");
      removeDirectives = /* @__PURE__ */ __name(function(text4) {
        return text4.replace(directiveRegex, "");
      }, "removeDirectives");
      isSubstringInArray = /* @__PURE__ */ __name(function(str2, arr) {
        for (const [i2, element3] of arr.entries()) {
          if (element3.match(str2)) {
            return i2;
          }
        }
        return -1;
      }, "isSubstringInArray");
      __name(interpolateToCurve, "interpolateToCurve");
      __name(formatUrl, "formatUrl");
      runFunc = /* @__PURE__ */ __name((functionName, ...params) => {
        const arrPaths = functionName.split(".");
        const len = arrPaths.length - 1;
        const fnName = arrPaths[len];
        let obj = window;
        for (let i2 = 0; i2 < len; i2++) {
          obj = obj[arrPaths[i2]];
          if (!obj) {
            log.error(`Function name: ${functionName} not found in window`);
            return;
          }
        }
        obj[fnName](...params);
      }, "runFunc");
      __name(distance, "distance");
      __name(traverseEdge, "traverseEdge");
      __name(calcLabelPosition, "calcLabelPosition");
      roundNumber = /* @__PURE__ */ __name((num, precision = 2) => {
        const factor = Math.pow(10, precision);
        return Math.round(num * factor) / factor;
      }, "roundNumber");
      calculatePoint = /* @__PURE__ */ __name((points, distanceToTraverse) => {
        let prevPoint = void 0;
        let remainingDistance = distanceToTraverse;
        for (const point8 of points) {
          if (prevPoint) {
            const vectorDistance = distance(point8, prevPoint);
            if (vectorDistance === 0) {
              return prevPoint;
            }
            if (vectorDistance < remainingDistance) {
              remainingDistance -= vectorDistance;
            } else {
              const distanceRatio = remainingDistance / vectorDistance;
              if (distanceRatio <= 0) {
                return prevPoint;
              }
              if (distanceRatio >= 1) {
                return { x: point8.x, y: point8.y };
              }
              if (distanceRatio > 0 && distanceRatio < 1) {
                return {
                  x: roundNumber((1 - distanceRatio) * prevPoint.x + distanceRatio * point8.x, 5),
                  y: roundNumber((1 - distanceRatio) * prevPoint.y + distanceRatio * point8.y, 5)
                };
              }
            }
          }
          prevPoint = point8;
        }
        throw new Error("Could not find a suitable point for the given distance");
      }, "calculatePoint");
      calcCardinalityPosition = /* @__PURE__ */ __name((isRelationTypePresent, points, initialPosition) => {
        log.info(`our points ${JSON.stringify(points)}`);
        if (points[0] !== initialPosition) {
          points = points.reverse();
        }
        const distanceToCardinalityPoint = 25;
        const center4 = calculatePoint(points, distanceToCardinalityPoint);
        const d3 = isRelationTypePresent ? 10 : 5;
        const angle2 = Math.atan2(points[0].y - center4.y, points[0].x - center4.x);
        const cardinalityPosition = { x: 0, y: 0 };
        cardinalityPosition.x = Math.sin(angle2) * d3 + (points[0].x + center4.x) / 2;
        cardinalityPosition.y = -Math.cos(angle2) * d3 + (points[0].y + center4.y) / 2;
        return cardinalityPosition;
      }, "calcCardinalityPosition");
      __name(calcTerminalLabelPosition, "calcTerminalLabelPosition");
      __name(getStylesFromArray, "getStylesFromArray");
      cnt = 0;
      generateId = /* @__PURE__ */ __name(() => {
        cnt++;
        return "id-" + Math.random().toString(36).substr(2, 12) + "-" + cnt;
      }, "generateId");
      __name(makeRandomHex, "makeRandomHex");
      random = /* @__PURE__ */ __name((options2) => {
        return makeRandomHex(options2.length);
      }, "random");
      getTextObj2 = /* @__PURE__ */ __name(function() {
        return {
          x: 0,
          y: 0,
          fill: void 0,
          anchor: "start",
          style: "#666",
          width: 100,
          height: 100,
          textMargin: 0,
          rx: 0,
          ry: 0,
          valign: void 0,
          text: ""
        };
      }, "getTextObj");
      drawSimpleText = /* @__PURE__ */ __name(function(elem, textData) {
        const nText = textData.text.replace(common_default.lineBreakRegex, " ");
        const [, _fontSizePx] = parseFontSize(textData.fontSize);
        const textElem = elem.append("text");
        textElem.attr("x", textData.x);
        textElem.attr("y", textData.y);
        textElem.style("text-anchor", textData.anchor);
        textElem.style("font-family", textData.fontFamily);
        textElem.style("font-size", _fontSizePx);
        textElem.style("font-weight", textData.fontWeight);
        textElem.attr("fill", textData.fill);
        if (textData.class !== void 0) {
          textElem.attr("class", textData.class);
        }
        const span = textElem.append("tspan");
        span.attr("x", textData.x + textData.textMargin * 2);
        span.attr("fill", textData.fill);
        span.text(nText);
        return textElem;
      }, "drawSimpleText");
      wrapLabel = memoize_default(
        (label, maxWidth2, config5) => {
          if (!label) {
            return label;
          }
          config5 = Object.assign(
            { fontSize: 12, fontWeight: 400, fontFamily: "Arial", joinWith: "<br/>" },
            config5
          );
          if (common_default.lineBreakRegex.test(label)) {
            return label;
          }
          const words = label.split(" ").filter(Boolean);
          const completedLines = [];
          let nextLine = "";
          words.forEach((word, index) => {
            const wordLength = calculateTextWidth(`${word} `, config5);
            const nextLineLength = calculateTextWidth(nextLine, config5);
            if (wordLength > maxWidth2) {
              const { hyphenatedStrings, remainingWord } = breakString(word, maxWidth2, "-", config5);
              completedLines.push(nextLine, ...hyphenatedStrings);
              nextLine = remainingWord;
            } else if (nextLineLength + wordLength >= maxWidth2) {
              completedLines.push(nextLine);
              nextLine = word;
            } else {
              nextLine = [nextLine, word].filter(Boolean).join(" ");
            }
            const currentWord = index + 1;
            const isLastWord = currentWord === words.length;
            if (isLastWord) {
              completedLines.push(nextLine);
            }
          });
          return completedLines.filter((line2) => line2 !== "").join(config5.joinWith);
        },
        (label, maxWidth2, config5) => `${label}${maxWidth2}${config5.fontSize}${config5.fontWeight}${config5.fontFamily}${config5.joinWith}`
      );
      breakString = memoize_default(
        (word, maxWidth2, hyphenCharacter = "-", config5) => {
          config5 = Object.assign(
            { fontSize: 12, fontWeight: 400, fontFamily: "Arial", margin: 0 },
            config5
          );
          const characters2 = [...word];
          const lines = [];
          let currentLine = "";
          characters2.forEach((character2, index) => {
            const nextLine = `${currentLine}${character2}`;
            const lineWidth = calculateTextWidth(nextLine, config5);
            if (lineWidth >= maxWidth2) {
              const currentCharacter = index + 1;
              const isLastLine = characters2.length === currentCharacter;
              const hyphenatedNextLine = `${nextLine}${hyphenCharacter}`;
              lines.push(isLastLine ? nextLine : hyphenatedNextLine);
              currentLine = "";
            } else {
              currentLine = nextLine;
            }
          });
          return { hyphenatedStrings: lines, remainingWord: currentLine };
        },
        (word, maxWidth2, hyphenCharacter = "-", config5) => `${word}${maxWidth2}${hyphenCharacter}${config5.fontSize}${config5.fontWeight}${config5.fontFamily}`
      );
      __name(calculateTextHeight, "calculateTextHeight");
      __name(calculateTextWidth, "calculateTextWidth");
      calculateTextDimensions = memoize_default(
        (text4, config5) => {
          const { fontSize = 12, fontFamily = "Arial", fontWeight = 400 } = config5;
          if (!text4) {
            return { width: 0, height: 0 };
          }
          const [, _fontSizePx] = parseFontSize(fontSize);
          const fontFamilies = ["sans-serif", fontFamily];
          const lines = text4.split(common_default.lineBreakRegex);
          const dims = [];
          const body = select_default2("body");
          if (!body.remove) {
            return { width: 0, height: 0, lineHeight: 0 };
          }
          const g2 = body.append("svg");
          for (const fontFamily2 of fontFamilies) {
            let cHeight = 0;
            const dim = { width: 0, height: 0, lineHeight: 0 };
            for (const line2 of lines) {
              const textObj = getTextObj2();
              textObj.text = line2 || ZERO_WIDTH_SPACE;
              const textElem = drawSimpleText(g2, textObj).style("font-size", _fontSizePx).style("font-weight", fontWeight).style("font-family", fontFamily2);
              const bBox = (textElem._groups || textElem)[0][0].getBBox();
              if (bBox.width === 0 && bBox.height === 0) {
                throw new Error("svg element not in render tree");
              }
              dim.width = Math.round(Math.max(dim.width, bBox.width));
              cHeight = Math.round(bBox.height);
              dim.height += cHeight;
              dim.lineHeight = Math.round(Math.max(dim.lineHeight, cHeight));
            }
            dims.push(dim);
          }
          g2.remove();
          const index = isNaN(dims[1].height) || isNaN(dims[1].width) || isNaN(dims[1].lineHeight) || dims[0].height > dims[1].height && dims[0].width > dims[1].width && dims[0].lineHeight > dims[1].lineHeight ? 0 : 1;
          return dims[index];
        },
        (text4, config5) => `${text4}${config5.fontSize}${config5.fontWeight}${config5.fontFamily}`
      );
      InitIDGenerator = class {
        constructor(deterministic = false, seed) {
          this.count = 0;
          this.count = seed ? seed.length : 0;
          this.next = deterministic ? () => this.count++ : () => Date.now();
        }
        static {
          __name(this, "InitIDGenerator");
        }
      };
      entityDecode = /* @__PURE__ */ __name(function(html2) {
        decoder = decoder || document.createElement("div");
        html2 = escape(html2).replace(/%26/g, "&").replace(/%23/g, "#").replace(/%3B/g, ";");
        decoder.innerHTML = html2;
        return unescape(decoder.textContent);
      }, "entityDecode");
      __name(isDetailedError, "isDetailedError");
      insertTitle = /* @__PURE__ */ __name((parent4, cssClass, titleTopMargin, title2) => {
        if (!title2) {
          return;
        }
        const bounds4 = parent4.node()?.getBBox();
        if (!bounds4) {
          return;
        }
        parent4.append("text").text(title2).attr("text-anchor", "middle").attr("x", bounds4.x + bounds4.width / 2).attr("y", -titleTopMargin).attr("class", cssClass);
      }, "insertTitle");
      parseFontSize = /* @__PURE__ */ __name((fontSize) => {
        if (typeof fontSize === "number") {
          return [fontSize, fontSize + "px"];
        }
        const fontSizeNumber = parseInt(fontSize ?? "", 10);
        if (Number.isNaN(fontSizeNumber)) {
          return [void 0, void 0];
        } else if (fontSize === String(fontSizeNumber)) {
          return [fontSizeNumber, fontSize + "px"];
        } else {
          return [fontSizeNumber, fontSize];
        }
      }, "parseFontSize");
      __name(cleanAndMerge, "cleanAndMerge");
      utils_default2 = {
        assignWithDepth: assignWithDepth_default,
        wrapLabel,
        calculateTextHeight,
        calculateTextWidth,
        calculateTextDimensions,
        cleanAndMerge,
        detectInit,
        detectDirective,
        isSubstringInArray,
        interpolateToCurve,
        calcLabelPosition,
        calcCardinalityPosition,
        calcTerminalLabelPosition,
        formatUrl,
        getStylesFromArray,
        generateId,
        random,
        runFunc,
        entityDecode,
        insertTitle,
        isLabelCoordinateInPath,
        parseFontSize,
        InitIDGenerator
      };
      encodeEntities = /* @__PURE__ */ __name(function(text4) {
        let txt = text4;
        txt = txt.replace(/style.*:\S*#.*;/g, function(s2) {
          return s2.substring(0, s2.length - 1);
        });
        txt = txt.replace(/classDef.*:\S*#.*;/g, function(s2) {
          return s2.substring(0, s2.length - 1);
        });
        txt = txt.replace(/#\w+;/g, function(s2) {
          const innerTxt = s2.substring(1, s2.length - 1);
          const isInt = /^\+?\d+$/.test(innerTxt);
          if (isInt) {
            return "\uFB02\xB0\xB0" + innerTxt + "\xB6\xDF";
          } else {
            return "\uFB02\xB0" + innerTxt + "\xB6\xDF";
          }
        });
        return txt;
      }, "encodeEntities");
      decodeEntities = /* @__PURE__ */ __name(function(text4) {
        return text4.replace(/ﬂ°°/g, "&#").replace(/ﬂ°/g, "&").replace(/¶ß/g, ";");
      }, "decodeEntities");
      getEdgeId = /* @__PURE__ */ __name((from2, to, {
        counter: counter2 = 0,
        prefix,
        suffix
      }, id34) => {
        if (id34) {
          return id34;
        }
        return `${prefix ? `${prefix}_` : ""}${from2}_${to}_${counter2}${suffix ? `_${suffix}` : ""}`;
      }, "getEdgeId");
      __name(handleUndefinedAttr, "handleUndefinedAttr");
      __name(isLabelCoordinateInPath, "isLabelCoordinateInPath");
    }
  });

  // src/diagrams/c4/c4Renderer.js
  function calcC4ShapeTextWH(textType, c4Shape, c4ShapeTextWrap, textConf, textLimitWidth) {
    if (!c4Shape[textType].width) {
      if (c4ShapeTextWrap) {
        c4Shape[textType].text = wrapLabel(c4Shape[textType].text, textLimitWidth, textConf);
        c4Shape[textType].textLines = c4Shape[textType].text.split(common_default.lineBreakRegex).length;
        c4Shape[textType].width = textLimitWidth;
        c4Shape[textType].height = calculateTextHeight(c4Shape[textType].text, textConf);
      } else {
        let lines = c4Shape[textType].text.split(common_default.lineBreakRegex);
        c4Shape[textType].textLines = lines.length;
        let lineHeight = 0;
        c4Shape[textType].height = 0;
        c4Shape[textType].width = 0;
        for (const line2 of lines) {
          c4Shape[textType].width = Math.max(
            calculateTextWidth(line2, textConf),
            c4Shape[textType].width
          );
          lineHeight = calculateTextHeight(line2, textConf);
          c4Shape[textType].height = c4Shape[textType].height + lineHeight;
        }
      }
    }
  }
  function drawInsideBoundary(diagram31, parentBoundaryAlias, parentBounds, currentBoundaries, diagObj) {
    let currentBounds = new Bounds(diagObj);
    currentBounds.data.widthLimit = parentBounds.data.widthLimit / Math.min(c4BoundaryInRow2, currentBoundaries.length);
    for (let [i2, currentBoundary] of currentBoundaries.entries()) {
      let Y3 = 0;
      currentBoundary.image = { width: 0, height: 0, Y: 0 };
      if (currentBoundary.sprite) {
        currentBoundary.image.width = 48;
        currentBoundary.image.height = 48;
        currentBoundary.image.Y = Y3;
        Y3 = currentBoundary.image.Y + currentBoundary.image.height;
      }
      let currentBoundaryTextWrap = currentBoundary.wrap && conf.wrap;
      let currentBoundaryLabelConf = boundaryFont(conf);
      currentBoundaryLabelConf.fontSize = currentBoundaryLabelConf.fontSize + 2;
      currentBoundaryLabelConf.fontWeight = "bold";
      calcC4ShapeTextWH(
        "label",
        currentBoundary,
        currentBoundaryTextWrap,
        currentBoundaryLabelConf,
        currentBounds.data.widthLimit
      );
      currentBoundary.label.Y = Y3 + 8;
      Y3 = currentBoundary.label.Y + currentBoundary.label.height;
      if (currentBoundary.type && currentBoundary.type.text !== "") {
        currentBoundary.type.text = "[" + currentBoundary.type.text + "]";
        let currentBoundaryTypeConf = boundaryFont(conf);
        calcC4ShapeTextWH(
          "type",
          currentBoundary,
          currentBoundaryTextWrap,
          currentBoundaryTypeConf,
          currentBounds.data.widthLimit
        );
        currentBoundary.type.Y = Y3 + 5;
        Y3 = currentBoundary.type.Y + currentBoundary.type.height;
      }
      if (currentBoundary.descr && currentBoundary.descr.text !== "") {
        let currentBoundaryDescrConf = boundaryFont(conf);
        currentBoundaryDescrConf.fontSize = currentBoundaryDescrConf.fontSize - 2;
        calcC4ShapeTextWH(
          "descr",
          currentBoundary,
          currentBoundaryTextWrap,
          currentBoundaryDescrConf,
          currentBounds.data.widthLimit
        );
        currentBoundary.descr.Y = Y3 + 20;
        Y3 = currentBoundary.descr.Y + currentBoundary.descr.height;
      }
      if (i2 == 0 || i2 % c4BoundaryInRow2 === 0) {
        let _x = parentBounds.data.startx + conf.diagramMarginX;
        let _y = parentBounds.data.stopy + conf.diagramMarginY + Y3;
        currentBounds.setData(_x, _x, _y, _y);
      } else {
        let _x = currentBounds.data.stopx !== currentBounds.data.startx ? currentBounds.data.stopx + conf.diagramMarginX : currentBounds.data.startx;
        let _y = currentBounds.data.starty;
        currentBounds.setData(_x, _x, _y, _y);
      }
      currentBounds.name = currentBoundary.alias;
      let currentPersonOrSystemArray = diagObj.db.getC4ShapeArray(currentBoundary.alias);
      let currentPersonOrSystemKeys = diagObj.db.getC4ShapeKeys(currentBoundary.alias);
      if (currentPersonOrSystemKeys.length > 0) {
        drawC4ShapeArray(
          currentBounds,
          diagram31,
          currentPersonOrSystemArray,
          currentPersonOrSystemKeys
        );
      }
      parentBoundaryAlias = currentBoundary.alias;
      let nextCurrentBoundaries = diagObj.db.getBoundaries(parentBoundaryAlias);
      if (nextCurrentBoundaries.length > 0) {
        drawInsideBoundary(
          diagram31,
          parentBoundaryAlias,
          currentBounds,
          nextCurrentBoundaries,
          diagObj
        );
      }
      if (currentBoundary.alias !== "global") {
        drawBoundary2(diagram31, currentBoundary, currentBounds);
      }
      parentBounds.data.stopy = Math.max(
        currentBounds.data.stopy + conf.c4ShapeMargin,
        parentBounds.data.stopy
      );
      parentBounds.data.stopx = Math.max(
        currentBounds.data.stopx + conf.c4ShapeMargin,
        parentBounds.data.stopx
      );
      globalBoundaryMaxX = Math.max(globalBoundaryMaxX, parentBounds.data.stopx);
      globalBoundaryMaxY = Math.max(globalBoundaryMaxY, parentBounds.data.stopy);
    }
  }
  var globalBoundaryMaxX, globalBoundaryMaxY, c4ShapeInRow2, c4BoundaryInRow2, conf, Bounds, setConf, c4ShapeFont, boundaryFont, messageFont, drawBoundary2, drawC4ShapeArray, Point2, getIntersectPoint, getIntersectPoints, drawRels2, draw, c4Renderer_default;
  var init_c4Renderer = __esm({
    "src/diagrams/c4/c4Renderer.js"() {
      "use strict";
      init_src32();
      init_svgDraw();
      init_logger();
      init_c4Diagram();
      init_common();
      init_c4Db();
      init_diagramAPI();
      init_assignWithDepth();
      init_utils2();
      init_setupGraphViewbox();
      globalBoundaryMaxX = 0;
      globalBoundaryMaxY = 0;
      c4ShapeInRow2 = 4;
      c4BoundaryInRow2 = 2;
      parser.yy = c4Db_default;
      conf = {};
      Bounds = class {
        static {
          __name(this, "Bounds");
        }
        constructor(diagObj) {
          this.name = "";
          this.data = {};
          this.data.startx = void 0;
          this.data.stopx = void 0;
          this.data.starty = void 0;
          this.data.stopy = void 0;
          this.data.widthLimit = void 0;
          this.nextData = {};
          this.nextData.startx = void 0;
          this.nextData.stopx = void 0;
          this.nextData.starty = void 0;
          this.nextData.stopy = void 0;
          this.nextData.cnt = 0;
          setConf(diagObj.db.getConfig());
        }
        setData(startx, stopx, starty, stopy) {
          this.nextData.startx = this.data.startx = startx;
          this.nextData.stopx = this.data.stopx = stopx;
          this.nextData.starty = this.data.starty = starty;
          this.nextData.stopy = this.data.stopy = stopy;
        }
        updateVal(obj, key, val, fun) {
          if (obj[key] === void 0) {
            obj[key] = val;
          } else {
            obj[key] = fun(val, obj[key]);
          }
        }
        insert(c4Shape) {
          this.nextData.cnt = this.nextData.cnt + 1;
          let _startx = this.nextData.startx === this.nextData.stopx ? this.nextData.stopx + c4Shape.margin : this.nextData.stopx + c4Shape.margin * 2;
          let _stopx = _startx + c4Shape.width;
          let _starty = this.nextData.starty + c4Shape.margin * 2;
          let _stopy = _starty + c4Shape.height;
          if (_startx >= this.data.widthLimit || _stopx >= this.data.widthLimit || this.nextData.cnt > c4ShapeInRow2) {
            _startx = this.nextData.startx + c4Shape.margin + conf.nextLinePaddingX;
            _starty = this.nextData.stopy + c4Shape.margin * 2;
            this.nextData.stopx = _stopx = _startx + c4Shape.width;
            this.nextData.starty = this.nextData.stopy;
            this.nextData.stopy = _stopy = _starty + c4Shape.height;
            this.nextData.cnt = 1;
          }
          c4Shape.x = _startx;
          c4Shape.y = _starty;
          this.updateVal(this.data, "startx", _startx, Math.min);
          this.updateVal(this.data, "starty", _starty, Math.min);
          this.updateVal(this.data, "stopx", _stopx, Math.max);
          this.updateVal(this.data, "stopy", _stopy, Math.max);
          this.updateVal(this.nextData, "startx", _startx, Math.min);
          this.updateVal(this.nextData, "starty", _starty, Math.min);
          this.updateVal(this.nextData, "stopx", _stopx, Math.max);
          this.updateVal(this.nextData, "stopy", _stopy, Math.max);
        }
        init(diagObj) {
          this.name = "";
          this.data = {
            startx: void 0,
            stopx: void 0,
            starty: void 0,
            stopy: void 0,
            widthLimit: void 0
          };
          this.nextData = {
            startx: void 0,
            stopx: void 0,
            starty: void 0,
            stopy: void 0,
            cnt: 0
          };
          setConf(diagObj.db.getConfig());
        }
        bumpLastMargin(margin) {
          this.data.stopx += margin;
          this.data.stopy += margin;
        }
      };
      setConf = /* @__PURE__ */ __name(function(cnf) {
        assignWithDepth_default(conf, cnf);
        if (cnf.fontFamily) {
          conf.personFontFamily = conf.systemFontFamily = conf.messageFontFamily = cnf.fontFamily;
        }
        if (cnf.fontSize) {
          conf.personFontSize = conf.systemFontSize = conf.messageFontSize = cnf.fontSize;
        }
        if (cnf.fontWeight) {
          conf.personFontWeight = conf.systemFontWeight = conf.messageFontWeight = cnf.fontWeight;
        }
      }, "setConf");
      c4ShapeFont = /* @__PURE__ */ __name((cnf, typeC4Shape) => {
        return {
          fontFamily: cnf[typeC4Shape + "FontFamily"],
          fontSize: cnf[typeC4Shape + "FontSize"],
          fontWeight: cnf[typeC4Shape + "FontWeight"]
        };
      }, "c4ShapeFont");
      boundaryFont = /* @__PURE__ */ __name((cnf) => {
        return {
          fontFamily: cnf.boundaryFontFamily,
          fontSize: cnf.boundaryFontSize,
          fontWeight: cnf.boundaryFontWeight
        };
      }, "boundaryFont");
      messageFont = /* @__PURE__ */ __name((cnf) => {
        return {
          fontFamily: cnf.messageFontFamily,
          fontSize: cnf.messageFontSize,
          fontWeight: cnf.messageFontWeight
        };
      }, "messageFont");
      __name(calcC4ShapeTextWH, "calcC4ShapeTextWH");
      drawBoundary2 = /* @__PURE__ */ __name(function(diagram31, boundary, bounds4) {
        boundary.x = bounds4.data.startx;
        boundary.y = bounds4.data.starty;
        boundary.width = bounds4.data.stopx - bounds4.data.startx;
        boundary.height = bounds4.data.stopy - bounds4.data.starty;
        boundary.label.y = conf.c4ShapeMargin - 35;
        let boundaryTextWrap = boundary.wrap && conf.wrap;
        let boundaryLabelConf = boundaryFont(conf);
        boundaryLabelConf.fontSize = boundaryLabelConf.fontSize + 2;
        boundaryLabelConf.fontWeight = "bold";
        let textLimitWidth = calculateTextWidth(boundary.label.text, boundaryLabelConf);
        calcC4ShapeTextWH("label", boundary, boundaryTextWrap, boundaryLabelConf, textLimitWidth);
        svgDraw_default.drawBoundary(diagram31, boundary, conf);
      }, "drawBoundary");
      drawC4ShapeArray = /* @__PURE__ */ __name(function(currentBounds, diagram31, c4ShapeArray2, c4ShapeKeys) {
        let Y3 = 0;
        for (const c4ShapeKey of c4ShapeKeys) {
          Y3 = 0;
          const c4Shape = c4ShapeArray2[c4ShapeKey];
          let c4ShapeTypeConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
          c4ShapeTypeConf.fontSize = c4ShapeTypeConf.fontSize - 2;
          c4Shape.typeC4Shape.width = calculateTextWidth(
            "\xAB" + c4Shape.typeC4Shape.text + "\xBB",
            c4ShapeTypeConf
          );
          c4Shape.typeC4Shape.height = c4ShapeTypeConf.fontSize + 2;
          c4Shape.typeC4Shape.Y = conf.c4ShapePadding;
          Y3 = c4Shape.typeC4Shape.Y + c4Shape.typeC4Shape.height - 4;
          c4Shape.image = { width: 0, height: 0, Y: 0 };
          switch (c4Shape.typeC4Shape.text) {
            case "person":
            case "external_person":
              c4Shape.image.width = 48;
              c4Shape.image.height = 48;
              c4Shape.image.Y = Y3;
              Y3 = c4Shape.image.Y + c4Shape.image.height;
              break;
          }
          if (c4Shape.sprite) {
            c4Shape.image.width = 48;
            c4Shape.image.height = 48;
            c4Shape.image.Y = Y3;
            Y3 = c4Shape.image.Y + c4Shape.image.height;
          }
          let c4ShapeTextWrap = c4Shape.wrap && conf.wrap;
          let textLimitWidth = conf.width - conf.c4ShapePadding * 2;
          let c4ShapeLabelConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
          c4ShapeLabelConf.fontSize = c4ShapeLabelConf.fontSize + 2;
          c4ShapeLabelConf.fontWeight = "bold";
          calcC4ShapeTextWH("label", c4Shape, c4ShapeTextWrap, c4ShapeLabelConf, textLimitWidth);
          c4Shape.label.Y = Y3 + 8;
          Y3 = c4Shape.label.Y + c4Shape.label.height;
          if (c4Shape.type && c4Shape.type.text !== "") {
            c4Shape.type.text = "[" + c4Shape.type.text + "]";
            let c4ShapeTypeConf2 = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
            calcC4ShapeTextWH("type", c4Shape, c4ShapeTextWrap, c4ShapeTypeConf2, textLimitWidth);
            c4Shape.type.Y = Y3 + 5;
            Y3 = c4Shape.type.Y + c4Shape.type.height;
          } else if (c4Shape.techn && c4Shape.techn.text !== "") {
            c4Shape.techn.text = "[" + c4Shape.techn.text + "]";
            let c4ShapeTechnConf = c4ShapeFont(conf, c4Shape.techn.text);
            calcC4ShapeTextWH("techn", c4Shape, c4ShapeTextWrap, c4ShapeTechnConf, textLimitWidth);
            c4Shape.techn.Y = Y3 + 5;
            Y3 = c4Shape.techn.Y + c4Shape.techn.height;
          }
          let rectHeight = Y3;
          let rectWidth = c4Shape.label.width;
          if (c4Shape.descr && c4Shape.descr.text !== "") {
            let c4ShapeDescrConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
            calcC4ShapeTextWH("descr", c4Shape, c4ShapeTextWrap, c4ShapeDescrConf, textLimitWidth);
            c4Shape.descr.Y = Y3 + 20;
            Y3 = c4Shape.descr.Y + c4Shape.descr.height;
            rectWidth = Math.max(c4Shape.label.width, c4Shape.descr.width);
            rectHeight = Y3 - c4Shape.descr.textLines * 5;
          }
          rectWidth = rectWidth + conf.c4ShapePadding;
          c4Shape.width = Math.max(c4Shape.width || conf.width, rectWidth, conf.width);
          c4Shape.height = Math.max(c4Shape.height || conf.height, rectHeight, conf.height);
          c4Shape.margin = c4Shape.margin || conf.c4ShapeMargin;
          currentBounds.insert(c4Shape);
          svgDraw_default.drawC4Shape(diagram31, c4Shape, conf);
        }
        currentBounds.bumpLastMargin(conf.c4ShapeMargin);
      }, "drawC4ShapeArray");
      Point2 = class {
        static {
          __name(this, "Point");
        }
        constructor(x5, y6) {
          this.x = x5;
          this.y = y6;
        }
      };
      getIntersectPoint = /* @__PURE__ */ __name(function(fromNode, endPoint) {
        let x1 = fromNode.x;
        let y1 = fromNode.y;
        let x22 = endPoint.x;
        let y22 = endPoint.y;
        let fromCenterX = x1 + fromNode.width / 2;
        let fromCenterY = y1 + fromNode.height / 2;
        let dx = Math.abs(x1 - x22);
        let dy = Math.abs(y1 - y22);
        let tanDYX = dy / dx;
        let fromDYX = fromNode.height / fromNode.width;
        let returnPoint = null;
        if (y1 == y22 && x1 < x22) {
          returnPoint = new Point2(x1 + fromNode.width, fromCenterY);
        } else if (y1 == y22 && x1 > x22) {
          returnPoint = new Point2(x1, fromCenterY);
        } else if (x1 == x22 && y1 < y22) {
          returnPoint = new Point2(fromCenterX, y1 + fromNode.height);
        } else if (x1 == x22 && y1 > y22) {
          returnPoint = new Point2(fromCenterX, y1);
        }
        if (x1 > x22 && y1 < y22) {
          if (fromDYX >= tanDYX) {
            returnPoint = new Point2(x1, fromCenterY + tanDYX * fromNode.width / 2);
          } else {
            returnPoint = new Point2(
              fromCenterX - dx / dy * fromNode.height / 2,
              y1 + fromNode.height
            );
          }
        } else if (x1 < x22 && y1 < y22) {
          if (fromDYX >= tanDYX) {
            returnPoint = new Point2(x1 + fromNode.width, fromCenterY + tanDYX * fromNode.width / 2);
          } else {
            returnPoint = new Point2(
              fromCenterX + dx / dy * fromNode.height / 2,
              y1 + fromNode.height
            );
          }
        } else if (x1 < x22 && y1 > y22) {
          if (fromDYX >= tanDYX) {
            returnPoint = new Point2(x1 + fromNode.width, fromCenterY - tanDYX * fromNode.width / 2);
          } else {
            returnPoint = new Point2(fromCenterX + fromNode.height / 2 * dx / dy, y1);
          }
        } else if (x1 > x22 && y1 > y22) {
          if (fromDYX >= tanDYX) {
            returnPoint = new Point2(x1, fromCenterY - fromNode.width / 2 * tanDYX);
          } else {
            returnPoint = new Point2(fromCenterX - fromNode.height / 2 * dx / dy, y1);
          }
        }
        return returnPoint;
      }, "getIntersectPoint");
      getIntersectPoints = /* @__PURE__ */ __name(function(fromNode, endNode) {
        let endIntersectPoint = { x: 0, y: 0 };
        endIntersectPoint.x = endNode.x + endNode.width / 2;
        endIntersectPoint.y = endNode.y + endNode.height / 2;
        let startPoint = getIntersectPoint(fromNode, endIntersectPoint);
        endIntersectPoint.x = fromNode.x + fromNode.width / 2;
        endIntersectPoint.y = fromNode.y + fromNode.height / 2;
        let endPoint = getIntersectPoint(endNode, endIntersectPoint);
        return { startPoint, endPoint };
      }, "getIntersectPoints");
      drawRels2 = /* @__PURE__ */ __name(function(diagram31, rels2, getC4ShapeObj, diagObj, diagramId3) {
        let i2 = 0;
        for (let rel2 of rels2) {
          i2 = i2 + 1;
          let relTextWrap = rel2.wrap && conf.wrap;
          let relConf = messageFont(conf);
          let diagramType = diagObj.db.getC4Type();
          if (diagramType === "C4Dynamic") {
            rel2.label.text = i2 + ": " + rel2.label.text;
          }
          let textLimitWidth = calculateTextWidth(rel2.label.text, relConf);
          calcC4ShapeTextWH("label", rel2, relTextWrap, relConf, textLimitWidth);
          if (rel2.techn && rel2.techn.text !== "") {
            textLimitWidth = calculateTextWidth(rel2.techn.text, relConf);
            calcC4ShapeTextWH("techn", rel2, relTextWrap, relConf, textLimitWidth);
          }
          if (rel2.descr && rel2.descr.text !== "") {
            textLimitWidth = calculateTextWidth(rel2.descr.text, relConf);
            calcC4ShapeTextWH("descr", rel2, relTextWrap, relConf, textLimitWidth);
          }
          let fromNode = getC4ShapeObj(rel2.from);
          let endNode = getC4ShapeObj(rel2.to);
          let points = getIntersectPoints(fromNode, endNode);
          rel2.startPoint = points.startPoint;
          rel2.endPoint = points.endPoint;
        }
        svgDraw_default.drawRels(diagram31, rels2, conf, diagramId3);
      }, "drawRels");
      __name(drawInsideBoundary, "drawInsideBoundary");
      draw = /* @__PURE__ */ __name(function(_text, id34, _version, diagObj) {
        conf = getConfig2().c4;
        const securityLevel = getConfig2().securityLevel;
        let sandboxElement;
        if (securityLevel === "sandbox") {
          sandboxElement = select_default2("#i" + id34);
        }
        const root3 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body");
        let db9 = diagObj.db;
        diagObj.db.setWrap(conf.wrap);
        c4ShapeInRow2 = db9.getC4ShapeInRow();
        c4BoundaryInRow2 = db9.getC4BoundaryInRow();
        log.debug(`C:${JSON.stringify(conf, null, 2)}`);
        const diagram31 = securityLevel === "sandbox" ? root3.select(`[id="${id34}"]`) : select_default2(`[id="${id34}"]`);
        svgDraw_default.insertComputerIcon(diagram31, id34);
        svgDraw_default.insertDatabaseIcon(diagram31, id34);
        svgDraw_default.insertClockIcon(diagram31, id34);
        let screenBounds = new Bounds(diagObj);
        screenBounds.setData(
          conf.diagramMarginX,
          conf.diagramMarginX,
          conf.diagramMarginY,
          conf.diagramMarginY
        );
        screenBounds.data.widthLimit = screen.availWidth;
        globalBoundaryMaxX = conf.diagramMarginX;
        globalBoundaryMaxY = conf.diagramMarginY;
        const title2 = diagObj.db.getTitle();
        let currentBoundaries = diagObj.db.getBoundaries("");
        drawInsideBoundary(diagram31, "", screenBounds, currentBoundaries, diagObj);
        svgDraw_default.insertArrowHead(diagram31, id34);
        svgDraw_default.insertArrowEnd(diagram31, id34);
        svgDraw_default.insertArrowCrossHead(diagram31, id34);
        svgDraw_default.insertArrowFilledHead(diagram31, id34);
        drawRels2(diagram31, diagObj.db.getRels(), diagObj.db.getC4Shape, diagObj, id34);
        screenBounds.data.stopx = globalBoundaryMaxX;
        screenBounds.data.stopy = globalBoundaryMaxY;
        const box = screenBounds.data;
        let boxHeight = box.stopy - box.starty;
        let height2 = boxHeight + 2 * conf.diagramMarginY;
        let boxWidth = box.stopx - box.startx;
        const width3 = boxWidth + 2 * conf.diagramMarginX;
        if (title2) {
          diagram31.append("text").text(title2).attr("x", (box.stopx - box.startx) / 2 - 4 * conf.diagramMarginX).attr("y", box.starty + conf.diagramMarginY);
        }
        configureSvgSize(diagram31, height2, width3, conf.useMaxWidth);
        const extraVertForTitle = title2 ? 60 : 0;
        diagram31.attr(
          "viewBox",
          box.startx - conf.diagramMarginX + " -" + (conf.diagramMarginY + extraVertForTitle) + " " + width3 + " " + (height2 + extraVertForTitle)
        );
        log.debug(`models:`, box);
      }, "draw");
      c4Renderer_default = {
        drawPersonOrSystemArray: drawC4ShapeArray,
        drawBoundary: drawBoundary2,
        setConf,
        draw
      };
    }
  });

  // src/diagrams/c4/styles.js
  var getStyles2, styles_default2;
  var init_styles2 = __esm({
    "src/diagrams/c4/styles.js"() {
      "use strict";
      getStyles2 = /* @__PURE__ */ __name((options2) => `.person {
    stroke: ${options2.personBorder};
    fill: ${options2.personBkg};
  }
`, "getStyles");
      styles_default2 = getStyles2;
    }
  });

  // src/diagrams/c4/c4Diagram.ts
  var c4Diagram_exports = {};
  __export(c4Diagram_exports, {
    diagram: () => diagram
  });
  var diagram;
  var init_c4Diagram2 = __esm({
    "src/diagrams/c4/c4Diagram.ts"() {
      "use strict";
      init_c4Diagram();
      init_c4Db();
      init_c4Renderer();
      init_styles2();
      diagram = {
        parser: c4Diagram_default,
        db: c4Db_default,
        renderer: c4Renderer_default,
        styles: styles_default2,
        init: /* @__PURE__ */ __name(({ c4, wrap: wrap3 }) => {
          c4Renderer_default.setConf(c4);
          c4Db_default.setWrap(wrap3);
        }, "init")
      };
    }
  });

  // ../../node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs
  function isNothing(subject) {
    return typeof subject === "undefined" || subject === null;
  }
  function isObject2(subject) {
    return typeof subject === "object" && subject !== null;
  }
  function toArray(sequence) {
    if (Array.isArray(sequence)) return sequence;
    else if (isNothing(sequence)) return [];
    return [sequence];
  }
  function extend2(target, source) {
    var index, length2, key, sourceKeys;
    if (source) {
      sourceKeys = Object.keys(source);
      for (index = 0, length2 = sourceKeys.length; index < length2; index += 1) {
        key = sourceKeys[index];
        target[key] = source[key];
      }
    }
    return target;
  }
  function repeat(string3, count2) {
    var result = "", cycle;
    for (cycle = 0; cycle < count2; cycle += 1) {
      result += string3;
    }
    return result;
  }
  function isNegativeZero(number7) {
    return number7 === 0 && Number.NEGATIVE_INFINITY === 1 / number7;
  }
  function formatError(exception2, compact2) {
    var where = "", message = exception2.reason || "(unknown reason)";
    if (!exception2.mark) return message;
    if (exception2.mark.name) {
      where += 'in "' + exception2.mark.name + '" ';
    }
    where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
    if (!compact2 && exception2.mark.snippet) {
      where += "\n\n" + exception2.mark.snippet;
    }
    return message + " " + where;
  }
  function YAMLException$1(reason, mark) {
    Error.call(this);
    this.name = "YAMLException";
    this.reason = reason;
    this.mark = mark;
    this.message = formatError(this, false);
    if (Error.captureStackTrace) {
      Error.captureStackTrace(this, this.constructor);
    } else {
      this.stack = new Error().stack || "";
    }
  }
  function getLine(buffer, lineStart, lineEnd, position5, maxLineLength) {
    var head2 = "";
    var tail = "";
    var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
    if (position5 - lineStart > maxHalfLength) {
      head2 = " ... ";
      lineStart = position5 - maxHalfLength + head2.length;
    }
    if (lineEnd - position5 > maxHalfLength) {
      tail = " ...";
      lineEnd = position5 + maxHalfLength - tail.length;
    }
    return {
      str: head2 + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
      pos: position5 - lineStart + head2.length
      // relative position
    };
  }
  function padStart(string3, max10) {
    return common.repeat(" ", max10 - string3.length) + string3;
  }
  function makeSnippet(mark, options2) {
    options2 = Object.create(options2 || null);
    if (!mark.buffer) return null;
    if (!options2.maxLength) options2.maxLength = 79;
    if (typeof options2.indent !== "number") options2.indent = 1;
    if (typeof options2.linesBefore !== "number") options2.linesBefore = 3;
    if (typeof options2.linesAfter !== "number") options2.linesAfter = 2;
    var re3 = /\r?\n|\r|\0/g;
    var lineStarts = [0];
    var lineEnds = [];
    var match2;
    var foundLineNo = -1;
    while (match2 = re3.exec(mark.buffer)) {
      lineEnds.push(match2.index);
      lineStarts.push(match2.index + match2[0].length);
      if (mark.position <= match2.index && foundLineNo < 0) {
        foundLineNo = lineStarts.length - 2;
      }
    }
    if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
    var result = "", i2, line2;
    var lineNoLength = Math.min(mark.line + options2.linesAfter, lineEnds.length).toString().length;
    var maxLineLength = options2.maxLength - (options2.indent + lineNoLength + 3);
    for (i2 = 1; i2 <= options2.linesBefore; i2++) {
      if (foundLineNo - i2 < 0) break;
      line2 = getLine(
        mark.buffer,
        lineStarts[foundLineNo - i2],
        lineEnds[foundLineNo - i2],
        mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i2]),
        maxLineLength
      );
      result = common.repeat(" ", options2.indent) + padStart((mark.line - i2 + 1).toString(), lineNoLength) + " | " + line2.str + "\n" + result;
    }
    line2 = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
    result += common.repeat(" ", options2.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line2.str + "\n";
    result += common.repeat("-", options2.indent + lineNoLength + 3 + line2.pos) + "^\n";
    for (i2 = 1; i2 <= options2.linesAfter; i2++) {
      if (foundLineNo + i2 >= lineEnds.length) break;
      line2 = getLine(
        mark.buffer,
        lineStarts[foundLineNo + i2],
        lineEnds[foundLineNo + i2],
        mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i2]),
        maxLineLength
      );
      result += common.repeat(" ", options2.indent) + padStart((mark.line + i2 + 1).toString(), lineNoLength) + " | " + line2.str + "\n";
    }
    return result.replace(/\n$/, "");
  }
  function compileStyleAliases(map5) {
    var result = {};
    if (map5 !== null) {
      Object.keys(map5).forEach(function(style3) {
        map5[style3].forEach(function(alias) {
          result[String(alias)] = style3;
        });
      });
    }
    return result;
  }
  function Type$1(tag, options2) {
    options2 = options2 || {};
    Object.keys(options2).forEach(function(name) {
      if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
        throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
      }
    });
    this.options = options2;
    this.tag = tag;
    this.kind = options2["kind"] || null;
    this.resolve = options2["resolve"] || function() {
      return true;
    };
    this.construct = options2["construct"] || function(data5) {
      return data5;
    };
    this.instanceOf = options2["instanceOf"] || null;
    this.predicate = options2["predicate"] || null;
    this.represent = options2["represent"] || null;
    this.representName = options2["representName"] || null;
    this.defaultStyle = options2["defaultStyle"] || null;
    this.multi = options2["multi"] || false;
    this.styleAliases = compileStyleAliases(options2["styleAliases"] || null);
    if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
      throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
    }
  }
  function compileList(schema2, name) {
    var result = [];
    schema2[name].forEach(function(currentType) {
      var newIndex = result.length;
      result.forEach(function(previousType, previousIndex) {
        if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
          newIndex = previousIndex;
        }
      });
      result[newIndex] = currentType;
    });
    return result;
  }
  function compileMap() {
    var result = {
      scalar: {},
      sequence: {},
      mapping: {},
      fallback: {},
      multi: {
        scalar: [],
        sequence: [],
        mapping: [],
        fallback: []
      }
    }, index, length2;
    function collectType(type3) {
      if (type3.multi) {
        result.multi[type3.kind].push(type3);
        result.multi["fallback"].push(type3);
      } else {
        result[type3.kind][type3.tag] = result["fallback"][type3.tag] = type3;
      }
    }
    __name(collectType, "collectType");
    for (index = 0, length2 = arguments.length; index < length2; index += 1) {
      arguments[index].forEach(collectType);
    }
    return result;
  }
  function Schema$1(definition) {
    return this.extend(definition);
  }
  function resolveYamlNull(data5) {
    if (data5 === null) return true;
    var max10 = data5.length;
    return max10 === 1 && data5 === "~" || max10 === 4 && (data5 === "null" || data5 === "Null" || data5 === "NULL");
  }
  function constructYamlNull() {
    return null;
  }
  function isNull(object3) {
    return object3 === null;
  }
  function resolveYamlBoolean(data5) {
    if (data5 === null) return false;
    var max10 = data5.length;
    return max10 === 4 && (data5 === "true" || data5 === "True" || data5 === "TRUE") || max10 === 5 && (data5 === "false" || data5 === "False" || data5 === "FALSE");
  }
  function constructYamlBoolean(data5) {
    return data5 === "true" || data5 === "True" || data5 === "TRUE";
  }
  function isBoolean(object3) {
    return Object.prototype.toString.call(object3) === "[object Boolean]";
  }
  function isHexCode(c3) {
    return 48 <= c3 && c3 <= 57 || 65 <= c3 && c3 <= 70 || 97 <= c3 && c3 <= 102;
  }
  function isOctCode(c3) {
    return 48 <= c3 && c3 <= 55;
  }
  function isDecCode(c3) {
    return 48 <= c3 && c3 <= 57;
  }
  function resolveYamlInteger(data5) {
    if (data5 === null) return false;
    var max10 = data5.length, index = 0, hasDigits = false, ch;
    if (!max10) return false;
    ch = data5[index];
    if (ch === "-" || ch === "+") {
      ch = data5[++index];
    }
    if (ch === "0") {
      if (index + 1 === max10) return true;
      ch = data5[++index];
      if (ch === "b") {
        index++;
        for (; index < max10; index++) {
          ch = data5[index];
          if (ch === "_") continue;
          if (ch !== "0" && ch !== "1") return false;
          hasDigits = true;
        }
        return hasDigits && ch !== "_";
      }
      if (ch === "x") {
        index++;
        for (; index < max10; index++) {
          ch = data5[index];
          if (ch === "_") continue;
          if (!isHexCode(data5.charCodeAt(index))) return false;
          hasDigits = true;
        }
        return hasDigits && ch !== "_";
      }
      if (ch === "o") {
        index++;
        for (; index < max10; index++) {
          ch = data5[index];
          if (ch === "_") continue;
          if (!isOctCode(data5.charCodeAt(index))) return false;
          hasDigits = true;
        }
        return hasDigits && ch !== "_";
      }
    }
    if (ch === "_") return false;
    for (; index < max10; index++) {
      ch = data5[index];
      if (ch === "_") continue;
      if (!isDecCode(data5.charCodeAt(index))) {
        return false;
      }
      hasDigits = true;
    }
    if (!hasDigits || ch === "_") return false;
    return true;
  }
  function constructYamlInteger(data5) {
    var value2 = data5, sign2 = 1, ch;
    if (value2.indexOf("_") !== -1) {
      value2 = value2.replace(/_/g, "");
    }
    ch = value2[0];
    if (ch === "-" || ch === "+") {
      if (ch === "-") sign2 = -1;
      value2 = value2.slice(1);
      ch = value2[0];
    }
    if (value2 === "0") return 0;
    if (ch === "0") {
      if (value2[1] === "b") return sign2 * parseInt(value2.slice(2), 2);
      if (value2[1] === "x") return sign2 * parseInt(value2.slice(2), 16);
      if (value2[1] === "o") return sign2 * parseInt(value2.slice(2), 8);
    }
    return sign2 * parseInt(value2, 10);
  }
  function isInteger(object3) {
    return Object.prototype.toString.call(object3) === "[object Number]" && (object3 % 1 === 0 && !common.isNegativeZero(object3));
  }
  function resolveYamlFloat(data5) {
    if (data5 === null) return false;
    if (!YAML_FLOAT_PATTERN.test(data5) || // Quick hack to not allow integers end with `_`
    // Probably should update regexp & check speed
    data5[data5.length - 1] === "_") {
      return false;
    }
    return true;
  }
  function constructYamlFloat(data5) {
    var value2, sign2;
    value2 = data5.replace(/_/g, "").toLowerCase();
    sign2 = value2[0] === "-" ? -1 : 1;
    if ("+-".indexOf(value2[0]) >= 0) {
      value2 = value2.slice(1);
    }
    if (value2 === ".inf") {
      return sign2 === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
    } else if (value2 === ".nan") {
      return NaN;
    }
    return sign2 * parseFloat(value2, 10);
  }
  function representYamlFloat(object3, style3) {
    var res;
    if (isNaN(object3)) {
      switch (style3) {
        case "lowercase":
          return ".nan";
        case "uppercase":
          return ".NAN";
        case "camelcase":
          return ".NaN";
      }
    } else if (Number.POSITIVE_INFINITY === object3) {
      switch (style3) {
        case "lowercase":
          return ".inf";
        case "uppercase":
          return ".INF";
        case "camelcase":
          return ".Inf";
      }
    } else if (Number.NEGATIVE_INFINITY === object3) {
      switch (style3) {
        case "lowercase":
          return "-.inf";
        case "uppercase":
          return "-.INF";
        case "camelcase":
          return "-.Inf";
      }
    } else if (common.isNegativeZero(object3)) {
      return "-0.0";
    }
    res = object3.toString(10);
    return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
  }
  function isFloat(object3) {
    return Object.prototype.toString.call(object3) === "[object Number]" && (object3 % 1 !== 0 || common.isNegativeZero(object3));
  }
  function resolveYamlTimestamp(data5) {
    if (data5 === null) return false;
    if (YAML_DATE_REGEXP.exec(data5) !== null) return true;
    if (YAML_TIMESTAMP_REGEXP.exec(data5) !== null) return true;
    return false;
  }
  function constructYamlTimestamp(data5) {
    var match2, year, month, day, hour, minute, second2, fraction = 0, delta = null, tz_hour, tz_minute, date2;
    match2 = YAML_DATE_REGEXP.exec(data5);
    if (match2 === null) match2 = YAML_TIMESTAMP_REGEXP.exec(data5);
    if (match2 === null) throw new Error("Date resolve error");
    year = +match2[1];
    month = +match2[2] - 1;
    day = +match2[3];
    if (!match2[4]) {
      return new Date(Date.UTC(year, month, day));
    }
    hour = +match2[4];
    minute = +match2[5];
    second2 = +match2[6];
    if (match2[7]) {
      fraction = match2[7].slice(0, 3);
      while (fraction.length < 3) {
        fraction += "0";
      }
      fraction = +fraction;
    }
    if (match2[9]) {
      tz_hour = +match2[10];
      tz_minute = +(match2[11] || 0);
      delta = (tz_hour * 60 + tz_minute) * 6e4;
      if (match2[9] === "-") delta = -delta;
    }
    date2 = new Date(Date.UTC(year, month, day, hour, minute, second2, fraction));
    if (delta) date2.setTime(date2.getTime() - delta);
    return date2;
  }
  function representYamlTimestamp(object3) {
    return object3.toISOString();
  }
  function resolveYamlMerge(data5) {
    return data5 === "<<" || data5 === null;
  }
  function resolveYamlBinary(data5) {
    if (data5 === null) return false;
    var code, idx, bitlen = 0, max10 = data5.length, map5 = BASE64_MAP;
    for (idx = 0; idx < max10; idx++) {
      code = map5.indexOf(data5.charAt(idx));
      if (code > 64) continue;
      if (code < 0) return false;
      bitlen += 6;
    }
    return bitlen % 8 === 0;
  }
  function constructYamlBinary(data5) {
    var idx, tailbits, input = data5.replace(/[\r\n=]/g, ""), max10 = input.length, map5 = BASE64_MAP, bits = 0, result = [];
    for (idx = 0; idx < max10; idx++) {
      if (idx % 4 === 0 && idx) {
        result.push(bits >> 16 & 255);
        result.push(bits >> 8 & 255);
        result.push(bits & 255);
      }
      bits = bits << 6 | map5.indexOf(input.charAt(idx));
    }
    tailbits = max10 % 4 * 6;
    if (tailbits === 0) {
      result.push(bits >> 16 & 255);
      result.push(bits >> 8 & 255);
      result.push(bits & 255);
    } else if (tailbits === 18) {
      result.push(bits >> 10 & 255);
      result.push(bits >> 2 & 255);
    } else if (tailbits === 12) {
      result.push(bits >> 4 & 255);
    }
    return new Uint8Array(result);
  }
  function representYamlBinary(object3) {
    var result = "", bits = 0, idx, tail, max10 = object3.length, map5 = BASE64_MAP;
    for (idx = 0; idx < max10; idx++) {
      if (idx % 3 === 0 && idx) {
        result += map5[bits >> 18 & 63];
        result += map5[bits >> 12 & 63];
        result += map5[bits >> 6 & 63];
        result += map5[bits & 63];
      }
      bits = (bits << 8) + object3[idx];
    }
    tail = max10 % 3;
    if (tail === 0) {
      result += map5[bits >> 18 & 63];
      result += map5[bits >> 12 & 63];
      result += map5[bits >> 6 & 63];
      result += map5[bits & 63];
    } else if (tail === 2) {
      result += map5[bits >> 10 & 63];
      result += map5[bits >> 4 & 63];
      result += map5[bits << 2 & 63];
      result += map5[64];
    } else if (tail === 1) {
      result += map5[bits >> 2 & 63];
      result += map5[bits << 4 & 63];
      result += map5[64];
      result += map5[64];
    }
    return result;
  }
  function isBinary(obj) {
    return Object.prototype.toString.call(obj) === "[object Uint8Array]";
  }
  function resolveYamlOmap(data5) {
    if (data5 === null) return true;
    var objectKeys = [], index, length2, pair, pairKey, pairHasKey, object3 = data5;
    for (index = 0, length2 = object3.length; index < length2; index += 1) {
      pair = object3[index];
      pairHasKey = false;
      if (_toString$2.call(pair) !== "[object Object]") return false;
      for (pairKey in pair) {
        if (_hasOwnProperty$3.call(pair, pairKey)) {
          if (!pairHasKey) pairHasKey = true;
          else return false;
        }
      }
      if (!pairHasKey) return false;
      if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
      else return false;
    }
    return true;
  }
  function constructYamlOmap(data5) {
    return data5 !== null ? data5 : [];
  }
  function resolveYamlPairs(data5) {
    if (data5 === null) return true;
    var index, length2, pair, keys2, result, object3 = data5;
    result = new Array(object3.length);
    for (index = 0, length2 = object3.length; index < length2; index += 1) {
      pair = object3[index];
      if (_toString$1.call(pair) !== "[object Object]") return false;
      keys2 = Object.keys(pair);
      if (keys2.length !== 1) return false;
      result[index] = [keys2[0], pair[keys2[0]]];
    }
    return true;
  }
  function constructYamlPairs(data5) {
    if (data5 === null) return [];
    var index, length2, pair, keys2, result, object3 = data5;
    result = new Array(object3.length);
    for (index = 0, length2 = object3.length; index < length2; index += 1) {
      pair = object3[index];
      keys2 = Object.keys(pair);
      result[index] = [keys2[0], pair[keys2[0]]];
    }
    return result;
  }
  function resolveYamlSet(data5) {
    if (data5 === null) return true;
    var key, object3 = data5;
    for (key in object3) {
      if (_hasOwnProperty$2.call(object3, key)) {
        if (object3[key] !== null) return false;
      }
    }
    return true;
  }
  function constructYamlSet(data5) {
    return data5 !== null ? data5 : {};
  }
  function _class(obj) {
    return Object.prototype.toString.call(obj);
  }
  function is_EOL(c3) {
    return c3 === 10 || c3 === 13;
  }
  function is_WHITE_SPACE(c3) {
    return c3 === 9 || c3 === 32;
  }
  function is_WS_OR_EOL(c3) {
    return c3 === 9 || c3 === 32 || c3 === 10 || c3 === 13;
  }
  function is_FLOW_INDICATOR(c3) {
    return c3 === 44 || c3 === 91 || c3 === 93 || c3 === 123 || c3 === 125;
  }
  function fromHexCode(c3) {
    var lc;
    if (48 <= c3 && c3 <= 57) {
      return c3 - 48;
    }
    lc = c3 | 32;
    if (97 <= lc && lc <= 102) {
      return lc - 97 + 10;
    }
    return -1;
  }
  function escapedHexLen(c3) {
    if (c3 === 120) {
      return 2;
    }
    if (c3 === 117) {
      return 4;
    }
    if (c3 === 85) {
      return 8;
    }
    return 0;
  }
  function fromDecimalCode(c3) {
    if (48 <= c3 && c3 <= 57) {
      return c3 - 48;
    }
    return -1;
  }
  function simpleEscapeSequence(c3) {
    return c3 === 48 ? "\0" : c3 === 97 ? "\x07" : c3 === 98 ? "\b" : c3 === 116 ? "	" : c3 === 9 ? "	" : c3 === 110 ? "\n" : c3 === 118 ? "\v" : c3 === 102 ? "\f" : c3 === 114 ? "\r" : c3 === 101 ? "\x1B" : c3 === 32 ? " " : c3 === 34 ? '"' : c3 === 47 ? "/" : c3 === 92 ? "\\" : c3 === 78 ? "\x85" : c3 === 95 ? "\xA0" : c3 === 76 ? "\u2028" : c3 === 80 ? "\u2029" : "";
  }
  function charFromCodepoint(c3) {
    if (c3 <= 65535) {
      return String.fromCharCode(c3);
    }
    return String.fromCharCode(
      (c3 - 65536 >> 10) + 55296,
      (c3 - 65536 & 1023) + 56320
    );
  }
  function setProperty(object3, key, value2) {
    if (key === "__proto__") {
      Object.defineProperty(object3, key, {
        configurable: true,
        enumerable: true,
        writable: true,
        value: value2
      });
    } else {
      object3[key] = value2;
    }
  }
  function State$1(input, options2) {
    this.input = input;
    this.filename = options2["filename"] || null;
    this.schema = options2["schema"] || _default;
    this.onWarning = options2["onWarning"] || null;
    this.legacy = options2["legacy"] || false;
    this.json = options2["json"] || false;
    this.listener = options2["listener"] || null;
    this.implicitTypes = this.schema.compiledImplicit;
    this.typeMap = this.schema.compiledTypeMap;
    this.length = input.length;
    this.position = 0;
    this.line = 0;
    this.lineStart = 0;
    this.lineIndent = 0;
    this.firstTabInLine = -1;
    this.documents = [];
  }
  function generateError(state4, message) {
    var mark = {
      name: state4.filename,
      buffer: state4.input.slice(0, -1),
      // omit trailing \0
      position: state4.position,
      line: state4.line,
      column: state4.position - state4.lineStart
    };
    mark.snippet = snippet(mark);
    return new exception(message, mark);
  }
  function throwError(state4, message) {
    throw generateError(state4, message);
  }
  function throwWarning(state4, message) {
    if (state4.onWarning) {
      state4.onWarning.call(null, generateError(state4, message));
    }
  }
  function captureSegment(state4, start3, end2, checkJson) {
    var _position, _length, _character, _result;
    if (start3 < end2) {
      _result = state4.input.slice(start3, end2);
      if (checkJson) {
        for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
          _character = _result.charCodeAt(_position);
          if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
            throwError(state4, "expected valid JSON character");
          }
        }
      } else if (PATTERN_NON_PRINTABLE.test(_result)) {
        throwError(state4, "the stream contains non-printable characters");
      }
      state4.result += _result;
    }
  }
  function mergeMappings(state4, destination, source, overridableKeys) {
    var sourceKeys, key, index, quantity;
    if (!common.isObject(source)) {
      throwError(state4, "cannot merge mappings; the provided source object is unacceptable");
    }
    sourceKeys = Object.keys(source);
    for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
      key = sourceKeys[index];
      if (!_hasOwnProperty$1.call(destination, key)) {
        setProperty(destination, key, source[key]);
        overridableKeys[key] = true;
      }
    }
  }
  function storeMappingPair(state4, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
    var index, quantity;
    if (Array.isArray(keyNode)) {
      keyNode = Array.prototype.slice.call(keyNode);
      for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
        if (Array.isArray(keyNode[index])) {
          throwError(state4, "nested arrays are not supported inside keys");
        }
        if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
          keyNode[index] = "[object Object]";
        }
      }
    }
    if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
      keyNode = "[object Object]";
    }
    keyNode = String(keyNode);
    if (_result === null) {
      _result = {};
    }
    if (keyTag === "tag:yaml.org,2002:merge") {
      if (Array.isArray(valueNode)) {
        for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
          mergeMappings(state4, _result, valueNode[index], overridableKeys);
        }
      } else {
        mergeMappings(state4, _result, valueNode, overridableKeys);
      }
    } else {
      if (!state4.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
        state4.line = startLine || state4.line;
        state4.lineStart = startLineStart || state4.lineStart;
        state4.position = startPos || state4.position;
        throwError(state4, "duplicated mapping key");
      }
      setProperty(_result, keyNode, valueNode);
      delete overridableKeys[keyNode];
    }
    return _result;
  }
  function readLineBreak(state4) {
    var ch;
    ch = state4.input.charCodeAt(state4.position);
    if (ch === 10) {
      state4.position++;
    } else if (ch === 13) {
      state4.position++;
      if (state4.input.charCodeAt(state4.position) === 10) {
        state4.position++;
      }
    } else {
      throwError(state4, "a line break is expected");
    }
    state4.line += 1;
    state4.lineStart = state4.position;
    state4.firstTabInLine = -1;
  }
  function skipSeparationSpace(state4, allowComments, checkIndent) {
    var lineBreaks = 0, ch = state4.input.charCodeAt(state4.position);
    while (ch !== 0) {
      while (is_WHITE_SPACE(ch)) {
        if (ch === 9 && state4.firstTabInLine === -1) {
          state4.firstTabInLine = state4.position;
        }
        ch = state4.input.charCodeAt(++state4.position);
      }
      if (allowComments && ch === 35) {
        do {
          ch = state4.input.charCodeAt(++state4.position);
        } while (ch !== 10 && ch !== 13 && ch !== 0);
      }
      if (is_EOL(ch)) {
        readLineBreak(state4);
        ch = state4.input.charCodeAt(state4.position);
        lineBreaks++;
        state4.lineIndent = 0;
        while (ch === 32) {
          state4.lineIndent++;
          ch = state4.input.charCodeAt(++state4.position);
        }
      } else {
        break;
      }
    }
    if (checkIndent !== -1 && lineBreaks !== 0 && state4.lineIndent < checkIndent) {
      throwWarning(state4, "deficient indentation");
    }
    return lineBreaks;
  }
  function testDocumentSeparator(state4) {
    var _position = state4.position, ch;
    ch = state4.input.charCodeAt(_position);
    if ((ch === 45 || ch === 46) && ch === state4.input.charCodeAt(_position + 1) && ch === state4.input.charCodeAt(_position + 2)) {
      _position += 3;
      ch = state4.input.charCodeAt(_position);
      if (ch === 0 || is_WS_OR_EOL(ch)) {
        return true;
      }
    }
    return false;
  }
  function writeFoldedLines(state4, count2) {
    if (count2 === 1) {
      state4.result += " ";
    } else if (count2 > 1) {
      state4.result += common.repeat("\n", count2 - 1);
    }
  }
  function readPlainScalar(state4, nodeIndent, withinFlowCollection) {
    var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state4.kind, _result = state4.result, ch;
    ch = state4.input.charCodeAt(state4.position);
    if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
      return false;
    }
    if (ch === 63 || ch === 45) {
      following = state4.input.charCodeAt(state4.position + 1);
      if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
        return false;
      }
    }
    state4.kind = "scalar";
    state4.result = "";
    captureStart = captureEnd = state4.position;
    hasPendingContent = false;
    while (ch !== 0) {
      if (ch === 58) {
        following = state4.input.charCodeAt(state4.position + 1);
        if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
          break;
        }
      } else if (ch === 35) {
        preceding = state4.input.charCodeAt(state4.position - 1);
        if (is_WS_OR_EOL(preceding)) {
          break;
        }
      } else if (state4.position === state4.lineStart && testDocumentSeparator(state4) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
        break;
      } else if (is_EOL(ch)) {
        _line = state4.line;
        _lineStart = state4.lineStart;
        _lineIndent = state4.lineIndent;
        skipSeparationSpace(state4, false, -1);
        if (state4.lineIndent >= nodeIndent) {
          hasPendingContent = true;
          ch = state4.input.charCodeAt(state4.position);
          continue;
        } else {
          state4.position = captureEnd;
          state4.line = _line;
          state4.lineStart = _lineStart;
          state4.lineIndent = _lineIndent;
          break;
        }
      }
      if (hasPendingContent) {
        captureSegment(state4, captureStart, captureEnd, false);
        writeFoldedLines(state4, state4.line - _line);
        captureStart = captureEnd = state4.position;
        hasPendingContent = false;
      }
      if (!is_WHITE_SPACE(ch)) {
        captureEnd = state4.position + 1;
      }
      ch = state4.input.charCodeAt(++state4.position);
    }
    captureSegment(state4, captureStart, captureEnd, false);
    if (state4.result) {
      return true;
    }
    state4.kind = _kind;
    state4.result = _result;
    return false;
  }
  function readSingleQuotedScalar(state4, nodeIndent) {
    var ch, captureStart, captureEnd;
    ch = state4.input.charCodeAt(state4.position);
    if (ch !== 39) {
      return false;
    }
    state4.kind = "scalar";
    state4.result = "";
    state4.position++;
    captureStart = captureEnd = state4.position;
    while ((ch = state4.input.charCodeAt(state4.position)) !== 0) {
      if (ch === 39) {
        captureSegment(state4, captureStart, state4.position, true);
        ch = state4.input.charCodeAt(++state4.position);
        if (ch === 39) {
          captureStart = state4.position;
          state4.position++;
          captureEnd = state4.position;
        } else {
          return true;
        }
      } else if (is_EOL(ch)) {
        captureSegment(state4, captureStart, captureEnd, true);
        writeFoldedLines(state4, skipSeparationSpace(state4, false, nodeIndent));
        captureStart = captureEnd = state4.position;
      } else if (state4.position === state4.lineStart && testDocumentSeparator(state4)) {
        throwError(state4, "unexpected end of the document within a single quoted scalar");
      } else {
        state4.position++;
        captureEnd = state4.position;
      }
    }
    throwError(state4, "unexpected end of the stream within a single quoted scalar");
  }
  function readDoubleQuotedScalar(state4, nodeIndent) {
    var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
    ch = state4.input.charCodeAt(state4.position);
    if (ch !== 34) {
      return false;
    }
    state4.kind = "scalar";
    state4.result = "";
    state4.position++;
    captureStart = captureEnd = state4.position;
    while ((ch = state4.input.charCodeAt(state4.position)) !== 0) {
      if (ch === 34) {
        captureSegment(state4, captureStart, state4.position, true);
        state4.position++;
        return true;
      } else if (ch === 92) {
        captureSegment(state4, captureStart, state4.position, true);
        ch = state4.input.charCodeAt(++state4.position);
        if (is_EOL(ch)) {
          skipSeparationSpace(state4, false, nodeIndent);
        } else if (ch < 256 && simpleEscapeCheck[ch]) {
          state4.result += simpleEscapeMap[ch];
          state4.position++;
        } else if ((tmp = escapedHexLen(ch)) > 0) {
          hexLength = tmp;
          hexResult = 0;
          for (; hexLength > 0; hexLength--) {
            ch = state4.input.charCodeAt(++state4.position);
            if ((tmp = fromHexCode(ch)) >= 0) {
              hexResult = (hexResult << 4) + tmp;
            } else {
              throwError(state4, "expected hexadecimal character");
            }
          }
          state4.result += charFromCodepoint(hexResult);
          state4.position++;
        } else {
          throwError(state4, "unknown escape sequence");
        }
        captureStart = captureEnd = state4.position;
      } else if (is_EOL(ch)) {
        captureSegment(state4, captureStart, captureEnd, true);
        writeFoldedLines(state4, skipSeparationSpace(state4, false, nodeIndent));
        captureStart = captureEnd = state4.position;
      } else if (state4.position === state4.lineStart && testDocumentSeparator(state4)) {
        throwError(state4, "unexpected end of the document within a double quoted scalar");
      } else {
        state4.position++;
        captureEnd = state4.position;
      }
    }
    throwError(state4, "unexpected end of the stream within a double quoted scalar");
  }
  function readFlowCollection(state4, nodeIndent) {
    var readNext = true, _line, _lineStart, _pos, _tag = state4.tag, _result, _anchor = state4.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
    ch = state4.input.charCodeAt(state4.position);
    if (ch === 91) {
      terminator = 93;
      isMapping = false;
      _result = [];
    } else if (ch === 123) {
      terminator = 125;
      isMapping = true;
      _result = {};
    } else {
      return false;
    }
    if (state4.anchor !== null) {
      state4.anchorMap[state4.anchor] = _result;
    }
    ch = state4.input.charCodeAt(++state4.position);
    while (ch !== 0) {
      skipSeparationSpace(state4, true, nodeIndent);
      ch = state4.input.charCodeAt(state4.position);
      if (ch === terminator) {
        state4.position++;
        state4.tag = _tag;
        state4.anchor = _anchor;
        state4.kind = isMapping ? "mapping" : "sequence";
        state4.result = _result;
        return true;
      } else if (!readNext) {
        throwError(state4, "missed comma between flow collection entries");
      } else if (ch === 44) {
        throwError(state4, "expected the node content, but found ','");
      }
      keyTag = keyNode = valueNode = null;
      isPair = isExplicitPair = false;
      if (ch === 63) {
        following = state4.input.charCodeAt(state4.position + 1);
        if (is_WS_OR_EOL(following)) {
          isPair = isExplicitPair = true;
          state4.position++;
          skipSeparationSpace(state4, true, nodeIndent);
        }
      }
      _line = state4.line;
      _lineStart = state4.lineStart;
      _pos = state4.position;
      composeNode(state4, nodeIndent, CONTEXT_FLOW_IN, false, true);
      keyTag = state4.tag;
      keyNode = state4.result;
      skipSeparationSpace(state4, true, nodeIndent);
      ch = state4.input.charCodeAt(state4.position);
      if ((isExplicitPair || state4.line === _line) && ch === 58) {
        isPair = true;
        ch = state4.input.charCodeAt(++state4.position);
        skipSeparationSpace(state4, true, nodeIndent);
        composeNode(state4, nodeIndent, CONTEXT_FLOW_IN, false, true);
        valueNode = state4.result;
      }
      if (isMapping) {
        storeMappingPair(state4, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
      } else if (isPair) {
        _result.push(storeMappingPair(state4, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
      } else {
        _result.push(keyNode);
      }
      skipSeparationSpace(state4, true, nodeIndent);
      ch = state4.input.charCodeAt(state4.position);
      if (ch === 44) {
        readNext = true;
        ch = state4.input.charCodeAt(++state4.position);
      } else {
        readNext = false;
      }
    }
    throwError(state4, "unexpected end of the stream within a flow collection");
  }
  function readBlockScalar(state4, nodeIndent) {
    var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
    ch = state4.input.charCodeAt(state4.position);
    if (ch === 124) {
      folding = false;
    } else if (ch === 62) {
      folding = true;
    } else {
      return false;
    }
    state4.kind = "scalar";
    state4.result = "";
    while (ch !== 0) {
      ch = state4.input.charCodeAt(++state4.position);
      if (ch === 43 || ch === 45) {
        if (CHOMPING_CLIP === chomping) {
          chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
        } else {
          throwError(state4, "repeat of a chomping mode identifier");
        }
      } else if ((tmp = fromDecimalCode(ch)) >= 0) {
        if (tmp === 0) {
          throwError(state4, "bad explicit indentation width of a block scalar; it cannot be less than one");
        } else if (!detectedIndent) {
          textIndent = nodeIndent + tmp - 1;
          detectedIndent = true;
        } else {
          throwError(state4, "repeat of an indentation width identifier");
        }
      } else {
        break;
      }
    }
    if (is_WHITE_SPACE(ch)) {
      do {
        ch = state4.input.charCodeAt(++state4.position);
      } while (is_WHITE_SPACE(ch));
      if (ch === 35) {
        do {
          ch = state4.input.charCodeAt(++state4.position);
        } while (!is_EOL(ch) && ch !== 0);
      }
    }
    while (ch !== 0) {
      readLineBreak(state4);
      state4.lineIndent = 0;
      ch = state4.input.charCodeAt(state4.position);
      while ((!detectedIndent || state4.lineIndent < textIndent) && ch === 32) {
        state4.lineIndent++;
        ch = state4.input.charCodeAt(++state4.position);
      }
      if (!detectedIndent && state4.lineIndent > textIndent) {
        textIndent = state4.lineIndent;
      }
      if (is_EOL(ch)) {
        emptyLines++;
        continue;
      }
      if (state4.lineIndent < textIndent) {
        if (chomping === CHOMPING_KEEP) {
          state4.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
        } else if (chomping === CHOMPING_CLIP) {
          if (didReadContent) {
            state4.result += "\n";
          }
        }
        break;
      }
      if (folding) {
        if (is_WHITE_SPACE(ch)) {
          atMoreIndented = true;
          state4.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
        } else if (atMoreIndented) {
          atMoreIndented = false;
          state4.result += common.repeat("\n", emptyLines + 1);
        } else if (emptyLines === 0) {
          if (didReadContent) {
            state4.result += " ";
          }
        } else {
          state4.result += common.repeat("\n", emptyLines);
        }
      } else {
        state4.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
      }
      didReadContent = true;
      detectedIndent = true;
      emptyLines = 0;
      captureStart = state4.position;
      while (!is_EOL(ch) && ch !== 0) {
        ch = state4.input.charCodeAt(++state4.position);
      }
      captureSegment(state4, captureStart, state4.position, false);
    }
    return true;
  }
  function readBlockSequence(state4, nodeIndent) {
    var _line, _tag = state4.tag, _anchor = state4.anchor, _result = [], following, detected = false, ch;
    if (state4.firstTabInLine !== -1) return false;
    if (state4.anchor !== null) {
      state4.anchorMap[state4.anchor] = _result;
    }
    ch = state4.input.charCodeAt(state4.position);
    while (ch !== 0) {
      if (state4.firstTabInLine !== -1) {
        state4.position = state4.firstTabInLine;
        throwError(state4, "tab characters must not be used in indentation");
      }
      if (ch !== 45) {
        break;
      }
      following = state4.input.charCodeAt(state4.position + 1);
      if (!is_WS_OR_EOL(following)) {
        break;
      }
      detected = true;
      state4.position++;
      if (skipSeparationSpace(state4, true, -1)) {
        if (state4.lineIndent <= nodeIndent) {
          _result.push(null);
          ch = state4.input.charCodeAt(state4.position);
          continue;
        }
      }
      _line = state4.line;
      composeNode(state4, nodeIndent, CONTEXT_BLOCK_IN, false, true);
      _result.push(state4.result);
      skipSeparationSpace(state4, true, -1);
      ch = state4.input.charCodeAt(state4.position);
      if ((state4.line === _line || state4.lineIndent > nodeIndent) && ch !== 0) {
        throwError(state4, "bad indentation of a sequence entry");
      } else if (state4.lineIndent < nodeIndent) {
        break;
      }
    }
    if (detected) {
      state4.tag = _tag;
      state4.anchor = _anchor;
      state4.kind = "sequence";
      state4.result = _result;
      return true;
    }
    return false;
  }
  function readBlockMapping(state4, nodeIndent, flowIndent) {
    var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state4.tag, _anchor = state4.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
    if (state4.firstTabInLine !== -1) return false;
    if (state4.anchor !== null) {
      state4.anchorMap[state4.anchor] = _result;
    }
    ch = state4.input.charCodeAt(state4.position);
    while (ch !== 0) {
      if (!atExplicitKey && state4.firstTabInLine !== -1) {
        state4.position = state4.firstTabInLine;
        throwError(state4, "tab characters must not be used in indentation");
      }
      following = state4.input.charCodeAt(state4.position + 1);
      _line = state4.line;
      if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
        if (ch === 63) {
          if (atExplicitKey) {
            storeMappingPair(state4, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
            keyTag = keyNode = valueNode = null;
          }
          detected = true;
          atExplicitKey = true;
          allowCompact = true;
        } else if (atExplicitKey) {
          atExplicitKey = false;
          allowCompact = true;
        } else {
          throwError(state4, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
        }
        state4.position += 1;
        ch = following;
      } else {
        _keyLine = state4.line;
        _keyLineStart = state4.lineStart;
        _keyPos = state4.position;
        if (!composeNode(state4, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
          break;
        }
        if (state4.line === _line) {
          ch = state4.input.charCodeAt(state4.position);
          while (is_WHITE_SPACE(ch)) {
            ch = state4.input.charCodeAt(++state4.position);
          }
          if (ch === 58) {
            ch = state4.input.charCodeAt(++state4.position);
            if (!is_WS_OR_EOL(ch)) {
              throwError(state4, "a whitespace character is expected after the key-value separator within a block mapping");
            }
            if (atExplicitKey) {
              storeMappingPair(state4, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
              keyTag = keyNode = valueNode = null;
            }
            detected = true;
            atExplicitKey = false;
            allowCompact = false;
            keyTag = state4.tag;
            keyNode = state4.result;
          } else if (detected) {
            throwError(state4, "can not read an implicit mapping pair; a colon is missed");
          } else {
            state4.tag = _tag;
            state4.anchor = _anchor;
            return true;
          }
        } else if (detected) {
          throwError(state4, "can not read a block mapping entry; a multiline key may not be an implicit key");
        } else {
          state4.tag = _tag;
          state4.anchor = _anchor;
          return true;
        }
      }
      if (state4.line === _line || state4.lineIndent > nodeIndent) {
        if (atExplicitKey) {
          _keyLine = state4.line;
          _keyLineStart = state4.lineStart;
          _keyPos = state4.position;
        }
        if (composeNode(state4, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
          if (atExplicitKey) {
            keyNode = state4.result;
          } else {
            valueNode = state4.result;
          }
        }
        if (!atExplicitKey) {
          storeMappingPair(state4, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
          keyTag = keyNode = valueNode = null;
        }
        skipSeparationSpace(state4, true, -1);
        ch = state4.input.charCodeAt(state4.position);
      }
      if ((state4.line === _line || state4.lineIndent > nodeIndent) && ch !== 0) {
        throwError(state4, "bad indentation of a mapping entry");
      } else if (state4.lineIndent < nodeIndent) {
        break;
      }
    }
    if (atExplicitKey) {
      storeMappingPair(state4, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
    }
    if (detected) {
      state4.tag = _tag;
      state4.anchor = _anchor;
      state4.kind = "mapping";
      state4.result = _result;
    }
    return detected;
  }
  function readTagProperty(state4) {
    var _position, isVerbatim = false, isNamed2 = false, tagHandle, tagName, ch;
    ch = state4.input.charCodeAt(state4.position);
    if (ch !== 33) return false;
    if (state4.tag !== null) {
      throwError(state4, "duplication of a tag property");
    }
    ch = state4.input.charCodeAt(++state4.position);
    if (ch === 60) {
      isVerbatim = true;
      ch = state4.input.charCodeAt(++state4.position);
    } else if (ch === 33) {
      isNamed2 = true;
      tagHandle = "!!";
      ch = state4.input.charCodeAt(++state4.position);
    } else {
      tagHandle = "!";
    }
    _position = state4.position;
    if (isVerbatim) {
      do {
        ch = state4.input.charCodeAt(++state4.position);
      } while (ch !== 0 && ch !== 62);
      if (state4.position < state4.length) {
        tagName = state4.input.slice(_position, state4.position);
        ch = state4.input.charCodeAt(++state4.position);
      } else {
        throwError(state4, "unexpected end of the stream within a verbatim tag");
      }
    } else {
      while (ch !== 0 && !is_WS_OR_EOL(ch)) {
        if (ch === 33) {
          if (!isNamed2) {
            tagHandle = state4.input.slice(_position - 1, state4.position + 1);
            if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
              throwError(state4, "named tag handle cannot contain such characters");
            }
            isNamed2 = true;
            _position = state4.position + 1;
          } else {
            throwError(state4, "tag suffix cannot contain exclamation marks");
          }
        }
        ch = state4.input.charCodeAt(++state4.position);
      }
      tagName = state4.input.slice(_position, state4.position);
      if (PATTERN_FLOW_INDICATORS.test(tagName)) {
        throwError(state4, "tag suffix cannot contain flow indicator characters");
      }
    }
    if (tagName && !PATTERN_TAG_URI.test(tagName)) {
      throwError(state4, "tag name cannot contain such characters: " + tagName);
    }
    try {
      tagName = decodeURIComponent(tagName);
    } catch (err) {
      throwError(state4, "tag name is malformed: " + tagName);
    }
    if (isVerbatim) {
      state4.tag = tagName;
    } else if (_hasOwnProperty$1.call(state4.tagMap, tagHandle)) {
      state4.tag = state4.tagMap[tagHandle] + tagName;
    } else if (tagHandle === "!") {
      state4.tag = "!" + tagName;
    } else if (tagHandle === "!!") {
      state4.tag = "tag:yaml.org,2002:" + tagName;
    } else {
      throwError(state4, 'undeclared tag handle "' + tagHandle + '"');
    }
    return true;
  }
  function readAnchorProperty(state4) {
    var _position, ch;
    ch = state4.input.charCodeAt(state4.position);
    if (ch !== 38) return false;
    if (state4.anchor !== null) {
      throwError(state4, "duplication of an anchor property");
    }
    ch = state4.input.charCodeAt(++state4.position);
    _position = state4.position;
    while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
      ch = state4.input.charCodeAt(++state4.position);
    }
    if (state4.position === _position) {
      throwError(state4, "name of an anchor node must contain at least one character");
    }
    state4.anchor = state4.input.slice(_position, state4.position);
    return true;
  }
  function readAlias(state4) {
    var _position, alias, ch;
    ch = state4.input.charCodeAt(state4.position);
    if (ch !== 42) return false;
    ch = state4.input.charCodeAt(++state4.position);
    _position = state4.position;
    while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
      ch = state4.input.charCodeAt(++state4.position);
    }
    if (state4.position === _position) {
      throwError(state4, "name of an alias node must contain at least one character");
    }
    alias = state4.input.slice(_position, state4.position);
    if (!_hasOwnProperty$1.call(state4.anchorMap, alias)) {
      throwError(state4, 'unidentified alias "' + alias + '"');
    }
    state4.result = state4.anchorMap[alias];
    skipSeparationSpace(state4, true, -1);
    return true;
  }
  function composeNode(state4, parentIndent, nodeContext, allowToSeek, allowCompact) {
    var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type3, flowIndent, blockIndent;
    if (state4.listener !== null) {
      state4.listener("open", state4);
    }
    state4.tag = null;
    state4.anchor = null;
    state4.kind = null;
    state4.result = null;
    allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
    if (allowToSeek) {
      if (skipSeparationSpace(state4, true, -1)) {
        atNewLine = true;
        if (state4.lineIndent > parentIndent) {
          indentStatus = 1;
        } else if (state4.lineIndent === parentIndent) {
          indentStatus = 0;
        } else if (state4.lineIndent < parentIndent) {
          indentStatus = -1;
        }
      }
    }
    if (indentStatus === 1) {
      while (readTagProperty(state4) || readAnchorProperty(state4)) {
        if (skipSeparationSpace(state4, true, -1)) {
          atNewLine = true;
          allowBlockCollections = allowBlockStyles;
          if (state4.lineIndent > parentIndent) {
            indentStatus = 1;
          } else if (state4.lineIndent === parentIndent) {
            indentStatus = 0;
          } else if (state4.lineIndent < parentIndent) {
            indentStatus = -1;
          }
        } else {
          allowBlockCollections = false;
        }
      }
    }
    if (allowBlockCollections) {
      allowBlockCollections = atNewLine || allowCompact;
    }
    if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
      if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
        flowIndent = parentIndent;
      } else {
        flowIndent = parentIndent + 1;
      }
      blockIndent = state4.position - state4.lineStart;
      if (indentStatus === 1) {
        if (allowBlockCollections && (readBlockSequence(state4, blockIndent) || readBlockMapping(state4, blockIndent, flowIndent)) || readFlowCollection(state4, flowIndent)) {
          hasContent = true;
        } else {
          if (allowBlockScalars && readBlockScalar(state4, flowIndent) || readSingleQuotedScalar(state4, flowIndent) || readDoubleQuotedScalar(state4, flowIndent)) {
            hasContent = true;
          } else if (readAlias(state4)) {
            hasContent = true;
            if (state4.tag !== null || state4.anchor !== null) {
              throwError(state4, "alias node should not have any properties");
            }
          } else if (readPlainScalar(state4, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
            hasContent = true;
            if (state4.tag === null) {
              state4.tag = "?";
            }
          }
          if (state4.anchor !== null) {
            state4.anchorMap[state4.anchor] = state4.result;
          }
        }
      } else if (indentStatus === 0) {
        hasContent = allowBlockCollections && readBlockSequence(state4, blockIndent);
      }
    }
    if (state4.tag === null) {
      if (state4.anchor !== null) {
        state4.anchorMap[state4.anchor] = state4.result;
      }
    } else if (state4.tag === "?") {
      if (state4.result !== null && state4.kind !== "scalar") {
        throwError(state4, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state4.kind + '"');
      }
      for (typeIndex = 0, typeQuantity = state4.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
        type3 = state4.implicitTypes[typeIndex];
        if (type3.resolve(state4.result)) {
          state4.result = type3.construct(state4.result);
          state4.tag = type3.tag;
          if (state4.anchor !== null) {
            state4.anchorMap[state4.anchor] = state4.result;
          }
          break;
        }
      }
    } else if (state4.tag !== "!") {
      if (_hasOwnProperty$1.call(state4.typeMap[state4.kind || "fallback"], state4.tag)) {
        type3 = state4.typeMap[state4.kind || "fallback"][state4.tag];
      } else {
        type3 = null;
        typeList = state4.typeMap.multi[state4.kind || "fallback"];
        for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
          if (state4.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
            type3 = typeList[typeIndex];
            break;
          }
        }
      }
      if (!type3) {
        throwError(state4, "unknown tag !<" + state4.tag + ">");
      }
      if (state4.result !== null && type3.kind !== state4.kind) {
        throwError(state4, "unacceptable node kind for !<" + state4.tag + '> tag; it should be "' + type3.kind + '", not "' + state4.kind + '"');
      }
      if (!type3.resolve(state4.result, state4.tag)) {
        throwError(state4, "cannot resolve a node with !<" + state4.tag + "> explicit tag");
      } else {
        state4.result = type3.construct(state4.result, state4.tag);
        if (state4.anchor !== null) {
          state4.anchorMap[state4.anchor] = state4.result;
        }
      }
    }
    if (state4.listener !== null) {
      state4.listener("close", state4);
    }
    return state4.tag !== null || state4.anchor !== null || hasContent;
  }
  function readDocument(state4) {
    var documentStart = state4.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
    state4.version = null;
    state4.checkLineBreaks = state4.legacy;
    state4.tagMap = /* @__PURE__ */ Object.create(null);
    state4.anchorMap = /* @__PURE__ */ Object.create(null);
    while ((ch = state4.input.charCodeAt(state4.position)) !== 0) {
      skipSeparationSpace(state4, true, -1);
      ch = state4.input.charCodeAt(state4.position);
      if (state4.lineIndent > 0 || ch !== 37) {
        break;
      }
      hasDirectives = true;
      ch = state4.input.charCodeAt(++state4.position);
      _position = state4.position;
      while (ch !== 0 && !is_WS_OR_EOL(ch)) {
        ch = state4.input.charCodeAt(++state4.position);
      }
      directiveName = state4.input.slice(_position, state4.position);
      directiveArgs = [];
      if (directiveName.length < 1) {
        throwError(state4, "directive name must not be less than one character in length");
      }
      while (ch !== 0) {
        while (is_WHITE_SPACE(ch)) {
          ch = state4.input.charCodeAt(++state4.position);
        }
        if (ch === 35) {
          do {
            ch = state4.input.charCodeAt(++state4.position);
          } while (ch !== 0 && !is_EOL(ch));
          break;
        }
        if (is_EOL(ch)) break;
        _position = state4.position;
        while (ch !== 0 && !is_WS_OR_EOL(ch)) {
          ch = state4.input.charCodeAt(++state4.position);
        }
        directiveArgs.push(state4.input.slice(_position, state4.position));
      }
      if (ch !== 0) readLineBreak(state4);
      if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
        directiveHandlers[directiveName](state4, directiveName, directiveArgs);
      } else {
        throwWarning(state4, 'unknown document directive "' + directiveName + '"');
      }
    }
    skipSeparationSpace(state4, true, -1);
    if (state4.lineIndent === 0 && state4.input.charCodeAt(state4.position) === 45 && state4.input.charCodeAt(state4.position + 1) === 45 && state4.input.charCodeAt(state4.position + 2) === 45) {
      state4.position += 3;
      skipSeparationSpace(state4, true, -1);
    } else if (hasDirectives) {
      throwError(state4, "directives end mark is expected");
    }
    composeNode(state4, state4.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
    skipSeparationSpace(state4, true, -1);
    if (state4.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state4.input.slice(documentStart, state4.position))) {
      throwWarning(state4, "non-ASCII line breaks are interpreted as content");
    }
    state4.documents.push(state4.result);
    if (state4.position === state4.lineStart && testDocumentSeparator(state4)) {
      if (state4.input.charCodeAt(state4.position) === 46) {
        state4.position += 3;
        skipSeparationSpace(state4, true, -1);
      }
      return;
    }
    if (state4.position < state4.length - 1) {
      throwError(state4, "end of the stream or a document separator is expected");
    } else {
      return;
    }
  }
  function loadDocuments(input, options2) {
    input = String(input);
    options2 = options2 || {};
    if (input.length !== 0) {
      if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
        input += "\n";
      }
      if (input.charCodeAt(0) === 65279) {
        input = input.slice(1);
      }
    }
    var state4 = new State$1(input, options2);
    var nullpos = input.indexOf("\0");
    if (nullpos !== -1) {
      state4.position = nullpos;
      throwError(state4, "null byte is not allowed in input");
    }
    state4.input += "\0";
    while (state4.input.charCodeAt(state4.position) === 32) {
      state4.lineIndent += 1;
      state4.position += 1;
    }
    while (state4.position < state4.length - 1) {
      readDocument(state4);
    }
    return state4.documents;
  }
  function loadAll$1(input, iterator, options2) {
    if (iterator !== null && typeof iterator === "object" && typeof options2 === "undefined") {
      options2 = iterator;
      iterator = null;
    }
    var documents = loadDocuments(input, options2);
    if (typeof iterator !== "function") {
      return documents;
    }
    for (var index = 0, length2 = documents.length; index < length2; index += 1) {
      iterator(documents[index]);
    }
  }
  function load$1(input, options2) {
    var documents = loadDocuments(input, options2);
    if (documents.length === 0) {
      return void 0;
    } else if (documents.length === 1) {
      return documents[0];
    }
    throw new exception("expected a single document in the stream, but found more");
  }
  function compileStyleMap(schema2, map5) {
    var result, keys2, index, length2, tag, style3, type3;
    if (map5 === null) return {};
    result = {};
    keys2 = Object.keys(map5);
    for (index = 0, length2 = keys2.length; index < length2; index += 1) {
      tag = keys2[index];
      style3 = String(map5[tag]);
      if (tag.slice(0, 2) === "!!") {
        tag = "tag:yaml.org,2002:" + tag.slice(2);
      }
      type3 = schema2.compiledTypeMap["fallback"][tag];
      if (type3 && _hasOwnProperty.call(type3.styleAliases, style3)) {
        style3 = type3.styleAliases[style3];
      }
      result[tag] = style3;
    }
    return result;
  }
  function encodeHex(character2) {
    var string3, handle, length2;
    string3 = character2.toString(16).toUpperCase();
    if (character2 <= 255) {
      handle = "x";
      length2 = 2;
    } else if (character2 <= 65535) {
      handle = "u";
      length2 = 4;
    } else if (character2 <= 4294967295) {
      handle = "U";
      length2 = 8;
    } else {
      throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
    }
    return "\\" + handle + common.repeat("0", length2 - string3.length) + string3;
  }
  function State(options2) {
    this.schema = options2["schema"] || _default;
    this.indent = Math.max(1, options2["indent"] || 2);
    this.noArrayIndent = options2["noArrayIndent"] || false;
    this.skipInvalid = options2["skipInvalid"] || false;
    this.flowLevel = common.isNothing(options2["flowLevel"]) ? -1 : options2["flowLevel"];
    this.styleMap = compileStyleMap(this.schema, options2["styles"] || null);
    this.sortKeys = options2["sortKeys"] || false;
    this.lineWidth = options2["lineWidth"] || 80;
    this.noRefs = options2["noRefs"] || false;
    this.noCompatMode = options2["noCompatMode"] || false;
    this.condenseFlow = options2["condenseFlow"] || false;
    this.quotingType = options2["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
    this.forceQuotes = options2["forceQuotes"] || false;
    this.replacer = typeof options2["replacer"] === "function" ? options2["replacer"] : null;
    this.implicitTypes = this.schema.compiledImplicit;
    this.explicitTypes = this.schema.compiledExplicit;
    this.tag = null;
    this.result = "";
    this.duplicates = [];
    this.usedDuplicates = null;
  }
  function indentString(string3, spaces) {
    var ind = common.repeat(" ", spaces), position5 = 0, next3 = -1, result = "", line2, length2 = string3.length;
    while (position5 < length2) {
      next3 = string3.indexOf("\n", position5);
      if (next3 === -1) {
        line2 = string3.slice(position5);
        position5 = length2;
      } else {
        line2 = string3.slice(position5, next3 + 1);
        position5 = next3 + 1;
      }
      if (line2.length && line2 !== "\n") result += ind;
      result += line2;
    }
    return result;
  }
  function generateNextLine(state4, level) {
    return "\n" + common.repeat(" ", state4.indent * level);
  }
  function testImplicitResolving(state4, str2) {
    var index, length2, type3;
    for (index = 0, length2 = state4.implicitTypes.length; index < length2; index += 1) {
      type3 = state4.implicitTypes[index];
      if (type3.resolve(str2)) {
        return true;
      }
    }
    return false;
  }
  function isWhitespace(c3) {
    return c3 === CHAR_SPACE || c3 === CHAR_TAB;
  }
  function isPrintable(c3) {
    return 32 <= c3 && c3 <= 126 || 161 <= c3 && c3 <= 55295 && c3 !== 8232 && c3 !== 8233 || 57344 <= c3 && c3 <= 65533 && c3 !== CHAR_BOM || 65536 <= c3 && c3 <= 1114111;
  }
  function isNsCharOrWhitespace(c3) {
    return isPrintable(c3) && c3 !== CHAR_BOM && c3 !== CHAR_CARRIAGE_RETURN && c3 !== CHAR_LINE_FEED;
  }
  function isPlainSafe(c3, prev2, inblock) {
    var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c3);
    var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c3);
    return (
      // ns-plain-safe
      (inblock ? (
        // c = flow-in
        cIsNsCharOrWhitespace
      ) : cIsNsCharOrWhitespace && c3 !== CHAR_COMMA && c3 !== CHAR_LEFT_SQUARE_BRACKET && c3 !== CHAR_RIGHT_SQUARE_BRACKET && c3 !== CHAR_LEFT_CURLY_BRACKET && c3 !== CHAR_RIGHT_CURLY_BRACKET) && c3 !== CHAR_SHARP && !(prev2 === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev2) && !isWhitespace(prev2) && c3 === CHAR_SHARP || prev2 === CHAR_COLON && cIsNsChar
    );
  }
  function isPlainSafeFirst(c3) {
    return isPrintable(c3) && c3 !== CHAR_BOM && !isWhitespace(c3) && c3 !== CHAR_MINUS && c3 !== CHAR_QUESTION && c3 !== CHAR_COLON && c3 !== CHAR_COMMA && c3 !== CHAR_LEFT_SQUARE_BRACKET && c3 !== CHAR_RIGHT_SQUARE_BRACKET && c3 !== CHAR_LEFT_CURLY_BRACKET && c3 !== CHAR_RIGHT_CURLY_BRACKET && c3 !== CHAR_SHARP && c3 !== CHAR_AMPERSAND && c3 !== CHAR_ASTERISK && c3 !== CHAR_EXCLAMATION && c3 !== CHAR_VERTICAL_LINE && c3 !== CHAR_EQUALS && c3 !== CHAR_GREATER_THAN && c3 !== CHAR_SINGLE_QUOTE && c3 !== CHAR_DOUBLE_QUOTE && c3 !== CHAR_PERCENT && c3 !== CHAR_COMMERCIAL_AT && c3 !== CHAR_GRAVE_ACCENT;
  }
  function isPlainSafeLast(c3) {
    return !isWhitespace(c3) && c3 !== CHAR_COLON;
  }
  function codePointAt(string3, pos) {
    var first3 = string3.charCodeAt(pos), second2;
    if (first3 >= 55296 && first3 <= 56319 && pos + 1 < string3.length) {
      second2 = string3.charCodeAt(pos + 1);
      if (second2 >= 56320 && second2 <= 57343) {
        return (first3 - 55296) * 1024 + second2 - 56320 + 65536;
      }
    }
    return first3;
  }
  function needIndentIndicator(string3) {
    var leadingSpaceRe = /^\n* /;
    return leadingSpaceRe.test(string3);
  }
  function chooseScalarStyle(string3, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
    var i2;
    var char2 = 0;
    var prevChar = null;
    var hasLineBreak = false;
    var hasFoldableLine = false;
    var shouldTrackWidth = lineWidth !== -1;
    var previousLineBreak = -1;
    var plain = isPlainSafeFirst(codePointAt(string3, 0)) && isPlainSafeLast(codePointAt(string3, string3.length - 1));
    if (singleLineOnly || forceQuotes) {
      for (i2 = 0; i2 < string3.length; char2 >= 65536 ? i2 += 2 : i2++) {
        char2 = codePointAt(string3, i2);
        if (!isPrintable(char2)) {
          return STYLE_DOUBLE;
        }
        plain = plain && isPlainSafe(char2, prevChar, inblock);
        prevChar = char2;
      }
    } else {
      for (i2 = 0; i2 < string3.length; char2 >= 65536 ? i2 += 2 : i2++) {
        char2 = codePointAt(string3, i2);
        if (char2 === CHAR_LINE_FEED) {
          hasLineBreak = true;
          if (shouldTrackWidth) {
            hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
            i2 - previousLineBreak - 1 > lineWidth && string3[previousLineBreak + 1] !== " ";
            previousLineBreak = i2;
          }
        } else if (!isPrintable(char2)) {
          return STYLE_DOUBLE;
        }
        plain = plain && isPlainSafe(char2, prevChar, inblock);
        prevChar = char2;
      }
      hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i2 - previousLineBreak - 1 > lineWidth && string3[previousLineBreak + 1] !== " ");
    }
    if (!hasLineBreak && !hasFoldableLine) {
      if (plain && !forceQuotes && !testAmbiguousType(string3)) {
        return STYLE_PLAIN;
      }
      return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
    }
    if (indentPerLevel > 9 && needIndentIndicator(string3)) {
      return STYLE_DOUBLE;
    }
    if (!forceQuotes) {
      return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
    }
    return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
  }
  function writeScalar(state4, string3, level, iskey, inblock) {
    state4.dump = (function() {
      if (string3.length === 0) {
        return state4.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
      }
      if (!state4.noCompatMode) {
        if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string3) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string3)) {
          return state4.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string3 + '"' : "'" + string3 + "'";
        }
      }
      var indent = state4.indent * Math.max(1, level);
      var lineWidth = state4.lineWidth === -1 ? -1 : Math.max(Math.min(state4.lineWidth, 40), state4.lineWidth - indent);
      var singleLineOnly = iskey || state4.flowLevel > -1 && level >= state4.flowLevel;
      function testAmbiguity(string4) {
        return testImplicitResolving(state4, string4);
      }
      __name(testAmbiguity, "testAmbiguity");
      switch (chooseScalarStyle(
        string3,
        singleLineOnly,
        state4.indent,
        lineWidth,
        testAmbiguity,
        state4.quotingType,
        state4.forceQuotes && !iskey,
        inblock
      )) {
        case STYLE_PLAIN:
          return string3;
        case STYLE_SINGLE:
          return "'" + string3.replace(/'/g, "''") + "'";
        case STYLE_LITERAL:
          return "|" + blockHeader(string3, state4.indent) + dropEndingNewline(indentString(string3, indent));
        case STYLE_FOLDED:
          return ">" + blockHeader(string3, state4.indent) + dropEndingNewline(indentString(foldString(string3, lineWidth), indent));
        case STYLE_DOUBLE:
          return '"' + escapeString(string3) + '"';
        default:
          throw new exception("impossible error: invalid scalar style");
      }
    })();
  }
  function blockHeader(string3, indentPerLevel) {
    var indentIndicator = needIndentIndicator(string3) ? String(indentPerLevel) : "";
    var clip = string3[string3.length - 1] === "\n";
    var keep = clip && (string3[string3.length - 2] === "\n" || string3 === "\n");
    var chomp = keep ? "+" : clip ? "" : "-";
    return indentIndicator + chomp + "\n";
  }
  function dropEndingNewline(string3) {
    return string3[string3.length - 1] === "\n" ? string3.slice(0, -1) : string3;
  }
  function foldString(string3, width3) {
    var lineRe = /(\n+)([^\n]*)/g;
    var result = (function() {
      var nextLF = string3.indexOf("\n");
      nextLF = nextLF !== -1 ? nextLF : string3.length;
      lineRe.lastIndex = nextLF;
      return foldLine(string3.slice(0, nextLF), width3);
    })();
    var prevMoreIndented = string3[0] === "\n" || string3[0] === " ";
    var moreIndented;
    var match2;
    while (match2 = lineRe.exec(string3)) {
      var prefix = match2[1], line2 = match2[2];
      moreIndented = line2[0] === " ";
      result += prefix + (!prevMoreIndented && !moreIndented && line2 !== "" ? "\n" : "") + foldLine(line2, width3);
      prevMoreIndented = moreIndented;
    }
    return result;
  }
  function foldLine(line2, width3) {
    if (line2 === "" || line2[0] === " ") return line2;
    var breakRe = / [^ ]/g;
    var match2;
    var start3 = 0, end2, curr = 0, next3 = 0;
    var result = "";
    while (match2 = breakRe.exec(line2)) {
      next3 = match2.index;
      if (next3 - start3 > width3) {
        end2 = curr > start3 ? curr : next3;
        result += "\n" + line2.slice(start3, end2);
        start3 = end2 + 1;
      }
      curr = next3;
    }
    result += "\n";
    if (line2.length - start3 > width3 && curr > start3) {
      result += line2.slice(start3, curr) + "\n" + line2.slice(curr + 1);
    } else {
      result += line2.slice(start3);
    }
    return result.slice(1);
  }
  function escapeString(string3) {
    var result = "";
    var char2 = 0;
    var escapeSeq;
    for (var i2 = 0; i2 < string3.length; char2 >= 65536 ? i2 += 2 : i2++) {
      char2 = codePointAt(string3, i2);
      escapeSeq = ESCAPE_SEQUENCES[char2];
      if (!escapeSeq && isPrintable(char2)) {
        result += string3[i2];
        if (char2 >= 65536) result += string3[i2 + 1];
      } else {
        result += escapeSeq || encodeHex(char2);
      }
    }
    return result;
  }
  function writeFlowSequence(state4, level, object3) {
    var _result = "", _tag = state4.tag, index, length2, value2;
    for (index = 0, length2 = object3.length; index < length2; index += 1) {
      value2 = object3[index];
      if (state4.replacer) {
        value2 = state4.replacer.call(object3, String(index), value2);
      }
      if (writeNode(state4, level, value2, false, false) || typeof value2 === "undefined" && writeNode(state4, level, null, false, false)) {
        if (_result !== "") _result += "," + (!state4.condenseFlow ? " " : "");
        _result += state4.dump;
      }
    }
    state4.tag = _tag;
    state4.dump = "[" + _result + "]";
  }
  function writeBlockSequence(state4, level, object3, compact2) {
    var _result = "", _tag = state4.tag, index, length2, value2;
    for (index = 0, length2 = object3.length; index < length2; index += 1) {
      value2 = object3[index];
      if (state4.replacer) {
        value2 = state4.replacer.call(object3, String(index), value2);
      }
      if (writeNode(state4, level + 1, value2, true, true, false, true) || typeof value2 === "undefined" && writeNode(state4, level + 1, null, true, true, false, true)) {
        if (!compact2 || _result !== "") {
          _result += generateNextLine(state4, level);
        }
        if (state4.dump && CHAR_LINE_FEED === state4.dump.charCodeAt(0)) {
          _result += "-";
        } else {
          _result += "- ";
        }
        _result += state4.dump;
      }
    }
    state4.tag = _tag;
    state4.dump = _result || "[]";
  }
  function writeFlowMapping(state4, level, object3) {
    var _result = "", _tag = state4.tag, objectKeyList = Object.keys(object3), index, length2, objectKey, objectValue, pairBuffer;
    for (index = 0, length2 = objectKeyList.length; index < length2; index += 1) {
      pairBuffer = "";
      if (_result !== "") pairBuffer += ", ";
      if (state4.condenseFlow) pairBuffer += '"';
      objectKey = objectKeyList[index];
      objectValue = object3[objectKey];
      if (state4.replacer) {
        objectValue = state4.replacer.call(object3, objectKey, objectValue);
      }
      if (!writeNode(state4, level, objectKey, false, false)) {
        continue;
      }
      if (state4.dump.length > 1024) pairBuffer += "? ";
      pairBuffer += state4.dump + (state4.condenseFlow ? '"' : "") + ":" + (state4.condenseFlow ? "" : " ");
      if (!writeNode(state4, level, objectValue, false, false)) {
        continue;
      }
      pairBuffer += state4.dump;
      _result += pairBuffer;
    }
    state4.tag = _tag;
    state4.dump = "{" + _result + "}";
  }
  function writeBlockMapping(state4, level, object3, compact2) {
    var _result = "", _tag = state4.tag, objectKeyList = Object.keys(object3), index, length2, objectKey, objectValue, explicitPair, pairBuffer;
    if (state4.sortKeys === true) {
      objectKeyList.sort();
    } else if (typeof state4.sortKeys === "function") {
      objectKeyList.sort(state4.sortKeys);
    } else if (state4.sortKeys) {
      throw new exception("sortKeys must be a boolean or a function");
    }
    for (index = 0, length2 = objectKeyList.length; index < length2; index += 1) {
      pairBuffer = "";
      if (!compact2 || _result !== "") {
        pairBuffer += generateNextLine(state4, level);
      }
      objectKey = objectKeyList[index];
      objectValue = object3[objectKey];
      if (state4.replacer) {
        objectValue = state4.replacer.call(object3, objectKey, objectValue);
      }
      if (!writeNode(state4, level + 1, objectKey, true, true, true)) {
        continue;
      }
      explicitPair = state4.tag !== null && state4.tag !== "?" || state4.dump && state4.dump.length > 1024;
      if (explicitPair) {
        if (state4.dump && CHAR_LINE_FEED === state4.dump.charCodeAt(0)) {
          pairBuffer += "?";
        } else {
          pairBuffer += "? ";
        }
      }
      pairBuffer += state4.dump;
      if (explicitPair) {
        pairBuffer += generateNextLine(state4, level);
      }
      if (!writeNode(state4, level + 1, objectValue, true, explicitPair)) {
        continue;
      }
      if (state4.dump && CHAR_LINE_FEED === state4.dump.charCodeAt(0)) {
        pairBuffer += ":";
      } else {
        pairBuffer += ": ";
      }
      pairBuffer += state4.dump;
      _result += pairBuffer;
    }
    state4.tag = _tag;
    state4.dump = _result || "{}";
  }
  function detectType2(state4, object3, explicit) {
    var _result, typeList, index, length2, type3, style3;
    typeList = explicit ? state4.explicitTypes : state4.implicitTypes;
    for (index = 0, length2 = typeList.length; index < length2; index += 1) {
      type3 = typeList[index];
      if ((type3.instanceOf || type3.predicate) && (!type3.instanceOf || typeof object3 === "object" && object3 instanceof type3.instanceOf) && (!type3.predicate || type3.predicate(object3))) {
        if (explicit) {
          if (type3.multi && type3.representName) {
            state4.tag = type3.representName(object3);
          } else {
            state4.tag = type3.tag;
          }
        } else {
          state4.tag = "?";
        }
        if (type3.represent) {
          style3 = state4.styleMap[type3.tag] || type3.defaultStyle;
          if (_toString.call(type3.represent) === "[object Function]") {
            _result = type3.represent(object3, style3);
          } else if (_hasOwnProperty.call(type3.represent, style3)) {
            _result = type3.represent[style3](object3, style3);
          } else {
            throw new exception("!<" + type3.tag + '> tag resolver accepts not "' + style3 + '" style');
          }
          state4.dump = _result;
        }
        return true;
      }
    }
    return false;
  }
  function writeNode(state4, level, object3, block2, compact2, iskey, isblockseq) {
    state4.tag = null;
    state4.dump = object3;
    if (!detectType2(state4, object3, false)) {
      detectType2(state4, object3, true);
    }
    var type3 = _toString.call(state4.dump);
    var inblock = block2;
    var tagStr;
    if (block2) {
      block2 = state4.flowLevel < 0 || state4.flowLevel > level;
    }
    var objectOrArray = type3 === "[object Object]" || type3 === "[object Array]", duplicateIndex, duplicate;
    if (objectOrArray) {
      duplicateIndex = state4.duplicates.indexOf(object3);
      duplicate = duplicateIndex !== -1;
    }
    if (state4.tag !== null && state4.tag !== "?" || duplicate || state4.indent !== 2 && level > 0) {
      compact2 = false;
    }
    if (duplicate && state4.usedDuplicates[duplicateIndex]) {
      state4.dump = "*ref_" + duplicateIndex;
    } else {
      if (objectOrArray && duplicate && !state4.usedDuplicates[duplicateIndex]) {
        state4.usedDuplicates[duplicateIndex] = true;
      }
      if (type3 === "[object Object]") {
        if (block2 && Object.keys(state4.dump).length !== 0) {
          writeBlockMapping(state4, level, state4.dump, compact2);
          if (duplicate) {
            state4.dump = "&ref_" + duplicateIndex + state4.dump;
          }
        } else {
          writeFlowMapping(state4, level, state4.dump);
          if (duplicate) {
            state4.dump = "&ref_" + duplicateIndex + " " + state4.dump;
          }
        }
      } else if (type3 === "[object Array]") {
        if (block2 && state4.dump.length !== 0) {
          if (state4.noArrayIndent && !isblockseq && level > 0) {
            writeBlockSequence(state4, level - 1, state4.dump, compact2);
          } else {
            writeBlockSequence(state4, level, state4.dump, compact2);
          }
          if (duplicate) {
            state4.dump = "&ref_" + duplicateIndex + state4.dump;
          }
        } else {
          writeFlowSequence(state4, level, state4.dump);
          if (duplicate) {
            state4.dump = "&ref_" + duplicateIndex + " " + state4.dump;
          }
        }
      } else if (type3 === "[object String]") {
        if (state4.tag !== "?") {
          writeScalar(state4, state4.dump, level, iskey, inblock);
        }
      } else if (type3 === "[object Undefined]") {
        return false;
      } else {
        if (state4.skipInvalid) return false;
        throw new exception("unacceptable kind of an object to dump " + type3);
      }
      if (state4.tag !== null && state4.tag !== "?") {
        tagStr = encodeURI(
          state4.tag[0] === "!" ? state4.tag.slice(1) : state4.tag
        ).replace(/!/g, "%21");
        if (state4.tag[0] === "!") {
          tagStr = "!" + tagStr;
        } else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
          tagStr = "!!" + tagStr.slice(18);
        } else {
          tagStr = "!<" + tagStr + ">";
        }
        state4.dump = tagStr + " " + state4.dump;
      }
    }
    return true;
  }
  function getDuplicateReferences(object3, state4) {
    var objects = [], duplicatesIndexes = [], index, length2;
    inspectNode(object3, objects, duplicatesIndexes);
    for (index = 0, length2 = duplicatesIndexes.length; index < length2; index += 1) {
      state4.duplicates.push(objects[duplicatesIndexes[index]]);
    }
    state4.usedDuplicates = new Array(length2);
  }
  function inspectNode(object3, objects, duplicatesIndexes) {
    var objectKeyList, index, length2;
    if (object3 !== null && typeof object3 === "object") {
      index = objects.indexOf(object3);
      if (index !== -1) {
        if (duplicatesIndexes.indexOf(index) === -1) {
          duplicatesIndexes.push(index);
        }
      } else {
        objects.push(object3);
        if (Array.isArray(object3)) {
          for (index = 0, length2 = object3.length; index < length2; index += 1) {
            inspectNode(object3[index], objects, duplicatesIndexes);
          }
        } else {
          objectKeyList = Object.keys(object3);
          for (index = 0, length2 = objectKeyList.length; index < length2; index += 1) {
            inspectNode(object3[objectKeyList[index]], objects, duplicatesIndexes);
          }
        }
      }
    }
  }
  function dump$1(input, options2) {
    options2 = options2 || {};
    var state4 = new State(options2);
    if (!state4.noRefs) getDuplicateReferences(input, state4);
    var value2 = input;
    if (state4.replacer) {
      value2 = state4.replacer.call({ "": value2 }, "", value2);
    }
    if (writeNode(state4, 0, value2, true, true)) return state4.dump + "\n";
    return "";
  }
  function renamed(from2, to) {
    return function() {
      throw new Error("Function yaml." + from2 + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
    };
  }
  var isNothing_1, isObject_1, toArray_1, repeat_1, isNegativeZero_1, extend_1, common, exception, snippet, TYPE_CONSTRUCTOR_OPTIONS, YAML_NODE_KINDS, type2, schema, str, seq, map2, failsafe, _null, bool, int, YAML_FLOAT_PATTERN, SCIENTIFIC_WITHOUT_DOT, float, json, core, YAML_DATE_REGEXP, YAML_TIMESTAMP_REGEXP, timestamp, merge2, BASE64_MAP, binary, _hasOwnProperty$3, _toString$2, omap, _toString$1, pairs, _hasOwnProperty$2, set3, _default, _hasOwnProperty$1, CONTEXT_FLOW_IN, CONTEXT_FLOW_OUT, CONTEXT_BLOCK_IN, CONTEXT_BLOCK_OUT, CHOMPING_CLIP, CHOMPING_STRIP, CHOMPING_KEEP, PATTERN_NON_PRINTABLE, PATTERN_NON_ASCII_LINE_BREAKS, PATTERN_FLOW_INDICATORS, PATTERN_TAG_HANDLE, PATTERN_TAG_URI, simpleEscapeCheck, simpleEscapeMap, i2, directiveHandlers, loadAll_1, load_1, loader2, _toString, _hasOwnProperty, CHAR_BOM, CHAR_TAB, CHAR_LINE_FEED, CHAR_CARRIAGE_RETURN, CHAR_SPACE, CHAR_EXCLAMATION, CHAR_DOUBLE_QUOTE, CHAR_SHARP, CHAR_PERCENT, CHAR_AMPERSAND, CHAR_SINGLE_QUOTE, CHAR_ASTERISK, CHAR_COMMA, CHAR_MINUS, CHAR_COLON, CHAR_EQUALS, CHAR_GREATER_THAN, CHAR_QUESTION, CHAR_COMMERCIAL_AT, CHAR_LEFT_SQUARE_BRACKET, CHAR_RIGHT_SQUARE_BRACKET, CHAR_GRAVE_ACCENT, CHAR_LEFT_CURLY_BRACKET, CHAR_VERTICAL_LINE, CHAR_RIGHT_CURLY_BRACKET, ESCAPE_SEQUENCES, DEPRECATED_BOOLEANS_SYNTAX, DEPRECATED_BASE60_SYNTAX, QUOTING_TYPE_SINGLE, QUOTING_TYPE_DOUBLE, STYLE_PLAIN, STYLE_SINGLE, STYLE_LITERAL, STYLE_FOLDED, STYLE_DOUBLE, dump_1, dumper, JSON_SCHEMA, load, loadAll, dump, safeLoad, safeLoadAll, safeDump;
  var init_js_yaml = __esm({
    "../../node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs"() {
      "use strict";
      __name(isNothing, "isNothing");
      __name(isObject2, "isObject");
      __name(toArray, "toArray");
      __name(extend2, "extend");
      __name(repeat, "repeat");
      __name(isNegativeZero, "isNegativeZero");
      isNothing_1 = isNothing;
      isObject_1 = isObject2;
      toArray_1 = toArray;
      repeat_1 = repeat;
      isNegativeZero_1 = isNegativeZero;
      extend_1 = extend2;
      common = {
        isNothing: isNothing_1,
        isObject: isObject_1,
        toArray: toArray_1,
        repeat: repeat_1,
        isNegativeZero: isNegativeZero_1,
        extend: extend_1
      };
      __name(formatError, "formatError");
      __name(YAMLException$1, "YAMLException$1");
      YAMLException$1.prototype = Object.create(Error.prototype);
      YAMLException$1.prototype.constructor = YAMLException$1;
      YAMLException$1.prototype.toString = /* @__PURE__ */ __name(function toString(compact2) {
        return this.name + ": " + formatError(this, compact2);
      }, "toString");
      exception = YAMLException$1;
      __name(getLine, "getLine");
      __name(padStart, "padStart");
      __name(makeSnippet, "makeSnippet");
      snippet = makeSnippet;
      TYPE_CONSTRUCTOR_OPTIONS = [
        "kind",
        "multi",
        "resolve",
        "construct",
        "instanceOf",
        "predicate",
        "represent",
        "representName",
        "defaultStyle",
        "styleAliases"
      ];
      YAML_NODE_KINDS = [
        "scalar",
        "sequence",
        "mapping"
      ];
      __name(compileStyleAliases, "compileStyleAliases");
      __name(Type$1, "Type$1");
      type2 = Type$1;
      __name(compileList, "compileList");
      __name(compileMap, "compileMap");
      __name(Schema$1, "Schema$1");
      Schema$1.prototype.extend = /* @__PURE__ */ __name(function extend3(definition) {
        var implicit2 = [];
        var explicit = [];
        if (definition instanceof type2) {
          explicit.push(definition);
        } else if (Array.isArray(definition)) {
          explicit = explicit.concat(definition);
        } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
          if (definition.implicit) implicit2 = implicit2.concat(definition.implicit);
          if (definition.explicit) explicit = explicit.concat(definition.explicit);
        } else {
          throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
        }
        implicit2.forEach(function(type$1) {
          if (!(type$1 instanceof type2)) {
            throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
          }
          if (type$1.loadKind && type$1.loadKind !== "scalar") {
            throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
          }
          if (type$1.multi) {
            throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
          }
        });
        explicit.forEach(function(type$1) {
          if (!(type$1 instanceof type2)) {
            throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
          }
        });
        var result = Object.create(Schema$1.prototype);
        result.implicit = (this.implicit || []).concat(implicit2);
        result.explicit = (this.explicit || []).concat(explicit);
        result.compiledImplicit = compileList(result, "implicit");
        result.compiledExplicit = compileList(result, "explicit");
        result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
        return result;
      }, "extend");
      schema = Schema$1;
      str = new type2("tag:yaml.org,2002:str", {
        kind: "scalar",
        construct: /* @__PURE__ */ __name(function(data5) {
          return data5 !== null ? data5 : "";
        }, "construct")
      });
      seq = new type2("tag:yaml.org,2002:seq", {
        kind: "sequence",
        construct: /* @__PURE__ */ __name(function(data5) {
          return data5 !== null ? data5 : [];
        }, "construct")
      });
      map2 = new type2("tag:yaml.org,2002:map", {
        kind: "mapping",
        construct: /* @__PURE__ */ __name(function(data5) {
          return data5 !== null ? data5 : {};
        }, "construct")
      });
      failsafe = new schema({
        explicit: [
          str,
          seq,
          map2
        ]
      });
      __name(resolveYamlNull, "resolveYamlNull");
      __name(constructYamlNull, "constructYamlNull");
      __name(isNull, "isNull");
      _null = new type2("tag:yaml.org,2002:null", {
        kind: "scalar",
        resolve: resolveYamlNull,
        construct: constructYamlNull,
        predicate: isNull,
        represent: {
          canonical: /* @__PURE__ */ __name(function() {
            return "~";
          }, "canonical"),
          lowercase: /* @__PURE__ */ __name(function() {
            return "null";
          }, "lowercase"),
          uppercase: /* @__PURE__ */ __name(function() {
            return "NULL";
          }, "uppercase"),
          camelcase: /* @__PURE__ */ __name(function() {
            return "Null";
          }, "camelcase"),
          empty: /* @__PURE__ */ __name(function() {
            return "";
          }, "empty")
        },
        defaultStyle: "lowercase"
      });
      __name(resolveYamlBoolean, "resolveYamlBoolean");
      __name(constructYamlBoolean, "constructYamlBoolean");
      __name(isBoolean, "isBoolean");
      bool = new type2("tag:yaml.org,2002:bool", {
        kind: "scalar",
        resolve: resolveYamlBoolean,
        construct: constructYamlBoolean,
        predicate: isBoolean,
        represent: {
          lowercase: /* @__PURE__ */ __name(function(object3) {
            return object3 ? "true" : "false";
          }, "lowercase"),
          uppercase: /* @__PURE__ */ __name(function(object3) {
            return object3 ? "TRUE" : "FALSE";
          }, "uppercase"),
          camelcase: /* @__PURE__ */ __name(function(object3) {
            return object3 ? "True" : "False";
          }, "camelcase")
        },
        defaultStyle: "lowercase"
      });
      __name(isHexCode, "isHexCode");
      __name(isOctCode, "isOctCode");
      __name(isDecCode, "isDecCode");
      __name(resolveYamlInteger, "resolveYamlInteger");
      __name(constructYamlInteger, "constructYamlInteger");
      __name(isInteger, "isInteger");
      int = new type2("tag:yaml.org,2002:int", {
        kind: "scalar",
        resolve: resolveYamlInteger,
        construct: constructYamlInteger,
        predicate: isInteger,
        represent: {
          binary: /* @__PURE__ */ __name(function(obj) {
            return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
          }, "binary"),
          octal: /* @__PURE__ */ __name(function(obj) {
            return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
          }, "octal"),
          decimal: /* @__PURE__ */ __name(function(obj) {
            return obj.toString(10);
          }, "decimal"),
          /* eslint-disable max-len */
          hexadecimal: /* @__PURE__ */ __name(function(obj) {
            return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
          }, "hexadecimal")
        },
        defaultStyle: "decimal",
        styleAliases: {
          binary: [2, "bin"],
          octal: [8, "oct"],
          decimal: [10, "dec"],
          hexadecimal: [16, "hex"]
        }
      });
      YAML_FLOAT_PATTERN = new RegExp(
        // 2.5e4, 2.5 and integers
        "^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
      );
      __name(resolveYamlFloat, "resolveYamlFloat");
      __name(constructYamlFloat, "constructYamlFloat");
      SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
      __name(representYamlFloat, "representYamlFloat");
      __name(isFloat, "isFloat");
      float = new type2("tag:yaml.org,2002:float", {
        kind: "scalar",
        resolve: resolveYamlFloat,
        construct: constructYamlFloat,
        predicate: isFloat,
        represent: representYamlFloat,
        defaultStyle: "lowercase"
      });
      json = failsafe.extend({
        implicit: [
          _null,
          bool,
          int,
          float
        ]
      });
      core = json;
      YAML_DATE_REGEXP = new RegExp(
        "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
      );
      YAML_TIMESTAMP_REGEXP = new RegExp(
        "^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
      );
      __name(resolveYamlTimestamp, "resolveYamlTimestamp");
      __name(constructYamlTimestamp, "constructYamlTimestamp");
      __name(representYamlTimestamp, "representYamlTimestamp");
      timestamp = new type2("tag:yaml.org,2002:timestamp", {
        kind: "scalar",
        resolve: resolveYamlTimestamp,
        construct: constructYamlTimestamp,
        instanceOf: Date,
        represent: representYamlTimestamp
      });
      __name(resolveYamlMerge, "resolveYamlMerge");
      merge2 = new type2("tag:yaml.org,2002:merge", {
        kind: "scalar",
        resolve: resolveYamlMerge
      });
      BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
      __name(resolveYamlBinary, "resolveYamlBinary");
      __name(constructYamlBinary, "constructYamlBinary");
      __name(representYamlBinary, "representYamlBinary");
      __name(isBinary, "isBinary");
      binary = new type2("tag:yaml.org,2002:binary", {
        kind: "scalar",
        resolve: resolveYamlBinary,
        construct: constructYamlBinary,
        predicate: isBinary,
        represent: representYamlBinary
      });
      _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
      _toString$2 = Object.prototype.toString;
      __name(resolveYamlOmap, "resolveYamlOmap");
      __name(constructYamlOmap, "constructYamlOmap");
      omap = new type2("tag:yaml.org,2002:omap", {
        kind: "sequence",
        resolve: resolveYamlOmap,
        construct: constructYamlOmap
      });
      _toString$1 = Object.prototype.toString;
      __name(resolveYamlPairs, "resolveYamlPairs");
      __name(constructYamlPairs, "constructYamlPairs");
      pairs = new type2("tag:yaml.org,2002:pairs", {
        kind: "sequence",
        resolve: resolveYamlPairs,
        construct: constructYamlPairs
      });
      _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
      __name(resolveYamlSet, "resolveYamlSet");
      __name(constructYamlSet, "constructYamlSet");
      set3 = new type2("tag:yaml.org,2002:set", {
        kind: "mapping",
        resolve: resolveYamlSet,
        construct: constructYamlSet
      });
      _default = core.extend({
        implicit: [
          timestamp,
          merge2
        ],
        explicit: [
          binary,
          omap,
          pairs,
          set3
        ]
      });
      _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
      CONTEXT_FLOW_IN = 1;
      CONTEXT_FLOW_OUT = 2;
      CONTEXT_BLOCK_IN = 3;
      CONTEXT_BLOCK_OUT = 4;
      CHOMPING_CLIP = 1;
      CHOMPING_STRIP = 2;
      CHOMPING_KEEP = 3;
      PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
      PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
      PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
      PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
      PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
      __name(_class, "_class");
      __name(is_EOL, "is_EOL");
      __name(is_WHITE_SPACE, "is_WHITE_SPACE");
      __name(is_WS_OR_EOL, "is_WS_OR_EOL");
      __name(is_FLOW_INDICATOR, "is_FLOW_INDICATOR");
      __name(fromHexCode, "fromHexCode");
      __name(escapedHexLen, "escapedHexLen");
      __name(fromDecimalCode, "fromDecimalCode");
      __name(simpleEscapeSequence, "simpleEscapeSequence");
      __name(charFromCodepoint, "charFromCodepoint");
      __name(setProperty, "setProperty");
      simpleEscapeCheck = new Array(256);
      simpleEscapeMap = new Array(256);
      for (i2 = 0; i2 < 256; i2++) {
        simpleEscapeCheck[i2] = simpleEscapeSequence(i2) ? 1 : 0;
        simpleEscapeMap[i2] = simpleEscapeSequence(i2);
      }
      __name(State$1, "State$1");
      __name(generateError, "generateError");
      __name(throwError, "throwError");
      __name(throwWarning, "throwWarning");
      directiveHandlers = {
        YAML: /* @__PURE__ */ __name(function handleYamlDirective(state4, name, args) {
          var match2, major, minor;
          if (state4.version !== null) {
            throwError(state4, "duplication of %YAML directive");
          }
          if (args.length !== 1) {
            throwError(state4, "YAML directive accepts exactly one argument");
          }
          match2 = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
          if (match2 === null) {
            throwError(state4, "ill-formed argument of the YAML directive");
          }
          major = parseInt(match2[1], 10);
          minor = parseInt(match2[2], 10);
          if (major !== 1) {
            throwError(state4, "unacceptable YAML version of the document");
          }
          state4.version = args[0];
          state4.checkLineBreaks = minor < 2;
          if (minor !== 1 && minor !== 2) {
            throwWarning(state4, "unsupported YAML version of the document");
          }
        }, "handleYamlDirective"),
        TAG: /* @__PURE__ */ __name(function handleTagDirective(state4, name, args) {
          var handle, prefix;
          if (args.length !== 2) {
            throwError(state4, "TAG directive accepts exactly two arguments");
          }
          handle = args[0];
          prefix = args[1];
          if (!PATTERN_TAG_HANDLE.test(handle)) {
            throwError(state4, "ill-formed tag handle (first argument) of the TAG directive");
          }
          if (_hasOwnProperty$1.call(state4.tagMap, handle)) {
            throwError(state4, 'there is a previously declared suffix for "' + handle + '" tag handle');
          }
          if (!PATTERN_TAG_URI.test(prefix)) {
            throwError(state4, "ill-formed tag prefix (second argument) of the TAG directive");
          }
          try {
            prefix = decodeURIComponent(prefix);
          } catch (err) {
            throwError(state4, "tag prefix is malformed: " + prefix);
          }
          state4.tagMap[handle] = prefix;
        }, "handleTagDirective")
      };
      __name(captureSegment, "captureSegment");
      __name(mergeMappings, "mergeMappings");
      __name(storeMappingPair, "storeMappingPair");
      __name(readLineBreak, "readLineBreak");
      __name(skipSeparationSpace, "skipSeparationSpace");
      __name(testDocumentSeparator, "testDocumentSeparator");
      __name(writeFoldedLines, "writeFoldedLines");
      __name(readPlainScalar, "readPlainScalar");
      __name(readSingleQuotedScalar, "readSingleQuotedScalar");
      __name(readDoubleQuotedScalar, "readDoubleQuotedScalar");
      __name(readFlowCollection, "readFlowCollection");
      __name(readBlockScalar, "readBlockScalar");
      __name(readBlockSequence, "readBlockSequence");
      __name(readBlockMapping, "readBlockMapping");
      __name(readTagProperty, "readTagProperty");
      __name(readAnchorProperty, "readAnchorProperty");
      __name(readAlias, "readAlias");
      __name(composeNode, "composeNode");
      __name(readDocument, "readDocument");
      __name(loadDocuments, "loadDocuments");
      __name(loadAll$1, "loadAll$1");
      __name(load$1, "load$1");
      loadAll_1 = loadAll$1;
      load_1 = load$1;
      loader2 = {
        loadAll: loadAll_1,
        load: load_1
      };
      _toString = Object.prototype.toString;
      _hasOwnProperty = Object.prototype.hasOwnProperty;
      CHAR_BOM = 65279;
      CHAR_TAB = 9;
      CHAR_LINE_FEED = 10;
      CHAR_CARRIAGE_RETURN = 13;
      CHAR_SPACE = 32;
      CHAR_EXCLAMATION = 33;
      CHAR_DOUBLE_QUOTE = 34;
      CHAR_SHARP = 35;
      CHAR_PERCENT = 37;
      CHAR_AMPERSAND = 38;
      CHAR_SINGLE_QUOTE = 39;
      CHAR_ASTERISK = 42;
      CHAR_COMMA = 44;
      CHAR_MINUS = 45;
      CHAR_COLON = 58;
      CHAR_EQUALS = 61;
      CHAR_GREATER_THAN = 62;
      CHAR_QUESTION = 63;
      CHAR_COMMERCIAL_AT = 64;
      CHAR_LEFT_SQUARE_BRACKET = 91;
      CHAR_RIGHT_SQUARE_BRACKET = 93;
      CHAR_GRAVE_ACCENT = 96;
      CHAR_LEFT_CURLY_BRACKET = 123;
      CHAR_VERTICAL_LINE = 124;
      CHAR_RIGHT_CURLY_BRACKET = 125;
      ESCAPE_SEQUENCES = {};
      ESCAPE_SEQUENCES[0] = "\\0";
      ESCAPE_SEQUENCES[7] = "\\a";
      ESCAPE_SEQUENCES[8] = "\\b";
      ESCAPE_SEQUENCES[9] = "\\t";
      ESCAPE_SEQUENCES[10] = "\\n";
      ESCAPE_SEQUENCES[11] = "\\v";
      ESCAPE_SEQUENCES[12] = "\\f";
      ESCAPE_SEQUENCES[13] = "\\r";
      ESCAPE_SEQUENCES[27] = "\\e";
      ESCAPE_SEQUENCES[34] = '\\"';
      ESCAPE_SEQUENCES[92] = "\\\\";
      ESCAPE_SEQUENCES[133] = "\\N";
      ESCAPE_SEQUENCES[160] = "\\_";
      ESCAPE_SEQUENCES[8232] = "\\L";
      ESCAPE_SEQUENCES[8233] = "\\P";
      DEPRECATED_BOOLEANS_SYNTAX = [
        "y",
        "Y",
        "yes",
        "Yes",
        "YES",
        "on",
        "On",
        "ON",
        "n",
        "N",
        "no",
        "No",
        "NO",
        "off",
        "Off",
        "OFF"
      ];
      DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
      __name(compileStyleMap, "compileStyleMap");
      __name(encodeHex, "encodeHex");
      QUOTING_TYPE_SINGLE = 1;
      QUOTING_TYPE_DOUBLE = 2;
      __name(State, "State");
      __name(indentString, "indentString");
      __name(generateNextLine, "generateNextLine");
      __name(testImplicitResolving, "testImplicitResolving");
      __name(isWhitespace, "isWhitespace");
      __name(isPrintable, "isPrintable");
      __name(isNsCharOrWhitespace, "isNsCharOrWhitespace");
      __name(isPlainSafe, "isPlainSafe");
      __name(isPlainSafeFirst, "isPlainSafeFirst");
      __name(isPlainSafeLast, "isPlainSafeLast");
      __name(codePointAt, "codePointAt");
      __name(needIndentIndicator, "needIndentIndicator");
      STYLE_PLAIN = 1;
      STYLE_SINGLE = 2;
      STYLE_LITERAL = 3;
      STYLE_FOLDED = 4;
      STYLE_DOUBLE = 5;
      __name(chooseScalarStyle, "chooseScalarStyle");
      __name(writeScalar, "writeScalar");
      __name(blockHeader, "blockHeader");
      __name(dropEndingNewline, "dropEndingNewline");
      __name(foldString, "foldString");
      __name(foldLine, "foldLine");
      __name(escapeString, "escapeString");
      __name(writeFlowSequence, "writeFlowSequence");
      __name(writeBlockSequence, "writeBlockSequence");
      __name(writeFlowMapping, "writeFlowMapping");
      __name(writeBlockMapping, "writeBlockMapping");
      __name(detectType2, "detectType");
      __name(writeNode, "writeNode");
      __name(getDuplicateReferences, "getDuplicateReferences");
      __name(inspectNode, "inspectNode");
      __name(dump$1, "dump$1");
      dump_1 = dump$1;
      dumper = {
        dump: dump_1
      };
      __name(renamed, "renamed");
      JSON_SCHEMA = json;
      load = loader2.load;
      loadAll = loader2.loadAll;
      dump = dumper.dump;
      safeLoad = renamed("safeLoad", "load");
      safeLoadAll = renamed("safeLoadAll", "loadAll");
      safeDump = renamed("safeDump", "dump");
    }
  });

  // ../../node_modules/.pnpm/marked@16.3.0/node_modules/marked/lib/marked.esm.js
  function L() {
    return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
  }
  function G(l4) {
    O = l4;
  }
  function h(l4, e3 = "") {
    let t4 = typeof l4 == "string" ? l4 : l4.source, n2 = { replace: /* @__PURE__ */ __name((r2, i2) => {
      let s2 = typeof i2 == "string" ? i2 : i2.source;
      return s2 = s2.replace(m.caret, "$1"), t4 = t4.replace(r2, s2), n2;
    }, "replace"), getRegex: /* @__PURE__ */ __name(() => new RegExp(t4, e3), "getRegex") };
    return n2;
  }
  function w(l4, e3) {
    if (e3) {
      if (m.escapeTest.test(l4)) return l4.replace(m.escapeReplace, ke);
    } else if (m.escapeTestNoEncode.test(l4)) return l4.replace(m.escapeReplaceNoEncode, ke);
    return l4;
  }
  function J(l4) {
    try {
      l4 = encodeURI(l4).replace(m.percentDecode, "%");
    } catch {
      return null;
    }
    return l4;
  }
  function V(l4, e3) {
    let t4 = l4.replace(m.findPipe, (i2, s2, o2) => {
      let a2 = false, u2 = s2;
      for (; --u2 >= 0 && o2[u2] === "\\"; ) a2 = !a2;
      return a2 ? "|" : " |";
    }), n2 = t4.split(m.splitPipe), r2 = 0;
    if (n2[0].trim() || n2.shift(), n2.length > 0 && !n2.at(-1)?.trim() && n2.pop(), e3) if (n2.length > e3) n2.splice(e3);
    else for (; n2.length < e3; ) n2.push("");
    for (; r2 < n2.length; r2++) n2[r2] = n2[r2].trim().replace(m.slashPipe, "|");
    return n2;
  }
  function z(l4, e3, t4) {
    let n2 = l4.length;
    if (n2 === 0) return "";
    let r2 = 0;
    for (; r2 < n2; ) {
      let i2 = l4.charAt(n2 - r2 - 1);
      if (i2 === e3 && !t4) r2++;
      else if (i2 !== e3 && t4) r2++;
      else break;
    }
    return l4.slice(0, n2 - r2);
  }
  function ge(l4, e3) {
    if (l4.indexOf(e3[1]) === -1) return -1;
    let t4 = 0;
    for (let n2 = 0; n2 < l4.length; n2++) if (l4[n2] === "\\") n2++;
    else if (l4[n2] === e3[0]) t4++;
    else if (l4[n2] === e3[1] && (t4--, t4 < 0)) return n2;
    return t4 > 0 ? -2 : -1;
  }
  function fe(l4, e3, t4, n2, r2) {
    let i2 = e3.href, s2 = e3.title || null, o2 = l4[1].replace(r2.other.outputLinkReplace, "$1");
    n2.state.inLink = true;
    let a2 = { type: l4[0].charAt(0) === "!" ? "image" : "link", raw: t4, href: i2, title: s2, text: o2, tokens: n2.inlineTokens(o2) };
    return n2.state.inLink = false, a2;
  }
  function Je(l4, e3, t4) {
    let n2 = l4.match(t4.other.indentCodeCompensation);
    if (n2 === null) return e3;
    let r2 = n2[1];
    return e3.split(`
`).map((i2) => {
      let s2 = i2.match(t4.other.beginningSpace);
      if (s2 === null) return i2;
      let [o2] = s2;
      return o2.length >= r2.length ? i2.slice(r2.length) : i2;
    }).join(`
`);
  }
  function d(l4, e3) {
    return _.parse(l4, e3);
  }
  var O, E, m, xe, be, Re, C, Oe, j, se, ie, Te, F, we, Q, ye, Pe, v, U, Se, oe, $e, K2, re2, _e, Le, Me, ze, ae, Ae, D2, W, le, Ee, ue, Ce, Ie, Be, pe, qe, ve, ce, De, He, Ze, Ge, Ne, je, Fe, q, Qe, he, de, Ue, X2, Ke, N, We, I, M, Xe, ke, y2, b, P, $, R, S2, B, _, Dt, Ht, Zt, Gt, Nt, Ft, Qt;
  var init_marked_esm = __esm({
    "../../node_modules/.pnpm/marked@16.3.0/node_modules/marked/lib/marked.esm.js"() {
      "use strict";
      __name(L, "L");
      O = L();
      __name(G, "G");
      E = { exec: /* @__PURE__ */ __name(() => null, "exec") };
      __name(h, "h");
      m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: /* @__PURE__ */ __name((l4) => new RegExp(`^( {0,3}${l4})((?:[	 ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex: /* @__PURE__ */ __name((l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`), "nextBulletRegex"), hrRegex: /* @__PURE__ */ __name((l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), "hrRegex"), fencesBeginRegex: /* @__PURE__ */ __name((l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}(?:\`\`\`|~~~)`), "fencesBeginRegex"), headingBeginRegex: /* @__PURE__ */ __name((l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}#`), "headingBeginRegex"), htmlBeginRegex: /* @__PURE__ */ __name((l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}<(?:[a-z].*>|!--)`, "i"), "htmlBeginRegex") };
      xe = /^(?:[ \t]*(?:\n|$))+/;
      be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
      Re = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
      C = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
      Oe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
      j = /(?:[*+-]|\d{1,9}[.)])/;
      se = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
      ie = h(se).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
      Te = h(se).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
      F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
      we = /^[^\n]+/;
      Q = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
      ye = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Q).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
      Pe = h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, j).getRegex();
      v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
      U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
      Se = h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
      oe = h(F).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex();
      $e = h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oe).getRegex();
      K2 = { blockquote: $e, code: be, def: ye, fences: Re, heading: Oe, hr: C, html: Se, lheading: ie, list: Pe, newline: xe, paragraph: oe, table: E, text: we };
      re2 = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}	)[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex();
      _e = { ...K2, lheading: Te, table: re2, paragraph: h(F).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re2).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() };
      Le = { ...K2, html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: E, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: h(F).replace("hr", C).replace("heading", ` *#{1,6} *[^
]`).replace("lheading", ie).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
      Me = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
      ze = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
      ae = /^( {2,}|\\)\n(?!\s*$)/;
      Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
      D2 = /[\p{P}\p{S}]/u;
      W = /[\s\p{P}\p{S}]/u;
      le = /[^\s\p{P}\p{S}]/u;
      Ee = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, W).getRegex();
      ue = /(?!~)[\p{P}\p{S}]/u;
      Ce = /(?!~)[\s\p{P}\p{S}]/u;
      Ie = /(?:[^\s\p{P}\p{S}]|~)/u;
      Be = /\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g;
      pe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
      qe = h(pe, "u").replace(/punct/g, D2).getRegex();
      ve = h(pe, "u").replace(/punct/g, ue).getRegex();
      ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
      De = h(ce, "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, W).replace(/punct/g, D2).getRegex();
      He = h(ce, "gu").replace(/notPunctSpace/g, Ie).replace(/punctSpace/g, Ce).replace(/punct/g, ue).getRegex();
      Ze = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, W).replace(/punct/g, D2).getRegex();
      Ge = h(/\\(punct)/, "gu").replace(/punct/g, D2).getRegex();
      Ne = h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
      je = h(U).replace("(?:-->|$)", "-->").getRegex();
      Fe = h("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
      q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/;
      Qe = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
      he = h(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex();
      de = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex();
      Ue = h("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", de).getRegex();
      X2 = { _backpedal: E, anyPunctuation: Ge, autolink: Ne, blockSkip: Be, br: ae, code: ze, del: E, emStrongLDelim: qe, emStrongRDelimAst: De, emStrongRDelimUnd: Ze, escape: Me, link: Qe, nolink: de, punctuation: Ee, reflink: he, reflinkSearch: Ue, tag: Fe, text: Ae, url: E };
      Ke = { ...X2, link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() };
      N = { ...X2, emStrongRDelimAst: He, emStrongLDelim: ve, url: h(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/ };
      We = { ...N, br: h(ae).replace("{2,}", "*").getRegex(), text: h(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
      I = { normal: K2, gfm: _e, pedantic: Le };
      M = { normal: X2, gfm: N, breaks: We, pedantic: Ke };
      Xe = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
      ke = /* @__PURE__ */ __name((l4) => Xe[l4], "ke");
      __name(w, "w");
      __name(J, "J");
      __name(V, "V");
      __name(z, "z");
      __name(ge, "ge");
      __name(fe, "fe");
      __name(Je, "Je");
      y2 = class {
        static {
          __name(this, "y");
        }
        options;
        rules;
        lexer;
        constructor(e3) {
          this.options = e3 || O;
        }
        space(e3) {
          let t4 = this.rules.block.newline.exec(e3);
          if (t4 && t4[0].length > 0) return { type: "space", raw: t4[0] };
        }
        code(e3) {
          let t4 = this.rules.block.code.exec(e3);
          if (t4) {
            let n2 = t4[0].replace(this.rules.other.codeRemoveIndent, "");
            return { type: "code", raw: t4[0], codeBlockStyle: "indented", text: this.options.pedantic ? n2 : z(n2, `
`) };
          }
        }
        fences(e3) {
          let t4 = this.rules.block.fences.exec(e3);
          if (t4) {
            let n2 = t4[0], r2 = Je(n2, t4[3] || "", this.rules);
            return { type: "code", raw: n2, lang: t4[2] ? t4[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t4[2], text: r2 };
          }
        }
        heading(e3) {
          let t4 = this.rules.block.heading.exec(e3);
          if (t4) {
            let n2 = t4[2].trim();
            if (this.rules.other.endingHash.test(n2)) {
              let r2 = z(n2, "#");
              (this.options.pedantic || !r2 || this.rules.other.endingSpaceChar.test(r2)) && (n2 = r2.trim());
            }
            return { type: "heading", raw: t4[0], depth: t4[1].length, text: n2, tokens: this.lexer.inline(n2) };
          }
        }
        hr(e3) {
          let t4 = this.rules.block.hr.exec(e3);
          if (t4) return { type: "hr", raw: z(t4[0], `
`) };
        }
        blockquote(e3) {
          let t4 = this.rules.block.blockquote.exec(e3);
          if (t4) {
            let n2 = z(t4[0], `
`).split(`
`), r2 = "", i2 = "", s2 = [];
            for (; n2.length > 0; ) {
              let o2 = false, a2 = [], u2;
              for (u2 = 0; u2 < n2.length; u2++) if (this.rules.other.blockquoteStart.test(n2[u2])) a2.push(n2[u2]), o2 = true;
              else if (!o2) a2.push(n2[u2]);
              else break;
              n2 = n2.slice(u2);
              let p3 = a2.join(`
`), c3 = p3.replace(this.rules.other.blockquoteSetextReplace, `
    $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
              r2 = r2 ? `${r2}
${p3}` : p3, i2 = i2 ? `${i2}
${c3}` : c3;
              let f2 = this.lexer.state.top;
              if (this.lexer.state.top = true, this.lexer.blockTokens(c3, s2, true), this.lexer.state.top = f2, n2.length === 0) break;
              let k2 = s2.at(-1);
              if (k2?.type === "code") break;
              if (k2?.type === "blockquote") {
                let x5 = k2, g2 = x5.raw + `
` + n2.join(`
`), T3 = this.blockquote(g2);
                s2[s2.length - 1] = T3, r2 = r2.substring(0, r2.length - x5.raw.length) + T3.raw, i2 = i2.substring(0, i2.length - x5.text.length) + T3.text;
                break;
              } else if (k2?.type === "list") {
                let x5 = k2, g2 = x5.raw + `
` + n2.join(`
`), T3 = this.list(g2);
                s2[s2.length - 1] = T3, r2 = r2.substring(0, r2.length - k2.raw.length) + T3.raw, i2 = i2.substring(0, i2.length - x5.raw.length) + T3.raw, n2 = g2.substring(s2.at(-1).raw.length).split(`
`);
                continue;
              }
            }
            return { type: "blockquote", raw: r2, tokens: s2, text: i2 };
          }
        }
        list(e3) {
          let t4 = this.rules.block.list.exec(e3);
          if (t4) {
            let n2 = t4[1].trim(), r2 = n2.length > 1, i2 = { type: "list", raw: "", ordered: r2, start: r2 ? +n2.slice(0, -1) : "", loose: false, items: [] };
            n2 = r2 ? `\\d{1,9}\\${n2.slice(-1)}` : `\\${n2}`, this.options.pedantic && (n2 = r2 ? n2 : "[*+-]");
            let s2 = this.rules.other.listItemRegex(n2), o2 = false;
            for (; e3; ) {
              let u2 = false, p3 = "", c3 = "";
              if (!(t4 = s2.exec(e3)) || this.rules.block.hr.test(e3)) break;
              p3 = t4[0], e3 = e3.substring(p3.length);
              let f2 = t4[2].split(`
`, 1)[0].replace(this.rules.other.listReplaceTabs, (H2) => " ".repeat(3 * H2.length)), k2 = e3.split(`
`, 1)[0], x5 = !f2.trim(), g2 = 0;
              if (this.options.pedantic ? (g2 = 2, c3 = f2.trimStart()) : x5 ? g2 = t4[1].length + 1 : (g2 = t4[2].search(this.rules.other.nonSpaceChar), g2 = g2 > 4 ? 1 : g2, c3 = f2.slice(g2), g2 += t4[1].length), x5 && this.rules.other.blankLine.test(k2) && (p3 += k2 + `
`, e3 = e3.substring(k2.length + 1), u2 = true), !u2) {
                let H2 = this.rules.other.nextBulletRegex(g2), ee = this.rules.other.hrRegex(g2), te = this.rules.other.fencesBeginRegex(g2), ne = this.rules.other.headingBeginRegex(g2), me = this.rules.other.htmlBeginRegex(g2);
                for (; e3; ) {
                  let Z2 = e3.split(`
`, 1)[0], A2;
                  if (k2 = Z2, this.options.pedantic ? (k2 = k2.replace(this.rules.other.listReplaceNesting, "  "), A2 = k2) : A2 = k2.replace(this.rules.other.tabCharGlobal, "    "), te.test(k2) || ne.test(k2) || me.test(k2) || H2.test(k2) || ee.test(k2)) break;
                  if (A2.search(this.rules.other.nonSpaceChar) >= g2 || !k2.trim()) c3 += `
` + A2.slice(g2);
                  else {
                    if (x5 || f2.replace(this.rules.other.tabCharGlobal, "    ").search(this.rules.other.nonSpaceChar) >= 4 || te.test(f2) || ne.test(f2) || ee.test(f2)) break;
                    c3 += `
` + k2;
                  }
                  !x5 && !k2.trim() && (x5 = true), p3 += Z2 + `
`, e3 = e3.substring(Z2.length + 1), f2 = A2.slice(g2);
                }
              }
              i2.loose || (o2 ? i2.loose = true : this.rules.other.doubleBlankLine.test(p3) && (o2 = true));
              let T3 = null, Y3;
              this.options.gfm && (T3 = this.rules.other.listIsTask.exec(c3), T3 && (Y3 = T3[0] !== "[ ] ", c3 = c3.replace(this.rules.other.listReplaceTask, ""))), i2.items.push({ type: "list_item", raw: p3, task: !!T3, checked: Y3, loose: false, text: c3, tokens: [] }), i2.raw += p3;
            }
            let a2 = i2.items.at(-1);
            if (a2) a2.raw = a2.raw.trimEnd(), a2.text = a2.text.trimEnd();
            else return;
            i2.raw = i2.raw.trimEnd();
            for (let u2 = 0; u2 < i2.items.length; u2++) if (this.lexer.state.top = false, i2.items[u2].tokens = this.lexer.blockTokens(i2.items[u2].text, []), !i2.loose) {
              let p3 = i2.items[u2].tokens.filter((f2) => f2.type === "space"), c3 = p3.length > 0 && p3.some((f2) => this.rules.other.anyLine.test(f2.raw));
              i2.loose = c3;
            }
            if (i2.loose) for (let u2 = 0; u2 < i2.items.length; u2++) i2.items[u2].loose = true;
            return i2;
          }
        }
        html(e3) {
          let t4 = this.rules.block.html.exec(e3);
          if (t4) return { type: "html", block: true, raw: t4[0], pre: t4[1] === "pre" || t4[1] === "script" || t4[1] === "style", text: t4[0] };
        }
        def(e3) {
          let t4 = this.rules.block.def.exec(e3);
          if (t4) {
            let n2 = t4[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r2 = t4[2] ? t4[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i2 = t4[3] ? t4[3].substring(1, t4[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t4[3];
            return { type: "def", tag: n2, raw: t4[0], href: r2, title: i2 };
          }
        }
        table(e3) {
          let t4 = this.rules.block.table.exec(e3);
          if (!t4 || !this.rules.other.tableDelimiter.test(t4[2])) return;
          let n2 = V(t4[1]), r2 = t4[2].replace(this.rules.other.tableAlignChars, "").split("|"), i2 = t4[3]?.trim() ? t4[3].replace(this.rules.other.tableRowBlankLine, "").split(`
`) : [], s2 = { type: "table", raw: t4[0], header: [], align: [], rows: [] };
          if (n2.length === r2.length) {
            for (let o2 of r2) this.rules.other.tableAlignRight.test(o2) ? s2.align.push("right") : this.rules.other.tableAlignCenter.test(o2) ? s2.align.push("center") : this.rules.other.tableAlignLeft.test(o2) ? s2.align.push("left") : s2.align.push(null);
            for (let o2 = 0; o2 < n2.length; o2++) s2.header.push({ text: n2[o2], tokens: this.lexer.inline(n2[o2]), header: true, align: s2.align[o2] });
            for (let o2 of i2) s2.rows.push(V(o2, s2.header.length).map((a2, u2) => ({ text: a2, tokens: this.lexer.inline(a2), header: false, align: s2.align[u2] })));
            return s2;
          }
        }
        lheading(e3) {
          let t4 = this.rules.block.lheading.exec(e3);
          if (t4) return { type: "heading", raw: t4[0], depth: t4[2].charAt(0) === "=" ? 1 : 2, text: t4[1], tokens: this.lexer.inline(t4[1]) };
        }
        paragraph(e3) {
          let t4 = this.rules.block.paragraph.exec(e3);
          if (t4) {
            let n2 = t4[1].charAt(t4[1].length - 1) === `
` ? t4[1].slice(0, -1) : t4[1];
            return { type: "paragraph", raw: t4[0], text: n2, tokens: this.lexer.inline(n2) };
          }
        }
        text(e3) {
          let t4 = this.rules.block.text.exec(e3);
          if (t4) return { type: "text", raw: t4[0], text: t4[0], tokens: this.lexer.inline(t4[0]) };
        }
        escape(e3) {
          let t4 = this.rules.inline.escape.exec(e3);
          if (t4) return { type: "escape", raw: t4[0], text: t4[1] };
        }
        tag(e3) {
          let t4 = this.rules.inline.tag.exec(e3);
          if (t4) return !this.lexer.state.inLink && this.rules.other.startATag.test(t4[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t4[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t4[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t4[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t4[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t4[0] };
        }
        link(e3) {
          let t4 = this.rules.inline.link.exec(e3);
          if (t4) {
            let n2 = t4[2].trim();
            if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n2)) {
              if (!this.rules.other.endAngleBracket.test(n2)) return;
              let s2 = z(n2.slice(0, -1), "\\");
              if ((n2.length - s2.length) % 2 === 0) return;
            } else {
              let s2 = ge(t4[2], "()");
              if (s2 === -2) return;
              if (s2 > -1) {
                let a2 = (t4[0].indexOf("!") === 0 ? 5 : 4) + t4[1].length + s2;
                t4[2] = t4[2].substring(0, s2), t4[0] = t4[0].substring(0, a2).trim(), t4[3] = "";
              }
            }
            let r2 = t4[2], i2 = "";
            if (this.options.pedantic) {
              let s2 = this.rules.other.pedanticHrefTitle.exec(r2);
              s2 && (r2 = s2[1], i2 = s2[3]);
            } else i2 = t4[3] ? t4[3].slice(1, -1) : "";
            return r2 = r2.trim(), this.rules.other.startAngleBracket.test(r2) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n2) ? r2 = r2.slice(1) : r2 = r2.slice(1, -1)), fe(t4, { href: r2 && r2.replace(this.rules.inline.anyPunctuation, "$1"), title: i2 && i2.replace(this.rules.inline.anyPunctuation, "$1") }, t4[0], this.lexer, this.rules);
          }
        }
        reflink(e3, t4) {
          let n2;
          if ((n2 = this.rules.inline.reflink.exec(e3)) || (n2 = this.rules.inline.nolink.exec(e3))) {
            let r2 = (n2[2] || n2[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i2 = t4[r2.toLowerCase()];
            if (!i2) {
              let s2 = n2[0].charAt(0);
              return { type: "text", raw: s2, text: s2 };
            }
            return fe(n2, i2, n2[0], this.lexer, this.rules);
          }
        }
        emStrong(e3, t4, n2 = "") {
          let r2 = this.rules.inline.emStrongLDelim.exec(e3);
          if (!r2 || r2[3] && n2.match(this.rules.other.unicodeAlphaNumeric)) return;
          if (!(r2[1] || r2[2] || "") || !n2 || this.rules.inline.punctuation.exec(n2)) {
            let s2 = [...r2[0]].length - 1, o2, a2, u2 = s2, p3 = 0, c3 = r2[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
            for (c3.lastIndex = 0, t4 = t4.slice(-1 * e3.length + s2); (r2 = c3.exec(t4)) != null; ) {
              if (o2 = r2[1] || r2[2] || r2[3] || r2[4] || r2[5] || r2[6], !o2) continue;
              if (a2 = [...o2].length, r2[3] || r2[4]) {
                u2 += a2;
                continue;
              } else if ((r2[5] || r2[6]) && s2 % 3 && !((s2 + a2) % 3)) {
                p3 += a2;
                continue;
              }
              if (u2 -= a2, u2 > 0) continue;
              a2 = Math.min(a2, a2 + u2 + p3);
              let f2 = [...r2[0]][0].length, k2 = e3.slice(0, s2 + r2.index + f2 + a2);
              if (Math.min(s2, a2) % 2) {
                let g2 = k2.slice(1, -1);
                return { type: "em", raw: k2, text: g2, tokens: this.lexer.inlineTokens(g2) };
              }
              let x5 = k2.slice(2, -2);
              return { type: "strong", raw: k2, text: x5, tokens: this.lexer.inlineTokens(x5) };
            }
          }
        }
        codespan(e3) {
          let t4 = this.rules.inline.code.exec(e3);
          if (t4) {
            let n2 = t4[2].replace(this.rules.other.newLineCharGlobal, " "), r2 = this.rules.other.nonSpaceChar.test(n2), i2 = this.rules.other.startingSpaceChar.test(n2) && this.rules.other.endingSpaceChar.test(n2);
            return r2 && i2 && (n2 = n2.substring(1, n2.length - 1)), { type: "codespan", raw: t4[0], text: n2 };
          }
        }
        br(e3) {
          let t4 = this.rules.inline.br.exec(e3);
          if (t4) return { type: "br", raw: t4[0] };
        }
        del(e3) {
          let t4 = this.rules.inline.del.exec(e3);
          if (t4) return { type: "del", raw: t4[0], text: t4[2], tokens: this.lexer.inlineTokens(t4[2]) };
        }
        autolink(e3) {
          let t4 = this.rules.inline.autolink.exec(e3);
          if (t4) {
            let n2, r2;
            return t4[2] === "@" ? (n2 = t4[1], r2 = "mailto:" + n2) : (n2 = t4[1], r2 = n2), { type: "link", raw: t4[0], text: n2, href: r2, tokens: [{ type: "text", raw: n2, text: n2 }] };
          }
        }
        url(e3) {
          let t4;
          if (t4 = this.rules.inline.url.exec(e3)) {
            let n2, r2;
            if (t4[2] === "@") n2 = t4[0], r2 = "mailto:" + n2;
            else {
              let i2;
              do
                i2 = t4[0], t4[0] = this.rules.inline._backpedal.exec(t4[0])?.[0] ?? "";
              while (i2 !== t4[0]);
              n2 = t4[0], t4[1] === "www." ? r2 = "http://" + t4[0] : r2 = t4[0];
            }
            return { type: "link", raw: t4[0], text: n2, href: r2, tokens: [{ type: "text", raw: n2, text: n2 }] };
          }
        }
        inlineText(e3) {
          let t4 = this.rules.inline.text.exec(e3);
          if (t4) {
            let n2 = this.lexer.state.inRawBlock;
            return { type: "text", raw: t4[0], text: t4[0], escaped: n2 };
          }
        }
      };
      b = class l {
        static {
          __name(this, "l");
        }
        tokens;
        options;
        state;
        tokenizer;
        inlineQueue;
        constructor(e3) {
          this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e3 || O, this.options.tokenizer = this.options.tokenizer || new y2(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
          let t4 = { other: m, block: I.normal, inline: M.normal };
          this.options.pedantic ? (t4.block = I.pedantic, t4.inline = M.pedantic) : this.options.gfm && (t4.block = I.gfm, this.options.breaks ? t4.inline = M.breaks : t4.inline = M.gfm), this.tokenizer.rules = t4;
        }
        static get rules() {
          return { block: I, inline: M };
        }
        static lex(e3, t4) {
          return new l(t4).lex(e3);
        }
        static lexInline(e3, t4) {
          return new l(t4).inlineTokens(e3);
        }
        lex(e3) {
          e3 = e3.replace(m.carriageReturn, `
`), this.blockTokens(e3, this.tokens);
          for (let t4 = 0; t4 < this.inlineQueue.length; t4++) {
            let n2 = this.inlineQueue[t4];
            this.inlineTokens(n2.src, n2.tokens);
          }
          return this.inlineQueue = [], this.tokens;
        }
        blockTokens(e3, t4 = [], n2 = false) {
          for (this.options.pedantic && (e3 = e3.replace(m.tabCharGlobal, "    ").replace(m.spaceLine, "")); e3; ) {
            let r2;
            if (this.options.extensions?.block?.some((s2) => (r2 = s2.call({ lexer: this }, e3, t4)) ? (e3 = e3.substring(r2.raw.length), t4.push(r2), true) : false)) continue;
            if (r2 = this.tokenizer.space(e3)) {
              e3 = e3.substring(r2.raw.length);
              let s2 = t4.at(-1);
              r2.raw.length === 1 && s2 !== void 0 ? s2.raw += `
` : t4.push(r2);
              continue;
            }
            if (r2 = this.tokenizer.code(e3)) {
              e3 = e3.substring(r2.raw.length);
              let s2 = t4.at(-1);
              s2?.type === "paragraph" || s2?.type === "text" ? (s2.raw += (s2.raw.endsWith(`
`) ? "" : `
`) + r2.raw, s2.text += `
` + r2.text, this.inlineQueue.at(-1).src = s2.text) : t4.push(r2);
              continue;
            }
            if (r2 = this.tokenizer.fences(e3)) {
              e3 = e3.substring(r2.raw.length), t4.push(r2);
              continue;
            }
            if (r2 = this.tokenizer.heading(e3)) {
              e3 = e3.substring(r2.raw.length), t4.push(r2);
              continue;
            }
            if (r2 = this.tokenizer.hr(e3)) {
              e3 = e3.substring(r2.raw.length), t4.push(r2);
              continue;
            }
            if (r2 = this.tokenizer.blockquote(e3)) {
              e3 = e3.substring(r2.raw.length), t4.push(r2);
              continue;
            }
            if (r2 = this.tokenizer.list(e3)) {
              e3 = e3.substring(r2.raw.length), t4.push(r2);
              continue;
            }
            if (r2 = this.tokenizer.html(e3)) {
              e3 = e3.substring(r2.raw.length), t4.push(r2);
              continue;
            }
            if (r2 = this.tokenizer.def(e3)) {
              e3 = e3.substring(r2.raw.length);
              let s2 = t4.at(-1);
              s2?.type === "paragraph" || s2?.type === "text" ? (s2.raw += (s2.raw.endsWith(`
`) ? "" : `
`) + r2.raw, s2.text += `
` + r2.raw, this.inlineQueue.at(-1).src = s2.text) : this.tokens.links[r2.tag] || (this.tokens.links[r2.tag] = { href: r2.href, title: r2.title }, t4.push(r2));
              continue;
            }
            if (r2 = this.tokenizer.table(e3)) {
              e3 = e3.substring(r2.raw.length), t4.push(r2);
              continue;
            }
            if (r2 = this.tokenizer.lheading(e3)) {
              e3 = e3.substring(r2.raw.length), t4.push(r2);
              continue;
            }
            let i2 = e3;
            if (this.options.extensions?.startBlock) {
              let s2 = 1 / 0, o2 = e3.slice(1), a2;
              this.options.extensions.startBlock.forEach((u2) => {
                a2 = u2.call({ lexer: this }, o2), typeof a2 == "number" && a2 >= 0 && (s2 = Math.min(s2, a2));
              }), s2 < 1 / 0 && s2 >= 0 && (i2 = e3.substring(0, s2 + 1));
            }
            if (this.state.top && (r2 = this.tokenizer.paragraph(i2))) {
              let s2 = t4.at(-1);
              n2 && s2?.type === "paragraph" ? (s2.raw += (s2.raw.endsWith(`
`) ? "" : `
`) + r2.raw, s2.text += `
` + r2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s2.text) : t4.push(r2), n2 = i2.length !== e3.length, e3 = e3.substring(r2.raw.length);
              continue;
            }
            if (r2 = this.tokenizer.text(e3)) {
              e3 = e3.substring(r2.raw.length);
              let s2 = t4.at(-1);
              s2?.type === "text" ? (s2.raw += (s2.raw.endsWith(`
`) ? "" : `
`) + r2.raw, s2.text += `
` + r2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s2.text) : t4.push(r2);
              continue;
            }
            if (e3) {
              let s2 = "Infinite loop on byte: " + e3.charCodeAt(0);
              if (this.options.silent) {
                console.error(s2);
                break;
              } else throw new Error(s2);
            }
          }
          return this.state.top = true, t4;
        }
        inline(e3, t4 = []) {
          return this.inlineQueue.push({ src: e3, tokens: t4 }), t4;
        }
        inlineTokens(e3, t4 = []) {
          let n2 = e3, r2 = null;
          if (this.tokens.links) {
            let o2 = Object.keys(this.tokens.links);
            if (o2.length > 0) for (; (r2 = this.tokenizer.rules.inline.reflinkSearch.exec(n2)) != null; ) o2.includes(r2[0].slice(r2[0].lastIndexOf("[") + 1, -1)) && (n2 = n2.slice(0, r2.index) + "[" + "a".repeat(r2[0].length - 2) + "]" + n2.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
          }
          for (; (r2 = this.tokenizer.rules.inline.anyPunctuation.exec(n2)) != null; ) n2 = n2.slice(0, r2.index) + "++" + n2.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
          for (; (r2 = this.tokenizer.rules.inline.blockSkip.exec(n2)) != null; ) n2 = n2.slice(0, r2.index) + "[" + "a".repeat(r2[0].length - 2) + "]" + n2.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
          n2 = this.options.hooks?.emStrongMask?.call({ lexer: this }, n2) ?? n2;
          let i2 = false, s2 = "";
          for (; e3; ) {
            i2 || (s2 = ""), i2 = false;
            let o2;
            if (this.options.extensions?.inline?.some((u2) => (o2 = u2.call({ lexer: this }, e3, t4)) ? (e3 = e3.substring(o2.raw.length), t4.push(o2), true) : false)) continue;
            if (o2 = this.tokenizer.escape(e3)) {
              e3 = e3.substring(o2.raw.length), t4.push(o2);
              continue;
            }
            if (o2 = this.tokenizer.tag(e3)) {
              e3 = e3.substring(o2.raw.length), t4.push(o2);
              continue;
            }
            if (o2 = this.tokenizer.link(e3)) {
              e3 = e3.substring(o2.raw.length), t4.push(o2);
              continue;
            }
            if (o2 = this.tokenizer.reflink(e3, this.tokens.links)) {
              e3 = e3.substring(o2.raw.length);
              let u2 = t4.at(-1);
              o2.type === "text" && u2?.type === "text" ? (u2.raw += o2.raw, u2.text += o2.text) : t4.push(o2);
              continue;
            }
            if (o2 = this.tokenizer.emStrong(e3, n2, s2)) {
              e3 = e3.substring(o2.raw.length), t4.push(o2);
              continue;
            }
            if (o2 = this.tokenizer.codespan(e3)) {
              e3 = e3.substring(o2.raw.length), t4.push(o2);
              continue;
            }
            if (o2 = this.tokenizer.br(e3)) {
              e3 = e3.substring(o2.raw.length), t4.push(o2);
              continue;
            }
            if (o2 = this.tokenizer.del(e3)) {
              e3 = e3.substring(o2.raw.length), t4.push(o2);
              continue;
            }
            if (o2 = this.tokenizer.autolink(e3)) {
              e3 = e3.substring(o2.raw.length), t4.push(o2);
              continue;
            }
            if (!this.state.inLink && (o2 = this.tokenizer.url(e3))) {
              e3 = e3.substring(o2.raw.length), t4.push(o2);
              continue;
            }
            let a2 = e3;
            if (this.options.extensions?.startInline) {
              let u2 = 1 / 0, p3 = e3.slice(1), c3;
              this.options.extensions.startInline.forEach((f2) => {
                c3 = f2.call({ lexer: this }, p3), typeof c3 == "number" && c3 >= 0 && (u2 = Math.min(u2, c3));
              }), u2 < 1 / 0 && u2 >= 0 && (a2 = e3.substring(0, u2 + 1));
            }
            if (o2 = this.tokenizer.inlineText(a2)) {
              e3 = e3.substring(o2.raw.length), o2.raw.slice(-1) !== "_" && (s2 = o2.raw.slice(-1)), i2 = true;
              let u2 = t4.at(-1);
              u2?.type === "text" ? (u2.raw += o2.raw, u2.text += o2.text) : t4.push(o2);
              continue;
            }
            if (e3) {
              let u2 = "Infinite loop on byte: " + e3.charCodeAt(0);
              if (this.options.silent) {
                console.error(u2);
                break;
              } else throw new Error(u2);
            }
          }
          return t4;
        }
      };
      P = class {
        static {
          __name(this, "P");
        }
        options;
        parser;
        constructor(e3) {
          this.options = e3 || O;
        }
        space(e3) {
          return "";
        }
        code({ text: e3, lang: t4, escaped: n2 }) {
          let r2 = (t4 || "").match(m.notSpaceStart)?.[0], i2 = e3.replace(m.endingNewline, "") + `
`;
          return r2 ? '<pre><code class="language-' + w(r2) + '">' + (n2 ? i2 : w(i2, true)) + `</code></pre>
` : "<pre><code>" + (n2 ? i2 : w(i2, true)) + `</code></pre>
`;
        }
        blockquote({ tokens: e3 }) {
          return `<blockquote>
${this.parser.parse(e3)}</blockquote>
`;
        }
        html({ text: e3 }) {
          return e3;
        }
        def(e3) {
          return "";
        }
        heading({ tokens: e3, depth: t4 }) {
          return `<h${t4}>${this.parser.parseInline(e3)}</h${t4}>
`;
        }
        hr(e3) {
          return `<hr>
`;
        }
        list(e3) {
          let t4 = e3.ordered, n2 = e3.start, r2 = "";
          for (let o2 = 0; o2 < e3.items.length; o2++) {
            let a2 = e3.items[o2];
            r2 += this.listitem(a2);
          }
          let i2 = t4 ? "ol" : "ul", s2 = t4 && n2 !== 1 ? ' start="' + n2 + '"' : "";
          return "<" + i2 + s2 + `>
` + r2 + "</" + i2 + `>
`;
        }
        listitem(e3) {
          let t4 = "";
          if (e3.task) {
            let n2 = this.checkbox({ checked: !!e3.checked });
            e3.loose ? e3.tokens[0]?.type === "paragraph" ? (e3.tokens[0].text = n2 + " " + e3.tokens[0].text, e3.tokens[0].tokens && e3.tokens[0].tokens.length > 0 && e3.tokens[0].tokens[0].type === "text" && (e3.tokens[0].tokens[0].text = n2 + " " + w(e3.tokens[0].tokens[0].text), e3.tokens[0].tokens[0].escaped = true)) : e3.tokens.unshift({ type: "text", raw: n2 + " ", text: n2 + " ", escaped: true }) : t4 += n2 + " ";
          }
          return t4 += this.parser.parse(e3.tokens, !!e3.loose), `<li>${t4}</li>
`;
        }
        checkbox({ checked: e3 }) {
          return "<input " + (e3 ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
        }
        paragraph({ tokens: e3 }) {
          return `<p>${this.parser.parseInline(e3)}</p>
`;
        }
        table(e3) {
          let t4 = "", n2 = "";
          for (let i2 = 0; i2 < e3.header.length; i2++) n2 += this.tablecell(e3.header[i2]);
          t4 += this.tablerow({ text: n2 });
          let r2 = "";
          for (let i2 = 0; i2 < e3.rows.length; i2++) {
            let s2 = e3.rows[i2];
            n2 = "";
            for (let o2 = 0; o2 < s2.length; o2++) n2 += this.tablecell(s2[o2]);
            r2 += this.tablerow({ text: n2 });
          }
          return r2 && (r2 = `<tbody>${r2}</tbody>`), `<table>
<thead>
` + t4 + `</thead>
` + r2 + `</table>
`;
        }
        tablerow({ text: e3 }) {
          return `<tr>
${e3}</tr>
`;
        }
        tablecell(e3) {
          let t4 = this.parser.parseInline(e3.tokens), n2 = e3.header ? "th" : "td";
          return (e3.align ? `<${n2} align="${e3.align}">` : `<${n2}>`) + t4 + `</${n2}>
`;
        }
        strong({ tokens: e3 }) {
          return `<strong>${this.parser.parseInline(e3)}</strong>`;
        }
        em({ tokens: e3 }) {
          return `<em>${this.parser.parseInline(e3)}</em>`;
        }
        codespan({ text: e3 }) {
          return `<code>${w(e3, true)}</code>`;
        }
        br(e3) {
          return "<br>";
        }
        del({ tokens: e3 }) {
          return `<del>${this.parser.parseInline(e3)}</del>`;
        }
        link({ href: e3, title: t4, tokens: n2 }) {
          let r2 = this.parser.parseInline(n2), i2 = J(e3);
          if (i2 === null) return r2;
          e3 = i2;
          let s2 = '<a href="' + e3 + '"';
          return t4 && (s2 += ' title="' + w(t4) + '"'), s2 += ">" + r2 + "</a>", s2;
        }
        image({ href: e3, title: t4, text: n2, tokens: r2 }) {
          r2 && (n2 = this.parser.parseInline(r2, this.parser.textRenderer));
          let i2 = J(e3);
          if (i2 === null) return w(n2);
          e3 = i2;
          let s2 = `<img src="${e3}" alt="${n2}"`;
          return t4 && (s2 += ` title="${w(t4)}"`), s2 += ">", s2;
        }
        text(e3) {
          return "tokens" in e3 && e3.tokens ? this.parser.parseInline(e3.tokens) : "escaped" in e3 && e3.escaped ? e3.text : w(e3.text);
        }
      };
      $ = class {
        static {
          __name(this, "$");
        }
        strong({ text: e3 }) {
          return e3;
        }
        em({ text: e3 }) {
          return e3;
        }
        codespan({ text: e3 }) {
          return e3;
        }
        del({ text: e3 }) {
          return e3;
        }
        html({ text: e3 }) {
          return e3;
        }
        text({ text: e3 }) {
          return e3;
        }
        link({ text: e3 }) {
          return "" + e3;
        }
        image({ text: e3 }) {
          return "" + e3;
        }
        br() {
          return "";
        }
      };
      R = class l2 {
        static {
          __name(this, "l");
        }
        options;
        renderer;
        textRenderer;
        constructor(e3) {
          this.options = e3 || O, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
        }
        static parse(e3, t4) {
          return new l2(t4).parse(e3);
        }
        static parseInline(e3, t4) {
          return new l2(t4).parseInline(e3);
        }
        parse(e3, t4 = true) {
          let n2 = "";
          for (let r2 = 0; r2 < e3.length; r2++) {
            let i2 = e3[r2];
            if (this.options.extensions?.renderers?.[i2.type]) {
              let o2 = i2, a2 = this.options.extensions.renderers[o2.type].call({ parser: this }, o2);
              if (a2 !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(o2.type)) {
                n2 += a2 || "";
                continue;
              }
            }
            let s2 = i2;
            switch (s2.type) {
              case "space": {
                n2 += this.renderer.space(s2);
                continue;
              }
              case "hr": {
                n2 += this.renderer.hr(s2);
                continue;
              }
              case "heading": {
                n2 += this.renderer.heading(s2);
                continue;
              }
              case "code": {
                n2 += this.renderer.code(s2);
                continue;
              }
              case "table": {
                n2 += this.renderer.table(s2);
                continue;
              }
              case "blockquote": {
                n2 += this.renderer.blockquote(s2);
                continue;
              }
              case "list": {
                n2 += this.renderer.list(s2);
                continue;
              }
              case "html": {
                n2 += this.renderer.html(s2);
                continue;
              }
              case "def": {
                n2 += this.renderer.def(s2);
                continue;
              }
              case "paragraph": {
                n2 += this.renderer.paragraph(s2);
                continue;
              }
              case "text": {
                let o2 = s2, a2 = this.renderer.text(o2);
                for (; r2 + 1 < e3.length && e3[r2 + 1].type === "text"; ) o2 = e3[++r2], a2 += `
` + this.renderer.text(o2);
                t4 ? n2 += this.renderer.paragraph({ type: "paragraph", raw: a2, text: a2, tokens: [{ type: "text", raw: a2, text: a2, escaped: true }] }) : n2 += a2;
                continue;
              }
              default: {
                let o2 = 'Token with "' + s2.type + '" type was not found.';
                if (this.options.silent) return console.error(o2), "";
                throw new Error(o2);
              }
            }
          }
          return n2;
        }
        parseInline(e3, t4 = this.renderer) {
          let n2 = "";
          for (let r2 = 0; r2 < e3.length; r2++) {
            let i2 = e3[r2];
            if (this.options.extensions?.renderers?.[i2.type]) {
              let o2 = this.options.extensions.renderers[i2.type].call({ parser: this }, i2);
              if (o2 !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i2.type)) {
                n2 += o2 || "";
                continue;
              }
            }
            let s2 = i2;
            switch (s2.type) {
              case "escape": {
                n2 += t4.text(s2);
                break;
              }
              case "html": {
                n2 += t4.html(s2);
                break;
              }
              case "link": {
                n2 += t4.link(s2);
                break;
              }
              case "image": {
                n2 += t4.image(s2);
                break;
              }
              case "strong": {
                n2 += t4.strong(s2);
                break;
              }
              case "em": {
                n2 += t4.em(s2);
                break;
              }
              case "codespan": {
                n2 += t4.codespan(s2);
                break;
              }
              case "br": {
                n2 += t4.br(s2);
                break;
              }
              case "del": {
                n2 += t4.del(s2);
                break;
              }
              case "text": {
                n2 += t4.text(s2);
                break;
              }
              default: {
                let o2 = 'Token with "' + s2.type + '" type was not found.';
                if (this.options.silent) return console.error(o2), "";
                throw new Error(o2);
              }
            }
          }
          return n2;
        }
      };
      S2 = class {
        static {
          __name(this, "S");
        }
        options;
        block;
        constructor(e3) {
          this.options = e3 || O;
        }
        static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
        static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
        preprocess(e3) {
          return e3;
        }
        postprocess(e3) {
          return e3;
        }
        processAllTokens(e3) {
          return e3;
        }
        emStrongMask(e3) {
          return e3;
        }
        provideLexer() {
          return this.block ? b.lex : b.lexInline;
        }
        provideParser() {
          return this.block ? R.parse : R.parseInline;
        }
      };
      B = class {
        static {
          __name(this, "B");
        }
        defaults = L();
        options = this.setOptions;
        parse = this.parseMarkdown(true);
        parseInline = this.parseMarkdown(false);
        Parser = R;
        Renderer = P;
        TextRenderer = $;
        Lexer = b;
        Tokenizer = y2;
        Hooks = S2;
        constructor(...e3) {
          this.use(...e3);
        }
        walkTokens(e3, t4) {
          let n2 = [];
          for (let r2 of e3) switch (n2 = n2.concat(t4.call(this, r2)), r2.type) {
            case "table": {
              let i2 = r2;
              for (let s2 of i2.header) n2 = n2.concat(this.walkTokens(s2.tokens, t4));
              for (let s2 of i2.rows) for (let o2 of s2) n2 = n2.concat(this.walkTokens(o2.tokens, t4));
              break;
            }
            case "list": {
              let i2 = r2;
              n2 = n2.concat(this.walkTokens(i2.items, t4));
              break;
            }
            default: {
              let i2 = r2;
              this.defaults.extensions?.childTokens?.[i2.type] ? this.defaults.extensions.childTokens[i2.type].forEach((s2) => {
                let o2 = i2[s2].flat(1 / 0);
                n2 = n2.concat(this.walkTokens(o2, t4));
              }) : i2.tokens && (n2 = n2.concat(this.walkTokens(i2.tokens, t4)));
            }
          }
          return n2;
        }
        use(...e3) {
          let t4 = this.defaults.extensions || { renderers: {}, childTokens: {} };
          return e3.forEach((n2) => {
            let r2 = { ...n2 };
            if (r2.async = this.defaults.async || r2.async || false, n2.extensions && (n2.extensions.forEach((i2) => {
              if (!i2.name) throw new Error("extension name required");
              if ("renderer" in i2) {
                let s2 = t4.renderers[i2.name];
                s2 ? t4.renderers[i2.name] = function(...o2) {
                  let a2 = i2.renderer.apply(this, o2);
                  return a2 === false && (a2 = s2.apply(this, o2)), a2;
                } : t4.renderers[i2.name] = i2.renderer;
              }
              if ("tokenizer" in i2) {
                if (!i2.level || i2.level !== "block" && i2.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
                let s2 = t4[i2.level];
                s2 ? s2.unshift(i2.tokenizer) : t4[i2.level] = [i2.tokenizer], i2.start && (i2.level === "block" ? t4.startBlock ? t4.startBlock.push(i2.start) : t4.startBlock = [i2.start] : i2.level === "inline" && (t4.startInline ? t4.startInline.push(i2.start) : t4.startInline = [i2.start]));
              }
              "childTokens" in i2 && i2.childTokens && (t4.childTokens[i2.name] = i2.childTokens);
            }), r2.extensions = t4), n2.renderer) {
              let i2 = this.defaults.renderer || new P(this.defaults);
              for (let s2 in n2.renderer) {
                if (!(s2 in i2)) throw new Error(`renderer '${s2}' does not exist`);
                if (["options", "parser"].includes(s2)) continue;
                let o2 = s2, a2 = n2.renderer[o2], u2 = i2[o2];
                i2[o2] = (...p3) => {
                  let c3 = a2.apply(i2, p3);
                  return c3 === false && (c3 = u2.apply(i2, p3)), c3 || "";
                };
              }
              r2.renderer = i2;
            }
            if (n2.tokenizer) {
              let i2 = this.defaults.tokenizer || new y2(this.defaults);
              for (let s2 in n2.tokenizer) {
                if (!(s2 in i2)) throw new Error(`tokenizer '${s2}' does not exist`);
                if (["options", "rules", "lexer"].includes(s2)) continue;
                let o2 = s2, a2 = n2.tokenizer[o2], u2 = i2[o2];
                i2[o2] = (...p3) => {
                  let c3 = a2.apply(i2, p3);
                  return c3 === false && (c3 = u2.apply(i2, p3)), c3;
                };
              }
              r2.tokenizer = i2;
            }
            if (n2.hooks) {
              let i2 = this.defaults.hooks || new S2();
              for (let s2 in n2.hooks) {
                if (!(s2 in i2)) throw new Error(`hook '${s2}' does not exist`);
                if (["options", "block"].includes(s2)) continue;
                let o2 = s2, a2 = n2.hooks[o2], u2 = i2[o2];
                S2.passThroughHooks.has(s2) ? i2[o2] = (p3) => {
                  if (this.defaults.async && S2.passThroughHooksRespectAsync.has(s2)) return Promise.resolve(a2.call(i2, p3)).then((f2) => u2.call(i2, f2));
                  let c3 = a2.call(i2, p3);
                  return u2.call(i2, c3);
                } : i2[o2] = (...p3) => {
                  let c3 = a2.apply(i2, p3);
                  return c3 === false && (c3 = u2.apply(i2, p3)), c3;
                };
              }
              r2.hooks = i2;
            }
            if (n2.walkTokens) {
              let i2 = this.defaults.walkTokens, s2 = n2.walkTokens;
              r2.walkTokens = function(o2) {
                let a2 = [];
                return a2.push(s2.call(this, o2)), i2 && (a2 = a2.concat(i2.call(this, o2))), a2;
              };
            }
            this.defaults = { ...this.defaults, ...r2 };
          }), this;
        }
        setOptions(e3) {
          return this.defaults = { ...this.defaults, ...e3 }, this;
        }
        lexer(e3, t4) {
          return b.lex(e3, t4 ?? this.defaults);
        }
        parser(e3, t4) {
          return R.parse(e3, t4 ?? this.defaults);
        }
        parseMarkdown(e3) {
          return (n2, r2) => {
            let i2 = { ...r2 }, s2 = { ...this.defaults, ...i2 }, o2 = this.onError(!!s2.silent, !!s2.async);
            if (this.defaults.async === true && i2.async === false) return o2(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
            if (typeof n2 > "u" || n2 === null) return o2(new Error("marked(): input parameter is undefined or null"));
            if (typeof n2 != "string") return o2(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n2) + ", string expected"));
            s2.hooks && (s2.hooks.options = s2, s2.hooks.block = e3);
            let a2 = s2.hooks ? s2.hooks.provideLexer() : e3 ? b.lex : b.lexInline, u2 = s2.hooks ? s2.hooks.provideParser() : e3 ? R.parse : R.parseInline;
            if (s2.async) return Promise.resolve(s2.hooks ? s2.hooks.preprocess(n2) : n2).then((p3) => a2(p3, s2)).then((p3) => s2.hooks ? s2.hooks.processAllTokens(p3) : p3).then((p3) => s2.walkTokens ? Promise.all(this.walkTokens(p3, s2.walkTokens)).then(() => p3) : p3).then((p3) => u2(p3, s2)).then((p3) => s2.hooks ? s2.hooks.postprocess(p3) : p3).catch(o2);
            try {
              s2.hooks && (n2 = s2.hooks.preprocess(n2));
              let p3 = a2(n2, s2);
              s2.hooks && (p3 = s2.hooks.processAllTokens(p3)), s2.walkTokens && this.walkTokens(p3, s2.walkTokens);
              let c3 = u2(p3, s2);
              return s2.hooks && (c3 = s2.hooks.postprocess(c3)), c3;
            } catch (p3) {
              return o2(p3);
            }
          };
        }
        onError(e3, t4) {
          return (n2) => {
            if (n2.message += `
Please report this to https://github.com/markedjs/marked.`, e3) {
              let r2 = "<p>An error occurred:</p><pre>" + w(n2.message + "", true) + "</pre>";
              return t4 ? Promise.resolve(r2) : r2;
            }
            if (t4) return Promise.reject(n2);
            throw n2;
          };
        }
      };
      _ = new B();
      __name(d, "d");
      d.options = d.setOptions = function(l4) {
        return _.setOptions(l4), d.defaults = _.defaults, G(d.defaults), d;
      };
      d.getDefaults = L;
      d.defaults = O;
      d.use = function(...l4) {
        return _.use(...l4), d.defaults = _.defaults, G(d.defaults), d;
      };
      d.walkTokens = function(l4, e3) {
        return _.walkTokens(l4, e3);
      };
      d.parseInline = _.parseInline;
      d.Parser = R;
      d.parser = R.parse;
      d.Renderer = P;
      d.TextRenderer = $;
      d.Lexer = b;
      d.lexer = b.lex;
      d.Tokenizer = y2;
      d.Hooks = S2;
      d.parse = d;
      Dt = d.options;
      Ht = d.setOptions;
      Zt = d.use;
      Gt = d.walkTokens;
      Nt = d.parseInline;
      Ft = R.parse;
      Qt = b.lex;
    }
  });

  // src/rendering-util/handle-markdown-text.ts
  function preprocessMarkdown(markdown, { markdownAutoWrap }) {
    const withoutBR = markdown.replace(/<br\/>/g, "\n");
    const withoutMultipleNewlines = withoutBR.replace(/\n{2,}/g, "\n");
    const withoutExtraSpaces = dedent(withoutMultipleNewlines);
    if (markdownAutoWrap === false) {
    }
    return withoutExtraSpaces;
  }
  function nonMarkdownToLines(nonMarkdownText) {
    return nonMarkdownText.split(/\\n|\n|<br\s*\/?>/gi).map(
      (line2) => line2.trim().match(/<[^>]+>|[^\s<>]+/g)?.map((word) => ({ content: word, type: "normal" })) ?? []
    );
  }
  function markdownToLines(markdown, config5 = {}) {
    const preprocessedMarkdown = preprocessMarkdown(markdown, config5);
    const nodes5 = d.lexer(preprocessedMarkdown);
    const lines = [[]];
    let currentLine = 0;
    function processNode(node2, parentType = "normal") {
      if (node2.type === "text") {
        const textLines = node2.text.split("\n");
        textLines.forEach((textLine, index) => {
          if (index !== 0) {
            currentLine++;
            lines.push([]);
          }
          textLine.split(" ").forEach((word) => {
            word = word.replace(/&#39;/g, `'`);
            if (word) {
              lines[currentLine].push({ content: word, type: parentType });
            }
          });
        });
      } else if (node2.type === "strong" || node2.type === "em") {
        node2.tokens.forEach((contentNode) => {
          processNode(contentNode, node2.type);
        });
      } else if (node2.type === "html") {
        lines[currentLine].push({ content: node2.text, type: "normal" });
      }
    }
    __name(processNode, "processNode");
    nodes5.forEach((treeNode) => {
      if (treeNode.type === "paragraph") {
        treeNode.tokens?.forEach((contentNode) => {
          processNode(contentNode);
        });
      } else if (treeNode.type === "html") {
        lines[currentLine].push({ content: treeNode.text, type: "normal" });
      } else {
        lines[currentLine].push({ content: treeNode.raw, type: "normal" });
      }
    });
    return lines;
  }
  function nonMarkdownToHTML(text4) {
    if (!text4) {
      return "";
    }
    return `<p>${/**
     * Replace new lines with <br /> tags.
     *
     * Unlike in markdown text, `\n` sequences are treated as line breaks here.
     */
    text4.replace(/\\n|\n/g, "<br />")}</p>`;
  }
  function markdownToHTML(markdown, { markdownAutoWrap } = {}) {
    const nodes5 = d.lexer(markdown);
    function output2(node2) {
      if (node2.type === "text") {
        if (markdownAutoWrap === false) {
          return node2.text.replace(/\n */g, "<br/>").replace(/ /g, "&nbsp;");
        }
        return node2.text.replace(/\n */g, "<br/>");
      } else if (node2.type === "strong") {
        return `<strong>${node2.tokens?.map(output2).join("")}</strong>`;
      } else if (node2.type === "em") {
        return `<em>${node2.tokens?.map(output2).join("")}</em>`;
      } else if (node2.type === "paragraph") {
        return `<p>${node2.tokens?.map(output2).join("")}</p>`;
      } else if (node2.type === "space") {
        return "";
      } else if (node2.type === "html") {
        return `${node2.text}`;
      } else if (node2.type === "escape") {
        return node2.text;
      }
      log.warn(`Unsupported markdown: ${node2.type}`);
      return node2.raw;
    }
    __name(output2, "output");
    return nodes5.map(output2).join("");
  }
  var init_handle_markdown_text = __esm({
    "src/rendering-util/handle-markdown-text.ts"() {
      "use strict";
      init_marked_esm();
      init_esm();
      init_logger();
      __name(preprocessMarkdown, "preprocessMarkdown");
      __name(nonMarkdownToLines, "nonMarkdownToLines");
      __name(markdownToLines, "markdownToLines");
      __name(nonMarkdownToHTML, "nonMarkdownToHTML");
      __name(markdownToHTML, "markdownToHTML");
    }
  });

  // src/rendering-util/splitText.ts
  function splitTextToChars(text4) {
    if (Intl.Segmenter) {
      return [...new Intl.Segmenter().segment(text4)].map((s2) => s2.segment);
    }
    return [...text4];
  }
  function splitWordToFitWidth(checkFit, word) {
    const characters2 = splitTextToChars(word.content);
    return splitWordToFitWidthRecursion(checkFit, [], characters2, word.type);
  }
  function splitWordToFitWidthRecursion(checkFit, usedChars, remainingChars, type3) {
    if (remainingChars.length === 0) {
      return [
        { content: usedChars.join(""), type: type3 },
        { content: "", type: type3 }
      ];
    }
    const [nextChar, ...rest] = remainingChars;
    const newWord = [...usedChars, nextChar];
    if (checkFit([{ content: newWord.join(""), type: type3 }])) {
      return splitWordToFitWidthRecursion(checkFit, newWord, rest, type3);
    }
    if (usedChars.length === 0 && nextChar) {
      usedChars.push(nextChar);
      remainingChars.shift();
    }
    return [
      { content: usedChars.join(""), type: type3 },
      { content: remainingChars.join(""), type: type3 }
    ];
  }
  function splitLineToFitWidth(line2, checkFit) {
    if (line2.some(({ content }) => content.includes("\n"))) {
      throw new Error("splitLineToFitWidth does not support newlines in the line");
    }
    return splitLineToFitWidthRecursion(line2, checkFit);
  }
  function splitLineToFitWidthRecursion(words, checkFit, lines = [], newLine = []) {
    if (words.length === 0) {
      if (newLine.length > 0) {
        lines.push(newLine);
      }
      return lines.length > 0 ? lines : [];
    }
    let joiner = "";
    if (words[0].content === " ") {
      joiner = " ";
      words.shift();
    }
    const nextWord = words.shift() ?? { content: " ", type: "normal" };
    const lineWithNextWord = [...newLine];
    if (joiner !== "") {
      lineWithNextWord.push({ content: joiner, type: "normal" });
    }
    lineWithNextWord.push(nextWord);
    if (checkFit(lineWithNextWord)) {
      return splitLineToFitWidthRecursion(words, checkFit, lines, lineWithNextWord);
    }
    if (newLine.length > 0) {
      lines.push(newLine);
      words.unshift(nextWord);
    } else if (nextWord.content) {
      const [line2, rest] = splitWordToFitWidth(checkFit, nextWord);
      lines.push([line2]);
      if (rest.content) {
        words.unshift(rest);
      }
    }
    return splitLineToFitWidthRecursion(words, checkFit, lines);
  }
  var init_splitText = __esm({
    "src/rendering-util/splitText.ts"() {
      "use strict";
      __name(splitTextToChars, "splitTextToChars");
      __name(splitWordToFitWidth, "splitWordToFitWidth");
      __name(splitWordToFitWidthRecursion, "splitWordToFitWidthRecursion");
      __name(splitLineToFitWidth, "splitLineToFitWidth");
      __name(splitLineToFitWidthRecursion, "splitLineToFitWidthRecursion");
    }
  });

  // src/rendering-util/createText.ts
  function applyStyle(dom, styleFn) {
    if (styleFn) {
      dom.attr("style", styleFn);
    }
  }
  async function addHtmlSpan(element3, node2, width3, classes3, addBackground = false, config5 = getConfig()) {
    const fo = element3.append("foreignObject");
    fo.attr("width", `${Math.min(10 * width3, maxSafeSizeForWidth)}px`);
    fo.attr("height", `${Math.min(10 * width3, maxSafeSizeForWidth)}px`);
    const div = fo.append("xhtml:div");
    const sanitizedLabel = hasKatex(node2.label) ? await renderKatexSanitized(node2.label.replace(common_default.lineBreakRegex, "\n"), config5) : sanitizeText(node2.label, config5);
    const labelClass = node2.isNode ? "nodeLabel" : "edgeLabel";
    const span = div.append("span");
    span.html(sanitizedLabel);
    applyStyle(span, node2.labelStyle);
    span.attr("class", `${labelClass} ${classes3}`);
    applyStyle(div, node2.labelStyle);
    div.style("display", "table-cell");
    div.style("white-space", "nowrap");
    div.style("line-height", "1.5");
    if (width3 !== Number.POSITIVE_INFINITY) {
      div.style("max-width", width3 + "px");
      div.style("text-align", "center");
    }
    div.attr("xmlns", "http://www.w3.org/1999/xhtml");
    if (addBackground) {
      div.attr("class", "labelBkg");
    }
    let bbox = div.node().getBoundingClientRect();
    if (bbox.width === width3) {
      div.style("display", "table");
      div.style("white-space", "break-spaces");
      div.style("width", width3 + "px");
      bbox = div.node().getBoundingClientRect();
    }
    return fo.node();
  }
  function createTspan(textElement, lineIndex, lineHeight, centerText = false) {
    const tspan = textElement.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", lineIndex * lineHeight - 0.1 + "em").attr("dy", lineHeight + "em");
    if (centerText) {
      tspan.attr("text-anchor", "middle");
    }
    return tspan;
  }
  function computeWidthOfText(parentNode, lineHeight, line2) {
    const testElement = parentNode.append("text");
    const testSpan = createTspan(testElement, 1, lineHeight);
    updateTextContentAndStyles(testSpan, line2);
    const textLength = testSpan.node().getComputedTextLength();
    testElement.remove();
    return textLength;
  }
  function computeDimensionOfText(parentNode, lineHeight, text4) {
    const testElement = parentNode.append("text");
    const testSpan = createTspan(testElement, 1, lineHeight);
    updateTextContentAndStyles(testSpan, [{ content: text4, type: "normal" }]);
    const textDimension = testSpan.node()?.getBoundingClientRect();
    if (textDimension) {
      testElement.remove();
    }
    return textDimension;
  }
  function createFormattedText(width3, g2, structuredText, addBackground = false, centerText = false) {
    const lineHeight = 1.1;
    const labelGroup = g2.append("g");
    const bkg = labelGroup.insert("rect").attr("class", "background").attr("style", "stroke: none");
    const textElement = labelGroup.append("text").attr("y", "-10.1");
    if (centerText) {
      textElement.attr("text-anchor", "middle");
    }
    let lineIndex = 0;
    for (const line2 of structuredText) {
      const checkWidth = /* @__PURE__ */ __name((line3) => computeWidthOfText(labelGroup, lineHeight, line3) <= width3, "checkWidth");
      const linesUnderWidth = checkWidth(line2) ? [line2] : splitLineToFitWidth(line2, checkWidth);
      for (const preparedLine of linesUnderWidth) {
        const tspan = createTspan(textElement, lineIndex, lineHeight, centerText);
        updateTextContentAndStyles(tspan, preparedLine);
        lineIndex++;
      }
    }
    if (addBackground) {
      const bbox = textElement.node().getBBox();
      const padding2 = 2;
      bkg.attr("x", bbox.x - padding2).attr("y", bbox.y - padding2).attr("width", bbox.width + 2 * padding2).attr("height", bbox.height + 2 * padding2);
      return labelGroup.node();
    } else {
      return textElement.node();
    }
  }
  function decodeHTMLEntities(text4) {
    const regex2 = /&(amp|lt|gt);/g;
    return text4.replace(regex2, (match2, entity) => {
      switch (entity) {
        case "amp":
          return "&";
        case "lt":
          return "<";
        case "gt":
          return ">";
        default:
          return match2;
      }
    });
  }
  function updateTextContentAndStyles(tspan, wrappedLine) {
    tspan.text("");
    wrappedLine.forEach((word, index) => {
      const innerTspan = tspan.append("tspan").attr("font-style", word.type === "em" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", word.type === "strong" ? "bold" : "normal");
      if (index === 0) {
        innerTspan.text(decodeHTMLEntities(word.content));
      } else {
        innerTspan.text(" " + decodeHTMLEntities(word.content));
      }
    });
  }
  async function replaceIconSubstring(text4, config5 = {}) {
    const pendingReplacements = [];
    text4.replace(/(fa[bklrs]?):fa-([\w-]+)/g, (fullMatch, prefix, iconName) => {
      pendingReplacements.push(
        (async () => {
          const registeredIconName = `${prefix}:${iconName}`;
          if (await isIconAvailable(registeredIconName)) {
            return await getIconSVG(registeredIconName, void 0, { class: "label-icon" });
          } else {
            return `<i class='${sanitizeText(fullMatch, config5).replace(":", " ")}'></i>`;
          }
        })()
      );
      return fullMatch;
    });
    const replacements = await Promise.all(pendingReplacements);
    return text4.replace(/(fa[bklrs]?):fa-([\w-]+)/g, () => replacements.shift() ?? "");
  }
  var maxSafeSizeForWidth, createText;
  var init_createText = __esm({
    "src/rendering-util/createText.ts"() {
      "use strict";
      init_src32();
      init_common();
      init_logger();
      init_handle_markdown_text();
      init_utils2();
      init_icons();
      init_splitText();
      init_config();
      __name(applyStyle, "applyStyle");
      maxSafeSizeForWidth = 16384;
      __name(addHtmlSpan, "addHtmlSpan");
      __name(createTspan, "createTspan");
      __name(computeWidthOfText, "computeWidthOfText");
      __name(computeDimensionOfText, "computeDimensionOfText");
      __name(createFormattedText, "createFormattedText");
      __name(decodeHTMLEntities, "decodeHTMLEntities");
      __name(updateTextContentAndStyles, "updateTextContentAndStyles");
      __name(replaceIconSubstring, "replaceIconSubstring");
      createText = /* @__PURE__ */ __name(async (el, text4 = "", {
        style: style3 = "",
        isTitle = false,
        classes: classes3 = "",
        useHtmlLabels = true,
        markdown = true,
        isNode: isNode2 = true,
        /**
         * The width to wrap the text within. Set to `Number.POSITIVE_INFINITY` for no wrapping.
         */
        width: width3 = 200,
        addSvgBackground = false
      } = {}, config5) => {
        log.debug(
          "XYZ createText",
          text4,
          style3,
          isTitle,
          classes3,
          useHtmlLabels,
          isNode2,
          "addSvgBackground: ",
          addSvgBackground
        );
        if (useHtmlLabels) {
          const htmlText = markdown ? markdownToHTML(text4, config5) : nonMarkdownToHTML(text4);
          const decodedReplacedText = await replaceIconSubstring(decodeEntities(htmlText), config5);
          const inputForKatex = text4.replace(/\\\\/g, "\\");
          const node2 = {
            isNode: isNode2,
            label: hasKatex(text4) ? inputForKatex : decodedReplacedText,
            labelStyle: style3.replace("fill:", "color:")
          };
          const vertexNode = await addHtmlSpan(el, node2, width3, classes3, addSvgBackground, config5);
          return vertexNode;
        } else {
          const sanitizeBR = decodeEntities(text4.replace(/<br\s*\/?>/g, "<br/>"));
          const structuredText = markdown ? markdownToLines(sanitizeBR.replace("<br>", "<br/>"), config5) : nonMarkdownToLines(sanitizeBR);
          const svgLabel = createFormattedText(
            width3,
            el,
            structuredText,
            text4 ? addSvgBackground : false,
            !isNode2
          );
          if (isNode2) {
            if (/stroke:/.exec(style3)) {
              style3 = style3.replace("stroke:", "lineColor:");
            }
            const nodeLabelTextStyle = style3.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
            select_default2(svgLabel).attr("style", nodeLabelTextStyle);
          } else {
            const edgeLabelRectStyle = style3.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/background:/g, "fill:");
            select_default2(svgLabel).select("rect").attr("style", edgeLabelRectStyle.replace(/background:/g, "fill:"));
            const edgeLabelTextStyle = style3.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
            select_default2(svgLabel).select("text").attr("style", edgeLabelTextStyle);
          }
          if (isTitle) {
            select_default2(svgLabel).selectAll("tspan.text-outer-tspan").classed("title-row", true);
          } else {
            select_default2(svgLabel).selectAll("tspan.text-outer-tspan").classed("row", true);
          }
          return svgLabel;
        }
      }, "createText");
    }
  });

  // src/rendering-util/rendering-elements/shapes/labelImageUtils.ts
  async function configureLabelImages(container2, labelText) {
    const images = container2.getElementsByTagName("img");
    if (!images || images.length === 0) {
      return;
    }
    const noImgText = labelText.replace(/<img[^>]*>/g, "").trim() === "";
    await Promise.all(
      [...images].map(
        (img) => new Promise((res) => {
          function setupImage() {
            img.style.display = "flex";
            img.style.flexDirection = "column";
            if (noImgText) {
              const bodyFontSize = getConfig2().fontSize ? getConfig2().fontSize : window.getComputedStyle(document.body).fontSize;
              const enlargingFactor = 5;
              const [parsedBodyFontSize = defaultConfig_default.fontSize] = parseFontSize(bodyFontSize);
              const width3 = parsedBodyFontSize * enlargingFactor + "px";
              img.style.minWidth = width3;
              img.style.maxWidth = width3;
            } else {
              img.style.width = "100%";
            }
            res(img);
          }
          __name(setupImage, "setupImage");
          setTimeout(() => {
            if (img.complete) {
              setupImage();
            }
          });
          img.addEventListener("error", setupImage);
          img.addEventListener("load", setupImage);
        })
      )
    );
  }
  var init_labelImageUtils = __esm({
    "src/rendering-util/rendering-elements/shapes/labelImageUtils.ts"() {
      "use strict";
      init_diagramAPI();
      init_defaultConfig();
      init_utils2();
      __name(configureLabelImages, "configureLabelImages");
    }
  });

  // src/rendering-util/rendering-elements/shapes/util.ts
  function createPathFromPoints(points) {
    const pointStrings = points.map((p3, i2) => `${i2 === 0 ? "M" : "L"}${p3.x},${p3.y}`);
    pointStrings.push("Z");
    return pointStrings.join(" ");
  }
  function generateFullSineWavePoints(x1, y1, x22, y22, amplitude, numCycles) {
    const points = [];
    const steps = 50;
    const deltaX = x22 - x1;
    const deltaY = y22 - y1;
    const cycleLength = deltaX / numCycles;
    const frequency = 2 * Math.PI / cycleLength;
    const midY = y1 + deltaY / 2;
    for (let i2 = 0; i2 <= steps; i2++) {
      const t4 = i2 / steps;
      const x5 = x1 + t4 * deltaX;
      const y6 = midY + amplitude * Math.sin(frequency * (x5 - x1));
      points.push({ x: x5, y: y6 });
    }
    return points;
  }
  function generateCirclePoints(centerX, centerY, radius2, numPoints, startAngle, endAngle) {
    const points = [];
    const startAngleRad = startAngle * Math.PI / 180;
    const endAngleRad = endAngle * Math.PI / 180;
    const angleRange = endAngleRad - startAngleRad;
    const angleStep = angleRange / (numPoints - 1);
    for (let i2 = 0; i2 < numPoints; i2++) {
      const angle2 = startAngleRad + i2 * angleStep;
      const x5 = centerX + radius2 * Math.cos(angle2);
      const y6 = centerY + radius2 * Math.sin(angle2);
      points.push({ x: -x5, y: -y6 });
    }
    return points;
  }
  function mergePaths(roughElement) {
    const paths = Array.from(roughElement.childNodes).filter(
      (node2) => node2.tagName === "path"
    );
    const mergedPath = document.createElementNS("http://www.w3.org/2000/svg", "path");
    const combinedPathData = paths.map((path4) => path4.getAttribute("d")).filter((d3) => d3 !== null).join(" ");
    mergedPath.setAttribute("d", combinedPathData);
    const fillPath = paths.find((path4) => path4.getAttribute("fill") !== "none");
    const strokePath = paths.find((path4) => path4.getAttribute("stroke") !== "none");
    const getAttr = /* @__PURE__ */ __name((element3, attr) => {
      return element3?.getAttribute(attr) ?? void 0;
    }, "getAttr");
    if (fillPath) {
      const fillAttrs = {
        fill: getAttr(fillPath, "fill"),
        "fill-opacity": getAttr(fillPath, "fill-opacity") ?? "1"
      };
      Object.entries(fillAttrs).forEach(([attr, value2]) => {
        if (value2) {
          mergedPath.setAttribute(attr, value2);
        }
      });
    }
    if (strokePath) {
      const strokeAttrs = {
        stroke: getAttr(strokePath, "stroke"),
        "stroke-width": getAttr(strokePath, "stroke-width") ?? "1",
        "stroke-opacity": getAttr(strokePath, "stroke-opacity") ?? "1"
      };
      Object.entries(strokeAttrs).forEach(([attr, value2]) => {
        if (value2) {
          mergedPath.setAttribute(attr, value2);
        }
      });
    }
    const group2 = document.createElementNS("http://www.w3.org/2000/svg", "g");
    group2.appendChild(mergedPath);
    return group2;
  }
  var labelHelper, insertLabel, updateNodeBounds, getNodeClasses;
  var init_util = __esm({
    "src/rendering-util/rendering-elements/shapes/util.ts"() {
      "use strict";
      init_createText();
      init_diagramAPI();
      init_config();
      init_src32();
      init_common();
      init_utils2();
      init_labelImageUtils();
      labelHelper = /* @__PURE__ */ __name(async (parent4, node2, _classes) => {
        let cssClasses;
        const useHtmlLabels = node2.useHtmlLabels || evaluate(getConfig2()?.htmlLabels);
        if (!_classes) {
          cssClasses = "node default";
        } else {
          cssClasses = _classes;
        }
        const shapeSvg = parent4.insert("g").attr("class", cssClasses).attr("id", node2.domId || node2.id);
        const labelEl = shapeSvg.insert("g").attr("class", "label").attr("style", handleUndefinedAttr(node2.labelStyle));
        let label;
        if (node2.label === void 0) {
          label = "";
        } else {
          label = typeof node2.label === "string" ? node2.label : node2.label[0];
        }
        const addBackground = !!node2.icon || !!node2.img;
        const isMarkdown = node2.labelType === "markdown";
        const text4 = await createText(
          labelEl,
          sanitizeText(decodeEntities(label), getConfig2()),
          {
            useHtmlLabels,
            width: node2.width || getConfig2().flowchart?.wrappingWidth,
            classes: isMarkdown ? "markdown-node-label" : "",
            style: node2.labelStyle,
            addSvgBackground: addBackground,
            markdown: isMarkdown
          },
          getConfig2()
        );
        let bbox = text4.getBBox();
        const halfPadding = (node2?.padding ?? 0) / 2;
        if (useHtmlLabels) {
          const div = text4.children[0];
          const dv = select_default2(text4);
          await configureLabelImages(div, label);
          bbox = div.getBoundingClientRect();
          dv.attr("width", bbox.width);
          dv.attr("height", bbox.height);
        }
        if (useHtmlLabels) {
          labelEl.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
        } else {
          labelEl.attr("transform", "translate(0, " + -bbox.height / 2 + ")");
        }
        if (node2.centerLabel) {
          labelEl.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
        }
        labelEl.insert("rect", ":first-child");
        return { shapeSvg, bbox, halfPadding, label: labelEl };
      }, "labelHelper");
      insertLabel = /* @__PURE__ */ __name(async (parent4, label, options2) => {
        const useHtmlLabels = options2.useHtmlLabels ?? getEffectiveHtmlLabels(getConfig2());
        const labelEl = parent4.insert("g").attr("class", "label").attr("style", options2.labelStyle || "");
        const text4 = await createText(labelEl, sanitizeText(decodeEntities(label), getConfig2()), {
          useHtmlLabels,
          width: options2.width || getConfig2()?.flowchart?.wrappingWidth,
          style: options2.labelStyle,
          addSvgBackground: !!options2.icon || !!options2.img
        });
        let bbox = text4.getBBox();
        const halfPadding = options2.padding / 2;
        if (getEffectiveHtmlLabels(getConfig2())) {
          const div = text4.children[0];
          const dv = select_default2(text4);
          bbox = div.getBoundingClientRect();
          dv.attr("width", bbox.width);
          dv.attr("height", bbox.height);
        }
        if (useHtmlLabels) {
          labelEl.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
        } else {
          labelEl.attr("transform", "translate(0, " + -bbox.height / 2 + ")");
        }
        if (options2.centerLabel) {
          labelEl.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
        }
        labelEl.insert("rect", ":first-child");
        return { shapeSvg: parent4, bbox, halfPadding, label: labelEl };
      }, "insertLabel");
      updateNodeBounds = /* @__PURE__ */ __name((node2, element3) => {
        const bbox = element3.node().getBBox();
        node2.width = bbox.width;
        node2.height = bbox.height;
      }, "updateNodeBounds");
      getNodeClasses = /* @__PURE__ */ __name((node2, extra) => (node2.look === "handDrawn" ? "rough-node" : "node") + " " + node2.cssClasses + " " + (extra || ""), "getNodeClasses");
      __name(createPathFromPoints, "createPathFromPoints");
      __name(generateFullSineWavePoints, "generateFullSineWavePoints");
      __name(generateCirclePoints, "generateCirclePoints");
      __name(mergePaths, "mergePaths");
    }
  });

  // src/rendering-util/rendering-elements/intersect/intersect-node.js
  function intersectNode(node2, point8) {
    return node2.intersect(point8);
  }
  var intersect_node_default;
  var init_intersect_node = __esm({
    "src/rendering-util/rendering-elements/intersect/intersect-node.js"() {
      "use strict";
      __name(intersectNode, "intersectNode");
      intersect_node_default = intersectNode;
    }
  });

  // src/rendering-util/rendering-elements/intersect/intersect-ellipse.js
  function intersectEllipse(node2, rx, ry, point8) {
    var cx = node2.x;
    var cy = node2.y;
    var px = cx - point8.x;
    var py = cy - point8.y;
    var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
    var dx = Math.abs(rx * ry * px / det);
    if (point8.x < cx) {
      dx = -dx;
    }
    var dy = Math.abs(rx * ry * py / det);
    if (point8.y < cy) {
      dy = -dy;
    }
    return { x: cx + dx, y: cy + dy };
  }
  var intersect_ellipse_default;
  var init_intersect_ellipse = __esm({
    "src/rendering-util/rendering-elements/intersect/intersect-ellipse.js"() {
      "use strict";
      __name(intersectEllipse, "intersectEllipse");
      intersect_ellipse_default = intersectEllipse;
    }
  });

  // src/rendering-util/rendering-elements/intersect/intersect-circle.js
  function intersectCircle(node2, rx, point8) {
    return intersect_ellipse_default(node2, rx, rx, point8);
  }
  var intersect_circle_default;
  var init_intersect_circle = __esm({
    "src/rendering-util/rendering-elements/intersect/intersect-circle.js"() {
      "use strict";
      init_intersect_ellipse();
      __name(intersectCircle, "intersectCircle");
      intersect_circle_default = intersectCircle;
    }
  });

  // src/rendering-util/rendering-elements/intersect/intersect-line.js
  function intersectLine(p1, p22, q1, q22) {
    {
      const a1 = p22.y - p1.y;
      const b1 = p1.x - p22.x;
      const c1 = p22.x * p1.y - p1.x * p22.y;
      const r3 = a1 * q1.x + b1 * q1.y + c1;
      const r4 = a1 * q22.x + b1 * q22.y + c1;
      const epsilon6 = 1e-6;
      if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
        return;
      }
      const a2 = q22.y - q1.y;
      const b22 = q1.x - q22.x;
      const c22 = q22.x * q1.y - q1.x * q22.y;
      const r1 = a2 * p1.x + b22 * p1.y + c22;
      const r2 = a2 * p22.x + b22 * p22.y + c22;
      if (Math.abs(r1) < epsilon6 && Math.abs(r2) < epsilon6 && sameSign(r1, r2)) {
        return;
      }
      const denom = a1 * b22 - a2 * b1;
      if (denom === 0) {
        return;
      }
      const offset = Math.abs(denom / 2);
      let num = b1 * c22 - b22 * c1;
      const x5 = num < 0 ? (num - offset) / denom : (num + offset) / denom;
      num = a2 * c1 - a1 * c22;
      const y6 = num < 0 ? (num - offset) / denom : (num + offset) / denom;
      return { x: x5, y: y6 };
    }
  }
  function sameSign(r1, r2) {
    return r1 * r2 > 0;
  }
  var intersect_line_default;
  var init_intersect_line = __esm({
    "src/rendering-util/rendering-elements/intersect/intersect-line.js"() {
      "use strict";
      __name(intersectLine, "intersectLine");
      __name(sameSign, "sameSign");
      intersect_line_default = intersectLine;
    }
  });

  // src/rendering-util/rendering-elements/intersect/intersect-polygon.js
  function intersectPolygon(node2, polyPoints, point8) {
    let x1 = node2.x;
    let y1 = node2.y;
    let intersections = [];
    let minX = Number.POSITIVE_INFINITY;
    let minY = Number.POSITIVE_INFINITY;
    if (typeof polyPoints.forEach === "function") {
      polyPoints.forEach(function(entry) {
        minX = Math.min(minX, entry.x);
        minY = Math.min(minY, entry.y);
      });
    } else {
      minX = Math.min(minX, polyPoints.x);
      minY = Math.min(minY, polyPoints.y);
    }
    let left3 = x1 - node2.width / 2 - minX;
    let top2 = y1 - node2.height / 2 - minY;
    for (let i2 = 0; i2 < polyPoints.length; i2++) {
      let p1 = polyPoints[i2];
      let p22 = polyPoints[i2 < polyPoints.length - 1 ? i2 + 1 : 0];
      let intersect3 = intersect_line_default(
        node2,
        point8,
        { x: left3 + p1.x, y: top2 + p1.y },
        { x: left3 + p22.x, y: top2 + p22.y }
      );
      if (intersect3) {
        intersections.push(intersect3);
      }
    }
    if (!intersections.length) {
      return node2;
    }
    if (intersections.length > 1) {
      intersections.sort(function(p3, q3) {
        let pdx = p3.x - point8.x;
        let pdy = p3.y - point8.y;
        let distp = Math.sqrt(pdx * pdx + pdy * pdy);
        let qdx = q3.x - point8.x;
        let qdy = q3.y - point8.y;
        let distq = Math.sqrt(qdx * qdx + qdy * qdy);
        return distp < distq ? -1 : distp === distq ? 0 : 1;
      });
    }
    return intersections[0];
  }
  var intersect_polygon_default;
  var init_intersect_polygon = __esm({
    "src/rendering-util/rendering-elements/intersect/intersect-polygon.js"() {
      "use strict";
      init_intersect_line();
      __name(intersectPolygon, "intersectPolygon");
      intersect_polygon_default = intersectPolygon;
    }
  });

  // src/rendering-util/rendering-elements/intersect/intersect-rect.js
  var intersectRect, intersect_rect_default;
  var init_intersect_rect = __esm({
    "src/rendering-util/rendering-elements/intersect/intersect-rect.js"() {
      "use strict";
      intersectRect = /* @__PURE__ */ __name((node2, point8) => {
        var x5 = node2.x;
        var y6 = node2.y;
        var dx = point8.x - x5;
        var dy = point8.y - y6;
        var w4 = node2.width / 2;
        var h3 = node2.height / 2;
        var sx, sy;
        if (Math.abs(dy) * w4 > Math.abs(dx) * h3) {
          if (dy < 0) {
            h3 = -h3;
          }
          sx = dy === 0 ? 0 : h3 * dx / dy;
          sy = h3;
        } else {
          if (dx < 0) {
            w4 = -w4;
          }
          sx = w4;
          sy = dx === 0 ? 0 : w4 * dy / dx;
        }
        return { x: x5 + sx, y: y6 + sy };
      }, "intersectRect");
      intersect_rect_default = intersectRect;
    }
  });

  // src/rendering-util/rendering-elements/intersect/index.js
  var intersect_default;
  var init_intersect = __esm({
    "src/rendering-util/rendering-elements/intersect/index.js"() {
      "use strict";
      init_intersect_node();
      init_intersect_circle();
      init_intersect_ellipse();
      init_intersect_polygon();
      init_intersect_rect();
      intersect_default = {
        node: intersect_node_default,
        circle: intersect_circle_default,
        ellipse: intersect_ellipse_default,
        polygon: intersect_polygon_default,
        rect: intersect_rect_default
      };
    }
  });

  // src/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.ts
  var solidStateFill, compileStyles, styles2Map, isLabelStyle, styles2String, userNodeOverrides, getStrokeDashArray;
  var init_handDrawnShapeStyles = __esm({
    "src/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.ts"() {
      "use strict";
      init_diagramAPI();
      solidStateFill = /* @__PURE__ */ __name((color2) => {
        const { handDrawnSeed } = getConfig2();
        return {
          fill: color2,
          hachureAngle: 120,
          // angle of hachure,
          hachureGap: 4,
          fillWeight: 2,
          roughness: 0.7,
          stroke: color2,
          seed: handDrawnSeed
        };
      }, "solidStateFill");
      compileStyles = /* @__PURE__ */ __name((node2) => {
        const stylesMap = styles2Map([
          ...node2.cssCompiledStyles || [],
          ...node2.cssStyles || [],
          ...node2.labelStyle || []
        ]);
        return { stylesMap, stylesArray: [...stylesMap] };
      }, "compileStyles");
      styles2Map = /* @__PURE__ */ __name((styles5) => {
        const styleMap2 = /* @__PURE__ */ new Map();
        styles5.forEach((style3) => {
          const [key, value2] = style3.split(":");
          styleMap2.set(key.trim(), value2?.trim());
        });
        return styleMap2;
      }, "styles2Map");
      isLabelStyle = /* @__PURE__ */ __name((key) => {
        return key === "color" || key === "font-size" || key === "font-family" || key === "font-weight" || key === "font-style" || key === "text-decoration" || key === "text-align" || key === "text-transform" || key === "line-height" || key === "letter-spacing" || key === "word-spacing" || key === "text-shadow" || key === "text-overflow" || key === "white-space" || key === "word-wrap" || key === "word-break" || key === "overflow-wrap" || key === "hyphens";
      }, "isLabelStyle");
      styles2String = /* @__PURE__ */ __name((node2) => {
        const { stylesArray } = compileStyles(node2);
        const labelStyles = [];
        const nodeStyles = [];
        const borderStyles = [];
        const backgroundStyles = [];
        stylesArray.forEach((style3) => {
          const key = style3[0];
          if (isLabelStyle(key)) {
            labelStyles.push(style3.join(":") + " !important");
          } else {
            nodeStyles.push(style3.join(":") + " !important");
            if (key.includes("stroke")) {
              borderStyles.push(style3.join(":") + " !important");
            }
            if (key === "fill") {
              backgroundStyles.push(style3.join(":") + " !important");
            }
          }
        });
        return {
          labelStyles: labelStyles.join(";"),
          nodeStyles: nodeStyles.join(";"),
          stylesArray,
          borderStyles,
          backgroundStyles
        };
      }, "styles2String");
      userNodeOverrides = /* @__PURE__ */ __name((node2, options2) => {
        const { themeVariables, handDrawnSeed } = getConfig2();
        const { nodeBorder, mainBkg } = themeVariables;
        const { stylesMap } = compileStyles(node2);
        const result = Object.assign(
          {
            roughness: 0.7,
            fill: stylesMap.get("fill") || mainBkg,
            fillStyle: "hachure",
            // solid fill
            fillWeight: 4,
            hachureGap: 5.2,
            stroke: stylesMap.get("stroke") || nodeBorder,
            seed: handDrawnSeed,
            strokeWidth: stylesMap.get("stroke-width")?.replace("px", "") || 1.3,
            fillLineDash: [0, 0],
            strokeLineDash: getStrokeDashArray(stylesMap.get("stroke-dasharray"))
          },
          options2
        );
        return result;
      }, "userNodeOverrides");
      getStrokeDashArray = /* @__PURE__ */ __name((strokeDasharrayStyle) => {
        if (!strokeDasharrayStyle) {
          return [0, 0];
        }
        const dashArray = strokeDasharrayStyle.trim().split(/\s+/).map(Number);
        if (dashArray.length === 1) {
          const val = isNaN(dashArray[0]) ? 0 : dashArray[0];
          return [val, val];
        }
        const first3 = isNaN(dashArray[0]) ? 0 : dashArray[0];
        const second2 = isNaN(dashArray[1]) ? 0 : dashArray[1];
        return [first3, second2];
      }, "getStrokeDashArray");
    }
  });

  // ../../node_modules/.pnpm/roughjs@4.6.6_patch_hash=3543d47108cb41b68ec6a671c0e1f9d0cfe2ce524fea5b0992511ae84c3c6b64/node_modules/roughjs/bundled/rough.esm.js
  function t(t4, e3, s2) {
    if (t4 && t4.length) {
      const [n2, o2] = e3, a2 = Math.PI / 180 * s2, h3 = Math.cos(a2), r2 = Math.sin(a2);
      for (const e4 of t4) {
        const [t5, s3] = e4;
        e4[0] = (t5 - n2) * h3 - (s3 - o2) * r2 + n2, e4[1] = (t5 - n2) * r2 + (s3 - o2) * h3 + o2;
      }
    }
  }
  function e(t4, e3) {
    return t4[0] === e3[0] && t4[1] === e3[1];
  }
  function s(s2, n2, o2, a2 = 1) {
    const h3 = o2, r2 = Math.max(n2, 0.1), i2 = s2[0] && s2[0][0] && "number" == typeof s2[0][0] ? [s2] : s2, c3 = [0, 0];
    if (h3) for (const e3 of i2) t(e3, c3, h3);
    const l4 = (function(t4, s3, n3) {
      const o3 = [];
      for (const s4 of t4) {
        const t5 = [...s4];
        e(t5[0], t5[t5.length - 1]) || t5.push([t5[0][0], t5[0][1]]), t5.length > 2 && o3.push(t5);
      }
      const a3 = [];
      s3 = Math.max(s3, 0.1);
      const h4 = [];
      for (const t5 of o3) for (let e3 = 0; e3 < t5.length - 1; e3++) {
        const s4 = t5[e3], n4 = t5[e3 + 1];
        if (s4[1] !== n4[1]) {
          const t6 = Math.min(s4[1], n4[1]);
          h4.push({ ymin: t6, ymax: Math.max(s4[1], n4[1]), x: t6 === s4[1] ? s4[0] : n4[0], islope: (n4[0] - s4[0]) / (n4[1] - s4[1]) });
        }
      }
      if (h4.sort(((t5, e3) => t5.ymin < e3.ymin ? -1 : t5.ymin > e3.ymin ? 1 : t5.x < e3.x ? -1 : t5.x > e3.x ? 1 : t5.ymax === e3.ymax ? 0 : (t5.ymax - e3.ymax) / Math.abs(t5.ymax - e3.ymax))), !h4.length) return a3;
      let r3 = [], i3 = h4[0].ymin, c4 = 0;
      for (; r3.length || h4.length; ) {
        if (h4.length) {
          let t5 = -1;
          for (let e3 = 0; e3 < h4.length && !(h4[e3].ymin > i3); e3++) t5 = e3;
          h4.splice(0, t5 + 1).forEach(((t6) => {
            r3.push({ s: i3, edge: t6 });
          }));
        }
        if (r3 = r3.filter(((t5) => !(t5.edge.ymax <= i3))), r3.sort(((t5, e3) => t5.edge.x === e3.edge.x ? 0 : (t5.edge.x - e3.edge.x) / Math.abs(t5.edge.x - e3.edge.x))), (1 !== n3 || c4 % s3 == 0) && r3.length > 1) for (let t5 = 0; t5 < r3.length; t5 += 2) {
          const e3 = t5 + 1;
          if (e3 >= r3.length) break;
          const s4 = r3[t5].edge, n4 = r3[e3].edge;
          a3.push([[Math.round(s4.x), i3], [Math.round(n4.x), i3]]);
        }
        i3 += n3, r3.forEach(((t5) => {
          t5.edge.x = t5.edge.x + n3 * t5.edge.islope;
        })), c4++;
      }
      return a3;
    })(i2, r2, a2);
    if (h3) {
      for (const e3 of i2) t(e3, c3, -h3);
      !(function(e3, s3, n3) {
        const o3 = [];
        e3.forEach(((t4) => o3.push(...t4))), t(o3, s3, n3);
      })(l4, c3, -h3);
    }
    return l4;
  }
  function n(t4, e3) {
    var n2;
    const o2 = e3.hachureAngle + 90;
    let a2 = e3.hachureGap;
    a2 < 0 && (a2 = 4 * e3.strokeWidth), a2 = Math.round(Math.max(a2, 0.1));
    let h3 = 1;
    return e3.roughness >= 1 && ((null === (n2 = e3.randomizer) || void 0 === n2 ? void 0 : n2.next()) || Math.random()) > 0.7 && (h3 = a2), s(t4, a2, o2, h3 || 1);
  }
  function a(t4) {
    const e3 = t4[0], s2 = t4[1];
    return Math.sqrt(Math.pow(e3[0] - s2[0], 2) + Math.pow(e3[1] - s2[1], 2));
  }
  function k(t4, e3) {
    return t4.type === e3;
  }
  function b2(t4) {
    const e3 = [], s2 = (function(t5) {
      const e4 = new Array();
      for (; "" !== t5; ) if (t5.match(/^([ \t\r\n,]+)/)) t5 = t5.substr(RegExp.$1.length);
      else if (t5.match(/^([aAcChHlLmMqQsStTvVzZ])/)) e4[e4.length] = { type: f, text: RegExp.$1 }, t5 = t5.substr(RegExp.$1.length);
      else {
        if (!t5.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)) return [];
        e4[e4.length] = { type: d2, text: `${parseFloat(RegExp.$1)}` }, t5 = t5.substr(RegExp.$1.length);
      }
      return e4[e4.length] = { type: g, text: "" }, e4;
    })(t4);
    let n2 = "BOD", o2 = 0, a2 = s2[o2];
    for (; !k(a2, g); ) {
      let h3 = 0;
      const r2 = [];
      if ("BOD" === n2) {
        if ("M" !== a2.text && "m" !== a2.text) return b2("M0,0" + t4);
        o2++, h3 = M2[a2.text], n2 = a2.text;
      } else k(a2, d2) ? h3 = M2[n2] : (o2++, h3 = M2[a2.text], n2 = a2.text);
      if (!(o2 + h3 < s2.length)) throw new Error("Path data ended short");
      for (let t5 = o2; t5 < o2 + h3; t5++) {
        const e4 = s2[t5];
        if (!k(e4, d2)) throw new Error("Param not a number: " + n2 + "," + e4.text);
        r2[r2.length] = +e4.text;
      }
      if ("number" != typeof M2[n2]) throw new Error("Bad segment: " + n2);
      {
        const t5 = { key: n2, data: r2 };
        e3.push(t5), o2 += h3, a2 = s2[o2], "M" === n2 && (n2 = "L"), "m" === n2 && (n2 = "l");
      }
    }
    return e3;
  }
  function y3(t4) {
    let e3 = 0, s2 = 0, n2 = 0, o2 = 0;
    const a2 = [];
    for (const { key: h3, data: r2 } of t4) switch (h3) {
      case "M":
        a2.push({ key: "M", data: [...r2] }), [e3, s2] = r2, [n2, o2] = r2;
        break;
      case "m":
        e3 += r2[0], s2 += r2[1], a2.push({ key: "M", data: [e3, s2] }), n2 = e3, o2 = s2;
        break;
      case "L":
        a2.push({ key: "L", data: [...r2] }), [e3, s2] = r2;
        break;
      case "l":
        e3 += r2[0], s2 += r2[1], a2.push({ key: "L", data: [e3, s2] });
        break;
      case "C":
        a2.push({ key: "C", data: [...r2] }), e3 = r2[4], s2 = r2[5];
        break;
      case "c": {
        const t5 = r2.map(((t6, n3) => n3 % 2 ? t6 + s2 : t6 + e3));
        a2.push({ key: "C", data: t5 }), e3 = t5[4], s2 = t5[5];
        break;
      }
      case "Q":
        a2.push({ key: "Q", data: [...r2] }), e3 = r2[2], s2 = r2[3];
        break;
      case "q": {
        const t5 = r2.map(((t6, n3) => n3 % 2 ? t6 + s2 : t6 + e3));
        a2.push({ key: "Q", data: t5 }), e3 = t5[2], s2 = t5[3];
        break;
      }
      case "A":
        a2.push({ key: "A", data: [...r2] }), e3 = r2[5], s2 = r2[6];
        break;
      case "a":
        e3 += r2[5], s2 += r2[6], a2.push({ key: "A", data: [r2[0], r2[1], r2[2], r2[3], r2[4], e3, s2] });
        break;
      case "H":
        a2.push({ key: "H", data: [...r2] }), e3 = r2[0];
        break;
      case "h":
        e3 += r2[0], a2.push({ key: "H", data: [e3] });
        break;
      case "V":
        a2.push({ key: "V", data: [...r2] }), s2 = r2[0];
        break;
      case "v":
        s2 += r2[0], a2.push({ key: "V", data: [s2] });
        break;
      case "S":
        a2.push({ key: "S", data: [...r2] }), e3 = r2[2], s2 = r2[3];
        break;
      case "s": {
        const t5 = r2.map(((t6, n3) => n3 % 2 ? t6 + s2 : t6 + e3));
        a2.push({ key: "S", data: t5 }), e3 = t5[2], s2 = t5[3];
        break;
      }
      case "T":
        a2.push({ key: "T", data: [...r2] }), e3 = r2[0], s2 = r2[1];
        break;
      case "t":
        e3 += r2[0], s2 += r2[1], a2.push({ key: "T", data: [e3, s2] });
        break;
      case "Z":
      case "z":
        a2.push({ key: "Z", data: [] }), e3 = n2, s2 = o2;
    }
    return a2;
  }
  function m2(t4) {
    const e3 = [];
    let s2 = "", n2 = 0, o2 = 0, a2 = 0, h3 = 0, r2 = 0, i2 = 0;
    for (const { key: c3, data: l4 } of t4) {
      switch (c3) {
        case "M":
          e3.push({ key: "M", data: [...l4] }), [n2, o2] = l4, [a2, h3] = l4;
          break;
        case "C":
          e3.push({ key: "C", data: [...l4] }), n2 = l4[4], o2 = l4[5], r2 = l4[2], i2 = l4[3];
          break;
        case "L":
          e3.push({ key: "L", data: [...l4] }), [n2, o2] = l4;
          break;
        case "H":
          n2 = l4[0], e3.push({ key: "L", data: [n2, o2] });
          break;
        case "V":
          o2 = l4[0], e3.push({ key: "L", data: [n2, o2] });
          break;
        case "S": {
          let t5 = 0, a3 = 0;
          "C" === s2 || "S" === s2 ? (t5 = n2 + (n2 - r2), a3 = o2 + (o2 - i2)) : (t5 = n2, a3 = o2), e3.push({ key: "C", data: [t5, a3, ...l4] }), r2 = l4[0], i2 = l4[1], n2 = l4[2], o2 = l4[3];
          break;
        }
        case "T": {
          const [t5, a3] = l4;
          let h4 = 0, c4 = 0;
          "Q" === s2 || "T" === s2 ? (h4 = n2 + (n2 - r2), c4 = o2 + (o2 - i2)) : (h4 = n2, c4 = o2);
          const u2 = n2 + 2 * (h4 - n2) / 3, p3 = o2 + 2 * (c4 - o2) / 3, f2 = t5 + 2 * (h4 - t5) / 3, d3 = a3 + 2 * (c4 - a3) / 3;
          e3.push({ key: "C", data: [u2, p3, f2, d3, t5, a3] }), r2 = h4, i2 = c4, n2 = t5, o2 = a3;
          break;
        }
        case "Q": {
          const [t5, s3, a3, h4] = l4, c4 = n2 + 2 * (t5 - n2) / 3, u2 = o2 + 2 * (s3 - o2) / 3, p3 = a3 + 2 * (t5 - a3) / 3, f2 = h4 + 2 * (s3 - h4) / 3;
          e3.push({ key: "C", data: [c4, u2, p3, f2, a3, h4] }), r2 = t5, i2 = s3, n2 = a3, o2 = h4;
          break;
        }
        case "A": {
          const t5 = Math.abs(l4[0]), s3 = Math.abs(l4[1]), a3 = l4[2], h4 = l4[3], r3 = l4[4], i3 = l4[5], c4 = l4[6];
          if (0 === t5 || 0 === s3) e3.push({ key: "C", data: [n2, o2, i3, c4, i3, c4] }), n2 = i3, o2 = c4;
          else if (n2 !== i3 || o2 !== c4) {
            x2(n2, o2, i3, c4, t5, s3, a3, h4, r3).forEach((function(t6) {
              e3.push({ key: "C", data: t6 });
            })), n2 = i3, o2 = c4;
          }
          break;
        }
        case "Z":
          e3.push({ key: "Z", data: [] }), n2 = a2, o2 = h3;
      }
      s2 = c3;
    }
    return e3;
  }
  function w2(t4, e3, s2) {
    return [t4 * Math.cos(s2) - e3 * Math.sin(s2), t4 * Math.sin(s2) + e3 * Math.cos(s2)];
  }
  function x2(t4, e3, s2, n2, o2, a2, h3, r2, i2, c3) {
    const l4 = (u2 = h3, Math.PI * u2 / 180);
    var u2;
    let p3 = [], f2 = 0, d3 = 0, g2 = 0, M3 = 0;
    if (c3) [f2, d3, g2, M3] = c3;
    else {
      [t4, e3] = w2(t4, e3, -l4), [s2, n2] = w2(s2, n2, -l4);
      const h4 = (t4 - s2) / 2, c4 = (e3 - n2) / 2;
      let u3 = h4 * h4 / (o2 * o2) + c4 * c4 / (a2 * a2);
      u3 > 1 && (u3 = Math.sqrt(u3), o2 *= u3, a2 *= u3);
      const p4 = o2 * o2, k3 = a2 * a2, b4 = p4 * k3 - p4 * c4 * c4 - k3 * h4 * h4, y7 = p4 * c4 * c4 + k3 * h4 * h4, m4 = (r2 === i2 ? -1 : 1) * Math.sqrt(Math.abs(b4 / y7));
      g2 = m4 * o2 * c4 / a2 + (t4 + s2) / 2, M3 = m4 * -a2 * h4 / o2 + (e3 + n2) / 2, f2 = Math.asin(parseFloat(((e3 - M3) / a2).toFixed(9))), d3 = Math.asin(parseFloat(((n2 - M3) / a2).toFixed(9))), t4 < g2 && (f2 = Math.PI - f2), s2 < g2 && (d3 = Math.PI - d3), f2 < 0 && (f2 = 2 * Math.PI + f2), d3 < 0 && (d3 = 2 * Math.PI + d3), i2 && f2 > d3 && (f2 -= 2 * Math.PI), !i2 && d3 > f2 && (d3 -= 2 * Math.PI);
    }
    let k2 = d3 - f2;
    if (Math.abs(k2) > 120 * Math.PI / 180) {
      const t5 = d3, e4 = s2, r3 = n2;
      d3 = i2 && d3 > f2 ? f2 + 120 * Math.PI / 180 * 1 : f2 + 120 * Math.PI / 180 * -1, p3 = x2(s2 = g2 + o2 * Math.cos(d3), n2 = M3 + a2 * Math.sin(d3), e4, r3, o2, a2, h3, 0, i2, [d3, t5, g2, M3]);
    }
    k2 = d3 - f2;
    const b3 = Math.cos(f2), y6 = Math.sin(f2), m3 = Math.cos(d3), P3 = Math.sin(d3), v3 = Math.tan(k2 / 4), S4 = 4 / 3 * o2 * v3, O3 = 4 / 3 * a2 * v3, L3 = [t4, e3], T3 = [t4 + S4 * y6, e3 - O3 * b3], D4 = [s2 + S4 * P3, n2 - O3 * m3], A2 = [s2, n2];
    if (T3[0] = 2 * L3[0] - T3[0], T3[1] = 2 * L3[1] - T3[1], c3) return [T3, D4, A2].concat(p3);
    {
      p3 = [T3, D4, A2].concat(p3);
      const t5 = [];
      for (let e4 = 0; e4 < p3.length; e4 += 3) {
        const s3 = w2(p3[e4][0], p3[e4][1], l4), n3 = w2(p3[e4 + 1][0], p3[e4 + 1][1], l4), o3 = w2(p3[e4 + 2][0], p3[e4 + 2][1], l4);
        t5.push([s3[0], s3[1], n3[0], n3[1], o3[0], o3[1]]);
      }
      return t5;
    }
  }
  function v2(t4, e3, s2, n2, o2) {
    return { type: "path", ops: $2(t4, e3, s2, n2, o2) };
  }
  function S3(t4, e3, s2) {
    const n2 = (t4 || []).length;
    if (n2 > 2) {
      const o2 = [];
      for (let e4 = 0; e4 < n2 - 1; e4++) o2.push(...$2(t4[e4][0], t4[e4][1], t4[e4 + 1][0], t4[e4 + 1][1], s2));
      return e3 && o2.push(...$2(t4[n2 - 1][0], t4[n2 - 1][1], t4[0][0], t4[0][1], s2)), { type: "path", ops: o2 };
    }
    return 2 === n2 ? v2(t4[0][0], t4[0][1], t4[1][0], t4[1][1], s2) : { type: "path", ops: [] };
  }
  function O2(t4, e3, s2, n2, o2) {
    return (function(t5, e4) {
      return S3(t5, true, e4);
    })([[t4, e3], [t4 + s2, e3], [t4 + s2, e3 + n2], [t4, e3 + n2]], o2);
  }
  function L2(t4, e3) {
    if (t4.length) {
      const s2 = "number" == typeof t4[0][0] ? [t4] : t4, n2 = j2(s2[0], 1 * (1 + 0.2 * e3.roughness), e3), o2 = e3.disableMultiStroke ? [] : j2(s2[0], 1.5 * (1 + 0.22 * e3.roughness), z2(e3));
      for (let t5 = 1; t5 < s2.length; t5++) {
        const a2 = s2[t5];
        if (a2.length) {
          const t6 = j2(a2, 1 * (1 + 0.2 * e3.roughness), e3), s3 = e3.disableMultiStroke ? [] : j2(a2, 1.5 * (1 + 0.22 * e3.roughness), z2(e3));
          for (const e4 of t6) "move" !== e4.op && n2.push(e4);
          for (const t7 of s3) "move" !== t7.op && o2.push(t7);
        }
      }
      return { type: "path", ops: n2.concat(o2) };
    }
    return { type: "path", ops: [] };
  }
  function T2(t4, e3, s2) {
    const n2 = Math.sqrt(2 * Math.PI * Math.sqrt((Math.pow(t4 / 2, 2) + Math.pow(e3 / 2, 2)) / 2)), o2 = Math.ceil(Math.max(s2.curveStepCount, s2.curveStepCount / Math.sqrt(200) * n2)), a2 = 2 * Math.PI / o2;
    let h3 = Math.abs(t4 / 2), r2 = Math.abs(e3 / 2);
    const i2 = 1 - s2.curveFitting;
    return h3 += G2(h3 * i2, s2), r2 += G2(r2 * i2, s2), { increment: a2, rx: h3, ry: r2 };
  }
  function D3(t4, e3, s2, n2) {
    const [o2, a2] = F2(n2.increment, t4, e3, n2.rx, n2.ry, 1, n2.increment * E2(0.1, E2(0.4, 1, s2), s2), s2);
    let h3 = q2(o2, null, s2);
    if (!s2.disableMultiStroke && 0 !== s2.roughness) {
      const [o3] = F2(n2.increment, t4, e3, n2.rx, n2.ry, 1.5, 0, s2), a3 = q2(o3, null, s2);
      h3 = h3.concat(a3);
    }
    return { estimatedPoints: a2, opset: { type: "path", ops: h3 } };
  }
  function A(t4, e3, s2, n2, o2, a2, h3, r2, i2) {
    const c3 = t4, l4 = e3;
    let u2 = Math.abs(s2 / 2), p3 = Math.abs(n2 / 2);
    u2 += G2(0.01 * u2, i2), p3 += G2(0.01 * p3, i2);
    let f2 = o2, d3 = a2;
    for (; f2 < 0; ) f2 += 2 * Math.PI, d3 += 2 * Math.PI;
    d3 - f2 > 2 * Math.PI && (f2 = 0, d3 = 2 * Math.PI);
    const g2 = 2 * Math.PI / i2.curveStepCount, M3 = Math.min(g2 / 2, (d3 - f2) / 2), k2 = V2(M3, c3, l4, u2, p3, f2, d3, 1, i2);
    if (!i2.disableMultiStroke) {
      const t5 = V2(M3, c3, l4, u2, p3, f2, d3, 1.5, i2);
      k2.push(...t5);
    }
    return h3 && (r2 ? k2.push(...$2(c3, l4, c3 + u2 * Math.cos(f2), l4 + p3 * Math.sin(f2), i2), ...$2(c3, l4, c3 + u2 * Math.cos(d3), l4 + p3 * Math.sin(d3), i2)) : k2.push({ op: "lineTo", data: [c3, l4] }, { op: "lineTo", data: [c3 + u2 * Math.cos(f2), l4 + p3 * Math.sin(f2)] })), { type: "path", ops: k2 };
  }
  function _2(t4, e3) {
    const s2 = m2(y3(b2(t4))), n2 = [];
    let o2 = [0, 0], a2 = [0, 0];
    for (const { key: t5, data: h3 } of s2) switch (t5) {
      case "M":
        a2 = [h3[0], h3[1]], o2 = [h3[0], h3[1]];
        break;
      case "L":
        n2.push(...$2(a2[0], a2[1], h3[0], h3[1], e3)), a2 = [h3[0], h3[1]];
        break;
      case "C": {
        const [t6, s3, o3, r2, i2, c3] = h3;
        n2.push(...Z(t6, s3, o3, r2, i2, c3, a2, e3)), a2 = [i2, c3];
        break;
      }
      case "Z":
        n2.push(...$2(a2[0], a2[1], o2[0], o2[1], e3)), a2 = [o2[0], o2[1]];
    }
    return { type: "path", ops: n2 };
  }
  function I2(t4, e3) {
    const s2 = [];
    for (const n2 of t4) if (n2.length) {
      const t5 = e3.maxRandomnessOffset || 0, o2 = n2.length;
      if (o2 > 2) {
        s2.push({ op: "move", data: [n2[0][0] + G2(t5, e3), n2[0][1] + G2(t5, e3)] });
        for (let a2 = 1; a2 < o2; a2++) s2.push({ op: "lineTo", data: [n2[a2][0] + G2(t5, e3), n2[a2][1] + G2(t5, e3)] });
      }
    }
    return { type: "fillPath", ops: s2 };
  }
  function C2(t4, e3) {
    return (function(t5, e4) {
      let s2 = t5.fillStyle || "hachure";
      if (!u[s2]) switch (s2) {
        case "zigzag":
          u[s2] || (u[s2] = new h2(e4));
          break;
        case "cross-hatch":
          u[s2] || (u[s2] = new r(e4));
          break;
        case "dots":
          u[s2] || (u[s2] = new i(e4));
          break;
        case "dashed":
          u[s2] || (u[s2] = new c2(e4));
          break;
        case "zigzag-line":
          u[s2] || (u[s2] = new l3(e4));
          break;
        default:
          s2 = "hachure", u[s2] || (u[s2] = new o(e4));
      }
      return u[s2];
    })(e3, P2).fillPolygons(t4, e3);
  }
  function z2(t4) {
    const e3 = Object.assign({}, t4);
    return e3.randomizer = void 0, t4.seed && (e3.seed = t4.seed + 1), e3;
  }
  function W2(t4) {
    return t4.randomizer || (t4.randomizer = new p(t4.seed || 0)), t4.randomizer.next();
  }
  function E2(t4, e3, s2, n2 = 1) {
    return s2.roughness * n2 * (W2(s2) * (e3 - t4) + t4);
  }
  function G2(t4, e3, s2 = 1) {
    return E2(-t4, t4, e3, s2);
  }
  function $2(t4, e3, s2, n2, o2, a2 = false) {
    const h3 = a2 ? o2.disableMultiStrokeFill : o2.disableMultiStroke, r2 = R2(t4, e3, s2, n2, o2, true, false);
    if (h3) return r2;
    const i2 = R2(t4, e3, s2, n2, o2, true, true);
    return r2.concat(i2);
  }
  function R2(t4, e3, s2, n2, o2, a2, h3) {
    const r2 = Math.pow(t4 - s2, 2) + Math.pow(e3 - n2, 2), i2 = Math.sqrt(r2);
    let c3 = 1;
    c3 = i2 < 200 ? 1 : i2 > 500 ? 0.4 : -16668e-7 * i2 + 1.233334;
    let l4 = o2.maxRandomnessOffset || 0;
    l4 * l4 * 100 > r2 && (l4 = i2 / 10);
    const u2 = l4 / 2, p3 = 0.2 + 0.2 * W2(o2);
    let f2 = o2.bowing * o2.maxRandomnessOffset * (n2 - e3) / 200, d3 = o2.bowing * o2.maxRandomnessOffset * (t4 - s2) / 200;
    f2 = G2(f2, o2, c3), d3 = G2(d3, o2, c3);
    const g2 = [], M3 = /* @__PURE__ */ __name(() => G2(u2, o2, c3), "M"), k2 = /* @__PURE__ */ __name(() => G2(l4, o2, c3), "k"), b3 = o2.preserveVertices;
    return a2 && (h3 ? g2.push({ op: "move", data: [t4 + (b3 ? 0 : M3()), e3 + (b3 ? 0 : M3())] }) : g2.push({ op: "move", data: [t4 + (b3 ? 0 : G2(l4, o2, c3)), e3 + (b3 ? 0 : G2(l4, o2, c3))] })), h3 ? g2.push({ op: "bcurveTo", data: [f2 + t4 + (s2 - t4) * p3 + M3(), d3 + e3 + (n2 - e3) * p3 + M3(), f2 + t4 + 2 * (s2 - t4) * p3 + M3(), d3 + e3 + 2 * (n2 - e3) * p3 + M3(), s2 + (b3 ? 0 : M3()), n2 + (b3 ? 0 : M3())] }) : g2.push({ op: "bcurveTo", data: [f2 + t4 + (s2 - t4) * p3 + k2(), d3 + e3 + (n2 - e3) * p3 + k2(), f2 + t4 + 2 * (s2 - t4) * p3 + k2(), d3 + e3 + 2 * (n2 - e3) * p3 + k2(), s2 + (b3 ? 0 : k2()), n2 + (b3 ? 0 : k2())] }), g2;
  }
  function j2(t4, e3, s2) {
    if (!t4.length) return [];
    const n2 = [];
    n2.push([t4[0][0] + G2(e3, s2), t4[0][1] + G2(e3, s2)]), n2.push([t4[0][0] + G2(e3, s2), t4[0][1] + G2(e3, s2)]);
    for (let o2 = 1; o2 < t4.length; o2++) n2.push([t4[o2][0] + G2(e3, s2), t4[o2][1] + G2(e3, s2)]), o2 === t4.length - 1 && n2.push([t4[o2][0] + G2(e3, s2), t4[o2][1] + G2(e3, s2)]);
    return q2(n2, null, s2);
  }
  function q2(t4, e3, s2) {
    const n2 = t4.length, o2 = [];
    if (n2 > 3) {
      const a2 = [], h3 = 1 - s2.curveTightness;
      o2.push({ op: "move", data: [t4[1][0], t4[1][1]] });
      for (let e4 = 1; e4 + 2 < n2; e4++) {
        const s3 = t4[e4];
        a2[0] = [s3[0], s3[1]], a2[1] = [s3[0] + (h3 * t4[e4 + 1][0] - h3 * t4[e4 - 1][0]) / 6, s3[1] + (h3 * t4[e4 + 1][1] - h3 * t4[e4 - 1][1]) / 6], a2[2] = [t4[e4 + 1][0] + (h3 * t4[e4][0] - h3 * t4[e4 + 2][0]) / 6, t4[e4 + 1][1] + (h3 * t4[e4][1] - h3 * t4[e4 + 2][1]) / 6], a2[3] = [t4[e4 + 1][0], t4[e4 + 1][1]], o2.push({ op: "bcurveTo", data: [a2[1][0], a2[1][1], a2[2][0], a2[2][1], a2[3][0], a2[3][1]] });
      }
      if (e3 && 2 === e3.length) {
        const t5 = s2.maxRandomnessOffset;
        o2.push({ op: "lineTo", data: [e3[0] + G2(t5, s2), e3[1] + G2(t5, s2)] });
      }
    } else 3 === n2 ? (o2.push({ op: "move", data: [t4[1][0], t4[1][1]] }), o2.push({ op: "bcurveTo", data: [t4[1][0], t4[1][1], t4[2][0], t4[2][1], t4[2][0], t4[2][1]] })) : 2 === n2 && o2.push(...R2(t4[0][0], t4[0][1], t4[1][0], t4[1][1], s2, true, true));
    return o2;
  }
  function F2(t4, e3, s2, n2, o2, a2, h3, r2) {
    const i2 = [], c3 = [];
    if (0 === r2.roughness) {
      t4 /= 4, c3.push([e3 + n2 * Math.cos(-t4), s2 + o2 * Math.sin(-t4)]);
      for (let a3 = 0; a3 <= 2 * Math.PI; a3 += t4) {
        const t5 = [e3 + n2 * Math.cos(a3), s2 + o2 * Math.sin(a3)];
        i2.push(t5), c3.push(t5);
      }
      c3.push([e3 + n2 * Math.cos(0), s2 + o2 * Math.sin(0)]), c3.push([e3 + n2 * Math.cos(t4), s2 + o2 * Math.sin(t4)]);
    } else {
      const l4 = G2(0.5, r2) - Math.PI / 2;
      c3.push([G2(a2, r2) + e3 + 0.9 * n2 * Math.cos(l4 - t4), G2(a2, r2) + s2 + 0.9 * o2 * Math.sin(l4 - t4)]);
      const u2 = 2 * Math.PI + l4 - 0.01;
      for (let h4 = l4; h4 < u2; h4 += t4) {
        const t5 = [G2(a2, r2) + e3 + n2 * Math.cos(h4), G2(a2, r2) + s2 + o2 * Math.sin(h4)];
        i2.push(t5), c3.push(t5);
      }
      c3.push([G2(a2, r2) + e3 + n2 * Math.cos(l4 + 2 * Math.PI + 0.5 * h3), G2(a2, r2) + s2 + o2 * Math.sin(l4 + 2 * Math.PI + 0.5 * h3)]), c3.push([G2(a2, r2) + e3 + 0.98 * n2 * Math.cos(l4 + h3), G2(a2, r2) + s2 + 0.98 * o2 * Math.sin(l4 + h3)]), c3.push([G2(a2, r2) + e3 + 0.9 * n2 * Math.cos(l4 + 0.5 * h3), G2(a2, r2) + s2 + 0.9 * o2 * Math.sin(l4 + 0.5 * h3)]);
    }
    return [c3, i2];
  }
  function V2(t4, e3, s2, n2, o2, a2, h3, r2, i2) {
    const c3 = a2 + G2(0.1, i2), l4 = [];
    l4.push([G2(r2, i2) + e3 + 0.9 * n2 * Math.cos(c3 - t4), G2(r2, i2) + s2 + 0.9 * o2 * Math.sin(c3 - t4)]);
    for (let a3 = c3; a3 <= h3; a3 += t4) l4.push([G2(r2, i2) + e3 + n2 * Math.cos(a3), G2(r2, i2) + s2 + o2 * Math.sin(a3)]);
    return l4.push([e3 + n2 * Math.cos(h3), s2 + o2 * Math.sin(h3)]), l4.push([e3 + n2 * Math.cos(h3), s2 + o2 * Math.sin(h3)]), q2(l4, null, i2);
  }
  function Z(t4, e3, s2, n2, o2, a2, h3, r2) {
    const i2 = [], c3 = [r2.maxRandomnessOffset || 1, (r2.maxRandomnessOffset || 1) + 0.3];
    let l4 = [0, 0];
    const u2 = r2.disableMultiStroke ? 1 : 2, p3 = r2.preserveVertices;
    for (let f2 = 0; f2 < u2; f2++) 0 === f2 ? i2.push({ op: "move", data: [h3[0], h3[1]] }) : i2.push({ op: "move", data: [h3[0] + (p3 ? 0 : G2(c3[0], r2)), h3[1] + (p3 ? 0 : G2(c3[0], r2))] }), l4 = p3 ? [o2, a2] : [o2 + G2(c3[f2], r2), a2 + G2(c3[f2], r2)], i2.push({ op: "bcurveTo", data: [t4 + G2(c3[f2], r2), e3 + G2(c3[f2], r2), s2 + G2(c3[f2], r2), n2 + G2(c3[f2], r2), l4[0], l4[1]] });
    return i2;
  }
  function Q2(t4) {
    return [...t4];
  }
  function H(t4, e3 = 0) {
    const s2 = t4.length;
    if (s2 < 3) throw new Error("A curve must have at least three points.");
    const n2 = [];
    if (3 === s2) n2.push(Q2(t4[0]), Q2(t4[1]), Q2(t4[2]), Q2(t4[2]));
    else {
      const s3 = [];
      s3.push(t4[0], t4[0]);
      for (let e4 = 1; e4 < t4.length; e4++) s3.push(t4[e4]), e4 === t4.length - 1 && s3.push(t4[e4]);
      const o2 = [], a2 = 1 - e3;
      n2.push(Q2(s3[0]));
      for (let t5 = 1; t5 + 2 < s3.length; t5++) {
        const e4 = s3[t5];
        o2[0] = [e4[0], e4[1]], o2[1] = [e4[0] + (a2 * s3[t5 + 1][0] - a2 * s3[t5 - 1][0]) / 6, e4[1] + (a2 * s3[t5 + 1][1] - a2 * s3[t5 - 1][1]) / 6], o2[2] = [s3[t5 + 1][0] + (a2 * s3[t5][0] - a2 * s3[t5 + 2][0]) / 6, s3[t5 + 1][1] + (a2 * s3[t5][1] - a2 * s3[t5 + 2][1]) / 6], o2[3] = [s3[t5 + 1][0], s3[t5 + 1][1]], n2.push(o2[1], o2[2], o2[3]);
      }
    }
    return n2;
  }
  function N2(t4, e3) {
    return Math.pow(t4[0] - e3[0], 2) + Math.pow(t4[1] - e3[1], 2);
  }
  function B2(t4, e3, s2) {
    const n2 = N2(e3, s2);
    if (0 === n2) return N2(t4, e3);
    let o2 = ((t4[0] - e3[0]) * (s2[0] - e3[0]) + (t4[1] - e3[1]) * (s2[1] - e3[1])) / n2;
    return o2 = Math.max(0, Math.min(1, o2)), N2(t4, J2(e3, s2, o2));
  }
  function J2(t4, e3, s2) {
    return [t4[0] + (e3[0] - t4[0]) * s2, t4[1] + (e3[1] - t4[1]) * s2];
  }
  function K3(t4, e3, s2, n2) {
    const o2 = n2 || [];
    if ((function(t5, e4) {
      const s3 = t5[e4 + 0], n3 = t5[e4 + 1], o3 = t5[e4 + 2], a3 = t5[e4 + 3];
      let h4 = 3 * n3[0] - 2 * s3[0] - a3[0];
      h4 *= h4;
      let r2 = 3 * n3[1] - 2 * s3[1] - a3[1];
      r2 *= r2;
      let i2 = 3 * o3[0] - 2 * a3[0] - s3[0];
      i2 *= i2;
      let c3 = 3 * o3[1] - 2 * a3[1] - s3[1];
      return c3 *= c3, h4 < i2 && (h4 = i2), r2 < c3 && (r2 = c3), h4 + r2;
    })(t4, e3) < s2) {
      const s3 = t4[e3 + 0];
      if (o2.length) {
        (a2 = o2[o2.length - 1], h3 = s3, Math.sqrt(N2(a2, h3))) > 1 && o2.push(s3);
      } else o2.push(s3);
      o2.push(t4[e3 + 3]);
    } else {
      const n3 = 0.5, a3 = t4[e3 + 0], h4 = t4[e3 + 1], r2 = t4[e3 + 2], i2 = t4[e3 + 3], c3 = J2(a3, h4, n3), l4 = J2(h4, r2, n3), u2 = J2(r2, i2, n3), p3 = J2(c3, l4, n3), f2 = J2(l4, u2, n3), d3 = J2(p3, f2, n3);
      K3([a3, c3, p3, d3], 0, s2, o2), K3([d3, f2, u2, i2], 0, s2, o2);
    }
    var a2, h3;
    return o2;
  }
  function U2(t4, e3) {
    return X3(t4, 0, t4.length, e3);
  }
  function X3(t4, e3, s2, n2, o2) {
    const a2 = o2 || [], h3 = t4[e3], r2 = t4[s2 - 1];
    let i2 = 0, c3 = 1;
    for (let n3 = e3 + 1; n3 < s2 - 1; ++n3) {
      const e4 = B2(t4[n3], h3, r2);
      e4 > i2 && (i2 = e4, c3 = n3);
    }
    return Math.sqrt(i2) > n2 ? (X3(t4, e3, c3 + 1, n2, a2), X3(t4, c3, s2, n2, a2)) : (a2.length || a2.push(h3), a2.push(r2)), a2;
  }
  function Y2(t4, e3 = 0.15, s2) {
    const n2 = [], o2 = (t4.length - 1) / 3;
    for (let s3 = 0; s3 < o2; s3++) {
      K3(t4, 3 * s3, e3, n2);
    }
    return s2 && s2 > 0 ? X3(n2, 0, n2.length, s2) : n2;
  }
  var o, h2, r, i, c2, l3, u, p, f, d2, g, M2, P2, tt, et, st, nt, ot, at;
  var init_rough_esm = __esm({
    "../../node_modules/.pnpm/roughjs@4.6.6_patch_hash=3543d47108cb41b68ec6a671c0e1f9d0cfe2ce524fea5b0992511ae84c3c6b64/node_modules/roughjs/bundled/rough.esm.js"() {
      "use strict";
      __name(t, "t");
      __name(e, "e");
      __name(s, "s");
      __name(n, "n");
      o = class {
        static {
          __name(this, "o");
        }
        constructor(t4) {
          this.helper = t4;
        }
        fillPolygons(t4, e3) {
          return this._fillPolygons(t4, e3);
        }
        _fillPolygons(t4, e3) {
          const s2 = n(t4, e3);
          return { type: "fillSketch", ops: this.renderLines(s2, e3) };
        }
        renderLines(t4, e3) {
          const s2 = [];
          for (const n2 of t4) s2.push(...this.helper.doubleLineOps(n2[0][0], n2[0][1], n2[1][0], n2[1][1], e3));
          return s2;
        }
      };
      __name(a, "a");
      h2 = class extends o {
        static {
          __name(this, "h");
        }
        fillPolygons(t4, e3) {
          let s2 = e3.hachureGap;
          s2 < 0 && (s2 = 4 * e3.strokeWidth), s2 = Math.max(s2, 0.1);
          const o2 = n(t4, Object.assign({}, e3, { hachureGap: s2 })), h3 = Math.PI / 180 * e3.hachureAngle, r2 = [], i2 = 0.5 * s2 * Math.cos(h3), c3 = 0.5 * s2 * Math.sin(h3);
          for (const [t5, e4] of o2) a([t5, e4]) && r2.push([[t5[0] - i2, t5[1] + c3], [...e4]], [[t5[0] + i2, t5[1] - c3], [...e4]]);
          return { type: "fillSketch", ops: this.renderLines(r2, e3) };
        }
      };
      r = class extends o {
        static {
          __name(this, "r");
        }
        fillPolygons(t4, e3) {
          const s2 = this._fillPolygons(t4, e3), n2 = Object.assign({}, e3, { hachureAngle: e3.hachureAngle + 90 }), o2 = this._fillPolygons(t4, n2);
          return s2.ops = s2.ops.concat(o2.ops), s2;
        }
      };
      i = class {
        static {
          __name(this, "i");
        }
        constructor(t4) {
          this.helper = t4;
        }
        fillPolygons(t4, e3) {
          const s2 = n(t4, e3 = Object.assign({}, e3, { hachureAngle: 0 }));
          return this.dotsOnLines(s2, e3);
        }
        dotsOnLines(t4, e3) {
          const s2 = [];
          let n2 = e3.hachureGap;
          n2 < 0 && (n2 = 4 * e3.strokeWidth), n2 = Math.max(n2, 0.1);
          let o2 = e3.fillWeight;
          o2 < 0 && (o2 = e3.strokeWidth / 2);
          const h3 = n2 / 4;
          for (const r2 of t4) {
            const t5 = a(r2), i2 = t5 / n2, c3 = Math.ceil(i2) - 1, l4 = t5 - c3 * n2, u2 = (r2[0][0] + r2[1][0]) / 2 - n2 / 4, p3 = Math.min(r2[0][1], r2[1][1]);
            for (let t6 = 0; t6 < c3; t6++) {
              const a2 = p3 + l4 + t6 * n2, r3 = u2 - h3 + 2 * Math.random() * h3, i3 = a2 - h3 + 2 * Math.random() * h3, c4 = this.helper.ellipse(r3, i3, o2, o2, e3);
              s2.push(...c4.ops);
            }
          }
          return { type: "fillSketch", ops: s2 };
        }
      };
      c2 = class {
        static {
          __name(this, "c");
        }
        constructor(t4) {
          this.helper = t4;
        }
        fillPolygons(t4, e3) {
          const s2 = n(t4, e3);
          return { type: "fillSketch", ops: this.dashedLine(s2, e3) };
        }
        dashedLine(t4, e3) {
          const s2 = e3.dashOffset < 0 ? e3.hachureGap < 0 ? 4 * e3.strokeWidth : e3.hachureGap : e3.dashOffset, n2 = e3.dashGap < 0 ? e3.hachureGap < 0 ? 4 * e3.strokeWidth : e3.hachureGap : e3.dashGap, o2 = [];
          return t4.forEach(((t5) => {
            const h3 = a(t5), r2 = Math.floor(h3 / (s2 + n2)), i2 = (h3 + n2 - r2 * (s2 + n2)) / 2;
            let c3 = t5[0], l4 = t5[1];
            c3[0] > l4[0] && (c3 = t5[1], l4 = t5[0]);
            const u2 = Math.atan((l4[1] - c3[1]) / (l4[0] - c3[0]));
            for (let t6 = 0; t6 < r2; t6++) {
              const a2 = t6 * (s2 + n2), h4 = a2 + s2, r3 = [c3[0] + a2 * Math.cos(u2) + i2 * Math.cos(u2), c3[1] + a2 * Math.sin(u2) + i2 * Math.sin(u2)], l5 = [c3[0] + h4 * Math.cos(u2) + i2 * Math.cos(u2), c3[1] + h4 * Math.sin(u2) + i2 * Math.sin(u2)];
              o2.push(...this.helper.doubleLineOps(r3[0], r3[1], l5[0], l5[1], e3));
            }
          })), o2;
        }
      };
      l3 = class {
        static {
          __name(this, "l");
        }
        constructor(t4) {
          this.helper = t4;
        }
        fillPolygons(t4, e3) {
          const s2 = e3.hachureGap < 0 ? 4 * e3.strokeWidth : e3.hachureGap, o2 = e3.zigzagOffset < 0 ? s2 : e3.zigzagOffset, a2 = n(t4, e3 = Object.assign({}, e3, { hachureGap: s2 + o2 }));
          return { type: "fillSketch", ops: this.zigzagLines(a2, o2, e3) };
        }
        zigzagLines(t4, e3, s2) {
          const n2 = [];
          return t4.forEach(((t5) => {
            const o2 = a(t5), h3 = Math.round(o2 / (2 * e3));
            let r2 = t5[0], i2 = t5[1];
            r2[0] > i2[0] && (r2 = t5[1], i2 = t5[0]);
            const c3 = Math.atan((i2[1] - r2[1]) / (i2[0] - r2[0]));
            for (let t6 = 0; t6 < h3; t6++) {
              const o3 = 2 * t6 * e3, a2 = 2 * (t6 + 1) * e3, h4 = Math.sqrt(2 * Math.pow(e3, 2)), i3 = [r2[0] + o3 * Math.cos(c3), r2[1] + o3 * Math.sin(c3)], l4 = [r2[0] + a2 * Math.cos(c3), r2[1] + a2 * Math.sin(c3)], u2 = [i3[0] + h4 * Math.cos(c3 + Math.PI / 4), i3[1] + h4 * Math.sin(c3 + Math.PI / 4)];
              n2.push(...this.helper.doubleLineOps(i3[0], i3[1], u2[0], u2[1], s2), ...this.helper.doubleLineOps(u2[0], u2[1], l4[0], l4[1], s2));
            }
          })), n2;
        }
      };
      u = {};
      p = class {
        static {
          __name(this, "p");
        }
        constructor(t4) {
          this.seed = t4;
        }
        next() {
          return this.seed ? (2 ** 31 - 1 & (this.seed = Math.imul(48271, this.seed))) / 2 ** 31 : Math.random();
        }
      };
      f = 0;
      d2 = 1;
      g = 2;
      M2 = { A: 7, a: 7, C: 6, c: 6, H: 1, h: 1, L: 2, l: 2, M: 2, m: 2, Q: 4, q: 4, S: 4, s: 4, T: 2, t: 2, V: 1, v: 1, Z: 0, z: 0 };
      __name(k, "k");
      __name(b2, "b");
      __name(y3, "y");
      __name(m2, "m");
      __name(w2, "w");
      __name(x2, "x");
      P2 = { randOffset: /* @__PURE__ */ __name(function(t4, e3) {
        return G2(t4, e3);
      }, "randOffset"), randOffsetWithRange: /* @__PURE__ */ __name(function(t4, e3, s2) {
        return E2(t4, e3, s2);
      }, "randOffsetWithRange"), ellipse: /* @__PURE__ */ __name(function(t4, e3, s2, n2, o2) {
        const a2 = T2(s2, n2, o2);
        return D3(t4, e3, o2, a2).opset;
      }, "ellipse"), doubleLineOps: /* @__PURE__ */ __name(function(t4, e3, s2, n2, o2) {
        return $2(t4, e3, s2, n2, o2, true);
      }, "doubleLineOps") };
      __name(v2, "v");
      __name(S3, "S");
      __name(O2, "O");
      __name(L2, "L");
      __name(T2, "T");
      __name(D3, "D");
      __name(A, "A");
      __name(_2, "_");
      __name(I2, "I");
      __name(C2, "C");
      __name(z2, "z");
      __name(W2, "W");
      __name(E2, "E");
      __name(G2, "G");
      __name($2, "$");
      __name(R2, "R");
      __name(j2, "j");
      __name(q2, "q");
      __name(F2, "F");
      __name(V2, "V");
      __name(Z, "Z");
      __name(Q2, "Q");
      __name(H, "H");
      __name(N2, "N");
      __name(B2, "B");
      __name(J2, "J");
      __name(K3, "K");
      __name(U2, "U");
      __name(X3, "X");
      __name(Y2, "Y");
      tt = "none";
      et = class {
        static {
          __name(this, "et");
        }
        constructor(t4) {
          this.defaultOptions = { maxRandomnessOffset: 2, roughness: 1, bowing: 1, stroke: "#000", strokeWidth: 1, curveTightness: 0, curveFitting: 0.95, curveStepCount: 9, fillStyle: "hachure", fillWeight: -1, hachureAngle: -41, hachureGap: -1, dashOffset: -1, dashGap: -1, zigzagOffset: -1, seed: 0, disableMultiStroke: false, disableMultiStrokeFill: false, preserveVertices: false, fillShapeRoughnessGain: 0.8 }, this.config = t4 || {}, this.config.options && (this.defaultOptions = this._o(this.config.options));
        }
        static newSeed() {
          return Math.floor(Math.random() * 2 ** 31);
        }
        _o(t4) {
          return t4 ? Object.assign({}, this.defaultOptions, t4) : this.defaultOptions;
        }
        _d(t4, e3, s2) {
          return { shape: t4, sets: e3 || [], options: s2 || this.defaultOptions };
        }
        line(t4, e3, s2, n2, o2) {
          const a2 = this._o(o2);
          return this._d("line", [v2(t4, e3, s2, n2, a2)], a2);
        }
        rectangle(t4, e3, s2, n2, o2) {
          const a2 = this._o(o2), h3 = [], r2 = O2(t4, e3, s2, n2, a2);
          if (a2.fill) {
            const o3 = [[t4, e3], [t4 + s2, e3], [t4 + s2, e3 + n2], [t4, e3 + n2]];
            "solid" === a2.fillStyle ? h3.push(I2([o3], a2)) : h3.push(C2([o3], a2));
          }
          return a2.stroke !== tt && h3.push(r2), this._d("rectangle", h3, a2);
        }
        ellipse(t4, e3, s2, n2, o2) {
          const a2 = this._o(o2), h3 = [], r2 = T2(s2, n2, a2), i2 = D3(t4, e3, a2, r2);
          if (a2.fill) if ("solid" === a2.fillStyle) {
            const s3 = D3(t4, e3, a2, r2).opset;
            s3.type = "fillPath", h3.push(s3);
          } else h3.push(C2([i2.estimatedPoints], a2));
          return a2.stroke !== tt && h3.push(i2.opset), this._d("ellipse", h3, a2);
        }
        circle(t4, e3, s2, n2) {
          const o2 = this.ellipse(t4, e3, s2, s2, n2);
          return o2.shape = "circle", o2;
        }
        linearPath(t4, e3) {
          const s2 = this._o(e3);
          return this._d("linearPath", [S3(t4, false, s2)], s2);
        }
        arc(t4, e3, s2, n2, o2, a2, h3 = false, r2) {
          const i2 = this._o(r2), c3 = [], l4 = A(t4, e3, s2, n2, o2, a2, h3, true, i2);
          if (h3 && i2.fill) if ("solid" === i2.fillStyle) {
            const h4 = Object.assign({}, i2);
            h4.disableMultiStroke = true;
            const r3 = A(t4, e3, s2, n2, o2, a2, true, false, h4);
            r3.type = "fillPath", c3.push(r3);
          } else c3.push((function(t5, e4, s3, n3, o3, a3, h4) {
            const r3 = t5, i3 = e4;
            let c4 = Math.abs(s3 / 2), l5 = Math.abs(n3 / 2);
            c4 += G2(0.01 * c4, h4), l5 += G2(0.01 * l5, h4);
            let u2 = o3, p3 = a3;
            for (; u2 < 0; ) u2 += 2 * Math.PI, p3 += 2 * Math.PI;
            p3 - u2 > 2 * Math.PI && (u2 = 0, p3 = 2 * Math.PI);
            const f2 = (p3 - u2) / h4.curveStepCount, d3 = [];
            for (let t6 = u2; t6 <= p3; t6 += f2) d3.push([r3 + c4 * Math.cos(t6), i3 + l5 * Math.sin(t6)]);
            return d3.push([r3 + c4 * Math.cos(p3), i3 + l5 * Math.sin(p3)]), d3.push([r3, i3]), C2([d3], h4);
          })(t4, e3, s2, n2, o2, a2, i2));
          return i2.stroke !== tt && c3.push(l4), this._d("arc", c3, i2);
        }
        curve(t4, e3) {
          const s2 = this._o(e3), n2 = [], o2 = L2(t4, s2);
          if (s2.fill && s2.fill !== tt) if ("solid" === s2.fillStyle) {
            const e4 = L2(t4, Object.assign(Object.assign({}, s2), { disableMultiStroke: true, roughness: s2.roughness ? s2.roughness + s2.fillShapeRoughnessGain : 0 }));
            n2.push({ type: "fillPath", ops: this._mergedShape(e4.ops) });
          } else {
            const e4 = [], o3 = t4;
            if (o3.length) {
              const t5 = "number" == typeof o3[0][0] ? [o3] : o3;
              for (const n3 of t5) n3.length < 3 ? e4.push(...n3) : 3 === n3.length ? e4.push(...Y2(H([n3[0], n3[0], n3[1], n3[2]]), 10, (1 + s2.roughness) / 2)) : e4.push(...Y2(H(n3), 10, (1 + s2.roughness) / 2));
            }
            e4.length && n2.push(C2([e4], s2));
          }
          return s2.stroke !== tt && n2.push(o2), this._d("curve", n2, s2);
        }
        polygon(t4, e3) {
          const s2 = this._o(e3), n2 = [], o2 = S3(t4, true, s2);
          return s2.fill && ("solid" === s2.fillStyle ? n2.push(I2([t4], s2)) : n2.push(C2([t4], s2))), s2.stroke !== tt && n2.push(o2), this._d("polygon", n2, s2);
        }
        path(t4, e3) {
          const s2 = this._o(e3), n2 = [];
          if (!t4) return this._d("path", n2, s2);
          t4 = (t4 || "").replace(/\n/g, " ").replace(/(-\s)/g, "-").replace("/(ss)/g", " ");
          const o2 = s2.fill && "transparent" !== s2.fill && s2.fill !== tt, a2 = s2.stroke !== tt, h3 = !!(s2.simplification && s2.simplification < 1), r2 = (function(t5, e4, s3) {
            const n3 = m2(y3(b2(t5))), o3 = [];
            let a3 = [], h4 = [0, 0], r3 = [];
            const i3 = /* @__PURE__ */ __name(() => {
              r3.length >= 4 && a3.push(...Y2(r3, e4)), r3 = [];
            }, "i"), c3 = /* @__PURE__ */ __name(() => {
              i3(), a3.length && (o3.push(a3), a3 = []);
            }, "c");
            for (const { key: t6, data: e6 } of n3) switch (t6) {
              case "M":
                c3(), h4 = [e6[0], e6[1]], a3.push(h4);
                break;
              case "L":
                i3(), a3.push([e6[0], e6[1]]);
                break;
              case "C":
                if (!r3.length) {
                  const t7 = a3.length ? a3[a3.length - 1] : h4;
                  r3.push([t7[0], t7[1]]);
                }
                r3.push([e6[0], e6[1]]), r3.push([e6[2], e6[3]]), r3.push([e6[4], e6[5]]);
                break;
              case "Z":
                i3(), a3.push([h4[0], h4[1]]);
            }
            if (c3(), !s3) return o3;
            const l4 = [];
            for (const t6 of o3) {
              const e6 = U2(t6, s3);
              e6.length && l4.push(e6);
            }
            return l4;
          })(t4, 1, h3 ? 4 - 4 * (s2.simplification || 1) : (1 + s2.roughness) / 2), i2 = _2(t4, s2);
          if (o2) if ("solid" === s2.fillStyle) if (1 === r2.length) {
            const e4 = _2(t4, Object.assign(Object.assign({}, s2), { disableMultiStroke: true, roughness: s2.roughness ? s2.roughness + s2.fillShapeRoughnessGain : 0 }));
            n2.push({ type: "fillPath", ops: this._mergedShape(e4.ops) });
          } else n2.push(I2(r2, s2));
          else n2.push(C2(r2, s2));
          return a2 && (h3 ? r2.forEach(((t5) => {
            n2.push(S3(t5, false, s2));
          })) : n2.push(i2)), this._d("path", n2, s2);
        }
        opsToPath(t4, e3) {
          let s2 = "";
          for (const n2 of t4.ops) {
            const t5 = "number" == typeof e3 && e3 >= 0 ? n2.data.map(((t6) => +t6.toFixed(e3))) : n2.data;
            switch (n2.op) {
              case "move":
                s2 += `M${t5[0]} ${t5[1]} `;
                break;
              case "bcurveTo":
                s2 += `C${t5[0]} ${t5[1]}, ${t5[2]} ${t5[3]}, ${t5[4]} ${t5[5]} `;
                break;
              case "lineTo":
                s2 += `L${t5[0]} ${t5[1]} `;
            }
          }
          return s2.trim();
        }
        toPaths(t4) {
          const e3 = t4.sets || [], s2 = t4.options || this.defaultOptions, n2 = [];
          for (const t5 of e3) {
            let e4 = null;
            switch (t5.type) {
              case "path":
                e4 = { d: this.opsToPath(t5), stroke: s2.stroke, strokeWidth: s2.strokeWidth, fill: tt };
                break;
              case "fillPath":
                e4 = { d: this.opsToPath(t5), stroke: tt, strokeWidth: 0, fill: s2.fill || tt };
                break;
              case "fillSketch":
                e4 = this.fillSketch(t5, s2);
            }
            e4 && n2.push(e4);
          }
          return n2;
        }
        fillSketch(t4, e3) {
          let s2 = e3.fillWeight;
          return s2 < 0 && (s2 = e3.strokeWidth / 2), { d: this.opsToPath(t4), stroke: e3.fill || tt, strokeWidth: s2, fill: tt };
        }
        _mergedShape(t4) {
          return t4.filter(((t5, e3) => 0 === e3 || "move" !== t5.op));
        }
      };
      st = class {
        static {
          __name(this, "st");
        }
        constructor(t4, e3) {
          this.canvas = t4, this.ctx = this.canvas.getContext("2d"), this.gen = new et(e3);
        }
        draw(t4) {
          const e3 = t4.sets || [], s2 = t4.options || this.getDefaultOptions(), n2 = this.ctx, o2 = t4.options.fixedDecimalPlaceDigits;
          for (const a2 of e3) switch (a2.type) {
            case "path":
              n2.save(), n2.strokeStyle = "none" === s2.stroke ? "transparent" : s2.stroke, n2.lineWidth = s2.strokeWidth, s2.strokeLineDash && n2.setLineDash(s2.strokeLineDash), s2.strokeLineDashOffset && (n2.lineDashOffset = s2.strokeLineDashOffset), this._drawToContext(n2, a2, o2), n2.restore();
              break;
            case "fillPath": {
              n2.save(), n2.fillStyle = s2.fill || "";
              const e4 = "curve" === t4.shape || "polygon" === t4.shape || "path" === t4.shape ? "evenodd" : "nonzero";
              this._drawToContext(n2, a2, o2, e4), n2.restore();
              break;
            }
            case "fillSketch":
              this.fillSketch(n2, a2, s2);
          }
        }
        fillSketch(t4, e3, s2) {
          let n2 = s2.fillWeight;
          n2 < 0 && (n2 = s2.strokeWidth / 2), t4.save(), s2.fillLineDash && t4.setLineDash(s2.fillLineDash), s2.fillLineDashOffset && (t4.lineDashOffset = s2.fillLineDashOffset), t4.strokeStyle = s2.fill || "", t4.lineWidth = n2, this._drawToContext(t4, e3, s2.fixedDecimalPlaceDigits), t4.restore();
        }
        _drawToContext(t4, e3, s2, n2 = "nonzero") {
          t4.beginPath();
          for (const n3 of e3.ops) {
            const e4 = "number" == typeof s2 && s2 >= 0 ? n3.data.map(((t5) => +t5.toFixed(s2))) : n3.data;
            switch (n3.op) {
              case "move":
                t4.moveTo(e4[0], e4[1]);
                break;
              case "bcurveTo":
                t4.bezierCurveTo(e4[0], e4[1], e4[2], e4[3], e4[4], e4[5]);
                break;
              case "lineTo":
                t4.lineTo(e4[0], e4[1]);
            }
          }
          "fillPath" === e3.type ? t4.fill(n2) : t4.stroke();
        }
        get generator() {
          return this.gen;
        }
        getDefaultOptions() {
          return this.gen.defaultOptions;
        }
        line(t4, e3, s2, n2, o2) {
          const a2 = this.gen.line(t4, e3, s2, n2, o2);
          return this.draw(a2), a2;
        }
        rectangle(t4, e3, s2, n2, o2) {
          const a2 = this.gen.rectangle(t4, e3, s2, n2, o2);
          return this.draw(a2), a2;
        }
        ellipse(t4, e3, s2, n2, o2) {
          const a2 = this.gen.ellipse(t4, e3, s2, n2, o2);
          return this.draw(a2), a2;
        }
        circle(t4, e3, s2, n2) {
          const o2 = this.gen.circle(t4, e3, s2, n2);
          return this.draw(o2), o2;
        }
        linearPath(t4, e3) {
          const s2 = this.gen.linearPath(t4, e3);
          return this.draw(s2), s2;
        }
        polygon(t4, e3) {
          const s2 = this.gen.polygon(t4, e3);
          return this.draw(s2), s2;
        }
        arc(t4, e3, s2, n2, o2, a2, h3 = false, r2) {
          const i2 = this.gen.arc(t4, e3, s2, n2, o2, a2, h3, r2);
          return this.draw(i2), i2;
        }
        curve(t4, e3) {
          const s2 = this.gen.curve(t4, e3);
          return this.draw(s2), s2;
        }
        path(t4, e3) {
          const s2 = this.gen.path(t4, e3);
          return this.draw(s2), s2;
        }
      };
      nt = "http://www.w3.org/2000/svg";
      ot = class {
        static {
          __name(this, "ot");
        }
        constructor(t4, e3) {
          this.svg = t4, this.gen = new et(e3);
        }
        draw(t4) {
          const e3 = t4.sets || [], s2 = t4.options || this.getDefaultOptions(), n2 = this.svg.ownerDocument || window.document, o2 = n2.createElementNS(nt, "g"), a2 = t4.options.fixedDecimalPlaceDigits;
          for (const h3 of e3) {
            let e4 = null;
            switch (h3.type) {
              case "path":
                e4 = n2.createElementNS(nt, "path"), e4.setAttribute("d", this.opsToPath(h3, a2)), e4.setAttribute("stroke", s2.stroke), e4.setAttribute("stroke-width", s2.strokeWidth + ""), e4.setAttribute("fill", "none"), s2.strokeLineDash && e4.setAttribute("stroke-dasharray", s2.strokeLineDash.join(" ").trim()), s2.strokeLineDashOffset && e4.setAttribute("stroke-dashoffset", `${s2.strokeLineDashOffset}`);
                break;
              case "fillPath":
                e4 = n2.createElementNS(nt, "path"), e4.setAttribute("d", this.opsToPath(h3, a2)), e4.setAttribute("stroke", "none"), e4.setAttribute("stroke-width", "0"), e4.setAttribute("fill", s2.fill || ""), "curve" !== t4.shape && "polygon" !== t4.shape || e4.setAttribute("fill-rule", "evenodd");
                break;
              case "fillSketch":
                e4 = this.fillSketch(n2, h3, s2);
            }
            e4 && o2.appendChild(e4);
          }
          return o2;
        }
        fillSketch(t4, e3, s2) {
          let n2 = s2.fillWeight;
          n2 < 0 && (n2 = s2.strokeWidth / 2);
          const o2 = t4.createElementNS(nt, "path");
          return o2.setAttribute("d", this.opsToPath(e3, s2.fixedDecimalPlaceDigits)), o2.setAttribute("stroke", s2.fill || ""), o2.setAttribute("stroke-width", n2 + ""), o2.setAttribute("fill", "none"), s2.fillLineDash && o2.setAttribute("stroke-dasharray", s2.fillLineDash.join(" ").trim()), s2.fillLineDashOffset && o2.setAttribute("stroke-dashoffset", `${s2.fillLineDashOffset}`), o2;
        }
        get generator() {
          return this.gen;
        }
        getDefaultOptions() {
          return this.gen.defaultOptions;
        }
        opsToPath(t4, e3) {
          return this.gen.opsToPath(t4, e3);
        }
        line(t4, e3, s2, n2, o2) {
          const a2 = this.gen.line(t4, e3, s2, n2, o2);
          return this.draw(a2);
        }
        rectangle(t4, e3, s2, n2, o2) {
          const a2 = this.gen.rectangle(t4, e3, s2, n2, o2);
          return this.draw(a2);
        }
        ellipse(t4, e3, s2, n2, o2) {
          const a2 = this.gen.ellipse(t4, e3, s2, n2, o2);
          return this.draw(a2);
        }
        circle(t4, e3, s2, n2) {
          const o2 = this.gen.circle(t4, e3, s2, n2);
          return this.draw(o2);
        }
        linearPath(t4, e3) {
          const s2 = this.gen.linearPath(t4, e3);
          return this.draw(s2);
        }
        polygon(t4, e3) {
          const s2 = this.gen.polygon(t4, e3);
          return this.draw(s2);
        }
        arc(t4, e3, s2, n2, o2, a2, h3 = false, r2) {
          const i2 = this.gen.arc(t4, e3, s2, n2, o2, a2, h3, r2);
          return this.draw(i2);
        }
        curve(t4, e3) {
          const s2 = this.gen.curve(t4, e3);
          return this.draw(s2);
        }
        path(t4, e3) {
          const s2 = this.gen.path(t4, e3);
          return this.draw(s2);
        }
      };
      at = { canvas: /* @__PURE__ */ __name((t4, e3) => new st(t4, e3), "canvas"), svg: /* @__PURE__ */ __name((t4, e3) => new ot(t4, e3), "svg"), generator: /* @__PURE__ */ __name((t4) => new et(t4), "generator"), newSeed: /* @__PURE__ */ __name(() => et.newSeed(), "newSeed") };
    }
  });

  // src/rendering-util/rendering-elements/shapes/anchor.ts
  function anchor(parent4, node2) {
    const { labelStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const classes3 = getNodeClasses(node2);
    let cssClasses = classes3;
    if (!classes3) {
      cssClasses = "anchor";
    }
    const shapeSvg = parent4.insert("g").attr("class", cssClasses).attr("id", node2.domId || node2.id);
    const radius2 = 1;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, { fill: "black", stroke: "none", fillStyle: "solid" });
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
    }
    const roughNode = rc.circle(0, 0, radius2 * 2, options2);
    const circleElem = shapeSvg.insert(() => roughNode, ":first-child");
    circleElem.attr("class", "anchor").attr("style", handleUndefinedAttr(cssStyles));
    updateNodeBounds(node2, circleElem);
    node2.intersect = function(point8) {
      log.info("Circle intersect", node2, radius2, point8);
      return intersect_default.circle(node2, radius2, point8);
    };
    return shapeSvg;
  }
  var init_anchor = __esm({
    "src/rendering-util/rendering-elements/shapes/anchor.ts"() {
      "use strict";
      init_logger();
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_utils2();
      __name(anchor, "anchor");
    }
  });

  // src/rendering-util/rendering-elements/shapes/bowTieRect.ts
  function generateArcPoints(x1, y1, x22, y22, rx, ry, clockwise) {
    const numPoints = 20;
    const midX = (x1 + x22) / 2;
    const midY = (y1 + y22) / 2;
    const angle2 = Math.atan2(y22 - y1, x22 - x1);
    const dx = (x22 - x1) / 2;
    const dy = (y22 - y1) / 2;
    const transformedX = dx / rx;
    const transformedY = dy / ry;
    const distance3 = Math.sqrt(transformedX ** 2 + transformedY ** 2);
    if (distance3 > 1) {
      throw new Error("The given radii are too small to create an arc between the points.");
    }
    const scaledCenterDistance = Math.sqrt(1 - distance3 ** 2);
    const centerX = midX + scaledCenterDistance * ry * Math.sin(angle2) * (clockwise ? -1 : 1);
    const centerY = midY - scaledCenterDistance * rx * Math.cos(angle2) * (clockwise ? -1 : 1);
    const startAngle = Math.atan2((y1 - centerY) / ry, (x1 - centerX) / rx);
    const endAngle = Math.atan2((y22 - centerY) / ry, (x22 - centerX) / rx);
    let angleRange = endAngle - startAngle;
    if (clockwise && angleRange < 0) {
      angleRange += 2 * Math.PI;
    }
    if (!clockwise && angleRange > 0) {
      angleRange -= 2 * Math.PI;
    }
    const points = [];
    for (let i2 = 0; i2 < numPoints; i2++) {
      const t4 = i2 / (numPoints - 1);
      const angle3 = startAngle + t4 * angleRange;
      const x5 = centerX + rx * Math.cos(angle3);
      const y6 = centerY + ry * Math.sin(angle3);
      points.push({ x: x5, y: y6 });
    }
    return points;
  }
  function calculateArcSagitta(chord, radiusX, radiusY) {
    const [semiMajorAxis, semiMinorAxis] = [radiusX, radiusY].sort((a2, b3) => b3 - a2);
    return semiMinorAxis * (1 - Math.sqrt(1 - (chord / semiMajorAxis / 2) ** 2));
  }
  async function bowTieRect(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 16 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 12 : nodePadding;
    const calcTotalHeight = /* @__PURE__ */ __name((labelHeight) => labelHeight + labelPaddingY, "calcTotalHeight");
    const calcEllipseRadius = /* @__PURE__ */ __name((totalHeight2) => {
      const ry2 = totalHeight2 / 2;
      const rx2 = ry2 / (2.5 + totalHeight2 / 50);
      return [rx2, ry2];
    }, "calcEllipseRadius");
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const totalHeight = calcTotalHeight(node2?.height ? node2?.height : bbox.height);
    const [rx, ry] = calcEllipseRadius(totalHeight);
    const sagitta = calculateArcSagitta(totalHeight, rx, ry);
    const totalWidth = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2 + sagitta;
    const w4 = totalWidth - sagitta;
    const h3 = totalHeight;
    const { cssStyles } = node2;
    const points = [
      { x: w4 / 2, y: -h3 / 2 },
      { x: -w4 / 2, y: -h3 / 2 },
      ...generateArcPoints(-w4 / 2, -h3 / 2, -w4 / 2, h3 / 2, rx, ry, false),
      { x: w4 / 2, y: h3 / 2 },
      ...generateArcPoints(w4 / 2, h3 / 2, w4 / 2, -h3 / 2, rx, ry, true)
    ];
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const bowTieRectPath = createPathFromPoints(points);
    const bowTieRectShapePath = rc.path(bowTieRectPath, options2);
    const bowTieRectShape = shapeSvg.insert(() => bowTieRectShapePath, ":first-child");
    bowTieRectShape.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      bowTieRectShape.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      bowTieRectShape.selectAll("path").attr("style", nodeStyles);
    }
    bowTieRectShape.attr("transform", `translate(${rx / 2}, 0)`);
    updateNodeBounds(node2, bowTieRectShape);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_bowTieRect = __esm({
    "src/rendering-util/rendering-elements/shapes/bowTieRect.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      __name(generateArcPoints, "generateArcPoints");
      __name(calculateArcSagitta, "calculateArcSagitta");
      __name(bowTieRect, "bowTieRect");
    }
  });

  // src/rendering-util/rendering-elements/shapes/insertPolygonShape.ts
  function insertPolygonShape(parent4, w4, h3, points) {
    return parent4.insert("polygon", ":first-child").attr(
      "points",
      points.map(function(d3) {
        return d3.x + "," + d3.y;
      }).join(" ")
    ).attr("class", "label-container").attr("transform", "translate(" + -w4 / 2 + "," + h3 / 2 + ")");
  }
  var init_insertPolygonShape = __esm({
    "src/rendering-util/rendering-elements/shapes/insertPolygonShape.ts"() {
      "use strict";
      __name(insertPolygonShape, "insertPolygonShape");
    }
  });

  // src/rendering-util/rendering-elements/shapes/card.ts
  async function card(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 28 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 24 : nodePadding;
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = (node2?.width ?? bbox.width) + (node2.look === "neo" ? labelPaddingX * 2 : labelPaddingX + NOTCH_SIZE);
    const h3 = (node2?.height ?? bbox.height) + (node2.look === "neo" ? labelPaddingY * 2 : labelPaddingY);
    const left3 = 0;
    const right3 = w4;
    const top2 = -h3;
    const bottom2 = 0;
    const points = [
      { x: left3 + NOTCH_SIZE, y: top2 },
      { x: right3, y: top2 },
      { x: right3, y: bottom2 },
      { x: left3, y: bottom2 },
      { x: left3, y: top2 + NOTCH_SIZE },
      { x: left3 + NOTCH_SIZE, y: top2 }
    ];
    let polygon2;
    const { cssStyles } = node2;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options2 = userNodeOverrides(node2, {});
      const pathData = createPathFromPoints(points);
      const roughNode = rc.path(pathData, options2);
      polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w4 / 2}, ${h3 / 2})`);
      if (cssStyles) {
        polygon2.attr("style", cssStyles);
      }
    } else {
      polygon2 = insertPolygonShape(shapeSvg, w4, h3, points);
    }
    if (nodeStyles) {
      polygon2.attr("style", nodeStyles);
    }
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      return intersect_default.polygon(node2, points, point8);
    };
    return shapeSvg;
  }
  var NOTCH_SIZE;
  var init_card = __esm({
    "src/rendering-util/rendering-elements/shapes/card.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_insertPolygonShape();
      init_util();
      NOTCH_SIZE = 12;
      __name(card, "card");
    }
  });

  // src/rendering-util/rendering-elements/shapes/choice.ts
  function choice(parent4, node2) {
    const { nodeStyles } = styles2String(node2);
    node2.label = "";
    const shapeSvg = parent4.insert("g").attr("class", getNodeClasses(node2)).attr("id", node2.domId ?? node2.id);
    const { cssStyles } = node2;
    const s2 = Math.max(28, node2.width ?? 0);
    const points = [
      { x: 0, y: s2 / 2 },
      { x: s2 / 2, y: 0 },
      { x: 0, y: -s2 / 2 },
      { x: -s2 / 2, y: 0 }
    ];
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const choicePath = createPathFromPoints(points);
    const roughNode = rc.path(choicePath, options2);
    const choiceShape = shapeSvg.insert(() => roughNode, ":first-child");
    if (cssStyles && node2.look !== "handDrawn") {
      choiceShape.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      choiceShape.selectAll("path").attr("style", nodeStyles);
    }
    node2.width = 28;
    node2.height = 28;
    node2.intersect = function(point8) {
      return intersect_default.polygon(node2, points, point8);
    };
    return shapeSvg;
  }
  var init_choice = __esm({
    "src/rendering-util/rendering-elements/shapes/choice.ts"() {
      "use strict";
      init_intersect();
      init_rough_esm();
      init_handDrawnShapeStyles();
      init_util();
      __name(choice, "choice");
    }
  });

  // src/rendering-util/rendering-elements/shapes/circle.ts
  async function circle(parent4, node2, options2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const { shapeSvg, bbox, halfPadding } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const labelPadding = 16;
    const padding2 = options2?.padding ?? halfPadding;
    const radius2 = node2.look === "neo" ? bbox.width / 2 + labelPadding * 2 : bbox.width / 2 + padding2;
    let circleElem;
    const { cssStyles } = node2;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options3 = userNodeOverrides(node2, {});
      const roughNode = rc.circle(0, 0, radius2 * 2, options3);
      circleElem = shapeSvg.insert(() => roughNode, ":first-child");
      circleElem.attr("class", "basic label-container").attr("style", handleUndefinedAttr(cssStyles));
    } else {
      circleElem = shapeSvg.insert("circle", ":first-child").attr("class", "basic label-container").attr("style", nodeStyles).attr("r", radius2).attr("cx", 0).attr("cy", 0);
    }
    updateNodeBounds(node2, circleElem);
    node2.calcIntersect = function(bounds4, point8) {
      const radius3 = bounds4.width / 2;
      return intersect_default.circle(bounds4, radius3, point8);
    };
    node2.intersect = function(point8) {
      log.info("Circle intersect", node2, radius2, point8);
      return intersect_default.circle(node2, radius2, point8);
    };
    return shapeSvg;
  }
  var init_circle = __esm({
    "src/rendering-util/rendering-elements/shapes/circle.ts"() {
      "use strict";
      init_rough_esm();
      init_logger();
      init_utils2();
      init_intersect();
      init_handDrawnShapeStyles();
      init_util();
      __name(circle, "circle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/crossedCircle.ts
  function createLine(r2) {
    const xAxis45 = Math.cos(Math.PI / 4);
    const yAxis45 = Math.sin(Math.PI / 4);
    const lineLength = r2 * 2;
    const pointQ1 = { x: lineLength / 2 * xAxis45, y: lineLength / 2 * yAxis45 };
    const pointQ2 = { x: -(lineLength / 2) * xAxis45, y: lineLength / 2 * yAxis45 };
    const pointQ3 = { x: -(lineLength / 2) * xAxis45, y: -(lineLength / 2) * yAxis45 };
    const pointQ4 = { x: lineLength / 2 * xAxis45, y: -(lineLength / 2) * yAxis45 };
    return `M ${pointQ2.x},${pointQ2.y} L ${pointQ4.x},${pointQ4.y}
                   M ${pointQ1.x},${pointQ1.y} L ${pointQ3.x},${pointQ3.y}`;
  }
  function crossedCircle(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    node2.label = "";
    const shapeSvg = parent4.insert("g").attr("class", getNodeClasses(node2)).attr("id", node2.domId ?? node2.id);
    const radius2 = Math.max(30, node2?.width ?? 0);
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const circleNode = rc.circle(0, 0, radius2 * 2, options2);
    const linePath = createLine(radius2);
    const lineNode = rc.path(linePath, options2);
    const crossedCircle2 = shapeSvg.insert(() => circleNode, ":first-child");
    crossedCircle2.insert(() => lineNode);
    crossedCircle2.attr("class", "outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      crossedCircle2.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      crossedCircle2.selectAll("path").attr("style", nodeStyles);
    }
    updateNodeBounds(node2, crossedCircle2);
    node2.intersect = function(point8) {
      log.info("crossedCircle intersect", node2, { radius: radius2, point: point8 });
      const pos = intersect_default.circle(node2, radius2, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_crossedCircle = __esm({
    "src/rendering-util/rendering-elements/shapes/crossedCircle.ts"() {
      "use strict";
      init_logger();
      init_util();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_intersect();
      __name(createLine, "createLine");
      __name(crossedCircle, "crossedCircle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/curlyBraceLeft.ts
  function generateCirclePoints2(centerX, centerY, radius2, numPoints = 100, startAngle = 0, endAngle = 180) {
    const points = [];
    const startAngleRad = startAngle * Math.PI / 180;
    const endAngleRad = endAngle * Math.PI / 180;
    const angleRange = endAngleRad - startAngleRad;
    const angleStep = angleRange / (numPoints - 1);
    for (let i2 = 0; i2 < numPoints; i2++) {
      const angle2 = startAngleRad + i2 * angleStep;
      const x5 = centerX + radius2 * Math.cos(angle2);
      const y6 = centerY + radius2 * Math.sin(angle2);
      points.push({ x: -x5, y: -y6 });
    }
    return points;
  }
  async function curlyBraceLeft(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const paddingX = node2.look === "neo" ? 18 : node2.padding ?? 0;
    const paddingY = node2.look === "neo" ? 12 : node2.padding ?? 0;
    const w4 = bbox.width + paddingX;
    const h3 = bbox.height + paddingY;
    const radius2 = Math.max(5, h3 * 0.1);
    const { cssStyles } = node2;
    const points = [
      ...generateCirclePoints2(w4 / 2, -h3 / 2, radius2, 30, -90, 0),
      { x: -w4 / 2 - radius2, y: radius2 },
      ...generateCirclePoints2(w4 / 2 + radius2 * 2, -radius2, radius2, 20, -180, -270),
      ...generateCirclePoints2(w4 / 2 + radius2 * 2, radius2, radius2, 20, -90, -180),
      { x: -w4 / 2 - radius2, y: -h3 / 2 },
      ...generateCirclePoints2(w4 / 2, h3 / 2, radius2, 20, 0, 90)
    ];
    const rectPoints = [
      { x: w4 / 2, y: -h3 / 2 - radius2 },
      { x: -w4 / 2, y: -h3 / 2 - radius2 },
      ...generateCirclePoints2(w4 / 2, -h3 / 2, radius2, 20, -90, 0),
      { x: -w4 / 2 - radius2, y: -radius2 },
      ...generateCirclePoints2(w4 / 2 + w4 * 0.1, -radius2, radius2, 20, -180, -270),
      ...generateCirclePoints2(w4 / 2 + w4 * 0.1, radius2, radius2, 20, -90, -180),
      { x: -w4 / 2 - radius2, y: h3 / 2 },
      ...generateCirclePoints2(w4 / 2, h3 / 2, radius2, 20, 0, 90),
      { x: -w4 / 2, y: h3 / 2 + radius2 },
      { x: w4 / 2, y: h3 / 2 + radius2 }
    ];
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, { fill: "none" });
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const curlyBraceLeftPath = createPathFromPoints(points);
    const newCurlyBracePath = curlyBraceLeftPath.replace("Z", "");
    const curlyBraceLeftNode = rc.path(newCurlyBracePath, options2);
    const rectPath = createPathFromPoints(rectPoints);
    const rectShape = rc.path(rectPath, { ...options2 });
    const curlyBraceLeftShape = shapeSvg.insert("g", ":first-child");
    curlyBraceLeftShape.insert(() => rectShape, ":first-child").attr("stroke-opacity", 0);
    curlyBraceLeftShape.insert(() => curlyBraceLeftNode, ":first-child");
    curlyBraceLeftShape.attr("class", "text");
    if (cssStyles && node2.look !== "handDrawn") {
      curlyBraceLeftShape.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      curlyBraceLeftShape.selectAll("path").attr("style", nodeStyles);
    }
    curlyBraceLeftShape.attr("transform", `translate(${radius2}, 0)`);
    label.attr(
      "transform",
      `translate(${-w4 / 2 + radius2 - (bbox.x - (bbox.left ?? 0))},${-h3 / 2 + (node2.padding ?? 0) / 2 - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, curlyBraceLeftShape);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, rectPoints, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_curlyBraceLeft = __esm({
    "src/rendering-util/rendering-elements/shapes/curlyBraceLeft.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      __name(generateCirclePoints2, "generateCirclePoints");
      __name(curlyBraceLeft, "curlyBraceLeft");
    }
  });

  // src/rendering-util/rendering-elements/shapes/curlyBraceRight.ts
  function generateCirclePoints3(centerX, centerY, radius2, numPoints = 100, startAngle = 0, endAngle = 180) {
    const points = [];
    const startAngleRad = startAngle * Math.PI / 180;
    const endAngleRad = endAngle * Math.PI / 180;
    const angleRange = endAngleRad - startAngleRad;
    const angleStep = angleRange / (numPoints - 1);
    for (let i2 = 0; i2 < numPoints; i2++) {
      const angle2 = startAngleRad + i2 * angleStep;
      const x5 = centerX + radius2 * Math.cos(angle2);
      const y6 = centerY + radius2 * Math.sin(angle2);
      points.push({ x: x5, y: y6 });
    }
    return points;
  }
  async function curlyBraceRight(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const labelPaddingX = node2.look === "neo" ? 18 : node2.padding ?? 0;
    const labelPaddingY = node2.look === "neo" ? 12 : node2.padding ?? 0;
    const w4 = bbox.width + (node2.look === "neo" ? labelPaddingX * 2 : labelPaddingX);
    const h3 = bbox.height + (node2.look === "neo" ? labelPaddingY * 2 : labelPaddingY);
    const radius2 = Math.max(5, h3 * 0.1);
    const { cssStyles } = node2;
    const points = [
      ...generateCirclePoints3(w4 / 2, -h3 / 2, radius2, 20, -90, 0),
      { x: w4 / 2 + radius2, y: -radius2 },
      ...generateCirclePoints3(w4 / 2 + radius2 * 2, -radius2, radius2, 20, -180, -270),
      ...generateCirclePoints3(w4 / 2 + radius2 * 2, radius2, radius2, 20, -90, -180),
      { x: w4 / 2 + radius2, y: h3 / 2 },
      ...generateCirclePoints3(w4 / 2, h3 / 2, radius2, 20, 0, 90)
    ];
    const rectPoints = [
      { x: -w4 / 2, y: -h3 / 2 - radius2 },
      { x: w4 / 2, y: -h3 / 2 - radius2 },
      ...generateCirclePoints3(w4 / 2, -h3 / 2, radius2, 20, -90, 0),
      { x: w4 / 2 + radius2, y: -radius2 },
      ...generateCirclePoints3(w4 / 2 + radius2 * 2, -radius2, radius2, 20, -180, -270),
      ...generateCirclePoints3(w4 / 2 + radius2 * 2, radius2, radius2, 20, -90, -180),
      { x: w4 / 2 + radius2, y: h3 / 2 },
      ...generateCirclePoints3(w4 / 2, h3 / 2, radius2, 20, 0, 90),
      { x: w4 / 2, y: h3 / 2 + radius2 },
      { x: -w4 / 2, y: h3 / 2 + radius2 }
    ];
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, { fill: "none" });
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const curlyBraceRightPath = createPathFromPoints(points);
    const newCurlyBracePath = curlyBraceRightPath.replace("Z", "");
    const curlyBraceRightNode = rc.path(newCurlyBracePath, options2);
    const rectPath = createPathFromPoints(rectPoints);
    const rectShape = rc.path(rectPath, { ...options2 });
    const curlyBraceRightShape = shapeSvg.insert("g", ":first-child");
    curlyBraceRightShape.insert(() => rectShape, ":first-child").attr("stroke-opacity", 0);
    curlyBraceRightShape.insert(() => curlyBraceRightNode, ":first-child");
    curlyBraceRightShape.attr("class", "text");
    if (cssStyles && node2.look !== "handDrawn") {
      curlyBraceRightShape.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      curlyBraceRightShape.selectAll("path").attr("style", nodeStyles);
    }
    curlyBraceRightShape.attr("transform", `translate(${-radius2}, 0)`);
    label.attr(
      "transform",
      `translate(${-w4 / 2 + (node2.padding ?? 0) / 2 - (bbox.x - (bbox.left ?? 0))},${-h3 / 2 + (node2.padding ?? 0) / 2 - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, curlyBraceRightShape);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, rectPoints, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_curlyBraceRight = __esm({
    "src/rendering-util/rendering-elements/shapes/curlyBraceRight.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      __name(generateCirclePoints3, "generateCirclePoints");
      __name(curlyBraceRight, "curlyBraceRight");
    }
  });

  // src/rendering-util/rendering-elements/shapes/curlyBraces.ts
  function generateCirclePoints4(centerX, centerY, radius2, numPoints = 100, startAngle = 0, endAngle = 180) {
    const points = [];
    const startAngleRad = startAngle * Math.PI / 180;
    const endAngleRad = endAngle * Math.PI / 180;
    const angleRange = endAngleRad - startAngleRad;
    const angleStep = angleRange / (numPoints - 1);
    for (let i2 = 0; i2 < numPoints; i2++) {
      const angle2 = startAngleRad + i2 * angleStep;
      const x5 = centerX + radius2 * Math.cos(angle2);
      const y6 = centerY + radius2 * Math.sin(angle2);
      points.push({ x: -x5, y: -y6 });
    }
    return points;
  }
  async function curlyBraces(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const labelPaddingX = node2.look === "neo" ? 18 : node2.padding ?? 0;
    const labelPaddingY = node2.look === "neo" ? 12 : node2.padding ?? 0;
    const w4 = bbox.width + (node2.look === "neo" ? labelPaddingX * 2 : labelPaddingX);
    const h3 = bbox.height + (node2.look === "neo" ? labelPaddingY * 2 : labelPaddingY);
    const radius2 = Math.max(5, h3 * 0.1);
    const { cssStyles } = node2;
    const leftCurlyBracePoints = [
      ...generateCirclePoints4(w4 / 2, -h3 / 2, radius2, 30, -90, 0),
      { x: -w4 / 2 - radius2, y: radius2 },
      ...generateCirclePoints4(w4 / 2 + radius2 * 2, -radius2, radius2, 20, -180, -270),
      ...generateCirclePoints4(w4 / 2 + radius2 * 2, radius2, radius2, 20, -90, -180),
      { x: -w4 / 2 - radius2, y: -h3 / 2 },
      ...generateCirclePoints4(w4 / 2, h3 / 2, radius2, 20, 0, 90)
    ];
    const rightCurlyBracePoints = [
      ...generateCirclePoints4(-w4 / 2 + radius2 + radius2 / 2, -h3 / 2, radius2, 20, -90, -180),
      { x: w4 / 2 - radius2 / 2, y: radius2 },
      ...generateCirclePoints4(-w4 / 2 - radius2 / 2, -radius2, radius2, 20, 0, 90),
      ...generateCirclePoints4(-w4 / 2 - radius2 / 2, radius2, radius2, 20, -90, 0),
      { x: w4 / 2 - radius2 / 2, y: -radius2 },
      ...generateCirclePoints4(-w4 / 2 + radius2 + radius2 / 2, h3 / 2, radius2, 30, -180, -270)
    ];
    const rectPoints = [
      { x: w4 / 2, y: -h3 / 2 - radius2 },
      { x: -w4 / 2, y: -h3 / 2 - radius2 },
      ...generateCirclePoints4(w4 / 2, -h3 / 2, radius2, 20, -90, 0),
      { x: -w4 / 2 - radius2, y: -radius2 },
      ...generateCirclePoints4(w4 / 2 + radius2 * 2, -radius2, radius2, 20, -180, -270),
      ...generateCirclePoints4(w4 / 2 + radius2 * 2, radius2, radius2, 20, -90, -180),
      { x: -w4 / 2 - radius2, y: h3 / 2 },
      ...generateCirclePoints4(w4 / 2, h3 / 2, radius2, 20, 0, 90),
      { x: -w4 / 2, y: h3 / 2 + radius2 },
      { x: w4 / 2 - radius2 - radius2 / 2, y: h3 / 2 + radius2 },
      ...generateCirclePoints4(-w4 / 2 + radius2 + radius2 / 2, -h3 / 2, radius2, 20, -90, -180),
      { x: w4 / 2 - radius2 / 2, y: radius2 },
      ...generateCirclePoints4(-w4 / 2 - radius2 / 2, -radius2, radius2, 20, 0, 90),
      ...generateCirclePoints4(-w4 / 2 - radius2 / 2, radius2, radius2, 20, -90, 0),
      { x: w4 / 2 - radius2 / 2, y: -radius2 },
      ...generateCirclePoints4(-w4 / 2 + radius2 + radius2 / 2, h3 / 2, radius2, 30, -180, -270)
    ];
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, { fill: "none" });
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const leftCurlyBracePath = createPathFromPoints(leftCurlyBracePoints);
    const newLeftCurlyBracePath = leftCurlyBracePath.replace("Z", "");
    const leftCurlyBraceNode = rc.path(newLeftCurlyBracePath, options2);
    const rightCurlyBracePath = createPathFromPoints(rightCurlyBracePoints);
    const newRightCurlyBracePath = rightCurlyBracePath.replace("Z", "");
    const rightCurlyBraceNode = rc.path(newRightCurlyBracePath, options2);
    const rectPath = createPathFromPoints(rectPoints);
    const rectShape = rc.path(rectPath, { ...options2 });
    const curlyBracesShape = shapeSvg.insert("g", ":first-child");
    curlyBracesShape.insert(() => rectShape, ":first-child").attr("stroke-opacity", 0);
    curlyBracesShape.insert(() => leftCurlyBraceNode, ":first-child");
    curlyBracesShape.insert(() => rightCurlyBraceNode, ":first-child");
    curlyBracesShape.attr("class", "text");
    if (cssStyles && node2.look !== "handDrawn") {
      curlyBracesShape.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      curlyBracesShape.selectAll("path").attr("style", nodeStyles);
    }
    curlyBracesShape.attr("transform", `translate(${radius2 - radius2 / 4}, 0)`);
    label.attr(
      "transform",
      `translate(${-w4 / 2 + (node2.padding ?? 0) / 2 - (bbox.x - (bbox.left ?? 0))},${-h3 / 2 + (node2.padding ?? 0) / 2 - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, curlyBracesShape);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, rectPoints, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_curlyBraces = __esm({
    "src/rendering-util/rendering-elements/shapes/curlyBraces.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      __name(generateCirclePoints4, "generateCirclePoints");
      __name(curlyBraces, "curlyBraces");
    }
  });

  // src/rendering-util/rendering-elements/shapes/curvedTrapezoid.ts
  async function curvedTrapezoid(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 16 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 12 : nodePadding;
    const minWidth = 20, minHeight = 5;
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = Math.max(minWidth, (bbox.width + labelPaddingX * 2) * 1.25, node2?.width ?? 0);
    const h3 = Math.max(minHeight, bbox.height + labelPaddingY * 2, node2?.height ?? 0);
    const radius2 = h3 / 2;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const totalWidth = w4, totalHeight = h3;
    const rw = totalWidth - radius2;
    const tw = totalHeight / 4;
    const points = [
      { x: rw, y: 0 },
      { x: tw, y: 0 },
      { x: 0, y: totalHeight / 2 },
      { x: tw, y: totalHeight },
      { x: rw, y: totalHeight },
      ...generateCirclePoints(-rw, -totalHeight / 2, radius2, 50, 270, 90)
    ];
    const pathData = createPathFromPoints(points);
    const shapeNode = rc.path(pathData, options2);
    const polygon2 = shapeSvg.insert(() => shapeNode, ":first-child");
    polygon2.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", nodeStyles);
    }
    polygon2.attr("transform", `translate(${-w4 / 2}, ${-h3 / 2})`);
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_curvedTrapezoid = __esm({
    "src/rendering-util/rendering-elements/shapes/curvedTrapezoid.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      __name(curvedTrapezoid, "curvedTrapezoid");
    }
  });

  // src/rendering-util/rendering-elements/shapes/cylinder.ts
  async function cylinder(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 24 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 24 : nodePadding;
    if (node2.width || node2.height) {
      const originalWidth = node2.width ?? 0;
      node2.width = (node2.width ?? 0) - labelPaddingY;
      if (node2.width < MIN_WIDTH) {
        node2.width = MIN_WIDTH;
      }
      const rx2 = originalWidth / 2;
      const ry2 = rx2 / (2.5 + originalWidth / 50);
      node2.height = (node2.height ?? 0) - labelPaddingX - ry2 * 3;
      if (node2.height < MIN_HEIGHT) {
        node2.height = MIN_HEIGHT;
      }
    }
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = (node2.width ? node2.width : bbox.width) + labelPaddingY;
    const rx = w4 / 2;
    const ry = rx / (2.5 + w4 / 50);
    const h3 = (node2.height ? node2.height : bbox.height) + labelPaddingX + ry;
    let cylinder3;
    const { cssStyles } = node2;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const outerPathData = createOuterCylinderPathD(0, 0, w4, h3, rx, ry);
      const innerPathData = createInnerCylinderPathD(0, ry, w4, h3, rx, ry);
      const options2 = userNodeOverrides(node2, {});
      const outerNode = rc.path(outerPathData, options2);
      const innerLine = rc.path(innerPathData, userNodeOverrides(node2, { fill: "none" }));
      cylinder3 = shapeSvg.insert(() => innerLine, ":first-child");
      cylinder3 = shapeSvg.insert(() => outerNode, ":first-child");
      cylinder3.attr("class", "basic label-container");
      if (cssStyles) {
        cylinder3.attr("style", cssStyles);
      }
    } else {
      const pathData = createCylinderPathD(0, 0, w4, h3, rx, ry);
      cylinder3 = shapeSvg.insert("path", ":first-child").attr("d", pathData).attr("class", "basic label-container outer-path").attr("style", handleUndefinedAttr(cssStyles)).attr("style", nodeStyles);
    }
    cylinder3.attr("label-offset-y", ry);
    cylinder3.attr("transform", `translate(${-w4 / 2}, ${-(h3 / 2 + ry)})`);
    updateNodeBounds(node2, cylinder3);
    label.attr(
      "transform",
      `translate(${-(bbox.width / 2) - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + (node2.padding ?? 0) / 1.5 - (bbox.y - (bbox.top ?? 0))})`
    );
    node2.intersect = function(point8) {
      const pos = intersect_default.rect(node2, point8);
      const x5 = pos.x - (node2.x ?? 0);
      if (rx != 0 && (Math.abs(x5) < (node2.width ?? 0) / 2 || Math.abs(x5) == (node2.width ?? 0) / 2 && Math.abs(pos.y - (node2.y ?? 0)) > (node2.height ?? 0) / 2 - ry)) {
        let y6 = ry * ry * (1 - x5 * x5 / (rx * rx));
        if (y6 > 0) {
          y6 = Math.sqrt(y6);
        }
        y6 = ry - y6;
        if (point8.y - (node2.y ?? 0) > 0) {
          y6 = -y6;
        }
        pos.y += y6;
      }
      return pos;
    };
    return shapeSvg;
  }
  var createCylinderPathD, createOuterCylinderPathD, createInnerCylinderPathD, MIN_HEIGHT, MIN_WIDTH;
  var init_cylinder = __esm({
    "src/rendering-util/rendering-elements/shapes/cylinder.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_utils2();
      createCylinderPathD = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => {
        return [
          `M${x5},${y6 + ry}`,
          `a${rx},${ry} 0,0,0 ${width3},0`,
          `a${rx},${ry} 0,0,0 ${-width3},0`,
          `l0,${height2}`,
          `a${rx},${ry} 0,0,0 ${width3},0`,
          `l0,${-height2}`
        ].join(" ");
      }, "createCylinderPathD");
      createOuterCylinderPathD = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => {
        return [
          `M${x5},${y6 + ry}`,
          `M${x5 + width3},${y6 + ry}`,
          `a${rx},${ry} 0,0,0 ${-width3},0`,
          `l0,${height2}`,
          `a${rx},${ry} 0,0,0 ${width3},0`,
          `l0,${-height2}`
        ].join(" ");
      }, "createOuterCylinderPathD");
      createInnerCylinderPathD = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => {
        return [`M${x5 - width3 / 2},${-height2 / 2}`, `a${rx},${ry} 0,0,0 ${width3},0`].join(" ");
      }, "createInnerCylinderPathD");
      MIN_HEIGHT = 8;
      MIN_WIDTH = 8;
      __name(cylinder, "cylinder");
    }
  });

  // src/rendering-util/rendering-elements/shapes/dividedRect.ts
  async function dividedRectangle(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const paddingX = node2.look === "neo" ? 16 : node2.padding ?? 0;
    const paddingY = node2.look === "neo" ? 16 : node2.padding ?? 0;
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = bbox.width + paddingX;
    const h3 = bbox.height + paddingY;
    const rectOffset2 = h3 * 0.2;
    const x5 = -w4 / 2;
    const y6 = -h3 / 2 - rectOffset2 / 2;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const pts2 = [
      { x: x5, y: y6 + rectOffset2 },
      { x: -x5, y: y6 + rectOffset2 },
      { x: -x5, y: -y6 },
      { x: x5, y: -y6 },
      { x: x5, y: y6 },
      { x: -x5, y: y6 },
      { x: -x5, y: y6 + rectOffset2 }
    ];
    const poly = rc.polygon(
      pts2.map((p3) => [p3.x, p3.y]),
      options2
    );
    const polygon2 = shapeSvg.insert(() => poly, ":first-child");
    polygon2.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      polygon2.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      polygon2.selectAll("path").attr("style", nodeStyles);
    }
    label.attr(
      "transform",
      `translate(${x5 + (node2.padding ?? 0) / 2 - (bbox.x - (bbox.left ?? 0))}, ${y6 + rectOffset2 + (node2.padding ?? 0) / 2 - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      const pos = intersect_default.rect(node2, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_dividedRect = __esm({
    "src/rendering-util/rendering-elements/shapes/dividedRect.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      __name(dividedRectangle, "dividedRectangle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/doubleCircle.ts
  async function doublecircle(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    const gap = node2.look === "neo" ? 12 : 5;
    node2.labelStyle = labelStyles;
    const padding2 = node2.padding ?? 0;
    const labelPadding = node2.look === "neo" ? 16 : padding2;
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const outerRadius = (node2?.width ? node2?.width / 2 : bbox.width / 2) + (labelPadding ?? 0);
    const innerRadius = outerRadius - gap;
    let circleGroup;
    const { cssStyles } = node2;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const outerOptions = userNodeOverrides(node2, { roughness: 0.2, strokeWidth: 2.5 });
      const innerOptions = userNodeOverrides(node2, { roughness: 0.2, strokeWidth: 1.5 });
      const outerRoughNode = rc.circle(0, 0, outerRadius * 2, outerOptions);
      const innerRoughNode = rc.circle(0, 0, innerRadius * 2, innerOptions);
      circleGroup = shapeSvg.insert("g", ":first-child");
      circleGroup.attr("class", handleUndefinedAttr(node2.cssClasses)).attr("style", handleUndefinedAttr(cssStyles));
      circleGroup.node()?.appendChild(outerRoughNode);
      circleGroup.node()?.appendChild(innerRoughNode);
    } else {
      circleGroup = shapeSvg.insert("g", ":first-child");
      const outerCircle = circleGroup.insert("circle", ":first-child");
      const innerCircle = circleGroup.insert("circle");
      circleGroup.attr("class", "basic label-container").attr("style", nodeStyles);
      outerCircle.attr("class", "outer-circle").attr("style", nodeStyles).attr("r", outerRadius).attr("cx", 0).attr("cy", 0);
      innerCircle.attr("class", "inner-circle").attr("style", nodeStyles).attr("r", innerRadius).attr("cx", 0).attr("cy", 0);
    }
    updateNodeBounds(node2, circleGroup);
    node2.intersect = function(point8) {
      log.info("DoubleCircle intersect", node2, outerRadius, point8);
      return intersect_default.circle(node2, outerRadius, point8);
    };
    return shapeSvg;
  }
  var init_doubleCircle = __esm({
    "src/rendering-util/rendering-elements/shapes/doubleCircle.ts"() {
      "use strict";
      init_logger();
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_utils2();
      __name(doublecircle, "doublecircle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/filledCircle.ts
  function filledCircle(parent4, node2, { config: { themeVariables } }) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.label = "";
    node2.labelStyle = labelStyles;
    const shapeSvg = parent4.insert("g").attr("class", getNodeClasses(node2)).attr("id", node2.domId ?? node2.id);
    const radius2 = 7;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const { nodeBorder } = themeVariables;
    const options2 = userNodeOverrides(node2, { fillStyle: "solid" });
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
    }
    const circleNode = rc.circle(0, 0, radius2 * 2, options2);
    const filledCircle2 = shapeSvg.insert(() => circleNode, ":first-child");
    filledCircle2.selectAll("path").attr("style", `fill: ${nodeBorder} !important;`);
    if (cssStyles && cssStyles.length > 0 && node2.look !== "handDrawn") {
      filledCircle2.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      filledCircle2.selectAll("path").attr("style", nodeStyles);
    }
    updateNodeBounds(node2, filledCircle2);
    node2.intersect = function(point8) {
      log.info("filledCircle intersect", node2, { radius: radius2, point: point8 });
      const pos = intersect_default.circle(node2, radius2, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_filledCircle = __esm({
    "src/rendering-util/rendering-elements/shapes/filledCircle.ts"() {
      "use strict";
      init_rough_esm();
      init_logger();
      init_intersect();
      init_handDrawnShapeStyles();
      init_util();
      __name(filledCircle, "filledCircle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/flippedTriangle.ts
  async function flippedTriangle(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? nodePadding * 2 : nodePadding;
    if (node2.width || node2.height) {
      node2.height = node2?.height ?? 0;
      if (node2.height < MIN_HEIGHT2) {
        node2.height = MIN_HEIGHT2;
      }
      node2.width = (node2?.width ?? 0) - labelPaddingX - labelPaddingX / 2;
      if (node2.width < MIN_WIDTH2) {
        node2.width = MIN_WIDTH2;
      }
    }
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = (node2?.width ? node2?.width : bbox.width) + (labelPaddingX ?? 0);
    const h3 = node2?.height ? node2?.height : w4 + bbox.height;
    const tw = h3;
    const points = [
      { x: 0, y: -h3 },
      { x: tw, y: -h3 },
      { x: tw / 2, y: 0 }
    ];
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const pathData = createPathFromPoints(points);
    const roughNode = rc.path(pathData, options2);
    const flippedTriangle2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-h3 / 2}, ${h3 / 2})`).attr("class", "outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      flippedTriangle2.selectChildren("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      flippedTriangle2.selectChildren("path").attr("style", nodeStyles);
    }
    node2.width = w4;
    node2.height = h3;
    updateNodeBounds(node2, flippedTriangle2);
    label.attr(
      "transform",
      `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${-h3 / 2 + (node2.padding ?? 0) / 2 + (bbox.y - (bbox.top ?? 0))})`
    );
    node2.intersect = function(point8) {
      log.info("Triangle intersect", node2, points, point8);
      return intersect_default.polygon(node2, points, point8);
    };
    return shapeSvg;
  }
  var MIN_HEIGHT2, MIN_WIDTH2;
  var init_flippedTriangle = __esm({
    "src/rendering-util/rendering-elements/shapes/flippedTriangle.ts"() {
      "use strict";
      init_logger();
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_util();
      MIN_HEIGHT2 = 10;
      MIN_WIDTH2 = 10;
      __name(flippedTriangle, "flippedTriangle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/forkJoin.ts
  function forkJoin(parent4, node2, { dir: dir2, config: { state: state4, themeVariables } }) {
    const { nodeStyles } = styles2String(node2);
    node2.label = "";
    const shapeSvg = parent4.insert("g").attr("class", getNodeClasses(node2)).attr("id", node2.domId ?? node2.id);
    const { cssStyles } = node2;
    let width3 = Math.max(70, node2?.width ?? 0);
    let height2 = Math.max(10, node2?.height ?? 0);
    if (dir2 === "LR") {
      width3 = Math.max(10, node2?.width ?? 0);
      height2 = Math.max(70, node2?.height ?? 0);
    }
    const x5 = -1 * width3 / 2;
    const y6 = -1 * height2 / 2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {
      stroke: themeVariables.lineColor,
      fill: themeVariables.lineColor
    });
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const roughNode = rc.rectangle(x5, y6, width3, height2, options2);
    const shape = shapeSvg.insert(() => roughNode, ":first-child");
    if (cssStyles && node2.look !== "handDrawn") {
      shape.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      shape.selectAll("path").attr("style", nodeStyles);
    }
    updateNodeBounds(node2, shape);
    const padding2 = state4?.padding ?? 0;
    if (node2.width && node2.height) {
      node2.width += padding2 / 2 || 0;
      node2.height += padding2 / 2 || 0;
    }
    node2.intersect = function(point8) {
      return intersect_default.rect(node2, point8);
    };
    return shapeSvg;
  }
  var init_forkJoin = __esm({
    "src/rendering-util/rendering-elements/shapes/forkJoin.ts"() {
      "use strict";
      init_rough_esm();
      init_intersect();
      init_handDrawnShapeStyles();
      init_util();
      __name(forkJoin, "forkJoin");
    }
  });

  // src/rendering-util/rendering-elements/shapes/halfRoundedRectangle.ts
  async function halfRoundedRectangle(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const minWidth = 15, minHeight = 10;
    const paddingX = node2.look === "neo" ? 16 : node2.padding ?? 0;
    const paddingY = node2.look === "neo" ? 12 : node2.padding ?? 0;
    if (node2.width || node2.height) {
      node2.height = (node2?.height ?? 0) - paddingY * 2;
      if (node2.height < minHeight) {
        node2.height = minHeight;
      }
      node2.width = (node2?.width ?? 0) - paddingX * 2;
      if (node2.width < minWidth) {
        node2.width = minWidth;
      }
    }
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = (node2?.width ? node2?.width : Math.max(minWidth, bbox.width)) + paddingX * 2;
    const h3 = (node2?.height ? node2?.height : Math.max(minHeight, bbox.height)) + paddingY * 2;
    const radius2 = h3 / 2;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const points = [
      { x: -w4 / 2, y: -h3 / 2 },
      { x: w4 / 2 - radius2, y: -h3 / 2 },
      ...generateCirclePoints(-w4 / 2 + radius2, 0, radius2, 50, 90, 270),
      { x: w4 / 2 - radius2, y: h3 / 2 },
      { x: -w4 / 2, y: h3 / 2 }
    ];
    const pathData = createPathFromPoints(points);
    const shapeNode = rc.path(pathData, options2);
    const polygon2 = shapeSvg.insert(() => shapeNode, ":first-child");
    polygon2.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", nodeStyles);
    }
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      log.info("Pill intersect", node2, { radius: radius2, point: point8 });
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_halfRoundedRectangle = __esm({
    "src/rendering-util/rendering-elements/shapes/halfRoundedRectangle.ts"() {
      "use strict";
      init_logger();
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      __name(halfRoundedRectangle, "halfRoundedRectangle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/hexagon.ts
  async function hexagon(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    const f2 = node2.look === "neo" ? 3.5 : 4;
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const wa = 70;
    const ha = 32;
    const labelPaddingX = node2.look === "neo" ? wa : nodePadding;
    const labelPaddingY = node2.look === "neo" ? ha : nodePadding;
    if (node2.width || node2.height) {
      const originalHeight = node2.height ?? 0;
      const m4 = originalHeight / f2;
      node2.width = (node2?.width ?? 0) - 2 * m4 - labelPaddingY;
      node2.height = (node2.height ?? 0) - labelPaddingX;
    }
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const h3 = (node2?.height ? node2?.height : bbox.height) + labelPaddingX;
    const m3 = h3 / f2;
    const w4 = (node2?.width ? node2?.width : bbox.width) + 2 * m3 + labelPaddingY;
    const points = [
      { x: m3, y: 0 },
      { x: w4 - m3, y: 0 },
      { x: w4, y: -h3 / 2 },
      { x: w4 - m3, y: -h3 },
      { x: m3, y: -h3 },
      { x: 0, y: -h3 / 2 }
    ];
    let polygon2;
    const { cssStyles } = node2;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options2 = userNodeOverrides(node2, {});
      const pathData = createHexagonPathD(0, 0, w4, h3, m3);
      const roughNode = rc.path(pathData, options2);
      polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w4 / 2}, ${h3 / 2})`);
      if (cssStyles) {
        polygon2.attr("style", cssStyles);
      }
    } else {
      polygon2 = insertPolygonShape(shapeSvg, w4, h3, points);
    }
    if (nodeStyles) {
      polygon2.attr("style", nodeStyles);
    }
    node2.width = w4;
    node2.height = h3;
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      return intersect_default.polygon(node2, points, point8);
    };
    return shapeSvg;
  }
  var createHexagonPathD;
  var init_hexagon = __esm({
    "src/rendering-util/rendering-elements/shapes/hexagon.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_insertPolygonShape();
      createHexagonPathD = /* @__PURE__ */ __name((x5, y6, width3, height2, m3) => {
        return [
          `M${x5 + m3},${y6}`,
          `L${x5 + width3 - m3},${y6}`,
          `L${x5 + width3},${y6 - height2 / 2}`,
          `L${x5 + width3 - m3},${y6 - height2}`,
          `L${x5 + m3},${y6 - height2}`,
          `L${x5},${y6 - height2 / 2}`,
          "Z"
        ].join(" ");
      }, "createHexagonPathD");
      __name(hexagon, "hexagon");
    }
  });

  // src/rendering-util/rendering-elements/shapes/hourglass.ts
  async function hourglass(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.label = "";
    node2.labelStyle = labelStyles;
    const { shapeSvg } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = Math.max(30, node2?.width ?? 0);
    const h3 = Math.max(30, node2?.height ?? 0);
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const points = [
      { x: 0, y: 0 },
      { x: w4, y: 0 },
      { x: 0, y: h3 },
      { x: w4, y: h3 }
    ];
    const pathData = createPathFromPoints(points);
    const shapeNode = rc.path(pathData, options2);
    const polygon2 = shapeSvg.insert(() => shapeNode, ":first-child");
    polygon2.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", nodeStyles);
    }
    polygon2.attr("transform", `translate(${-w4 / 2}, ${-h3 / 2})`);
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      log.info("Pill intersect", node2, { points });
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_hourglass = __esm({
    "src/rendering-util/rendering-elements/shapes/hourglass.ts"() {
      "use strict";
      init_logger();
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      __name(hourglass, "hourglass");
    }
  });

  // src/rendering-util/rendering-elements/shapes/icon.ts
  async function icon(parent4, node2, { config: { themeVariables, flowchart } }) {
    const { labelStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const assetHeight = node2.assetHeight ?? 48;
    const assetWidth = node2.assetWidth ?? 48;
    const iconSize = Math.max(assetHeight, assetWidth);
    const defaultWidth = flowchart?.wrappingWidth;
    node2.width = Math.max(iconSize, defaultWidth ?? 0);
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, "icon-shape default");
    const topLabel = node2.pos === "t";
    const height2 = iconSize;
    const width3 = iconSize;
    const { nodeBorder } = themeVariables;
    const { stylesMap } = compileStyles(node2);
    const x5 = -width3 / 2;
    const y6 = -height2 / 2;
    const labelPadding = node2.label ? 8 : 0;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, { stroke: "none", fill: "none" });
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const iconNode = rc.rectangle(x5, y6, width3, height2, options2);
    const outerWidth = Math.max(width3, bbox.width);
    const outerHeight = height2 + bbox.height + labelPadding;
    const outerNode = rc.rectangle(-outerWidth / 2, -outerHeight / 2, outerWidth, outerHeight, {
      ...options2,
      fill: "transparent",
      stroke: "none"
    });
    const iconShape = shapeSvg.insert(() => iconNode, ":first-child");
    const outerShape = shapeSvg.insert(() => outerNode);
    if (node2.icon) {
      const iconElem = shapeSvg.append("g");
      iconElem.html(
        `<g>${await getIconSVG(node2.icon, {
          height: iconSize,
          width: iconSize,
          fallbackPrefix: ""
        })}</g>`
      );
      const iconBBox = iconElem.node().getBBox();
      const iconWidth = iconBBox.width;
      const iconHeight = iconBBox.height;
      const iconX = iconBBox.x;
      const iconY = iconBBox.y;
      iconElem.attr(
        "transform",
        `translate(${-iconWidth / 2 - iconX},${topLabel ? bbox.height / 2 + labelPadding / 2 - iconHeight / 2 - iconY : -bbox.height / 2 - labelPadding / 2 - iconHeight / 2 - iconY})`
      );
      iconElem.attr("style", `color: ${stylesMap.get("stroke") ?? nodeBorder};`);
    }
    label.attr(
      "transform",
      `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))},${topLabel ? -outerHeight / 2 : outerHeight / 2 - bbox.height})`
    );
    iconShape.attr(
      "transform",
      `translate(${0},${topLabel ? bbox.height / 2 + labelPadding / 2 : -bbox.height / 2 - labelPadding / 2})`
    );
    updateNodeBounds(node2, outerShape);
    node2.intersect = function(point8) {
      log.info("iconSquare intersect", node2, point8);
      if (!node2.label) {
        return intersect_default.rect(node2, point8);
      }
      const dx = node2.x ?? 0;
      const dy = node2.y ?? 0;
      const nodeHeight = node2.height ?? 0;
      let points = [];
      if (topLabel) {
        points = [
          { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 },
          { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 },
          { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding },
          { x: dx + width3 / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding },
          { x: dx + width3 / 2, y: dy + nodeHeight / 2 },
          { x: dx - width3 / 2, y: dy + nodeHeight / 2 },
          { x: dx - width3 / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding },
          { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }
        ];
      } else {
        points = [
          { x: dx - width3 / 2, y: dy - nodeHeight / 2 },
          { x: dx + width3 / 2, y: dy - nodeHeight / 2 },
          { x: dx + width3 / 2, y: dy - nodeHeight / 2 + height2 },
          { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + height2 },
          { x: dx + bbox.width / 2 / 2, y: dy + nodeHeight / 2 },
          { x: dx - bbox.width / 2, y: dy + nodeHeight / 2 },
          { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + height2 },
          { x: dx - width3 / 2, y: dy - nodeHeight / 2 + height2 }
        ];
      }
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_icon = __esm({
    "src/rendering-util/rendering-elements/shapes/icon.ts"() {
      "use strict";
      init_rough_esm();
      init_logger();
      init_icons();
      init_intersect();
      init_handDrawnShapeStyles();
      init_util();
      __name(icon, "icon");
    }
  });

  // src/rendering-util/rendering-elements/shapes/iconCircle.ts
  async function iconCircle(parent4, node2, { config: { themeVariables, flowchart } }) {
    const { labelStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const assetHeight = node2.assetHeight ?? 48;
    const assetWidth = node2.assetWidth ?? 48;
    const iconSize = Math.max(assetHeight, assetWidth);
    const defaultWidth = flowchart?.wrappingWidth;
    node2.width = Math.max(iconSize, defaultWidth ?? 0);
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, "icon-shape default");
    const padding2 = 20;
    const labelPadding = node2.label ? 8 : 0;
    const topLabel = node2.pos === "t";
    const { nodeBorder, mainBkg } = themeVariables;
    const { stylesMap } = compileStyles(node2);
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const fill = stylesMap.get("fill");
    options2.stroke = fill ?? mainBkg;
    const iconElem = shapeSvg.append("g");
    if (node2.icon) {
      iconElem.html(
        `<g>${await getIconSVG(node2.icon, {
          height: iconSize,
          width: iconSize,
          fallbackPrefix: ""
        })}</g>`
      );
    }
    const iconBBox = iconElem.node().getBBox();
    const iconWidth = iconBBox.width;
    const iconHeight = iconBBox.height;
    const iconX = iconBBox.x;
    const iconY = iconBBox.y;
    const diameter = Math.max(iconWidth, iconHeight) * Math.SQRT2 + padding2 * 2;
    const iconNode = rc.circle(0, 0, diameter, options2);
    const outerWidth = Math.max(diameter, bbox.width);
    const outerHeight = diameter + bbox.height + labelPadding;
    const outerNode = rc.rectangle(-outerWidth / 2, -outerHeight / 2, outerWidth, outerHeight, {
      ...options2,
      fill: "transparent",
      stroke: "none"
    });
    const iconShape = shapeSvg.insert(() => iconNode, ":first-child");
    const outerShape = shapeSvg.insert(() => outerNode);
    iconElem.attr(
      "transform",
      `translate(${-iconWidth / 2 - iconX},${topLabel ? bbox.height / 2 + labelPadding / 2 - iconHeight / 2 - iconY : -bbox.height / 2 - labelPadding / 2 - iconHeight / 2 - iconY})`
    );
    iconElem.attr("style", `color: ${stylesMap.get("stroke") ?? nodeBorder};`);
    label.attr(
      "transform",
      `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))},${topLabel ? -outerHeight / 2 : outerHeight / 2 - bbox.height})`
    );
    iconShape.attr(
      "transform",
      `translate(${0},${topLabel ? bbox.height / 2 + labelPadding / 2 : -bbox.height / 2 - labelPadding / 2})`
    );
    updateNodeBounds(node2, outerShape);
    node2.intersect = function(point8) {
      log.info("iconSquare intersect", node2, point8);
      const pos = intersect_default.rect(node2, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_iconCircle = __esm({
    "src/rendering-util/rendering-elements/shapes/iconCircle.ts"() {
      "use strict";
      init_rough_esm();
      init_logger();
      init_icons();
      init_intersect();
      init_handDrawnShapeStyles();
      init_util();
      __name(iconCircle, "iconCircle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/roundedRectPath.ts
  var createRoundedRectPathD;
  var init_roundedRectPath = __esm({
    "src/rendering-util/rendering-elements/shapes/roundedRectPath.ts"() {
      "use strict";
      createRoundedRectPathD = /* @__PURE__ */ __name((x5, y6, totalWidth, totalHeight, radius2) => [
        "M",
        x5 + radius2,
        y6,
        // Move to the first point
        "H",
        x5 + totalWidth - radius2,
        // Draw horizontal line to the beginning of the right corner
        "A",
        radius2,
        radius2,
        0,
        0,
        1,
        x5 + totalWidth,
        y6 + radius2,
        // Draw arc to the right top corner
        "V",
        y6 + totalHeight - radius2,
        // Draw vertical line down to the beginning of the right bottom corner
        "A",
        radius2,
        radius2,
        0,
        0,
        1,
        x5 + totalWidth - radius2,
        y6 + totalHeight,
        // Draw arc to the right bottom corner
        "H",
        x5 + radius2,
        // Draw horizontal line to the beginning of the left bottom corner
        "A",
        radius2,
        radius2,
        0,
        0,
        1,
        x5,
        y6 + totalHeight - radius2,
        // Draw arc to the left bottom corner
        "V",
        y6 + radius2,
        // Draw vertical line up to the beginning of the left top corner
        "A",
        radius2,
        radius2,
        0,
        0,
        1,
        x5 + radius2,
        y6,
        // Draw arc to the left top corner
        "Z"
        // Close the path
      ].join(" "), "createRoundedRectPathD");
    }
  });

  // src/rendering-util/rendering-elements/shapes/iconRounded.ts
  async function iconRounded(parent4, node2, { config: { themeVariables, flowchart } }) {
    const { labelStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const assetHeight = node2.assetHeight ?? 48;
    const assetWidth = node2.assetWidth ?? 48;
    const iconSize = Math.max(assetHeight, assetWidth);
    const defaultWidth = flowchart?.wrappingWidth;
    node2.width = Math.max(iconSize, defaultWidth ?? 0);
    const { shapeSvg, bbox, halfPadding, label } = await labelHelper(
      parent4,
      node2,
      "icon-shape default"
    );
    const topLabel = node2.pos === "t";
    const height2 = iconSize + halfPadding * 2;
    const width3 = iconSize + halfPadding * 2;
    const { nodeBorder, mainBkg } = themeVariables;
    const { stylesMap } = compileStyles(node2);
    const x5 = -width3 / 2;
    const y6 = -height2 / 2;
    const labelPadding = node2.label ? 8 : 0;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const fill = stylesMap.get("fill");
    options2.stroke = fill ?? mainBkg;
    const iconNode = rc.path(createRoundedRectPathD(x5, y6, width3, height2, 5), options2);
    const outerWidth = Math.max(width3, bbox.width);
    const outerHeight = height2 + bbox.height + labelPadding;
    const outerNode = rc.rectangle(-outerWidth / 2, -outerHeight / 2, outerWidth, outerHeight, {
      ...options2,
      fill: "transparent",
      stroke: "none"
    });
    const iconShape = shapeSvg.insert(() => iconNode, ":first-child").attr("class", "icon-shape2");
    const outerShape = shapeSvg.insert(() => outerNode);
    if (node2.icon) {
      const iconElem = shapeSvg.append("g");
      iconElem.html(
        `<g>${await getIconSVG(node2.icon, {
          height: iconSize,
          width: iconSize,
          fallbackPrefix: ""
        })}</g>`
      );
      const iconBBox = iconElem.node().getBBox();
      const iconWidth = iconBBox.width;
      const iconHeight = iconBBox.height;
      const iconX = iconBBox.x;
      const iconY = iconBBox.y;
      iconElem.attr(
        "transform",
        `translate(${-iconWidth / 2 - iconX},${topLabel ? bbox.height / 2 + labelPadding / 2 - iconHeight / 2 - iconY : -bbox.height / 2 - labelPadding / 2 - iconHeight / 2 - iconY})`
      );
      iconElem.attr("style", `color: ${stylesMap.get("stroke") ?? nodeBorder};`);
    }
    label.attr(
      "transform",
      `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))},${topLabel ? -outerHeight / 2 : outerHeight / 2 - bbox.height})`
    );
    iconShape.attr(
      "transform",
      `translate(${0},${topLabel ? bbox.height / 2 + labelPadding / 2 : -bbox.height / 2 - labelPadding / 2})`
    );
    updateNodeBounds(node2, outerShape);
    node2.intersect = function(point8) {
      log.info("iconSquare intersect", node2, point8);
      if (!node2.label) {
        return intersect_default.rect(node2, point8);
      }
      const dx = node2.x ?? 0;
      const dy = node2.y ?? 0;
      const nodeHeight = node2.height ?? 0;
      let points = [];
      if (topLabel) {
        points = [
          { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 },
          { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 },
          { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding },
          { x: dx + width3 / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding },
          { x: dx + width3 / 2, y: dy + nodeHeight / 2 },
          { x: dx - width3 / 2, y: dy + nodeHeight / 2 },
          { x: dx - width3 / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding },
          { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }
        ];
      } else {
        points = [
          { x: dx - width3 / 2, y: dy - nodeHeight / 2 },
          { x: dx + width3 / 2, y: dy - nodeHeight / 2 },
          { x: dx + width3 / 2, y: dy - nodeHeight / 2 + height2 },
          { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + height2 },
          { x: dx + bbox.width / 2 / 2, y: dy + nodeHeight / 2 },
          { x: dx - bbox.width / 2, y: dy + nodeHeight / 2 },
          { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + height2 },
          { x: dx - width3 / 2, y: dy - nodeHeight / 2 + height2 }
        ];
      }
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_iconRounded = __esm({
    "src/rendering-util/rendering-elements/shapes/iconRounded.ts"() {
      "use strict";
      init_rough_esm();
      init_logger();
      init_icons();
      init_intersect();
      init_handDrawnShapeStyles();
      init_roundedRectPath();
      init_util();
      __name(iconRounded, "iconRounded");
    }
  });

  // src/rendering-util/rendering-elements/shapes/iconSquare.ts
  async function iconSquare(parent4, node2, { config: { themeVariables, flowchart } }) {
    const { labelStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const assetHeight = node2.assetHeight ?? 48;
    const assetWidth = node2.assetWidth ?? 48;
    const iconSize = Math.max(assetHeight, assetWidth);
    const defaultWidth = flowchart?.wrappingWidth;
    node2.width = Math.max(iconSize, defaultWidth ?? 0);
    const { shapeSvg, bbox, halfPadding, label } = await labelHelper(
      parent4,
      node2,
      "icon-shape default"
    );
    const topLabel = node2.pos === "t";
    const height2 = iconSize + halfPadding * 2;
    const width3 = iconSize + halfPadding * 2;
    const { nodeBorder, mainBkg } = themeVariables;
    const { stylesMap } = compileStyles(node2);
    const x5 = -width3 / 2;
    const y6 = -height2 / 2;
    const labelPadding = node2.label ? 8 : 0;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const fill = stylesMap.get("fill");
    options2.stroke = fill ?? mainBkg;
    const iconNode = rc.path(createRoundedRectPathD(x5, y6, width3, height2, 0.1), options2);
    const outerWidth = Math.max(width3, bbox.width);
    const outerHeight = height2 + bbox.height + labelPadding;
    const outerNode = rc.rectangle(-outerWidth / 2, -outerHeight / 2, outerWidth, outerHeight, {
      ...options2,
      fill: "transparent",
      stroke: "none"
    });
    const iconShape = shapeSvg.insert(() => iconNode, ":first-child");
    const outerShape = shapeSvg.insert(() => outerNode);
    if (node2.icon) {
      const iconElem = shapeSvg.append("g");
      iconElem.html(
        `<g>${await getIconSVG(node2.icon, {
          height: iconSize,
          width: iconSize,
          fallbackPrefix: ""
        })}</g>`
      );
      const iconBBox = iconElem.node().getBBox();
      const iconWidth = iconBBox.width;
      const iconHeight = iconBBox.height;
      const iconX = iconBBox.x;
      const iconY = iconBBox.y;
      iconElem.attr(
        "transform",
        `translate(${-iconWidth / 2 - iconX},${topLabel ? bbox.height / 2 + labelPadding / 2 - iconHeight / 2 - iconY : -bbox.height / 2 - labelPadding / 2 - iconHeight / 2 - iconY})`
      );
      iconElem.attr("style", `color: ${stylesMap.get("stroke") ?? nodeBorder};`);
    }
    label.attr(
      "transform",
      `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))},${topLabel ? -outerHeight / 2 : outerHeight / 2 - bbox.height})`
    );
    iconShape.attr(
      "transform",
      `translate(${0},${topLabel ? bbox.height / 2 + labelPadding / 2 : -bbox.height / 2 - labelPadding / 2})`
    );
    updateNodeBounds(node2, outerShape);
    node2.intersect = function(point8) {
      log.info("iconSquare intersect", node2, point8);
      if (!node2.label) {
        return intersect_default.rect(node2, point8);
      }
      const dx = node2.x ?? 0;
      const dy = node2.y ?? 0;
      const nodeHeight = node2.height ?? 0;
      let points = [];
      if (topLabel) {
        points = [
          { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 },
          { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 },
          { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding },
          { x: dx + width3 / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding },
          { x: dx + width3 / 2, y: dy + nodeHeight / 2 },
          { x: dx - width3 / 2, y: dy + nodeHeight / 2 },
          { x: dx - width3 / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding },
          { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }
        ];
      } else {
        points = [
          { x: dx - width3 / 2, y: dy - nodeHeight / 2 },
          { x: dx + width3 / 2, y: dy - nodeHeight / 2 },
          { x: dx + width3 / 2, y: dy - nodeHeight / 2 + height2 },
          { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + height2 },
          { x: dx + bbox.width / 2 / 2, y: dy + nodeHeight / 2 },
          { x: dx - bbox.width / 2, y: dy + nodeHeight / 2 },
          { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + height2 },
          { x: dx - width3 / 2, y: dy - nodeHeight / 2 + height2 }
        ];
      }
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_iconSquare = __esm({
    "src/rendering-util/rendering-elements/shapes/iconSquare.ts"() {
      "use strict";
      init_rough_esm();
      init_logger();
      init_icons();
      init_intersect();
      init_roundedRectPath();
      init_handDrawnShapeStyles();
      init_util();
      __name(iconSquare, "iconSquare");
    }
  });

  // src/rendering-util/rendering-elements/shapes/imageSquare.ts
  async function imageSquare(parent4, node2, { config: { flowchart } }) {
    const img = new Image();
    img.src = node2?.img ?? "";
    await img.decode();
    const imageNaturalWidth = Number(img.naturalWidth.toString().replace("px", ""));
    const imageNaturalHeight = Number(img.naturalHeight.toString().replace("px", ""));
    node2.imageAspectRatio = imageNaturalWidth / imageNaturalHeight;
    const { labelStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const defaultWidth = flowchart?.wrappingWidth;
    node2.defaultWidth = flowchart?.wrappingWidth;
    const imageRawWidth = Math.max(
      node2.label ? defaultWidth ?? 0 : 0,
      node2?.assetWidth ?? imageNaturalWidth
    );
    const imageWidth = node2.constraint === "on" ? node2?.assetHeight ? node2.assetHeight * node2.imageAspectRatio : imageRawWidth : imageRawWidth;
    const imageHeight = node2.constraint === "on" ? imageWidth / node2.imageAspectRatio : node2?.assetHeight ?? imageNaturalHeight;
    node2.width = Math.max(imageWidth, defaultWidth ?? 0);
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, "image-shape default");
    const topLabel = node2.pos === "t";
    const x5 = -imageWidth / 2;
    const y6 = -imageHeight / 2;
    const labelPadding = node2.label ? 8 : 0;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const imageNode = rc.rectangle(x5, y6, imageWidth, imageHeight, options2);
    const outerWidth = Math.max(imageWidth, bbox.width);
    const outerHeight = imageHeight + bbox.height + labelPadding;
    const outerNode = rc.rectangle(-outerWidth / 2, -outerHeight / 2, outerWidth, outerHeight, {
      ...options2,
      fill: "none",
      stroke: "none"
    });
    const iconShape = shapeSvg.insert(() => imageNode, ":first-child");
    const outerShape = shapeSvg.insert(() => outerNode);
    if (node2.img) {
      const image = shapeSvg.append("image");
      image.attr("href", node2.img);
      image.attr("width", imageWidth);
      image.attr("height", imageHeight);
      image.attr("preserveAspectRatio", "none");
      image.attr(
        "transform",
        `translate(${-imageWidth / 2},${topLabel ? outerHeight / 2 - imageHeight : -outerHeight / 2})`
      );
    }
    label.attr(
      "transform",
      `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))},${topLabel ? -imageHeight / 2 - bbox.height / 2 - labelPadding / 2 : imageHeight / 2 - bbox.height / 2 + labelPadding / 2})`
    );
    iconShape.attr(
      "transform",
      `translate(${0},${topLabel ? bbox.height / 2 + labelPadding / 2 : -bbox.height / 2 - labelPadding / 2})`
    );
    updateNodeBounds(node2, outerShape);
    node2.intersect = function(point8) {
      log.info("iconSquare intersect", node2, point8);
      if (!node2.label) {
        return intersect_default.rect(node2, point8);
      }
      const dx = node2.x ?? 0;
      const dy = node2.y ?? 0;
      const nodeHeight = node2.height ?? 0;
      let points = [];
      if (topLabel) {
        points = [
          { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 },
          { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 },
          { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding },
          { x: dx + imageWidth / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding },
          { x: dx + imageWidth / 2, y: dy + nodeHeight / 2 },
          { x: dx - imageWidth / 2, y: dy + nodeHeight / 2 },
          { x: dx - imageWidth / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding },
          { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }
        ];
      } else {
        points = [
          { x: dx - imageWidth / 2, y: dy - nodeHeight / 2 },
          { x: dx + imageWidth / 2, y: dy - nodeHeight / 2 },
          { x: dx + imageWidth / 2, y: dy - nodeHeight / 2 + imageHeight },
          { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + imageHeight },
          { x: dx + bbox.width / 2 / 2, y: dy + nodeHeight / 2 },
          { x: dx - bbox.width / 2, y: dy + nodeHeight / 2 },
          { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + imageHeight },
          { x: dx - imageWidth / 2, y: dy - nodeHeight / 2 + imageHeight }
        ];
      }
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_imageSquare = __esm({
    "src/rendering-util/rendering-elements/shapes/imageSquare.ts"() {
      "use strict";
      init_rough_esm();
      init_logger();
      init_intersect();
      init_handDrawnShapeStyles();
      init_util();
      __name(imageSquare, "imageSquare");
    }
  });

  // src/rendering-util/rendering-elements/shapes/invertedTrapezoid.ts
  async function inv_trapezoid(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingY = nodePadding;
    const labelPaddingX = node2.look === "neo" ? nodePadding * 2 : nodePadding;
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = Math.max(bbox.width + (labelPaddingX ?? 0) * 2, node2?.width ?? 0);
    const h3 = Math.max(bbox.height + (labelPaddingY ?? 0) * 2, node2?.height ?? 0);
    const points = [
      { x: 0, y: 0 },
      { x: w4, y: 0 },
      { x: w4 + 3 * h3 / 6, y: -h3 },
      { x: -3 * h3 / 6, y: -h3 }
    ];
    let polygon2;
    const { cssStyles } = node2;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options2 = userNodeOverrides(node2, {});
      const pathData = createPathFromPoints(points);
      const roughNode = rc.path(pathData, options2);
      polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w4 / 2}, ${h3 / 2})`);
      if (cssStyles) {
        polygon2.attr("style", cssStyles);
      }
    } else {
      polygon2 = insertPolygonShape(shapeSvg, w4, h3, points);
    }
    if (nodeStyles) {
      polygon2.attr("style", nodeStyles);
    }
    node2.width = w4;
    node2.height = h3;
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      return intersect_default.polygon(node2, points, point8);
    };
    return shapeSvg;
  }
  var init_invertedTrapezoid = __esm({
    "src/rendering-util/rendering-elements/shapes/invertedTrapezoid.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_insertPolygonShape();
      __name(inv_trapezoid, "inv_trapezoid");
    }
  });

  // src/rendering-util/rendering-elements/shapes/drawRect.ts
  async function drawRect3(parent4, node2, options2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const totalWidth = Math.max(bbox.width + options2.labelPaddingX * 2, node2?.width || 0);
    const totalHeight = Math.max(bbox.height + options2.labelPaddingY * 2, node2?.height || 0);
    const x5 = -totalWidth / 2;
    const y6 = -totalHeight / 2;
    let rect3;
    let { rx, ry } = node2;
    const { cssStyles } = node2;
    if (options2?.rx && options2.ry) {
      rx = options2.rx;
      ry = options2.ry;
    }
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options3 = userNodeOverrides(node2, {});
      const roughNode = rx || ry ? rc.path(createRoundedRectPathD(x5, y6, totalWidth, totalHeight, rx || 0), options3) : rc.rectangle(x5, y6, totalWidth, totalHeight, options3);
      rect3 = shapeSvg.insert(() => roughNode, ":first-child");
      rect3.attr("class", "basic label-container").attr("style", handleUndefinedAttr(cssStyles));
    } else {
      rect3 = shapeSvg.insert("rect", ":first-child");
      rect3.attr("class", "basic label-container").attr("style", nodeStyles).attr("rx", handleUndefinedAttr(rx)).attr("ry", handleUndefinedAttr(ry)).attr("x", x5).attr("y", y6).attr("width", totalWidth).attr("height", totalHeight);
    }
    updateNodeBounds(node2, rect3);
    node2.calcIntersect = function(bounds4, point8) {
      return intersect_default.rect(bounds4, point8);
    };
    node2.intersect = function(point8) {
      return intersect_default.rect(node2, point8);
    };
    return shapeSvg;
  }
  var init_drawRect = __esm({
    "src/rendering-util/rendering-elements/shapes/drawRect.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_roundedRectPath();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_utils2();
      __name(drawRect3, "drawRect");
    }
  });

  // src/rendering-util/rendering-elements/shapes/labelRect.ts
  async function labelRect(parent4, node2) {
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, "label");
    const rect3 = shapeSvg.insert("rect", ":first-child");
    const totalWidth = 0.1;
    const totalHeight = 0.1;
    rect3.attr("width", totalWidth).attr("height", totalHeight);
    shapeSvg.attr("class", "label edgeLabel");
    label.attr(
      "transform",
      `translate(${-(bbox.width / 2) - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, rect3);
    node2.intersect = function(point8) {
      return intersect_default.rect(node2, point8);
    };
    return shapeSvg;
  }
  var init_labelRect = __esm({
    "src/rendering-util/rendering-elements/shapes/labelRect.ts"() {
      "use strict";
      init_drawRect();
      init_util();
      init_intersect();
      __name(labelRect, "labelRect");
    }
  });

  // src/rendering-util/rendering-elements/shapes/leanLeft.ts
  async function lean_left(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingY = nodePadding;
    const labelPaddingX = node2.look === "neo" ? nodePadding * 2 : nodePadding;
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const h3 = (node2?.height ?? bbox.height) + labelPaddingY;
    const w4 = (node2?.width ?? bbox.width) + labelPaddingX;
    const points = [
      { x: 0, y: 0 },
      { x: w4 + 3 * h3 / 6, y: 0 },
      { x: w4, y: -h3 },
      { x: -(3 * h3) / 6, y: -h3 }
    ];
    let polygon2;
    const { cssStyles } = node2;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options2 = userNodeOverrides(node2, {});
      const pathData = createPathFromPoints(points);
      const roughNode = rc.path(pathData, options2);
      polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w4 / 2}, ${h3 / 2})`);
      if (cssStyles) {
        polygon2.attr("style", cssStyles);
      }
    } else {
      polygon2 = insertPolygonShape(shapeSvg, w4, h3, points);
    }
    if (nodeStyles) {
      polygon2.attr("style", nodeStyles);
    }
    node2.width = w4;
    node2.height = h3;
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      return intersect_default.polygon(node2, points, point8);
    };
    return shapeSvg;
  }
  var init_leanLeft = __esm({
    "src/rendering-util/rendering-elements/shapes/leanLeft.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_insertPolygonShape();
      __name(lean_left, "lean_left");
    }
  });

  // src/rendering-util/rendering-elements/shapes/leanRight.ts
  async function lean_right(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingY = nodePadding;
    const labelPaddingX = node2.look === "neo" ? nodePadding * 2 : nodePadding;
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const h3 = (node2?.height ?? bbox.height) + labelPaddingY;
    const w4 = (node2?.width ?? bbox.width) + labelPaddingX;
    const points = [
      { x: -3 * h3 / 6, y: 0 },
      { x: w4, y: 0 },
      { x: w4 + 3 * h3 / 6, y: -h3 },
      { x: 0, y: -h3 }
    ];
    let polygon2;
    const { cssStyles } = node2;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options2 = userNodeOverrides(node2, {});
      const pathData = createPathFromPoints(points);
      const roughNode = rc.path(pathData, options2);
      polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w4 / 2}, ${h3 / 2})`);
      if (cssStyles) {
        polygon2.attr("style", cssStyles);
      }
    } else {
      polygon2 = insertPolygonShape(shapeSvg, w4, h3, points);
    }
    if (nodeStyles) {
      polygon2.attr("style", nodeStyles);
    }
    node2.width = w4;
    node2.height = h3;
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      return intersect_default.polygon(node2, points, point8);
    };
    return shapeSvg;
  }
  var init_leanRight = __esm({
    "src/rendering-util/rendering-elements/shapes/leanRight.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_insertPolygonShape();
      __name(lean_right, "lean_right");
    }
  });

  // src/rendering-util/rendering-elements/shapes/lightningBolt.ts
  function lightningBolt(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.label = "";
    node2.labelStyle = labelStyles;
    const shapeSvg = parent4.insert("g").attr("class", getNodeClasses(node2)).attr("id", node2.domId ?? node2.id);
    const { cssStyles } = node2;
    const width3 = Math.max(35, node2?.width ?? 0);
    const height2 = Math.max(35, node2?.height ?? 0);
    const gap = 7;
    const points = [
      { x: width3, y: 0 },
      { x: 0, y: height2 + gap / 2 },
      { x: width3 - 2 * gap, y: height2 + gap / 2 },
      { x: 0, y: 2 * height2 },
      { x: width3, y: height2 - gap / 2 },
      { x: 2 * gap, y: height2 - gap / 2 }
    ];
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const linePath = createPathFromPoints(points);
    const lineNode = rc.path(linePath, options2);
    const lightningBolt2 = shapeSvg.insert(() => lineNode, ":first-child");
    lightningBolt2.attr("class", "outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      lightningBolt2.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      lightningBolt2.selectAll("path").attr("style", nodeStyles);
    }
    lightningBolt2.attr("transform", `translate(-${width3 / 2},${-height2})`);
    updateNodeBounds(node2, lightningBolt2);
    node2.intersect = function(point8) {
      log.info("lightningBolt intersect", node2, point8);
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_lightningBolt = __esm({
    "src/rendering-util/rendering-elements/shapes/lightningBolt.ts"() {
      "use strict";
      init_logger();
      init_util();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_intersect();
      init_util();
      __name(lightningBolt, "lightningBolt");
    }
  });

  // src/rendering-util/rendering-elements/shapes/linedCylinder.ts
  async function linedCylinder(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 16 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 24 : nodePadding;
    if (node2.width || node2.height) {
      const originalWidth = node2.width ?? 0;
      node2.width = (node2.width ?? 0) - labelPaddingX;
      if (node2.width < MIN_WIDTH3) {
        node2.width = MIN_WIDTH3;
      }
      const rx2 = originalWidth / 2;
      const ry2 = rx2 / (2.5 + originalWidth / 50);
      node2.height = (node2.height ?? 0) - labelPaddingY - ry2 * 3;
      if (node2.height < MIN_HEIGHT3) {
        node2.height = MIN_HEIGHT3;
      }
    }
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2;
    const rx = w4 / 2;
    const ry = rx / (2.5 + w4 / 50);
    const h3 = (node2?.height ? node2?.height : bbox.height) + ry + labelPaddingY * 2;
    const outerOffset = h3 * 0.1;
    let cylinder3;
    const { cssStyles } = node2;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const outerPathData = createOuterCylinderPathD2(0, 0, w4, h3, rx, ry, outerOffset);
      const innerPathData = createInnerCylinderPathD2(0, ry, w4, h3, rx, ry);
      const options2 = userNodeOverrides(node2, {});
      const outerNode = rc.path(outerPathData, options2);
      const innerLine = rc.path(innerPathData, options2);
      const innerLineEl = shapeSvg.insert(() => innerLine, ":first-child");
      innerLineEl.attr("class", "line");
      cylinder3 = shapeSvg.insert(() => outerNode, ":first-child");
      cylinder3.attr("class", "basic label-container");
      if (cssStyles) {
        cylinder3.attr("style", cssStyles);
      }
    } else {
      const pathData = createCylinderPathD2(0, 0, w4, h3, rx, ry, outerOffset);
      cylinder3 = shapeSvg.insert("path", ":first-child").attr("d", pathData).attr("class", "basic label-container outer-path").attr("style", handleUndefinedAttr(cssStyles)).attr("style", nodeStyles);
    }
    cylinder3.attr("label-offset-y", ry);
    cylinder3.attr("transform", `translate(${-w4 / 2}, ${-(h3 / 2 + ry)})`);
    updateNodeBounds(node2, cylinder3);
    label.attr(
      "transform",
      `translate(${-(bbox.width / 2) - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + ry - (bbox.y - (bbox.top ?? 0))})`
    );
    node2.intersect = function(point8) {
      const pos = intersect_default.rect(node2, point8);
      const x5 = pos.x - (node2.x ?? 0);
      if (rx != 0 && (Math.abs(x5) < (node2.width ?? 0) / 2 || Math.abs(x5) == (node2.width ?? 0) / 2 && Math.abs(pos.y - (node2.y ?? 0)) > (node2.height ?? 0) / 2 - ry)) {
        let y6 = ry * ry * (1 - x5 * x5 / (rx * rx));
        if (y6 > 0) {
          y6 = Math.sqrt(y6);
        }
        y6 = ry - y6;
        if (point8.y - (node2.y ?? 0) > 0) {
          y6 = -y6;
        }
        pos.y += y6;
      }
      return pos;
    };
    return shapeSvg;
  }
  var createCylinderPathD2, createOuterCylinderPathD2, createInnerCylinderPathD2, MIN_HEIGHT3, MIN_WIDTH3;
  var init_linedCylinder = __esm({
    "src/rendering-util/rendering-elements/shapes/linedCylinder.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_utils2();
      createCylinderPathD2 = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry, outerOffset) => {
        return [
          `M${x5},${y6 + ry}`,
          `a${rx},${ry} 0,0,0 ${width3},0`,
          `a${rx},${ry} 0,0,0 ${-width3},0`,
          `l0,${height2}`,
          `a${rx},${ry} 0,0,0 ${width3},0`,
          `l0,${-height2}`,
          `M${x5},${y6 + ry + outerOffset}`,
          `a${rx},${ry} 0,0,0 ${width3},0`
        ].join(" ");
      }, "createCylinderPathD");
      createOuterCylinderPathD2 = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry, outerOffset) => {
        return [
          `M${x5},${y6 + ry}`,
          `M${x5 + width3},${y6 + ry}`,
          `a${rx},${ry} 0,0,0 ${-width3},0`,
          `l0,${height2}`,
          `a${rx},${ry} 0,0,0 ${width3},0`,
          `l0,${-height2}`,
          `M${x5},${y6 + ry + outerOffset}`,
          `a${rx},${ry} 0,0,0 ${width3},0`
        ].join(" ");
      }, "createOuterCylinderPathD");
      createInnerCylinderPathD2 = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => {
        return [`M${x5 - width3 / 2},${-height2 / 2}`, `a${rx},${ry} 0,0,0 ${width3},0`].join(" ");
      }, "createInnerCylinderPathD");
      MIN_HEIGHT3 = 10;
      MIN_WIDTH3 = 10;
      __name(linedCylinder, "linedCylinder");
    }
  });

  // src/rendering-util/rendering-elements/shapes/linedWaveEdgedRect.ts
  async function linedWaveEdgedRect(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 16 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 12 : nodePadding;
    if (node2.width || node2.height) {
      const originalWidth = node2.width;
      node2.width = (originalWidth ?? 0) * 10 / 11 - labelPaddingX * 2;
      if (node2.width < 10) {
        node2.width = 10;
      }
      node2.height = (node2?.height ?? 0) - labelPaddingY * 2;
      if (node2.height < 10) {
        node2.height = 10;
      }
    }
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = (node2?.width ? node2?.width : bbox.width) + (labelPaddingX ?? 0) * 2;
    const h3 = (node2?.height ? node2?.height : bbox.height) + (labelPaddingY ?? 0) * 2;
    const waveAmplitude = node2.look === "neo" ? h3 / 4 : h3 / 8;
    const finalH = h3 + waveAmplitude;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const points = [
      { x: -w4 / 2 - w4 / 2 * 0.1, y: -finalH / 2 },
      { x: -w4 / 2 - w4 / 2 * 0.1, y: finalH / 2 },
      ...generateFullSineWavePoints(
        -w4 / 2 - w4 / 2 * 0.1,
        finalH / 2,
        w4 / 2 + w4 / 2 * 0.1,
        finalH / 2,
        waveAmplitude,
        0.8
      ),
      { x: w4 / 2 + w4 / 2 * 0.1, y: -finalH / 2 },
      { x: -w4 / 2 - w4 / 2 * 0.1, y: -finalH / 2 },
      { x: -w4 / 2, y: -finalH / 2 },
      { x: -w4 / 2, y: finalH / 2 * 1.1 },
      { x: -w4 / 2, y: -finalH / 2 }
    ];
    const poly = rc.polygon(
      points.map((p3) => [p3.x, p3.y]),
      options2
    );
    const waveEdgeRect = shapeSvg.insert(() => poly, ":first-child");
    waveEdgeRect.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      waveEdgeRect.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      waveEdgeRect.selectAll("path").attr("style", nodeStyles);
    }
    waveEdgeRect.attr("transform", `translate(0,${-waveAmplitude / 2})`);
    label.attr(
      "transform",
      `translate(${-w4 / 2 + (node2.padding ?? 0) + w4 / 2 * 0.1 / 2 - (bbox.x - (bbox.left ?? 0))},${-h3 / 2 + (node2.padding ?? 0) - waveAmplitude / 2 - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, waveEdgeRect);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_linedWaveEdgedRect = __esm({
    "src/rendering-util/rendering-elements/shapes/linedWaveEdgedRect.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_rough_esm();
      init_handDrawnShapeStyles();
      __name(linedWaveEdgedRect, "linedWaveEdgedRect");
    }
  });

  // src/rendering-util/rendering-elements/shapes/multiRect.ts
  async function multiRect(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 16 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 12 : nodePadding;
    const rectOffset2 = node2.look === "neo" ? 10 : 5;
    if (node2.width || node2.height) {
      node2.width = Math.max((node2?.width ?? 0) - labelPaddingX * 2 - 2 * rectOffset2, 10);
      node2.height = Math.max((node2?.height ?? 0) - labelPaddingY * 2 - 2 * rectOffset2, 10);
    }
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const totalWidth = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2 + 2 * rectOffset2;
    const totalHeight = (node2?.height ? node2?.height : bbox.height) + labelPaddingY * 2 + 2 * rectOffset2;
    const w4 = totalWidth - 2 * rectOffset2;
    const h3 = totalHeight - 2 * rectOffset2;
    const x5 = -w4 / 2;
    const y6 = -h3 / 2;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    const outerPathPoints = [
      { x: x5 - rectOffset2, y: y6 + rectOffset2 },
      { x: x5 - rectOffset2, y: y6 + h3 + rectOffset2 },
      { x: x5 + w4 - rectOffset2, y: y6 + h3 + rectOffset2 },
      { x: x5 + w4 - rectOffset2, y: y6 + h3 },
      { x: x5 + w4, y: y6 + h3 },
      { x: x5 + w4, y: y6 + h3 - rectOffset2 },
      { x: x5 + w4 + rectOffset2, y: y6 + h3 - rectOffset2 },
      { x: x5 + w4 + rectOffset2, y: y6 - rectOffset2 },
      { x: x5 + rectOffset2, y: y6 - rectOffset2 },
      { x: x5 + rectOffset2, y: y6 },
      { x: x5, y: y6 },
      { x: x5, y: y6 + rectOffset2 }
    ];
    const innerPathPoints = [
      { x: x5, y: y6 + rectOffset2 },
      { x: x5 + w4 - rectOffset2, y: y6 + rectOffset2 },
      { x: x5 + w4 - rectOffset2, y: y6 + h3 },
      { x: x5 + w4, y: y6 + h3 },
      { x: x5 + w4, y: y6 },
      { x: x5, y: y6 }
    ];
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const outerPath = createPathFromPoints(outerPathPoints);
    let outerNode = rc.path(outerPath, options2);
    const innerPath3 = createPathFromPoints(innerPathPoints);
    let innerNode = rc.path(innerPath3, options2);
    if (node2.look !== "handDrawn") {
      outerNode = mergePaths(outerNode);
      innerNode = mergePaths(innerNode);
    }
    const multiRect2 = shapeSvg.insert("g", ":first-child");
    multiRect2.insert(() => outerNode);
    multiRect2.insert(() => innerNode);
    multiRect2.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      multiRect2.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      multiRect2.selectAll("path").attr("style", nodeStyles);
    }
    label.attr(
      "transform",
      `translate(${-(bbox.width / 2) - rectOffset2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + rectOffset2 - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, multiRect2);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, outerPathPoints, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_multiRect = __esm({
    "src/rendering-util/rendering-elements/shapes/multiRect.ts"() {
      "use strict";
      init_util();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_intersect();
      __name(multiRect, "multiRect");
    }
  });

  // src/rendering-util/rendering-elements/shapes/multiWaveEdgedRectangle.ts
  async function multiWaveEdgedRectangle(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 16 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 12 : nodePadding;
    let adjustFinalHeight = true;
    if (node2.width || node2.height) {
      adjustFinalHeight = false;
      node2.width = (node2?.width ?? 0) - labelPaddingX * 2;
      node2.height = (node2?.height ?? 0) - labelPaddingY * 3;
    }
    const w4 = Math.max(bbox.width, node2?.width ?? 0) + labelPaddingX * 2;
    const h3 = Math.max(bbox.height, node2?.height ?? 0) + labelPaddingY * 3;
    const waveAmplitude = node2.look === "neo" ? h3 / 4 : h3 / 8;
    const finalH = h3 + (adjustFinalHeight ? waveAmplitude / 2 : -waveAmplitude / 2);
    const x5 = -w4 / 2;
    const y6 = -finalH / 2;
    const rectOffset2 = 10;
    const { cssStyles } = node2;
    const wavePoints = generateFullSineWavePoints(
      x5 - rectOffset2,
      y6 + finalH + rectOffset2,
      x5 + w4 - rectOffset2,
      y6 + finalH + rectOffset2,
      waveAmplitude,
      0.8
    );
    const lastWavePoint = wavePoints?.[wavePoints.length - 1];
    const outerPathPoints = [
      { x: x5 - rectOffset2, y: y6 + rectOffset2 },
      { x: x5 - rectOffset2, y: y6 + finalH + rectOffset2 },
      ...wavePoints,
      { x: x5 + w4 - rectOffset2, y: lastWavePoint.y - rectOffset2 },
      { x: x5 + w4, y: lastWavePoint.y - rectOffset2 },
      { x: x5 + w4, y: lastWavePoint.y - 2 * rectOffset2 },
      { x: x5 + w4 + rectOffset2, y: lastWavePoint.y - 2 * rectOffset2 },
      { x: x5 + w4 + rectOffset2, y: y6 - rectOffset2 },
      { x: x5 + rectOffset2, y: y6 - rectOffset2 },
      { x: x5 + rectOffset2, y: y6 },
      { x: x5, y: y6 },
      { x: x5, y: y6 + rectOffset2 }
    ];
    const innerPathPoints = [
      { x: x5, y: y6 + rectOffset2 },
      { x: x5 + w4 - rectOffset2, y: y6 + rectOffset2 },
      { x: x5 + w4 - rectOffset2, y: lastWavePoint.y - rectOffset2 },
      { x: x5 + w4, y: lastWavePoint.y - rectOffset2 },
      { x: x5 + w4, y: y6 },
      { x: x5, y: y6 }
    ];
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const outerPath = createPathFromPoints(outerPathPoints);
    const outerNode = rc.path(outerPath, options2);
    const innerPath3 = createPathFromPoints(innerPathPoints);
    const innerNode = rc.path(innerPath3, options2);
    const shape = shapeSvg.insert(() => outerNode, ":first-child");
    shape.insert(() => innerNode);
    shape.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      shape.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      shape.selectAll("path").attr("style", nodeStyles);
    }
    shape.attr("transform", `translate(0,${-waveAmplitude / 2})`);
    label.attr(
      "transform",
      `translate(${-(bbox.width / 2) - rectOffset2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + rectOffset2 - waveAmplitude / 2 - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, shape);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, outerPathPoints, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_multiWaveEdgedRectangle = __esm({
    "src/rendering-util/rendering-elements/shapes/multiWaveEdgedRectangle.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_rough_esm();
      init_handDrawnShapeStyles();
      __name(multiWaveEdgedRectangle, "multiWaveEdgedRectangle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/note.ts
  async function note(parent4, node2, { config: { themeVariables } }) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const useHtmlLabels = node2.useHtmlLabels || getEffectiveHtmlLabels(getConfig());
    if (!useHtmlLabels) {
      node2.centerLabel = true;
    }
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const totalWidth = Math.max(bbox.width + (node2.padding ?? 0) * 2, node2?.width ?? 0);
    const totalHeight = Math.max(bbox.height + (node2.padding ?? 0) * 2, node2?.height ?? 0);
    const x5 = -totalWidth / 2;
    const y6 = -totalHeight / 2;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {
      fill: themeVariables.noteBkgColor,
      stroke: themeVariables.noteBorderColor
    });
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const noteShapeNode = rc.rectangle(x5, y6, totalWidth, totalHeight, options2);
    const rect3 = shapeSvg.insert(() => noteShapeNode, ":first-child");
    rect3.attr("class", "basic label-container outer-path");
    label.attr("class", "label noteLabel");
    if (cssStyles && node2.look !== "handDrawn") {
      rect3.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      rect3.selectAll("path").attr("style", nodeStyles);
    }
    label.attr(
      "transform",
      `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, rect3);
    node2.intersect = function(point8) {
      return intersect_default.rect(node2, point8);
    };
    return shapeSvg;
  }
  var init_note = __esm({
    "src/rendering-util/rendering-elements/shapes/note.ts"() {
      "use strict";
      init_rough_esm();
      init_intersect();
      init_handDrawnShapeStyles();
      init_util();
      init_config();
      init_config();
      __name(note, "note");
    }
  });

  // src/rendering-util/rendering-elements/shapes/question.ts
  async function question(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = bbox.width + (node2.padding ?? 0);
    const h3 = bbox.height + (node2.padding ?? 0);
    const s2 = w4 + h3;
    const adjustment = 0.5;
    const points = [
      { x: s2 / 2, y: 0 },
      { x: s2, y: -s2 / 2 },
      { x: s2 / 2, y: -s2 },
      { x: 0, y: -s2 / 2 }
    ];
    let polygon2;
    const { cssStyles } = node2;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options2 = userNodeOverrides(node2, {});
      const pathData = createDecisionBoxPathD(0, 0, s2);
      const roughNode = rc.path(pathData, options2);
      polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-s2 / 2 + adjustment}, ${s2 / 2})`);
      if (cssStyles) {
        polygon2.attr("style", cssStyles);
      }
    } else {
      polygon2 = insertPolygonShape(shapeSvg, s2, s2, points);
      polygon2.attr("transform", `translate(${-s2 / 2 + adjustment}, ${s2 / 2})`);
    }
    if (nodeStyles) {
      polygon2.attr("style", nodeStyles);
    }
    updateNodeBounds(node2, polygon2);
    node2.calcIntersect = function(bounds4, point8) {
      const s3 = bounds4.width;
      const points2 = [
        { x: s3 / 2, y: 0 },
        { x: s3, y: -s3 / 2 },
        { x: s3 / 2, y: -s3 },
        { x: 0, y: -s3 / 2 }
      ];
      const res = intersect_default.polygon(bounds4, points2, point8);
      return { x: res.x - 0.5, y: res.y - 0.5 };
    };
    node2.intersect = function(point8) {
      return this.calcIntersect(node2, point8);
    };
    return shapeSvg;
  }
  var createDecisionBoxPathD;
  var init_question = __esm({
    "src/rendering-util/rendering-elements/shapes/question.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_insertPolygonShape();
      createDecisionBoxPathD = /* @__PURE__ */ __name((x5, y6, size4) => {
        return [
          `M${x5 + size4 / 2},${y6}`,
          `L${x5 + size4},${y6 - size4 / 2}`,
          `L${x5 + size4 / 2},${y6 - size4}`,
          `L${x5},${y6 - size4 / 2}`,
          "Z"
        ].join(" ");
      }, "createDecisionBoxPathD");
      __name(question, "question");
    }
  });

  // src/rendering-util/rendering-elements/shapes/rectLeftInvArrow.ts
  async function rect_left_inv_arrow(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 21 : nodePadding ?? 0;
    const labelPaddingY = node2.look === "neo" ? 12 : nodePadding ?? 0;
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = (node2?.width ?? bbox.width) + (node2.look === "neo" ? labelPaddingX * 2 : labelPaddingX);
    const h3 = (node2?.height ?? bbox.height) + (node2.look === "neo" ? labelPaddingY * 2 : labelPaddingY);
    const x5 = -w4 / 2;
    const y6 = -h3 / 2;
    const notch = y6 / 2;
    const points = [
      { x: x5 + notch, y: y6 },
      { x: x5, y: 0 },
      { x: x5 + notch, y: -y6 },
      { x: -x5, y: -y6 },
      { x: -x5, y: y6 }
    ];
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const pathData = createPathFromPoints(points);
    const roughNode = rc.path(pathData, options2);
    const polygon2 = shapeSvg.insert(() => roughNode, ":first-child");
    polygon2.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      polygon2.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      polygon2.selectAll("path").attr("style", nodeStyles);
    }
    polygon2.attr("transform", `translate(${-notch / 2},0)`);
    label.attr(
      "transform",
      `translate(${-notch / 2 - bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      return intersect_default.polygon(node2, points, point8);
    };
    return shapeSvg;
  }
  var init_rectLeftInvArrow = __esm({
    "src/rendering-util/rendering-elements/shapes/rectLeftInvArrow.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      __name(rect_left_inv_arrow, "rect_left_inv_arrow");
    }
  });

  // src/rendering-util/rendering-elements/createLabel.js
  var createLabel, createLabel_default;
  var init_createLabel = __esm({
    "src/rendering-util/rendering-elements/createLabel.js"() {
      "use strict";
      init_config();
      init_diagramAPI();
      init_createText();
      createLabel = /* @__PURE__ */ __name(async (element3, _vertexText, style3, isTitle = false, isNode2 = false) => {
        let vertexText = _vertexText || "";
        if (typeof vertexText === "object") {
          vertexText = vertexText[0];
        }
        const config5 = getConfig2();
        const useHtmlLabels = getEffectiveHtmlLabels(config5);
        return await createText(
          element3,
          vertexText,
          {
            style: style3,
            isTitle,
            useHtmlLabels,
            markdown: false,
            isNode: isNode2,
            width: Number.POSITIVE_INFINITY
          },
          config5
        );
      }, "createLabel");
      createLabel_default = createLabel;
    }
  });

  // src/rendering-util/rendering-elements/shapes/rectWithTitle.ts
  async function rectWithTitle(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    let classes3;
    if (!node2.cssClasses) {
      classes3 = "node default";
    } else {
      classes3 = "node " + node2.cssClasses;
    }
    const shapeSvg = parent4.insert("g").attr("class", classes3).attr("id", node2.domId || node2.id);
    const g2 = shapeSvg.insert("g");
    const label = shapeSvg.insert("g").attr("class", "label").attr("style", nodeStyles);
    const description = node2.description;
    const title2 = node2.label;
    const text4 = await createLabel_default(label, title2, node2.labelStyle, true, true);
    let bbox = { width: 0, height: 0 };
    if (getEffectiveHtmlLabels(getConfig2())) {
      const div2 = text4.children[0];
      const dv2 = select_default2(text4);
      bbox = div2.getBoundingClientRect();
      dv2.attr("width", bbox.width);
      dv2.attr("height", bbox.height);
    }
    log.info("Text 2", description);
    const textRows = description || [];
    const titleBox = text4.getBBox();
    const descr = await createLabel_default(
      label,
      Array.isArray(textRows) ? textRows.join("<br/>") : textRows,
      node2.labelStyle,
      true,
      true
    );
    const div = descr.children[0];
    const dv = select_default2(descr);
    bbox = div.getBoundingClientRect();
    dv.attr("width", bbox.width);
    dv.attr("height", bbox.height);
    const halfPadding = (node2.padding || 0) / 2;
    select_default2(descr).attr(
      "transform",
      "translate( " + (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ", " + (titleBox.height + halfPadding + 5) + ")"
    );
    select_default2(text4).attr(
      "transform",
      "translate( " + (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ", 0)"
    );
    bbox = label.node().getBBox();
    label.attr(
      "transform",
      "translate(" + -bbox.width / 2 + ", " + (-bbox.height / 2 - halfPadding + 3) + ")"
    );
    const totalWidth = bbox.width + (node2.padding || 0);
    const totalHeight = bbox.height + (node2.padding || 0);
    const x5 = -bbox.width / 2 - halfPadding;
    const y6 = -bbox.height / 2 - halfPadding;
    let rect3;
    let innerLine;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options2 = userNodeOverrides(node2, {});
      const roughNode = rc.path(
        createRoundedRectPathD(x5, y6, totalWidth, totalHeight, node2.rx || 0),
        options2
      );
      const roughLine = rc.line(
        -bbox.width / 2 - halfPadding,
        -bbox.height / 2 - halfPadding + titleBox.height + halfPadding,
        bbox.width / 2 + halfPadding,
        -bbox.height / 2 - halfPadding + titleBox.height + halfPadding,
        options2
      );
      innerLine = shapeSvg.insert(() => {
        log.debug("Rough node insert CXC", roughNode);
        return roughLine;
      }, ":first-child");
      rect3 = shapeSvg.insert(() => {
        log.debug("Rough node insert CXC", roughNode);
        return roughNode;
      }, ":first-child");
    } else {
      rect3 = g2.insert("rect", ":first-child");
      innerLine = g2.insert("line");
      rect3.attr("class", "outer title-state").attr("style", nodeStyles).attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + (node2.padding || 0)).attr("height", bbox.height + (node2.padding || 0));
      innerLine.attr("class", "divider").attr("x1", -bbox.width / 2 - halfPadding).attr("x2", bbox.width / 2 + halfPadding).attr("y1", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding).attr("y2", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
    }
    updateNodeBounds(node2, rect3);
    node2.intersect = function(point8) {
      return intersect_default.rect(node2, point8);
    };
    return shapeSvg;
  }
  var init_rectWithTitle = __esm({
    "src/rendering-util/rendering-elements/shapes/rectWithTitle.ts"() {
      "use strict";
      init_src32();
      init_util();
      init_createLabel();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_diagramAPI();
      init_roundedRectPath();
      init_logger();
      init_config();
      __name(rectWithTitle, "rectWithTitle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/roundedRect.ts
  async function roundedRect(parent4, node2, { config: { themeVariables } }) {
    const radius2 = themeVariables?.radius ?? 5;
    const options2 = {
      rx: radius2,
      ry: radius2,
      classes: "",
      labelPaddingX: (node2?.padding ?? 0) * 1,
      labelPaddingY: (node2?.padding ?? 0) * 1
    };
    return drawRect3(parent4, node2, options2);
  }
  var init_roundedRect = __esm({
    "src/rendering-util/rendering-elements/shapes/roundedRect.ts"() {
      "use strict";
      init_drawRect();
      __name(roundedRect, "roundedRect");
    }
  });

  // src/rendering-util/rendering-elements/shapes/shadedProcess.ts
  async function shadedProcess(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const paddingX = node2.look === "neo" ? 16 : node2.padding ?? 0;
    const paddingY = node2.look === "neo" ? 12 : node2.padding ?? 0;
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const totalWidth = (node2?.width ?? bbox.width) + paddingX * 2 + (node2.look === "neo" ? FRAME_WIDTH : FRAME_WIDTH * 2);
    const totalHeight = (node2?.height ?? bbox.height) + paddingY * 2;
    const w4 = totalWidth - FRAME_WIDTH;
    const h3 = totalHeight;
    const x5 = FRAME_WIDTH - totalWidth / 2;
    const y6 = -totalHeight / 2;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const points = [
      { x: x5, y: y6 },
      { x: x5 + w4, y: y6 },
      { x: x5 + w4, y: y6 + h3 },
      { x: x5 - FRAME_WIDTH, y: y6 + h3 },
      { x: x5 - FRAME_WIDTH, y: y6 },
      { x: x5, y: y6 },
      { x: x5, y: y6 + h3 }
    ];
    const roughNode = rc.polygon(
      points.map((p3) => [p3.x, p3.y]),
      options2
    );
    const rect3 = shapeSvg.insert(() => roughNode, ":first-child");
    rect3.attr("class", "basic label-container outer-path").attr("style", handleUndefinedAttr(cssStyles));
    if (nodeStyles && node2.look !== "handDrawn") {
      rect3.selectAll("path").attr("style", nodeStyles);
    }
    if (cssStyles && node2.look !== "handDrawn") {
      rect3.selectAll("path").attr("style", nodeStyles);
    }
    label.attr(
      "transform",
      `translate(${FRAME_WIDTH / 2 - bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, rect3);
    node2.intersect = function(point8) {
      return intersect_default.rect(node2, point8);
    };
    return shapeSvg;
  }
  var FRAME_WIDTH;
  var init_shadedProcess = __esm({
    "src/rendering-util/rendering-elements/shapes/shadedProcess.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_utils2();
      FRAME_WIDTH = 8;
      __name(shadedProcess, "shadedProcess");
    }
  });

  // src/rendering-util/rendering-elements/shapes/slopedRect.ts
  async function slopedRect(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 16 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 12 : nodePadding;
    if (node2.width || node2.height) {
      node2.width = Math.max((node2?.width ?? 0) - labelPaddingX * 2, 10);
      node2.height = Math.max((node2?.height ?? 0) / 1.5 - labelPaddingY * 2, 10);
    }
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const totalWidth = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2;
    const totalHeight = ((node2?.height ? node2?.height : bbox.height) + labelPaddingY * 2) * 1.5;
    const w4 = totalWidth;
    const h3 = totalHeight / 1.5;
    const x5 = -w4 / 2;
    const y6 = -h3 / 2;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const points = [
      { x: x5, y: y6 },
      { x: x5, y: y6 + h3 },
      { x: x5 + w4, y: y6 + h3 },
      { x: x5 + w4, y: y6 - h3 / 2 }
    ];
    const pathData = createPathFromPoints(points);
    const shapeNode = rc.path(pathData, options2);
    const polygon2 = shapeSvg.insert(() => shapeNode, ":first-child");
    polygon2.attr("class", "basic label-container  outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", nodeStyles);
    }
    polygon2.attr("transform", `translate(0, ${h3 / 4})`);
    label.attr(
      "transform",
      `translate(${-w4 / 2 + (node2.padding ?? 0) - (bbox.x - (bbox.left ?? 0))}, ${-h3 / 4 + (node2.padding ?? 0) - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_slopedRect = __esm({
    "src/rendering-util/rendering-elements/shapes/slopedRect.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      __name(slopedRect, "slopedRect");
    }
  });

  // src/rendering-util/rendering-elements/shapes/squareRect.ts
  async function squareRect(parent4, node2) {
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 16 : nodePadding * 2;
    const labelPaddingY = node2.look === "neo" ? 12 : nodePadding;
    const options2 = {
      rx: 0,
      ry: 0,
      classes: "",
      labelPaddingX: node2.labelPaddingX ?? labelPaddingX,
      labelPaddingY
    };
    return drawRect3(parent4, node2, options2);
  }
  var init_squareRect = __esm({
    "src/rendering-util/rendering-elements/shapes/squareRect.ts"() {
      "use strict";
      init_drawRect();
      __name(squareRect, "squareRect");
    }
  });

  // src/rendering-util/rendering-elements/shapes/stadium.ts
  async function stadium(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 20 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 12 : nodePadding;
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const h3 = bbox.height + (node2.look === "neo" ? labelPaddingY * 2 : labelPaddingY);
    const w4 = bbox.width + h3 / 4 + (node2.look === "neo" ? labelPaddingX * 2 : labelPaddingX);
    const radius2 = h3 / 2;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const points = [
      { x: -w4 / 2 + radius2, y: -h3 / 2 },
      { x: w4 / 2 - radius2, y: -h3 / 2 },
      ...generateCirclePoints(-w4 / 2 + radius2, 0, radius2, 50, 90, 270),
      { x: w4 / 2 - radius2, y: h3 / 2 },
      ...generateCirclePoints(w4 / 2 - radius2, 0, radius2, 50, 270, 450)
    ];
    const pathData = createPathFromPoints(points);
    const shapeNode = rc.path(pathData, options2);
    const polygon2 = shapeSvg.insert(() => shapeNode, ":first-child");
    polygon2.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", nodeStyles);
    }
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_stadium = __esm({
    "src/rendering-util/rendering-elements/shapes/stadium.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      __name(stadium, "stadium");
    }
  });

  // src/rendering-util/rendering-elements/shapes/state.ts
  async function state(parent4, node2) {
    const options2 = {
      rx: node2.look === "neo" ? 3 : 5,
      ry: node2.look === "neo" ? 3 : 5,
      classes: "flowchart-node"
    };
    return drawRect3(parent4, node2, options2);
  }
  var init_state = __esm({
    "src/rendering-util/rendering-elements/shapes/state.ts"() {
      "use strict";
      init_drawRect();
      __name(state, "state");
    }
  });

  // src/rendering-util/rendering-elements/shapes/stateEnd.ts
  function stateEnd(parent4, node2, { config: { themeVariables } }) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const { cssStyles } = node2;
    const { lineColor, stateBorder, nodeBorder, nodeShadow } = themeVariables;
    if (node2.width || node2.height) {
      if ((node2.width ?? 0) < 14) {
        node2.width = 14;
      }
      if ((node2.height ?? 0) < 14) {
        node2.height = 14;
      }
    }
    if (!node2.width) {
      node2.width = 14;
    }
    if (!node2.height) {
      node2.height = 14;
    }
    const shapeSvg = parent4.insert("g").attr("class", "node default").attr("id", node2.domId ?? node2.id);
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const roughNode = rc.circle(0, 0, node2.width, {
      ...options2,
      stroke: lineColor,
      strokeWidth: 2
    });
    const innerFill = stateBorder ?? nodeBorder;
    const innerNodeRadius = (node2.width ?? 0) * 5 / 14;
    const roughInnerNode = rc.circle(0, 0, innerNodeRadius, {
      ...options2,
      fill: innerFill,
      stroke: innerFill,
      strokeWidth: 2,
      fillStyle: "solid"
    });
    const circle6 = shapeSvg.insert(() => roughNode, ":first-child");
    circle6.insert(() => roughInnerNode);
    if (node2.look !== "handDrawn") {
      circle6.attr("class", "outer-path");
    }
    if (cssStyles) {
      circle6.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles) {
      circle6.selectAll("path").attr("style", nodeStyles);
    }
    if (node2.width < 25 && nodeShadow && node2.look !== "handDrawn") {
      const svgId = parent4.node()?.ownerSVGElement?.id ?? "";
      const filterId = svgId ? `${svgId}-drop-shadow-small` : "drop-shadow-small";
      circle6.attr("style", `filter:url(#${filterId})`);
    }
    updateNodeBounds(node2, circle6);
    node2.intersect = function(point8) {
      return intersect_default.circle(node2, (node2.width ?? 0) / 2, point8);
    };
    return shapeSvg;
  }
  var init_stateEnd = __esm({
    "src/rendering-util/rendering-elements/shapes/stateEnd.ts"() {
      "use strict";
      init_rough_esm();
      init_intersect();
      init_handDrawnShapeStyles();
      init_util();
      __name(stateEnd, "stateEnd");
    }
  });

  // src/rendering-util/rendering-elements/shapes/stateStart.ts
  function stateStart(parent4, node2, { config: { themeVariables } }) {
    const { lineColor, nodeShadow } = themeVariables;
    if (node2.width || node2.height) {
      if ((node2.width ?? 0) < 14) {
        node2.width = 14;
      }
      if ((node2.height ?? 0) < 14) {
        node2.height = 14;
      }
    }
    if (!node2.width) {
      node2.width = 14;
    }
    if (!node2.height) {
      node2.height = 14;
    }
    const shapeSvg = parent4.insert("g").attr("class", "node default").attr("id", node2.domId || node2.id);
    let circle6;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const roughNode = rc.circle(0, 0, node2.width, solidStateFill(lineColor));
      circle6 = shapeSvg.insert(() => roughNode);
      circle6.attr("class", "state-start").attr("r", (node2.width ?? 7) / 2).attr("width", node2.width ?? 14).attr("height", node2.height ?? 14);
    } else {
      circle6 = shapeSvg.insert("circle", ":first-child");
      circle6.attr("class", "state-start").attr("r", (node2.width ?? 7) / 2).attr("width", node2.width ?? 14).attr("height", node2.height ?? 14);
    }
    if (node2.width < 25 && nodeShadow && node2.look !== "handDrawn") {
      const svgId = parent4.node()?.ownerSVGElement?.id ?? "";
      const filterId = svgId ? `${svgId}-drop-shadow-small` : "drop-shadow-small";
      circle6.attr("style", `filter:url(#${filterId})`);
    }
    updateNodeBounds(node2, circle6);
    node2.intersect = function(point8) {
      return intersect_default.circle(node2, (node2.width ?? 7) / 2, point8);
    };
    return shapeSvg;
  }
  var init_stateStart = __esm({
    "src/rendering-util/rendering-elements/shapes/stateStart.ts"() {
      "use strict";
      init_rough_esm();
      init_intersect();
      init_handDrawnShapeStyles();
      init_util();
      __name(stateStart, "stateStart");
    }
  });

  // src/rendering-util/rendering-elements/shapes/subroutine.ts
  async function subroutine(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2?.padding ?? 8;
    const labelPaddingX = node2.look === "neo" ? 28 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 12 : nodePadding;
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const totalWidth = (node2?.width ?? bbox.width) + 2 * FRAME_WIDTH2 + labelPaddingX;
    const totalHeight = (node2?.height ?? bbox.height) + labelPaddingY;
    const w4 = totalWidth - 2 * FRAME_WIDTH2;
    const h3 = totalHeight;
    const x5 = -totalWidth / 2;
    const y6 = -totalHeight / 2;
    const points = [
      { x: 0, y: 0 },
      { x: w4, y: 0 },
      { x: w4, y: -h3 },
      { x: 0, y: -h3 },
      { x: 0, y: 0 },
      { x: -8, y: 0 },
      { x: w4 + 8, y: 0 },
      { x: w4 + 8, y: -h3 },
      { x: -8, y: -h3 },
      { x: -8, y: 0 }
    ];
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options2 = userNodeOverrides(node2, {});
      const roughNode = rc.rectangle(x5, y6, w4 + 16, h3, options2);
      const l1 = rc.line(x5 + FRAME_WIDTH2, y6, x5 + FRAME_WIDTH2, y6 + h3, options2);
      const l22 = rc.line(x5 + FRAME_WIDTH2 + w4, y6, x5 + FRAME_WIDTH2 + w4, y6 + h3, options2);
      shapeSvg.insert(() => l1, ":first-child");
      shapeSvg.insert(() => l22, ":first-child");
      const rect3 = shapeSvg.insert(() => roughNode, ":first-child");
      const { cssStyles } = node2;
      rect3.attr("class", "basic label-container").attr("style", handleUndefinedAttr(cssStyles));
      updateNodeBounds(node2, rect3);
    } else {
      const el = insertPolygonShape(shapeSvg, w4, h3, points);
      if (nodeStyles) {
        el.attr("style", nodeStyles);
      }
      updateNodeBounds(node2, el);
    }
    node2.intersect = function(point8) {
      return intersect_default.polygon(node2, points, point8);
    };
    return shapeSvg;
  }
  var FRAME_WIDTH2;
  var init_subroutine = __esm({
    "src/rendering-util/rendering-elements/shapes/subroutine.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_insertPolygonShape();
      init_utils2();
      FRAME_WIDTH2 = 8;
      __name(subroutine, "subroutine");
    }
  });

  // src/rendering-util/rendering-elements/shapes/taggedRect.ts
  async function taggedRect(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 16 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 12 : nodePadding;
    if (node2.width || node2.height) {
      node2.height = Math.max((node2?.height ?? 0) - labelPaddingY * 2, 10);
      node2.width = Math.max(
        (node2?.width ?? 0) - labelPaddingX * 2 - TAG_RATIO * (node2.height + labelPaddingY * 2),
        10
      );
    }
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const totalHeight = (node2?.height ? node2?.height : bbox.height) + labelPaddingY * 2;
    const tagWidth = TAG_RATIO * totalHeight;
    const tagHeight = TAG_RATIO * totalHeight;
    const totalWidth = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2 + tagWidth;
    const w4 = totalWidth - tagWidth;
    const h3 = totalHeight;
    const x5 = -w4 / 2;
    const y6 = -h3 / 2;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    const rectPoints = [
      { x: x5 - tagWidth / 2, y: y6 },
      { x: x5 + w4 + tagWidth / 2, y: y6 },
      { x: x5 + w4 + tagWidth / 2, y: y6 + h3 },
      { x: x5 - tagWidth / 2, y: y6 + h3 }
    ];
    const tagPoints = [
      { x: x5 + w4 - tagWidth / 2, y: y6 + h3 },
      { x: x5 + w4 + tagWidth / 2, y: y6 + h3 },
      { x: x5 + w4 + tagWidth / 2, y: y6 + h3 - tagHeight }
    ];
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const rectPath = createPathFromPoints(rectPoints);
    const rectNode = rc.path(rectPath, options2);
    const tagPath = createPathFromPoints(tagPoints);
    const tagNode = rc.path(tagPath, { ...options2, fillStyle: "solid" });
    const taggedRect2 = shapeSvg.insert(() => tagNode, ":first-child");
    taggedRect2.insert(() => rectNode, ":first-child");
    taggedRect2.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      taggedRect2.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      taggedRect2.selectAll("path").attr("style", nodeStyles);
    }
    updateNodeBounds(node2, taggedRect2);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, rectPoints, point8);
      return pos;
    };
    return shapeSvg;
  }
  var TAG_RATIO;
  var init_taggedRect = __esm({
    "src/rendering-util/rendering-elements/shapes/taggedRect.ts"() {
      "use strict";
      init_util();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_intersect();
      TAG_RATIO = 0.2;
      __name(taggedRect, "taggedRect");
    }
  });

  // src/rendering-util/rendering-elements/shapes/taggedWaveEdgedRectangle.ts
  async function taggedWaveEdgedRectangle(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = Math.max(bbox.width + (node2.padding ?? 0) * 2, node2?.width ?? 0);
    const h3 = Math.max(bbox.height + (node2.padding ?? 0) * 2, node2?.height ?? 0);
    const waveAmplitude = h3 / 8;
    const tagWidth = 0.2 * w4;
    const tagHeight = 0.2 * h3;
    const finalH = h3 + waveAmplitude;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const points = [
      { x: -w4 / 2 - w4 / 2 * 0.1, y: finalH / 2 },
      ...generateFullSineWavePoints(
        -w4 / 2 - w4 / 2 * 0.1,
        finalH / 2,
        w4 / 2 + w4 / 2 * 0.1,
        finalH / 2,
        waveAmplitude,
        0.8
      ),
      { x: w4 / 2 + w4 / 2 * 0.1, y: -finalH / 2 },
      { x: -w4 / 2 - w4 / 2 * 0.1, y: -finalH / 2 }
    ];
    const x5 = -w4 / 2 + w4 / 2 * 0.1;
    const y6 = -finalH / 2 - tagHeight * 0.4;
    const tagPoints = [
      { x: x5 + w4 - tagWidth, y: (y6 + h3) * 1.3 },
      { x: x5 + w4, y: y6 + h3 - tagHeight },
      { x: x5 + w4, y: (y6 + h3) * 0.9 },
      ...generateFullSineWavePoints(
        x5 + w4,
        (y6 + h3) * 1.25,
        x5 + w4 - tagWidth,
        (y6 + h3) * 1.3,
        -h3 * 0.02,
        0.5
      )
    ];
    const waveEdgeRectPath = createPathFromPoints(points);
    const waveEdgeRectNode = rc.path(waveEdgeRectPath, options2);
    const taggedWaveEdgeRectPath = createPathFromPoints(tagPoints);
    const taggedWaveEdgeRectNode = rc.path(taggedWaveEdgeRectPath, {
      ...options2,
      fillStyle: "solid"
    });
    const waveEdgeRect = shapeSvg.insert(() => taggedWaveEdgeRectNode, ":first-child");
    waveEdgeRect.insert(() => waveEdgeRectNode, ":first-child");
    waveEdgeRect.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      waveEdgeRect.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      waveEdgeRect.selectAll("path").attr("style", nodeStyles);
    }
    waveEdgeRect.attr("transform", `translate(0,${-waveAmplitude / 2})`);
    label.attr(
      "transform",
      `translate(${-w4 / 2 + (node2.padding ?? 0) - (bbox.x - (bbox.left ?? 0))},${-h3 / 2 + (node2.padding ?? 0) - waveAmplitude / 2 - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, waveEdgeRect);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_taggedWaveEdgedRectangle = __esm({
    "src/rendering-util/rendering-elements/shapes/taggedWaveEdgedRectangle.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_rough_esm();
      init_handDrawnShapeStyles();
      __name(taggedWaveEdgedRectangle, "taggedWaveEdgedRectangle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/text.ts
  async function text3(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const totalWidth = Math.max(bbox.width + (node2.padding ?? 0), node2?.width || 0);
    const totalHeight = Math.max(bbox.height + (node2.padding ?? 0), node2?.height || 0);
    const x5 = -totalWidth / 2;
    const y6 = -totalHeight / 2;
    const rect3 = shapeSvg.insert("rect", ":first-child");
    rect3.attr("class", "text").attr("style", nodeStyles).attr("rx", 0).attr("ry", 0).attr("x", x5).attr("y", y6).attr("width", totalWidth).attr("height", totalHeight);
    updateNodeBounds(node2, rect3);
    node2.intersect = function(point8) {
      return intersect_default.rect(node2, point8);
    };
    return shapeSvg;
  }
  var init_text3 = __esm({
    "src/rendering-util/rendering-elements/shapes/text.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      __name(text3, "text");
    }
  });

  // src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts
  async function tiltedCylinder(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPadding = node2.look === "neo" ? 12 : nodePadding / 2;
    if (node2.width || node2.height) {
      const originalHeight = node2.height ?? 0;
      node2.height = (node2.height ?? 0) - labelPadding;
      if (node2.height < MIN_HEIGHT4) {
        node2.height = MIN_HEIGHT4;
      }
      const ry2 = originalHeight / 2;
      const rx2 = ry2 / (2.5 + originalHeight / 50);
      node2.width = (node2.width ?? 0) - labelPadding - rx2 * 3;
      if (node2.width < MIN_WIDTH4) {
        node2.width = MIN_WIDTH4;
      }
    }
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const h3 = (node2.height ? node2.height : bbox.height) + labelPadding;
    const ry = h3 / 2;
    const rx = ry / (2.5 + h3 / 50);
    const w4 = (node2.width ? node2.width : bbox.width) + rx + labelPadding;
    const { cssStyles } = node2;
    let cylinder3;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const outerPathData = createOuterCylinderPathD3(0, 0, w4, h3, rx, ry);
      const innerPathData = createInnerCylinderPathD3(0, 0, w4, h3, rx, ry);
      const outerNode = rc.path(outerPathData, userNodeOverrides(node2, {}));
      const innerLine = rc.path(innerPathData, userNodeOverrides(node2, { fill: "none" }));
      cylinder3 = shapeSvg.insert(() => innerLine, ":first-child");
      cylinder3 = shapeSvg.insert(() => outerNode, ":first-child");
      cylinder3.attr("class", "basic label-container");
      if (cssStyles) {
        cylinder3.attr("style", cssStyles);
      }
    } else {
      const pathData = createCylinderPathD3(0, 0, w4, h3, rx, ry);
      cylinder3 = shapeSvg.insert("path", ":first-child").attr("d", pathData).attr("class", "basic label-container").attr("style", handleUndefinedAttr(cssStyles)).attr("style", nodeStyles);
      cylinder3.attr("class", "basic label-container outer-path");
      if (cssStyles) {
        cylinder3.selectAll("path").attr("style", cssStyles);
      }
      if (nodeStyles) {
        cylinder3.selectAll("path").attr("style", nodeStyles);
      }
    }
    cylinder3.attr("label-offset-x", rx);
    cylinder3.attr("transform", `translate(${-w4 / 2}, ${h3 / 2} )`);
    label.attr(
      "transform",
      `translate(${-(bbox.width / 2) - rx - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, cylinder3);
    node2.intersect = function(point8) {
      const pos = intersect_default.rect(node2, point8);
      const y6 = pos.y - (node2.y ?? 0);
      if (ry != 0 && (Math.abs(y6) < (node2.height ?? 0) / 2 || Math.abs(y6) == (node2.height ?? 0) / 2 && Math.abs(pos.x - (node2.x ?? 0)) > (node2.width ?? 0) / 2 - rx)) {
        let x5 = rx * rx * (1 - y6 * y6 / (ry * ry));
        if (x5 != 0) {
          x5 = Math.sqrt(Math.abs(x5));
        }
        x5 = rx - x5;
        if (point8.x - (node2.x ?? 0) > 0) {
          x5 = -x5;
        }
        pos.x += x5;
      }
      return pos;
    };
    return shapeSvg;
  }
  var createCylinderPathD3, createOuterCylinderPathD3, createInnerCylinderPathD3, MIN_HEIGHT4, MIN_WIDTH4;
  var init_tiltedCylinder = __esm({
    "src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts"() {
      "use strict";
      init_util();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_intersect();
      init_utils2();
      createCylinderPathD3 = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => {
        return `M${x5},${y6}
    a${rx},${ry} 0,0,1 ${0},${-height2}
    l${width3},${0}
    a${rx},${ry} 0,0,1 ${0},${height2}
    M${width3},${-height2}
    a${rx},${ry} 0,0,0 ${0},${height2}
    l${-width3},${0}`;
      }, "createCylinderPathD");
      createOuterCylinderPathD3 = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => {
        return [
          `M${x5},${y6}`,
          `M${x5 + width3},${y6}`,
          `a${rx},${ry} 0,0,0 ${0},${-height2}`,
          `l${-width3},0`,
          `a${rx},${ry} 0,0,0 ${0},${height2}`,
          `l${width3},0`
        ].join(" ");
      }, "createOuterCylinderPathD");
      createInnerCylinderPathD3 = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => {
        return [`M${x5 + width3 / 2},${-height2 / 2}`, `a${rx},${ry} 0,0,0 0,${height2}`].join(" ");
      }, "createInnerCylinderPathD");
      MIN_HEIGHT4 = 5;
      MIN_WIDTH4 = 10;
      __name(tiltedCylinder, "tiltedCylinder");
    }
  });

  // src/rendering-util/rendering-elements/shapes/trapezoid.ts
  async function trapezoid(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingY = node2.look === "neo" ? nodePadding : nodePadding;
    const labelPaddingX = node2.look === "neo" ? nodePadding * 2 : nodePadding;
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const h3 = (node2?.height ?? bbox.height) + labelPaddingY;
    const w4 = (node2?.width ?? bbox.width) + labelPaddingX;
    const points = [
      { x: -3 * h3 / 6, y: 0 },
      { x: w4 + 3 * h3 / 6, y: 0 },
      { x: w4, y: -h3 },
      { x: 0, y: -h3 }
    ];
    let polygon2;
    const { cssStyles } = node2;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options2 = userNodeOverrides(node2, {});
      const pathData = createPathFromPoints(points);
      const roughNode = rc.path(pathData, options2);
      polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w4 / 2}, ${h3 / 2})`);
      if (cssStyles) {
        polygon2.attr("style", cssStyles);
      }
    } else {
      polygon2 = insertPolygonShape(shapeSvg, w4, h3, points);
    }
    if (nodeStyles) {
      polygon2.attr("style", nodeStyles);
    }
    node2.width = w4;
    node2.height = h3;
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      return intersect_default.polygon(node2, points, point8);
    };
    return shapeSvg;
  }
  var init_trapezoid = __esm({
    "src/rendering-util/rendering-elements/shapes/trapezoid.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_insertPolygonShape();
      __name(trapezoid, "trapezoid");
    }
  });

  // src/rendering-util/rendering-elements/shapes/trapezoidalPentagon.ts
  async function trapezoidalPentagon(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 16 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 12 : nodePadding;
    const minWidth = 15, minHeight = 5;
    if (node2.width || node2.height) {
      node2.height = (node2.height ?? 0) - labelPaddingY * 2;
      if (node2.height < minHeight) {
        node2.height = minHeight;
      }
      node2.width = (node2.width ?? 0) - labelPaddingX * 2;
      if (node2.width < minWidth) {
        node2.width = minWidth;
      }
    }
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2;
    const h3 = (node2?.height ? node2?.height : bbox.height) + labelPaddingY * 2;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const points = [
      { x: -w4 / 2 * 0.8, y: -h3 / 2 },
      { x: w4 / 2 * 0.8, y: -h3 / 2 },
      { x: w4 / 2, y: -h3 / 2 * 0.6 },
      { x: w4 / 2, y: h3 / 2 },
      { x: -w4 / 2, y: h3 / 2 },
      { x: -w4 / 2, y: -h3 / 2 * 0.6 }
    ];
    const pathData = createPathFromPoints(points);
    const shapeNode = rc.path(pathData, options2);
    const polygon2 = shapeSvg.insert(() => shapeNode, ":first-child");
    polygon2.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", nodeStyles);
    }
    updateNodeBounds(node2, polygon2);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_trapezoidalPentagon = __esm({
    "src/rendering-util/rendering-elements/shapes/trapezoidalPentagon.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      __name(trapezoidalPentagon, "trapezoidalPentagon");
    }
  });

  // src/rendering-util/rendering-elements/shapes/triangle.ts
  async function triangle(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? nodePadding * 2 : nodePadding;
    if (node2.width || node2.height) {
      node2.width = ((node2?.width ?? 0) - labelPaddingX) / 2;
      if (node2.width < MIN_WIDTH5) {
        node2.width = MIN_WIDTH5;
      }
      node2.height = node2?.height ?? 0;
      if (node2.height < MIN_HEIGHT5) {
        node2.height = MIN_HEIGHT5;
      }
    }
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const useHtmlLabels = evaluate(getConfig2().flowchart?.htmlLabels);
    const w4 = (node2?.width ? node2?.width : bbox.width) + labelPaddingX;
    const h3 = node2?.height ? node2?.height : w4 + bbox.height;
    const tw = h3;
    const points = [
      { x: 0, y: 0 },
      { x: tw, y: 0 },
      { x: tw / 2, y: -h3 }
    ];
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const pathData = createPathFromPoints(points);
    const roughNode = rc.path(pathData, options2);
    const polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-h3 / 2}, ${h3 / 2})`).attr("class", "outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      polygon2.selectChildren("path").attr("style", nodeStyles);
    }
    node2.width = w4;
    node2.height = h3;
    updateNodeBounds(node2, polygon2);
    label.attr(
      "transform",
      `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${h3 / 2 - (bbox.height + (node2.padding ?? 0) / (useHtmlLabels ? 2 : 1) - (bbox.y - (bbox.top ?? 0)))})`
    );
    node2.intersect = function(point8) {
      log.info("Triangle intersect", node2, points, point8);
      return intersect_default.polygon(node2, points, point8);
    };
    return shapeSvg;
  }
  var MIN_HEIGHT5, MIN_WIDTH5;
  var init_triangle = __esm({
    "src/rendering-util/rendering-elements/shapes/triangle.ts"() {
      "use strict";
      init_logger();
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_util();
      init_common();
      init_diagramAPI();
      MIN_HEIGHT5 = 10;
      MIN_WIDTH5 = 10;
      __name(triangle, "triangle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/waveEdgedRectangle.ts
  async function waveEdgedRectangle(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 16 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 12 : nodePadding;
    let adjustFinalHeight = true;
    if (node2.width || node2.height) {
      adjustFinalHeight = false;
      node2.width = (node2?.width ?? 0) - labelPaddingX * 2;
      if (node2.width < 10) {
        node2.width = 10;
      }
      node2.height = (node2?.height ?? 0) - labelPaddingY * 2;
      if (node2.height < 10) {
        node2.height = 10;
      }
    }
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = (node2?.width ? node2?.width : bbox.width) + (labelPaddingX ?? 0) * 2;
    const h3 = (node2?.height ? node2?.height : bbox.height) + (labelPaddingY ?? 0) * 2;
    const waveAmplitude = node2.look === "neo" ? h3 / 4 : h3 / 8;
    const finalH = h3 + (adjustFinalHeight ? waveAmplitude : -waveAmplitude);
    const { cssStyles } = node2;
    const minWidth = 14;
    const widthDif = minWidth - w4;
    const extraW = widthDif > 0 ? widthDif / 2 : 0;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const points = [
      { x: -w4 / 2 - extraW, y: finalH / 2 },
      ...generateFullSineWavePoints(
        -w4 / 2 - extraW,
        finalH / 2,
        w4 / 2 + extraW,
        finalH / 2,
        waveAmplitude,
        0.8
      ),
      { x: w4 / 2 + extraW, y: -finalH / 2 },
      { x: -w4 / 2 - extraW, y: -finalH / 2 }
    ];
    const waveEdgeRectPath = createPathFromPoints(points);
    const waveEdgeRectNode = rc.path(waveEdgeRectPath, options2);
    const waveEdgeRect = shapeSvg.insert(() => waveEdgeRectNode, ":first-child");
    waveEdgeRect.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      waveEdgeRect.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      waveEdgeRect.selectAll("path").attr("style", nodeStyles);
    }
    waveEdgeRect.attr("transform", `translate(0,${-waveAmplitude / 2})`);
    label.attr(
      "transform",
      `translate(${-w4 / 2 + (node2.padding ?? 0) - (bbox.x - (bbox.left ?? 0))},${-h3 / 2 + (node2.padding ?? 0) - waveAmplitude - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, waveEdgeRect);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_waveEdgedRectangle = __esm({
    "src/rendering-util/rendering-elements/shapes/waveEdgedRectangle.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_rough_esm();
      init_handDrawnShapeStyles();
      __name(waveEdgedRectangle, "waveEdgedRectangle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/waveRectangle.ts
  async function waveRectangle(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const nodePadding = node2.padding ?? 0;
    const labelPaddingX = node2.look === "neo" ? 16 : nodePadding;
    const labelPaddingY = node2.look === "neo" ? 20 : nodePadding;
    if (node2.width || node2.height) {
      node2.width = node2?.width ?? 0;
      if (node2.width < 20) {
        node2.width = 20;
      }
      node2.height = node2?.height ?? 0;
      if (node2.height < 10) {
        node2.height = 10;
      }
      const waveAmplitude2 = Math.min(node2.height * 0.2, node2.height / 4);
      node2.height = Math.ceil(node2.height - labelPaddingY - waveAmplitude2 * (20 / 9));
      node2.width = node2.width - labelPaddingX * 2;
    }
    const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const w4 = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2;
    const h3 = (node2?.height ? node2?.height : bbox.height) + labelPaddingY;
    const waveAmplitude = h3 / 8;
    const finalH = h3 + waveAmplitude * 2;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const points = [
      { x: -w4 / 2, y: finalH / 2 },
      ...generateFullSineWavePoints(-w4 / 2, finalH / 2, w4 / 2, finalH / 2, waveAmplitude, 1),
      { x: w4 / 2, y: -finalH / 2 },
      ...generateFullSineWavePoints(w4 / 2, -finalH / 2, -w4 / 2, -finalH / 2, waveAmplitude, -1)
    ];
    const waveRectPath = createPathFromPoints(points);
    const waveRectNode = rc.path(waveRectPath, options2);
    const waveRect = shapeSvg.insert(() => waveRectNode, ":first-child");
    waveRect.attr("class", "basic label-container");
    if (cssStyles && node2.look !== "handDrawn") {
      waveRect.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      waveRect.selectAll("path").attr("style", nodeStyles);
    }
    updateNodeBounds(node2, waveRect);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, points, point8);
      return pos;
    };
    return shapeSvg;
  }
  var init_waveRectangle = __esm({
    "src/rendering-util/rendering-elements/shapes/waveRectangle.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      __name(waveRectangle, "waveRectangle");
    }
  });

  // src/rendering-util/rendering-elements/shapes/windowPane.ts
  async function windowPane(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const paddingX = node2.look === "neo" ? 16 : node2.padding ?? 0;
    const paddingY = node2.look === "neo" ? 12 : node2.padding ?? 0;
    if (node2.width || node2.height) {
      node2.width = Math.max((node2?.width ?? 0) - paddingX * 2 - rectOffset, 10);
      node2.height = Math.max((node2?.height ?? 0) - paddingY * 2 - rectOffset, 10);
    }
    const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2));
    const totalWidth = (node2?.width ? node2?.width : bbox.width) + paddingX * 2 + rectOffset;
    const totalHeight = (node2?.height ? node2?.height : bbox.height) + paddingY * 2 + rectOffset;
    const w4 = totalWidth - rectOffset;
    const h3 = totalHeight - rectOffset;
    const x5 = -w4 / 2;
    const y6 = -h3 / 2;
    const { cssStyles } = node2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    const outerPathPoints = [
      { x: x5 - rectOffset, y: y6 - rectOffset },
      { x: x5 - rectOffset, y: y6 + h3 },
      { x: x5 + w4, y: y6 + h3 },
      { x: x5 + w4, y: y6 - rectOffset }
    ];
    const path4 = `M${x5 - rectOffset},${y6 - rectOffset} L${x5 + w4},${y6 - rectOffset} L${x5 + w4},${y6 + h3} L${x5 - rectOffset},${y6 + h3} L${x5 - rectOffset},${y6 - rectOffset}
                M${x5 - rectOffset},${y6} L${x5 + w4},${y6}
                M${x5},${y6 - rectOffset} L${x5},${y6 + h3}`;
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const no = rc.path(path4, options2);
    const windowPane2 = shapeSvg.insert(() => no, ":first-child");
    windowPane2.attr("transform", `translate(${rectOffset / 2}, ${rectOffset / 2})`);
    windowPane2.attr("class", "basic label-container outer-path");
    if (cssStyles && node2.look !== "handDrawn") {
      windowPane2.selectAll("path").attr("style", cssStyles);
    }
    if (nodeStyles && node2.look !== "handDrawn") {
      windowPane2.selectAll("path").attr("style", nodeStyles);
    }
    label.attr(
      "transform",
      `translate(${-(bbox.width / 2) + rectOffset / 2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + rectOffset / 2 - (bbox.y - (bbox.top ?? 0))})`
    );
    updateNodeBounds(node2, windowPane2);
    node2.intersect = function(point8) {
      const pos = intersect_default.polygon(node2, outerPathPoints, point8);
      return pos;
    };
    return shapeSvg;
  }
  var rectOffset;
  var init_windowPane = __esm({
    "src/rendering-util/rendering-elements/shapes/windowPane.ts"() {
      "use strict";
      init_util();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_intersect();
      rectOffset = 10;
      __name(windowPane, "windowPane");
    }
  });

  // src/rendering-util/rendering-elements/shapes/erBox.ts
  async function erBox(parent4, node2) {
    const entityNode = node2;
    if (entityNode.alias) {
      node2.label = entityNode.alias;
    }
    const { theme, themeVariables } = getConfig();
    const { rowEven, rowOdd, nodeBorder, borderColorArray } = themeVariables;
    if (node2.look === "handDrawn") {
      const { themeVariables: themeVariables2 } = getConfig();
      const { background } = themeVariables2;
      const backgroundNode = {
        ...node2,
        id: node2.id + "-background",
        domId: (node2.domId || node2.id) + "-background",
        look: "default",
        cssStyles: ["stroke: none", `fill: ${background}`]
      };
      await erBox(parent4, backgroundNode);
    }
    const config5 = getConfig();
    node2.useHtmlLabels = config5.htmlLabels;
    let PADDING = config5.er?.diagramPadding ?? 10;
    let TEXT_PADDING = config5.er?.entityPadding ?? 6;
    const { cssStyles } = node2;
    const { labelStyles, nodeStyles } = styles2String(node2);
    if (entityNode.attributes.length === 0 && node2.label) {
      const options3 = {
        rx: 0,
        ry: 0,
        labelPaddingX: PADDING,
        labelPaddingY: PADDING * 1.5,
        classes: ""
      };
      if (calculateTextWidth(node2.label, config5) + options3.labelPaddingX * 2 < config5.er.minEntityWidth) {
        node2.width = config5.er.minEntityWidth;
      }
      const shapeSvg2 = await drawRect3(parent4, node2, options3);
      if (theme != null && COLOR_THEMES.has(theme)) {
        const colorIndex = entityNode.colorIndex ?? 0;
        shapeSvg2.attr("data-color-id", `color-${colorIndex % borderColorArray.length}`);
      }
      if (!evaluate(config5.htmlLabels)) {
        const textElement = shapeSvg2.select("text");
        const bbox = textElement.node()?.getBBox();
        textElement.attr("transform", `translate(${-bbox.width / 2}, 0)`);
      }
      return shapeSvg2;
    }
    if (!config5.htmlLabels) {
      PADDING *= 1.25;
      TEXT_PADDING *= 1.25;
    }
    let cssClasses = getNodeClasses(node2);
    if (!cssClasses) {
      cssClasses = "node default";
    }
    const shapeSvg = parent4.insert("g").attr("class", cssClasses).attr("id", node2.domId || node2.id);
    const nameBBox = await addText(shapeSvg, node2.label ?? "", config5, 0, 0, ["name"], labelStyles);
    nameBBox.height += TEXT_PADDING;
    let yOffset = 0;
    const yOffsets = [];
    const rows = [];
    let maxTypeWidth = 0;
    let maxNameWidth = 0;
    let maxKeysWidth = 0;
    let maxCommentWidth = 0;
    let keysPresent = true;
    let commentPresent = true;
    for (const attribute of entityNode.attributes) {
      const typeBBox = await addText(
        shapeSvg,
        attribute.type,
        config5,
        0,
        yOffset,
        ["attribute-type"],
        labelStyles
      );
      maxTypeWidth = Math.max(maxTypeWidth, typeBBox.width + PADDING);
      const nameBBox2 = await addText(
        shapeSvg,
        attribute.name,
        config5,
        0,
        yOffset,
        ["attribute-name"],
        labelStyles
      );
      maxNameWidth = Math.max(maxNameWidth, nameBBox2.width + PADDING);
      const keysBBox = await addText(
        shapeSvg,
        attribute.keys.join(),
        config5,
        0,
        yOffset,
        ["attribute-keys"],
        labelStyles
      );
      maxKeysWidth = Math.max(maxKeysWidth, keysBBox.width + PADDING);
      const commentBBox = await addText(
        shapeSvg,
        attribute.comment,
        config5,
        0,
        yOffset,
        ["attribute-comment"],
        labelStyles
      );
      maxCommentWidth = Math.max(maxCommentWidth, commentBBox.width + PADDING);
      const rowHeight = Math.max(typeBBox.height, nameBBox2.height, keysBBox.height, commentBBox.height) + TEXT_PADDING;
      rows.push({ yOffset, rowHeight });
      yOffset += rowHeight;
    }
    let totalWidthSections = 4;
    if (maxKeysWidth <= PADDING) {
      keysPresent = false;
      maxKeysWidth = 0;
      totalWidthSections--;
    }
    if (maxCommentWidth <= PADDING) {
      commentPresent = false;
      maxCommentWidth = 0;
      totalWidthSections--;
    }
    const shapeBBox = shapeSvg.node().getBBox();
    if (nameBBox.width + PADDING * 2 - (maxTypeWidth + maxNameWidth + maxKeysWidth + maxCommentWidth) > 0) {
      const difference2 = nameBBox.width + PADDING * 2 - (maxTypeWidth + maxNameWidth + maxKeysWidth + maxCommentWidth);
      maxTypeWidth += difference2 / totalWidthSections;
      maxNameWidth += difference2 / totalWidthSections;
      if (maxKeysWidth > 0) {
        maxKeysWidth += difference2 / totalWidthSections;
      }
      if (maxCommentWidth > 0) {
        maxCommentWidth += difference2 / totalWidthSections;
      }
    }
    const maxWidth2 = maxTypeWidth + maxNameWidth + maxKeysWidth + maxCommentWidth;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    let totalShapeBBoxHeight = 0;
    if (rows.length > 0) {
      totalShapeBBoxHeight = rows.reduce((sum2, row) => sum2 + (row?.rowHeight ?? 0), 0);
    }
    const w4 = Math.max(shapeBBox.width + PADDING * 2, node2?.width || 0, maxWidth2);
    const h3 = Math.max((totalShapeBBoxHeight ?? 0) + nameBBox.height, node2?.height || 0);
    const x5 = -w4 / 2;
    const y6 = -h3 / 2;
    shapeSvg.selectAll("g:not(:first-child)").each((_3, i2, nodes5) => {
      const text4 = select_default2(nodes5[i2]);
      const transform8 = text4.attr("transform");
      let translateX2 = 0;
      let translateY2 = 0;
      if (transform8) {
        const regex2 = RegExp(/translate\(([^,]+),([^)]+)\)/);
        const translate2 = regex2.exec(transform8);
        if (translate2) {
          translateX2 = parseFloat(translate2[1]);
          translateY2 = parseFloat(translate2[2]);
          if (text4.attr("class").includes("attribute-name")) {
            translateX2 += maxTypeWidth;
          } else if (text4.attr("class").includes("attribute-keys")) {
            translateX2 += maxTypeWidth + maxNameWidth;
          } else if (text4.attr("class").includes("attribute-comment")) {
            translateX2 += maxTypeWidth + maxNameWidth + maxKeysWidth;
          }
        }
      }
      text4.attr(
        "transform",
        `translate(${x5 + PADDING / 2 + translateX2}, ${translateY2 + y6 + nameBBox.height + TEXT_PADDING / 2})`
      );
    });
    shapeSvg.select(".name").attr("transform", "translate(" + -nameBBox.width / 2 + ", " + (y6 + TEXT_PADDING / 2) + ")");
    if (theme != null && COLOR_THEMES.has(theme)) {
      const colorIndex = entityNode.colorIndex ?? 0;
      shapeSvg.attr("data-color-id", `color-${colorIndex % borderColorArray.length}`);
    }
    const roughRect = rc.rectangle(x5, y6, w4, h3, options2);
    const rect3 = shapeSvg.insert(() => roughRect, ":first-child").attr("class", "outer-path").attr("style", cssStyles.join(""));
    yOffsets.push(0);
    for (const [i2, row] of rows.entries()) {
      const contentRowIndex = i2 + 1;
      const isEven = contentRowIndex % 2 === 0 && row.yOffset !== 0;
      const roughRect2 = rc.rectangle(x5, nameBBox.height + y6 + row?.yOffset, w4, row?.rowHeight, {
        ...options2,
        fill: isEven ? rowEven : rowOdd,
        stroke: nodeBorder
      });
      shapeSvg.insert(() => roughRect2, "g.label").attr("style", cssStyles.join("")).attr("class", `row-rect-${isEven ? "even" : "odd"}`);
    }
    const thickness = 1e-4;
    let points = lineToPolygon(x5, nameBBox.height + y6, w4 + x5, nameBBox.height + y6, thickness);
    let roughLine = rc.polygon(
      points.map((p3) => [p3.x, p3.y]),
      options2
    );
    shapeSvg.insert(() => roughLine).attr("class", "divider");
    points = lineToPolygon(maxTypeWidth + x5, nameBBox.height + y6, maxTypeWidth + x5, h3 + y6, thickness);
    roughLine = rc.polygon(
      points.map((p3) => [p3.x, p3.y]),
      options2
    );
    shapeSvg.insert(() => roughLine).attr("class", "divider");
    if (keysPresent) {
      const xCoord = maxTypeWidth + maxNameWidth + x5;
      points = lineToPolygon(xCoord, nameBBox.height + y6, xCoord, h3 + y6, thickness);
      roughLine = rc.polygon(
        points.map((p3) => [p3.x, p3.y]),
        options2
      );
      shapeSvg.insert(() => roughLine).attr("class", "divider");
    }
    if (commentPresent) {
      const xCoord = maxTypeWidth + maxNameWidth + maxKeysWidth + x5;
      points = lineToPolygon(xCoord, nameBBox.height + y6, xCoord, h3 + y6, thickness);
      roughLine = rc.polygon(
        points.map((p3) => [p3.x, p3.y]),
        options2
      );
      shapeSvg.insert(() => roughLine).attr("class", "divider");
    }
    for (const yOffset2 of yOffsets) {
      const yCoord = nameBBox.height + y6 + yOffset2;
      points = lineToPolygon(x5, yCoord, w4 + x5, yCoord, thickness);
      roughLine = rc.polygon(
        points.map((p3) => [p3.x, p3.y]),
        options2
      );
      shapeSvg.insert(() => roughLine).attr("class", "divider");
    }
    updateNodeBounds(node2, rect3);
    if (nodeStyles && node2.look !== "handDrawn") {
      if (theme != null && REDUX_THEMES.has(theme)) {
        shapeSvg.selectAll("path").attr("style", nodeStyles);
      } else {
        const allStyle = nodeStyles.split(";");
        const strokeStyles = allStyle?.filter((e3) => {
          return e3.includes("stroke");
        })?.map((s2) => `${s2}`).join("; ");
        shapeSvg.selectAll("path").attr("style", strokeStyles ?? "");
        shapeSvg.selectAll(".row-rect-even path").attr("style", nodeStyles);
      }
    }
    node2.intersect = function(point8) {
      return intersect_default.rect(node2, point8);
    };
    return shapeSvg;
  }
  async function addText(shapeSvg, labelText, config5, translateX2 = 0, translateY2 = 0, classes3 = [], style3 = "") {
    const label = shapeSvg.insert("g").attr("class", `label ${classes3.join(" ")}`).attr("transform", `translate(${translateX2}, ${translateY2})`).attr("style", style3);
    if (labelText !== parseGenericTypes(labelText)) {
      labelText = parseGenericTypes(labelText);
      labelText = labelText.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
    }
    const text4 = label.node().appendChild(
      await createText(
        label,
        labelText,
        {
          width: calculateTextWidth(labelText, config5) + 100,
          style: style3,
          useHtmlLabels: config5.htmlLabels
        },
        config5
      )
    );
    if (labelText.includes("&lt;") || labelText.includes("&gt;")) {
      let child = text4.children[0];
      child.textContent = child.textContent.replaceAll("&lt;", "<").replaceAll("&gt;", ">");
      while (child.childNodes[0]) {
        child = child.childNodes[0];
        child.textContent = child.textContent.replaceAll("&lt;", "<").replaceAll("&gt;", ">");
      }
    }
    let bbox = text4.getBBox();
    if (evaluate(config5.htmlLabels)) {
      const div = text4.children[0];
      div.style.textAlign = "start";
      const dv = select_default2(text4);
      bbox = div.getBoundingClientRect();
      dv.attr("width", bbox.width);
      dv.attr("height", bbox.height);
    }
    return bbox;
  }
  function lineToPolygon(x1, y1, x22, y22, thickness) {
    if (x1 === x22) {
      return [
        { x: x1 - thickness / 2, y: y1 },
        { x: x1 + thickness / 2, y: y1 },
        { x: x22 + thickness / 2, y: y22 },
        { x: x22 - thickness / 2, y: y22 }
      ];
    }
    return [
      { x: x1, y: y1 - thickness / 2 },
      { x: x1, y: y1 + thickness / 2 },
      { x: x22, y: y22 + thickness / 2 },
      { x: x22, y: y22 - thickness / 2 }
    ];
  }
  var COLOR_THEMES, REDUX_THEMES;
  var init_erBox = __esm({
    "src/rendering-util/rendering-elements/shapes/erBox.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_drawRect();
      init_config();
      init_createText();
      init_common();
      init_src32();
      init_utils2();
      COLOR_THEMES = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]);
      REDUX_THEMES = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]);
      __name(erBox, "erBox");
      __name(addText, "addText");
      __name(lineToPolygon, "lineToPolygon");
    }
  });

  // src/diagrams/class/shapeUtil.ts
  async function textHelper(parent4, node2, config5, useHtmlLabels, GAP = config5.class.padding ?? 12) {
    const TEXT_PADDING = !useHtmlLabels ? 3 : 0;
    const shapeSvg = parent4.insert("g").attr("class", getNodeClasses(node2)).attr("id", node2.domId || node2.id);
    let annotationGroup = null;
    let labelGroup = null;
    let membersGroup = null;
    let methodsGroup = null;
    let annotationGroupHeight = 0;
    let labelGroupHeight = 0;
    let membersGroupHeight = 0;
    annotationGroup = shapeSvg.insert("g").attr("class", "annotation-group text");
    if (node2.annotations.length > 0) {
      const annotation = node2.annotations[0];
      await addText2(annotationGroup, { text: `\xAB${annotation}\xBB` }, 0);
      const annotationGroupBBox = annotationGroup.node().getBBox();
      annotationGroupHeight = annotationGroupBBox.height;
    }
    labelGroup = shapeSvg.insert("g").attr("class", "label-group text");
    await addText2(labelGroup, node2, 0, ["font-weight: bolder"]);
    const labelGroupBBox = labelGroup.node().getBBox();
    labelGroupHeight = labelGroupBBox.height;
    membersGroup = shapeSvg.insert("g").attr("class", "members-group text");
    let yOffset = 0;
    for (const member of node2.members) {
      const height2 = await addText2(membersGroup, member, yOffset, [member.parseClassifier()]);
      yOffset += height2 + TEXT_PADDING;
    }
    membersGroupHeight = membersGroup.node().getBBox().height;
    if (membersGroupHeight <= 0) {
      membersGroupHeight = GAP / 2;
    }
    methodsGroup = shapeSvg.insert("g").attr("class", "methods-group text");
    let methodsYOffset = 0;
    for (const method of node2.methods) {
      const height2 = await addText2(methodsGroup, method, methodsYOffset, [method.parseClassifier()]);
      methodsYOffset += height2 + TEXT_PADDING;
    }
    let bbox = shapeSvg.node().getBBox();
    if (annotationGroup !== null) {
      const annotationGroupBBox = annotationGroup.node().getBBox();
      annotationGroup.attr("transform", `translate(${-annotationGroupBBox.width / 2})`);
    }
    labelGroup.attr("transform", `translate(${-labelGroupBBox.width / 2}, ${annotationGroupHeight})`);
    bbox = shapeSvg.node().getBBox();
    membersGroup.attr(
      "transform",
      `translate(${0}, ${annotationGroupHeight + labelGroupHeight + GAP * 2})`
    );
    bbox = shapeSvg.node().getBBox();
    methodsGroup.attr(
      "transform",
      `translate(${0}, ${annotationGroupHeight + labelGroupHeight + (membersGroupHeight ? membersGroupHeight + GAP * 4 : GAP * 2)})`
    );
    bbox = shapeSvg.node().getBBox();
    return { shapeSvg, bbox };
  }
  async function addText2(parentGroup, node2, yOffset, styles5 = []) {
    const textEl = parentGroup.insert("g").attr("class", "label").attr("style", styles5.join("; "));
    const config5 = getConfig();
    let useHtmlLabels = "useHtmlLabels" in node2 ? node2.useHtmlLabels : evaluate(config5.htmlLabels) ?? true;
    let textContent = "";
    if ("text" in node2) {
      textContent = node2.text;
    } else {
      textContent = node2.label;
    }
    if (!useHtmlLabels && textContent.startsWith("\\")) {
      textContent = textContent.substring(1);
    }
    if (hasKatex(textContent)) {
      useHtmlLabels = true;
    }
    const text4 = await createText(
      textEl,
      sanitizeText3(decodeEntities(textContent)),
      {
        width: calculateTextWidth(textContent, config5) + 50,
        // Add room for error when splitting text into multiple lines
        classes: "markdown-node-label",
        useHtmlLabels
      },
      config5
    );
    let bbox;
    let numberOfLines = 1;
    if (!useHtmlLabels) {
      if (styles5.includes("font-weight: bolder")) {
        select_default2(text4).selectAll("tspan").attr("font-weight", "");
      }
      numberOfLines = text4.children.length;
      const textChild = text4.children[0];
      if (text4.textContent === "" || text4.textContent.includes("&gt")) {
        textChild.textContent = textContent[0] + textContent.substring(1).replaceAll("&gt;", ">").replaceAll("&lt;", "<").trim();
        const preserveSpace = textContent[1] === " ";
        if (preserveSpace) {
          textChild.textContent = textChild.textContent[0] + " " + textChild.textContent.substring(1);
        }
      }
      if (textChild.textContent === "undefined") {
        textChild.textContent = "";
      }
      bbox = text4.getBBox();
    } else {
      const div = text4.children[0];
      const dv = select_default2(text4);
      numberOfLines = div.innerHTML.split("<br>").length;
      if (div.innerHTML.includes("</math>")) {
        numberOfLines += div.innerHTML.split("<mrow>").length - 1;
      }
      const images = div.getElementsByTagName("img");
      if (images) {
        const noImgText = textContent.replace(/<img[^>]*>/g, "").trim() === "";
        await Promise.all(
          [...images].map(
            (img) => new Promise((res) => {
              function setupImage() {
                img.style.display = "flex";
                img.style.flexDirection = "column";
                if (noImgText) {
                  const bodyFontSize = config5.fontSize?.toString() ?? window.getComputedStyle(document.body).fontSize;
                  const enlargingFactor = 5;
                  const width3 = parseInt(bodyFontSize, 10) * enlargingFactor + "px";
                  img.style.minWidth = width3;
                  img.style.maxWidth = width3;
                } else {
                  img.style.width = "100%";
                }
                res(img);
              }
              __name(setupImage, "setupImage");
              setTimeout(() => {
                if (img.complete) {
                  setupImage();
                }
              });
              img.addEventListener("error", setupImage);
              img.addEventListener("load", setupImage);
            })
          )
        );
      }
      bbox = div.getBoundingClientRect();
      dv.attr("width", bbox.width);
      dv.attr("height", bbox.height);
    }
    textEl.attr("transform", "translate(0," + (-bbox.height / (2 * numberOfLines) + yOffset) + ")");
    return bbox.height;
  }
  var init_shapeUtil = __esm({
    "src/diagrams/class/shapeUtil.ts"() {
      "use strict";
      init_src32();
      init_config();
      init_util();
      init_utils2();
      init_diagramAPI();
      init_createText();
      init_common();
      __name(textHelper, "textHelper");
      __name(addText2, "addText");
    }
  });

  // src/rendering-util/rendering-elements/shapes/classBox.ts
  async function classBox(parent4, node2) {
    const config5 = getConfig2();
    const { themeVariables } = config5;
    const { useGradient } = themeVariables;
    const PADDING = config5.class.padding ?? 12;
    const GAP = PADDING;
    const useHtmlLabels = node2.useHtmlLabels ?? evaluate(config5.htmlLabels) ?? true;
    const classNode = node2;
    classNode.annotations = classNode.annotations ?? [];
    classNode.members = classNode.members ?? [];
    classNode.methods = classNode.methods ?? [];
    const { shapeSvg, bbox } = await textHelper(parent4, node2, config5, useHtmlLabels, GAP);
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    node2.cssStyles = classNode.styles || "";
    const styles5 = classNode.styles?.join(";") || nodeStyles || "";
    if (!node2.cssStyles) {
      node2.cssStyles = styles5.replaceAll("!important", "").split(";");
    }
    const renderExtraBox = classNode.members.length === 0 && classNode.methods.length === 0 && !config5.class?.hideEmptyMembersBox;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const w4 = Math.max(node2.width ?? 0, bbox.width);
    let h3 = Math.max(node2.height ?? 0, bbox.height);
    const nodeHeightGreater = (node2.height ?? 0) > bbox.height;
    if (classNode.members.length === 0 && classNode.methods.length === 0) {
      h3 += GAP;
    } else if (classNode.members.length > 0 && classNode.methods.length === 0) {
      h3 += GAP * 2;
    }
    const x5 = -w4 / 2;
    const y6 = -h3 / 2;
    let extraHeight = renderExtraBox ? PADDING * 2 : classNode.members.length === 0 && classNode.methods.length === 0 ? -PADDING : 0;
    if (nodeHeightGreater) {
      extraHeight = PADDING * 2;
    }
    const roughRect = rc.rectangle(
      x5 - PADDING,
      y6 - PADDING - (renderExtraBox ? PADDING : classNode.members.length === 0 && classNode.methods.length === 0 ? -PADDING / 2 : 0),
      w4 + 2 * PADDING,
      h3 + 2 * PADDING + extraHeight,
      options2
    );
    const rect3 = shapeSvg.insert(() => roughRect, ":first-child");
    rect3.attr("class", "basic label-container outer-path");
    const rectBBox = rect3.node().getBBox();
    const annotationGroupHeight = shapeSvg.select(".annotation-group").node().getBBox().height - (renderExtraBox ? PADDING / 2 : 0) || 0;
    const labelGroupHeight = shapeSvg.select(".label-group").node().getBBox().height - (renderExtraBox ? PADDING / 2 : 0) || 0;
    const membersGroupHeight = shapeSvg.select(".members-group").node().getBBox().height - (renderExtraBox ? PADDING / 2 : 0) || 0;
    const methodsAreaPlacement = (annotationGroupHeight + labelGroupHeight + y6 + PADDING - (y6 - PADDING - (renderExtraBox ? PADDING : classNode.members.length === 0 && classNode.methods.length === 0 ? -PADDING / 2 : 0))) / 2;
    shapeSvg.selectAll(".text").each((_3, i2, nodes5) => {
      const text4 = select_default2(nodes5[i2]);
      const transform8 = text4.attr("transform");
      let translateY2 = 0;
      if (transform8) {
        const regex2 = RegExp(/translate\(([^,]+),([^)]+)\)/);
        const translate2 = regex2.exec(transform8);
        if (translate2) {
          translateY2 = parseFloat(translate2[2]);
        }
      }
      let newTranslateY = translateY2 + y6 + PADDING - (renderExtraBox ? PADDING : classNode.members.length === 0 && classNode.methods.length === 0 ? -PADDING / 2 : 0);
      if (text4.attr("class").includes("methods-group")) {
        const membersGroupHeightForMethods = Math.max(membersGroupHeight, GAP / 2);
        if (nodeHeightGreater) {
          newTranslateY = Math.max(
            methodsAreaPlacement,
            annotationGroupHeight + labelGroupHeight + membersGroupHeightForMethods + y6 + GAP * 2 + PADDING
          ) + GAP * 2;
        } else {
          newTranslateY = annotationGroupHeight + labelGroupHeight + membersGroupHeightForMethods + y6 + GAP * 4 + PADDING;
        }
      }
      if (classNode.members.length === 0 && classNode.methods.length === 0 && config5.class?.hideEmptyMembersBox) {
        if (classNode.annotations.length > 0) {
          newTranslateY = translateY2 - GAP;
        } else {
          newTranslateY = translateY2;
        }
      }
      if (!useHtmlLabels) {
        newTranslateY -= 4;
      }
      let newTranslateX = x5;
      if (text4.attr("class").includes("label-group") || text4.attr("class").includes("annotation-group")) {
        newTranslateX = -text4.node()?.getBBox().width / 2 || 0;
        shapeSvg.selectAll("text").each(function(_4, i3, nodes6) {
          if (window.getComputedStyle(nodes6[i3]).textAnchor === "middle") {
            newTranslateX = 0;
          }
        });
      }
      text4.attr("transform", `translate(${newTranslateX}, ${newTranslateY})`);
    });
    if (classNode.members.length > 0 || classNode.methods.length > 0 || renderExtraBox) {
      const firstLineY = annotationGroupHeight + labelGroupHeight + y6 + PADDING;
      const roughLine = rc.line(
        rectBBox.x,
        firstLineY,
        rectBBox.x + rectBBox.width,
        firstLineY + 1e-3,
        options2
      );
      const line2 = shapeSvg.insert(() => roughLine);
      line2.attr("class", `divider${node2.look === "neo" && !useGradient ? " neo-line" : ""}`).attr("style", styles5);
    }
    if (renderExtraBox || classNode.members.length > 0 || classNode.methods.length > 0) {
      const secondLineY = annotationGroupHeight + labelGroupHeight + membersGroupHeight + y6 + GAP * 2 + PADDING;
      const roughLine = rc.line(
        rectBBox.x,
        nodeHeightGreater ? Math.max(methodsAreaPlacement, secondLineY) : secondLineY,
        rectBBox.x + rectBBox.width,
        (nodeHeightGreater ? Math.max(methodsAreaPlacement, secondLineY) : secondLineY) + 1e-3,
        options2
      );
      const line2 = shapeSvg.insert(() => roughLine);
      line2.attr("class", `divider${node2.look === "neo" && !useGradient ? " neo-line" : ""}`).attr("style", styles5);
    }
    if (classNode.look !== "handDrawn") {
      shapeSvg.selectAll("path").attr("style", styles5);
    }
    rect3.select(":nth-child(2)").attr("style", styles5);
    shapeSvg.selectAll(".divider").select("path").attr("style", styles5);
    if (node2.labelStyle) {
      shapeSvg.selectAll("span").attr("style", node2.labelStyle);
    } else {
      shapeSvg.selectAll("span").attr("style", styles5);
    }
    if (!useHtmlLabels) {
      const colorRegex = RegExp(/color\s*:\s*([^;]*)/);
      const match2 = colorRegex.exec(styles5);
      if (match2) {
        const colorStyle = match2[0].replace("color", "fill");
        shapeSvg.selectAll("tspan").attr("style", colorStyle);
      } else if (labelStyles) {
        const match3 = colorRegex.exec(labelStyles);
        if (match3) {
          const colorStyle = match3[0].replace("color", "fill");
          shapeSvg.selectAll("tspan").attr("style", colorStyle);
        }
      }
    }
    updateNodeBounds(node2, rect3);
    node2.intersect = function(point8) {
      return intersect_default.rect(node2, point8);
    };
    return shapeSvg;
  }
  var init_classBox = __esm({
    "src/rendering-util/rendering-elements/shapes/classBox.ts"() {
      "use strict";
      init_util();
      init_diagramAPI();
      init_src32();
      init_rough_esm();
      init_handDrawnShapeStyles();
      init_intersect();
      init_shapeUtil();
      init_common();
      __name(classBox, "classBox");
    }
  });

  // src/rendering-util/rendering-elements/shapes/requirementBox.ts
  async function requirementBox(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const requirementNode = node2;
    const elementNode = node2;
    const padding2 = 20;
    const gap = 20;
    const isRequirementNode = "verifyMethod" in node2;
    const classes3 = getNodeClasses(node2);
    const { themeVariables } = getConfig2();
    const { borderColorArray, requirementEdgeLabelBackground } = themeVariables;
    const shapeSvg = parent4.insert("g").attr("class", classes3).attr("id", node2.domId ?? node2.id);
    let typeHeight;
    if (isRequirementNode) {
      typeHeight = await addText3(
        shapeSvg,
        `&lt;&lt;${requirementNode.type}&gt;&gt;`,
        0,
        node2.labelStyle
      );
    } else {
      typeHeight = await addText3(shapeSvg, "&lt;&lt;Element&gt;&gt;", 0, node2.labelStyle);
    }
    let accumulativeHeight = typeHeight;
    const nameHeight = await addText3(
      shapeSvg,
      requirementNode.name,
      accumulativeHeight,
      node2.labelStyle + "; font-weight: bold;"
    );
    accumulativeHeight += nameHeight + gap;
    if (isRequirementNode) {
      const idHeight = await addText3(
        shapeSvg,
        `${requirementNode.requirementId ? `ID: ${requirementNode.requirementId}` : ""}`,
        accumulativeHeight,
        node2.labelStyle
      );
      accumulativeHeight += idHeight;
      const textHeight = await addText3(
        shapeSvg,
        `${requirementNode.text ? `Text: ${requirementNode.text}` : ""}`,
        accumulativeHeight,
        node2.labelStyle
      );
      accumulativeHeight += textHeight;
      const riskHeight = await addText3(
        shapeSvg,
        `${requirementNode.risk ? `Risk: ${requirementNode.risk}` : ""}`,
        accumulativeHeight,
        node2.labelStyle
      );
      accumulativeHeight += riskHeight;
      await addText3(
        shapeSvg,
        `${requirementNode.verifyMethod ? `Verification: ${requirementNode.verifyMethod}` : ""}`,
        accumulativeHeight,
        node2.labelStyle
      );
    } else {
      const typeHeight2 = await addText3(
        shapeSvg,
        `${elementNode.type ? `Type: ${elementNode.type}` : ""}`,
        accumulativeHeight,
        node2.labelStyle
      );
      accumulativeHeight += typeHeight2;
      await addText3(
        shapeSvg,
        `${elementNode.docRef ? `Doc Ref: ${elementNode.docRef}` : ""}`,
        accumulativeHeight,
        node2.labelStyle
      );
    }
    const totalWidth = (shapeSvg.node()?.getBBox().width ?? 200) + padding2;
    const totalHeight = (shapeSvg.node()?.getBBox().height ?? 200) + padding2;
    const x5 = -totalWidth / 2;
    const y6 = -totalHeight / 2;
    const rc = at.svg(shapeSvg);
    const options2 = userNodeOverrides(node2, {});
    if (node2.look !== "handDrawn") {
      options2.roughness = 0;
      options2.fillStyle = "solid";
    }
    const roughRect = rc.rectangle(x5, y6, totalWidth, totalHeight, options2);
    const rect3 = shapeSvg.insert(() => roughRect, ":first-child");
    rect3.attr("class", "basic label-container outer-path").attr("style", nodeStyles);
    if (borderColorArray?.length) {
      const colorIndex = node2.colorIndex ?? 0;
      shapeSvg.attr("data-color-id", `color-${colorIndex % borderColorArray.length}`);
    }
    shapeSvg.selectAll(".label").each((_3, i2, nodes5) => {
      const text4 = select_default2(nodes5[i2]);
      const transform8 = text4.attr("transform");
      let translateX2 = 0;
      let translateY2 = 0;
      if (transform8) {
        const regex2 = RegExp(/translate\(([^,]+),([^)]+)\)/);
        const translate2 = regex2.exec(transform8);
        if (translate2) {
          translateX2 = parseFloat(translate2[1]);
          translateY2 = parseFloat(translate2[2]);
        }
      }
      const newTranslateY = translateY2 - totalHeight / 2;
      let newTranslateX = x5 + padding2 / 2;
      if (i2 === 0 || i2 === 1) {
        newTranslateX = translateX2;
      }
      text4.attr("transform", `translate(${newTranslateX}, ${newTranslateY + padding2})`);
    });
    if (accumulativeHeight > typeHeight + nameHeight + gap) {
      const lineY = y6 + typeHeight + nameHeight + gap;
      let roughLine;
      if (node2.look === "neo") {
        const thickness = 1e-3;
        const polygonPoints = [
          [x5, lineY],
          [x5 + totalWidth, lineY],
          [x5 + totalWidth, lineY + thickness],
          [x5, lineY + thickness]
        ];
        roughLine = rc.polygon(polygonPoints, options2);
      } else {
        roughLine = rc.line(x5, lineY, x5 + totalWidth, lineY, options2);
      }
      const dividerLine = shapeSvg.insert(() => roughLine);
      dividerLine.attr("class", "divider");
    }
    updateNodeBounds(node2, rect3);
    node2.intersect = function(point8) {
      return intersect_default.rect(node2, point8);
    };
    if (nodeStyles && node2.look !== "handDrawn" && (requirementEdgeLabelBackground || borderColorArray?.length)) {
      shapeSvg.selectAll("path").attr("style", nodeStyles);
    }
    return shapeSvg;
  }
  async function addText3(parentGroup, inputText, yOffset, style3 = "") {
    if (inputText === "") {
      return 0;
    }
    const textEl = parentGroup.insert("g").attr("class", "label").attr("style", style3);
    const config5 = getConfig2();
    const useHtmlLabels = config5.htmlLabels ?? true;
    const text4 = await createText(
      textEl,
      sanitizeText3(decodeEntities(inputText)),
      {
        width: calculateTextWidth(inputText, config5) + 50,
        // Add room for error when splitting text into multiple lines
        classes: "markdown-node-label",
        useHtmlLabels,
        style: style3
      },
      config5
    );
    let bbox;
    if (!useHtmlLabels) {
      const textChild = text4.children[0];
      for (const child of textChild.children) {
        if (style3) {
          child.setAttribute("style", style3);
        }
      }
      bbox = text4.getBBox();
      bbox.height += 6;
    } else {
      const div = text4.children[0];
      const dv = select_default2(text4);
      bbox = div.getBoundingClientRect();
      dv.attr("width", bbox.width);
      dv.attr("height", bbox.height);
    }
    textEl.attr("transform", `translate(${-bbox.width / 2},${-bbox.height / 2 + yOffset})`);
    return bbox.height;
  }
  var init_requirementBox = __esm({
    "src/rendering-util/rendering-elements/shapes/requirementBox.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_utils2();
      init_diagramAPI();
      init_createText();
      init_src32();
      __name(requirementBox, "requirementBox");
      __name(addText3, "addText");
    }
  });

  // src/rendering-util/rendering-elements/shapes/kanbanItem.ts
  async function kanbanItem(parent4, kanbanNode, { config: config5 }) {
    const { labelStyles, nodeStyles } = styles2String(kanbanNode);
    kanbanNode.labelStyle = labelStyles || "";
    const labelPaddingX = 10;
    const orgWidth = kanbanNode.width;
    kanbanNode.width = (kanbanNode.width ?? 200) - 10;
    const {
      shapeSvg,
      bbox,
      label: labelElTitle
    } = await labelHelper(parent4, kanbanNode, getNodeClasses(kanbanNode));
    const padding2 = kanbanNode.padding || 10;
    let ticketUrl = "";
    let link2;
    if ("ticket" in kanbanNode && kanbanNode.ticket && config5?.kanban?.ticketBaseUrl) {
      ticketUrl = config5?.kanban?.ticketBaseUrl.replace("#TICKET#", kanbanNode.ticket);
      link2 = shapeSvg.insert("svg:a", ":first-child").attr("class", "kanban-ticket-link").attr("xlink:href", ticketUrl).attr("target", "_blank");
    }
    const options2 = {
      useHtmlLabels: kanbanNode.useHtmlLabels,
      labelStyle: kanbanNode.labelStyle || "",
      width: kanbanNode.width,
      img: kanbanNode.img,
      padding: kanbanNode.padding || 8,
      centerLabel: false
    };
    let labelEl, bbox2;
    if (link2) {
      ({ label: labelEl, bbox: bbox2 } = await insertLabel(
        link2,
        "ticket" in kanbanNode && kanbanNode.ticket || "",
        options2
      ));
    } else {
      ({ label: labelEl, bbox: bbox2 } = await insertLabel(
        shapeSvg,
        "ticket" in kanbanNode && kanbanNode.ticket || "",
        options2
      ));
    }
    const { label: labelElAssigned, bbox: bboxAssigned } = await insertLabel(
      shapeSvg,
      "assigned" in kanbanNode && kanbanNode.assigned || "",
      options2
    );
    kanbanNode.width = orgWidth;
    const labelPaddingY = 10;
    const totalWidth = kanbanNode?.width || 0;
    const heightAdj = Math.max(bbox2.height, bboxAssigned.height) / 2;
    const totalHeight = Math.max(bbox.height + labelPaddingY * 2, kanbanNode?.height || 0) + heightAdj;
    const x5 = -totalWidth / 2;
    const y6 = -totalHeight / 2;
    labelElTitle.attr(
      "transform",
      "translate(" + (padding2 - totalWidth / 2) + ", " + (-heightAdj - bbox.height / 2) + ")"
    );
    labelEl.attr(
      "transform",
      "translate(" + (padding2 - totalWidth / 2) + ", " + (-heightAdj + bbox.height / 2) + ")"
    );
    labelElAssigned.attr(
      "transform",
      "translate(" + (padding2 + totalWidth / 2 - bboxAssigned.width - 2 * labelPaddingX) + ", " + (-heightAdj + bbox.height / 2) + ")"
    );
    let rect3;
    const { rx, ry } = kanbanNode;
    const { cssStyles } = kanbanNode;
    if (kanbanNode.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options3 = userNodeOverrides(kanbanNode, {});
      const roughNode = rx || ry ? rc.path(createRoundedRectPathD(x5, y6, totalWidth, totalHeight, rx || 0), options3) : rc.rectangle(x5, y6, totalWidth, totalHeight, options3);
      rect3 = shapeSvg.insert(() => roughNode, ":first-child");
      rect3.attr("class", "basic label-container").attr("style", cssStyles ? cssStyles : null);
    } else {
      rect3 = shapeSvg.insert("rect", ":first-child");
      rect3.attr("class", "basic label-container __APA__").attr("style", nodeStyles).attr("rx", rx ?? 5).attr("ry", ry ?? 5).attr("x", x5).attr("y", y6).attr("width", totalWidth).attr("height", totalHeight);
      const priority3 = "priority" in kanbanNode && kanbanNode.priority;
      if (priority3) {
        const line2 = shapeSvg.append("line");
        const lineX = x5 + 2;
        const y1 = y6 + Math.floor((rx ?? 0) / 2);
        const y22 = y6 + totalHeight - Math.floor((rx ?? 0) / 2);
        line2.attr("x1", lineX).attr("y1", y1).attr("x2", lineX).attr("y2", y22).attr("stroke-width", "4").attr("stroke", colorFromPriority(priority3));
      }
    }
    updateNodeBounds(kanbanNode, rect3);
    kanbanNode.height = totalHeight;
    kanbanNode.intersect = function(point8) {
      return intersect_default.rect(kanbanNode, point8);
    };
    return shapeSvg;
  }
  var colorFromPriority;
  var init_kanbanItem = __esm({
    "src/rendering-util/rendering-elements/shapes/kanbanItem.ts"() {
      "use strict";
      init_util();
      init_intersect();
      init_roundedRectPath();
      init_handDrawnShapeStyles();
      init_rough_esm();
      colorFromPriority = /* @__PURE__ */ __name((priority3) => {
        switch (priority3) {
          case "Very High":
            return "red";
          case "High":
            return "orange";
          case "Medium":
            return null;
          // no stroke
          case "Low":
            return "blue";
          case "Very Low":
            return "lightblue";
        }
      }, "colorFromPriority");
      __name(kanbanItem, "kanbanItem");
    }
  });

  // src/rendering-util/rendering-elements/shapes/bang.ts
  async function bang(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const { shapeSvg, bbox, halfPadding, label } = await labelHelper(
      parent4,
      node2,
      getNodeClasses(node2)
    );
    const w4 = bbox.width + 10 * halfPadding;
    const h3 = bbox.height + 8 * halfPadding;
    const r2 = 0.15 * w4;
    const { cssStyles } = node2;
    const minWidth = bbox.width + 20;
    const minHeight = bbox.height + 20;
    const effectiveWidth = Math.max(w4, minWidth);
    const effectiveHeight = Math.max(h3, minHeight);
    label.attr("transform", `translate(${-bbox.width / 2}, ${-bbox.height / 2})`);
    let bangElem;
    const path4 = `M0 0 
    a${r2},${r2} 1 0,0 ${effectiveWidth * 0.25},${-1 * effectiveHeight * 0.1}
    a${r2},${r2} 1 0,0 ${effectiveWidth * 0.25},${0}
    a${r2},${r2} 1 0,0 ${effectiveWidth * 0.25},${0}
    a${r2},${r2} 1 0,0 ${effectiveWidth * 0.25},${effectiveHeight * 0.1}

    a${r2},${r2} 1 0,0 ${effectiveWidth * 0.15},${effectiveHeight * 0.33}
    a${r2 * 0.8},${r2 * 0.8} 1 0,0 0,${effectiveHeight * 0.34}
    a${r2},${r2} 1 0,0 ${-1 * effectiveWidth * 0.15},${effectiveHeight * 0.33}

    a${r2},${r2} 1 0,0 ${-1 * effectiveWidth * 0.25},${effectiveHeight * 0.15}
    a${r2},${r2} 1 0,0 ${-1 * effectiveWidth * 0.25},0
    a${r2},${r2} 1 0,0 ${-1 * effectiveWidth * 0.25},0
    a${r2},${r2} 1 0,0 ${-1 * effectiveWidth * 0.25},${-1 * effectiveHeight * 0.15}

    a${r2},${r2} 1 0,0 ${-1 * effectiveWidth * 0.1},${-1 * effectiveHeight * 0.33}
    a${r2 * 0.8},${r2 * 0.8} 1 0,0 0,${-1 * effectiveHeight * 0.34}
    a${r2},${r2} 1 0,0 ${effectiveWidth * 0.1},${-1 * effectiveHeight * 0.33}
  H0 V0 Z`;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options2 = userNodeOverrides(node2, {});
      const roughNode = rc.path(path4, options2);
      bangElem = shapeSvg.insert(() => roughNode, ":first-child");
      bangElem.attr("class", "basic label-container").attr("style", handleUndefinedAttr(cssStyles));
    } else {
      bangElem = shapeSvg.insert("path", ":first-child").attr("class", "basic label-container").attr("style", nodeStyles).attr("d", path4);
    }
    bangElem.attr("transform", `translate(${-effectiveWidth / 2}, ${-effectiveHeight / 2})`);
    updateNodeBounds(node2, bangElem);
    node2.calcIntersect = function(bounds4, point8) {
      return intersect_default.rect(bounds4, point8);
    };
    node2.intersect = function(point8) {
      log.info("Bang intersect", node2, point8);
      return intersect_default.rect(node2, point8);
    };
    return shapeSvg;
  }
  var init_bang = __esm({
    "src/rendering-util/rendering-elements/shapes/bang.ts"() {
      "use strict";
      init_logger();
      init_util();
      init_intersect();
      init_handDrawnShapeStyles();
      init_rough_esm();
      init_utils2();
      __name(bang, "bang");
    }
  });

  // src/rendering-util/rendering-elements/shapes/cloud.ts
  async function cloud(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const { shapeSvg, bbox, halfPadding, label } = await labelHelper(
      parent4,
      node2,
      getNodeClasses(node2)
    );
    const w4 = bbox.width + 2 * halfPadding;
    const h3 = bbox.height + 2 * halfPadding;
    const r1 = 0.15 * w4;
    const r2 = 0.25 * w4;
    const r3 = 0.35 * w4;
    const r4 = 0.2 * w4;
    const { cssStyles } = node2;
    let cloudElem;
    const path4 = `M0 0 
    a${r1},${r1} 0 0,1 ${w4 * 0.25},${-1 * w4 * 0.1}
    a${r3},${r3} 1 0,1 ${w4 * 0.4},${-1 * w4 * 0.1}
    a${r2},${r2} 1 0,1 ${w4 * 0.35},${w4 * 0.2}

    a${r1},${r1} 1 0,1 ${w4 * 0.15},${h3 * 0.35}
    a${r4},${r4} 1 0,1 ${-1 * w4 * 0.15},${h3 * 0.65}

    a${r2},${r1} 1 0,1 ${-1 * w4 * 0.25},${w4 * 0.15}
    a${r3},${r3} 1 0,1 ${-1 * w4 * 0.5},0
    a${r1},${r1} 1 0,1 ${-1 * w4 * 0.25},${-1 * w4 * 0.15}

    a${r1},${r1} 1 0,1 ${-1 * w4 * 0.1},${-1 * h3 * 0.35}
    a${r4},${r4} 1 0,1 ${w4 * 0.1},${-1 * h3 * 0.65}
  H0 V0 Z`;
    if (node2.look === "handDrawn") {
      const rc = at.svg(shapeSvg);
      const options2 = userNodeOverrides(node2, {});
      const roughNode = rc.path(path4, options2);
      cloudElem = shapeSvg.insert(() => roughNode, ":first-child");
      cloudElem.attr("class", "basic label-container").attr("style", handleUndefinedAttr(cssStyles));
    } else {
      cloudElem = shapeSvg.insert("path", ":first-child").attr("class", "basic label-container").attr("style", nodeStyles).attr("d", path4);
    }
    label.attr("transform", `translate(${-bbox.width / 2}, ${-bbox.height / 2})`);
    cloudElem.attr("transform", `translate(${-w4 / 2}, ${-h3 / 2})`);
    updateNodeBounds(node2, cloudElem);
    node2.calcIntersect = function(bounds4, point8) {
      return intersect_default.rect(bounds4, point8);
    };
    node2.intersect = function(point8) {
      log.info("Cloud intersect", node2, point8);
      return intersect_default.rect(node2, point8);
    };
    return shapeSvg;
  }
  var init_cloud = __esm({
    "src/rendering-util/rendering-elements/shapes/cloud.ts"() {
      "use strict";
      init_rough_esm();
      init_logger();
      init_utils2();
      init_intersect();
      init_handDrawnShapeStyles();
      init_util();
      __name(cloud, "cloud");
    }
  });

  // src/rendering-util/rendering-elements/shapes/defaultMindmapNode.ts
  async function defaultMindmapNode(parent4, node2) {
    const { labelStyles, nodeStyles } = styles2String(node2);
    node2.labelStyle = labelStyles;
    const { shapeSvg, bbox, halfPadding, label } = await labelHelper(
      parent4,
      node2,
      getNodeClasses(node2)
    );
    const w4 = bbox.width + 8 * halfPadding;
    const h3 = bbox.height + 2 * halfPadding;
    const rd = 5;
    const rectPath = node2.look === "neo" ? `
    M${-w4 / 2} ${h3 / 2 - rd}
    v${-h3 + 2 * rd}
    q0,-${rd} ${rd},-${rd}
    h${w4 - 2 * rd}
    q${rd},0 ${rd},${rd}
    v${h3 - rd}
    H${-w4 / 2}
    Z
  ` : `
    M${-w4 / 2} ${h3 / 2 - rd}
    v${-h3 + 2 * rd}
    q0,-${rd} ${rd},-${rd}
    h${w4 - 2 * rd}
    q${rd},0 ${rd},${rd}
    v${h3 - 2 * rd}
    q0,${rd} ${-rd},${rd}
    h${-(w4 - 2 * rd)}
    q${-rd},0 ${-rd},${-rd}
    Z
  `;
    if (!node2.domId) {
      throw new Error(
        `defaultMindmapNode: node "${node2.id}" is missing a domId \u2014 was render.ts domId prefixing skipped?`
      );
    }
    const bg = shapeSvg.append("path").attr("id", node2.domId).attr("class", "node-bkg node-" + node2.type).attr("style", nodeStyles).attr("d", rectPath);
    shapeSvg.append("line").attr("class", "node-line-").attr("x1", -w4 / 2).attr("y1", h3 / 2).attr("x2", w4 / 2).attr("y2", h3 / 2);
    label.attr("transform", `translate(${-bbox.width / 2}, ${-bbox.height / 2})`);
    shapeSvg.append(() => label.node());
    updateNodeBounds(node2, bg);
    node2.calcIntersect = function(bounds4, point8) {
      return intersect_default.rect(bounds4, point8);
    };
    node2.intersect = function(point8) {
      return intersect_default.rect(node2, point8);
    };
    return shapeSvg;
  }
  var init_defaultMindmapNode = __esm({
    "src/rendering-util/rendering-elements/shapes/defaultMindmapNode.ts"() {
      "use strict";
      init_intersect();
      init_handDrawnShapeStyles();
      init_util();
      __name(defaultMindmapNode, "defaultMindmapNode");
    }
  });

  // src/rendering-util/rendering-elements/shapes/mindmapCircle.ts
  async function mindmapCircle(parent4, node2) {
    const options2 = {
      padding: node2.padding ?? 0
    };
    return circle(parent4, node2, options2);
  }
  var init_mindmapCircle = __esm({
    "src/rendering-util/rendering-elements/shapes/mindmapCircle.ts"() {
      "use strict";
      init_circle();
      __name(mindmapCircle, "mindmapCircle");
    }
  });

  // src/rendering-util/rendering-elements/shapes.ts
  function isValidShape(shape) {
    return shape in shapes;
  }
  var shapesDefs, generateShapeMap, shapes;
  var init_shapes = __esm({
    "src/rendering-util/rendering-elements/shapes.ts"() {
      "use strict";
      init_anchor();
      init_bowTieRect();
      init_card();
      init_choice();
      init_circle();
      init_crossedCircle();
      init_curlyBraceLeft();
      init_curlyBraceRight();
      init_curlyBraces();
      init_curvedTrapezoid();
      init_cylinder();
      init_dividedRect();
      init_doubleCircle();
      init_filledCircle();
      init_flippedTriangle();
      init_forkJoin();
      init_halfRoundedRectangle();
      init_hexagon();
      init_hourglass();
      init_icon();
      init_iconCircle();
      init_iconRounded();
      init_iconSquare();
      init_imageSquare();
      init_invertedTrapezoid();
      init_labelRect();
      init_leanLeft();
      init_leanRight();
      init_lightningBolt();
      init_linedCylinder();
      init_linedWaveEdgedRect();
      init_multiRect();
      init_multiWaveEdgedRectangle();
      init_note();
      init_question();
      init_rectLeftInvArrow();
      init_rectWithTitle();
      init_roundedRect();
      init_shadedProcess();
      init_slopedRect();
      init_squareRect();
      init_stadium();
      init_state();
      init_stateEnd();
      init_stateStart();
      init_subroutine();
      init_taggedRect();
      init_taggedWaveEdgedRectangle();
      init_text3();
      init_tiltedCylinder();
      init_trapezoid();
      init_trapezoidalPentagon();
      init_triangle();
      init_waveEdgedRectangle();
      init_waveRectangle();
      init_windowPane();
      init_erBox();
      init_classBox();
      init_requirementBox();
      init_kanbanItem();
      init_bang();
      init_cloud();
      init_defaultMindmapNode();
      init_mindmapCircle();
      shapesDefs = [
        {
          semanticName: "Process",
          name: "Rectangle",
          shortName: "rect",
          description: "Standard process shape",
          aliases: ["proc", "process", "rectangle"],
          internalAliases: ["squareRect"],
          handler: squareRect
        },
        {
          semanticName: "Event",
          name: "Rounded Rectangle",
          shortName: "rounded",
          description: "Represents an event",
          aliases: ["event"],
          internalAliases: ["roundedRect"],
          handler: roundedRect
        },
        {
          semanticName: "Terminal Point",
          name: "Stadium",
          shortName: "stadium",
          description: "Terminal point",
          aliases: ["terminal", "pill"],
          handler: stadium
        },
        {
          semanticName: "Subprocess",
          name: "Framed Rectangle",
          shortName: "fr-rect",
          description: "Subprocess",
          aliases: ["subprocess", "subproc", "framed-rectangle", "subroutine"],
          handler: subroutine
        },
        {
          semanticName: "Database",
          name: "Cylinder",
          shortName: "cyl",
          description: "Database storage",
          aliases: ["db", "database", "cylinder"],
          handler: cylinder
        },
        {
          semanticName: "Start",
          name: "Circle",
          shortName: "circle",
          description: "Starting point",
          aliases: ["circ"],
          handler: circle
        },
        {
          semanticName: "Bang",
          name: "Bang",
          shortName: "bang",
          description: "Bang",
          aliases: ["bang"],
          handler: bang
        },
        {
          semanticName: "Cloud",
          name: "Cloud",
          shortName: "cloud",
          description: "cloud",
          aliases: ["cloud"],
          handler: cloud
        },
        {
          semanticName: "Decision",
          name: "Diamond",
          shortName: "diam",
          description: "Decision-making step",
          aliases: ["decision", "diamond", "question"],
          handler: question
        },
        {
          semanticName: "Prepare Conditional",
          name: "Hexagon",
          shortName: "hex",
          description: "Preparation or condition step",
          aliases: ["hexagon", "prepare"],
          handler: hexagon
        },
        {
          semanticName: "Data Input/Output",
          name: "Lean Right",
          shortName: "lean-r",
          description: "Represents input or output",
          aliases: ["lean-right", "in-out"],
          internalAliases: ["lean_right"],
          handler: lean_right
        },
        {
          semanticName: "Data Input/Output",
          name: "Lean Left",
          shortName: "lean-l",
          description: "Represents output or input",
          aliases: ["lean-left", "out-in"],
          internalAliases: ["lean_left"],
          handler: lean_left
        },
        {
          semanticName: "Priority Action",
          name: "Trapezoid Base Bottom",
          shortName: "trap-b",
          description: "Priority action",
          aliases: ["priority", "trapezoid-bottom", "trapezoid"],
          handler: trapezoid
        },
        {
          semanticName: "Manual Operation",
          name: "Trapezoid Base Top",
          shortName: "trap-t",
          description: "Represents a manual task",
          aliases: ["manual", "trapezoid-top", "inv-trapezoid"],
          internalAliases: ["inv_trapezoid"],
          handler: inv_trapezoid
        },
        {
          semanticName: "Stop",
          name: "Double Circle",
          shortName: "dbl-circ",
          description: "Represents a stop point",
          aliases: ["double-circle"],
          internalAliases: ["doublecircle"],
          handler: doublecircle
        },
        {
          semanticName: "Text Block",
          name: "Text Block",
          shortName: "text",
          description: "Text block",
          handler: text3
        },
        {
          semanticName: "Card",
          name: "Notched Rectangle",
          shortName: "notch-rect",
          description: "Represents a card",
          aliases: ["card", "notched-rectangle"],
          handler: card
        },
        {
          semanticName: "Lined/Shaded Process",
          name: "Lined Rectangle",
          shortName: "lin-rect",
          description: "Lined process shape",
          aliases: ["lined-rectangle", "lined-process", "lin-proc", "shaded-process"],
          handler: shadedProcess
        },
        {
          semanticName: "Start",
          name: "Small Circle",
          shortName: "sm-circ",
          description: "Small starting point",
          aliases: ["start", "small-circle"],
          internalAliases: ["stateStart"],
          handler: stateStart
        },
        {
          semanticName: "Stop",
          name: "Framed Circle",
          shortName: "fr-circ",
          description: "Stop point",
          aliases: ["stop", "framed-circle"],
          internalAliases: ["stateEnd"],
          handler: stateEnd
        },
        {
          semanticName: "Fork/Join",
          name: "Filled Rectangle",
          shortName: "fork",
          description: "Fork or join in process flow",
          aliases: ["join"],
          internalAliases: ["forkJoin"],
          handler: forkJoin
        },
        {
          semanticName: "Collate",
          name: "Hourglass",
          shortName: "hourglass",
          description: "Represents a collate operation",
          aliases: ["hourglass", "collate"],
          handler: hourglass
        },
        {
          semanticName: "Comment",
          name: "Curly Brace",
          shortName: "brace",
          description: "Adds a comment",
          aliases: ["comment", "brace-l"],
          handler: curlyBraceLeft
        },
        {
          semanticName: "Comment Right",
          name: "Curly Brace",
          shortName: "brace-r",
          description: "Adds a comment",
          handler: curlyBraceRight
        },
        {
          semanticName: "Comment with braces on both sides",
          name: "Curly Braces",
          shortName: "braces",
          description: "Adds a comment",
          handler: curlyBraces
        },
        {
          semanticName: "Com Link",
          name: "Lightning Bolt",
          shortName: "bolt",
          description: "Communication link",
          aliases: ["com-link", "lightning-bolt"],
          handler: lightningBolt
        },
        {
          semanticName: "Document",
          name: "Document",
          shortName: "doc",
          description: "Represents a document",
          aliases: ["doc", "document"],
          handler: waveEdgedRectangle
        },
        {
          semanticName: "Delay",
          name: "Half-Rounded Rectangle",
          shortName: "delay",
          description: "Represents a delay",
          aliases: ["half-rounded-rectangle"],
          handler: halfRoundedRectangle
        },
        {
          semanticName: "Direct Access Storage",
          name: "Horizontal Cylinder",
          shortName: "h-cyl",
          description: "Direct access storage",
          aliases: ["das", "horizontal-cylinder"],
          handler: tiltedCylinder
        },
        {
          semanticName: "Disk Storage",
          name: "Lined Cylinder",
          shortName: "lin-cyl",
          description: "Disk storage",
          aliases: ["disk", "lined-cylinder"],
          handler: linedCylinder
        },
        {
          semanticName: "Display",
          name: "Curved Trapezoid",
          shortName: "curv-trap",
          description: "Represents a display",
          aliases: ["curved-trapezoid", "display"],
          handler: curvedTrapezoid
        },
        {
          semanticName: "Divided Process",
          name: "Divided Rectangle",
          shortName: "div-rect",
          description: "Divided process shape",
          aliases: ["div-proc", "divided-rectangle", "divided-process"],
          handler: dividedRectangle
        },
        {
          semanticName: "Extract",
          name: "Triangle",
          shortName: "tri",
          description: "Extraction process",
          aliases: ["extract", "triangle"],
          handler: triangle
        },
        {
          semanticName: "Internal Storage",
          name: "Window Pane",
          shortName: "win-pane",
          description: "Internal storage",
          aliases: ["internal-storage", "window-pane"],
          handler: windowPane
        },
        {
          semanticName: "Junction",
          name: "Filled Circle",
          shortName: "f-circ",
          description: "Junction point",
          aliases: ["junction", "filled-circle"],
          handler: filledCircle
        },
        {
          semanticName: "Loop Limit",
          name: "Trapezoidal Pentagon",
          shortName: "notch-pent",
          description: "Loop limit step",
          aliases: ["loop-limit", "notched-pentagon"],
          handler: trapezoidalPentagon
        },
        {
          semanticName: "Manual File",
          name: "Flipped Triangle",
          shortName: "flip-tri",
          description: "Manual file operation",
          aliases: ["manual-file", "flipped-triangle"],
          handler: flippedTriangle
        },
        {
          semanticName: "Manual Input",
          name: "Sloped Rectangle",
          shortName: "sl-rect",
          description: "Manual input step",
          aliases: ["manual-input", "sloped-rectangle"],
          handler: slopedRect
        },
        {
          semanticName: "Multi-Document",
          name: "Stacked Document",
          shortName: "docs",
          description: "Multiple documents",
          aliases: ["documents", "st-doc", "stacked-document"],
          handler: multiWaveEdgedRectangle
        },
        {
          semanticName: "Multi-Process",
          name: "Stacked Rectangle",
          shortName: "st-rect",
          description: "Multiple processes",
          aliases: ["procs", "processes", "stacked-rectangle"],
          handler: multiRect
        },
        {
          semanticName: "Stored Data",
          name: "Bow Tie Rectangle",
          shortName: "bow-rect",
          description: "Stored data",
          aliases: ["stored-data", "bow-tie-rectangle"],
          handler: bowTieRect
        },
        {
          semanticName: "Summary",
          name: "Crossed Circle",
          shortName: "cross-circ",
          description: "Summary",
          aliases: ["summary", "crossed-circle"],
          handler: crossedCircle
        },
        {
          semanticName: "Tagged Document",
          name: "Tagged Document",
          shortName: "tag-doc",
          description: "Tagged document",
          aliases: ["tag-doc", "tagged-document"],
          handler: taggedWaveEdgedRectangle
        },
        {
          semanticName: "Tagged Process",
          name: "Tagged Rectangle",
          shortName: "tag-rect",
          description: "Tagged process",
          aliases: ["tagged-rectangle", "tag-proc", "tagged-process"],
          handler: taggedRect
        },
        {
          semanticName: "Paper Tape",
          name: "Flag",
          shortName: "flag",
          description: "Paper tape",
          aliases: ["paper-tape"],
          handler: waveRectangle
        },
        {
          semanticName: "Odd",
          name: "Odd",
          shortName: "odd",
          description: "Odd shape",
          internalAliases: ["rect_left_inv_arrow"],
          handler: rect_left_inv_arrow
        },
        {
          semanticName: "Lined Document",
          name: "Lined Document",
          shortName: "lin-doc",
          description: "Lined document",
          aliases: ["lined-document"],
          handler: linedWaveEdgedRect
        }
      ];
      generateShapeMap = /* @__PURE__ */ __name(() => {
        const undocumentedShapes = {
          // States
          state,
          choice,
          note,
          // Rectangles
          rectWithTitle,
          labelRect,
          // Icons
          iconSquare,
          iconCircle,
          icon,
          iconRounded,
          imageSquare,
          anchor,
          // Kanban diagram
          kanbanItem,
          //Mindmap diagram
          mindmapCircle,
          defaultMindmapNode,
          // class diagram
          classBox,
          // er diagram
          erBox,
          // Requirement diagram
          requirementBox
        };
        const entries2 = [
          ...Object.entries(undocumentedShapes),
          ...shapesDefs.flatMap((shape) => {
            const aliases = [
              shape.shortName,
              ..."aliases" in shape ? shape.aliases : [],
              ..."internalAliases" in shape ? shape.internalAliases : []
            ];
            return aliases.map((alias) => [alias, shape.handler]);
          })
        ];
        return Object.fromEntries(entries2);
      }, "generateShapeMap");
      shapes = generateShapeMap();
      __name(isValidShape, "isValidShape");
    }
  });

  // src/diagrams/flowchart/flowDb.ts
  var MERMAID_DOM_ID_PREFIX, FlowDB;
  var init_flowDb = __esm({
    "src/diagrams/flowchart/flowDb.ts"() {
      "use strict";
      init_src32();
      init_js_yaml();
      init_diagramAPI();
      init_logger();
      init_shapes();
      init_utils2();
      init_common();
      init_commonDb();
      init_svgDrawCommon();
      init_purify_es();
      MERMAID_DOM_ID_PREFIX = "flowchart-";
      FlowDB = class {
        // cspell:ignore funs
        constructor() {
          this.vertexCounter = 0;
          this.config = getConfig2();
          this.diagramId = "";
          this.vertices = /* @__PURE__ */ new Map();
          this.edges = [];
          this.classes = /* @__PURE__ */ new Map();
          this.subGraphs = [];
          this.subGraphLookup = /* @__PURE__ */ new Map();
          this.tooltips = /* @__PURE__ */ new Map();
          this.subCount = 0;
          this.firstGraphFlag = true;
          // As in graph
          this.secCount = -1;
          this.posCrossRef = [];
          // Functions to be run after graph rendering
          this.funs = [];
          this.setAccTitle = setAccTitle;
          this.setAccDescription = setAccDescription;
          this.setDiagramTitle = setDiagramTitle;
          this.getAccTitle = getAccTitle;
          this.getAccDescription = getAccDescription;
          this.getDiagramTitle = getDiagramTitle;
          this.funs.push(this.setupToolTips.bind(this));
          this.addVertex = this.addVertex.bind(this);
          this.firstGraph = this.firstGraph.bind(this);
          this.setDirection = this.setDirection.bind(this);
          this.addSubGraph = this.addSubGraph.bind(this);
          this.addLink = this.addLink.bind(this);
          this.setLink = this.setLink.bind(this);
          this.updateLink = this.updateLink.bind(this);
          this.addClass = this.addClass.bind(this);
          this.setClass = this.setClass.bind(this);
          this.destructLink = this.destructLink.bind(this);
          this.setClickEvent = this.setClickEvent.bind(this);
          this.setTooltip = this.setTooltip.bind(this);
          this.updateLinkInterpolate = this.updateLinkInterpolate.bind(this);
          this.setClickFun = this.setClickFun.bind(this);
          this.bindFunctions = this.bindFunctions.bind(this);
          this.lex = {
            firstGraph: this.firstGraph.bind(this)
          };
          this.clear();
          this.setGen("gen-2");
        }
        static {
          __name(this, "FlowDB");
        }
        sanitizeText(txt) {
          return common_default.sanitizeText(txt, this.config);
        }
        sanitizeNodeLabelType(labelType) {
          switch (labelType) {
            case "markdown":
            case "string":
            case "text":
              return labelType;
            default:
              return "markdown";
          }
        }
        /**
         * Sets the diagram's SVG element ID, used to prefix domIds for uniqueness
         * across multiple diagrams on the same page.
         */
        setDiagramId(svgElementId) {
          this.diagramId = svgElementId;
        }
        /**
         * Function to lookup domId from id in the graph definition.
         * When diagramId is set, returns the prefixed version for DOM uniqueness.
         *
         * @param id - id of the node
         */
        lookUpDomId(id34) {
          for (const vertex of this.vertices.values()) {
            if (vertex.id === id34) {
              return this.diagramId ? `${this.diagramId}-${vertex.domId}` : vertex.domId;
            }
          }
          return this.diagramId ? `${this.diagramId}-${id34}` : id34;
        }
        /**
         * Function called by parser when a node definition has been found
         */
        addVertex(id34, textObj, type3, style3, classes3, dir2, props = {}, metadata) {
          if (!id34 || id34.trim().length === 0) {
            return;
          }
          let doc;
          if (metadata !== void 0) {
            let yamlData;
            if (!metadata.includes("\n")) {
              yamlData = "{\n" + metadata + "\n}";
            } else {
              yamlData = metadata + "\n";
            }
            doc = load(yamlData, { schema: JSON_SCHEMA });
          }
          const edge = this.edges.find((e3) => e3.id === id34);
          if (edge) {
            const edgeDoc = doc;
            if (edgeDoc?.animate !== void 0) {
              edge.animate = edgeDoc.animate;
            }
            if (edgeDoc?.animation !== void 0) {
              edge.animation = edgeDoc.animation;
            }
            if (edgeDoc?.curve !== void 0) {
              edge.interpolate = edgeDoc.curve;
            }
            return;
          }
          let txt;
          let vertex = this.vertices.get(id34);
          if (vertex === void 0) {
            if (textObj === void 0 && type3 === void 0 && style3 !== void 0 && style3 !== null) {
              log.warn(
                `Style applied to unknown node "${id34}". This may indicate a typo. The node will be created automatically.`
              );
            }
            vertex = {
              id: id34,
              labelType: "text",
              domId: MERMAID_DOM_ID_PREFIX + id34 + "-" + this.vertexCounter,
              styles: [],
              classes: []
            };
            this.vertices.set(id34, vertex);
          }
          this.vertexCounter++;
          if (textObj !== void 0) {
            this.config = getConfig2();
            txt = this.sanitizeText(textObj.text.trim());
            vertex.labelType = textObj.type;
            if (txt.startsWith('"') && txt.endsWith('"')) {
              txt = txt.substring(1, txt.length - 1);
            }
            vertex.text = txt;
          } else {
            if (vertex.text === void 0) {
              vertex.text = id34;
            }
          }
          if (type3 !== void 0) {
            vertex.type = type3;
          }
          if (style3 !== void 0 && style3 !== null) {
            style3.forEach((s2) => {
              vertex.styles.push(s2);
            });
          }
          if (classes3 !== void 0 && classes3 !== null) {
            classes3.forEach((s2) => {
              vertex.classes.push(s2);
            });
          }
          if (dir2 !== void 0) {
            vertex.dir = dir2;
          }
          if (vertex.props === void 0) {
            vertex.props = props;
          } else if (props !== void 0) {
            Object.assign(vertex.props, props);
          }
          if (doc !== void 0) {
            if (doc.shape) {
              if (doc.shape !== doc.shape.toLowerCase() || doc.shape.includes("_")) {
                throw new Error(`No such shape: ${doc.shape}. Shape names should be lowercase.`);
              } else if (!isValidShape(doc.shape)) {
                throw new Error(`No such shape: ${doc.shape}.`);
              }
              vertex.type = doc?.shape;
            }
            if (doc?.label) {
              vertex.text = doc?.label;
              vertex.labelType = this.sanitizeNodeLabelType(doc?.labelType);
            }
            if (doc?.icon) {
              vertex.icon = doc?.icon;
              if (!doc.label?.trim() && vertex.text === id34) {
                vertex.text = "";
              }
            }
            if (doc?.form) {
              vertex.form = doc?.form;
            }
            if (doc?.pos) {
              vertex.pos = doc?.pos;
            }
            if (doc?.img) {
              vertex.img = doc?.img;
              if (!doc.label?.trim() && vertex.text === id34) {
                vertex.text = "";
              }
            }
            if (doc?.constraint) {
              vertex.constraint = doc.constraint;
            }
            if (doc.w) {
              vertex.assetWidth = Number(doc.w);
            }
            if (doc.h) {
              vertex.assetHeight = Number(doc.h);
            }
          }
        }
        /**
         * Function called by parser when a link/edge definition has been found
         *
         */
        addSingleLink(_start, _end, type3, id34) {
          const start3 = _start;
          const end2 = _end;
          const edge = {
            start: start3,
            end: end2,
            type: void 0,
            text: "",
            labelType: "text",
            classes: [],
            isUserDefinedId: false,
            interpolate: this.edges.defaultInterpolate
          };
          log.info("abc78 Got edge...", edge);
          const linkTextObj = type3.text;
          if (linkTextObj !== void 0) {
            edge.text = this.sanitizeText(linkTextObj.text.trim());
            if (edge.text.startsWith('"') && edge.text.endsWith('"')) {
              edge.text = edge.text.substring(1, edge.text.length - 1);
            }
            edge.labelType = this.sanitizeNodeLabelType(linkTextObj.type);
          }
          if (type3 !== void 0) {
            edge.type = type3.type;
            edge.stroke = type3.stroke;
            edge.length = type3.length > 10 ? 10 : type3.length;
          }
          if (id34 && !this.edges.some((e3) => e3.id === id34)) {
            edge.id = id34;
            edge.isUserDefinedId = true;
          } else {
            const existingLinks = this.edges.filter((e3) => e3.start === edge.start && e3.end === edge.end);
            if (existingLinks.length === 0) {
              edge.id = getEdgeId(edge.start, edge.end, { counter: 0, prefix: "L" });
            } else {
              edge.id = getEdgeId(edge.start, edge.end, {
                counter: existingLinks.length + 1,
                prefix: "L"
              });
            }
          }
          if (this.edges.length < (this.config.maxEdges ?? 500)) {
            log.info("Pushing edge...");
            this.edges.push(edge);
          } else {
            throw new Error(
              `Edge limit exceeded. ${this.edges.length} edges found, but the limit is ${this.config.maxEdges}.

Initialize mermaid with maxEdges set to a higher number to allow more edges.
You cannot set this config via configuration inside the diagram as it is a secure config.
You have to call mermaid.initialize.`
            );
          }
        }
        isLinkData(value2) {
          return value2 !== null && typeof value2 === "object" && "id" in value2 && typeof value2.id === "string";
        }
        addLink(_start, _end, linkData) {
          const id34 = this.isLinkData(linkData) ? linkData.id.replace("@", "") : void 0;
          log.info("addLink", _start, _end, id34);
          for (const start3 of _start) {
            for (const end2 of _end) {
              const isLastStart = start3 === _start[_start.length - 1];
              const isFirstEnd = end2 === _end[0];
              if (isLastStart && isFirstEnd) {
                this.addSingleLink(start3, end2, linkData, id34);
              } else {
                this.addSingleLink(start3, end2, linkData, void 0);
              }
            }
          }
        }
        /**
         * Updates a link's line interpolation algorithm
         */
        updateLinkInterpolate(positions2, interpolate) {
          positions2.forEach((pos) => {
            if (pos === "default") {
              this.edges.defaultInterpolate = interpolate;
            } else {
              this.edges[pos].interpolate = interpolate;
            }
          });
        }
        /**
         * Updates a link with a style
         *
         */
        updateLink(positions2, style3) {
          positions2.forEach((pos) => {
            if (typeof pos === "number" && pos >= this.edges.length) {
              throw new Error(
                `The index ${pos} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length - 1}. (Help: Ensure that the index is within the range of existing edges.)`
              );
            }
            if (pos === "default") {
              this.edges.defaultStyle = style3;
            } else {
              this.edges[pos].style = style3;
              if ((this.edges[pos]?.style?.length ?? 0) > 0 && !this.edges[pos]?.style?.some((s2) => s2?.startsWith("fill"))) {
                this.edges[pos]?.style?.push("fill:none");
              }
            }
          });
        }
        addClass(ids, _style) {
          const style3 = _style.join().replace(/\\,/g, "\xA7\xA7\xA7").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
          ids.split(",").forEach((id34) => {
            let classNode = this.classes.get(id34);
            if (classNode === void 0) {
              classNode = { id: id34, styles: [], textStyles: [] };
              this.classes.set(id34, classNode);
            }
            if (style3 !== void 0 && style3 !== null) {
              style3.forEach((s2) => {
                if (/color/.exec(s2)) {
                  const newStyle = s2.replace("fill", "bgFill");
                  classNode.textStyles.push(newStyle);
                }
                classNode.styles.push(s2);
              });
            }
          });
        }
        /**
         * Called by parser when a graph definition is found, stores the direction of the chart.
         *
         */
        setDirection(dir2) {
          this.direction = dir2.trim();
          if (/.*</.exec(this.direction)) {
            this.direction = "RL";
          }
          if (/.*\^/.exec(this.direction)) {
            this.direction = "BT";
          }
          if (/.*>/.exec(this.direction)) {
            this.direction = "LR";
          }
          if (/.*v/.exec(this.direction)) {
            this.direction = "TB";
          }
          if (this.direction === "TD") {
            this.direction = "TB";
          }
        }
        /**
         * Called by parser when a special node is found, e.g. a clickable element.
         *
         * @param ids - Comma separated list of ids
         * @param className - Class to add
         */
        setClass(ids, className) {
          for (const id34 of ids.split(",")) {
            const vertex = this.vertices.get(id34);
            if (vertex) {
              vertex.classes.push(className);
            }
            const edge = this.edges.find((e3) => e3.id === id34);
            if (edge) {
              edge.classes.push(className);
            }
            const subGraph = this.subGraphLookup.get(id34);
            if (subGraph) {
              subGraph.classes.push(className);
            }
          }
        }
        setTooltip(ids, tooltip) {
          if (tooltip === void 0) {
            return;
          }
          tooltip = this.sanitizeText(tooltip);
          for (const id34 of ids.split(",")) {
            this.tooltips.set(this.version === "gen-1" ? this.lookUpDomId(id34) : id34, tooltip);
          }
        }
        setClickFun(id34, functionName, functionArgs) {
          if (getConfig2().securityLevel !== "loose") {
            return;
          }
          if (functionName === void 0) {
            return;
          }
          let argList = [];
          if (typeof functionArgs === "string") {
            argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
            for (let i2 = 0; i2 < argList.length; i2++) {
              let item = argList[i2].trim();
              if (item.startsWith('"') && item.endsWith('"')) {
                item = item.substr(1, item.length - 2);
              }
              argList[i2] = item;
            }
          }
          if (argList.length === 0) {
            argList.push(id34);
          }
          const vertex = this.vertices.get(id34);
          if (vertex) {
            vertex.haveCallback = true;
            this.funs.push(() => {
              const domId = this.lookUpDomId(id34);
              const elem = document.querySelector(`[id="${domId}"]`);
              if (elem !== null) {
                elem.addEventListener(
                  "click",
                  () => {
                    utils_default2.runFunc(functionName, ...argList);
                  },
                  false
                );
              }
            });
          }
        }
        /**
         * Called by parser when a link is found. Adds the URL to the vertex data.
         *
         * @param ids - Comma separated list of ids
         * @param linkStr - URL to create a link for
         * @param target - Target attribute for the link
         */
        setLink(ids, linkStr, target) {
          ids.split(",").forEach((id34) => {
            const vertex = this.vertices.get(id34);
            if (vertex !== void 0) {
              vertex.link = utils_default2.formatUrl(linkStr, this.config);
              vertex.linkTarget = target;
            }
          });
          this.setClass(ids, "clickable");
        }
        getTooltip(id34) {
          return this.tooltips.get(id34);
        }
        /**
         * Called by parser when a click definition is found. Registers an event handler.
         *
         * @param ids - Comma separated list of ids
         * @param functionName - Function to be called on click
         * @param functionArgs - Arguments to be passed to the function
         */
        setClickEvent(ids, functionName, functionArgs) {
          ids.split(",").forEach((id34) => {
            this.setClickFun(id34, functionName, functionArgs);
          });
          this.setClass(ids, "clickable");
        }
        bindFunctions(element3) {
          this.funs.forEach((fun) => {
            fun(element3);
          });
        }
        getDirection() {
          return this.direction?.trim();
        }
        /**
         * Retrieval function for fetching the found nodes after parsing has completed.
         *
         */
        getVertices() {
          return this.vertices;
        }
        /**
         * Retrieval function for fetching the found links after parsing has completed.
         *
         */
        getEdges() {
          return this.edges;
        }
        /**
         * Retrieval function for fetching the found class definitions after parsing has completed.
         *
         */
        getClasses() {
          return this.classes;
        }
        setupToolTips(element3) {
          const tooltipElem = createTooltip();
          const svg2 = select_default2(element3).select("svg");
          const nodes5 = svg2.selectAll("g.node");
          nodes5.on("mouseover", (e3) => {
            const el = select_default2(e3.currentTarget);
            const title2 = el.attr("title");
            if (title2 === null) {
              return;
            }
            const rect3 = e3.currentTarget?.getBoundingClientRect();
            tooltipElem.transition().duration(200).style("opacity", ".9");
            tooltipElem.text(el.attr("title")).style("left", window.scrollX + rect3.left + (rect3.right - rect3.left) / 2 + "px").style("top", window.scrollY + rect3.bottom + "px");
            tooltipElem.html(purify.sanitize(title2));
            el.classed("hover", true);
          }).on("mouseout", (e3) => {
            tooltipElem.transition().duration(500).style("opacity", 0);
            const el = select_default2(e3.currentTarget);
            el.classed("hover", false);
          });
        }
        /**
         * Clears the internal graph db so that a new graph can be parsed.
         *
         */
        clear(ver = "gen-2") {
          this.vertices = /* @__PURE__ */ new Map();
          this.classes = /* @__PURE__ */ new Map();
          this.edges = [];
          this.funs = [this.setupToolTips.bind(this)];
          this.diagramId = "";
          this.subGraphs = [];
          this.subGraphLookup = /* @__PURE__ */ new Map();
          this.subCount = 0;
          this.tooltips = /* @__PURE__ */ new Map();
          this.firstGraphFlag = true;
          this.version = ver;
          this.config = getConfig2();
          clear();
        }
        setGen(ver) {
          this.version = ver || "gen-2";
        }
        defaultStyle() {
          return "fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;";
        }
        addSubGraph(_id, list, _title) {
          let id34 = _id.text.trim();
          let title2 = _title.text;
          if (_id === _title && /\s/.exec(_title.text)) {
            id34 = void 0;
          }
          const uniq2 = /* @__PURE__ */ __name((a2) => {
            const prims = { boolean: {}, number: {}, string: {} };
            const objs = [];
            let dir3;
            const nodeList2 = a2.filter(function(item) {
              const type3 = typeof item;
              if (item.stmt && item.stmt === "dir") {
                dir3 = item.value;
                return false;
              }
              if (item.trim() === "") {
                return false;
              }
              if (type3 in prims) {
                return prims[type3].hasOwnProperty(item) ? false : prims[type3][item] = true;
              } else {
                return objs.includes(item) ? false : objs.push(item);
              }
            });
            return { nodeList: nodeList2, dir: dir3 };
          }, "uniq");
          const result = uniq2(list.flat());
          const nodeList = result.nodeList;
          let dir2 = result.dir;
          const flowchartConfig = getConfig2().flowchart ?? {};
          dir2 = dir2 ?? (flowchartConfig.inheritDir ? this.getDirection() ?? getConfig2().direction ?? void 0 : void 0);
          if (this.version === "gen-1") {
            for (let i2 = 0; i2 < nodeList.length; i2++) {
              nodeList[i2] = this.lookUpDomId(nodeList[i2]);
            }
          }
          id34 = id34 ?? "subGraph" + this.subCount;
          title2 = title2 || "";
          title2 = this.sanitizeText(title2);
          this.subCount = this.subCount + 1;
          const subGraph = {
            id: id34,
            nodes: nodeList,
            title: title2.trim(),
            classes: [],
            dir: dir2,
            labelType: this.sanitizeNodeLabelType(_title?.type)
          };
          log.info("Adding", subGraph.id, subGraph.nodes, subGraph.dir);
          subGraph.nodes = this.makeUniq(subGraph, this.subGraphs).nodes;
          this.subGraphs.push(subGraph);
          this.subGraphLookup.set(id34, subGraph);
          return id34;
        }
        getPosForId(id34) {
          for (const [i2, subGraph] of this.subGraphs.entries()) {
            if (subGraph.id === id34) {
              return i2;
            }
          }
          return -1;
        }
        indexNodes2(id34, pos) {
          const nodes5 = this.subGraphs[pos].nodes;
          this.secCount = this.secCount + 1;
          if (this.secCount > 2e3) {
            return {
              result: false,
              count: 0
            };
          }
          this.posCrossRef[this.secCount] = pos;
          if (this.subGraphs[pos].id === id34) {
            return {
              result: true,
              count: 0
            };
          }
          let count2 = 0;
          let posCount = 1;
          while (count2 < nodes5.length) {
            const childPos = this.getPosForId(nodes5[count2]);
            if (childPos >= 0) {
              const res = this.indexNodes2(id34, childPos);
              if (res.result) {
                return {
                  result: true,
                  count: posCount + res.count
                };
              } else {
                posCount = posCount + res.count;
              }
            }
            count2 = count2 + 1;
          }
          return {
            result: false,
            count: posCount
          };
        }
        getDepthFirstPos(pos) {
          return this.posCrossRef[pos];
        }
        indexNodes() {
          this.secCount = -1;
          if (this.subGraphs.length > 0) {
            this.indexNodes2("none", this.subGraphs.length - 1);
          }
        }
        getSubGraphs() {
          return this.subGraphs;
        }
        firstGraph() {
          if (this.firstGraphFlag) {
            this.firstGraphFlag = false;
            return true;
          }
          return false;
        }
        destructStartLink(_str) {
          let str2 = _str.trim();
          let type3 = "arrow_open";
          switch (str2[0]) {
            case "<":
              type3 = "arrow_point";
              str2 = str2.slice(1);
              break;
            case "x":
              type3 = "arrow_cross";
              str2 = str2.slice(1);
              break;
            case "o":
              type3 = "arrow_circle";
              str2 = str2.slice(1);
              break;
          }
          let stroke = "normal";
          if (str2.includes("=")) {
            stroke = "thick";
          }
          if (str2.includes(".")) {
            stroke = "dotted";
          }
          return { type: type3, stroke };
        }
        countChar(char2, str2) {
          const length2 = str2.length;
          let count2 = 0;
          for (let i2 = 0; i2 < length2; ++i2) {
            if (str2[i2] === char2) {
              ++count2;
            }
          }
          return count2;
        }
        destructEndLink(_str) {
          const str2 = _str.trim();
          let line2 = str2.slice(0, -1);
          let type3 = "arrow_open";
          switch (str2.slice(-1)) {
            case "x":
              type3 = "arrow_cross";
              if (str2.startsWith("x")) {
                type3 = "double_" + type3;
                line2 = line2.slice(1);
              }
              break;
            case ">":
              type3 = "arrow_point";
              if (str2.startsWith("<")) {
                type3 = "double_" + type3;
                line2 = line2.slice(1);
              }
              break;
            case "o":
              type3 = "arrow_circle";
              if (str2.startsWith("o")) {
                type3 = "double_" + type3;
                line2 = line2.slice(1);
              }
              break;
          }
          let stroke = "normal";
          let length2 = line2.length - 1;
          if (line2.startsWith("=")) {
            stroke = "thick";
          }
          if (line2.startsWith("~")) {
            stroke = "invisible";
          }
          const dots = this.countChar(".", line2);
          if (dots) {
            stroke = "dotted";
            length2 = dots;
          }
          return { type: type3, stroke, length: length2 };
        }
        destructLink(_str, _startStr) {
          const info2 = this.destructEndLink(_str);
          let startInfo;
          if (_startStr) {
            startInfo = this.destructStartLink(_startStr);
            if (startInfo.stroke !== info2.stroke) {
              return { type: "INVALID", stroke: "INVALID" };
            }
            if (startInfo.type === "arrow_open") {
              startInfo.type = info2.type;
            } else {
              if (startInfo.type !== info2.type) {
                return { type: "INVALID", stroke: "INVALID" };
              }
              startInfo.type = "double_" + startInfo.type;
            }
            if (startInfo.type === "double_arrow") {
              startInfo.type = "double_arrow_point";
            }
            startInfo.length = info2.length;
            return startInfo;
          }
          return info2;
        }
        // Todo optimizer this by caching existing nodes
        exists(allSgs, _id) {
          for (const sg of allSgs) {
            if (sg.nodes.includes(_id)) {
              return true;
            }
          }
          return false;
        }
        /**
         * Deletes an id from all subgraphs
         *
         */
        makeUniq(sg, allSubgraphs) {
          const res = [];
          sg.nodes.forEach((_id, pos) => {
            if (!this.exists(allSubgraphs, _id)) {
              res.push(sg.nodes[pos]);
            }
          });
          return { nodes: res };
        }
        getTypeFromVertex(vertex) {
          if (vertex.img) {
            return "imageSquare";
          }
          if (vertex.icon) {
            if (vertex.form === "circle") {
              return "iconCircle";
            }
            if (vertex.form === "square") {
              return "iconSquare";
            }
            if (vertex.form === "rounded") {
              return "iconRounded";
            }
            return "icon";
          }
          switch (vertex.type) {
            case "square":
            case void 0:
              return "squareRect";
            case "round":
              return "roundedRect";
            case "ellipse":
              return "ellipse";
            default:
              return vertex.type;
          }
        }
        findNode(nodes5, id34) {
          return nodes5.find((node2) => node2.id === id34);
        }
        destructEdgeType(type3) {
          let arrowTypeStart = "none";
          let arrowTypeEnd = "arrow_point";
          switch (type3) {
            case "arrow_point":
            case "arrow_circle":
            case "arrow_cross":
              arrowTypeEnd = type3;
              break;
            case "double_arrow_point":
            case "double_arrow_circle":
            case "double_arrow_cross":
              arrowTypeStart = type3.replace("double_", "");
              arrowTypeEnd = arrowTypeStart;
              break;
          }
          return { arrowTypeStart, arrowTypeEnd };
        }
        addNodeFromVertex(vertex, nodes5, parentDB, subGraphDB, config5, look) {
          const parentId = parentDB.get(vertex.id);
          const isGroup2 = subGraphDB.get(vertex.id) ?? false;
          const node2 = this.findNode(nodes5, vertex.id);
          if (node2) {
            node2.cssStyles = vertex.styles;
            node2.cssCompiledStyles = this.getCompiledStyles(vertex.classes);
            node2.cssClasses = vertex.classes.join(" ");
          } else {
            const baseNode = {
              id: vertex.id,
              label: vertex.text,
              labelType: vertex.labelType,
              labelStyle: "",
              parentId,
              padding: config5.flowchart?.padding || 8,
              cssStyles: vertex.styles,
              cssCompiledStyles: this.getCompiledStyles(["default", "node", ...vertex.classes]),
              cssClasses: "default " + vertex.classes.join(" "),
              dir: vertex.dir,
              domId: vertex.domId,
              look,
              link: vertex.link,
              linkTarget: vertex.linkTarget,
              tooltip: this.getTooltip(vertex.id),
              icon: vertex.icon,
              pos: vertex.pos,
              img: vertex.img,
              assetWidth: vertex.assetWidth,
              assetHeight: vertex.assetHeight,
              constraint: vertex.constraint
            };
            if (isGroup2) {
              nodes5.push({
                ...baseNode,
                isGroup: true,
                shape: "rect"
              });
            } else {
              nodes5.push({
                ...baseNode,
                isGroup: false,
                shape: this.getTypeFromVertex(vertex)
              });
            }
          }
        }
        getCompiledStyles(classDefs) {
          let compiledStyles = [];
          for (const customClass of classDefs) {
            const cssClass = this.classes.get(customClass);
            if (cssClass?.styles) {
              compiledStyles = [...compiledStyles, ...cssClass.styles ?? []].map((s2) => s2.trim());
            }
            if (cssClass?.textStyles) {
              compiledStyles = [...compiledStyles, ...cssClass.textStyles ?? []].map((s2) => s2.trim());
            }
          }
          return compiledStyles;
        }
        getData() {
          const config5 = getConfig2();
          const nodes5 = [];
          const edges3 = [];
          const subGraphs = this.getSubGraphs();
          const parentDB = /* @__PURE__ */ new Map();
          const subGraphDB = /* @__PURE__ */ new Map();
          for (let i2 = subGraphs.length - 1; i2 >= 0; i2--) {
            const subGraph = subGraphs[i2];
            if (subGraph.nodes.length > 0) {
              subGraphDB.set(subGraph.id, true);
            }
            for (const id34 of subGraph.nodes) {
              parentDB.set(id34, subGraph.id);
            }
          }
          for (let i2 = subGraphs.length - 1; i2 >= 0; i2--) {
            const subGraph = subGraphs[i2];
            nodes5.push({
              id: subGraph.id,
              label: subGraph.title,
              labelStyle: "",
              labelType: subGraph.labelType,
              parentId: parentDB.get(subGraph.id),
              padding: 8,
              cssCompiledStyles: this.getCompiledStyles(subGraph.classes),
              cssClasses: subGraph.classes.join(" "),
              shape: "rect",
              dir: subGraph.dir,
              isGroup: true,
              look: config5.look
            });
          }
          const n2 = this.getVertices();
          n2.forEach((vertex) => {
            this.addNodeFromVertex(vertex, nodes5, parentDB, subGraphDB, config5, config5.look || "classic");
          });
          const e3 = this.getEdges();
          e3.forEach((rawEdge, index) => {
            const { arrowTypeStart, arrowTypeEnd } = this.destructEdgeType(rawEdge.type);
            const styles5 = [...e3.defaultStyle ?? []];
            if (rawEdge.style) {
              styles5.push(...rawEdge.style);
            }
            const edge = {
              id: getEdgeId(rawEdge.start, rawEdge.end, { counter: index, prefix: "L" }, rawEdge.id),
              isUserDefinedId: rawEdge.isUserDefinedId,
              start: rawEdge.start,
              end: rawEdge.end,
              type: rawEdge.type ?? "normal",
              label: rawEdge.text,
              labelType: rawEdge.labelType,
              labelpos: "c",
              thickness: rawEdge.stroke,
              minlen: rawEdge.length,
              classes: rawEdge?.stroke === "invisible" ? "" : "edge-thickness-normal edge-pattern-solid flowchart-link",
              arrowTypeStart: rawEdge?.stroke === "invisible" || rawEdge?.type === "arrow_open" ? "none" : arrowTypeStart,
              arrowTypeEnd: rawEdge?.stroke === "invisible" || rawEdge?.type === "arrow_open" ? "none" : arrowTypeEnd,
              arrowheadStyle: "fill: #333",
              cssCompiledStyles: this.getCompiledStyles(rawEdge.classes),
              labelStyle: styles5,
              style: styles5,
              pattern: rawEdge.stroke,
              look: config5.look,
              animate: rawEdge.animate,
              animation: rawEdge.animation,
              curve: rawEdge.interpolate || this.edges.defaultInterpolate || config5.flowchart?.curve
            };
            edges3.push(edge);
          });
          return { nodes: nodes5, edges: edges3, other: {}, config: config5 };
        }
        defaultConfig() {
          return defaultConfig2.flowchart;
        }
      };
    }
  });

  // src/rendering-util/insertElementsForSize.js
  var getDiagramElement;
  var init_insertElementsForSize = __esm({
    "src/rendering-util/insertElementsForSize.js"() {
      "use strict";
      init_src32();
      getDiagramElement = /* @__PURE__ */ __name((id34, securityLevel) => {
        let sandboxElement;
        if (securityLevel === "sandbox") {
          sandboxElement = select_default2("#i" + id34);
        }
        const root3 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body");
        const svg2 = root3.select(`[id="${id34}"]`);
        return svg2;
      }, "getDiagramElement");
    }
  });

  // src/utils/subGraphTitleMargins.ts
  var getSubGraphTitleMargins;
  var init_subGraphTitleMargins = __esm({
    "src/utils/subGraphTitleMargins.ts"() {
      "use strict";
      getSubGraphTitleMargins = /* @__PURE__ */ __name(({
        flowchart
      }) => {
        const subGraphTitleTopMargin = flowchart?.subGraphTitleMargin?.top ?? 0;
        const subGraphTitleBottomMargin = flowchart?.subGraphTitleMargin?.bottom ?? 0;
        const subGraphTitleTotalMargin = subGraphTitleTopMargin + subGraphTitleBottomMargin;
        return {
          subGraphTitleTopMargin,
          subGraphTitleBottomMargin,
          subGraphTitleTotalMargin
        };
      }, "getSubGraphTitleMargins");
    }
  });

  // src/rendering-util/rendering-elements/clusters.js
  var rect, noteGroup, roundedWithTitle, kanbanSection, divider, squareRect2, shapes2, clusterElems, insertCluster, clear3;
  var init_clusters = __esm({
    "src/rendering-util/rendering-elements/clusters.js"() {
      "use strict";
      init_diagramAPI();
      init_config();
      init_logger();
      init_subGraphTitleMargins();
      init_src32();
      init_rough_esm();
      init_createText();
      init_intersect_rect();
      init_createLabel();
      init_roundedRectPath();
      init_handDrawnShapeStyles();
      rect = /* @__PURE__ */ __name(async (parent4, node2) => {
        log.info("Creating subgraph rect for ", node2.id, node2);
        const siteConfig2 = getConfig2();
        const { themeVariables, handDrawnSeed } = siteConfig2;
        const { clusterBkg, clusterBorder } = themeVariables;
        const { labelStyles, nodeStyles, borderStyles, backgroundStyles } = styles2String(node2);
        const shapeSvg = parent4.insert("g").attr("class", "cluster " + node2.cssClasses).attr("id", node2.domId).attr("data-look", node2.look);
        const useHtmlLabels = getEffectiveHtmlLabels(siteConfig2);
        const labelEl = shapeSvg.insert("g").attr("class", "cluster-label ");
        let text4;
        if (node2.labelType === "markdown") {
          text4 = await createText(labelEl, node2.label, {
            style: node2.labelStyle,
            useHtmlLabels,
            isNode: true,
            width: node2.width
          });
        } else {
          text4 = await createLabel_default(labelEl, node2.label, node2.labelStyle || "", false, true);
        }
        let bbox = text4.getBBox();
        if (getEffectiveHtmlLabels(siteConfig2)) {
          const div = text4.children[0];
          const dv = select_default2(text4);
          bbox = div.getBoundingClientRect();
          dv.attr("width", bbox.width);
          dv.attr("height", bbox.height);
        }
        const width3 = node2.width <= bbox.width + node2.padding ? bbox.width + node2.padding : node2.width;
        if (node2.width <= bbox.width + node2.padding) {
          node2.diff = (width3 - node2.width) / 2 - node2.padding;
        } else {
          node2.diff = -node2.padding;
        }
        const height2 = node2.height;
        const x5 = node2.x - width3 / 2;
        const y6 = node2.y - height2 / 2;
        log.trace("Data ", node2, JSON.stringify(node2));
        let rect3;
        if (node2.look === "handDrawn") {
          const rc = at.svg(shapeSvg);
          const options2 = userNodeOverrides(node2, {
            roughness: 0.7,
            fill: clusterBkg,
            // fill: 'red',
            stroke: clusterBorder,
            fillWeight: 3,
            seed: handDrawnSeed
          });
          const roughNode = rc.path(createRoundedRectPathD(x5, y6, width3, height2, 0), options2);
          rect3 = shapeSvg.insert(() => {
            log.debug("Rough node insert CXC", roughNode);
            return roughNode;
          }, ":first-child");
          rect3.select("path:nth-child(2)").attr("style", borderStyles.join(";"));
          rect3.select("path").attr("style", backgroundStyles.join(";").replace("fill", "stroke"));
        } else {
          rect3 = shapeSvg.insert("rect", ":first-child");
          rect3.attr("style", nodeStyles).attr("rx", node2.rx).attr("ry", node2.ry).attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2);
        }
        const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig2);
        labelEl.attr(
          "transform",
          // This puts the label on top of the box instead of inside it
          `translate(${node2.x - bbox.width / 2}, ${node2.y - node2.height / 2 + subGraphTitleTopMargin})`
        );
        if (labelStyles) {
          const span = labelEl.select("span");
          if (span) {
            span.attr("style", labelStyles);
          }
        }
        const rectBox = rect3.node().getBBox();
        node2.offsetX = 0;
        node2.width = rectBox.width;
        node2.height = rectBox.height;
        node2.offsetY = bbox.height - node2.padding / 2;
        node2.intersect = function(point8) {
          return intersect_rect_default(node2, point8);
        };
        return { cluster: shapeSvg, labelBBox: bbox };
      }, "rect");
      noteGroup = /* @__PURE__ */ __name((parent4, node2) => {
        const shapeSvg = parent4.insert("g").attr("class", "note-cluster").attr("id", node2.domId);
        const rect3 = shapeSvg.insert("rect", ":first-child");
        const padding2 = 0 * node2.padding;
        const halfPadding = padding2 / 2;
        rect3.attr("rx", node2.rx).attr("ry", node2.ry).attr("x", node2.x - node2.width / 2 - halfPadding).attr("y", node2.y - node2.height / 2 - halfPadding).attr("width", node2.width + padding2).attr("height", node2.height + padding2).attr("fill", "none");
        const rectBox = rect3.node().getBBox();
        node2.width = rectBox.width;
        node2.height = rectBox.height;
        node2.intersect = function(point8) {
          return intersect_rect_default(node2, point8);
        };
        return { cluster: shapeSvg, labelBBox: { width: 0, height: 0 } };
      }, "noteGroup");
      roundedWithTitle = /* @__PURE__ */ __name(async (parent4, node2) => {
        const siteConfig2 = getConfig2();
        const { themeVariables, handDrawnSeed } = siteConfig2;
        const { altBackground, compositeBackground, compositeTitleBackground, nodeBorder } = themeVariables;
        const shapeSvg = parent4.insert("g").attr("class", node2.cssClasses).attr("id", node2.domId).attr("data-id", node2.id).attr("data-look", node2.look);
        const outerRectG = shapeSvg.insert("g", ":first-child");
        const label = shapeSvg.insert("g").attr("class", "cluster-label");
        let innerRect = shapeSvg.append("rect");
        const text4 = await createLabel_default(label, node2.label, node2.labelStyle, void 0, true);
        let bbox = text4.getBBox();
        if (getEffectiveHtmlLabels(siteConfig2)) {
          const div = text4.children[0];
          const dv = select_default2(text4);
          bbox = div.getBoundingClientRect();
          dv.attr("width", bbox.width);
          dv.attr("height", bbox.height);
        }
        const padding2 = 0 * node2.padding;
        const halfPadding = padding2 / 2;
        const width3 = (node2.width <= bbox.width + node2.padding ? bbox.width + node2.padding : node2.width) + padding2;
        if (node2.width <= bbox.width + node2.padding) {
          node2.diff = (width3 - node2.width) / 2 - node2.padding;
        } else {
          node2.diff = -node2.padding;
        }
        const height2 = node2.height + padding2;
        const innerHeight = node2.height + padding2 - bbox.height - 6;
        const x5 = node2.x - width3 / 2;
        const y6 = node2.y - height2 / 2;
        node2.width = width3;
        const innerY = node2.y - node2.height / 2 - halfPadding + bbox.height + 2;
        let rect3;
        if (node2.look === "handDrawn") {
          const isAlt = node2.cssClasses.includes("statediagram-cluster-alt");
          const rc = at.svg(shapeSvg);
          const roughOuterNode = node2.rx || node2.ry ? rc.path(createRoundedRectPathD(x5, y6, width3, height2, 10), {
            roughness: 0.7,
            fill: compositeTitleBackground,
            fillStyle: "solid",
            stroke: nodeBorder,
            seed: handDrawnSeed
          }) : rc.rectangle(x5, y6, width3, height2, { seed: handDrawnSeed });
          rect3 = shapeSvg.insert(() => roughOuterNode, ":first-child");
          const roughInnerNode = rc.rectangle(x5, innerY, width3, innerHeight, {
            fill: isAlt ? altBackground : compositeBackground,
            fillStyle: isAlt ? "hachure" : "solid",
            stroke: nodeBorder,
            seed: handDrawnSeed
          });
          rect3 = shapeSvg.insert(() => roughOuterNode, ":first-child");
          innerRect = shapeSvg.insert(() => roughInnerNode);
        } else {
          rect3 = outerRectG.insert("rect", ":first-child");
          const outerRectClass = "outer";
          rect3.attr("class", outerRectClass).attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2).attr("data-look", node2.look);
          innerRect.attr("class", "inner").attr("x", x5).attr("y", innerY).attr("width", width3).attr("height", innerHeight);
        }
        label.attr(
          "transform",
          `translate(${node2.x - bbox.width / 2}, ${y6 + 1 - (getEffectiveHtmlLabels(siteConfig2) ? 0 : 3)})`
        );
        const rectBox = rect3.node().getBBox();
        node2.height = rectBox.height;
        node2.offsetX = 0;
        node2.offsetY = bbox.height - node2.padding / 2;
        node2.labelBBox = bbox;
        node2.intersect = function(point8) {
          return intersect_rect_default(node2, point8);
        };
        return { cluster: shapeSvg, labelBBox: bbox };
      }, "roundedWithTitle");
      kanbanSection = /* @__PURE__ */ __name(async (parent4, node2) => {
        log.info("Creating subgraph rect for ", node2.id, node2);
        const siteConfig2 = getConfig2();
        const { themeVariables, handDrawnSeed } = siteConfig2;
        const { clusterBkg, clusterBorder } = themeVariables;
        const { labelStyles, nodeStyles, borderStyles, backgroundStyles } = styles2String(node2);
        const shapeSvg = parent4.insert("g").attr("class", "cluster " + node2.cssClasses).attr("id", node2.domId).attr("data-look", node2.look);
        const useHtmlLabels = getEffectiveHtmlLabels(siteConfig2);
        const labelEl = shapeSvg.insert("g").attr("class", "cluster-label ");
        const text4 = await createText(labelEl, node2.label, {
          style: node2.labelStyle,
          useHtmlLabels,
          isNode: true,
          width: node2.width
        });
        let bbox = text4.getBBox();
        if (getEffectiveHtmlLabels(siteConfig2)) {
          const div = text4.children[0];
          const dv = select_default2(text4);
          bbox = div.getBoundingClientRect();
          dv.attr("width", bbox.width);
          dv.attr("height", bbox.height);
        }
        const width3 = node2.width <= bbox.width + node2.padding ? bbox.width + node2.padding : node2.width;
        if (node2.width <= bbox.width + node2.padding) {
          node2.diff = (width3 - node2.width) / 2 - node2.padding;
        } else {
          node2.diff = -node2.padding;
        }
        const height2 = node2.height;
        const x5 = node2.x - width3 / 2;
        const y6 = node2.y - height2 / 2;
        log.trace("Data ", node2, JSON.stringify(node2));
        let rect3;
        if (node2.look === "handDrawn") {
          const rc = at.svg(shapeSvg);
          const options2 = userNodeOverrides(node2, {
            roughness: 0.7,
            fill: clusterBkg,
            // fill: 'red',
            stroke: clusterBorder,
            fillWeight: 4,
            seed: handDrawnSeed
          });
          const roughNode = rc.path(createRoundedRectPathD(x5, y6, width3, height2, node2.rx), options2);
          rect3 = shapeSvg.insert(() => {
            log.debug("Rough node insert CXC", roughNode);
            return roughNode;
          }, ":first-child");
          rect3.select("path:nth-child(2)").attr("style", borderStyles.join(";"));
          rect3.select("path").attr("style", backgroundStyles.join(";").replace("fill", "stroke"));
        } else {
          rect3 = shapeSvg.insert("rect", ":first-child");
          rect3.attr("style", nodeStyles).attr("rx", node2.rx).attr("ry", node2.ry).attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2);
        }
        const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig2);
        labelEl.attr(
          "transform",
          // This puts the label on top of the box instead of inside it
          `translate(${node2.x - bbox.width / 2}, ${node2.y - node2.height / 2 + subGraphTitleTopMargin})`
        );
        if (labelStyles) {
          const span = labelEl.select("span");
          if (span) {
            span.attr("style", labelStyles);
          }
        }
        const rectBox = rect3.node().getBBox();
        node2.offsetX = 0;
        node2.width = rectBox.width;
        node2.height = rectBox.height;
        node2.offsetY = bbox.height - node2.padding / 2;
        node2.intersect = function(point8) {
          return intersect_rect_default(node2, point8);
        };
        return { cluster: shapeSvg, labelBBox: bbox };
      }, "kanbanSection");
      divider = /* @__PURE__ */ __name((parent4, node2) => {
        const siteConfig2 = getConfig2();
        const { themeVariables, handDrawnSeed } = siteConfig2;
        const { nodeBorder } = themeVariables;
        const shapeSvg = parent4.insert("g").attr("class", node2.cssClasses).attr("id", node2.domId).attr("data-look", node2.look);
        const outerRectG = shapeSvg.insert("g", ":first-child");
        const padding2 = 0 * node2.padding;
        const width3 = node2.width + padding2;
        node2.diff = -node2.padding;
        const height2 = node2.height + padding2;
        const x5 = node2.x - width3 / 2;
        const y6 = node2.y - height2 / 2;
        node2.width = width3;
        let rect3;
        if (node2.look === "handDrawn") {
          const rc = at.svg(shapeSvg);
          const roughOuterNode = rc.rectangle(x5, y6, width3, height2, {
            fill: "lightgrey",
            roughness: 0.5,
            strokeLineDash: [5],
            stroke: nodeBorder,
            seed: handDrawnSeed
          });
          rect3 = shapeSvg.insert(() => roughOuterNode, ":first-child");
        } else {
          rect3 = outerRectG.insert("rect", ":first-child");
          let outerRectClass = "outer";
          if (node2.look === "neo") {
            outerRectClass = "divider";
          } else {
            outerRectClass = "divider";
          }
          rect3.attr("class", outerRectClass).attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2).attr("data-look", node2.look);
        }
        const rectBox = rect3.node().getBBox();
        node2.height = rectBox.height;
        node2.offsetX = 0;
        node2.offsetY = 0;
        node2.intersect = function(point8) {
          return intersect_rect_default(node2, point8);
        };
        return { cluster: shapeSvg, labelBBox: {} };
      }, "divider");
      squareRect2 = rect;
      shapes2 = {
        rect,
        squareRect: squareRect2,
        roundedWithTitle,
        noteGroup,
        divider,
        kanbanSection
      };
      clusterElems = /* @__PURE__ */ new Map();
      insertCluster = /* @__PURE__ */ __name(async (elem, node2) => {
        const shape = node2.shape || "rect";
        const cluster = await shapes2[shape](elem, node2);
        clusterElems.set(node2.id, cluster);
        return cluster;
      }, "insertCluster");
      clear3 = /* @__PURE__ */ __name(() => {
        clusterElems = /* @__PURE__ */ new Map();
      }, "clear");
    }
  });

  // src/rendering-util/labelTransform.ts
  var computeLabelTransform;
  var init_labelTransform = __esm({
    "src/rendering-util/labelTransform.ts"() {
      "use strict";
      computeLabelTransform = /* @__PURE__ */ __name((bbox, useHtmlLabels) => {
        if (useHtmlLabels) {
          return "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")";
        }
        const x5 = bbox.x ?? 0;
        const y6 = bbox.y ?? 0;
        return "translate(" + -(x5 + bbox.width / 2) + ", " + -(y6 + bbox.height / 2) + ")";
      }, "computeLabelTransform");
    }
  });

  // src/utils/lineWithOffset.ts
  function calculateDeltaAndAngle(point1, point22) {
    if (point1 === void 0 || point22 === void 0) {
      return { angle: 0, deltaX: 0, deltaY: 0 };
    }
    point1 = pointTransformer(point1);
    point22 = pointTransformer(point22);
    const [x1, y1] = [point1.x, point1.y];
    const [x22, y22] = [point22.x, point22.y];
    const deltaX = x22 - x1;
    const deltaY = y22 - y1;
    return { angle: Math.atan(deltaY / deltaX), deltaX, deltaY };
  }
  var markerOffsets, markerOffsets2, pointTransformer, getLineFunctionsWithOffset;
  var init_lineWithOffset = __esm({
    "src/utils/lineWithOffset.ts"() {
      "use strict";
      markerOffsets = {
        aggregation: 17.25,
        extension: 17.25,
        composition: 17.25,
        dependency: 6,
        lollipop: 13.5,
        arrow_point: 4,
        arrow_barb: 0,
        arrow_barb_neo: 5.5
        //arrow_cross: 24,
      };
      markerOffsets2 = {
        arrow_point: 4,
        arrow_cross: 12.5,
        arrow_circle: 12.5
      };
      __name(calculateDeltaAndAngle, "calculateDeltaAndAngle");
      pointTransformer = /* @__PURE__ */ __name((data5) => {
        if (Array.isArray(data5)) {
          return { x: data5[0], y: data5[1] };
        }
        return data5;
      }, "pointTransformer");
      getLineFunctionsWithOffset = /* @__PURE__ */ __name((edge) => {
        return {
          x: /* @__PURE__ */ __name(function(d3, i2, data5) {
            let offset = 0;
            const DIRECTION = pointTransformer(data5[0]).x < pointTransformer(data5[data5.length - 1]).x ? "left" : "right";
            if (i2 === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) {
              const { angle: angle2, deltaX } = calculateDeltaAndAngle(data5[0], data5[1]);
              offset = markerOffsets[edge.arrowTypeStart] * Math.cos(angle2) * (deltaX >= 0 ? 1 : -1);
            } else if (i2 === data5.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) {
              const { angle: angle2, deltaX } = calculateDeltaAndAngle(
                data5[data5.length - 1],
                data5[data5.length - 2]
              );
              offset = markerOffsets[edge.arrowTypeEnd] * Math.cos(angle2) * (deltaX >= 0 ? 1 : -1);
            }
            const differenceToEnd = Math.abs(
              pointTransformer(d3).x - pointTransformer(data5[data5.length - 1]).x
            );
            const differenceInYEnd = Math.abs(
              pointTransformer(d3).y - pointTransformer(data5[data5.length - 1]).y
            );
            const differenceToStart = Math.abs(pointTransformer(d3).x - pointTransformer(data5[0]).x);
            const differenceInYStart = Math.abs(pointTransformer(d3).y - pointTransformer(data5[0]).y);
            const startMarkerHeight = markerOffsets[edge.arrowTypeStart];
            const endMarkerHeight = markerOffsets[edge.arrowTypeEnd];
            const extraRoom = 1;
            if (differenceToEnd < endMarkerHeight && differenceToEnd > 0 && differenceInYEnd < endMarkerHeight) {
              let adjustment = endMarkerHeight + extraRoom - differenceToEnd;
              adjustment *= DIRECTION === "right" ? -1 : 1;
              offset -= adjustment;
            }
            if (differenceToStart < startMarkerHeight && differenceToStart > 0 && differenceInYStart < startMarkerHeight) {
              let adjustment = startMarkerHeight + extraRoom - differenceToStart;
              adjustment *= DIRECTION === "right" ? -1 : 1;
              offset += adjustment;
            }
            return pointTransformer(d3).x + offset;
          }, "x"),
          y: /* @__PURE__ */ __name(function(d3, i2, data5) {
            let offset = 0;
            const DIRECTION = pointTransformer(data5[0]).y < pointTransformer(data5[data5.length - 1]).y ? "down" : "up";
            if (i2 === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) {
              const { angle: angle2, deltaY } = calculateDeltaAndAngle(data5[0], data5[1]);
              offset = markerOffsets[edge.arrowTypeStart] * Math.abs(Math.sin(angle2)) * (deltaY >= 0 ? 1 : -1);
            } else if (i2 === data5.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) {
              const { angle: angle2, deltaY } = calculateDeltaAndAngle(
                data5[data5.length - 1],
                data5[data5.length - 2]
              );
              offset = markerOffsets[edge.arrowTypeEnd] * Math.abs(Math.sin(angle2)) * (deltaY >= 0 ? 1 : -1);
            }
            const differenceToEnd = Math.abs(
              pointTransformer(d3).y - pointTransformer(data5[data5.length - 1]).y
            );
            const differenceInXEnd = Math.abs(
              pointTransformer(d3).x - pointTransformer(data5[data5.length - 1]).x
            );
            const differenceToStart = Math.abs(pointTransformer(d3).y - pointTransformer(data5[0]).y);
            const differenceInXStart = Math.abs(pointTransformer(d3).x - pointTransformer(data5[0]).x);
            const startMarkerHeight = markerOffsets[edge.arrowTypeStart];
            const endMarkerHeight = markerOffsets[edge.arrowTypeEnd];
            const extraRoom = 1;
            if (differenceToEnd < endMarkerHeight && differenceToEnd > 0 && differenceInXEnd < endMarkerHeight) {
              let adjustment = endMarkerHeight + extraRoom - differenceToEnd;
              adjustment *= DIRECTION === "up" ? -1 : 1;
              offset -= adjustment;
            }
            if (differenceToStart < startMarkerHeight && differenceToStart > 0 && differenceInXStart < startMarkerHeight) {
              let adjustment = startMarkerHeight + extraRoom - differenceToStart;
              adjustment *= DIRECTION === "up" ? -1 : 1;
              offset += adjustment;
            }
            return pointTransformer(d3).y + offset;
          }, "y")
        };
      }, "getLineFunctionsWithOffset");
      if (void 0) {
        const { it, expect, describe } = void 0;
        describe("calculateDeltaAndAngle", () => {
          it("should calculate the angle and deltas between two points", () => {
            expect(calculateDeltaAndAngle([0, 0], [0, 1])).toStrictEqual({
              angle: 1.5707963267948966,
              deltaX: 0,
              deltaY: 1
            });
            expect(calculateDeltaAndAngle([1, 0], [0, -1])).toStrictEqual({
              angle: 0.7853981633974483,
              deltaX: -1,
              deltaY: -1
            });
            expect(calculateDeltaAndAngle({ x: 1, y: 0 }, [0, -1])).toStrictEqual({
              angle: 0.7853981633974483,
              deltaX: -1,
              deltaY: -1
            });
            expect(calculateDeltaAndAngle({ x: 1, y: 0 }, { x: 1, y: 0 })).toStrictEqual({
              angle: NaN,
              deltaX: 0,
              deltaY: 0
            });
          });
          it("should calculate the angle and deltas if one point in undefined", () => {
            expect(calculateDeltaAndAngle(void 0, [0, 1])).toStrictEqual({
              angle: 0,
              deltaX: 0,
              deltaY: 0
            });
            expect(calculateDeltaAndAngle([0, 1], void 0)).toStrictEqual({
              angle: 0,
              deltaX: 0,
              deltaY: 0
            });
          });
        });
      }
    }
  });

  // src/rendering-util/rendering-elements/edgeMarker.ts
  var addEdgeMarkers, arrowTypesMap, arrowTypesWithMarginSupport, addEdgeMarker;
  var init_edgeMarker = __esm({
    "src/rendering-util/rendering-elements/edgeMarker.ts"() {
      "use strict";
      init_logger();
      addEdgeMarkers = /* @__PURE__ */ __name((svgPath, edge, url, id34, diagramType, useMargin = false, strokeColor) => {
        if (edge.arrowTypeStart) {
          addEdgeMarker(
            svgPath,
            "start",
            edge.arrowTypeStart,
            url,
            id34,
            diagramType,
            useMargin,
            strokeColor
          );
        }
        if (edge.arrowTypeEnd) {
          addEdgeMarker(svgPath, "end", edge.arrowTypeEnd, url, id34, diagramType, useMargin, strokeColor);
        }
      }, "addEdgeMarkers");
      arrowTypesMap = {
        arrow_cross: { type: "cross", fill: false },
        arrow_point: { type: "point", fill: true },
        arrow_barb: { type: "barb", fill: true },
        arrow_barb_neo: { type: "barb", fill: true },
        arrow_circle: { type: "circle", fill: false },
        aggregation: { type: "aggregation", fill: false },
        extension: { type: "extension", fill: false },
        composition: { type: "composition", fill: true },
        dependency: { type: "dependency", fill: true },
        lollipop: { type: "lollipop", fill: false },
        only_one: { type: "onlyOne", fill: false },
        zero_or_one: { type: "zeroOrOne", fill: false },
        one_or_more: { type: "oneOrMore", fill: false },
        zero_or_more: { type: "zeroOrMore", fill: false },
        requirement_arrow: { type: "requirement_arrow", fill: false },
        requirement_contains: { type: "requirement_contains", fill: false }
      };
      arrowTypesWithMarginSupport = [
        "cross",
        "point",
        "circle",
        "lollipop",
        "aggregation",
        "extension",
        "composition",
        "dependency",
        "barb"
      ];
      addEdgeMarker = /* @__PURE__ */ __name((svgPath, position5, arrowType, url, id34, diagramType, useMargin = false, strokeColor) => {
        const arrowTypeInfo = arrowTypesMap[arrowType];
        const marginSupport = arrowTypeInfo && arrowTypesWithMarginSupport.includes(arrowTypeInfo.type);
        if (!arrowTypeInfo) {
          log.warn(`Unknown arrow type: ${arrowType}`);
          return;
        }
        const endMarkerType = arrowTypeInfo.type;
        const suffix = position5 === "start" ? "Start" : "End";
        const offset = useMargin && marginSupport ? "-margin" : "";
        const originalMarkerId = `${id34}_${diagramType}-${endMarkerType}${suffix}${offset}`;
        if (strokeColor && strokeColor.trim() !== "") {
          const colorId = strokeColor.replace(/[^\dA-Za-z]/g, "_");
          const coloredMarkerId = `${originalMarkerId}_${colorId}`;
          if (!document.getElementById(coloredMarkerId)) {
            const originalMarker = document.getElementById(originalMarkerId);
            if (originalMarker) {
              const coloredMarker = originalMarker.cloneNode(true);
              coloredMarker.id = coloredMarkerId;
              const paths = coloredMarker.querySelectorAll("path, circle, line");
              paths.forEach((path4) => {
                path4.setAttribute("stroke", strokeColor);
                if (arrowTypeInfo.fill) {
                  path4.setAttribute("fill", strokeColor);
                }
              });
              originalMarker.parentNode?.appendChild(coloredMarker);
            }
          }
          svgPath.attr(`marker-${position5}`, `url(${url}#${coloredMarkerId})`);
        } else {
          svgPath.attr(`marker-${position5}`, `url(${url}#${originalMarkerId})`);
        }
      }, "addEdgeMarker");
    }
  });

  // src/rendering-util/rendering-elements/edges.js
  function setTerminalWidth(fo, value2) {
    if (getEffectiveHtmlLabels(getConfig2()) && fo) {
      fo.style.width = value2.length * 9 + "px";
      fo.style.height = "12px";
    }
  }
  function extractCornerPoints(points) {
    const cornerPoints = [];
    const cornerPointPositions = [];
    for (let i2 = 1; i2 < points.length - 1; i2++) {
      const prev2 = points[i2 - 1];
      const curr = points[i2];
      const next3 = points[i2 + 1];
      if (prev2.x === curr.x && curr.y === next3.y && Math.abs(curr.x - next3.x) > 5 && Math.abs(curr.y - prev2.y) > 5) {
        cornerPoints.push(curr);
        cornerPointPositions.push(i2);
      } else if (prev2.y === curr.y && curr.x === next3.x && Math.abs(curr.x - prev2.x) > 5 && Math.abs(curr.y - next3.y) > 5) {
        cornerPoints.push(curr);
        cornerPointPositions.push(i2);
      }
    }
    return { cornerPoints, cornerPointPositions };
  }
  function generateRoundedPath(points, radius2) {
    if (points.length < 2) {
      return "";
    }
    let path4 = "";
    const size4 = points.length;
    const epsilon6 = 1e-5;
    for (let i2 = 0; i2 < size4; i2++) {
      const currPoint = points[i2];
      const prevPoint = points[i2 - 1];
      const nextPoint = points[i2 + 1];
      if (i2 === 0) {
        path4 += `M${currPoint.x},${currPoint.y}`;
      } else if (i2 === size4 - 1) {
        path4 += `L${currPoint.x},${currPoint.y}`;
      } else {
        const dx1 = currPoint.x - prevPoint.x;
        const dy1 = currPoint.y - prevPoint.y;
        const dx2 = nextPoint.x - currPoint.x;
        const dy2 = nextPoint.y - currPoint.y;
        const len1 = Math.hypot(dx1, dy1);
        const len2 = Math.hypot(dx2, dy2);
        if (len1 < epsilon6 || len2 < epsilon6) {
          path4 += `L${currPoint.x},${currPoint.y}`;
          continue;
        }
        const nx1 = dx1 / len1;
        const ny1 = dy1 / len1;
        const nx2 = dx2 / len2;
        const ny2 = dy2 / len2;
        const dot2 = nx1 * nx2 + ny1 * ny2;
        const clampedDot = Math.max(-1, Math.min(1, dot2));
        const angle2 = Math.acos(clampedDot);
        if (angle2 < epsilon6 || Math.abs(Math.PI - angle2) < epsilon6) {
          path4 += `L${currPoint.x},${currPoint.y}`;
          continue;
        }
        const cutLen = Math.min(radius2 / Math.sin(angle2 / 2), len1 / 2, len2 / 2);
        const startX2 = currPoint.x - nx1 * cutLen;
        const startY2 = currPoint.y - ny1 * cutLen;
        const endX = currPoint.x + nx2 * cutLen;
        const endY = currPoint.y + ny2 * cutLen;
        path4 += `L${startX2},${startY2}`;
        path4 += `Q${currPoint.x},${currPoint.y} ${endX},${endY}`;
      }
    }
    return path4;
  }
  function calculateDeltaAndAngle2(point1, point22) {
    if (!point1 || !point22) {
      return { angle: 0, deltaX: 0, deltaY: 0 };
    }
    const deltaX = point22.x - point1.x;
    const deltaY = point22.y - point1.y;
    const angle2 = Math.atan2(deltaY, deltaX);
    return { angle: angle2, deltaX, deltaY };
  }
  function applyMarkerOffsetsToPoints(points, edge) {
    const newPoints = points.map((point8) => ({ ...point8 }));
    if (points.length >= 2 && markerOffsets[edge.arrowTypeStart]) {
      const offsetValue = markerOffsets[edge.arrowTypeStart];
      const point1 = points[0];
      const point22 = points[1];
      const { angle: angle2 } = calculateDeltaAndAngle2(point1, point22);
      const offsetX = offsetValue * Math.cos(angle2);
      const offsetY = offsetValue * Math.sin(angle2);
      newPoints[0].x = point1.x + offsetX;
      newPoints[0].y = point1.y + offsetY;
    }
    const n2 = points.length;
    if (n2 >= 2 && markerOffsets[edge.arrowTypeEnd]) {
      const offsetValue = markerOffsets[edge.arrowTypeEnd];
      const point1 = points[n2 - 1];
      const point22 = points[n2 - 2];
      const { angle: angle2 } = calculateDeltaAndAngle2(point22, point1);
      const offsetX = offsetValue * Math.cos(angle2);
      const offsetY = offsetValue * Math.sin(angle2);
      newPoints[n2 - 1].x = point1.x - offsetX;
      newPoints[n2 - 1].y = point1.y - offsetY;
    }
    return newPoints;
  }
  var resolveEdgeCurveType, edgeLabels, terminalLabels, clear4, getLabelStyles, insertEdgeLabel, positionEdgeLabel, outsideNode, intersection, cutPathAtIntersect, findAdjacentPoint, fixCorners, generateDashArray, insertEdge;
  var init_edges = __esm({
    "src/rendering-util/rendering-elements/edges.js"() {
      "use strict";
      init_diagramAPI();
      init_config();
      init_logger();
      init_createText();
      init_labelTransform();
      init_utils2();
      init_lineWithOffset();
      init_subGraphTitleMargins();
      init_src32();
      init_rough_esm();
      init_createLabel();
      init_edgeMarker();
      init_handDrawnShapeStyles();
      resolveEdgeCurveType = /* @__PURE__ */ __name((edgeCurve) => {
        return typeof edgeCurve === "string" ? edgeCurve : getConfig2()?.flowchart?.curve;
      }, "resolveEdgeCurveType");
      edgeLabels = /* @__PURE__ */ new Map();
      terminalLabels = /* @__PURE__ */ new Map();
      clear4 = /* @__PURE__ */ __name(() => {
        edgeLabels.clear();
        terminalLabels.clear();
      }, "clear");
      getLabelStyles = /* @__PURE__ */ __name((styleArray) => {
        if (!styleArray) {
          return "";
        }
        if (typeof styleArray === "string") {
          return styleArray;
        }
        return styleArray.reduce((acc, style3) => acc + ";" + style3, "");
      }, "getLabelStyles");
      insertEdgeLabel = /* @__PURE__ */ __name(async (elem, edge) => {
        const config5 = getConfig2();
        let useHtmlLabels = getEffectiveHtmlLabels(config5);
        const { labelStyles } = styles2String(edge);
        edge.labelStyle = labelStyles;
        const edgeLabel = elem.insert("g").attr("class", "edgeLabel");
        const label = edgeLabel.insert("g").attr("class", "label").attr("data-id", edge.id);
        const isMarkdown = edge.labelType === "markdown";
        const markdownWidth = void 0;
        const labelElement = await createText(
          elem,
          edge.label,
          {
            style: getLabelStyles(edge.labelStyle),
            useHtmlLabels,
            addSvgBackground: true,
            isNode: false,
            markdown: isMarkdown,
            // Plain text edge labels should auto-wrap, markdown edge labels respect markdownAutoWrap config
            width: isMarkdown ? markdownWidth : void 0
          },
          config5
        );
        label.node().appendChild(labelElement);
        log.info("abc82", edge, edge.labelType);
        let bbox = labelElement.getBBox();
        let transformBbox = bbox;
        if (useHtmlLabels) {
          const div = labelElement.children[0];
          const dv = select_default2(labelElement);
          bbox = div.getBoundingClientRect();
          transformBbox = bbox;
          dv.attr("width", bbox.width);
          dv.attr("height", bbox.height);
        } else {
          const textEl = select_default2(labelElement).select("text").node();
          if (textEl && typeof textEl.getBBox === "function") {
            transformBbox = textEl.getBBox();
          }
        }
        label.attr("transform", computeLabelTransform(transformBbox, useHtmlLabels));
        edgeLabels.set(edge.id, edgeLabel);
        edge.width = bbox.width;
        edge.height = bbox.height;
        let fo;
        if (edge.startLabelLeft) {
          const startEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
          const inner2 = startEdgeLabelLeft.insert("g").attr("class", "inner");
          const startLabelElement = await createLabel_default(
            inner2,
            edge.startLabelLeft,
            getLabelStyles(edge.labelStyle) || "",
            false,
            false
          );
          fo = startLabelElement;
          let slBox = startLabelElement.getBBox();
          if (useHtmlLabels) {
            const div = startLabelElement.children[0];
            const dv = select_default2(startLabelElement);
            slBox = div.getBoundingClientRect();
            dv.attr("width", slBox.width);
            dv.attr("height", slBox.height);
          }
          inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels));
          if (!terminalLabels.get(edge.id)) {
            terminalLabels.set(edge.id, {});
          }
          terminalLabels.get(edge.id).startLeft = startEdgeLabelLeft;
          setTerminalWidth(fo, edge.startLabelLeft);
        }
        if (edge.startLabelRight) {
          const startEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
          const inner2 = startEdgeLabelRight.insert("g").attr("class", "inner");
          const startLabelElement = await createLabel_default(
            inner2,
            edge.startLabelRight,
            getLabelStyles(edge.labelStyle) || "",
            false,
            false
          );
          fo = startLabelElement;
          inner2.node().appendChild(startLabelElement);
          let slBox = startLabelElement.getBBox();
          if (useHtmlLabels) {
            const div = startLabelElement.children[0];
            const dv = select_default2(startLabelElement);
            slBox = div.getBoundingClientRect();
            dv.attr("width", slBox.width);
            dv.attr("height", slBox.height);
          }
          inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels));
          if (!terminalLabels.get(edge.id)) {
            terminalLabels.set(edge.id, {});
          }
          terminalLabels.get(edge.id).startRight = startEdgeLabelRight;
          setTerminalWidth(fo, edge.startLabelRight);
        }
        if (edge.endLabelLeft) {
          const endEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
          const inner2 = endEdgeLabelLeft.insert("g").attr("class", "inner");
          const endLabelElement = await createLabel_default(
            inner2,
            edge.endLabelLeft,
            getLabelStyles(edge.labelStyle) || "",
            false,
            false
          );
          fo = endLabelElement;
          let slBox = endLabelElement.getBBox();
          if (useHtmlLabels) {
            const div = endLabelElement.children[0];
            const dv = select_default2(endLabelElement);
            slBox = div.getBoundingClientRect();
            dv.attr("width", slBox.width);
            dv.attr("height", slBox.height);
          }
          inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels));
          endEdgeLabelLeft.node().appendChild(endLabelElement);
          if (!terminalLabels.get(edge.id)) {
            terminalLabels.set(edge.id, {});
          }
          terminalLabels.get(edge.id).endLeft = endEdgeLabelLeft;
          setTerminalWidth(fo, edge.endLabelLeft);
        }
        if (edge.endLabelRight) {
          const endEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
          const inner2 = endEdgeLabelRight.insert("g").attr("class", "inner");
          const endLabelElement = await createLabel_default(
            inner2,
            edge.endLabelRight,
            getLabelStyles(edge.labelStyle) || "",
            false,
            false
          );
          fo = endLabelElement;
          let slBox = endLabelElement.getBBox();
          if (useHtmlLabels) {
            const div = endLabelElement.children[0];
            const dv = select_default2(endLabelElement);
            slBox = div.getBoundingClientRect();
            dv.attr("width", slBox.width);
            dv.attr("height", slBox.height);
          }
          inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels));
          endEdgeLabelRight.node().appendChild(endLabelElement);
          if (!terminalLabels.get(edge.id)) {
            terminalLabels.set(edge.id, {});
          }
          terminalLabels.get(edge.id).endRight = endEdgeLabelRight;
          setTerminalWidth(fo, edge.endLabelRight);
        }
        return labelElement;
      }, "insertEdgeLabel");
      __name(setTerminalWidth, "setTerminalWidth");
      positionEdgeLabel = /* @__PURE__ */ __name((edge, paths) => {
        log.debug("Moving label abc88 ", edge.id, edge.label, edgeLabels.get(edge.id), paths);
        let path4 = paths.updatedPath ? paths.updatedPath : paths.originalPath;
        const siteConfig2 = getConfig2();
        const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig2);
        if (edge.label) {
          const el = edgeLabels.get(edge.id);
          let x5 = edge.x;
          let y6 = edge.y;
          if (path4) {
            const pos = utils_default2.calcLabelPosition(path4);
            log.debug(
              "Moving label " + edge.label + " from (",
              x5,
              ",",
              y6,
              ") to (",
              pos.x,
              ",",
              pos.y,
              ") abc88"
            );
            if (paths.updatedPath) {
              x5 = pos.x;
              y6 = pos.y;
            }
          }
          el.attr("transform", `translate(${x5}, ${y6 + subGraphTitleTotalMargin / 2})`);
        }
        if (edge.startLabelLeft) {
          const el = terminalLabels.get(edge.id).startLeft;
          let x5 = edge.x;
          let y6 = edge.y;
          if (path4) {
            const pos = utils_default2.calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, "start_left", path4);
            x5 = pos.x;
            y6 = pos.y;
          }
          el.attr("transform", `translate(${x5}, ${y6})`);
        }
        if (edge.startLabelRight) {
          const el = terminalLabels.get(edge.id).startRight;
          let x5 = edge.x;
          let y6 = edge.y;
          if (path4) {
            const pos = utils_default2.calcTerminalLabelPosition(
              edge.arrowTypeStart ? 10 : 0,
              "start_right",
              path4
            );
            x5 = pos.x;
            y6 = pos.y;
          }
          el.attr("transform", `translate(${x5}, ${y6})`);
        }
        if (edge.endLabelLeft) {
          const el = terminalLabels.get(edge.id).endLeft;
          let x5 = edge.x;
          let y6 = edge.y;
          if (path4) {
            const pos = utils_default2.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_left", path4);
            x5 = pos.x;
            y6 = pos.y;
          }
          el.attr("transform", `translate(${x5}, ${y6})`);
        }
        if (edge.endLabelRight) {
          const el = terminalLabels.get(edge.id).endRight;
          let x5 = edge.x;
          let y6 = edge.y;
          if (path4) {
            const pos = utils_default2.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_right", path4);
            x5 = pos.x;
            y6 = pos.y;
          }
          el.attr("transform", `translate(${x5}, ${y6})`);
        }
      }, "positionEdgeLabel");
      outsideNode = /* @__PURE__ */ __name((node2, point8) => {
        const x5 = node2.x;
        const y6 = node2.y;
        const dx = Math.abs(point8.x - x5);
        const dy = Math.abs(point8.y - y6);
        const w4 = node2.width / 2;
        const h3 = node2.height / 2;
        return dx >= w4 || dy >= h3;
      }, "outsideNode");
      intersection = /* @__PURE__ */ __name((node2, outsidePoint, insidePoint) => {
        log.debug(`intersection calc abc89:
  outsidePoint: ${JSON.stringify(outsidePoint)}
  insidePoint : ${JSON.stringify(insidePoint)}
  node        : x:${node2.x} y:${node2.y} w:${node2.width} h:${node2.height}`);
        const x5 = node2.x;
        const y6 = node2.y;
        const dx = Math.abs(x5 - insidePoint.x);
        const w4 = node2.width / 2;
        let r2 = insidePoint.x < outsidePoint.x ? w4 - dx : w4 + dx;
        const h3 = node2.height / 2;
        const Q3 = Math.abs(outsidePoint.y - insidePoint.y);
        const R3 = Math.abs(outsidePoint.x - insidePoint.x);
        if (Math.abs(y6 - outsidePoint.y) * w4 > Math.abs(x5 - outsidePoint.x) * h3) {
          let q3 = insidePoint.y < outsidePoint.y ? outsidePoint.y - h3 - y6 : y6 - h3 - outsidePoint.y;
          r2 = R3 * q3 / Q3;
          const res = {
            x: insidePoint.x < outsidePoint.x ? insidePoint.x + r2 : insidePoint.x - R3 + r2,
            y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q3 - q3 : insidePoint.y - Q3 + q3
          };
          if (r2 === 0) {
            res.x = outsidePoint.x;
            res.y = outsidePoint.y;
          }
          if (R3 === 0) {
            res.x = outsidePoint.x;
          }
          if (Q3 === 0) {
            res.y = outsidePoint.y;
          }
          log.debug(`abc89 top/bottom calc, Q ${Q3}, q ${q3}, R ${R3}, r ${r2}`, res);
          return res;
        } else {
          if (insidePoint.x < outsidePoint.x) {
            r2 = outsidePoint.x - w4 - x5;
          } else {
            r2 = x5 - w4 - outsidePoint.x;
          }
          let q3 = Q3 * r2 / R3;
          let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R3 - r2 : insidePoint.x - R3 + r2;
          let _y = insidePoint.y < outsidePoint.y ? insidePoint.y + q3 : insidePoint.y - q3;
          log.debug(`sides calc abc89, Q ${Q3}, q ${q3}, R ${R3}, r ${r2}`, { _x, _y });
          if (r2 === 0) {
            _x = outsidePoint.x;
            _y = outsidePoint.y;
          }
          if (R3 === 0) {
            _x = outsidePoint.x;
          }
          if (Q3 === 0) {
            _y = outsidePoint.y;
          }
          return { x: _x, y: _y };
        }
      }, "intersection");
      cutPathAtIntersect = /* @__PURE__ */ __name((_points, boundaryNode) => {
        log.warn("abc88 cutPathAtIntersect", _points, boundaryNode);
        let points = [];
        let lastPointOutside = _points[0];
        let isInside = false;
        _points.forEach((point8) => {
          log.info("abc88 checking point", point8, boundaryNode);
          if (!outsideNode(boundaryNode, point8) && !isInside) {
            const inter = intersection(boundaryNode, lastPointOutside, point8);
            log.debug("abc88 inside", point8, lastPointOutside, inter);
            log.debug("abc88 intersection", inter, boundaryNode);
            let pointPresent = false;
            points.forEach((p3) => {
              pointPresent = pointPresent || p3.x === inter.x && p3.y === inter.y;
            });
            if (!points.some((e3) => e3.x === inter.x && e3.y === inter.y)) {
              points.push(inter);
            } else {
              log.warn("abc88 no intersect", inter, points);
            }
            isInside = true;
          } else {
            log.warn("abc88 outside", point8, lastPointOutside);
            lastPointOutside = point8;
            if (!isInside) {
              points.push(point8);
            }
          }
        });
        log.debug("returning points", points);
        return points;
      }, "cutPathAtIntersect");
      __name(extractCornerPoints, "extractCornerPoints");
      findAdjacentPoint = /* @__PURE__ */ __name(function(pointA, pointB, distance3) {
        const xDiff = pointB.x - pointA.x;
        const yDiff = pointB.y - pointA.y;
        const length2 = Math.sqrt(xDiff * xDiff + yDiff * yDiff);
        const ratio = distance3 / length2;
        return { x: pointB.x - ratio * xDiff, y: pointB.y - ratio * yDiff };
      }, "findAdjacentPoint");
      fixCorners = /* @__PURE__ */ __name(function(lineData) {
        const { cornerPointPositions } = extractCornerPoints(lineData);
        const newLineData = [];
        for (let i2 = 0; i2 < lineData.length; i2++) {
          if (cornerPointPositions.includes(i2)) {
            const prevPoint = lineData[i2 - 1];
            const nextPoint = lineData[i2 + 1];
            const cornerPoint = lineData[i2];
            const newPrevPoint = findAdjacentPoint(prevPoint, cornerPoint, 5);
            const newNextPoint = findAdjacentPoint(nextPoint, cornerPoint, 5);
            const xDiff = newNextPoint.x - newPrevPoint.x;
            const yDiff = newNextPoint.y - newPrevPoint.y;
            newLineData.push(newPrevPoint);
            const a2 = Math.sqrt(2) * 2;
            let newCornerPoint = { x: cornerPoint.x, y: cornerPoint.y };
            if (Math.abs(nextPoint.x - prevPoint.x) > 10 && Math.abs(nextPoint.y - prevPoint.y) >= 10) {
              log.debug(
                "Corner point fixing",
                Math.abs(nextPoint.x - prevPoint.x),
                Math.abs(nextPoint.y - prevPoint.y)
              );
              const r2 = 5;
              if (cornerPoint.x === newPrevPoint.x) {
                newCornerPoint = {
                  x: xDiff < 0 ? newPrevPoint.x - r2 + a2 : newPrevPoint.x + r2 - a2,
                  y: yDiff < 0 ? newPrevPoint.y - a2 : newPrevPoint.y + a2
                };
              } else {
                newCornerPoint = {
                  x: xDiff < 0 ? newPrevPoint.x - a2 : newPrevPoint.x + a2,
                  y: yDiff < 0 ? newPrevPoint.y - r2 + a2 : newPrevPoint.y + r2 - a2
                };
              }
            } else {
              log.debug(
                "Corner point skipping fixing",
                Math.abs(nextPoint.x - prevPoint.x),
                Math.abs(nextPoint.y - prevPoint.y)
              );
            }
            newLineData.push(newCornerPoint, newNextPoint);
          } else {
            newLineData.push(lineData[i2]);
          }
        }
        return newLineData;
      }, "fixCorners");
      generateDashArray = /* @__PURE__ */ __name((len, oValueS, oValueE) => {
        const middleLength = len - oValueS - oValueE;
        const dashLength = 2;
        const gapLength = 2;
        const dashGapPairLength = dashLength + gapLength;
        const numberOfPairs = Math.floor(middleLength / dashGapPairLength);
        const middlePattern = Array(numberOfPairs).fill(`${dashLength} ${gapLength}`).join(" ");
        const dashArray = `0 ${oValueS} ${middlePattern} ${oValueE}`;
        return dashArray;
      }, "generateDashArray");
      insertEdge = /* @__PURE__ */ __name(function(elem, edge, clusterDb2, diagramType, startNode, endNode, diagramId3, skipIntersect = false) {
        if (!diagramId3) {
          throw new Error(
            `insertEdge: missing diagramId for edge "${edge.id}" \u2014 edge IDs require a diagram prefix for uniqueness`
          );
        }
        const { handDrawnSeed } = getConfig2();
        let points = edge.points;
        let pointsHasChanged = false;
        const tail = startNode;
        var head2 = endNode;
        const edgeClassStyles = [];
        for (const key in edge.cssCompiledStyles) {
          if (isLabelStyle(key)) {
            continue;
          }
          edgeClassStyles.push(edge.cssCompiledStyles[key]);
        }
        log.debug("UIO intersect check", edge.points, head2.x, tail.x);
        if (head2.intersect && tail.intersect && !skipIntersect) {
          points = points.slice(1, edge.points.length - 1);
          points.unshift(tail.intersect(points[0]));
          log.debug(
            "Last point UIO",
            edge.start,
            "-->",
            edge.end,
            points[points.length - 1],
            head2,
            head2.intersect(points[points.length - 1])
          );
          points.push(head2.intersect(points[points.length - 1]));
        }
        const pointsStr = btoa(JSON.stringify(points));
        if (edge.toCluster) {
          log.info("to cluster abc88", clusterDb2.get(edge.toCluster));
          points = cutPathAtIntersect(edge.points, clusterDb2.get(edge.toCluster).node);
          pointsHasChanged = true;
        }
        if (edge.fromCluster) {
          log.debug(
            "from cluster abc88",
            clusterDb2.get(edge.fromCluster),
            JSON.stringify(points, null, 2)
          );
          points = cutPathAtIntersect(points.reverse(), clusterDb2.get(edge.fromCluster).node).reverse();
          pointsHasChanged = true;
        }
        let lineData = points.filter((p3) => !Number.isNaN(p3.y));
        const edgeCurveType = resolveEdgeCurveType(edge.curve);
        if (edgeCurveType !== "rounded") {
          lineData = fixCorners(lineData);
        }
        let curve = linear_default;
        switch (edgeCurveType) {
          case "linear":
            curve = linear_default;
            break;
          case "basis":
            curve = basis_default2;
            break;
          case "cardinal":
            curve = cardinal_default;
            break;
          case "bumpX":
            curve = bumpX;
            break;
          case "bumpY":
            curve = bumpY;
            break;
          case "catmullRom":
            curve = catmullRom_default;
            break;
          case "monotoneX":
            curve = monotoneX;
            break;
          case "monotoneY":
            curve = monotoneY;
            break;
          case "natural":
            curve = natural_default;
            break;
          case "step":
            curve = step_default;
            break;
          case "stepAfter":
            curve = stepAfter;
            break;
          case "stepBefore":
            curve = stepBefore;
            break;
          case "rounded":
            curve = linear_default;
            break;
          default:
            curve = basis_default2;
        }
        const { x: x5, y: y6 } = getLineFunctionsWithOffset(edge);
        const lineFunction = line_default().x(x5).y(y6).curve(curve);
        let strokeClasses;
        switch (edge.thickness) {
          case "normal":
            strokeClasses = "edge-thickness-normal";
            break;
          case "thick":
            strokeClasses = "edge-thickness-thick";
            break;
          case "invisible":
            strokeClasses = "edge-thickness-invisible";
            break;
          default:
            strokeClasses = "edge-thickness-normal";
        }
        switch (edge.pattern) {
          case "solid":
            strokeClasses += " edge-pattern-solid";
            break;
          case "dotted":
            strokeClasses += " edge-pattern-dotted";
            break;
          case "dashed":
            strokeClasses += " edge-pattern-dashed";
            break;
          default:
            strokeClasses += " edge-pattern-solid";
        }
        let svgPath;
        let linePath = edgeCurveType === "rounded" ? generateRoundedPath(applyMarkerOffsetsToPoints(lineData, edge), 5) : lineFunction(lineData);
        const edgeStyles = Array.isArray(edge.style) ? edge.style : [edge.style];
        let strokeColor = edgeStyles.find((style3) => style3?.startsWith("stroke:"));
        let animationClass = "";
        if (edge.animate) {
          animationClass = "edge-animation-fast";
        }
        if (edge.animation) {
          animationClass = "edge-animation-" + edge.animation;
        }
        let animatedEdge = false;
        if (edge.look === "handDrawn") {
          const rc = at.svg(elem);
          Object.assign([], lineData);
          const svgPathNode = rc.path(linePath, {
            roughness: 0.3,
            seed: handDrawnSeed
          });
          strokeClasses += " transition";
          svgPath = select_default2(svgPathNode).select("path").attr("id", `${diagramId3}-${edge.id}`).attr(
            "class",
            " " + strokeClasses + (edge.classes ? " " + edge.classes : "") + (animationClass ? " " + animationClass : "")
          ).attr("style", edgeStyles ? edgeStyles.reduce((acc, style3) => acc + ";" + style3, "") : "");
          let d3 = svgPath.attr("d");
          svgPath.attr("d", d3);
          elem.node().appendChild(svgPath.node());
        } else {
          const stylesFromClasses = edgeClassStyles.join(";");
          const styles5 = edgeStyles ? edgeStyles.reduce((acc, style3) => acc + style3 + ";", "") : "";
          const pathStyle = (stylesFromClasses ? stylesFromClasses + ";" + styles5 + ";" : styles5) + ";" + (edgeStyles ? edgeStyles.reduce((acc, style3) => acc + ";" + style3, "") : "");
          svgPath = elem.append("path").attr("d", linePath).attr("id", `${diagramId3}-${edge.id}`).attr(
            "class",
            " " + strokeClasses + (edge.classes ? " " + edge.classes : "") + (animationClass ? " " + animationClass : "")
          ).attr("style", pathStyle);
          strokeColor = pathStyle.match(/stroke:([^;]+)/)?.[1];
          animatedEdge = edge.animate === true || !!edge.animation || stylesFromClasses.includes("animation");
          const pathNode = svgPath.node();
          const len = typeof pathNode.getTotalLength === "function" ? pathNode.getTotalLength() : 0;
          const oValueS = markerOffsets2[edge.arrowTypeStart] || 0;
          const oValueE = markerOffsets2[edge.arrowTypeEnd] || 0;
          if (edge.look === "neo" && !animatedEdge) {
            const dashArray = edge.pattern === "dotted" || edge.pattern === "dashed" ? generateDashArray(len, oValueS, oValueE) : `0 ${oValueS} ${len - oValueS - oValueE} ${oValueE}`;
            const mOffset = `stroke-dasharray: ${dashArray}; stroke-dashoffset: 0;`;
            svgPath.attr("style", mOffset + svgPath.attr("style"));
          }
        }
        svgPath.attr("data-edge", true);
        svgPath.attr("data-et", "edge");
        svgPath.attr("data-id", edge.id);
        svgPath.attr("data-points", pointsStr);
        svgPath.attr("data-look", handleUndefinedAttr(edge.look));
        if (edge.showPoints) {
          lineData.forEach((point9) => {
            elem.append("circle").style("stroke", "red").style("fill", "red").attr("r", 1).attr("cx", point9.x).attr("cy", point9.y);
          });
        }
        let url = "";
        if (getConfig2().flowchart.arrowMarkerAbsolute || getConfig2().state.arrowMarkerAbsolute) {
          url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
          url = url.replace(/\(/g, "\\(").replace(/\)/g, "\\)");
        }
        log.info("arrowTypeStart", edge.arrowTypeStart);
        log.info("arrowTypeEnd", edge.arrowTypeEnd);
        const useMargin = !animatedEdge && edge?.look === "neo";
        addEdgeMarkers(svgPath, edge, url, diagramId3, diagramType, useMargin, strokeColor);
        const midIndex = Math.floor(points.length / 2);
        const point8 = points[midIndex];
        if (!utils_default2.isLabelCoordinateInPath(point8, svgPath.attr("d"))) {
          pointsHasChanged = true;
        }
        let paths = {};
        if (pointsHasChanged) {
          paths.updatedPath = points;
        }
        paths.originalPath = edge.points;
        return paths;
      }, "insertEdge");
      __name(generateRoundedPath, "generateRoundedPath");
      __name(calculateDeltaAndAngle2, "calculateDeltaAndAngle");
      __name(applyMarkerOffsetsToPoints, "applyMarkerOffsetsToPoints");
    }
  });

  // src/rendering-util/rendering-elements/markers.js
  var insertMarkers, extension, composition, aggregation, dependency, lollipop, point6, circle2, cross, barb, barbNeo, only_one, zero_or_one, one_or_more, zero_or_more, only_one_neo, zero_or_one_neo, one_or_more_neo, zero_or_more_neo, requirement_arrow, requirement_arrow_neo, requirement_contains, requirement_contains_neo, markers, markers_default;
  var init_markers = __esm({
    "src/rendering-util/rendering-elements/markers.js"() {
      "use strict";
      init_logger();
      init_config();
      insertMarkers = /* @__PURE__ */ __name((elem, markerArray, type3, id34) => {
        markerArray.forEach((markerName) => {
          markers[markerName](elem, type3, id34);
        });
      }, "insertMarkers");
      extension = /* @__PURE__ */ __name((elem, type3, id34) => {
        log.trace("Making markers for ", id34);
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-extensionStart").attr("class", "marker extension " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-extensionEnd").attr("class", "marker extension " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
        elem.append("marker").attr("id", id34 + "_" + type3 + "-extensionStart-margin").attr("class", "marker extension " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").attr("viewBox", "0 0 20 14").append("polygon").attr("points", "10,7 18,13 18,1").style("stroke-width", 2).style("stroke-dasharray", "0");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-extensionEnd-margin").attr("class", "marker extension " + type3).attr("refX", 9).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").attr("viewBox", "0 0 20 14").append("polygon").attr("points", "10,1 10,13 18,7").style("stroke-width", 2).style("stroke-dasharray", "0");
      }, "extension");
      composition = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-compositionStart").attr("class", "marker composition " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-compositionEnd").attr("class", "marker composition " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-compositionStart-margin").attr("class", "marker composition " + type3).attr("refX", 15).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").style("stroke-width", 0).attr("viewBox", "0 0 15 15").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-compositionEnd-margin").attr("class", "marker composition " + type3).attr("refX", 3.5).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").style("stroke-width", 0).attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
      }, "composition");
      aggregation = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-aggregationStart").attr("class", "marker aggregation " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-aggregationEnd").attr("class", "marker aggregation " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-aggregationStart-margin").attr("class", "marker aggregation " + type3).attr("refX", 15).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").style("stroke-width", 2).attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-aggregationEnd-margin").attr("class", "marker aggregation " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").style("stroke-width", 2).attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
      }, "aggregation");
      dependency = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-dependencyStart").attr("class", "marker dependency " + type3).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-dependencyEnd").attr("class", "marker dependency " + type3).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-dependencyStart-margin").attr("class", "marker dependency " + type3).attr("refX", 4).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").style("stroke-width", 0).attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-dependencyEnd-margin").attr("class", "marker dependency " + type3).attr("refX", 16).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").style("stroke-width", 0).attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
      }, "dependency");
      lollipop = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-lollipopStart").attr("class", "marker lollipop " + type3).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-lollipopEnd").attr("class", "marker lollipop " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-lollipopStart-margin").attr("class", "marker lollipop " + type3).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("circle").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6).attr("stroke-width", 2);
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-lollipopEnd-margin").attr("class", "marker lollipop " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("circle").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6).attr("stroke-width", 2);
      }, "lollipop");
      point6 = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("marker").attr("id", id34 + "_" + type3 + "-pointEnd").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", 5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 8).attr("markerHeight", 8).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
        elem.append("marker").attr("id", id34 + "_" + type3 + "-pointStart").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 8).attr("markerHeight", 8).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
        elem.append("marker").attr("id", id34 + "_" + type3 + "-pointEnd-margin").attr("class", "marker " + type3).attr("viewBox", "0 0 11.5 14").attr("refX", 11.5).attr("refY", 7).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 10.5).attr("markerHeight", 14).attr("orient", "auto").append("path").attr("d", "M 0 0 L 11.5 7 L 0 14 z").attr("class", "arrowMarkerPath").style("stroke-width", 0).style("stroke-dasharray", "1,0");
        elem.append("marker").attr("id", id34 + "_" + type3 + "-pointStart-margin").attr("class", "marker " + type3).attr("viewBox", "0 0 11.5 14").attr("refX", 1).attr("refY", 7).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11.5).attr("markerHeight", 14).attr("orient", "auto").append("polygon").attr("points", "0,7 11.5,14 11.5,0").attr("class", "arrowMarkerPath").style("stroke-width", 0).style("stroke-dasharray", "1,0");
      }, "point");
      circle2 = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("marker").attr("id", id34 + "_" + type3 + "-circleEnd").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
        elem.append("marker").attr("id", id34 + "_" + type3 + "-circleStart").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
        elem.append("marker").attr("id", id34 + "_" + type3 + "-circleEnd-margin").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refY", 5).attr("refX", 12.25).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 14).attr("markerHeight", 14).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 0).style("stroke-dasharray", "1,0");
        elem.append("marker").attr("id", id34 + "_" + type3 + "-circleStart-margin").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", -2).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 14).attr("markerHeight", 14).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 0).style("stroke-dasharray", "1,0");
      }, "circle");
      cross = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("marker").attr("id", id34 + "_" + type3 + "-crossEnd").attr("class", "marker cross " + type3).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
        elem.append("marker").attr("id", id34 + "_" + type3 + "-crossStart").attr("class", "marker cross " + type3).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
        elem.append("marker").attr("id", id34 + "_" + type3 + "-crossEnd-margin").attr("class", "marker cross " + type3).attr("viewBox", "0 0 15 15").attr("refX", 17.7).attr("refY", 7.5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 1,1 L 14,14 M 1,14 L 14,1").attr("class", "arrowMarkerPath").style("stroke-width", 2.5);
        elem.append("marker").attr("id", id34 + "_" + type3 + "-crossStart-margin").attr("class", "marker cross " + type3).attr("viewBox", "0 0 15 15").attr("refX", -3.5).attr("refY", 7.5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 1,1 L 14,14 M 1,14 L 14,1").attr("class", "arrowMarkerPath").style("stroke-width", 2.5).style("stroke-dasharray", "1,0");
      }, "cross");
      barb = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "userSpaceOnUse").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
      }, "barb");
      barbNeo = /* @__PURE__ */ __name((elem, type3, id34) => {
        const config5 = getConfig();
        const { themeVariables } = config5;
        const { transitionColor } = themeVariables;
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L11,14 L13,7 L11,0 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-barbEnd-margin").attr("refX", 17).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "userSpaceOnUse").attr("orient", "auto").append("path").attr("d", "M 19,7 L11,14 L13,7 L11,0 Z").attr("fill", `${transitionColor}`);
      }, "barbNeo");
      only_one = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-onlyOneStart").attr("class", "marker onlyOne " + type3).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("d", "M9,0 L9,18 M15,0 L15,18");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-onlyOneEnd").attr("class", "marker onlyOne " + type3).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("d", "M3,0 L3,18 M9,0 L9,18");
      }, "only_one");
      zero_or_one = /* @__PURE__ */ __name((elem, type3, id34) => {
        const startMarker = elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-zeroOrOneStart").attr("class", "marker zeroOrOne " + type3).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto");
        startMarker.append("circle").attr("fill", "white").attr("cx", 21).attr("cy", 9).attr("r", 6);
        startMarker.append("path").attr("d", "M9,0 L9,18");
        const endMarker = elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-zeroOrOneEnd").attr("class", "marker zeroOrOne " + type3).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto");
        endMarker.append("circle").attr("fill", "white").attr("cx", 9).attr("cy", 9).attr("r", 6);
        endMarker.append("path").attr("d", "M21,0 L21,18");
      }, "zero_or_one");
      one_or_more = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-oneOrMoreStart").attr("class", "marker oneOrMore " + type3).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("d", "M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-oneOrMoreEnd").attr("class", "marker oneOrMore " + type3).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18");
      }, "one_or_more");
      zero_or_more = /* @__PURE__ */ __name((elem, type3, id34) => {
        const startMarker = elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-zeroOrMoreStart").attr("class", "marker zeroOrMore " + type3).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto");
        startMarker.append("circle").attr("fill", "white").attr("cx", 48).attr("cy", 18).attr("r", 6);
        startMarker.append("path").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18");
        const endMarker = elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-zeroOrMoreEnd").attr("class", "marker zeroOrMore " + type3).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto");
        endMarker.append("circle").attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6);
        endMarker.append("path").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18");
      }, "zero_or_more");
      only_one_neo = /* @__PURE__ */ __name((elem, type3, id34) => {
        const config5 = getConfig();
        const { themeVariables } = config5;
        const { strokeWidth } = themeVariables;
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-onlyOneStart").attr("class", "marker onlyOne " + type3).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").attr("d", "M9,0 L9,18 M15,0 L15,18").attr("stroke-width", `${strokeWidth}`);
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-onlyOneEnd").attr("class", "marker onlyOne " + type3).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").attr("d", "M3,0 L3,18 M9,0 L9,18").attr("stroke-width", `${strokeWidth}`);
      }, "only_one_neo");
      zero_or_one_neo = /* @__PURE__ */ __name((elem, type3, id34) => {
        const config5 = getConfig();
        const { themeVariables } = config5;
        const { strokeWidth, mainBkg } = themeVariables;
        const startMarker = elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-zeroOrOneStart").attr("class", "marker zeroOrOne " + type3).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse");
        startMarker.append("circle").attr("fill", mainBkg ?? "white").attr("cx", 21).attr("cy", 9).attr("stroke-width", `${strokeWidth}`).attr("r", 6);
        startMarker.append("path").attr("d", "M9,0 L9,18").attr("stroke-width", `${strokeWidth}`);
        const endMarker = elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-zeroOrOneEnd").attr("class", "marker zeroOrOne " + type3).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("markerUnits", "userSpaceOnUse").attr("orient", "auto");
        endMarker.append("circle").attr("fill", mainBkg ?? "white").attr("cx", 9).attr("cy", 9).attr("stroke-width", `${strokeWidth}`).attr("r", 6);
        endMarker.append("path").attr("d", "M21,0 L21,18").attr("stroke-width", `${strokeWidth}`);
      }, "zero_or_one_neo");
      one_or_more_neo = /* @__PURE__ */ __name((elem, type3, id34) => {
        const config5 = getConfig();
        const { themeVariables } = config5;
        const { strokeWidth } = themeVariables;
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-oneOrMoreStart").attr("class", "marker oneOrMore " + type3).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").attr("d", "M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27").attr("stroke-width", `${strokeWidth}`);
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-oneOrMoreEnd").attr("class", "marker oneOrMore " + type3).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("markerUnits", "userSpaceOnUse").attr("orient", "auto").append("path").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18").attr("stroke-width", `${strokeWidth}`);
      }, "one_or_more_neo");
      zero_or_more_neo = /* @__PURE__ */ __name((elem, type3, id34) => {
        const config5 = getConfig();
        const { themeVariables } = config5;
        const { strokeWidth, mainBkg } = themeVariables;
        const startMarker = elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-zeroOrMoreStart").attr("class", "marker zeroOrMore " + type3).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("markerUnits", "userSpaceOnUse").attr("orient", "auto");
        startMarker.append("circle").attr("fill", mainBkg ?? "white").attr("cx", 45.5).attr("cy", 18).attr("r", 6).attr("stroke-width", `${strokeWidth}`);
        startMarker.append("path").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18").attr("stroke-width", `${strokeWidth}`);
        const endMarker = elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-zeroOrMoreEnd").attr("class", "marker zeroOrMore " + type3).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse");
        endMarker.append("circle").attr("fill", mainBkg ?? "white").attr("cx", 11).attr("cy", 18).attr("r", 6).attr("stroke-width", `${strokeWidth}`);
        endMarker.append("path").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18").attr("stroke-width", `${strokeWidth}`);
      }, "zero_or_more_neo");
      requirement_arrow = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-requirement_arrowEnd").attr("refX", 20).attr("refY", 10).attr("markerWidth", 20).attr("markerHeight", 20).attr("orient", "auto").append("path").attr(
          "d",
          `M0,0
      L20,10
      M20,10
      L0,20`
        );
      }, "requirement_arrow");
      requirement_arrow_neo = /* @__PURE__ */ __name((elem, type3, id34) => {
        const config5 = getConfig();
        const { themeVariables } = config5;
        const { strokeWidth } = themeVariables;
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-requirement_arrowEnd").attr("refX", 20).attr("refY", 10).attr("markerWidth", 20).attr("markerHeight", 20).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").attr("stroke-width", `${strokeWidth}`).attr("viewBox", "0 0 25 20").append("path").attr(
          "d",
          `M0,0
      L20,10
      M20,10
      L0,20`
        ).attr("stroke-linejoin", "miter");
      }, "requirement_arrow_neo");
      requirement_contains = /* @__PURE__ */ __name((elem, type3, id34) => {
        const containsNode = elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-requirement_containsStart").attr("refX", 0).attr("refY", 10).attr("markerWidth", 20).attr("markerHeight", 20).attr("orient", "auto").append("g");
        containsNode.append("circle").attr("cx", 10).attr("cy", 10).attr("r", 9).attr("fill", "none");
        containsNode.append("line").attr("x1", 1).attr("x2", 19).attr("y1", 10).attr("y2", 10);
        containsNode.append("line").attr("y1", 1).attr("y2", 19).attr("x1", 10).attr("x2", 10);
      }, "requirement_contains");
      requirement_contains_neo = /* @__PURE__ */ __name((elem, type3, id34) => {
        const config5 = getConfig();
        const { themeVariables } = config5;
        const { strokeWidth } = themeVariables;
        const containsNode = elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-requirement_containsStart").attr("refX", 0).attr("refY", 10).attr("markerWidth", 20).attr("markerHeight", 20).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("g");
        containsNode.append("circle").attr("cx", 10).attr("cy", 10).attr("r", 9).attr("fill", "none");
        containsNode.append("line").attr("x1", 1).attr("x2", 19).attr("y1", 10).attr("y2", 10);
        containsNode.append("line").attr("y1", 1).attr("y2", 19).attr("x1", 10).attr("x2", 10);
        containsNode.selectAll("*").attr("stroke-width", `${strokeWidth}`);
      }, "requirement_contains_neo");
      markers = {
        extension,
        composition,
        aggregation,
        dependency,
        lollipop,
        point: point6,
        circle: circle2,
        cross,
        barb,
        barbNeo,
        only_one,
        zero_or_one,
        one_or_more,
        zero_or_more,
        only_one_neo,
        zero_or_one_neo,
        one_or_more_neo,
        zero_or_more_neo,
        requirement_arrow,
        requirement_contains,
        requirement_arrow_neo,
        requirement_contains_neo
      };
      markers_default = insertMarkers;
    }
  });

  // src/rendering-util/rendering-elements/nodes.ts
  async function insertNode(elem, node2, renderOptions) {
    let newEl;
    let el;
    if (node2.shape === "rect") {
      if (node2.rx && node2.ry) {
        node2.shape = "roundedRect";
      } else {
        node2.shape = "squareRect";
      }
    }
    const shapeHandler = node2.shape ? shapes[node2.shape] : void 0;
    if (!shapeHandler) {
      throw new Error(`No such shape: ${node2.shape}. Please check your syntax.`);
    }
    if (node2.link) {
      let target;
      if (renderOptions.config.securityLevel === "sandbox") {
        target = "_top";
      } else if (node2.linkTarget) {
        target = node2.linkTarget || "_blank";
      }
      newEl = elem.insert("svg:a").attr("xlink:href", node2.link).attr("target", target ?? null);
      el = await shapeHandler(newEl, node2, renderOptions);
    } else {
      el = await shapeHandler(elem, node2, renderOptions);
      newEl = el;
    }
    newEl.attr("data-look", handleUndefinedAttr(node2.look));
    if (node2.tooltip) {
      el.attr("title", node2.tooltip);
    }
    nodeElems.set(node2.id, newEl);
    if (node2.haveCallback) {
      newEl.attr("class", newEl.attr("class") + " clickable");
    }
    return newEl;
  }
  var nodeElems, setNodeElem, clear5, positionNode;
  var init_nodes2 = __esm({
    "src/rendering-util/rendering-elements/nodes.ts"() {
      "use strict";
      init_logger();
      init_shapes();
      init_utils2();
      nodeElems = /* @__PURE__ */ new Map();
      __name(insertNode, "insertNode");
      setNodeElem = /* @__PURE__ */ __name((elem, node2) => {
        nodeElems.set(node2.id, elem);
      }, "setNodeElem");
      clear5 = /* @__PURE__ */ __name(() => {
        nodeElems.clear();
      }, "clear");
      positionNode = /* @__PURE__ */ __name((node2) => {
        const el = nodeElems.get(node2.id);
        log.trace(
          "Transforming node",
          node2.diff,
          node2,
          "translate(" + (node2.x - node2.width / 2 - 5) + ", " + node2.width / 2 + ")"
        );
        const padding2 = 8;
        const diff2 = node2.diff || 0;
        if (node2.clusterNode) {
          el.attr(
            "transform",
            "translate(" + (node2.x + diff2 - node2.width / 2) + ", " + (node2.y - node2.height / 2 - padding2) + ")"
          );
        } else {
          el.attr("transform", "translate(" + node2.x + ", " + node2.y + ")");
        }
        return diff2;
      }, "positionNode");
    }
  });

  // src/internals.ts
  var internalHelpers;
  var init_internals = __esm({
    "src/internals.ts"() {
      "use strict";
      init_config();
      init_common();
      init_logger();
      init_clusters();
      init_edges();
      init_markers();
      init_nodes2();
      init_util();
      init_utils2();
      internalHelpers = {
        common: common_default,
        getConfig,
        insertCluster,
        insertEdge,
        insertEdgeLabel,
        insertMarkers: markers_default,
        insertNode,
        interpolateToCurve,
        labelHelper,
        log,
        positionEdgeLabel
      };
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js
  function isSymbol(value2) {
    return typeof value2 == "symbol" || isObjectLike_default(value2) && baseGetTag_default(value2) == symbolTag;
  }
  var symbolTag, isSymbol_default;
  var init_isSymbol = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js"() {
      "use strict";
      init_baseGetTag();
      init_isObjectLike();
      symbolTag = "[object Symbol]";
      __name(isSymbol, "isSymbol");
      isSymbol_default = isSymbol;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js
  function arrayMap(array4, iteratee) {
    var index = -1, length2 = array4 == null ? 0 : array4.length, result = Array(length2);
    while (++index < length2) {
      result[index] = iteratee(array4[index], index, array4);
    }
    return result;
  }
  var arrayMap_default;
  var init_arrayMap = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js"() {
      "use strict";
      __name(arrayMap, "arrayMap");
      arrayMap_default = arrayMap;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js
  function baseToString(value2) {
    if (typeof value2 == "string") {
      return value2;
    }
    if (isArray_default(value2)) {
      return arrayMap_default(value2, baseToString) + "";
    }
    if (isSymbol_default(value2)) {
      return symbolToString ? symbolToString.call(value2) : "";
    }
    var result = value2 + "";
    return result == "0" && 1 / value2 == -INFINITY ? "-0" : result;
  }
  var INFINITY, symbolProto, symbolToString, baseToString_default;
  var init_baseToString = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js"() {
      "use strict";
      init_Symbol();
      init_arrayMap();
      init_isArray();
      init_isSymbol();
      INFINITY = 1 / 0;
      symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
      symbolToString = symbolProto ? symbolProto.toString : void 0;
      __name(baseToString, "baseToString");
      baseToString_default = baseToString;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js
  function trimmedEndIndex(string3) {
    var index = string3.length;
    while (index-- && reWhitespace.test(string3.charAt(index))) {
    }
    return index;
  }
  var reWhitespace, trimmedEndIndex_default;
  var init_trimmedEndIndex = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js"() {
      "use strict";
      reWhitespace = /\s/;
      __name(trimmedEndIndex, "trimmedEndIndex");
      trimmedEndIndex_default = trimmedEndIndex;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js
  function baseTrim(string3) {
    return string3 ? string3.slice(0, trimmedEndIndex_default(string3) + 1).replace(reTrimStart, "") : string3;
  }
  var reTrimStart, baseTrim_default;
  var init_baseTrim = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js"() {
      "use strict";
      init_trimmedEndIndex();
      reTrimStart = /^\s+/;
      __name(baseTrim, "baseTrim");
      baseTrim_default = baseTrim;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js
  function toNumber(value2) {
    if (typeof value2 == "number") {
      return value2;
    }
    if (isSymbol_default(value2)) {
      return NAN;
    }
    if (isObject_default(value2)) {
      var other = typeof value2.valueOf == "function" ? value2.valueOf() : value2;
      value2 = isObject_default(other) ? other + "" : other;
    }
    if (typeof value2 != "string") {
      return value2 === 0 ? value2 : +value2;
    }
    value2 = baseTrim_default(value2);
    var isBinary2 = reIsBinary.test(value2);
    return isBinary2 || reIsOctal.test(value2) ? freeParseInt(value2.slice(2), isBinary2 ? 2 : 8) : reIsBadHex.test(value2) ? NAN : +value2;
  }
  var NAN, reIsBadHex, reIsBinary, reIsOctal, freeParseInt, toNumber_default;
  var init_toNumber = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js"() {
      "use strict";
      init_baseTrim();
      init_isObject();
      init_isSymbol();
      NAN = 0 / 0;
      reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
      reIsBinary = /^0b[01]+$/i;
      reIsOctal = /^0o[0-7]+$/i;
      freeParseInt = parseInt;
      __name(toNumber, "toNumber");
      toNumber_default = toNumber;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toFinite.js
  function toFinite(value2) {
    if (!value2) {
      return value2 === 0 ? value2 : 0;
    }
    value2 = toNumber_default(value2);
    if (value2 === INFINITY2 || value2 === -INFINITY2) {
      var sign2 = value2 < 0 ? -1 : 1;
      return sign2 * MAX_INTEGER;
    }
    return value2 === value2 ? value2 : 0;
  }
  var INFINITY2, MAX_INTEGER, toFinite_default;
  var init_toFinite = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toFinite.js"() {
      "use strict";
      init_toNumber();
      INFINITY2 = 1 / 0;
      MAX_INTEGER = 17976931348623157e292;
      __name(toFinite, "toFinite");
      toFinite_default = toFinite;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toInteger.js
  function toInteger(value2) {
    var result = toFinite_default(value2), remainder = result % 1;
    return result === result ? remainder ? result - remainder : result : 0;
  }
  var toInteger_default;
  var init_toInteger = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toInteger.js"() {
      "use strict";
      init_toFinite();
      __name(toInteger, "toInteger");
      toInteger_default = toInteger;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js
  var WeakMap, WeakMap_default;
  var init_WeakMap = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js"() {
      "use strict";
      init_getNative();
      init_root();
      WeakMap = getNative_default(root_default, "WeakMap");
      WeakMap_default = WeakMap;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/noop.js
  function noop2() {
  }
  var noop_default2;
  var init_noop2 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/noop.js"() {
      "use strict";
      __name(noop2, "noop");
      noop_default2 = noop2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js
  function arrayEach(array4, iteratee) {
    var index = -1, length2 = array4 == null ? 0 : array4.length;
    while (++index < length2) {
      if (iteratee(array4[index], index, array4) === false) {
        break;
      }
    }
    return array4;
  }
  var arrayEach_default;
  var init_arrayEach = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js"() {
      "use strict";
      __name(arrayEach, "arrayEach");
      arrayEach_default = arrayEach;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseFindIndex.js
  function baseFindIndex(array4, predicate, fromIndex, fromRight) {
    var length2 = array4.length, index = fromIndex + (fromRight ? 1 : -1);
    while (fromRight ? index-- : ++index < length2) {
      if (predicate(array4[index], index, array4)) {
        return index;
      }
    }
    return -1;
  }
  var baseFindIndex_default;
  var init_baseFindIndex = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseFindIndex.js"() {
      "use strict";
      __name(baseFindIndex, "baseFindIndex");
      baseFindIndex_default = baseFindIndex;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNaN.js
  function baseIsNaN(value2) {
    return value2 !== value2;
  }
  var baseIsNaN_default;
  var init_baseIsNaN = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNaN.js"() {
      "use strict";
      __name(baseIsNaN, "baseIsNaN");
      baseIsNaN_default = baseIsNaN;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_strictIndexOf.js
  function strictIndexOf(array4, value2, fromIndex) {
    var index = fromIndex - 1, length2 = array4.length;
    while (++index < length2) {
      if (array4[index] === value2) {
        return index;
      }
    }
    return -1;
  }
  var strictIndexOf_default;
  var init_strictIndexOf = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_strictIndexOf.js"() {
      "use strict";
      __name(strictIndexOf, "strictIndexOf");
      strictIndexOf_default = strictIndexOf;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIndexOf.js
  function baseIndexOf(array4, value2, fromIndex) {
    return value2 === value2 ? strictIndexOf_default(array4, value2, fromIndex) : baseFindIndex_default(array4, baseIsNaN_default, fromIndex);
  }
  var baseIndexOf_default;
  var init_baseIndexOf = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIndexOf.js"() {
      "use strict";
      init_baseFindIndex();
      init_baseIsNaN();
      init_strictIndexOf();
      __name(baseIndexOf, "baseIndexOf");
      baseIndexOf_default = baseIndexOf;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludes.js
  function arrayIncludes(array4, value2) {
    var length2 = array4 == null ? 0 : array4.length;
    return !!length2 && baseIndexOf_default(array4, value2, 0) > -1;
  }
  var arrayIncludes_default;
  var init_arrayIncludes = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludes.js"() {
      "use strict";
      init_baseIndexOf();
      __name(arrayIncludes, "arrayIncludes");
      arrayIncludes_default = arrayIncludes;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js
  var nativeKeys, nativeKeys_default;
  var init_nativeKeys = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js"() {
      "use strict";
      init_overArg();
      nativeKeys = overArg_default(Object.keys, Object);
      nativeKeys_default = nativeKeys;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js
  function baseKeys(object3) {
    if (!isPrototype_default(object3)) {
      return nativeKeys_default(object3);
    }
    var result = [];
    for (var key in Object(object3)) {
      if (hasOwnProperty10.call(object3, key) && key != "constructor") {
        result.push(key);
      }
    }
    return result;
  }
  var objectProto12, hasOwnProperty10, baseKeys_default;
  var init_baseKeys = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js"() {
      "use strict";
      init_isPrototype();
      init_nativeKeys();
      objectProto12 = Object.prototype;
      hasOwnProperty10 = objectProto12.hasOwnProperty;
      __name(baseKeys, "baseKeys");
      baseKeys_default = baseKeys;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/keys.js
  function keys(object3) {
    return isArrayLike_default(object3) ? arrayLikeKeys_default(object3) : baseKeys_default(object3);
  }
  var keys_default;
  var init_keys = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/keys.js"() {
      "use strict";
      init_arrayLikeKeys();
      init_baseKeys();
      init_isArrayLike();
      __name(keys, "keys");
      keys_default = keys;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/assign.js
  var objectProto13, hasOwnProperty11, assign, assign_default;
  var init_assign = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/assign.js"() {
      "use strict";
      init_assignValue();
      init_copyObject();
      init_createAssigner();
      init_isArrayLike();
      init_isPrototype();
      init_keys();
      objectProto13 = Object.prototype;
      hasOwnProperty11 = objectProto13.hasOwnProperty;
      assign = createAssigner_default(function(object3, source) {
        if (isPrototype_default(source) || isArrayLike_default(source)) {
          copyObject_default(source, keys_default(source), object3);
          return;
        }
        for (var key in source) {
          if (hasOwnProperty11.call(source, key)) {
            assignValue_default(object3, key, source[key]);
          }
        }
      });
      assign_default = assign;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js
  function isKey(value2, object3) {
    if (isArray_default(value2)) {
      return false;
    }
    var type3 = typeof value2;
    if (type3 == "number" || type3 == "symbol" || type3 == "boolean" || value2 == null || isSymbol_default(value2)) {
      return true;
    }
    return reIsPlainProp.test(value2) || !reIsDeepProp.test(value2) || object3 != null && value2 in Object(object3);
  }
  var reIsDeepProp, reIsPlainProp, isKey_default;
  var init_isKey = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js"() {
      "use strict";
      init_isArray();
      init_isSymbol();
      reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
      reIsPlainProp = /^\w*$/;
      __name(isKey, "isKey");
      isKey_default = isKey;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js
  function memoizeCapped(func) {
    var result = memoize_default(func, function(key) {
      if (cache3.size === MAX_MEMOIZE_SIZE) {
        cache3.clear();
      }
      return key;
    });
    var cache3 = result.cache;
    return result;
  }
  var MAX_MEMOIZE_SIZE, memoizeCapped_default;
  var init_memoizeCapped = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js"() {
      "use strict";
      init_memoize();
      MAX_MEMOIZE_SIZE = 500;
      __name(memoizeCapped, "memoizeCapped");
      memoizeCapped_default = memoizeCapped;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js
  var rePropName, reEscapeChar, stringToPath, stringToPath_default;
  var init_stringToPath = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js"() {
      "use strict";
      init_memoizeCapped();
      rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
      reEscapeChar = /\\(\\)?/g;
      stringToPath = memoizeCapped_default(function(string3) {
        var result = [];
        if (string3.charCodeAt(0) === 46) {
          result.push("");
        }
        string3.replace(rePropName, function(match2, number7, quote, subString) {
          result.push(quote ? subString.replace(reEscapeChar, "$1") : number7 || match2);
        });
        return result;
      });
      stringToPath_default = stringToPath;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toString.js
  function toString2(value2) {
    return value2 == null ? "" : baseToString_default(value2);
  }
  var toString_default;
  var init_toString = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toString.js"() {
      "use strict";
      init_baseToString();
      __name(toString2, "toString");
      toString_default = toString2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js
  function castPath(value2, object3) {
    if (isArray_default(value2)) {
      return value2;
    }
    return isKey_default(value2, object3) ? [value2] : stringToPath_default(toString_default(value2));
  }
  var castPath_default;
  var init_castPath = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js"() {
      "use strict";
      init_isArray();
      init_isKey();
      init_stringToPath();
      init_toString();
      __name(castPath, "castPath");
      castPath_default = castPath;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js
  function toKey(value2) {
    if (typeof value2 == "string" || isSymbol_default(value2)) {
      return value2;
    }
    var result = value2 + "";
    return result == "0" && 1 / value2 == -INFINITY3 ? "-0" : result;
  }
  var INFINITY3, toKey_default;
  var init_toKey = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js"() {
      "use strict";
      init_isSymbol();
      INFINITY3 = 1 / 0;
      __name(toKey, "toKey");
      toKey_default = toKey;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.js
  function baseGet(object3, path4) {
    path4 = castPath_default(path4, object3);
    var index = 0, length2 = path4.length;
    while (object3 != null && index < length2) {
      object3 = object3[toKey_default(path4[index++])];
    }
    return index && index == length2 ? object3 : void 0;
  }
  var baseGet_default;
  var init_baseGet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.js"() {
      "use strict";
      init_castPath();
      init_toKey();
      __name(baseGet, "baseGet");
      baseGet_default = baseGet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/get.js
  function get3(object3, path4, defaultValue) {
    var result = object3 == null ? void 0 : baseGet_default(object3, path4);
    return result === void 0 ? defaultValue : result;
  }
  var get_default;
  var init_get = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/get.js"() {
      "use strict";
      init_baseGet();
      __name(get3, "get");
      get_default = get3;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js
  function arrayPush2(array4, values2) {
    var index = -1, length2 = values2.length, offset = array4.length;
    while (++index < length2) {
      array4[offset + index] = values2[index];
    }
    return array4;
  }
  var arrayPush_default;
  var init_arrayPush = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js"() {
      "use strict";
      __name(arrayPush2, "arrayPush");
      arrayPush_default = arrayPush2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isFlattenable.js
  function isFlattenable(value2) {
    return isArray_default(value2) || isArguments_default(value2) || !!(spreadableSymbol && value2 && value2[spreadableSymbol]);
  }
  var spreadableSymbol, isFlattenable_default;
  var init_isFlattenable = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isFlattenable.js"() {
      "use strict";
      init_Symbol();
      init_isArguments();
      init_isArray();
      spreadableSymbol = Symbol_default ? Symbol_default.isConcatSpreadable : void 0;
      __name(isFlattenable, "isFlattenable");
      isFlattenable_default = isFlattenable;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseFlatten.js
  function baseFlatten(array4, depth, predicate, isStrict, result) {
    var index = -1, length2 = array4.length;
    predicate || (predicate = isFlattenable_default);
    result || (result = []);
    while (++index < length2) {
      var value2 = array4[index];
      if (depth > 0 && predicate(value2)) {
        if (depth > 1) {
          baseFlatten(value2, depth - 1, predicate, isStrict, result);
        } else {
          arrayPush_default(result, value2);
        }
      } else if (!isStrict) {
        result[result.length] = value2;
      }
    }
    return result;
  }
  var baseFlatten_default;
  var init_baseFlatten = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseFlatten.js"() {
      "use strict";
      init_arrayPush();
      init_isFlattenable();
      __name(baseFlatten, "baseFlatten");
      baseFlatten_default = baseFlatten;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/flatten.js
  function flatten(array4) {
    var length2 = array4 == null ? 0 : array4.length;
    return length2 ? baseFlatten_default(array4, 1) : [];
  }
  var flatten_default;
  var init_flatten = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/flatten.js"() {
      "use strict";
      init_baseFlatten();
      __name(flatten, "flatten");
      flatten_default = flatten;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_flatRest.js
  function flatRest(func) {
    return setToString_default(overRest_default(func, void 0, flatten_default), func + "");
  }
  var flatRest_default;
  var init_flatRest = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_flatRest.js"() {
      "use strict";
      init_flatten();
      init_overRest();
      init_setToString();
      __name(flatRest, "flatRest");
      flatRest_default = flatRest;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSlice.js
  function baseSlice(array4, start3, end2) {
    var index = -1, length2 = array4.length;
    if (start3 < 0) {
      start3 = -start3 > length2 ? 0 : length2 + start3;
    }
    end2 = end2 > length2 ? length2 : end2;
    if (end2 < 0) {
      end2 += length2;
    }
    length2 = start3 > end2 ? 0 : end2 - start3 >>> 0;
    start3 >>>= 0;
    var result = Array(length2);
    while (++index < length2) {
      result[index] = array4[index + start3];
    }
    return result;
  }
  var baseSlice_default;
  var init_baseSlice = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSlice.js"() {
      "use strict";
      __name(baseSlice, "baseSlice");
      baseSlice_default = baseSlice;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hasUnicode.js
  function hasUnicode(string3) {
    return reHasUnicode.test(string3);
  }
  var rsAstralRange, rsComboMarksRange, reComboHalfMarksRange, rsComboSymbolsRange, rsComboRange, rsVarRange, rsZWJ, reHasUnicode, hasUnicode_default;
  var init_hasUnicode = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hasUnicode.js"() {
      "use strict";
      rsAstralRange = "\\ud800-\\udfff";
      rsComboMarksRange = "\\u0300-\\u036f";
      reComboHalfMarksRange = "\\ufe20-\\ufe2f";
      rsComboSymbolsRange = "\\u20d0-\\u20ff";
      rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
      rsVarRange = "\\ufe0e\\ufe0f";
      rsZWJ = "\\u200d";
      reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
      __name(hasUnicode, "hasUnicode");
      hasUnicode_default = hasUnicode;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayReduce.js
  function arrayReduce(array4, iteratee, accumulator, initAccum) {
    var index = -1, length2 = array4 == null ? 0 : array4.length;
    if (initAccum && length2) {
      accumulator = array4[++index];
    }
    while (++index < length2) {
      accumulator = iteratee(accumulator, array4[index], index, array4);
    }
    return accumulator;
  }
  var arrayReduce_default;
  var init_arrayReduce = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayReduce.js"() {
      "use strict";
      __name(arrayReduce, "arrayReduce");
      arrayReduce_default = arrayReduce;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js
  function baseAssign(object3, source) {
    return object3 && copyObject_default(source, keys_default(source), object3);
  }
  var baseAssign_default;
  var init_baseAssign = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js"() {
      "use strict";
      init_copyObject();
      init_keys();
      __name(baseAssign, "baseAssign");
      baseAssign_default = baseAssign;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js
  function baseAssignIn(object3, source) {
    return object3 && copyObject_default(source, keysIn_default(source), object3);
  }
  var baseAssignIn_default;
  var init_baseAssignIn = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js"() {
      "use strict";
      init_copyObject();
      init_keysIn();
      __name(baseAssignIn, "baseAssignIn");
      baseAssignIn_default = baseAssignIn;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js
  function arrayFilter(array4, predicate) {
    var index = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
    while (++index < length2) {
      var value2 = array4[index];
      if (predicate(value2, index, array4)) {
        result[resIndex++] = value2;
      }
    }
    return result;
  }
  var arrayFilter_default;
  var init_arrayFilter = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js"() {
      "use strict";
      __name(arrayFilter, "arrayFilter");
      arrayFilter_default = arrayFilter;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js
  function stubArray() {
    return [];
  }
  var stubArray_default;
  var init_stubArray = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js"() {
      "use strict";
      __name(stubArray, "stubArray");
      stubArray_default = stubArray;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js
  var objectProto14, propertyIsEnumerable2, nativeGetSymbols, getSymbols, getSymbols_default;
  var init_getSymbols = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js"() {
      "use strict";
      init_arrayFilter();
      init_stubArray();
      objectProto14 = Object.prototype;
      propertyIsEnumerable2 = objectProto14.propertyIsEnumerable;
      nativeGetSymbols = Object.getOwnPropertySymbols;
      getSymbols = !nativeGetSymbols ? stubArray_default : function(object3) {
        if (object3 == null) {
          return [];
        }
        object3 = Object(object3);
        return arrayFilter_default(nativeGetSymbols(object3), function(symbol) {
          return propertyIsEnumerable2.call(object3, symbol);
        });
      };
      getSymbols_default = getSymbols;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js
  function copySymbols(source, object3) {
    return copyObject_default(source, getSymbols_default(source), object3);
  }
  var copySymbols_default;
  var init_copySymbols = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js"() {
      "use strict";
      init_copyObject();
      init_getSymbols();
      __name(copySymbols, "copySymbols");
      copySymbols_default = copySymbols;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js
  var nativeGetSymbols2, getSymbolsIn, getSymbolsIn_default;
  var init_getSymbolsIn = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js"() {
      "use strict";
      init_arrayPush();
      init_getPrototype();
      init_getSymbols();
      init_stubArray();
      nativeGetSymbols2 = Object.getOwnPropertySymbols;
      getSymbolsIn = !nativeGetSymbols2 ? stubArray_default : function(object3) {
        var result = [];
        while (object3) {
          arrayPush_default(result, getSymbols_default(object3));
          object3 = getPrototype_default(object3);
        }
        return result;
      };
      getSymbolsIn_default = getSymbolsIn;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js
  function copySymbolsIn(source, object3) {
    return copyObject_default(source, getSymbolsIn_default(source), object3);
  }
  var copySymbolsIn_default;
  var init_copySymbolsIn = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js"() {
      "use strict";
      init_copyObject();
      init_getSymbolsIn();
      __name(copySymbolsIn, "copySymbolsIn");
      copySymbolsIn_default = copySymbolsIn;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js
  function baseGetAllKeys(object3, keysFunc, symbolsFunc) {
    var result = keysFunc(object3);
    return isArray_default(object3) ? result : arrayPush_default(result, symbolsFunc(object3));
  }
  var baseGetAllKeys_default;
  var init_baseGetAllKeys = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js"() {
      "use strict";
      init_arrayPush();
      init_isArray();
      __name(baseGetAllKeys, "baseGetAllKeys");
      baseGetAllKeys_default = baseGetAllKeys;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js
  function getAllKeys(object3) {
    return baseGetAllKeys_default(object3, keys_default, getSymbols_default);
  }
  var getAllKeys_default;
  var init_getAllKeys = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js"() {
      "use strict";
      init_baseGetAllKeys();
      init_getSymbols();
      init_keys();
      __name(getAllKeys, "getAllKeys");
      getAllKeys_default = getAllKeys;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js
  function getAllKeysIn(object3) {
    return baseGetAllKeys_default(object3, keysIn_default, getSymbolsIn_default);
  }
  var getAllKeysIn_default;
  var init_getAllKeysIn = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js"() {
      "use strict";
      init_baseGetAllKeys();
      init_getSymbolsIn();
      init_keysIn();
      __name(getAllKeysIn, "getAllKeysIn");
      getAllKeysIn_default = getAllKeysIn;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js
  var DataView2, DataView_default;
  var init_DataView = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js"() {
      "use strict";
      init_getNative();
      init_root();
      DataView2 = getNative_default(root_default, "DataView");
      DataView_default = DataView2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js
  var Promise2, Promise_default;
  var init_Promise = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js"() {
      "use strict";
      init_getNative();
      init_root();
      Promise2 = getNative_default(root_default, "Promise");
      Promise_default = Promise2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Set.js
  var Set2, Set_default;
  var init_Set = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Set.js"() {
      "use strict";
      init_getNative();
      init_root();
      Set2 = getNative_default(root_default, "Set");
      Set_default = Set2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js
  var mapTag2, objectTag3, promiseTag, setTag2, weakMapTag2, dataViewTag2, dataViewCtorString, mapCtorString, promiseCtorString, setCtorString, weakMapCtorString, getTag, getTag_default;
  var init_getTag = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js"() {
      "use strict";
      init_DataView();
      init_Map();
      init_Promise();
      init_Set();
      init_WeakMap();
      init_baseGetTag();
      init_toSource();
      mapTag2 = "[object Map]";
      objectTag3 = "[object Object]";
      promiseTag = "[object Promise]";
      setTag2 = "[object Set]";
      weakMapTag2 = "[object WeakMap]";
      dataViewTag2 = "[object DataView]";
      dataViewCtorString = toSource_default(DataView_default);
      mapCtorString = toSource_default(Map_default);
      promiseCtorString = toSource_default(Promise_default);
      setCtorString = toSource_default(Set_default);
      weakMapCtorString = toSource_default(WeakMap_default);
      getTag = baseGetTag_default;
      if (DataView_default && getTag(new DataView_default(new ArrayBuffer(1))) != dataViewTag2 || Map_default && getTag(new Map_default()) != mapTag2 || Promise_default && getTag(Promise_default.resolve()) != promiseTag || Set_default && getTag(new Set_default()) != setTag2 || WeakMap_default && getTag(new WeakMap_default()) != weakMapTag2) {
        getTag = /* @__PURE__ */ __name(function(value2) {
          var result = baseGetTag_default(value2), Ctor = result == objectTag3 ? value2.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
          if (ctorString) {
            switch (ctorString) {
              case dataViewCtorString:
                return dataViewTag2;
              case mapCtorString:
                return mapTag2;
              case promiseCtorString:
                return promiseTag;
              case setCtorString:
                return setTag2;
              case weakMapCtorString:
                return weakMapTag2;
            }
          }
          return result;
        }, "getTag");
      }
      getTag_default = getTag;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js
  function initCloneArray(array4) {
    var length2 = array4.length, result = new array4.constructor(length2);
    if (length2 && typeof array4[0] == "string" && hasOwnProperty12.call(array4, "index")) {
      result.index = array4.index;
      result.input = array4.input;
    }
    return result;
  }
  var objectProto15, hasOwnProperty12, initCloneArray_default;
  var init_initCloneArray = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js"() {
      "use strict";
      objectProto15 = Object.prototype;
      hasOwnProperty12 = objectProto15.hasOwnProperty;
      __name(initCloneArray, "initCloneArray");
      initCloneArray_default = initCloneArray;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js
  function cloneDataView(dataView, isDeep) {
    var buffer = isDeep ? cloneArrayBuffer_default(dataView.buffer) : dataView.buffer;
    return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  }
  var cloneDataView_default;
  var init_cloneDataView = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js"() {
      "use strict";
      init_cloneArrayBuffer();
      __name(cloneDataView, "cloneDataView");
      cloneDataView_default = cloneDataView;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js
  function cloneRegExp(regexp) {
    var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
    result.lastIndex = regexp.lastIndex;
    return result;
  }
  var reFlags, cloneRegExp_default;
  var init_cloneRegExp = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js"() {
      "use strict";
      reFlags = /\w*$/;
      __name(cloneRegExp, "cloneRegExp");
      cloneRegExp_default = cloneRegExp;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js
  function cloneSymbol(symbol) {
    return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  }
  var symbolProto2, symbolValueOf, cloneSymbol_default;
  var init_cloneSymbol = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js"() {
      "use strict";
      init_Symbol();
      symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0;
      symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0;
      __name(cloneSymbol, "cloneSymbol");
      cloneSymbol_default = cloneSymbol;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js
  function initCloneByTag(object3, tag, isDeep) {
    var Ctor = object3.constructor;
    switch (tag) {
      case arrayBufferTag2:
        return cloneArrayBuffer_default(object3);
      case boolTag2:
      case dateTag2:
        return new Ctor(+object3);
      case dataViewTag3:
        return cloneDataView_default(object3, isDeep);
      case float32Tag2:
      case float64Tag2:
      case int8Tag2:
      case int16Tag2:
      case int32Tag2:
      case uint8Tag2:
      case uint8ClampedTag2:
      case uint16Tag2:
      case uint32Tag2:
        return cloneTypedArray_default(object3, isDeep);
      case mapTag3:
        return new Ctor();
      case numberTag2:
      case stringTag2:
        return new Ctor(object3);
      case regexpTag2:
        return cloneRegExp_default(object3);
      case setTag3:
        return new Ctor();
      case symbolTag2:
        return cloneSymbol_default(object3);
    }
  }
  var boolTag2, dateTag2, mapTag3, numberTag2, regexpTag2, setTag3, stringTag2, symbolTag2, arrayBufferTag2, dataViewTag3, float32Tag2, float64Tag2, int8Tag2, int16Tag2, int32Tag2, uint8Tag2, uint8ClampedTag2, uint16Tag2, uint32Tag2, initCloneByTag_default;
  var init_initCloneByTag = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js"() {
      "use strict";
      init_cloneArrayBuffer();
      init_cloneDataView();
      init_cloneRegExp();
      init_cloneSymbol();
      init_cloneTypedArray();
      boolTag2 = "[object Boolean]";
      dateTag2 = "[object Date]";
      mapTag3 = "[object Map]";
      numberTag2 = "[object Number]";
      regexpTag2 = "[object RegExp]";
      setTag3 = "[object Set]";
      stringTag2 = "[object String]";
      symbolTag2 = "[object Symbol]";
      arrayBufferTag2 = "[object ArrayBuffer]";
      dataViewTag3 = "[object DataView]";
      float32Tag2 = "[object Float32Array]";
      float64Tag2 = "[object Float64Array]";
      int8Tag2 = "[object Int8Array]";
      int16Tag2 = "[object Int16Array]";
      int32Tag2 = "[object Int32Array]";
      uint8Tag2 = "[object Uint8Array]";
      uint8ClampedTag2 = "[object Uint8ClampedArray]";
      uint16Tag2 = "[object Uint16Array]";
      uint32Tag2 = "[object Uint32Array]";
      __name(initCloneByTag, "initCloneByTag");
      initCloneByTag_default = initCloneByTag;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js
  function baseIsMap(value2) {
    return isObjectLike_default(value2) && getTag_default(value2) == mapTag4;
  }
  var mapTag4, baseIsMap_default;
  var init_baseIsMap = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js"() {
      "use strict";
      init_getTag();
      init_isObjectLike();
      mapTag4 = "[object Map]";
      __name(baseIsMap, "baseIsMap");
      baseIsMap_default = baseIsMap;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isMap.js
  var nodeIsMap, isMap, isMap_default;
  var init_isMap = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isMap.js"() {
      "use strict";
      init_baseIsMap();
      init_baseUnary();
      init_nodeUtil();
      nodeIsMap = nodeUtil_default && nodeUtil_default.isMap;
      isMap = nodeIsMap ? baseUnary_default(nodeIsMap) : baseIsMap_default;
      isMap_default = isMap;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js
  function baseIsSet(value2) {
    return isObjectLike_default(value2) && getTag_default(value2) == setTag4;
  }
  var setTag4, baseIsSet_default;
  var init_baseIsSet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js"() {
      "use strict";
      init_getTag();
      init_isObjectLike();
      setTag4 = "[object Set]";
      __name(baseIsSet, "baseIsSet");
      baseIsSet_default = baseIsSet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSet.js
  var nodeIsSet, isSet, isSet_default;
  var init_isSet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSet.js"() {
      "use strict";
      init_baseIsSet();
      init_baseUnary();
      init_nodeUtil();
      nodeIsSet = nodeUtil_default && nodeUtil_default.isSet;
      isSet = nodeIsSet ? baseUnary_default(nodeIsSet) : baseIsSet_default;
      isSet_default = isSet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js
  function baseClone(value2, bitmask, customizer, key, object3, stack) {
    var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
    if (customizer) {
      result = object3 ? customizer(value2, key, object3, stack) : customizer(value2);
    }
    if (result !== void 0) {
      return result;
    }
    if (!isObject_default(value2)) {
      return value2;
    }
    var isArr = isArray_default(value2);
    if (isArr) {
      result = initCloneArray_default(value2);
      if (!isDeep) {
        return copyArray_default(value2, result);
      }
    } else {
      var tag = getTag_default(value2), isFunc = tag == funcTag3 || tag == genTag2;
      if (isBuffer_default(value2)) {
        return cloneBuffer_default(value2, isDeep);
      }
      if (tag == objectTag4 || tag == argsTag3 || isFunc && !object3) {
        result = isFlat || isFunc ? {} : initCloneObject_default(value2);
        if (!isDeep) {
          return isFlat ? copySymbolsIn_default(value2, baseAssignIn_default(result, value2)) : copySymbols_default(value2, baseAssign_default(result, value2));
        }
      } else {
        if (!cloneableTags[tag]) {
          return object3 ? value2 : {};
        }
        result = initCloneByTag_default(value2, tag, isDeep);
      }
    }
    stack || (stack = new Stack_default());
    var stacked = stack.get(value2);
    if (stacked) {
      return stacked;
    }
    stack.set(value2, result);
    if (isSet_default(value2)) {
      value2.forEach(function(subValue) {
        result.add(baseClone(subValue, bitmask, customizer, subValue, value2, stack));
      });
    } else if (isMap_default(value2)) {
      value2.forEach(function(subValue, key2) {
        result.set(key2, baseClone(subValue, bitmask, customizer, key2, value2, stack));
      });
    }
    var keysFunc = isFull ? isFlat ? getAllKeysIn_default : getAllKeys_default : isFlat ? keysIn_default : keys_default;
    var props = isArr ? void 0 : keysFunc(value2);
    arrayEach_default(props || value2, function(subValue, key2) {
      if (props) {
        key2 = subValue;
        subValue = value2[key2];
      }
      assignValue_default(result, key2, baseClone(subValue, bitmask, customizer, key2, value2, stack));
    });
    return result;
  }
  var CLONE_DEEP_FLAG, CLONE_FLAT_FLAG, CLONE_SYMBOLS_FLAG, argsTag3, arrayTag2, boolTag3, dateTag3, errorTag2, funcTag3, genTag2, mapTag5, numberTag3, objectTag4, regexpTag3, setTag5, stringTag3, symbolTag3, weakMapTag3, arrayBufferTag3, dataViewTag4, float32Tag3, float64Tag3, int8Tag3, int16Tag3, int32Tag3, uint8Tag3, uint8ClampedTag3, uint16Tag3, uint32Tag3, cloneableTags, baseClone_default;
  var init_baseClone = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js"() {
      "use strict";
      init_Stack();
      init_arrayEach();
      init_assignValue();
      init_baseAssign();
      init_baseAssignIn();
      init_cloneBuffer();
      init_copyArray();
      init_copySymbols();
      init_copySymbolsIn();
      init_getAllKeys();
      init_getAllKeysIn();
      init_getTag();
      init_initCloneArray();
      init_initCloneByTag();
      init_initCloneObject();
      init_isArray();
      init_isBuffer();
      init_isMap();
      init_isObject();
      init_isSet();
      init_keys();
      init_keysIn();
      CLONE_DEEP_FLAG = 1;
      CLONE_FLAT_FLAG = 2;
      CLONE_SYMBOLS_FLAG = 4;
      argsTag3 = "[object Arguments]";
      arrayTag2 = "[object Array]";
      boolTag3 = "[object Boolean]";
      dateTag3 = "[object Date]";
      errorTag2 = "[object Error]";
      funcTag3 = "[object Function]";
      genTag2 = "[object GeneratorFunction]";
      mapTag5 = "[object Map]";
      numberTag3 = "[object Number]";
      objectTag4 = "[object Object]";
      regexpTag3 = "[object RegExp]";
      setTag5 = "[object Set]";
      stringTag3 = "[object String]";
      symbolTag3 = "[object Symbol]";
      weakMapTag3 = "[object WeakMap]";
      arrayBufferTag3 = "[object ArrayBuffer]";
      dataViewTag4 = "[object DataView]";
      float32Tag3 = "[object Float32Array]";
      float64Tag3 = "[object Float64Array]";
      int8Tag3 = "[object Int8Array]";
      int16Tag3 = "[object Int16Array]";
      int32Tag3 = "[object Int32Array]";
      uint8Tag3 = "[object Uint8Array]";
      uint8ClampedTag3 = "[object Uint8ClampedArray]";
      uint16Tag3 = "[object Uint16Array]";
      uint32Tag3 = "[object Uint32Array]";
      cloneableTags = {};
      cloneableTags[argsTag3] = cloneableTags[arrayTag2] = cloneableTags[arrayBufferTag3] = cloneableTags[dataViewTag4] = cloneableTags[boolTag3] = cloneableTags[dateTag3] = cloneableTags[float32Tag3] = cloneableTags[float64Tag3] = cloneableTags[int8Tag3] = cloneableTags[int16Tag3] = cloneableTags[int32Tag3] = cloneableTags[mapTag5] = cloneableTags[numberTag3] = cloneableTags[objectTag4] = cloneableTags[regexpTag3] = cloneableTags[setTag5] = cloneableTags[stringTag3] = cloneableTags[symbolTag3] = cloneableTags[uint8Tag3] = cloneableTags[uint8ClampedTag3] = cloneableTags[uint16Tag3] = cloneableTags[uint32Tag3] = true;
      cloneableTags[errorTag2] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
      __name(baseClone, "baseClone");
      baseClone_default = baseClone;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/clone.js
  function clone2(value2) {
    return baseClone_default(value2, CLONE_SYMBOLS_FLAG2);
  }
  var CLONE_SYMBOLS_FLAG2, clone_default2;
  var init_clone2 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/clone.js"() {
      "use strict";
      init_baseClone();
      CLONE_SYMBOLS_FLAG2 = 4;
      __name(clone2, "clone");
      clone_default2 = clone2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js
  function cloneDeep(value2) {
    return baseClone_default(value2, CLONE_DEEP_FLAG2 | CLONE_SYMBOLS_FLAG3);
  }
  var CLONE_DEEP_FLAG2, CLONE_SYMBOLS_FLAG3, cloneDeep_default;
  var init_cloneDeep = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js"() {
      "use strict";
      init_baseClone();
      CLONE_DEEP_FLAG2 = 1;
      CLONE_SYMBOLS_FLAG3 = 4;
      __name(cloneDeep, "cloneDeep");
      cloneDeep_default = cloneDeep;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/compact.js
  function compact(array4) {
    var index = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
    while (++index < length2) {
      var value2 = array4[index];
      if (value2) {
        result[resIndex++] = value2;
      }
    }
    return result;
  }
  var compact_default;
  var init_compact = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/compact.js"() {
      "use strict";
      __name(compact, "compact");
      compact_default = compact;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js
  function setCacheAdd(value2) {
    this.__data__.set(value2, HASH_UNDEFINED3);
    return this;
  }
  var HASH_UNDEFINED3, setCacheAdd_default;
  var init_setCacheAdd = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js"() {
      "use strict";
      HASH_UNDEFINED3 = "__lodash_hash_undefined__";
      __name(setCacheAdd, "setCacheAdd");
      setCacheAdd_default = setCacheAdd;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js
  function setCacheHas(value2) {
    return this.__data__.has(value2);
  }
  var setCacheHas_default;
  var init_setCacheHas = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js"() {
      "use strict";
      __name(setCacheHas, "setCacheHas");
      setCacheHas_default = setCacheHas;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js
  function SetCache(values2) {
    var index = -1, length2 = values2 == null ? 0 : values2.length;
    this.__data__ = new MapCache_default();
    while (++index < length2) {
      this.add(values2[index]);
    }
  }
  var SetCache_default;
  var init_SetCache = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js"() {
      "use strict";
      init_MapCache();
      init_setCacheAdd();
      init_setCacheHas();
      __name(SetCache, "SetCache");
      SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default;
      SetCache.prototype.has = setCacheHas_default;
      SetCache_default = SetCache;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js
  function arraySome(array4, predicate) {
    var index = -1, length2 = array4 == null ? 0 : array4.length;
    while (++index < length2) {
      if (predicate(array4[index], index, array4)) {
        return true;
      }
    }
    return false;
  }
  var arraySome_default;
  var init_arraySome = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js"() {
      "use strict";
      __name(arraySome, "arraySome");
      arraySome_default = arraySome;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js
  function cacheHas(cache3, key) {
    return cache3.has(key);
  }
  var cacheHas_default;
  var init_cacheHas = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js"() {
      "use strict";
      __name(cacheHas, "cacheHas");
      cacheHas_default = cacheHas;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js
  function equalArrays(array4, other, bitmask, customizer, equalFunc, stack) {
    var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array4.length, othLength = other.length;
    if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
      return false;
    }
    var arrStacked = stack.get(array4);
    var othStacked = stack.get(other);
    if (arrStacked && othStacked) {
      return arrStacked == other && othStacked == array4;
    }
    var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0;
    stack.set(array4, other);
    stack.set(other, array4);
    while (++index < arrLength) {
      var arrValue = array4[index], othValue = other[index];
      if (customizer) {
        var compared = isPartial ? customizer(othValue, arrValue, index, other, array4, stack) : customizer(arrValue, othValue, index, array4, other, stack);
      }
      if (compared !== void 0) {
        if (compared) {
          continue;
        }
        result = false;
        break;
      }
      if (seen) {
        if (!arraySome_default(other, function(othValue2, othIndex) {
          if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
            return seen.push(othIndex);
          }
        })) {
          result = false;
          break;
        }
      } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
        result = false;
        break;
      }
    }
    stack["delete"](array4);
    stack["delete"](other);
    return result;
  }
  var COMPARE_PARTIAL_FLAG, COMPARE_UNORDERED_FLAG, equalArrays_default;
  var init_equalArrays = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js"() {
      "use strict";
      init_SetCache();
      init_arraySome();
      init_cacheHas();
      COMPARE_PARTIAL_FLAG = 1;
      COMPARE_UNORDERED_FLAG = 2;
      __name(equalArrays, "equalArrays");
      equalArrays_default = equalArrays;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js
  function mapToArray(map5) {
    var index = -1, result = Array(map5.size);
    map5.forEach(function(value2, key) {
      result[++index] = [key, value2];
    });
    return result;
  }
  var mapToArray_default;
  var init_mapToArray = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js"() {
      "use strict";
      __name(mapToArray, "mapToArray");
      mapToArray_default = mapToArray;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js
  function setToArray(set5) {
    var index = -1, result = Array(set5.size);
    set5.forEach(function(value2) {
      result[++index] = value2;
    });
    return result;
  }
  var setToArray_default;
  var init_setToArray = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js"() {
      "use strict";
      __name(setToArray, "setToArray");
      setToArray_default = setToArray;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js
  function equalByTag(object3, other, tag, bitmask, customizer, equalFunc, stack) {
    switch (tag) {
      case dataViewTag5:
        if (object3.byteLength != other.byteLength || object3.byteOffset != other.byteOffset) {
          return false;
        }
        object3 = object3.buffer;
        other = other.buffer;
      case arrayBufferTag4:
        if (object3.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object3), new Uint8Array_default(other))) {
          return false;
        }
        return true;
      case boolTag4:
      case dateTag4:
      case numberTag4:
        return eq_default(+object3, +other);
      case errorTag3:
        return object3.name == other.name && object3.message == other.message;
      case regexpTag4:
      case stringTag4:
        return object3 == other + "";
      case mapTag6:
        var convert = mapToArray_default;
      case setTag6:
        var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
        convert || (convert = setToArray_default);
        if (object3.size != other.size && !isPartial) {
          return false;
        }
        var stacked = stack.get(object3);
        if (stacked) {
          return stacked == other;
        }
        bitmask |= COMPARE_UNORDERED_FLAG2;
        stack.set(object3, other);
        var result = equalArrays_default(convert(object3), convert(other), bitmask, customizer, equalFunc, stack);
        stack["delete"](object3);
        return result;
      case symbolTag4:
        if (symbolValueOf2) {
          return symbolValueOf2.call(object3) == symbolValueOf2.call(other);
        }
    }
    return false;
  }
  var COMPARE_PARTIAL_FLAG2, COMPARE_UNORDERED_FLAG2, boolTag4, dateTag4, errorTag3, mapTag6, numberTag4, regexpTag4, setTag6, stringTag4, symbolTag4, arrayBufferTag4, dataViewTag5, symbolProto3, symbolValueOf2, equalByTag_default;
  var init_equalByTag = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js"() {
      "use strict";
      init_Symbol();
      init_Uint8Array();
      init_eq();
      init_equalArrays();
      init_mapToArray();
      init_setToArray();
      COMPARE_PARTIAL_FLAG2 = 1;
      COMPARE_UNORDERED_FLAG2 = 2;
      boolTag4 = "[object Boolean]";
      dateTag4 = "[object Date]";
      errorTag3 = "[object Error]";
      mapTag6 = "[object Map]";
      numberTag4 = "[object Number]";
      regexpTag4 = "[object RegExp]";
      setTag6 = "[object Set]";
      stringTag4 = "[object String]";
      symbolTag4 = "[object Symbol]";
      arrayBufferTag4 = "[object ArrayBuffer]";
      dataViewTag5 = "[object DataView]";
      symbolProto3 = Symbol_default ? Symbol_default.prototype : void 0;
      symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : void 0;
      __name(equalByTag, "equalByTag");
      equalByTag_default = equalByTag;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js
  function equalObjects(object3, other, bitmask, customizer, equalFunc, stack) {
    var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object3), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length;
    if (objLength != othLength && !isPartial) {
      return false;
    }
    var index = objLength;
    while (index--) {
      var key = objProps[index];
      if (!(isPartial ? key in other : hasOwnProperty13.call(other, key))) {
        return false;
      }
    }
    var objStacked = stack.get(object3);
    var othStacked = stack.get(other);
    if (objStacked && othStacked) {
      return objStacked == other && othStacked == object3;
    }
    var result = true;
    stack.set(object3, other);
    stack.set(other, object3);
    var skipCtor = isPartial;
    while (++index < objLength) {
      key = objProps[index];
      var objValue = object3[key], othValue = other[key];
      if (customizer) {
        var compared = isPartial ? customizer(othValue, objValue, key, other, object3, stack) : customizer(objValue, othValue, key, object3, other, stack);
      }
      if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
        result = false;
        break;
      }
      skipCtor || (skipCtor = key == "constructor");
    }
    if (result && !skipCtor) {
      var objCtor = object3.constructor, othCtor = other.constructor;
      if (objCtor != othCtor && ("constructor" in object3 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
        result = false;
      }
    }
    stack["delete"](object3);
    stack["delete"](other);
    return result;
  }
  var COMPARE_PARTIAL_FLAG3, objectProto16, hasOwnProperty13, equalObjects_default;
  var init_equalObjects = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js"() {
      "use strict";
      init_getAllKeys();
      COMPARE_PARTIAL_FLAG3 = 1;
      objectProto16 = Object.prototype;
      hasOwnProperty13 = objectProto16.hasOwnProperty;
      __name(equalObjects, "equalObjects");
      equalObjects_default = equalObjects;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js
  function baseIsEqualDeep(object3, other, bitmask, customizer, equalFunc, stack) {
    var objIsArr = isArray_default(object3), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag3 : getTag_default(object3), othTag = othIsArr ? arrayTag3 : getTag_default(other);
    objTag = objTag == argsTag4 ? objectTag5 : objTag;
    othTag = othTag == argsTag4 ? objectTag5 : othTag;
    var objIsObj = objTag == objectTag5, othIsObj = othTag == objectTag5, isSameTag = objTag == othTag;
    if (isSameTag && isBuffer_default(object3)) {
      if (!isBuffer_default(other)) {
        return false;
      }
      objIsArr = true;
      objIsObj = false;
    }
    if (isSameTag && !objIsObj) {
      stack || (stack = new Stack_default());
      return objIsArr || isTypedArray_default(object3) ? equalArrays_default(object3, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object3, other, objTag, bitmask, customizer, equalFunc, stack);
    }
    if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
      var objIsWrapped = objIsObj && hasOwnProperty14.call(object3, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty14.call(other, "__wrapped__");
      if (objIsWrapped || othIsWrapped) {
        var objUnwrapped = objIsWrapped ? object3.value() : object3, othUnwrapped = othIsWrapped ? other.value() : other;
        stack || (stack = new Stack_default());
        return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
      }
    }
    if (!isSameTag) {
      return false;
    }
    stack || (stack = new Stack_default());
    return equalObjects_default(object3, other, bitmask, customizer, equalFunc, stack);
  }
  var COMPARE_PARTIAL_FLAG4, argsTag4, arrayTag3, objectTag5, objectProto17, hasOwnProperty14, baseIsEqualDeep_default;
  var init_baseIsEqualDeep = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js"() {
      "use strict";
      init_Stack();
      init_equalArrays();
      init_equalByTag();
      init_equalObjects();
      init_getTag();
      init_isArray();
      init_isBuffer();
      init_isTypedArray();
      COMPARE_PARTIAL_FLAG4 = 1;
      argsTag4 = "[object Arguments]";
      arrayTag3 = "[object Array]";
      objectTag5 = "[object Object]";
      objectProto17 = Object.prototype;
      hasOwnProperty14 = objectProto17.hasOwnProperty;
      __name(baseIsEqualDeep, "baseIsEqualDeep");
      baseIsEqualDeep_default = baseIsEqualDeep;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js
  function baseIsEqual(value2, other, bitmask, customizer, stack) {
    if (value2 === other) {
      return true;
    }
    if (value2 == null || other == null || !isObjectLike_default(value2) && !isObjectLike_default(other)) {
      return value2 !== value2 && other !== other;
    }
    return baseIsEqualDeep_default(value2, other, bitmask, customizer, baseIsEqual, stack);
  }
  var baseIsEqual_default;
  var init_baseIsEqual = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js"() {
      "use strict";
      init_baseIsEqualDeep();
      init_isObjectLike();
      __name(baseIsEqual, "baseIsEqual");
      baseIsEqual_default = baseIsEqual;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMatch.js
  function baseIsMatch(object3, source, matchData, customizer) {
    var index = matchData.length, length2 = index, noCustomizer = !customizer;
    if (object3 == null) {
      return !length2;
    }
    object3 = Object(object3);
    while (index--) {
      var data5 = matchData[index];
      if (noCustomizer && data5[2] ? data5[1] !== object3[data5[0]] : !(data5[0] in object3)) {
        return false;
      }
    }
    while (++index < length2) {
      data5 = matchData[index];
      var key = data5[0], objValue = object3[key], srcValue = data5[1];
      if (noCustomizer && data5[2]) {
        if (objValue === void 0 && !(key in object3)) {
          return false;
        }
      } else {
        var stack = new Stack_default();
        if (customizer) {
          var result = customizer(objValue, srcValue, key, object3, source, stack);
        }
        if (!(result === void 0 ? baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result)) {
          return false;
        }
      }
    }
    return true;
  }
  var COMPARE_PARTIAL_FLAG5, COMPARE_UNORDERED_FLAG3, baseIsMatch_default;
  var init_baseIsMatch = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMatch.js"() {
      "use strict";
      init_Stack();
      init_baseIsEqual();
      COMPARE_PARTIAL_FLAG5 = 1;
      COMPARE_UNORDERED_FLAG3 = 2;
      __name(baseIsMatch, "baseIsMatch");
      baseIsMatch_default = baseIsMatch;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isStrictComparable.js
  function isStrictComparable(value2) {
    return value2 === value2 && !isObject_default(value2);
  }
  var isStrictComparable_default;
  var init_isStrictComparable = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isStrictComparable.js"() {
      "use strict";
      init_isObject();
      __name(isStrictComparable, "isStrictComparable");
      isStrictComparable_default = isStrictComparable;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getMatchData.js
  function getMatchData(object3) {
    var result = keys_default(object3), length2 = result.length;
    while (length2--) {
      var key = result[length2], value2 = object3[key];
      result[length2] = [key, value2, isStrictComparable_default(value2)];
    }
    return result;
  }
  var getMatchData_default;
  var init_getMatchData = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getMatchData.js"() {
      "use strict";
      init_isStrictComparable();
      init_keys();
      __name(getMatchData, "getMatchData");
      getMatchData_default = getMatchData;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_matchesStrictComparable.js
  function matchesStrictComparable(key, srcValue) {
    return function(object3) {
      if (object3 == null) {
        return false;
      }
      return object3[key] === srcValue && (srcValue !== void 0 || key in Object(object3));
    };
  }
  var matchesStrictComparable_default;
  var init_matchesStrictComparable = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_matchesStrictComparable.js"() {
      "use strict";
      __name(matchesStrictComparable, "matchesStrictComparable");
      matchesStrictComparable_default = matchesStrictComparable;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMatches.js
  function baseMatches(source) {
    var matchData = getMatchData_default(source);
    if (matchData.length == 1 && matchData[0][2]) {
      return matchesStrictComparable_default(matchData[0][0], matchData[0][1]);
    }
    return function(object3) {
      return object3 === source || baseIsMatch_default(object3, source, matchData);
    };
  }
  var baseMatches_default;
  var init_baseMatches = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMatches.js"() {
      "use strict";
      init_baseIsMatch();
      init_getMatchData();
      init_matchesStrictComparable();
      __name(baseMatches, "baseMatches");
      baseMatches_default = baseMatches;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseHasIn.js
  function baseHasIn(object3, key) {
    return object3 != null && key in Object(object3);
  }
  var baseHasIn_default;
  var init_baseHasIn = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseHasIn.js"() {
      "use strict";
      __name(baseHasIn, "baseHasIn");
      baseHasIn_default = baseHasIn;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hasPath.js
  function hasPath(object3, path4, hasFunc) {
    path4 = castPath_default(path4, object3);
    var index = -1, length2 = path4.length, result = false;
    while (++index < length2) {
      var key = toKey_default(path4[index]);
      if (!(result = object3 != null && hasFunc(object3, key))) {
        break;
      }
      object3 = object3[key];
    }
    if (result || ++index != length2) {
      return result;
    }
    length2 = object3 == null ? 0 : object3.length;
    return !!length2 && isLength_default(length2) && isIndex_default(key, length2) && (isArray_default(object3) || isArguments_default(object3));
  }
  var hasPath_default;
  var init_hasPath = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hasPath.js"() {
      "use strict";
      init_castPath();
      init_isArguments();
      init_isArray();
      init_isIndex();
      init_isLength();
      init_toKey();
      __name(hasPath, "hasPath");
      hasPath_default = hasPath;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/hasIn.js
  function hasIn(object3, path4) {
    return object3 != null && hasPath_default(object3, path4, baseHasIn_default);
  }
  var hasIn_default;
  var init_hasIn = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/hasIn.js"() {
      "use strict";
      init_baseHasIn();
      init_hasPath();
      __name(hasIn, "hasIn");
      hasIn_default = hasIn;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMatchesProperty.js
  function baseMatchesProperty(path4, srcValue) {
    if (isKey_default(path4) && isStrictComparable_default(srcValue)) {
      return matchesStrictComparable_default(toKey_default(path4), srcValue);
    }
    return function(object3) {
      var objValue = get_default(object3, path4);
      return objValue === void 0 && objValue === srcValue ? hasIn_default(object3, path4) : baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG6 | COMPARE_UNORDERED_FLAG4);
    };
  }
  var COMPARE_PARTIAL_FLAG6, COMPARE_UNORDERED_FLAG4, baseMatchesProperty_default;
  var init_baseMatchesProperty = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMatchesProperty.js"() {
      "use strict";
      init_baseIsEqual();
      init_get();
      init_hasIn();
      init_isKey();
      init_isStrictComparable();
      init_matchesStrictComparable();
      init_toKey();
      COMPARE_PARTIAL_FLAG6 = 1;
      COMPARE_UNORDERED_FLAG4 = 2;
      __name(baseMatchesProperty, "baseMatchesProperty");
      baseMatchesProperty_default = baseMatchesProperty;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseProperty.js
  function baseProperty(key) {
    return function(object3) {
      return object3 == null ? void 0 : object3[key];
    };
  }
  var baseProperty_default;
  var init_baseProperty = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseProperty.js"() {
      "use strict";
      __name(baseProperty, "baseProperty");
      baseProperty_default = baseProperty;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_basePropertyDeep.js
  function basePropertyDeep(path4) {
    return function(object3) {
      return baseGet_default(object3, path4);
    };
  }
  var basePropertyDeep_default;
  var init_basePropertyDeep = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_basePropertyDeep.js"() {
      "use strict";
      init_baseGet();
      __name(basePropertyDeep, "basePropertyDeep");
      basePropertyDeep_default = basePropertyDeep;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/property.js
  function property(path4) {
    return isKey_default(path4) ? baseProperty_default(toKey_default(path4)) : basePropertyDeep_default(path4);
  }
  var property_default2;
  var init_property2 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/property.js"() {
      "use strict";
      init_baseProperty();
      init_basePropertyDeep();
      init_isKey();
      init_toKey();
      __name(property, "property");
      property_default2 = property;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIteratee.js
  function baseIteratee(value2) {
    if (typeof value2 == "function") {
      return value2;
    }
    if (value2 == null) {
      return identity_default4;
    }
    if (typeof value2 == "object") {
      return isArray_default(value2) ? baseMatchesProperty_default(value2[0], value2[1]) : baseMatches_default(value2);
    }
    return property_default2(value2);
  }
  var baseIteratee_default;
  var init_baseIteratee = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIteratee.js"() {
      "use strict";
      init_baseMatches();
      init_baseMatchesProperty();
      init_identity4();
      init_isArray();
      init_property2();
      __name(baseIteratee, "baseIteratee");
      baseIteratee_default = baseIteratee;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayAggregator.js
  function arrayAggregator(array4, setter, iteratee, accumulator) {
    var index = -1, length2 = array4 == null ? 0 : array4.length;
    while (++index < length2) {
      var value2 = array4[index];
      setter(accumulator, value2, iteratee(value2), array4);
    }
    return accumulator;
  }
  var arrayAggregator_default;
  var init_arrayAggregator = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayAggregator.js"() {
      "use strict";
      __name(arrayAggregator, "arrayAggregator");
      arrayAggregator_default = arrayAggregator;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseForOwn.js
  function baseForOwn(object3, iteratee) {
    return object3 && baseFor_default(object3, iteratee, keys_default);
  }
  var baseForOwn_default;
  var init_baseForOwn = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseForOwn.js"() {
      "use strict";
      init_baseFor();
      init_keys();
      __name(baseForOwn, "baseForOwn");
      baseForOwn_default = baseForOwn;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createBaseEach.js
  function createBaseEach(eachFunc, fromRight) {
    return function(collection4, iteratee) {
      if (collection4 == null) {
        return collection4;
      }
      if (!isArrayLike_default(collection4)) {
        return eachFunc(collection4, iteratee);
      }
      var length2 = collection4.length, index = fromRight ? length2 : -1, iterable = Object(collection4);
      while (fromRight ? index-- : ++index < length2) {
        if (iteratee(iterable[index], index, iterable) === false) {
          break;
        }
      }
      return collection4;
    };
  }
  var createBaseEach_default;
  var init_createBaseEach = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createBaseEach.js"() {
      "use strict";
      init_isArrayLike();
      __name(createBaseEach, "createBaseEach");
      createBaseEach_default = createBaseEach;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseEach.js
  var baseEach, baseEach_default;
  var init_baseEach = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseEach.js"() {
      "use strict";
      init_baseForOwn();
      init_createBaseEach();
      baseEach = createBaseEach_default(baseForOwn_default);
      baseEach_default = baseEach;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAggregator.js
  function baseAggregator(collection4, setter, iteratee, accumulator) {
    baseEach_default(collection4, function(value2, key, collection5) {
      setter(accumulator, value2, iteratee(value2), collection5);
    });
    return accumulator;
  }
  var baseAggregator_default;
  var init_baseAggregator = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAggregator.js"() {
      "use strict";
      init_baseEach();
      __name(baseAggregator, "baseAggregator");
      baseAggregator_default = baseAggregator;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createAggregator.js
  function createAggregator(setter, initializer) {
    return function(collection4, iteratee) {
      var func = isArray_default(collection4) ? arrayAggregator_default : baseAggregator_default, accumulator = initializer ? initializer() : {};
      return func(collection4, setter, baseIteratee_default(iteratee, 2), accumulator);
    };
  }
  var createAggregator_default;
  var init_createAggregator = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createAggregator.js"() {
      "use strict";
      init_arrayAggregator();
      init_baseAggregator();
      init_baseIteratee();
      init_isArray();
      __name(createAggregator, "createAggregator");
      createAggregator_default = createAggregator;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/now.js
  var now2, now_default;
  var init_now = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/now.js"() {
      "use strict";
      init_root();
      now2 = /* @__PURE__ */ __name(function() {
        return root_default.Date.now();
      }, "now");
      now_default = now2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/defaults.js
  var objectProto18, hasOwnProperty15, defaults, defaults_default;
  var init_defaults3 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/defaults.js"() {
      "use strict";
      init_baseRest();
      init_eq();
      init_isIterateeCall();
      init_keysIn();
      objectProto18 = Object.prototype;
      hasOwnProperty15 = objectProto18.hasOwnProperty;
      defaults = baseRest_default(function(object3, sources) {
        object3 = Object(object3);
        var index = -1;
        var length2 = sources.length;
        var guard = length2 > 2 ? sources[2] : void 0;
        if (guard && isIterateeCall_default(sources[0], sources[1], guard)) {
          length2 = 1;
        }
        while (++index < length2) {
          var source = sources[index];
          var props = keysIn_default(source);
          var propsIndex = -1;
          var propsLength = props.length;
          while (++propsIndex < propsLength) {
            var key = props[propsIndex];
            var value2 = object3[key];
            if (value2 === void 0 || eq_default(value2, objectProto18[key]) && !hasOwnProperty15.call(object3, key)) {
              object3[key] = source[key];
            }
          }
        }
        return object3;
      });
      defaults_default = defaults;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludesWith.js
  function arrayIncludesWith(array4, value2, comparator) {
    var index = -1, length2 = array4 == null ? 0 : array4.length;
    while (++index < length2) {
      if (comparator(value2, array4[index])) {
        return true;
      }
    }
    return false;
  }
  var arrayIncludesWith_default;
  var init_arrayIncludesWith = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludesWith.js"() {
      "use strict";
      __name(arrayIncludesWith, "arrayIncludesWith");
      arrayIncludesWith_default = arrayIncludesWith;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseDifference.js
  function baseDifference(array4, values2, iteratee, comparator) {
    var index = -1, includes3 = arrayIncludes_default, isCommon = true, length2 = array4.length, result = [], valuesLength = values2.length;
    if (!length2) {
      return result;
    }
    if (iteratee) {
      values2 = arrayMap_default(values2, baseUnary_default(iteratee));
    }
    if (comparator) {
      includes3 = arrayIncludesWith_default;
      isCommon = false;
    } else if (values2.length >= LARGE_ARRAY_SIZE2) {
      includes3 = cacheHas_default;
      isCommon = false;
      values2 = new SetCache_default(values2);
    }
    outer:
      while (++index < length2) {
        var value2 = array4[index], computed = iteratee == null ? value2 : iteratee(value2);
        value2 = comparator || value2 !== 0 ? value2 : 0;
        if (isCommon && computed === computed) {
          var valuesIndex = valuesLength;
          while (valuesIndex--) {
            if (values2[valuesIndex] === computed) {
              continue outer;
            }
          }
          result.push(value2);
        } else if (!includes3(values2, computed, comparator)) {
          result.push(value2);
        }
      }
    return result;
  }
  var LARGE_ARRAY_SIZE2, baseDifference_default;
  var init_baseDifference = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseDifference.js"() {
      "use strict";
      init_SetCache();
      init_arrayIncludes();
      init_arrayIncludesWith();
      init_arrayMap();
      init_baseUnary();
      init_cacheHas();
      LARGE_ARRAY_SIZE2 = 200;
      __name(baseDifference, "baseDifference");
      baseDifference_default = baseDifference;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/difference.js
  var difference, difference_default;
  var init_difference = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/difference.js"() {
      "use strict";
      init_baseDifference();
      init_baseFlatten();
      init_baseRest();
      init_isArrayLikeObject();
      difference = baseRest_default(function(array4, values2) {
        return isArrayLikeObject_default(array4) ? baseDifference_default(array4, baseFlatten_default(values2, 1, isArrayLikeObject_default, true)) : [];
      });
      difference_default = difference;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/last.js
  function last(array4) {
    var length2 = array4 == null ? 0 : array4.length;
    return length2 ? array4[length2 - 1] : void 0;
  }
  var last_default;
  var init_last = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/last.js"() {
      "use strict";
      __name(last, "last");
      last_default = last;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/drop.js
  function drop(array4, n2, guard) {
    var length2 = array4 == null ? 0 : array4.length;
    if (!length2) {
      return [];
    }
    n2 = guard || n2 === void 0 ? 1 : toInteger_default(n2);
    return baseSlice_default(array4, n2 < 0 ? 0 : n2, length2);
  }
  var drop_default;
  var init_drop = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/drop.js"() {
      "use strict";
      init_baseSlice();
      init_toInteger();
      __name(drop, "drop");
      drop_default = drop;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/dropRight.js
  function dropRight(array4, n2, guard) {
    var length2 = array4 == null ? 0 : array4.length;
    if (!length2) {
      return [];
    }
    n2 = guard || n2 === void 0 ? 1 : toInteger_default(n2);
    n2 = length2 - n2;
    return baseSlice_default(array4, 0, n2 < 0 ? 0 : n2);
  }
  var dropRight_default;
  var init_dropRight = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/dropRight.js"() {
      "use strict";
      init_baseSlice();
      init_toInteger();
      __name(dropRight, "dropRight");
      dropRight_default = dropRight;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_castFunction.js
  function castFunction(value2) {
    return typeof value2 == "function" ? value2 : identity_default4;
  }
  var castFunction_default;
  var init_castFunction = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_castFunction.js"() {
      "use strict";
      init_identity4();
      __name(castFunction, "castFunction");
      castFunction_default = castFunction;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/forEach.js
  function forEach(collection4, iteratee) {
    var func = isArray_default(collection4) ? arrayEach_default : baseEach_default;
    return func(collection4, castFunction_default(iteratee));
  }
  var forEach_default;
  var init_forEach = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/forEach.js"() {
      "use strict";
      init_arrayEach();
      init_baseEach();
      init_castFunction();
      init_isArray();
      __name(forEach, "forEach");
      forEach_default = forEach;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/each.js
  var init_each3 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/each.js"() {
      "use strict";
      init_forEach();
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayEvery.js
  function arrayEvery(array4, predicate) {
    var index = -1, length2 = array4 == null ? 0 : array4.length;
    while (++index < length2) {
      if (!predicate(array4[index], index, array4)) {
        return false;
      }
    }
    return true;
  }
  var arrayEvery_default;
  var init_arrayEvery = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayEvery.js"() {
      "use strict";
      __name(arrayEvery, "arrayEvery");
      arrayEvery_default = arrayEvery;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseEvery.js
  function baseEvery(collection4, predicate) {
    var result = true;
    baseEach_default(collection4, function(value2, index, collection5) {
      result = !!predicate(value2, index, collection5);
      return result;
    });
    return result;
  }
  var baseEvery_default;
  var init_baseEvery = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseEvery.js"() {
      "use strict";
      init_baseEach();
      __name(baseEvery, "baseEvery");
      baseEvery_default = baseEvery;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/every.js
  function every(collection4, predicate, guard) {
    var func = isArray_default(collection4) ? arrayEvery_default : baseEvery_default;
    if (guard && isIterateeCall_default(collection4, predicate, guard)) {
      predicate = void 0;
    }
    return func(collection4, baseIteratee_default(predicate, 3));
  }
  var every_default;
  var init_every = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/every.js"() {
      "use strict";
      init_arrayEvery();
      init_baseEvery();
      init_baseIteratee();
      init_isArray();
      init_isIterateeCall();
      __name(every, "every");
      every_default = every;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseFilter.js
  function baseFilter(collection4, predicate) {
    var result = [];
    baseEach_default(collection4, function(value2, index, collection5) {
      if (predicate(value2, index, collection5)) {
        result.push(value2);
      }
    });
    return result;
  }
  var baseFilter_default;
  var init_baseFilter = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseFilter.js"() {
      "use strict";
      init_baseEach();
      __name(baseFilter, "baseFilter");
      baseFilter_default = baseFilter;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/filter.js
  function filter2(collection4, predicate) {
    var func = isArray_default(collection4) ? arrayFilter_default : baseFilter_default;
    return func(collection4, baseIteratee_default(predicate, 3));
  }
  var filter_default3;
  var init_filter3 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/filter.js"() {
      "use strict";
      init_arrayFilter();
      init_baseFilter();
      init_baseIteratee();
      init_isArray();
      __name(filter2, "filter");
      filter_default3 = filter2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createFind.js
  function createFind(findIndexFunc) {
    return function(collection4, predicate, fromIndex) {
      var iterable = Object(collection4);
      if (!isArrayLike_default(collection4)) {
        var iteratee = baseIteratee_default(predicate, 3);
        collection4 = keys_default(collection4);
        predicate = /* @__PURE__ */ __name(function(key) {
          return iteratee(iterable[key], key, iterable);
        }, "predicate");
      }
      var index = findIndexFunc(collection4, predicate, fromIndex);
      return index > -1 ? iterable[iteratee ? collection4[index] : index] : void 0;
    };
  }
  var createFind_default;
  var init_createFind = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createFind.js"() {
      "use strict";
      init_baseIteratee();
      init_isArrayLike();
      init_keys();
      __name(createFind, "createFind");
      createFind_default = createFind;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/findIndex.js
  function findIndex(array4, predicate, fromIndex) {
    var length2 = array4 == null ? 0 : array4.length;
    if (!length2) {
      return -1;
    }
    var index = fromIndex == null ? 0 : toInteger_default(fromIndex);
    if (index < 0) {
      index = nativeMax2(length2 + index, 0);
    }
    return baseFindIndex_default(array4, baseIteratee_default(predicate, 3), index);
  }
  var nativeMax2, findIndex_default;
  var init_findIndex = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/findIndex.js"() {
      "use strict";
      init_baseFindIndex();
      init_baseIteratee();
      init_toInteger();
      nativeMax2 = Math.max;
      __name(findIndex, "findIndex");
      findIndex_default = findIndex;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/find.js
  var find2, find_default2;
  var init_find2 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/find.js"() {
      "use strict";
      init_createFind();
      init_findIndex();
      find2 = createFind_default(findIndex_default);
      find_default2 = find2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/head.js
  function head(array4) {
    return array4 && array4.length ? array4[0] : void 0;
  }
  var head_default;
  var init_head = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/head.js"() {
      "use strict";
      __name(head, "head");
      head_default = head;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/first.js
  var init_first = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/first.js"() {
      "use strict";
      init_head();
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMap.js
  function baseMap(collection4, iteratee) {
    var index = -1, result = isArrayLike_default(collection4) ? Array(collection4.length) : [];
    baseEach_default(collection4, function(value2, key, collection5) {
      result[++index] = iteratee(value2, key, collection5);
    });
    return result;
  }
  var baseMap_default;
  var init_baseMap = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMap.js"() {
      "use strict";
      init_baseEach();
      init_isArrayLike();
      __name(baseMap, "baseMap");
      baseMap_default = baseMap;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/map.js
  function map3(collection4, iteratee) {
    var func = isArray_default(collection4) ? arrayMap_default : baseMap_default;
    return func(collection4, baseIteratee_default(iteratee, 3));
  }
  var map_default;
  var init_map = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/map.js"() {
      "use strict";
      init_arrayMap();
      init_baseIteratee();
      init_baseMap();
      init_isArray();
      __name(map3, "map");
      map_default = map3;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/flatMap.js
  function flatMap(collection4, iteratee) {
    return baseFlatten_default(map_default(collection4, iteratee), 1);
  }
  var flatMap_default;
  var init_flatMap = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/flatMap.js"() {
      "use strict";
      init_baseFlatten();
      init_map();
      __name(flatMap, "flatMap");
      flatMap_default = flatMap;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/forIn.js
  function forIn(object3, iteratee) {
    return object3 == null ? object3 : baseFor_default(object3, castFunction_default(iteratee), keysIn_default);
  }
  var forIn_default;
  var init_forIn = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/forIn.js"() {
      "use strict";
      init_baseFor();
      init_castFunction();
      init_keysIn();
      __name(forIn, "forIn");
      forIn_default = forIn;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/forOwn.js
  function forOwn(object3, iteratee) {
    return object3 && baseForOwn_default(object3, castFunction_default(iteratee));
  }
  var forOwn_default;
  var init_forOwn = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/forOwn.js"() {
      "use strict";
      init_baseForOwn();
      init_castFunction();
      __name(forOwn, "forOwn");
      forOwn_default = forOwn;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/groupBy.js
  var objectProto19, hasOwnProperty16, groupBy, groupBy_default;
  var init_groupBy = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/groupBy.js"() {
      "use strict";
      init_baseAssignValue();
      init_createAggregator();
      objectProto19 = Object.prototype;
      hasOwnProperty16 = objectProto19.hasOwnProperty;
      groupBy = createAggregator_default(function(result, value2, key) {
        if (hasOwnProperty16.call(result, key)) {
          result[key].push(value2);
        } else {
          baseAssignValue_default(result, key, [value2]);
        }
      });
      groupBy_default = groupBy;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGt.js
  function baseGt(value2, other) {
    return value2 > other;
  }
  var baseGt_default;
  var init_baseGt = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGt.js"() {
      "use strict";
      __name(baseGt, "baseGt");
      baseGt_default = baseGt;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseHas.js
  function baseHas(object3, key) {
    return object3 != null && hasOwnProperty17.call(object3, key);
  }
  var objectProto20, hasOwnProperty17, baseHas_default;
  var init_baseHas = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseHas.js"() {
      "use strict";
      objectProto20 = Object.prototype;
      hasOwnProperty17 = objectProto20.hasOwnProperty;
      __name(baseHas, "baseHas");
      baseHas_default = baseHas;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/has.js
  function has(object3, path4) {
    return object3 != null && hasPath_default(object3, path4, baseHas_default);
  }
  var has_default;
  var init_has = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/has.js"() {
      "use strict";
      init_baseHas();
      init_hasPath();
      __name(has, "has");
      has_default = has;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isString.js
  function isString(value2) {
    return typeof value2 == "string" || !isArray_default(value2) && isObjectLike_default(value2) && baseGetTag_default(value2) == stringTag5;
  }
  var stringTag5, isString_default;
  var init_isString = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isString.js"() {
      "use strict";
      init_baseGetTag();
      init_isArray();
      init_isObjectLike();
      stringTag5 = "[object String]";
      __name(isString, "isString");
      isString_default = isString;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseValues.js
  function baseValues(object3, props) {
    return arrayMap_default(props, function(key) {
      return object3[key];
    });
  }
  var baseValues_default;
  var init_baseValues = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseValues.js"() {
      "use strict";
      init_arrayMap();
      __name(baseValues, "baseValues");
      baseValues_default = baseValues;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/values.js
  function values(object3) {
    return object3 == null ? [] : baseValues_default(object3, keys_default(object3));
  }
  var values_default;
  var init_values = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/values.js"() {
      "use strict";
      init_baseValues();
      init_keys();
      __name(values, "values");
      values_default = values;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/includes.js
  function includes(collection4, value2, fromIndex, guard) {
    collection4 = isArrayLike_default(collection4) ? collection4 : values_default(collection4);
    fromIndex = fromIndex && !guard ? toInteger_default(fromIndex) : 0;
    var length2 = collection4.length;
    if (fromIndex < 0) {
      fromIndex = nativeMax3(length2 + fromIndex, 0);
    }
    return isString_default(collection4) ? fromIndex <= length2 && collection4.indexOf(value2, fromIndex) > -1 : !!length2 && baseIndexOf_default(collection4, value2, fromIndex) > -1;
  }
  var nativeMax3, includes_default;
  var init_includes = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/includes.js"() {
      "use strict";
      init_baseIndexOf();
      init_isArrayLike();
      init_isString();
      init_toInteger();
      init_values();
      nativeMax3 = Math.max;
      __name(includes, "includes");
      includes_default = includes;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/indexOf.js
  function indexOf(array4, value2, fromIndex) {
    var length2 = array4 == null ? 0 : array4.length;
    if (!length2) {
      return -1;
    }
    var index = fromIndex == null ? 0 : toInteger_default(fromIndex);
    if (index < 0) {
      index = nativeMax4(length2 + index, 0);
    }
    return baseIndexOf_default(array4, value2, index);
  }
  var nativeMax4, indexOf_default;
  var init_indexOf = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/indexOf.js"() {
      "use strict";
      init_baseIndexOf();
      init_toInteger();
      nativeMax4 = Math.max;
      __name(indexOf, "indexOf");
      indexOf_default = indexOf;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js
  function isEmpty(value2) {
    if (value2 == null) {
      return true;
    }
    if (isArrayLike_default(value2) && (isArray_default(value2) || typeof value2 == "string" || typeof value2.splice == "function" || isBuffer_default(value2) || isTypedArray_default(value2) || isArguments_default(value2))) {
      return !value2.length;
    }
    var tag = getTag_default(value2);
    if (tag == mapTag7 || tag == setTag7) {
      return !value2.size;
    }
    if (isPrototype_default(value2)) {
      return !baseKeys_default(value2).length;
    }
    for (var key in value2) {
      if (hasOwnProperty18.call(value2, key)) {
        return false;
      }
    }
    return true;
  }
  var mapTag7, setTag7, objectProto21, hasOwnProperty18, isEmpty_default;
  var init_isEmpty = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js"() {
      "use strict";
      init_baseKeys();
      init_getTag();
      init_isArguments();
      init_isArray();
      init_isArrayLike();
      init_isBuffer();
      init_isPrototype();
      init_isTypedArray();
      mapTag7 = "[object Map]";
      setTag7 = "[object Set]";
      objectProto21 = Object.prototype;
      hasOwnProperty18 = objectProto21.hasOwnProperty;
      __name(isEmpty, "isEmpty");
      isEmpty_default = isEmpty;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsRegExp.js
  function baseIsRegExp(value2) {
    return isObjectLike_default(value2) && baseGetTag_default(value2) == regexpTag5;
  }
  var regexpTag5, baseIsRegExp_default;
  var init_baseIsRegExp = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsRegExp.js"() {
      "use strict";
      init_baseGetTag();
      init_isObjectLike();
      regexpTag5 = "[object RegExp]";
      __name(baseIsRegExp, "baseIsRegExp");
      baseIsRegExp_default = baseIsRegExp;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isRegExp.js
  var nodeIsRegExp, isRegExp, isRegExp_default;
  var init_isRegExp = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isRegExp.js"() {
      "use strict";
      init_baseIsRegExp();
      init_baseUnary();
      init_nodeUtil();
      nodeIsRegExp = nodeUtil_default && nodeUtil_default.isRegExp;
      isRegExp = nodeIsRegExp ? baseUnary_default(nodeIsRegExp) : baseIsRegExp_default;
      isRegExp_default = isRegExp;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isUndefined.js
  function isUndefined(value2) {
    return value2 === void 0;
  }
  var isUndefined_default;
  var init_isUndefined = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isUndefined.js"() {
      "use strict";
      __name(isUndefined, "isUndefined");
      isUndefined_default = isUndefined;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseLt.js
  function baseLt(value2, other) {
    return value2 < other;
  }
  var baseLt_default;
  var init_baseLt = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseLt.js"() {
      "use strict";
      __name(baseLt, "baseLt");
      baseLt_default = baseLt;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/mapValues.js
  function mapValues(object3, iteratee) {
    var result = {};
    iteratee = baseIteratee_default(iteratee, 3);
    baseForOwn_default(object3, function(value2, key, object4) {
      baseAssignValue_default(result, key, iteratee(value2, key, object4));
    });
    return result;
  }
  var mapValues_default;
  var init_mapValues = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/mapValues.js"() {
      "use strict";
      init_baseAssignValue();
      init_baseForOwn();
      init_baseIteratee();
      __name(mapValues, "mapValues");
      mapValues_default = mapValues;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseExtremum.js
  function baseExtremum(array4, iteratee, comparator) {
    var index = -1, length2 = array4.length;
    while (++index < length2) {
      var value2 = array4[index], current = iteratee(value2);
      if (current != null && (computed === void 0 ? current === current && !isSymbol_default(current) : comparator(current, computed))) {
        var computed = current, result = value2;
      }
    }
    return result;
  }
  var baseExtremum_default;
  var init_baseExtremum = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseExtremum.js"() {
      "use strict";
      init_isSymbol();
      __name(baseExtremum, "baseExtremum");
      baseExtremum_default = baseExtremum;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/max.js
  function max4(array4) {
    return array4 && array4.length ? baseExtremum_default(array4, identity_default4, baseGt_default) : void 0;
  }
  var max_default;
  var init_max2 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/max.js"() {
      "use strict";
      init_baseExtremum();
      init_baseGt();
      init_identity4();
      __name(max4, "max");
      max_default = max4;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/min.js
  function min4(array4) {
    return array4 && array4.length ? baseExtremum_default(array4, identity_default4, baseLt_default) : void 0;
  }
  var min_default;
  var init_min2 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/min.js"() {
      "use strict";
      init_baseExtremum();
      init_baseLt();
      init_identity4();
      __name(min4, "min");
      min_default = min4;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/minBy.js
  function minBy(array4, iteratee) {
    return array4 && array4.length ? baseExtremum_default(array4, baseIteratee_default(iteratee, 2), baseLt_default) : void 0;
  }
  var minBy_default;
  var init_minBy = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/minBy.js"() {
      "use strict";
      init_baseExtremum();
      init_baseIteratee();
      init_baseLt();
      __name(minBy, "minBy");
      minBy_default = minBy;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/negate.js
  function negate(predicate) {
    if (typeof predicate != "function") {
      throw new TypeError(FUNC_ERROR_TEXT2);
    }
    return function() {
      var args = arguments;
      switch (args.length) {
        case 0:
          return !predicate.call(this);
        case 1:
          return !predicate.call(this, args[0]);
        case 2:
          return !predicate.call(this, args[0], args[1]);
        case 3:
          return !predicate.call(this, args[0], args[1], args[2]);
      }
      return !predicate.apply(this, args);
    };
  }
  var FUNC_ERROR_TEXT2, negate_default;
  var init_negate = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/negate.js"() {
      "use strict";
      FUNC_ERROR_TEXT2 = "Expected a function";
      __name(negate, "negate");
      negate_default = negate;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSet.js
  function baseSet(object3, path4, value2, customizer) {
    if (!isObject_default(object3)) {
      return object3;
    }
    path4 = castPath_default(path4, object3);
    var index = -1, length2 = path4.length, lastIndex = length2 - 1, nested = object3;
    while (nested != null && ++index < length2) {
      var key = toKey_default(path4[index]), newValue = value2;
      if (key === "__proto__" || key === "constructor" || key === "prototype") {
        return object3;
      }
      if (index != lastIndex) {
        var objValue = nested[key];
        newValue = customizer ? customizer(objValue, key, nested) : void 0;
        if (newValue === void 0) {
          newValue = isObject_default(objValue) ? objValue : isIndex_default(path4[index + 1]) ? [] : {};
        }
      }
      assignValue_default(nested, key, newValue);
      nested = nested[key];
    }
    return object3;
  }
  var baseSet_default;
  var init_baseSet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSet.js"() {
      "use strict";
      init_assignValue();
      init_castPath();
      init_isIndex();
      init_isObject();
      init_toKey();
      __name(baseSet, "baseSet");
      baseSet_default = baseSet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_basePickBy.js
  function basePickBy(object3, paths, predicate) {
    var index = -1, length2 = paths.length, result = {};
    while (++index < length2) {
      var path4 = paths[index], value2 = baseGet_default(object3, path4);
      if (predicate(value2, path4)) {
        baseSet_default(result, castPath_default(path4, object3), value2);
      }
    }
    return result;
  }
  var basePickBy_default;
  var init_basePickBy = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_basePickBy.js"() {
      "use strict";
      init_baseGet();
      init_baseSet();
      init_castPath();
      __name(basePickBy, "basePickBy");
      basePickBy_default = basePickBy;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/pickBy.js
  function pickBy(object3, predicate) {
    if (object3 == null) {
      return {};
    }
    var props = arrayMap_default(getAllKeysIn_default(object3), function(prop) {
      return [prop];
    });
    predicate = baseIteratee_default(predicate);
    return basePickBy_default(object3, props, function(value2, path4) {
      return predicate(value2, path4[0]);
    });
  }
  var pickBy_default;
  var init_pickBy = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/pickBy.js"() {
      "use strict";
      init_arrayMap();
      init_baseIteratee();
      init_basePickBy();
      init_getAllKeysIn();
      __name(pickBy, "pickBy");
      pickBy_default = pickBy;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSortBy.js
  function baseSortBy(array4, comparer) {
    var length2 = array4.length;
    array4.sort(comparer);
    while (length2--) {
      array4[length2] = array4[length2].value;
    }
    return array4;
  }
  var baseSortBy_default;
  var init_baseSortBy = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSortBy.js"() {
      "use strict";
      __name(baseSortBy, "baseSortBy");
      baseSortBy_default = baseSortBy;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_compareAscending.js
  function compareAscending(value2, other) {
    if (value2 !== other) {
      var valIsDefined = value2 !== void 0, valIsNull = value2 === null, valIsReflexive = value2 === value2, valIsSymbol = isSymbol_default(value2);
      var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol_default(other);
      if (!othIsNull && !othIsSymbol && !valIsSymbol && value2 > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
        return 1;
      }
      if (!valIsNull && !valIsSymbol && !othIsSymbol && value2 < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
        return -1;
      }
    }
    return 0;
  }
  var compareAscending_default;
  var init_compareAscending = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_compareAscending.js"() {
      "use strict";
      init_isSymbol();
      __name(compareAscending, "compareAscending");
      compareAscending_default = compareAscending;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_compareMultiple.js
  function compareMultiple(object3, other, orders) {
    var index = -1, objCriteria = object3.criteria, othCriteria = other.criteria, length2 = objCriteria.length, ordersLength = orders.length;
    while (++index < length2) {
      var result = compareAscending_default(objCriteria[index], othCriteria[index]);
      if (result) {
        if (index >= ordersLength) {
          return result;
        }
        var order2 = orders[index];
        return result * (order2 == "desc" ? -1 : 1);
      }
    }
    return object3.index - other.index;
  }
  var compareMultiple_default;
  var init_compareMultiple = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_compareMultiple.js"() {
      "use strict";
      init_compareAscending();
      __name(compareMultiple, "compareMultiple");
      compareMultiple_default = compareMultiple;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseOrderBy.js
  function baseOrderBy(collection4, iteratees, orders) {
    if (iteratees.length) {
      iteratees = arrayMap_default(iteratees, function(iteratee) {
        if (isArray_default(iteratee)) {
          return function(value2) {
            return baseGet_default(value2, iteratee.length === 1 ? iteratee[0] : iteratee);
          };
        }
        return iteratee;
      });
    } else {
      iteratees = [identity_default4];
    }
    var index = -1;
    iteratees = arrayMap_default(iteratees, baseUnary_default(baseIteratee_default));
    var result = baseMap_default(collection4, function(value2, key, collection5) {
      var criteria = arrayMap_default(iteratees, function(iteratee) {
        return iteratee(value2);
      });
      return { "criteria": criteria, "index": ++index, "value": value2 };
    });
    return baseSortBy_default(result, function(object3, other) {
      return compareMultiple_default(object3, other, orders);
    });
  }
  var baseOrderBy_default;
  var init_baseOrderBy = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseOrderBy.js"() {
      "use strict";
      init_arrayMap();
      init_baseGet();
      init_baseIteratee();
      init_baseMap();
      init_baseSortBy();
      init_baseUnary();
      init_compareMultiple();
      init_identity4();
      init_isArray();
      __name(baseOrderBy, "baseOrderBy");
      baseOrderBy_default = baseOrderBy;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_asciiSize.js
  var asciiSize, asciiSize_default;
  var init_asciiSize = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_asciiSize.js"() {
      "use strict";
      init_baseProperty();
      asciiSize = baseProperty_default("length");
      asciiSize_default = asciiSize;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_unicodeSize.js
  function unicodeSize(string3) {
    var result = reUnicode.lastIndex = 0;
    while (reUnicode.test(string3)) {
      ++result;
    }
    return result;
  }
  var rsAstralRange2, rsComboMarksRange2, reComboHalfMarksRange2, rsComboSymbolsRange2, rsComboRange2, rsVarRange2, rsAstral, rsCombo, rsFitz, rsModifier, rsNonAstral, rsRegional, rsSurrPair, rsZWJ2, reOptMod, rsOptVar, rsOptJoin, rsSeq, rsSymbol, reUnicode, unicodeSize_default;
  var init_unicodeSize = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_unicodeSize.js"() {
      "use strict";
      rsAstralRange2 = "\\ud800-\\udfff";
      rsComboMarksRange2 = "\\u0300-\\u036f";
      reComboHalfMarksRange2 = "\\ufe20-\\ufe2f";
      rsComboSymbolsRange2 = "\\u20d0-\\u20ff";
      rsComboRange2 = rsComboMarksRange2 + reComboHalfMarksRange2 + rsComboSymbolsRange2;
      rsVarRange2 = "\\ufe0e\\ufe0f";
      rsAstral = "[" + rsAstralRange2 + "]";
      rsCombo = "[" + rsComboRange2 + "]";
      rsFitz = "\\ud83c[\\udffb-\\udfff]";
      rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
      rsNonAstral = "[^" + rsAstralRange2 + "]";
      rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
      rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
      rsZWJ2 = "\\u200d";
      reOptMod = rsModifier + "?";
      rsOptVar = "[" + rsVarRange2 + "]?";
      rsOptJoin = "(?:" + rsZWJ2 + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
      rsSeq = rsOptVar + reOptMod + rsOptJoin;
      rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
      reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
      __name(unicodeSize, "unicodeSize");
      unicodeSize_default = unicodeSize;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stringSize.js
  function stringSize(string3) {
    return hasUnicode_default(string3) ? unicodeSize_default(string3) : asciiSize_default(string3);
  }
  var stringSize_default;
  var init_stringSize = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stringSize.js"() {
      "use strict";
      init_asciiSize();
      init_hasUnicode();
      init_unicodeSize();
      __name(stringSize, "stringSize");
      stringSize_default = stringSize;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_basePick.js
  function basePick(object3, paths) {
    return basePickBy_default(object3, paths, function(value2, path4) {
      return hasIn_default(object3, path4);
    });
  }
  var basePick_default;
  var init_basePick = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_basePick.js"() {
      "use strict";
      init_basePickBy();
      init_hasIn();
      __name(basePick, "basePick");
      basePick_default = basePick;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/pick.js
  var pick, pick_default;
  var init_pick = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/pick.js"() {
      "use strict";
      init_basePick();
      init_flatRest();
      pick = flatRest_default(function(object3, paths) {
        return object3 == null ? {} : basePick_default(object3, paths);
      });
      pick_default = pick;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseRange.js
  function baseRange(start3, end2, step3, fromRight) {
    var index = -1, length2 = nativeMax5(nativeCeil((end2 - start3) / (step3 || 1)), 0), result = Array(length2);
    while (length2--) {
      result[fromRight ? length2 : ++index] = start3;
      start3 += step3;
    }
    return result;
  }
  var nativeCeil, nativeMax5, baseRange_default;
  var init_baseRange = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseRange.js"() {
      "use strict";
      nativeCeil = Math.ceil;
      nativeMax5 = Math.max;
      __name(baseRange, "baseRange");
      baseRange_default = baseRange;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createRange.js
  function createRange(fromRight) {
    return function(start3, end2, step3) {
      if (step3 && typeof step3 != "number" && isIterateeCall_default(start3, end2, step3)) {
        end2 = step3 = void 0;
      }
      start3 = toFinite_default(start3);
      if (end2 === void 0) {
        end2 = start3;
        start3 = 0;
      } else {
        end2 = toFinite_default(end2);
      }
      step3 = step3 === void 0 ? start3 < end2 ? 1 : -1 : toFinite_default(step3);
      return baseRange_default(start3, end2, step3, fromRight);
    };
  }
  var createRange_default;
  var init_createRange = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createRange.js"() {
      "use strict";
      init_baseRange();
      init_isIterateeCall();
      init_toFinite();
      __name(createRange, "createRange");
      createRange_default = createRange;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/range.js
  var range2, range_default;
  var init_range2 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/range.js"() {
      "use strict";
      init_createRange();
      range2 = createRange_default();
      range_default = range2;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseReduce.js
  function baseReduce(collection4, iteratee, accumulator, initAccum, eachFunc) {
    eachFunc(collection4, function(value2, index, collection5) {
      accumulator = initAccum ? (initAccum = false, value2) : iteratee(accumulator, value2, index, collection5);
    });
    return accumulator;
  }
  var baseReduce_default;
  var init_baseReduce = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseReduce.js"() {
      "use strict";
      __name(baseReduce, "baseReduce");
      baseReduce_default = baseReduce;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/reduce.js
  function reduce(collection4, iteratee, accumulator) {
    var func = isArray_default(collection4) ? arrayReduce_default : baseReduce_default, initAccum = arguments.length < 3;
    return func(collection4, baseIteratee_default(iteratee, 4), accumulator, initAccum, baseEach_default);
  }
  var reduce_default;
  var init_reduce = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/reduce.js"() {
      "use strict";
      init_arrayReduce();
      init_baseEach();
      init_baseIteratee();
      init_baseReduce();
      init_isArray();
      __name(reduce, "reduce");
      reduce_default = reduce;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/reject.js
  function reject(collection4, predicate) {
    var func = isArray_default(collection4) ? arrayFilter_default : baseFilter_default;
    return func(collection4, negate_default(baseIteratee_default(predicate, 3)));
  }
  var reject_default;
  var init_reject = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/reject.js"() {
      "use strict";
      init_arrayFilter();
      init_baseFilter();
      init_baseIteratee();
      init_isArray();
      init_negate();
      __name(reject, "reject");
      reject_default = reject;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/size.js
  function size(collection4) {
    if (collection4 == null) {
      return 0;
    }
    if (isArrayLike_default(collection4)) {
      return isString_default(collection4) ? stringSize_default(collection4) : collection4.length;
    }
    var tag = getTag_default(collection4);
    if (tag == mapTag8 || tag == setTag8) {
      return collection4.size;
    }
    return baseKeys_default(collection4).length;
  }
  var mapTag8, setTag8, size_default2;
  var init_size3 = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/size.js"() {
      "use strict";
      init_baseKeys();
      init_getTag();
      init_isArrayLike();
      init_isString();
      init_stringSize();
      mapTag8 = "[object Map]";
      setTag8 = "[object Set]";
      __name(size, "size");
      size_default2 = size;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSome.js
  function baseSome(collection4, predicate) {
    var result;
    baseEach_default(collection4, function(value2, index, collection5) {
      result = predicate(value2, index, collection5);
      return !result;
    });
    return !!result;
  }
  var baseSome_default;
  var init_baseSome = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSome.js"() {
      "use strict";
      init_baseEach();
      __name(baseSome, "baseSome");
      baseSome_default = baseSome;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/some.js
  function some(collection4, predicate, guard) {
    var func = isArray_default(collection4) ? arraySome_default : baseSome_default;
    if (guard && isIterateeCall_default(collection4, predicate, guard)) {
      predicate = void 0;
    }
    return func(collection4, baseIteratee_default(predicate, 3));
  }
  var some_default;
  var init_some = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/some.js"() {
      "use strict";
      init_arraySome();
      init_baseIteratee();
      init_baseSome();
      init_isArray();
      init_isIterateeCall();
      __name(some, "some");
      some_default = some;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/sortBy.js
  var sortBy, sortBy_default;
  var init_sortBy = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/sortBy.js"() {
      "use strict";
      init_baseFlatten();
      init_baseOrderBy();
      init_baseRest();
      init_isIterateeCall();
      sortBy = baseRest_default(function(collection4, iteratees) {
        if (collection4 == null) {
          return [];
        }
        var length2 = iteratees.length;
        if (length2 > 1 && isIterateeCall_default(collection4, iteratees[0], iteratees[1])) {
          iteratees = [];
        } else if (length2 > 2 && isIterateeCall_default(iteratees[0], iteratees[1], iteratees[2])) {
          iteratees = [iteratees[0]];
        }
        return baseOrderBy_default(collection4, baseFlatten_default(iteratees, 1), []);
      });
      sortBy_default = sortBy;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createSet.js
  var INFINITY4, createSet, createSet_default;
  var init_createSet = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createSet.js"() {
      "use strict";
      init_Set();
      init_noop2();
      init_setToArray();
      INFINITY4 = 1 / 0;
      createSet = !(Set_default && 1 / setToArray_default(new Set_default([, -0]))[1] == INFINITY4) ? noop_default2 : function(values2) {
        return new Set_default(values2);
      };
      createSet_default = createSet;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseUniq.js
  function baseUniq(array4, iteratee, comparator) {
    var index = -1, includes3 = arrayIncludes_default, length2 = array4.length, isCommon = true, result = [], seen = result;
    if (comparator) {
      isCommon = false;
      includes3 = arrayIncludesWith_default;
    } else if (length2 >= LARGE_ARRAY_SIZE3) {
      var set5 = iteratee ? null : createSet_default(array4);
      if (set5) {
        return setToArray_default(set5);
      }
      isCommon = false;
      includes3 = cacheHas_default;
      seen = new SetCache_default();
    } else {
      seen = iteratee ? [] : result;
    }
    outer:
      while (++index < length2) {
        var value2 = array4[index], computed = iteratee ? iteratee(value2) : value2;
        value2 = comparator || value2 !== 0 ? value2 : 0;
        if (isCommon && computed === computed) {
          var seenIndex = seen.length;
          while (seenIndex--) {
            if (seen[seenIndex] === computed) {
              continue outer;
            }
          }
          if (iteratee) {
            seen.push(computed);
          }
          result.push(value2);
        } else if (!includes3(seen, computed, comparator)) {
          if (seen !== result) {
            seen.push(computed);
          }
          result.push(value2);
        }
      }
    return result;
  }
  var LARGE_ARRAY_SIZE3, baseUniq_default;
  var init_baseUniq = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseUniq.js"() {
      "use strict";
      init_SetCache();
      init_arrayIncludes();
      init_arrayIncludesWith();
      init_cacheHas();
      init_createSet();
      init_setToArray();
      LARGE_ARRAY_SIZE3 = 200;
      __name(baseUniq, "baseUniq");
      baseUniq_default = baseUniq;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/union.js
  var union, union_default;
  var init_union = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/union.js"() {
      "use strict";
      init_baseFlatten();
      init_baseRest();
      init_baseUniq();
      init_isArrayLikeObject();
      union = baseRest_default(function(arrays) {
        return baseUniq_default(baseFlatten_default(arrays, 1, isArrayLikeObject_default, true));
      });
      union_default = union;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/uniq.js
  function uniq(array4) {
    return array4 && array4.length ? baseUniq_default(array4) : [];
  }
  var uniq_default;
  var init_uniq = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/uniq.js"() {
      "use strict";
      init_baseUniq();
      __name(uniq, "uniq");
      uniq_default = uniq;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/uniqBy.js
  function uniqBy(array4, iteratee) {
    return array4 && array4.length ? baseUniq_default(array4, baseIteratee_default(iteratee, 2)) : [];
  }
  var uniqBy_default;
  var init_uniqBy = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/uniqBy.js"() {
      "use strict";
      init_baseIteratee();
      init_baseUniq();
      __name(uniqBy, "uniqBy");
      uniqBy_default = uniqBy;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/uniqueId.js
  function uniqueId(prefix) {
    var id34 = ++idCounter;
    return toString_default(prefix) + id34;
  }
  var idCounter, uniqueId_default;
  var init_uniqueId = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/uniqueId.js"() {
      "use strict";
      init_toString();
      idCounter = 0;
      __name(uniqueId, "uniqueId");
      uniqueId_default = uniqueId;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseZipObject.js
  function baseZipObject(props, values2, assignFunc) {
    var index = -1, length2 = props.length, valsLength = values2.length, result = {};
    while (++index < length2) {
      var value2 = index < valsLength ? values2[index] : void 0;
      assignFunc(result, props[index], value2);
    }
    return result;
  }
  var baseZipObject_default;
  var init_baseZipObject = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseZipObject.js"() {
      "use strict";
      __name(baseZipObject, "baseZipObject");
      baseZipObject_default = baseZipObject;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/zipObject.js
  function zipObject(props, values2) {
    return baseZipObject_default(props || [], values2 || [], assignValue_default);
  }
  var zipObject_default;
  var init_zipObject = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/zipObject.js"() {
      "use strict";
      init_assignValue();
      init_baseZipObject();
      __name(zipObject, "zipObject");
      zipObject_default = zipObject;
    }
  });

  // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/lodash.js
  var init_lodash = __esm({
    "../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/lodash.js"() {
      "use strict";
      init_assign();
      init_clone2();
      init_cloneDeep();
      init_compact();
      init_constant8();
      init_defaults3();
      init_difference();
      init_drop();
      init_dropRight();
      init_each3();
      init_every();
      init_filter3();
      init_find2();
      init_first();
      init_flatMap();
      init_flatten();
      init_forEach();
      init_forIn();
      init_forOwn();
      init_groupBy();
      init_has();
      init_identity4();
      init_includes();
      init_indexOf();
      init_isArray();
      init_isEmpty();
      init_isFunction();
      init_isObject();
      init_isRegExp();
      init_isString();
      init_isUndefined();
      init_keys();
      init_last();
      init_map();
      init_mapValues();
      init_max2();
      init_merge4();
      init_min2();
      init_minBy();
      init_noop2();
      init_now();
      init_pick();
      init_pickBy();
      init_range2();
      init_reduce();
      init_reject();
      init_size3();
      init_some();
      init_sortBy();
      init_union();
      init_uniq();
      init_uniqueId();
      init_values();
      init_zipObject();
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/graph.js
  function incrementOrInitEntry(map5, k2) {
    if (map5[k2]) {
      map5[k2]++;
    } else {
      map5[k2] = 1;
    }
  }
  function decrementOrRemoveEntry(map5, k2) {
    if (!--map5[k2]) {
      delete map5[k2];
    }
  }
  function edgeArgsToId(isDirected, v_, w_, name) {
    var v3 = "" + v_;
    var w4 = "" + w_;
    if (!isDirected && v3 > w4) {
      var tmp = v3;
      v3 = w4;
      w4 = tmp;
    }
    return v3 + EDGE_KEY_DELIM + w4 + EDGE_KEY_DELIM + (isUndefined_default(name) ? DEFAULT_EDGE_NAME : name);
  }
  function edgeArgsToObj(isDirected, v_, w_, name) {
    var v3 = "" + v_;
    var w4 = "" + w_;
    if (!isDirected && v3 > w4) {
      var tmp = v3;
      v3 = w4;
      w4 = tmp;
    }
    var edgeObj = { v: v3, w: w4 };
    if (name) {
      edgeObj.name = name;
    }
    return edgeObj;
  }
  function edgeObjToId(isDirected, edgeObj) {
    return edgeArgsToId(isDirected, edgeObj.v, edgeObj.w, edgeObj.name);
  }
  var DEFAULT_EDGE_NAME, GRAPH_NODE, EDGE_KEY_DELIM, Graph;
  var init_graph = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/graph.js"() {
      "use strict";
      init_lodash();
      DEFAULT_EDGE_NAME = "\0";
      GRAPH_NODE = "\0";
      EDGE_KEY_DELIM = "";
      Graph = class {
        static {
          __name(this, "Graph");
        }
        /**
         * @param {GraphOptions} [opts] - Graph options.
         */
        constructor(opts = {}) {
          this._isDirected = Object.prototype.hasOwnProperty.call(opts, "directed") ? opts.directed : true;
          this._isMultigraph = Object.prototype.hasOwnProperty.call(opts, "multigraph") ? opts.multigraph : false;
          this._isCompound = Object.prototype.hasOwnProperty.call(opts, "compound") ? opts.compound : false;
          this._label = void 0;
          this._defaultNodeLabelFn = constant_default7(void 0);
          this._defaultEdgeLabelFn = constant_default7(void 0);
          this._nodes = {};
          if (this._isCompound) {
            this._parent = {};
            this._children = {};
            this._children[GRAPH_NODE] = {};
          }
          this._in = {};
          this._preds = {};
          this._out = {};
          this._sucs = {};
          this._edgeObjs = {};
          this._edgeLabels = {};
        }
        /* === Graph functions ========= */
        /**
         *
         * @returns {boolean} `true` if the graph is [directed](https://en.wikipedia.org/wiki/Directed_graph).
         * A directed graph treats the order of nodes in an edge as significant whereas an
         * [undirected](https://en.wikipedia.org/wiki/Graph_(mathematics)#Undirected_graph)
         * graph does not.
         * This example demonstrates the difference:
         *
         * @example
         *
         * ```js
         * var directed = new Graph({ directed: true });
         * directed.setEdge("a", "b", "my-label");
         * directed.edge("a", "b"); // returns "my-label"
         * directed.edge("b", "a"); // returns undefined
         *
         * var undirected = new Graph({ directed: false });
         * undirected.setEdge("a", "b", "my-label");
         * undirected.edge("a", "b"); // returns "my-label"
         * undirected.edge("b", "a"); // returns "my-label"
         * ```
         */
        isDirected() {
          return this._isDirected;
        }
        /**
         * @returns {boolean} `true` if the graph is a multigraph.
         */
        isMultigraph() {
          return this._isMultigraph;
        }
        /**
         * @returns {boolean} `true` if the graph is compound.
         */
        isCompound() {
          return this._isCompound;
        }
        /**
         * Sets the label for the graph to `label`.
         *
         * @param {GraphLabel} label - Label for the graph.
         * @returns {this}
         */
        setGraph(label) {
          this._label = label;
          return this;
        }
        /**
         * @returns {GraphLabel | undefined} the currently assigned label for the graph.
         * If no label has been assigned, returns `undefined`.
         *
         * @example
         *
         * ```js
         * var g = new Graph();
         * g.graph(); // returns undefined
         * g.setGraph("graph-label");
         *  g.graph(); // returns "graph-label"
         * ```
         */
        graph() {
          return this._label;
        }
        /* === Node functions ========== */
        /**
         * Sets a new default value that is assigned to nodes that are created without
         * a label.
         *
         * @param {typeof this._defaultNodeLabelFn | NodeLabel} newDefault - If a function,
         * it is called with the id of the node being created.
         * Otherwise, it is assigned as the label directly.
         * @returns {this}
         */
        setDefaultNodeLabel(newDefault) {
          if (!isFunction_default(newDefault)) {
            newDefault = constant_default7(newDefault);
          }
          this._defaultNodeLabelFn = newDefault;
          return this;
        }
        /**
         * @returns {number} the number of nodes in the graph.
         */
        nodeCount() {
          return this._nodeCount;
        }
        /**
         * @returns {NodeID[]} the ids of the nodes in the graph.
         *
         * @remarks
         * Use {@link node()} to get the label for each node.
         * Takes `O(|V|)` time.
         */
        nodes() {
          return keys_default(this._nodes);
        }
        /**
         * @returns {NodeID[]} those nodes in the graph that have no in-edges.
         * @remarks Takes `O(|V|)` time.
         */
        sources() {
          var self2 = this;
          return filter_default3(this.nodes(), function(v3) {
            return isEmpty_default(self2._in[v3]);
          });
        }
        /**
         * @returns {NodeID[]} those nodes in the graph that have no out-edges.
         * @remarks Takes `O(|V|)` time.
         */
        sinks() {
          var self2 = this;
          return filter_default3(this.nodes(), function(v3) {
            return isEmpty_default(self2._out[v3]);
          });
        }
        /**
         * Invokes setNode method for each node in `vs` list.
         *
         * @param {Collection<NodeID | number>} vs - List of node IDs to create/set.
         * @param {NodeLabel} [value] - If set, update all nodes with this value.
         * @returns {this}
         * @remarks Complexity: O(|names|).
         */
        setNodes(vs, value2) {
          var args = arguments;
          var self2 = this;
          forEach_default(vs, function(v3) {
            if (args.length > 1) {
              self2.setNode(v3, value2);
            } else {
              self2.setNode(v3);
            }
          });
          return this;
        }
        /**
         * Creates or updates the value for the node `v` in the graph.
         *
         * @param {NodeID | number} v - ID of the node to create/set.
         * @param {NodeLabel} [value] - If supplied, it is set as the value for the node.
         * If not supplied and the node was created by this call then
         * {@link setDefaultNodeLabel} will be used to set the node's value.
         * @returns {this} the graph, allowing this to be chained with other functions.
         * @remarks Takes `O(1)` time.
         */
        setNode(v3, value2) {
          if (Object.prototype.hasOwnProperty.call(this._nodes, v3)) {
            if (arguments.length > 1) {
              this._nodes[v3] = value2;
            }
            return this;
          }
          this._nodes[v3] = arguments.length > 1 ? value2 : this._defaultNodeLabelFn(v3);
          if (this._isCompound) {
            this._parent[v3] = GRAPH_NODE;
            this._children[v3] = {};
            this._children[GRAPH_NODE][v3] = true;
          }
          this._in[v3] = {};
          this._preds[v3] = {};
          this._out[v3] = {};
          this._sucs[v3] = {};
          ++this._nodeCount;
          return this;
        }
        /**
         * Gets the label of node with specified name.
         *
         * @param {NodeID | number} v - Node ID.
         * @returns {NodeLabel | undefined} the label assigned to the node with the id `v`
         * if it is in the graph.
         * Otherwise returns `undefined`.
         * @remarks Takes `O(1)` time.
         */
        node(v3) {
          return this._nodes[v3];
        }
        /**
         * Detects whether graph has a node with specified name or not.
         *
         * @param {NodeID | number} v - Node ID.
         * @returns {boolean} Returns `true` the graph has a node with the id.
         * @remarks Takes `O(1)` time.
         */
        hasNode(v3) {
          return Object.prototype.hasOwnProperty.call(this._nodes, v3);
        }
        /**
         * Remove the node with the id `v` in the graph or do nothing if the node is
         * not in the graph.
         *
         * If the node was removed this function also removes any incident edges.
         *
         * @param {NodeID | number} v - Node ID to remove.
         * @returns {this} the graph, allowing this to be chained with other functions.
         * @remarks Takes `O(|E|)` time.
         */
        removeNode(v3) {
          if (Object.prototype.hasOwnProperty.call(this._nodes, v3)) {
            var removeEdge = /* @__PURE__ */ __name((e3) => this.removeEdge(this._edgeObjs[e3]), "removeEdge");
            delete this._nodes[v3];
            if (this._isCompound) {
              this._removeFromParentsChildList(v3);
              delete this._parent[v3];
              forEach_default(this.children(v3), (child) => {
                this.setParent(child);
              });
              delete this._children[v3];
            }
            forEach_default(keys_default(this._in[v3]), removeEdge);
            delete this._in[v3];
            delete this._preds[v3];
            forEach_default(keys_default(this._out[v3]), removeEdge);
            delete this._out[v3];
            delete this._sucs[v3];
            --this._nodeCount;
          }
          return this;
        }
        /**
         * Sets the parent for `v` to `parent` if it is defined or removes the parent
         * for `v` if `parent` is undefined.
         *
         * @param {NodeID | number} v - Node ID to set the parent for.
         * @param {NodeID | number} [parent] - Parent node ID. If not defined, removes the parent.
         * @returns {this} the graph, allowing this to be chained with other functions.
         * @throws if the graph is not compound.
         * @throws if setting the parent would create a cycle.
         * @remarks Takes `O(1)` time.
         */
        setParent(v3, parent4) {
          if (!this._isCompound) {
            throw new Error("Cannot set parent in a non-compound graph");
          }
          if (isUndefined_default(parent4)) {
            parent4 = GRAPH_NODE;
          } else {
            parent4 += "";
            for (var ancestor = parent4; !isUndefined_default(ancestor); ancestor = this.parent(ancestor)) {
              if (ancestor === v3) {
                throw new Error("Setting " + parent4 + " as parent of " + v3 + " would create a cycle");
              }
            }
            this.setNode(parent4);
          }
          this.setNode(v3);
          this._removeFromParentsChildList(v3);
          this._parent[v3] = parent4;
          this._children[parent4][v3] = true;
          return this;
        }
        /**
         * @private
         * @param {NodeID | number} v - Node ID.
         */
        _removeFromParentsChildList(v3) {
          delete this._children[this._parent[v3]][v3];
        }
        /**
         * Get parent node for node `v`.
         *
         * @param {NodeID | number} v - Node ID.
         * @returns {NodeID | undefined} the node that is a parent of node `v`
         * or `undefined` if node `v` does not have a parent or is not a member of
         * the graph.
         * Always returns `undefined` for graphs that are not compound.
         * @remarks Takes `O(1)` time.
         */
        parent(v3) {
          if (this._isCompound) {
            var parent4 = this._parent[v3];
            if (parent4 !== GRAPH_NODE) {
              return parent4;
            }
          }
        }
        /**
         * Gets list of direct children of node v.
         *
         * @param {NodeID | number} [v] - Node ID. If not specified, gets nodes
         * with no parent (top-level nodes).
         * @returns {NodeID[] | undefined} all nodes that are children of node `v` or
         * `undefined` if node `v` is not in the graph.
         * Always returns `[]` for graphs that are not compound.
         * @remarks Takes `O(|V|)` time.
         */
        children(v3) {
          if (isUndefined_default(v3)) {
            v3 = GRAPH_NODE;
          }
          if (this._isCompound) {
            var children2 = this._children[v3];
            if (children2) {
              return keys_default(children2);
            }
          } else if (v3 === GRAPH_NODE) {
            return this.nodes();
          } else if (this.hasNode(v3)) {
            return [];
          }
        }
        /**
         * @param {NodeID | number} v - Node ID.
         * @returns {NodeID[] | undefined} all nodes that are predecessors of the
         * specified node or `undefined` if node `v` is not in the graph.
         * @remarks
         * Behavior is undefined for undirected graphs - use {@link neighbors} instead.
         * Takes `O(|V|)` time.
         */
        predecessors(v3) {
          var predsV = this._preds[v3];
          if (predsV) {
            return keys_default(predsV);
          }
        }
        /**
         * @param {NodeID | number} v - Node ID.
         * @returns {NodeID[] | undefined} all nodes that are successors of the
         * specified node or `undefined` if node `v` is not in the graph.
         * @remarks
         * Behavior is undefined for undirected graphs - use {@link neighbors} instead.
         * Takes `O(|V|)` time.
         */
        successors(v3) {
          var sucsV = this._sucs[v3];
          if (sucsV) {
            return keys_default(sucsV);
          }
        }
        /**
         * @param {NodeID | number} v - Node ID.
         * @returns {NodeID[] | undefined} all nodes that are predecessors or
         * successors of the specified node
         * or `undefined` if node `v` is not in the graph.
         * @remarks Takes `O(|V|)` time.
         */
        neighbors(v3) {
          var preds = this.predecessors(v3);
          if (preds) {
            return union_default(preds, this.successors(v3));
          }
        }
        /**
         * @param {NodeID | number} v - Node ID.
         * @returns {boolean} True if the node is a leaf (has no successors), false otherwise.
         */
        isLeaf(v3) {
          var neighbors;
          if (this.isDirected()) {
            neighbors = this.successors(v3);
          } else {
            neighbors = this.neighbors(v3);
          }
          return neighbors.length === 0;
        }
        /**
           * Creates new graph with nodes filtered via `filter`.
           * Edges incident to rejected node
           * are also removed.
           * 
           * In case of compound graph, if parent is rejected by `filter`,
           * than all its children are rejected too.
        
           * @param {(v: NodeID) => boolean} filter - Function that returns `true` for nodes to keep.
           * @returns {Graph<GraphLabel, NodeLabel, EdgeLabel>} A new graph containing only the nodes for which `filter` returns `true`.
           * @remarks Average-case complexity: O(|E|+|V|).
           */
        filterNodes(filter6) {
          var copy5 = new this.constructor({
            directed: this._isDirected,
            multigraph: this._isMultigraph,
            compound: this._isCompound
          });
          copy5.setGraph(this.graph());
          var self2 = this;
          forEach_default(this._nodes, function(value2, v3) {
            if (filter6(v3)) {
              copy5.setNode(v3, value2);
            }
          });
          forEach_default(this._edgeObjs, function(e3) {
            if (copy5.hasNode(e3.v) && copy5.hasNode(e3.w)) {
              copy5.setEdge(e3, self2.edge(e3));
            }
          });
          var parents3 = {};
          function findParent(v3) {
            var parent4 = self2.parent(v3);
            if (parent4 === void 0 || copy5.hasNode(parent4)) {
              parents3[v3] = parent4;
              return parent4;
            } else if (parent4 in parents3) {
              return parents3[parent4];
            } else {
              return findParent(parent4);
            }
          }
          __name(findParent, "findParent");
          if (this._isCompound) {
            forEach_default(copy5.nodes(), function(v3) {
              copy5.setParent(v3, findParent(v3));
            });
          }
          return copy5;
        }
        /* === Edge functions ========== */
        /**
         * Sets a new default value that is assigned to edges that are created without
         * a label.
         *
         * @param {typeof this._defaultEdgeLabelFn | EdgeLabel} newDefault - If a function,
         * it is called with the parameters `(v, w, name)`.
         * Otherwise, it is assigned as the label directly.
         * @returns {this}
         */
        setDefaultEdgeLabel(newDefault) {
          if (!isFunction_default(newDefault)) {
            newDefault = constant_default7(newDefault);
          }
          this._defaultEdgeLabelFn = newDefault;
          return this;
        }
        /**
         * @returns {number} the number of edges in the graph.
         * @remarks Complexity: O(1).
         */
        edgeCount() {
          return this._edgeCount;
        }
        /**
         * Gets edges of the graph.
         *
         * @returns {EdgeObj[]} the {@link EdgeObj} for each edge in the graph.
         *
         * @remarks
         * In case of compound graph subgraphs are not considered.
         * Use {@link edge()} to get the label for each edge.
         * Takes `O(|E|)` time.
         */
        edges() {
          return values_default(this._edgeObjs);
        }
        /**
         * Establish an edges path over the nodes in nodes list.
         *
         * If some edge is already exists, it will update its label, otherwise it will
         * create an edge between pair of nodes with label provided or default label
         * if no label provided.
         *
         * @param {Collection<NodeID>} vs - List of node IDs to create edges between.
         * @param {EdgeLabel} [value] - If set, update all edges with this value.
         * @returns {this}
         * @remarks Complexity: O(|nodes|).
         */
        setPath(vs, value2) {
          var self2 = this;
          var args = arguments;
          reduce_default(vs, function(v3, w4) {
            if (args.length > 1) {
              self2.setEdge(v3, w4, value2);
            } else {
              self2.setEdge(v3, w4);
            }
            return w4;
          });
          return this;
        }
        /**
         * Creates or updates the label for the edge (`v`, `w`) with the optionally
         * supplied `name`.
         *
         * @overload
         * @param {EdgeObj} arg0 - Edge object.
         * @param {EdgeLabel} [value] - If supplied, it is set as the label for the edge.
         * If not supplied and the edge was created by this call then
         * {@link setDefaultEdgeLabel} will be used to assign the edge's label.
         * @returns {this} the graph, allowing this to be chained with other functions.
         * @remarks Takes `O(1)` time.
         */
        /**
         * Creates or updates the label for the edge (`v`, `w`) with the optionally
         * supplied `name`.
         *
         * @overload
         * @param {NodeID | number} v - Source node ID. Number values will be coerced to strings.
         * @param {NodeID | number} w - Target node ID. Number values will be coerced to strings.
         * @param {EdgeLabel} [value] - If supplied, it is set as the label for the edge.
         * If not supplied and the edge was created by this call then
         * {@link setDefaultEdgeLabel} will be used to assign the edge's label.
         * @param {string | number} [name] - Edge name. Only useful with multigraphs.
         * @returns {this} the graph, allowing this to be chained with other functions.
         * @remarks Takes `O(1)` time.
         */
        setEdge() {
          var v3, w4, name, value2;
          var valueSpecified = false;
          var arg0 = arguments[0];
          if (typeof arg0 === "object" && arg0 !== null && "v" in arg0) {
            v3 = arg0.v;
            w4 = arg0.w;
            name = arg0.name;
            if (arguments.length === 2) {
              value2 = arguments[1];
              valueSpecified = true;
            }
          } else {
            v3 = arg0;
            w4 = arguments[1];
            name = arguments[3];
            if (arguments.length > 2) {
              value2 = arguments[2];
              valueSpecified = true;
            }
          }
          v3 = "" + v3;
          w4 = "" + w4;
          if (!isUndefined_default(name)) {
            name = "" + name;
          }
          var e3 = edgeArgsToId(this._isDirected, v3, w4, name);
          if (Object.prototype.hasOwnProperty.call(this._edgeLabels, e3)) {
            if (valueSpecified) {
              this._edgeLabels[e3] = value2;
            }
            return this;
          }
          if (!isUndefined_default(name) && !this._isMultigraph) {
            throw new Error("Cannot set a named edge when isMultigraph = false");
          }
          this.setNode(v3);
          this.setNode(w4);
          this._edgeLabels[e3] = valueSpecified ? value2 : this._defaultEdgeLabelFn(v3, w4, name);
          var edgeObj = edgeArgsToObj(this._isDirected, v3, w4, name);
          v3 = edgeObj.v;
          w4 = edgeObj.w;
          Object.freeze(edgeObj);
          this._edgeObjs[e3] = edgeObj;
          incrementOrInitEntry(this._preds[w4], v3);
          incrementOrInitEntry(this._sucs[v3], w4);
          this._in[w4][e3] = edgeObj;
          this._out[v3][e3] = edgeObj;
          this._edgeCount++;
          return this;
        }
        /**
         * Gets the label for the specified edge.
         *
         * @overload
         * @param {EdgeObj} v - Edge object.
         * @returns {EdgeLabel | undefined} the label for the edge (`v`, `w`) if the
         * graph has an edge between `v` and `w` with the optional `name`.
         * Returned `undefined` if there is no such edge in the graph.
         * @remarks
         * `v` and `w` can be interchanged for undirected graphs.
         * Takes `O(1)` time.
         */
        /**
         * Gets the label for the specified edge.
         *
         * @overload
         * @param {NodeID | number} v - Source node ID.
         * @param {NodeID | number} w - Target node ID.
         * @param {string | number} [name] - Edge name. Only useful with multigraphs.
         * @returns {EdgeLabel | undefined} the label for the edge (`v`, `w`) if the
         * graph has an edge between `v` and `w` with the optional `name`.
         * Returned `undefined` if there is no such edge in the graph.
         * @remarks
         * `v` and `w` can be interchanged for undirected graphs.
         * Takes `O(1)` time.
         */
        edge(v3, w4, name) {
          var e3 = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v3, w4, name);
          return this._edgeLabels[e3];
        }
        /**
         * Detects whether the graph contains specified edge or not.
         *
         * @overload
         * @param {EdgeObj} v - Edge object.
         * @returns {boolean} `true` if the graph has an edge between `v` and `w`
         * with the optional `name`.
         * @remarks
         * `v` and `w` can be interchanged for undirected graphs.
         * No subgraphs are considered.
         * Takes `O(1)` time.
         */
        /**
         * Detects whether the graph contains specified edge or not.
         *
         * @overload
         * @param {NodeID | number} v - Source node ID.
         * @param {NodeID | number} w - Target node ID.
         * @param {string | number} [name] - Edge name. Only useful with multigraphs.
         * @returns {boolean} `true` if the graph has an edge between `v` and `w`
         * with the optional `name`.
         * @remarks
         * `v` and `w` can be interchanged for undirected graphs.
         * No subgraphs are considered.
         * Takes `O(1)` time.
         */
        hasEdge(v3, w4, name) {
          var e3 = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v3, w4, name);
          return Object.prototype.hasOwnProperty.call(this._edgeLabels, e3);
        }
        /**
         * Removes the edge (`v`, `w`) if the graph has an edge between `v` and `w`
         * with the optional `name`. If not this function does nothing.
         *
         * @overload
         * @param {EdgeObj} v - Edge object.
         * @returns {this}
         * @remarks
         * `v` and `w` can be interchanged for undirected graphs.
         * No subgraphs are considered.
         * Takes `O(1)` time.
         */
        /**
         * Removes the edge (`v`, `w`) if the graph has an edge between `v` and `w`
         * with the optional `name`. If not this function does nothing.
         *
         * @overload
         * @param {NodeID | number} v - Source node ID.
         * @param {NodeID | number} w - Target node ID.
         * @param {string | number} [name] - Edge name. Only useful with multigraphs.
         * @returns {this}
         * @remarks
         * `v` and `w` can be interchanged for undirected graphs.
         * Takes `O(1)` time.
         */
        removeEdge(v3, w4, name) {
          var e3 = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v3, w4, name);
          var edge = this._edgeObjs[e3];
          if (edge) {
            v3 = edge.v;
            w4 = edge.w;
            delete this._edgeLabels[e3];
            delete this._edgeObjs[e3];
            decrementOrRemoveEntry(this._preds[w4], v3);
            decrementOrRemoveEntry(this._sucs[v3], w4);
            delete this._in[w4][e3];
            delete this._out[v3][e3];
            this._edgeCount--;
          }
          return this;
        }
        /**
         * @param {NodeID | number} v - Target node ID.
         * @param {NodeID | number} [u] - Optionally filters edges down to just those
         * coming from node `u`.
         * @returns {EdgeObj[] | undefined} all edges that point to the node `v`.
         * Returns `undefined` if node `v` is not in the graph.
         * @remarks
         * Behavior is undefined for undirected graphs - use {@link nodeEdges} instead.
         * Takes `O(|E|)` time.
         */
        inEdges(v3, u2) {
          var inV = this._in[v3];
          if (inV) {
            var edges3 = values_default(inV);
            if (!u2) {
              return edges3;
            }
            return filter_default3(edges3, function(edge) {
              return edge.v === u2;
            });
          }
        }
        /**
         * @param {NodeID | number} v - Target node ID.
         * @param {NodeID | number} [w] - Optionally filters edges down to just those
         * that point to `w`.
         * @returns {EdgeObj[] | undefined} all edges that point to the node `v`.
         * Returns `undefined` if node `v` is not in the graph.
         * @remarks
         * Behavior is undefined for undirected graphs - use {@link nodeEdges} instead.
         * Takes `O(|E|)` time.
         */
        outEdges(v3, w4) {
          var outV = this._out[v3];
          if (outV) {
            var edges3 = values_default(outV);
            if (!w4) {
              return edges3;
            }
            return filter_default3(edges3, function(edge) {
              return edge.w === w4;
            });
          }
        }
        /**
         * @param {NodeID | number} v - Target Node ID.
         * @param {NodeID | number} [w] - If set, filters those edges down to just
         * those between nodes `v` and `w` regardless of direction
         * @returns {EdgeObj[] | undefined} all edges to or from node `v` regardless
         * of direction. Returns `undefined` if node `v` is not in the graph.
         * @remarks Takes `O(|E|)` time.
         */
        nodeEdges(v3, w4) {
          var inEdges = this.inEdges(v3, w4);
          if (inEdges) {
            return inEdges.concat(this.outEdges(v3, w4));
          }
        }
      };
      Graph.prototype._nodeCount = 0;
      Graph.prototype._edgeCount = 0;
      __name(incrementOrInitEntry, "incrementOrInitEntry");
      __name(decrementOrRemoveEntry, "decrementOrRemoveEntry");
      __name(edgeArgsToId, "edgeArgsToId");
      __name(edgeArgsToObj, "edgeArgsToObj");
      __name(edgeObjToId, "edgeObjToId");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/index.js
  var init_graphlib = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/index.js"() {
      "use strict";
      init_graph();
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/data/list.js
  function unlink(entry) {
    entry._prev._next = entry._next;
    entry._next._prev = entry._prev;
    delete entry._next;
    delete entry._prev;
  }
  function filterOutLinks(k2, v3) {
    if (k2 !== "_next" && k2 !== "_prev") {
      return v3;
    }
  }
  var List;
  var init_list = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/data/list.js"() {
      "use strict";
      List = class {
        static {
          __name(this, "List");
        }
        constructor() {
          var sentinel = {};
          sentinel._next = sentinel._prev = sentinel;
          this._sentinel = sentinel;
        }
        dequeue() {
          var sentinel = this._sentinel;
          var entry = sentinel._prev;
          if (entry !== sentinel) {
            unlink(entry);
            return entry;
          }
        }
        enqueue(entry) {
          var sentinel = this._sentinel;
          if (entry._prev && entry._next) {
            unlink(entry);
          }
          entry._next = sentinel._next;
          sentinel._next._prev = entry;
          sentinel._next = entry;
          entry._prev = sentinel;
        }
        toString() {
          var strs = [];
          var sentinel = this._sentinel;
          var curr = sentinel._prev;
          while (curr !== sentinel) {
            strs.push(JSON.stringify(curr, filterOutLinks));
            curr = curr._prev;
          }
          return "[" + strs.join(", ") + "]";
        }
      };
      __name(unlink, "unlink");
      __name(filterOutLinks, "filterOutLinks");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/greedy-fas.js
  function greedyFAS(g2, weightFn) {
    if (g2.nodeCount() <= 1) {
      return [];
    }
    var state4 = buildState(g2, weightFn || DEFAULT_WEIGHT_FN);
    var results = doGreedyFAS(state4.graph, state4.buckets, state4.zeroIdx);
    return flatten_default(
      map_default(results, function(e3) {
        return g2.outEdges(e3.v, e3.w);
      })
    );
  }
  function doGreedyFAS(g2, buckets, zeroIdx) {
    var results = [];
    var sources = buckets[buckets.length - 1];
    var sinks = buckets[0];
    var entry;
    while (g2.nodeCount()) {
      while (entry = sinks.dequeue()) {
        removeNode(g2, buckets, zeroIdx, entry);
      }
      while (entry = sources.dequeue()) {
        removeNode(g2, buckets, zeroIdx, entry);
      }
      if (g2.nodeCount()) {
        for (var i2 = buckets.length - 2; i2 > 0; --i2) {
          entry = buckets[i2].dequeue();
          if (entry) {
            results = results.concat(removeNode(g2, buckets, zeroIdx, entry, true));
            break;
          }
        }
      }
    }
    return results;
  }
  function removeNode(g2, buckets, zeroIdx, entry, collectPredecessors) {
    var results = collectPredecessors ? [] : void 0;
    forEach_default(g2.inEdges(entry.v), function(edge) {
      var weight8 = g2.edge(edge);
      var uEntry = g2.node(edge.v);
      if (collectPredecessors) {
        results.push({ v: edge.v, w: edge.w });
      }
      uEntry.out -= weight8;
      assignBucket(buckets, zeroIdx, uEntry);
    });
    forEach_default(g2.outEdges(entry.v), function(edge) {
      var weight8 = g2.edge(edge);
      var w4 = edge.w;
      var wEntry = g2.node(w4);
      wEntry["in"] -= weight8;
      assignBucket(buckets, zeroIdx, wEntry);
    });
    g2.removeNode(entry.v);
    return results;
  }
  function buildState(g2, weightFn) {
    var fasGraph = new Graph();
    var maxIn = 0;
    var maxOut = 0;
    forEach_default(g2.nodes(), function(v3) {
      fasGraph.setNode(v3, { v: v3, in: 0, out: 0 });
    });
    forEach_default(g2.edges(), function(e3) {
      var prevWeight = fasGraph.edge(e3.v, e3.w) || 0;
      var weight8 = weightFn(e3);
      var edgeWeight = prevWeight + weight8;
      fasGraph.setEdge(e3.v, e3.w, edgeWeight);
      maxOut = Math.max(maxOut, fasGraph.node(e3.v).out += weight8);
      maxIn = Math.max(maxIn, fasGraph.node(e3.w)["in"] += weight8);
    });
    var buckets = range_default(maxOut + maxIn + 3).map(function() {
      return new List();
    });
    var zeroIdx = maxIn + 1;
    forEach_default(fasGraph.nodes(), function(v3) {
      assignBucket(buckets, zeroIdx, fasGraph.node(v3));
    });
    return { graph: fasGraph, buckets, zeroIdx };
  }
  function assignBucket(buckets, zeroIdx, entry) {
    if (!entry.out) {
      buckets[0].enqueue(entry);
    } else if (!entry["in"]) {
      buckets[buckets.length - 1].enqueue(entry);
    } else {
      buckets[entry.out - entry["in"] + zeroIdx].enqueue(entry);
    }
  }
  var DEFAULT_WEIGHT_FN;
  var init_greedy_fas = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/greedy-fas.js"() {
      "use strict";
      init_lodash();
      init_graphlib();
      init_list();
      DEFAULT_WEIGHT_FN = constant_default7(1);
      __name(greedyFAS, "greedyFAS");
      __name(doGreedyFAS, "doGreedyFAS");
      __name(removeNode, "removeNode");
      __name(buildState, "buildState");
      __name(assignBucket, "assignBucket");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/acyclic.js
  function run(g2) {
    var fas = g2.graph().acyclicer === "greedy" ? greedyFAS(g2, weightFn(g2)) : dfsFAS(g2);
    forEach_default(fas, function(e3) {
      var label = g2.edge(e3);
      g2.removeEdge(e3);
      label.forwardName = e3.name;
      label.reversed = true;
      g2.setEdge(e3.w, e3.v, label, uniqueId_default("rev"));
    });
    function weightFn(g3) {
      return function(e3) {
        return g3.edge(e3).weight;
      };
    }
    __name(weightFn, "weightFn");
  }
  function dfsFAS(g2) {
    var fas = [];
    var stack = {};
    var visited = {};
    function dfs3(v3) {
      if (Object.prototype.hasOwnProperty.call(visited, v3)) {
        return;
      }
      visited[v3] = true;
      stack[v3] = true;
      forEach_default(g2.outEdges(v3), function(e3) {
        if (Object.prototype.hasOwnProperty.call(stack, e3.w)) {
          fas.push(e3);
        } else {
          dfs3(e3.w);
        }
      });
      delete stack[v3];
    }
    __name(dfs3, "dfs");
    forEach_default(g2.nodes(), dfs3);
    return fas;
  }
  function undo(g2) {
    forEach_default(g2.edges(), function(e3) {
      var label = g2.edge(e3);
      if (label.reversed) {
        g2.removeEdge(e3);
        var forwardName = label.forwardName;
        delete label.reversed;
        delete label.forwardName;
        g2.setEdge(e3.w, e3.v, label, forwardName);
      }
    });
  }
  var init_acyclic = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/acyclic.js"() {
      "use strict";
      init_lodash();
      init_greedy_fas();
      __name(run, "run");
      __name(dfsFAS, "dfsFAS");
      __name(undo, "undo");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/util.js
  function addDummyNode(g2, type3, attrs, name) {
    var v3;
    do {
      v3 = uniqueId_default(name);
    } while (g2.hasNode(v3));
    attrs.dummy = type3;
    g2.setNode(v3, attrs);
    return v3;
  }
  function simplify(g2) {
    var simplified = new Graph().setGraph(g2.graph());
    forEach_default(g2.nodes(), function(v3) {
      simplified.setNode(v3, g2.node(v3));
    });
    forEach_default(g2.edges(), function(e3) {
      var simpleLabel = simplified.edge(e3.v, e3.w) || { weight: 0, minlen: 1 };
      var label = g2.edge(e3);
      simplified.setEdge(e3.v, e3.w, {
        weight: simpleLabel.weight + label.weight,
        minlen: Math.max(simpleLabel.minlen, label.minlen)
      });
    });
    return simplified;
  }
  function asNonCompoundGraph(g2) {
    var simplified = new Graph({ multigraph: g2.isMultigraph() }).setGraph(g2.graph());
    forEach_default(g2.nodes(), function(v3) {
      if (!g2.children(v3).length) {
        simplified.setNode(v3, g2.node(v3));
      }
    });
    forEach_default(g2.edges(), function(e3) {
      simplified.setEdge(e3, g2.edge(e3));
    });
    return simplified;
  }
  function intersectRect2(rect3, point8) {
    var x5 = rect3.x;
    var y6 = rect3.y;
    var dx = point8.x - x5;
    var dy = point8.y - y6;
    var w4 = rect3.width / 2;
    var h3 = rect3.height / 2;
    if (!dx && !dy) {
      throw new Error("Not possible to find intersection inside of the rectangle");
    }
    var sx, sy;
    if (Math.abs(dy) * w4 > Math.abs(dx) * h3) {
      if (dy < 0) {
        h3 = -h3;
      }
      sx = h3 * dx / dy;
      sy = h3;
    } else {
      if (dx < 0) {
        w4 = -w4;
      }
      sx = w4;
      sy = w4 * dy / dx;
    }
    return { x: x5 + sx, y: y6 + sy };
  }
  function buildLayerMatrix(g2) {
    var layering = map_default(range_default(maxRank(g2) + 1), function() {
      return [];
    });
    forEach_default(g2.nodes(), function(v3) {
      var node2 = g2.node(v3);
      var rank2 = node2.rank;
      if (!isUndefined_default(rank2)) {
        layering[rank2][node2.order] = v3;
      }
    });
    return layering;
  }
  function normalizeRanks(g2) {
    var min9 = min_default(
      map_default(g2.nodes(), function(v3) {
        return g2.node(v3).rank;
      })
    );
    forEach_default(g2.nodes(), function(v3) {
      var node2 = g2.node(v3);
      if (has_default(node2, "rank")) {
        node2.rank -= min9;
      }
    });
  }
  function removeEmptyRanks(g2) {
    var offset = min_default(
      map_default(g2.nodes(), function(v3) {
        return g2.node(v3).rank;
      })
    );
    var layers = [];
    forEach_default(g2.nodes(), function(v3) {
      var rank2 = g2.node(v3).rank - offset;
      if (!layers[rank2]) {
        layers[rank2] = [];
      }
      layers[rank2].push(v3);
    });
    var delta = 0;
    var nodeRankFactor = g2.graph().nodeRankFactor;
    forEach_default(layers, function(vs, i2) {
      if (isUndefined_default(vs) && i2 % nodeRankFactor !== 0) {
        --delta;
      } else if (delta) {
        forEach_default(vs, function(v3) {
          g2.node(v3).rank += delta;
        });
      }
    });
  }
  function addBorderNode(g2, prefix, rank2, order2) {
    var node2 = {
      width: 0,
      height: 0
    };
    if (arguments.length >= 4) {
      node2.rank = rank2;
      node2.order = order2;
    }
    return addDummyNode(g2, "border", node2, prefix);
  }
  function maxRank(g2) {
    return max_default(
      map_default(g2.nodes(), function(v3) {
        var rank2 = g2.node(v3).rank;
        if (!isUndefined_default(rank2)) {
          return rank2;
        }
      })
    );
  }
  function partition(collection4, fn3) {
    var result = { lhs: [], rhs: [] };
    forEach_default(collection4, function(value2) {
      if (fn3(value2)) {
        result.lhs.push(value2);
      } else {
        result.rhs.push(value2);
      }
    });
    return result;
  }
  function time2(name, fn3) {
    var start3 = now_default();
    try {
      return fn3();
    } finally {
      console.log(name + " time: " + (now_default() - start3) + "ms");
    }
  }
  function notime(name, fn3) {
    return fn3();
  }
  var init_util2 = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/util.js"() {
      "use strict";
      init_lodash();
      init_graphlib();
      __name(addDummyNode, "addDummyNode");
      __name(simplify, "simplify");
      __name(asNonCompoundGraph, "asNonCompoundGraph");
      __name(intersectRect2, "intersectRect");
      __name(buildLayerMatrix, "buildLayerMatrix");
      __name(normalizeRanks, "normalizeRanks");
      __name(removeEmptyRanks, "removeEmptyRanks");
      __name(addBorderNode, "addBorderNode");
      __name(maxRank, "maxRank");
      __name(partition, "partition");
      __name(time2, "time");
      __name(notime, "notime");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/add-border-segments.js
  function addBorderSegments(g2) {
    function dfs3(v3) {
      var children2 = g2.children(v3);
      var node2 = g2.node(v3);
      if (children2.length) {
        forEach_default(children2, dfs3);
      }
      if (Object.prototype.hasOwnProperty.call(node2, "minRank")) {
        node2.borderLeft = [];
        node2.borderRight = [];
        for (var rank2 = node2.minRank, maxRank2 = node2.maxRank + 1; rank2 < maxRank2; ++rank2) {
          addBorderNode2(g2, "borderLeft", "_bl", v3, node2, rank2);
          addBorderNode2(g2, "borderRight", "_br", v3, node2, rank2);
        }
      }
    }
    __name(dfs3, "dfs");
    forEach_default(g2.children(), dfs3);
  }
  function addBorderNode2(g2, prop, prefix, sg, sgNode, rank2) {
    var label = { width: 0, height: 0, rank: rank2, borderType: prop };
    var prev2 = sgNode[prop][rank2 - 1];
    var curr = addDummyNode(g2, "border", label, prefix);
    sgNode[prop][rank2] = curr;
    g2.setParent(curr, sg);
    if (prev2) {
      g2.setEdge(prev2, curr, { weight: 1 });
    }
  }
  var init_add_border_segments = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/add-border-segments.js"() {
      "use strict";
      init_lodash();
      init_util2();
      __name(addBorderSegments, "addBorderSegments");
      __name(addBorderNode2, "addBorderNode");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/coordinate-system.js
  function adjust2(g2) {
    var rankDir = g2.graph().rankdir.toLowerCase();
    if (rankDir === "lr" || rankDir === "rl") {
      swapWidthHeight(g2);
    }
  }
  function undo2(g2) {
    var rankDir = g2.graph().rankdir.toLowerCase();
    if (rankDir === "bt" || rankDir === "rl") {
      reverseY(g2);
    }
    if (rankDir === "lr" || rankDir === "rl") {
      swapXY(g2);
      swapWidthHeight(g2);
    }
  }
  function swapWidthHeight(g2) {
    forEach_default(g2.nodes(), function(v3) {
      swapWidthHeightOne(g2.node(v3));
    });
    forEach_default(g2.edges(), function(e3) {
      swapWidthHeightOne(g2.edge(e3));
    });
  }
  function swapWidthHeightOne(attrs) {
    var w4 = attrs.width;
    attrs.width = attrs.height;
    attrs.height = w4;
  }
  function reverseY(g2) {
    forEach_default(g2.nodes(), function(v3) {
      reverseYOne(g2.node(v3));
    });
    forEach_default(g2.edges(), function(e3) {
      var edge = g2.edge(e3);
      forEach_default(edge.points, reverseYOne);
      if (Object.prototype.hasOwnProperty.call(edge, "y")) {
        reverseYOne(edge);
      }
    });
  }
  function reverseYOne(attrs) {
    attrs.y = -attrs.y;
  }
  function swapXY(g2) {
    forEach_default(g2.nodes(), function(v3) {
      swapXYOne(g2.node(v3));
    });
    forEach_default(g2.edges(), function(e3) {
      var edge = g2.edge(e3);
      forEach_default(edge.points, swapXYOne);
      if (Object.prototype.hasOwnProperty.call(edge, "x")) {
        swapXYOne(edge);
      }
    });
  }
  function swapXYOne(attrs) {
    var x5 = attrs.x;
    attrs.x = attrs.y;
    attrs.y = x5;
  }
  var init_coordinate_system = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/coordinate-system.js"() {
      "use strict";
      init_lodash();
      __name(adjust2, "adjust");
      __name(undo2, "undo");
      __name(swapWidthHeight, "swapWidthHeight");
      __name(swapWidthHeightOne, "swapWidthHeightOne");
      __name(reverseY, "reverseY");
      __name(reverseYOne, "reverseYOne");
      __name(swapXY, "swapXY");
      __name(swapXYOne, "swapXYOne");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/normalize.js
  function run2(g2) {
    g2.graph().dummyChains = [];
    forEach_default(g2.edges(), function(edge) {
      normalizeEdge(g2, edge);
    });
  }
  function normalizeEdge(g2, e3) {
    var v3 = e3.v;
    var vRank = g2.node(v3).rank;
    var w4 = e3.w;
    var wRank = g2.node(w4).rank;
    var name = e3.name;
    var edgeLabel = g2.edge(e3);
    var labelRank = edgeLabel.labelRank;
    if (wRank === vRank + 1) return;
    g2.removeEdge(e3);
    var attrs = void 0;
    var dummy, i2;
    for (i2 = 0, ++vRank; vRank < wRank; ++i2, ++vRank) {
      edgeLabel.points = [];
      attrs = {
        width: 0,
        height: 0,
        edgeLabel,
        edgeObj: e3,
        rank: vRank
      };
      dummy = addDummyNode(g2, "edge", attrs, "_d");
      if (vRank === labelRank) {
        attrs.width = edgeLabel.width;
        attrs.height = edgeLabel.height;
        attrs.dummy = "edge-label";
        attrs.labelpos = edgeLabel.labelpos;
      }
      g2.setEdge(v3, dummy, { weight: edgeLabel.weight }, name);
      if (i2 === 0) {
        g2.graph().dummyChains.push(dummy);
      }
      v3 = dummy;
    }
    g2.setEdge(v3, w4, { weight: edgeLabel.weight }, name);
  }
  function undo3(g2) {
    forEach_default(g2.graph().dummyChains, function(v3) {
      var node2 = g2.node(v3);
      var origLabel = node2.edgeLabel;
      var w4;
      g2.setEdge(node2.edgeObj, origLabel);
      while (node2.dummy) {
        w4 = g2.successors(v3)[0];
        g2.removeNode(v3);
        origLabel.points.push({ x: node2.x, y: node2.y });
        if (node2.dummy === "edge-label") {
          origLabel.x = node2.x;
          origLabel.y = node2.y;
          origLabel.width = node2.width;
          origLabel.height = node2.height;
        }
        v3 = w4;
        node2 = g2.node(v3);
      }
    });
  }
  var init_normalize = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/normalize.js"() {
      "use strict";
      init_lodash();
      init_util2();
      __name(run2, "run");
      __name(normalizeEdge, "normalizeEdge");
      __name(undo3, "undo");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/util.js
  function longestPath(g2) {
    var visited = {};
    function dfs3(v3) {
      var label = g2.node(v3);
      if (Object.prototype.hasOwnProperty.call(visited, v3)) {
        return label.rank;
      }
      visited[v3] = true;
      var rank2 = min_default(
        map_default(g2.outEdges(v3), function(e3) {
          return dfs3(e3.w) - g2.edge(e3).minlen;
        })
      );
      if (rank2 === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3
      rank2 === void 0 || // return value of _.map([]) for Lodash 4
      rank2 === null) {
        rank2 = 0;
      }
      return label.rank = rank2;
    }
    __name(dfs3, "dfs");
    forEach_default(g2.sources(), dfs3);
  }
  function slack(g2, e3) {
    return g2.node(e3.w).rank - g2.node(e3.v).rank - g2.edge(e3).minlen;
  }
  var init_util3 = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/util.js"() {
      "use strict";
      init_lodash();
      __name(longestPath, "longestPath");
      __name(slack, "slack");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/feasible-tree.js
  function feasibleTree(g2) {
    var t4 = new Graph({ directed: false });
    var start3 = g2.nodes()[0];
    var size4 = g2.nodeCount();
    t4.setNode(start3, {});
    var edge, delta;
    while (tightTree(t4, g2) < size4) {
      edge = findMinSlackEdge(t4, g2);
      delta = t4.hasNode(edge.v) ? slack(g2, edge) : -slack(g2, edge);
      shiftRanks(t4, g2, delta);
    }
    return t4;
  }
  function tightTree(t4, g2) {
    function dfs3(v3) {
      forEach_default(g2.nodeEdges(v3), function(e3) {
        var edgeV = e3.v, w4 = v3 === edgeV ? e3.w : edgeV;
        if (!t4.hasNode(w4) && !slack(g2, e3)) {
          t4.setNode(w4, {});
          t4.setEdge(v3, w4, {});
          dfs3(w4);
        }
      });
    }
    __name(dfs3, "dfs");
    forEach_default(t4.nodes(), dfs3);
    return t4.nodeCount();
  }
  function findMinSlackEdge(t4, g2) {
    return minBy_default(g2.edges(), function(e3) {
      if (t4.hasNode(e3.v) !== t4.hasNode(e3.w)) {
        return slack(g2, e3);
      }
    });
  }
  function shiftRanks(t4, g2, delta) {
    forEach_default(t4.nodes(), function(v3) {
      g2.node(v3).rank += delta;
    });
  }
  var init_feasible_tree = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/feasible-tree.js"() {
      "use strict";
      init_lodash();
      init_graphlib();
      init_util3();
      __name(feasibleTree, "feasibleTree");
      __name(tightTree, "tightTree");
      __name(findMinSlackEdge, "findMinSlackEdge");
      __name(shiftRanks, "shiftRanks");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/components.js
  var init_components = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/components.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/data/priority-queue.js
  var init_priority_queue = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/data/priority-queue.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dijkstra.js
  var DEFAULT_WEIGHT_FUNC;
  var init_dijkstra = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dijkstra.js"() {
      "use strict";
      init_lodash();
      init_priority_queue();
      DEFAULT_WEIGHT_FUNC = constant_default7(1);
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dijkstra-all.js
  var init_dijkstra_all = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dijkstra-all.js"() {
      "use strict";
      init_dijkstra();
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/tarjan.js
  var init_tarjan = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/tarjan.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/find-cycles.js
  var init_find_cycles = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/find-cycles.js"() {
      "use strict";
      init_tarjan();
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/floyd-warshall.js
  var DEFAULT_WEIGHT_FUNC2;
  var init_floyd_warshall = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/floyd-warshall.js"() {
      "use strict";
      init_lodash();
      DEFAULT_WEIGHT_FUNC2 = constant_default7(1);
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/topsort.js
  function topsort(g2) {
    var visited = {};
    var stack = {};
    var results = [];
    function visit(node2) {
      if (Object.prototype.hasOwnProperty.call(stack, node2)) {
        throw new CycleException();
      }
      if (!Object.prototype.hasOwnProperty.call(visited, node2)) {
        stack[node2] = true;
        visited[node2] = true;
        forEach_default(g2.predecessors(node2), visit);
        delete stack[node2];
        results.push(node2);
      }
    }
    __name(visit, "visit");
    forEach_default(g2.sinks(), visit);
    if (size_default2(visited) !== g2.nodeCount()) {
      throw new CycleException();
    }
    return results;
  }
  function CycleException() {
  }
  var init_topsort = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/topsort.js"() {
      "use strict";
      init_lodash();
      topsort.CycleException = CycleException;
      __name(topsort, "topsort");
      __name(CycleException, "CycleException");
      CycleException.prototype = new Error();
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/is-acyclic.js
  var init_is_acyclic = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/is-acyclic.js"() {
      "use strict";
      init_topsort();
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dfs.js
  function dfs(g2, vs, order2) {
    if (!isArray_default(vs)) {
      vs = [vs];
    }
    var navigation = (g2.isDirected() ? g2.successors : g2.neighbors).bind(g2);
    var acc = [];
    var visited = {};
    forEach_default(vs, function(v3) {
      if (!g2.hasNode(v3)) {
        throw new Error("Graph does not have node: " + v3);
      }
      doDfs(g2, v3, order2 === "post", visited, navigation, acc);
    });
    return acc;
  }
  function doDfs(g2, v3, postorder3, visited, navigation, acc) {
    if (!Object.prototype.hasOwnProperty.call(visited, v3)) {
      visited[v3] = true;
      if (!postorder3) {
        acc.push(v3);
      }
      forEach_default(navigation(v3), function(w4) {
        doDfs(g2, w4, postorder3, visited, navigation, acc);
      });
      if (postorder3) {
        acc.push(v3);
      }
    }
  }
  var init_dfs = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dfs.js"() {
      "use strict";
      init_lodash();
      __name(dfs, "dfs");
      __name(doDfs, "doDfs");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/postorder.js
  function postorder(g2, vs) {
    return dfs(g2, vs, "post");
  }
  var init_postorder = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/postorder.js"() {
      "use strict";
      init_dfs();
      __name(postorder, "postorder");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/preorder.js
  function preorder(g2, vs) {
    return dfs(g2, vs, "pre");
  }
  var init_preorder = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/preorder.js"() {
      "use strict";
      init_dfs();
      __name(preorder, "preorder");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/prim.js
  var init_prim = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/prim.js"() {
      "use strict";
      init_priority_queue();
      init_graph();
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/index.js
  var init_alg = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/index.js"() {
      "use strict";
      init_components();
      init_dijkstra();
      init_dijkstra_all();
      init_find_cycles();
      init_floyd_warshall();
      init_is_acyclic();
      init_postorder();
      init_preorder();
      init_prim();
      init_tarjan();
      init_topsort();
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js
  function networkSimplex(g2) {
    g2 = simplify(g2);
    longestPath(g2);
    var t4 = feasibleTree(g2);
    initLowLimValues(t4);
    initCutValues(t4, g2);
    var e3, f2;
    while (e3 = leaveEdge(t4)) {
      f2 = enterEdge(t4, g2, e3);
      exchangeEdges(t4, g2, e3, f2);
    }
  }
  function initCutValues(t4, g2) {
    var vs = postorder(t4, t4.nodes());
    vs = vs.slice(0, vs.length - 1);
    forEach_default(vs, function(v3) {
      assignCutValue(t4, g2, v3);
    });
  }
  function assignCutValue(t4, g2, child) {
    var childLab = t4.node(child);
    var parent4 = childLab.parent;
    t4.edge(child, parent4).cutvalue = calcCutValue(t4, g2, child);
  }
  function calcCutValue(t4, g2, child) {
    var childLab = t4.node(child);
    var parent4 = childLab.parent;
    var childIsTail = true;
    var graphEdge = g2.edge(child, parent4);
    var cutValue = 0;
    if (!graphEdge) {
      childIsTail = false;
      graphEdge = g2.edge(parent4, child);
    }
    cutValue = graphEdge.weight;
    forEach_default(g2.nodeEdges(child), function(e3) {
      var isOutEdge = e3.v === child, other = isOutEdge ? e3.w : e3.v;
      if (other !== parent4) {
        var pointsToHead = isOutEdge === childIsTail, otherWeight = g2.edge(e3).weight;
        cutValue += pointsToHead ? otherWeight : -otherWeight;
        if (isTreeEdge(t4, child, other)) {
          var otherCutValue = t4.edge(child, other).cutvalue;
          cutValue += pointsToHead ? -otherCutValue : otherCutValue;
        }
      }
    });
    return cutValue;
  }
  function initLowLimValues(tree, root3) {
    if (arguments.length < 2) {
      root3 = tree.nodes()[0];
    }
    dfsAssignLowLim(tree, {}, 1, root3);
  }
  function dfsAssignLowLim(tree, visited, nextLim, v3, parent4) {
    var low = nextLim;
    var label = tree.node(v3);
    visited[v3] = true;
    forEach_default(tree.neighbors(v3), function(w4) {
      if (!Object.prototype.hasOwnProperty.call(visited, w4)) {
        nextLim = dfsAssignLowLim(tree, visited, nextLim, w4, v3);
      }
    });
    label.low = low;
    label.lim = nextLim++;
    if (parent4) {
      label.parent = parent4;
    } else {
      delete label.parent;
    }
    return nextLim;
  }
  function leaveEdge(tree) {
    return find_default2(tree.edges(), function(e3) {
      return tree.edge(e3).cutvalue < 0;
    });
  }
  function enterEdge(t4, g2, edge) {
    var v3 = edge.v;
    var w4 = edge.w;
    if (!g2.hasEdge(v3, w4)) {
      v3 = edge.w;
      w4 = edge.v;
    }
    var vLabel = t4.node(v3);
    var wLabel = t4.node(w4);
    var tailLabel = vLabel;
    var flip = false;
    if (vLabel.lim > wLabel.lim) {
      tailLabel = wLabel;
      flip = true;
    }
    var candidates = filter_default3(g2.edges(), function(edge2) {
      return flip === isDescendant(t4, t4.node(edge2.v), tailLabel) && flip !== isDescendant(t4, t4.node(edge2.w), tailLabel);
    });
    return minBy_default(candidates, function(edge2) {
      return slack(g2, edge2);
    });
  }
  function exchangeEdges(t4, g2, e3, f2) {
    var v3 = e3.v;
    var w4 = e3.w;
    t4.removeEdge(v3, w4);
    t4.setEdge(f2.v, f2.w, {});
    initLowLimValues(t4);
    initCutValues(t4, g2);
    updateRanks(t4, g2);
  }
  function updateRanks(t4, g2) {
    var root3 = find_default2(t4.nodes(), function(v3) {
      return !g2.node(v3).parent;
    });
    var vs = preorder(t4, root3);
    vs = vs.slice(1);
    forEach_default(vs, function(v3) {
      var parent4 = t4.node(v3).parent, edge = g2.edge(v3, parent4), flipped = false;
      if (!edge) {
        edge = g2.edge(parent4, v3);
        flipped = true;
      }
      g2.node(v3).rank = g2.node(parent4).rank + (flipped ? edge.minlen : -edge.minlen);
    });
  }
  function isTreeEdge(tree, u2, v3) {
    return tree.hasEdge(u2, v3);
  }
  function isDescendant(tree, vLabel, rootLabel) {
    return rootLabel.low <= vLabel.lim && vLabel.lim <= rootLabel.lim;
  }
  var init_network_simplex = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js"() {
      "use strict";
      init_lodash();
      init_alg();
      init_util2();
      init_feasible_tree();
      init_util3();
      networkSimplex.initLowLimValues = initLowLimValues;
      networkSimplex.initCutValues = initCutValues;
      networkSimplex.calcCutValue = calcCutValue;
      networkSimplex.leaveEdge = leaveEdge;
      networkSimplex.enterEdge = enterEdge;
      networkSimplex.exchangeEdges = exchangeEdges;
      __name(networkSimplex, "networkSimplex");
      __name(initCutValues, "initCutValues");
      __name(assignCutValue, "assignCutValue");
      __name(calcCutValue, "calcCutValue");
      __name(initLowLimValues, "initLowLimValues");
      __name(dfsAssignLowLim, "dfsAssignLowLim");
      __name(leaveEdge, "leaveEdge");
      __name(enterEdge, "enterEdge");
      __name(exchangeEdges, "exchangeEdges");
      __name(updateRanks, "updateRanks");
      __name(isTreeEdge, "isTreeEdge");
      __name(isDescendant, "isDescendant");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/index.js
  function rank(g2) {
    switch (g2.graph().ranker) {
      case "network-simplex":
        networkSimplexRanker(g2);
        break;
      case "tight-tree":
        tightTreeRanker(g2);
        break;
      case "longest-path":
        longestPathRanker(g2);
        break;
      default:
        networkSimplexRanker(g2);
    }
  }
  function tightTreeRanker(g2) {
    longestPath(g2);
    feasibleTree(g2);
  }
  function networkSimplexRanker(g2) {
    networkSimplex(g2);
  }
  var longestPathRanker;
  var init_rank = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/index.js"() {
      "use strict";
      init_feasible_tree();
      init_network_simplex();
      init_util3();
      __name(rank, "rank");
      longestPathRanker = longestPath;
      __name(tightTreeRanker, "tightTreeRanker");
      __name(networkSimplexRanker, "networkSimplexRanker");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/nesting-graph.js
  function run3(g2) {
    var root3 = addDummyNode(g2, "root", {}, "_root");
    var depths = treeDepths(g2);
    var height2 = max_default(values_default(depths)) - 1;
    var nodeSep = 2 * height2 + 1;
    g2.graph().nestingRoot = root3;
    forEach_default(g2.edges(), function(e3) {
      g2.edge(e3).minlen *= nodeSep;
    });
    var weight8 = sumWeights(g2) + 1;
    forEach_default(g2.children(), function(child) {
      dfs2(g2, root3, nodeSep, weight8, height2, depths, child);
    });
    g2.graph().nodeRankFactor = nodeSep;
  }
  function dfs2(g2, root3, nodeSep, weight8, height2, depths, v3) {
    var children2 = g2.children(v3);
    if (!children2.length) {
      if (v3 !== root3) {
        g2.setEdge(root3, v3, { weight: 0, minlen: nodeSep });
      }
      return;
    }
    var top2 = addBorderNode(g2, "_bt");
    var bottom2 = addBorderNode(g2, "_bb");
    var label = g2.node(v3);
    g2.setParent(top2, v3);
    label.borderTop = top2;
    g2.setParent(bottom2, v3);
    label.borderBottom = bottom2;
    forEach_default(children2, function(child) {
      dfs2(g2, root3, nodeSep, weight8, height2, depths, child);
      var childNode = g2.node(child);
      var childTop = childNode.borderTop ? childNode.borderTop : child;
      var childBottom = childNode.borderBottom ? childNode.borderBottom : child;
      var thisWeight = childNode.borderTop ? weight8 : 2 * weight8;
      var minlen = childTop !== childBottom ? 1 : height2 - depths[v3] + 1;
      g2.setEdge(top2, childTop, {
        weight: thisWeight,
        minlen,
        nestingEdge: true
      });
      g2.setEdge(childBottom, bottom2, {
        weight: thisWeight,
        minlen,
        nestingEdge: true
      });
    });
    if (!g2.parent(v3)) {
      g2.setEdge(root3, top2, { weight: 0, minlen: height2 + depths[v3] });
    }
  }
  function treeDepths(g2) {
    var depths = {};
    function dfs3(v3, depth) {
      var children2 = g2.children(v3);
      if (children2 && children2.length) {
        forEach_default(children2, function(child) {
          dfs3(child, depth + 1);
        });
      }
      depths[v3] = depth;
    }
    __name(dfs3, "dfs");
    forEach_default(g2.children(), function(v3) {
      dfs3(v3, 1);
    });
    return depths;
  }
  function sumWeights(g2) {
    return reduce_default(
      g2.edges(),
      function(acc, e3) {
        return acc + g2.edge(e3).weight;
      },
      0
    );
  }
  function cleanup(g2) {
    var graphLabel = g2.graph();
    g2.removeNode(graphLabel.nestingRoot);
    delete graphLabel.nestingRoot;
    forEach_default(g2.edges(), function(e3) {
      var edge = g2.edge(e3);
      if (edge.nestingEdge) {
        g2.removeEdge(e3);
      }
    });
  }
  var init_nesting_graph = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/nesting-graph.js"() {
      "use strict";
      init_lodash();
      init_util2();
      __name(run3, "run");
      __name(dfs2, "dfs");
      __name(treeDepths, "treeDepths");
      __name(sumWeights, "sumWeights");
      __name(cleanup, "cleanup");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/add-subgraph-constraints.js
  function addSubgraphConstraints(g2, cg, vs) {
    var prev2 = {}, rootPrev;
    forEach_default(vs, function(v3) {
      var child = g2.parent(v3), parent4, prevChild;
      while (child) {
        parent4 = g2.parent(child);
        if (parent4) {
          prevChild = prev2[parent4];
          prev2[parent4] = child;
        } else {
          prevChild = rootPrev;
          rootPrev = child;
        }
        if (prevChild && prevChild !== child) {
          cg.setEdge(prevChild, child);
          return;
        }
        child = parent4;
      }
    });
  }
  var init_add_subgraph_constraints = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/add-subgraph-constraints.js"() {
      "use strict";
      init_lodash();
      __name(addSubgraphConstraints, "addSubgraphConstraints");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/build-layer-graph.js
  function buildLayerGraph(g2, rank2, relationship) {
    var root3 = createRootNode(g2), result = new Graph({ compound: true }).setGraph({ root: root3 }).setDefaultNodeLabel(function(v3) {
      return g2.node(v3);
    });
    forEach_default(g2.nodes(), function(v3) {
      var node2 = g2.node(v3), parent4 = g2.parent(v3);
      if (node2.rank === rank2 || node2.minRank <= rank2 && rank2 <= node2.maxRank) {
        result.setNode(v3);
        result.setParent(v3, parent4 || root3);
        forEach_default(g2[relationship](v3), function(e3) {
          var u2 = e3.v === v3 ? e3.w : e3.v, edge = result.edge(u2, v3), weight8 = !isUndefined_default(edge) ? edge.weight : 0;
          result.setEdge(u2, v3, { weight: g2.edge(e3).weight + weight8 });
        });
        if (Object.prototype.hasOwnProperty.call(node2, "minRank")) {
          result.setNode(v3, {
            borderLeft: node2.borderLeft[rank2],
            borderRight: node2.borderRight[rank2]
          });
        }
      }
    });
    return result;
  }
  function createRootNode(g2) {
    var v3;
    while (g2.hasNode(v3 = uniqueId_default("_root"))) ;
    return v3;
  }
  var init_build_layer_graph = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/build-layer-graph.js"() {
      "use strict";
      init_lodash();
      init_graphlib();
      __name(buildLayerGraph, "buildLayerGraph");
      __name(createRootNode, "createRootNode");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/cross-count.js
  function crossCount(g2, layering) {
    var cc2 = 0;
    for (var i2 = 1; i2 < layering.length; ++i2) {
      cc2 += twoLayerCrossCount(g2, layering[i2 - 1], layering[i2]);
    }
    return cc2;
  }
  function twoLayerCrossCount(g2, northLayer, southLayer) {
    var southPos = zipObject_default(
      southLayer,
      map_default(southLayer, function(v3, i2) {
        return i2;
      })
    );
    var southEntries = flatten_default(
      map_default(northLayer, function(v3) {
        return sortBy_default(
          map_default(g2.outEdges(v3), function(e3) {
            return { pos: southPos[e3.w], weight: g2.edge(e3).weight };
          }),
          "pos"
        );
      })
    );
    var firstIndex = 1;
    while (firstIndex < southLayer.length) firstIndex <<= 1;
    var treeSize = 2 * firstIndex - 1;
    firstIndex -= 1;
    var tree = map_default(new Array(treeSize), function() {
      return 0;
    });
    var cc2 = 0;
    forEach_default(
      // @ts-expect-error
      southEntries.forEach(function(entry) {
        var index = entry.pos + firstIndex;
        tree[index] += entry.weight;
        var weightSum = 0;
        while (index > 0) {
          if (index % 2) {
            weightSum += tree[index + 1];
          }
          index = index - 1 >> 1;
          tree[index] += entry.weight;
        }
        cc2 += entry.weight * weightSum;
      })
    );
    return cc2;
  }
  var init_cross_count = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/cross-count.js"() {
      "use strict";
      init_lodash();
      __name(crossCount, "crossCount");
      __name(twoLayerCrossCount, "twoLayerCrossCount");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/init-order.js
  function initOrder(g2) {
    var visited = {};
    var simpleNodes = filter_default3(g2.nodes(), function(v3) {
      return !g2.children(v3).length;
    });
    var maxRank2 = max_default(
      map_default(simpleNodes, function(v3) {
        return g2.node(v3).rank;
      })
    );
    var layers = map_default(range_default(maxRank2 + 1), function() {
      return [];
    });
    function dfs3(v3) {
      if (has_default(visited, v3)) return;
      visited[v3] = true;
      var node2 = g2.node(v3);
      layers[node2.rank].push(v3);
      forEach_default(g2.successors(v3), dfs3);
    }
    __name(dfs3, "dfs");
    var orderedVs = sortBy_default(simpleNodes, function(v3) {
      return g2.node(v3).rank;
    });
    forEach_default(orderedVs, dfs3);
    return layers;
  }
  var init_init_order = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/init-order.js"() {
      "use strict";
      init_lodash();
      __name(initOrder, "initOrder");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/barycenter.js
  function barycenter(g2, movable) {
    return map_default(movable, function(v3) {
      var inV = g2.inEdges(v3);
      if (!inV.length) {
        return { v: v3 };
      } else {
        var result = reduce_default(
          inV,
          function(acc, e3) {
            var edge = g2.edge(e3), nodeU = g2.node(e3.v);
            return {
              sum: acc.sum + edge.weight * nodeU.order,
              weight: acc.weight + edge.weight
            };
          },
          { sum: 0, weight: 0 }
        );
        return {
          v: v3,
          barycenter: result.sum / result.weight,
          weight: result.weight
        };
      }
    });
  }
  var init_barycenter = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/barycenter.js"() {
      "use strict";
      init_lodash();
      __name(barycenter, "barycenter");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js
  function resolveConflicts(entries2, cg) {
    var mappedEntries = {};
    forEach_default(entries2, function(entry, i2) {
      var tmp = mappedEntries[entry.v] = {
        indegree: 0,
        in: [],
        out: [],
        vs: [entry.v],
        i: i2
      };
      if (!isUndefined_default(entry.barycenter)) {
        tmp.barycenter = entry.barycenter;
        tmp.weight = entry.weight;
      }
    });
    forEach_default(cg.edges(), function(e3) {
      var entryV = mappedEntries[e3.v];
      var entryW = mappedEntries[e3.w];
      if (!isUndefined_default(entryV) && !isUndefined_default(entryW)) {
        entryW.indegree++;
        entryV.out.push(mappedEntries[e3.w]);
      }
    });
    var sourceSet = filter_default3(mappedEntries, function(entry) {
      return !entry.indegree;
    });
    return doResolveConflicts(sourceSet);
  }
  function doResolveConflicts(sourceSet) {
    var entries2 = [];
    function handleIn(vEntry) {
      return function(uEntry) {
        if (uEntry.merged) {
          return;
        }
        if (isUndefined_default(uEntry.barycenter) || isUndefined_default(vEntry.barycenter) || uEntry.barycenter >= vEntry.barycenter) {
          mergeEntries(vEntry, uEntry);
        }
      };
    }
    __name(handleIn, "handleIn");
    function handleOut(vEntry) {
      return function(wEntry) {
        wEntry["in"].push(vEntry);
        if (--wEntry.indegree === 0) {
          sourceSet.push(wEntry);
        }
      };
    }
    __name(handleOut, "handleOut");
    while (sourceSet.length) {
      var entry = sourceSet.pop();
      entries2.push(entry);
      forEach_default(entry["in"].reverse(), handleIn(entry));
      forEach_default(entry.out, handleOut(entry));
    }
    return map_default(
      filter_default3(entries2, function(entry2) {
        return !entry2.merged;
      }),
      function(entry2) {
        return pick_default(entry2, ["vs", "i", "barycenter", "weight"]);
      }
    );
  }
  function mergeEntries(target, source) {
    var sum2 = 0;
    var weight8 = 0;
    if (target.weight) {
      sum2 += target.barycenter * target.weight;
      weight8 += target.weight;
    }
    if (source.weight) {
      sum2 += source.barycenter * source.weight;
      weight8 += source.weight;
    }
    target.vs = source.vs.concat(target.vs);
    target.barycenter = sum2 / weight8;
    target.weight = weight8;
    target.i = Math.min(source.i, target.i);
    source.merged = true;
  }
  var init_resolve_conflicts = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js"() {
      "use strict";
      init_lodash();
      __name(resolveConflicts, "resolveConflicts");
      __name(doResolveConflicts, "doResolveConflicts");
      __name(mergeEntries, "mergeEntries");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/sort.js
  function sort(entries2, biasRight) {
    var parts = partition(entries2, function(entry) {
      return Object.prototype.hasOwnProperty.call(entry, "barycenter");
    });
    var sortable = parts.lhs, unsortable = sortBy_default(parts.rhs, function(entry) {
      return -entry.i;
    }), vs = [], sum2 = 0, weight8 = 0, vsIndex = 0;
    sortable.sort(compareWithBias(!!biasRight));
    vsIndex = consumeUnsortable(vs, unsortable, vsIndex);
    forEach_default(sortable, function(entry) {
      vsIndex += entry.vs.length;
      vs.push(entry.vs);
      sum2 += entry.barycenter * entry.weight;
      weight8 += entry.weight;
      vsIndex = consumeUnsortable(vs, unsortable, vsIndex);
    });
    var result = { vs: flatten_default(vs) };
    if (weight8) {
      result.barycenter = sum2 / weight8;
      result.weight = weight8;
    }
    return result;
  }
  function consumeUnsortable(vs, unsortable, index) {
    var last3;
    while (unsortable.length && (last3 = last_default(unsortable)).i <= index) {
      unsortable.pop();
      vs.push(last3.vs);
      index++;
    }
    return index;
  }
  function compareWithBias(bias) {
    return function(entryV, entryW) {
      if (entryV.barycenter < entryW.barycenter) {
        return -1;
      } else if (entryV.barycenter > entryW.barycenter) {
        return 1;
      }
      return !bias ? entryV.i - entryW.i : entryW.i - entryV.i;
    };
  }
  var init_sort3 = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/sort.js"() {
      "use strict";
      init_lodash();
      init_util2();
      __name(sort, "sort");
      __name(consumeUnsortable, "consumeUnsortable");
      __name(compareWithBias, "compareWithBias");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js
  function sortSubgraph(g2, v3, cg, biasRight) {
    var movable = g2.children(v3);
    var node2 = g2.node(v3);
    var bl = node2 ? node2.borderLeft : void 0;
    var br = node2 ? node2.borderRight : void 0;
    var subgraphs = {};
    if (bl) {
      movable = filter_default3(movable, function(w4) {
        return w4 !== bl && w4 !== br;
      });
    }
    var barycenters = barycenter(g2, movable);
    forEach_default(barycenters, function(entry) {
      if (g2.children(entry.v).length) {
        var subgraphResult = sortSubgraph(g2, entry.v, cg, biasRight);
        subgraphs[entry.v] = subgraphResult;
        if (Object.prototype.hasOwnProperty.call(subgraphResult, "barycenter")) {
          mergeBarycenters(entry, subgraphResult);
        }
      }
    });
    var entries2 = resolveConflicts(barycenters, cg);
    expandSubgraphs(entries2, subgraphs);
    var result = sort(entries2, biasRight);
    if (bl) {
      result.vs = flatten_default([bl, result.vs, br]);
      if (g2.predecessors(bl).length) {
        var blPred = g2.node(g2.predecessors(bl)[0]), brPred = g2.node(g2.predecessors(br)[0]);
        if (!Object.prototype.hasOwnProperty.call(result, "barycenter")) {
          result.barycenter = 0;
          result.weight = 0;
        }
        result.barycenter = (result.barycenter * result.weight + blPred.order + brPred.order) / (result.weight + 2);
        result.weight += 2;
      }
    }
    return result;
  }
  function expandSubgraphs(entries2, subgraphs) {
    forEach_default(entries2, function(entry) {
      entry.vs = flatten_default(
        entry.vs.map(function(v3) {
          if (subgraphs[v3]) {
            return subgraphs[v3].vs;
          }
          return v3;
        })
      );
    });
  }
  function mergeBarycenters(target, other) {
    if (!isUndefined_default(target.barycenter)) {
      target.barycenter = (target.barycenter * target.weight + other.barycenter * other.weight) / (target.weight + other.weight);
      target.weight += other.weight;
    } else {
      target.barycenter = other.barycenter;
      target.weight = other.weight;
    }
  }
  var init_sort_subgraph = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js"() {
      "use strict";
      init_lodash();
      init_barycenter();
      init_resolve_conflicts();
      init_sort3();
      __name(sortSubgraph, "sortSubgraph");
      __name(expandSubgraphs, "expandSubgraphs");
      __name(mergeBarycenters, "mergeBarycenters");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/index.js
  function order(g2) {
    var maxRank2 = maxRank(g2), downLayerGraphs = buildLayerGraphs(g2, range_default(1, maxRank2 + 1), "inEdges"), upLayerGraphs = buildLayerGraphs(g2, range_default(maxRank2 - 1, -1, -1), "outEdges");
    var layering = initOrder(g2);
    assignOrder(g2, layering);
    var bestCC = Number.POSITIVE_INFINITY, best;
    for (var i2 = 0, lastBest = 0; lastBest < 4; ++i2, ++lastBest) {
      sweepLayerGraphs(i2 % 2 ? downLayerGraphs : upLayerGraphs, i2 % 4 >= 2);
      layering = buildLayerMatrix(g2);
      var cc2 = crossCount(g2, layering);
      if (cc2 < bestCC) {
        lastBest = 0;
        best = cloneDeep_default(layering);
        bestCC = cc2;
      }
    }
    assignOrder(g2, best);
  }
  function buildLayerGraphs(g2, ranks, relationship) {
    return map_default(ranks, function(rank2) {
      return buildLayerGraph(g2, rank2, relationship);
    });
  }
  function sweepLayerGraphs(layerGraphs, biasRight) {
    var cg = new Graph();
    forEach_default(layerGraphs, function(lg) {
      var root3 = lg.graph().root;
      var sorted = sortSubgraph(lg, root3, cg, biasRight);
      forEach_default(sorted.vs, function(v3, i2) {
        lg.node(v3).order = i2;
      });
      addSubgraphConstraints(lg, cg, sorted.vs);
    });
  }
  function assignOrder(g2, layering) {
    forEach_default(layering, function(layer) {
      forEach_default(layer, function(v3, i2) {
        g2.node(v3).order = i2;
      });
    });
  }
  var init_order2 = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/index.js"() {
      "use strict";
      init_lodash();
      init_graphlib();
      init_util2();
      init_add_subgraph_constraints();
      init_build_layer_graph();
      init_cross_count();
      init_init_order();
      init_sort_subgraph();
      __name(order, "order");
      __name(buildLayerGraphs, "buildLayerGraphs");
      __name(sweepLayerGraphs, "sweepLayerGraphs");
      __name(assignOrder, "assignOrder");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/parent-dummy-chains.js
  function parentDummyChains(g2) {
    var postorderNums = postorder2(g2);
    forEach_default(g2.graph().dummyChains, function(v3) {
      var node2 = g2.node(v3);
      var edgeObj = node2.edgeObj;
      var pathData = findPath(g2, postorderNums, edgeObj.v, edgeObj.w);
      var path4 = pathData.path;
      var lca = pathData.lca;
      var pathIdx = 0;
      var pathV = path4[pathIdx];
      var ascending5 = true;
      while (v3 !== edgeObj.w) {
        node2 = g2.node(v3);
        if (ascending5) {
          while ((pathV = path4[pathIdx]) !== lca && g2.node(pathV).maxRank < node2.rank) {
            pathIdx++;
          }
          if (pathV === lca) {
            ascending5 = false;
          }
        }
        if (!ascending5) {
          while (pathIdx < path4.length - 1 && g2.node(pathV = path4[pathIdx + 1]).minRank <= node2.rank) {
            pathIdx++;
          }
          pathV = path4[pathIdx];
        }
        g2.setParent(v3, pathV);
        v3 = g2.successors(v3)[0];
      }
    });
  }
  function findPath(g2, postorderNums, v3, w4) {
    var vPath = [];
    var wPath = [];
    var low = Math.min(postorderNums[v3].low, postorderNums[w4].low);
    var lim = Math.max(postorderNums[v3].lim, postorderNums[w4].lim);
    var parent4;
    var lca;
    parent4 = v3;
    do {
      parent4 = g2.parent(parent4);
      vPath.push(parent4);
    } while (parent4 && (postorderNums[parent4].low > low || lim > postorderNums[parent4].lim));
    lca = parent4;
    parent4 = w4;
    while ((parent4 = g2.parent(parent4)) !== lca) {
      wPath.push(parent4);
    }
    return { path: vPath.concat(wPath.reverse()), lca };
  }
  function postorder2(g2) {
    var result = {};
    var lim = 0;
    function dfs3(v3) {
      var low = lim;
      forEach_default(g2.children(v3), dfs3);
      result[v3] = { low, lim: lim++ };
    }
    __name(dfs3, "dfs");
    forEach_default(g2.children(), dfs3);
    return result;
  }
  var init_parent_dummy_chains = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/parent-dummy-chains.js"() {
      "use strict";
      init_lodash();
      __name(parentDummyChains, "parentDummyChains");
      __name(findPath, "findPath");
      __name(postorder2, "postorder");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/position/bk.js
  function findType1Conflicts(g2, layering) {
    var conflicts = {};
    function visitLayer(prevLayer, layer) {
      var k0 = 0, scanPos = 0, prevLayerLength = prevLayer.length, lastNode = last_default(layer);
      forEach_default(layer, function(v3, i2) {
        var w4 = findOtherInnerSegmentNode(g2, v3), k1 = w4 ? g2.node(w4).order : prevLayerLength;
        if (w4 || v3 === lastNode) {
          forEach_default(layer.slice(scanPos, i2 + 1), function(scanNode) {
            forEach_default(g2.predecessors(scanNode), function(u2) {
              var uLabel = g2.node(u2), uPos = uLabel.order;
              if ((uPos < k0 || k1 < uPos) && !(uLabel.dummy && g2.node(scanNode).dummy)) {
                addConflict(conflicts, u2, scanNode);
              }
            });
          });
          scanPos = i2 + 1;
          k0 = k1;
        }
      });
      return layer;
    }
    __name(visitLayer, "visitLayer");
    reduce_default(layering, visitLayer);
    return conflicts;
  }
  function findType2Conflicts(g2, layering) {
    var conflicts = {};
    function scan(south, southPos, southEnd, prevNorthBorder, nextNorthBorder) {
      var v3;
      forEach_default(range_default(southPos, southEnd), function(i2) {
        v3 = south[i2];
        if (g2.node(v3).dummy) {
          forEach_default(g2.predecessors(v3), function(u2) {
            var uNode = g2.node(u2);
            if (uNode.dummy && (uNode.order < prevNorthBorder || uNode.order > nextNorthBorder)) {
              addConflict(conflicts, u2, v3);
            }
          });
        }
      });
    }
    __name(scan, "scan");
    function visitLayer(north, south) {
      var prevNorthPos = -1, nextNorthPos, southPos = 0;
      forEach_default(south, function(v3, southLookahead) {
        if (g2.node(v3).dummy === "border") {
          var predecessors = g2.predecessors(v3);
          if (predecessors.length) {
            nextNorthPos = g2.node(predecessors[0]).order;
            scan(south, southPos, southLookahead, prevNorthPos, nextNorthPos);
            southPos = southLookahead;
            prevNorthPos = nextNorthPos;
          }
        }
        scan(south, southPos, south.length, nextNorthPos, north.length);
      });
      return south;
    }
    __name(visitLayer, "visitLayer");
    reduce_default(layering, visitLayer);
    return conflicts;
  }
  function findOtherInnerSegmentNode(g2, v3) {
    if (g2.node(v3).dummy) {
      return find_default2(g2.predecessors(v3), function(u2) {
        return g2.node(u2).dummy;
      });
    }
  }
  function addConflict(conflicts, v3, w4) {
    if (v3 > w4) {
      var tmp = v3;
      v3 = w4;
      w4 = tmp;
    }
    if (!Object.prototype.hasOwnProperty.call(conflicts, v3)) {
      Object.defineProperty(conflicts, v3, {
        enumerable: true,
        configurable: true,
        value: {},
        writable: true
      });
    }
    var conflictsV = conflicts[v3];
    Object.defineProperty(conflictsV, w4, {
      enumerable: true,
      configurable: true,
      value: true,
      writable: true
    });
  }
  function hasConflict(conflicts, v3, w4) {
    if (v3 > w4) {
      var tmp = v3;
      v3 = w4;
      w4 = tmp;
    }
    return !!conflicts[v3] && Object.prototype.hasOwnProperty.call(conflicts[v3], w4);
  }
  function verticalAlignment(g2, layering, conflicts, neighborFn) {
    var root3 = {}, align = {}, pos = {};
    forEach_default(layering, function(layer) {
      forEach_default(layer, function(v3, order2) {
        root3[v3] = v3;
        align[v3] = v3;
        pos[v3] = order2;
      });
    });
    forEach_default(layering, function(layer) {
      var prevIdx = -1;
      forEach_default(layer, function(v3) {
        var ws = neighborFn(v3);
        if (ws.length) {
          ws = sortBy_default(ws, function(w5) {
            return pos[w5];
          });
          var mp = (ws.length - 1) / 2;
          for (var i2 = Math.floor(mp), il = Math.ceil(mp); i2 <= il; ++i2) {
            var w4 = ws[i2];
            if (align[v3] === v3 && prevIdx < pos[w4] && !hasConflict(conflicts, v3, w4)) {
              align[w4] = v3;
              align[v3] = root3[v3] = root3[w4];
              prevIdx = pos[w4];
            }
          }
        }
      });
    });
    return { root: root3, align };
  }
  function horizontalCompaction(g2, layering, root3, align, reverseSep) {
    var xs = {}, blockG = buildBlockGraph(g2, layering, root3, reverseSep), borderType = reverseSep ? "borderLeft" : "borderRight";
    function iterate(setXsFunc, nextNodesFunc) {
      var stack = blockG.nodes();
      var elem = stack.pop();
      var visited = {};
      while (elem) {
        if (visited[elem]) {
          setXsFunc(elem);
        } else {
          visited[elem] = true;
          stack.push(elem);
          stack = stack.concat(nextNodesFunc(elem));
        }
        elem = stack.pop();
      }
    }
    __name(iterate, "iterate");
    function pass1(elem) {
      xs[elem] = blockG.inEdges(elem).reduce(function(acc, e3) {
        return Math.max(acc, xs[e3.v] + blockG.edge(e3));
      }, 0);
    }
    __name(pass1, "pass1");
    function pass2(elem) {
      var min9 = blockG.outEdges(elem).reduce(function(acc, e3) {
        return Math.min(acc, xs[e3.w] - blockG.edge(e3));
      }, Number.POSITIVE_INFINITY);
      var node2 = g2.node(elem);
      if (min9 !== Number.POSITIVE_INFINITY && node2.borderType !== borderType) {
        xs[elem] = Math.max(xs[elem], min9);
      }
    }
    __name(pass2, "pass2");
    iterate(pass1, blockG.predecessors.bind(blockG));
    iterate(pass2, blockG.successors.bind(blockG));
    forEach_default(align, function(v3) {
      xs[v3] = xs[root3[v3]];
    });
    return xs;
  }
  function buildBlockGraph(g2, layering, root3, reverseSep) {
    var blockGraph = new Graph(), graphLabel = g2.graph(), sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep);
    forEach_default(layering, function(layer) {
      var u2;
      forEach_default(layer, function(v3) {
        var vRoot = root3[v3];
        blockGraph.setNode(vRoot);
        if (u2) {
          var uRoot = root3[u2], prevMax = blockGraph.edge(uRoot, vRoot);
          blockGraph.setEdge(uRoot, vRoot, Math.max(sepFn(g2, v3, u2), prevMax || 0));
        }
        u2 = v3;
      });
    });
    return blockGraph;
  }
  function findSmallestWidthAlignment(g2, xss) {
    return minBy_default(values_default(xss), function(xs) {
      var max10 = Number.NEGATIVE_INFINITY;
      var min9 = Number.POSITIVE_INFINITY;
      forIn_default(xs, function(x5, v3) {
        var halfWidth = width(g2, v3) / 2;
        max10 = Math.max(x5 + halfWidth, max10);
        min9 = Math.min(x5 - halfWidth, min9);
      });
      return max10 - min9;
    });
  }
  function alignCoordinates(xss, alignTo) {
    var alignToVals = values_default(alignTo), alignToMin = min_default(alignToVals), alignToMax = max_default(alignToVals);
    forEach_default(["u", "d"], function(vert) {
      forEach_default(["l", "r"], function(horiz) {
        var alignment = vert + horiz, xs = xss[alignment], delta;
        if (xs === alignTo) return;
        var xsVals = values_default(xs);
        delta = horiz === "l" ? alignToMin - min_default(xsVals) : alignToMax - max_default(xsVals);
        if (delta) {
          xss[alignment] = mapValues_default(xs, function(x5) {
            return x5 + delta;
          });
        }
      });
    });
  }
  function balance(xss, align) {
    return mapValues_default(xss.ul, function(ignore, v3) {
      if (align) {
        return xss[align.toLowerCase()][v3];
      } else {
        var xs = sortBy_default(map_default(xss, v3));
        return (xs[1] + xs[2]) / 2;
      }
    });
  }
  function positionX(g2) {
    var layering = buildLayerMatrix(g2);
    var conflicts = merge_default3(findType1Conflicts(g2, layering), findType2Conflicts(g2, layering));
    var xss = {};
    var adjustedLayering;
    forEach_default(["u", "d"], function(vert) {
      adjustedLayering = vert === "u" ? layering : values_default(layering).reverse();
      forEach_default(["l", "r"], function(horiz) {
        if (horiz === "r") {
          adjustedLayering = map_default(adjustedLayering, function(inner2) {
            return values_default(inner2).reverse();
          });
        }
        var neighborFn = (vert === "u" ? g2.predecessors : g2.successors).bind(g2);
        var align = verticalAlignment(g2, adjustedLayering, conflicts, neighborFn);
        var xs = horizontalCompaction(g2, adjustedLayering, align.root, align.align, horiz === "r");
        if (horiz === "r") {
          xs = mapValues_default(xs, function(x5) {
            return -x5;
          });
        }
        xss[vert + horiz] = xs;
      });
    });
    var smallestWidth = findSmallestWidthAlignment(g2, xss);
    alignCoordinates(xss, smallestWidth);
    return balance(xss, g2.graph().align);
  }
  function sep(nodeSep, edgeSep, reverseSep) {
    return function(g2, v3, w4) {
      var vLabel = g2.node(v3);
      var wLabel = g2.node(w4);
      var sum2 = 0;
      var delta;
      sum2 += vLabel.width / 2;
      if (Object.prototype.hasOwnProperty.call(vLabel, "labelpos")) {
        switch (vLabel.labelpos.toLowerCase()) {
          case "l":
            delta = -vLabel.width / 2;
            break;
          case "r":
            delta = vLabel.width / 2;
            break;
        }
      }
      if (delta) {
        sum2 += reverseSep ? delta : -delta;
      }
      delta = 0;
      sum2 += (vLabel.dummy ? edgeSep : nodeSep) / 2;
      sum2 += (wLabel.dummy ? edgeSep : nodeSep) / 2;
      sum2 += wLabel.width / 2;
      if (Object.prototype.hasOwnProperty.call(wLabel, "labelpos")) {
        switch (wLabel.labelpos.toLowerCase()) {
          case "l":
            delta = wLabel.width / 2;
            break;
          case "r":
            delta = -wLabel.width / 2;
            break;
        }
      }
      if (delta) {
        sum2 += reverseSep ? delta : -delta;
      }
      delta = 0;
      return sum2;
    };
  }
  function width(g2, v3) {
    return g2.node(v3).width;
  }
  var init_bk = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/position/bk.js"() {
      "use strict";
      init_lodash();
      init_graphlib();
      init_util2();
      __name(findType1Conflicts, "findType1Conflicts");
      __name(findType2Conflicts, "findType2Conflicts");
      __name(findOtherInnerSegmentNode, "findOtherInnerSegmentNode");
      __name(addConflict, "addConflict");
      __name(hasConflict, "hasConflict");
      __name(verticalAlignment, "verticalAlignment");
      __name(horizontalCompaction, "horizontalCompaction");
      __name(buildBlockGraph, "buildBlockGraph");
      __name(findSmallestWidthAlignment, "findSmallestWidthAlignment");
      __name(alignCoordinates, "alignCoordinates");
      __name(balance, "balance");
      __name(positionX, "positionX");
      __name(sep, "sep");
      __name(width, "width");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/position/index.js
  function position(g2) {
    g2 = asNonCompoundGraph(g2);
    positionY(g2);
    forOwn_default(positionX(g2), function(x5, v3) {
      g2.node(v3).x = x5;
    });
  }
  function positionY(g2) {
    var layering = buildLayerMatrix(g2);
    var rankSep = g2.graph().ranksep;
    var prevY = 0;
    forEach_default(layering, function(layer) {
      var maxHeight = max_default(
        map_default(layer, function(v3) {
          return g2.node(v3).height;
        })
      );
      forEach_default(layer, function(v3) {
        g2.node(v3).y = prevY + maxHeight / 2;
      });
      prevY += maxHeight + rankSep;
    });
  }
  var init_position = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/position/index.js"() {
      "use strict";
      init_lodash();
      init_util2();
      init_bk();
      __name(position, "position");
      __name(positionY, "positionY");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/layout.js
  function layout(g2, opts) {
    var time4 = opts && opts.debugTiming ? time2 : notime;
    time4("layout", () => {
      var layoutGraph = time4("  buildLayoutGraph", () => buildLayoutGraph(g2));
      time4("  runLayout", () => runLayout(layoutGraph, time4));
      time4("  updateInputGraph", () => updateInputGraph(g2, layoutGraph));
    });
  }
  function runLayout(g2, time4) {
    time4("    makeSpaceForEdgeLabels", () => makeSpaceForEdgeLabels(g2));
    time4("    removeSelfEdges", () => removeSelfEdges(g2));
    time4("    acyclic", () => run(g2));
    time4("    nestingGraph.run", () => run3(g2));
    time4("    rank", () => rank(asNonCompoundGraph(g2)));
    time4("    injectEdgeLabelProxies", () => injectEdgeLabelProxies(g2));
    time4("    removeEmptyRanks", () => removeEmptyRanks(g2));
    time4("    nestingGraph.cleanup", () => cleanup(g2));
    time4("    normalizeRanks", () => normalizeRanks(g2));
    time4("    assignRankMinMax", () => assignRankMinMax(g2));
    time4("    removeEdgeLabelProxies", () => removeEdgeLabelProxies(g2));
    time4("    normalize.run", () => run2(g2));
    time4("    parentDummyChains", () => parentDummyChains(g2));
    time4("    addBorderSegments", () => addBorderSegments(g2));
    time4("    order", () => order(g2));
    time4("    insertSelfEdges", () => insertSelfEdges(g2));
    time4("    adjustCoordinateSystem", () => adjust2(g2));
    time4("    position", () => position(g2));
    time4("    positionSelfEdges", () => positionSelfEdges(g2));
    time4("    removeBorderNodes", () => removeBorderNodes(g2));
    time4("    normalize.undo", () => undo3(g2));
    time4("    fixupEdgeLabelCoords", () => fixupEdgeLabelCoords(g2));
    time4("    undoCoordinateSystem", () => undo2(g2));
    time4("    translateGraph", () => translateGraph(g2));
    time4("    assignNodeIntersects", () => assignNodeIntersects(g2));
    time4("    reversePoints", () => reversePointsForReversedEdges(g2));
    time4("    acyclic.undo", () => undo(g2));
  }
  function updateInputGraph(inputGraph, layoutGraph) {
    forEach_default(inputGraph.nodes(), function(v3) {
      var inputLabel = inputGraph.node(v3);
      var layoutLabel = layoutGraph.node(v3);
      if (inputLabel) {
        inputLabel.x = layoutLabel.x;
        inputLabel.y = layoutLabel.y;
        if (layoutGraph.children(v3).length) {
          inputLabel.width = layoutLabel.width;
          inputLabel.height = layoutLabel.height;
        }
      }
    });
    forEach_default(inputGraph.edges(), function(e3) {
      var inputLabel = inputGraph.edge(e3);
      var layoutLabel = layoutGraph.edge(e3);
      inputLabel.points = layoutLabel.points;
      if (Object.prototype.hasOwnProperty.call(layoutLabel, "x")) {
        inputLabel.x = layoutLabel.x;
        inputLabel.y = layoutLabel.y;
      }
    });
    inputGraph.graph().width = layoutGraph.graph().width;
    inputGraph.graph().height = layoutGraph.graph().height;
  }
  function buildLayoutGraph(inputGraph) {
    var g2 = new Graph({ multigraph: true, compound: true });
    var graph = canonicalize(inputGraph.graph());
    g2.setGraph(
      merge_default3({}, graphDefaults, selectNumberAttrs(graph, graphNumAttrs), pick_default(graph, graphAttrs))
    );
    forEach_default(inputGraph.nodes(), function(v3) {
      var node2 = canonicalize(inputGraph.node(v3));
      g2.setNode(v3, defaults_default(selectNumberAttrs(node2, nodeNumAttrs), nodeDefaults));
      g2.setParent(v3, inputGraph.parent(v3));
    });
    forEach_default(inputGraph.edges(), function(e3) {
      var edge = canonicalize(inputGraph.edge(e3));
      g2.setEdge(
        e3,
        merge_default3({}, edgeDefaults, selectNumberAttrs(edge, edgeNumAttrs), pick_default(edge, edgeAttrs))
      );
    });
    return g2;
  }
  function makeSpaceForEdgeLabels(g2) {
    var graph = g2.graph();
    graph.ranksep /= 2;
    forEach_default(g2.edges(), function(e3) {
      var edge = g2.edge(e3);
      edge.minlen *= 2;
      if (edge.labelpos.toLowerCase() !== "c") {
        if (graph.rankdir === "TB" || graph.rankdir === "BT") {
          edge.width += edge.labeloffset;
        } else {
          edge.height += edge.labeloffset;
        }
      }
    });
  }
  function injectEdgeLabelProxies(g2) {
    forEach_default(g2.edges(), function(e3) {
      var edge = g2.edge(e3);
      if (edge.width && edge.height) {
        var v3 = g2.node(e3.v);
        var w4 = g2.node(e3.w);
        var label = { rank: (w4.rank - v3.rank) / 2 + v3.rank, e: e3 };
        addDummyNode(g2, "edge-proxy", label, "_ep");
      }
    });
  }
  function assignRankMinMax(g2) {
    var maxRank2 = 0;
    forEach_default(g2.nodes(), function(v3) {
      var node2 = g2.node(v3);
      if (node2.borderTop) {
        node2.minRank = g2.node(node2.borderTop).rank;
        node2.maxRank = g2.node(node2.borderBottom).rank;
        maxRank2 = max_default(maxRank2, node2.maxRank);
      }
    });
    g2.graph().maxRank = maxRank2;
  }
  function removeEdgeLabelProxies(g2) {
    forEach_default(g2.nodes(), function(v3) {
      var node2 = g2.node(v3);
      if (node2.dummy === "edge-proxy") {
        g2.edge(node2.e).labelRank = node2.rank;
        g2.removeNode(v3);
      }
    });
  }
  function translateGraph(g2) {
    var minX = Number.POSITIVE_INFINITY;
    var maxX = 0;
    var minY = Number.POSITIVE_INFINITY;
    var maxY = 0;
    var graphLabel = g2.graph();
    var marginX = graphLabel.marginx || 0;
    var marginY = graphLabel.marginy || 0;
    function getExtremes(attrs) {
      var x5 = attrs.x;
      var y6 = attrs.y;
      var w4 = attrs.width;
      var h3 = attrs.height;
      minX = Math.min(minX, x5 - w4 / 2);
      maxX = Math.max(maxX, x5 + w4 / 2);
      minY = Math.min(minY, y6 - h3 / 2);
      maxY = Math.max(maxY, y6 + h3 / 2);
    }
    __name(getExtremes, "getExtremes");
    forEach_default(g2.nodes(), function(v3) {
      getExtremes(g2.node(v3));
    });
    forEach_default(g2.edges(), function(e3) {
      var edge = g2.edge(e3);
      if (Object.prototype.hasOwnProperty.call(edge, "x")) {
        getExtremes(edge);
      }
    });
    minX -= marginX;
    minY -= marginY;
    forEach_default(g2.nodes(), function(v3) {
      var node2 = g2.node(v3);
      node2.x -= minX;
      node2.y -= minY;
    });
    forEach_default(g2.edges(), function(e3) {
      var edge = g2.edge(e3);
      forEach_default(edge.points, function(p3) {
        p3.x -= minX;
        p3.y -= minY;
      });
      if (Object.prototype.hasOwnProperty.call(edge, "x")) {
        edge.x -= minX;
      }
      if (Object.prototype.hasOwnProperty.call(edge, "y")) {
        edge.y -= minY;
      }
    });
    graphLabel.width = maxX - minX + marginX;
    graphLabel.height = maxY - minY + marginY;
  }
  function assignNodeIntersects(g2) {
    forEach_default(g2.edges(), function(e3) {
      var edge = g2.edge(e3);
      var nodeV = g2.node(e3.v);
      var nodeW = g2.node(e3.w);
      var p1, p22;
      if (!edge.points) {
        edge.points = [];
        p1 = nodeW;
        p22 = nodeV;
      } else {
        p1 = edge.points[0];
        p22 = edge.points[edge.points.length - 1];
      }
      edge.points.unshift(intersectRect2(nodeV, p1));
      edge.points.push(intersectRect2(nodeW, p22));
    });
  }
  function fixupEdgeLabelCoords(g2) {
    forEach_default(g2.edges(), function(e3) {
      var edge = g2.edge(e3);
      if (Object.prototype.hasOwnProperty.call(edge, "x")) {
        if (edge.labelpos === "l" || edge.labelpos === "r") {
          edge.width -= edge.labeloffset;
        }
        switch (edge.labelpos) {
          case "l":
            edge.x -= edge.width / 2 + edge.labeloffset;
            break;
          case "r":
            edge.x += edge.width / 2 + edge.labeloffset;
            break;
        }
      }
    });
  }
  function reversePointsForReversedEdges(g2) {
    forEach_default(g2.edges(), function(e3) {
      var edge = g2.edge(e3);
      if (edge.reversed) {
        edge.points.reverse();
      }
    });
  }
  function removeBorderNodes(g2) {
    forEach_default(g2.nodes(), function(v3) {
      if (g2.children(v3).length) {
        var node2 = g2.node(v3);
        var t4 = g2.node(node2.borderTop);
        var b3 = g2.node(node2.borderBottom);
        var l4 = g2.node(last_default(node2.borderLeft));
        var r2 = g2.node(last_default(node2.borderRight));
        node2.width = Math.abs(r2.x - l4.x);
        node2.height = Math.abs(b3.y - t4.y);
        node2.x = l4.x + node2.width / 2;
        node2.y = t4.y + node2.height / 2;
      }
    });
    forEach_default(g2.nodes(), function(v3) {
      if (g2.node(v3).dummy === "border") {
        g2.removeNode(v3);
      }
    });
  }
  function removeSelfEdges(g2) {
    forEach_default(g2.edges(), function(e3) {
      if (e3.v === e3.w) {
        var node2 = g2.node(e3.v);
        if (!node2.selfEdges) {
          node2.selfEdges = [];
        }
        node2.selfEdges.push({ e: e3, label: g2.edge(e3) });
        g2.removeEdge(e3);
      }
    });
  }
  function insertSelfEdges(g2) {
    var layers = buildLayerMatrix(g2);
    forEach_default(layers, function(layer) {
      var orderShift = 0;
      forEach_default(layer, function(v3, i2) {
        var node2 = g2.node(v3);
        node2.order = i2 + orderShift;
        forEach_default(node2.selfEdges, function(selfEdge) {
          addDummyNode(
            g2,
            "selfedge",
            {
              width: selfEdge.label.width,
              height: selfEdge.label.height,
              rank: node2.rank,
              order: i2 + ++orderShift,
              e: selfEdge.e,
              label: selfEdge.label
            },
            "_se"
          );
        });
        delete node2.selfEdges;
      });
    });
  }
  function positionSelfEdges(g2) {
    forEach_default(g2.nodes(), function(v3) {
      var node2 = g2.node(v3);
      if (node2.dummy === "selfedge") {
        var selfNode = g2.node(node2.e.v);
        var x5 = selfNode.x + selfNode.width / 2;
        var y6 = selfNode.y;
        var dx = node2.x - x5;
        var dy = selfNode.height / 2;
        g2.setEdge(node2.e, node2.label);
        g2.removeNode(v3);
        node2.label.points = [
          { x: x5 + 2 * dx / 3, y: y6 - dy },
          { x: x5 + 5 * dx / 6, y: y6 - dy },
          { x: x5 + dx, y: y6 },
          { x: x5 + 5 * dx / 6, y: y6 + dy },
          { x: x5 + 2 * dx / 3, y: y6 + dy }
        ];
        node2.label.x = node2.x;
        node2.label.y = node2.y;
      }
    });
  }
  function selectNumberAttrs(obj, attrs) {
    return mapValues_default(pick_default(obj, attrs), Number);
  }
  function canonicalize(attrs) {
    var newAttrs = {};
    forEach_default(attrs, function(v3, k2) {
      newAttrs[k2.toLowerCase()] = v3;
    });
    return newAttrs;
  }
  var graphNumAttrs, graphDefaults, graphAttrs, nodeNumAttrs, nodeDefaults, edgeNumAttrs, edgeDefaults, edgeAttrs;
  var init_layout = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/layout.js"() {
      "use strict";
      init_lodash();
      init_graphlib();
      init_add_border_segments();
      init_coordinate_system();
      init_acyclic();
      init_normalize();
      init_rank();
      init_nesting_graph();
      init_order2();
      init_parent_dummy_chains();
      init_position();
      init_util2();
      __name(layout, "layout");
      __name(runLayout, "runLayout");
      __name(updateInputGraph, "updateInputGraph");
      graphNumAttrs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"];
      graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" };
      graphAttrs = ["acyclicer", "ranker", "rankdir", "align"];
      nodeNumAttrs = ["width", "height"];
      nodeDefaults = { width: 0, height: 0 };
      edgeNumAttrs = ["minlen", "weight", "width", "height", "labeloffset"];
      edgeDefaults = {
        minlen: 1,
        weight: 1,
        width: 0,
        height: 0,
        labeloffset: 10,
        labelpos: "r"
      };
      edgeAttrs = ["labelpos"];
      __name(buildLayoutGraph, "buildLayoutGraph");
      __name(makeSpaceForEdgeLabels, "makeSpaceForEdgeLabels");
      __name(injectEdgeLabelProxies, "injectEdgeLabelProxies");
      __name(assignRankMinMax, "assignRankMinMax");
      __name(removeEdgeLabelProxies, "removeEdgeLabelProxies");
      __name(translateGraph, "translateGraph");
      __name(assignNodeIntersects, "assignNodeIntersects");
      __name(fixupEdgeLabelCoords, "fixupEdgeLabelCoords");
      __name(reversePointsForReversedEdges, "reversePointsForReversedEdges");
      __name(removeBorderNodes, "removeBorderNodes");
      __name(removeSelfEdges, "removeSelfEdges");
      __name(insertSelfEdges, "insertSelfEdges");
      __name(positionSelfEdges, "positionSelfEdges");
      __name(selectNumberAttrs, "selectNumberAttrs");
      __name(canonicalize, "canonicalize");
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/index.js
  var init_dagre = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/index.js"() {
      "use strict";
      init_acyclic();
      init_layout();
      init_normalize();
      init_rank();
    }
  });

  // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/json.js
  function write(g2) {
    var json3 = {
      options: {
        directed: g2.isDirected(),
        multigraph: g2.isMultigraph(),
        compound: g2.isCompound()
      },
      nodes: writeNodes(g2),
      edges: writeEdges(g2)
    };
    if (!isUndefined_default(g2.graph())) {
      json3.value = clone_default2(g2.graph());
    }
    return json3;
  }
  function writeNodes(g2) {
    return map_default(g2.nodes(), function(v3) {
      var nodeValue = g2.node(v3);
      var parent4 = g2.parent(v3);
      var node2 = { v: v3 };
      if (!isUndefined_default(nodeValue)) {
        node2.value = nodeValue;
      }
      if (!isUndefined_default(parent4)) {
        node2.parent = parent4;
      }
      return node2;
    });
  }
  function writeEdges(g2) {
    return map_default(g2.edges(), function(e3) {
      var edgeValue = g2.edge(e3);
      var edge = { v: e3.v, w: e3.w };
      if (!isUndefined_default(e3.name)) {
        edge.name = e3.name;
      }
      if (!isUndefined_default(edgeValue)) {
        edge.value = edgeValue;
      }
      return edge;
    });
  }
  var init_json = __esm({
    "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/json.js"() {
      "use strict";
      init_lodash();
      init_graph();
      __name(write, "write");
      __name(writeNodes, "writeNodes");
      __name(writeEdges, "writeEdges");
    }
  });

  // src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js
  var clusterDb, descendants, parents, clear6, isDescendant2, edgeInCluster, copy2, extractDescendants, findCommonEdges, findNonClusterChild, getAnchorId, adjustClustersAndEdges, extractor, sorter, sortNodesByHierarchy;
  var init_mermaid_graphlib = __esm({
    "src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js"() {
      "use strict";
      init_logger();
      init_graphlib();
      init_json();
      clusterDb = /* @__PURE__ */ new Map();
      descendants = /* @__PURE__ */ new Map();
      parents = /* @__PURE__ */ new Map();
      clear6 = /* @__PURE__ */ __name(() => {
        descendants.clear();
        parents.clear();
        clusterDb.clear();
      }, "clear");
      isDescendant2 = /* @__PURE__ */ __name((id34, ancestorId) => {
        const ancestorDescendants = descendants.get(ancestorId) || [];
        log.trace("In isDescendant", ancestorId, " ", id34, " = ", ancestorDescendants.includes(id34));
        return ancestorDescendants.includes(id34);
      }, "isDescendant");
      edgeInCluster = /* @__PURE__ */ __name((edge, clusterId) => {
        const clusterDescendants = descendants.get(clusterId) || [];
        log.info("Descendants of ", clusterId, " is ", clusterDescendants);
        log.info("Edge is ", edge);
        if (edge.v === clusterId || edge.w === clusterId) {
          return false;
        }
        if (!clusterDescendants) {
          log.debug("Tilt, ", clusterId, ",not in descendants");
          return false;
        }
        return clusterDescendants.includes(edge.v) || isDescendant2(edge.v, clusterId) || isDescendant2(edge.w, clusterId) || clusterDescendants.includes(edge.w);
      }, "edgeInCluster");
      copy2 = /* @__PURE__ */ __name((clusterId, graph, newGraph, rootId) => {
        log.warn(
          "Copying children of ",
          clusterId,
          "root",
          rootId,
          "data",
          graph.node(clusterId),
          rootId
        );
        const nodes5 = graph.children(clusterId) || [];
        if (clusterId !== rootId) {
          nodes5.push(clusterId);
        }
        log.warn("Copying (nodes) clusterId", clusterId, "nodes", nodes5);
        nodes5.forEach((node2) => {
          if (graph.children(node2).length > 0) {
            copy2(node2, graph, newGraph, rootId);
          } else {
            const data5 = graph.node(node2);
            log.info("cp ", node2, " to ", rootId, " with parent ", clusterId);
            newGraph.setNode(node2, data5);
            if (rootId !== graph.parent(node2)) {
              log.warn("Setting parent", node2, graph.parent(node2));
              newGraph.setParent(node2, graph.parent(node2));
            }
            if (clusterId !== rootId && node2 !== clusterId) {
              log.debug("Setting parent", node2, clusterId);
              newGraph.setParent(node2, clusterId);
            } else {
              log.info("In copy ", clusterId, "root", rootId, "data", graph.node(clusterId), rootId);
              log.debug(
                "Not Setting parent for node=",
                node2,
                "cluster!==rootId",
                clusterId !== rootId,
                "node!==clusterId",
                node2 !== clusterId
              );
            }
            const edges3 = graph.edges(node2);
            log.debug("Copying Edges", edges3);
            edges3.forEach((edge) => {
              log.info("Edge", edge);
              const data6 = graph.edge(edge.v, edge.w, edge.name);
              log.info("Edge data", data6, rootId);
              try {
                if (edgeInCluster(edge, rootId)) {
                  log.info("Copying as ", edge.v, edge.w, data6, edge.name);
                  newGraph.setEdge(edge.v, edge.w, data6, edge.name);
                  log.info("newGraph edges ", newGraph.edges(), newGraph.edge(newGraph.edges()[0]));
                } else {
                  log.info(
                    "Skipping copy of edge ",
                    edge.v,
                    "-->",
                    edge.w,
                    " rootId: ",
                    rootId,
                    " clusterId:",
                    clusterId
                  );
                }
              } catch (e3) {
                log.error(e3);
              }
            });
          }
          log.debug("Removing node", node2);
          graph.removeNode(node2);
        });
      }, "copy");
      extractDescendants = /* @__PURE__ */ __name((id34, graph) => {
        const children2 = graph.children(id34);
        let res = [...children2];
        for (const child of children2) {
          parents.set(child, id34);
          res = [...res, ...extractDescendants(child, graph)];
        }
        return res;
      }, "extractDescendants");
      findCommonEdges = /* @__PURE__ */ __name((graph, id1, id210) => {
        const edges1 = graph.edges().filter((edge) => edge.v === id1 || edge.w === id1);
        const edges22 = graph.edges().filter((edge) => edge.v === id210 || edge.w === id210);
        const edges1Prim = edges1.map((edge) => {
          return { v: edge.v === id1 ? id210 : edge.v, w: edge.w === id1 ? id1 : edge.w };
        });
        const edges2Prim = edges22.map((edge) => {
          return { v: edge.v, w: edge.w };
        });
        const result = edges1Prim.filter((edgeIn1) => {
          return edges2Prim.some((edge) => edgeIn1.v === edge.v && edgeIn1.w === edge.w);
        });
        return result;
      }, "findCommonEdges");
      findNonClusterChild = /* @__PURE__ */ __name((id34, graph, clusterId) => {
        const children2 = graph.children(id34);
        log.trace("Searching children of id ", id34, children2);
        if (children2.length < 1) {
          return id34;
        }
        let reserve;
        for (const child of children2) {
          const _id = findNonClusterChild(child, graph, clusterId);
          const commonEdges = findCommonEdges(graph, clusterId, _id);
          if (_id) {
            if (commonEdges.length > 0) {
              reserve = _id;
            } else {
              return _id;
            }
          }
        }
        return reserve;
      }, "findNonClusterChild");
      getAnchorId = /* @__PURE__ */ __name((id34) => {
        if (!clusterDb.has(id34)) {
          return id34;
        }
        if (!clusterDb.get(id34).externalConnections) {
          return id34;
        }
        if (clusterDb.has(id34)) {
          return clusterDb.get(id34).id;
        }
        return id34;
      }, "getAnchorId");
      adjustClustersAndEdges = /* @__PURE__ */ __name((graph, depth) => {
        if (!graph || depth > 10) {
          log.debug("Opting out, no graph ");
          return;
        } else {
          log.debug("Opting in, graph ");
        }
        graph.nodes().forEach(function(id34) {
          const children2 = graph.children(id34);
          if (children2.length > 0) {
            log.warn(
              "Cluster identified",
              id34,
              " Replacement id in edges: ",
              findNonClusterChild(id34, graph, id34)
            );
            descendants.set(id34, extractDescendants(id34, graph));
            clusterDb.set(id34, { id: findNonClusterChild(id34, graph, id34), clusterData: graph.node(id34) });
          }
        });
        graph.nodes().forEach(function(id34) {
          const children2 = graph.children(id34);
          const edges3 = graph.edges();
          if (children2.length > 0) {
            log.debug("Cluster identified", id34, descendants);
            edges3.forEach((edge) => {
              const d1 = isDescendant2(edge.v, id34);
              const d22 = isDescendant2(edge.w, id34);
              if (d1 ^ d22) {
                log.warn("Edge: ", edge, " leaves cluster ", id34);
                log.warn("Descendants of XXX ", id34, ": ", descendants.get(id34));
                clusterDb.get(id34).externalConnections = true;
              }
            });
          } else {
            log.debug("Not a cluster ", id34, descendants);
          }
        });
        for (let id34 of clusterDb.keys()) {
          const nonClusterChild = clusterDb.get(id34).id;
          const parent4 = graph.parent(nonClusterChild);
          if (parent4 !== id34 && clusterDb.has(parent4) && !clusterDb.get(parent4).externalConnections) {
            clusterDb.get(id34).id = parent4;
          }
        }
        graph.edges().forEach(function(e3) {
          const edge = graph.edge(e3);
          log.warn("Edge " + e3.v + " -> " + e3.w + ": " + JSON.stringify(e3));
          log.warn("Edge " + e3.v + " -> " + e3.w + ": " + JSON.stringify(graph.edge(e3)));
          let v3 = e3.v;
          let w4 = e3.w;
          log.warn(
            "Fix XXX",
            clusterDb,
            "ids:",
            e3.v,
            e3.w,
            "Translating: ",
            clusterDb.get(e3.v),
            " --- ",
            clusterDb.get(e3.w)
          );
          if (clusterDb.get(e3.v) || clusterDb.get(e3.w)) {
            log.warn("Fixing and trying - removing XXX", e3.v, e3.w, e3.name);
            v3 = getAnchorId(e3.v);
            w4 = getAnchorId(e3.w);
            graph.removeEdge(e3.v, e3.w, e3.name);
            if (v3 !== e3.v) {
              const parent4 = graph.parent(v3);
              clusterDb.get(parent4).externalConnections = true;
              edge.fromCluster = e3.v;
            }
            if (w4 !== e3.w) {
              const parent4 = graph.parent(w4);
              clusterDb.get(parent4).externalConnections = true;
              edge.toCluster = e3.w;
            }
            log.warn("Fix Replacing with XXX", v3, w4, e3.name);
            graph.setEdge(v3, w4, edge, e3.name);
          }
        });
        log.warn("Adjusted Graph", write(graph));
        extractor(graph, 0);
        log.trace(clusterDb);
      }, "adjustClustersAndEdges");
      extractor = /* @__PURE__ */ __name((graph, depth) => {
        log.warn("extractor - ", depth, write(graph), graph.children("D"));
        if (depth > 10) {
          log.error("Bailing out");
          return;
        }
        let nodes5 = graph.nodes();
        let hasChildren = false;
        for (const node2 of nodes5) {
          const children2 = graph.children(node2);
          hasChildren = hasChildren || children2.length > 0;
        }
        if (!hasChildren) {
          log.debug("Done, no node has children", graph.nodes());
          return;
        }
        log.debug("Nodes = ", nodes5, depth);
        for (const node2 of nodes5) {
          log.debug(
            "Extracting node",
            node2,
            clusterDb,
            clusterDb.has(node2) && !clusterDb.get(node2).externalConnections,
            !graph.parent(node2),
            graph.node(node2),
            graph.children("D"),
            " Depth ",
            depth
          );
          if (!clusterDb.has(node2)) {
            log.debug("Not a cluster", node2, depth);
          } else if (!clusterDb.get(node2).externalConnections && graph.children(node2) && graph.children(node2).length > 0) {
            log.warn(
              "Cluster without external connections, without a parent and with children",
              node2,
              depth
            );
            const graphSettings = graph.graph();
            let dir2 = graphSettings.rankdir === "TB" ? "LR" : "TB";
            if (clusterDb.get(node2)?.clusterData?.dir) {
              dir2 = clusterDb.get(node2).clusterData.dir;
              log.warn("Fixing dir", clusterDb.get(node2).clusterData.dir, dir2);
            }
            const clusterGraph = new Graph({
              multigraph: true,
              compound: true
            }).setGraph({
              rankdir: dir2,
              nodesep: 50,
              ranksep: 50,
              marginx: 8,
              marginy: 8
            }).setDefaultEdgeLabel(function() {
              return {};
            });
            log.warn("Old graph before copy", write(graph));
            copy2(node2, graph, clusterGraph, node2);
            graph.setNode(node2, {
              clusterNode: true,
              id: node2,
              clusterData: clusterDb.get(node2).clusterData,
              label: clusterDb.get(node2).label,
              graph: clusterGraph
            });
            log.warn("New graph after copy node: (", node2, ")", write(clusterGraph));
            log.debug("Old graph after copy", write(graph));
          } else {
            log.warn(
              "Cluster ** ",
              node2,
              " **not meeting the criteria !externalConnections:",
              !clusterDb.get(node2).externalConnections,
              " no parent: ",
              !graph.parent(node2),
              " children ",
              graph.children(node2) && graph.children(node2).length > 0,
              graph.children("D"),
              depth
            );
            log.debug(clusterDb);
          }
        }
        nodes5 = graph.nodes();
        log.warn("New list of nodes", nodes5);
        for (const node2 of nodes5) {
          const data5 = graph.node(node2);
          log.warn(" Now next level", node2, data5);
          if (data5?.clusterNode) {
            extractor(data5.graph, depth + 1);
          }
        }
      }, "extractor");
      sorter = /* @__PURE__ */ __name((graph, nodes5) => {
        if (nodes5.length === 0) {
          return [];
        }
        let result = Object.assign([], nodes5);
        nodes5.forEach((node2) => {
          const children2 = graph.children(node2);
          const sorted = sorter(graph, children2);
          result = [...result, ...sorted];
        });
        return result;
      }, "sorter");
      sortNodesByHierarchy = /* @__PURE__ */ __name((graph) => sorter(graph, graph.children()), "sortNodesByHierarchy");
    }
  });

  // src/rendering-util/layout-algorithms/dagre/index.js
  var dagre_exports = {};
  __export(dagre_exports, {
    render: () => render3
  });
  var recursiveRender, render3;
  var init_dagre2 = __esm({
    "src/rendering-util/layout-algorithms/dagre/index.js"() {
      "use strict";
      init_dagre();
      init_json();
      init_graphlib();
      init_markers();
      init_util();
      init_mermaid_graphlib();
      init_nodes2();
      init_clusters();
      init_edges();
      init_logger();
      init_subGraphTitleMargins();
      init_diagramAPI();
      recursiveRender = /* @__PURE__ */ __name(async (_elem, graph, diagramType, id34, parentCluster, siteConfig2) => {
        log.warn("Graph in recursive render:XAX", write(graph), parentCluster);
        const dir2 = graph.graph().rankdir;
        log.trace("Dir in recursive render - dir:", dir2);
        const elem = _elem.insert("g").attr("class", "root");
        if (!graph.nodes()) {
          log.info("No nodes found for", graph);
        } else {
          log.info("Recursive render XXX", graph.nodes());
        }
        if (graph.edges().length > 0) {
          log.info("Recursive edges", graph.edge(graph.edges()[0]));
        }
        const clusters = elem.insert("g").attr("class", "clusters");
        const edgePaths = elem.insert("g").attr("class", "edgePaths");
        const edgeLabels3 = elem.insert("g").attr("class", "edgeLabels");
        const nodes5 = elem.insert("g").attr("class", "nodes");
        await Promise.all(
          graph.nodes().map(async function(v3) {
            const node2 = graph.node(v3);
            if (parentCluster !== void 0) {
              const data5 = JSON.parse(JSON.stringify(parentCluster.clusterData));
              log.trace(
                "Setting data for parent cluster XXX\n Node.id = ",
                v3,
                "\n data=",
                data5.height,
                "\nParent cluster",
                parentCluster.height
              );
              graph.setNode(parentCluster.id, data5);
              if (!graph.parent(v3)) {
                log.trace("Setting parent", v3, parentCluster.id);
                graph.setParent(v3, parentCluster.id, data5);
              }
            }
            log.info("(Insert) Node XXX" + v3 + ": " + JSON.stringify(graph.node(v3)));
            if (node2?.clusterNode) {
              log.info("Cluster identified XBX", v3, node2.width, graph.node(v3));
              const { ranksep, nodesep } = graph.graph();
              node2.graph.setGraph({
                ...node2.graph.graph(),
                ranksep: ranksep + 25,
                nodesep
              });
              const o2 = await recursiveRender(
                nodes5,
                node2.graph,
                diagramType,
                id34,
                graph.node(v3),
                siteConfig2
              );
              const newEl = o2.elem;
              updateNodeBounds(node2, newEl);
              node2.diff = o2.diff || 0;
              log.info(
                "New compound node after recursive render XAX",
                v3,
                "width",
                // node,
                node2.width,
                "height",
                node2.height
                // node.x,
                // node.y
              );
              setNodeElem(newEl, node2);
            } else {
              if (graph.children(v3).length > 0) {
                log.trace(
                  "Cluster - the non recursive path XBX",
                  v3,
                  node2.id,
                  node2,
                  node2.width,
                  "Graph:",
                  graph
                );
                log.trace(findNonClusterChild(node2.id, graph));
                clusterDb.set(node2.id, { id: findNonClusterChild(node2.id, graph), node: node2 });
              } else {
                log.trace("Node - the non recursive path XAX", v3, nodes5, graph.node(v3), dir2);
                await insertNode(nodes5, graph.node(v3), { config: siteConfig2, dir: dir2 });
              }
            }
          })
        );
        const processEdges = /* @__PURE__ */ __name(async () => {
          const edgePromises = graph.edges().map(async function(e3) {
            const edge = graph.edge(e3.v, e3.w, e3.name);
            log.info("Edge " + e3.v + " -> " + e3.w + ": " + JSON.stringify(e3));
            log.info("Edge " + e3.v + " -> " + e3.w + ": ", e3, " ", JSON.stringify(graph.edge(e3)));
            log.info(
              "Fix",
              clusterDb,
              "ids:",
              e3.v,
              e3.w,
              "Translating: ",
              clusterDb.get(e3.v),
              clusterDb.get(e3.w)
            );
            await insertEdgeLabel(edgeLabels3, edge);
          });
          await Promise.all(edgePromises);
        }, "processEdges");
        await processEdges();
        log.info("Graph before layout:", JSON.stringify(write(graph)));
        log.info("############################################# XXX");
        log.info("###                Layout                 ### XXX");
        log.info("############################################# XXX");
        layout(graph);
        log.info("Graph after layout:", JSON.stringify(write(graph)));
        let diff2 = 0;
        let { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig2);
        await Promise.all(
          sortNodesByHierarchy(graph).map(async function(v3) {
            const node2 = graph.node(v3);
            log.info(
              "Position XBX => " + v3 + ": (" + node2.x,
              "," + node2.y,
              ") width: ",
              node2.width,
              " height: ",
              node2.height
            );
            if (node2?.clusterNode) {
              node2.y += subGraphTitleTotalMargin;
              log.info(
                "A tainted cluster node XBX1",
                v3,
                node2.id,
                node2.width,
                node2.height,
                node2.x,
                node2.y,
                graph.parent(v3)
              );
              clusterDb.get(node2.id).node = node2;
              positionNode(node2);
            } else {
              if (graph.children(v3).length > 0) {
                log.info(
                  "A pure cluster node XBX1",
                  v3,
                  node2.id,
                  node2.x,
                  node2.y,
                  node2.width,
                  node2.height,
                  graph.parent(v3)
                );
                node2.height += subGraphTitleTotalMargin;
                graph.node(node2.parentId);
                const halfPadding = node2?.padding / 2 || 0;
                const labelHeight = node2?.labelBBox?.height || 0;
                const offsetY = labelHeight - halfPadding || 0;
                log.debug("OffsetY", offsetY, "labelHeight", labelHeight, "halfPadding", halfPadding);
                await insertCluster(clusters, node2);
                clusterDb.get(node2.id).node = node2;
              } else {
                const parent4 = graph.node(node2.parentId);
                node2.y += subGraphTitleTotalMargin / 2;
                log.info(
                  "A regular node XBX1 - using the padding",
                  node2.id,
                  "parent",
                  node2.parentId,
                  node2.width,
                  node2.height,
                  node2.x,
                  node2.y,
                  "offsetY",
                  node2.offsetY,
                  "parent",
                  parent4,
                  parent4?.offsetY,
                  node2
                );
                positionNode(node2);
              }
            }
          })
        );
        graph.edges().forEach(function(e3) {
          const edge = graph.edge(e3);
          log.info("Edge " + e3.v + " -> " + e3.w + ": " + JSON.stringify(edge), edge);
          edge.points.forEach((point8) => point8.y += subGraphTitleTotalMargin / 2);
          const startNode = graph.node(e3.v);
          var endNode = graph.node(e3.w);
          const paths = insertEdge(edgePaths, edge, clusterDb, diagramType, startNode, endNode, id34);
          positionEdgeLabel(edge, paths);
        });
        graph.nodes().forEach(function(v3) {
          const n2 = graph.node(v3);
          log.info(v3, n2.type, n2.diff);
          if (n2.isGroup) {
            diff2 = n2.diff;
          }
        });
        log.warn("Returning from recursive render XAX", elem, diff2);
        return { elem, diff: diff2 };
      }, "recursiveRender");
      render3 = /* @__PURE__ */ __name(async (data4Layout, svg2) => {
        const graph = new Graph({
          multigraph: true,
          compound: true
        }).setGraph({
          rankdir: data4Layout.direction,
          nodesep: data4Layout.config?.nodeSpacing || data4Layout.config?.flowchart?.nodeSpacing || data4Layout.nodeSpacing,
          ranksep: data4Layout.config?.rankSpacing || data4Layout.config?.flowchart?.rankSpacing || data4Layout.rankSpacing,
          marginx: 8,
          marginy: 8
        }).setDefaultEdgeLabel(function() {
          return {};
        });
        const element3 = svg2.select("g");
        markers_default(element3, data4Layout.markers, data4Layout.type, data4Layout.diagramId);
        clear5();
        clear4();
        clear3();
        clear6();
        data4Layout.nodes.forEach((node2) => {
          graph.setNode(node2.id, { ...node2 });
          if (node2.parentId) {
            graph.setParent(node2.id, node2.parentId);
          }
        });
        log.debug("Edges:", data4Layout.edges);
        data4Layout.edges.forEach((edge) => {
          if (edge.start === edge.end) {
            const nodeId = edge.start;
            const specialId1 = nodeId + "---" + nodeId + "---1";
            const specialId2 = nodeId + "---" + nodeId + "---2";
            const node2 = graph.node(nodeId);
            graph.setNode(specialId1, {
              domId: specialId1,
              id: specialId1,
              parentId: node2.parentId,
              labelStyle: "",
              label: "",
              padding: 0,
              shape: "labelRect",
              // shape: 'rect',
              style: "",
              width: 10,
              height: 10
            });
            graph.setParent(specialId1, node2.parentId);
            graph.setNode(specialId2, {
              domId: specialId2,
              id: specialId2,
              parentId: node2.parentId,
              labelStyle: "",
              padding: 0,
              // shape: 'rect',
              shape: "labelRect",
              label: "",
              style: "",
              width: 10,
              height: 10
            });
            graph.setParent(specialId2, node2.parentId);
            const edge1 = structuredClone(edge);
            const edgeMid = structuredClone(edge);
            const edge2 = structuredClone(edge);
            edge1.label = "";
            edge1.arrowTypeEnd = "none";
            edge1.id = nodeId + "-cyclic-special-1";
            edgeMid.arrowTypeStart = "none";
            edgeMid.arrowTypeEnd = "none";
            edgeMid.id = nodeId + "-cyclic-special-mid";
            edge2.label = "";
            if (node2.isGroup) {
              edge1.fromCluster = nodeId;
              edge2.toCluster = nodeId;
            }
            edge2.id = nodeId + "-cyclic-special-2";
            edge2.arrowTypeStart = "none";
            graph.setEdge(nodeId, specialId1, edge1, nodeId + "-cyclic-special-0");
            graph.setEdge(specialId1, specialId2, edgeMid, nodeId + "-cyclic-special-1");
            graph.setEdge(specialId2, nodeId, edge2, nodeId + "-cyc<lic-special-2");
          } else {
            graph.setEdge(edge.start, edge.end, { ...edge }, edge.id);
          }
        });
        log.warn("Graph at first:", JSON.stringify(write(graph)));
        adjustClustersAndEdges(graph);
        log.warn("Graph after XAX:", JSON.stringify(write(graph)));
        const siteConfig2 = getConfig2();
        await recursiveRender(
          element3,
          graph,
          data4Layout.type,
          data4Layout.diagramId,
          void 0,
          siteConfig2
        );
      }, "render");
    }
  });

  // ../../node_modules/.pnpm/cytoscape@3.33.1/node_modules/cytoscape/dist/cytoscape.esm.mjs
  function _arrayLikeToArray(r2, a2) {
    (null == a2 || a2 > r2.length) && (a2 = r2.length);
    for (var e3 = 0, n2 = Array(a2); e3 < a2; e3++) n2[e3] = r2[e3];
    return n2;
  }
  function _arrayWithHoles(r2) {
    if (Array.isArray(r2)) return r2;
  }
  function _arrayWithoutHoles(r2) {
    if (Array.isArray(r2)) return _arrayLikeToArray(r2);
  }
  function _classCallCheck(a2, n2) {
    if (!(a2 instanceof n2)) throw new TypeError("Cannot call a class as a function");
  }
  function _defineProperties(e3, r2) {
    for (var t4 = 0; t4 < r2.length; t4++) {
      var o2 = r2[t4];
      o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e3, _toPropertyKey(o2.key), o2);
    }
  }
  function _createClass(e3, r2, t4) {
    return r2 && _defineProperties(e3.prototype, r2), Object.defineProperty(e3, "prototype", {
      writable: false
    }), e3;
  }
  function _createForOfIteratorHelper(r2, e3) {
    var t4 = "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"];
    if (!t4) {
      if (Array.isArray(r2) || (t4 = _unsupportedIterableToArray(r2)) || e3) {
        t4 && (r2 = t4);
        var n2 = 0, F3 = /* @__PURE__ */ __name(function() {
        }, "F");
        return {
          s: F3,
          n: /* @__PURE__ */ __name(function() {
            return n2 >= r2.length ? {
              done: true
            } : {
              done: false,
              value: r2[n2++]
            };
          }, "n"),
          e: /* @__PURE__ */ __name(function(r3) {
            throw r3;
          }, "e"),
          f: F3
        };
      }
      throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
    }
    var o2, a2 = true, u2 = false;
    return {
      s: /* @__PURE__ */ __name(function() {
        t4 = t4.call(r2);
      }, "s"),
      n: /* @__PURE__ */ __name(function() {
        var r3 = t4.next();
        return a2 = r3.done, r3;
      }, "n"),
      e: /* @__PURE__ */ __name(function(r3) {
        u2 = true, o2 = r3;
      }, "e"),
      f: /* @__PURE__ */ __name(function() {
        try {
          a2 || null == t4.return || t4.return();
        } finally {
          if (u2) throw o2;
        }
      }, "f")
    };
  }
  function _defineProperty$1(e3, r2, t4) {
    return (r2 = _toPropertyKey(r2)) in e3 ? Object.defineProperty(e3, r2, {
      value: t4,
      enumerable: true,
      configurable: true,
      writable: true
    }) : e3[r2] = t4, e3;
  }
  function _iterableToArray(r2) {
    if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2);
  }
  function _iterableToArrayLimit(r2, l4) {
    var t4 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"];
    if (null != t4) {
      var e3, n2, i2, u2, a2 = [], f2 = true, o2 = false;
      try {
        if (i2 = (t4 = t4.call(r2)).next, 0 === l4) {
          if (Object(t4) !== t4) return;
          f2 = false;
        } else for (; !(f2 = (e3 = i2.call(t4)).done) && (a2.push(e3.value), a2.length !== l4); f2 = true) ;
      } catch (r3) {
        o2 = true, n2 = r3;
      } finally {
        try {
          if (!f2 && null != t4.return && (u2 = t4.return(), Object(u2) !== u2)) return;
        } finally {
          if (o2) throw n2;
        }
      }
      return a2;
    }
  }
  function _nonIterableRest() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  }
  function _nonIterableSpread() {
    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  }
  function _slicedToArray(r2, e3) {
    return _arrayWithHoles(r2) || _iterableToArrayLimit(r2, e3) || _unsupportedIterableToArray(r2, e3) || _nonIterableRest();
  }
  function _toConsumableArray(r2) {
    return _arrayWithoutHoles(r2) || _iterableToArray(r2) || _unsupportedIterableToArray(r2) || _nonIterableSpread();
  }
  function _toPrimitive(t4, r2) {
    if ("object" != typeof t4 || !t4) return t4;
    var e3 = t4[Symbol.toPrimitive];
    if (void 0 !== e3) {
      var i2 = e3.call(t4, r2);
      if ("object" != typeof i2) return i2;
      throw new TypeError("@@toPrimitive must return a primitive value.");
    }
    return String(t4);
  }
  function _toPropertyKey(t4) {
    var i2 = _toPrimitive(t4, "string");
    return "symbol" == typeof i2 ? i2 : i2 + "";
  }
  function _typeof(o2) {
    "@babel/helpers - typeof";
    return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) {
      return typeof o3;
    } : function(o3) {
      return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3;
    }, _typeof(o2);
  }
  function _unsupportedIterableToArray(r2, a2) {
    if (r2) {
      if ("string" == typeof r2) return _arrayLikeToArray(r2, a2);
      var t4 = {}.toString.call(r2).slice(8, -1);
      return "Object" === t4 && r2.constructor && (t4 = r2.constructor.name), "Map" === t4 || "Set" === t4 ? Array.from(r2) : "Arguments" === t4 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t4) ? _arrayLikeToArray(r2, a2) : void 0;
    }
  }
  function getDefaultExportFromCjs(x5) {
    return x5 && x5.__esModule && Object.prototype.hasOwnProperty.call(x5, "default") ? x5["default"] : x5;
  }
  function requireIsObject() {
    if (hasRequiredIsObject) return isObject_12;
    hasRequiredIsObject = 1;
    function isObject3(value2) {
      var type3 = typeof value2;
      return value2 != null && (type3 == "object" || type3 == "function");
    }
    __name(isObject3, "isObject");
    isObject_12 = isObject3;
    return isObject_12;
  }
  function require_freeGlobal() {
    if (hasRequired_freeGlobal) return _freeGlobal;
    hasRequired_freeGlobal = 1;
    var freeGlobal2 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
    _freeGlobal = freeGlobal2;
    return _freeGlobal;
  }
  function require_root() {
    if (hasRequired_root) return _root;
    hasRequired_root = 1;
    var freeGlobal2 = require_freeGlobal();
    var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
    var root3 = freeGlobal2 || freeSelf2 || Function("return this")();
    _root = root3;
    return _root;
  }
  function requireNow() {
    if (hasRequiredNow) return now_1;
    hasRequiredNow = 1;
    var root3 = require_root();
    var now3 = /* @__PURE__ */ __name(function() {
      return root3.Date.now();
    }, "now");
    now_1 = now3;
    return now_1;
  }
  function require_trimmedEndIndex() {
    if (hasRequired_trimmedEndIndex) return _trimmedEndIndex;
    hasRequired_trimmedEndIndex = 1;
    var reWhitespace2 = /\s/;
    function trimmedEndIndex2(string3) {
      var index = string3.length;
      while (index-- && reWhitespace2.test(string3.charAt(index))) {
      }
      return index;
    }
    __name(trimmedEndIndex2, "trimmedEndIndex");
    _trimmedEndIndex = trimmedEndIndex2;
    return _trimmedEndIndex;
  }
  function require_baseTrim() {
    if (hasRequired_baseTrim) return _baseTrim;
    hasRequired_baseTrim = 1;
    var trimmedEndIndex2 = require_trimmedEndIndex();
    var reTrimStart2 = /^\s+/;
    function baseTrim2(string3) {
      return string3 ? string3.slice(0, trimmedEndIndex2(string3) + 1).replace(reTrimStart2, "") : string3;
    }
    __name(baseTrim2, "baseTrim");
    _baseTrim = baseTrim2;
    return _baseTrim;
  }
  function require_Symbol() {
    if (hasRequired_Symbol) return _Symbol;
    hasRequired_Symbol = 1;
    var root3 = require_root();
    var Symbol3 = root3.Symbol;
    _Symbol = Symbol3;
    return _Symbol;
  }
  function require_getRawTag() {
    if (hasRequired_getRawTag) return _getRawTag;
    hasRequired_getRawTag = 1;
    var Symbol3 = require_Symbol();
    var objectProto22 = Object.prototype;
    var hasOwnProperty19 = objectProto22.hasOwnProperty;
    var nativeObjectToString3 = objectProto22.toString;
    var symToStringTag3 = Symbol3 ? Symbol3.toStringTag : void 0;
    function getRawTag2(value2) {
      var isOwn = hasOwnProperty19.call(value2, symToStringTag3), tag = value2[symToStringTag3];
      try {
        value2[symToStringTag3] = void 0;
        var unmasked = true;
      } catch (e3) {
      }
      var result = nativeObjectToString3.call(value2);
      if (unmasked) {
        if (isOwn) {
          value2[symToStringTag3] = tag;
        } else {
          delete value2[symToStringTag3];
        }
      }
      return result;
    }
    __name(getRawTag2, "getRawTag");
    _getRawTag = getRawTag2;
    return _getRawTag;
  }
  function require_objectToString() {
    if (hasRequired_objectToString) return _objectToString;
    hasRequired_objectToString = 1;
    var objectProto22 = Object.prototype;
    var nativeObjectToString3 = objectProto22.toString;
    function objectToString2(value2) {
      return nativeObjectToString3.call(value2);
    }
    __name(objectToString2, "objectToString");
    _objectToString = objectToString2;
    return _objectToString;
  }
  function require_baseGetTag() {
    if (hasRequired_baseGetTag) return _baseGetTag;
    hasRequired_baseGetTag = 1;
    var Symbol3 = require_Symbol(), getRawTag2 = require_getRawTag(), objectToString2 = require_objectToString();
    var nullTag2 = "[object Null]", undefinedTag2 = "[object Undefined]";
    var symToStringTag3 = Symbol3 ? Symbol3.toStringTag : void 0;
    function baseGetTag2(value2) {
      if (value2 == null) {
        return value2 === void 0 ? undefinedTag2 : nullTag2;
      }
      return symToStringTag3 && symToStringTag3 in Object(value2) ? getRawTag2(value2) : objectToString2(value2);
    }
    __name(baseGetTag2, "baseGetTag");
    _baseGetTag = baseGetTag2;
    return _baseGetTag;
  }
  function requireIsObjectLike() {
    if (hasRequiredIsObjectLike) return isObjectLike_1;
    hasRequiredIsObjectLike = 1;
    function isObjectLike2(value2) {
      return value2 != null && typeof value2 == "object";
    }
    __name(isObjectLike2, "isObjectLike");
    isObjectLike_1 = isObjectLike2;
    return isObjectLike_1;
  }
  function requireIsSymbol() {
    if (hasRequiredIsSymbol) return isSymbol_1;
    hasRequiredIsSymbol = 1;
    var baseGetTag2 = require_baseGetTag(), isObjectLike2 = requireIsObjectLike();
    var symbolTag5 = "[object Symbol]";
    function isSymbol2(value2) {
      return typeof value2 == "symbol" || isObjectLike2(value2) && baseGetTag2(value2) == symbolTag5;
    }
    __name(isSymbol2, "isSymbol");
    isSymbol_1 = isSymbol2;
    return isSymbol_1;
  }
  function requireToNumber() {
    if (hasRequiredToNumber) return toNumber_1;
    hasRequiredToNumber = 1;
    var baseTrim2 = require_baseTrim(), isObject3 = requireIsObject(), isSymbol2 = requireIsSymbol();
    var NAN2 = 0 / 0;
    var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
    var reIsBinary2 = /^0b[01]+$/i;
    var reIsOctal2 = /^0o[0-7]+$/i;
    var freeParseInt2 = parseInt;
    function toNumber2(value2) {
      if (typeof value2 == "number") {
        return value2;
      }
      if (isSymbol2(value2)) {
        return NAN2;
      }
      if (isObject3(value2)) {
        var other = typeof value2.valueOf == "function" ? value2.valueOf() : value2;
        value2 = isObject3(other) ? other + "" : other;
      }
      if (typeof value2 != "string") {
        return value2 === 0 ? value2 : +value2;
      }
      value2 = baseTrim2(value2);
      var isBinary2 = reIsBinary2.test(value2);
      return isBinary2 || reIsOctal2.test(value2) ? freeParseInt2(value2.slice(2), isBinary2 ? 2 : 8) : reIsBadHex2.test(value2) ? NAN2 : +value2;
    }
    __name(toNumber2, "toNumber");
    toNumber_1 = toNumber2;
    return toNumber_1;
  }
  function requireDebounce() {
    if (hasRequiredDebounce) return debounce_1;
    hasRequiredDebounce = 1;
    var isObject3 = requireIsObject(), now3 = requireNow(), toNumber2 = requireToNumber();
    var FUNC_ERROR_TEXT3 = "Expected a function";
    var nativeMax6 = Math.max, nativeMin = Math.min;
    function debounce2(func, wait, options2) {
      var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
      if (typeof func != "function") {
        throw new TypeError(FUNC_ERROR_TEXT3);
      }
      wait = toNumber2(wait) || 0;
      if (isObject3(options2)) {
        leading = !!options2.leading;
        maxing = "maxWait" in options2;
        maxWait = maxing ? nativeMax6(toNumber2(options2.maxWait) || 0, wait) : maxWait;
        trailing = "trailing" in options2 ? !!options2.trailing : trailing;
      }
      function invokeFunc(time4) {
        var args = lastArgs, thisArg = lastThis;
        lastArgs = lastThis = void 0;
        lastInvokeTime = time4;
        result = func.apply(thisArg, args);
        return result;
      }
      __name(invokeFunc, "invokeFunc");
      function leadingEdge(time4) {
        lastInvokeTime = time4;
        timerId = setTimeout(timerExpired, wait);
        return leading ? invokeFunc(time4) : result;
      }
      __name(leadingEdge, "leadingEdge");
      function remainingWait(time4) {
        var timeSinceLastCall = time4 - lastCallTime, timeSinceLastInvoke = time4 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
        return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
      }
      __name(remainingWait, "remainingWait");
      function shouldInvoke(time4) {
        var timeSinceLastCall = time4 - lastCallTime, timeSinceLastInvoke = time4 - lastInvokeTime;
        return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
      }
      __name(shouldInvoke, "shouldInvoke");
      function timerExpired() {
        var time4 = now3();
        if (shouldInvoke(time4)) {
          return trailingEdge(time4);
        }
        timerId = setTimeout(timerExpired, remainingWait(time4));
      }
      __name(timerExpired, "timerExpired");
      function trailingEdge(time4) {
        timerId = void 0;
        if (trailing && lastArgs) {
          return invokeFunc(time4);
        }
        lastArgs = lastThis = void 0;
        return result;
      }
      __name(trailingEdge, "trailingEdge");
      function cancel() {
        if (timerId !== void 0) {
          clearTimeout(timerId);
        }
        lastInvokeTime = 0;
        lastArgs = lastCallTime = lastThis = timerId = void 0;
      }
      __name(cancel, "cancel");
      function flush() {
        return timerId === void 0 ? result : trailingEdge(now3());
      }
      __name(flush, "flush");
      function debounced() {
        var time4 = now3(), isInvoking = shouldInvoke(time4);
        lastArgs = arguments;
        lastThis = this;
        lastCallTime = time4;
        if (isInvoking) {
          if (timerId === void 0) {
            return leadingEdge(lastCallTime);
          }
          if (maxing) {
            clearTimeout(timerId);
            timerId = setTimeout(timerExpired, wait);
            return invokeFunc(lastCallTime);
          }
        }
        if (timerId === void 0) {
          timerId = setTimeout(timerExpired, wait);
        }
        return result;
      }
      __name(debounced, "debounced");
      debounced.cancel = cancel;
      debounced.flush = flush;
      return debounced;
    }
    __name(debounce2, "debounce");
    debounce_1 = debounce2;
    return debounce_1;
  }
  function rotatePoint(x5, y6, centerX, centerY, angleDegrees) {
    var angleRadians = angleDegrees * Math.PI / 180;
    var rotatedX = Math.cos(angleRadians) * (x5 - centerX) - Math.sin(angleRadians) * (y6 - centerY) + centerX;
    var rotatedY = Math.sin(angleRadians) * (x5 - centerX) + Math.cos(angleRadians) * (y6 - centerY) + centerY;
    return {
      x: rotatedX,
      y: rotatedY
    };
  }
  function rotatePosAndSkewByBox(pos, box, angleDegrees) {
    if (angleDegrees === 0) return pos;
    var centerX = (box.x1 + box.x2) / 2;
    var centerY = (box.y1 + box.y2) / 2;
    var skewX = box.w / box.h;
    var skewY = 1 / skewX;
    var rotated = rotatePoint(pos.x, pos.y, centerX, centerY, angleDegrees);
    var skewed = movePointByBoxAspect(rotated.x, rotated.y, centerX, centerY, skewX, skewY);
    return {
      x: skewed.x,
      y: skewed.y
    };
  }
  function requireHeap$1() {
    if (hasRequiredHeap$1) return heap$2.exports;
    hasRequiredHeap$1 = 1;
    (function(module2, exports2) {
      (function() {
        var Heap2, defaultCmp, floor, heapify, heappop, heappush, heappushpop, heapreplace, insort, min9, nlargest, nsmallest, updateItem, _siftdown, _siftup;
        floor = Math.floor, min9 = Math.min;
        defaultCmp = /* @__PURE__ */ __name(function(x5, y6) {
          if (x5 < y6) {
            return -1;
          }
          if (x5 > y6) {
            return 1;
          }
          return 0;
        }, "defaultCmp");
        insort = /* @__PURE__ */ __name(function(a2, x5, lo, hi, cmp) {
          var mid;
          if (lo == null) {
            lo = 0;
          }
          if (cmp == null) {
            cmp = defaultCmp;
          }
          if (lo < 0) {
            throw new Error("lo must be non-negative");
          }
          if (hi == null) {
            hi = a2.length;
          }
          while (lo < hi) {
            mid = floor((lo + hi) / 2);
            if (cmp(x5, a2[mid]) < 0) {
              hi = mid;
            } else {
              lo = mid + 1;
            }
          }
          return [].splice.apply(a2, [lo, lo - lo].concat(x5)), x5;
        }, "insort");
        heappush = /* @__PURE__ */ __name(function(array4, item, cmp) {
          if (cmp == null) {
            cmp = defaultCmp;
          }
          array4.push(item);
          return _siftdown(array4, 0, array4.length - 1, cmp);
        }, "heappush");
        heappop = /* @__PURE__ */ __name(function(array4, cmp) {
          var lastelt, returnitem;
          if (cmp == null) {
            cmp = defaultCmp;
          }
          lastelt = array4.pop();
          if (array4.length) {
            returnitem = array4[0];
            array4[0] = lastelt;
            _siftup(array4, 0, cmp);
          } else {
            returnitem = lastelt;
          }
          return returnitem;
        }, "heappop");
        heapreplace = /* @__PURE__ */ __name(function(array4, item, cmp) {
          var returnitem;
          if (cmp == null) {
            cmp = defaultCmp;
          }
          returnitem = array4[0];
          array4[0] = item;
          _siftup(array4, 0, cmp);
          return returnitem;
        }, "heapreplace");
        heappushpop = /* @__PURE__ */ __name(function(array4, item, cmp) {
          var _ref;
          if (cmp == null) {
            cmp = defaultCmp;
          }
          if (array4.length && cmp(array4[0], item) < 0) {
            _ref = [array4[0], item], item = _ref[0], array4[0] = _ref[1];
            _siftup(array4, 0, cmp);
          }
          return item;
        }, "heappushpop");
        heapify = /* @__PURE__ */ __name(function(array4, cmp) {
          var i2, _i, _len, _ref1, _results, _results1;
          if (cmp == null) {
            cmp = defaultCmp;
          }
          _ref1 = (function() {
            _results1 = [];
            for (var _j = 0, _ref = floor(array4.length / 2); 0 <= _ref ? _j < _ref : _j > _ref; 0 <= _ref ? _j++ : _j--) {
              _results1.push(_j);
            }
            return _results1;
          }).apply(this).reverse();
          _results = [];
          for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
            i2 = _ref1[_i];
            _results.push(_siftup(array4, i2, cmp));
          }
          return _results;
        }, "heapify");
        updateItem = /* @__PURE__ */ __name(function(array4, item, cmp) {
          var pos;
          if (cmp == null) {
            cmp = defaultCmp;
          }
          pos = array4.indexOf(item);
          if (pos === -1) {
            return;
          }
          _siftdown(array4, 0, pos, cmp);
          return _siftup(array4, pos, cmp);
        }, "updateItem");
        nlargest = /* @__PURE__ */ __name(function(array4, n2, cmp) {
          var elem, result, _i, _len, _ref;
          if (cmp == null) {
            cmp = defaultCmp;
          }
          result = array4.slice(0, n2);
          if (!result.length) {
            return result;
          }
          heapify(result, cmp);
          _ref = array4.slice(n2);
          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
            elem = _ref[_i];
            heappushpop(result, elem, cmp);
          }
          return result.sort(cmp).reverse();
        }, "nlargest");
        nsmallest = /* @__PURE__ */ __name(function(array4, n2, cmp) {
          var elem, los, result, _i, _j, _len, _ref, _ref1, _results;
          if (cmp == null) {
            cmp = defaultCmp;
          }
          if (n2 * 10 <= array4.length) {
            result = array4.slice(0, n2).sort(cmp);
            if (!result.length) {
              return result;
            }
            los = result[result.length - 1];
            _ref = array4.slice(n2);
            for (_i = 0, _len = _ref.length; _i < _len; _i++) {
              elem = _ref[_i];
              if (cmp(elem, los) < 0) {
                insort(result, elem, 0, null, cmp);
                result.pop();
                los = result[result.length - 1];
              }
            }
            return result;
          }
          heapify(array4, cmp);
          _results = [];
          for (_j = 0, _ref1 = min9(n2, array4.length); 0 <= _ref1 ? _j < _ref1 : _j > _ref1; 0 <= _ref1 ? ++_j : --_j) {
            _results.push(heappop(array4, cmp));
          }
          return _results;
        }, "nsmallest");
        _siftdown = /* @__PURE__ */ __name(function(array4, startpos, pos, cmp) {
          var newitem, parent4, parentpos;
          if (cmp == null) {
            cmp = defaultCmp;
          }
          newitem = array4[pos];
          while (pos > startpos) {
            parentpos = pos - 1 >> 1;
            parent4 = array4[parentpos];
            if (cmp(newitem, parent4) < 0) {
              array4[pos] = parent4;
              pos = parentpos;
              continue;
            }
            break;
          }
          return array4[pos] = newitem;
        }, "_siftdown");
        _siftup = /* @__PURE__ */ __name(function(array4, pos, cmp) {
          var childpos, endpos, newitem, rightpos, startpos;
          if (cmp == null) {
            cmp = defaultCmp;
          }
          endpos = array4.length;
          startpos = pos;
          newitem = array4[pos];
          childpos = 2 * pos + 1;
          while (childpos < endpos) {
            rightpos = childpos + 1;
            if (rightpos < endpos && !(cmp(array4[childpos], array4[rightpos]) < 0)) {
              childpos = rightpos;
            }
            array4[pos] = array4[childpos];
            pos = childpos;
            childpos = 2 * pos + 1;
          }
          array4[pos] = newitem;
          return _siftdown(array4, startpos, pos, cmp);
        }, "_siftup");
        Heap2 = (function() {
          Heap3.push = heappush;
          Heap3.pop = heappop;
          Heap3.replace = heapreplace;
          Heap3.pushpop = heappushpop;
          Heap3.heapify = heapify;
          Heap3.updateItem = updateItem;
          Heap3.nlargest = nlargest;
          Heap3.nsmallest = nsmallest;
          function Heap3(cmp) {
            this.cmp = cmp != null ? cmp : defaultCmp;
            this.nodes = [];
          }
          __name(Heap3, "Heap");
          Heap3.prototype.push = function(x5) {
            return heappush(this.nodes, x5, this.cmp);
          };
          Heap3.prototype.pop = function() {
            return heappop(this.nodes, this.cmp);
          };
          Heap3.prototype.peek = function() {
            return this.nodes[0];
          };
          Heap3.prototype.contains = function(x5) {
            return this.nodes.indexOf(x5) !== -1;
          };
          Heap3.prototype.replace = function(x5) {
            return heapreplace(this.nodes, x5, this.cmp);
          };
          Heap3.prototype.pushpop = function(x5) {
            return heappushpop(this.nodes, x5, this.cmp);
          };
          Heap3.prototype.heapify = function() {
            return heapify(this.nodes, this.cmp);
          };
          Heap3.prototype.updateItem = function(x5) {
            return updateItem(this.nodes, x5, this.cmp);
          };
          Heap3.prototype.clear = function() {
            return this.nodes = [];
          };
          Heap3.prototype.empty = function() {
            return this.nodes.length === 0;
          };
          Heap3.prototype.size = function() {
            return this.nodes.length;
          };
          Heap3.prototype.clone = function() {
            var heap2;
            heap2 = new Heap3();
            heap2.nodes = this.nodes.slice(0);
            return heap2;
          };
          Heap3.prototype.toArray = function() {
            return this.nodes.slice(0);
          };
          Heap3.prototype.insert = Heap3.prototype.push;
          Heap3.prototype.top = Heap3.prototype.peek;
          Heap3.prototype.front = Heap3.prototype.peek;
          Heap3.prototype.has = Heap3.prototype.contains;
          Heap3.prototype.copy = Heap3.prototype.clone;
          return Heap3;
        })();
        (function(root3, factory) {
          {
            return module2.exports = factory();
          }
        })(this, function() {
          return Heap2;
        });
      }).call(heap$1);
    })(heap$2);
    return heap$2.exports;
  }
  function requireHeap() {
    if (hasRequiredHeap) return heap;
    hasRequiredHeap = 1;
    heap = requireHeap$1();
    return heap;
  }
  function inflatePolygon(polygon2, d3) {
    if (polygon2.length < 3) {
      throw new Error("Need at least 3 vertices");
    }
    var add3 = /* @__PURE__ */ __name(function add4(a2, b3) {
      return {
        x: a2.x + b3.x,
        y: a2.y + b3.y
      };
    }, "add");
    var sub2 = /* @__PURE__ */ __name(function sub3(a2, b3) {
      return {
        x: a2.x - b3.x,
        y: a2.y - b3.y
      };
    }, "sub");
    var scale3 = /* @__PURE__ */ __name(function scale4(v3, s2) {
      return {
        x: v3.x * s2,
        y: v3.y * s2
      };
    }, "scale");
    var cross3 = /* @__PURE__ */ __name(function cross4(u2, v3) {
      return u2.x * v3.y - u2.y * v3.x;
    }, "cross");
    var normalize4 = /* @__PURE__ */ __name(function normalize5(v3) {
      var len = hypot(v3.x, v3.y);
      return len === 0 ? {
        x: 0,
        y: 0
      } : {
        x: v3.x / len,
        y: v3.y / len
      };
    }, "normalize");
    var signedArea = /* @__PURE__ */ __name(function signedArea2(pts3) {
      var A2 = 0;
      for (var i3 = 0; i3 < pts3.length; i3++) {
        var p4 = pts3[i3], q4 = pts3[(i3 + 1) % pts3.length];
        A2 += p4.x * q4.y - q4.x * p4.y;
      }
      return A2 / 2;
    }, "signedArea");
    var intersectLines = /* @__PURE__ */ __name(function intersectLines2(p1, p22, p32, p4) {
      var r2 = sub2(p22, p1);
      var s2 = sub2(p4, p32);
      var denom = cross3(r2, s2);
      if (Math.abs(denom) < 1e-9) {
        return add3(p1, scale3(r2, 0.5));
      }
      var t4 = cross3(sub2(p32, p1), s2) / denom;
      return add3(p1, scale3(r2, t4));
    }, "intersectLines");
    var pts2 = polygon2.map(function(p4) {
      return {
        x: p4.x,
        y: p4.y
      };
    });
    if (signedArea(pts2) < 0) pts2.reverse();
    var n2 = pts2.length;
    var normals = [];
    for (var i2 = 0; i2 < n2; i2++) {
      var p3 = pts2[i2], q3 = pts2[(i2 + 1) % n2];
      var edge = sub2(q3, p3);
      var out = normalize4({
        x: edge.y,
        y: -edge.x
      });
      normals.push(out);
    }
    var offsetEdges = normals.map(function(nrm, i3) {
      var p1 = add3(pts2[i3], scale3(nrm, d3));
      var p22 = add3(pts2[(i3 + 1) % n2], scale3(nrm, d3));
      return {
        p1,
        p2: p22
      };
    });
    var inflated = [];
    for (var _i2 = 0; _i2 < n2; _i2++) {
      var prevEdge = offsetEdges[(_i2 - 1 + n2) % n2];
      var currEdge = offsetEdges[_i2];
      var ip = intersectLines(prevEdge.p1, prevEdge.p2, currEdge.p1, currEdge.p2);
      inflated.push(ip);
    }
    return inflated;
  }
  function miterBox(pts2, centerX, centerY, width3, height2, strokeWidth) {
    var tpts = transformPoints(pts2, centerX, centerY, width3, height2);
    var offsetPoints = inflatePolygon(tpts, strokeWidth);
    var bb = makeBoundingBox();
    offsetPoints.forEach(function(pt) {
      return expandBoundingBoxByPoint(bb, pt.x, pt.y);
    });
    return bb;
  }
  function satPolygonIntersection(poly1, poly2) {
    function getAxes2(polygon2) {
      var axes2 = [];
      for (var i2 = 0; i2 < polygon2.length; i2++) {
        var p1 = polygon2[i2];
        var p22 = polygon2[(i2 + 1) % polygon2.length];
        var edge = {
          x: p22.x - p1.x,
          y: p22.y - p1.y
        };
        var normal = {
          x: -edge.y,
          y: edge.x
        };
        var length2 = Math.sqrt(normal.x * normal.x + normal.y * normal.y);
        axes2.push({
          x: normal.x / length2,
          y: normal.y / length2
        });
      }
      return axes2;
    }
    __name(getAxes2, "getAxes");
    function project(polygon2, axis3) {
      var min9 = Infinity;
      var max10 = -Infinity;
      var _iterator = _createForOfIteratorHelper(polygon2), _step;
      try {
        for (_iterator.s(); !(_step = _iterator.n()).done; ) {
          var point8 = _step.value;
          var projection2 = point8.x * axis3.x + point8.y * axis3.y;
          min9 = Math.min(min9, projection2);
          max10 = Math.max(max10, projection2);
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }
      return {
        min: min9,
        max: max10
      };
    }
    __name(project, "project");
    function overlaps(proj12, proj22) {
      return !(proj12.max < proj22.min || proj22.max < proj12.min);
    }
    __name(overlaps, "overlaps");
    var axes = [].concat(_toConsumableArray(getAxes2(poly1)), _toConsumableArray(getAxes2(poly2)));
    var _iterator2 = _createForOfIteratorHelper(axes), _step2;
    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
        var axis2 = _step2.value;
        var proj1 = project(poly1, axis2);
        var proj2 = project(poly2, axis2);
        if (!overlaps(proj1, proj2)) {
          return false;
        }
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }
    return true;
  }
  function clusteringDistance(method, length2, getP, getQ, nodeP, nodeQ) {
    var impl2;
    if (fn$6(method)) {
      impl2 = method;
    } else {
      impl2 = distances[method] || distances.euclidean;
    }
    if (length2 === 0 && fn$6(method)) {
      return impl2(nodeP, nodeQ);
    } else {
      return impl2(length2, getP, getQ, nodeP, nodeQ);
    }
  }
  function requireIsArray() {
    if (hasRequiredIsArray) return isArray_1;
    hasRequiredIsArray = 1;
    var isArray2 = Array.isArray;
    isArray_1 = isArray2;
    return isArray_1;
  }
  function require_isKey() {
    if (hasRequired_isKey) return _isKey;
    hasRequired_isKey = 1;
    var isArray2 = requireIsArray(), isSymbol2 = requireIsSymbol();
    var reIsDeepProp2 = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp2 = /^\w*$/;
    function isKey2(value2, object3) {
      if (isArray2(value2)) {
        return false;
      }
      var type3 = typeof value2;
      if (type3 == "number" || type3 == "symbol" || type3 == "boolean" || value2 == null || isSymbol2(value2)) {
        return true;
      }
      return reIsPlainProp2.test(value2) || !reIsDeepProp2.test(value2) || object3 != null && value2 in Object(object3);
    }
    __name(isKey2, "isKey");
    _isKey = isKey2;
    return _isKey;
  }
  function requireIsFunction() {
    if (hasRequiredIsFunction) return isFunction_1;
    hasRequiredIsFunction = 1;
    var baseGetTag2 = require_baseGetTag(), isObject3 = requireIsObject();
    var asyncTag2 = "[object AsyncFunction]", funcTag4 = "[object Function]", genTag3 = "[object GeneratorFunction]", proxyTag2 = "[object Proxy]";
    function isFunction2(value2) {
      if (!isObject3(value2)) {
        return false;
      }
      var tag = baseGetTag2(value2);
      return tag == funcTag4 || tag == genTag3 || tag == asyncTag2 || tag == proxyTag2;
    }
    __name(isFunction2, "isFunction");
    isFunction_1 = isFunction2;
    return isFunction_1;
  }
  function require_coreJsData() {
    if (hasRequired_coreJsData) return _coreJsData;
    hasRequired_coreJsData = 1;
    var root3 = require_root();
    var coreJsData2 = root3["__core-js_shared__"];
    _coreJsData = coreJsData2;
    return _coreJsData;
  }
  function require_isMasked() {
    if (hasRequired_isMasked) return _isMasked;
    hasRequired_isMasked = 1;
    var coreJsData2 = require_coreJsData();
    var maskSrcKey2 = (function() {
      var uid = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || "");
      return uid ? "Symbol(src)_1." + uid : "";
    })();
    function isMasked2(func) {
      return !!maskSrcKey2 && maskSrcKey2 in func;
    }
    __name(isMasked2, "isMasked");
    _isMasked = isMasked2;
    return _isMasked;
  }
  function require_toSource() {
    if (hasRequired_toSource) return _toSource;
    hasRequired_toSource = 1;
    var funcProto4 = Function.prototype;
    var funcToString4 = funcProto4.toString;
    function toSource2(func) {
      if (func != null) {
        try {
          return funcToString4.call(func);
        } catch (e3) {
        }
        try {
          return func + "";
        } catch (e3) {
        }
      }
      return "";
    }
    __name(toSource2, "toSource");
    _toSource = toSource2;
    return _toSource;
  }
  function require_baseIsNative() {
    if (hasRequired_baseIsNative) return _baseIsNative;
    hasRequired_baseIsNative = 1;
    var isFunction2 = requireIsFunction(), isMasked2 = require_isMasked(), isObject3 = requireIsObject(), toSource2 = require_toSource();
    var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g;
    var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
    var funcProto4 = Function.prototype, objectProto22 = Object.prototype;
    var funcToString4 = funcProto4.toString;
    var hasOwnProperty19 = objectProto22.hasOwnProperty;
    var reIsNative2 = RegExp(
      "^" + funcToString4.call(hasOwnProperty19).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
    );
    function baseIsNative2(value2) {
      if (!isObject3(value2) || isMasked2(value2)) {
        return false;
      }
      var pattern = isFunction2(value2) ? reIsNative2 : reIsHostCtor2;
      return pattern.test(toSource2(value2));
    }
    __name(baseIsNative2, "baseIsNative");
    _baseIsNative = baseIsNative2;
    return _baseIsNative;
  }
  function require_getValue() {
    if (hasRequired_getValue) return _getValue;
    hasRequired_getValue = 1;
    function getValue3(object3, key) {
      return object3 == null ? void 0 : object3[key];
    }
    __name(getValue3, "getValue");
    _getValue = getValue3;
    return _getValue;
  }
  function require_getNative() {
    if (hasRequired_getNative) return _getNative;
    hasRequired_getNative = 1;
    var baseIsNative2 = require_baseIsNative(), getValue3 = require_getValue();
    function getNative2(object3, key) {
      var value2 = getValue3(object3, key);
      return baseIsNative2(value2) ? value2 : void 0;
    }
    __name(getNative2, "getNative");
    _getNative = getNative2;
    return _getNative;
  }
  function require_nativeCreate() {
    if (hasRequired_nativeCreate) return _nativeCreate;
    hasRequired_nativeCreate = 1;
    var getNative2 = require_getNative();
    var nativeCreate2 = getNative2(Object, "create");
    _nativeCreate = nativeCreate2;
    return _nativeCreate;
  }
  function require_hashClear() {
    if (hasRequired_hashClear) return _hashClear;
    hasRequired_hashClear = 1;
    var nativeCreate2 = require_nativeCreate();
    function hashClear2() {
      this.__data__ = nativeCreate2 ? nativeCreate2(null) : {};
      this.size = 0;
    }
    __name(hashClear2, "hashClear");
    _hashClear = hashClear2;
    return _hashClear;
  }
  function require_hashDelete() {
    if (hasRequired_hashDelete) return _hashDelete;
    hasRequired_hashDelete = 1;
    function hashDelete2(key) {
      var result = this.has(key) && delete this.__data__[key];
      this.size -= result ? 1 : 0;
      return result;
    }
    __name(hashDelete2, "hashDelete");
    _hashDelete = hashDelete2;
    return _hashDelete;
  }
  function require_hashGet() {
    if (hasRequired_hashGet) return _hashGet;
    hasRequired_hashGet = 1;
    var nativeCreate2 = require_nativeCreate();
    var HASH_UNDEFINED4 = "__lodash_hash_undefined__";
    var objectProto22 = Object.prototype;
    var hasOwnProperty19 = objectProto22.hasOwnProperty;
    function hashGet2(key) {
      var data5 = this.__data__;
      if (nativeCreate2) {
        var result = data5[key];
        return result === HASH_UNDEFINED4 ? void 0 : result;
      }
      return hasOwnProperty19.call(data5, key) ? data5[key] : void 0;
    }
    __name(hashGet2, "hashGet");
    _hashGet = hashGet2;
    return _hashGet;
  }
  function require_hashHas() {
    if (hasRequired_hashHas) return _hashHas;
    hasRequired_hashHas = 1;
    var nativeCreate2 = require_nativeCreate();
    var objectProto22 = Object.prototype;
    var hasOwnProperty19 = objectProto22.hasOwnProperty;
    function hashHas2(key) {
      var data5 = this.__data__;
      return nativeCreate2 ? data5[key] !== void 0 : hasOwnProperty19.call(data5, key);
    }
    __name(hashHas2, "hashHas");
    _hashHas = hashHas2;
    return _hashHas;
  }
  function require_hashSet() {
    if (hasRequired_hashSet) return _hashSet;
    hasRequired_hashSet = 1;
    var nativeCreate2 = require_nativeCreate();
    var HASH_UNDEFINED4 = "__lodash_hash_undefined__";
    function hashSet2(key, value2) {
      var data5 = this.__data__;
      this.size += this.has(key) ? 0 : 1;
      data5[key] = nativeCreate2 && value2 === void 0 ? HASH_UNDEFINED4 : value2;
      return this;
    }
    __name(hashSet2, "hashSet");
    _hashSet = hashSet2;
    return _hashSet;
  }
  function require_Hash() {
    if (hasRequired_Hash) return _Hash;
    hasRequired_Hash = 1;
    var hashClear2 = require_hashClear(), hashDelete2 = require_hashDelete(), hashGet2 = require_hashGet(), hashHas2 = require_hashHas(), hashSet2 = require_hashSet();
    function Hash2(entries2) {
      var index = -1, length2 = entries2 == null ? 0 : entries2.length;
      this.clear();
      while (++index < length2) {
        var entry = entries2[index];
        this.set(entry[0], entry[1]);
      }
    }
    __name(Hash2, "Hash");
    Hash2.prototype.clear = hashClear2;
    Hash2.prototype["delete"] = hashDelete2;
    Hash2.prototype.get = hashGet2;
    Hash2.prototype.has = hashHas2;
    Hash2.prototype.set = hashSet2;
    _Hash = Hash2;
    return _Hash;
  }
  function require_listCacheClear() {
    if (hasRequired_listCacheClear) return _listCacheClear;
    hasRequired_listCacheClear = 1;
    function listCacheClear2() {
      this.__data__ = [];
      this.size = 0;
    }
    __name(listCacheClear2, "listCacheClear");
    _listCacheClear = listCacheClear2;
    return _listCacheClear;
  }
  function requireEq() {
    if (hasRequiredEq) return eq_1;
    hasRequiredEq = 1;
    function eq3(value2, other) {
      return value2 === other || value2 !== value2 && other !== other;
    }
    __name(eq3, "eq");
    eq_1 = eq3;
    return eq_1;
  }
  function require_assocIndexOf() {
    if (hasRequired_assocIndexOf) return _assocIndexOf;
    hasRequired_assocIndexOf = 1;
    var eq3 = requireEq();
    function assocIndexOf2(array4, key) {
      var length2 = array4.length;
      while (length2--) {
        if (eq3(array4[length2][0], key)) {
          return length2;
        }
      }
      return -1;
    }
    __name(assocIndexOf2, "assocIndexOf");
    _assocIndexOf = assocIndexOf2;
    return _assocIndexOf;
  }
  function require_listCacheDelete() {
    if (hasRequired_listCacheDelete) return _listCacheDelete;
    hasRequired_listCacheDelete = 1;
    var assocIndexOf2 = require_assocIndexOf();
    var arrayProto2 = Array.prototype;
    var splice2 = arrayProto2.splice;
    function listCacheDelete2(key) {
      var data5 = this.__data__, index = assocIndexOf2(data5, key);
      if (index < 0) {
        return false;
      }
      var lastIndex = data5.length - 1;
      if (index == lastIndex) {
        data5.pop();
      } else {
        splice2.call(data5, index, 1);
      }
      --this.size;
      return true;
    }
    __name(listCacheDelete2, "listCacheDelete");
    _listCacheDelete = listCacheDelete2;
    return _listCacheDelete;
  }
  function require_listCacheGet() {
    if (hasRequired_listCacheGet) return _listCacheGet;
    hasRequired_listCacheGet = 1;
    var assocIndexOf2 = require_assocIndexOf();
    function listCacheGet2(key) {
      var data5 = this.__data__, index = assocIndexOf2(data5, key);
      return index < 0 ? void 0 : data5[index][1];
    }
    __name(listCacheGet2, "listCacheGet");
    _listCacheGet = listCacheGet2;
    return _listCacheGet;
  }
  function require_listCacheHas() {
    if (hasRequired_listCacheHas) return _listCacheHas;
    hasRequired_listCacheHas = 1;
    var assocIndexOf2 = require_assocIndexOf();
    function listCacheHas2(key) {
      return assocIndexOf2(this.__data__, key) > -1;
    }
    __name(listCacheHas2, "listCacheHas");
    _listCacheHas = listCacheHas2;
    return _listCacheHas;
  }
  function require_listCacheSet() {
    if (hasRequired_listCacheSet) return _listCacheSet;
    hasRequired_listCacheSet = 1;
    var assocIndexOf2 = require_assocIndexOf();
    function listCacheSet2(key, value2) {
      var data5 = this.__data__, index = assocIndexOf2(data5, key);
      if (index < 0) {
        ++this.size;
        data5.push([key, value2]);
      } else {
        data5[index][1] = value2;
      }
      return this;
    }
    __name(listCacheSet2, "listCacheSet");
    _listCacheSet = listCacheSet2;
    return _listCacheSet;
  }
  function require_ListCache() {
    if (hasRequired_ListCache) return _ListCache;
    hasRequired_ListCache = 1;
    var listCacheClear2 = require_listCacheClear(), listCacheDelete2 = require_listCacheDelete(), listCacheGet2 = require_listCacheGet(), listCacheHas2 = require_listCacheHas(), listCacheSet2 = require_listCacheSet();
    function ListCache2(entries2) {
      var index = -1, length2 = entries2 == null ? 0 : entries2.length;
      this.clear();
      while (++index < length2) {
        var entry = entries2[index];
        this.set(entry[0], entry[1]);
      }
    }
    __name(ListCache2, "ListCache");
    ListCache2.prototype.clear = listCacheClear2;
    ListCache2.prototype["delete"] = listCacheDelete2;
    ListCache2.prototype.get = listCacheGet2;
    ListCache2.prototype.has = listCacheHas2;
    ListCache2.prototype.set = listCacheSet2;
    _ListCache = ListCache2;
    return _ListCache;
  }
  function require_Map() {
    if (hasRequired_Map) return _Map;
    hasRequired_Map = 1;
    var getNative2 = require_getNative(), root3 = require_root();
    var Map3 = getNative2(root3, "Map");
    _Map = Map3;
    return _Map;
  }
  function require_mapCacheClear() {
    if (hasRequired_mapCacheClear) return _mapCacheClear;
    hasRequired_mapCacheClear = 1;
    var Hash2 = require_Hash(), ListCache2 = require_ListCache(), Map3 = require_Map();
    function mapCacheClear2() {
      this.size = 0;
      this.__data__ = {
        "hash": new Hash2(),
        "map": new (Map3 || ListCache2)(),
        "string": new Hash2()
      };
    }
    __name(mapCacheClear2, "mapCacheClear");
    _mapCacheClear = mapCacheClear2;
    return _mapCacheClear;
  }
  function require_isKeyable() {
    if (hasRequired_isKeyable) return _isKeyable;
    hasRequired_isKeyable = 1;
    function isKeyable2(value2) {
      var type3 = typeof value2;
      return type3 == "string" || type3 == "number" || type3 == "symbol" || type3 == "boolean" ? value2 !== "__proto__" : value2 === null;
    }
    __name(isKeyable2, "isKeyable");
    _isKeyable = isKeyable2;
    return _isKeyable;
  }
  function require_getMapData() {
    if (hasRequired_getMapData) return _getMapData;
    hasRequired_getMapData = 1;
    var isKeyable2 = require_isKeyable();
    function getMapData2(map5, key) {
      var data5 = map5.__data__;
      return isKeyable2(key) ? data5[typeof key == "string" ? "string" : "hash"] : data5.map;
    }
    __name(getMapData2, "getMapData");
    _getMapData = getMapData2;
    return _getMapData;
  }
  function require_mapCacheDelete() {
    if (hasRequired_mapCacheDelete) return _mapCacheDelete;
    hasRequired_mapCacheDelete = 1;
    var getMapData2 = require_getMapData();
    function mapCacheDelete2(key) {
      var result = getMapData2(this, key)["delete"](key);
      this.size -= result ? 1 : 0;
      return result;
    }
    __name(mapCacheDelete2, "mapCacheDelete");
    _mapCacheDelete = mapCacheDelete2;
    return _mapCacheDelete;
  }
  function require_mapCacheGet() {
    if (hasRequired_mapCacheGet) return _mapCacheGet;
    hasRequired_mapCacheGet = 1;
    var getMapData2 = require_getMapData();
    function mapCacheGet2(key) {
      return getMapData2(this, key).get(key);
    }
    __name(mapCacheGet2, "mapCacheGet");
    _mapCacheGet = mapCacheGet2;
    return _mapCacheGet;
  }
  function require_mapCacheHas() {
    if (hasRequired_mapCacheHas) return _mapCacheHas;
    hasRequired_mapCacheHas = 1;
    var getMapData2 = require_getMapData();
    function mapCacheHas2(key) {
      return getMapData2(this, key).has(key);
    }
    __name(mapCacheHas2, "mapCacheHas");
    _mapCacheHas = mapCacheHas2;
    return _mapCacheHas;
  }
  function require_mapCacheSet() {
    if (hasRequired_mapCacheSet) return _mapCacheSet;
    hasRequired_mapCacheSet = 1;
    var getMapData2 = require_getMapData();
    function mapCacheSet2(key, value2) {
      var data5 = getMapData2(this, key), size4 = data5.size;
      data5.set(key, value2);
      this.size += data5.size == size4 ? 0 : 1;
      return this;
    }
    __name(mapCacheSet2, "mapCacheSet");
    _mapCacheSet = mapCacheSet2;
    return _mapCacheSet;
  }
  function require_MapCache() {
    if (hasRequired_MapCache) return _MapCache;
    hasRequired_MapCache = 1;
    var mapCacheClear2 = require_mapCacheClear(), mapCacheDelete2 = require_mapCacheDelete(), mapCacheGet2 = require_mapCacheGet(), mapCacheHas2 = require_mapCacheHas(), mapCacheSet2 = require_mapCacheSet();
    function MapCache2(entries2) {
      var index = -1, length2 = entries2 == null ? 0 : entries2.length;
      this.clear();
      while (++index < length2) {
        var entry = entries2[index];
        this.set(entry[0], entry[1]);
      }
    }
    __name(MapCache2, "MapCache");
    MapCache2.prototype.clear = mapCacheClear2;
    MapCache2.prototype["delete"] = mapCacheDelete2;
    MapCache2.prototype.get = mapCacheGet2;
    MapCache2.prototype.has = mapCacheHas2;
    MapCache2.prototype.set = mapCacheSet2;
    _MapCache = MapCache2;
    return _MapCache;
  }
  function requireMemoize() {
    if (hasRequiredMemoize) return memoize_1;
    hasRequiredMemoize = 1;
    var MapCache2 = require_MapCache();
    var FUNC_ERROR_TEXT3 = "Expected a function";
    function memoize4(func, resolver3) {
      if (typeof func != "function" || resolver3 != null && typeof resolver3 != "function") {
        throw new TypeError(FUNC_ERROR_TEXT3);
      }
      var memoized = /* @__PURE__ */ __name(function() {
        var args = arguments, key = resolver3 ? resolver3.apply(this, args) : args[0], cache3 = memoized.cache;
        if (cache3.has(key)) {
          return cache3.get(key);
        }
        var result = func.apply(this, args);
        memoized.cache = cache3.set(key, result) || cache3;
        return result;
      }, "memoized");
      memoized.cache = new (memoize4.Cache || MapCache2)();
      return memoized;
    }
    __name(memoize4, "memoize");
    memoize4.Cache = MapCache2;
    memoize_1 = memoize4;
    return memoize_1;
  }
  function require_memoizeCapped() {
    if (hasRequired_memoizeCapped) return _memoizeCapped;
    hasRequired_memoizeCapped = 1;
    var memoize4 = requireMemoize();
    var MAX_MEMOIZE_SIZE2 = 500;
    function memoizeCapped2(func) {
      var result = memoize4(func, function(key) {
        if (cache3.size === MAX_MEMOIZE_SIZE2) {
          cache3.clear();
        }
        return key;
      });
      var cache3 = result.cache;
      return result;
    }
    __name(memoizeCapped2, "memoizeCapped");
    _memoizeCapped = memoizeCapped2;
    return _memoizeCapped;
  }
  function require_stringToPath() {
    if (hasRequired_stringToPath) return _stringToPath;
    hasRequired_stringToPath = 1;
    var memoizeCapped2 = require_memoizeCapped();
    var rePropName2 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
    var reEscapeChar2 = /\\(\\)?/g;
    var stringToPath2 = memoizeCapped2(function(string3) {
      var result = [];
      if (string3.charCodeAt(0) === 46) {
        result.push("");
      }
      string3.replace(rePropName2, function(match2, number7, quote, subString) {
        result.push(quote ? subString.replace(reEscapeChar2, "$1") : number7 || match2);
      });
      return result;
    });
    _stringToPath = stringToPath2;
    return _stringToPath;
  }
  function require_arrayMap() {
    if (hasRequired_arrayMap) return _arrayMap;
    hasRequired_arrayMap = 1;
    function arrayMap2(array4, iteratee) {
      var index = -1, length2 = array4 == null ? 0 : array4.length, result = Array(length2);
      while (++index < length2) {
        result[index] = iteratee(array4[index], index, array4);
      }
      return result;
    }
    __name(arrayMap2, "arrayMap");
    _arrayMap = arrayMap2;
    return _arrayMap;
  }
  function require_baseToString() {
    if (hasRequired_baseToString) return _baseToString;
    hasRequired_baseToString = 1;
    var Symbol3 = require_Symbol(), arrayMap2 = require_arrayMap(), isArray2 = requireIsArray(), isSymbol2 = requireIsSymbol();
    var symbolProto4 = Symbol3 ? Symbol3.prototype : void 0, symbolToString2 = symbolProto4 ? symbolProto4.toString : void 0;
    function baseToString2(value2) {
      if (typeof value2 == "string") {
        return value2;
      }
      if (isArray2(value2)) {
        return arrayMap2(value2, baseToString2) + "";
      }
      if (isSymbol2(value2)) {
        return symbolToString2 ? symbolToString2.call(value2) : "";
      }
      var result = value2 + "";
      return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
    }
    __name(baseToString2, "baseToString");
    _baseToString = baseToString2;
    return _baseToString;
  }
  function requireToString() {
    if (hasRequiredToString) return toString_1;
    hasRequiredToString = 1;
    var baseToString2 = require_baseToString();
    function toString6(value2) {
      return value2 == null ? "" : baseToString2(value2);
    }
    __name(toString6, "toString");
    toString_1 = toString6;
    return toString_1;
  }
  function require_castPath() {
    if (hasRequired_castPath) return _castPath;
    hasRequired_castPath = 1;
    var isArray2 = requireIsArray(), isKey2 = require_isKey(), stringToPath2 = require_stringToPath(), toString6 = requireToString();
    function castPath2(value2, object3) {
      if (isArray2(value2)) {
        return value2;
      }
      return isKey2(value2, object3) ? [value2] : stringToPath2(toString6(value2));
    }
    __name(castPath2, "castPath");
    _castPath = castPath2;
    return _castPath;
  }
  function require_toKey() {
    if (hasRequired_toKey) return _toKey;
    hasRequired_toKey = 1;
    var isSymbol2 = requireIsSymbol();
    function toKey2(value2) {
      if (typeof value2 == "string" || isSymbol2(value2)) {
        return value2;
      }
      var result = value2 + "";
      return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
    }
    __name(toKey2, "toKey");
    _toKey = toKey2;
    return _toKey;
  }
  function require_baseGet() {
    if (hasRequired_baseGet) return _baseGet;
    hasRequired_baseGet = 1;
    var castPath2 = require_castPath(), toKey2 = require_toKey();
    function baseGet2(object3, path4) {
      path4 = castPath2(path4, object3);
      var index = 0, length2 = path4.length;
      while (object3 != null && index < length2) {
        object3 = object3[toKey2(path4[index++])];
      }
      return index && index == length2 ? object3 : void 0;
    }
    __name(baseGet2, "baseGet");
    _baseGet = baseGet2;
    return _baseGet;
  }
  function requireGet() {
    if (hasRequiredGet) return get_1;
    hasRequiredGet = 1;
    var baseGet2 = require_baseGet();
    function get5(object3, path4, defaultValue) {
      var result = object3 == null ? void 0 : baseGet2(object3, path4);
      return result === void 0 ? defaultValue : result;
    }
    __name(get5, "get");
    get_1 = get5;
    return get_1;
  }
  function require_defineProperty() {
    if (hasRequired_defineProperty) return _defineProperty;
    hasRequired_defineProperty = 1;
    var getNative2 = require_getNative();
    var defineProperty2 = (function() {
      try {
        var func = getNative2(Object, "defineProperty");
        func({}, "", {});
        return func;
      } catch (e3) {
      }
    })();
    _defineProperty = defineProperty2;
    return _defineProperty;
  }
  function require_baseAssignValue() {
    if (hasRequired_baseAssignValue) return _baseAssignValue;
    hasRequired_baseAssignValue = 1;
    var defineProperty2 = require_defineProperty();
    function baseAssignValue2(object3, key, value2) {
      if (key == "__proto__" && defineProperty2) {
        defineProperty2(object3, key, {
          "configurable": true,
          "enumerable": true,
          "value": value2,
          "writable": true
        });
      } else {
        object3[key] = value2;
      }
    }
    __name(baseAssignValue2, "baseAssignValue");
    _baseAssignValue = baseAssignValue2;
    return _baseAssignValue;
  }
  function require_assignValue() {
    if (hasRequired_assignValue) return _assignValue;
    hasRequired_assignValue = 1;
    var baseAssignValue2 = require_baseAssignValue(), eq3 = requireEq();
    var objectProto22 = Object.prototype;
    var hasOwnProperty19 = objectProto22.hasOwnProperty;
    function assignValue2(object3, key, value2) {
      var objValue = object3[key];
      if (!(hasOwnProperty19.call(object3, key) && eq3(objValue, value2)) || value2 === void 0 && !(key in object3)) {
        baseAssignValue2(object3, key, value2);
      }
    }
    __name(assignValue2, "assignValue");
    _assignValue = assignValue2;
    return _assignValue;
  }
  function require_isIndex() {
    if (hasRequired_isIndex) return _isIndex;
    hasRequired_isIndex = 1;
    var MAX_SAFE_INTEGER3 = 9007199254740991;
    var reIsUint2 = /^(?:0|[1-9]\d*)$/;
    function isIndex2(value2, length2) {
      var type3 = typeof value2;
      length2 = length2 == null ? MAX_SAFE_INTEGER3 : length2;
      return !!length2 && (type3 == "number" || type3 != "symbol" && reIsUint2.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2);
    }
    __name(isIndex2, "isIndex");
    _isIndex = isIndex2;
    return _isIndex;
  }
  function require_baseSet() {
    if (hasRequired_baseSet) return _baseSet;
    hasRequired_baseSet = 1;
    var assignValue2 = require_assignValue(), castPath2 = require_castPath(), isIndex2 = require_isIndex(), isObject3 = requireIsObject(), toKey2 = require_toKey();
    function baseSet2(object3, path4, value2, customizer) {
      if (!isObject3(object3)) {
        return object3;
      }
      path4 = castPath2(path4, object3);
      var index = -1, length2 = path4.length, lastIndex = length2 - 1, nested = object3;
      while (nested != null && ++index < length2) {
        var key = toKey2(path4[index]), newValue = value2;
        if (key === "__proto__" || key === "constructor" || key === "prototype") {
          return object3;
        }
        if (index != lastIndex) {
          var objValue = nested[key];
          newValue = customizer ? customizer(objValue, key, nested) : void 0;
          if (newValue === void 0) {
            newValue = isObject3(objValue) ? objValue : isIndex2(path4[index + 1]) ? [] : {};
          }
        }
        assignValue2(nested, key, newValue);
        nested = nested[key];
      }
      return object3;
    }
    __name(baseSet2, "baseSet");
    _baseSet = baseSet2;
    return _baseSet;
  }
  function requireSet() {
    if (hasRequiredSet) return set_1;
    hasRequiredSet = 1;
    var baseSet2 = require_baseSet();
    function set5(object3, path4, value2) {
      return object3 == null ? object3 : baseSet2(object3, path4, value2);
    }
    __name(set5, "set");
    set_1 = set5;
    return set_1;
  }
  function require_copyArray() {
    if (hasRequired_copyArray) return _copyArray;
    hasRequired_copyArray = 1;
    function copyArray4(source, array4) {
      var index = -1, length2 = source.length;
      array4 || (array4 = Array(length2));
      while (++index < length2) {
        array4[index] = source[index];
      }
      return array4;
    }
    __name(copyArray4, "copyArray");
    _copyArray = copyArray4;
    return _copyArray;
  }
  function requireToPath() {
    if (hasRequiredToPath) return toPath_1;
    hasRequiredToPath = 1;
    var arrayMap2 = require_arrayMap(), copyArray4 = require_copyArray(), isArray2 = requireIsArray(), isSymbol2 = requireIsSymbol(), stringToPath2 = require_stringToPath(), toKey2 = require_toKey(), toString6 = requireToString();
    function toPath2(value2) {
      if (isArray2(value2)) {
        return arrayMap2(value2, toKey2);
      }
      return isSymbol2(value2) ? [value2] : copyArray4(stringToPath2(toString6(value2)));
    }
    __name(toPath2, "toPath");
    toPath_1 = toPath2;
    return toPath_1;
  }
  function forEachCompound(eles, fn3, includeSelf, recursiveStep) {
    var q3 = [];
    var did = new Set$1();
    var cy = eles.cy();
    var hasCompounds = cy.hasCompoundNodes();
    for (var i2 = 0; i2 < eles.length; i2++) {
      var ele = eles[i2];
      if (includeSelf) {
        q3.push(ele);
      } else if (hasCompounds) {
        recursiveStep(q3, did, ele);
      }
    }
    while (q3.length > 0) {
      var _ele = q3.shift();
      fn3(_ele);
      did.add(_ele.id());
      if (hasCompounds) {
        recursiveStep(q3, did, _ele);
      }
    }
    return eles;
  }
  function addChildren(q3, did, ele) {
    if (ele.isParent()) {
      var children2 = ele._private.children;
      for (var i2 = 0; i2 < children2.length; i2++) {
        var child = children2[i2];
        if (!did.has(child.id())) {
          q3.push(child);
        }
      }
    }
  }
  function addParent(q3, did, ele) {
    if (ele.isChild()) {
      var parent4 = ele._private.parent;
      if (!did.has(parent4.id())) {
        q3.push(parent4);
      }
    }
  }
  function addParentAndChildren(q3, did, ele) {
    addParent(q3, did, ele);
    addChildren(q3, did, ele);
  }
  function defineDegreeFunction(callback) {
    return function(includeLoops) {
      var self2 = this;
      if (includeLoops === void 0) {
        includeLoops = true;
      }
      if (self2.length === 0) {
        return;
      }
      if (self2.isNode() && !self2.removed()) {
        var degree = 0;
        var node2 = self2[0];
        var connectedEdges = node2._private.edges;
        for (var i2 = 0; i2 < connectedEdges.length; i2++) {
          var edge = connectedEdges[i2];
          if (!includeLoops && edge.isLoop()) {
            continue;
          }
          degree += callback(node2, edge);
        }
        return degree;
      } else {
        return;
      }
    };
  }
  function defineDegreeBoundsFunction(degreeFn, callback) {
    return function(includeLoops) {
      var ret;
      var nodes5 = this.nodes();
      for (var i2 = 0; i2 < nodes5.length; i2++) {
        var ele = nodes5[i2];
        var degree = ele[degreeFn](includeLoops);
        if (degree !== void 0 && (ret === void 0 || callback(degree, ret))) {
          ret = degree;
        }
      }
      return ret;
    };
  }
  function returnFalse() {
    return false;
  }
  function returnTrue() {
    return true;
  }
  function Emitter() {
    var opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : emptyOpts;
    var context = arguments.length > 1 ? arguments[1] : void 0;
    for (var i2 = 0; i2 < defaultsKeys.length; i2++) {
      var key = defaultsKeys[i2];
      this[key] = opts[key] || defaults$8[key];
    }
    this.context = context || this.context;
    this.listeners = [];
    this.emitting = 0;
  }
  function styleCache(key, fn3, ele) {
    var _p = ele._private;
    var cache3 = _p.styleCache = _p.styleCache || [];
    var val;
    if ((val = cache3[key]) != null) {
      return val;
    } else {
      val = cache3[key] = fn3(ele);
      return val;
    }
  }
  function cacheStyleFunction(key, fn3) {
    key = hashString(key);
    return /* @__PURE__ */ __name(function cachedStyleFunction(ele) {
      return styleCache(key, fn3, ele);
    }, "cachedStyleFunction");
  }
  function cachePrototypeStyleFunction(key, fn3) {
    key = hashString(key);
    var selfFn = /* @__PURE__ */ __name(function selfFn2(ele) {
      return fn3.call(ele);
    }, "selfFn");
    return /* @__PURE__ */ __name(function cachedPrototypeStyleFunction() {
      var ele = this[0];
      if (ele) {
        return styleCache(key, selfFn, ele);
      }
    }, "cachedPrototypeStyleFunction");
  }
  function checkCompound(ele, parentOk) {
    var _p = ele._private;
    var parents3 = _p.data.parent ? ele.parents() : null;
    if (parents3) {
      for (var i2 = 0; i2 < parents3.length; i2++) {
        var parent4 = parents3[i2];
        if (!parentOk(parent4)) {
          return false;
        }
      }
    }
    return true;
  }
  function defineDerivedStateFunction(specs) {
    var ok = specs.ok;
    var edgeOkViaNode = specs.edgeOkViaNode || specs.ok;
    var parentOk = specs.parentOk || specs.ok;
    return function() {
      var cy = this.cy();
      if (!cy.styleEnabled()) {
        return true;
      }
      var ele = this[0];
      var hasCompoundNodes2 = cy.hasCompoundNodes();
      if (ele) {
        var _p = ele._private;
        if (!ok(ele)) {
          return false;
        }
        if (ele.isNode()) {
          return !hasCompoundNodes2 || checkCompound(ele, parentOk);
        } else {
          var src = _p.source;
          var tgt = _p.target;
          return edgeOkViaNode(src) && (!hasCompoundNodes2 || checkCompound(src, edgeOkViaNode)) && (src === tgt || edgeOkViaNode(tgt) && (!hasCompoundNodes2 || checkCompound(tgt, edgeOkViaNode)));
        }
      }
    };
  }
  function defineSwitchFunction(params) {
    return function() {
      var args = arguments;
      var changedEles = [];
      if (args.length === 2) {
        var data5 = args[0];
        var handler = args[1];
        this.on(params.event, data5, handler);
      } else if (args.length === 1 && fn$6(args[0])) {
        var _handler = args[0];
        this.on(params.event, _handler);
      } else if (args.length === 0 || args.length === 1 && array2(args[0])) {
        var addlEvents = args.length === 1 ? args[0] : null;
        for (var i2 = 0; i2 < this.length; i2++) {
          var ele = this[i2];
          var able = !params.ableField || ele._private[params.ableField];
          var changed = ele._private[params.field] != params.value;
          if (params.overrideAble) {
            var overrideAble2 = params.overrideAble(ele);
            if (overrideAble2 !== void 0) {
              able = overrideAble2;
              if (!overrideAble2) {
                return this;
              }
            }
          }
          if (able) {
            ele._private[params.field] = params.value;
            if (changed) {
              changedEles.push(ele);
            }
          }
        }
        var changedColl = this.spawn(changedEles);
        changedColl.updateStyle();
        changedColl.emit(params.event);
        if (addlEvents) {
          changedColl.emit(addlEvents);
        }
      }
      return this;
    };
  }
  function defineSwitchSet(params) {
    elesfn$3[params.field] = function() {
      var ele = this[0];
      if (ele) {
        if (params.overrideField) {
          var val = params.overrideField(ele);
          if (val !== void 0) {
            return val;
          }
        }
        return ele._private[params.field];
      }
    };
    elesfn$3[params.on] = defineSwitchFunction({
      event: params.on,
      field: params.field,
      ableField: params.ableField,
      overrideAble: params.overrideAble,
      value: true
    });
    elesfn$3[params.off] = defineSwitchFunction({
      event: params.off,
      field: params.field,
      ableField: params.ableField,
      overrideAble: params.overrideAble,
      value: false
    });
  }
  function defineSourceFunction(params) {
    return /* @__PURE__ */ __name(function sourceImpl2(selector) {
      var sources = [];
      for (var i2 = 0; i2 < this.length; i2++) {
        var ele = this[i2];
        var src = ele._private[params.attr];
        if (src) {
          sources.push(src);
        }
      }
      return this.spawn(sources, true).filter(selector);
    }, "sourceImpl");
  }
  function defineEdgesWithFunction(params) {
    return /* @__PURE__ */ __name(function edgesWithImpl(otherNodes) {
      var elements2 = [];
      var cy = this._private.cy;
      var p3 = params || {};
      if (string(otherNodes)) {
        otherNodes = cy.$(otherNodes);
      }
      for (var h3 = 0; h3 < otherNodes.length; h3++) {
        var edges3 = otherNodes[h3]._private.edges;
        for (var i2 = 0; i2 < edges3.length; i2++) {
          var edge = edges3[i2];
          var edgeData2 = edge._private.data;
          var thisToOther = this.hasElementWithId(edgeData2.source) && otherNodes.hasElementWithId(edgeData2.target);
          var otherToThis = otherNodes.hasElementWithId(edgeData2.source) && this.hasElementWithId(edgeData2.target);
          var edgeConnectsThisAndOther = thisToOther || otherToThis;
          if (!edgeConnectsThisAndOther) {
            continue;
          }
          if (p3.thisIsSrc || p3.thisIsTgt) {
            if (p3.thisIsSrc && !thisToOther) {
              continue;
            }
            if (p3.thisIsTgt && !otherToThis) {
              continue;
            }
          }
          elements2.push(edge);
        }
      }
      return this.spawn(elements2, true);
    }, "edgesWithImpl");
  }
  function defineParallelEdgesFunction(params) {
    var defaults4 = {
      codirected: false
    };
    params = extend4({}, defaults4, params);
    return /* @__PURE__ */ __name(function parallelEdgesImpl(selector) {
      var elements2 = [];
      var edges3 = this.edges();
      var p3 = params;
      for (var i2 = 0; i2 < edges3.length; i2++) {
        var edge1 = edges3[i2];
        var edge1_p = edge1._private;
        var src1 = edge1_p.source;
        var srcid1 = src1._private.data.id;
        var tgtid1 = edge1_p.data.target;
        var srcEdges1 = src1._private.edges;
        for (var j3 = 0; j3 < srcEdges1.length; j3++) {
          var edge2 = srcEdges1[j3];
          var edge2data = edge2._private.data;
          var tgtid2 = edge2data.target;
          var srcid2 = edge2data.source;
          var codirected = tgtid2 === tgtid1 && srcid2 === srcid1;
          var oppdirected = srcid1 === tgtid2 && tgtid1 === srcid2;
          if (p3.codirected && codirected || !p3.codirected && (codirected || oppdirected)) {
            elements2.push(edge2);
          }
        }
      }
      return this.spawn(elements2, true).filter(selector);
    }, "parallelEdgesImpl");
  }
  function generateCubicBezier(mX1, mY1, mX2, mY2) {
    var NEWTON_ITERATIONS = 4, NEWTON_MIN_SLOPE = 1e-3, SUBDIVISION_PRECISION = 1e-7, SUBDIVISION_MAX_ITERATIONS = 10, kSplineTableSize = 11, kSampleStepSize = 1 / (kSplineTableSize - 1), float32ArraySupported = typeof Float32Array !== "undefined";
    if (arguments.length !== 4) {
      return false;
    }
    for (var i2 = 0; i2 < 4; ++i2) {
      if (typeof arguments[i2] !== "number" || isNaN(arguments[i2]) || !isFinite(arguments[i2])) {
        return false;
      }
    }
    mX1 = Math.min(mX1, 1);
    mX2 = Math.min(mX2, 1);
    mX1 = Math.max(mX1, 0);
    mX2 = Math.max(mX2, 0);
    var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
    function A2(aA1, aA2) {
      return 1 - 3 * aA2 + 3 * aA1;
    }
    __name(A2, "A");
    function B3(aA1, aA2) {
      return 3 * aA2 - 6 * aA1;
    }
    __name(B3, "B");
    function C3(aA1) {
      return 3 * aA1;
    }
    __name(C3, "C");
    function calcBezier(aT, aA1, aA2) {
      return ((A2(aA1, aA2) * aT + B3(aA1, aA2)) * aT + C3(aA1)) * aT;
    }
    __name(calcBezier, "calcBezier");
    function getSlope(aT, aA1, aA2) {
      return 3 * A2(aA1, aA2) * aT * aT + 2 * B3(aA1, aA2) * aT + C3(aA1);
    }
    __name(getSlope, "getSlope");
    function newtonRaphsonIterate(aX, aGuessT) {
      for (var _i = 0; _i < NEWTON_ITERATIONS; ++_i) {
        var currentSlope = getSlope(aGuessT, mX1, mX2);
        if (currentSlope === 0) {
          return aGuessT;
        }
        var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
        aGuessT -= currentX / currentSlope;
      }
      return aGuessT;
    }
    __name(newtonRaphsonIterate, "newtonRaphsonIterate");
    function calcSampleValues() {
      for (var _i2 = 0; _i2 < kSplineTableSize; ++_i2) {
        mSampleValues[_i2] = calcBezier(_i2 * kSampleStepSize, mX1, mX2);
      }
    }
    __name(calcSampleValues, "calcSampleValues");
    function binarySubdivide(aX, aA, aB) {
      var currentX, currentT, i3 = 0;
      do {
        currentT = aA + (aB - aA) / 2;
        currentX = calcBezier(currentT, mX1, mX2) - aX;
        if (currentX > 0) {
          aB = currentT;
        } else {
          aA = currentT;
        }
      } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i3 < SUBDIVISION_MAX_ITERATIONS);
      return currentT;
    }
    __name(binarySubdivide, "binarySubdivide");
    function getTForX(aX) {
      var intervalStart = 0, currentSample = 1, lastSample = kSplineTableSize - 1;
      for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {
        intervalStart += kSampleStepSize;
      }
      --currentSample;
      var dist3 = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]), guessForT = intervalStart + dist3 * kSampleStepSize, initialSlope = getSlope(guessForT, mX1, mX2);
      if (initialSlope >= NEWTON_MIN_SLOPE) {
        return newtonRaphsonIterate(aX, guessForT);
      } else if (initialSlope === 0) {
        return guessForT;
      } else {
        return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize);
      }
    }
    __name(getTForX, "getTForX");
    var _precomputed = false;
    function precompute() {
      _precomputed = true;
      if (mX1 !== mY1 || mX2 !== mY2) {
        calcSampleValues();
      }
    }
    __name(precompute, "precompute");
    var f2 = /* @__PURE__ */ __name(function f3(aX) {
      if (!_precomputed) {
        precompute();
      }
      if (mX1 === mY1 && mX2 === mY2) {
        return aX;
      }
      if (aX === 0) {
        return 0;
      }
      if (aX === 1) {
        return 1;
      }
      return calcBezier(getTForX(aX), mY1, mY2);
    }, "f");
    f2.getControlPoints = function() {
      return [{
        x: mX1,
        y: mY1
      }, {
        x: mX2,
        y: mY2
      }];
    };
    var str2 = "generateBezier(" + [mX1, mY1, mX2, mY2] + ")";
    f2.toString = function() {
      return str2;
    };
    return f2;
  }
  function getEasedValue(type3, start3, end2, percent, easingFn) {
    if (percent === 1) {
      return end2;
    }
    if (start3 === end2) {
      return end2;
    }
    var val = easingFn(start3, end2, percent);
    if (type3 == null) {
      return val;
    }
    if (type3.roundValue || type3.color) {
      val = Math.round(val);
    }
    if (type3.min !== void 0) {
      val = Math.max(val, type3.min);
    }
    if (type3.max !== void 0) {
      val = Math.min(val, type3.max);
    }
    return val;
  }
  function getValue2(prop, spec) {
    if (prop.pfValue != null || prop.value != null) {
      if (prop.pfValue != null && (spec == null || spec.type.units !== "%")) {
        return prop.pfValue;
      } else {
        return prop.value;
      }
    } else {
      return prop;
    }
  }
  function ease(startProp, endProp, percent, easingFn, propSpec) {
    var type3 = propSpec != null ? propSpec.type : null;
    if (percent < 0) {
      percent = 0;
    } else if (percent > 1) {
      percent = 1;
    }
    var start3 = getValue2(startProp, propSpec);
    var end2 = getValue2(endProp, propSpec);
    if (number$1(start3) && number$1(end2)) {
      return getEasedValue(type3, start3, end2, percent, easingFn);
    } else if (array2(start3) && array2(end2)) {
      var easedArr = [];
      for (var i2 = 0; i2 < end2.length; i2++) {
        var si = start3[i2];
        var ei = end2[i2];
        if (si != null && ei != null) {
          var val = getEasedValue(type3, si, ei, percent, easingFn);
          easedArr.push(val);
        } else {
          easedArr.push(ei);
        }
      }
      return easedArr;
    }
    return void 0;
  }
  function step$1(self2, ani, now3, isCore) {
    var isEles = !isCore;
    var _p = self2._private;
    var ani_p = ani._private;
    var pEasing = ani_p.easing;
    var startTime = ani_p.startTime;
    var cy = isCore ? self2 : self2.cy();
    var style3 = cy.style();
    if (!ani_p.easingImpl) {
      if (pEasing == null) {
        ani_p.easingImpl = easings["linear"];
      } else {
        var easingVals;
        if (string(pEasing)) {
          var easingProp = style3.parse("transition-timing-function", pEasing);
          easingVals = easingProp.value;
        } else {
          easingVals = pEasing;
        }
        var name, args;
        if (string(easingVals)) {
          name = easingVals;
          args = [];
        } else {
          name = easingVals[1];
          args = easingVals.slice(2).map(function(n2) {
            return +n2;
          });
        }
        if (args.length > 0) {
          if (name === "spring") {
            args.push(ani_p.duration);
          }
          ani_p.easingImpl = easings[name].apply(null, args);
        } else {
          ani_p.easingImpl = easings[name];
        }
      }
    }
    var easing = ani_p.easingImpl;
    var percent;
    if (ani_p.duration === 0) {
      percent = 1;
    } else {
      percent = (now3 - startTime) / ani_p.duration;
    }
    if (ani_p.applying) {
      percent = ani_p.progress;
    }
    if (percent < 0) {
      percent = 0;
    } else if (percent > 1) {
      percent = 1;
    }
    if (ani_p.delay == null) {
      var startPos = ani_p.startPosition;
      var endPos = ani_p.position;
      if (endPos && isEles && !self2.locked()) {
        var newPos = {};
        if (valid(startPos.x, endPos.x)) {
          newPos.x = ease(startPos.x, endPos.x, percent, easing);
        }
        if (valid(startPos.y, endPos.y)) {
          newPos.y = ease(startPos.y, endPos.y, percent, easing);
        }
        self2.position(newPos);
      }
      var startPan = ani_p.startPan;
      var endPan = ani_p.pan;
      var pan2 = _p.pan;
      var animatingPan = endPan != null && isCore;
      if (animatingPan) {
        if (valid(startPan.x, endPan.x)) {
          pan2.x = ease(startPan.x, endPan.x, percent, easing);
        }
        if (valid(startPan.y, endPan.y)) {
          pan2.y = ease(startPan.y, endPan.y, percent, easing);
        }
        self2.emit("pan");
      }
      var startZoom = ani_p.startZoom;
      var endZoom = ani_p.zoom;
      var animatingZoom = endZoom != null && isCore;
      if (animatingZoom) {
        if (valid(startZoom, endZoom)) {
          _p.zoom = bound(_p.minZoom, ease(startZoom, endZoom, percent, easing), _p.maxZoom);
        }
        self2.emit("zoom");
      }
      if (animatingPan || animatingZoom) {
        self2.emit("viewport");
      }
      var props = ani_p.style;
      if (props && props.length > 0 && isEles) {
        for (var i2 = 0; i2 < props.length; i2++) {
          var prop = props[i2];
          var _name = prop.name;
          var end2 = prop;
          var start3 = ani_p.startStyle[_name];
          var propSpec = style3.properties[start3.name];
          var easedVal = ease(start3, end2, percent, easing, propSpec);
          style3.overrideBypass(self2, _name, easedVal);
        }
        self2.emit("style");
      }
    }
    ani_p.progress = percent;
    return percent;
  }
  function valid(start3, end2) {
    if (start3 == null || end2 == null) {
      return false;
    }
    if (number$1(start3) && number$1(end2)) {
      return true;
    } else if (start3 && end2) {
      return true;
    }
    return false;
  }
  function startAnimation(self2, ani, now3, isCore) {
    var ani_p = ani._private;
    ani_p.started = true;
    ani_p.startTime = now3 - ani_p.progress * ani_p.duration;
  }
  function stepAll(now3, cy) {
    var eles = cy._private.aniEles;
    var doneEles = [];
    function stepOne(ele2, isCore) {
      var _p = ele2._private;
      var current = _p.animation.current;
      var queue = _p.animation.queue;
      var ranAnis = false;
      if (current.length === 0) {
        var next3 = queue.shift();
        if (next3) {
          current.push(next3);
        }
      }
      var callbacks = /* @__PURE__ */ __name(function callbacks2(_callbacks) {
        for (var j3 = _callbacks.length - 1; j3 >= 0; j3--) {
          var cb = _callbacks[j3];
          cb();
        }
        _callbacks.splice(0, _callbacks.length);
      }, "callbacks");
      for (var i2 = current.length - 1; i2 >= 0; i2--) {
        var ani = current[i2];
        var ani_p = ani._private;
        if (ani_p.stopped) {
          current.splice(i2, 1);
          ani_p.hooked = false;
          ani_p.playing = false;
          ani_p.started = false;
          callbacks(ani_p.frames);
          continue;
        }
        if (!ani_p.playing && !ani_p.applying) {
          continue;
        }
        if (ani_p.playing && ani_p.applying) {
          ani_p.applying = false;
        }
        if (!ani_p.started) {
          startAnimation(ele2, ani, now3);
        }
        step$1(ele2, ani, now3, isCore);
        if (ani_p.applying) {
          ani_p.applying = false;
        }
        callbacks(ani_p.frames);
        if (ani_p.step != null) {
          ani_p.step(now3);
        }
        if (ani.completed()) {
          current.splice(i2, 1);
          ani_p.hooked = false;
          ani_p.playing = false;
          ani_p.started = false;
          callbacks(ani_p.completes);
        }
        ranAnis = true;
      }
      if (!isCore && current.length === 0 && queue.length === 0) {
        doneEles.push(ele2);
      }
      return ranAnis;
    }
    __name(stepOne, "stepOne");
    var ranEleAni = false;
    for (var e3 = 0; e3 < eles.length; e3++) {
      var ele = eles[e3];
      var handledThisEle = stepOne(ele);
      ranEleAni = ranEleAni || handledThisEle;
    }
    var ranCoreAni = stepOne(cy, true);
    if (ranEleAni || ranCoreAni) {
      if (eles.length > 0) {
        cy.notify("draw", eles);
      } else {
        cy.notify("draw");
      }
    }
    eles.unmerge(doneEles);
    cy.emit("step");
  }
  function BreadthFirstLayout(options2) {
    this.options = extend4({}, defaults$7, deprecatedOptionDefaults, options2);
  }
  function CircleLayout(options2) {
    this.options = extend4({}, defaults$6, options2);
  }
  function ConcentricLayout(options2) {
    this.options = extend4({}, defaults$5, options2);
  }
  function CoseLayout(options2) {
    this.options = extend4({}, defaults$4, options2);
    this.options.layout = this;
    var nodes5 = this.options.eles.nodes();
    var edges3 = this.options.eles.edges();
    var notEdges = edges3.filter(function(e3) {
      var sourceId = e3.source().data("id");
      var targetId = e3.target().data("id");
      var hasSource = nodes5.some(function(n2) {
        return n2.data("id") === sourceId;
      });
      var hasTarget = nodes5.some(function(n2) {
        return n2.data("id") === targetId;
      });
      return !hasSource || !hasTarget;
    });
    this.options.eles = this.options.eles.not(notEdges);
  }
  function GridLayout(options2) {
    this.options = extend4({}, defaults$3, options2);
  }
  function NullLayout(options2) {
    this.options = extend4({}, defaults$2, options2);
  }
  function PresetLayout(options2) {
    this.options = extend4({}, defaults$1, options2);
  }
  function RandomLayout(options2) {
    this.options = extend4({}, defaults3, options2);
  }
  function NullRenderer(options2) {
    this.options = options2;
    this.notifications = 0;
  }
  function drawPreparedRoundCorner(ctx, roundCorner) {
    if (roundCorner.radius === 0) ctx.lineTo(roundCorner.cx, roundCorner.cy);
    else ctx.arc(roundCorner.cx, roundCorner.cy, roundCorner.radius, roundCorner.startAngle, roundCorner.endAngle, roundCorner.counterClockwise);
  }
  function getRoundCorner(previousPoint, currentPoint, nextPoint, radiusMax) {
    var isArcRadius = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
    if (radiusMax === 0 || currentPoint.radius === 0) return {
      cx: currentPoint.x,
      cy: currentPoint.y,
      radius: 0,
      startX: currentPoint.x,
      startY: currentPoint.y,
      stopX: currentPoint.x,
      stopY: currentPoint.y,
      startAngle: void 0,
      endAngle: void 0,
      counterClockwise: void 0
    };
    calcCornerArc(previousPoint, currentPoint, nextPoint, radiusMax, isArcRadius);
    return {
      cx: x3,
      cy: y4,
      radius: cRadius,
      startX,
      startY,
      stopX,
      stopY,
      startAngle: v1.ang + Math.PI / 2 * radDirection,
      endAngle: v22.ang - Math.PI / 2 * radDirection,
      counterClockwise: drawDirection
    };
  }
  function getPts(pts2) {
    var retPts = [];
    if (pts2 == null) {
      return;
    }
    for (var i2 = 0; i2 < pts2.length; i2 += 2) {
      var x5 = pts2[i2];
      var y6 = pts2[i2 + 1];
      retPts.push({
        x: x5,
        y: y6
      });
    }
    return retPts;
  }
  function pushBezierPts(r2, edge, pts2) {
    var qbezierAt$1 = /* @__PURE__ */ __name(function qbezierAt$12(p1, p22, p32, t4) {
      return qbezierAt(p1, p22, p32, t4);
    }, "qbezierAt$1");
    var _p = edge._private;
    var bpts = _p.rstyle.bezierPts;
    for (var i2 = 0; i2 < r2.bezierProjPcts.length; i2++) {
      var p3 = r2.bezierProjPcts[i2];
      bpts.push({
        x: qbezierAt$1(pts2[0], pts2[2], pts2[4], p3),
        y: qbezierAt$1(pts2[1], pts2[3], pts2[5], p3)
      });
    }
  }
  function polygon(context, points) {
    for (var i2 = 0; i2 < points.length; i2++) {
      var pt = points[i2];
      context.lineTo(pt.x, pt.y);
    }
  }
  function triangleBackcurve(context, points, controlPoint) {
    var firstPt;
    for (var i2 = 0; i2 < points.length; i2++) {
      var pt = points[i2];
      if (i2 === 0) {
        firstPt = pt;
      }
      context.lineTo(pt.x, pt.y);
    }
    context.quadraticCurveTo(controlPoint.x, controlPoint.y, firstPt.x, firstPt.y);
  }
  function triangleTee(context, trianglePoints, teePoints) {
    if (context.beginPath) {
      context.beginPath();
    }
    var triPts = trianglePoints;
    for (var i2 = 0; i2 < triPts.length; i2++) {
      var pt = triPts[i2];
      context.lineTo(pt.x, pt.y);
    }
    var teePts = teePoints;
    var firstTeePt = teePoints[0];
    context.moveTo(firstTeePt.x, firstTeePt.y);
    for (var i2 = 1; i2 < teePts.length; i2++) {
      var pt = teePts[i2];
      context.lineTo(pt.x, pt.y);
    }
    if (context.closePath) {
      context.closePath();
    }
  }
  function circleTriangle(context, trianglePoints, rx, ry, r2) {
    if (context.beginPath) {
      context.beginPath();
    }
    context.arc(rx, ry, r2, 0, Math.PI * 2, false);
    var triPts = trianglePoints;
    var firstTrPt = triPts[0];
    context.moveTo(firstTrPt.x, firstTrPt.y);
    for (var i2 = 0; i2 < triPts.length; i2++) {
      var pt = triPts[i2];
      context.lineTo(pt.x, pt.y);
    }
    if (context.closePath) {
      context.closePath();
    }
  }
  function circle$1(context, rx, ry, r2) {
    context.arc(rx, ry, r2, 0, Math.PI * 2, false);
  }
  function circle3(ctx, x5, y6, width3, height2) {
    var diameter = Math.min(width3, height2);
    var radius2 = diameter / 2;
    var centerX = x5 + width3 / 2;
    var centerY = y6 + height2 / 2;
    ctx.beginPath();
    ctx.arc(centerX, centerY, radius2, 0, Math.PI * 2);
    ctx.closePath();
  }
  function roundRect(ctx, x5, y6, width3, height2) {
    var radius2 = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 5;
    var r2 = Math.min(radius2, width3 / 2, height2 / 2);
    ctx.beginPath();
    ctx.moveTo(x5 + r2, y6);
    ctx.lineTo(x5 + width3 - r2, y6);
    ctx.quadraticCurveTo(x5 + width3, y6, x5 + width3, y6 + r2);
    ctx.lineTo(x5 + width3, y6 + height2 - r2);
    ctx.quadraticCurveTo(x5 + width3, y6 + height2, x5 + width3 - r2, y6 + height2);
    ctx.lineTo(x5 + r2, y6 + height2);
    ctx.quadraticCurveTo(x5, y6 + height2, x5, y6 + height2 - r2);
    ctx.lineTo(x5, y6 + r2);
    ctx.quadraticCurveTo(x5, y6, x5 + r2, y6);
    ctx.closePath();
  }
  function compileShader(gl, type3, source) {
    var shader = gl.createShader(type3);
    gl.shaderSource(shader, source);
    gl.compileShader(shader);
    if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
      throw new Error(gl.getShaderInfoLog(shader));
    }
    return shader;
  }
  function createProgram(gl, vertexSource, fragementSource) {
    var vertexShader = compileShader(gl, gl.VERTEX_SHADER, vertexSource);
    var fragmentShader = compileShader(gl, gl.FRAGMENT_SHADER, fragementSource);
    var program = gl.createProgram();
    gl.attachShader(program, vertexShader);
    gl.attachShader(program, fragmentShader);
    gl.linkProgram(program);
    if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
      throw new Error("Could not initialize shaders");
    }
    return program;
  }
  function createTextureCanvas(r2, width3, height2) {
    if (height2 === void 0) {
      height2 = width3;
    }
    var canvas = r2.makeOffscreenCanvas(width3, height2);
    var ctx = canvas.context = canvas.getContext("2d");
    canvas.clear = function() {
      return ctx.clearRect(0, 0, canvas.width, canvas.height);
    };
    canvas.clear();
    return canvas;
  }
  function getEffectivePanZoom(r2) {
    var pixelRatio = r2.pixelRatio;
    var zoom2 = r2.cy.zoom();
    var pan2 = r2.cy.pan();
    return {
      zoom: zoom2 * pixelRatio,
      pan: {
        x: pan2.x * pixelRatio,
        y: pan2.y * pixelRatio
      }
    };
  }
  function getEffectiveZoom(r2) {
    var pixelRatio = r2.pixelRatio;
    var zoom2 = r2.cy.zoom();
    return zoom2 * pixelRatio;
  }
  function modelToRenderedPosition2(r2, pan2, zoom2, x5, y6) {
    var rx = x5 * zoom2 + pan2.x;
    var ry = y6 * zoom2 + pan2.y;
    ry = Math.round(r2.canvasHeight - ry);
    return [rx, ry];
  }
  function isSimpleShape(node2) {
    if (node2.pstyle("background-fill").value !== "solid") return false;
    if (node2.pstyle("background-image").strValue !== "none") return false;
    if (node2.pstyle("border-width").value === 0) return true;
    if (node2.pstyle("border-opacity").value === 0) return true;
    if (node2.pstyle("border-style").value !== "solid") return false;
    return true;
  }
  function arrayEqual(a1, a2) {
    if (a1.length !== a2.length) {
      return false;
    }
    for (var i2 = 0; i2 < a1.length; i2++) {
      if (a1[i2] !== a2[i2]) {
        return false;
      }
    }
    return true;
  }
  function toWebGLColor(color2, opacity, outArray) {
    var r2 = color2[0] / 255;
    var g2 = color2[1] / 255;
    var b3 = color2[2] / 255;
    var a2 = opacity;
    var arr = outArray || new Array(4);
    arr[0] = r2 * a2;
    arr[1] = g2 * a2;
    arr[2] = b3 * a2;
    arr[3] = a2;
    return arr;
  }
  function indexToVec4(index, outArray) {
    var arr = outArray || new Array(4);
    arr[0] = (index >> 0 & 255) / 255;
    arr[1] = (index >> 8 & 255) / 255;
    arr[2] = (index >> 16 & 255) / 255;
    arr[3] = (index >> 24 & 255) / 255;
    return arr;
  }
  function vec4ToIndex(vec4) {
    return vec4[0] + (vec4[1] << 8) + (vec4[2] << 16) + (vec4[3] << 24);
  }
  function createTexture(gl, debugID) {
    var texture = gl.createTexture();
    texture.buffer = function(offscreenCanvas) {
      gl.bindTexture(gl.TEXTURE_2D, texture);
      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
      gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
      gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, offscreenCanvas);
      gl.generateMipmap(gl.TEXTURE_2D);
      gl.bindTexture(gl.TEXTURE_2D, null);
    };
    texture.deleteTexture = function() {
      gl.deleteTexture(texture);
    };
    return texture;
  }
  function getTypeInfo(gl, glslType) {
    switch (glslType) {
      case "float":
        return [1, gl.FLOAT, 4];
      case "vec2":
        return [2, gl.FLOAT, 4];
      case "vec3":
        return [3, gl.FLOAT, 4];
      case "vec4":
        return [4, gl.FLOAT, 4];
      case "int":
        return [1, gl.INT, 4];
      case "ivec2":
        return [2, gl.INT, 4];
    }
  }
  function createTypedArray(gl, glType, dataOrSize) {
    switch (glType) {
      case gl.FLOAT:
        return new Float32Array(dataOrSize);
      case gl.INT:
        return new Int32Array(dataOrSize);
    }
  }
  function createTypedArrayView(gl, glType, array4, stride, size4, i2) {
    switch (glType) {
      case gl.FLOAT:
        return new Float32Array(array4.buffer, i2 * stride, size4);
      case gl.INT:
        return new Int32Array(array4.buffer, i2 * stride, size4);
    }
  }
  function createBufferStaticDraw(gl, type3, attributeLoc, dataArray) {
    var _getTypeInfo = getTypeInfo(gl, type3), _getTypeInfo2 = _slicedToArray(_getTypeInfo, 2), size4 = _getTypeInfo2[0], glType = _getTypeInfo2[1];
    var data5 = createTypedArray(gl, glType, dataArray);
    var buffer = gl.createBuffer();
    gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
    gl.bufferData(gl.ARRAY_BUFFER, data5, gl.STATIC_DRAW);
    if (glType === gl.FLOAT) {
      gl.vertexAttribPointer(attributeLoc, size4, glType, false, 0, 0);
    } else if (glType === gl.INT) {
      gl.vertexAttribIPointer(attributeLoc, size4, glType, 0, 0);
    }
    gl.enableVertexAttribArray(attributeLoc);
    gl.bindBuffer(gl.ARRAY_BUFFER, null);
    return buffer;
  }
  function createBufferDynamicDraw(gl, instances, type3, attributeLoc) {
    var _getTypeInfo3 = getTypeInfo(gl, type3), _getTypeInfo4 = _slicedToArray(_getTypeInfo3, 3), size4 = _getTypeInfo4[0], glType = _getTypeInfo4[1], bytes = _getTypeInfo4[2];
    var dataArray = createTypedArray(gl, glType, instances * size4);
    var stride = size4 * bytes;
    var buffer = gl.createBuffer();
    gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
    gl.bufferData(gl.ARRAY_BUFFER, instances * stride, gl.DYNAMIC_DRAW);
    gl.enableVertexAttribArray(attributeLoc);
    if (glType === gl.FLOAT) {
      gl.vertexAttribPointer(attributeLoc, size4, glType, false, stride, 0);
    } else if (glType === gl.INT) {
      gl.vertexAttribIPointer(attributeLoc, size4, glType, stride, 0);
    }
    gl.vertexAttribDivisor(attributeLoc, 1);
    gl.bindBuffer(gl.ARRAY_BUFFER, null);
    var views = new Array(instances);
    for (var i2 = 0; i2 < instances; i2++) {
      views[i2] = createTypedArrayView(gl, glType, dataArray, stride, size4, i2);
    }
    buffer.dataArray = dataArray;
    buffer.stride = stride;
    buffer.size = size4;
    buffer.getView = function(i3) {
      return views[i3];
    };
    buffer.setPoint = function(i3, x5, y6) {
      var view = views[i3];
      view[0] = x5;
      view[1] = y6;
    };
    buffer.bufferSubData = function(count2) {
      gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
      if (count2) {
        gl.bufferSubData(gl.ARRAY_BUFFER, 0, dataArray, 0, count2 * size4);
      } else {
        gl.bufferSubData(gl.ARRAY_BUFFER, 0, dataArray);
      }
    };
    return buffer;
  }
  function create3x3MatrixBufferDynamicDraw(gl, instances, attributeLoc) {
    var matrixSize = 9;
    var matrixData = new Float32Array(instances * matrixSize);
    var matrixViews = new Array(instances);
    for (var i2 = 0; i2 < instances; i2++) {
      var byteOffset = i2 * matrixSize * 4;
      matrixViews[i2] = new Float32Array(matrixData.buffer, byteOffset, matrixSize);
    }
    var buffer = gl.createBuffer();
    gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
    gl.bufferData(gl.ARRAY_BUFFER, matrixData.byteLength, gl.DYNAMIC_DRAW);
    for (var _i = 0; _i < 3; _i++) {
      var loc = attributeLoc + _i;
      gl.enableVertexAttribArray(loc);
      gl.vertexAttribPointer(loc, 3, gl.FLOAT, false, 3 * 12, _i * 12);
      gl.vertexAttribDivisor(loc, 1);
    }
    gl.bindBuffer(gl.ARRAY_BUFFER, null);
    buffer.getMatrixView = function(i3) {
      return matrixViews[i3];
    };
    buffer.setData = function(matrix, i3) {
      matrixViews[i3].set(matrix, 0);
    };
    buffer.bufferSubData = function() {
      gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
      gl.bufferSubData(gl.ARRAY_BUFFER, 0, matrixData);
    };
    return buffer;
  }
  function createPickingFrameBuffer(gl) {
    var fb = gl.createFramebuffer();
    gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
    var targetTexture = gl.createTexture();
    gl.bindTexture(gl.TEXTURE_2D, targetTexture);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
    gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, targetTexture, 0);
    gl.bindFramebuffer(gl.FRAMEBUFFER, null);
    fb.setFramebufferAttachmentSizes = function(width3, height2) {
      gl.bindTexture(gl.TEXTURE_2D, targetTexture);
      gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width3, height2, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
    };
    return fb;
  }
  function create3() {
    var out = new ARRAY_TYPE(9);
    if (ARRAY_TYPE != Float32Array) {
      out[1] = 0;
      out[2] = 0;
      out[3] = 0;
      out[5] = 0;
      out[6] = 0;
      out[7] = 0;
    }
    out[0] = 1;
    out[4] = 1;
    out[8] = 1;
    return out;
  }
  function identity6(out) {
    out[0] = 1;
    out[1] = 0;
    out[2] = 0;
    out[3] = 0;
    out[4] = 1;
    out[5] = 0;
    out[6] = 0;
    out[7] = 0;
    out[8] = 1;
    return out;
  }
  function multiply(out, a2, b3) {
    var a00 = a2[0], a01 = a2[1], a02 = a2[2];
    var a10 = a2[3], a11 = a2[4], a12 = a2[5];
    var a20 = a2[6], a21 = a2[7], a22 = a2[8];
    var b00 = b3[0], b01 = b3[1], b02 = b3[2];
    var b10 = b3[3], b11 = b3[4], b12 = b3[5];
    var b20 = b3[6], b21 = b3[7], b22 = b3[8];
    out[0] = b00 * a00 + b01 * a10 + b02 * a20;
    out[1] = b00 * a01 + b01 * a11 + b02 * a21;
    out[2] = b00 * a02 + b01 * a12 + b02 * a22;
    out[3] = b10 * a00 + b11 * a10 + b12 * a20;
    out[4] = b10 * a01 + b11 * a11 + b12 * a21;
    out[5] = b10 * a02 + b11 * a12 + b12 * a22;
    out[6] = b20 * a00 + b21 * a10 + b22 * a20;
    out[7] = b20 * a01 + b21 * a11 + b22 * a21;
    out[8] = b20 * a02 + b21 * a12 + b22 * a22;
    return out;
  }
  function translate(out, a2, v3) {
    var a00 = a2[0], a01 = a2[1], a02 = a2[2], a10 = a2[3], a11 = a2[4], a12 = a2[5], a20 = a2[6], a21 = a2[7], a22 = a2[8], x5 = v3[0], y6 = v3[1];
    out[0] = a00;
    out[1] = a01;
    out[2] = a02;
    out[3] = a10;
    out[4] = a11;
    out[5] = a12;
    out[6] = x5 * a00 + y6 * a10 + a20;
    out[7] = x5 * a01 + y6 * a11 + a21;
    out[8] = x5 * a02 + y6 * a12 + a22;
    return out;
  }
  function rotate(out, a2, rad) {
    var a00 = a2[0], a01 = a2[1], a02 = a2[2], a10 = a2[3], a11 = a2[4], a12 = a2[5], a20 = a2[6], a21 = a2[7], a22 = a2[8], s2 = Math.sin(rad), c3 = Math.cos(rad);
    out[0] = c3 * a00 + s2 * a10;
    out[1] = c3 * a01 + s2 * a11;
    out[2] = c3 * a02 + s2 * a12;
    out[3] = c3 * a10 - s2 * a00;
    out[4] = c3 * a11 - s2 * a01;
    out[5] = c3 * a12 - s2 * a02;
    out[6] = a20;
    out[7] = a21;
    out[8] = a22;
    return out;
  }
  function scale(out, a2, v3) {
    var x5 = v3[0], y6 = v3[1];
    out[0] = x5 * a2[0];
    out[1] = x5 * a2[1];
    out[2] = x5 * a2[2];
    out[3] = y6 * a2[3];
    out[4] = y6 * a2[4];
    out[5] = y6 * a2[5];
    out[6] = a2[6];
    out[7] = a2[7];
    out[8] = a2[8];
    return out;
  }
  function projection(out, width3, height2) {
    out[0] = 2 / width3;
    out[1] = 0;
    out[2] = 0;
    out[3] = 0;
    out[4] = -2 / height2;
    out[5] = 0;
    out[6] = -1;
    out[7] = 1;
    out[8] = 1;
    return out;
  }
  function intersection2(set1, set22) {
    if (set1.intersection) return set1.intersection(set22);
    else return new Set(_toConsumableArray(set1).filter(function(x5) {
      return set22.has(x5);
    }));
  }
  function getBGColor(r2) {
    var container2 = r2.cy.container();
    var cssColor = container2 && container2.style && container2.style.backgroundColor || "white";
    return color2tuple(cssColor);
  }
  function getLabelLines(ele, prefix) {
    var rs = ele._private.rscratch;
    return getPrefixedProperty(rs, "labelWrapCachedLines", prefix) || [];
  }
  function overrideCanvasRendererFunctions(r2) {
    {
      var renderCanvas = r2.render;
      r2.render = function(options2) {
        options2 = options2 || {};
        var cy = r2.cy;
        if (r2.webgl) {
          if (cy.zoom() > maxZoom$1) {
            clearWebgl(r2);
            renderCanvas.call(r2, options2);
          } else {
            clearCanvas(r2);
            renderWebgl(r2, options2, RENDER_TARGET.SCREEN);
          }
        }
      };
    }
    {
      var baseFunc = r2.matchCanvasSize;
      r2.matchCanvasSize = function(container2) {
        baseFunc.call(r2, container2);
        r2.pickingFrameBuffer.setFramebufferAttachmentSizes(r2.canvasWidth, r2.canvasHeight);
        r2.pickingFrameBuffer.needsDraw = true;
      };
    }
    {
      r2.findNearestElements = function(x5, y6, interactiveElementsOnly, isTouch) {
        return findNearestElementsWebgl(r2, x5, y6);
      };
    }
    {
      var _baseFunc = r2.invalidateCachedZSortedEles;
      r2.invalidateCachedZSortedEles = function() {
        _baseFunc.call(r2);
        r2.pickingFrameBuffer.needsDraw = true;
      };
    }
    {
      var _baseFunc2 = r2.notify;
      r2.notify = function(eventName, eles) {
        _baseFunc2.call(r2, eventName, eles);
        if (eventName === "viewport" || eventName === "bounds") {
          r2.pickingFrameBuffer.needsDraw = true;
        } else if (eventName === "background") {
          r2.drawing.invalidate(eles, {
            type: "node-body"
          });
        }
      };
    }
  }
  function clearWebgl(r2) {
    var gl = r2.data.contexts[r2.WEBGL];
    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
  }
  function clearCanvas(r2) {
    var clear21 = /* @__PURE__ */ __name(function clear22(context) {
      context.save();
      context.setTransform(1, 0, 0, 1, 0, 0);
      context.clearRect(0, 0, r2.canvasWidth, r2.canvasHeight);
      context.restore();
    }, "clear");
    clear21(r2.data.contexts[r2.NODE]);
    clear21(r2.data.contexts[r2.DRAG]);
  }
  function createPanZoomMatrix(r2) {
    var width3 = r2.canvasWidth;
    var height2 = r2.canvasHeight;
    var _util$getEffectivePan = getEffectivePanZoom(r2), pan2 = _util$getEffectivePan.pan, zoom2 = _util$getEffectivePan.zoom;
    var transform8 = create3();
    translate(transform8, transform8, [pan2.x, pan2.y]);
    scale(transform8, transform8, [zoom2, zoom2]);
    var projection$1 = create3();
    projection(projection$1, width3, height2);
    var product = create3();
    multiply(product, projection$1, transform8);
    return product;
  }
  function setContextTransform(r2, context) {
    var width3 = r2.canvasWidth;
    var height2 = r2.canvasHeight;
    var _util$getEffectivePan2 = getEffectivePanZoom(r2), pan2 = _util$getEffectivePan2.pan, zoom2 = _util$getEffectivePan2.zoom;
    context.setTransform(1, 0, 0, 1, 0, 0);
    context.clearRect(0, 0, width3, height2);
    context.translate(pan2.x, pan2.y);
    context.scale(zoom2, zoom2);
  }
  function drawSelectionRectangle(r2, options2) {
    r2.drawSelectionRectangle(options2, function(context) {
      return setContextTransform(r2, context);
    });
  }
  function drawAxes(r2) {
    var context = r2.data.contexts[r2.NODE];
    context.save();
    setContextTransform(r2, context);
    context.strokeStyle = "rgba(0, 0, 0, 0.3)";
    context.beginPath();
    context.moveTo(-1e3, 0);
    context.lineTo(1e3, 0);
    context.stroke();
    context.beginPath();
    context.moveTo(0, -1e3);
    context.lineTo(0, 1e3);
    context.stroke();
    context.restore();
  }
  function drawAtlases(r2) {
    var draw31 = /* @__PURE__ */ __name(function draw32(drawing, name, row) {
      var collection4 = drawing.atlasManager.getAtlasCollection(name);
      var context = r2.data.contexts[r2.NODE];
      var atlases = collection4.atlases;
      for (var _i = 0; _i < atlases.length; _i++) {
        var atlas = atlases[_i];
        var canvas = atlas.canvas;
        if (canvas) {
          var w4 = canvas.width;
          var h3 = canvas.height;
          var x5 = w4 * _i;
          var y6 = canvas.height * row;
          var scale3 = 0.4;
          context.save();
          context.scale(scale3, scale3);
          context.drawImage(canvas, x5, y6);
          context.strokeStyle = "black";
          context.rect(x5, y6, w4, h3);
          context.stroke();
          context.restore();
        }
      }
    }, "draw");
    var i2 = 0;
    draw31(r2.drawing, "node", i2++);
    draw31(r2.drawing, "label", i2++);
  }
  function getPickingIndexes(r2, mX1, mY1, mX2, mY2) {
    var x5, y6, w4, h3;
    var _util$getEffectivePan3 = getEffectivePanZoom(r2), pan2 = _util$getEffectivePan3.pan, zoom2 = _util$getEffectivePan3.zoom;
    {
      var _util$modelToRendered = modelToRenderedPosition2(r2, pan2, zoom2, mX1, mY1), _util$modelToRendered2 = _slicedToArray(_util$modelToRendered, 2), cX1 = _util$modelToRendered2[0], cY1 = _util$modelToRendered2[1];
      var t4 = 6;
      x5 = cX1 - t4 / 2;
      y6 = cY1 - t4 / 2;
      w4 = t4;
      h3 = t4;
    }
    if (w4 === 0 || h3 === 0) {
      return [];
    }
    var gl = r2.data.contexts[r2.WEBGL];
    gl.bindFramebuffer(gl.FRAMEBUFFER, r2.pickingFrameBuffer);
    if (r2.pickingFrameBuffer.needsDraw) {
      gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
      renderWebgl(r2, null, RENDER_TARGET.PICKING);
      r2.pickingFrameBuffer.needsDraw = false;
    }
    var n2 = w4 * h3;
    var data5 = new Uint8Array(n2 * 4);
    gl.readPixels(x5, y6, w4, h3, gl.RGBA, gl.UNSIGNED_BYTE, data5);
    gl.bindFramebuffer(gl.FRAMEBUFFER, null);
    var indexes = /* @__PURE__ */ new Set();
    for (var i2 = 0; i2 < n2; i2++) {
      var pixel = data5.slice(i2 * 4, i2 * 4 + 4);
      var index = vec4ToIndex(pixel) - 1;
      if (index >= 0) {
        indexes.add(index);
      }
    }
    return indexes;
  }
  function findNearestElementsWebgl(r2, x5, y6) {
    var indexes = getPickingIndexes(r2, x5, y6);
    var eles = r2.getCachedZSortedEles();
    var node2, edge;
    var _iterator = _createForOfIteratorHelper(indexes), _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done; ) {
        var index = _step.value;
        var ele = eles[index];
        if (!node2 && ele.isNode()) {
          node2 = ele;
        }
        if (!edge && ele.isEdge()) {
          edge = ele;
        }
        if (node2 && edge) {
          break;
        }
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    return [node2, edge].filter(Boolean);
  }
  function drawEle(r2, index, ele) {
    var drawing = r2.drawing;
    index += 1;
    if (ele.isNode()) {
      drawing.drawNode(ele, index, "node-underlay");
      drawing.drawNode(ele, index, "node-body");
      drawing.drawTexture(ele, index, "label");
      drawing.drawNode(ele, index, "node-overlay");
    } else {
      drawing.drawEdgeLine(ele, index);
      drawing.drawEdgeArrow(ele, index, "source");
      drawing.drawEdgeArrow(ele, index, "target");
      drawing.drawTexture(ele, index, "label");
      drawing.drawTexture(ele, index, "edge-source-label");
      drawing.drawTexture(ele, index, "edge-target-label");
    }
  }
  function renderWebgl(r2, options2, renderTarget) {
    var start3;
    if (r2.webglDebug) {
      start3 = performance.now();
    }
    var drawing = r2.drawing;
    var eleCount = 0;
    if (renderTarget.screen) {
      if (r2.data.canvasNeedsRedraw[r2.SELECT_BOX]) {
        drawSelectionRectangle(r2, options2);
      }
    }
    if (r2.data.canvasNeedsRedraw[r2.NODE] || renderTarget.picking) {
      var gl = r2.data.contexts[r2.WEBGL];
      if (renderTarget.screen) {
        gl.clearColor(0, 0, 0, 0);
        gl.enable(gl.BLEND);
        gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
      } else {
        gl.disable(gl.BLEND);
      }
      gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
      gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
      var panZoomMatrix = createPanZoomMatrix(r2);
      var eles = r2.getCachedZSortedEles();
      eleCount = eles.length;
      drawing.startFrame(panZoomMatrix, renderTarget);
      if (renderTarget.screen) {
        for (var i2 = 0; i2 < eles.nondrag.length; i2++) {
          drawEle(r2, i2, eles.nondrag[i2]);
        }
        for (var _i2 = 0; _i2 < eles.drag.length; _i2++) {
          drawEle(r2, _i2, eles.drag[_i2]);
        }
      } else if (renderTarget.picking) {
        for (var _i3 = 0; _i3 < eles.length; _i3++) {
          drawEle(r2, _i3, eles[_i3]);
        }
      }
      drawing.endFrame();
      if (renderTarget.screen && r2.webglDebugShowAtlases) {
        drawAxes(r2);
        drawAtlases(r2);
      }
      r2.data.canvasNeedsRedraw[r2.NODE] = false;
      r2.data.canvasNeedsRedraw[r2.DRAG] = false;
    }
    if (r2.webglDebug) {
      var end2 = performance.now();
      var compact2 = false;
      var time4 = Math.ceil(end2 - start3);
      var debugInfo = drawing.getDebugInfo();
      var report = ["".concat(eleCount, " elements"), "".concat(debugInfo.totalInstances, " instances"), "".concat(debugInfo.batchCount, " batches"), "".concat(debugInfo.totalAtlases, " atlases"), "".concat(debugInfo.wrappedCount, " wrapped textures"), "".concat(debugInfo.simpleCount, " simple shapes")].join(", ");
      if (compact2) {
        console.log("WebGL (".concat(renderTarget.name, ") - time ").concat(time4, "ms, ").concat(report));
      } else {
        console.log("WebGL (".concat(renderTarget.name, ") - frame time ").concat(time4, "ms"));
        console.log("Totals:");
        console.log("  ".concat(report));
        console.log("Texture Atlases Used:");
        var atlasInfo = debugInfo.atlasInfo;
        var _iterator2 = _createForOfIteratorHelper(atlasInfo), _step2;
        try {
          for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
            var info2 = _step2.value;
            console.log("  ".concat(info2.type, ": ").concat(info2.keyCount, " keys, ").concat(info2.atlasCount, " atlases"));
          }
        } catch (err) {
          _iterator2.e(err);
        } finally {
          _iterator2.f();
        }
        console.log("");
      }
    }
    if (r2.data.gc) {
      console.log("Garbage Collect!");
      r2.data.gc = false;
      drawing.gc();
    }
  }
  function b64ToBlob(b64, mimeType) {
    var bytes = atob(b64);
    var buff = new ArrayBuffer(bytes.length);
    var buffUint8 = new Uint8Array(buff);
    for (var i2 = 0; i2 < bytes.length; i2++) {
      buffUint8[i2] = bytes.charCodeAt(i2);
    }
    return new Blob([buff], {
      type: mimeType
    });
  }
  function b64UriToB64(b64uri) {
    var i2 = b64uri.indexOf(",");
    return b64uri.substr(i2 + 1);
  }
  function output(options2, canvas, mimeType) {
    var getB64Uri = /* @__PURE__ */ __name(function getB64Uri2() {
      return canvas.toDataURL(mimeType, options2.quality);
    }, "getB64Uri");
    switch (options2.output) {
      case "blob-promise":
        return new Promise$1(function(resolve2, reject3) {
          try {
            canvas.toBlob(function(blob) {
              if (blob != null) {
                resolve2(blob);
              } else {
                reject3(new Error("`canvas.toBlob()` sent a null value in its callback"));
              }
            }, mimeType, options2.quality);
          } catch (err) {
            reject3(err);
          }
        });
      case "blob":
        return b64ToBlob(b64UriToB64(getB64Uri()), mimeType);
      case "base64":
        return b64UriToB64(getB64Uri());
      case "base64uri":
      default:
        return getB64Uri();
    }
  }
  function CanvasRenderer(options2) {
    var r2 = this;
    var containerWindow = r2.cy.window();
    var document2 = containerWindow.document;
    if (options2.webgl) {
      CRp.CANVAS_LAYERS = r2.CANVAS_LAYERS = 4;
      console.log("webgl rendering enabled");
    }
    r2.data = {
      canvases: new Array(CRp.CANVAS_LAYERS),
      contexts: new Array(CRp.CANVAS_LAYERS),
      canvasNeedsRedraw: new Array(CRp.CANVAS_LAYERS),
      bufferCanvases: new Array(CRp.BUFFER_COUNT),
      bufferContexts: new Array(CRp.CANVAS_LAYERS)
    };
    var tapHlOffAttr = "-webkit-tap-highlight-color";
    var tapHlOffStyle = "rgba(0,0,0,0)";
    r2.data.canvasContainer = document2.createElement("div");
    var containerStyle = r2.data.canvasContainer.style;
    r2.data.canvasContainer.style[tapHlOffAttr] = tapHlOffStyle;
    containerStyle.position = "relative";
    containerStyle.zIndex = "0";
    containerStyle.overflow = "hidden";
    var container2 = options2.cy.container();
    container2.appendChild(r2.data.canvasContainer);
    container2.style[tapHlOffAttr] = tapHlOffStyle;
    var styleMap2 = {
      "-webkit-user-select": "none",
      "-moz-user-select": "-moz-none",
      "user-select": "none",
      "-webkit-tap-highlight-color": "rgba(0,0,0,0)",
      "outline-style": "none"
    };
    if (ms()) {
      styleMap2["-ms-touch-action"] = "none";
      styleMap2["touch-action"] = "none";
    }
    for (var i2 = 0; i2 < CRp.CANVAS_LAYERS; i2++) {
      var canvas = r2.data.canvases[i2] = document2.createElement("canvas");
      var type3 = CRp.CANVAS_TYPES[i2];
      r2.data.contexts[i2] = canvas.getContext(type3);
      if (!r2.data.contexts[i2]) {
        error("Could not create canvas of type " + type3);
      }
      Object.keys(styleMap2).forEach(function(k2) {
        canvas.style[k2] = styleMap2[k2];
      });
      canvas.style.position = "absolute";
      canvas.setAttribute("data-id", "layer" + i2);
      canvas.style.zIndex = String(CRp.CANVAS_LAYERS - i2);
      r2.data.canvasContainer.appendChild(canvas);
      r2.data.canvasNeedsRedraw[i2] = false;
    }
    r2.data.topCanvas = r2.data.canvases[0];
    r2.data.canvases[CRp.NODE].setAttribute("data-id", "layer" + CRp.NODE + "-node");
    r2.data.canvases[CRp.SELECT_BOX].setAttribute("data-id", "layer" + CRp.SELECT_BOX + "-selectbox");
    r2.data.canvases[CRp.DRAG].setAttribute("data-id", "layer" + CRp.DRAG + "-drag");
    if (r2.data.canvases[CRp.WEBGL]) {
      r2.data.canvases[CRp.WEBGL].setAttribute("data-id", "layer" + CRp.WEBGL + "-webgl");
    }
    for (var i2 = 0; i2 < CRp.BUFFER_COUNT; i2++) {
      r2.data.bufferCanvases[i2] = document2.createElement("canvas");
      r2.data.bufferContexts[i2] = r2.data.bufferCanvases[i2].getContext("2d");
      r2.data.bufferCanvases[i2].style.position = "absolute";
      r2.data.bufferCanvases[i2].setAttribute("data-id", "buffer" + i2);
      r2.data.bufferCanvases[i2].style.zIndex = String(-i2 - 1);
      r2.data.bufferCanvases[i2].style.visibility = "hidden";
    }
    r2.pathsEnabled = true;
    var emptyBb = makeBoundingBox();
    var getBoxCenter = /* @__PURE__ */ __name(function getBoxCenter2(bb) {
      return {
        x: (bb.x1 + bb.x2) / 2,
        y: (bb.y1 + bb.y2) / 2
      };
    }, "getBoxCenter");
    var getCenterOffset = /* @__PURE__ */ __name(function getCenterOffset2(bb) {
      return {
        x: -bb.w / 2,
        y: -bb.h / 2
      };
    }, "getCenterOffset");
    var backgroundTimestampHasChanged = /* @__PURE__ */ __name(function backgroundTimestampHasChanged2(ele) {
      var _p = ele[0]._private;
      var same2 = _p.oldBackgroundTimestamp === _p.backgroundTimestamp;
      return !same2;
    }, "backgroundTimestampHasChanged");
    var getStyleKey = /* @__PURE__ */ __name(function getStyleKey2(ele) {
      return ele[0]._private.nodeKey;
    }, "getStyleKey");
    var getLabelKey = /* @__PURE__ */ __name(function getLabelKey2(ele) {
      return ele[0]._private.labelStyleKey;
    }, "getLabelKey");
    var getSourceLabelKey = /* @__PURE__ */ __name(function getSourceLabelKey2(ele) {
      return ele[0]._private.sourceLabelStyleKey;
    }, "getSourceLabelKey");
    var getTargetLabelKey = /* @__PURE__ */ __name(function getTargetLabelKey2(ele) {
      return ele[0]._private.targetLabelStyleKey;
    }, "getTargetLabelKey");
    var drawElement = /* @__PURE__ */ __name(function drawElement2(context, ele, bb, scaledLabelShown, useEleOpacity) {
      return r2.drawElement(context, ele, bb, false, false, useEleOpacity);
    }, "drawElement");
    var drawLabel4 = /* @__PURE__ */ __name(function drawLabel5(context, ele, bb, scaledLabelShown, useEleOpacity) {
      return r2.drawElementText(context, ele, bb, scaledLabelShown, "main", useEleOpacity);
    }, "drawLabel");
    var drawSourceLabel = /* @__PURE__ */ __name(function drawSourceLabel2(context, ele, bb, scaledLabelShown, useEleOpacity) {
      return r2.drawElementText(context, ele, bb, scaledLabelShown, "source", useEleOpacity);
    }, "drawSourceLabel");
    var drawTargetLabel = /* @__PURE__ */ __name(function drawTargetLabel2(context, ele, bb, scaledLabelShown, useEleOpacity) {
      return r2.drawElementText(context, ele, bb, scaledLabelShown, "target", useEleOpacity);
    }, "drawTargetLabel");
    var getElementBox = /* @__PURE__ */ __name(function getElementBox2(ele) {
      ele.boundingBox();
      return ele[0]._private.bodyBounds;
    }, "getElementBox");
    var getLabelBox = /* @__PURE__ */ __name(function getLabelBox2(ele) {
      ele.boundingBox();
      return ele[0]._private.labelBounds.main || emptyBb;
    }, "getLabelBox");
    var getSourceLabelBox = /* @__PURE__ */ __name(function getSourceLabelBox2(ele) {
      ele.boundingBox();
      return ele[0]._private.labelBounds.source || emptyBb;
    }, "getSourceLabelBox");
    var getTargetLabelBox = /* @__PURE__ */ __name(function getTargetLabelBox2(ele) {
      ele.boundingBox();
      return ele[0]._private.labelBounds.target || emptyBb;
    }, "getTargetLabelBox");
    var isLabelVisibleAtScale = /* @__PURE__ */ __name(function isLabelVisibleAtScale2(ele, scaledLabelShown) {
      return scaledLabelShown;
    }, "isLabelVisibleAtScale");
    var getElementRotationPoint = /* @__PURE__ */ __name(function getElementRotationPoint2(ele) {
      return getBoxCenter(getElementBox(ele));
    }, "getElementRotationPoint");
    var addTextMargin = /* @__PURE__ */ __name(function addTextMargin2(prefix, pt, ele) {
      var pre = prefix ? prefix + "-" : "";
      return {
        x: pt.x + ele.pstyle(pre + "text-margin-x").pfValue,
        y: pt.y + ele.pstyle(pre + "text-margin-y").pfValue
      };
    }, "addTextMargin");
    var getRsPt = /* @__PURE__ */ __name(function getRsPt2(ele, x5, y6) {
      var rs = ele[0]._private.rscratch;
      return {
        x: rs[x5],
        y: rs[y6]
      };
    }, "getRsPt");
    var getLabelRotationPoint = /* @__PURE__ */ __name(function getLabelRotationPoint2(ele) {
      return addTextMargin("", getRsPt(ele, "labelX", "labelY"), ele);
    }, "getLabelRotationPoint");
    var getSourceLabelRotationPoint = /* @__PURE__ */ __name(function getSourceLabelRotationPoint2(ele) {
      return addTextMargin("source", getRsPt(ele, "sourceLabelX", "sourceLabelY"), ele);
    }, "getSourceLabelRotationPoint");
    var getTargetLabelRotationPoint = /* @__PURE__ */ __name(function getTargetLabelRotationPoint2(ele) {
      return addTextMargin("target", getRsPt(ele, "targetLabelX", "targetLabelY"), ele);
    }, "getTargetLabelRotationPoint");
    var getElementRotationOffset = /* @__PURE__ */ __name(function getElementRotationOffset2(ele) {
      return getCenterOffset(getElementBox(ele));
    }, "getElementRotationOffset");
    var getSourceLabelRotationOffset = /* @__PURE__ */ __name(function getSourceLabelRotationOffset2(ele) {
      return getCenterOffset(getSourceLabelBox(ele));
    }, "getSourceLabelRotationOffset");
    var getTargetLabelRotationOffset = /* @__PURE__ */ __name(function getTargetLabelRotationOffset2(ele) {
      return getCenterOffset(getTargetLabelBox(ele));
    }, "getTargetLabelRotationOffset");
    var getLabelRotationOffset = /* @__PURE__ */ __name(function getLabelRotationOffset2(ele) {
      var bb = getLabelBox(ele);
      var p3 = getCenterOffset(getLabelBox(ele));
      if (ele.isNode()) {
        switch (ele.pstyle("text-halign").value) {
          case "left":
            p3.x = -bb.w - (bb.leftPad || 0);
            break;
          case "right":
            p3.x = -(bb.rightPad || 0);
            break;
        }
        switch (ele.pstyle("text-valign").value) {
          case "top":
            p3.y = -bb.h - (bb.topPad || 0);
            break;
          case "bottom":
            p3.y = -(bb.botPad || 0);
            break;
        }
      }
      return p3;
    }, "getLabelRotationOffset");
    var eleTxrCache = r2.data.eleTxrCache = new ElementTextureCache(r2, {
      getKey: getStyleKey,
      doesEleInvalidateKey: backgroundTimestampHasChanged,
      drawElement,
      getBoundingBox: getElementBox,
      getRotationPoint: getElementRotationPoint,
      getRotationOffset: getElementRotationOffset,
      allowEdgeTxrCaching: false,
      allowParentTxrCaching: false
    });
    var lblTxrCache = r2.data.lblTxrCache = new ElementTextureCache(r2, {
      getKey: getLabelKey,
      drawElement: drawLabel4,
      getBoundingBox: getLabelBox,
      getRotationPoint: getLabelRotationPoint,
      getRotationOffset: getLabelRotationOffset,
      isVisible: isLabelVisibleAtScale
    });
    var slbTxrCache = r2.data.slbTxrCache = new ElementTextureCache(r2, {
      getKey: getSourceLabelKey,
      drawElement: drawSourceLabel,
      getBoundingBox: getSourceLabelBox,
      getRotationPoint: getSourceLabelRotationPoint,
      getRotationOffset: getSourceLabelRotationOffset,
      isVisible: isLabelVisibleAtScale
    });
    var tlbTxrCache = r2.data.tlbTxrCache = new ElementTextureCache(r2, {
      getKey: getTargetLabelKey,
      drawElement: drawTargetLabel,
      getBoundingBox: getTargetLabelBox,
      getRotationPoint: getTargetLabelRotationPoint,
      getRotationOffset: getTargetLabelRotationOffset,
      isVisible: isLabelVisibleAtScale
    });
    var lyrTxrCache = r2.data.lyrTxrCache = new LayeredTextureCache(r2);
    r2.onUpdateEleCalcs(/* @__PURE__ */ __name(function invalidateTextureCaches(willDraw, eles) {
      eleTxrCache.invalidateElements(eles);
      lblTxrCache.invalidateElements(eles);
      slbTxrCache.invalidateElements(eles);
      tlbTxrCache.invalidateElements(eles);
      lyrTxrCache.invalidateElements(eles);
      for (var _i = 0; _i < eles.length; _i++) {
        var _p = eles[_i]._private;
        _p.oldBackgroundTimestamp = _p.backgroundTimestamp;
      }
    }, "invalidateTextureCaches"));
    var refineInLayers = /* @__PURE__ */ __name(function refineInLayers2(reqs) {
      for (var i3 = 0; i3 < reqs.length; i3++) {
        lyrTxrCache.enqueueElementRefinement(reqs[i3].ele);
      }
    }, "refineInLayers");
    eleTxrCache.onDequeue(refineInLayers);
    lblTxrCache.onDequeue(refineInLayers);
    slbTxrCache.onDequeue(refineInLayers);
    tlbTxrCache.onDequeue(refineInLayers);
    if (options2.webgl) {
      r2.initWebgl(options2, {
        getStyleKey,
        getLabelKey,
        getSourceLabelKey,
        getTargetLabelKey,
        drawElement,
        drawLabel: drawLabel4,
        drawSourceLabel,
        drawTargetLabel,
        getElementBox,
        getLabelBox,
        getSourceLabelBox,
        getTargetLabelBox,
        getElementRotationPoint,
        getElementRotationOffset,
        getLabelRotationPoint,
        getSourceLabelRotationPoint,
        getTargetLabelRotationPoint,
        getLabelRotationOffset,
        getSourceLabelRotationOffset,
        getTargetLabelRotationOffset
      });
    }
  }
  function setExtension(type3, name, registrant) {
    var ext = registrant;
    var overrideErr = /* @__PURE__ */ __name(function overrideErr2(field) {
      warn("Can not register `" + name + "` for `" + type3 + "` since `" + field + "` already exists in the prototype and can not be overridden");
    }, "overrideErr");
    if (type3 === "core") {
      if (Core.prototype[name]) {
        return overrideErr(name);
      } else {
        Core.prototype[name] = registrant;
      }
    } else if (type3 === "collection") {
      if (Collection.prototype[name]) {
        return overrideErr(name);
      } else {
        Collection.prototype[name] = registrant;
      }
    } else if (type3 === "layout") {
      var Layout2 = /* @__PURE__ */ __name(function Layout3(options2) {
        this.options = options2;
        registrant.call(this, options2);
        if (!plainObject(this._private)) {
          this._private = {};
        }
        this._private.cy = options2.cy;
        this._private.listeners = [];
        this.createEmitter();
      }, "Layout");
      var layoutProto = Layout2.prototype = Object.create(registrant.prototype);
      var optLayoutFns = [];
      for (var i2 = 0; i2 < optLayoutFns.length; i2++) {
        var fnName = optLayoutFns[i2];
        layoutProto[fnName] = layoutProto[fnName] || function() {
          return this;
        };
      }
      if (layoutProto.start && !layoutProto.run) {
        layoutProto.run = function() {
          this.start();
          return this;
        };
      } else if (!layoutProto.start && layoutProto.run) {
        layoutProto.start = function() {
          this.run();
          return this;
        };
      }
      var regStop = registrant.prototype.stop;
      layoutProto.stop = function() {
        var opts = this.options;
        if (opts && opts.animate) {
          var anis = this.animations;
          if (anis) {
            for (var _i = 0; _i < anis.length; _i++) {
              anis[_i].stop();
            }
          }
        }
        if (regStop) {
          regStop.call(this);
        } else {
          this.emit("layoutstop");
        }
        return this;
      };
      if (!layoutProto.destroy) {
        layoutProto.destroy = function() {
          return this;
        };
      }
      layoutProto.cy = function() {
        return this._private.cy;
      };
      var getCy = /* @__PURE__ */ __name(function getCy2(layout7) {
        return layout7._private.cy;
      }, "getCy");
      var emitterOpts = {
        addEventFields: /* @__PURE__ */ __name(function addEventFields4(layout7, evt) {
          evt.layout = layout7;
          evt.cy = getCy(layout7);
          evt.target = layout7;
        }, "addEventFields"),
        bubble: /* @__PURE__ */ __name(function bubble3() {
          return true;
        }, "bubble"),
        parent: /* @__PURE__ */ __name(function parent4(layout7) {
          return getCy(layout7);
        }, "parent")
      };
      extend4(layoutProto, {
        createEmitter: /* @__PURE__ */ __name(function createEmitter3() {
          this._private.emitter = new Emitter(emitterOpts, this);
          return this;
        }, "createEmitter"),
        emitter: /* @__PURE__ */ __name(function emitter3() {
          return this._private.emitter;
        }, "emitter"),
        on: /* @__PURE__ */ __name(function on3(evt, cb) {
          this.emitter().on(evt, cb);
          return this;
        }, "on"),
        one: /* @__PURE__ */ __name(function one4(evt, cb) {
          this.emitter().one(evt, cb);
          return this;
        }, "one"),
        once: /* @__PURE__ */ __name(function once3(evt, cb) {
          this.emitter().one(evt, cb);
          return this;
        }, "once"),
        removeListener: /* @__PURE__ */ __name(function removeListener3(evt, cb) {
          this.emitter().removeListener(evt, cb);
          return this;
        }, "removeListener"),
        removeAllListeners: /* @__PURE__ */ __name(function removeAllListeners3() {
          this.emitter().removeAllListeners();
          return this;
        }, "removeAllListeners"),
        emit: /* @__PURE__ */ __name(function emit3(evt, params) {
          this.emitter().emit(evt, params);
          return this;
        }, "emit")
      });
      define2.eventAliasesOn(layoutProto);
      ext = Layout2;
    } else if (type3 === "renderer" && name !== "null" && name !== "base") {
      var BaseRenderer3 = getExtension("renderer", "base");
      var bProto = BaseRenderer3.prototype;
      var RegistrantRenderer = registrant;
      var rProto = registrant.prototype;
      var Renderer = /* @__PURE__ */ __name(function Renderer2() {
        BaseRenderer3.apply(this, arguments);
        RegistrantRenderer.apply(this, arguments);
      }, "Renderer");
      var proto = Renderer.prototype;
      for (var pName in bProto) {
        var pVal = bProto[pName];
        var existsInR = rProto[pName] != null;
        if (existsInR) {
          return overrideErr(pName);
        }
        proto[pName] = pVal;
      }
      for (var _pName in rProto) {
        proto[_pName] = rProto[_pName];
      }
      bProto.clientFunctions.forEach(function(name2) {
        proto[name2] = proto[name2] || function() {
          error("Renderer does not implement `renderer." + name2 + "()` on its prototype");
        };
      });
      ext = Renderer;
    } else if (type3 === "__proto__" || type3 === "constructor" || type3 === "prototype") {
      return error(type3 + " is an illegal type to be registered, possibly lead to prototype pollutions");
    }
    return setMap({
      map: extensions,
      keys: [type3, name],
      value: ext
    });
  }
  function getExtension(type3, name) {
    return getMap({
      map: extensions,
      keys: [type3, name]
    });
  }
  function setModule(type3, name, moduleType, moduleName, registrant) {
    return setMap({
      map: modules,
      keys: [type3, name, moduleType, moduleName],
      value: registrant
    });
  }
  function getModule(type3, name, moduleType, moduleName) {
    return getMap({
      map: modules,
      keys: [type3, name, moduleType, moduleName]
    });
  }
  var _window, navigator2, typeofstr, typeofobj, typeoffn, typeofhtmlele, instanceStr, string, fn$6, array2, plainObject, object, number$1, integer, htmlElement, elementOrCollection, element, collection, core2, stylesheet, event, emptyString, domElement, boundingBox, promise, ms, memoize2, camel2dash, dash2camel, prependCamel, capitalize, endsWith, number6, rgba3, rgbaNoBackRefs, hsla2, hslaNoBackRefs, hex3, hex6, ascending3, descending2, extend4, hex2tuple, hsl2tuple, rgb2tuple, colorname2tuple, color2tuple, colors, setMap, getMap, commonjsGlobal, isObject_12, hasRequiredIsObject, _freeGlobal, hasRequired_freeGlobal, _root, hasRequired_root, now_1, hasRequiredNow, _trimmedEndIndex, hasRequired_trimmedEndIndex, _baseTrim, hasRequired_baseTrim, _Symbol, hasRequired_Symbol, _getRawTag, hasRequired_getRawTag, _objectToString, hasRequired_objectToString, _baseGetTag, hasRequired_baseGetTag, isObjectLike_1, hasRequiredIsObjectLike, isSymbol_1, hasRequiredIsSymbol, toNumber_1, hasRequiredToNumber, debounce_1, hasRequiredDebounce, debounceExports, debounce, performance$1, pnow, raf, requestAnimationFrame2, performanceNow, DEFAULT_HASH_SEED, K4, DEFAULT_HASH_SEED_ALT, hashIterableInts, hashInt, hashIntAlt, combineHashes, combineHashesArray, hashArrays, hashIntsArray, hashString, hashStrings, hashStringsArray, movePointByBoxAspect, warningsEnabled, warnSupported, traceSupported, MAX_INT$1, trueify, falsify, zeroify, noop$1, error, warnings, warn, clone3, copy3, copyArray2, uuid, _staticEmptyObject, staticEmptyObject, defaults$g, removeFromArray, clearArray, push, getPrefixedProperty, setPrefixedProperty, ObjectMap, Map$1, undef, ObjectSet, Set$1, Element, defineSearch, elesfn$v, heap$2, heap$1, hasRequiredHeap$1, heap, hasRequiredHeap, heapExports, Heap, dijkstraDefaults, elesfn$u, elesfn$t, aStarDefaults, elesfn$s, floydWarshallDefaults, elesfn$r, bellmanFordDefaults, elesfn$q, sqrt2, collapse, contractUntil, elesfn$p, _Math$hypot, copyPosition, modelToRenderedPosition$1, renderedToModelPosition, array2point, min5, max5, mean, median, deg2rad, getAngleFromDisp, log22, signum, dist, sqdist, inPlaceSumNormalize, qbezierAt, qbezierPtAt, lineAt, bound, makeBoundingBox, copyBoundingBox, clearBoundingBox, updateBoundingBox, expandBoundingBoxByPoint, expandBoundingBox, expandBoundingBoxSides, assignBoundingBox, boundingBoxesIntersect, inBoundingBox, pointInBoundingBox, boundingBoxInBoundingBox, hypot, roundRectangleIntersectLine, inLineVicinity, inBezierVicinity, solveQuadratic, solveCubic, sqdistToQuadraticBezier, sqdistToFiniteLine, pointInsidePolygonPoints, pointInsidePolygon, pointInsideRoundPolygon, joinLines, expandPolygon, intersectLineEllipse, checkInEllipse, intersectLineCircle, midOfThree, finiteLinesIntersect, transformPoints, polygonIntersectLine, roundPolygonIntersectLine, shortenIntersection, generateUnitNgonPointsFitToSquare, fitPolygonToSquare, generateUnitNgonPoints, getRoundRectangleRadius, getRoundPolygonRadius, getCutRectangleCornerLength, bezierPtsToQuadCoeff, getBarrelCurveConstants, pageRankDefaults, elesfn$o, defaults$f, elesfn$n, defaults$e, elesfn$m, defaults$d, elesfn$l, defaults$c, setOptions$3, getSimilarity$1, addLoops, normalize2, mmult, expand, inflate, hasConverged, assign$2, isDuplicate, removeDuplicates, markovClustering, markovClustering$1, identity$1, absDiff, addAbsDiff, addSquaredDiff, sqrt3, maxAbsDiff, getDistance, distances, defaults$b, setOptions$2, getDist, randomCentroids, classify, buildCluster, haveValuesConverged, haveMatricesConverged, seenBefore, randomMedoids, findCost, kMeans, kMedoids, updateCentroids, updateMembership, assign$1, fuzzyCMeans, kClustering, defaults$a, linkageAliases, setOptions$1, mergeClosest, _getAllChildren, _buildDendrogram, _buildClustersFromTree, hierarchicalClustering, hierarchicalClustering$1, defaults$9, setOptions4, getSimilarity2, getPreference, findExemplars, assignClusters, assign4, affinityPropagation, affinityPropagation$1, hierholzerDefaults, elesfn$k, hopcroftTarjanBiconnected, hopcroftTarjanBiconnected$1, tarjanStronglyConnected, tarjanStronglyConnected$1, elesfn$j, STATE_PENDING, STATE_FULFILLED, STATE_REJECTED, _api, deliver, execute, execute_handlers, resolver, _resolve, Promise$1, Animation, anifn, define$3, isArray_1, hasRequiredIsArray, _isKey, hasRequired_isKey, isFunction_1, hasRequiredIsFunction, _coreJsData, hasRequired_coreJsData, _isMasked, hasRequired_isMasked, _toSource, hasRequired_toSource, _baseIsNative, hasRequired_baseIsNative, _getValue, hasRequired_getValue, _getNative, hasRequired_getNative, _nativeCreate, hasRequired_nativeCreate, _hashClear, hasRequired_hashClear, _hashDelete, hasRequired_hashDelete, _hashGet, hasRequired_hashGet, _hashHas, hasRequired_hashHas, _hashSet, hasRequired_hashSet, _Hash, hasRequired_Hash, _listCacheClear, hasRequired_listCacheClear, eq_1, hasRequiredEq, _assocIndexOf, hasRequired_assocIndexOf, _listCacheDelete, hasRequired_listCacheDelete, _listCacheGet, hasRequired_listCacheGet, _listCacheHas, hasRequired_listCacheHas, _listCacheSet, hasRequired_listCacheSet, _ListCache, hasRequired_ListCache, _Map, hasRequired_Map, _mapCacheClear, hasRequired_mapCacheClear, _isKeyable, hasRequired_isKeyable, _getMapData, hasRequired_getMapData, _mapCacheDelete, hasRequired_mapCacheDelete, _mapCacheGet, hasRequired_mapCacheGet, _mapCacheHas, hasRequired_mapCacheHas, _mapCacheSet, hasRequired_mapCacheSet, _MapCache, hasRequired_MapCache, memoize_1, hasRequiredMemoize, _memoizeCapped, hasRequired_memoizeCapped, _stringToPath, hasRequired_stringToPath, _arrayMap, hasRequired_arrayMap, _baseToString, hasRequired_baseToString, toString_1, hasRequiredToString, _castPath, hasRequired_castPath, _toKey, hasRequired_toKey, _baseGet, hasRequired_baseGet, get_1, hasRequiredGet, getExports, get4, _defineProperty, hasRequired_defineProperty, _baseAssignValue, hasRequired_baseAssignValue, _assignValue, hasRequired_assignValue, _isIndex, hasRequired_isIndex, _baseSet, hasRequired_baseSet, set_1, hasRequiredSet, setExports, set4, _copyArray, hasRequired_copyArray, toPath_1, hasRequiredToPath, toPathExports, toPath, define$2, define$1, define2, elesfn$i, elesfn$h, tokens, newQuery, Type2, stateSelectors, lookup, stateSelectorMatches, stateSelectorRegex, cleanMetaChars, replaceLastQuery, exprs, consumeExpr, consumeWhitespace, parse, toString3, parse$1, valCmp, boolCmp, existCmp, data$1, meta, match, matches$1, filter3, matches31, matching, Selector, selfn, elesfn$g, cache, elesfn$f, fn$5, elesfn$e, data3, elesfn$d, fn$4, elesfn$c, beforePositionSet, positionDef, position2, fn$3, elesfn$b, noninf, updateBounds, updateBoundsFromBox, prefixedProperty, updateBoundsFromArrow, updateBoundsFromLabel, updateBoundsFromOutline, updateBoundsFromMiter, updateBoundsFromMiterBorder, boundingBoxImpl, getKey, getBoundingBoxPosKey, cachedBoundingBoxImpl, defBbOpts, defBbOptsKey, filledBbOpts, bounds, fn$2, elesfn$a, defineDimFns, widthHeight, ifEdge, ifEdgeRenderedPosition, ifEdgeRenderedPositions, controlPoints2, segmentPoints, sourceEndpoint, targetEndpoint, midpoint, pts, renderedName, edgePoints, dimensions, Event, eventRegex, universalNamespace, defaults$8, defaultsKeys, emptyOpts, p2, forEachEvent, makeEventObj, forEachEventObj, emitterOptions$1, argSelector$1, elesfn$9, elesfn$8, fn$1, elesfn$7, zIndexSort, elesfn$6, defineSymbolIterator, getLayoutDimensionOptions, elesfn$5, elesfn$4, eleTakesUpSpace, eleInteractive, parentInteractive, eleVisible, edgeVisibleViaNode, elesfn$3, elesfn$2, defineDagExtremity, defineDagOneHop, defineDagAllHops, Collection, elesfn$1, corefn$9, generateSpringRK4, cubicBezier, easings, corefn$8, emitterOptions, argSelector2, elesfn, corefn$7, corefn$6, corefn$5, rendererDefaults, corefn$4, corefn$3, styfn$8, TRUE, FALSE, styfn$7, styfn$6, styfn$5, styfn$4, styfn$3, styfn$2, styfn$1, _Style, styfn, corefn$2, defaultSelectionType, corefn$1, fn2, Core, corefn, defaults$7, deprecatedOptionDefaults, getInfo, setInfo, defaults$6, defaults$5, DEBUG, defaults$4, createLayoutInfo, findLCA, _findLCA_aux, printLayoutInfo, randomizePositions, getScaleInBoundsFn, refreshPositions, step, calculateNodeForces, randomDistance, nodeRepulsion2, nodesOverlap, findClippingPoint, calculateEdgeForces, calculateGravityForces, propagateForces, updatePositions, limitForce, _updateAncestryBoundaries, separateComponents, defaults$3, defaults$2, defaults$1, defaults3, layout4, noop4, throwImgErr, BRp$f, BRp$e, BRp$d, x3, y4, v1, v22, sinA, sinA90, radDirection, drawDirection, angle, halfAngle, cRadius, lenOut, radius, limit, startX, startY, stopX, stopY, lastPoint, asVec, invertVec, calcCornerArc, AVOID_IMPOSSIBLE_BEZIER_CONSTANT, AVOID_IMPOSSIBLE_BEZIER_CONSTANT_L, BRp$c, BRp$b, BRp$a, BRp$9, lineAngleFromDelta, lineAngle, bezierAngle, BRp$8, TOO_SMALL_CUT_RECT, warnedCutRect, BRp$7, BRp$6, BRp$5, BRp$4, BRp$3, BRp$2, BRp$1, beforeRenderCallbacks, BaseRenderer, BR, BRp, fullFpsTime, defs, ElementTextureCacheLookup, minTxrH, txrStepH, minLvl$1, maxLvl$1, maxZoom$1, eleTxrSpacing, defTxrWidth, maxTxrW, maxTxrH, minUtility, maxFullness, maxFullnessChecks, deqCost$1, deqAvgCost$1, deqNoDrawCost$1, deqFastCost$1, deqRedrawThreshold$1, maxDeqSize$1, getTxrReasons, initDefaults, ElementTextureCache, ETCp, defNumLayers, minLvl, maxLvl, maxZoom2, deqRedrawThreshold, refineEleDebounceTime, deqCost, deqAvgCost, deqNoDrawCost, deqFastCost, maxDeqSize, invalidThreshold, maxLayerArea, maxLayerDim, useHighQualityEleTxrReqs, LayeredTextureCache, LTCp, layerIdPool, MAX_INT, CRp$b, impl, CRp$a, getZeroRotation, getLabelRotation, getSourceLabelRotation, getTargetLabelRotation, getOpacity, getTextOpacity, CRp$9, drawEdgeOverlayUnderlay, CRp$8, CRp$7, CRp$6, drawNodeOverlayUnderlay, CRp$5, motionBlurDelay, fpsHeight, ARRAY_TYPE, Atlas, AtlasCollection, AtlasManager, AtlasBatchManager, circleSD, rectangleSD, roundRectangleSD, ellipseSD, RENDER_TARGET, TEX_PICKING_MODE, TEXTURE, EDGE_STRAIGHT, EDGE_CURVE_SEGMENT, EDGE_ARROW, RECTANGLE, ROUND_RECTANGLE, BOTTOM_ROUND_RECTANGLE, ELLIPSE, ElementDrawingWebGL, CRp$4, getStyleKeysForLabel, getBoundingBoxForLabel, CRp$3, sin0, cos0, sin2, cos2, ellipseStepSize, i2, CRp$2, CRp$1, CR, CRp, pathsImpld, renderer2, incExts, extensions, modules, extension2, _Stylesheet, sheetfn, version2, cytoscape2;
  var init_cytoscape_esm = __esm({
    "../../node_modules/.pnpm/cytoscape@3.33.1/node_modules/cytoscape/dist/cytoscape.esm.mjs"() {
      "use strict";
      __name(_arrayLikeToArray, "_arrayLikeToArray");
      __name(_arrayWithHoles, "_arrayWithHoles");
      __name(_arrayWithoutHoles, "_arrayWithoutHoles");
      __name(_classCallCheck, "_classCallCheck");
      __name(_defineProperties, "_defineProperties");
      __name(_createClass, "_createClass");
      __name(_createForOfIteratorHelper, "_createForOfIteratorHelper");
      __name(_defineProperty$1, "_defineProperty$1");
      __name(_iterableToArray, "_iterableToArray");
      __name(_iterableToArrayLimit, "_iterableToArrayLimit");
      __name(_nonIterableRest, "_nonIterableRest");
      __name(_nonIterableSpread, "_nonIterableSpread");
      __name(_slicedToArray, "_slicedToArray");
      __name(_toConsumableArray, "_toConsumableArray");
      __name(_toPrimitive, "_toPrimitive");
      __name(_toPropertyKey, "_toPropertyKey");
      __name(_typeof, "_typeof");
      __name(_unsupportedIterableToArray, "_unsupportedIterableToArray");
      _window = typeof window === "undefined" ? null : window;
      navigator2 = _window ? _window.navigator : null;
      _window ? _window.document : null;
      typeofstr = _typeof("");
      typeofobj = _typeof({});
      typeoffn = _typeof(function() {
      });
      typeofhtmlele = typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement);
      instanceStr = /* @__PURE__ */ __name(function instanceStr2(obj) {
        return obj && obj.instanceString && fn$6(obj.instanceString) ? obj.instanceString() : null;
      }, "instanceStr");
      string = /* @__PURE__ */ __name(function string2(obj) {
        return obj != null && _typeof(obj) == typeofstr;
      }, "string");
      fn$6 = /* @__PURE__ */ __name(function fn(obj) {
        return obj != null && _typeof(obj) === typeoffn;
      }, "fn");
      array2 = /* @__PURE__ */ __name(function array3(obj) {
        return !elementOrCollection(obj) && (Array.isArray ? Array.isArray(obj) : obj != null && obj instanceof Array);
      }, "array");
      plainObject = /* @__PURE__ */ __name(function plainObject2(obj) {
        return obj != null && _typeof(obj) === typeofobj && !array2(obj) && obj.constructor === Object;
      }, "plainObject");
      object = /* @__PURE__ */ __name(function object2(obj) {
        return obj != null && _typeof(obj) === typeofobj;
      }, "object");
      number$1 = /* @__PURE__ */ __name(function number5(obj) {
        return obj != null && _typeof(obj) === _typeof(1) && !isNaN(obj);
      }, "number");
      integer = /* @__PURE__ */ __name(function integer2(obj) {
        return number$1(obj) && Math.floor(obj) === obj;
      }, "integer");
      htmlElement = /* @__PURE__ */ __name(function htmlElement2(obj) {
        if ("undefined" === typeofhtmlele) {
          return void 0;
        } else {
          return null != obj && obj instanceof HTMLElement;
        }
      }, "htmlElement");
      elementOrCollection = /* @__PURE__ */ __name(function elementOrCollection2(obj) {
        return element(obj) || collection(obj);
      }, "elementOrCollection");
      element = /* @__PURE__ */ __name(function element2(obj) {
        return instanceStr(obj) === "collection" && obj._private.single;
      }, "element");
      collection = /* @__PURE__ */ __name(function collection2(obj) {
        return instanceStr(obj) === "collection" && !obj._private.single;
      }, "collection");
      core2 = /* @__PURE__ */ __name(function core3(obj) {
        return instanceStr(obj) === "core";
      }, "core");
      stylesheet = /* @__PURE__ */ __name(function stylesheet2(obj) {
        return instanceStr(obj) === "stylesheet";
      }, "stylesheet");
      event = /* @__PURE__ */ __name(function event2(obj) {
        return instanceStr(obj) === "event";
      }, "event");
      emptyString = /* @__PURE__ */ __name(function emptyString2(obj) {
        if (obj === void 0 || obj === null) {
          return true;
        } else if (obj === "" || obj.match(/^\s+$/)) {
          return true;
        }
        return false;
      }, "emptyString");
      domElement = /* @__PURE__ */ __name(function domElement2(obj) {
        if (typeof HTMLElement === "undefined") {
          return false;
        } else {
          return obj instanceof HTMLElement;
        }
      }, "domElement");
      boundingBox = /* @__PURE__ */ __name(function boundingBox2(obj) {
        return plainObject(obj) && number$1(obj.x1) && number$1(obj.x2) && number$1(obj.y1) && number$1(obj.y2);
      }, "boundingBox");
      promise = /* @__PURE__ */ __name(function promise2(obj) {
        return object(obj) && fn$6(obj.then);
      }, "promise");
      ms = /* @__PURE__ */ __name(function ms2() {
        return navigator2 && navigator2.userAgent.match(/msie|trident|edge/i);
      }, "ms");
      memoize2 = /* @__PURE__ */ __name(function memoize3(fn3, keyFn) {
        if (!keyFn) {
          keyFn = /* @__PURE__ */ __name(function keyFn2() {
            if (arguments.length === 1) {
              return arguments[0];
            } else if (arguments.length === 0) {
              return "undefined";
            }
            var args = [];
            for (var i2 = 0; i2 < arguments.length; i2++) {
              args.push(arguments[i2]);
            }
            return args.join("$");
          }, "keyFn");
        }
        var _memoizedFn = /* @__PURE__ */ __name(function memoizedFn() {
          var self2 = this;
          var args = arguments;
          var ret;
          var k2 = keyFn.apply(self2, args);
          var cache3 = _memoizedFn.cache;
          if (!(ret = cache3[k2])) {
            ret = cache3[k2] = fn3.apply(self2, args);
          }
          return ret;
        }, "memoizedFn");
        _memoizedFn.cache = {};
        return _memoizedFn;
      }, "memoize");
      camel2dash = memoize2(function(str2) {
        return str2.replace(/([A-Z])/g, function(v3) {
          return "-" + v3.toLowerCase();
        });
      });
      dash2camel = memoize2(function(str2) {
        return str2.replace(/(-\w)/g, function(v3) {
          return v3[1].toUpperCase();
        });
      });
      prependCamel = memoize2(function(prefix, str2) {
        return prefix + str2[0].toUpperCase() + str2.substring(1);
      }, function(prefix, str2) {
        return prefix + "$" + str2;
      });
      capitalize = /* @__PURE__ */ __name(function capitalize2(str2) {
        if (emptyString(str2)) {
          return str2;
        }
        return str2.charAt(0).toUpperCase() + str2.substring(1);
      }, "capitalize");
      endsWith = /* @__PURE__ */ __name(function endsWith2(string3, suffix) {
        return string3.slice(-1 * suffix.length) === suffix;
      }, "endsWith");
      number6 = "(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))";
      rgba3 = "rgb[a]?\\((" + number6 + "[%]?)\\s*,\\s*(" + number6 + "[%]?)\\s*,\\s*(" + number6 + "[%]?)(?:\\s*,\\s*(" + number6 + "))?\\)";
      rgbaNoBackRefs = "rgb[a]?\\((?:" + number6 + "[%]?)\\s*,\\s*(?:" + number6 + "[%]?)\\s*,\\s*(?:" + number6 + "[%]?)(?:\\s*,\\s*(?:" + number6 + "))?\\)";
      hsla2 = "hsl[a]?\\((" + number6 + ")\\s*,\\s*(" + number6 + "[%])\\s*,\\s*(" + number6 + "[%])(?:\\s*,\\s*(" + number6 + "))?\\)";
      hslaNoBackRefs = "hsl[a]?\\((?:" + number6 + ")\\s*,\\s*(?:" + number6 + "[%])\\s*,\\s*(?:" + number6 + "[%])(?:\\s*,\\s*(?:" + number6 + "))?\\)";
      hex3 = "\\#[0-9a-fA-F]{3}";
      hex6 = "\\#[0-9a-fA-F]{6}";
      ascending3 = /* @__PURE__ */ __name(function ascending4(a2, b3) {
        if (a2 < b3) {
          return -1;
        } else if (a2 > b3) {
          return 1;
        } else {
          return 0;
        }
      }, "ascending");
      descending2 = /* @__PURE__ */ __name(function descending3(a2, b3) {
        return -1 * ascending3(a2, b3);
      }, "descending");
      extend4 = Object.assign != null ? Object.assign.bind(Object) : function(tgt) {
        var args = arguments;
        for (var i2 = 1; i2 < args.length; i2++) {
          var obj = args[i2];
          if (obj == null) {
            continue;
          }
          var keys2 = Object.keys(obj);
          for (var j3 = 0; j3 < keys2.length; j3++) {
            var k2 = keys2[j3];
            tgt[k2] = obj[k2];
          }
        }
        return tgt;
      };
      hex2tuple = /* @__PURE__ */ __name(function hex2tuple2(hex2) {
        if (!(hex2.length === 4 || hex2.length === 7) || hex2[0] !== "#") {
          return;
        }
        var shortHex = hex2.length === 4;
        var r2, g2, b3;
        var base = 16;
        if (shortHex) {
          r2 = parseInt(hex2[1] + hex2[1], base);
          g2 = parseInt(hex2[2] + hex2[2], base);
          b3 = parseInt(hex2[3] + hex2[3], base);
        } else {
          r2 = parseInt(hex2[1] + hex2[2], base);
          g2 = parseInt(hex2[3] + hex2[4], base);
          b3 = parseInt(hex2[5] + hex2[6], base);
        }
        return [r2, g2, b3];
      }, "hex2tuple");
      hsl2tuple = /* @__PURE__ */ __name(function hsl2tuple2(hsl2) {
        var ret;
        var h3, s2, l4, a2, r2, g2, b3;
        function hue2rgb(p4, q4, t4) {
          if (t4 < 0) t4 += 1;
          if (t4 > 1) t4 -= 1;
          if (t4 < 1 / 6) return p4 + (q4 - p4) * 6 * t4;
          if (t4 < 1 / 2) return q4;
          if (t4 < 2 / 3) return p4 + (q4 - p4) * (2 / 3 - t4) * 6;
          return p4;
        }
        __name(hue2rgb, "hue2rgb");
        var m3 = new RegExp("^" + hsla2 + "$").exec(hsl2);
        if (m3) {
          h3 = parseInt(m3[1]);
          if (h3 < 0) {
            h3 = (360 - -1 * h3 % 360) % 360;
          } else if (h3 > 360) {
            h3 = h3 % 360;
          }
          h3 /= 360;
          s2 = parseFloat(m3[2]);
          if (s2 < 0 || s2 > 100) {
            return;
          }
          s2 = s2 / 100;
          l4 = parseFloat(m3[3]);
          if (l4 < 0 || l4 > 100) {
            return;
          }
          l4 = l4 / 100;
          a2 = m3[4];
          if (a2 !== void 0) {
            a2 = parseFloat(a2);
            if (a2 < 0 || a2 > 1) {
              return;
            }
          }
          if (s2 === 0) {
            r2 = g2 = b3 = Math.round(l4 * 255);
          } else {
            var q3 = l4 < 0.5 ? l4 * (1 + s2) : l4 + s2 - l4 * s2;
            var p3 = 2 * l4 - q3;
            r2 = Math.round(255 * hue2rgb(p3, q3, h3 + 1 / 3));
            g2 = Math.round(255 * hue2rgb(p3, q3, h3));
            b3 = Math.round(255 * hue2rgb(p3, q3, h3 - 1 / 3));
          }
          ret = [r2, g2, b3, a2];
        }
        return ret;
      }, "hsl2tuple");
      rgb2tuple = /* @__PURE__ */ __name(function rgb2tuple2(rgb2) {
        var ret;
        var m3 = new RegExp("^" + rgba3 + "$").exec(rgb2);
        if (m3) {
          ret = [];
          var isPct = [];
          for (var i2 = 1; i2 <= 3; i2++) {
            var channel2 = m3[i2];
            if (channel2[channel2.length - 1] === "%") {
              isPct[i2] = true;
            }
            channel2 = parseFloat(channel2);
            if (isPct[i2]) {
              channel2 = channel2 / 100 * 255;
            }
            if (channel2 < 0 || channel2 > 255) {
              return;
            }
            ret.push(Math.floor(channel2));
          }
          var atLeastOneIsPct = isPct[1] || isPct[2] || isPct[3];
          var allArePct = isPct[1] && isPct[2] && isPct[3];
          if (atLeastOneIsPct && !allArePct) {
            return;
          }
          var alpha = m3[4];
          if (alpha !== void 0) {
            alpha = parseFloat(alpha);
            if (alpha < 0 || alpha > 1) {
              return;
            }
            ret.push(alpha);
          }
        }
        return ret;
      }, "rgb2tuple");
      colorname2tuple = /* @__PURE__ */ __name(function colorname2tuple2(color2) {
        return colors[color2.toLowerCase()];
      }, "colorname2tuple");
      color2tuple = /* @__PURE__ */ __name(function color2tuple2(color2) {
        return (array2(color2) ? color2 : null) || colorname2tuple(color2) || hex2tuple(color2) || rgb2tuple(color2) || hsl2tuple(color2);
      }, "color2tuple");
      colors = {
        // special colour names
        transparent: [0, 0, 0, 0],
        // NB alpha === 0
        // regular colours
        aliceblue: [240, 248, 255],
        antiquewhite: [250, 235, 215],
        aqua: [0, 255, 255],
        aquamarine: [127, 255, 212],
        azure: [240, 255, 255],
        beige: [245, 245, 220],
        bisque: [255, 228, 196],
        black: [0, 0, 0],
        blanchedalmond: [255, 235, 205],
        blue: [0, 0, 255],
        blueviolet: [138, 43, 226],
        brown: [165, 42, 42],
        burlywood: [222, 184, 135],
        cadetblue: [95, 158, 160],
        chartreuse: [127, 255, 0],
        chocolate: [210, 105, 30],
        coral: [255, 127, 80],
        cornflowerblue: [100, 149, 237],
        cornsilk: [255, 248, 220],
        crimson: [220, 20, 60],
        cyan: [0, 255, 255],
        darkblue: [0, 0, 139],
        darkcyan: [0, 139, 139],
        darkgoldenrod: [184, 134, 11],
        darkgray: [169, 169, 169],
        darkgreen: [0, 100, 0],
        darkgrey: [169, 169, 169],
        darkkhaki: [189, 183, 107],
        darkmagenta: [139, 0, 139],
        darkolivegreen: [85, 107, 47],
        darkorange: [255, 140, 0],
        darkorchid: [153, 50, 204],
        darkred: [139, 0, 0],
        darksalmon: [233, 150, 122],
        darkseagreen: [143, 188, 143],
        darkslateblue: [72, 61, 139],
        darkslategray: [47, 79, 79],
        darkslategrey: [47, 79, 79],
        darkturquoise: [0, 206, 209],
        darkviolet: [148, 0, 211],
        deeppink: [255, 20, 147],
        deepskyblue: [0, 191, 255],
        dimgray: [105, 105, 105],
        dimgrey: [105, 105, 105],
        dodgerblue: [30, 144, 255],
        firebrick: [178, 34, 34],
        floralwhite: [255, 250, 240],
        forestgreen: [34, 139, 34],
        fuchsia: [255, 0, 255],
        gainsboro: [220, 220, 220],
        ghostwhite: [248, 248, 255],
        gold: [255, 215, 0],
        goldenrod: [218, 165, 32],
        gray: [128, 128, 128],
        grey: [128, 128, 128],
        green: [0, 128, 0],
        greenyellow: [173, 255, 47],
        honeydew: [240, 255, 240],
        hotpink: [255, 105, 180],
        indianred: [205, 92, 92],
        indigo: [75, 0, 130],
        ivory: [255, 255, 240],
        khaki: [240, 230, 140],
        lavender: [230, 230, 250],
        lavenderblush: [255, 240, 245],
        lawngreen: [124, 252, 0],
        lemonchiffon: [255, 250, 205],
        lightblue: [173, 216, 230],
        lightcoral: [240, 128, 128],
        lightcyan: [224, 255, 255],
        lightgoldenrodyellow: [250, 250, 210],
        lightgray: [211, 211, 211],
        lightgreen: [144, 238, 144],
        lightgrey: [211, 211, 211],
        lightpink: [255, 182, 193],
        lightsalmon: [255, 160, 122],
        lightseagreen: [32, 178, 170],
        lightskyblue: [135, 206, 250],
        lightslategray: [119, 136, 153],
        lightslategrey: [119, 136, 153],
        lightsteelblue: [176, 196, 222],
        lightyellow: [255, 255, 224],
        lime: [0, 255, 0],
        limegreen: [50, 205, 50],
        linen: [250, 240, 230],
        magenta: [255, 0, 255],
        maroon: [128, 0, 0],
        mediumaquamarine: [102, 205, 170],
        mediumblue: [0, 0, 205],
        mediumorchid: [186, 85, 211],
        mediumpurple: [147, 112, 219],
        mediumseagreen: [60, 179, 113],
        mediumslateblue: [123, 104, 238],
        mediumspringgreen: [0, 250, 154],
        mediumturquoise: [72, 209, 204],
        mediumvioletred: [199, 21, 133],
        midnightblue: [25, 25, 112],
        mintcream: [245, 255, 250],
        mistyrose: [255, 228, 225],
        moccasin: [255, 228, 181],
        navajowhite: [255, 222, 173],
        navy: [0, 0, 128],
        oldlace: [253, 245, 230],
        olive: [128, 128, 0],
        olivedrab: [107, 142, 35],
        orange: [255, 165, 0],
        orangered: [255, 69, 0],
        orchid: [218, 112, 214],
        palegoldenrod: [238, 232, 170],
        palegreen: [152, 251, 152],
        paleturquoise: [175, 238, 238],
        palevioletred: [219, 112, 147],
        papayawhip: [255, 239, 213],
        peachpuff: [255, 218, 185],
        peru: [205, 133, 63],
        pink: [255, 192, 203],
        plum: [221, 160, 221],
        powderblue: [176, 224, 230],
        purple: [128, 0, 128],
        red: [255, 0, 0],
        rosybrown: [188, 143, 143],
        royalblue: [65, 105, 225],
        saddlebrown: [139, 69, 19],
        salmon: [250, 128, 114],
        sandybrown: [244, 164, 96],
        seagreen: [46, 139, 87],
        seashell: [255, 245, 238],
        sienna: [160, 82, 45],
        silver: [192, 192, 192],
        skyblue: [135, 206, 235],
        slateblue: [106, 90, 205],
        slategray: [112, 128, 144],
        slategrey: [112, 128, 144],
        snow: [255, 250, 250],
        springgreen: [0, 255, 127],
        steelblue: [70, 130, 180],
        tan: [210, 180, 140],
        teal: [0, 128, 128],
        thistle: [216, 191, 216],
        tomato: [255, 99, 71],
        turquoise: [64, 224, 208],
        violet: [238, 130, 238],
        wheat: [245, 222, 179],
        white: [255, 255, 255],
        whitesmoke: [245, 245, 245],
        yellow: [255, 255, 0],
        yellowgreen: [154, 205, 50]
      };
      setMap = /* @__PURE__ */ __name(function setMap2(options2) {
        var obj = options2.map;
        var keys2 = options2.keys;
        var l4 = keys2.length;
        for (var i2 = 0; i2 < l4; i2++) {
          var key = keys2[i2];
          if (plainObject(key)) {
            throw Error("Tried to set map with object key");
          }
          if (i2 < keys2.length - 1) {
            if (obj[key] == null) {
              obj[key] = {};
            }
            obj = obj[key];
          } else {
            obj[key] = options2.value;
          }
        }
      }, "setMap");
      getMap = /* @__PURE__ */ __name(function getMap2(options2) {
        var obj = options2.map;
        var keys2 = options2.keys;
        var l4 = keys2.length;
        for (var i2 = 0; i2 < l4; i2++) {
          var key = keys2[i2];
          if (plainObject(key)) {
            throw Error("Tried to get map with object key");
          }
          obj = obj[key];
          if (obj == null) {
            return obj;
          }
        }
        return obj;
      }, "getMap");
      commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
      __name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
      __name(requireIsObject, "requireIsObject");
      __name(require_freeGlobal, "require_freeGlobal");
      __name(require_root, "require_root");
      __name(requireNow, "requireNow");
      __name(require_trimmedEndIndex, "require_trimmedEndIndex");
      __name(require_baseTrim, "require_baseTrim");
      __name(require_Symbol, "require_Symbol");
      __name(require_getRawTag, "require_getRawTag");
      __name(require_objectToString, "require_objectToString");
      __name(require_baseGetTag, "require_baseGetTag");
      __name(requireIsObjectLike, "requireIsObjectLike");
      __name(requireIsSymbol, "requireIsSymbol");
      __name(requireToNumber, "requireToNumber");
      __name(requireDebounce, "requireDebounce");
      debounceExports = requireDebounce();
      debounce = /* @__PURE__ */ getDefaultExportFromCjs(debounceExports);
      performance$1 = _window ? _window.performance : null;
      pnow = performance$1 && performance$1.now ? function() {
        return performance$1.now();
      } : function() {
        return Date.now();
      };
      raf = (function() {
        if (_window) {
          if (_window.requestAnimationFrame) {
            return function(fn3) {
              _window.requestAnimationFrame(fn3);
            };
          } else if (_window.mozRequestAnimationFrame) {
            return function(fn3) {
              _window.mozRequestAnimationFrame(fn3);
            };
          } else if (_window.webkitRequestAnimationFrame) {
            return function(fn3) {
              _window.webkitRequestAnimationFrame(fn3);
            };
          } else if (_window.msRequestAnimationFrame) {
            return function(fn3) {
              _window.msRequestAnimationFrame(fn3);
            };
          }
        }
        return function(fn3) {
          if (fn3) {
            setTimeout(function() {
              fn3(pnow());
            }, 1e3 / 60);
          }
        };
      })();
      requestAnimationFrame2 = /* @__PURE__ */ __name(function requestAnimationFrame3(fn3) {
        return raf(fn3);
      }, "requestAnimationFrame");
      performanceNow = pnow;
      DEFAULT_HASH_SEED = 9261;
      K4 = 65599;
      DEFAULT_HASH_SEED_ALT = 5381;
      hashIterableInts = /* @__PURE__ */ __name(function hashIterableInts2(iterator) {
        var seed = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DEFAULT_HASH_SEED;
        var hash = seed;
        var entry;
        for (; ; ) {
          entry = iterator.next();
          if (entry.done) {
            break;
          }
          hash = hash * K4 + entry.value | 0;
        }
        return hash;
      }, "hashIterableInts");
      hashInt = /* @__PURE__ */ __name(function hashInt2(num) {
        var seed = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DEFAULT_HASH_SEED;
        return seed * K4 + num | 0;
      }, "hashInt");
      hashIntAlt = /* @__PURE__ */ __name(function hashIntAlt2(num) {
        var seed = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DEFAULT_HASH_SEED_ALT;
        return (seed << 5) + seed + num | 0;
      }, "hashIntAlt");
      combineHashes = /* @__PURE__ */ __name(function combineHashes2(hash1, hash2) {
        return hash1 * 2097152 + hash2;
      }, "combineHashes");
      combineHashesArray = /* @__PURE__ */ __name(function combineHashesArray2(hashes) {
        return hashes[0] * 2097152 + hashes[1];
      }, "combineHashesArray");
      hashArrays = /* @__PURE__ */ __name(function hashArrays2(hashes1, hashes2) {
        return [hashInt(hashes1[0], hashes2[0]), hashIntAlt(hashes1[1], hashes2[1])];
      }, "hashArrays");
      hashIntsArray = /* @__PURE__ */ __name(function hashIntsArray2(ints, seed) {
        var entry = {
          value: 0,
          done: false
        };
        var i2 = 0;
        var length2 = ints.length;
        var iterator = {
          next: /* @__PURE__ */ __name(function next3() {
            if (i2 < length2) {
              entry.value = ints[i2++];
            } else {
              entry.done = true;
            }
            return entry;
          }, "next")
        };
        return hashIterableInts(iterator, seed);
      }, "hashIntsArray");
      hashString = /* @__PURE__ */ __name(function hashString2(str2, seed) {
        var entry = {
          value: 0,
          done: false
        };
        var i2 = 0;
        var length2 = str2.length;
        var iterator = {
          next: /* @__PURE__ */ __name(function next3() {
            if (i2 < length2) {
              entry.value = str2.charCodeAt(i2++);
            } else {
              entry.done = true;
            }
            return entry;
          }, "next")
        };
        return hashIterableInts(iterator, seed);
      }, "hashString");
      hashStrings = /* @__PURE__ */ __name(function hashStrings2() {
        return hashStringsArray(arguments);
      }, "hashStrings");
      hashStringsArray = /* @__PURE__ */ __name(function hashStringsArray2(strs) {
        var hash;
        for (var i2 = 0; i2 < strs.length; i2++) {
          var str2 = strs[i2];
          if (i2 === 0) {
            hash = hashString(str2);
          } else {
            hash = hashString(str2, hash);
          }
        }
        return hash;
      }, "hashStringsArray");
      __name(rotatePoint, "rotatePoint");
      movePointByBoxAspect = /* @__PURE__ */ __name(function movePointByBoxAspect2(x5, y6, boxX, boxY, skewX, skewY) {
        return {
          x: (x5 - boxX) * skewX + boxX,
          y: (y6 - boxY) * skewY + boxY
        };
      }, "movePointByBoxAspect");
      __name(rotatePosAndSkewByBox, "rotatePosAndSkewByBox");
      warningsEnabled = true;
      warnSupported = console.warn != null;
      traceSupported = console.trace != null;
      MAX_INT$1 = Number.MAX_SAFE_INTEGER || 9007199254740991;
      trueify = /* @__PURE__ */ __name(function trueify2() {
        return true;
      }, "trueify");
      falsify = /* @__PURE__ */ __name(function falsify2() {
        return false;
      }, "falsify");
      zeroify = /* @__PURE__ */ __name(function zeroify2() {
        return 0;
      }, "zeroify");
      noop$1 = /* @__PURE__ */ __name(function noop3() {
      }, "noop");
      error = /* @__PURE__ */ __name(function error2(msg) {
        throw new Error(msg);
      }, "error");
      warnings = /* @__PURE__ */ __name(function warnings2(enabled) {
        if (enabled !== void 0) {
          warningsEnabled = !!enabled;
        } else {
          return warningsEnabled;
        }
      }, "warnings");
      warn = /* @__PURE__ */ __name(function warn2(msg) {
        if (!warnings()) {
          return;
        }
        if (warnSupported) {
          console.warn(msg);
        } else {
          console.log(msg);
          if (traceSupported) {
            console.trace();
          }
        }
      }, "warn");
      clone3 = /* @__PURE__ */ __name(function clone4(obj) {
        return extend4({}, obj);
      }, "clone");
      copy3 = /* @__PURE__ */ __name(function copy4(obj) {
        if (obj == null) {
          return obj;
        }
        if (array2(obj)) {
          return obj.slice();
        } else if (plainObject(obj)) {
          return clone3(obj);
        } else {
          return obj;
        }
      }, "copy");
      copyArray2 = /* @__PURE__ */ __name(function copyArray3(arr) {
        return arr.slice();
      }, "copyArray");
      uuid = /* @__PURE__ */ __name(function uuid2(a2, b3) {
        for (
          // loop :)
          b3 = a2 = "";
          // b - result , a - numeric letiable
          a2++ < 36;
          //
          b3 += a2 * 51 & 52 ? (
            //  return a random number or 4
            (a2 ^ 15 ? (
              // generate a random number from 0 to 15
              8 ^ Math.random() * (a2 ^ 20 ? 16 : 4)
            ) : 4).toString(16)
          ) : "-"
        ) ;
        return b3;
      }, "uuid");
      _staticEmptyObject = {};
      staticEmptyObject = /* @__PURE__ */ __name(function staticEmptyObject2() {
        return _staticEmptyObject;
      }, "staticEmptyObject");
      defaults$g = /* @__PURE__ */ __name(function defaults2(_defaults) {
        var keys2 = Object.keys(_defaults);
        return function(opts) {
          var filledOpts = {};
          for (var i2 = 0; i2 < keys2.length; i2++) {
            var key = keys2[i2];
            var optVal = opts == null ? void 0 : opts[key];
            filledOpts[key] = optVal === void 0 ? _defaults[key] : optVal;
          }
          return filledOpts;
        };
      }, "defaults");
      removeFromArray = /* @__PURE__ */ __name(function removeFromArray2(arr, ele, oneCopy) {
        for (var i2 = arr.length - 1; i2 >= 0; i2--) {
          if (arr[i2] === ele) {
            arr.splice(i2, 1);
          }
        }
      }, "removeFromArray");
      clearArray = /* @__PURE__ */ __name(function clearArray2(arr) {
        arr.splice(0, arr.length);
      }, "clearArray");
      push = /* @__PURE__ */ __name(function push2(arr, otherArr) {
        for (var i2 = 0; i2 < otherArr.length; i2++) {
          var el = otherArr[i2];
          arr.push(el);
        }
      }, "push");
      getPrefixedProperty = /* @__PURE__ */ __name(function getPrefixedProperty2(obj, propName, prefix) {
        if (prefix) {
          propName = prependCamel(prefix, propName);
        }
        return obj[propName];
      }, "getPrefixedProperty");
      setPrefixedProperty = /* @__PURE__ */ __name(function setPrefixedProperty2(obj, propName, prefix, value2) {
        if (prefix) {
          propName = prependCamel(prefix, propName);
        }
        obj[propName] = value2;
      }, "setPrefixedProperty");
      ObjectMap = /* @__PURE__ */ (function() {
        function ObjectMap2() {
          _classCallCheck(this, ObjectMap2);
          this._obj = {};
        }
        __name(ObjectMap2, "ObjectMap");
        return _createClass(ObjectMap2, [{
          key: "set",
          value: /* @__PURE__ */ __name(function set5(key, val) {
            this._obj[key] = val;
            return this;
          }, "set")
        }, {
          key: "delete",
          value: /* @__PURE__ */ __name(function _delete(key) {
            this._obj[key] = void 0;
            return this;
          }, "_delete")
        }, {
          key: "clear",
          value: /* @__PURE__ */ __name(function clear21() {
            this._obj = {};
          }, "clear")
        }, {
          key: "has",
          value: /* @__PURE__ */ __name(function has2(key) {
            return this._obj[key] !== void 0;
          }, "has")
        }, {
          key: "get",
          value: /* @__PURE__ */ __name(function get5(key) {
            return this._obj[key];
          }, "get")
        }]);
      })();
      Map$1 = typeof Map !== "undefined" ? Map : ObjectMap;
      undef = "undefined";
      ObjectSet = /* @__PURE__ */ (function() {
        function ObjectSet2(arrayOrObjectSet) {
          _classCallCheck(this, ObjectSet2);
          this._obj = /* @__PURE__ */ Object.create(null);
          this.size = 0;
          if (arrayOrObjectSet != null) {
            var arr;
            if (arrayOrObjectSet.instanceString != null && arrayOrObjectSet.instanceString() === this.instanceString()) {
              arr = arrayOrObjectSet.toArray();
            } else {
              arr = arrayOrObjectSet;
            }
            for (var i2 = 0; i2 < arr.length; i2++) {
              this.add(arr[i2]);
            }
          }
        }
        __name(ObjectSet2, "ObjectSet");
        return _createClass(ObjectSet2, [{
          key: "instanceString",
          value: /* @__PURE__ */ __name(function instanceString4() {
            return "set";
          }, "instanceString")
        }, {
          key: "add",
          value: /* @__PURE__ */ __name(function add3(val) {
            var o2 = this._obj;
            if (o2[val] !== 1) {
              o2[val] = 1;
              this.size++;
            }
          }, "add")
        }, {
          key: "delete",
          value: /* @__PURE__ */ __name(function _delete(val) {
            var o2 = this._obj;
            if (o2[val] === 1) {
              o2[val] = 0;
              this.size--;
            }
          }, "_delete")
        }, {
          key: "clear",
          value: /* @__PURE__ */ __name(function clear21() {
            this._obj = /* @__PURE__ */ Object.create(null);
          }, "clear")
        }, {
          key: "has",
          value: /* @__PURE__ */ __name(function has2(val) {
            return this._obj[val] === 1;
          }, "has")
        }, {
          key: "toArray",
          value: /* @__PURE__ */ __name(function toArray3() {
            var _this = this;
            return Object.keys(this._obj).filter(function(key) {
              return _this.has(key);
            });
          }, "toArray")
        }, {
          key: "forEach",
          value: /* @__PURE__ */ __name(function forEach3(callback, thisArg) {
            return this.toArray().forEach(callback, thisArg);
          }, "forEach")
        }]);
      })();
      Set$1 = (typeof Set === "undefined" ? "undefined" : _typeof(Set)) !== undef ? Set : ObjectSet;
      Element = /* @__PURE__ */ __name(function Element2(cy, params) {
        var restore = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
        if (cy === void 0 || params === void 0 || !core2(cy)) {
          error("An element must have a core reference and parameters set");
          return;
        }
        var group2 = params.group;
        if (group2 == null) {
          if (params.data && params.data.source != null && params.data.target != null) {
            group2 = "edges";
          } else {
            group2 = "nodes";
          }
        }
        if (group2 !== "nodes" && group2 !== "edges") {
          error("An element must be of type `nodes` or `edges`; you specified `" + group2 + "`");
          return;
        }
        this.length = 1;
        this[0] = this;
        var _p = this._private = {
          cy,
          single: true,
          // indicates this is an element
          data: params.data || {},
          // data object
          position: params.position || {
            x: 0,
            y: 0
          },
          // (x, y) position pair
          autoWidth: void 0,
          // width and height of nodes calculated by the renderer when set to special 'auto' value
          autoHeight: void 0,
          autoPadding: void 0,
          compoundBoundsClean: false,
          // whether the compound dimensions need to be recalculated the next time dimensions are read
          listeners: [],
          // array of bound listeners
          group: group2,
          // string; 'nodes' or 'edges'
          style: {},
          // properties as set by the style
          rstyle: {},
          // properties for style sent from the renderer to the core
          styleCxts: [],
          // applied style contexts from the styler
          styleKeys: {},
          // per-group keys of style property values
          removed: true,
          // whether it's inside the vis; true if removed (set true here since we call restore)
          selected: params.selected ? true : false,
          // whether it's selected
          selectable: params.selectable === void 0 ? true : params.selectable ? true : false,
          // whether it's selectable
          locked: params.locked ? true : false,
          // whether the element is locked (cannot be moved)
          grabbed: false,
          // whether the element is grabbed by the mouse; renderer sets this privately
          grabbable: params.grabbable === void 0 ? true : params.grabbable ? true : false,
          // whether the element can be grabbed
          pannable: params.pannable === void 0 ? group2 === "edges" ? true : false : params.pannable ? true : false,
          // whether the element has passthrough panning enabled
          active: false,
          // whether the element is active from user interaction
          classes: new Set$1(),
          // map ( className => true )
          animation: {
            // object for currently-running animations
            current: [],
            queue: []
          },
          rscratch: {},
          // object in which the renderer can store information
          scratch: params.scratch || {},
          // scratch objects
          edges: [],
          // array of connected edges
          children: [],
          // array of children
          parent: params.parent && params.parent.isNode() ? params.parent : null,
          // parent ref
          traversalCache: {},
          // cache of output of traversal functions
          backgrounding: false,
          // whether background images are loading
          bbCache: null,
          // cache of the current bounding box
          bbCacheShift: {
            x: 0,
            y: 0
          },
          // shift applied to cached bb to be applied on next get
          bodyBounds: null,
          // bounds cache of element body, w/o overlay
          overlayBounds: null,
          // bounds cache of element body, including overlay
          labelBounds: {
            // bounds cache of labels
            all: null,
            source: null,
            target: null,
            main: null
          },
          arrowBounds: {
            // bounds cache of edge arrows
            source: null,
            target: null,
            "mid-source": null,
            "mid-target": null
          }
        };
        if (_p.position.x == null) {
          _p.position.x = 0;
        }
        if (_p.position.y == null) {
          _p.position.y = 0;
        }
        if (params.renderedPosition) {
          var rpos = params.renderedPosition;
          var pan2 = cy.pan();
          var zoom2 = cy.zoom();
          _p.position = {
            x: (rpos.x - pan2.x) / zoom2,
            y: (rpos.y - pan2.y) / zoom2
          };
        }
        var classes3 = [];
        if (array2(params.classes)) {
          classes3 = params.classes;
        } else if (string(params.classes)) {
          classes3 = params.classes.split(/\s+/);
        }
        for (var i2 = 0, l4 = classes3.length; i2 < l4; i2++) {
          var cls = classes3[i2];
          if (!cls || cls === "") {
            continue;
          }
          _p.classes.add(cls);
        }
        this.createEmitter();
        if (restore === void 0 || restore) {
          this.restore();
        }
        var bypass = params.style || params.css;
        if (bypass) {
          warn("Setting a `style` bypass at element creation should be done only when absolutely necessary.  Try to use the stylesheet instead.");
          this.style(bypass);
        }
      }, "Element");
      defineSearch = /* @__PURE__ */ __name(function defineSearch2(params) {
        params = {
          bfs: params.bfs || !params.dfs,
          dfs: params.dfs || !params.bfs
        };
        return /* @__PURE__ */ __name(function searchFn(roots, fn3, directed) {
          var options2;
          if (plainObject(roots) && !elementOrCollection(roots)) {
            options2 = roots;
            roots = options2.roots || options2.root;
            fn3 = options2.visit;
            directed = options2.directed;
          }
          directed = arguments.length === 2 && !fn$6(fn3) ? fn3 : directed;
          fn3 = fn$6(fn3) ? fn3 : function() {
          };
          var cy = this._private.cy;
          var v3 = roots = string(roots) ? this.filter(roots) : roots;
          var Q3 = [];
          var connectedNodes = [];
          var connectedBy = {};
          var id2depth = {};
          var V3 = {};
          var j3 = 0;
          var found;
          var _this$byGroup = this.byGroup(), nodes5 = _this$byGroup.nodes, edges3 = _this$byGroup.edges;
          for (var i2 = 0; i2 < v3.length; i2++) {
            var vi2 = v3[i2];
            var viId = vi2.id();
            if (vi2.isNode()) {
              Q3.unshift(vi2);
              if (params.bfs) {
                V3[viId] = true;
                connectedNodes.push(vi2);
              }
              id2depth[viId] = 0;
            }
          }
          var _loop = /* @__PURE__ */ __name(function _loop2() {
            var v5 = params.bfs ? Q3.shift() : Q3.pop();
            var vId = v5.id();
            if (params.dfs) {
              if (V3[vId]) {
                return 0;
              }
              V3[vId] = true;
              connectedNodes.push(v5);
            }
            var depth = id2depth[vId];
            var prevEdge = connectedBy[vId];
            var src = prevEdge != null ? prevEdge.source() : null;
            var tgt = prevEdge != null ? prevEdge.target() : null;
            var prevNode = prevEdge == null ? void 0 : v5.same(src) ? tgt[0] : src[0];
            var ret;
            ret = fn3(v5, prevEdge, prevNode, j3++, depth);
            if (ret === true) {
              found = v5;
              return 1;
            }
            if (ret === false) {
              return 1;
            }
            var vwEdges = v5.connectedEdges().filter(function(e4) {
              return (!directed || e4.source().same(v5)) && edges3.has(e4);
            });
            for (var _i2 = 0; _i2 < vwEdges.length; _i2++) {
              var e3 = vwEdges[_i2];
              var w4 = e3.connectedNodes().filter(function(n2) {
                return !n2.same(v5) && nodes5.has(n2);
              });
              var wId = w4.id();
              if (w4.length !== 0 && !V3[wId]) {
                w4 = w4[0];
                Q3.push(w4);
                if (params.bfs) {
                  V3[wId] = true;
                  connectedNodes.push(w4);
                }
                connectedBy[wId] = e3;
                id2depth[wId] = id2depth[vId] + 1;
              }
            }
          }, "_loop"), _ret;
          while (Q3.length !== 0) {
            _ret = _loop();
            if (_ret === 0) continue;
            if (_ret === 1) break;
          }
          var connectedEles = cy.collection();
          for (var _i = 0; _i < connectedNodes.length; _i++) {
            var node2 = connectedNodes[_i];
            var edge = connectedBy[node2.id()];
            if (edge != null) {
              connectedEles.push(edge);
            }
            connectedEles.push(node2);
          }
          return {
            path: cy.collection(connectedEles),
            found: cy.collection(found)
          };
        }, "searchFn");
      }, "defineSearch");
      elesfn$v = {
        breadthFirstSearch: defineSearch({
          bfs: true
        }),
        depthFirstSearch: defineSearch({
          dfs: true
        })
      };
      elesfn$v.bfs = elesfn$v.breadthFirstSearch;
      elesfn$v.dfs = elesfn$v.depthFirstSearch;
      heap$2 = { exports: {} };
      heap$1 = heap$2.exports;
      __name(requireHeap$1, "requireHeap$1");
      __name(requireHeap, "requireHeap");
      heapExports = requireHeap();
      Heap = /* @__PURE__ */ getDefaultExportFromCjs(heapExports);
      dijkstraDefaults = defaults$g({
        root: null,
        weight: /* @__PURE__ */ __name(function weight(edge) {
          return 1;
        }, "weight"),
        directed: false
      });
      elesfn$u = {
        dijkstra: /* @__PURE__ */ __name(function dijkstra2(options2) {
          if (!plainObject(options2)) {
            var args = arguments;
            options2 = {
              root: args[0],
              weight: args[1],
              directed: args[2]
            };
          }
          var _dijkstraDefaults = dijkstraDefaults(options2), root3 = _dijkstraDefaults.root, weight8 = _dijkstraDefaults.weight, directed = _dijkstraDefaults.directed;
          var eles = this;
          var weightFn = weight8;
          var source = string(root3) ? this.filter(root3)[0] : root3[0];
          var dist3 = {};
          var prev2 = {};
          var knownDist = {};
          var _this$byGroup = this.byGroup(), nodes5 = _this$byGroup.nodes, edges3 = _this$byGroup.edges;
          edges3.unmergeBy(function(ele) {
            return ele.isLoop();
          });
          var getDist3 = /* @__PURE__ */ __name(function getDist4(node3) {
            return dist3[node3.id()];
          }, "getDist");
          var setDist = /* @__PURE__ */ __name(function setDist2(node3, d3) {
            dist3[node3.id()] = d3;
            Q3.updateItem(node3);
          }, "setDist");
          var Q3 = new Heap(function(a2, b3) {
            return getDist3(a2) - getDist3(b3);
          });
          for (var i2 = 0; i2 < nodes5.length; i2++) {
            var node2 = nodes5[i2];
            dist3[node2.id()] = node2.same(source) ? 0 : Infinity;
            Q3.push(node2);
          }
          var distBetween = /* @__PURE__ */ __name(function distBetween2(u3, v5) {
            var uvs = (directed ? u3.edgesTo(v5) : u3.edgesWith(v5)).intersect(edges3);
            var smallestDistance = Infinity;
            var smallestEdge;
            for (var _i = 0; _i < uvs.length; _i++) {
              var edge = uvs[_i];
              var _weight = weightFn(edge);
              if (_weight < smallestDistance || !smallestEdge) {
                smallestDistance = _weight;
                smallestEdge = edge;
              }
            }
            return {
              edge: smallestEdge,
              dist: smallestDistance
            };
          }, "distBetween");
          while (Q3.size() > 0) {
            var u2 = Q3.pop();
            var smalletsDist = getDist3(u2);
            var uid = u2.id();
            knownDist[uid] = smalletsDist;
            if (smalletsDist === Infinity) {
              continue;
            }
            var neighbors = u2.neighborhood().intersect(nodes5);
            for (var _i2 = 0; _i2 < neighbors.length; _i2++) {
              var v3 = neighbors[_i2];
              var vid = v3.id();
              var vDist = distBetween(u2, v3);
              var alt = smalletsDist + vDist.dist;
              if (alt < getDist3(v3)) {
                setDist(v3, alt);
                prev2[vid] = {
                  node: u2,
                  edge: vDist.edge
                };
              }
            }
          }
          return {
            distanceTo: /* @__PURE__ */ __name(function distanceTo(node3) {
              var target = string(node3) ? nodes5.filter(node3)[0] : node3[0];
              return knownDist[target.id()];
            }, "distanceTo"),
            pathTo: /* @__PURE__ */ __name(function pathTo(node3) {
              var target = string(node3) ? nodes5.filter(node3)[0] : node3[0];
              var S4 = [];
              var u3 = target;
              var uid2 = u3.id();
              if (target.length > 0) {
                S4.unshift(target);
                while (prev2[uid2]) {
                  var p3 = prev2[uid2];
                  S4.unshift(p3.edge);
                  S4.unshift(p3.node);
                  u3 = p3.node;
                  uid2 = u3.id();
                }
              }
              return eles.spawn(S4);
            }, "pathTo")
          };
        }, "dijkstra")
      };
      elesfn$t = {
        // kruskal's algorithm (finds min spanning tree, assuming undirected graph)
        // implemented from pseudocode from wikipedia
        kruskal: /* @__PURE__ */ __name(function kruskal(weightFn) {
          weightFn = weightFn || function(edge2) {
            return 1;
          };
          var _this$byGroup = this.byGroup(), nodes5 = _this$byGroup.nodes, edges3 = _this$byGroup.edges;
          var numNodes = nodes5.length;
          var forest = new Array(numNodes);
          var A2 = nodes5;
          var findSetIndex = /* @__PURE__ */ __name(function findSetIndex2(ele) {
            for (var i3 = 0; i3 < forest.length; i3++) {
              var eles = forest[i3];
              if (eles.has(ele)) {
                return i3;
              }
            }
          }, "findSetIndex");
          for (var i2 = 0; i2 < numNodes; i2++) {
            forest[i2] = this.spawn(nodes5[i2]);
          }
          var S4 = edges3.sort(function(a2, b3) {
            return weightFn(a2) - weightFn(b3);
          });
          for (var _i = 0; _i < S4.length; _i++) {
            var edge = S4[_i];
            var u2 = edge.source()[0];
            var v3 = edge.target()[0];
            var setUIndex = findSetIndex(u2);
            var setVIndex = findSetIndex(v3);
            var setU = forest[setUIndex];
            var setV = forest[setVIndex];
            if (setUIndex !== setVIndex) {
              A2.merge(edge);
              setU.merge(setV);
              forest.splice(setVIndex, 1);
            }
          }
          return A2;
        }, "kruskal")
      };
      aStarDefaults = defaults$g({
        root: null,
        goal: null,
        weight: /* @__PURE__ */ __name(function weight2(edge) {
          return 1;
        }, "weight"),
        heuristic: /* @__PURE__ */ __name(function heuristic(edge) {
          return 0;
        }, "heuristic"),
        directed: false
      });
      elesfn$s = {
        // Implemented from pseudocode from wikipedia
        aStar: /* @__PURE__ */ __name(function aStar(options2) {
          var cy = this.cy();
          var _aStarDefaults = aStarDefaults(options2), root3 = _aStarDefaults.root, goal = _aStarDefaults.goal, heuristic2 = _aStarDefaults.heuristic, directed = _aStarDefaults.directed, weight8 = _aStarDefaults.weight;
          root3 = cy.collection(root3)[0];
          goal = cy.collection(goal)[0];
          var sid = root3.id();
          var tid = goal.id();
          var gScore = {};
          var fScore = {};
          var closedSetIds = {};
          var openSet = new Heap(function(a2, b3) {
            return fScore[a2.id()] - fScore[b3.id()];
          });
          var openSetIds = new Set$1();
          var cameFrom = {};
          var cameFromEdge = {};
          var addToOpenSet = /* @__PURE__ */ __name(function addToOpenSet2(ele, id34) {
            openSet.push(ele);
            openSetIds.add(id34);
          }, "addToOpenSet");
          var cMin, cMinId;
          var popFromOpenSet = /* @__PURE__ */ __name(function popFromOpenSet2() {
            cMin = openSet.pop();
            cMinId = cMin.id();
            openSetIds["delete"](cMinId);
          }, "popFromOpenSet");
          var isInOpenSet = /* @__PURE__ */ __name(function isInOpenSet2(id34) {
            return openSetIds.has(id34);
          }, "isInOpenSet");
          addToOpenSet(root3, sid);
          gScore[sid] = 0;
          fScore[sid] = heuristic2(root3);
          var steps = 0;
          while (openSet.size() > 0) {
            popFromOpenSet();
            steps++;
            if (cMinId === tid) {
              var path4 = [];
              var pathNode = goal;
              var pathNodeId = tid;
              var pathEdge = cameFromEdge[pathNodeId];
              for (; ; ) {
                path4.unshift(pathNode);
                if (pathEdge != null) {
                  path4.unshift(pathEdge);
                }
                pathNode = cameFrom[pathNodeId];
                if (pathNode == null) {
                  break;
                }
                pathNodeId = pathNode.id();
                pathEdge = cameFromEdge[pathNodeId];
              }
              return {
                found: true,
                distance: gScore[cMinId],
                path: this.spawn(path4),
                steps
              };
            }
            closedSetIds[cMinId] = true;
            var vwEdges = cMin._private.edges;
            for (var i2 = 0; i2 < vwEdges.length; i2++) {
              var e3 = vwEdges[i2];
              if (!this.hasElementWithId(e3.id())) {
                continue;
              }
              if (directed && e3.data("source") !== cMinId) {
                continue;
              }
              var wSrc = e3.source();
              var wTgt = e3.target();
              var w4 = wSrc.id() !== cMinId ? wSrc : wTgt;
              var wid = w4.id();
              if (!this.hasElementWithId(wid)) {
                continue;
              }
              if (closedSetIds[wid]) {
                continue;
              }
              var tempScore = gScore[cMinId] + weight8(e3);
              if (!isInOpenSet(wid)) {
                gScore[wid] = tempScore;
                fScore[wid] = tempScore + heuristic2(w4);
                addToOpenSet(w4, wid);
                cameFrom[wid] = cMin;
                cameFromEdge[wid] = e3;
                continue;
              }
              if (tempScore < gScore[wid]) {
                gScore[wid] = tempScore;
                fScore[wid] = tempScore + heuristic2(w4);
                cameFrom[wid] = cMin;
                cameFromEdge[wid] = e3;
              }
            }
          }
          return {
            found: false,
            distance: void 0,
            path: void 0,
            steps
          };
        }, "aStar")
      };
      floydWarshallDefaults = defaults$g({
        weight: /* @__PURE__ */ __name(function weight3(edge) {
          return 1;
        }, "weight"),
        directed: false
      });
      elesfn$r = {
        // Implemented from pseudocode from wikipedia
        floydWarshall: /* @__PURE__ */ __name(function floydWarshall2(options2) {
          var cy = this.cy();
          var _floydWarshallDefault = floydWarshallDefaults(options2), weight8 = _floydWarshallDefault.weight, directed = _floydWarshallDefault.directed;
          var weightFn = weight8;
          var _this$byGroup = this.byGroup(), nodes5 = _this$byGroup.nodes, edges3 = _this$byGroup.edges;
          var N3 = nodes5.length;
          var Nsq = N3 * N3;
          var indexOf2 = /* @__PURE__ */ __name(function indexOf3(node2) {
            return nodes5.indexOf(node2);
          }, "indexOf");
          var atIndex = /* @__PURE__ */ __name(function atIndex2(i3) {
            return nodes5[i3];
          }, "atIndex");
          var dist3 = new Array(Nsq);
          for (var n2 = 0; n2 < Nsq; n2++) {
            var j3 = n2 % N3;
            var i2 = (n2 - j3) / N3;
            if (i2 === j3) {
              dist3[n2] = 0;
            } else {
              dist3[n2] = Infinity;
            }
          }
          var next3 = new Array(Nsq);
          var edgeNext = new Array(Nsq);
          for (var _i = 0; _i < edges3.length; _i++) {
            var edge = edges3[_i];
            var src = edge.source()[0];
            var tgt = edge.target()[0];
            if (src === tgt) {
              continue;
            }
            var s2 = indexOf2(src);
            var t4 = indexOf2(tgt);
            var st2 = s2 * N3 + t4;
            var _weight = weightFn(edge);
            if (dist3[st2] > _weight) {
              dist3[st2] = _weight;
              next3[st2] = t4;
              edgeNext[st2] = edge;
            }
            if (!directed) {
              var ts = t4 * N3 + s2;
              if (!directed && dist3[ts] > _weight) {
                dist3[ts] = _weight;
                next3[ts] = s2;
                edgeNext[ts] = edge;
              }
            }
          }
          for (var k2 = 0; k2 < N3; k2++) {
            for (var _i2 = 0; _i2 < N3; _i2++) {
              var ik = _i2 * N3 + k2;
              for (var _j = 0; _j < N3; _j++) {
                var ij = _i2 * N3 + _j;
                var kj = k2 * N3 + _j;
                if (dist3[ik] + dist3[kj] < dist3[ij]) {
                  dist3[ij] = dist3[ik] + dist3[kj];
                  next3[ij] = next3[ik];
                }
              }
            }
          }
          var getArgEle = /* @__PURE__ */ __name(function getArgEle2(ele) {
            return (string(ele) ? cy.filter(ele) : ele)[0];
          }, "getArgEle");
          var indexOfArgEle = /* @__PURE__ */ __name(function indexOfArgEle2(ele) {
            return indexOf2(getArgEle(ele));
          }, "indexOfArgEle");
          var res = {
            distance: /* @__PURE__ */ __name(function distance3(from2, to) {
              var i3 = indexOfArgEle(from2);
              var j4 = indexOfArgEle(to);
              return dist3[i3 * N3 + j4];
            }, "distance"),
            path: /* @__PURE__ */ __name(function path4(from2, to) {
              var i3 = indexOfArgEle(from2);
              var j4 = indexOfArgEle(to);
              var fromNode = atIndex(i3);
              if (i3 === j4) {
                return fromNode.collection();
              }
              if (next3[i3 * N3 + j4] == null) {
                return cy.collection();
              }
              var path5 = cy.collection();
              var prev2 = i3;
              var edge2;
              path5.merge(fromNode);
              while (i3 !== j4) {
                prev2 = i3;
                i3 = next3[i3 * N3 + j4];
                edge2 = edgeNext[prev2 * N3 + i3];
                path5.merge(edge2);
                path5.merge(atIndex(i3));
              }
              return path5;
            }, "path")
          };
          return res;
        }, "floydWarshall")
        // floydWarshall
      };
      bellmanFordDefaults = defaults$g({
        weight: /* @__PURE__ */ __name(function weight4(edge) {
          return 1;
        }, "weight"),
        directed: false,
        root: null
      });
      elesfn$q = {
        // Implemented from pseudocode from wikipedia
        bellmanFord: /* @__PURE__ */ __name(function bellmanFord(options2) {
          var _this = this;
          var _bellmanFordDefaults = bellmanFordDefaults(options2), weight8 = _bellmanFordDefaults.weight, directed = _bellmanFordDefaults.directed, root3 = _bellmanFordDefaults.root;
          var weightFn = weight8;
          var eles = this;
          var cy = this.cy();
          var _this$byGroup = this.byGroup(), edges3 = _this$byGroup.edges, nodes5 = _this$byGroup.nodes;
          var numNodes = nodes5.length;
          var infoMap = new Map$1();
          var hasNegativeWeightCycle = false;
          var negativeWeightCycles = [];
          root3 = cy.collection(root3)[0];
          edges3.unmergeBy(function(edge2) {
            return edge2.isLoop();
          });
          var numEdges = edges3.length;
          var getInfo3 = /* @__PURE__ */ __name(function getInfo4(node3) {
            var obj = infoMap.get(node3.id());
            if (!obj) {
              obj = {};
              infoMap.set(node3.id(), obj);
            }
            return obj;
          }, "getInfo");
          var getNodeFromTo = /* @__PURE__ */ __name(function getNodeFromTo2(to) {
            return (string(to) ? cy.$(to) : to)[0];
          }, "getNodeFromTo");
          var distanceTo = /* @__PURE__ */ __name(function distanceTo2(to) {
            return getInfo3(getNodeFromTo(to)).dist;
          }, "distanceTo");
          var pathTo = /* @__PURE__ */ __name(function pathTo2(to) {
            var thisStart = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : root3;
            var end2 = getNodeFromTo(to);
            var path4 = [];
            var node3 = end2;
            for (; ; ) {
              if (node3 == null) {
                return _this.spawn();
              }
              var _getInfo = getInfo3(node3), edge2 = _getInfo.edge, pred = _getInfo.pred;
              path4.unshift(node3[0]);
              if (node3.same(thisStart) && path4.length > 0) {
                break;
              }
              if (edge2 != null) {
                path4.unshift(edge2);
              }
              node3 = pred;
            }
            return eles.spawn(path4);
          }, "pathTo");
          for (var i2 = 0; i2 < numNodes; i2++) {
            var node2 = nodes5[i2];
            var info2 = getInfo3(node2);
            if (node2.same(root3)) {
              info2.dist = 0;
            } else {
              info2.dist = Infinity;
            }
            info2.pred = null;
            info2.edge = null;
          }
          var replacedEdge = false;
          var checkForEdgeReplacement = /* @__PURE__ */ __name(function checkForEdgeReplacement2(node1, node22, edge2, info1, info22, weight9) {
            var dist3 = info1.dist + weight9;
            if (dist3 < info22.dist && !edge2.same(info1.edge)) {
              info22.dist = dist3;
              info22.pred = node1;
              info22.edge = edge2;
              replacedEdge = true;
            }
          }, "checkForEdgeReplacement");
          for (var _i = 1; _i < numNodes; _i++) {
            replacedEdge = false;
            for (var e3 = 0; e3 < numEdges; e3++) {
              var edge = edges3[e3];
              var src = edge.source();
              var tgt = edge.target();
              var _weight = weightFn(edge);
              var srcInfo = getInfo3(src);
              var tgtInfo = getInfo3(tgt);
              checkForEdgeReplacement(src, tgt, edge, srcInfo, tgtInfo, _weight);
              if (!directed) {
                checkForEdgeReplacement(tgt, src, edge, tgtInfo, srcInfo, _weight);
              }
            }
            if (!replacedEdge) {
              break;
            }
          }
          if (replacedEdge) {
            var negativeWeightCycleIds = [];
            for (var _e2 = 0; _e2 < numEdges; _e2++) {
              var _edge = edges3[_e2];
              var _src = _edge.source();
              var _tgt = _edge.target();
              var _weight2 = weightFn(_edge);
              var srcDist = getInfo3(_src).dist;
              var tgtDist = getInfo3(_tgt).dist;
              if (srcDist + _weight2 < tgtDist || !directed && tgtDist + _weight2 < srcDist) {
                if (!hasNegativeWeightCycle) {
                  warn("Graph contains a negative weight cycle for Bellman-Ford");
                  hasNegativeWeightCycle = true;
                }
                if (options2.findNegativeWeightCycles !== false) {
                  var negativeNodes = [];
                  if (srcDist + _weight2 < tgtDist) {
                    negativeNodes.push(_src);
                  }
                  if (!directed && tgtDist + _weight2 < srcDist) {
                    negativeNodes.push(_tgt);
                  }
                  var numNegativeNodes = negativeNodes.length;
                  for (var n2 = 0; n2 < numNegativeNodes; n2++) {
                    var start3 = negativeNodes[n2];
                    var cycle = [start3];
                    cycle.push(getInfo3(start3).edge);
                    var _node = getInfo3(start3).pred;
                    while (cycle.indexOf(_node) === -1) {
                      cycle.push(_node);
                      cycle.push(getInfo3(_node).edge);
                      _node = getInfo3(_node).pred;
                    }
                    cycle = cycle.slice(cycle.indexOf(_node));
                    var smallestId = cycle[0].id();
                    var smallestIndex = 0;
                    for (var c3 = 2; c3 < cycle.length; c3 += 2) {
                      if (cycle[c3].id() < smallestId) {
                        smallestId = cycle[c3].id();
                        smallestIndex = c3;
                      }
                    }
                    cycle = cycle.slice(smallestIndex).concat(cycle.slice(0, smallestIndex));
                    cycle.push(cycle[0]);
                    var cycleId = cycle.map(function(el) {
                      return el.id();
                    }).join(",");
                    if (negativeWeightCycleIds.indexOf(cycleId) === -1) {
                      negativeWeightCycles.push(eles.spawn(cycle));
                      negativeWeightCycleIds.push(cycleId);
                    }
                  }
                } else {
                  break;
                }
              }
            }
          }
          return {
            distanceTo,
            pathTo,
            hasNegativeWeightCycle,
            negativeWeightCycles
          };
        }, "bellmanFord")
        // bellmanFord
      };
      sqrt2 = Math.sqrt(2);
      collapse = /* @__PURE__ */ __name(function collapse2(edgeIndex, nodeMap, remainingEdges) {
        if (remainingEdges.length === 0) {
          error("Karger-Stein must be run on a connected (sub)graph");
        }
        var edgeInfo = remainingEdges[edgeIndex];
        var sourceIn = edgeInfo[1];
        var targetIn = edgeInfo[2];
        var partition1 = nodeMap[sourceIn];
        var partition2 = nodeMap[targetIn];
        var newEdges = remainingEdges;
        for (var i2 = newEdges.length - 1; i2 >= 0; i2--) {
          var edge = newEdges[i2];
          var src = edge[1];
          var tgt = edge[2];
          if (nodeMap[src] === partition1 && nodeMap[tgt] === partition2 || nodeMap[src] === partition2 && nodeMap[tgt] === partition1) {
            newEdges.splice(i2, 1);
          }
        }
        for (var _i = 0; _i < newEdges.length; _i++) {
          var _edge = newEdges[_i];
          if (_edge[1] === partition2) {
            newEdges[_i] = _edge.slice();
            newEdges[_i][1] = partition1;
          } else if (_edge[2] === partition2) {
            newEdges[_i] = _edge.slice();
            newEdges[_i][2] = partition1;
          }
        }
        for (var _i2 = 0; _i2 < nodeMap.length; _i2++) {
          if (nodeMap[_i2] === partition2) {
            nodeMap[_i2] = partition1;
          }
        }
        return newEdges;
      }, "collapse");
      contractUntil = /* @__PURE__ */ __name(function contractUntil2(metaNodeMap, remainingEdges, size4, sizeLimit) {
        while (size4 > sizeLimit) {
          var edgeIndex = Math.floor(Math.random() * remainingEdges.length);
          remainingEdges = collapse(edgeIndex, metaNodeMap, remainingEdges);
          size4--;
        }
        return remainingEdges;
      }, "contractUntil");
      elesfn$p = {
        // Computes the minimum cut of an undirected graph
        // Returns the correct answer with high probability
        kargerStein: /* @__PURE__ */ __name(function kargerStein() {
          var _this = this;
          var _this$byGroup = this.byGroup(), nodes5 = _this$byGroup.nodes, edges3 = _this$byGroup.edges;
          edges3.unmergeBy(function(edge) {
            return edge.isLoop();
          });
          var numNodes = nodes5.length;
          var numEdges = edges3.length;
          var numIter = Math.ceil(Math.pow(Math.log(numNodes) / Math.LN2, 2));
          var stopSize = Math.floor(numNodes / sqrt2);
          if (numNodes < 2) {
            error("At least 2 nodes are required for Karger-Stein algorithm");
            return void 0;
          }
          var edgeIndexes = [];
          for (var i2 = 0; i2 < numEdges; i2++) {
            var e3 = edges3[i2];
            edgeIndexes.push([i2, nodes5.indexOf(e3.source()), nodes5.indexOf(e3.target())]);
          }
          var minCutSize = Infinity;
          var minCutEdgeIndexes = [];
          var minCutNodeMap = new Array(numNodes);
          var metaNodeMap = new Array(numNodes);
          var metaNodeMap2 = new Array(numNodes);
          var copyNodesMap = /* @__PURE__ */ __name(function copyNodesMap2(from2, to) {
            for (var _i3 = 0; _i3 < numNodes; _i3++) {
              to[_i3] = from2[_i3];
            }
          }, "copyNodesMap");
          for (var iter = 0; iter <= numIter; iter++) {
            for (var _i4 = 0; _i4 < numNodes; _i4++) {
              metaNodeMap[_i4] = _i4;
            }
            var edgesState = contractUntil(metaNodeMap, edgeIndexes.slice(), numNodes, stopSize);
            var edgesState2 = edgesState.slice();
            copyNodesMap(metaNodeMap, metaNodeMap2);
            var res1 = contractUntil(metaNodeMap, edgesState, stopSize, 2);
            var res2 = contractUntil(metaNodeMap2, edgesState2, stopSize, 2);
            if (res1.length <= res2.length && res1.length < minCutSize) {
              minCutSize = res1.length;
              minCutEdgeIndexes = res1;
              copyNodesMap(metaNodeMap, minCutNodeMap);
            } else if (res2.length <= res1.length && res2.length < minCutSize) {
              minCutSize = res2.length;
              minCutEdgeIndexes = res2;
              copyNodesMap(metaNodeMap2, minCutNodeMap);
            }
          }
          var cut = this.spawn(minCutEdgeIndexes.map(function(e4) {
            return edges3[e4[0]];
          }));
          var partition1 = this.spawn();
          var partition2 = this.spawn();
          var witnessNodePartition = minCutNodeMap[0];
          for (var _i5 = 0; _i5 < minCutNodeMap.length; _i5++) {
            var partitionId = minCutNodeMap[_i5];
            var node2 = nodes5[_i5];
            if (partitionId === witnessNodePartition) {
              partition1.merge(node2);
            } else {
              partition2.merge(node2);
            }
          }
          var constructComponent = /* @__PURE__ */ __name(function constructComponent2(subset) {
            var component2 = _this.spawn();
            subset.forEach(function(node3) {
              component2.merge(node3);
              node3.connectedEdges().forEach(function(edge) {
                if (_this.contains(edge) && !cut.contains(edge)) {
                  component2.merge(edge);
                }
              });
            });
            return component2;
          }, "constructComponent");
          var components3 = [constructComponent(partition1), constructComponent(partition2)];
          var ret = {
            cut,
            components: components3,
            // n.b. partitions are included to be compatible with the old api spec
            // (could be removed in a future major version)
            partition1,
            partition2
          };
          return ret;
        }, "kargerStein")
      };
      copyPosition = /* @__PURE__ */ __name(function copyPosition2(p3) {
        return {
          x: p3.x,
          y: p3.y
        };
      }, "copyPosition");
      modelToRenderedPosition$1 = /* @__PURE__ */ __name(function modelToRenderedPosition(p3, zoom2, pan2) {
        return {
          x: p3.x * zoom2 + pan2.x,
          y: p3.y * zoom2 + pan2.y
        };
      }, "modelToRenderedPosition");
      renderedToModelPosition = /* @__PURE__ */ __name(function renderedToModelPosition2(p3, zoom2, pan2) {
        return {
          x: (p3.x - pan2.x) / zoom2,
          y: (p3.y - pan2.y) / zoom2
        };
      }, "renderedToModelPosition");
      array2point = /* @__PURE__ */ __name(function array2point2(arr) {
        return {
          x: arr[0],
          y: arr[1]
        };
      }, "array2point");
      min5 = /* @__PURE__ */ __name(function min6(arr) {
        var begin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
        var end2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : arr.length;
        var min9 = Infinity;
        for (var i2 = begin; i2 < end2; i2++) {
          var val = arr[i2];
          if (isFinite(val)) {
            min9 = Math.min(val, min9);
          }
        }
        return min9;
      }, "min");
      max5 = /* @__PURE__ */ __name(function max6(arr) {
        var begin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
        var end2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : arr.length;
        var max10 = -Infinity;
        for (var i2 = begin; i2 < end2; i2++) {
          var val = arr[i2];
          if (isFinite(val)) {
            max10 = Math.max(val, max10);
          }
        }
        return max10;
      }, "max");
      mean = /* @__PURE__ */ __name(function mean2(arr) {
        var begin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
        var end2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : arr.length;
        var total = 0;
        var n2 = 0;
        for (var i2 = begin; i2 < end2; i2++) {
          var val = arr[i2];
          if (isFinite(val)) {
            total += val;
            n2++;
          }
        }
        return total / n2;
      }, "mean");
      median = /* @__PURE__ */ __name(function median2(arr) {
        var begin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
        var end2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : arr.length;
        var copy5 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
        var sort3 = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
        var includeHoles = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true;
        if (copy5) {
          arr = arr.slice(begin, end2);
        } else {
          if (end2 < arr.length) {
            arr.splice(end2, arr.length - end2);
          }
          if (begin > 0) {
            arr.splice(0, begin);
          }
        }
        var off = 0;
        for (var i2 = arr.length - 1; i2 >= 0; i2--) {
          var v3 = arr[i2];
          if (includeHoles) {
            if (!isFinite(v3)) {
              arr[i2] = -Infinity;
              off++;
            }
          } else {
            arr.splice(i2, 1);
          }
        }
        if (sort3) {
          arr.sort(function(a2, b3) {
            return a2 - b3;
          });
        }
        var len = arr.length;
        var mid = Math.floor(len / 2);
        if (len % 2 !== 0) {
          return arr[mid + 1 + off];
        } else {
          return (arr[mid - 1 + off] + arr[mid + off]) / 2;
        }
      }, "median");
      deg2rad = /* @__PURE__ */ __name(function deg2rad2(deg) {
        return Math.PI * deg / 180;
      }, "deg2rad");
      getAngleFromDisp = /* @__PURE__ */ __name(function getAngleFromDisp2(dispX, dispY) {
        return Math.atan2(dispY, dispX) - Math.PI / 2;
      }, "getAngleFromDisp");
      log22 = Math.log2 || function(n2) {
        return Math.log(n2) / Math.log(2);
      };
      signum = /* @__PURE__ */ __name(function signum2(x5) {
        if (x5 > 0) {
          return 1;
        } else if (x5 < 0) {
          return -1;
        } else {
          return 0;
        }
      }, "signum");
      dist = /* @__PURE__ */ __name(function dist2(p1, p22) {
        return Math.sqrt(sqdist(p1, p22));
      }, "dist");
      sqdist = /* @__PURE__ */ __name(function sqdist2(p1, p22) {
        var dx = p22.x - p1.x;
        var dy = p22.y - p1.y;
        return dx * dx + dy * dy;
      }, "sqdist");
      inPlaceSumNormalize = /* @__PURE__ */ __name(function inPlaceSumNormalize2(v3) {
        var length2 = v3.length;
        var total = 0;
        for (var i2 = 0; i2 < length2; i2++) {
          total += v3[i2];
        }
        for (var _i = 0; _i < length2; _i++) {
          v3[_i] = v3[_i] / total;
        }
        return v3;
      }, "inPlaceSumNormalize");
      qbezierAt = /* @__PURE__ */ __name(function qbezierAt2(p0, p1, p22, t4) {
        return (1 - t4) * (1 - t4) * p0 + 2 * (1 - t4) * t4 * p1 + t4 * t4 * p22;
      }, "qbezierAt");
      qbezierPtAt = /* @__PURE__ */ __name(function qbezierPtAt2(p0, p1, p22, t4) {
        return {
          x: qbezierAt(p0.x, p1.x, p22.x, t4),
          y: qbezierAt(p0.y, p1.y, p22.y, t4)
        };
      }, "qbezierPtAt");
      lineAt = /* @__PURE__ */ __name(function lineAt2(p0, p1, t4, d3) {
        var vec = {
          x: p1.x - p0.x,
          y: p1.y - p0.y
        };
        var vecDist = dist(p0, p1);
        var normVec = {
          x: vec.x / vecDist,
          y: vec.y / vecDist
        };
        t4 = t4 == null ? 0 : t4;
        d3 = d3 != null ? d3 : t4 * vecDist;
        return {
          x: p0.x + normVec.x * d3,
          y: p0.y + normVec.y * d3
        };
      }, "lineAt");
      bound = /* @__PURE__ */ __name(function bound2(min9, val, max10) {
        return Math.max(min9, Math.min(max10, val));
      }, "bound");
      makeBoundingBox = /* @__PURE__ */ __name(function makeBoundingBox2(bb) {
        if (bb == null) {
          return {
            x1: Infinity,
            y1: Infinity,
            x2: -Infinity,
            y2: -Infinity,
            w: 0,
            h: 0
          };
        } else if (bb.x1 != null && bb.y1 != null) {
          if (bb.x2 != null && bb.y2 != null && bb.x2 >= bb.x1 && bb.y2 >= bb.y1) {
            return {
              x1: bb.x1,
              y1: bb.y1,
              x2: bb.x2,
              y2: bb.y2,
              w: bb.x2 - bb.x1,
              h: bb.y2 - bb.y1
            };
          } else if (bb.w != null && bb.h != null && bb.w >= 0 && bb.h >= 0) {
            return {
              x1: bb.x1,
              y1: bb.y1,
              x2: bb.x1 + bb.w,
              y2: bb.y1 + bb.h,
              w: bb.w,
              h: bb.h
            };
          }
        }
      }, "makeBoundingBox");
      copyBoundingBox = /* @__PURE__ */ __name(function copyBoundingBox2(bb) {
        return {
          x1: bb.x1,
          x2: bb.x2,
          w: bb.w,
          y1: bb.y1,
          y2: bb.y2,
          h: bb.h
        };
      }, "copyBoundingBox");
      clearBoundingBox = /* @__PURE__ */ __name(function clearBoundingBox2(bb) {
        bb.x1 = Infinity;
        bb.y1 = Infinity;
        bb.x2 = -Infinity;
        bb.y2 = -Infinity;
        bb.w = 0;
        bb.h = 0;
      }, "clearBoundingBox");
      updateBoundingBox = /* @__PURE__ */ __name(function updateBoundingBox2(bb1, bb2) {
        bb1.x1 = Math.min(bb1.x1, bb2.x1);
        bb1.x2 = Math.max(bb1.x2, bb2.x2);
        bb1.w = bb1.x2 - bb1.x1;
        bb1.y1 = Math.min(bb1.y1, bb2.y1);
        bb1.y2 = Math.max(bb1.y2, bb2.y2);
        bb1.h = bb1.y2 - bb1.y1;
      }, "updateBoundingBox");
      expandBoundingBoxByPoint = /* @__PURE__ */ __name(function expandBoundingBoxByPoint2(bb, x5, y6) {
        bb.x1 = Math.min(bb.x1, x5);
        bb.x2 = Math.max(bb.x2, x5);
        bb.w = bb.x2 - bb.x1;
        bb.y1 = Math.min(bb.y1, y6);
        bb.y2 = Math.max(bb.y2, y6);
        bb.h = bb.y2 - bb.y1;
      }, "expandBoundingBoxByPoint");
      expandBoundingBox = /* @__PURE__ */ __name(function expandBoundingBox2(bb) {
        var padding2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
        bb.x1 -= padding2;
        bb.x2 += padding2;
        bb.y1 -= padding2;
        bb.y2 += padding2;
        bb.w = bb.x2 - bb.x1;
        bb.h = bb.y2 - bb.y1;
        return bb;
      }, "expandBoundingBox");
      expandBoundingBoxSides = /* @__PURE__ */ __name(function expandBoundingBoxSides2(bb) {
        var padding2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0];
        var top2, right3, bottom2, left3;
        if (padding2.length === 1) {
          top2 = right3 = bottom2 = left3 = padding2[0];
        } else if (padding2.length === 2) {
          top2 = bottom2 = padding2[0];
          left3 = right3 = padding2[1];
        } else if (padding2.length === 4) {
          var _padding = _slicedToArray(padding2, 4);
          top2 = _padding[0];
          right3 = _padding[1];
          bottom2 = _padding[2];
          left3 = _padding[3];
        }
        bb.x1 -= left3;
        bb.x2 += right3;
        bb.y1 -= top2;
        bb.y2 += bottom2;
        bb.w = bb.x2 - bb.x1;
        bb.h = bb.y2 - bb.y1;
        return bb;
      }, "expandBoundingBoxSides");
      assignBoundingBox = /* @__PURE__ */ __name(function assignBoundingBox2(bb1, bb2) {
        bb1.x1 = bb2.x1;
        bb1.y1 = bb2.y1;
        bb1.x2 = bb2.x2;
        bb1.y2 = bb2.y2;
        bb1.w = bb1.x2 - bb1.x1;
        bb1.h = bb1.y2 - bb1.y1;
      }, "assignBoundingBox");
      boundingBoxesIntersect = /* @__PURE__ */ __name(function boundingBoxesIntersect2(bb1, bb2) {
        if (bb1.x1 > bb2.x2) {
          return false;
        }
        if (bb2.x1 > bb1.x2) {
          return false;
        }
        if (bb1.x2 < bb2.x1) {
          return false;
        }
        if (bb2.x2 < bb1.x1) {
          return false;
        }
        if (bb1.y2 < bb2.y1) {
          return false;
        }
        if (bb2.y2 < bb1.y1) {
          return false;
        }
        if (bb1.y1 > bb2.y2) {
          return false;
        }
        if (bb2.y1 > bb1.y2) {
          return false;
        }
        return true;
      }, "boundingBoxesIntersect");
      inBoundingBox = /* @__PURE__ */ __name(function inBoundingBox2(bb, x5, y6) {
        return bb.x1 <= x5 && x5 <= bb.x2 && bb.y1 <= y6 && y6 <= bb.y2;
      }, "inBoundingBox");
      pointInBoundingBox = /* @__PURE__ */ __name(function pointInBoundingBox2(bb, pt) {
        return inBoundingBox(bb, pt.x, pt.y);
      }, "pointInBoundingBox");
      boundingBoxInBoundingBox = /* @__PURE__ */ __name(function boundingBoxInBoundingBox2(bb1, bb2) {
        return inBoundingBox(bb1, bb2.x1, bb2.y1) && inBoundingBox(bb1, bb2.x2, bb2.y2);
      }, "boundingBoxInBoundingBox");
      hypot = (_Math$hypot = Math.hypot) !== null && _Math$hypot !== void 0 ? _Math$hypot : function(x5, y6) {
        return Math.sqrt(x5 * x5 + y6 * y6);
      };
      __name(inflatePolygon, "inflatePolygon");
      __name(miterBox, "miterBox");
      roundRectangleIntersectLine = /* @__PURE__ */ __name(function roundRectangleIntersectLine2(x5, y6, nodeX, nodeY, width3, height2, padding2) {
        var radius2 = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : "auto";
        var cornerRadius = radius2 === "auto" ? getRoundRectangleRadius(width3, height2) : radius2;
        var halfWidth = width3 / 2;
        var halfHeight = height2 / 2;
        cornerRadius = Math.min(cornerRadius, halfWidth, halfHeight);
        var doWidth = cornerRadius !== halfWidth, doHeight = cornerRadius !== halfHeight;
        var straightLineIntersections;
        if (doWidth) {
          var topStartX = nodeX - halfWidth + cornerRadius - padding2;
          var topStartY = nodeY - halfHeight - padding2;
          var topEndX = nodeX + halfWidth - cornerRadius + padding2;
          var topEndY = topStartY;
          straightLineIntersections = finiteLinesIntersect(x5, y6, nodeX, nodeY, topStartX, topStartY, topEndX, topEndY, false);
          if (straightLineIntersections.length > 0) {
            return straightLineIntersections;
          }
        }
        if (doHeight) {
          var rightStartX = nodeX + halfWidth + padding2;
          var rightStartY = nodeY - halfHeight + cornerRadius - padding2;
          var rightEndX = rightStartX;
          var rightEndY = nodeY + halfHeight - cornerRadius + padding2;
          straightLineIntersections = finiteLinesIntersect(x5, y6, nodeX, nodeY, rightStartX, rightStartY, rightEndX, rightEndY, false);
          if (straightLineIntersections.length > 0) {
            return straightLineIntersections;
          }
        }
        if (doWidth) {
          var bottomStartX = nodeX - halfWidth + cornerRadius - padding2;
          var bottomStartY = nodeY + halfHeight + padding2;
          var bottomEndX = nodeX + halfWidth - cornerRadius + padding2;
          var bottomEndY = bottomStartY;
          straightLineIntersections = finiteLinesIntersect(x5, y6, nodeX, nodeY, bottomStartX, bottomStartY, bottomEndX, bottomEndY, false);
          if (straightLineIntersections.length > 0) {
            return straightLineIntersections;
          }
        }
        if (doHeight) {
          var leftStartX = nodeX - halfWidth - padding2;
          var leftStartY = nodeY - halfHeight + cornerRadius - padding2;
          var leftEndX = leftStartX;
          var leftEndY = nodeY + halfHeight - cornerRadius + padding2;
          straightLineIntersections = finiteLinesIntersect(x5, y6, nodeX, nodeY, leftStartX, leftStartY, leftEndX, leftEndY, false);
          if (straightLineIntersections.length > 0) {
            return straightLineIntersections;
          }
        }
        var arcIntersections;
        {
          var topLeftCenterX = nodeX - halfWidth + cornerRadius;
          var topLeftCenterY = nodeY - halfHeight + cornerRadius;
          arcIntersections = intersectLineCircle(x5, y6, nodeX, nodeY, topLeftCenterX, topLeftCenterY, cornerRadius + padding2);
          if (arcIntersections.length > 0 && arcIntersections[0] <= topLeftCenterX && arcIntersections[1] <= topLeftCenterY) {
            return [arcIntersections[0], arcIntersections[1]];
          }
        }
        {
          var topRightCenterX = nodeX + halfWidth - cornerRadius;
          var topRightCenterY = nodeY - halfHeight + cornerRadius;
          arcIntersections = intersectLineCircle(x5, y6, nodeX, nodeY, topRightCenterX, topRightCenterY, cornerRadius + padding2);
          if (arcIntersections.length > 0 && arcIntersections[0] >= topRightCenterX && arcIntersections[1] <= topRightCenterY) {
            return [arcIntersections[0], arcIntersections[1]];
          }
        }
        {
          var bottomRightCenterX = nodeX + halfWidth - cornerRadius;
          var bottomRightCenterY = nodeY + halfHeight - cornerRadius;
          arcIntersections = intersectLineCircle(x5, y6, nodeX, nodeY, bottomRightCenterX, bottomRightCenterY, cornerRadius + padding2);
          if (arcIntersections.length > 0 && arcIntersections[0] >= bottomRightCenterX && arcIntersections[1] >= bottomRightCenterY) {
            return [arcIntersections[0], arcIntersections[1]];
          }
        }
        {
          var bottomLeftCenterX = nodeX - halfWidth + cornerRadius;
          var bottomLeftCenterY = nodeY + halfHeight - cornerRadius;
          arcIntersections = intersectLineCircle(x5, y6, nodeX, nodeY, bottomLeftCenterX, bottomLeftCenterY, cornerRadius + padding2);
          if (arcIntersections.length > 0 && arcIntersections[0] <= bottomLeftCenterX && arcIntersections[1] >= bottomLeftCenterY) {
            return [arcIntersections[0], arcIntersections[1]];
          }
        }
        return [];
      }, "roundRectangleIntersectLine");
      inLineVicinity = /* @__PURE__ */ __name(function inLineVicinity2(x5, y6, lx1, ly1, lx2, ly2, tolerance) {
        var t4 = tolerance;
        var x1 = Math.min(lx1, lx2);
        var x22 = Math.max(lx1, lx2);
        var y1 = Math.min(ly1, ly2);
        var y22 = Math.max(ly1, ly2);
        return x1 - t4 <= x5 && x5 <= x22 + t4 && y1 - t4 <= y6 && y6 <= y22 + t4;
      }, "inLineVicinity");
      inBezierVicinity = /* @__PURE__ */ __name(function inBezierVicinity2(x5, y6, x1, y1, x22, y22, x32, y32, tolerance) {
        var bb = {
          x1: Math.min(x1, x32, x22) - tolerance,
          x2: Math.max(x1, x32, x22) + tolerance,
          y1: Math.min(y1, y32, y22) - tolerance,
          y2: Math.max(y1, y32, y22) + tolerance
        };
        if (x5 < bb.x1 || x5 > bb.x2 || y6 < bb.y1 || y6 > bb.y2) {
          return false;
        } else {
          return true;
        }
      }, "inBezierVicinity");
      solveQuadratic = /* @__PURE__ */ __name(function solveQuadratic2(a2, b3, c3, val) {
        c3 -= val;
        var r2 = b3 * b3 - 4 * a2 * c3;
        if (r2 < 0) {
          return [];
        }
        var sqrtR = Math.sqrt(r2);
        var denom = 2 * a2;
        var root1 = (-b3 + sqrtR) / denom;
        var root22 = (-b3 - sqrtR) / denom;
        return [root1, root22];
      }, "solveQuadratic");
      solveCubic = /* @__PURE__ */ __name(function solveCubic2(a2, b3, c3, d3, result) {
        var epsilon6 = 1e-5;
        if (a2 === 0) {
          a2 = epsilon6;
        }
        b3 /= a2;
        c3 /= a2;
        d3 /= a2;
        var discriminant, q3, r2, dum1, s2, t4, term1, r13;
        q3 = (3 * c3 - b3 * b3) / 9;
        r2 = -(27 * d3) + b3 * (9 * c3 - 2 * (b3 * b3));
        r2 /= 54;
        discriminant = q3 * q3 * q3 + r2 * r2;
        result[1] = 0;
        term1 = b3 / 3;
        if (discriminant > 0) {
          s2 = r2 + Math.sqrt(discriminant);
          s2 = s2 < 0 ? -Math.pow(-s2, 1 / 3) : Math.pow(s2, 1 / 3);
          t4 = r2 - Math.sqrt(discriminant);
          t4 = t4 < 0 ? -Math.pow(-t4, 1 / 3) : Math.pow(t4, 1 / 3);
          result[0] = -term1 + s2 + t4;
          term1 += (s2 + t4) / 2;
          result[4] = result[2] = -term1;
          term1 = Math.sqrt(3) * (-t4 + s2) / 2;
          result[3] = term1;
          result[5] = -term1;
          return;
        }
        result[5] = result[3] = 0;
        if (discriminant === 0) {
          r13 = r2 < 0 ? -Math.pow(-r2, 1 / 3) : Math.pow(r2, 1 / 3);
          result[0] = -term1 + 2 * r13;
          result[4] = result[2] = -(r13 + term1);
          return;
        }
        q3 = -q3;
        dum1 = q3 * q3 * q3;
        dum1 = Math.acos(r2 / Math.sqrt(dum1));
        r13 = 2 * Math.sqrt(q3);
        result[0] = -term1 + r13 * Math.cos(dum1 / 3);
        result[2] = -term1 + r13 * Math.cos((dum1 + 2 * Math.PI) / 3);
        result[4] = -term1 + r13 * Math.cos((dum1 + 4 * Math.PI) / 3);
        return;
      }, "solveCubic");
      sqdistToQuadraticBezier = /* @__PURE__ */ __name(function sqdistToQuadraticBezier2(x5, y6, x1, y1, x22, y22, x32, y32) {
        var a2 = 1 * x1 * x1 - 4 * x1 * x22 + 2 * x1 * x32 + 4 * x22 * x22 - 4 * x22 * x32 + x32 * x32 + y1 * y1 - 4 * y1 * y22 + 2 * y1 * y32 + 4 * y22 * y22 - 4 * y22 * y32 + y32 * y32;
        var b3 = 1 * 9 * x1 * x22 - 3 * x1 * x1 - 3 * x1 * x32 - 6 * x22 * x22 + 3 * x22 * x32 + 9 * y1 * y22 - 3 * y1 * y1 - 3 * y1 * y32 - 6 * y22 * y22 + 3 * y22 * y32;
        var c3 = 1 * 3 * x1 * x1 - 6 * x1 * x22 + x1 * x32 - x1 * x5 + 2 * x22 * x22 + 2 * x22 * x5 - x32 * x5 + 3 * y1 * y1 - 6 * y1 * y22 + y1 * y32 - y1 * y6 + 2 * y22 * y22 + 2 * y22 * y6 - y32 * y6;
        var d3 = 1 * x1 * x22 - x1 * x1 + x1 * x5 - x22 * x5 + y1 * y22 - y1 * y1 + y1 * y6 - y22 * y6;
        var roots = [];
        solveCubic(a2, b3, c3, d3, roots);
        var zeroThreshold = 1e-7;
        var params = [];
        for (var index = 0; index < 6; index += 2) {
          if (Math.abs(roots[index + 1]) < zeroThreshold && roots[index] >= 0 && roots[index] <= 1) {
            params.push(roots[index]);
          }
        }
        params.push(1);
        params.push(0);
        var minDistanceSquared = -1;
        var curX, curY, distSquared;
        for (var i2 = 0; i2 < params.length; i2++) {
          curX = Math.pow(1 - params[i2], 2) * x1 + 2 * (1 - params[i2]) * params[i2] * x22 + params[i2] * params[i2] * x32;
          curY = Math.pow(1 - params[i2], 2) * y1 + 2 * (1 - params[i2]) * params[i2] * y22 + params[i2] * params[i2] * y32;
          distSquared = Math.pow(curX - x5, 2) + Math.pow(curY - y6, 2);
          if (minDistanceSquared >= 0) {
            if (distSquared < minDistanceSquared) {
              minDistanceSquared = distSquared;
            }
          } else {
            minDistanceSquared = distSquared;
          }
        }
        return minDistanceSquared;
      }, "sqdistToQuadraticBezier");
      sqdistToFiniteLine = /* @__PURE__ */ __name(function sqdistToFiniteLine2(x5, y6, x1, y1, x22, y22) {
        var offset = [x5 - x1, y6 - y1];
        var line2 = [x22 - x1, y22 - y1];
        var lineSq = line2[0] * line2[0] + line2[1] * line2[1];
        var hypSq = offset[0] * offset[0] + offset[1] * offset[1];
        var dotProduct = offset[0] * line2[0] + offset[1] * line2[1];
        var adjSq = dotProduct * dotProduct / lineSq;
        if (dotProduct < 0) {
          return hypSq;
        }
        if (adjSq > lineSq) {
          return (x5 - x22) * (x5 - x22) + (y6 - y22) * (y6 - y22);
        }
        return hypSq - adjSq;
      }, "sqdistToFiniteLine");
      pointInsidePolygonPoints = /* @__PURE__ */ __name(function pointInsidePolygonPoints2(x5, y6, points) {
        var x1, y1, x22, y22;
        var y32;
        var up = 0;
        for (var i2 = 0; i2 < points.length / 2; i2++) {
          x1 = points[i2 * 2];
          y1 = points[i2 * 2 + 1];
          if (i2 + 1 < points.length / 2) {
            x22 = points[(i2 + 1) * 2];
            y22 = points[(i2 + 1) * 2 + 1];
          } else {
            x22 = points[(i2 + 1 - points.length / 2) * 2];
            y22 = points[(i2 + 1 - points.length / 2) * 2 + 1];
          }
          if (x1 == x5 && x22 == x5) ;
          else if (x1 >= x5 && x5 >= x22 || x1 <= x5 && x5 <= x22) {
            y32 = (x5 - x1) / (x22 - x1) * (y22 - y1) + y1;
            if (y32 > y6) {
              up++;
            }
          } else {
            continue;
          }
        }
        if (up % 2 === 0) {
          return false;
        } else {
          return true;
        }
      }, "pointInsidePolygonPoints");
      pointInsidePolygon = /* @__PURE__ */ __name(function pointInsidePolygon2(x5, y6, basePoints, centerX, centerY, width3, height2, direction2, padding2) {
        var transformedPoints = new Array(basePoints.length);
        var angle2;
        if (direction2[0] != null) {
          angle2 = Math.atan(direction2[1] / direction2[0]);
          if (direction2[0] < 0) {
            angle2 = angle2 + Math.PI / 2;
          } else {
            angle2 = -angle2 - Math.PI / 2;
          }
        } else {
          angle2 = direction2;
        }
        var cos3 = Math.cos(-angle2);
        var sin3 = Math.sin(-angle2);
        for (var i2 = 0; i2 < transformedPoints.length / 2; i2++) {
          transformedPoints[i2 * 2] = width3 / 2 * (basePoints[i2 * 2] * cos3 - basePoints[i2 * 2 + 1] * sin3);
          transformedPoints[i2 * 2 + 1] = height2 / 2 * (basePoints[i2 * 2 + 1] * cos3 + basePoints[i2 * 2] * sin3);
          transformedPoints[i2 * 2] += centerX;
          transformedPoints[i2 * 2 + 1] += centerY;
        }
        var points;
        if (padding2 > 0) {
          var expandedLineSet = expandPolygon(transformedPoints, -padding2);
          points = joinLines(expandedLineSet);
        } else {
          points = transformedPoints;
        }
        return pointInsidePolygonPoints(x5, y6, points);
      }, "pointInsidePolygon");
      pointInsideRoundPolygon = /* @__PURE__ */ __name(function pointInsideRoundPolygon2(x5, y6, basePoints, centerX, centerY, width3, height2, corners) {
        var cutPolygonPoints = new Array(basePoints.length * 2);
        for (var i2 = 0; i2 < corners.length; i2++) {
          var corner = corners[i2];
          cutPolygonPoints[i2 * 4 + 0] = corner.startX;
          cutPolygonPoints[i2 * 4 + 1] = corner.startY;
          cutPolygonPoints[i2 * 4 + 2] = corner.stopX;
          cutPolygonPoints[i2 * 4 + 3] = corner.stopY;
          var squaredDistance = Math.pow(corner.cx - x5, 2) + Math.pow(corner.cy - y6, 2);
          if (squaredDistance <= Math.pow(corner.radius, 2)) {
            return true;
          }
        }
        return pointInsidePolygonPoints(x5, y6, cutPolygonPoints);
      }, "pointInsideRoundPolygon");
      joinLines = /* @__PURE__ */ __name(function joinLines2(lineSet) {
        var vertices = new Array(lineSet.length / 2);
        var currentLineStartX, currentLineStartY, currentLineEndX, currentLineEndY;
        var nextLineStartX, nextLineStartY, nextLineEndX, nextLineEndY;
        for (var i2 = 0; i2 < lineSet.length / 4; i2++) {
          currentLineStartX = lineSet[i2 * 4];
          currentLineStartY = lineSet[i2 * 4 + 1];
          currentLineEndX = lineSet[i2 * 4 + 2];
          currentLineEndY = lineSet[i2 * 4 + 3];
          if (i2 < lineSet.length / 4 - 1) {
            nextLineStartX = lineSet[(i2 + 1) * 4];
            nextLineStartY = lineSet[(i2 + 1) * 4 + 1];
            nextLineEndX = lineSet[(i2 + 1) * 4 + 2];
            nextLineEndY = lineSet[(i2 + 1) * 4 + 3];
          } else {
            nextLineStartX = lineSet[0];
            nextLineStartY = lineSet[1];
            nextLineEndX = lineSet[2];
            nextLineEndY = lineSet[3];
          }
          var intersection4 = finiteLinesIntersect(currentLineStartX, currentLineStartY, currentLineEndX, currentLineEndY, nextLineStartX, nextLineStartY, nextLineEndX, nextLineEndY, true);
          vertices[i2 * 2] = intersection4[0];
          vertices[i2 * 2 + 1] = intersection4[1];
        }
        return vertices;
      }, "joinLines");
      expandPolygon = /* @__PURE__ */ __name(function expandPolygon2(points, pad3) {
        var expandedLineSet = new Array(points.length * 2);
        var currentPointX, currentPointY, nextPointX, nextPointY;
        for (var i2 = 0; i2 < points.length / 2; i2++) {
          currentPointX = points[i2 * 2];
          currentPointY = points[i2 * 2 + 1];
          if (i2 < points.length / 2 - 1) {
            nextPointX = points[(i2 + 1) * 2];
            nextPointY = points[(i2 + 1) * 2 + 1];
          } else {
            nextPointX = points[0];
            nextPointY = points[1];
          }
          var offsetX = nextPointY - currentPointY;
          var offsetY = -(nextPointX - currentPointX);
          var offsetLength = Math.sqrt(offsetX * offsetX + offsetY * offsetY);
          var normalizedOffsetX = offsetX / offsetLength;
          var normalizedOffsetY = offsetY / offsetLength;
          expandedLineSet[i2 * 4] = currentPointX + normalizedOffsetX * pad3;
          expandedLineSet[i2 * 4 + 1] = currentPointY + normalizedOffsetY * pad3;
          expandedLineSet[i2 * 4 + 2] = nextPointX + normalizedOffsetX * pad3;
          expandedLineSet[i2 * 4 + 3] = nextPointY + normalizedOffsetY * pad3;
        }
        return expandedLineSet;
      }, "expandPolygon");
      intersectLineEllipse = /* @__PURE__ */ __name(function intersectLineEllipse2(x5, y6, centerX, centerY, ellipseWradius, ellipseHradius) {
        var dispX = centerX - x5;
        var dispY = centerY - y6;
        dispX /= ellipseWradius;
        dispY /= ellipseHradius;
        var len = Math.sqrt(dispX * dispX + dispY * dispY);
        var newLength = len - 1;
        if (newLength < 0) {
          return [];
        }
        var lenProportion = newLength / len;
        return [(centerX - x5) * lenProportion + x5, (centerY - y6) * lenProportion + y6];
      }, "intersectLineEllipse");
      checkInEllipse = /* @__PURE__ */ __name(function checkInEllipse2(x5, y6, width3, height2, centerX, centerY, padding2) {
        x5 -= centerX;
        y6 -= centerY;
        x5 /= width3 / 2 + padding2;
        y6 /= height2 / 2 + padding2;
        return x5 * x5 + y6 * y6 <= 1;
      }, "checkInEllipse");
      intersectLineCircle = /* @__PURE__ */ __name(function intersectLineCircle2(x1, y1, x22, y22, centerX, centerY, radius2) {
        var d3 = [x22 - x1, y22 - y1];
        var f2 = [x1 - centerX, y1 - centerY];
        var a2 = d3[0] * d3[0] + d3[1] * d3[1];
        var b3 = 2 * (f2[0] * d3[0] + f2[1] * d3[1]);
        var c3 = f2[0] * f2[0] + f2[1] * f2[1] - radius2 * radius2;
        var discriminant = b3 * b3 - 4 * a2 * c3;
        if (discriminant < 0) {
          return [];
        }
        var t13 = (-b3 + Math.sqrt(discriminant)) / (2 * a2);
        var t22 = (-b3 - Math.sqrt(discriminant)) / (2 * a2);
        var tMin = Math.min(t13, t22);
        var tMax = Math.max(t13, t22);
        var inRangeParams = [];
        if (tMin >= 0 && tMin <= 1) {
          inRangeParams.push(tMin);
        }
        if (tMax >= 0 && tMax <= 1) {
          inRangeParams.push(tMax);
        }
        if (inRangeParams.length === 0) {
          return [];
        }
        var nearIntersectionX = inRangeParams[0] * d3[0] + x1;
        var nearIntersectionY = inRangeParams[0] * d3[1] + y1;
        if (inRangeParams.length > 1) {
          if (inRangeParams[0] == inRangeParams[1]) {
            return [nearIntersectionX, nearIntersectionY];
          } else {
            var farIntersectionX = inRangeParams[1] * d3[0] + x1;
            var farIntersectionY = inRangeParams[1] * d3[1] + y1;
            return [nearIntersectionX, nearIntersectionY, farIntersectionX, farIntersectionY];
          }
        } else {
          return [nearIntersectionX, nearIntersectionY];
        }
      }, "intersectLineCircle");
      midOfThree = /* @__PURE__ */ __name(function midOfThree2(a2, b3, c3) {
        if (b3 <= a2 && a2 <= c3 || c3 <= a2 && a2 <= b3) {
          return a2;
        } else if (a2 <= b3 && b3 <= c3 || c3 <= b3 && b3 <= a2) {
          return b3;
        } else {
          return c3;
        }
      }, "midOfThree");
      finiteLinesIntersect = /* @__PURE__ */ __name(function finiteLinesIntersect2(x1, y1, x22, y22, x32, y32, x42, y42, infiniteLines) {
        var dx13 = x1 - x32;
        var dx21 = x22 - x1;
        var dx43 = x42 - x32;
        var dy13 = y1 - y32;
        var dy21 = y22 - y1;
        var dy43 = y42 - y32;
        var ua_t = dx43 * dy13 - dy43 * dx13;
        var ub_t = dx21 * dy13 - dy21 * dx13;
        var u_b = dy43 * dx21 - dx43 * dy21;
        if (u_b !== 0) {
          var ua = ua_t / u_b;
          var ub = ub_t / u_b;
          var flptThreshold = 1e-3;
          var _min = 0 - flptThreshold;
          var _max = 1 + flptThreshold;
          if (_min <= ua && ua <= _max && _min <= ub && ub <= _max) {
            return [x1 + ua * dx21, y1 + ua * dy21];
          } else {
            if (!infiniteLines) {
              return [];
            } else {
              return [x1 + ua * dx21, y1 + ua * dy21];
            }
          }
        } else {
          if (ua_t === 0 || ub_t === 0) {
            if (midOfThree(x1, x22, x42) === x42) {
              return [x42, y42];
            }
            if (midOfThree(x1, x22, x32) === x32) {
              return [x32, y32];
            }
            if (midOfThree(x32, x42, x22) === x22) {
              return [x22, y22];
            }
            return [];
          } else {
            return [];
          }
        }
      }, "finiteLinesIntersect");
      transformPoints = /* @__PURE__ */ __name(function transformPoints2(points, centerX, centerY, width3, height2) {
        var ret = [];
        var halfW = width3 / 2;
        var halfH = height2 / 2;
        var x5 = centerX;
        var y6 = centerY;
        ret.push({
          x: x5 + halfW * points[0],
          y: y6 + halfH * points[1]
        });
        for (var i2 = 1; i2 < points.length / 2; i2++) {
          ret.push({
            x: x5 + halfW * points[i2 * 2],
            y: y6 + halfH * points[i2 * 2 + 1]
          });
        }
        return ret;
      }, "transformPoints");
      polygonIntersectLine = /* @__PURE__ */ __name(function polygonIntersectLine2(x5, y6, basePoints, centerX, centerY, width3, height2, padding2) {
        var intersections = [];
        var intersection4;
        var transformedPoints = new Array(basePoints.length);
        var doTransform = true;
        if (width3 == null) {
          doTransform = false;
        }
        var points;
        if (doTransform) {
          for (var i2 = 0; i2 < transformedPoints.length / 2; i2++) {
            transformedPoints[i2 * 2] = basePoints[i2 * 2] * width3 + centerX;
            transformedPoints[i2 * 2 + 1] = basePoints[i2 * 2 + 1] * height2 + centerY;
          }
          if (padding2 > 0) {
            var expandedLineSet = expandPolygon(transformedPoints, -padding2);
            points = joinLines(expandedLineSet);
          } else {
            points = transformedPoints;
          }
        } else {
          points = basePoints;
        }
        var currentX, currentY, nextX, nextY;
        for (var _i3 = 0; _i3 < points.length / 2; _i3++) {
          currentX = points[_i3 * 2];
          currentY = points[_i3 * 2 + 1];
          if (_i3 < points.length / 2 - 1) {
            nextX = points[(_i3 + 1) * 2];
            nextY = points[(_i3 + 1) * 2 + 1];
          } else {
            nextX = points[0];
            nextY = points[1];
          }
          intersection4 = finiteLinesIntersect(x5, y6, centerX, centerY, currentX, currentY, nextX, nextY);
          if (intersection4.length !== 0) {
            intersections.push(intersection4[0], intersection4[1]);
          }
        }
        return intersections;
      }, "polygonIntersectLine");
      roundPolygonIntersectLine = /* @__PURE__ */ __name(function roundPolygonIntersectLine2(x5, y6, basePoints, centerX, centerY, width3, height2, padding2, corners) {
        var intersections = [];
        var intersection4;
        var lines = new Array(basePoints.length * 2);
        corners.forEach(function(corner, i3) {
          if (i3 === 0) {
            lines[lines.length - 2] = corner.startX;
            lines[lines.length - 1] = corner.startY;
          } else {
            lines[i3 * 4 - 2] = corner.startX;
            lines[i3 * 4 - 1] = corner.startY;
          }
          lines[i3 * 4] = corner.stopX;
          lines[i3 * 4 + 1] = corner.stopY;
          intersection4 = intersectLineCircle(x5, y6, centerX, centerY, corner.cx, corner.cy, corner.radius);
          if (intersection4.length !== 0) {
            intersections.push(intersection4[0], intersection4[1]);
          }
        });
        for (var i2 = 0; i2 < lines.length / 4; i2++) {
          intersection4 = finiteLinesIntersect(x5, y6, centerX, centerY, lines[i2 * 4], lines[i2 * 4 + 1], lines[i2 * 4 + 2], lines[i2 * 4 + 3], false);
          if (intersection4.length !== 0) {
            intersections.push(intersection4[0], intersection4[1]);
          }
        }
        if (intersections.length > 2) {
          var lowestIntersection = [intersections[0], intersections[1]];
          var lowestSquaredDistance = Math.pow(lowestIntersection[0] - x5, 2) + Math.pow(lowestIntersection[1] - y6, 2);
          for (var _i4 = 1; _i4 < intersections.length / 2; _i4++) {
            var squaredDistance = Math.pow(intersections[_i4 * 2] - x5, 2) + Math.pow(intersections[_i4 * 2 + 1] - y6, 2);
            if (squaredDistance <= lowestSquaredDistance) {
              lowestIntersection[0] = intersections[_i4 * 2];
              lowestIntersection[1] = intersections[_i4 * 2 + 1];
              lowestSquaredDistance = squaredDistance;
            }
          }
          return lowestIntersection;
        }
        return intersections;
      }, "roundPolygonIntersectLine");
      shortenIntersection = /* @__PURE__ */ __name(function shortenIntersection2(intersection4, offset, amount) {
        var disp = [intersection4[0] - offset[0], intersection4[1] - offset[1]];
        var length2 = Math.sqrt(disp[0] * disp[0] + disp[1] * disp[1]);
        var lenRatio = (length2 - amount) / length2;
        if (lenRatio < 0) {
          lenRatio = 1e-5;
        }
        return [offset[0] + lenRatio * disp[0], offset[1] + lenRatio * disp[1]];
      }, "shortenIntersection");
      generateUnitNgonPointsFitToSquare = /* @__PURE__ */ __name(function generateUnitNgonPointsFitToSquare2(sides, rotationRadians) {
        var points = generateUnitNgonPoints(sides, rotationRadians);
        points = fitPolygonToSquare(points);
        return points;
      }, "generateUnitNgonPointsFitToSquare");
      fitPolygonToSquare = /* @__PURE__ */ __name(function fitPolygonToSquare2(points) {
        var x5, y6;
        var sides = points.length / 2;
        var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
        for (var i2 = 0; i2 < sides; i2++) {
          x5 = points[2 * i2];
          y6 = points[2 * i2 + 1];
          minX = Math.min(minX, x5);
          maxX = Math.max(maxX, x5);
          minY = Math.min(minY, y6);
          maxY = Math.max(maxY, y6);
        }
        var sx = 2 / (maxX - minX);
        var sy = 2 / (maxY - minY);
        for (var _i5 = 0; _i5 < sides; _i5++) {
          x5 = points[2 * _i5] = points[2 * _i5] * sx;
          y6 = points[2 * _i5 + 1] = points[2 * _i5 + 1] * sy;
          minX = Math.min(minX, x5);
          maxX = Math.max(maxX, x5);
          minY = Math.min(minY, y6);
          maxY = Math.max(maxY, y6);
        }
        if (minY < -1) {
          for (var _i6 = 0; _i6 < sides; _i6++) {
            y6 = points[2 * _i6 + 1] = points[2 * _i6 + 1] + (-1 - minY);
          }
        }
        return points;
      }, "fitPolygonToSquare");
      generateUnitNgonPoints = /* @__PURE__ */ __name(function generateUnitNgonPoints2(sides, rotationRadians) {
        var increment = 1 / sides * 2 * Math.PI;
        var startAngle = sides % 2 === 0 ? Math.PI / 2 + increment / 2 : Math.PI / 2;
        startAngle += rotationRadians;
        var points = new Array(sides * 2);
        var currentAngle;
        for (var i2 = 0; i2 < sides; i2++) {
          currentAngle = i2 * increment + startAngle;
          points[2 * i2] = Math.cos(currentAngle);
          points[2 * i2 + 1] = Math.sin(-currentAngle);
        }
        return points;
      }, "generateUnitNgonPoints");
      getRoundRectangleRadius = /* @__PURE__ */ __name(function getRoundRectangleRadius2(width3, height2) {
        return Math.min(width3 / 4, height2 / 4, 8);
      }, "getRoundRectangleRadius");
      getRoundPolygonRadius = /* @__PURE__ */ __name(function getRoundPolygonRadius2(width3, height2) {
        return Math.min(width3 / 10, height2 / 10, 8);
      }, "getRoundPolygonRadius");
      getCutRectangleCornerLength = /* @__PURE__ */ __name(function getCutRectangleCornerLength2() {
        return 8;
      }, "getCutRectangleCornerLength");
      bezierPtsToQuadCoeff = /* @__PURE__ */ __name(function bezierPtsToQuadCoeff2(p0, p1, p22) {
        return [p0 - 2 * p1 + p22, 2 * (p1 - p0), p0];
      }, "bezierPtsToQuadCoeff");
      getBarrelCurveConstants = /* @__PURE__ */ __name(function getBarrelCurveConstants2(width3, height2) {
        return {
          heightOffset: Math.min(15, 0.05 * height2),
          widthOffset: Math.min(100, 0.25 * width3),
          ctrlPtOffsetPct: 0.05
        };
      }, "getBarrelCurveConstants");
      __name(satPolygonIntersection, "satPolygonIntersection");
      pageRankDefaults = defaults$g({
        dampingFactor: 0.8,
        precision: 1e-6,
        iterations: 200,
        weight: /* @__PURE__ */ __name(function weight5(edge) {
          return 1;
        }, "weight")
      });
      elesfn$o = {
        pageRank: /* @__PURE__ */ __name(function pageRank(options2) {
          var _pageRankDefaults = pageRankDefaults(options2), dampingFactor = _pageRankDefaults.dampingFactor, precision = _pageRankDefaults.precision, iterations = _pageRankDefaults.iterations, weight8 = _pageRankDefaults.weight;
          var cy = this._private.cy;
          var _this$byGroup = this.byGroup(), nodes5 = _this$byGroup.nodes, edges3 = _this$byGroup.edges;
          var numNodes = nodes5.length;
          var numNodesSqd = numNodes * numNodes;
          var numEdges = edges3.length;
          var matrix = new Array(numNodesSqd);
          var columnSum = new Array(numNodes);
          var additionalProb = (1 - dampingFactor) / numNodes;
          for (var i2 = 0; i2 < numNodes; i2++) {
            for (var j3 = 0; j3 < numNodes; j3++) {
              var n2 = i2 * numNodes + j3;
              matrix[n2] = 0;
            }
            columnSum[i2] = 0;
          }
          for (var _i = 0; _i < numEdges; _i++) {
            var edge = edges3[_i];
            var srcId = edge.data("source");
            var tgtId = edge.data("target");
            if (srcId === tgtId) {
              continue;
            }
            var s2 = nodes5.indexOfId(srcId);
            var t4 = nodes5.indexOfId(tgtId);
            var w4 = weight8(edge);
            var _n = t4 * numNodes + s2;
            matrix[_n] += w4;
            columnSum[s2] += w4;
          }
          var p3 = 1 / numNodes + additionalProb;
          for (var _j = 0; _j < numNodes; _j++) {
            if (columnSum[_j] === 0) {
              for (var _i2 = 0; _i2 < numNodes; _i2++) {
                var _n2 = _i2 * numNodes + _j;
                matrix[_n2] = p3;
              }
            } else {
              for (var _i3 = 0; _i3 < numNodes; _i3++) {
                var _n3 = _i3 * numNodes + _j;
                matrix[_n3] = matrix[_n3] / columnSum[_j] + additionalProb;
              }
            }
          }
          var eigenvector = new Array(numNodes);
          var temp = new Array(numNodes);
          var previous;
          for (var _i4 = 0; _i4 < numNodes; _i4++) {
            eigenvector[_i4] = 1;
          }
          for (var iter = 0; iter < iterations; iter++) {
            for (var _i5 = 0; _i5 < numNodes; _i5++) {
              temp[_i5] = 0;
            }
            for (var _i6 = 0; _i6 < numNodes; _i6++) {
              for (var _j2 = 0; _j2 < numNodes; _j2++) {
                var _n4 = _i6 * numNodes + _j2;
                temp[_i6] += matrix[_n4] * eigenvector[_j2];
              }
            }
            inPlaceSumNormalize(temp);
            previous = eigenvector;
            eigenvector = temp;
            temp = previous;
            var diff2 = 0;
            for (var _i7 = 0; _i7 < numNodes; _i7++) {
              var delta = previous[_i7] - eigenvector[_i7];
              diff2 += delta * delta;
            }
            if (diff2 < precision) {
              break;
            }
          }
          var res = {
            rank: /* @__PURE__ */ __name(function rank2(node2) {
              node2 = cy.collection(node2)[0];
              return eigenvector[nodes5.indexOf(node2)];
            }, "rank")
          };
          return res;
        }, "pageRank")
        // pageRank
      };
      defaults$f = defaults$g({
        root: null,
        weight: /* @__PURE__ */ __name(function weight6(edge) {
          return 1;
        }, "weight"),
        directed: false,
        alpha: 0
      });
      elesfn$n = {
        degreeCentralityNormalized: /* @__PURE__ */ __name(function degreeCentralityNormalized(options2) {
          options2 = defaults$f(options2);
          var cy = this.cy();
          var nodes5 = this.nodes();
          var numNodes = nodes5.length;
          if (!options2.directed) {
            var degrees3 = {};
            var maxDegree = 0;
            for (var i2 = 0; i2 < numNodes; i2++) {
              var node2 = nodes5[i2];
              options2.root = node2;
              var currDegree = this.degreeCentrality(options2);
              if (maxDegree < currDegree.degree) {
                maxDegree = currDegree.degree;
              }
              degrees3[node2.id()] = currDegree.degree;
            }
            return {
              degree: /* @__PURE__ */ __name(function degree(node3) {
                if (maxDegree === 0) {
                  return 0;
                }
                if (string(node3)) {
                  node3 = cy.filter(node3);
                }
                return degrees3[node3.id()] / maxDegree;
              }, "degree")
            };
          } else {
            var indegrees = {};
            var outdegrees = {};
            var maxIndegree = 0;
            var maxOutdegree = 0;
            for (var _i = 0; _i < numNodes; _i++) {
              var _node = nodes5[_i];
              var id34 = _node.id();
              options2.root = _node;
              var _currDegree = this.degreeCentrality(options2);
              if (maxIndegree < _currDegree.indegree) maxIndegree = _currDegree.indegree;
              if (maxOutdegree < _currDegree.outdegree) maxOutdegree = _currDegree.outdegree;
              indegrees[id34] = _currDegree.indegree;
              outdegrees[id34] = _currDegree.outdegree;
            }
            return {
              indegree: /* @__PURE__ */ __name(function indegree(node3) {
                if (maxIndegree == 0) {
                  return 0;
                }
                if (string(node3)) {
                  node3 = cy.filter(node3);
                }
                return indegrees[node3.id()] / maxIndegree;
              }, "indegree"),
              outdegree: /* @__PURE__ */ __name(function outdegree(node3) {
                if (maxOutdegree === 0) {
                  return 0;
                }
                if (string(node3)) {
                  node3 = cy.filter(node3);
                }
                return outdegrees[node3.id()] / maxOutdegree;
              }, "outdegree")
            };
          }
        }, "degreeCentralityNormalized"),
        // degreeCentralityNormalized
        // Implemented from the algorithm in Opsahl's paper
        // "Node centrality in weighted networks: Generalizing degree and shortest paths"
        // check the heading 2 "Degree"
        degreeCentrality: /* @__PURE__ */ __name(function degreeCentrality(options2) {
          options2 = defaults$f(options2);
          var cy = this.cy();
          var callingEles = this;
          var _options = options2, root3 = _options.root, weight8 = _options.weight, directed = _options.directed, alpha = _options.alpha;
          root3 = cy.collection(root3)[0];
          if (!directed) {
            var connEdges = root3.connectedEdges().intersection(callingEles);
            var k2 = connEdges.length;
            var s2 = 0;
            for (var i2 = 0; i2 < connEdges.length; i2++) {
              s2 += weight8(connEdges[i2]);
            }
            return {
              degree: Math.pow(k2, 1 - alpha) * Math.pow(s2, alpha)
            };
          } else {
            var edges3 = root3.connectedEdges();
            var incoming = edges3.filter(function(edge) {
              return edge.target().same(root3) && callingEles.has(edge);
            });
            var outgoing = edges3.filter(function(edge) {
              return edge.source().same(root3) && callingEles.has(edge);
            });
            var k_in = incoming.length;
            var k_out = outgoing.length;
            var s_in = 0;
            var s_out = 0;
            for (var _i2 = 0; _i2 < incoming.length; _i2++) {
              s_in += weight8(incoming[_i2]);
            }
            for (var _i3 = 0; _i3 < outgoing.length; _i3++) {
              s_out += weight8(outgoing[_i3]);
            }
            return {
              indegree: Math.pow(k_in, 1 - alpha) * Math.pow(s_in, alpha),
              outdegree: Math.pow(k_out, 1 - alpha) * Math.pow(s_out, alpha)
            };
          }
        }, "degreeCentrality")
        // degreeCentrality
      };
      elesfn$n.dc = elesfn$n.degreeCentrality;
      elesfn$n.dcn = elesfn$n.degreeCentralityNormalised = elesfn$n.degreeCentralityNormalized;
      defaults$e = defaults$g({
        harmonic: true,
        weight: /* @__PURE__ */ __name(function weight7() {
          return 1;
        }, "weight"),
        directed: false,
        root: null
      });
      elesfn$m = {
        closenessCentralityNormalized: /* @__PURE__ */ __name(function closenessCentralityNormalized(options2) {
          var _defaults = defaults$e(options2), harmonic = _defaults.harmonic, weight8 = _defaults.weight, directed = _defaults.directed;
          var cy = this.cy();
          var closenesses = {};
          var maxCloseness = 0;
          var nodes5 = this.nodes();
          var fw = this.floydWarshall({
            weight: weight8,
            directed
          });
          for (var i2 = 0; i2 < nodes5.length; i2++) {
            var currCloseness = 0;
            var node_i = nodes5[i2];
            for (var j3 = 0; j3 < nodes5.length; j3++) {
              if (i2 !== j3) {
                var d3 = fw.distance(node_i, nodes5[j3]);
                if (harmonic) {
                  currCloseness += 1 / d3;
                } else {
                  currCloseness += d3;
                }
              }
            }
            if (!harmonic) {
              currCloseness = 1 / currCloseness;
            }
            if (maxCloseness < currCloseness) {
              maxCloseness = currCloseness;
            }
            closenesses[node_i.id()] = currCloseness;
          }
          return {
            closeness: /* @__PURE__ */ __name(function closeness(node2) {
              if (maxCloseness == 0) {
                return 0;
              }
              if (string(node2)) {
                node2 = cy.filter(node2)[0].id();
              } else {
                node2 = node2.id();
              }
              return closenesses[node2] / maxCloseness;
            }, "closeness")
          };
        }, "closenessCentralityNormalized"),
        // Implemented from pseudocode from wikipedia
        closenessCentrality: /* @__PURE__ */ __name(function closenessCentrality(options2) {
          var _defaults2 = defaults$e(options2), root3 = _defaults2.root, weight8 = _defaults2.weight, directed = _defaults2.directed, harmonic = _defaults2.harmonic;
          root3 = this.filter(root3)[0];
          var dijkstra3 = this.dijkstra({
            root: root3,
            weight: weight8,
            directed
          });
          var totalDistance = 0;
          var nodes5 = this.nodes();
          for (var i2 = 0; i2 < nodes5.length; i2++) {
            var n2 = nodes5[i2];
            if (!n2.same(root3)) {
              var d3 = dijkstra3.distanceTo(n2);
              if (harmonic) {
                totalDistance += 1 / d3;
              } else {
                totalDistance += d3;
              }
            }
          }
          return harmonic ? totalDistance : 1 / totalDistance;
        }, "closenessCentrality")
        // closenessCentrality
      };
      elesfn$m.cc = elesfn$m.closenessCentrality;
      elesfn$m.ccn = elesfn$m.closenessCentralityNormalised = elesfn$m.closenessCentralityNormalized;
      defaults$d = defaults$g({
        weight: null,
        directed: false
      });
      elesfn$l = {
        // Implemented from the algorithm in the paper "On Variants of Shortest-Path Betweenness Centrality and their Generic Computation" by Ulrik Brandes
        betweennessCentrality: /* @__PURE__ */ __name(function betweennessCentrality(options2) {
          var _defaults = defaults$d(options2), directed = _defaults.directed, weight8 = _defaults.weight;
          var weighted = weight8 != null;
          var cy = this.cy();
          var V3 = this.nodes();
          var A2 = {};
          var _C = {};
          var max10 = 0;
          var C3 = {
            set: /* @__PURE__ */ __name(function set5(key, val) {
              _C[key] = val;
              if (val > max10) {
                max10 = val;
              }
            }, "set"),
            get: /* @__PURE__ */ __name(function get5(key) {
              return _C[key];
            }, "get")
          };
          for (var i2 = 0; i2 < V3.length; i2++) {
            var v3 = V3[i2];
            var vid = v3.id();
            if (directed) {
              A2[vid] = v3.outgoers().nodes();
            } else {
              A2[vid] = v3.openNeighborhood().nodes();
            }
            C3.set(vid, 0);
          }
          var _loop = /* @__PURE__ */ __name(function _loop2() {
            var sid = V3[s2].id();
            var S4 = [];
            var P3 = {};
            var g2 = {};
            var d3 = {};
            var Q3 = new Heap(function(a2, b3) {
              return d3[a2] - d3[b3];
            });
            for (var _i = 0; _i < V3.length; _i++) {
              var _vid = V3[_i].id();
              P3[_vid] = [];
              g2[_vid] = 0;
              d3[_vid] = Infinity;
            }
            g2[sid] = 1;
            d3[sid] = 0;
            Q3.push(sid);
            while (!Q3.empty()) {
              var _v = Q3.pop();
              S4.push(_v);
              if (weighted) {
                for (var j3 = 0; j3 < A2[_v].length; j3++) {
                  var w4 = A2[_v][j3];
                  var vEle = cy.getElementById(_v);
                  var edge = void 0;
                  if (vEle.edgesTo(w4).length > 0) {
                    edge = vEle.edgesTo(w4)[0];
                  } else {
                    edge = w4.edgesTo(vEle)[0];
                  }
                  var edgeWeight = weight8(edge);
                  w4 = w4.id();
                  if (d3[w4] > d3[_v] + edgeWeight) {
                    d3[w4] = d3[_v] + edgeWeight;
                    if (Q3.nodes.indexOf(w4) < 0) {
                      Q3.push(w4);
                    } else {
                      Q3.updateItem(w4);
                    }
                    g2[w4] = 0;
                    P3[w4] = [];
                  }
                  if (d3[w4] == d3[_v] + edgeWeight) {
                    g2[w4] = g2[w4] + g2[_v];
                    P3[w4].push(_v);
                  }
                }
              } else {
                for (var _j = 0; _j < A2[_v].length; _j++) {
                  var _w = A2[_v][_j].id();
                  if (d3[_w] == Infinity) {
                    Q3.push(_w);
                    d3[_w] = d3[_v] + 1;
                  }
                  if (d3[_w] == d3[_v] + 1) {
                    g2[_w] = g2[_w] + g2[_v];
                    P3[_w].push(_v);
                  }
                }
              }
            }
            var e3 = {};
            for (var _i2 = 0; _i2 < V3.length; _i2++) {
              e3[V3[_i2].id()] = 0;
            }
            while (S4.length > 0) {
              var _w2 = S4.pop();
              for (var _j2 = 0; _j2 < P3[_w2].length; _j2++) {
                var _v2 = P3[_w2][_j2];
                e3[_v2] = e3[_v2] + g2[_v2] / g2[_w2] * (1 + e3[_w2]);
              }
              if (_w2 != V3[s2].id()) {
                C3.set(_w2, C3.get(_w2) + e3[_w2]);
              }
            }
          }, "_loop");
          for (var s2 = 0; s2 < V3.length; s2++) {
            _loop();
          }
          var ret = {
            betweenness: /* @__PURE__ */ __name(function betweenness(node2) {
              var id34 = cy.collection(node2).id();
              return C3.get(id34);
            }, "betweenness"),
            betweennessNormalized: /* @__PURE__ */ __name(function betweennessNormalized(node2) {
              if (max10 == 0) {
                return 0;
              }
              var id34 = cy.collection(node2).id();
              return C3.get(id34) / max10;
            }, "betweennessNormalized")
          };
          ret.betweennessNormalised = ret.betweennessNormalized;
          return ret;
        }, "betweennessCentrality")
        // betweennessCentrality
      };
      elesfn$l.bc = elesfn$l.betweennessCentrality;
      defaults$c = defaults$g({
        expandFactor: 2,
        // affects time of computation and cluster granularity to some extent: M * M
        inflateFactor: 2,
        // affects cluster granularity (the greater the value, the more clusters): M(i,j) / E(j)
        multFactor: 1,
        // optional self loops for each node. Use a neutral value to improve cluster computations.
        maxIterations: 20,
        // maximum number of iterations of the MCL algorithm in a single run
        attributes: [
          // attributes/features used to group nodes, ie. similarity values between nodes
          function(edge) {
            return 1;
          }
        ]
      });
      setOptions$3 = /* @__PURE__ */ __name(function setOptions(options2) {
        return defaults$c(options2);
      }, "setOptions");
      getSimilarity$1 = /* @__PURE__ */ __name(function getSimilarity(edge, attributes) {
        var total = 0;
        for (var i2 = 0; i2 < attributes.length; i2++) {
          total += attributes[i2](edge);
        }
        return total;
      }, "getSimilarity");
      addLoops = /* @__PURE__ */ __name(function addLoops2(M3, n2, val) {
        for (var i2 = 0; i2 < n2; i2++) {
          M3[i2 * n2 + i2] = val;
        }
      }, "addLoops");
      normalize2 = /* @__PURE__ */ __name(function normalize3(M3, n2) {
        var sum2;
        for (var col = 0; col < n2; col++) {
          sum2 = 0;
          for (var row = 0; row < n2; row++) {
            sum2 += M3[row * n2 + col];
          }
          for (var _row = 0; _row < n2; _row++) {
            M3[_row * n2 + col] = M3[_row * n2 + col] / sum2;
          }
        }
      }, "normalize");
      mmult = /* @__PURE__ */ __name(function mmult2(A2, B3, n2) {
        var C3 = new Array(n2 * n2);
        for (var i2 = 0; i2 < n2; i2++) {
          for (var j3 = 0; j3 < n2; j3++) {
            C3[i2 * n2 + j3] = 0;
          }
          for (var k2 = 0; k2 < n2; k2++) {
            for (var _j = 0; _j < n2; _j++) {
              C3[i2 * n2 + _j] += A2[i2 * n2 + k2] * B3[k2 * n2 + _j];
            }
          }
        }
        return C3;
      }, "mmult");
      expand = /* @__PURE__ */ __name(function expand2(M3, n2, expandFactor) {
        var _M = M3.slice(0);
        for (var p3 = 1; p3 < expandFactor; p3++) {
          M3 = mmult(M3, _M, n2);
        }
        return M3;
      }, "expand");
      inflate = /* @__PURE__ */ __name(function inflate2(M3, n2, inflateFactor) {
        var _M = new Array(n2 * n2);
        for (var i2 = 0; i2 < n2 * n2; i2++) {
          _M[i2] = Math.pow(M3[i2], inflateFactor);
        }
        normalize2(_M, n2);
        return _M;
      }, "inflate");
      hasConverged = /* @__PURE__ */ __name(function hasConverged2(M3, _M, n2, roundFactor) {
        for (var i2 = 0; i2 < n2; i2++) {
          var v12 = Math.round(M3[i2] * Math.pow(10, roundFactor)) / Math.pow(10, roundFactor);
          var v23 = Math.round(_M[i2] * Math.pow(10, roundFactor)) / Math.pow(10, roundFactor);
          if (v12 !== v23) {
            return false;
          }
        }
        return true;
      }, "hasConverged");
      assign$2 = /* @__PURE__ */ __name(function assign2(M3, n2, nodes5, cy) {
        var clusters = [];
        for (var i2 = 0; i2 < n2; i2++) {
          var cluster = [];
          for (var j3 = 0; j3 < n2; j3++) {
            if (Math.round(M3[i2 * n2 + j3] * 1e3) / 1e3 > 0) {
              cluster.push(nodes5[j3]);
            }
          }
          if (cluster.length !== 0) {
            clusters.push(cy.collection(cluster));
          }
        }
        return clusters;
      }, "assign");
      isDuplicate = /* @__PURE__ */ __name(function isDuplicate2(c1, c22) {
        for (var i2 = 0; i2 < c1.length; i2++) {
          if (!c22[i2] || c1[i2].id() !== c22[i2].id()) {
            return false;
          }
        }
        return true;
      }, "isDuplicate");
      removeDuplicates = /* @__PURE__ */ __name(function removeDuplicates2(clusters) {
        for (var i2 = 0; i2 < clusters.length; i2++) {
          for (var j3 = 0; j3 < clusters.length; j3++) {
            if (i2 != j3 && isDuplicate(clusters[i2], clusters[j3])) {
              clusters.splice(j3, 1);
            }
          }
        }
        return clusters;
      }, "removeDuplicates");
      markovClustering = /* @__PURE__ */ __name(function markovClustering2(options2) {
        var nodes5 = this.nodes();
        var edges3 = this.edges();
        var cy = this.cy();
        var opts = setOptions$3(options2);
        var id2position = {};
        for (var i2 = 0; i2 < nodes5.length; i2++) {
          id2position[nodes5[i2].id()] = i2;
        }
        var n2 = nodes5.length, n22 = n2 * n2;
        var M3 = new Array(n22), _M;
        for (var _i = 0; _i < n22; _i++) {
          M3[_i] = 0;
        }
        for (var e3 = 0; e3 < edges3.length; e3++) {
          var edge = edges3[e3];
          var _i2 = id2position[edge.source().id()];
          var j3 = id2position[edge.target().id()];
          var sim = getSimilarity$1(edge, opts.attributes);
          M3[_i2 * n2 + j3] += sim;
          M3[j3 * n2 + _i2] += sim;
        }
        addLoops(M3, n2, opts.multFactor);
        normalize2(M3, n2);
        var isStillMoving = true;
        var iterations = 0;
        while (isStillMoving && iterations < opts.maxIterations) {
          isStillMoving = false;
          _M = expand(M3, n2, opts.expandFactor);
          M3 = inflate(_M, n2, opts.inflateFactor);
          if (!hasConverged(M3, _M, n22, 4)) {
            isStillMoving = true;
          }
          iterations++;
        }
        var clusters = assign$2(M3, n2, nodes5, cy);
        clusters = removeDuplicates(clusters);
        return clusters;
      }, "markovClustering");
      markovClustering$1 = {
        markovClustering,
        mcl: markovClustering
      };
      identity$1 = /* @__PURE__ */ __name(function identity5(x5) {
        return x5;
      }, "identity");
      absDiff = /* @__PURE__ */ __name(function absDiff2(p3, q3) {
        return Math.abs(q3 - p3);
      }, "absDiff");
      addAbsDiff = /* @__PURE__ */ __name(function addAbsDiff2(total, p3, q3) {
        return total + absDiff(p3, q3);
      }, "addAbsDiff");
      addSquaredDiff = /* @__PURE__ */ __name(function addSquaredDiff2(total, p3, q3) {
        return total + Math.pow(q3 - p3, 2);
      }, "addSquaredDiff");
      sqrt3 = /* @__PURE__ */ __name(function sqrt4(x5) {
        return Math.sqrt(x5);
      }, "sqrt");
      maxAbsDiff = /* @__PURE__ */ __name(function maxAbsDiff2(currentMax, p3, q3) {
        return Math.max(currentMax, absDiff(p3, q3));
      }, "maxAbsDiff");
      getDistance = /* @__PURE__ */ __name(function getDistance2(length2, getP, getQ, init3, visit) {
        var post = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : identity$1;
        var ret = init3;
        var p3, q3;
        for (var dim = 0; dim < length2; dim++) {
          p3 = getP(dim);
          q3 = getQ(dim);
          ret = visit(ret, p3, q3);
        }
        return post(ret);
      }, "getDistance");
      distances = {
        euclidean: /* @__PURE__ */ __name(function euclidean(length2, getP, getQ) {
          if (length2 >= 2) {
            return getDistance(length2, getP, getQ, 0, addSquaredDiff, sqrt3);
          } else {
            return getDistance(length2, getP, getQ, 0, addAbsDiff);
          }
        }, "euclidean"),
        squaredEuclidean: /* @__PURE__ */ __name(function squaredEuclidean(length2, getP, getQ) {
          return getDistance(length2, getP, getQ, 0, addSquaredDiff);
        }, "squaredEuclidean"),
        manhattan: /* @__PURE__ */ __name(function manhattan(length2, getP, getQ) {
          return getDistance(length2, getP, getQ, 0, addAbsDiff);
        }, "manhattan"),
        max: /* @__PURE__ */ __name(function max7(length2, getP, getQ) {
          return getDistance(length2, getP, getQ, -Infinity, maxAbsDiff);
        }, "max")
      };
      distances["squared-euclidean"] = distances["squaredEuclidean"];
      distances["squaredeuclidean"] = distances["squaredEuclidean"];
      __name(clusteringDistance, "clusteringDistance");
      defaults$b = defaults$g({
        k: 2,
        m: 2,
        sensitivityThreshold: 1e-4,
        distance: "euclidean",
        maxIterations: 10,
        attributes: [],
        testMode: false,
        testCentroids: null
      });
      setOptions$2 = /* @__PURE__ */ __name(function setOptions2(options2) {
        return defaults$b(options2);
      }, "setOptions");
      getDist = /* @__PURE__ */ __name(function getDist2(type3, node2, centroid, attributes, mode) {
        var noNodeP = mode !== "kMedoids";
        var getP = noNodeP ? function(i2) {
          return centroid[i2];
        } : function(i2) {
          return attributes[i2](centroid);
        };
        var getQ = /* @__PURE__ */ __name(function getQ2(i2) {
          return attributes[i2](node2);
        }, "getQ");
        var nodeP = centroid;
        var nodeQ = node2;
        return clusteringDistance(type3, attributes.length, getP, getQ, nodeP, nodeQ);
      }, "getDist");
      randomCentroids = /* @__PURE__ */ __name(function randomCentroids2(nodes5, k2, attributes) {
        var ndim = attributes.length;
        var min9 = new Array(ndim);
        var max10 = new Array(ndim);
        var centroids = new Array(k2);
        var centroid = null;
        for (var i2 = 0; i2 < ndim; i2++) {
          min9[i2] = nodes5.min(attributes[i2]).value;
          max10[i2] = nodes5.max(attributes[i2]).value;
        }
        for (var c3 = 0; c3 < k2; c3++) {
          centroid = [];
          for (var _i = 0; _i < ndim; _i++) {
            centroid[_i] = Math.random() * (max10[_i] - min9[_i]) + min9[_i];
          }
          centroids[c3] = centroid;
        }
        return centroids;
      }, "randomCentroids");
      classify = /* @__PURE__ */ __name(function classify2(node2, centroids, distance3, attributes, type3) {
        var min9 = Infinity;
        var index = 0;
        for (var i2 = 0; i2 < centroids.length; i2++) {
          var dist3 = getDist(distance3, node2, centroids[i2], attributes, type3);
          if (dist3 < min9) {
            min9 = dist3;
            index = i2;
          }
        }
        return index;
      }, "classify");
      buildCluster = /* @__PURE__ */ __name(function buildCluster2(centroid, nodes5, assignment) {
        var cluster = [];
        var node2 = null;
        for (var n2 = 0; n2 < nodes5.length; n2++) {
          node2 = nodes5[n2];
          if (assignment[node2.id()] === centroid) {
            cluster.push(node2);
          }
        }
        return cluster;
      }, "buildCluster");
      haveValuesConverged = /* @__PURE__ */ __name(function haveValuesConverged2(v12, v23, sensitivityThreshold) {
        return Math.abs(v23 - v12) <= sensitivityThreshold;
      }, "haveValuesConverged");
      haveMatricesConverged = /* @__PURE__ */ __name(function haveMatricesConverged2(v12, v23, sensitivityThreshold) {
        for (var i2 = 0; i2 < v12.length; i2++) {
          for (var j3 = 0; j3 < v12[i2].length; j3++) {
            var diff2 = Math.abs(v12[i2][j3] - v23[i2][j3]);
            if (diff2 > sensitivityThreshold) {
              return false;
            }
          }
        }
        return true;
      }, "haveMatricesConverged");
      seenBefore = /* @__PURE__ */ __name(function seenBefore2(node2, medoids, n2) {
        for (var i2 = 0; i2 < n2; i2++) {
          if (node2 === medoids[i2]) return true;
        }
        return false;
      }, "seenBefore");
      randomMedoids = /* @__PURE__ */ __name(function randomMedoids2(nodes5, k2) {
        var medoids = new Array(k2);
        if (nodes5.length < 50) {
          for (var i2 = 0; i2 < k2; i2++) {
            var node2 = nodes5[Math.floor(Math.random() * nodes5.length)];
            while (seenBefore(node2, medoids, i2)) {
              node2 = nodes5[Math.floor(Math.random() * nodes5.length)];
            }
            medoids[i2] = node2;
          }
        } else {
          for (var _i2 = 0; _i2 < k2; _i2++) {
            medoids[_i2] = nodes5[Math.floor(Math.random() * nodes5.length)];
          }
        }
        return medoids;
      }, "randomMedoids");
      findCost = /* @__PURE__ */ __name(function findCost2(potentialNewMedoid, cluster, attributes) {
        var cost = 0;
        for (var n2 = 0; n2 < cluster.length; n2++) {
          cost += getDist("manhattan", cluster[n2], potentialNewMedoid, attributes, "kMedoids");
        }
        return cost;
      }, "findCost");
      kMeans = /* @__PURE__ */ __name(function kMeans2(options2) {
        var cy = this.cy();
        var nodes5 = this.nodes();
        var node2 = null;
        var opts = setOptions$2(options2);
        var clusters = new Array(opts.k);
        var assignment = {};
        var centroids;
        if (opts.testMode) {
          if (typeof opts.testCentroids === "number") {
            opts.testCentroids;
            centroids = randomCentroids(nodes5, opts.k, opts.attributes);
          } else if (_typeof(opts.testCentroids) === "object") {
            centroids = opts.testCentroids;
          } else {
            centroids = randomCentroids(nodes5, opts.k, opts.attributes);
          }
        } else {
          centroids = randomCentroids(nodes5, opts.k, opts.attributes);
        }
        var isStillMoving = true;
        var iterations = 0;
        while (isStillMoving && iterations < opts.maxIterations) {
          for (var n2 = 0; n2 < nodes5.length; n2++) {
            node2 = nodes5[n2];
            assignment[node2.id()] = classify(node2, centroids, opts.distance, opts.attributes, "kMeans");
          }
          isStillMoving = false;
          for (var c3 = 0; c3 < opts.k; c3++) {
            var cluster = buildCluster(c3, nodes5, assignment);
            if (cluster.length === 0) {
              continue;
            }
            var ndim = opts.attributes.length;
            var centroid = centroids[c3];
            var newCentroid = new Array(ndim);
            var sum2 = new Array(ndim);
            for (var d3 = 0; d3 < ndim; d3++) {
              sum2[d3] = 0;
              for (var i2 = 0; i2 < cluster.length; i2++) {
                node2 = cluster[i2];
                sum2[d3] += opts.attributes[d3](node2);
              }
              newCentroid[d3] = sum2[d3] / cluster.length;
              if (!haveValuesConverged(newCentroid[d3], centroid[d3], opts.sensitivityThreshold)) {
                isStillMoving = true;
              }
            }
            centroids[c3] = newCentroid;
            clusters[c3] = cy.collection(cluster);
          }
          iterations++;
        }
        return clusters;
      }, "kMeans");
      kMedoids = /* @__PURE__ */ __name(function kMedoids2(options2) {
        var cy = this.cy();
        var nodes5 = this.nodes();
        var node2 = null;
        var opts = setOptions$2(options2);
        var clusters = new Array(opts.k);
        var medoids;
        var assignment = {};
        var curCost;
        var minCosts = new Array(opts.k);
        if (opts.testMode) {
          if (typeof opts.testCentroids === "number") ;
          else if (_typeof(opts.testCentroids) === "object") {
            medoids = opts.testCentroids;
          } else {
            medoids = randomMedoids(nodes5, opts.k);
          }
        } else {
          medoids = randomMedoids(nodes5, opts.k);
        }
        var isStillMoving = true;
        var iterations = 0;
        while (isStillMoving && iterations < opts.maxIterations) {
          for (var n2 = 0; n2 < nodes5.length; n2++) {
            node2 = nodes5[n2];
            assignment[node2.id()] = classify(node2, medoids, opts.distance, opts.attributes, "kMedoids");
          }
          isStillMoving = false;
          for (var m3 = 0; m3 < medoids.length; m3++) {
            var cluster = buildCluster(m3, nodes5, assignment);
            if (cluster.length === 0) {
              continue;
            }
            minCosts[m3] = findCost(medoids[m3], cluster, opts.attributes);
            for (var _n = 0; _n < cluster.length; _n++) {
              curCost = findCost(cluster[_n], cluster, opts.attributes);
              if (curCost < minCosts[m3]) {
                minCosts[m3] = curCost;
                medoids[m3] = cluster[_n];
                isStillMoving = true;
              }
            }
            clusters[m3] = cy.collection(cluster);
          }
          iterations++;
        }
        return clusters;
      }, "kMedoids");
      updateCentroids = /* @__PURE__ */ __name(function updateCentroids2(centroids, nodes5, U3, weight8, opts) {
        var numerator, denominator;
        for (var n2 = 0; n2 < nodes5.length; n2++) {
          for (var c3 = 0; c3 < centroids.length; c3++) {
            weight8[n2][c3] = Math.pow(U3[n2][c3], opts.m);
          }
        }
        for (var _c = 0; _c < centroids.length; _c++) {
          for (var dim = 0; dim < opts.attributes.length; dim++) {
            numerator = 0;
            denominator = 0;
            for (var _n2 = 0; _n2 < nodes5.length; _n2++) {
              numerator += weight8[_n2][_c] * opts.attributes[dim](nodes5[_n2]);
              denominator += weight8[_n2][_c];
            }
            centroids[_c][dim] = numerator / denominator;
          }
        }
      }, "updateCentroids");
      updateMembership = /* @__PURE__ */ __name(function updateMembership2(U3, _U, centroids, nodes5, opts) {
        for (var i2 = 0; i2 < U3.length; i2++) {
          _U[i2] = U3[i2].slice();
        }
        var sum2, numerator, denominator;
        var pow = 2 / (opts.m - 1);
        for (var c3 = 0; c3 < centroids.length; c3++) {
          for (var n2 = 0; n2 < nodes5.length; n2++) {
            sum2 = 0;
            for (var k2 = 0; k2 < centroids.length; k2++) {
              numerator = getDist(opts.distance, nodes5[n2], centroids[c3], opts.attributes, "cmeans");
              denominator = getDist(opts.distance, nodes5[n2], centroids[k2], opts.attributes, "cmeans");
              sum2 += Math.pow(numerator / denominator, pow);
            }
            U3[n2][c3] = 1 / sum2;
          }
        }
      }, "updateMembership");
      assign$1 = /* @__PURE__ */ __name(function assign3(nodes5, U3, opts, cy) {
        var clusters = new Array(opts.k);
        for (var c3 = 0; c3 < clusters.length; c3++) {
          clusters[c3] = [];
        }
        var max10;
        var index;
        for (var n2 = 0; n2 < U3.length; n2++) {
          max10 = -Infinity;
          index = -1;
          for (var _c2 = 0; _c2 < U3[0].length; _c2++) {
            if (U3[n2][_c2] > max10) {
              max10 = U3[n2][_c2];
              index = _c2;
            }
          }
          clusters[index].push(nodes5[n2]);
        }
        for (var _c3 = 0; _c3 < clusters.length; _c3++) {
          clusters[_c3] = cy.collection(clusters[_c3]);
        }
        return clusters;
      }, "assign");
      fuzzyCMeans = /* @__PURE__ */ __name(function fuzzyCMeans2(options2) {
        var cy = this.cy();
        var nodes5 = this.nodes();
        var opts = setOptions$2(options2);
        var clusters;
        var centroids;
        var U3;
        var _U;
        var weight8;
        _U = new Array(nodes5.length);
        for (var i2 = 0; i2 < nodes5.length; i2++) {
          _U[i2] = new Array(opts.k);
        }
        U3 = new Array(nodes5.length);
        for (var _i3 = 0; _i3 < nodes5.length; _i3++) {
          U3[_i3] = new Array(opts.k);
        }
        for (var _i4 = 0; _i4 < nodes5.length; _i4++) {
          var total = 0;
          for (var j3 = 0; j3 < opts.k; j3++) {
            U3[_i4][j3] = Math.random();
            total += U3[_i4][j3];
          }
          for (var _j = 0; _j < opts.k; _j++) {
            U3[_i4][_j] = U3[_i4][_j] / total;
          }
        }
        centroids = new Array(opts.k);
        for (var _i5 = 0; _i5 < opts.k; _i5++) {
          centroids[_i5] = new Array(opts.attributes.length);
        }
        weight8 = new Array(nodes5.length);
        for (var _i6 = 0; _i6 < nodes5.length; _i6++) {
          weight8[_i6] = new Array(opts.k);
        }
        var isStillMoving = true;
        var iterations = 0;
        while (isStillMoving && iterations < opts.maxIterations) {
          isStillMoving = false;
          updateCentroids(centroids, nodes5, U3, weight8, opts);
          updateMembership(U3, _U, centroids, nodes5, opts);
          if (!haveMatricesConverged(U3, _U, opts.sensitivityThreshold)) {
            isStillMoving = true;
          }
          iterations++;
        }
        clusters = assign$1(nodes5, U3, opts, cy);
        return {
          clusters,
          degreeOfMembership: U3
        };
      }, "fuzzyCMeans");
      kClustering = {
        kMeans,
        kMedoids,
        fuzzyCMeans,
        fcm: fuzzyCMeans
      };
      defaults$a = defaults$g({
        distance: "euclidean",
        // distance metric to compare nodes
        linkage: "min",
        // linkage criterion : how to determine the distance between clusters of nodes
        mode: "threshold",
        // mode:'threshold' => clusters must be threshold distance apart
        threshold: Infinity,
        // the distance threshold
        // mode:'dendrogram' => the nodes are organised as leaves in a tree (siblings are close), merging makes clusters
        addDendrogram: false,
        // whether to add the dendrogram to the graph for viz
        dendrogramDepth: 0,
        // depth at which dendrogram branches are merged into the returned clusters
        attributes: []
        // array of attr functions
      });
      linkageAliases = {
        "single": "min",
        "complete": "max"
      };
      setOptions$1 = /* @__PURE__ */ __name(function setOptions3(options2) {
        var opts = defaults$a(options2);
        var preferredAlias = linkageAliases[opts.linkage];
        if (preferredAlias != null) {
          opts.linkage = preferredAlias;
        }
        return opts;
      }, "setOptions");
      mergeClosest = /* @__PURE__ */ __name(function mergeClosest2(clusters, index, dists, mins, opts) {
        var minKey = 0;
        var min9 = Infinity;
        var dist3;
        var attrs = opts.attributes;
        var getDist3 = /* @__PURE__ */ __name(function getDist4(n1, n2) {
          return clusteringDistance(opts.distance, attrs.length, function(i3) {
            return attrs[i3](n1);
          }, function(i3) {
            return attrs[i3](n2);
          }, n1, n2);
        }, "getDist");
        for (var i2 = 0; i2 < clusters.length; i2++) {
          var key = clusters[i2].key;
          var _dist = dists[key][mins[key]];
          if (_dist < min9) {
            minKey = key;
            min9 = _dist;
          }
        }
        if (opts.mode === "threshold" && min9 >= opts.threshold || opts.mode === "dendrogram" && clusters.length === 1) {
          return false;
        }
        var c1 = index[minKey];
        var c22 = index[mins[minKey]];
        var merged;
        if (opts.mode === "dendrogram") {
          merged = {
            left: c1,
            right: c22,
            key: c1.key
          };
        } else {
          merged = {
            value: c1.value.concat(c22.value),
            key: c1.key
          };
        }
        clusters[c1.index] = merged;
        clusters.splice(c22.index, 1);
        index[c1.key] = merged;
        for (var _i = 0; _i < clusters.length; _i++) {
          var cur = clusters[_i];
          if (c1.key === cur.key) {
            dist3 = Infinity;
          } else if (opts.linkage === "min") {
            dist3 = dists[c1.key][cur.key];
            if (dists[c1.key][cur.key] > dists[c22.key][cur.key]) {
              dist3 = dists[c22.key][cur.key];
            }
          } else if (opts.linkage === "max") {
            dist3 = dists[c1.key][cur.key];
            if (dists[c1.key][cur.key] < dists[c22.key][cur.key]) {
              dist3 = dists[c22.key][cur.key];
            }
          } else if (opts.linkage === "mean") {
            dist3 = (dists[c1.key][cur.key] * c1.size + dists[c22.key][cur.key] * c22.size) / (c1.size + c22.size);
          } else {
            if (opts.mode === "dendrogram") dist3 = getDist3(cur.value, c1.value);
            else dist3 = getDist3(cur.value[0], c1.value[0]);
          }
          dists[c1.key][cur.key] = dists[cur.key][c1.key] = dist3;
        }
        for (var _i2 = 0; _i2 < clusters.length; _i2++) {
          var key1 = clusters[_i2].key;
          if (mins[key1] === c1.key || mins[key1] === c22.key) {
            var _min = key1;
            for (var j3 = 0; j3 < clusters.length; j3++) {
              var key2 = clusters[j3].key;
              if (dists[key1][key2] < dists[key1][_min]) {
                _min = key2;
              }
            }
            mins[key1] = _min;
          }
          clusters[_i2].index = _i2;
        }
        c1.key = c22.key = c1.index = c22.index = null;
        return true;
      }, "mergeClosest");
      _getAllChildren = /* @__PURE__ */ __name(function getAllChildren(root3, arr, cy) {
        if (!root3) return;
        if (root3.value) {
          arr.push(root3.value);
        } else {
          if (root3.left) _getAllChildren(root3.left, arr);
          if (root3.right) _getAllChildren(root3.right, arr);
        }
      }, "getAllChildren");
      _buildDendrogram = /* @__PURE__ */ __name(function buildDendrogram(root3, cy) {
        if (!root3) return "";
        if (root3.left && root3.right) {
          var leftStr = _buildDendrogram(root3.left, cy);
          var rightStr = _buildDendrogram(root3.right, cy);
          var node2 = cy.add({
            group: "nodes",
            data: {
              id: leftStr + "," + rightStr
            }
          });
          cy.add({
            group: "edges",
            data: {
              source: leftStr,
              target: node2.id()
            }
          });
          cy.add({
            group: "edges",
            data: {
              source: rightStr,
              target: node2.id()
            }
          });
          return node2.id();
        } else if (root3.value) {
          return root3.value.id();
        }
      }, "buildDendrogram");
      _buildClustersFromTree = /* @__PURE__ */ __name(function buildClustersFromTree(root3, k2, cy) {
        if (!root3) return [];
        var left3 = [], right3 = [], leaves = [];
        if (k2 === 0) {
          if (root3.left) _getAllChildren(root3.left, left3);
          if (root3.right) _getAllChildren(root3.right, right3);
          leaves = left3.concat(right3);
          return [cy.collection(leaves)];
        } else if (k2 === 1) {
          if (root3.value) {
            return [cy.collection(root3.value)];
          } else {
            if (root3.left) _getAllChildren(root3.left, left3);
            if (root3.right) _getAllChildren(root3.right, right3);
            return [cy.collection(left3), cy.collection(right3)];
          }
        } else {
          if (root3.value) {
            return [cy.collection(root3.value)];
          } else {
            if (root3.left) left3 = _buildClustersFromTree(root3.left, k2 - 1, cy);
            if (root3.right) right3 = _buildClustersFromTree(root3.right, k2 - 1, cy);
            return left3.concat(right3);
          }
        }
      }, "buildClustersFromTree");
      hierarchicalClustering = /* @__PURE__ */ __name(function hierarchicalClustering2(options2) {
        var cy = this.cy();
        var nodes5 = this.nodes();
        var opts = setOptions$1(options2);
        var attrs = opts.attributes;
        var getDist3 = /* @__PURE__ */ __name(function getDist4(n1, n22) {
          return clusteringDistance(opts.distance, attrs.length, function(i3) {
            return attrs[i3](n1);
          }, function(i3) {
            return attrs[i3](n22);
          }, n1, n22);
        }, "getDist");
        var clusters = [];
        var dists = [];
        var mins = [];
        var index = [];
        for (var n2 = 0; n2 < nodes5.length; n2++) {
          var cluster = {
            value: opts.mode === "dendrogram" ? nodes5[n2] : [nodes5[n2]],
            key: n2,
            index: n2
          };
          clusters[n2] = cluster;
          index[n2] = cluster;
          dists[n2] = [];
          mins[n2] = 0;
        }
        for (var i2 = 0; i2 < clusters.length; i2++) {
          for (var j3 = 0; j3 <= i2; j3++) {
            var dist3 = void 0;
            if (opts.mode === "dendrogram") {
              dist3 = i2 === j3 ? Infinity : getDist3(clusters[i2].value, clusters[j3].value);
            } else {
              dist3 = i2 === j3 ? Infinity : getDist3(clusters[i2].value[0], clusters[j3].value[0]);
            }
            dists[i2][j3] = dist3;
            dists[j3][i2] = dist3;
            if (dist3 < dists[i2][mins[i2]]) {
              mins[i2] = j3;
            }
          }
        }
        var merged = mergeClosest(clusters, index, dists, mins, opts);
        while (merged) {
          merged = mergeClosest(clusters, index, dists, mins, opts);
        }
        var retClusters;
        if (opts.mode === "dendrogram") {
          retClusters = _buildClustersFromTree(clusters[0], opts.dendrogramDepth, cy);
          if (opts.addDendrogram) _buildDendrogram(clusters[0], cy);
        } else {
          retClusters = new Array(clusters.length);
          clusters.forEach(function(cluster2, i3) {
            cluster2.key = cluster2.index = null;
            retClusters[i3] = cy.collection(cluster2.value);
          });
        }
        return retClusters;
      }, "hierarchicalClustering");
      hierarchicalClustering$1 = {
        hierarchicalClustering,
        hca: hierarchicalClustering
      };
      defaults$9 = defaults$g({
        distance: "euclidean",
        // distance metric to compare attributes between two nodes
        preference: "median",
        // suitability of a data point to serve as an exemplar
        damping: 0.8,
        // damping factor between [0.5, 1)
        maxIterations: 1e3,
        // max number of iterations to run
        minIterations: 100,
        // min number of iterations to run in order for clustering to stop
        attributes: [
          // functions to quantify the similarity between any two points
          // e.g. node => node.data('weight')
        ]
      });
      setOptions4 = /* @__PURE__ */ __name(function setOptions5(options2) {
        var dmp = options2.damping;
        var pref = options2.preference;
        if (!(0.5 <= dmp && dmp < 1)) {
          error("Damping must range on [0.5, 1).  Got: ".concat(dmp));
        }
        var validPrefs = ["median", "mean", "min", "max"];
        if (!(validPrefs.some(function(v3) {
          return v3 === pref;
        }) || number$1(pref))) {
          error("Preference must be one of [".concat(validPrefs.map(function(p3) {
            return "'".concat(p3, "'");
          }).join(", "), "] or a number.  Got: ").concat(pref));
        }
        return defaults$9(options2);
      }, "setOptions");
      getSimilarity2 = /* @__PURE__ */ __name(function getSimilarity3(type3, n1, n2, attributes) {
        var attr = /* @__PURE__ */ __name(function attr2(n3, i2) {
          return attributes[i2](n3);
        }, "attr");
        return -clusteringDistance(type3, attributes.length, function(i2) {
          return attr(n1, i2);
        }, function(i2) {
          return attr(n2, i2);
        }, n1, n2);
      }, "getSimilarity");
      getPreference = /* @__PURE__ */ __name(function getPreference2(S4, preference) {
        var p3 = null;
        if (preference === "median") {
          p3 = median(S4);
        } else if (preference === "mean") {
          p3 = mean(S4);
        } else if (preference === "min") {
          p3 = min5(S4);
        } else if (preference === "max") {
          p3 = max5(S4);
        } else {
          p3 = preference;
        }
        return p3;
      }, "getPreference");
      findExemplars = /* @__PURE__ */ __name(function findExemplars2(n2, R3, A2) {
        var indices = [];
        for (var i2 = 0; i2 < n2; i2++) {
          if (R3[i2 * n2 + i2] + A2[i2 * n2 + i2] > 0) {
            indices.push(i2);
          }
        }
        return indices;
      }, "findExemplars");
      assignClusters = /* @__PURE__ */ __name(function assignClusters2(n2, S4, exemplars) {
        var clusters = [];
        for (var i2 = 0; i2 < n2; i2++) {
          var index = -1;
          var max10 = -Infinity;
          for (var ei = 0; ei < exemplars.length; ei++) {
            var e3 = exemplars[ei];
            if (S4[i2 * n2 + e3] > max10) {
              index = e3;
              max10 = S4[i2 * n2 + e3];
            }
          }
          if (index > 0) {
            clusters.push(index);
          }
        }
        for (var _ei = 0; _ei < exemplars.length; _ei++) {
          clusters[exemplars[_ei]] = exemplars[_ei];
        }
        return clusters;
      }, "assignClusters");
      assign4 = /* @__PURE__ */ __name(function assign5(n2, S4, exemplars) {
        var clusters = assignClusters(n2, S4, exemplars);
        for (var ei = 0; ei < exemplars.length; ei++) {
          var ii = [];
          for (var c3 = 0; c3 < clusters.length; c3++) {
            if (clusters[c3] === exemplars[ei]) {
              ii.push(c3);
            }
          }
          var maxI = -1;
          var maxSum = -Infinity;
          for (var i2 = 0; i2 < ii.length; i2++) {
            var sum2 = 0;
            for (var j3 = 0; j3 < ii.length; j3++) {
              sum2 += S4[ii[j3] * n2 + ii[i2]];
            }
            if (sum2 > maxSum) {
              maxI = i2;
              maxSum = sum2;
            }
          }
          exemplars[ei] = ii[maxI];
        }
        clusters = assignClusters(n2, S4, exemplars);
        return clusters;
      }, "assign");
      affinityPropagation = /* @__PURE__ */ __name(function affinityPropagation2(options2) {
        var cy = this.cy();
        var nodes5 = this.nodes();
        var opts = setOptions4(options2);
        var id2position = {};
        for (var i2 = 0; i2 < nodes5.length; i2++) {
          id2position[nodes5[i2].id()] = i2;
        }
        var n2;
        var n22;
        var S4;
        var p3;
        var R3;
        var A2;
        n2 = nodes5.length;
        n22 = n2 * n2;
        S4 = new Array(n22);
        for (var _i = 0; _i < n22; _i++) {
          S4[_i] = -Infinity;
        }
        for (var _i2 = 0; _i2 < n2; _i2++) {
          for (var j3 = 0; j3 < n2; j3++) {
            if (_i2 !== j3) {
              S4[_i2 * n2 + j3] = getSimilarity2(opts.distance, nodes5[_i2], nodes5[j3], opts.attributes);
            }
          }
        }
        p3 = getPreference(S4, opts.preference);
        for (var _i3 = 0; _i3 < n2; _i3++) {
          S4[_i3 * n2 + _i3] = p3;
        }
        R3 = new Array(n22);
        for (var _i4 = 0; _i4 < n22; _i4++) {
          R3[_i4] = 0;
        }
        A2 = new Array(n22);
        for (var _i5 = 0; _i5 < n22; _i5++) {
          A2[_i5] = 0;
        }
        var old = new Array(n2);
        var Rp = new Array(n2);
        var se2 = new Array(n2);
        for (var _i6 = 0; _i6 < n2; _i6++) {
          old[_i6] = 0;
          Rp[_i6] = 0;
          se2[_i6] = 0;
        }
        var e3 = new Array(n2 * opts.minIterations);
        for (var _i7 = 0; _i7 < e3.length; _i7++) {
          e3[_i7] = 0;
        }
        var iter;
        for (iter = 0; iter < opts.maxIterations; iter++) {
          for (var _i8 = 0; _i8 < n2; _i8++) {
            var max10 = -Infinity, max22 = -Infinity, maxI = -1, AS = 0;
            for (var _j = 0; _j < n2; _j++) {
              old[_j] = R3[_i8 * n2 + _j];
              AS = A2[_i8 * n2 + _j] + S4[_i8 * n2 + _j];
              if (AS >= max10) {
                max22 = max10;
                max10 = AS;
                maxI = _j;
              } else if (AS > max22) {
                max22 = AS;
              }
            }
            for (var _j2 = 0; _j2 < n2; _j2++) {
              R3[_i8 * n2 + _j2] = (1 - opts.damping) * (S4[_i8 * n2 + _j2] - max10) + opts.damping * old[_j2];
            }
            R3[_i8 * n2 + maxI] = (1 - opts.damping) * (S4[_i8 * n2 + maxI] - max22) + opts.damping * old[maxI];
          }
          for (var _i9 = 0; _i9 < n2; _i9++) {
            var sum2 = 0;
            for (var _j3 = 0; _j3 < n2; _j3++) {
              old[_j3] = A2[_j3 * n2 + _i9];
              Rp[_j3] = Math.max(0, R3[_j3 * n2 + _i9]);
              sum2 += Rp[_j3];
            }
            sum2 -= Rp[_i9];
            Rp[_i9] = R3[_i9 * n2 + _i9];
            sum2 += Rp[_i9];
            for (var _j4 = 0; _j4 < n2; _j4++) {
              A2[_j4 * n2 + _i9] = (1 - opts.damping) * Math.min(0, sum2 - Rp[_j4]) + opts.damping * old[_j4];
            }
            A2[_i9 * n2 + _i9] = (1 - opts.damping) * (sum2 - Rp[_i9]) + opts.damping * old[_i9];
          }
          var K5 = 0;
          for (var _i10 = 0; _i10 < n2; _i10++) {
            var E3 = A2[_i10 * n2 + _i10] + R3[_i10 * n2 + _i10] > 0 ? 1 : 0;
            e3[iter % opts.minIterations * n2 + _i10] = E3;
            K5 += E3;
          }
          if (K5 > 0 && (iter >= opts.minIterations - 1 || iter == opts.maxIterations - 1)) {
            var _sum = 0;
            for (var _i11 = 0; _i11 < n2; _i11++) {
              se2[_i11] = 0;
              for (var _j5 = 0; _j5 < opts.minIterations; _j5++) {
                se2[_i11] += e3[_j5 * n2 + _i11];
              }
              if (se2[_i11] === 0 || se2[_i11] === opts.minIterations) {
                _sum++;
              }
            }
            if (_sum === n2) {
              break;
            }
          }
        }
        var exemplarsIndices = findExemplars(n2, R3, A2);
        var clusterIndices = assign4(n2, S4, exemplarsIndices);
        var clusters = {};
        for (var c3 = 0; c3 < exemplarsIndices.length; c3++) {
          clusters[exemplarsIndices[c3]] = [];
        }
        for (var _i12 = 0; _i12 < nodes5.length; _i12++) {
          var pos = id2position[nodes5[_i12].id()];
          var clusterIndex = clusterIndices[pos];
          if (clusterIndex != null) {
            clusters[clusterIndex].push(nodes5[_i12]);
          }
        }
        var retClusters = new Array(exemplarsIndices.length);
        for (var _c = 0; _c < exemplarsIndices.length; _c++) {
          retClusters[_c] = cy.collection(clusters[exemplarsIndices[_c]]);
        }
        return retClusters;
      }, "affinityPropagation");
      affinityPropagation$1 = {
        affinityPropagation,
        ap: affinityPropagation
      };
      hierholzerDefaults = defaults$g({
        root: void 0,
        directed: false
      });
      elesfn$k = {
        hierholzer: /* @__PURE__ */ __name(function hierholzer(options2) {
          if (!plainObject(options2)) {
            var args = arguments;
            options2 = {
              root: args[0],
              directed: args[1]
            };
          }
          var _hierholzerDefaults = hierholzerDefaults(options2), root3 = _hierholzerDefaults.root, directed = _hierholzerDefaults.directed;
          var eles = this;
          var dflag = false;
          var oddIn;
          var oddOut;
          var startVertex;
          if (root3) startVertex = string(root3) ? this.filter(root3)[0].id() : root3[0].id();
          var nodes5 = {};
          var edges3 = {};
          if (directed) {
            eles.forEach(function(ele) {
              var id34 = ele.id();
              if (ele.isNode()) {
                var ind = ele.indegree(true);
                var outd = ele.outdegree(true);
                var d1 = ind - outd;
                var d22 = outd - ind;
                if (d1 == 1) {
                  if (oddIn) dflag = true;
                  else oddIn = id34;
                } else if (d22 == 1) {
                  if (oddOut) dflag = true;
                  else oddOut = id34;
                } else if (d22 > 1 || d1 > 1) {
                  dflag = true;
                }
                nodes5[id34] = [];
                ele.outgoers().forEach(function(e3) {
                  if (e3.isEdge()) nodes5[id34].push(e3.id());
                });
              } else {
                edges3[id34] = [void 0, ele.target().id()];
              }
            });
          } else {
            eles.forEach(function(ele) {
              var id34 = ele.id();
              if (ele.isNode()) {
                var d4 = ele.degree(true);
                if (d4 % 2) {
                  if (!oddIn) oddIn = id34;
                  else if (!oddOut) oddOut = id34;
                  else dflag = true;
                }
                nodes5[id34] = [];
                ele.connectedEdges().forEach(function(e3) {
                  return nodes5[id34].push(e3.id());
                });
              } else {
                edges3[id34] = [ele.source().id(), ele.target().id()];
              }
            });
          }
          var result = {
            found: false,
            trail: void 0
          };
          if (dflag) return result;
          else if (oddOut && oddIn) {
            if (directed) {
              if (startVertex && oddOut != startVertex) {
                return result;
              }
              startVertex = oddOut;
            } else {
              if (startVertex && oddOut != startVertex && oddIn != startVertex) {
                return result;
              } else if (!startVertex) {
                startVertex = oddOut;
              }
            }
          } else {
            if (!startVertex) startVertex = eles[0].id();
          }
          var walk = /* @__PURE__ */ __name(function walk2(v3) {
            var currentNode = v3;
            var subtour2 = [v3];
            var adj, adjTail, adjHead;
            while (nodes5[currentNode].length) {
              adj = nodes5[currentNode].shift();
              adjTail = edges3[adj][0];
              adjHead = edges3[adj][1];
              if (currentNode != adjHead) {
                nodes5[adjHead] = nodes5[adjHead].filter(function(e3) {
                  return e3 != adj;
                });
                currentNode = adjHead;
              } else if (!directed && currentNode != adjTail) {
                nodes5[adjTail] = nodes5[adjTail].filter(function(e3) {
                  return e3 != adj;
                });
                currentNode = adjTail;
              }
              subtour2.unshift(adj);
              subtour2.unshift(currentNode);
            }
            return subtour2;
          }, "walk");
          var trail = [];
          var subtour = [];
          subtour = walk(startVertex);
          while (subtour.length != 1) {
            if (nodes5[subtour[0]].length == 0) {
              trail.unshift(eles.getElementById(subtour.shift()));
              trail.unshift(eles.getElementById(subtour.shift()));
            } else {
              subtour = walk(subtour.shift()).concat(subtour);
            }
          }
          trail.unshift(eles.getElementById(subtour.shift()));
          for (var d3 in nodes5) {
            if (nodes5[d3].length) {
              return result;
            }
          }
          result.found = true;
          result.trail = this.spawn(trail, true);
          return result;
        }, "hierholzer")
      };
      hopcroftTarjanBiconnected = /* @__PURE__ */ __name(function hopcroftTarjanBiconnected2() {
        var eles = this;
        var nodes5 = {};
        var id34 = 0;
        var edgeCount3 = 0;
        var components3 = [];
        var stack = [];
        var visitedEdges = {};
        var buildComponent = /* @__PURE__ */ __name(function buildComponent2(x5, y6) {
          var i2 = stack.length - 1;
          var cutset = [];
          var component2 = eles.spawn();
          while (stack[i2].x != x5 || stack[i2].y != y6) {
            cutset.push(stack.pop().edge);
            i2--;
          }
          cutset.push(stack.pop().edge);
          cutset.forEach(function(edge) {
            var connectedNodes = edge.connectedNodes().intersection(eles);
            component2.merge(edge);
            connectedNodes.forEach(function(node2) {
              var nodeId = node2.id();
              var connectedEdges = node2.connectedEdges().intersection(eles);
              component2.merge(node2);
              if (!nodes5[nodeId].cutVertex) {
                component2.merge(connectedEdges);
              } else {
                component2.merge(connectedEdges.filter(function(edge2) {
                  return edge2.isLoop();
                }));
              }
            });
          });
          components3.push(component2);
        }, "buildComponent");
        var _biconnectedSearch = /* @__PURE__ */ __name(function biconnectedSearch(root3, currentNode, parent4) {
          if (root3 === parent4) edgeCount3 += 1;
          nodes5[currentNode] = {
            id: id34,
            low: id34++,
            cutVertex: false
          };
          var edges3 = eles.getElementById(currentNode).connectedEdges().intersection(eles);
          if (edges3.size() === 0) {
            components3.push(eles.spawn(eles.getElementById(currentNode)));
          } else {
            var sourceId, targetId, otherNodeId, edgeId;
            edges3.forEach(function(edge) {
              sourceId = edge.source().id();
              targetId = edge.target().id();
              otherNodeId = sourceId === currentNode ? targetId : sourceId;
              if (otherNodeId !== parent4) {
                edgeId = edge.id();
                if (!visitedEdges[edgeId]) {
                  visitedEdges[edgeId] = true;
                  stack.push({
                    x: currentNode,
                    y: otherNodeId,
                    edge
                  });
                }
                if (!(otherNodeId in nodes5)) {
                  _biconnectedSearch(root3, otherNodeId, currentNode);
                  nodes5[currentNode].low = Math.min(nodes5[currentNode].low, nodes5[otherNodeId].low);
                  if (nodes5[currentNode].id <= nodes5[otherNodeId].low) {
                    nodes5[currentNode].cutVertex = true;
                    buildComponent(currentNode, otherNodeId);
                  }
                } else {
                  nodes5[currentNode].low = Math.min(nodes5[currentNode].low, nodes5[otherNodeId].id);
                }
              }
            });
          }
        }, "biconnectedSearch");
        eles.forEach(function(ele) {
          if (ele.isNode()) {
            var nodeId = ele.id();
            if (!(nodeId in nodes5)) {
              edgeCount3 = 0;
              _biconnectedSearch(nodeId, nodeId);
              nodes5[nodeId].cutVertex = edgeCount3 > 1;
            }
          }
        });
        var cutVertices = Object.keys(nodes5).filter(function(id35) {
          return nodes5[id35].cutVertex;
        }).map(function(id35) {
          return eles.getElementById(id35);
        });
        return {
          cut: eles.spawn(cutVertices),
          components: components3
        };
      }, "hopcroftTarjanBiconnected");
      hopcroftTarjanBiconnected$1 = {
        hopcroftTarjanBiconnected,
        htbc: hopcroftTarjanBiconnected,
        htb: hopcroftTarjanBiconnected,
        hopcroftTarjanBiconnectedComponents: hopcroftTarjanBiconnected
      };
      tarjanStronglyConnected = /* @__PURE__ */ __name(function tarjanStronglyConnected2() {
        var eles = this;
        var nodes5 = {};
        var index = 0;
        var components3 = [];
        var stack = [];
        var cut = eles.spawn(eles);
        var _stronglyConnectedSearch = /* @__PURE__ */ __name(function stronglyConnectedSearch(sourceNodeId) {
          stack.push(sourceNodeId);
          nodes5[sourceNodeId] = {
            index,
            low: index++,
            explored: false
          };
          var connectedEdges = eles.getElementById(sourceNodeId).connectedEdges().intersection(eles);
          connectedEdges.forEach(function(edge) {
            var targetNodeId = edge.target().id();
            if (targetNodeId !== sourceNodeId) {
              if (!(targetNodeId in nodes5)) {
                _stronglyConnectedSearch(targetNodeId);
              }
              if (!nodes5[targetNodeId].explored) {
                nodes5[sourceNodeId].low = Math.min(nodes5[sourceNodeId].low, nodes5[targetNodeId].low);
              }
            }
          });
          if (nodes5[sourceNodeId].index === nodes5[sourceNodeId].low) {
            var componentNodes = eles.spawn();
            for (; ; ) {
              var nodeId = stack.pop();
              componentNodes.merge(eles.getElementById(nodeId));
              nodes5[nodeId].low = nodes5[sourceNodeId].index;
              nodes5[nodeId].explored = true;
              if (nodeId === sourceNodeId) {
                break;
              }
            }
            var componentEdges = componentNodes.edgesWith(componentNodes);
            var component2 = componentNodes.merge(componentEdges);
            components3.push(component2);
            cut = cut.difference(component2);
          }
        }, "stronglyConnectedSearch");
        eles.forEach(function(ele) {
          if (ele.isNode()) {
            var nodeId = ele.id();
            if (!(nodeId in nodes5)) {
              _stronglyConnectedSearch(nodeId);
            }
          }
        });
        return {
          cut,
          components: components3
        };
      }, "tarjanStronglyConnected");
      tarjanStronglyConnected$1 = {
        tarjanStronglyConnected,
        tsc: tarjanStronglyConnected,
        tscc: tarjanStronglyConnected,
        tarjanStronglyConnectedComponents: tarjanStronglyConnected
      };
      elesfn$j = {};
      [elesfn$v, elesfn$u, elesfn$t, elesfn$s, elesfn$r, elesfn$q, elesfn$p, elesfn$o, elesfn$n, elesfn$m, elesfn$l, markovClustering$1, kClustering, hierarchicalClustering$1, affinityPropagation$1, elesfn$k, hopcroftTarjanBiconnected$1, tarjanStronglyConnected$1].forEach(function(props) {
        extend4(elesfn$j, props);
      });
      STATE_PENDING = 0;
      STATE_FULFILLED = 1;
      STATE_REJECTED = 2;
      _api = /* @__PURE__ */ __name(function api(executor) {
        if (!(this instanceof _api)) return new _api(executor);
        this.id = "Thenable/1.0.7";
        this.state = STATE_PENDING;
        this.fulfillValue = void 0;
        this.rejectReason = void 0;
        this.onFulfilled = [];
        this.onRejected = [];
        this.proxy = {
          then: this.then.bind(this)
        };
        if (typeof executor === "function") executor.call(this, this.fulfill.bind(this), this.reject.bind(this));
      }, "api");
      _api.prototype = {
        /*  promise resolving methods  */
        fulfill: /* @__PURE__ */ __name(function fulfill(value2) {
          return deliver(this, STATE_FULFILLED, "fulfillValue", value2);
        }, "fulfill"),
        reject: /* @__PURE__ */ __name(function reject2(value2) {
          return deliver(this, STATE_REJECTED, "rejectReason", value2);
        }, "reject"),
        /*  "The then Method" [Promises/A+ 1.1, 1.2, 2.2]  */
        then: /* @__PURE__ */ __name(function then(onFulfilled, onRejected) {
          var curr = this;
          var next3 = new _api();
          curr.onFulfilled.push(resolver(onFulfilled, next3, "fulfill"));
          curr.onRejected.push(resolver(onRejected, next3, "reject"));
          execute(curr);
          return next3.proxy;
        }, "then")
      };
      deliver = /* @__PURE__ */ __name(function deliver2(curr, state4, name, value2) {
        if (curr.state === STATE_PENDING) {
          curr.state = state4;
          curr[name] = value2;
          execute(curr);
        }
        return curr;
      }, "deliver");
      execute = /* @__PURE__ */ __name(function execute2(curr) {
        if (curr.state === STATE_FULFILLED) execute_handlers(curr, "onFulfilled", curr.fulfillValue);
        else if (curr.state === STATE_REJECTED) execute_handlers(curr, "onRejected", curr.rejectReason);
      }, "execute");
      execute_handlers = /* @__PURE__ */ __name(function execute_handlers2(curr, name, value2) {
        if (curr[name].length === 0) return;
        var handlers = curr[name];
        curr[name] = [];
        var func = /* @__PURE__ */ __name(function func2() {
          for (var i2 = 0; i2 < handlers.length; i2++) handlers[i2](value2);
        }, "func");
        if (typeof setImmediate === "function") setImmediate(func);
        else setTimeout(func, 0);
      }, "execute_handlers");
      resolver = /* @__PURE__ */ __name(function resolver2(cb, next3, method) {
        return function(value2) {
          if (typeof cb !== "function")
            next3[method].call(next3, value2);
          else {
            var result;
            try {
              result = cb(value2);
            } catch (e3) {
              next3.reject(e3);
              return;
            }
            _resolve(next3, result);
          }
        };
      }, "resolver");
      _resolve = /* @__PURE__ */ __name(function resolve(promise4, x5) {
        if (promise4 === x5 || promise4.proxy === x5) {
          promise4.reject(new TypeError("cannot resolve promise with itself"));
          return;
        }
        var then2;
        if (_typeof(x5) === "object" && x5 !== null || typeof x5 === "function") {
          try {
            then2 = x5.then;
          } catch (e3) {
            promise4.reject(e3);
            return;
          }
        }
        if (typeof then2 === "function") {
          var resolved = false;
          try {
            then2.call(
              x5,
              /*  resolvePromise  */
              /*  [Promises/A+ 2.3.3.3.1]  */
              function(y6) {
                if (resolved) return;
                resolved = true;
                if (y6 === x5)
                  promise4.reject(new TypeError("circular thenable chain"));
                else _resolve(promise4, y6);
              },
              /*  rejectPromise  */
              /*  [Promises/A+ 2.3.3.3.2]  */
              function(r2) {
                if (resolved) return;
                resolved = true;
                promise4.reject(r2);
              }
            );
          } catch (e3) {
            if (!resolved)
              promise4.reject(e3);
          }
          return;
        }
        promise4.fulfill(x5);
      }, "resolve");
      _api.all = function(ps) {
        return new _api(function(resolveAll, rejectAll) {
          var vals = new Array(ps.length);
          var doneCount = 0;
          var fulfill2 = /* @__PURE__ */ __name(function fulfill3(i3, val) {
            vals[i3] = val;
            doneCount++;
            if (doneCount === ps.length) {
              resolveAll(vals);
            }
          }, "fulfill");
          for (var i2 = 0; i2 < ps.length; i2++) {
            (function(i3) {
              var p3 = ps[i3];
              var isPromise = p3 != null && p3.then != null;
              if (isPromise) {
                p3.then(function(val2) {
                  fulfill2(i3, val2);
                }, function(err) {
                  rejectAll(err);
                });
              } else {
                var val = p3;
                fulfill2(i3, val);
              }
            })(i2);
          }
        });
      };
      _api.resolve = function(val) {
        return new _api(function(resolve2, reject3) {
          resolve2(val);
        });
      };
      _api.reject = function(val) {
        return new _api(function(resolve2, reject3) {
          reject3(val);
        });
      };
      Promise$1 = typeof Promise !== "undefined" ? Promise : _api;
      Animation = /* @__PURE__ */ __name(function Animation2(target, opts, opts2) {
        var isCore = core2(target);
        var isEle = !isCore;
        var _p = this._private = extend4({
          duration: 1e3
        }, opts, opts2);
        _p.target = target;
        _p.style = _p.style || _p.css;
        _p.started = false;
        _p.playing = false;
        _p.hooked = false;
        _p.applying = false;
        _p.progress = 0;
        _p.completes = [];
        _p.frames = [];
        if (_p.complete && fn$6(_p.complete)) {
          _p.completes.push(_p.complete);
        }
        if (isEle) {
          var pos = target.position();
          _p.startPosition = _p.startPosition || {
            x: pos.x,
            y: pos.y
          };
          _p.startStyle = _p.startStyle || target.cy().style().getAnimationStartStyle(target, _p.style);
        }
        if (isCore) {
          var pan2 = target.pan();
          _p.startPan = {
            x: pan2.x,
            y: pan2.y
          };
          _p.startZoom = target.zoom();
        }
        this.length = 1;
        this[0] = this;
      }, "Animation");
      anifn = Animation.prototype;
      extend4(anifn, {
        instanceString: /* @__PURE__ */ __name(function instanceString() {
          return "animation";
        }, "instanceString"),
        hook: /* @__PURE__ */ __name(function hook() {
          var _p = this._private;
          if (!_p.hooked) {
            var q3;
            var tAni = _p.target._private.animation;
            if (_p.queue) {
              q3 = tAni.queue;
            } else {
              q3 = tAni.current;
            }
            q3.push(this);
            if (elementOrCollection(_p.target)) {
              _p.target.cy().addToAnimationPool(_p.target);
            }
            _p.hooked = true;
          }
          return this;
        }, "hook"),
        play: /* @__PURE__ */ __name(function play() {
          var _p = this._private;
          if (_p.progress === 1) {
            _p.progress = 0;
          }
          _p.playing = true;
          _p.started = false;
          _p.stopped = false;
          this.hook();
          return this;
        }, "play"),
        playing: /* @__PURE__ */ __name(function playing() {
          return this._private.playing;
        }, "playing"),
        apply: /* @__PURE__ */ __name(function apply3() {
          var _p = this._private;
          _p.applying = true;
          _p.started = false;
          _p.stopped = false;
          this.hook();
          return this;
        }, "apply"),
        applying: /* @__PURE__ */ __name(function applying() {
          return this._private.applying;
        }, "applying"),
        pause: /* @__PURE__ */ __name(function pause() {
          var _p = this._private;
          _p.playing = false;
          _p.started = false;
          return this;
        }, "pause"),
        stop: /* @__PURE__ */ __name(function stop() {
          var _p = this._private;
          _p.playing = false;
          _p.started = false;
          _p.stopped = true;
          return this;
        }, "stop"),
        rewind: /* @__PURE__ */ __name(function rewind() {
          return this.progress(0);
        }, "rewind"),
        fastforward: /* @__PURE__ */ __name(function fastforward() {
          return this.progress(1);
        }, "fastforward"),
        time: /* @__PURE__ */ __name(function time3(t4) {
          var _p = this._private;
          if (t4 === void 0) {
            return _p.progress * _p.duration;
          } else {
            return this.progress(t4 / _p.duration);
          }
        }, "time"),
        progress: /* @__PURE__ */ __name(function progress(p3) {
          var _p = this._private;
          var wasPlaying = _p.playing;
          if (p3 === void 0) {
            return _p.progress;
          } else {
            if (wasPlaying) {
              this.pause();
            }
            _p.progress = p3;
            _p.started = false;
            if (wasPlaying) {
              this.play();
            }
          }
          return this;
        }, "progress"),
        completed: /* @__PURE__ */ __name(function completed() {
          return this._private.progress === 1;
        }, "completed"),
        reverse: /* @__PURE__ */ __name(function reverse() {
          var _p = this._private;
          var wasPlaying = _p.playing;
          if (wasPlaying) {
            this.pause();
          }
          _p.progress = 1 - _p.progress;
          _p.started = false;
          var swap = /* @__PURE__ */ __name(function swap2(a2, b3) {
            var _pa = _p[a2];
            if (_pa == null) {
              return;
            }
            _p[a2] = _p[b3];
            _p[b3] = _pa;
          }, "swap");
          swap("zoom", "startZoom");
          swap("pan", "startPan");
          swap("position", "startPosition");
          if (_p.style) {
            for (var i2 = 0; i2 < _p.style.length; i2++) {
              var prop = _p.style[i2];
              var name = prop.name;
              var startStyleProp = _p.startStyle[name];
              _p.startStyle[name] = prop;
              _p.style[i2] = startStyleProp;
            }
          }
          if (wasPlaying) {
            this.play();
          }
          return this;
        }, "reverse"),
        promise: /* @__PURE__ */ __name(function promise3(type3) {
          var _p = this._private;
          var arr;
          switch (type3) {
            case "frame":
              arr = _p.frames;
              break;
            default:
            case "complete":
            case "completed":
              arr = _p.completes;
          }
          return new Promise$1(function(resolve2, reject3) {
            arr.push(function() {
              resolve2();
            });
          });
        }, "promise")
      });
      anifn.complete = anifn.completed;
      anifn.run = anifn.play;
      anifn.running = anifn.playing;
      define$3 = {
        animated: /* @__PURE__ */ __name(function animated() {
          return /* @__PURE__ */ __name(function animatedImpl() {
            var self2 = this;
            var selfIsArrayLike = self2.length !== void 0;
            var all = selfIsArrayLike ? self2 : [self2];
            var cy = this._private.cy || this;
            if (!cy.styleEnabled()) {
              return false;
            }
            var ele = all[0];
            if (ele) {
              return ele._private.animation.current.length > 0;
            }
          }, "animatedImpl");
        }, "animated"),
        // animated
        clearQueue: /* @__PURE__ */ __name(function clearQueue() {
          return /* @__PURE__ */ __name(function clearQueueImpl() {
            var self2 = this;
            var selfIsArrayLike = self2.length !== void 0;
            var all = selfIsArrayLike ? self2 : [self2];
            var cy = this._private.cy || this;
            if (!cy.styleEnabled()) {
              return this;
            }
            for (var i2 = 0; i2 < all.length; i2++) {
              var ele = all[i2];
              ele._private.animation.queue = [];
            }
            return this;
          }, "clearQueueImpl");
        }, "clearQueue"),
        // clearQueue
        delay: /* @__PURE__ */ __name(function delay() {
          return /* @__PURE__ */ __name(function delayImpl(time4, complete) {
            var cy = this._private.cy || this;
            if (!cy.styleEnabled()) {
              return this;
            }
            return this.animate({
              delay: time4,
              duration: time4,
              complete
            });
          }, "delayImpl");
        }, "delay"),
        // delay
        delayAnimation: /* @__PURE__ */ __name(function delayAnimation() {
          return /* @__PURE__ */ __name(function delayAnimationImpl(time4, complete) {
            var cy = this._private.cy || this;
            if (!cy.styleEnabled()) {
              return this;
            }
            return this.animation({
              delay: time4,
              duration: time4,
              complete
            });
          }, "delayAnimationImpl");
        }, "delayAnimation"),
        // delay
        animation: /* @__PURE__ */ __name(function animation() {
          return /* @__PURE__ */ __name(function animationImpl(properties, params) {
            var self2 = this;
            var selfIsArrayLike = self2.length !== void 0;
            var all = selfIsArrayLike ? self2 : [self2];
            var cy = this._private.cy || this;
            var isCore = !selfIsArrayLike;
            var isEles = !isCore;
            if (!cy.styleEnabled()) {
              return this;
            }
            var style3 = cy.style();
            properties = extend4({}, properties, params);
            var propertiesEmpty = Object.keys(properties).length === 0;
            if (propertiesEmpty) {
              return new Animation(all[0], properties);
            }
            if (properties.duration === void 0) {
              properties.duration = 400;
            }
            switch (properties.duration) {
              case "slow":
                properties.duration = 600;
                break;
              case "fast":
                properties.duration = 200;
                break;
            }
            if (isEles) {
              properties.style = style3.getPropsList(properties.style || properties.css);
              properties.css = void 0;
            }
            if (isEles && properties.renderedPosition != null) {
              var rpos = properties.renderedPosition;
              var pan2 = cy.pan();
              var zoom2 = cy.zoom();
              properties.position = renderedToModelPosition(rpos, zoom2, pan2);
            }
            if (isCore && properties.panBy != null) {
              var panBy2 = properties.panBy;
              var cyPan = cy.pan();
              properties.pan = {
                x: cyPan.x + panBy2.x,
                y: cyPan.y + panBy2.y
              };
            }
            var center4 = properties.center || properties.centre;
            if (isCore && center4 != null) {
              var centerPan = cy.getCenterPan(center4.eles, properties.zoom);
              if (centerPan != null) {
                properties.pan = centerPan;
              }
            }
            if (isCore && properties.fit != null) {
              var fit2 = properties.fit;
              var fitVp = cy.getFitViewport(fit2.eles || fit2.boundingBox, fit2.padding);
              if (fitVp != null) {
                properties.pan = fitVp.pan;
                properties.zoom = fitVp.zoom;
              }
            }
            if (isCore && plainObject(properties.zoom)) {
              var vp = cy.getZoomedViewport(properties.zoom);
              if (vp != null) {
                if (vp.zoomed) {
                  properties.zoom = vp.zoom;
                }
                if (vp.panned) {
                  properties.pan = vp.pan;
                }
              } else {
                properties.zoom = null;
              }
            }
            return new Animation(all[0], properties);
          }, "animationImpl");
        }, "animation"),
        // animate
        animate: /* @__PURE__ */ __name(function animate() {
          return /* @__PURE__ */ __name(function animateImpl(properties, params) {
            var self2 = this;
            var selfIsArrayLike = self2.length !== void 0;
            var all = selfIsArrayLike ? self2 : [self2];
            var cy = this._private.cy || this;
            if (!cy.styleEnabled()) {
              return this;
            }
            if (params) {
              properties = extend4({}, properties, params);
            }
            for (var i2 = 0; i2 < all.length; i2++) {
              var ele = all[i2];
              var queue = ele.animated() && (properties.queue === void 0 || properties.queue);
              var ani = ele.animation(properties, queue ? {
                queue: true
              } : void 0);
              ani.play();
            }
            return this;
          }, "animateImpl");
        }, "animate"),
        // animate
        stop: /* @__PURE__ */ __name(function stop2() {
          return /* @__PURE__ */ __name(function stopImpl(clearQueue2, jumpToEnd) {
            var self2 = this;
            var selfIsArrayLike = self2.length !== void 0;
            var all = selfIsArrayLike ? self2 : [self2];
            var cy = this._private.cy || this;
            if (!cy.styleEnabled()) {
              return this;
            }
            for (var i2 = 0; i2 < all.length; i2++) {
              var ele = all[i2];
              var _p = ele._private;
              var anis = _p.animation.current;
              for (var j3 = 0; j3 < anis.length; j3++) {
                var ani = anis[j3];
                var ani_p = ani._private;
                if (jumpToEnd) {
                  ani_p.duration = 0;
                }
              }
              if (clearQueue2) {
                _p.animation.queue = [];
              }
              if (!jumpToEnd) {
                _p.animation.current = [];
              }
            }
            cy.notify("draw");
            return this;
          }, "stopImpl");
        }, "stop")
        // stop
      };
      __name(requireIsArray, "requireIsArray");
      __name(require_isKey, "require_isKey");
      __name(requireIsFunction, "requireIsFunction");
      __name(require_coreJsData, "require_coreJsData");
      __name(require_isMasked, "require_isMasked");
      __name(require_toSource, "require_toSource");
      __name(require_baseIsNative, "require_baseIsNative");
      __name(require_getValue, "require_getValue");
      __name(require_getNative, "require_getNative");
      __name(require_nativeCreate, "require_nativeCreate");
      __name(require_hashClear, "require_hashClear");
      __name(require_hashDelete, "require_hashDelete");
      __name(require_hashGet, "require_hashGet");
      __name(require_hashHas, "require_hashHas");
      __name(require_hashSet, "require_hashSet");
      __name(require_Hash, "require_Hash");
      __name(require_listCacheClear, "require_listCacheClear");
      __name(requireEq, "requireEq");
      __name(require_assocIndexOf, "require_assocIndexOf");
      __name(require_listCacheDelete, "require_listCacheDelete");
      __name(require_listCacheGet, "require_listCacheGet");
      __name(require_listCacheHas, "require_listCacheHas");
      __name(require_listCacheSet, "require_listCacheSet");
      __name(require_ListCache, "require_ListCache");
      __name(require_Map, "require_Map");
      __name(require_mapCacheClear, "require_mapCacheClear");
      __name(require_isKeyable, "require_isKeyable");
      __name(require_getMapData, "require_getMapData");
      __name(require_mapCacheDelete, "require_mapCacheDelete");
      __name(require_mapCacheGet, "require_mapCacheGet");
      __name(require_mapCacheHas, "require_mapCacheHas");
      __name(require_mapCacheSet, "require_mapCacheSet");
      __name(require_MapCache, "require_MapCache");
      __name(requireMemoize, "requireMemoize");
      __name(require_memoizeCapped, "require_memoizeCapped");
      __name(require_stringToPath, "require_stringToPath");
      __name(require_arrayMap, "require_arrayMap");
      __name(require_baseToString, "require_baseToString");
      __name(requireToString, "requireToString");
      __name(require_castPath, "require_castPath");
      __name(require_toKey, "require_toKey");
      __name(require_baseGet, "require_baseGet");
      __name(requireGet, "requireGet");
      getExports = requireGet();
      get4 = /* @__PURE__ */ getDefaultExportFromCjs(getExports);
      __name(require_defineProperty, "require_defineProperty");
      __name(require_baseAssignValue, "require_baseAssignValue");
      __name(require_assignValue, "require_assignValue");
      __name(require_isIndex, "require_isIndex");
      __name(require_baseSet, "require_baseSet");
      __name(requireSet, "requireSet");
      setExports = requireSet();
      set4 = /* @__PURE__ */ getDefaultExportFromCjs(setExports);
      __name(require_copyArray, "require_copyArray");
      __name(requireToPath, "requireToPath");
      toPathExports = requireToPath();
      toPath = /* @__PURE__ */ getDefaultExportFromCjs(toPathExports);
      define$2 = {
        // access data field
        data: /* @__PURE__ */ __name(function data(params) {
          var defaults4 = {
            field: "data",
            bindingEvent: "data",
            allowBinding: false,
            allowSetting: false,
            allowGetting: false,
            settingEvent: "data",
            settingTriggersEvent: false,
            triggerFnName: "trigger",
            immutableKeys: {},
            // key => true if immutable
            updateStyle: false,
            beforeGet: /* @__PURE__ */ __name(function beforeGet2(self2) {
            }, "beforeGet"),
            beforeSet: /* @__PURE__ */ __name(function beforeSet3(self2, obj) {
            }, "beforeSet"),
            onSet: /* @__PURE__ */ __name(function onSet3(self2) {
            }, "onSet"),
            canSet: /* @__PURE__ */ __name(function canSet2(self2) {
              return true;
            }, "canSet")
          };
          params = extend4({}, defaults4, params);
          return /* @__PURE__ */ __name(function dataImpl(name, value2) {
            var p3 = params;
            var self2 = this;
            var selfIsArrayLike = self2.length !== void 0;
            var all = selfIsArrayLike ? self2 : [self2];
            var single = selfIsArrayLike ? self2[0] : self2;
            if (string(name)) {
              var isPathLike = name.indexOf(".") !== -1;
              var path4 = isPathLike && toPath(name);
              if (p3.allowGetting && value2 === void 0) {
                var ret;
                if (single) {
                  p3.beforeGet(single);
                  if (path4 && single._private[p3.field][name] === void 0) {
                    ret = get4(single._private[p3.field], path4);
                  } else {
                    ret = single._private[p3.field][name];
                  }
                }
                return ret;
              } else if (p3.allowSetting && value2 !== void 0) {
                var valid2 = !p3.immutableKeys[name];
                if (valid2) {
                  var change2 = _defineProperty$1({}, name, value2);
                  p3.beforeSet(self2, change2);
                  for (var i2 = 0, l4 = all.length; i2 < l4; i2++) {
                    var ele = all[i2];
                    if (p3.canSet(ele)) {
                      if (path4 && single._private[p3.field][name] === void 0) {
                        set4(ele._private[p3.field], path4, value2);
                      } else {
                        ele._private[p3.field][name] = value2;
                      }
                    }
                  }
                  if (p3.updateStyle) {
                    self2.updateStyle();
                  }
                  p3.onSet(self2);
                  if (p3.settingTriggersEvent) {
                    self2[p3.triggerFnName](p3.settingEvent);
                  }
                }
              }
            } else if (p3.allowSetting && plainObject(name)) {
              var obj = name;
              var k2, v3;
              var keys2 = Object.keys(obj);
              p3.beforeSet(self2, obj);
              for (var _i = 0; _i < keys2.length; _i++) {
                k2 = keys2[_i];
                v3 = obj[k2];
                var _valid = !p3.immutableKeys[k2];
                if (_valid) {
                  for (var j3 = 0; j3 < all.length; j3++) {
                    var _ele = all[j3];
                    if (p3.canSet(_ele)) {
                      _ele._private[p3.field][k2] = v3;
                    }
                  }
                }
              }
              if (p3.updateStyle) {
                self2.updateStyle();
              }
              p3.onSet(self2);
              if (p3.settingTriggersEvent) {
                self2[p3.triggerFnName](p3.settingEvent);
              }
            } else if (p3.allowBinding && fn$6(name)) {
              var fn3 = name;
              self2.on(p3.bindingEvent, fn3);
            } else if (p3.allowGetting && name === void 0) {
              var _ret;
              if (single) {
                p3.beforeGet(single);
                _ret = single._private[p3.field];
              }
              return _ret;
            }
            return self2;
          }, "dataImpl");
        }, "data"),
        // data
        // remove data field
        removeData: /* @__PURE__ */ __name(function removeData(params) {
          var defaults4 = {
            field: "data",
            event: "data",
            triggerFnName: "trigger",
            triggerEvent: false,
            immutableKeys: {}
            // key => true if immutable
          };
          params = extend4({}, defaults4, params);
          return /* @__PURE__ */ __name(function removeDataImpl(names) {
            var p3 = params;
            var self2 = this;
            var selfIsArrayLike = self2.length !== void 0;
            var all = selfIsArrayLike ? self2 : [self2];
            if (string(names)) {
              var keys2 = names.split(/\s+/);
              var l4 = keys2.length;
              for (var i2 = 0; i2 < l4; i2++) {
                var key = keys2[i2];
                if (emptyString(key)) {
                  continue;
                }
                var valid2 = !p3.immutableKeys[key];
                if (valid2) {
                  for (var i_a = 0, l_a = all.length; i_a < l_a; i_a++) {
                    all[i_a]._private[p3.field][key] = void 0;
                  }
                }
              }
              if (p3.triggerEvent) {
                self2[p3.triggerFnName](p3.event);
              }
            } else if (names === void 0) {
              for (var _i_a = 0, _l_a = all.length; _i_a < _l_a; _i_a++) {
                var _privateFields = all[_i_a]._private[p3.field];
                var _keys = Object.keys(_privateFields);
                for (var _i2 = 0; _i2 < _keys.length; _i2++) {
                  var _key = _keys[_i2];
                  var validKeyToDelete = !p3.immutableKeys[_key];
                  if (validKeyToDelete) {
                    _privateFields[_key] = void 0;
                  }
                }
              }
              if (p3.triggerEvent) {
                self2[p3.triggerFnName](p3.event);
              }
            }
            return self2;
          }, "removeDataImpl");
        }, "removeData")
        // removeData
      };
      define$1 = {
        eventAliasesOn: /* @__PURE__ */ __name(function eventAliasesOn(proto) {
          var p3 = proto;
          p3.addListener = p3.listen = p3.bind = p3.on;
          p3.unlisten = p3.unbind = p3.off = p3.removeListener;
          p3.trigger = p3.emit;
          p3.pon = p3.promiseOn = function(events, selector) {
            var self2 = this;
            var args = Array.prototype.slice.call(arguments, 0);
            return new Promise$1(function(resolve2, reject3) {
              var callback = /* @__PURE__ */ __name(function callback2(e3) {
                self2.off.apply(self2, offArgs);
                resolve2(e3);
              }, "callback");
              var onArgs = args.concat([callback]);
              var offArgs = onArgs.concat([]);
              self2.on.apply(self2, onArgs);
            });
          };
        }, "eventAliasesOn")
      };
      define2 = {};
      [define$3, define$2, define$1].forEach(function(m3) {
        extend4(define2, m3);
      });
      elesfn$i = {
        animate: define2.animate(),
        animation: define2.animation(),
        animated: define2.animated(),
        clearQueue: define2.clearQueue(),
        delay: define2.delay(),
        delayAnimation: define2.delayAnimation(),
        stop: define2.stop()
      };
      elesfn$h = {
        classes: /* @__PURE__ */ __name(function classes(_classes) {
          var self2 = this;
          if (_classes === void 0) {
            var ret = [];
            self2[0]._private.classes.forEach(function(cls2) {
              return ret.push(cls2);
            });
            return ret;
          } else if (!array2(_classes)) {
            _classes = (_classes || "").match(/\S+/g) || [];
          }
          var changed = [];
          var classesSet = new Set$1(_classes);
          for (var j3 = 0; j3 < self2.length; j3++) {
            var ele = self2[j3];
            var _p = ele._private;
            var eleClasses = _p.classes;
            var changedEle = false;
            for (var i2 = 0; i2 < _classes.length; i2++) {
              var cls = _classes[i2];
              var eleHasClass = eleClasses.has(cls);
              if (!eleHasClass) {
                changedEle = true;
                break;
              }
            }
            if (!changedEle) {
              changedEle = eleClasses.size !== _classes.length;
            }
            if (changedEle) {
              _p.classes = classesSet;
              changed.push(ele);
            }
          }
          if (changed.length > 0) {
            this.spawn(changed).updateStyle().emit("class");
          }
          return self2;
        }, "classes"),
        addClass: /* @__PURE__ */ __name(function addClass(classes3) {
          return this.toggleClass(classes3, true);
        }, "addClass"),
        hasClass: /* @__PURE__ */ __name(function hasClass(className) {
          var ele = this[0];
          return ele != null && ele._private.classes.has(className);
        }, "hasClass"),
        toggleClass: /* @__PURE__ */ __name(function toggleClass(classes3, toggle) {
          if (!array2(classes3)) {
            classes3 = classes3.match(/\S+/g) || [];
          }
          var self2 = this;
          var toggleUndefd = toggle === void 0;
          var changed = [];
          for (var i2 = 0, il = self2.length; i2 < il; i2++) {
            var ele = self2[i2];
            var eleClasses = ele._private.classes;
            var changedEle = false;
            for (var j3 = 0; j3 < classes3.length; j3++) {
              var cls = classes3[j3];
              var hasClass2 = eleClasses.has(cls);
              var changedNow = false;
              if (toggle || toggleUndefd && !hasClass2) {
                eleClasses.add(cls);
                changedNow = true;
              } else if (!toggle || toggleUndefd && hasClass2) {
                eleClasses["delete"](cls);
                changedNow = true;
              }
              if (!changedEle && changedNow) {
                changed.push(ele);
                changedEle = true;
              }
            }
          }
          if (changed.length > 0) {
            this.spawn(changed).updateStyle().emit("class");
          }
          return self2;
        }, "toggleClass"),
        removeClass: /* @__PURE__ */ __name(function removeClass(classes3) {
          return this.toggleClass(classes3, false);
        }, "removeClass"),
        flashClass: /* @__PURE__ */ __name(function flashClass(classes3, duration) {
          var self2 = this;
          if (duration == null) {
            duration = 250;
          } else if (duration === 0) {
            return self2;
          }
          self2.addClass(classes3);
          setTimeout(function() {
            self2.removeClass(classes3);
          }, duration);
          return self2;
        }, "flashClass")
      };
      elesfn$h.className = elesfn$h.classNames = elesfn$h.classes;
      tokens = {
        metaChar: "[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",
        // chars we need to escape in let names, etc
        comparatorOp: "=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",
        // binary comparison op (used in data selectors)
        boolOp: "\\?|\\!|\\^",
        // boolean (unary) operators (used in data selectors)
        string: `"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,
        // string literals (used in data selectors) -- doublequotes | singlequotes
        number: number6,
        // number literal (used in data selectors) --- e.g. 0.1234, 1234, 12e123
        meta: "degree|indegree|outdegree",
        // allowed metadata fields (i.e. allowed functions to use from Collection)
        separator: "\\s*,\\s*",
        // queries are separated by commas, e.g. edge[foo = 'bar'], node.someClass
        descendant: "\\s+",
        child: "\\s+>\\s+",
        subject: "\\$",
        group: "node|edge|\\*",
        directedEdge: "\\s+->\\s+",
        undirectedEdge: "\\s+<->\\s+"
      };
      tokens.variable = "(?:[\\w-.]|(?:\\\\" + tokens.metaChar + "))+";
      tokens.className = "(?:[\\w-]|(?:\\\\" + tokens.metaChar + "))+";
      tokens.value = tokens.string + "|" + tokens.number;
      tokens.id = tokens.variable;
      (function() {
        var ops, op2, i2;
        ops = tokens.comparatorOp.split("|");
        for (i2 = 0; i2 < ops.length; i2++) {
          op2 = ops[i2];
          tokens.comparatorOp += "|@" + op2;
        }
        ops = tokens.comparatorOp.split("|");
        for (i2 = 0; i2 < ops.length; i2++) {
          op2 = ops[i2];
          if (op2.indexOf("!") >= 0) {
            continue;
          }
          if (op2 === "=") {
            continue;
          }
          tokens.comparatorOp += "|\\!" + op2;
        }
      })();
      newQuery = /* @__PURE__ */ __name(function newQuery2() {
        return {
          checks: []
        };
      }, "newQuery");
      Type2 = {
        /** E.g. node */
        GROUP: 0,
        /** A collection of elements */
        COLLECTION: 1,
        /** A filter(ele) function */
        FILTER: 2,
        /** E.g. [foo > 1] */
        DATA_COMPARE: 3,
        /** E.g. [foo] */
        DATA_EXIST: 4,
        /** E.g. [?foo] */
        DATA_BOOL: 5,
        /** E.g. [[degree > 2]] */
        META_COMPARE: 6,
        /** E.g. :selected */
        STATE: 7,
        /** E.g. #foo */
        ID: 8,
        /** E.g. .foo */
        CLASS: 9,
        /** E.g. #foo <-> #bar */
        UNDIRECTED_EDGE: 10,
        /** E.g. #foo -> #bar */
        DIRECTED_EDGE: 11,
        /** E.g. $#foo -> #bar */
        NODE_SOURCE: 12,
        /** E.g. #foo -> $#bar */
        NODE_TARGET: 13,
        /** E.g. $#foo <-> #bar */
        NODE_NEIGHBOR: 14,
        /** E.g. #foo > #bar */
        CHILD: 15,
        /** E.g. #foo #bar */
        DESCENDANT: 16,
        /** E.g. $#foo > #bar */
        PARENT: 17,
        /** E.g. $#foo #bar */
        ANCESTOR: 18,
        /** E.g. #foo > $bar > #baz */
        COMPOUND_SPLIT: 19,
        /** Always matches, useful placeholder for subject in `COMPOUND_SPLIT` */
        TRUE: 20
      };
      stateSelectors = [{
        selector: ":selected",
        matches: /* @__PURE__ */ __name(function matches(ele) {
          return ele.selected();
        }, "matches")
      }, {
        selector: ":unselected",
        matches: /* @__PURE__ */ __name(function matches2(ele) {
          return !ele.selected();
        }, "matches")
      }, {
        selector: ":selectable",
        matches: /* @__PURE__ */ __name(function matches3(ele) {
          return ele.selectable();
        }, "matches")
      }, {
        selector: ":unselectable",
        matches: /* @__PURE__ */ __name(function matches4(ele) {
          return !ele.selectable();
        }, "matches")
      }, {
        selector: ":locked",
        matches: /* @__PURE__ */ __name(function matches5(ele) {
          return ele.locked();
        }, "matches")
      }, {
        selector: ":unlocked",
        matches: /* @__PURE__ */ __name(function matches6(ele) {
          return !ele.locked();
        }, "matches")
      }, {
        selector: ":visible",
        matches: /* @__PURE__ */ __name(function matches7(ele) {
          return ele.visible();
        }, "matches")
      }, {
        selector: ":hidden",
        matches: /* @__PURE__ */ __name(function matches8(ele) {
          return !ele.visible();
        }, "matches")
      }, {
        selector: ":transparent",
        matches: /* @__PURE__ */ __name(function matches9(ele) {
          return ele.transparent();
        }, "matches")
      }, {
        selector: ":grabbed",
        matches: /* @__PURE__ */ __name(function matches10(ele) {
          return ele.grabbed();
        }, "matches")
      }, {
        selector: ":free",
        matches: /* @__PURE__ */ __name(function matches11(ele) {
          return !ele.grabbed();
        }, "matches")
      }, {
        selector: ":removed",
        matches: /* @__PURE__ */ __name(function matches12(ele) {
          return ele.removed();
        }, "matches")
      }, {
        selector: ":inside",
        matches: /* @__PURE__ */ __name(function matches13(ele) {
          return !ele.removed();
        }, "matches")
      }, {
        selector: ":grabbable",
        matches: /* @__PURE__ */ __name(function matches14(ele) {
          return ele.grabbable();
        }, "matches")
      }, {
        selector: ":ungrabbable",
        matches: /* @__PURE__ */ __name(function matches15(ele) {
          return !ele.grabbable();
        }, "matches")
      }, {
        selector: ":animated",
        matches: /* @__PURE__ */ __name(function matches16(ele) {
          return ele.animated();
        }, "matches")
      }, {
        selector: ":unanimated",
        matches: /* @__PURE__ */ __name(function matches17(ele) {
          return !ele.animated();
        }, "matches")
      }, {
        selector: ":parent",
        matches: /* @__PURE__ */ __name(function matches18(ele) {
          return ele.isParent();
        }, "matches")
      }, {
        selector: ":childless",
        matches: /* @__PURE__ */ __name(function matches19(ele) {
          return ele.isChildless();
        }, "matches")
      }, {
        selector: ":child",
        matches: /* @__PURE__ */ __name(function matches20(ele) {
          return ele.isChild();
        }, "matches")
      }, {
        selector: ":orphan",
        matches: /* @__PURE__ */ __name(function matches21(ele) {
          return ele.isOrphan();
        }, "matches")
      }, {
        selector: ":nonorphan",
        matches: /* @__PURE__ */ __name(function matches22(ele) {
          return ele.isChild();
        }, "matches")
      }, {
        selector: ":compound",
        matches: /* @__PURE__ */ __name(function matches23(ele) {
          if (ele.isNode()) {
            return ele.isParent();
          } else {
            return ele.source().isParent() || ele.target().isParent();
          }
        }, "matches")
      }, {
        selector: ":loop",
        matches: /* @__PURE__ */ __name(function matches24(ele) {
          return ele.isLoop();
        }, "matches")
      }, {
        selector: ":simple",
        matches: /* @__PURE__ */ __name(function matches25(ele) {
          return ele.isSimple();
        }, "matches")
      }, {
        selector: ":active",
        matches: /* @__PURE__ */ __name(function matches26(ele) {
          return ele.active();
        }, "matches")
      }, {
        selector: ":inactive",
        matches: /* @__PURE__ */ __name(function matches27(ele) {
          return !ele.active();
        }, "matches")
      }, {
        selector: ":backgrounding",
        matches: /* @__PURE__ */ __name(function matches28(ele) {
          return ele.backgrounding();
        }, "matches")
      }, {
        selector: ":nonbackgrounding",
        matches: /* @__PURE__ */ __name(function matches29(ele) {
          return !ele.backgrounding();
        }, "matches")
      }].sort(function(a2, b3) {
        return descending2(a2.selector, b3.selector);
      });
      lookup = (function() {
        var selToFn = {};
        var s2;
        for (var i2 = 0; i2 < stateSelectors.length; i2++) {
          s2 = stateSelectors[i2];
          selToFn[s2.selector] = s2.matches;
        }
        return selToFn;
      })();
      stateSelectorMatches = /* @__PURE__ */ __name(function stateSelectorMatches2(sel, ele) {
        return lookup[sel](ele);
      }, "stateSelectorMatches");
      stateSelectorRegex = "(" + stateSelectors.map(function(s2) {
        return s2.selector;
      }).join("|") + ")";
      cleanMetaChars = /* @__PURE__ */ __name(function cleanMetaChars2(str2) {
        return str2.replace(new RegExp("\\\\(" + tokens.metaChar + ")", "g"), function(match2, $1) {
          return $1;
        });
      }, "cleanMetaChars");
      replaceLastQuery = /* @__PURE__ */ __name(function replaceLastQuery2(selector, examiningQuery, replacementQuery) {
        selector[selector.length - 1] = replacementQuery;
      }, "replaceLastQuery");
      exprs = [{
        name: "group",
        // just used for identifying when debugging
        query: true,
        regex: "(" + tokens.group + ")",
        populate: /* @__PURE__ */ __name(function populate(selector, query, _ref) {
          var _ref2 = _slicedToArray(_ref, 1), group2 = _ref2[0];
          query.checks.push({
            type: Type2.GROUP,
            value: group2 === "*" ? group2 : group2 + "s"
          });
        }, "populate")
      }, {
        name: "state",
        query: true,
        regex: stateSelectorRegex,
        populate: /* @__PURE__ */ __name(function populate2(selector, query, _ref3) {
          var _ref4 = _slicedToArray(_ref3, 1), state4 = _ref4[0];
          query.checks.push({
            type: Type2.STATE,
            value: state4
          });
        }, "populate")
      }, {
        name: "id",
        query: true,
        regex: "\\#(" + tokens.id + ")",
        populate: /* @__PURE__ */ __name(function populate3(selector, query, _ref5) {
          var _ref6 = _slicedToArray(_ref5, 1), id34 = _ref6[0];
          query.checks.push({
            type: Type2.ID,
            value: cleanMetaChars(id34)
          });
        }, "populate")
      }, {
        name: "className",
        query: true,
        regex: "\\.(" + tokens.className + ")",
        populate: /* @__PURE__ */ __name(function populate4(selector, query, _ref7) {
          var _ref8 = _slicedToArray(_ref7, 1), className = _ref8[0];
          query.checks.push({
            type: Type2.CLASS,
            value: cleanMetaChars(className)
          });
        }, "populate")
      }, {
        name: "dataExists",
        query: true,
        regex: "\\[\\s*(" + tokens.variable + ")\\s*\\]",
        populate: /* @__PURE__ */ __name(function populate5(selector, query, _ref9) {
          var _ref10 = _slicedToArray(_ref9, 1), variable = _ref10[0];
          query.checks.push({
            type: Type2.DATA_EXIST,
            field: cleanMetaChars(variable)
          });
        }, "populate")
      }, {
        name: "dataCompare",
        query: true,
        regex: "\\[\\s*(" + tokens.variable + ")\\s*(" + tokens.comparatorOp + ")\\s*(" + tokens.value + ")\\s*\\]",
        populate: /* @__PURE__ */ __name(function populate6(selector, query, _ref11) {
          var _ref12 = _slicedToArray(_ref11, 3), variable = _ref12[0], comparatorOp = _ref12[1], value2 = _ref12[2];
          var valueIsString = new RegExp("^" + tokens.string + "$").exec(value2) != null;
          if (valueIsString) {
            value2 = value2.substring(1, value2.length - 1);
          } else {
            value2 = parseFloat(value2);
          }
          query.checks.push({
            type: Type2.DATA_COMPARE,
            field: cleanMetaChars(variable),
            operator: comparatorOp,
            value: value2
          });
        }, "populate")
      }, {
        name: "dataBool",
        query: true,
        regex: "\\[\\s*(" + tokens.boolOp + ")\\s*(" + tokens.variable + ")\\s*\\]",
        populate: /* @__PURE__ */ __name(function populate7(selector, query, _ref13) {
          var _ref14 = _slicedToArray(_ref13, 2), boolOp = _ref14[0], variable = _ref14[1];
          query.checks.push({
            type: Type2.DATA_BOOL,
            field: cleanMetaChars(variable),
            operator: boolOp
          });
        }, "populate")
      }, {
        name: "metaCompare",
        query: true,
        regex: "\\[\\[\\s*(" + tokens.meta + ")\\s*(" + tokens.comparatorOp + ")\\s*(" + tokens.number + ")\\s*\\]\\]",
        populate: /* @__PURE__ */ __name(function populate8(selector, query, _ref15) {
          var _ref16 = _slicedToArray(_ref15, 3), meta3 = _ref16[0], comparatorOp = _ref16[1], number7 = _ref16[2];
          query.checks.push({
            type: Type2.META_COMPARE,
            field: cleanMetaChars(meta3),
            operator: comparatorOp,
            value: parseFloat(number7)
          });
        }, "populate")
      }, {
        name: "nextQuery",
        separator: true,
        regex: tokens.separator,
        populate: /* @__PURE__ */ __name(function populate9(selector, query) {
          var currentSubject = selector.currentSubject;
          var edgeCount3 = selector.edgeCount;
          var compoundCount = selector.compoundCount;
          var lastQ = selector[selector.length - 1];
          if (currentSubject != null) {
            lastQ.subject = currentSubject;
            selector.currentSubject = null;
          }
          lastQ.edgeCount = edgeCount3;
          lastQ.compoundCount = compoundCount;
          selector.edgeCount = 0;
          selector.compoundCount = 0;
          var nextQuery = selector[selector.length++] = newQuery();
          return nextQuery;
        }, "populate")
      }, {
        name: "directedEdge",
        separator: true,
        regex: tokens.directedEdge,
        populate: /* @__PURE__ */ __name(function populate10(selector, query) {
          if (selector.currentSubject == null) {
            var edgeQuery = newQuery();
            var source = query;
            var target = newQuery();
            edgeQuery.checks.push({
              type: Type2.DIRECTED_EDGE,
              source,
              target
            });
            replaceLastQuery(selector, query, edgeQuery);
            selector.edgeCount++;
            return target;
          } else {
            var srcTgtQ = newQuery();
            var _source = query;
            var _target = newQuery();
            srcTgtQ.checks.push({
              type: Type2.NODE_SOURCE,
              source: _source,
              target: _target
            });
            replaceLastQuery(selector, query, srcTgtQ);
            selector.edgeCount++;
            return _target;
          }
        }, "populate")
      }, {
        name: "undirectedEdge",
        separator: true,
        regex: tokens.undirectedEdge,
        populate: /* @__PURE__ */ __name(function populate11(selector, query) {
          if (selector.currentSubject == null) {
            var edgeQuery = newQuery();
            var source = query;
            var target = newQuery();
            edgeQuery.checks.push({
              type: Type2.UNDIRECTED_EDGE,
              nodes: [source, target]
            });
            replaceLastQuery(selector, query, edgeQuery);
            selector.edgeCount++;
            return target;
          } else {
            var nhoodQ = newQuery();
            var node2 = query;
            var neighbor = newQuery();
            nhoodQ.checks.push({
              type: Type2.NODE_NEIGHBOR,
              node: node2,
              neighbor
            });
            replaceLastQuery(selector, query, nhoodQ);
            return neighbor;
          }
        }, "populate")
      }, {
        name: "child",
        separator: true,
        regex: tokens.child,
        populate: /* @__PURE__ */ __name(function populate12(selector, query) {
          if (selector.currentSubject == null) {
            var parentChildQuery = newQuery();
            var child = newQuery();
            var parent4 = selector[selector.length - 1];
            parentChildQuery.checks.push({
              type: Type2.CHILD,
              parent: parent4,
              child
            });
            replaceLastQuery(selector, query, parentChildQuery);
            selector.compoundCount++;
            return child;
          } else if (selector.currentSubject === query) {
            var compound = newQuery();
            var left3 = selector[selector.length - 1];
            var right3 = newQuery();
            var subject = newQuery();
            var _child = newQuery();
            var _parent = newQuery();
            compound.checks.push({
              type: Type2.COMPOUND_SPLIT,
              left: left3,
              right: right3,
              subject
            });
            subject.checks = query.checks;
            query.checks = [{
              type: Type2.TRUE
            }];
            _parent.checks.push({
              type: Type2.TRUE
            });
            right3.checks.push({
              type: Type2.PARENT,
              // type is swapped on right side queries
              parent: _parent,
              child: _child
              // empty for now
            });
            replaceLastQuery(selector, left3, compound);
            selector.currentSubject = subject;
            selector.compoundCount++;
            return _child;
          } else {
            var _parent2 = newQuery();
            var _child2 = newQuery();
            var pcQChecks = [{
              type: Type2.PARENT,
              parent: _parent2,
              child: _child2
            }];
            _parent2.checks = query.checks;
            query.checks = pcQChecks;
            selector.compoundCount++;
            return _child2;
          }
        }, "populate")
      }, {
        name: "descendant",
        separator: true,
        regex: tokens.descendant,
        populate: /* @__PURE__ */ __name(function populate13(selector, query) {
          if (selector.currentSubject == null) {
            var ancChQuery = newQuery();
            var descendant = newQuery();
            var ancestor = selector[selector.length - 1];
            ancChQuery.checks.push({
              type: Type2.DESCENDANT,
              ancestor,
              descendant
            });
            replaceLastQuery(selector, query, ancChQuery);
            selector.compoundCount++;
            return descendant;
          } else if (selector.currentSubject === query) {
            var compound = newQuery();
            var left3 = selector[selector.length - 1];
            var right3 = newQuery();
            var subject = newQuery();
            var _descendant = newQuery();
            var _ancestor = newQuery();
            compound.checks.push({
              type: Type2.COMPOUND_SPLIT,
              left: left3,
              right: right3,
              subject
            });
            subject.checks = query.checks;
            query.checks = [{
              type: Type2.TRUE
            }];
            _ancestor.checks.push({
              type: Type2.TRUE
            });
            right3.checks.push({
              type: Type2.ANCESTOR,
              // type is swapped on right side queries
              ancestor: _ancestor,
              descendant: _descendant
              // empty for now
            });
            replaceLastQuery(selector, left3, compound);
            selector.currentSubject = subject;
            selector.compoundCount++;
            return _descendant;
          } else {
            var _ancestor2 = newQuery();
            var _descendant2 = newQuery();
            var adQChecks = [{
              type: Type2.ANCESTOR,
              ancestor: _ancestor2,
              descendant: _descendant2
            }];
            _ancestor2.checks = query.checks;
            query.checks = adQChecks;
            selector.compoundCount++;
            return _descendant2;
          }
        }, "populate")
      }, {
        name: "subject",
        modifier: true,
        regex: tokens.subject,
        populate: /* @__PURE__ */ __name(function populate14(selector, query) {
          if (selector.currentSubject != null && selector.currentSubject !== query) {
            warn("Redefinition of subject in selector `" + selector.toString() + "`");
            return false;
          }
          selector.currentSubject = query;
          var topQ = selector[selector.length - 1];
          var topChk = topQ.checks[0];
          var topType = topChk == null ? null : topChk.type;
          if (topType === Type2.DIRECTED_EDGE) {
            topChk.type = Type2.NODE_TARGET;
          } else if (topType === Type2.UNDIRECTED_EDGE) {
            topChk.type = Type2.NODE_NEIGHBOR;
            topChk.node = topChk.nodes[1];
            topChk.neighbor = topChk.nodes[0];
            topChk.nodes = null;
          }
        }, "populate")
      }];
      exprs.forEach(function(e3) {
        return e3.regexObj = new RegExp("^" + e3.regex);
      });
      consumeExpr = /* @__PURE__ */ __name(function consumeExpr2(remaining) {
        var expr;
        var match2;
        var name;
        for (var j3 = 0; j3 < exprs.length; j3++) {
          var e3 = exprs[j3];
          var n2 = e3.name;
          var m3 = remaining.match(e3.regexObj);
          if (m3 != null) {
            match2 = m3;
            expr = e3;
            name = n2;
            var consumed = m3[0];
            remaining = remaining.substring(consumed.length);
            break;
          }
        }
        return {
          expr,
          match: match2,
          name,
          remaining
        };
      }, "consumeExpr");
      consumeWhitespace = /* @__PURE__ */ __name(function consumeWhitespace2(remaining) {
        var match2 = remaining.match(/^\s+/);
        if (match2) {
          var consumed = match2[0];
          remaining = remaining.substring(consumed.length);
        }
        return remaining;
      }, "consumeWhitespace");
      parse = /* @__PURE__ */ __name(function parse2(selector) {
        var self2 = this;
        var remaining = self2.inputText = selector;
        var currentQuery = self2[0] = newQuery();
        self2.length = 1;
        remaining = consumeWhitespace(remaining);
        for (; ; ) {
          var exprInfo = consumeExpr(remaining);
          if (exprInfo.expr == null) {
            warn("The selector `" + selector + "`is invalid");
            return false;
          } else {
            var args = exprInfo.match.slice(1);
            var ret = exprInfo.expr.populate(self2, currentQuery, args);
            if (ret === false) {
              return false;
            } else if (ret != null) {
              currentQuery = ret;
            }
          }
          remaining = exprInfo.remaining;
          if (remaining.match(/^\s*$/)) {
            break;
          }
        }
        var lastQ = self2[self2.length - 1];
        if (self2.currentSubject != null) {
          lastQ.subject = self2.currentSubject;
        }
        lastQ.edgeCount = self2.edgeCount;
        lastQ.compoundCount = self2.compoundCount;
        for (var i2 = 0; i2 < self2.length; i2++) {
          var q3 = self2[i2];
          if (q3.compoundCount > 0 && q3.edgeCount > 0) {
            warn("The selector `" + selector + "` is invalid because it uses both a compound selector and an edge selector");
            return false;
          }
          if (q3.edgeCount > 1) {
            warn("The selector `" + selector + "` is invalid because it uses multiple edge selectors");
            return false;
          } else if (q3.edgeCount === 1) {
            warn("The selector `" + selector + "` is deprecated.  Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons.  Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.");
          }
        }
        return true;
      }, "parse");
      toString3 = /* @__PURE__ */ __name(function toString4() {
        if (this.toStringCache != null) {
          return this.toStringCache;
        }
        var clean = /* @__PURE__ */ __name(function clean2(obj) {
          if (obj == null) {
            return "";
          } else {
            return obj;
          }
        }, "clean");
        var cleanVal = /* @__PURE__ */ __name(function cleanVal2(val) {
          if (string(val)) {
            return '"' + val + '"';
          } else {
            return clean(val);
          }
        }, "cleanVal");
        var space = /* @__PURE__ */ __name(function space2(val) {
          return " " + val + " ";
        }, "space");
        var checkToString = /* @__PURE__ */ __name(function checkToString2(check, subject) {
          var type3 = check.type, value2 = check.value;
          switch (type3) {
            case Type2.GROUP: {
              var group2 = clean(value2);
              return group2.substring(0, group2.length - 1);
            }
            case Type2.DATA_COMPARE: {
              var field = check.field, operator = check.operator;
              return "[" + field + space(clean(operator)) + cleanVal(value2) + "]";
            }
            case Type2.DATA_BOOL: {
              var _operator = check.operator, _field = check.field;
              return "[" + clean(_operator) + _field + "]";
            }
            case Type2.DATA_EXIST: {
              var _field2 = check.field;
              return "[" + _field2 + "]";
            }
            case Type2.META_COMPARE: {
              var _operator2 = check.operator, _field3 = check.field;
              return "[[" + _field3 + space(clean(_operator2)) + cleanVal(value2) + "]]";
            }
            case Type2.STATE: {
              return value2;
            }
            case Type2.ID: {
              return "#" + value2;
            }
            case Type2.CLASS: {
              return "." + value2;
            }
            case Type2.PARENT:
            case Type2.CHILD: {
              return queryToString(check.parent, subject) + space(">") + queryToString(check.child, subject);
            }
            case Type2.ANCESTOR:
            case Type2.DESCENDANT: {
              return queryToString(check.ancestor, subject) + " " + queryToString(check.descendant, subject);
            }
            case Type2.COMPOUND_SPLIT: {
              var lhs = queryToString(check.left, subject);
              var sub2 = queryToString(check.subject, subject);
              var rhs = queryToString(check.right, subject);
              return lhs + (lhs.length > 0 ? " " : "") + sub2 + rhs;
            }
            case Type2.TRUE: {
              return "";
            }
          }
        }, "checkToString");
        var queryToString = /* @__PURE__ */ __name(function queryToString2(query2, subject) {
          return query2.checks.reduce(function(str3, chk, i3) {
            return str3 + (subject === query2 && i3 === 0 ? "$" : "") + checkToString(chk, subject);
          }, "");
        }, "queryToString");
        var str2 = "";
        for (var i2 = 0; i2 < this.length; i2++) {
          var query = this[i2];
          str2 += queryToString(query, query.subject);
          if (this.length > 1 && i2 < this.length - 1) {
            str2 += ", ";
          }
        }
        this.toStringCache = str2;
        return str2;
      }, "toString");
      parse$1 = {
        parse,
        toString: toString3
      };
      valCmp = /* @__PURE__ */ __name(function valCmp2(fieldVal, operator, value2) {
        var matches33;
        var isFieldStr = string(fieldVal);
        var isFieldNum = number$1(fieldVal);
        var isValStr = string(value2);
        var fieldStr, valStr;
        var caseInsensitive = false;
        var notExpr = false;
        var isIneqCmp = false;
        if (operator.indexOf("!") >= 0) {
          operator = operator.replace("!", "");
          notExpr = true;
        }
        if (operator.indexOf("@") >= 0) {
          operator = operator.replace("@", "");
          caseInsensitive = true;
        }
        if (isFieldStr || isValStr || caseInsensitive) {
          fieldStr = !isFieldStr && !isFieldNum ? "" : "" + fieldVal;
          valStr = "" + value2;
        }
        if (caseInsensitive) {
          fieldVal = fieldStr = fieldStr.toLowerCase();
          value2 = valStr = valStr.toLowerCase();
        }
        switch (operator) {
          case "*=":
            matches33 = fieldStr.indexOf(valStr) >= 0;
            break;
          case "$=":
            matches33 = fieldStr.indexOf(valStr, fieldStr.length - valStr.length) >= 0;
            break;
          case "^=":
            matches33 = fieldStr.indexOf(valStr) === 0;
            break;
          case "=":
            matches33 = fieldVal === value2;
            break;
          case ">":
            isIneqCmp = true;
            matches33 = fieldVal > value2;
            break;
          case ">=":
            isIneqCmp = true;
            matches33 = fieldVal >= value2;
            break;
          case "<":
            isIneqCmp = true;
            matches33 = fieldVal < value2;
            break;
          case "<=":
            isIneqCmp = true;
            matches33 = fieldVal <= value2;
            break;
          default:
            matches33 = false;
            break;
        }
        if (notExpr && (fieldVal != null || !isIneqCmp)) {
          matches33 = !matches33;
        }
        return matches33;
      }, "valCmp");
      boolCmp = /* @__PURE__ */ __name(function boolCmp2(fieldVal, operator) {
        switch (operator) {
          case "?":
            return fieldVal ? true : false;
          case "!":
            return fieldVal ? false : true;
          case "^":
            return fieldVal === void 0;
        }
      }, "boolCmp");
      existCmp = /* @__PURE__ */ __name(function existCmp2(fieldVal) {
        return fieldVal !== void 0;
      }, "existCmp");
      data$1 = /* @__PURE__ */ __name(function data2(ele, field) {
        return ele.data(field);
      }, "data");
      meta = /* @__PURE__ */ __name(function meta2(ele, field) {
        return ele[field]();
      }, "meta");
      match = [];
      matches$1 = /* @__PURE__ */ __name(function matches30(query, ele) {
        return query.checks.every(function(chk) {
          return match[chk.type](chk, ele);
        });
      }, "matches");
      match[Type2.GROUP] = function(check, ele) {
        var group2 = check.value;
        return group2 === "*" || group2 === ele.group();
      };
      match[Type2.STATE] = function(check, ele) {
        var stateSelector = check.value;
        return stateSelectorMatches(stateSelector, ele);
      };
      match[Type2.ID] = function(check, ele) {
        var id34 = check.value;
        return ele.id() === id34;
      };
      match[Type2.CLASS] = function(check, ele) {
        var cls = check.value;
        return ele.hasClass(cls);
      };
      match[Type2.META_COMPARE] = function(check, ele) {
        var field = check.field, operator = check.operator, value2 = check.value;
        return valCmp(meta(ele, field), operator, value2);
      };
      match[Type2.DATA_COMPARE] = function(check, ele) {
        var field = check.field, operator = check.operator, value2 = check.value;
        return valCmp(data$1(ele, field), operator, value2);
      };
      match[Type2.DATA_BOOL] = function(check, ele) {
        var field = check.field, operator = check.operator;
        return boolCmp(data$1(ele, field), operator);
      };
      match[Type2.DATA_EXIST] = function(check, ele) {
        var field = check.field;
        check.operator;
        return existCmp(data$1(ele, field));
      };
      match[Type2.UNDIRECTED_EDGE] = function(check, ele) {
        var qA = check.nodes[0];
        var qB = check.nodes[1];
        var src = ele.source();
        var tgt = ele.target();
        return matches$1(qA, src) && matches$1(qB, tgt) || matches$1(qB, src) && matches$1(qA, tgt);
      };
      match[Type2.NODE_NEIGHBOR] = function(check, ele) {
        return matches$1(check.node, ele) && ele.neighborhood().some(function(n2) {
          return n2.isNode() && matches$1(check.neighbor, n2);
        });
      };
      match[Type2.DIRECTED_EDGE] = function(check, ele) {
        return matches$1(check.source, ele.source()) && matches$1(check.target, ele.target());
      };
      match[Type2.NODE_SOURCE] = function(check, ele) {
        return matches$1(check.source, ele) && ele.outgoers().some(function(n2) {
          return n2.isNode() && matches$1(check.target, n2);
        });
      };
      match[Type2.NODE_TARGET] = function(check, ele) {
        return matches$1(check.target, ele) && ele.incomers().some(function(n2) {
          return n2.isNode() && matches$1(check.source, n2);
        });
      };
      match[Type2.CHILD] = function(check, ele) {
        return matches$1(check.child, ele) && matches$1(check.parent, ele.parent());
      };
      match[Type2.PARENT] = function(check, ele) {
        return matches$1(check.parent, ele) && ele.children().some(function(c3) {
          return matches$1(check.child, c3);
        });
      };
      match[Type2.DESCENDANT] = function(check, ele) {
        return matches$1(check.descendant, ele) && ele.ancestors().some(function(a2) {
          return matches$1(check.ancestor, a2);
        });
      };
      match[Type2.ANCESTOR] = function(check, ele) {
        return matches$1(check.ancestor, ele) && ele.descendants().some(function(d3) {
          return matches$1(check.descendant, d3);
        });
      };
      match[Type2.COMPOUND_SPLIT] = function(check, ele) {
        return matches$1(check.subject, ele) && matches$1(check.left, ele) && matches$1(check.right, ele);
      };
      match[Type2.TRUE] = function() {
        return true;
      };
      match[Type2.COLLECTION] = function(check, ele) {
        var collection4 = check.value;
        return collection4.has(ele);
      };
      match[Type2.FILTER] = function(check, ele) {
        var filter6 = check.value;
        return filter6(ele);
      };
      filter3 = /* @__PURE__ */ __name(function filter4(collection4) {
        var self2 = this;
        if (self2.length === 1 && self2[0].checks.length === 1 && self2[0].checks[0].type === Type2.ID) {
          return collection4.getElementById(self2[0].checks[0].value).collection();
        }
        var selectorFunction = /* @__PURE__ */ __name(function selectorFunction2(element3) {
          for (var j3 = 0; j3 < self2.length; j3++) {
            var query = self2[j3];
            if (matches$1(query, element3)) {
              return true;
            }
          }
          return false;
        }, "selectorFunction");
        if (self2.text() == null) {
          selectorFunction = /* @__PURE__ */ __name(function selectorFunction2() {
            return true;
          }, "selectorFunction");
        }
        return collection4.filter(selectorFunction);
      }, "filter");
      matches31 = /* @__PURE__ */ __name(function matches32(ele) {
        var self2 = this;
        for (var j3 = 0; j3 < self2.length; j3++) {
          var query = self2[j3];
          if (matches$1(query, ele)) {
            return true;
          }
        }
        return false;
      }, "matches");
      matching = {
        matches: matches31,
        filter: filter3
      };
      Selector = /* @__PURE__ */ __name(function Selector2(selector) {
        this.inputText = selector;
        this.currentSubject = null;
        this.compoundCount = 0;
        this.edgeCount = 0;
        this.length = 0;
        if (selector == null || string(selector) && selector.match(/^\s*$/)) ;
        else if (elementOrCollection(selector)) {
          this.addQuery({
            checks: [{
              type: Type2.COLLECTION,
              value: selector.collection()
            }]
          });
        } else if (fn$6(selector)) {
          this.addQuery({
            checks: [{
              type: Type2.FILTER,
              value: selector
            }]
          });
        } else if (string(selector)) {
          if (!this.parse(selector)) {
            this.invalid = true;
          }
        } else {
          error("A selector must be created from a string; found ");
        }
      }, "Selector");
      selfn = Selector.prototype;
      [parse$1, matching].forEach(function(p3) {
        return extend4(selfn, p3);
      });
      selfn.text = function() {
        return this.inputText;
      };
      selfn.size = function() {
        return this.length;
      };
      selfn.eq = function(i2) {
        return this[i2];
      };
      selfn.sameText = function(otherSel) {
        return !this.invalid && !otherSel.invalid && this.text() === otherSel.text();
      };
      selfn.addQuery = function(q3) {
        this[this.length++] = q3;
      };
      selfn.selector = selfn.toString;
      elesfn$g = {
        allAre: /* @__PURE__ */ __name(function allAre(selector) {
          var selObj = new Selector(selector);
          return this.every(function(ele) {
            return selObj.matches(ele);
          });
        }, "allAre"),
        is: /* @__PURE__ */ __name(function is(selector) {
          var selObj = new Selector(selector);
          return this.some(function(ele) {
            return selObj.matches(ele);
          });
        }, "is"),
        some: /* @__PURE__ */ __name(function some2(fn3, thisArg) {
          for (var i2 = 0; i2 < this.length; i2++) {
            var ret = !thisArg ? fn3(this[i2], i2, this) : fn3.apply(thisArg, [this[i2], i2, this]);
            if (ret) {
              return true;
            }
          }
          return false;
        }, "some"),
        every: /* @__PURE__ */ __name(function every2(fn3, thisArg) {
          for (var i2 = 0; i2 < this.length; i2++) {
            var ret = !thisArg ? fn3(this[i2], i2, this) : fn3.apply(thisArg, [this[i2], i2, this]);
            if (!ret) {
              return false;
            }
          }
          return true;
        }, "every"),
        same: /* @__PURE__ */ __name(function same(collection4) {
          if (this === collection4) {
            return true;
          }
          collection4 = this.cy().collection(collection4);
          var thisLength = this.length;
          var collectionLength = collection4.length;
          if (thisLength !== collectionLength) {
            return false;
          }
          if (thisLength === 1) {
            return this[0] === collection4[0];
          }
          return this.every(function(ele) {
            return collection4.hasElementWithId(ele.id());
          });
        }, "same"),
        anySame: /* @__PURE__ */ __name(function anySame(collection4) {
          collection4 = this.cy().collection(collection4);
          return this.some(function(ele) {
            return collection4.hasElementWithId(ele.id());
          });
        }, "anySame"),
        allAreNeighbors: /* @__PURE__ */ __name(function allAreNeighbors(collection4) {
          collection4 = this.cy().collection(collection4);
          var nhood = this.neighborhood();
          return collection4.every(function(ele) {
            return nhood.hasElementWithId(ele.id());
          });
        }, "allAreNeighbors"),
        contains: /* @__PURE__ */ __name(function contains(collection4) {
          collection4 = this.cy().collection(collection4);
          var self2 = this;
          return collection4.every(function(ele) {
            return self2.hasElementWithId(ele.id());
          });
        }, "contains")
      };
      elesfn$g.allAreNeighbours = elesfn$g.allAreNeighbors;
      elesfn$g.has = elesfn$g.contains;
      elesfn$g.equal = elesfn$g.equals = elesfn$g.same;
      cache = /* @__PURE__ */ __name(function cache2(fn3, name) {
        return /* @__PURE__ */ __name(function traversalCache(arg1, arg2, arg3, arg4) {
          var selectorOrEles = arg1;
          var eles = this;
          var key;
          if (selectorOrEles == null) {
            key = "";
          } else if (elementOrCollection(selectorOrEles) && selectorOrEles.length === 1) {
            key = selectorOrEles.id();
          }
          if (eles.length === 1 && key) {
            var _p = eles[0]._private;
            var tch = _p.traversalCache = _p.traversalCache || {};
            var ch = tch[name] = tch[name] || [];
            var hash = hashString(key);
            var cacheHit = ch[hash];
            if (cacheHit) {
              return cacheHit;
            } else {
              return ch[hash] = fn3.call(eles, arg1, arg2, arg3, arg4);
            }
          } else {
            return fn3.call(eles, arg1, arg2, arg3, arg4);
          }
        }, "traversalCache");
      }, "cache");
      elesfn$f = {
        parent: /* @__PURE__ */ __name(function parent(selector) {
          var parents3 = [];
          if (this.length === 1) {
            var parent4 = this[0]._private.parent;
            if (parent4) {
              return parent4;
            }
          }
          for (var i2 = 0; i2 < this.length; i2++) {
            var ele = this[i2];
            var _parent = ele._private.parent;
            if (_parent) {
              parents3.push(_parent);
            }
          }
          return this.spawn(parents3, true).filter(selector);
        }, "parent"),
        parents: /* @__PURE__ */ __name(function parents2(selector) {
          var parents3 = [];
          var eles = this.parent();
          while (eles.nonempty()) {
            for (var i2 = 0; i2 < eles.length; i2++) {
              var ele = eles[i2];
              parents3.push(ele);
            }
            eles = eles.parent();
          }
          return this.spawn(parents3, true).filter(selector);
        }, "parents"),
        commonAncestors: /* @__PURE__ */ __name(function commonAncestors(selector) {
          var ancestors;
          for (var i2 = 0; i2 < this.length; i2++) {
            var ele = this[i2];
            var parents3 = ele.parents();
            ancestors = ancestors || parents3;
            ancestors = ancestors.intersect(parents3);
          }
          return ancestors.filter(selector);
        }, "commonAncestors"),
        orphans: /* @__PURE__ */ __name(function orphans(selector) {
          return this.stdFilter(function(ele) {
            return ele.isOrphan();
          }).filter(selector);
        }, "orphans"),
        nonorphans: /* @__PURE__ */ __name(function nonorphans(selector) {
          return this.stdFilter(function(ele) {
            return ele.isChild();
          }).filter(selector);
        }, "nonorphans"),
        children: cache(function(selector) {
          var children2 = [];
          for (var i2 = 0; i2 < this.length; i2++) {
            var ele = this[i2];
            var eleChildren = ele._private.children;
            for (var j3 = 0; j3 < eleChildren.length; j3++) {
              children2.push(eleChildren[j3]);
            }
          }
          return this.spawn(children2, true).filter(selector);
        }, "children"),
        siblings: /* @__PURE__ */ __name(function siblings(selector) {
          return this.parent().children().not(this).filter(selector);
        }, "siblings"),
        isParent: /* @__PURE__ */ __name(function isParent() {
          var ele = this[0];
          if (ele) {
            return ele.isNode() && ele._private.children.length !== 0;
          }
        }, "isParent"),
        isChildless: /* @__PURE__ */ __name(function isChildless() {
          var ele = this[0];
          if (ele) {
            return ele.isNode() && ele._private.children.length === 0;
          }
        }, "isChildless"),
        isChild: /* @__PURE__ */ __name(function isChild() {
          var ele = this[0];
          if (ele) {
            return ele.isNode() && ele._private.parent != null;
          }
        }, "isChild"),
        isOrphan: /* @__PURE__ */ __name(function isOrphan() {
          var ele = this[0];
          if (ele) {
            return ele.isNode() && ele._private.parent == null;
          }
        }, "isOrphan"),
        descendants: /* @__PURE__ */ __name(function descendants2(selector) {
          var elements2 = [];
          function add3(eles) {
            for (var i2 = 0; i2 < eles.length; i2++) {
              var ele = eles[i2];
              elements2.push(ele);
              if (ele.children().nonempty()) {
                add3(ele.children());
              }
            }
          }
          __name(add3, "add");
          add3(this.children());
          return this.spawn(elements2, true).filter(selector);
        }, "descendants")
      };
      __name(forEachCompound, "forEachCompound");
      __name(addChildren, "addChildren");
      elesfn$f.forEachDown = function(fn3) {
        var includeSelf = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
        return forEachCompound(this, fn3, includeSelf, addChildren);
      };
      __name(addParent, "addParent");
      elesfn$f.forEachUp = function(fn3) {
        var includeSelf = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
        return forEachCompound(this, fn3, includeSelf, addParent);
      };
      __name(addParentAndChildren, "addParentAndChildren");
      elesfn$f.forEachUpAndDown = function(fn3) {
        var includeSelf = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
        return forEachCompound(this, fn3, includeSelf, addParentAndChildren);
      };
      elesfn$f.ancestors = elesfn$f.parents;
      fn$5 = elesfn$e = {
        data: define2.data({
          field: "data",
          bindingEvent: "data",
          allowBinding: true,
          allowSetting: true,
          settingEvent: "data",
          settingTriggersEvent: true,
          triggerFnName: "trigger",
          allowGetting: true,
          immutableKeys: {
            "id": true,
            "source": true,
            "target": true,
            "parent": true
          },
          updateStyle: true
        }),
        removeData: define2.removeData({
          field: "data",
          event: "data",
          triggerFnName: "trigger",
          triggerEvent: true,
          immutableKeys: {
            "id": true,
            "source": true,
            "target": true,
            "parent": true
          },
          updateStyle: true
        }),
        scratch: define2.data({
          field: "scratch",
          bindingEvent: "scratch",
          allowBinding: true,
          allowSetting: true,
          settingEvent: "scratch",
          settingTriggersEvent: true,
          triggerFnName: "trigger",
          allowGetting: true,
          updateStyle: true
        }),
        removeScratch: define2.removeData({
          field: "scratch",
          event: "scratch",
          triggerFnName: "trigger",
          triggerEvent: true,
          updateStyle: true
        }),
        rscratch: define2.data({
          field: "rscratch",
          allowBinding: false,
          allowSetting: true,
          settingTriggersEvent: false,
          allowGetting: true
        }),
        removeRscratch: define2.removeData({
          field: "rscratch",
          triggerEvent: false
        }),
        id: /* @__PURE__ */ __name(function id3() {
          var ele = this[0];
          if (ele) {
            return ele._private.data.id;
          }
        }, "id")
      };
      fn$5.attr = fn$5.data;
      fn$5.removeAttr = fn$5.removeData;
      data3 = elesfn$e;
      elesfn$d = {};
      __name(defineDegreeFunction, "defineDegreeFunction");
      extend4(elesfn$d, {
        degree: defineDegreeFunction(function(node2, edge) {
          if (edge.source().same(edge.target())) {
            return 2;
          } else {
            return 1;
          }
        }),
        indegree: defineDegreeFunction(function(node2, edge) {
          if (edge.target().same(node2)) {
            return 1;
          } else {
            return 0;
          }
        }),
        outdegree: defineDegreeFunction(function(node2, edge) {
          if (edge.source().same(node2)) {
            return 1;
          } else {
            return 0;
          }
        })
      });
      __name(defineDegreeBoundsFunction, "defineDegreeBoundsFunction");
      extend4(elesfn$d, {
        minDegree: defineDegreeBoundsFunction("degree", function(degree, min9) {
          return degree < min9;
        }),
        maxDegree: defineDegreeBoundsFunction("degree", function(degree, max10) {
          return degree > max10;
        }),
        minIndegree: defineDegreeBoundsFunction("indegree", function(degree, min9) {
          return degree < min9;
        }),
        maxIndegree: defineDegreeBoundsFunction("indegree", function(degree, max10) {
          return degree > max10;
        }),
        minOutdegree: defineDegreeBoundsFunction("outdegree", function(degree, min9) {
          return degree < min9;
        }),
        maxOutdegree: defineDegreeBoundsFunction("outdegree", function(degree, max10) {
          return degree > max10;
        })
      });
      extend4(elesfn$d, {
        totalDegree: /* @__PURE__ */ __name(function totalDegree(includeLoops) {
          var total = 0;
          var nodes5 = this.nodes();
          for (var i2 = 0; i2 < nodes5.length; i2++) {
            total += nodes5[i2].degree(includeLoops);
          }
          return total;
        }, "totalDegree")
      });
      beforePositionSet = /* @__PURE__ */ __name(function beforePositionSet2(eles, newPos, silent) {
        for (var i2 = 0; i2 < eles.length; i2++) {
          var ele = eles[i2];
          if (!ele.locked()) {
            var oldPos = ele._private.position;
            var delta = {
              x: newPos.x != null ? newPos.x - oldPos.x : 0,
              y: newPos.y != null ? newPos.y - oldPos.y : 0
            };
            if (ele.isParent() && !(delta.x === 0 && delta.y === 0)) {
              ele.children().shift(delta, silent);
            }
            ele.dirtyBoundingBoxCache();
          }
        }
      }, "beforePositionSet");
      positionDef = {
        field: "position",
        bindingEvent: "position",
        allowBinding: true,
        allowSetting: true,
        settingEvent: "position",
        settingTriggersEvent: true,
        triggerFnName: "emitAndNotify",
        allowGetting: true,
        validKeys: ["x", "y"],
        beforeGet: /* @__PURE__ */ __name(function beforeGet(ele) {
          ele.updateCompoundBounds();
        }, "beforeGet"),
        beforeSet: /* @__PURE__ */ __name(function beforeSet(eles, newPos) {
          beforePositionSet(eles, newPos, false);
        }, "beforeSet"),
        onSet: /* @__PURE__ */ __name(function onSet(eles) {
          eles.dirtyCompoundBoundsCache();
        }, "onSet"),
        canSet: /* @__PURE__ */ __name(function canSet(ele) {
          return !ele.locked();
        }, "canSet")
      };
      fn$4 = elesfn$c = {
        position: define2.data(positionDef),
        // position but no notification to renderer
        silentPosition: define2.data(extend4({}, positionDef, {
          allowBinding: false,
          allowSetting: true,
          settingTriggersEvent: false,
          allowGetting: false,
          beforeSet: /* @__PURE__ */ __name(function beforeSet2(eles, newPos) {
            beforePositionSet(eles, newPos, true);
          }, "beforeSet"),
          onSet: /* @__PURE__ */ __name(function onSet2(eles) {
            eles.dirtyCompoundBoundsCache();
          }, "onSet")
        })),
        positions: /* @__PURE__ */ __name(function positions(pos, silent) {
          if (plainObject(pos)) {
            if (silent) {
              this.silentPosition(pos);
            } else {
              this.position(pos);
            }
          } else if (fn$6(pos)) {
            var _fn = pos;
            var cy = this.cy();
            cy.startBatch();
            for (var i2 = 0; i2 < this.length; i2++) {
              var ele = this[i2];
              var _pos = void 0;
              if (_pos = _fn(ele, i2)) {
                if (silent) {
                  ele.silentPosition(_pos);
                } else {
                  ele.position(_pos);
                }
              }
            }
            cy.endBatch();
          }
          return this;
        }, "positions"),
        silentPositions: /* @__PURE__ */ __name(function silentPositions(pos) {
          return this.positions(pos, true);
        }, "silentPositions"),
        shift: /* @__PURE__ */ __name(function shift(dim, val, silent) {
          var delta;
          if (plainObject(dim)) {
            delta = {
              x: number$1(dim.x) ? dim.x : 0,
              y: number$1(dim.y) ? dim.y : 0
            };
            silent = val;
          } else if (string(dim) && number$1(val)) {
            delta = {
              x: 0,
              y: 0
            };
            delta[dim] = val;
          }
          if (delta != null) {
            var cy = this.cy();
            cy.startBatch();
            for (var i2 = 0; i2 < this.length; i2++) {
              var ele = this[i2];
              if (cy.hasCompoundNodes() && ele.isChild() && ele.ancestors().anySame(this)) {
                continue;
              }
              var pos = ele.position();
              var newPos = {
                x: pos.x + delta.x,
                y: pos.y + delta.y
              };
              if (silent) {
                ele.silentPosition(newPos);
              } else {
                ele.position(newPos);
              }
            }
            cy.endBatch();
          }
          return this;
        }, "shift"),
        silentShift: /* @__PURE__ */ __name(function silentShift(dim, val) {
          if (plainObject(dim)) {
            this.shift(dim, true);
          } else if (string(dim) && number$1(val)) {
            this.shift(dim, val, true);
          }
          return this;
        }, "silentShift"),
        // get/set the rendered (i.e. on screen) positon of the element
        renderedPosition: /* @__PURE__ */ __name(function renderedPosition(dim, val) {
          var ele = this[0];
          var cy = this.cy();
          var zoom2 = cy.zoom();
          var pan2 = cy.pan();
          var rpos = plainObject(dim) ? dim : void 0;
          var setting = rpos !== void 0 || val !== void 0 && string(dim);
          if (ele && ele.isNode()) {
            if (setting) {
              for (var i2 = 0; i2 < this.length; i2++) {
                var _ele = this[i2];
                if (val !== void 0) {
                  _ele.position(dim, (val - pan2[dim]) / zoom2);
                } else if (rpos !== void 0) {
                  _ele.position(renderedToModelPosition(rpos, zoom2, pan2));
                }
              }
            } else {
              var pos = ele.position();
              rpos = modelToRenderedPosition$1(pos, zoom2, pan2);
              if (dim === void 0) {
                return rpos;
              } else {
                return rpos[dim];
              }
            }
          } else if (!setting) {
            return void 0;
          }
          return this;
        }, "renderedPosition"),
        // get/set the position relative to the parent
        relativePosition: /* @__PURE__ */ __name(function relativePosition(dim, val) {
          var ele = this[0];
          var cy = this.cy();
          var ppos = plainObject(dim) ? dim : void 0;
          var setting = ppos !== void 0 || val !== void 0 && string(dim);
          var hasCompoundNodes2 = cy.hasCompoundNodes();
          if (ele && ele.isNode()) {
            if (setting) {
              for (var i2 = 0; i2 < this.length; i2++) {
                var _ele2 = this[i2];
                var parent4 = hasCompoundNodes2 ? _ele2.parent() : null;
                var hasParent = parent4 && parent4.length > 0;
                var relativeToParent = hasParent;
                if (hasParent) {
                  parent4 = parent4[0];
                }
                var origin = relativeToParent ? parent4.position() : {
                  x: 0,
                  y: 0
                };
                if (val !== void 0) {
                  _ele2.position(dim, val + origin[dim]);
                } else if (ppos !== void 0) {
                  _ele2.position({
                    x: ppos.x + origin.x,
                    y: ppos.y + origin.y
                  });
                }
              }
            } else {
              var pos = ele.position();
              var _parent = hasCompoundNodes2 ? ele.parent() : null;
              var _hasParent = _parent && _parent.length > 0;
              var _relativeToParent = _hasParent;
              if (_hasParent) {
                _parent = _parent[0];
              }
              var _origin = _relativeToParent ? _parent.position() : {
                x: 0,
                y: 0
              };
              ppos = {
                x: pos.x - _origin.x,
                y: pos.y - _origin.y
              };
              if (dim === void 0) {
                return ppos;
              } else {
                return ppos[dim];
              }
            }
          } else if (!setting) {
            return void 0;
          }
          return this;
        }, "relativePosition")
      };
      fn$4.modelPosition = fn$4.point = fn$4.position;
      fn$4.modelPositions = fn$4.points = fn$4.positions;
      fn$4.renderedPoint = fn$4.renderedPosition;
      fn$4.relativePoint = fn$4.relativePosition;
      position2 = elesfn$c;
      fn$3 = elesfn$b = {};
      elesfn$b.renderedBoundingBox = function(options2) {
        var bb = this.boundingBox(options2);
        var cy = this.cy();
        var zoom2 = cy.zoom();
        var pan2 = cy.pan();
        var x1 = bb.x1 * zoom2 + pan2.x;
        var x22 = bb.x2 * zoom2 + pan2.x;
        var y1 = bb.y1 * zoom2 + pan2.y;
        var y22 = bb.y2 * zoom2 + pan2.y;
        return {
          x1,
          x2: x22,
          y1,
          y2: y22,
          w: x22 - x1,
          h: y22 - y1
        };
      };
      elesfn$b.dirtyCompoundBoundsCache = function() {
        var silent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
        var cy = this.cy();
        if (!cy.styleEnabled() || !cy.hasCompoundNodes()) {
          return this;
        }
        this.forEachUp(function(ele) {
          if (ele.isParent()) {
            var _p = ele._private;
            _p.compoundBoundsClean = false;
            _p.bbCache = null;
            if (!silent) {
              ele.emitAndNotify("bounds");
            }
          }
        });
        return this;
      };
      elesfn$b.updateCompoundBounds = function() {
        var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
        var cy = this.cy();
        if (!cy.styleEnabled() || !cy.hasCompoundNodes()) {
          return this;
        }
        if (!force && cy.batching()) {
          return this;
        }
        function update2(parent4) {
          if (!parent4.isParent()) {
            return;
          }
          var _p2 = parent4._private;
          var children2 = parent4.children();
          var includeLabels = parent4.pstyle("compound-sizing-wrt-labels").value === "include";
          var min9 = {
            width: {
              val: parent4.pstyle("min-width").pfValue,
              left: parent4.pstyle("min-width-bias-left"),
              right: parent4.pstyle("min-width-bias-right")
            },
            height: {
              val: parent4.pstyle("min-height").pfValue,
              top: parent4.pstyle("min-height-bias-top"),
              bottom: parent4.pstyle("min-height-bias-bottom")
            }
          };
          var bb = children2.boundingBox({
            includeLabels,
            includeOverlays: false,
            // updating the compound bounds happens outside of the regular
            // cache cycle (i.e. before fired events)
            useCache: false
          });
          var pos = _p2.position;
          if (bb.w === 0 || bb.h === 0) {
            bb = {
              w: parent4.pstyle("width").pfValue,
              h: parent4.pstyle("height").pfValue
            };
            bb.x1 = pos.x - bb.w / 2;
            bb.x2 = pos.x + bb.w / 2;
            bb.y1 = pos.y - bb.h / 2;
            bb.y2 = pos.y + bb.h / 2;
          }
          function computeBiasValues(propDiff, propBias, propBiasComplement) {
            var biasDiff = 0;
            var biasComplementDiff = 0;
            var biasTotal = propBias + propBiasComplement;
            if (propDiff > 0 && biasTotal > 0) {
              biasDiff = propBias / biasTotal * propDiff;
              biasComplementDiff = propBiasComplement / biasTotal * propDiff;
            }
            return {
              biasDiff,
              biasComplementDiff
            };
          }
          __name(computeBiasValues, "computeBiasValues");
          function computePaddingValues(width3, height2, paddingObject, relativeTo) {
            if (paddingObject.units === "%") {
              switch (relativeTo) {
                case "width":
                  return width3 > 0 ? paddingObject.pfValue * width3 : 0;
                case "height":
                  return height2 > 0 ? paddingObject.pfValue * height2 : 0;
                case "average":
                  return width3 > 0 && height2 > 0 ? paddingObject.pfValue * (width3 + height2) / 2 : 0;
                case "min":
                  return width3 > 0 && height2 > 0 ? width3 > height2 ? paddingObject.pfValue * height2 : paddingObject.pfValue * width3 : 0;
                case "max":
                  return width3 > 0 && height2 > 0 ? width3 > height2 ? paddingObject.pfValue * width3 : paddingObject.pfValue * height2 : 0;
                default:
                  return 0;
              }
            } else if (paddingObject.units === "px") {
              return paddingObject.pfValue;
            } else {
              return 0;
            }
          }
          __name(computePaddingValues, "computePaddingValues");
          var leftVal = min9.width.left.value;
          if (min9.width.left.units === "px" && min9.width.val > 0) {
            leftVal = leftVal * 100 / min9.width.val;
          }
          var rightVal = min9.width.right.value;
          if (min9.width.right.units === "px" && min9.width.val > 0) {
            rightVal = rightVal * 100 / min9.width.val;
          }
          var topVal = min9.height.top.value;
          if (min9.height.top.units === "px" && min9.height.val > 0) {
            topVal = topVal * 100 / min9.height.val;
          }
          var bottomVal = min9.height.bottom.value;
          if (min9.height.bottom.units === "px" && min9.height.val > 0) {
            bottomVal = bottomVal * 100 / min9.height.val;
          }
          var widthBiasDiffs = computeBiasValues(min9.width.val - bb.w, leftVal, rightVal);
          var diffLeft = widthBiasDiffs.biasDiff;
          var diffRight = widthBiasDiffs.biasComplementDiff;
          var heightBiasDiffs = computeBiasValues(min9.height.val - bb.h, topVal, bottomVal);
          var diffTop = heightBiasDiffs.biasDiff;
          var diffBottom = heightBiasDiffs.biasComplementDiff;
          _p2.autoPadding = computePaddingValues(bb.w, bb.h, parent4.pstyle("padding"), parent4.pstyle("padding-relative-to").value);
          _p2.autoWidth = Math.max(bb.w, min9.width.val);
          pos.x = (-diffLeft + bb.x1 + bb.x2 + diffRight) / 2;
          _p2.autoHeight = Math.max(bb.h, min9.height.val);
          pos.y = (-diffTop + bb.y1 + bb.y2 + diffBottom) / 2;
        }
        __name(update2, "update");
        for (var i2 = 0; i2 < this.length; i2++) {
          var ele = this[i2];
          var _p = ele._private;
          if (!_p.compoundBoundsClean || force) {
            update2(ele);
            if (!cy.batching()) {
              _p.compoundBoundsClean = true;
            }
          }
        }
        return this;
      };
      noninf = /* @__PURE__ */ __name(function noninf2(x5) {
        if (x5 === Infinity || x5 === -Infinity) {
          return 0;
        }
        return x5;
      }, "noninf");
      updateBounds = /* @__PURE__ */ __name(function updateBounds2(b3, x1, y1, x22, y22) {
        if (x22 - x1 === 0 || y22 - y1 === 0) {
          return;
        }
        if (x1 == null || y1 == null || x22 == null || y22 == null) {
          return;
        }
        b3.x1 = x1 < b3.x1 ? x1 : b3.x1;
        b3.x2 = x22 > b3.x2 ? x22 : b3.x2;
        b3.y1 = y1 < b3.y1 ? y1 : b3.y1;
        b3.y2 = y22 > b3.y2 ? y22 : b3.y2;
        b3.w = b3.x2 - b3.x1;
        b3.h = b3.y2 - b3.y1;
      }, "updateBounds");
      updateBoundsFromBox = /* @__PURE__ */ __name(function updateBoundsFromBox2(b3, b22) {
        if (b22 == null) {
          return b3;
        }
        return updateBounds(b3, b22.x1, b22.y1, b22.x2, b22.y2);
      }, "updateBoundsFromBox");
      prefixedProperty = /* @__PURE__ */ __name(function prefixedProperty2(obj, field, prefix) {
        return getPrefixedProperty(obj, field, prefix);
      }, "prefixedProperty");
      updateBoundsFromArrow = /* @__PURE__ */ __name(function updateBoundsFromArrow2(bounds4, ele, prefix) {
        if (ele.cy().headless()) {
          return;
        }
        var _p = ele._private;
        var rstyle = _p.rstyle;
        var halfArW = rstyle.arrowWidth / 2;
        var arrowType = ele.pstyle(prefix + "-arrow-shape").value;
        var x5;
        var y6;
        if (arrowType !== "none") {
          if (prefix === "source") {
            x5 = rstyle.srcX;
            y6 = rstyle.srcY;
          } else if (prefix === "target") {
            x5 = rstyle.tgtX;
            y6 = rstyle.tgtY;
          } else {
            x5 = rstyle.midX;
            y6 = rstyle.midY;
          }
          var bbs = _p.arrowBounds = _p.arrowBounds || {};
          var bb = bbs[prefix] = bbs[prefix] || {};
          bb.x1 = x5 - halfArW;
          bb.y1 = y6 - halfArW;
          bb.x2 = x5 + halfArW;
          bb.y2 = y6 + halfArW;
          bb.w = bb.x2 - bb.x1;
          bb.h = bb.y2 - bb.y1;
          expandBoundingBox(bb, 1);
          updateBounds(bounds4, bb.x1, bb.y1, bb.x2, bb.y2);
        }
      }, "updateBoundsFromArrow");
      updateBoundsFromLabel = /* @__PURE__ */ __name(function updateBoundsFromLabel2(bounds4, ele, prefix) {
        if (ele.cy().headless()) {
          return;
        }
        var prefixDash;
        if (prefix) {
          prefixDash = prefix + "-";
        } else {
          prefixDash = "";
        }
        var _p = ele._private;
        var rstyle = _p.rstyle;
        var label = ele.pstyle(prefixDash + "label").strValue;
        if (label) {
          var halign = ele.pstyle("text-halign");
          var valign = ele.pstyle("text-valign");
          var labelWidth = prefixedProperty(rstyle, "labelWidth", prefix);
          var labelHeight = prefixedProperty(rstyle, "labelHeight", prefix);
          var labelX = prefixedProperty(rstyle, "labelX", prefix);
          var labelY = prefixedProperty(rstyle, "labelY", prefix);
          var marginX = ele.pstyle(prefixDash + "text-margin-x").pfValue;
          var marginY = ele.pstyle(prefixDash + "text-margin-y").pfValue;
          var isEdge2 = ele.isEdge();
          var rotation = ele.pstyle(prefixDash + "text-rotation");
          var outlineWidth = ele.pstyle("text-outline-width").pfValue;
          var borderWidth = ele.pstyle("text-border-width").pfValue;
          var halfBorderWidth = borderWidth / 2;
          var padding2 = ele.pstyle("text-background-padding").pfValue;
          var marginOfError = 2;
          var lh = labelHeight;
          var lw = labelWidth;
          var lw_2 = lw / 2;
          var lh_2 = lh / 2;
          var lx1, lx2, ly1, ly2;
          if (isEdge2) {
            lx1 = labelX - lw_2;
            lx2 = labelX + lw_2;
            ly1 = labelY - lh_2;
            ly2 = labelY + lh_2;
          } else {
            switch (halign.value) {
              case "left":
                lx1 = labelX - lw;
                lx2 = labelX;
                break;
              case "center":
                lx1 = labelX - lw_2;
                lx2 = labelX + lw_2;
                break;
              case "right":
                lx1 = labelX;
                lx2 = labelX + lw;
                break;
            }
            switch (valign.value) {
              case "top":
                ly1 = labelY - lh;
                ly2 = labelY;
                break;
              case "center":
                ly1 = labelY - lh_2;
                ly2 = labelY + lh_2;
                break;
              case "bottom":
                ly1 = labelY;
                ly2 = labelY + lh;
                break;
            }
          }
          var leftPad = marginX - Math.max(outlineWidth, halfBorderWidth) - padding2 - marginOfError;
          var rightPad = marginX + Math.max(outlineWidth, halfBorderWidth) + padding2 + marginOfError;
          var topPad = marginY - Math.max(outlineWidth, halfBorderWidth) - padding2 - marginOfError;
          var botPad = marginY + Math.max(outlineWidth, halfBorderWidth) + padding2 + marginOfError;
          lx1 += leftPad;
          lx2 += rightPad;
          ly1 += topPad;
          ly2 += botPad;
          var bbPrefix = prefix || "main";
          var bbs = _p.labelBounds;
          var bb = bbs[bbPrefix] = bbs[bbPrefix] || {};
          bb.x1 = lx1;
          bb.y1 = ly1;
          bb.x2 = lx2;
          bb.y2 = ly2;
          bb.w = lx2 - lx1;
          bb.h = ly2 - ly1;
          bb.leftPad = leftPad;
          bb.rightPad = rightPad;
          bb.topPad = topPad;
          bb.botPad = botPad;
          var isAutorotate = isEdge2 && rotation.strValue === "autorotate";
          var isPfValue = rotation.pfValue != null && rotation.pfValue !== 0;
          if (isAutorotate || isPfValue) {
            var theta = isAutorotate ? prefixedProperty(_p.rstyle, "labelAngle", prefix) : rotation.pfValue;
            var cos3 = Math.cos(theta);
            var sin3 = Math.sin(theta);
            var xo = (lx1 + lx2) / 2;
            var yo = (ly1 + ly2) / 2;
            if (!isEdge2) {
              switch (halign.value) {
                case "left":
                  xo = lx2;
                  break;
                case "right":
                  xo = lx1;
                  break;
              }
              switch (valign.value) {
                case "top":
                  yo = ly2;
                  break;
                case "bottom":
                  yo = ly1;
                  break;
              }
            }
            var rotate2 = /* @__PURE__ */ __name(function rotate3(x5, y6) {
              x5 = x5 - xo;
              y6 = y6 - yo;
              return {
                x: x5 * cos3 - y6 * sin3 + xo,
                y: x5 * sin3 + y6 * cos3 + yo
              };
            }, "rotate");
            var px1y1 = rotate2(lx1, ly1);
            var px1y2 = rotate2(lx1, ly2);
            var px2y1 = rotate2(lx2, ly1);
            var px2y2 = rotate2(lx2, ly2);
            lx1 = Math.min(px1y1.x, px1y2.x, px2y1.x, px2y2.x);
            lx2 = Math.max(px1y1.x, px1y2.x, px2y1.x, px2y2.x);
            ly1 = Math.min(px1y1.y, px1y2.y, px2y1.y, px2y2.y);
            ly2 = Math.max(px1y1.y, px1y2.y, px2y1.y, px2y2.y);
          }
          var bbPrefixRot = bbPrefix + "Rot";
          var bbRot = bbs[bbPrefixRot] = bbs[bbPrefixRot] || {};
          bbRot.x1 = lx1;
          bbRot.y1 = ly1;
          bbRot.x2 = lx2;
          bbRot.y2 = ly2;
          bbRot.w = lx2 - lx1;
          bbRot.h = ly2 - ly1;
          updateBounds(bounds4, lx1, ly1, lx2, ly2);
          updateBounds(_p.labelBounds.all, lx1, ly1, lx2, ly2);
        }
        return bounds4;
      }, "updateBoundsFromLabel");
      updateBoundsFromOutline = /* @__PURE__ */ __name(function updateBoundsFromOutline2(bounds4, ele) {
        if (ele.cy().headless()) {
          return;
        }
        var outlineOpacity = ele.pstyle("outline-opacity").value;
        var outlineWidth = ele.pstyle("outline-width").value;
        var outlineOffset = ele.pstyle("outline-offset").value;
        var expansion = outlineWidth + outlineOffset;
        updateBoundsFromMiter(bounds4, ele, outlineOpacity, expansion, "outside", expansion / 2);
      }, "updateBoundsFromOutline");
      updateBoundsFromMiter = /* @__PURE__ */ __name(function updateBoundsFromMiter2(bounds4, ele, opacity, expansionSize, expansionPosition, useFallbackValue) {
        if (opacity === 0 || expansionSize <= 0 || expansionPosition === "inside") {
          return;
        }
        var cy = ele.cy();
        var shape = ele.pstyle("shape").value;
        var rshape = cy.renderer().nodeShapes[shape];
        var _ele$position = ele.position(), x5 = _ele$position.x, y6 = _ele$position.y;
        var w4 = ele.width();
        var h3 = ele.height();
        if (rshape.hasMiterBounds) {
          if (expansionPosition === "center") {
            expansionSize /= 2;
          }
          var mbb = rshape.miterBounds(x5, y6, w4, h3, expansionSize);
          updateBoundsFromBox(bounds4, mbb);
        } else if (useFallbackValue != null && useFallbackValue > 0) {
          expandBoundingBoxSides(bounds4, [useFallbackValue, useFallbackValue, useFallbackValue, useFallbackValue]);
        }
      }, "updateBoundsFromMiter");
      updateBoundsFromMiterBorder = /* @__PURE__ */ __name(function updateBoundsFromMiterBorder2(bounds4, ele) {
        if (ele.cy().headless()) {
          return;
        }
        var borderOpacity = ele.pstyle("border-opacity").value;
        var borderWidth = ele.pstyle("border-width").pfValue;
        var borderPosition = ele.pstyle("border-position").value;
        updateBoundsFromMiter(bounds4, ele, borderOpacity, borderWidth, borderPosition);
      }, "updateBoundsFromMiterBorder");
      boundingBoxImpl = /* @__PURE__ */ __name(function boundingBoxImpl2(ele, options2) {
        var cy = ele._private.cy;
        var styleEnabled2 = cy.styleEnabled();
        var headless2 = cy.headless();
        var bounds4 = makeBoundingBox();
        var _p = ele._private;
        var isNode2 = ele.isNode();
        var isEdge2 = ele.isEdge();
        var ex1, ex2, ey1, ey2;
        var x5, y6;
        var rstyle = _p.rstyle;
        var manualExpansion = isNode2 && styleEnabled2 ? ele.pstyle("bounds-expansion").pfValue : [0];
        var isDisplayed = /* @__PURE__ */ __name(function isDisplayed2(ele2) {
          return ele2.pstyle("display").value !== "none";
        }, "isDisplayed");
        var displayed = !styleEnabled2 || isDisplayed(ele) && (!isEdge2 || isDisplayed(ele.source()) && isDisplayed(ele.target()));
        if (displayed) {
          var overlayOpacity = 0;
          var overlayPadding = 0;
          if (styleEnabled2 && options2.includeOverlays) {
            overlayOpacity = ele.pstyle("overlay-opacity").value;
            if (overlayOpacity !== 0) {
              overlayPadding = ele.pstyle("overlay-padding").value;
            }
          }
          var underlayOpacity = 0;
          var underlayPadding = 0;
          if (styleEnabled2 && options2.includeUnderlays) {
            underlayOpacity = ele.pstyle("underlay-opacity").value;
            if (underlayOpacity !== 0) {
              underlayPadding = ele.pstyle("underlay-padding").value;
            }
          }
          var padding2 = Math.max(overlayPadding, underlayPadding);
          var w4 = 0;
          var wHalf = 0;
          if (styleEnabled2) {
            w4 = ele.pstyle("width").pfValue;
            wHalf = w4 / 2;
          }
          if (isNode2 && options2.includeNodes) {
            var pos = ele.position();
            x5 = pos.x;
            y6 = pos.y;
            var _w = ele.outerWidth();
            var halfW = _w / 2;
            var h3 = ele.outerHeight();
            var halfH = h3 / 2;
            ex1 = x5 - halfW;
            ex2 = x5 + halfW;
            ey1 = y6 - halfH;
            ey2 = y6 + halfH;
            updateBounds(bounds4, ex1, ey1, ex2, ey2);
            if (styleEnabled2) {
              updateBoundsFromOutline(bounds4, ele);
            }
            if (styleEnabled2 && options2.includeOutlines && !headless2) {
              updateBoundsFromOutline(bounds4, ele);
            }
            if (styleEnabled2) {
              updateBoundsFromMiterBorder(bounds4, ele);
            }
          } else if (isEdge2 && options2.includeEdges) {
            if (styleEnabled2 && !headless2) {
              var curveStyle = ele.pstyle("curve-style").strValue;
              ex1 = Math.min(rstyle.srcX, rstyle.midX, rstyle.tgtX);
              ex2 = Math.max(rstyle.srcX, rstyle.midX, rstyle.tgtX);
              ey1 = Math.min(rstyle.srcY, rstyle.midY, rstyle.tgtY);
              ey2 = Math.max(rstyle.srcY, rstyle.midY, rstyle.tgtY);
              ex1 -= wHalf;
              ex2 += wHalf;
              ey1 -= wHalf;
              ey2 += wHalf;
              updateBounds(bounds4, ex1, ey1, ex2, ey2);
              if (curveStyle === "haystack") {
                var hpts = rstyle.haystackPts;
                if (hpts && hpts.length === 2) {
                  ex1 = hpts[0].x;
                  ey1 = hpts[0].y;
                  ex2 = hpts[1].x;
                  ey2 = hpts[1].y;
                  if (ex1 > ex2) {
                    var temp = ex1;
                    ex1 = ex2;
                    ex2 = temp;
                  }
                  if (ey1 > ey2) {
                    var _temp = ey1;
                    ey1 = ey2;
                    ey2 = _temp;
                  }
                  updateBounds(bounds4, ex1 - wHalf, ey1 - wHalf, ex2 + wHalf, ey2 + wHalf);
                }
              } else if (curveStyle === "bezier" || curveStyle === "unbundled-bezier" || endsWith(curveStyle, "segments") || endsWith(curveStyle, "taxi")) {
                var pts2;
                switch (curveStyle) {
                  case "bezier":
                  case "unbundled-bezier":
                    pts2 = rstyle.bezierPts;
                    break;
                  case "segments":
                  case "taxi":
                  case "round-segments":
                  case "round-taxi":
                    pts2 = rstyle.linePts;
                    break;
                }
                if (pts2 != null) {
                  for (var j3 = 0; j3 < pts2.length; j3++) {
                    var pt = pts2[j3];
                    ex1 = pt.x - wHalf;
                    ex2 = pt.x + wHalf;
                    ey1 = pt.y - wHalf;
                    ey2 = pt.y + wHalf;
                    updateBounds(bounds4, ex1, ey1, ex2, ey2);
                  }
                }
              }
            } else {
              var n1 = ele.source();
              var n1pos = n1.position();
              var n2 = ele.target();
              var n2pos = n2.position();
              ex1 = n1pos.x;
              ex2 = n2pos.x;
              ey1 = n1pos.y;
              ey2 = n2pos.y;
              if (ex1 > ex2) {
                var _temp2 = ex1;
                ex1 = ex2;
                ex2 = _temp2;
              }
              if (ey1 > ey2) {
                var _temp3 = ey1;
                ey1 = ey2;
                ey2 = _temp3;
              }
              ex1 -= wHalf;
              ex2 += wHalf;
              ey1 -= wHalf;
              ey2 += wHalf;
              updateBounds(bounds4, ex1, ey1, ex2, ey2);
            }
          }
          if (styleEnabled2 && options2.includeEdges && isEdge2) {
            updateBoundsFromArrow(bounds4, ele, "mid-source");
            updateBoundsFromArrow(bounds4, ele, "mid-target");
            updateBoundsFromArrow(bounds4, ele, "source");
            updateBoundsFromArrow(bounds4, ele, "target");
          }
          if (styleEnabled2) {
            var ghost = ele.pstyle("ghost").value === "yes";
            if (ghost) {
              var gx = ele.pstyle("ghost-offset-x").pfValue;
              var gy = ele.pstyle("ghost-offset-y").pfValue;
              updateBounds(bounds4, bounds4.x1 + gx, bounds4.y1 + gy, bounds4.x2 + gx, bounds4.y2 + gy);
            }
          }
          var bbBody = _p.bodyBounds = _p.bodyBounds || {};
          assignBoundingBox(bbBody, bounds4);
          expandBoundingBoxSides(bbBody, manualExpansion);
          expandBoundingBox(bbBody, 1);
          if (styleEnabled2) {
            ex1 = bounds4.x1;
            ex2 = bounds4.x2;
            ey1 = bounds4.y1;
            ey2 = bounds4.y2;
            updateBounds(bounds4, ex1 - padding2, ey1 - padding2, ex2 + padding2, ey2 + padding2);
          }
          var bbOverlay = _p.overlayBounds = _p.overlayBounds || {};
          assignBoundingBox(bbOverlay, bounds4);
          expandBoundingBoxSides(bbOverlay, manualExpansion);
          expandBoundingBox(bbOverlay, 1);
          var bbLabels = _p.labelBounds = _p.labelBounds || {};
          if (bbLabels.all != null) {
            clearBoundingBox(bbLabels.all);
          } else {
            bbLabels.all = makeBoundingBox();
          }
          if (styleEnabled2 && options2.includeLabels) {
            if (options2.includeMainLabels) {
              updateBoundsFromLabel(bounds4, ele, null);
            }
            if (isEdge2) {
              if (options2.includeSourceLabels) {
                updateBoundsFromLabel(bounds4, ele, "source");
              }
              if (options2.includeTargetLabels) {
                updateBoundsFromLabel(bounds4, ele, "target");
              }
            }
          }
        }
        bounds4.x1 = noninf(bounds4.x1);
        bounds4.y1 = noninf(bounds4.y1);
        bounds4.x2 = noninf(bounds4.x2);
        bounds4.y2 = noninf(bounds4.y2);
        bounds4.w = noninf(bounds4.x2 - bounds4.x1);
        bounds4.h = noninf(bounds4.y2 - bounds4.y1);
        if (bounds4.w > 0 && bounds4.h > 0 && displayed) {
          expandBoundingBoxSides(bounds4, manualExpansion);
          expandBoundingBox(bounds4, 1);
        }
        return bounds4;
      }, "boundingBoxImpl");
      getKey = /* @__PURE__ */ __name(function getKey2(opts) {
        var i2 = 0;
        var tf = /* @__PURE__ */ __name(function tf2(val) {
          return (val ? 1 : 0) << i2++;
        }, "tf");
        var key = 0;
        key += tf(opts.incudeNodes);
        key += tf(opts.includeEdges);
        key += tf(opts.includeLabels);
        key += tf(opts.includeMainLabels);
        key += tf(opts.includeSourceLabels);
        key += tf(opts.includeTargetLabels);
        key += tf(opts.includeOverlays);
        key += tf(opts.includeOutlines);
        return key;
      }, "getKey");
      getBoundingBoxPosKey = /* @__PURE__ */ __name(function getBoundingBoxPosKey2(ele) {
        var r2 = /* @__PURE__ */ __name(function r3(x5) {
          return Math.round(x5);
        }, "r");
        if (ele.isEdge()) {
          var p1 = ele.source().position();
          var p22 = ele.target().position();
          return hashIntsArray([r2(p1.x), r2(p1.y), r2(p22.x), r2(p22.y)]);
        } else {
          var p3 = ele.position();
          return hashIntsArray([r2(p3.x), r2(p3.y)]);
        }
      }, "getBoundingBoxPosKey");
      cachedBoundingBoxImpl = /* @__PURE__ */ __name(function cachedBoundingBoxImpl2(ele, opts) {
        var _p = ele._private;
        var bb;
        var isEdge2 = ele.isEdge();
        var key = opts == null ? defBbOptsKey : getKey(opts);
        var usingDefOpts = key === defBbOptsKey;
        if (_p.bbCache == null) {
          bb = boundingBoxImpl(ele, defBbOpts);
          _p.bbCache = bb;
          _p.bbCachePosKey = getBoundingBoxPosKey(ele);
        } else {
          bb = _p.bbCache;
        }
        if (!usingDefOpts) {
          var isNode2 = ele.isNode();
          bb = makeBoundingBox();
          if (opts.includeNodes && isNode2 || opts.includeEdges && !isNode2) {
            if (opts.includeOverlays) {
              updateBoundsFromBox(bb, _p.overlayBounds);
            } else {
              updateBoundsFromBox(bb, _p.bodyBounds);
            }
          }
          if (opts.includeLabels) {
            if (opts.includeMainLabels && (!isEdge2 || opts.includeSourceLabels && opts.includeTargetLabels)) {
              updateBoundsFromBox(bb, _p.labelBounds.all);
            } else {
              if (opts.includeMainLabels) {
                updateBoundsFromBox(bb, _p.labelBounds.mainRot);
              }
              if (opts.includeSourceLabels) {
                updateBoundsFromBox(bb, _p.labelBounds.sourceRot);
              }
              if (opts.includeTargetLabels) {
                updateBoundsFromBox(bb, _p.labelBounds.targetRot);
              }
            }
          }
          bb.w = bb.x2 - bb.x1;
          bb.h = bb.y2 - bb.y1;
        }
        return bb;
      }, "cachedBoundingBoxImpl");
      defBbOpts = {
        includeNodes: true,
        includeEdges: true,
        includeLabels: true,
        includeMainLabels: true,
        includeSourceLabels: true,
        includeTargetLabels: true,
        includeOverlays: true,
        includeUnderlays: true,
        includeOutlines: true,
        useCache: true
      };
      defBbOptsKey = getKey(defBbOpts);
      filledBbOpts = defaults$g(defBbOpts);
      elesfn$b.boundingBox = function(options2) {
        var bounds4;
        var useCache = options2 === void 0 || options2.useCache === void 0 || options2.useCache === true;
        var isDirty = memoize2(function(ele2) {
          var _p = ele2._private;
          return _p.bbCache == null || _p.styleDirty || _p.bbCachePosKey !== getBoundingBoxPosKey(ele2);
        }, function(ele2) {
          return ele2.id();
        });
        if (useCache && this.length === 1 && !isDirty(this[0])) {
          if (options2 === void 0) {
            options2 = defBbOpts;
          } else {
            options2 = filledBbOpts(options2);
          }
          bounds4 = cachedBoundingBoxImpl(this[0], options2);
        } else {
          bounds4 = makeBoundingBox();
          options2 = options2 || defBbOpts;
          var opts = filledBbOpts(options2);
          var eles = this;
          var cy = eles.cy();
          var styleEnabled2 = cy.styleEnabled();
          this.edges().forEach(isDirty);
          this.nodes().forEach(isDirty);
          if (styleEnabled2) {
            this.recalculateRenderedStyle(useCache);
          }
          this.updateCompoundBounds(!useCache);
          for (var i2 = 0; i2 < eles.length; i2++) {
            var ele = eles[i2];
            if (isDirty(ele)) {
              ele.dirtyBoundingBoxCache();
            }
            updateBoundsFromBox(bounds4, cachedBoundingBoxImpl(ele, opts));
          }
        }
        bounds4.x1 = noninf(bounds4.x1);
        bounds4.y1 = noninf(bounds4.y1);
        bounds4.x2 = noninf(bounds4.x2);
        bounds4.y2 = noninf(bounds4.y2);
        bounds4.w = noninf(bounds4.x2 - bounds4.x1);
        bounds4.h = noninf(bounds4.y2 - bounds4.y1);
        return bounds4;
      };
      elesfn$b.dirtyBoundingBoxCache = function() {
        for (var i2 = 0; i2 < this.length; i2++) {
          var _p = this[i2]._private;
          _p.bbCache = null;
          _p.bbCachePosKey = null;
          _p.bodyBounds = null;
          _p.overlayBounds = null;
          _p.labelBounds.all = null;
          _p.labelBounds.source = null;
          _p.labelBounds.target = null;
          _p.labelBounds.main = null;
          _p.labelBounds.sourceRot = null;
          _p.labelBounds.targetRot = null;
          _p.labelBounds.mainRot = null;
          _p.arrowBounds.source = null;
          _p.arrowBounds.target = null;
          _p.arrowBounds["mid-source"] = null;
          _p.arrowBounds["mid-target"] = null;
        }
        this.emitAndNotify("bounds");
        return this;
      };
      elesfn$b.boundingBoxAt = function(fn3) {
        var nodes5 = this.nodes();
        var cy = this.cy();
        var hasCompoundNodes2 = cy.hasCompoundNodes();
        var parents3 = cy.collection();
        if (hasCompoundNodes2) {
          parents3 = nodes5.filter(function(node2) {
            return node2.isParent();
          });
          nodes5 = nodes5.not(parents3);
        }
        if (plainObject(fn3)) {
          var obj = fn3;
          fn3 = /* @__PURE__ */ __name(function fn4() {
            return obj;
          }, "fn");
        }
        var storeOldPos = /* @__PURE__ */ __name(function storeOldPos2(node2, i2) {
          return node2._private.bbAtOldPos = fn3(node2, i2);
        }, "storeOldPos");
        var getOldPos = /* @__PURE__ */ __name(function getOldPos2(node2) {
          return node2._private.bbAtOldPos;
        }, "getOldPos");
        cy.startBatch();
        nodes5.forEach(storeOldPos).silentPositions(fn3);
        if (hasCompoundNodes2) {
          parents3.dirtyCompoundBoundsCache();
          parents3.dirtyBoundingBoxCache();
          parents3.updateCompoundBounds(true);
        }
        var bb = copyBoundingBox(this.boundingBox({
          useCache: false
        }));
        nodes5.silentPositions(getOldPos);
        if (hasCompoundNodes2) {
          parents3.dirtyCompoundBoundsCache();
          parents3.dirtyBoundingBoxCache();
          parents3.updateCompoundBounds(true);
        }
        cy.endBatch();
        return bb;
      };
      fn$3.boundingbox = fn$3.bb = fn$3.boundingBox;
      fn$3.renderedBoundingbox = fn$3.renderedBoundingBox;
      bounds = elesfn$b;
      fn$2 = elesfn$a = {};
      defineDimFns = /* @__PURE__ */ __name(function defineDimFns2(opts) {
        opts.uppercaseName = capitalize(opts.name);
        opts.autoName = "auto" + opts.uppercaseName;
        opts.labelName = "label" + opts.uppercaseName;
        opts.outerName = "outer" + opts.uppercaseName;
        opts.uppercaseOuterName = capitalize(opts.outerName);
        fn$2[opts.name] = /* @__PURE__ */ __name(function dimImpl() {
          var ele = this[0];
          var _p = ele._private;
          var cy = _p.cy;
          var styleEnabled2 = cy._private.styleEnabled;
          if (ele) {
            if (styleEnabled2) {
              if (ele.isParent()) {
                ele.updateCompoundBounds();
                return _p[opts.autoName] || 0;
              }
              var d3 = ele.pstyle(opts.name);
              switch (d3.strValue) {
                case "label":
                  ele.recalculateRenderedStyle();
                  return _p.rstyle[opts.labelName] || 0;
                default:
                  return d3.pfValue;
              }
            } else {
              return 1;
            }
          }
        }, "dimImpl");
        fn$2["outer" + opts.uppercaseName] = /* @__PURE__ */ __name(function outerDimImpl() {
          var ele = this[0];
          var _p = ele._private;
          var cy = _p.cy;
          var styleEnabled2 = cy._private.styleEnabled;
          if (ele) {
            if (styleEnabled2) {
              var dim = ele[opts.name]();
              var borderPos = ele.pstyle("border-position").value;
              var border;
              if (borderPos === "center") {
                border = ele.pstyle("border-width").pfValue;
              } else if (borderPos === "outside") {
                border = 2 * ele.pstyle("border-width").pfValue;
              } else {
                border = 0;
              }
              var padding2 = 2 * ele.padding();
              return dim + border + padding2;
            } else {
              return 1;
            }
          }
        }, "outerDimImpl");
        fn$2["rendered" + opts.uppercaseName] = /* @__PURE__ */ __name(function renderedDimImpl() {
          var ele = this[0];
          if (ele) {
            var d3 = ele[opts.name]();
            return d3 * this.cy().zoom();
          }
        }, "renderedDimImpl");
        fn$2["rendered" + opts.uppercaseOuterName] = /* @__PURE__ */ __name(function renderedOuterDimImpl() {
          var ele = this[0];
          if (ele) {
            var od = ele[opts.outerName]();
            return od * this.cy().zoom();
          }
        }, "renderedOuterDimImpl");
      }, "defineDimFns");
      defineDimFns({
        name: "width"
      });
      defineDimFns({
        name: "height"
      });
      elesfn$a.padding = function() {
        var ele = this[0];
        var _p = ele._private;
        if (ele.isParent()) {
          ele.updateCompoundBounds();
          if (_p.autoPadding !== void 0) {
            return _p.autoPadding;
          } else {
            return ele.pstyle("padding").pfValue;
          }
        } else {
          return ele.pstyle("padding").pfValue;
        }
      };
      elesfn$a.paddedHeight = function() {
        var ele = this[0];
        return ele.height() + 2 * ele.padding();
      };
      elesfn$a.paddedWidth = function() {
        var ele = this[0];
        return ele.width() + 2 * ele.padding();
      };
      widthHeight = elesfn$a;
      ifEdge = /* @__PURE__ */ __name(function ifEdge2(ele, getValue3) {
        if (ele.isEdge() && ele.takesUpSpace()) {
          return getValue3(ele);
        }
      }, "ifEdge");
      ifEdgeRenderedPosition = /* @__PURE__ */ __name(function ifEdgeRenderedPosition2(ele, getPoint) {
        if (ele.isEdge() && ele.takesUpSpace()) {
          var cy = ele.cy();
          return modelToRenderedPosition$1(getPoint(ele), cy.zoom(), cy.pan());
        }
      }, "ifEdgeRenderedPosition");
      ifEdgeRenderedPositions = /* @__PURE__ */ __name(function ifEdgeRenderedPositions2(ele, getPoints) {
        if (ele.isEdge() && ele.takesUpSpace()) {
          var cy = ele.cy();
          var pan2 = cy.pan();
          var zoom2 = cy.zoom();
          return getPoints(ele).map(function(p3) {
            return modelToRenderedPosition$1(p3, zoom2, pan2);
          });
        }
      }, "ifEdgeRenderedPositions");
      controlPoints2 = /* @__PURE__ */ __name(function controlPoints3(ele) {
        return ele.renderer().getControlPoints(ele);
      }, "controlPoints");
      segmentPoints = /* @__PURE__ */ __name(function segmentPoints2(ele) {
        return ele.renderer().getSegmentPoints(ele);
      }, "segmentPoints");
      sourceEndpoint = /* @__PURE__ */ __name(function sourceEndpoint2(ele) {
        return ele.renderer().getSourceEndpoint(ele);
      }, "sourceEndpoint");
      targetEndpoint = /* @__PURE__ */ __name(function targetEndpoint2(ele) {
        return ele.renderer().getTargetEndpoint(ele);
      }, "targetEndpoint");
      midpoint = /* @__PURE__ */ __name(function midpoint2(ele) {
        return ele.renderer().getEdgeMidpoint(ele);
      }, "midpoint");
      pts = {
        controlPoints: {
          get: controlPoints2,
          mult: true
        },
        segmentPoints: {
          get: segmentPoints,
          mult: true
        },
        sourceEndpoint: {
          get: sourceEndpoint
        },
        targetEndpoint: {
          get: targetEndpoint
        },
        midpoint: {
          get: midpoint
        }
      };
      renderedName = /* @__PURE__ */ __name(function renderedName2(name) {
        return "rendered" + name[0].toUpperCase() + name.substr(1);
      }, "renderedName");
      edgePoints = Object.keys(pts).reduce(function(obj, name) {
        var spec = pts[name];
        var rName = renderedName(name);
        obj[name] = function() {
          return ifEdge(this, spec.get);
        };
        if (spec.mult) {
          obj[rName] = function() {
            return ifEdgeRenderedPositions(this, spec.get);
          };
        } else {
          obj[rName] = function() {
            return ifEdgeRenderedPosition(this, spec.get);
          };
        }
        return obj;
      }, {});
      dimensions = extend4({}, position2, bounds, widthHeight, edgePoints);
      Event = /* @__PURE__ */ __name(function Event2(src, props) {
        this.recycle(src, props);
      }, "Event");
      __name(returnFalse, "returnFalse");
      __name(returnTrue, "returnTrue");
      Event.prototype = {
        instanceString: /* @__PURE__ */ __name(function instanceString2() {
          return "event";
        }, "instanceString"),
        recycle: /* @__PURE__ */ __name(function recycle(src, props) {
          this.isImmediatePropagationStopped = this.isPropagationStopped = this.isDefaultPrevented = returnFalse;
          if (src != null && src.preventDefault) {
            this.type = src.type;
            this.isDefaultPrevented = src.defaultPrevented ? returnTrue : returnFalse;
          } else if (src != null && src.type) {
            props = src;
          } else {
            this.type = src;
          }
          if (props != null) {
            this.originalEvent = props.originalEvent;
            this.type = props.type != null ? props.type : this.type;
            this.cy = props.cy;
            this.target = props.target;
            this.position = props.position;
            this.renderedPosition = props.renderedPosition;
            this.namespace = props.namespace;
            this.layout = props.layout;
          }
          if (this.cy != null && this.position != null && this.renderedPosition == null) {
            var pos = this.position;
            var zoom2 = this.cy.zoom();
            var pan2 = this.cy.pan();
            this.renderedPosition = {
              x: pos.x * zoom2 + pan2.x,
              y: pos.y * zoom2 + pan2.y
            };
          }
          this.timeStamp = src && src.timeStamp || Date.now();
        }, "recycle"),
        preventDefault: /* @__PURE__ */ __name(function preventDefault() {
          this.isDefaultPrevented = returnTrue;
          var e3 = this.originalEvent;
          if (!e3) {
            return;
          }
          if (e3.preventDefault) {
            e3.preventDefault();
          }
        }, "preventDefault"),
        stopPropagation: /* @__PURE__ */ __name(function stopPropagation() {
          this.isPropagationStopped = returnTrue;
          var e3 = this.originalEvent;
          if (!e3) {
            return;
          }
          if (e3.stopPropagation) {
            e3.stopPropagation();
          }
        }, "stopPropagation"),
        stopImmediatePropagation: /* @__PURE__ */ __name(function stopImmediatePropagation() {
          this.isImmediatePropagationStopped = returnTrue;
          this.stopPropagation();
        }, "stopImmediatePropagation"),
        isDefaultPrevented: returnFalse,
        isPropagationStopped: returnFalse,
        isImmediatePropagationStopped: returnFalse
      };
      eventRegex = /^([^.]+)(\.(?:[^.]+))?$/;
      universalNamespace = ".*";
      defaults$8 = {
        qualifierCompare: /* @__PURE__ */ __name(function qualifierCompare(q1, q22) {
          return q1 === q22;
        }, "qualifierCompare"),
        eventMatches: /* @__PURE__ */ __name(function eventMatches() {
          return true;
        }, "eventMatches"),
        addEventFields: /* @__PURE__ */ __name(function addEventFields() {
        }, "addEventFields"),
        callbackContext: /* @__PURE__ */ __name(function callbackContext(context) {
          return context;
        }, "callbackContext"),
        beforeEmit: /* @__PURE__ */ __name(function beforeEmit() {
        }, "beforeEmit"),
        afterEmit: /* @__PURE__ */ __name(function afterEmit() {
        }, "afterEmit"),
        bubble: /* @__PURE__ */ __name(function bubble() {
          return false;
        }, "bubble"),
        parent: /* @__PURE__ */ __name(function parent2() {
          return null;
        }, "parent"),
        context: null
      };
      defaultsKeys = Object.keys(defaults$8);
      emptyOpts = {};
      __name(Emitter, "Emitter");
      p2 = Emitter.prototype;
      forEachEvent = /* @__PURE__ */ __name(function forEachEvent2(self2, handler, events, qualifier, callback, conf5, confOverrides) {
        if (fn$6(qualifier)) {
          callback = qualifier;
          qualifier = null;
        }
        if (confOverrides) {
          if (conf5 == null) {
            conf5 = confOverrides;
          } else {
            conf5 = extend4({}, conf5, confOverrides);
          }
        }
        var eventList = array2(events) ? events : events.split(/\s+/);
        for (var i2 = 0; i2 < eventList.length; i2++) {
          var evt = eventList[i2];
          if (emptyString(evt)) {
            continue;
          }
          var match2 = evt.match(eventRegex);
          if (match2) {
            var type3 = match2[1];
            var namespace = match2[2] ? match2[2] : null;
            var ret = handler(self2, evt, type3, namespace, qualifier, callback, conf5);
            if (ret === false) {
              break;
            }
          }
        }
      }, "forEachEvent");
      makeEventObj = /* @__PURE__ */ __name(function makeEventObj2(self2, obj) {
        self2.addEventFields(self2.context, obj);
        return new Event(obj.type, obj);
      }, "makeEventObj");
      forEachEventObj = /* @__PURE__ */ __name(function forEachEventObj2(self2, handler, events) {
        if (event(events)) {
          handler(self2, events);
          return;
        } else if (plainObject(events)) {
          handler(self2, makeEventObj(self2, events));
          return;
        }
        var eventList = array2(events) ? events : events.split(/\s+/);
        for (var i2 = 0; i2 < eventList.length; i2++) {
          var evt = eventList[i2];
          if (emptyString(evt)) {
            continue;
          }
          var match2 = evt.match(eventRegex);
          if (match2) {
            var type3 = match2[1];
            var namespace = match2[2] ? match2[2] : null;
            var eventObj = makeEventObj(self2, {
              type: type3,
              namespace,
              target: self2.context
            });
            handler(self2, eventObj);
          }
        }
      }, "forEachEventObj");
      p2.on = p2.addListener = function(events, qualifier, callback, conf5, confOverrides) {
        forEachEvent(this, function(self2, event3, type3, namespace, qualifier2, callback2, conf6) {
          if (fn$6(callback2)) {
            self2.listeners.push({
              event: event3,
              // full event string
              callback: callback2,
              // callback to run
              type: type3,
              // the event type (e.g. 'click')
              namespace,
              // the event namespace (e.g. ".foo")
              qualifier: qualifier2,
              // a restriction on whether to match this emitter
              conf: conf6
              // additional configuration
            });
          }
        }, events, qualifier, callback, conf5, confOverrides);
        return this;
      };
      p2.one = function(events, qualifier, callback, conf5) {
        return this.on(events, qualifier, callback, conf5, {
          one: true
        });
      };
      p2.removeListener = p2.off = function(events, qualifier, callback, conf5) {
        var _this = this;
        if (this.emitting !== 0) {
          this.listeners = copyArray2(this.listeners);
        }
        var listeners = this.listeners;
        var _loop = /* @__PURE__ */ __name(function _loop2(i3) {
          var listener = listeners[i3];
          forEachEvent(_this, function(self2, event3, type3, namespace, qualifier2, callback2) {
            if ((listener.type === type3 || events === "*") && (!namespace && listener.namespace !== ".*" || listener.namespace === namespace) && (!qualifier2 || self2.qualifierCompare(listener.qualifier, qualifier2)) && (!callback2 || listener.callback === callback2)) {
              listeners.splice(i3, 1);
              return false;
            }
          }, events, qualifier, callback, conf5);
        }, "_loop");
        for (var i2 = listeners.length - 1; i2 >= 0; i2--) {
          _loop(i2);
        }
        return this;
      };
      p2.removeAllListeners = function() {
        return this.removeListener("*");
      };
      p2.emit = p2.trigger = function(events, extraParams, manualCallback) {
        var listeners = this.listeners;
        var numListenersBeforeEmit = listeners.length;
        this.emitting++;
        if (!array2(extraParams)) {
          extraParams = [extraParams];
        }
        forEachEventObj(this, function(self2, eventObj) {
          if (manualCallback != null) {
            listeners = [{
              event: eventObj.event,
              type: eventObj.type,
              namespace: eventObj.namespace,
              callback: manualCallback
            }];
            numListenersBeforeEmit = listeners.length;
          }
          var _loop2 = /* @__PURE__ */ __name(function _loop22() {
            var listener = listeners[i2];
            if (listener.type === eventObj.type && (!listener.namespace || listener.namespace === eventObj.namespace || listener.namespace === universalNamespace) && self2.eventMatches(self2.context, listener, eventObj)) {
              var args = [eventObj];
              if (extraParams != null) {
                push(args, extraParams);
              }
              self2.beforeEmit(self2.context, listener, eventObj);
              if (listener.conf && listener.conf.one) {
                self2.listeners = self2.listeners.filter(function(l4) {
                  return l4 !== listener;
                });
              }
              var context = self2.callbackContext(self2.context, listener, eventObj);
              var ret = listener.callback.apply(context, args);
              self2.afterEmit(self2.context, listener, eventObj);
              if (ret === false) {
                eventObj.stopPropagation();
                eventObj.preventDefault();
              }
            }
          }, "_loop2");
          for (var i2 = 0; i2 < numListenersBeforeEmit; i2++) {
            _loop2();
          }
          if (self2.bubble(self2.context) && !eventObj.isPropagationStopped()) {
            self2.parent(self2.context).emit(eventObj, extraParams);
          }
        }, events);
        this.emitting--;
        return this;
      };
      emitterOptions$1 = {
        qualifierCompare: /* @__PURE__ */ __name(function qualifierCompare2(selector1, selector2) {
          if (selector1 == null || selector2 == null) {
            return selector1 == null && selector2 == null;
          } else {
            return selector1.sameText(selector2);
          }
        }, "qualifierCompare"),
        eventMatches: /* @__PURE__ */ __name(function eventMatches2(ele, listener, eventObj) {
          var selector = listener.qualifier;
          if (selector != null) {
            return ele !== eventObj.target && element(eventObj.target) && selector.matches(eventObj.target);
          }
          return true;
        }, "eventMatches"),
        addEventFields: /* @__PURE__ */ __name(function addEventFields2(ele, evt) {
          evt.cy = ele.cy();
          evt.target = ele;
        }, "addEventFields"),
        callbackContext: /* @__PURE__ */ __name(function callbackContext2(ele, listener, eventObj) {
          return listener.qualifier != null ? eventObj.target : ele;
        }, "callbackContext"),
        beforeEmit: /* @__PURE__ */ __name(function beforeEmit2(context, listener) {
          if (listener.conf && listener.conf.once) {
            listener.conf.onceCollection.removeListener(listener.event, listener.qualifier, listener.callback);
          }
        }, "beforeEmit"),
        bubble: /* @__PURE__ */ __name(function bubble2() {
          return true;
        }, "bubble"),
        parent: /* @__PURE__ */ __name(function parent3(ele) {
          return ele.isChild() ? ele.parent() : ele.cy();
        }, "parent")
      };
      argSelector$1 = /* @__PURE__ */ __name(function argSelector(arg) {
        if (string(arg)) {
          return new Selector(arg);
        } else {
          return arg;
        }
      }, "argSelector");
      elesfn$9 = {
        createEmitter: /* @__PURE__ */ __name(function createEmitter() {
          for (var i2 = 0; i2 < this.length; i2++) {
            var ele = this[i2];
            var _p = ele._private;
            if (!_p.emitter) {
              _p.emitter = new Emitter(emitterOptions$1, ele);
            }
          }
          return this;
        }, "createEmitter"),
        emitter: /* @__PURE__ */ __name(function emitter() {
          return this._private.emitter;
        }, "emitter"),
        on: /* @__PURE__ */ __name(function on(events, selector, callback) {
          var argSel = argSelector$1(selector);
          for (var i2 = 0; i2 < this.length; i2++) {
            var ele = this[i2];
            ele.emitter().on(events, argSel, callback);
          }
          return this;
        }, "on"),
        removeListener: /* @__PURE__ */ __name(function removeListener(events, selector, callback) {
          var argSel = argSelector$1(selector);
          for (var i2 = 0; i2 < this.length; i2++) {
            var ele = this[i2];
            ele.emitter().removeListener(events, argSel, callback);
          }
          return this;
        }, "removeListener"),
        removeAllListeners: /* @__PURE__ */ __name(function removeAllListeners() {
          for (var i2 = 0; i2 < this.length; i2++) {
            var ele = this[i2];
            ele.emitter().removeAllListeners();
          }
          return this;
        }, "removeAllListeners"),
        one: /* @__PURE__ */ __name(function one2(events, selector, callback) {
          var argSel = argSelector$1(selector);
          for (var i2 = 0; i2 < this.length; i2++) {
            var ele = this[i2];
            ele.emitter().one(events, argSel, callback);
          }
          return this;
        }, "one"),
        once: /* @__PURE__ */ __name(function once(events, selector, callback) {
          var argSel = argSelector$1(selector);
          for (var i2 = 0; i2 < this.length; i2++) {
            var ele = this[i2];
            ele.emitter().on(events, argSel, callback, {
              once: true,
              onceCollection: this
            });
          }
        }, "once"),
        emit: /* @__PURE__ */ __name(function emit(events, extraParams) {
          for (var i2 = 0; i2 < this.length; i2++) {
            var ele = this[i2];
            ele.emitter().emit(events, extraParams);
          }
          return this;
        }, "emit"),
        emitAndNotify: /* @__PURE__ */ __name(function emitAndNotify(event3, extraParams) {
          if (this.length === 0) {
            return;
          }
          this.cy().notify(event3, this);
          this.emit(event3, extraParams);
          return this;
        }, "emitAndNotify")
      };
      define2.eventAliasesOn(elesfn$9);
      elesfn$8 = {
        nodes: /* @__PURE__ */ __name(function nodes(selector) {
          return this.filter(function(ele) {
            return ele.isNode();
          }).filter(selector);
        }, "nodes"),
        edges: /* @__PURE__ */ __name(function edges(selector) {
          return this.filter(function(ele) {
            return ele.isEdge();
          }).filter(selector);
        }, "edges"),
        // internal helper to get nodes and edges as separate collections with single iteration over elements
        byGroup: /* @__PURE__ */ __name(function byGroup() {
          var nodes5 = this.spawn();
          var edges3 = this.spawn();
          for (var i2 = 0; i2 < this.length; i2++) {
            var ele = this[i2];
            if (ele.isNode()) {
              nodes5.push(ele);
            } else {
              edges3.push(ele);
            }
          }
          return {
            nodes: nodes5,
            edges: edges3
          };
        }, "byGroup"),
        filter: /* @__PURE__ */ __name(function filter5(_filter, thisArg) {
          if (_filter === void 0) {
            return this;
          } else if (string(_filter) || elementOrCollection(_filter)) {
            return new Selector(_filter).filter(this);
          } else if (fn$6(_filter)) {
            var filterEles = this.spawn();
            var eles = this;
            for (var i2 = 0; i2 < eles.length; i2++) {
              var ele = eles[i2];
              var include = thisArg ? _filter.apply(thisArg, [ele, i2, eles]) : _filter(ele, i2, eles);
              if (include) {
                filterEles.push(ele);
              }
            }
            return filterEles;
          }
          return this.spawn();
        }, "filter"),
        not: /* @__PURE__ */ __name(function not(toRemove) {
          if (!toRemove) {
            return this;
          } else {
            if (string(toRemove)) {
              toRemove = this.filter(toRemove);
            }
            var elements2 = this.spawn();
            for (var i2 = 0; i2 < this.length; i2++) {
              var element3 = this[i2];
              var remove3 = toRemove.has(element3);
              if (!remove3) {
                elements2.push(element3);
              }
            }
            return elements2;
          }
        }, "not"),
        absoluteComplement: /* @__PURE__ */ __name(function absoluteComplement() {
          var cy = this.cy();
          return cy.mutableElements().not(this);
        }, "absoluteComplement"),
        intersect: /* @__PURE__ */ __name(function intersect2(other) {
          if (string(other)) {
            var selector = other;
            return this.filter(selector);
          }
          var elements2 = this.spawn();
          var col1 = this;
          var col2 = other;
          var col1Smaller = this.length < other.length;
          var colS = col1Smaller ? col1 : col2;
          var colL = col1Smaller ? col2 : col1;
          for (var i2 = 0; i2 < colS.length; i2++) {
            var ele = colS[i2];
            if (colL.has(ele)) {
              elements2.push(ele);
            }
          }
          return elements2;
        }, "intersect"),
        xor: /* @__PURE__ */ __name(function xor(other) {
          var cy = this._private.cy;
          if (string(other)) {
            other = cy.$(other);
          }
          var elements2 = this.spawn();
          var col1 = this;
          var col2 = other;
          var add3 = /* @__PURE__ */ __name(function add4(col, other2) {
            for (var i2 = 0; i2 < col.length; i2++) {
              var ele = col[i2];
              var id34 = ele._private.data.id;
              var inOther = other2.hasElementWithId(id34);
              if (!inOther) {
                elements2.push(ele);
              }
            }
          }, "add");
          add3(col1, col2);
          add3(col2, col1);
          return elements2;
        }, "xor"),
        diff: /* @__PURE__ */ __name(function diff(other) {
          var cy = this._private.cy;
          if (string(other)) {
            other = cy.$(other);
          }
          var left3 = this.spawn();
          var right3 = this.spawn();
          var both = this.spawn();
          var col1 = this;
          var col2 = other;
          var add3 = /* @__PURE__ */ __name(function add4(col, other2, retEles) {
            for (var i2 = 0; i2 < col.length; i2++) {
              var ele = col[i2];
              var id34 = ele._private.data.id;
              var inOther = other2.hasElementWithId(id34);
              if (inOther) {
                both.merge(ele);
              } else {
                retEles.push(ele);
              }
            }
          }, "add");
          add3(col1, col2, left3);
          add3(col2, col1, right3);
          return {
            left: left3,
            right: right3,
            both
          };
        }, "diff"),
        add: /* @__PURE__ */ __name(function add(toAdd) {
          var cy = this._private.cy;
          if (!toAdd) {
            return this;
          }
          if (string(toAdd)) {
            var selector = toAdd;
            toAdd = cy.mutableElements().filter(selector);
          }
          var elements2 = this.spawnSelf();
          for (var i2 = 0; i2 < toAdd.length; i2++) {
            var ele = toAdd[i2];
            var add3 = !this.has(ele);
            if (add3) {
              elements2.push(ele);
            }
          }
          return elements2;
        }, "add"),
        // in place merge on calling collection
        merge: /* @__PURE__ */ __name(function merge3(toAdd) {
          var _p = this._private;
          var cy = _p.cy;
          if (!toAdd) {
            return this;
          }
          if (toAdd && string(toAdd)) {
            var selector = toAdd;
            toAdd = cy.mutableElements().filter(selector);
          }
          var map5 = _p.map;
          for (var i2 = 0; i2 < toAdd.length; i2++) {
            var toAddEle = toAdd[i2];
            var id34 = toAddEle._private.data.id;
            var add3 = !map5.has(id34);
            if (add3) {
              var index = this.length++;
              this[index] = toAddEle;
              map5.set(id34, {
                ele: toAddEle,
                index
              });
            }
          }
          return this;
        }, "merge"),
        unmergeAt: /* @__PURE__ */ __name(function unmergeAt(i2) {
          var ele = this[i2];
          var id34 = ele.id();
          var _p = this._private;
          var map5 = _p.map;
          this[i2] = void 0;
          map5["delete"](id34);
          var unmergedLastEle = i2 === this.length - 1;
          if (this.length > 1 && !unmergedLastEle) {
            var lastEleI = this.length - 1;
            var lastEle = this[lastEleI];
            var lastEleId = lastEle._private.data.id;
            this[lastEleI] = void 0;
            this[i2] = lastEle;
            map5.set(lastEleId, {
              ele: lastEle,
              index: i2
            });
          }
          this.length--;
          return this;
        }, "unmergeAt"),
        // remove single ele in place in calling collection
        unmergeOne: /* @__PURE__ */ __name(function unmergeOne(ele) {
          ele = ele[0];
          var _p = this._private;
          var id34 = ele._private.data.id;
          var map5 = _p.map;
          var entry = map5.get(id34);
          if (!entry) {
            return this;
          }
          var i2 = entry.index;
          this.unmergeAt(i2);
          return this;
        }, "unmergeOne"),
        // remove eles in place on calling collection
        unmerge: /* @__PURE__ */ __name(function unmerge(toRemove) {
          var cy = this._private.cy;
          if (!toRemove) {
            return this;
          }
          if (toRemove && string(toRemove)) {
            var selector = toRemove;
            toRemove = cy.mutableElements().filter(selector);
          }
          for (var i2 = 0; i2 < toRemove.length; i2++) {
            this.unmergeOne(toRemove[i2]);
          }
          return this;
        }, "unmerge"),
        unmergeBy: /* @__PURE__ */ __name(function unmergeBy(toRmFn) {
          for (var i2 = this.length - 1; i2 >= 0; i2--) {
            var ele = this[i2];
            if (toRmFn(ele)) {
              this.unmergeAt(i2);
            }
          }
          return this;
        }, "unmergeBy"),
        map: /* @__PURE__ */ __name(function map4(mapFn, thisArg) {
          var arr = [];
          var eles = this;
          for (var i2 = 0; i2 < eles.length; i2++) {
            var ele = eles[i2];
            var ret = thisArg ? mapFn.apply(thisArg, [ele, i2, eles]) : mapFn(ele, i2, eles);
            arr.push(ret);
          }
          return arr;
        }, "map"),
        reduce: /* @__PURE__ */ __name(function reduce2(fn3, initialValue) {
          var val = initialValue;
          var eles = this;
          for (var i2 = 0; i2 < eles.length; i2++) {
            val = fn3(val, eles[i2], i2, eles);
          }
          return val;
        }, "reduce"),
        max: /* @__PURE__ */ __name(function max8(valFn, thisArg) {
          var max10 = -Infinity;
          var maxEle;
          var eles = this;
          for (var i2 = 0; i2 < eles.length; i2++) {
            var ele = eles[i2];
            var val = thisArg ? valFn.apply(thisArg, [ele, i2, eles]) : valFn(ele, i2, eles);
            if (val > max10) {
              max10 = val;
              maxEle = ele;
            }
          }
          return {
            value: max10,
            ele: maxEle
          };
        }, "max"),
        min: /* @__PURE__ */ __name(function min7(valFn, thisArg) {
          var min9 = Infinity;
          var minEle;
          var eles = this;
          for (var i2 = 0; i2 < eles.length; i2++) {
            var ele = eles[i2];
            var val = thisArg ? valFn.apply(thisArg, [ele, i2, eles]) : valFn(ele, i2, eles);
            if (val < min9) {
              min9 = val;
              minEle = ele;
            }
          }
          return {
            value: min9,
            ele: minEle
          };
        }, "min")
      };
      fn$1 = elesfn$8;
      fn$1["u"] = fn$1["|"] = fn$1["+"] = fn$1.union = fn$1.or = fn$1.add;
      fn$1["\\"] = fn$1["!"] = fn$1["-"] = fn$1.difference = fn$1.relativeComplement = fn$1.subtract = fn$1.not;
      fn$1["n"] = fn$1["&"] = fn$1["."] = fn$1.and = fn$1.intersection = fn$1.intersect;
      fn$1["^"] = fn$1["(+)"] = fn$1["(-)"] = fn$1.symmetricDifference = fn$1.symdiff = fn$1.xor;
      fn$1.fnFilter = fn$1.filterFn = fn$1.stdFilter = fn$1.filter;
      fn$1.complement = fn$1.abscomp = fn$1.absoluteComplement;
      elesfn$7 = {
        isNode: /* @__PURE__ */ __name(function isNode() {
          return this.group() === "nodes";
        }, "isNode"),
        isEdge: /* @__PURE__ */ __name(function isEdge() {
          return this.group() === "edges";
        }, "isEdge"),
        isLoop: /* @__PURE__ */ __name(function isLoop() {
          return this.isEdge() && this.source()[0] === this.target()[0];
        }, "isLoop"),
        isSimple: /* @__PURE__ */ __name(function isSimple() {
          return this.isEdge() && this.source()[0] !== this.target()[0];
        }, "isSimple"),
        group: /* @__PURE__ */ __name(function group() {
          var ele = this[0];
          if (ele) {
            return ele._private.group;
          }
        }, "group")
      };
      zIndexSort = /* @__PURE__ */ __name(function zIndexSort2(a2, b3) {
        var cy = a2.cy();
        var hasCompoundNodes2 = cy.hasCompoundNodes();
        function getDepth(ele) {
          var style3 = ele.pstyle("z-compound-depth");
          if (style3.value === "auto") {
            return hasCompoundNodes2 ? ele.zDepth() : 0;
          } else if (style3.value === "bottom") {
            return -1;
          } else if (style3.value === "top") {
            return MAX_INT$1;
          }
          return 0;
        }
        __name(getDepth, "getDepth");
        var depthDiff = getDepth(a2) - getDepth(b3);
        if (depthDiff !== 0) {
          return depthDiff;
        }
        function getEleDepth(ele) {
          var style3 = ele.pstyle("z-index-compare");
          if (style3.value === "auto") {
            return ele.isNode() ? 1 : 0;
          }
          return 0;
        }
        __name(getEleDepth, "getEleDepth");
        var eleDiff = getEleDepth(a2) - getEleDepth(b3);
        if (eleDiff !== 0) {
          return eleDiff;
        }
        var zDiff = a2.pstyle("z-index").value - b3.pstyle("z-index").value;
        if (zDiff !== 0) {
          return zDiff;
        }
        return a2.poolIndex() - b3.poolIndex();
      }, "zIndexSort");
      elesfn$6 = {
        forEach: /* @__PURE__ */ __name(function forEach2(fn3, thisArg) {
          if (fn$6(fn3)) {
            var N3 = this.length;
            for (var i2 = 0; i2 < N3; i2++) {
              var ele = this[i2];
              var ret = thisArg ? fn3.apply(thisArg, [ele, i2, this]) : fn3(ele, i2, this);
              if (ret === false) {
                break;
              }
            }
          }
          return this;
        }, "forEach"),
        toArray: /* @__PURE__ */ __name(function toArray2() {
          var array4 = [];
          for (var i2 = 0; i2 < this.length; i2++) {
            array4.push(this[i2]);
          }
          return array4;
        }, "toArray"),
        slice: /* @__PURE__ */ __name(function slice2(start3, end2) {
          var array4 = [];
          var thisSize = this.length;
          if (end2 == null) {
            end2 = thisSize;
          }
          if (start3 == null) {
            start3 = 0;
          }
          if (start3 < 0) {
            start3 = thisSize + start3;
          }
          if (end2 < 0) {
            end2 = thisSize + end2;
          }
          for (var i2 = start3; i2 >= 0 && i2 < end2 && i2 < thisSize; i2++) {
            array4.push(this[i2]);
          }
          return this.spawn(array4);
        }, "slice"),
        size: /* @__PURE__ */ __name(function size2() {
          return this.length;
        }, "size"),
        eq: /* @__PURE__ */ __name(function eq2(i2) {
          return this[i2] || this.spawn();
        }, "eq"),
        first: /* @__PURE__ */ __name(function first() {
          return this[0] || this.spawn();
        }, "first"),
        last: /* @__PURE__ */ __name(function last2() {
          return this[this.length - 1] || this.spawn();
        }, "last"),
        empty: /* @__PURE__ */ __name(function empty2() {
          return this.length === 0;
        }, "empty"),
        nonempty: /* @__PURE__ */ __name(function nonempty() {
          return !this.empty();
        }, "nonempty"),
        sort: /* @__PURE__ */ __name(function sort2(sortFn) {
          if (!fn$6(sortFn)) {
            return this;
          }
          var sorted = this.toArray().sort(sortFn);
          return this.spawn(sorted);
        }, "sort"),
        sortByZIndex: /* @__PURE__ */ __name(function sortByZIndex() {
          return this.sort(zIndexSort);
        }, "sortByZIndex"),
        zDepth: /* @__PURE__ */ __name(function zDepth() {
          var ele = this[0];
          if (!ele) {
            return void 0;
          }
          var _p = ele._private;
          var group2 = _p.group;
          if (group2 === "nodes") {
            var depth = _p.data.parent ? ele.parents().size() : 0;
            if (!ele.isParent()) {
              return MAX_INT$1 - 1;
            }
            return depth;
          } else {
            var src = _p.source;
            var tgt = _p.target;
            var srcDepth = src.zDepth();
            var tgtDepth = tgt.zDepth();
            return Math.max(srcDepth, tgtDepth, 0);
          }
        }, "zDepth")
      };
      elesfn$6.each = elesfn$6.forEach;
      defineSymbolIterator = /* @__PURE__ */ __name(function defineSymbolIterator2() {
        var typeofUndef = "undefined";
        var isIteratorSupported = (typeof Symbol === "undefined" ? "undefined" : _typeof(Symbol)) != typeofUndef && _typeof(Symbol.iterator) != typeofUndef;
        if (isIteratorSupported) {
          elesfn$6[Symbol.iterator] = function() {
            var _this = this;
            var entry = {
              value: void 0,
              done: false
            };
            var i2 = 0;
            var length2 = this.length;
            return _defineProperty$1({
              next: /* @__PURE__ */ __name(function next3() {
                if (i2 < length2) {
                  entry.value = _this[i2++];
                } else {
                  entry.value = void 0;
                  entry.done = true;
                }
                return entry;
              }, "next")
            }, Symbol.iterator, function() {
              return this;
            });
          };
        }
      }, "defineSymbolIterator");
      defineSymbolIterator();
      getLayoutDimensionOptions = defaults$g({
        nodeDimensionsIncludeLabels: false
      });
      elesfn$5 = {
        // Calculates and returns node dimensions { x, y } based on options given
        layoutDimensions: /* @__PURE__ */ __name(function layoutDimensions(options2) {
          options2 = getLayoutDimensionOptions(options2);
          var dims;
          if (!this.takesUpSpace()) {
            dims = {
              w: 0,
              h: 0
            };
          } else if (options2.nodeDimensionsIncludeLabels) {
            var bbDim = this.boundingBox();
            dims = {
              w: bbDim.w,
              h: bbDim.h
            };
          } else {
            dims = {
              w: this.outerWidth(),
              h: this.outerHeight()
            };
          }
          if (dims.w === 0 || dims.h === 0) {
            dims.w = dims.h = 1;
          }
          return dims;
        }, "layoutDimensions"),
        // using standard layout options, apply position function (w/ or w/o animation)
        layoutPositions: /* @__PURE__ */ __name(function layoutPositions(layout7, options2, fn3) {
          var nodes5 = this.nodes().filter(function(n2) {
            return !n2.isParent();
          });
          var cy = this.cy();
          var layoutEles = options2.eles;
          var getMemoizeKey = /* @__PURE__ */ __name(function getMemoizeKey2(node3) {
            return node3.id();
          }, "getMemoizeKey");
          var fnMem = memoize2(fn3, getMemoizeKey);
          layout7.emit({
            type: "layoutstart",
            layout: layout7
          });
          layout7.animations = [];
          var calculateSpacing = /* @__PURE__ */ __name(function calculateSpacing2(spacing2, nodesBb, pos) {
            var center4 = {
              x: nodesBb.x1 + nodesBb.w / 2,
              y: nodesBb.y1 + nodesBb.h / 2
            };
            var spacingVector = {
              // scale from center of bounding box (not necessarily 0,0)
              x: (pos.x - center4.x) * spacing2,
              y: (pos.y - center4.y) * spacing2
            };
            return {
              x: center4.x + spacingVector.x,
              y: center4.y + spacingVector.y
            };
          }, "calculateSpacing");
          var useSpacingFactor = options2.spacingFactor && options2.spacingFactor !== 1;
          var spacingBb = /* @__PURE__ */ __name(function spacingBb2() {
            if (!useSpacingFactor) {
              return null;
            }
            var bb2 = makeBoundingBox();
            for (var i3 = 0; i3 < nodes5.length; i3++) {
              var node3 = nodes5[i3];
              var pos = fnMem(node3, i3);
              expandBoundingBoxByPoint(bb2, pos.x, pos.y);
            }
            return bb2;
          }, "spacingBb");
          var bb = spacingBb();
          var getFinalPos = memoize2(function(node3, i3) {
            var newPos2 = fnMem(node3, i3);
            if (useSpacingFactor) {
              var spacing2 = Math.abs(options2.spacingFactor);
              newPos2 = calculateSpacing(spacing2, bb, newPos2);
            }
            if (options2.transform != null) {
              newPos2 = options2.transform(node3, newPos2);
            }
            return newPos2;
          }, getMemoizeKey);
          if (options2.animate) {
            for (var i2 = 0; i2 < nodes5.length; i2++) {
              var node2 = nodes5[i2];
              var newPos = getFinalPos(node2, i2);
              var animateNode = options2.animateFilter == null || options2.animateFilter(node2, i2);
              if (animateNode) {
                var ani = node2.animation({
                  position: newPos,
                  duration: options2.animationDuration,
                  easing: options2.animationEasing
                });
                layout7.animations.push(ani);
              } else {
                node2.position(newPos);
              }
            }
            if (options2.fit) {
              var fitAni = cy.animation({
                fit: {
                  boundingBox: layoutEles.boundingBoxAt(getFinalPos),
                  padding: options2.padding
                },
                duration: options2.animationDuration,
                easing: options2.animationEasing
              });
              layout7.animations.push(fitAni);
            } else if (options2.zoom !== void 0 && options2.pan !== void 0) {
              var zoomPanAni = cy.animation({
                zoom: options2.zoom,
                pan: options2.pan,
                duration: options2.animationDuration,
                easing: options2.animationEasing
              });
              layout7.animations.push(zoomPanAni);
            }
            layout7.animations.forEach(function(ani2) {
              return ani2.play();
            });
            layout7.one("layoutready", options2.ready);
            layout7.emit({
              type: "layoutready",
              layout: layout7
            });
            Promise$1.all(layout7.animations.map(function(ani2) {
              return ani2.promise();
            })).then(function() {
              layout7.one("layoutstop", options2.stop);
              layout7.emit({
                type: "layoutstop",
                layout: layout7
              });
            });
          } else {
            nodes5.positions(getFinalPos);
            if (options2.fit) {
              cy.fit(options2.eles, options2.padding);
            }
            if (options2.zoom != null) {
              cy.zoom(options2.zoom);
            }
            if (options2.pan) {
              cy.pan(options2.pan);
            }
            layout7.one("layoutready", options2.ready);
            layout7.emit({
              type: "layoutready",
              layout: layout7
            });
            layout7.one("layoutstop", options2.stop);
            layout7.emit({
              type: "layoutstop",
              layout: layout7
            });
          }
          return this;
        }, "layoutPositions"),
        layout: /* @__PURE__ */ __name(function layout2(options2) {
          var cy = this.cy();
          return cy.makeLayout(extend4({}, options2, {
            eles: this
          }));
        }, "layout")
      };
      elesfn$5.createLayout = elesfn$5.makeLayout = elesfn$5.layout;
      __name(styleCache, "styleCache");
      __name(cacheStyleFunction, "cacheStyleFunction");
      __name(cachePrototypeStyleFunction, "cachePrototypeStyleFunction");
      elesfn$4 = {
        recalculateRenderedStyle: /* @__PURE__ */ __name(function recalculateRenderedStyle(useCache) {
          var cy = this.cy();
          var renderer13 = cy.renderer();
          var styleEnabled2 = cy.styleEnabled();
          if (renderer13 && styleEnabled2) {
            renderer13.recalculateRenderedStyle(this, useCache);
          }
          return this;
        }, "recalculateRenderedStyle"),
        dirtyStyleCache: /* @__PURE__ */ __name(function dirtyStyleCache() {
          var cy = this.cy();
          var dirty = /* @__PURE__ */ __name(function dirty2(ele) {
            return ele._private.styleCache = null;
          }, "dirty");
          if (cy.hasCompoundNodes()) {
            var eles;
            eles = this.spawnSelf().merge(this.descendants()).merge(this.parents());
            eles.merge(eles.connectedEdges());
            eles.forEach(dirty);
          } else {
            this.forEach(function(ele) {
              dirty(ele);
              ele.connectedEdges().forEach(dirty);
            });
          }
          return this;
        }, "dirtyStyleCache"),
        // fully updates (recalculates) the style for the elements
        updateStyle: /* @__PURE__ */ __name(function updateStyle(notifyRenderer) {
          var cy = this._private.cy;
          if (!cy.styleEnabled()) {
            return this;
          }
          if (cy.batching()) {
            var bEles = cy._private.batchStyleEles;
            bEles.merge(this);
            return this;
          }
          var hasCompounds = cy.hasCompoundNodes();
          var updatedEles = this;
          notifyRenderer = notifyRenderer || notifyRenderer === void 0 ? true : false;
          if (hasCompounds) {
            updatedEles = this.spawnSelf().merge(this.descendants()).merge(this.parents());
          }
          var changedEles = updatedEles;
          if (notifyRenderer) {
            changedEles.emitAndNotify("style");
          } else {
            changedEles.emit("style");
          }
          updatedEles.forEach(function(ele) {
            return ele._private.styleDirty = true;
          });
          return this;
        }, "updateStyle"),
        // private: clears dirty flag and recalculates style
        cleanStyle: /* @__PURE__ */ __name(function cleanStyle() {
          var cy = this.cy();
          if (!cy.styleEnabled()) {
            return;
          }
          for (var i2 = 0; i2 < this.length; i2++) {
            var ele = this[i2];
            if (ele._private.styleDirty) {
              ele._private.styleDirty = false;
              cy.style().apply(ele);
            }
          }
        }, "cleanStyle"),
        // get the internal parsed style object for the specified property
        parsedStyle: /* @__PURE__ */ __name(function parsedStyle(property2) {
          var includeNonDefault = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
          var ele = this[0];
          var cy = ele.cy();
          if (!cy.styleEnabled()) {
            return;
          }
          if (ele) {
            if (ele._private.styleDirty) {
              ele._private.styleDirty = false;
              cy.style().apply(ele);
            }
            var overriddenStyle = ele._private.style[property2];
            if (overriddenStyle != null) {
              return overriddenStyle;
            } else if (includeNonDefault) {
              return cy.style().getDefaultProperty(property2);
            } else {
              return null;
            }
          }
        }, "parsedStyle"),
        numericStyle: /* @__PURE__ */ __name(function numericStyle(property2) {
          var ele = this[0];
          if (!ele.cy().styleEnabled()) {
            return;
          }
          if (ele) {
            var pstyle = ele.pstyle(property2);
            return pstyle.pfValue !== void 0 ? pstyle.pfValue : pstyle.value;
          }
        }, "numericStyle"),
        numericStyleUnits: /* @__PURE__ */ __name(function numericStyleUnits(property2) {
          var ele = this[0];
          if (!ele.cy().styleEnabled()) {
            return;
          }
          if (ele) {
            return ele.pstyle(property2).units;
          }
        }, "numericStyleUnits"),
        // get the specified css property as a rendered value (i.e. on-screen value)
        // or get the whole rendered style if no property specified (NB doesn't allow setting)
        renderedStyle: /* @__PURE__ */ __name(function renderedStyle(property2) {
          var cy = this.cy();
          if (!cy.styleEnabled()) {
            return this;
          }
          var ele = this[0];
          if (ele) {
            return cy.style().getRenderedStyle(ele, property2);
          }
        }, "renderedStyle"),
        // read the calculated css style of the element or override the style (via a bypass)
        style: /* @__PURE__ */ __name(function style(name, value2) {
          var cy = this.cy();
          if (!cy.styleEnabled()) {
            return this;
          }
          var updateTransitions = false;
          var style3 = cy.style();
          if (plainObject(name)) {
            var props = name;
            style3.applyBypass(this, props, updateTransitions);
            this.emitAndNotify("style");
          } else if (string(name)) {
            if (value2 === void 0) {
              var ele = this[0];
              if (ele) {
                return style3.getStylePropertyValue(ele, name);
              } else {
                return;
              }
            } else {
              style3.applyBypass(this, name, value2, updateTransitions);
              this.emitAndNotify("style");
            }
          } else if (name === void 0) {
            var _ele = this[0];
            if (_ele) {
              return style3.getRawStyle(_ele);
            } else {
              return;
            }
          }
          return this;
        }, "style"),
        removeStyle: /* @__PURE__ */ __name(function removeStyle(names) {
          var cy = this.cy();
          if (!cy.styleEnabled()) {
            return this;
          }
          var updateTransitions = false;
          var style3 = cy.style();
          var eles = this;
          if (names === void 0) {
            for (var i2 = 0; i2 < eles.length; i2++) {
              var ele = eles[i2];
              style3.removeAllBypasses(ele, updateTransitions);
            }
          } else {
            names = names.split(/\s+/);
            for (var _i = 0; _i < eles.length; _i++) {
              var _ele2 = eles[_i];
              style3.removeBypasses(_ele2, names, updateTransitions);
            }
          }
          this.emitAndNotify("style");
          return this;
        }, "removeStyle"),
        show: /* @__PURE__ */ __name(function show() {
          this.css("display", "element");
          return this;
        }, "show"),
        hide: /* @__PURE__ */ __name(function hide() {
          this.css("display", "none");
          return this;
        }, "hide"),
        effectiveOpacity: /* @__PURE__ */ __name(function effectiveOpacity() {
          var cy = this.cy();
          if (!cy.styleEnabled()) {
            return 1;
          }
          var hasCompoundNodes2 = cy.hasCompoundNodes();
          var ele = this[0];
          if (ele) {
            var _p = ele._private;
            var parentOpacity = ele.pstyle("opacity").value;
            if (!hasCompoundNodes2) {
              return parentOpacity;
            }
            var parents3 = !_p.data.parent ? null : ele.parents();
            if (parents3) {
              for (var i2 = 0; i2 < parents3.length; i2++) {
                var parent4 = parents3[i2];
                var opacity = parent4.pstyle("opacity").value;
                parentOpacity = opacity * parentOpacity;
              }
            }
            return parentOpacity;
          }
        }, "effectiveOpacity"),
        transparent: /* @__PURE__ */ __name(function transparent() {
          var cy = this.cy();
          if (!cy.styleEnabled()) {
            return false;
          }
          var ele = this[0];
          var hasCompoundNodes2 = ele.cy().hasCompoundNodes();
          if (ele) {
            if (!hasCompoundNodes2) {
              return ele.pstyle("opacity").value === 0;
            } else {
              return ele.effectiveOpacity() === 0;
            }
          }
        }, "transparent"),
        backgrounding: /* @__PURE__ */ __name(function backgrounding() {
          var cy = this.cy();
          if (!cy.styleEnabled()) {
            return false;
          }
          var ele = this[0];
          return ele._private.backgrounding ? true : false;
        }, "backgrounding")
      };
      __name(checkCompound, "checkCompound");
      __name(defineDerivedStateFunction, "defineDerivedStateFunction");
      eleTakesUpSpace = cacheStyleFunction("eleTakesUpSpace", function(ele) {
        return ele.pstyle("display").value === "element" && ele.width() !== 0 && (ele.isNode() ? ele.height() !== 0 : true);
      });
      elesfn$4.takesUpSpace = cachePrototypeStyleFunction("takesUpSpace", defineDerivedStateFunction({
        ok: eleTakesUpSpace
      }));
      eleInteractive = cacheStyleFunction("eleInteractive", function(ele) {
        return ele.pstyle("events").value === "yes" && ele.pstyle("visibility").value === "visible" && eleTakesUpSpace(ele);
      });
      parentInteractive = cacheStyleFunction("parentInteractive", function(parent4) {
        return parent4.pstyle("visibility").value === "visible" && eleTakesUpSpace(parent4);
      });
      elesfn$4.interactive = cachePrototypeStyleFunction("interactive", defineDerivedStateFunction({
        ok: eleInteractive,
        parentOk: parentInteractive,
        edgeOkViaNode: eleTakesUpSpace
      }));
      elesfn$4.noninteractive = function() {
        var ele = this[0];
        if (ele) {
          return !ele.interactive();
        }
      };
      eleVisible = cacheStyleFunction("eleVisible", function(ele) {
        return ele.pstyle("visibility").value === "visible" && ele.pstyle("opacity").pfValue !== 0 && eleTakesUpSpace(ele);
      });
      edgeVisibleViaNode = eleTakesUpSpace;
      elesfn$4.visible = cachePrototypeStyleFunction("visible", defineDerivedStateFunction({
        ok: eleVisible,
        edgeOkViaNode: edgeVisibleViaNode
      }));
      elesfn$4.hidden = function() {
        var ele = this[0];
        if (ele) {
          return !ele.visible();
        }
      };
      elesfn$4.isBundledBezier = cachePrototypeStyleFunction("isBundledBezier", function() {
        if (!this.cy().styleEnabled()) {
          return false;
        }
        return !this.removed() && this.pstyle("curve-style").value === "bezier" && this.takesUpSpace();
      });
      elesfn$4.bypass = elesfn$4.css = elesfn$4.style;
      elesfn$4.renderedCss = elesfn$4.renderedStyle;
      elesfn$4.removeBypass = elesfn$4.removeCss = elesfn$4.removeStyle;
      elesfn$4.pstyle = elesfn$4.parsedStyle;
      elesfn$3 = {};
      __name(defineSwitchFunction, "defineSwitchFunction");
      __name(defineSwitchSet, "defineSwitchSet");
      defineSwitchSet({
        field: "locked",
        overrideField: /* @__PURE__ */ __name(function overrideField(ele) {
          return ele.cy().autolock() ? true : void 0;
        }, "overrideField"),
        on: "lock",
        off: "unlock"
      });
      defineSwitchSet({
        field: "grabbable",
        overrideField: /* @__PURE__ */ __name(function overrideField2(ele) {
          return ele.cy().autoungrabify() || ele.pannable() ? false : void 0;
        }, "overrideField"),
        on: "grabify",
        off: "ungrabify"
      });
      defineSwitchSet({
        field: "selected",
        ableField: "selectable",
        overrideAble: /* @__PURE__ */ __name(function overrideAble(ele) {
          return ele.cy().autounselectify() ? false : void 0;
        }, "overrideAble"),
        on: "select",
        off: "unselect"
      });
      defineSwitchSet({
        field: "selectable",
        overrideField: /* @__PURE__ */ __name(function overrideField3(ele) {
          return ele.cy().autounselectify() ? false : void 0;
        }, "overrideField"),
        on: "selectify",
        off: "unselectify"
      });
      elesfn$3.deselect = elesfn$3.unselect;
      elesfn$3.grabbed = function() {
        var ele = this[0];
        if (ele) {
          return ele._private.grabbed;
        }
      };
      defineSwitchSet({
        field: "active",
        on: "activate",
        off: "unactivate"
      });
      defineSwitchSet({
        field: "pannable",
        on: "panify",
        off: "unpanify"
      });
      elesfn$3.inactive = function() {
        var ele = this[0];
        if (ele) {
          return !ele._private.active;
        }
      };
      elesfn$2 = {};
      defineDagExtremity = /* @__PURE__ */ __name(function defineDagExtremity2(params) {
        return /* @__PURE__ */ __name(function dagExtremityImpl(selector) {
          var eles = this;
          var ret = [];
          for (var i2 = 0; i2 < eles.length; i2++) {
            var ele = eles[i2];
            if (!ele.isNode()) {
              continue;
            }
            var disqualified = false;
            var edges3 = ele.connectedEdges();
            for (var j3 = 0; j3 < edges3.length; j3++) {
              var edge = edges3[j3];
              var src = edge.source();
              var tgt = edge.target();
              if (params.noIncomingEdges && tgt === ele && src !== ele || params.noOutgoingEdges && src === ele && tgt !== ele) {
                disqualified = true;
                break;
              }
            }
            if (!disqualified) {
              ret.push(ele);
            }
          }
          return this.spawn(ret, true).filter(selector);
        }, "dagExtremityImpl");
      }, "defineDagExtremity");
      defineDagOneHop = /* @__PURE__ */ __name(function defineDagOneHop2(params) {
        return function(selector) {
          var eles = this;
          var oEles = [];
          for (var i2 = 0; i2 < eles.length; i2++) {
            var ele = eles[i2];
            if (!ele.isNode()) {
              continue;
            }
            var edges3 = ele.connectedEdges();
            for (var j3 = 0; j3 < edges3.length; j3++) {
              var edge = edges3[j3];
              var src = edge.source();
              var tgt = edge.target();
              if (params.outgoing && src === ele) {
                oEles.push(edge);
                oEles.push(tgt);
              } else if (params.incoming && tgt === ele) {
                oEles.push(edge);
                oEles.push(src);
              }
            }
          }
          return this.spawn(oEles, true).filter(selector);
        };
      }, "defineDagOneHop");
      defineDagAllHops = /* @__PURE__ */ __name(function defineDagAllHops2(params) {
        return function(selector) {
          var eles = this;
          var sEles = [];
          var sElesIds = {};
          for (; ; ) {
            var next3 = params.outgoing ? eles.outgoers() : eles.incomers();
            if (next3.length === 0) {
              break;
            }
            var newNext = false;
            for (var i2 = 0; i2 < next3.length; i2++) {
              var n2 = next3[i2];
              var nid = n2.id();
              if (!sElesIds[nid]) {
                sElesIds[nid] = true;
                sEles.push(n2);
                newNext = true;
              }
            }
            if (!newNext) {
              break;
            }
            eles = next3;
          }
          return this.spawn(sEles, true).filter(selector);
        };
      }, "defineDagAllHops");
      elesfn$2.clearTraversalCache = function() {
        for (var i2 = 0; i2 < this.length; i2++) {
          this[i2]._private.traversalCache = null;
        }
      };
      extend4(elesfn$2, {
        // get the root nodes in the DAG
        roots: defineDagExtremity({
          noIncomingEdges: true
        }),
        // get the leaf nodes in the DAG
        leaves: defineDagExtremity({
          noOutgoingEdges: true
        }),
        // normally called children in graph theory
        // these nodes =edges=> outgoing nodes
        outgoers: cache(defineDagOneHop({
          outgoing: true
        }), "outgoers"),
        // aka DAG descendants
        successors: defineDagAllHops({
          outgoing: true
        }),
        // normally called parents in graph theory
        // these nodes <=edges= incoming nodes
        incomers: cache(defineDagOneHop({
          incoming: true
        }), "incomers"),
        // aka DAG ancestors
        predecessors: defineDagAllHops({})
      });
      extend4(elesfn$2, {
        neighborhood: cache(function(selector) {
          var elements2 = [];
          var nodes5 = this.nodes();
          for (var i2 = 0; i2 < nodes5.length; i2++) {
            var node2 = nodes5[i2];
            var connectedEdges = node2.connectedEdges();
            for (var j3 = 0; j3 < connectedEdges.length; j3++) {
              var edge = connectedEdges[j3];
              var src = edge.source();
              var tgt = edge.target();
              var otherNode = node2 === src ? tgt : src;
              if (otherNode.length > 0) {
                elements2.push(otherNode[0]);
              }
              elements2.push(edge[0]);
            }
          }
          return this.spawn(elements2, true).filter(selector);
        }, "neighborhood"),
        closedNeighborhood: /* @__PURE__ */ __name(function closedNeighborhood(selector) {
          return this.neighborhood().add(this).filter(selector);
        }, "closedNeighborhood"),
        openNeighborhood: /* @__PURE__ */ __name(function openNeighborhood(selector) {
          return this.neighborhood(selector);
        }, "openNeighborhood")
      });
      elesfn$2.neighbourhood = elesfn$2.neighborhood;
      elesfn$2.closedNeighbourhood = elesfn$2.closedNeighborhood;
      elesfn$2.openNeighbourhood = elesfn$2.openNeighborhood;
      extend4(elesfn$2, {
        source: cache(/* @__PURE__ */ __name(function sourceImpl(selector) {
          var ele = this[0];
          var src;
          if (ele) {
            src = ele._private.source || ele.cy().collection();
          }
          return src && selector ? src.filter(selector) : src;
        }, "sourceImpl"), "source"),
        target: cache(/* @__PURE__ */ __name(function targetImpl(selector) {
          var ele = this[0];
          var tgt;
          if (ele) {
            tgt = ele._private.target || ele.cy().collection();
          }
          return tgt && selector ? tgt.filter(selector) : tgt;
        }, "targetImpl"), "target"),
        sources: defineSourceFunction({
          attr: "source"
        }),
        targets: defineSourceFunction({
          attr: "target"
        })
      });
      __name(defineSourceFunction, "defineSourceFunction");
      extend4(elesfn$2, {
        edgesWith: cache(defineEdgesWithFunction(), "edgesWith"),
        edgesTo: cache(defineEdgesWithFunction({
          thisIsSrc: true
        }), "edgesTo")
      });
      __name(defineEdgesWithFunction, "defineEdgesWithFunction");
      extend4(elesfn$2, {
        connectedEdges: cache(function(selector) {
          var retEles = [];
          var eles = this;
          for (var i2 = 0; i2 < eles.length; i2++) {
            var node2 = eles[i2];
            if (!node2.isNode()) {
              continue;
            }
            var edges3 = node2._private.edges;
            for (var j3 = 0; j3 < edges3.length; j3++) {
              var edge = edges3[j3];
              retEles.push(edge);
            }
          }
          return this.spawn(retEles, true).filter(selector);
        }, "connectedEdges"),
        connectedNodes: cache(function(selector) {
          var retEles = [];
          var eles = this;
          for (var i2 = 0; i2 < eles.length; i2++) {
            var edge = eles[i2];
            if (!edge.isEdge()) {
              continue;
            }
            retEles.push(edge.source()[0]);
            retEles.push(edge.target()[0]);
          }
          return this.spawn(retEles, true).filter(selector);
        }, "connectedNodes"),
        parallelEdges: cache(defineParallelEdgesFunction(), "parallelEdges"),
        codirectedEdges: cache(defineParallelEdgesFunction({
          codirected: true
        }), "codirectedEdges")
      });
      __name(defineParallelEdgesFunction, "defineParallelEdgesFunction");
      extend4(elesfn$2, {
        components: /* @__PURE__ */ __name(function components2(root3) {
          var self2 = this;
          var cy = self2.cy();
          var visited = cy.collection();
          var unvisited = root3 == null ? self2.nodes() : root3.nodes();
          var components3 = [];
          if (root3 != null && unvisited.empty()) {
            unvisited = root3.sources();
          }
          var visitInComponent = /* @__PURE__ */ __name(function visitInComponent2(node2, component2) {
            visited.merge(node2);
            unvisited.unmerge(node2);
            component2.merge(node2);
          }, "visitInComponent");
          if (unvisited.empty()) {
            return self2.spawn();
          }
          var _loop = /* @__PURE__ */ __name(function _loop2() {
            var cmpt = cy.collection();
            components3.push(cmpt);
            var root4 = unvisited[0];
            visitInComponent(root4, cmpt);
            self2.bfs({
              directed: false,
              roots: root4,
              visit: /* @__PURE__ */ __name(function visit(v3) {
                return visitInComponent(v3, cmpt);
              }, "visit")
            });
            cmpt.forEach(function(node2) {
              node2.connectedEdges().forEach(function(e3) {
                if (self2.has(e3) && cmpt.has(e3.source()) && cmpt.has(e3.target())) {
                  cmpt.merge(e3);
                }
              });
            });
          }, "_loop");
          do {
            _loop();
          } while (unvisited.length > 0);
          return components3;
        }, "components"),
        component: /* @__PURE__ */ __name(function component() {
          var ele = this[0];
          return ele.cy().mutableElements().components(ele)[0];
        }, "component")
      });
      elesfn$2.componentsOf = elesfn$2.components;
      Collection = /* @__PURE__ */ __name(function Collection2(cy, elements2) {
        var unique = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
        var removed = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
        if (cy === void 0) {
          error("A collection must have a reference to the core");
          return;
        }
        var map5 = new Map$1();
        var createdElements = false;
        if (!elements2) {
          elements2 = [];
        } else if (elements2.length > 0 && plainObject(elements2[0]) && !element(elements2[0])) {
          createdElements = true;
          var eles = [];
          var elesIds = new Set$1();
          for (var i2 = 0, l4 = elements2.length; i2 < l4; i2++) {
            var json3 = elements2[i2];
            if (json3.data == null) {
              json3.data = {};
            }
            var _data = json3.data;
            if (_data.id == null) {
              _data.id = uuid();
            } else if (cy.hasElementWithId(_data.id) || elesIds.has(_data.id)) {
              continue;
            }
            var ele = new Element(cy, json3, false);
            eles.push(ele);
            elesIds.add(_data.id);
          }
          elements2 = eles;
        }
        this.length = 0;
        for (var _i = 0, _l = elements2.length; _i < _l; _i++) {
          var element$1 = elements2[_i][0];
          if (element$1 == null) {
            continue;
          }
          var id34 = element$1._private.data.id;
          if (!unique || !map5.has(id34)) {
            if (unique) {
              map5.set(id34, {
                index: this.length,
                ele: element$1
              });
            }
            this[this.length] = element$1;
            this.length++;
          }
        }
        this._private = {
          eles: this,
          cy,
          get map() {
            if (this.lazyMap == null) {
              this.rebuildMap();
            }
            return this.lazyMap;
          },
          set map(m3) {
            this.lazyMap = m3;
          },
          rebuildMap: /* @__PURE__ */ __name(function rebuildMap() {
            var m3 = this.lazyMap = new Map$1();
            var eles2 = this.eles;
            for (var _i2 = 0; _i2 < eles2.length; _i2++) {
              var _ele = eles2[_i2];
              m3.set(_ele.id(), {
                index: _i2,
                ele: _ele
              });
            }
          }, "rebuildMap")
        };
        if (unique) {
          this._private.map = map5;
        }
        if (createdElements && !removed) {
          this.restore();
        }
      }, "Collection");
      elesfn$1 = Element.prototype = Collection.prototype = Object.create(Array.prototype);
      elesfn$1.instanceString = function() {
        return "collection";
      };
      elesfn$1.spawn = function(eles, unique) {
        return new Collection(this.cy(), eles, unique);
      };
      elesfn$1.spawnSelf = function() {
        return this.spawn(this);
      };
      elesfn$1.cy = function() {
        return this._private.cy;
      };
      elesfn$1.renderer = function() {
        return this._private.cy.renderer();
      };
      elesfn$1.element = function() {
        return this[0];
      };
      elesfn$1.collection = function() {
        if (collection(this)) {
          return this;
        } else {
          return new Collection(this._private.cy, [this]);
        }
      };
      elesfn$1.unique = function() {
        return new Collection(this._private.cy, this, true);
      };
      elesfn$1.hasElementWithId = function(id34) {
        id34 = "" + id34;
        return this._private.map.has(id34);
      };
      elesfn$1.getElementById = function(id34) {
        id34 = "" + id34;
        var cy = this._private.cy;
        var entry = this._private.map.get(id34);
        return entry ? entry.ele : new Collection(cy);
      };
      elesfn$1.$id = elesfn$1.getElementById;
      elesfn$1.poolIndex = function() {
        var cy = this._private.cy;
        var eles = cy._private.elements;
        var id34 = this[0]._private.data.id;
        return eles._private.map.get(id34).index;
      };
      elesfn$1.indexOf = function(ele) {
        var id34 = ele[0]._private.data.id;
        return this._private.map.get(id34).index;
      };
      elesfn$1.indexOfId = function(id34) {
        id34 = "" + id34;
        return this._private.map.get(id34).index;
      };
      elesfn$1.json = function(obj) {
        var ele = this.element();
        var cy = this.cy();
        if (ele == null && obj) {
          return this;
        }
        if (ele == null) {
          return void 0;
        }
        var p3 = ele._private;
        if (plainObject(obj)) {
          cy.startBatch();
          if (obj.data) {
            ele.data(obj.data);
            var _data2 = p3.data;
            if (ele.isEdge()) {
              var move = false;
              var spec = {};
              var src = obj.data.source;
              var tgt = obj.data.target;
              if (src != null && src != _data2.source) {
                spec.source = "" + src;
                move = true;
              }
              if (tgt != null && tgt != _data2.target) {
                spec.target = "" + tgt;
                move = true;
              }
              if (move) {
                ele = ele.move(spec);
              }
            } else {
              var newParentValSpecd = "parent" in obj.data;
              var parent4 = obj.data.parent;
              if (newParentValSpecd && (parent4 != null || _data2.parent != null) && parent4 != _data2.parent) {
                if (parent4 === void 0) {
                  parent4 = null;
                }
                if (parent4 != null) {
                  parent4 = "" + parent4;
                }
                ele = ele.move({
                  parent: parent4
                });
              }
            }
          }
          if (obj.position) {
            ele.position(obj.position);
          }
          var checkSwitch = /* @__PURE__ */ __name(function checkSwitch2(k2, trueFnName, falseFnName) {
            var obj_k = obj[k2];
            if (obj_k != null && obj_k !== p3[k2]) {
              if (obj_k) {
                ele[trueFnName]();
              } else {
                ele[falseFnName]();
              }
            }
          }, "checkSwitch");
          checkSwitch("removed", "remove", "restore");
          checkSwitch("selected", "select", "unselect");
          checkSwitch("selectable", "selectify", "unselectify");
          checkSwitch("locked", "lock", "unlock");
          checkSwitch("grabbable", "grabify", "ungrabify");
          checkSwitch("pannable", "panify", "unpanify");
          if (obj.classes != null) {
            ele.classes(obj.classes);
          }
          cy.endBatch();
          return this;
        } else if (obj === void 0) {
          var json3 = {
            data: copy3(p3.data),
            position: copy3(p3.position),
            group: p3.group,
            removed: p3.removed,
            selected: p3.selected,
            selectable: p3.selectable,
            locked: p3.locked,
            grabbable: p3.grabbable,
            pannable: p3.pannable,
            classes: null
          };
          json3.classes = "";
          var i2 = 0;
          p3.classes.forEach(function(cls) {
            return json3.classes += i2++ === 0 ? cls : " " + cls;
          });
          return json3;
        }
      };
      elesfn$1.jsons = function() {
        var jsons = [];
        for (var i2 = 0; i2 < this.length; i2++) {
          var ele = this[i2];
          var json3 = ele.json();
          jsons.push(json3);
        }
        return jsons;
      };
      elesfn$1.clone = function() {
        var cy = this.cy();
        var elesArr = [];
        for (var i2 = 0; i2 < this.length; i2++) {
          var ele = this[i2];
          var json3 = ele.json();
          var clone6 = new Element(cy, json3, false);
          elesArr.push(clone6);
        }
        return new Collection(cy, elesArr);
      };
      elesfn$1.copy = elesfn$1.clone;
      elesfn$1.restore = function() {
        var notifyRenderer = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
        var addToPool2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
        var self2 = this;
        var cy = self2.cy();
        var cy_p = cy._private;
        var nodes5 = [];
        var edges3 = [];
        var elements2;
        for (var _i3 = 0, l4 = self2.length; _i3 < l4; _i3++) {
          var ele = self2[_i3];
          if (addToPool2 && !ele.removed()) {
            continue;
          }
          if (ele.isNode()) {
            nodes5.push(ele);
          } else {
            edges3.push(ele);
          }
        }
        elements2 = nodes5.concat(edges3);
        var i2;
        var removeFromElements = /* @__PURE__ */ __name(function removeFromElements2() {
          elements2.splice(i2, 1);
          i2--;
        }, "removeFromElements");
        for (i2 = 0; i2 < elements2.length; i2++) {
          var _ele2 = elements2[i2];
          var _private = _ele2._private;
          var _data3 = _private.data;
          _ele2.clearTraversalCache();
          if (!addToPool2 && !_private.removed) ;
          else if (_data3.id === void 0) {
            _data3.id = uuid();
          } else if (number$1(_data3.id)) {
            _data3.id = "" + _data3.id;
          } else if (emptyString(_data3.id) || !string(_data3.id)) {
            error("Can not create element with invalid string ID `" + _data3.id + "`");
            removeFromElements();
            continue;
          } else if (cy.hasElementWithId(_data3.id)) {
            error("Can not create second element with ID `" + _data3.id + "`");
            removeFromElements();
            continue;
          }
          var id34 = _data3.id;
          if (_ele2.isNode()) {
            var pos = _private.position;
            if (pos.x == null) {
              pos.x = 0;
            }
            if (pos.y == null) {
              pos.y = 0;
            }
          }
          if (_ele2.isEdge()) {
            var edge = _ele2;
            var fields = ["source", "target"];
            var fieldsLength = fields.length;
            var badSourceOrTarget = false;
            for (var j3 = 0; j3 < fieldsLength; j3++) {
              var field = fields[j3];
              var val = _data3[field];
              if (number$1(val)) {
                val = _data3[field] = "" + _data3[field];
              }
              if (val == null || val === "") {
                error("Can not create edge `" + id34 + "` with unspecified " + field);
                badSourceOrTarget = true;
              } else if (!cy.hasElementWithId(val)) {
                error("Can not create edge `" + id34 + "` with nonexistant " + field + " `" + val + "`");
                badSourceOrTarget = true;
              }
            }
            if (badSourceOrTarget) {
              removeFromElements();
              continue;
            }
            var src = cy.getElementById(_data3.source);
            var tgt = cy.getElementById(_data3.target);
            if (src.same(tgt)) {
              src._private.edges.push(edge);
            } else {
              src._private.edges.push(edge);
              tgt._private.edges.push(edge);
            }
            edge._private.source = src;
            edge._private.target = tgt;
          }
          _private.map = new Map$1();
          _private.map.set(id34, {
            ele: _ele2,
            index: 0
          });
          _private.removed = false;
          if (addToPool2) {
            cy.addToPool(_ele2);
          }
        }
        for (var _i4 = 0; _i4 < nodes5.length; _i4++) {
          var node2 = nodes5[_i4];
          var _data4 = node2._private.data;
          if (number$1(_data4.parent)) {
            _data4.parent = "" + _data4.parent;
          }
          var parentId = _data4.parent;
          var specifiedParent = parentId != null;
          if (specifiedParent || node2._private.parent) {
            var parent4 = node2._private.parent ? cy.collection().merge(node2._private.parent) : cy.getElementById(parentId);
            if (parent4.empty()) {
              _data4.parent = void 0;
            } else if (parent4[0].removed()) {
              warn("Node added with missing parent, reference to parent removed");
              _data4.parent = void 0;
              node2._private.parent = null;
            } else {
              var selfAsParent = false;
              var ancestor = parent4;
              while (!ancestor.empty()) {
                if (node2.same(ancestor)) {
                  selfAsParent = true;
                  _data4.parent = void 0;
                  break;
                }
                ancestor = ancestor.parent();
              }
              if (!selfAsParent) {
                parent4[0]._private.children.push(node2);
                node2._private.parent = parent4[0];
                cy_p.hasCompoundNodes = true;
              }
            }
          }
        }
        if (elements2.length > 0) {
          var restored = elements2.length === self2.length ? self2 : new Collection(cy, elements2);
          for (var _i5 = 0; _i5 < restored.length; _i5++) {
            var _ele3 = restored[_i5];
            if (_ele3.isNode()) {
              continue;
            }
            _ele3.parallelEdges().clearTraversalCache();
            _ele3.source().clearTraversalCache();
            _ele3.target().clearTraversalCache();
          }
          var toUpdateStyle;
          if (cy_p.hasCompoundNodes) {
            toUpdateStyle = cy.collection().merge(restored).merge(restored.connectedNodes()).merge(restored.parent());
          } else {
            toUpdateStyle = restored;
          }
          toUpdateStyle.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(notifyRenderer);
          if (notifyRenderer) {
            restored.emitAndNotify("add");
          } else if (addToPool2) {
            restored.emit("add");
          }
        }
        return self2;
      };
      elesfn$1.removed = function() {
        var ele = this[0];
        return ele && ele._private.removed;
      };
      elesfn$1.inside = function() {
        var ele = this[0];
        return ele && !ele._private.removed;
      };
      elesfn$1.remove = function() {
        var notifyRenderer = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
        var removeFromPool2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
        var self2 = this;
        var elesToRemove = [];
        var elesToRemoveIds = {};
        var cy = self2._private.cy;
        function addConnectedEdges(node2) {
          var edges3 = node2._private.edges;
          for (var i3 = 0; i3 < edges3.length; i3++) {
            add3(edges3[i3]);
          }
        }
        __name(addConnectedEdges, "addConnectedEdges");
        function addChildren2(node2) {
          var children2 = node2._private.children;
          for (var i3 = 0; i3 < children2.length; i3++) {
            add3(children2[i3]);
          }
        }
        __name(addChildren2, "addChildren");
        function add3(ele2) {
          var alreadyAdded = elesToRemoveIds[ele2.id()];
          if (removeFromPool2 && ele2.removed() || alreadyAdded) {
            return;
          } else {
            elesToRemoveIds[ele2.id()] = true;
          }
          if (ele2.isNode()) {
            elesToRemove.push(ele2);
            addConnectedEdges(ele2);
            addChildren2(ele2);
          } else {
            elesToRemove.unshift(ele2);
          }
        }
        __name(add3, "add");
        for (var i2 = 0, l4 = self2.length; i2 < l4; i2++) {
          var ele = self2[i2];
          add3(ele);
        }
        function removeEdgeRef(node2, edge) {
          var connectedEdges = node2._private.edges;
          removeFromArray(connectedEdges, edge);
          node2.clearTraversalCache();
        }
        __name(removeEdgeRef, "removeEdgeRef");
        function removeParallelRef(pllEdge2) {
          pllEdge2.clearTraversalCache();
        }
        __name(removeParallelRef, "removeParallelRef");
        var alteredParents = [];
        alteredParents.ids = {};
        function removeChildRef(parent5, ele2) {
          ele2 = ele2[0];
          parent5 = parent5[0];
          var children2 = parent5._private.children;
          var pid = parent5.id();
          removeFromArray(children2, ele2);
          ele2._private.parent = null;
          if (!alteredParents.ids[pid]) {
            alteredParents.ids[pid] = true;
            alteredParents.push(parent5);
          }
        }
        __name(removeChildRef, "removeChildRef");
        self2.dirtyCompoundBoundsCache();
        if (removeFromPool2) {
          cy.removeFromPool(elesToRemove);
        }
        for (var _i6 = 0; _i6 < elesToRemove.length; _i6++) {
          var _ele4 = elesToRemove[_i6];
          if (_ele4.isEdge()) {
            var src = _ele4.source()[0];
            var tgt = _ele4.target()[0];
            removeEdgeRef(src, _ele4);
            removeEdgeRef(tgt, _ele4);
            var pllEdges = _ele4.parallelEdges();
            for (var j3 = 0; j3 < pllEdges.length; j3++) {
              var pllEdge = pllEdges[j3];
              removeParallelRef(pllEdge);
              if (pllEdge.isBundledBezier()) {
                pllEdge.dirtyBoundingBoxCache();
              }
            }
          } else {
            var parent4 = _ele4.parent();
            if (parent4.length !== 0) {
              removeChildRef(parent4, _ele4);
            }
          }
          if (removeFromPool2) {
            _ele4._private.removed = true;
          }
        }
        var elesStillInside = cy._private.elements;
        cy._private.hasCompoundNodes = false;
        for (var _i7 = 0; _i7 < elesStillInside.length; _i7++) {
          var _ele5 = elesStillInside[_i7];
          if (_ele5.isParent()) {
            cy._private.hasCompoundNodes = true;
            break;
          }
        }
        var removedElements = new Collection(this.cy(), elesToRemove);
        if (removedElements.size() > 0) {
          if (notifyRenderer) {
            removedElements.emitAndNotify("remove");
          } else if (removeFromPool2) {
            removedElements.emit("remove");
          }
        }
        for (var _i8 = 0; _i8 < alteredParents.length; _i8++) {
          var _ele6 = alteredParents[_i8];
          if (!removeFromPool2 || !_ele6.removed()) {
            _ele6.updateStyle();
          }
        }
        return removedElements;
      };
      elesfn$1.move = function(struct) {
        var cy = this._private.cy;
        var eles = this;
        var notifyRenderer = false;
        var modifyPool = false;
        var toString6 = /* @__PURE__ */ __name(function toString7(id34) {
          return id34 == null ? id34 : "" + id34;
        }, "toString");
        if (struct.source !== void 0 || struct.target !== void 0) {
          var srcId = toString6(struct.source);
          var tgtId = toString6(struct.target);
          var srcExists = srcId != null && cy.hasElementWithId(srcId);
          var tgtExists = tgtId != null && cy.hasElementWithId(tgtId);
          if (srcExists || tgtExists) {
            cy.batch(function() {
              eles.remove(notifyRenderer, modifyPool);
              eles.emitAndNotify("moveout");
              for (var i2 = 0; i2 < eles.length; i2++) {
                var ele = eles[i2];
                var _data5 = ele._private.data;
                if (ele.isEdge()) {
                  if (srcExists) {
                    _data5.source = srcId;
                  }
                  if (tgtExists) {
                    _data5.target = tgtId;
                  }
                }
              }
              eles.restore(notifyRenderer, modifyPool);
            });
            eles.emitAndNotify("move");
          }
        } else if (struct.parent !== void 0) {
          var parentId = toString6(struct.parent);
          var parentExists = parentId === null || cy.hasElementWithId(parentId);
          if (parentExists) {
            var pidToAssign = parentId === null ? void 0 : parentId;
            cy.batch(function() {
              var updated = eles.remove(notifyRenderer, modifyPool);
              updated.emitAndNotify("moveout");
              for (var i2 = 0; i2 < eles.length; i2++) {
                var ele = eles[i2];
                var _data6 = ele._private.data;
                if (ele.isNode()) {
                  _data6.parent = pidToAssign;
                }
              }
              updated.restore(notifyRenderer, modifyPool);
            });
            eles.emitAndNotify("move");
          }
        }
        return this;
      };
      [elesfn$j, elesfn$i, elesfn$h, elesfn$g, elesfn$f, data3, elesfn$d, dimensions, elesfn$9, elesfn$8, elesfn$7, elesfn$6, elesfn$5, elesfn$4, elesfn$3, elesfn$2].forEach(function(props) {
        extend4(elesfn$1, props);
      });
      corefn$9 = {
        add: /* @__PURE__ */ __name(function add2(opts) {
          var elements2;
          var cy = this;
          if (elementOrCollection(opts)) {
            var eles = opts;
            if (eles._private.cy === cy) {
              elements2 = eles.restore();
            } else {
              var jsons = [];
              for (var i2 = 0; i2 < eles.length; i2++) {
                var ele = eles[i2];
                jsons.push(ele.json());
              }
              elements2 = new Collection(cy, jsons);
            }
          } else if (array2(opts)) {
            var _jsons = opts;
            elements2 = new Collection(cy, _jsons);
          } else if (plainObject(opts) && (array2(opts.nodes) || array2(opts.edges))) {
            var elesByGroup = opts;
            var _jsons2 = [];
            var grs = ["nodes", "edges"];
            for (var _i = 0, il = grs.length; _i < il; _i++) {
              var group2 = grs[_i];
              var elesArray = elesByGroup[group2];
              if (array2(elesArray)) {
                for (var j3 = 0, jl = elesArray.length; j3 < jl; j3++) {
                  var json3 = extend4({
                    group: group2
                  }, elesArray[j3]);
                  _jsons2.push(json3);
                }
              }
            }
            elements2 = new Collection(cy, _jsons2);
          } else {
            var _json = opts;
            elements2 = new Element(cy, _json).collection();
          }
          return elements2;
        }, "add"),
        remove: /* @__PURE__ */ __name(function remove2(collection4) {
          if (elementOrCollection(collection4)) ;
          else if (string(collection4)) {
            var selector = collection4;
            collection4 = this.$(selector);
          }
          return collection4.remove();
        }, "remove")
      };
      __name(generateCubicBezier, "generateCubicBezier");
      generateSpringRK4 = /* @__PURE__ */ (function() {
        function springAccelerationForState(state4) {
          return -state4.tension * state4.x - state4.friction * state4.v;
        }
        __name(springAccelerationForState, "springAccelerationForState");
        function springEvaluateStateWithDerivative(initialState, dt, derivative) {
          var state4 = {
            x: initialState.x + derivative.dx * dt,
            v: initialState.v + derivative.dv * dt,
            tension: initialState.tension,
            friction: initialState.friction
          };
          return {
            dx: state4.v,
            dv: springAccelerationForState(state4)
          };
        }
        __name(springEvaluateStateWithDerivative, "springEvaluateStateWithDerivative");
        function springIntegrateState(state4, dt) {
          var a2 = {
            dx: state4.v,
            dv: springAccelerationForState(state4)
          }, b3 = springEvaluateStateWithDerivative(state4, dt * 0.5, a2), c3 = springEvaluateStateWithDerivative(state4, dt * 0.5, b3), d3 = springEvaluateStateWithDerivative(state4, dt, c3), dxdt = 1 / 6 * (a2.dx + 2 * (b3.dx + c3.dx) + d3.dx), dvdt = 1 / 6 * (a2.dv + 2 * (b3.dv + c3.dv) + d3.dv);
          state4.x = state4.x + dxdt * dt;
          state4.v = state4.v + dvdt * dt;
          return state4;
        }
        __name(springIntegrateState, "springIntegrateState");
        return /* @__PURE__ */ __name(function springRK4Factory(tension, friction, duration) {
          var initState = {
            x: -1,
            v: 0,
            tension: null,
            friction: null
          }, path4 = [0], time_lapsed = 0, tolerance = 1 / 1e4, DT = 16 / 1e3, have_duration, dt, last_state;
          tension = parseFloat(tension) || 500;
          friction = parseFloat(friction) || 20;
          duration = duration || null;
          initState.tension = tension;
          initState.friction = friction;
          have_duration = duration !== null;
          if (have_duration) {
            time_lapsed = springRK4Factory(tension, friction);
            dt = time_lapsed / duration * DT;
          } else {
            dt = DT;
          }
          for (; ; ) {
            last_state = springIntegrateState(last_state || initState, dt);
            path4.push(1 + last_state.x);
            time_lapsed += 16;
            if (!(Math.abs(last_state.x) > tolerance && Math.abs(last_state.v) > tolerance)) {
              break;
            }
          }
          return !have_duration ? time_lapsed : function(percentComplete) {
            return path4[percentComplete * (path4.length - 1) | 0];
          };
        }, "springRK4Factory");
      })();
      cubicBezier = /* @__PURE__ */ __name(function cubicBezier2(t13, p1, t22, p22) {
        var bezier = generateCubicBezier(t13, p1, t22, p22);
        return function(start3, end2, percent) {
          return start3 + (end2 - start3) * bezier(percent);
        };
      }, "cubicBezier");
      easings = {
        "linear": /* @__PURE__ */ __name(function linear3(start3, end2, percent) {
          return start3 + (end2 - start3) * percent;
        }, "linear"),
        // default easings
        "ease": cubicBezier(0.25, 0.1, 0.25, 1),
        "ease-in": cubicBezier(0.42, 0, 1, 1),
        "ease-out": cubicBezier(0, 0, 0.58, 1),
        "ease-in-out": cubicBezier(0.42, 0, 0.58, 1),
        // sine
        "ease-in-sine": cubicBezier(0.47, 0, 0.745, 0.715),
        "ease-out-sine": cubicBezier(0.39, 0.575, 0.565, 1),
        "ease-in-out-sine": cubicBezier(0.445, 0.05, 0.55, 0.95),
        // quad
        "ease-in-quad": cubicBezier(0.55, 0.085, 0.68, 0.53),
        "ease-out-quad": cubicBezier(0.25, 0.46, 0.45, 0.94),
        "ease-in-out-quad": cubicBezier(0.455, 0.03, 0.515, 0.955),
        // cubic
        "ease-in-cubic": cubicBezier(0.55, 0.055, 0.675, 0.19),
        "ease-out-cubic": cubicBezier(0.215, 0.61, 0.355, 1),
        "ease-in-out-cubic": cubicBezier(0.645, 0.045, 0.355, 1),
        // quart
        "ease-in-quart": cubicBezier(0.895, 0.03, 0.685, 0.22),
        "ease-out-quart": cubicBezier(0.165, 0.84, 0.44, 1),
        "ease-in-out-quart": cubicBezier(0.77, 0, 0.175, 1),
        // quint
        "ease-in-quint": cubicBezier(0.755, 0.05, 0.855, 0.06),
        "ease-out-quint": cubicBezier(0.23, 1, 0.32, 1),
        "ease-in-out-quint": cubicBezier(0.86, 0, 0.07, 1),
        // expo
        "ease-in-expo": cubicBezier(0.95, 0.05, 0.795, 0.035),
        "ease-out-expo": cubicBezier(0.19, 1, 0.22, 1),
        "ease-in-out-expo": cubicBezier(1, 0, 0, 1),
        // circ
        "ease-in-circ": cubicBezier(0.6, 0.04, 0.98, 0.335),
        "ease-out-circ": cubicBezier(0.075, 0.82, 0.165, 1),
        "ease-in-out-circ": cubicBezier(0.785, 0.135, 0.15, 0.86),
        // user param easings...
        "spring": /* @__PURE__ */ __name(function spring(tension, friction, duration) {
          if (duration === 0) {
            return easings.linear;
          }
          var spring2 = generateSpringRK4(tension, friction, duration);
          return function(start3, end2, percent) {
            return start3 + (end2 - start3) * spring2(percent);
          };
        }, "spring"),
        "cubic-bezier": cubicBezier
      };
      __name(getEasedValue, "getEasedValue");
      __name(getValue2, "getValue");
      __name(ease, "ease");
      __name(step$1, "step$1");
      __name(valid, "valid");
      __name(startAnimation, "startAnimation");
      __name(stepAll, "stepAll");
      corefn$8 = {
        // pull in animation functions
        animate: define2.animate(),
        animation: define2.animation(),
        animated: define2.animated(),
        clearQueue: define2.clearQueue(),
        delay: define2.delay(),
        delayAnimation: define2.delayAnimation(),
        stop: define2.stop(),
        addToAnimationPool: /* @__PURE__ */ __name(function addToAnimationPool(eles) {
          var cy = this;
          if (!cy.styleEnabled()) {
            return;
          }
          cy._private.aniEles.merge(eles);
        }, "addToAnimationPool"),
        stopAnimationLoop: /* @__PURE__ */ __name(function stopAnimationLoop() {
          this._private.animationsRunning = false;
        }, "stopAnimationLoop"),
        startAnimationLoop: /* @__PURE__ */ __name(function startAnimationLoop() {
          var cy = this;
          cy._private.animationsRunning = true;
          if (!cy.styleEnabled()) {
            return;
          }
          function headlessStep() {
            if (!cy._private.animationsRunning) {
              return;
            }
            requestAnimationFrame2(/* @__PURE__ */ __name(function animationStep(now3) {
              stepAll(now3, cy);
              headlessStep();
            }, "animationStep"));
          }
          __name(headlessStep, "headlessStep");
          var renderer13 = cy.renderer();
          if (renderer13 && renderer13.beforeRender) {
            renderer13.beforeRender(/* @__PURE__ */ __name(function rendererAnimationStep(willDraw, now3) {
              stepAll(now3, cy);
            }, "rendererAnimationStep"), renderer13.beforeRenderPriorities.animations);
          } else {
            headlessStep();
          }
        }, "startAnimationLoop")
      };
      emitterOptions = {
        qualifierCompare: /* @__PURE__ */ __name(function qualifierCompare3(selector1, selector2) {
          if (selector1 == null || selector2 == null) {
            return selector1 == null && selector2 == null;
          } else {
            return selector1.sameText(selector2);
          }
        }, "qualifierCompare"),
        eventMatches: /* @__PURE__ */ __name(function eventMatches3(cy, listener, eventObj) {
          var selector = listener.qualifier;
          if (selector != null) {
            return cy !== eventObj.target && element(eventObj.target) && selector.matches(eventObj.target);
          }
          return true;
        }, "eventMatches"),
        addEventFields: /* @__PURE__ */ __name(function addEventFields3(cy, evt) {
          evt.cy = cy;
          evt.target = cy;
        }, "addEventFields"),
        callbackContext: /* @__PURE__ */ __name(function callbackContext3(cy, listener, eventObj) {
          return listener.qualifier != null ? eventObj.target : cy;
        }, "callbackContext")
      };
      argSelector2 = /* @__PURE__ */ __name(function argSelector3(arg) {
        if (string(arg)) {
          return new Selector(arg);
        } else {
          return arg;
        }
      }, "argSelector");
      elesfn = {
        createEmitter: /* @__PURE__ */ __name(function createEmitter2() {
          var _p = this._private;
          if (!_p.emitter) {
            _p.emitter = new Emitter(emitterOptions, this);
          }
          return this;
        }, "createEmitter"),
        emitter: /* @__PURE__ */ __name(function emitter2() {
          return this._private.emitter;
        }, "emitter"),
        on: /* @__PURE__ */ __name(function on2(events, selector, callback) {
          this.emitter().on(events, argSelector2(selector), callback);
          return this;
        }, "on"),
        removeListener: /* @__PURE__ */ __name(function removeListener2(events, selector, callback) {
          this.emitter().removeListener(events, argSelector2(selector), callback);
          return this;
        }, "removeListener"),
        removeAllListeners: /* @__PURE__ */ __name(function removeAllListeners2() {
          this.emitter().removeAllListeners();
          return this;
        }, "removeAllListeners"),
        one: /* @__PURE__ */ __name(function one3(events, selector, callback) {
          this.emitter().one(events, argSelector2(selector), callback);
          return this;
        }, "one"),
        once: /* @__PURE__ */ __name(function once2(events, selector, callback) {
          this.emitter().one(events, argSelector2(selector), callback);
          return this;
        }, "once"),
        emit: /* @__PURE__ */ __name(function emit2(events, extraParams) {
          this.emitter().emit(events, extraParams);
          return this;
        }, "emit"),
        emitAndNotify: /* @__PURE__ */ __name(function emitAndNotify2(event3, eles) {
          this.emit(event3);
          this.notify(event3, eles);
          return this;
        }, "emitAndNotify")
      };
      define2.eventAliasesOn(elesfn);
      corefn$7 = {
        png: /* @__PURE__ */ __name(function png(options2) {
          var renderer13 = this._private.renderer;
          options2 = options2 || {};
          return renderer13.png(options2);
        }, "png"),
        jpg: /* @__PURE__ */ __name(function jpg(options2) {
          var renderer13 = this._private.renderer;
          options2 = options2 || {};
          options2.bg = options2.bg || "#fff";
          return renderer13.jpg(options2);
        }, "jpg")
      };
      corefn$7.jpeg = corefn$7.jpg;
      corefn$6 = {
        layout: /* @__PURE__ */ __name(function layout3(options2) {
          var cy = this;
          if (options2 == null) {
            error("Layout options must be specified to make a layout");
            return;
          }
          if (options2.name == null) {
            error("A `name` must be specified to make a layout");
            return;
          }
          var name = options2.name;
          var Layout2 = cy.extension("layout", name);
          if (Layout2 == null) {
            error("No such layout `" + name + "` found.  Did you forget to import it and `cytoscape.use()` it?");
            return;
          }
          var eles;
          if (string(options2.eles)) {
            eles = cy.$(options2.eles);
          } else {
            eles = options2.eles != null ? options2.eles : cy.$();
          }
          var layout7 = new Layout2(extend4({}, options2, {
            cy,
            eles
          }));
          return layout7;
        }, "layout")
      };
      corefn$6.createLayout = corefn$6.makeLayout = corefn$6.layout;
      corefn$5 = {
        notify: /* @__PURE__ */ __name(function notify(eventName, eventEles) {
          var _p = this._private;
          if (this.batching()) {
            _p.batchNotifications = _p.batchNotifications || {};
            var eles = _p.batchNotifications[eventName] = _p.batchNotifications[eventName] || this.collection();
            if (eventEles != null) {
              eles.merge(eventEles);
            }
            return;
          }
          if (!_p.notificationsEnabled) {
            return;
          }
          var renderer13 = this.renderer();
          if (this.destroyed() || !renderer13) {
            return;
          }
          renderer13.notify(eventName, eventEles);
        }, "notify"),
        notifications: /* @__PURE__ */ __name(function notifications(bool2) {
          var p3 = this._private;
          if (bool2 === void 0) {
            return p3.notificationsEnabled;
          } else {
            p3.notificationsEnabled = bool2 ? true : false;
          }
          return this;
        }, "notifications"),
        noNotifications: /* @__PURE__ */ __name(function noNotifications(callback) {
          this.notifications(false);
          callback();
          this.notifications(true);
        }, "noNotifications"),
        batching: /* @__PURE__ */ __name(function batching() {
          return this._private.batchCount > 0;
        }, "batching"),
        startBatch: /* @__PURE__ */ __name(function startBatch() {
          var _p = this._private;
          if (_p.batchCount == null) {
            _p.batchCount = 0;
          }
          if (_p.batchCount === 0) {
            _p.batchStyleEles = this.collection();
            _p.batchNotifications = {};
          }
          _p.batchCount++;
          return this;
        }, "startBatch"),
        endBatch: /* @__PURE__ */ __name(function endBatch() {
          var _p = this._private;
          if (_p.batchCount === 0) {
            return this;
          }
          _p.batchCount--;
          if (_p.batchCount === 0) {
            _p.batchStyleEles.updateStyle();
            var renderer13 = this.renderer();
            Object.keys(_p.batchNotifications).forEach(function(eventName) {
              var eles = _p.batchNotifications[eventName];
              if (eles.empty()) {
                renderer13.notify(eventName);
              } else {
                renderer13.notify(eventName, eles);
              }
            });
          }
          return this;
        }, "endBatch"),
        batch: /* @__PURE__ */ __name(function batch(callback) {
          this.startBatch();
          callback();
          this.endBatch();
          return this;
        }, "batch"),
        // for backwards compatibility
        batchData: /* @__PURE__ */ __name(function batchData(map5) {
          var cy = this;
          return this.batch(function() {
            var ids = Object.keys(map5);
            for (var i2 = 0; i2 < ids.length; i2++) {
              var id34 = ids[i2];
              var data5 = map5[id34];
              var ele = cy.getElementById(id34);
              ele.data(data5);
            }
          });
        }, "batchData")
      };
      rendererDefaults = defaults$g({
        hideEdgesOnViewport: false,
        textureOnViewport: false,
        motionBlur: false,
        motionBlurOpacity: 0.05,
        pixelRatio: void 0,
        desktopTapThreshold: 4,
        touchTapThreshold: 8,
        wheelSensitivity: 1,
        debug: false,
        showFps: false,
        // webgl options
        webgl: false,
        webglDebug: false,
        webglDebugShowAtlases: false,
        // defaults good for mobile
        webglTexSize: 2048,
        webglTexRows: 36,
        webglTexRowsNodes: 18,
        webglBatchSize: 2048,
        webglTexPerBatch: 14,
        webglBgColor: [255, 255, 255]
      });
      corefn$4 = {
        renderTo: /* @__PURE__ */ __name(function renderTo(context, zoom2, pan2, pxRatio) {
          var r2 = this._private.renderer;
          r2.renderTo(context, zoom2, pan2, pxRatio);
          return this;
        }, "renderTo"),
        renderer: /* @__PURE__ */ __name(function renderer() {
          return this._private.renderer;
        }, "renderer"),
        forceRender: /* @__PURE__ */ __name(function forceRender() {
          this.notify("draw");
          return this;
        }, "forceRender"),
        resize: /* @__PURE__ */ __name(function resize() {
          this.invalidateSize();
          this.emitAndNotify("resize");
          return this;
        }, "resize"),
        initRenderer: /* @__PURE__ */ __name(function initRenderer(options2) {
          var cy = this;
          var RendererProto = cy.extension("renderer", options2.name);
          if (RendererProto == null) {
            error("Can not initialise: No such renderer `".concat(options2.name, "` found. Did you forget to import it and `cytoscape.use()` it?"));
            return;
          }
          if (options2.wheelSensitivity !== void 0) {
            warn("You have set a custom wheel sensitivity.  This will make your app zoom unnaturally when using mainstream mice.  You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");
          }
          var rOpts = rendererDefaults(options2);
          rOpts.cy = cy;
          cy._private.renderer = new RendererProto(rOpts);
          this.notify("init");
        }, "initRenderer"),
        destroyRenderer: /* @__PURE__ */ __name(function destroyRenderer() {
          var cy = this;
          cy.notify("destroy");
          var domEle = cy.container();
          if (domEle) {
            domEle._cyreg = null;
            while (domEle.childNodes.length > 0) {
              domEle.removeChild(domEle.childNodes[0]);
            }
          }
          cy._private.renderer = null;
          cy.mutableElements().forEach(function(ele) {
            var _p = ele._private;
            _p.rscratch = {};
            _p.rstyle = {};
            _p.animation.current = [];
            _p.animation.queue = [];
          });
        }, "destroyRenderer"),
        onRender: /* @__PURE__ */ __name(function onRender(fn3) {
          return this.on("render", fn3);
        }, "onRender"),
        offRender: /* @__PURE__ */ __name(function offRender(fn3) {
          return this.off("render", fn3);
        }, "offRender")
      };
      corefn$4.invalidateDimensions = corefn$4.resize;
      corefn$3 = {
        // get a collection
        // - empty collection on no args
        // - collection of elements in the graph on selector arg
        // - guarantee a returned collection when elements or collection specified
        collection: /* @__PURE__ */ __name(function collection3(eles, opts) {
          if (string(eles)) {
            return this.$(eles);
          } else if (elementOrCollection(eles)) {
            return eles.collection();
          } else if (array2(eles)) {
            if (!opts) {
              opts = {};
            }
            return new Collection(this, eles, opts.unique, opts.removed);
          }
          return new Collection(this);
        }, "collection"),
        nodes: /* @__PURE__ */ __name(function nodes2(selector) {
          var nodes5 = this.$(function(ele) {
            return ele.isNode();
          });
          if (selector) {
            return nodes5.filter(selector);
          }
          return nodes5;
        }, "nodes"),
        edges: /* @__PURE__ */ __name(function edges2(selector) {
          var edges3 = this.$(function(ele) {
            return ele.isEdge();
          });
          if (selector) {
            return edges3.filter(selector);
          }
          return edges3;
        }, "edges"),
        // search the graph like jQuery
        $: /* @__PURE__ */ __name(function $3(selector) {
          var eles = this._private.elements;
          if (selector) {
            return eles.filter(selector);
          } else {
            return eles.spawnSelf();
          }
        }, "$"),
        mutableElements: /* @__PURE__ */ __name(function mutableElements() {
          return this._private.elements;
        }, "mutableElements")
      };
      corefn$3.elements = corefn$3.filter = corefn$3.$;
      styfn$8 = {};
      TRUE = "t";
      FALSE = "f";
      styfn$8.apply = function(eles) {
        var self2 = this;
        var _p = self2._private;
        var cy = _p.cy;
        var updatedEles = cy.collection();
        for (var ie2 = 0; ie2 < eles.length; ie2++) {
          var ele = eles[ie2];
          var cxtMeta = self2.getContextMeta(ele);
          if (cxtMeta.empty) {
            continue;
          }
          var cxtStyle = self2.getContextStyle(cxtMeta);
          var app = self2.applyContextStyle(cxtMeta, cxtStyle, ele);
          if (ele._private.appliedInitStyle) {
            self2.updateTransitions(ele, app.diffProps);
          } else {
            ele._private.appliedInitStyle = true;
          }
          var hintsDiff = self2.updateStyleHints(ele);
          if (hintsDiff) {
            updatedEles.push(ele);
          }
        }
        return updatedEles;
      };
      styfn$8.getPropertiesDiff = function(oldCxtKey, newCxtKey) {
        var self2 = this;
        var cache3 = self2._private.propDiffs = self2._private.propDiffs || {};
        var dualCxtKey = oldCxtKey + "-" + newCxtKey;
        var cachedVal = cache3[dualCxtKey];
        if (cachedVal) {
          return cachedVal;
        }
        var diffProps = [];
        var addedProp = {};
        for (var i2 = 0; i2 < self2.length; i2++) {
          var cxt = self2[i2];
          var oldHasCxt = oldCxtKey[i2] === TRUE;
          var newHasCxt = newCxtKey[i2] === TRUE;
          var cxtHasDiffed = oldHasCxt !== newHasCxt;
          var cxtHasMappedProps = cxt.mappedProperties.length > 0;
          if (cxtHasDiffed || newHasCxt && cxtHasMappedProps) {
            var props = void 0;
            if (cxtHasDiffed && cxtHasMappedProps) {
              props = cxt.properties;
            } else if (cxtHasDiffed) {
              props = cxt.properties;
            } else if (cxtHasMappedProps) {
              props = cxt.mappedProperties;
            }
            for (var j3 = 0; j3 < props.length; j3++) {
              var prop = props[j3];
              var name = prop.name;
              var laterCxtOverrides = false;
              for (var k2 = i2 + 1; k2 < self2.length; k2++) {
                var laterCxt = self2[k2];
                var hasLaterCxt = newCxtKey[k2] === TRUE;
                if (!hasLaterCxt) {
                  continue;
                }
                laterCxtOverrides = laterCxt.properties[prop.name] != null;
                if (laterCxtOverrides) {
                  break;
                }
              }
              if (!addedProp[name] && !laterCxtOverrides) {
                addedProp[name] = true;
                diffProps.push(name);
              }
            }
          }
        }
        cache3[dualCxtKey] = diffProps;
        return diffProps;
      };
      styfn$8.getContextMeta = function(ele) {
        var self2 = this;
        var cxtKey = "";
        var diffProps;
        var prevKey = ele._private.styleCxtKey || "";
        for (var i2 = 0; i2 < self2.length; i2++) {
          var context = self2[i2];
          var contextSelectorMatches = context.selector && context.selector.matches(ele);
          if (contextSelectorMatches) {
            cxtKey += TRUE;
          } else {
            cxtKey += FALSE;
          }
        }
        diffProps = self2.getPropertiesDiff(prevKey, cxtKey);
        ele._private.styleCxtKey = cxtKey;
        return {
          key: cxtKey,
          diffPropNames: diffProps,
          empty: diffProps.length === 0
        };
      };
      styfn$8.getContextStyle = function(cxtMeta) {
        var cxtKey = cxtMeta.key;
        var self2 = this;
        var cxtStyles = this._private.contextStyles = this._private.contextStyles || {};
        if (cxtStyles[cxtKey]) {
          return cxtStyles[cxtKey];
        }
        var style3 = {
          _private: {
            key: cxtKey
          }
        };
        for (var i2 = 0; i2 < self2.length; i2++) {
          var cxt = self2[i2];
          var hasCxt = cxtKey[i2] === TRUE;
          if (!hasCxt) {
            continue;
          }
          for (var j3 = 0; j3 < cxt.properties.length; j3++) {
            var prop = cxt.properties[j3];
            style3[prop.name] = prop;
          }
        }
        cxtStyles[cxtKey] = style3;
        return style3;
      };
      styfn$8.applyContextStyle = function(cxtMeta, cxtStyle, ele) {
        var self2 = this;
        var diffProps = cxtMeta.diffPropNames;
        var retDiffProps = {};
        var types = self2.types;
        for (var i2 = 0; i2 < diffProps.length; i2++) {
          var diffPropName = diffProps[i2];
          var cxtProp = cxtStyle[diffPropName];
          var eleProp = ele.pstyle(diffPropName);
          if (!cxtProp) {
            if (!eleProp) {
              continue;
            } else if (eleProp.bypass) {
              cxtProp = {
                name: diffPropName,
                deleteBypassed: true
              };
            } else {
              cxtProp = {
                name: diffPropName,
                "delete": true
              };
            }
          }
          if (eleProp === cxtProp) {
            continue;
          }
          if (cxtProp.mapped === types.fn && eleProp != null && eleProp.mapping != null && eleProp.mapping.value === cxtProp.value) {
            var mapping = eleProp.mapping;
            var fnValue = mapping.fnValue = cxtProp.value(ele);
            if (fnValue === mapping.prevFnValue) {
              continue;
            }
          }
          var retDiffProp = retDiffProps[diffPropName] = {
            prev: eleProp
          };
          self2.applyParsedProperty(ele, cxtProp);
          retDiffProp.next = ele.pstyle(diffPropName);
          if (retDiffProp.next && retDiffProp.next.bypass) {
            retDiffProp.next = retDiffProp.next.bypassed;
          }
        }
        return {
          diffProps: retDiffProps
        };
      };
      styfn$8.updateStyleHints = function(ele) {
        var _p = ele._private;
        var self2 = this;
        var propNames = self2.propertyGroupNames;
        var propGrKeys = self2.propertyGroupKeys;
        var propHash = /* @__PURE__ */ __name(function propHash2(ele2, propNames2, seedKey) {
          return self2.getPropertiesHash(ele2, propNames2, seedKey);
        }, "propHash");
        var oldStyleKey = _p.styleKey;
        if (ele.removed()) {
          return false;
        }
        var isNode2 = _p.group === "nodes";
        var overriddenStyles = ele._private.style;
        propNames = Object.keys(overriddenStyles);
        for (var i2 = 0; i2 < propGrKeys.length; i2++) {
          var grKey = propGrKeys[i2];
          _p.styleKeys[grKey] = [DEFAULT_HASH_SEED, DEFAULT_HASH_SEED_ALT];
        }
        var updateGrKey1 = /* @__PURE__ */ __name(function updateGrKey12(val, grKey2) {
          return _p.styleKeys[grKey2][0] = hashInt(val, _p.styleKeys[grKey2][0]);
        }, "updateGrKey1");
        var updateGrKey2 = /* @__PURE__ */ __name(function updateGrKey22(val, grKey2) {
          return _p.styleKeys[grKey2][1] = hashIntAlt(val, _p.styleKeys[grKey2][1]);
        }, "updateGrKey2");
        var updateGrKey = /* @__PURE__ */ __name(function updateGrKey3(val, grKey2) {
          updateGrKey1(val, grKey2);
          updateGrKey2(val, grKey2);
        }, "updateGrKey");
        var updateGrKeyWStr = /* @__PURE__ */ __name(function updateGrKeyWStr2(strVal, grKey2) {
          for (var j3 = 0; j3 < strVal.length; j3++) {
            var ch = strVal.charCodeAt(j3);
            updateGrKey1(ch, grKey2);
            updateGrKey2(ch, grKey2);
          }
        }, "updateGrKeyWStr");
        var N3 = 2e9;
        var cleanNum = /* @__PURE__ */ __name(function cleanNum2(val) {
          return -128 < val && val < 128 && Math.floor(val) !== val ? N3 - (val * 1024 | 0) : val;
        }, "cleanNum");
        for (var _i = 0; _i < propNames.length; _i++) {
          var name = propNames[_i];
          var parsedProp = overriddenStyles[name];
          if (parsedProp == null) {
            continue;
          }
          var propInfo = this.properties[name];
          var type3 = propInfo.type;
          var _grKey = propInfo.groupKey;
          var normalizedNumberVal = void 0;
          if (propInfo.hashOverride != null) {
            normalizedNumberVal = propInfo.hashOverride(ele, parsedProp);
          } else if (parsedProp.pfValue != null) {
            normalizedNumberVal = parsedProp.pfValue;
          }
          var numberVal = propInfo.enums == null ? parsedProp.value : null;
          var haveNormNum = normalizedNumberVal != null;
          var haveUnitedNum = numberVal != null;
          var haveNum = haveNormNum || haveUnitedNum;
          var units = parsedProp.units;
          if (type3.number && haveNum && !type3.multiple) {
            var v3 = haveNormNum ? normalizedNumberVal : numberVal;
            updateGrKey(cleanNum(v3), _grKey);
            if (!haveNormNum && units != null) {
              updateGrKeyWStr(units, _grKey);
            }
          } else {
            updateGrKeyWStr(parsedProp.strValue, _grKey);
          }
        }
        var hash = [DEFAULT_HASH_SEED, DEFAULT_HASH_SEED_ALT];
        for (var _i2 = 0; _i2 < propGrKeys.length; _i2++) {
          var _grKey2 = propGrKeys[_i2];
          var grHash = _p.styleKeys[_grKey2];
          hash[0] = hashInt(grHash[0], hash[0]);
          hash[1] = hashIntAlt(grHash[1], hash[1]);
        }
        _p.styleKey = combineHashes(hash[0], hash[1]);
        var sk = _p.styleKeys;
        _p.labelDimsKey = combineHashesArray(sk.labelDimensions);
        var labelKeys = propHash(ele, ["label"], sk.labelDimensions);
        _p.labelKey = combineHashesArray(labelKeys);
        _p.labelStyleKey = combineHashesArray(hashArrays(sk.commonLabel, labelKeys));
        if (!isNode2) {
          var sourceLabelKeys = propHash(ele, ["source-label"], sk.labelDimensions);
          _p.sourceLabelKey = combineHashesArray(sourceLabelKeys);
          _p.sourceLabelStyleKey = combineHashesArray(hashArrays(sk.commonLabel, sourceLabelKeys));
          var targetLabelKeys = propHash(ele, ["target-label"], sk.labelDimensions);
          _p.targetLabelKey = combineHashesArray(targetLabelKeys);
          _p.targetLabelStyleKey = combineHashesArray(hashArrays(sk.commonLabel, targetLabelKeys));
        }
        if (isNode2) {
          var _p$styleKeys = _p.styleKeys, nodeBody = _p$styleKeys.nodeBody, nodeBorder = _p$styleKeys.nodeBorder, nodeOutline = _p$styleKeys.nodeOutline, backgroundImage = _p$styleKeys.backgroundImage, compound = _p$styleKeys.compound, pie2 = _p$styleKeys.pie, stripe = _p$styleKeys.stripe;
          var nodeKeys = [nodeBody, nodeBorder, nodeOutline, backgroundImage, compound, pie2, stripe].filter(function(k2) {
            return k2 != null;
          }).reduce(hashArrays, [DEFAULT_HASH_SEED, DEFAULT_HASH_SEED_ALT]);
          _p.nodeKey = combineHashesArray(nodeKeys);
          _p.hasPie = pie2 != null && pie2[0] !== DEFAULT_HASH_SEED && pie2[1] !== DEFAULT_HASH_SEED_ALT;
          _p.hasStripe = stripe != null && stripe[0] !== DEFAULT_HASH_SEED && stripe[1] !== DEFAULT_HASH_SEED_ALT;
        }
        return oldStyleKey !== _p.styleKey;
      };
      styfn$8.clearStyleHints = function(ele) {
        var _p = ele._private;
        _p.styleCxtKey = "";
        _p.styleKeys = {};
        _p.styleKey = null;
        _p.labelKey = null;
        _p.labelStyleKey = null;
        _p.sourceLabelKey = null;
        _p.sourceLabelStyleKey = null;
        _p.targetLabelKey = null;
        _p.targetLabelStyleKey = null;
        _p.nodeKey = null;
        _p.hasPie = null;
        _p.hasStripe = null;
      };
      styfn$8.applyParsedProperty = function(ele, parsedProp) {
        var self2 = this;
        var prop = parsedProp;
        var style3 = ele._private.style;
        var flatProp;
        var types = self2.types;
        var type3 = self2.properties[prop.name].type;
        var propIsBypass = prop.bypass;
        var origProp = style3[prop.name];
        var origPropIsBypass = origProp && origProp.bypass;
        var _p = ele._private;
        var flatPropMapping = "mapping";
        var getVal = /* @__PURE__ */ __name(function getVal2(p3) {
          if (p3 == null) {
            return null;
          } else if (p3.pfValue != null) {
            return p3.pfValue;
          } else {
            return p3.value;
          }
        }, "getVal");
        var checkTriggers = /* @__PURE__ */ __name(function checkTriggers2() {
          var fromVal = getVal(origProp);
          var toVal = getVal(prop);
          self2.checkTriggers(ele, prop.name, fromVal, toVal);
        }, "checkTriggers");
        if (parsedProp.name === "curve-style" && ele.isEdge() && // loops must be bundled beziers
        (parsedProp.value !== "bezier" && ele.isLoop() || // edges connected to compound nodes can not be haystacks
        parsedProp.value === "haystack" && (ele.source().isParent() || ele.target().isParent()))) {
          prop = parsedProp = this.parse(parsedProp.name, "bezier", propIsBypass);
        }
        if (prop["delete"]) {
          style3[prop.name] = void 0;
          checkTriggers();
          return true;
        }
        if (prop.deleteBypassed) {
          if (!origProp) {
            checkTriggers();
            return true;
          } else if (origProp.bypass) {
            origProp.bypassed = void 0;
            checkTriggers();
            return true;
          } else {
            return false;
          }
        }
        if (prop.deleteBypass) {
          if (!origProp) {
            checkTriggers();
            return true;
          } else if (origProp.bypass) {
            style3[prop.name] = origProp.bypassed;
            checkTriggers();
            return true;
          } else {
            return false;
          }
        }
        var printMappingErr = /* @__PURE__ */ __name(function printMappingErr2() {
          warn("Do not assign mappings to elements without corresponding data (i.e. ele `" + ele.id() + "` has no mapping for property `" + prop.name + "` with data field `" + prop.field + "`); try a `[" + prop.field + "]` selector to limit scope to elements with `" + prop.field + "` defined");
        }, "printMappingErr");
        switch (prop.mapped) {
          // flatten the property if mapped
          case types.mapData: {
            var fields = prop.field.split(".");
            var fieldVal = _p.data;
            for (var i2 = 0; i2 < fields.length && fieldVal; i2++) {
              var field = fields[i2];
              fieldVal = fieldVal[field];
            }
            if (fieldVal == null) {
              printMappingErr();
              return false;
            }
            var percent;
            if (!number$1(fieldVal)) {
              warn("Do not use continuous mappers without specifying numeric data (i.e. `" + prop.field + ": " + fieldVal + "` for `" + ele.id() + "` is non-numeric)");
              return false;
            } else {
              var fieldWidth = prop.fieldMax - prop.fieldMin;
              if (fieldWidth === 0) {
                percent = 0;
              } else {
                percent = (fieldVal - prop.fieldMin) / fieldWidth;
              }
            }
            if (percent < 0) {
              percent = 0;
            } else if (percent > 1) {
              percent = 1;
            }
            if (type3.color) {
              var r1 = prop.valueMin[0];
              var r2 = prop.valueMax[0];
              var g1 = prop.valueMin[1];
              var g2 = prop.valueMax[1];
              var b1 = prop.valueMin[2];
              var b22 = prop.valueMax[2];
              var a1 = prop.valueMin[3] == null ? 1 : prop.valueMin[3];
              var a2 = prop.valueMax[3] == null ? 1 : prop.valueMax[3];
              var clr = [Math.round(r1 + (r2 - r1) * percent), Math.round(g1 + (g2 - g1) * percent), Math.round(b1 + (b22 - b1) * percent), Math.round(a1 + (a2 - a1) * percent)];
              flatProp = {
                // colours are simple, so just create the flat property instead of expensive string parsing
                bypass: prop.bypass,
                // we're a bypass if the mapping property is a bypass
                name: prop.name,
                value: clr,
                strValue: "rgb(" + clr[0] + ", " + clr[1] + ", " + clr[2] + ")"
              };
            } else if (type3.number) {
              var calcValue = prop.valueMin + (prop.valueMax - prop.valueMin) * percent;
              flatProp = this.parse(prop.name, calcValue, prop.bypass, flatPropMapping);
            } else {
              return false;
            }
            if (!flatProp) {
              printMappingErr();
              return false;
            }
            flatProp.mapping = prop;
            prop = flatProp;
            break;
          }
          // direct mapping
          case types.data: {
            var _fields = prop.field.split(".");
            var _fieldVal = _p.data;
            for (var _i3 = 0; _i3 < _fields.length && _fieldVal; _i3++) {
              var _field = _fields[_i3];
              _fieldVal = _fieldVal[_field];
            }
            if (_fieldVal != null) {
              flatProp = this.parse(prop.name, _fieldVal, prop.bypass, flatPropMapping);
            }
            if (!flatProp) {
              printMappingErr();
              return false;
            }
            flatProp.mapping = prop;
            prop = flatProp;
            break;
          }
          case types.fn: {
            var fn3 = prop.value;
            var fnRetVal = prop.fnValue != null ? prop.fnValue : fn3(ele);
            prop.prevFnValue = fnRetVal;
            if (fnRetVal == null) {
              warn("Custom function mappers may not return null (i.e. `" + prop.name + "` for ele `" + ele.id() + "` is null)");
              return false;
            }
            flatProp = this.parse(prop.name, fnRetVal, prop.bypass, flatPropMapping);
            if (!flatProp) {
              warn("Custom function mappers may not return invalid values for the property type (i.e. `" + prop.name + "` for ele `" + ele.id() + "` is invalid)");
              return false;
            }
            flatProp.mapping = copy3(prop);
            prop = flatProp;
            break;
          }
          case void 0:
            break;
          // just set the property
          default:
            return false;
        }
        if (propIsBypass) {
          if (origPropIsBypass) {
            prop.bypassed = origProp.bypassed;
          } else {
            prop.bypassed = origProp;
          }
          style3[prop.name] = prop;
        } else {
          if (origPropIsBypass) {
            origProp.bypassed = prop;
          } else {
            style3[prop.name] = prop;
          }
        }
        checkTriggers();
        return true;
      };
      styfn$8.cleanElements = function(eles, keepBypasses) {
        for (var i2 = 0; i2 < eles.length; i2++) {
          var ele = eles[i2];
          this.clearStyleHints(ele);
          ele.dirtyCompoundBoundsCache();
          ele.dirtyBoundingBoxCache();
          if (!keepBypasses) {
            ele._private.style = {};
          } else {
            var style3 = ele._private.style;
            var propNames = Object.keys(style3);
            for (var j3 = 0; j3 < propNames.length; j3++) {
              var propName = propNames[j3];
              var eleProp = style3[propName];
              if (eleProp != null) {
                if (eleProp.bypass) {
                  eleProp.bypassed = null;
                } else {
                  style3[propName] = null;
                }
              }
            }
          }
        }
      };
      styfn$8.update = function() {
        var cy = this._private.cy;
        var eles = cy.mutableElements();
        eles.updateStyle();
      };
      styfn$8.updateTransitions = function(ele, diffProps) {
        var self2 = this;
        var _p = ele._private;
        var props = ele.pstyle("transition-property").value;
        var duration = ele.pstyle("transition-duration").pfValue;
        var delay2 = ele.pstyle("transition-delay").pfValue;
        if (props.length > 0 && duration > 0) {
          var style3 = {};
          var anyPrev = false;
          for (var i2 = 0; i2 < props.length; i2++) {
            var prop = props[i2];
            var styProp = ele.pstyle(prop);
            var diffProp = diffProps[prop];
            if (!diffProp) {
              continue;
            }
            var prevProp = diffProp.prev;
            var fromProp = prevProp;
            var toProp = diffProp.next != null ? diffProp.next : styProp;
            var diff2 = false;
            var initVal = void 0;
            var initDt = 1e-6;
            if (!fromProp) {
              continue;
            }
            if (number$1(fromProp.pfValue) && number$1(toProp.pfValue)) {
              diff2 = toProp.pfValue - fromProp.pfValue;
              initVal = fromProp.pfValue + initDt * diff2;
            } else if (number$1(fromProp.value) && number$1(toProp.value)) {
              diff2 = toProp.value - fromProp.value;
              initVal = fromProp.value + initDt * diff2;
            } else if (array2(fromProp.value) && array2(toProp.value)) {
              diff2 = fromProp.value[0] !== toProp.value[0] || fromProp.value[1] !== toProp.value[1] || fromProp.value[2] !== toProp.value[2];
              initVal = fromProp.strValue;
            }
            if (diff2) {
              style3[prop] = toProp.strValue;
              this.applyBypass(ele, prop, initVal);
              anyPrev = true;
            }
          }
          if (!anyPrev) {
            return;
          }
          _p.transitioning = true;
          new Promise$1(function(resolve2) {
            if (delay2 > 0) {
              ele.delayAnimation(delay2).play().promise().then(resolve2);
            } else {
              resolve2();
            }
          }).then(function() {
            return ele.animation({
              style: style3,
              duration,
              easing: ele.pstyle("transition-timing-function").value,
              queue: false
            }).play().promise();
          }).then(function() {
            self2.removeBypasses(ele, props);
            ele.emitAndNotify("style");
            _p.transitioning = false;
          });
        } else if (_p.transitioning) {
          this.removeBypasses(ele, props);
          ele.emitAndNotify("style");
          _p.transitioning = false;
        }
      };
      styfn$8.checkTrigger = function(ele, name, fromValue, toValue, getTrigger, onTrigger) {
        var prop = this.properties[name];
        var triggerCheck = getTrigger(prop);
        if (ele.removed()) {
          return;
        }
        if (triggerCheck != null && triggerCheck(fromValue, toValue, ele)) {
          onTrigger(prop);
        }
      };
      styfn$8.checkZOrderTrigger = function(ele, name, fromValue, toValue) {
        var _this = this;
        this.checkTrigger(ele, name, fromValue, toValue, function(prop) {
          return prop.triggersZOrder;
        }, function() {
          _this._private.cy.notify("zorder", ele);
        });
      };
      styfn$8.checkBoundsTrigger = function(ele, name, fromValue, toValue) {
        this.checkTrigger(ele, name, fromValue, toValue, function(prop) {
          return prop.triggersBounds;
        }, function(prop) {
          ele.dirtyCompoundBoundsCache();
          ele.dirtyBoundingBoxCache();
        });
      };
      styfn$8.checkConnectedEdgesBoundsTrigger = function(ele, name, fromValue, toValue) {
        this.checkTrigger(ele, name, fromValue, toValue, function(prop) {
          return prop.triggersBoundsOfConnectedEdges;
        }, function(prop) {
          ele.connectedEdges().forEach(function(edge) {
            edge.dirtyBoundingBoxCache();
          });
        });
      };
      styfn$8.checkParallelEdgesBoundsTrigger = function(ele, name, fromValue, toValue) {
        this.checkTrigger(ele, name, fromValue, toValue, function(prop) {
          return prop.triggersBoundsOfParallelEdges;
        }, function(prop) {
          ele.parallelEdges().forEach(function(pllEdge) {
            pllEdge.dirtyBoundingBoxCache();
          });
        });
      };
      styfn$8.checkTriggers = function(ele, name, fromValue, toValue) {
        ele.dirtyStyleCache();
        this.checkZOrderTrigger(ele, name, fromValue, toValue);
        this.checkBoundsTrigger(ele, name, fromValue, toValue);
        this.checkConnectedEdgesBoundsTrigger(ele, name, fromValue, toValue);
        this.checkParallelEdgesBoundsTrigger(ele, name, fromValue, toValue);
      };
      styfn$7 = {};
      styfn$7.applyBypass = function(eles, name, value2, updateTransitions) {
        var self2 = this;
        var props = [];
        var isBypass = true;
        if (name === "*" || name === "**") {
          if (value2 !== void 0) {
            for (var i2 = 0; i2 < self2.properties.length; i2++) {
              var prop = self2.properties[i2];
              var _name = prop.name;
              var parsedProp = this.parse(_name, value2, true);
              if (parsedProp) {
                props.push(parsedProp);
              }
            }
          }
        } else if (string(name)) {
          var _parsedProp = this.parse(name, value2, true);
          if (_parsedProp) {
            props.push(_parsedProp);
          }
        } else if (plainObject(name)) {
          var specifiedProps = name;
          updateTransitions = value2;
          var names = Object.keys(specifiedProps);
          for (var _i = 0; _i < names.length; _i++) {
            var _name2 = names[_i];
            var _value = specifiedProps[_name2];
            if (_value === void 0) {
              _value = specifiedProps[dash2camel(_name2)];
            }
            if (_value !== void 0) {
              var _parsedProp2 = this.parse(_name2, _value, true);
              if (_parsedProp2) {
                props.push(_parsedProp2);
              }
            }
          }
        } else {
          return false;
        }
        if (props.length === 0) {
          return false;
        }
        var ret = false;
        for (var _i2 = 0; _i2 < eles.length; _i2++) {
          var ele = eles[_i2];
          var diffProps = {};
          var diffProp = void 0;
          for (var j3 = 0; j3 < props.length; j3++) {
            var _prop = props[j3];
            if (updateTransitions) {
              var prevProp = ele.pstyle(_prop.name);
              diffProp = diffProps[_prop.name] = {
                prev: prevProp
              };
            }
            ret = this.applyParsedProperty(ele, copy3(_prop)) || ret;
            if (updateTransitions) {
              diffProp.next = ele.pstyle(_prop.name);
            }
          }
          if (ret) {
            this.updateStyleHints(ele);
          }
          if (updateTransitions) {
            this.updateTransitions(ele, diffProps, isBypass);
          }
        }
        return ret;
      };
      styfn$7.overrideBypass = function(eles, name, value2) {
        name = camel2dash(name);
        for (var i2 = 0; i2 < eles.length; i2++) {
          var ele = eles[i2];
          var prop = ele._private.style[name];
          var type3 = this.properties[name].type;
          var isColor = type3.color;
          var isMulti = type3.mutiple;
          var oldValue = !prop ? null : prop.pfValue != null ? prop.pfValue : prop.value;
          if (!prop || !prop.bypass) {
            this.applyBypass(ele, name, value2);
          } else {
            prop.value = value2;
            if (prop.pfValue != null) {
              prop.pfValue = value2;
            }
            if (isColor) {
              prop.strValue = "rgb(" + value2.join(",") + ")";
            } else if (isMulti) {
              prop.strValue = value2.join(" ");
            } else {
              prop.strValue = "" + value2;
            }
            this.updateStyleHints(ele);
          }
          this.checkTriggers(ele, name, oldValue, value2);
        }
      };
      styfn$7.removeAllBypasses = function(eles, updateTransitions) {
        return this.removeBypasses(eles, this.propertyNames, updateTransitions);
      };
      styfn$7.removeBypasses = function(eles, props, updateTransitions) {
        var isBypass = true;
        for (var j3 = 0; j3 < eles.length; j3++) {
          var ele = eles[j3];
          var diffProps = {};
          for (var i2 = 0; i2 < props.length; i2++) {
            var name = props[i2];
            var prop = this.properties[name];
            var prevProp = ele.pstyle(prop.name);
            if (!prevProp || !prevProp.bypass) {
              continue;
            }
            var value2 = "";
            var parsedProp = this.parse(name, value2, true);
            var diffProp = diffProps[prop.name] = {
              prev: prevProp
            };
            this.applyParsedProperty(ele, parsedProp);
            diffProp.next = ele.pstyle(prop.name);
          }
          this.updateStyleHints(ele);
          if (updateTransitions) {
            this.updateTransitions(ele, diffProps, isBypass);
          }
        }
      };
      styfn$6 = {};
      styfn$6.getEmSizeInPixels = function() {
        var px = this.containerCss("font-size");
        if (px != null) {
          return parseFloat(px);
        } else {
          return 1;
        }
      };
      styfn$6.containerCss = function(propName) {
        var cy = this._private.cy;
        var domElement3 = cy.container();
        var containerWindow = cy.window();
        if (containerWindow && domElement3 && containerWindow.getComputedStyle) {
          return containerWindow.getComputedStyle(domElement3).getPropertyValue(propName);
        }
      };
      styfn$5 = {};
      styfn$5.getRenderedStyle = function(ele, prop) {
        if (prop) {
          return this.getStylePropertyValue(ele, prop, true);
        } else {
          return this.getRawStyle(ele, true);
        }
      };
      styfn$5.getRawStyle = function(ele, isRenderedVal) {
        var self2 = this;
        ele = ele[0];
        if (ele) {
          var rstyle = {};
          for (var i2 = 0; i2 < self2.properties.length; i2++) {
            var prop = self2.properties[i2];
            var val = self2.getStylePropertyValue(ele, prop.name, isRenderedVal);
            if (val != null) {
              rstyle[prop.name] = val;
              rstyle[dash2camel(prop.name)] = val;
            }
          }
          return rstyle;
        }
      };
      styfn$5.getIndexedStyle = function(ele, property2, subproperty, index) {
        var pstyle = ele.pstyle(property2)[subproperty][index];
        return pstyle != null ? pstyle : ele.cy().style().getDefaultProperty(property2)[subproperty][0];
      };
      styfn$5.getStylePropertyValue = function(ele, propName, isRenderedVal) {
        var self2 = this;
        ele = ele[0];
        if (ele) {
          var prop = self2.properties[propName];
          if (prop.alias) {
            prop = prop.pointsTo;
          }
          var type3 = prop.type;
          var styleProp = ele.pstyle(prop.name);
          if (styleProp) {
            var value2 = styleProp.value, units = styleProp.units, strValue = styleProp.strValue;
            if (isRenderedVal && type3.number && value2 != null && number$1(value2)) {
              var zoom2 = ele.cy().zoom();
              var getRenderedValue = /* @__PURE__ */ __name(function getRenderedValue2(val) {
                return val * zoom2;
              }, "getRenderedValue");
              var getValueStringWithUnits = /* @__PURE__ */ __name(function getValueStringWithUnits2(val, units2) {
                return getRenderedValue(val) + units2;
              }, "getValueStringWithUnits");
              var isArrayValue = array2(value2);
              var haveUnits = isArrayValue ? units.every(function(u2) {
                return u2 != null;
              }) : units != null;
              if (haveUnits) {
                if (isArrayValue) {
                  return value2.map(function(v3, i2) {
                    return getValueStringWithUnits(v3, units[i2]);
                  }).join(" ");
                } else {
                  return getValueStringWithUnits(value2, units);
                }
              } else {
                if (isArrayValue) {
                  return value2.map(function(v3) {
                    return string(v3) ? v3 : "" + getRenderedValue(v3);
                  }).join(" ");
                } else {
                  return "" + getRenderedValue(value2);
                }
              }
            } else if (strValue != null) {
              return strValue;
            }
          }
          return null;
        }
      };
      styfn$5.getAnimationStartStyle = function(ele, aniProps) {
        var rstyle = {};
        for (var i2 = 0; i2 < aniProps.length; i2++) {
          var aniProp = aniProps[i2];
          var name = aniProp.name;
          var styleProp = ele.pstyle(name);
          if (styleProp !== void 0) {
            if (plainObject(styleProp)) {
              styleProp = this.parse(name, styleProp.strValue);
            } else {
              styleProp = this.parse(name, styleProp);
            }
          }
          if (styleProp) {
            rstyle[name] = styleProp;
          }
        }
        return rstyle;
      };
      styfn$5.getPropsList = function(propsObj) {
        var self2 = this;
        var rstyle = [];
        var style3 = propsObj;
        var props = self2.properties;
        if (style3) {
          var names = Object.keys(style3);
          for (var i2 = 0; i2 < names.length; i2++) {
            var name = names[i2];
            var val = style3[name];
            var prop = props[name] || props[camel2dash(name)];
            var styleProp = this.parse(prop.name, val);
            if (styleProp) {
              rstyle.push(styleProp);
            }
          }
        }
        return rstyle;
      };
      styfn$5.getNonDefaultPropertiesHash = function(ele, propNames, seed) {
        var hash = seed.slice();
        var name, val, strVal, chVal;
        var i2, j3;
        for (i2 = 0; i2 < propNames.length; i2++) {
          name = propNames[i2];
          val = ele.pstyle(name, false);
          if (val == null) {
            continue;
          } else if (val.pfValue != null) {
            hash[0] = hashInt(chVal, hash[0]);
            hash[1] = hashIntAlt(chVal, hash[1]);
          } else {
            strVal = val.strValue;
            for (j3 = 0; j3 < strVal.length; j3++) {
              chVal = strVal.charCodeAt(j3);
              hash[0] = hashInt(chVal, hash[0]);
              hash[1] = hashIntAlt(chVal, hash[1]);
            }
          }
        }
        return hash;
      };
      styfn$5.getPropertiesHash = styfn$5.getNonDefaultPropertiesHash;
      styfn$4 = {};
      styfn$4.appendFromJson = function(json3) {
        var style3 = this;
        for (var i2 = 0; i2 < json3.length; i2++) {
          var context = json3[i2];
          var selector = context.selector;
          var props = context.style || context.css;
          var names = Object.keys(props);
          style3.selector(selector);
          for (var j3 = 0; j3 < names.length; j3++) {
            var name = names[j3];
            var value2 = props[name];
            style3.css(name, value2);
          }
        }
        return style3;
      };
      styfn$4.fromJson = function(json3) {
        var style3 = this;
        style3.resetToDefault();
        style3.appendFromJson(json3);
        return style3;
      };
      styfn$4.json = function() {
        var json3 = [];
        for (var i2 = this.defaultLength; i2 < this.length; i2++) {
          var cxt = this[i2];
          var selector = cxt.selector;
          var props = cxt.properties;
          var css = {};
          for (var j3 = 0; j3 < props.length; j3++) {
            var prop = props[j3];
            css[prop.name] = prop.strValue;
          }
          json3.push({
            selector: !selector ? "core" : selector.toString(),
            style: css
          });
        }
        return json3;
      };
      styfn$3 = {};
      styfn$3.appendFromString = function(string3) {
        var self2 = this;
        var style3 = this;
        var remaining = "" + string3;
        var selAndBlockStr;
        var blockRem;
        var propAndValStr;
        remaining = remaining.replace(/[/][*](\s|.)+?[*][/]/g, "");
        function removeSelAndBlockFromRemaining() {
          if (remaining.length > selAndBlockStr.length) {
            remaining = remaining.substr(selAndBlockStr.length);
          } else {
            remaining = "";
          }
        }
        __name(removeSelAndBlockFromRemaining, "removeSelAndBlockFromRemaining");
        function removePropAndValFromRem() {
          if (blockRem.length > propAndValStr.length) {
            blockRem = blockRem.substr(propAndValStr.length);
          } else {
            blockRem = "";
          }
        }
        __name(removePropAndValFromRem, "removePropAndValFromRem");
        for (; ; ) {
          var nothingLeftToParse = remaining.match(/^\s*$/);
          if (nothingLeftToParse) {
            break;
          }
          var selAndBlock = remaining.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);
          if (!selAndBlock) {
            warn("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: " + remaining);
            break;
          }
          selAndBlockStr = selAndBlock[0];
          var selectorStr = selAndBlock[1];
          if (selectorStr !== "core") {
            var selector = new Selector(selectorStr);
            if (selector.invalid) {
              warn("Skipping parsing of block: Invalid selector found in string stylesheet: " + selectorStr);
              removeSelAndBlockFromRemaining();
              continue;
            }
          }
          var blockStr = selAndBlock[2];
          var invalidBlock = false;
          blockRem = blockStr;
          var props = [];
          for (; ; ) {
            var _nothingLeftToParse = blockRem.match(/^\s*$/);
            if (_nothingLeftToParse) {
              break;
            }
            var propAndVal = blockRem.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);
            if (!propAndVal) {
              warn("Skipping parsing of block: Invalid formatting of style property and value definitions found in:" + blockStr);
              invalidBlock = true;
              break;
            }
            propAndValStr = propAndVal[0];
            var propStr = propAndVal[1];
            var valStr = propAndVal[2];
            var prop = self2.properties[propStr];
            if (!prop) {
              warn("Skipping property: Invalid property name in: " + propAndValStr);
              removePropAndValFromRem();
              continue;
            }
            var parsedProp = style3.parse(propStr, valStr);
            if (!parsedProp) {
              warn("Skipping property: Invalid property definition in: " + propAndValStr);
              removePropAndValFromRem();
              continue;
            }
            props.push({
              name: propStr,
              val: valStr
            });
            removePropAndValFromRem();
          }
          if (invalidBlock) {
            removeSelAndBlockFromRemaining();
            break;
          }
          style3.selector(selectorStr);
          for (var i2 = 0; i2 < props.length; i2++) {
            var _prop = props[i2];
            style3.css(_prop.name, _prop.val);
          }
          removeSelAndBlockFromRemaining();
        }
        return style3;
      };
      styfn$3.fromString = function(string3) {
        var style3 = this;
        style3.resetToDefault();
        style3.appendFromString(string3);
        return style3;
      };
      styfn$2 = {};
      (function() {
        var number$12 = number6;
        var rgba4 = rgbaNoBackRefs;
        var hsla3 = hslaNoBackRefs;
        var hex3$1 = hex3;
        var hex6$1 = hex6;
        var data5 = /* @__PURE__ */ __name(function data6(prefix) {
          return "^" + prefix + "\\s*\\(\\s*([\\w\\.]+)\\s*\\)$";
        }, "data");
        var mapData = /* @__PURE__ */ __name(function mapData2(prefix) {
          var mapArg = number$12 + "|\\w+|" + rgba4 + "|" + hsla3 + "|" + hex3$1 + "|" + hex6$1;
          return "^" + prefix + "\\s*\\(([\\w\\.]+)\\s*\\,\\s*(" + number$12 + ")\\s*\\,\\s*(" + number$12 + ")\\s*,\\s*(" + mapArg + ")\\s*\\,\\s*(" + mapArg + ")\\)$";
        }, "mapData");
        var urlRegexes = [`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`, "^(none)$", "^(.+)$"];
        styfn$2.types = {
          time: {
            number: true,
            min: 0,
            units: "s|ms",
            implicitUnits: "ms"
          },
          percent: {
            number: true,
            min: 0,
            max: 100,
            units: "%",
            implicitUnits: "%"
          },
          percentages: {
            number: true,
            min: 0,
            max: 100,
            units: "%",
            implicitUnits: "%",
            multiple: true
          },
          zeroOneNumber: {
            number: true,
            min: 0,
            max: 1,
            unitless: true
          },
          zeroOneNumbers: {
            number: true,
            min: 0,
            max: 1,
            unitless: true,
            multiple: true
          },
          nOneOneNumber: {
            number: true,
            min: -1,
            max: 1,
            unitless: true
          },
          nonNegativeInt: {
            number: true,
            min: 0,
            integer: true,
            unitless: true
          },
          nonNegativeNumber: {
            number: true,
            min: 0,
            unitless: true
          },
          position: {
            enums: ["parent", "origin"]
          },
          nodeSize: {
            number: true,
            min: 0,
            enums: ["label"]
          },
          number: {
            number: true,
            unitless: true
          },
          numbers: {
            number: true,
            unitless: true,
            multiple: true
          },
          positiveNumber: {
            number: true,
            unitless: true,
            min: 0,
            strictMin: true
          },
          size: {
            number: true,
            min: 0
          },
          bidirectionalSize: {
            number: true
          },
          // allows negative
          bidirectionalSizeMaybePercent: {
            number: true,
            allowPercent: true
          },
          // allows negative
          bidirectionalSizes: {
            number: true,
            multiple: true
          },
          // allows negative
          sizeMaybePercent: {
            number: true,
            min: 0,
            allowPercent: true
          },
          axisDirection: {
            enums: ["horizontal", "leftward", "rightward", "vertical", "upward", "downward", "auto"]
          },
          axisDirectionExplicit: {
            enums: ["leftward", "rightward", "upward", "downward"]
          },
          axisDirectionPrimary: {
            enums: ["horizontal", "vertical"]
          },
          paddingRelativeTo: {
            enums: ["width", "height", "average", "min", "max"]
          },
          bgWH: {
            number: true,
            min: 0,
            allowPercent: true,
            enums: ["auto"],
            multiple: true
          },
          bgPos: {
            number: true,
            allowPercent: true,
            multiple: true
          },
          bgRelativeTo: {
            enums: ["inner", "include-padding"],
            multiple: true
          },
          bgRepeat: {
            enums: ["repeat", "repeat-x", "repeat-y", "no-repeat"],
            multiple: true
          },
          bgFit: {
            enums: ["none", "contain", "cover"],
            multiple: true
          },
          bgCrossOrigin: {
            enums: ["anonymous", "use-credentials", "null"],
            multiple: true
          },
          bgClip: {
            enums: ["none", "node"],
            multiple: true
          },
          bgContainment: {
            enums: ["inside", "over"],
            multiple: true
          },
          boxSelection: {
            enums: ["contain", "overlap", "none"]
          },
          color: {
            color: true
          },
          colors: {
            color: true,
            multiple: true
          },
          fill: {
            enums: ["solid", "linear-gradient", "radial-gradient"]
          },
          bool: {
            enums: ["yes", "no"]
          },
          bools: {
            enums: ["yes", "no"],
            multiple: true
          },
          lineStyle: {
            enums: ["solid", "dotted", "dashed"]
          },
          lineCap: {
            enums: ["butt", "round", "square"]
          },
          linePosition: {
            enums: ["center", "inside", "outside"]
          },
          lineJoin: {
            enums: ["round", "bevel", "miter"]
          },
          borderStyle: {
            enums: ["solid", "dotted", "dashed", "double"]
          },
          curveStyle: {
            enums: ["bezier", "unbundled-bezier", "haystack", "segments", "straight", "straight-triangle", "taxi", "round-segments", "round-taxi"]
          },
          radiusType: {
            enums: ["arc-radius", "influence-radius"],
            multiple: true
          },
          fontFamily: {
            regex: '^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'
          },
          fontStyle: {
            enums: ["italic", "normal", "oblique"]
          },
          fontWeight: {
            enums: ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "800", "900", 100, 200, 300, 400, 500, 600, 700, 800, 900]
          },
          textDecoration: {
            enums: ["none", "underline", "overline", "line-through"]
          },
          textTransform: {
            enums: ["none", "uppercase", "lowercase"]
          },
          textWrap: {
            enums: ["none", "wrap", "ellipsis"]
          },
          textOverflowWrap: {
            enums: ["whitespace", "anywhere"]
          },
          textBackgroundShape: {
            enums: ["rectangle", "roundrectangle", "round-rectangle", "circle"]
          },
          nodeShape: {
            enums: ["rectangle", "roundrectangle", "round-rectangle", "cutrectangle", "cut-rectangle", "bottomroundrectangle", "bottom-round-rectangle", "barrel", "ellipse", "triangle", "round-triangle", "square", "pentagon", "round-pentagon", "hexagon", "round-hexagon", "concavehexagon", "concave-hexagon", "heptagon", "round-heptagon", "octagon", "round-octagon", "tag", "round-tag", "star", "diamond", "round-diamond", "vee", "rhomboid", "right-rhomboid", "polygon"]
          },
          overlayShape: {
            enums: ["roundrectangle", "round-rectangle", "ellipse"]
          },
          cornerRadius: {
            number: true,
            min: 0,
            units: "px|em",
            implicitUnits: "px",
            enums: ["auto"]
          },
          compoundIncludeLabels: {
            enums: ["include", "exclude"]
          },
          arrowShape: {
            enums: ["tee", "triangle", "triangle-tee", "circle-triangle", "triangle-cross", "triangle-backcurve", "vee", "square", "circle", "diamond", "chevron", "none"]
          },
          arrowFill: {
            enums: ["filled", "hollow"]
          },
          arrowWidth: {
            number: true,
            units: "%|px|em",
            implicitUnits: "px",
            enums: ["match-line"]
          },
          display: {
            enums: ["element", "none"]
          },
          visibility: {
            enums: ["hidden", "visible"]
          },
          zCompoundDepth: {
            enums: ["bottom", "orphan", "auto", "top"]
          },
          zIndexCompare: {
            enums: ["auto", "manual"]
          },
          valign: {
            enums: ["top", "center", "bottom"]
          },
          halign: {
            enums: ["left", "center", "right"]
          },
          justification: {
            enums: ["left", "center", "right", "auto"]
          },
          text: {
            string: true
          },
          data: {
            mapping: true,
            regex: data5("data")
          },
          layoutData: {
            mapping: true,
            regex: data5("layoutData")
          },
          scratch: {
            mapping: true,
            regex: data5("scratch")
          },
          mapData: {
            mapping: true,
            regex: mapData("mapData")
          },
          mapLayoutData: {
            mapping: true,
            regex: mapData("mapLayoutData")
          },
          mapScratch: {
            mapping: true,
            regex: mapData("mapScratch")
          },
          fn: {
            mapping: true,
            fn: true
          },
          url: {
            regexes: urlRegexes,
            singleRegexMatchValue: true
          },
          urls: {
            regexes: urlRegexes,
            singleRegexMatchValue: true,
            multiple: true
          },
          propList: {
            propList: true
          },
          angle: {
            number: true,
            units: "deg|rad",
            implicitUnits: "rad"
          },
          textRotation: {
            number: true,
            units: "deg|rad",
            implicitUnits: "rad",
            enums: ["none", "autorotate"]
          },
          polygonPointList: {
            number: true,
            multiple: true,
            evenMultiple: true,
            min: -1,
            max: 1,
            unitless: true
          },
          edgeDistances: {
            enums: ["intersection", "node-position", "endpoints"]
          },
          edgeEndpoint: {
            number: true,
            multiple: true,
            units: "%|px|em|deg|rad",
            implicitUnits: "px",
            enums: ["inside-to-node", "outside-to-node", "outside-to-node-or-label", "outside-to-line", "outside-to-line-or-label"],
            singleEnum: true,
            validate: /* @__PURE__ */ __name(function validate(valArr, unitsArr) {
              switch (valArr.length) {
                case 2:
                  return unitsArr[0] !== "deg" && unitsArr[0] !== "rad" && unitsArr[1] !== "deg" && unitsArr[1] !== "rad";
                case 1:
                  return string(valArr[0]) || unitsArr[0] === "deg" || unitsArr[0] === "rad";
                default:
                  return false;
              }
            }, "validate")
          },
          easing: {
            regexes: ["^(spring)\\s*\\(\\s*(" + number$12 + ")\\s*,\\s*(" + number$12 + ")\\s*\\)$", "^(cubic-bezier)\\s*\\(\\s*(" + number$12 + ")\\s*,\\s*(" + number$12 + ")\\s*,\\s*(" + number$12 + ")\\s*,\\s*(" + number$12 + ")\\s*\\)$"],
            enums: ["linear", "ease", "ease-in", "ease-out", "ease-in-out", "ease-in-sine", "ease-out-sine", "ease-in-out-sine", "ease-in-quad", "ease-out-quad", "ease-in-out-quad", "ease-in-cubic", "ease-out-cubic", "ease-in-out-cubic", "ease-in-quart", "ease-out-quart", "ease-in-out-quart", "ease-in-quint", "ease-out-quint", "ease-in-out-quint", "ease-in-expo", "ease-out-expo", "ease-in-out-expo", "ease-in-circ", "ease-out-circ", "ease-in-out-circ"]
          },
          gradientDirection: {
            enums: [
              "to-bottom",
              "to-top",
              "to-left",
              "to-right",
              "to-bottom-right",
              "to-bottom-left",
              "to-top-right",
              "to-top-left",
              "to-right-bottom",
              "to-left-bottom",
              "to-right-top",
              "to-left-top"
              // different order
            ]
          },
          boundsExpansion: {
            number: true,
            multiple: true,
            min: 0,
            validate: /* @__PURE__ */ __name(function validate(valArr) {
              var length2 = valArr.length;
              return length2 === 1 || length2 === 2 || length2 === 4;
            }, "validate")
          }
        };
        var diff2 = {
          zeroNonZero: /* @__PURE__ */ __name(function zeroNonZero(val1, val2) {
            if ((val1 == null || val2 == null) && val1 !== val2) {
              return true;
            }
            if (val1 == 0 && val2 != 0) {
              return true;
            } else if (val1 != 0 && val2 == 0) {
              return true;
            } else {
              return false;
            }
          }, "zeroNonZero"),
          any: /* @__PURE__ */ __name(function any(val1, val2) {
            return val1 != val2;
          }, "any"),
          emptyNonEmpty: /* @__PURE__ */ __name(function emptyNonEmpty(str1, str2) {
            var empty1 = emptyString(str1);
            var empty22 = emptyString(str2);
            return empty1 && !empty22 || !empty1 && empty22;
          }, "emptyNonEmpty")
        };
        var t4 = styfn$2.types;
        var mainLabel = [{
          name: "label",
          type: t4.text,
          triggersBounds: diff2.any,
          triggersZOrder: diff2.emptyNonEmpty
        }, {
          name: "text-rotation",
          type: t4.textRotation,
          triggersBounds: diff2.any
        }, {
          name: "text-margin-x",
          type: t4.bidirectionalSize,
          triggersBounds: diff2.any
        }, {
          name: "text-margin-y",
          type: t4.bidirectionalSize,
          triggersBounds: diff2.any
        }];
        var sourceLabel = [{
          name: "source-label",
          type: t4.text,
          triggersBounds: diff2.any
        }, {
          name: "source-text-rotation",
          type: t4.textRotation,
          triggersBounds: diff2.any
        }, {
          name: "source-text-margin-x",
          type: t4.bidirectionalSize,
          triggersBounds: diff2.any
        }, {
          name: "source-text-margin-y",
          type: t4.bidirectionalSize,
          triggersBounds: diff2.any
        }, {
          name: "source-text-offset",
          type: t4.size,
          triggersBounds: diff2.any
        }];
        var targetLabel = [{
          name: "target-label",
          type: t4.text,
          triggersBounds: diff2.any
        }, {
          name: "target-text-rotation",
          type: t4.textRotation,
          triggersBounds: diff2.any
        }, {
          name: "target-text-margin-x",
          type: t4.bidirectionalSize,
          triggersBounds: diff2.any
        }, {
          name: "target-text-margin-y",
          type: t4.bidirectionalSize,
          triggersBounds: diff2.any
        }, {
          name: "target-text-offset",
          type: t4.size,
          triggersBounds: diff2.any
        }];
        var labelDimensions = [{
          name: "font-family",
          type: t4.fontFamily,
          triggersBounds: diff2.any
        }, {
          name: "font-style",
          type: t4.fontStyle,
          triggersBounds: diff2.any
        }, {
          name: "font-weight",
          type: t4.fontWeight,
          triggersBounds: diff2.any
        }, {
          name: "font-size",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "text-transform",
          type: t4.textTransform,
          triggersBounds: diff2.any
        }, {
          name: "text-wrap",
          type: t4.textWrap,
          triggersBounds: diff2.any
        }, {
          name: "text-overflow-wrap",
          type: t4.textOverflowWrap,
          triggersBounds: diff2.any
        }, {
          name: "text-max-width",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "text-outline-width",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "line-height",
          type: t4.positiveNumber,
          triggersBounds: diff2.any
        }];
        var commonLabel = [{
          name: "text-valign",
          type: t4.valign,
          triggersBounds: diff2.any
        }, {
          name: "text-halign",
          type: t4.halign,
          triggersBounds: diff2.any
        }, {
          name: "color",
          type: t4.color
        }, {
          name: "text-outline-color",
          type: t4.color
        }, {
          name: "text-outline-opacity",
          type: t4.zeroOneNumber
        }, {
          name: "text-background-color",
          type: t4.color
        }, {
          name: "text-background-opacity",
          type: t4.zeroOneNumber
        }, {
          name: "text-background-padding",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "text-border-opacity",
          type: t4.zeroOneNumber
        }, {
          name: "text-border-color",
          type: t4.color
        }, {
          name: "text-border-width",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "text-border-style",
          type: t4.borderStyle,
          triggersBounds: diff2.any
        }, {
          name: "text-background-shape",
          type: t4.textBackgroundShape,
          triggersBounds: diff2.any
        }, {
          name: "text-justification",
          type: t4.justification
        }, {
          name: "box-select-labels",
          type: t4.bool,
          triggersBounds: diff2.any
        }];
        var behavior = [{
          name: "events",
          type: t4.bool,
          triggersZOrder: diff2.any
        }, {
          name: "text-events",
          type: t4.bool,
          triggersZOrder: diff2.any
        }, {
          name: "box-selection",
          type: t4.boxSelection,
          triggersZOrder: diff2.any
        }];
        var visibility = [{
          name: "display",
          type: t4.display,
          triggersZOrder: diff2.any,
          triggersBounds: diff2.any,
          triggersBoundsOfConnectedEdges: diff2.any,
          triggersBoundsOfParallelEdges: /* @__PURE__ */ __name(function triggersBoundsOfParallelEdges(fromValue, toValue, ele) {
            if (fromValue === toValue) {
              return false;
            }
            return ele.pstyle("curve-style").value === "bezier";
          }, "triggersBoundsOfParallelEdges")
        }, {
          name: "visibility",
          type: t4.visibility,
          triggersZOrder: diff2.any
        }, {
          name: "opacity",
          type: t4.zeroOneNumber,
          triggersZOrder: diff2.zeroNonZero
        }, {
          name: "text-opacity",
          type: t4.zeroOneNumber
        }, {
          name: "min-zoomed-font-size",
          type: t4.size
        }, {
          name: "z-compound-depth",
          type: t4.zCompoundDepth,
          triggersZOrder: diff2.any
        }, {
          name: "z-index-compare",
          type: t4.zIndexCompare,
          triggersZOrder: diff2.any
        }, {
          name: "z-index",
          type: t4.number,
          triggersZOrder: diff2.any
        }];
        var overlay = [{
          name: "overlay-padding",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "overlay-color",
          type: t4.color
        }, {
          name: "overlay-opacity",
          type: t4.zeroOneNumber,
          triggersBounds: diff2.zeroNonZero
        }, {
          name: "overlay-shape",
          type: t4.overlayShape,
          triggersBounds: diff2.any
        }, {
          name: "overlay-corner-radius",
          type: t4.cornerRadius
        }];
        var underlay = [{
          name: "underlay-padding",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "underlay-color",
          type: t4.color
        }, {
          name: "underlay-opacity",
          type: t4.zeroOneNumber,
          triggersBounds: diff2.zeroNonZero
        }, {
          name: "underlay-shape",
          type: t4.overlayShape,
          triggersBounds: diff2.any
        }, {
          name: "underlay-corner-radius",
          type: t4.cornerRadius
        }];
        var transition2 = [{
          name: "transition-property",
          type: t4.propList
        }, {
          name: "transition-duration",
          type: t4.time
        }, {
          name: "transition-delay",
          type: t4.time
        }, {
          name: "transition-timing-function",
          type: t4.easing
        }];
        var nodeSizeHashOverride = /* @__PURE__ */ __name(function nodeSizeHashOverride2(ele, parsedProp) {
          if (parsedProp.value === "label") {
            return -ele.poolIndex();
          } else {
            return parsedProp.pfValue;
          }
        }, "nodeSizeHashOverride");
        var nodeBody = [{
          name: "height",
          type: t4.nodeSize,
          triggersBounds: diff2.any,
          hashOverride: nodeSizeHashOverride
        }, {
          name: "width",
          type: t4.nodeSize,
          triggersBounds: diff2.any,
          hashOverride: nodeSizeHashOverride
        }, {
          name: "shape",
          type: t4.nodeShape,
          triggersBounds: diff2.any
        }, {
          name: "shape-polygon-points",
          type: t4.polygonPointList,
          triggersBounds: diff2.any
        }, {
          name: "corner-radius",
          type: t4.cornerRadius
        }, {
          name: "background-color",
          type: t4.color
        }, {
          name: "background-fill",
          type: t4.fill
        }, {
          name: "background-opacity",
          type: t4.zeroOneNumber
        }, {
          name: "background-blacken",
          type: t4.nOneOneNumber
        }, {
          name: "background-gradient-stop-colors",
          type: t4.colors
        }, {
          name: "background-gradient-stop-positions",
          type: t4.percentages
        }, {
          name: "background-gradient-direction",
          type: t4.gradientDirection
        }, {
          name: "padding",
          type: t4.sizeMaybePercent,
          triggersBounds: diff2.any
        }, {
          name: "padding-relative-to",
          type: t4.paddingRelativeTo,
          triggersBounds: diff2.any
        }, {
          name: "bounds-expansion",
          type: t4.boundsExpansion,
          triggersBounds: diff2.any
        }];
        var nodeBorder = [{
          name: "border-color",
          type: t4.color
        }, {
          name: "border-opacity",
          type: t4.zeroOneNumber
        }, {
          name: "border-width",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "border-style",
          type: t4.borderStyle
        }, {
          name: "border-cap",
          type: t4.lineCap
        }, {
          name: "border-join",
          type: t4.lineJoin
        }, {
          name: "border-dash-pattern",
          type: t4.numbers
        }, {
          name: "border-dash-offset",
          type: t4.number
        }, {
          name: "border-position",
          type: t4.linePosition
        }];
        var nodeOutline = [{
          name: "outline-color",
          type: t4.color
        }, {
          name: "outline-opacity",
          type: t4.zeroOneNumber
        }, {
          name: "outline-width",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "outline-style",
          type: t4.borderStyle
        }, {
          name: "outline-offset",
          type: t4.size,
          triggersBounds: diff2.any
        }];
        var backgroundImage = [{
          name: "background-image",
          type: t4.urls
        }, {
          name: "background-image-crossorigin",
          type: t4.bgCrossOrigin
        }, {
          name: "background-image-opacity",
          type: t4.zeroOneNumbers
        }, {
          name: "background-image-containment",
          type: t4.bgContainment
        }, {
          name: "background-image-smoothing",
          type: t4.bools
        }, {
          name: "background-position-x",
          type: t4.bgPos
        }, {
          name: "background-position-y",
          type: t4.bgPos
        }, {
          name: "background-width-relative-to",
          type: t4.bgRelativeTo
        }, {
          name: "background-height-relative-to",
          type: t4.bgRelativeTo
        }, {
          name: "background-repeat",
          type: t4.bgRepeat
        }, {
          name: "background-fit",
          type: t4.bgFit
        }, {
          name: "background-clip",
          type: t4.bgClip
        }, {
          name: "background-width",
          type: t4.bgWH
        }, {
          name: "background-height",
          type: t4.bgWH
        }, {
          name: "background-offset-x",
          type: t4.bgPos
        }, {
          name: "background-offset-y",
          type: t4.bgPos
        }];
        var compound = [{
          name: "position",
          type: t4.position,
          triggersBounds: diff2.any
        }, {
          name: "compound-sizing-wrt-labels",
          type: t4.compoundIncludeLabels,
          triggersBounds: diff2.any
        }, {
          name: "min-width",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "min-width-bias-left",
          type: t4.sizeMaybePercent,
          triggersBounds: diff2.any
        }, {
          name: "min-width-bias-right",
          type: t4.sizeMaybePercent,
          triggersBounds: diff2.any
        }, {
          name: "min-height",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "min-height-bias-top",
          type: t4.sizeMaybePercent,
          triggersBounds: diff2.any
        }, {
          name: "min-height-bias-bottom",
          type: t4.sizeMaybePercent,
          triggersBounds: diff2.any
        }];
        var edgeLine = [{
          name: "line-style",
          type: t4.lineStyle
        }, {
          name: "line-color",
          type: t4.color
        }, {
          name: "line-fill",
          type: t4.fill
        }, {
          name: "line-cap",
          type: t4.lineCap
        }, {
          name: "line-opacity",
          type: t4.zeroOneNumber
        }, {
          name: "line-dash-pattern",
          type: t4.numbers
        }, {
          name: "line-dash-offset",
          type: t4.number
        }, {
          name: "line-outline-width",
          type: t4.size
        }, {
          name: "line-outline-color",
          type: t4.color
        }, {
          name: "line-gradient-stop-colors",
          type: t4.colors
        }, {
          name: "line-gradient-stop-positions",
          type: t4.percentages
        }, {
          name: "curve-style",
          type: t4.curveStyle,
          triggersBounds: diff2.any,
          triggersBoundsOfParallelEdges: /* @__PURE__ */ __name(function triggersBoundsOfParallelEdges(fromValue, toValue) {
            if (fromValue === toValue) {
              return false;
            }
            return fromValue === "bezier" || // remove from bundle
            toValue === "bezier";
          }, "triggersBoundsOfParallelEdges")
        }, {
          name: "haystack-radius",
          type: t4.zeroOneNumber,
          triggersBounds: diff2.any
        }, {
          name: "source-endpoint",
          type: t4.edgeEndpoint,
          triggersBounds: diff2.any
        }, {
          name: "target-endpoint",
          type: t4.edgeEndpoint,
          triggersBounds: diff2.any
        }, {
          name: "control-point-step-size",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "control-point-distances",
          type: t4.bidirectionalSizes,
          triggersBounds: diff2.any
        }, {
          name: "control-point-weights",
          type: t4.numbers,
          triggersBounds: diff2.any
        }, {
          name: "segment-distances",
          type: t4.bidirectionalSizes,
          triggersBounds: diff2.any
        }, {
          name: "segment-weights",
          type: t4.numbers,
          triggersBounds: diff2.any
        }, {
          name: "segment-radii",
          type: t4.numbers,
          triggersBounds: diff2.any
        }, {
          name: "radius-type",
          type: t4.radiusType,
          triggersBounds: diff2.any
        }, {
          name: "taxi-turn",
          type: t4.bidirectionalSizeMaybePercent,
          triggersBounds: diff2.any
        }, {
          name: "taxi-turn-min-distance",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "taxi-direction",
          type: t4.axisDirection,
          triggersBounds: diff2.any
        }, {
          name: "taxi-radius",
          type: t4.number,
          triggersBounds: diff2.any
        }, {
          name: "edge-distances",
          type: t4.edgeDistances,
          triggersBounds: diff2.any
        }, {
          name: "arrow-scale",
          type: t4.positiveNumber,
          triggersBounds: diff2.any
        }, {
          name: "loop-direction",
          type: t4.angle,
          triggersBounds: diff2.any
        }, {
          name: "loop-sweep",
          type: t4.angle,
          triggersBounds: diff2.any
        }, {
          name: "source-distance-from-node",
          type: t4.size,
          triggersBounds: diff2.any
        }, {
          name: "target-distance-from-node",
          type: t4.size,
          triggersBounds: diff2.any
        }];
        var ghost = [{
          name: "ghost",
          type: t4.bool,
          triggersBounds: diff2.any
        }, {
          name: "ghost-offset-x",
          type: t4.bidirectionalSize,
          triggersBounds: diff2.any
        }, {
          name: "ghost-offset-y",
          type: t4.bidirectionalSize,
          triggersBounds: diff2.any
        }, {
          name: "ghost-opacity",
          type: t4.zeroOneNumber
        }];
        var core4 = [{
          name: "selection-box-color",
          type: t4.color
        }, {
          name: "selection-box-opacity",
          type: t4.zeroOneNumber
        }, {
          name: "selection-box-border-color",
          type: t4.color
        }, {
          name: "selection-box-border-width",
          type: t4.size
        }, {
          name: "active-bg-color",
          type: t4.color
        }, {
          name: "active-bg-opacity",
          type: t4.zeroOneNumber
        }, {
          name: "active-bg-size",
          type: t4.size
        }, {
          name: "outside-texture-bg-color",
          type: t4.color
        }, {
          name: "outside-texture-bg-opacity",
          type: t4.zeroOneNumber
        }];
        var pie2 = [];
        styfn$2.pieBackgroundN = 16;
        pie2.push({
          name: "pie-size",
          type: t4.sizeMaybePercent
        });
        pie2.push({
          name: "pie-hole",
          type: t4.sizeMaybePercent
        });
        pie2.push({
          name: "pie-start-angle",
          type: t4.angle
        });
        for (var i2 = 1; i2 <= styfn$2.pieBackgroundN; i2++) {
          pie2.push({
            name: "pie-" + i2 + "-background-color",
            type: t4.color
          });
          pie2.push({
            name: "pie-" + i2 + "-background-size",
            type: t4.percent
          });
          pie2.push({
            name: "pie-" + i2 + "-background-opacity",
            type: t4.zeroOneNumber
          });
        }
        var stripe = [];
        styfn$2.stripeBackgroundN = 16;
        stripe.push({
          name: "stripe-size",
          type: t4.sizeMaybePercent
        });
        stripe.push({
          name: "stripe-direction",
          type: t4.axisDirectionPrimary
        });
        for (var _i = 1; _i <= styfn$2.stripeBackgroundN; _i++) {
          stripe.push({
            name: "stripe-" + _i + "-background-color",
            type: t4.color
          });
          stripe.push({
            name: "stripe-" + _i + "-background-size",
            type: t4.percent
          });
          stripe.push({
            name: "stripe-" + _i + "-background-opacity",
            type: t4.zeroOneNumber
          });
        }
        var edgeArrow = [];
        var arrowPrefixes = styfn$2.arrowPrefixes = ["source", "mid-source", "target", "mid-target"];
        [{
          name: "arrow-shape",
          type: t4.arrowShape,
          triggersBounds: diff2.any
        }, {
          name: "arrow-color",
          type: t4.color
        }, {
          name: "arrow-fill",
          type: t4.arrowFill
        }, {
          name: "arrow-width",
          type: t4.arrowWidth
        }].forEach(function(prop2) {
          arrowPrefixes.forEach(function(prefix) {
            var name = prefix + "-" + prop2.name;
            var type3 = prop2.type, triggersBounds = prop2.triggersBounds;
            edgeArrow.push({
              name,
              type: type3,
              triggersBounds
            });
          });
        }, {});
        var props = styfn$2.properties = [].concat(behavior, transition2, visibility, overlay, underlay, ghost, commonLabel, labelDimensions, mainLabel, sourceLabel, targetLabel, nodeBody, nodeBorder, nodeOutline, backgroundImage, pie2, stripe, compound, edgeLine, edgeArrow, core4);
        var propGroups = styfn$2.propertyGroups = {
          // common to all eles
          behavior,
          transition: transition2,
          visibility,
          overlay,
          underlay,
          ghost,
          // labels
          commonLabel,
          labelDimensions,
          mainLabel,
          sourceLabel,
          targetLabel,
          // node props
          nodeBody,
          nodeBorder,
          nodeOutline,
          backgroundImage,
          pie: pie2,
          stripe,
          compound,
          // edge props
          edgeLine,
          edgeArrow,
          core: core4
        };
        var propGroupNames = styfn$2.propertyGroupNames = {};
        var propGroupKeys = styfn$2.propertyGroupKeys = Object.keys(propGroups);
        propGroupKeys.forEach(function(key) {
          propGroupNames[key] = propGroups[key].map(function(prop2) {
            return prop2.name;
          });
          propGroups[key].forEach(function(prop2) {
            return prop2.groupKey = key;
          });
        });
        var aliases = styfn$2.aliases = [{
          name: "content",
          pointsTo: "label"
        }, {
          name: "control-point-distance",
          pointsTo: "control-point-distances"
        }, {
          name: "control-point-weight",
          pointsTo: "control-point-weights"
        }, {
          name: "segment-distance",
          pointsTo: "segment-distances"
        }, {
          name: "segment-weight",
          pointsTo: "segment-weights"
        }, {
          name: "segment-radius",
          pointsTo: "segment-radii"
        }, {
          name: "edge-text-rotation",
          pointsTo: "text-rotation"
        }, {
          name: "padding-left",
          pointsTo: "padding"
        }, {
          name: "padding-right",
          pointsTo: "padding"
        }, {
          name: "padding-top",
          pointsTo: "padding"
        }, {
          name: "padding-bottom",
          pointsTo: "padding"
        }];
        styfn$2.propertyNames = props.map(function(p3) {
          return p3.name;
        });
        for (var _i2 = 0; _i2 < props.length; _i2++) {
          var prop = props[_i2];
          props[prop.name] = prop;
        }
        for (var _i3 = 0; _i3 < aliases.length; _i3++) {
          var alias = aliases[_i3];
          var pointsToProp = props[alias.pointsTo];
          var aliasProp = {
            name: alias.name,
            alias: true,
            pointsTo: pointsToProp
          };
          props.push(aliasProp);
          props[alias.name] = aliasProp;
        }
      })();
      styfn$2.getDefaultProperty = function(name) {
        return this.getDefaultProperties()[name];
      };
      styfn$2.getDefaultProperties = function() {
        var _p = this._private;
        if (_p.defaultProperties != null) {
          return _p.defaultProperties;
        }
        var rawProps = extend4({
          // core props
          "selection-box-color": "#ddd",
          "selection-box-opacity": 0.65,
          "selection-box-border-color": "#aaa",
          "selection-box-border-width": 1,
          "active-bg-color": "black",
          "active-bg-opacity": 0.15,
          "active-bg-size": 30,
          "outside-texture-bg-color": "#000",
          "outside-texture-bg-opacity": 0.125,
          // common node/edge props
          "events": "yes",
          "text-events": "no",
          "text-valign": "top",
          "text-halign": "center",
          "text-justification": "auto",
          "line-height": 1,
          "color": "#000",
          "box-selection": "contain",
          "text-outline-color": "#000",
          "text-outline-width": 0,
          "text-outline-opacity": 1,
          "text-opacity": 1,
          "text-decoration": "none",
          "text-transform": "none",
          "text-wrap": "none",
          "text-overflow-wrap": "whitespace",
          "text-max-width": 9999,
          "text-background-color": "#000",
          "text-background-opacity": 0,
          "text-background-shape": "rectangle",
          "text-background-padding": 0,
          "text-border-opacity": 0,
          "text-border-width": 0,
          "text-border-style": "solid",
          "text-border-color": "#000",
          "font-family": "Helvetica Neue, Helvetica, sans-serif",
          "font-style": "normal",
          "font-weight": "normal",
          "font-size": 16,
          "min-zoomed-font-size": 0,
          "text-rotation": "none",
          "source-text-rotation": "none",
          "target-text-rotation": "none",
          "visibility": "visible",
          "display": "element",
          "opacity": 1,
          "z-compound-depth": "auto",
          "z-index-compare": "auto",
          "z-index": 0,
          "label": "",
          "text-margin-x": 0,
          "text-margin-y": 0,
          "source-label": "",
          "source-text-offset": 0,
          "source-text-margin-x": 0,
          "source-text-margin-y": 0,
          "target-label": "",
          "target-text-offset": 0,
          "target-text-margin-x": 0,
          "target-text-margin-y": 0,
          "overlay-opacity": 0,
          "overlay-color": "#000",
          "overlay-padding": 10,
          "overlay-shape": "round-rectangle",
          "overlay-corner-radius": "auto",
          "underlay-opacity": 0,
          "underlay-color": "#000",
          "underlay-padding": 10,
          "underlay-shape": "round-rectangle",
          "underlay-corner-radius": "auto",
          "transition-property": "none",
          "transition-duration": 0,
          "transition-delay": 0,
          "transition-timing-function": "linear",
          "box-select-labels": "no",
          // node props
          "background-blacken": 0,
          "background-color": "#999",
          "background-fill": "solid",
          "background-opacity": 1,
          "background-image": "none",
          "background-image-crossorigin": "anonymous",
          "background-image-opacity": 1,
          "background-image-containment": "inside",
          "background-image-smoothing": "yes",
          "background-position-x": "50%",
          "background-position-y": "50%",
          "background-offset-x": 0,
          "background-offset-y": 0,
          "background-width-relative-to": "include-padding",
          "background-height-relative-to": "include-padding",
          "background-repeat": "no-repeat",
          "background-fit": "none",
          "background-clip": "node",
          "background-width": "auto",
          "background-height": "auto",
          "border-color": "#000",
          "border-opacity": 1,
          "border-width": 0,
          "border-style": "solid",
          "border-dash-pattern": [4, 2],
          "border-dash-offset": 0,
          "border-cap": "butt",
          "border-join": "miter",
          "border-position": "center",
          "outline-color": "#999",
          "outline-opacity": 1,
          "outline-width": 0,
          "outline-offset": 0,
          "outline-style": "solid",
          "height": 30,
          "width": 30,
          "shape": "ellipse",
          "shape-polygon-points": "-1, -1,   1, -1,   1, 1,   -1, 1",
          "corner-radius": "auto",
          "bounds-expansion": 0,
          // node gradient
          "background-gradient-direction": "to-bottom",
          "background-gradient-stop-colors": "#999",
          "background-gradient-stop-positions": "0%",
          // ghost props
          "ghost": "no",
          "ghost-offset-y": 0,
          "ghost-offset-x": 0,
          "ghost-opacity": 0,
          // compound props
          "padding": 0,
          "padding-relative-to": "width",
          "position": "origin",
          "compound-sizing-wrt-labels": "include",
          "min-width": 0,
          "min-width-bias-left": 0,
          "min-width-bias-right": 0,
          "min-height": 0,
          "min-height-bias-top": 0,
          "min-height-bias-bottom": 0
        }, {
          // node pie bg
          "pie-size": "100%",
          "pie-hole": 0,
          "pie-start-angle": "0deg"
        }, [{
          name: "pie-{{i}}-background-color",
          value: "black"
        }, {
          name: "pie-{{i}}-background-size",
          value: "0%"
        }, {
          name: "pie-{{i}}-background-opacity",
          value: 1
        }].reduce(function(css, prop2) {
          for (var i3 = 1; i3 <= styfn$2.pieBackgroundN; i3++) {
            var name2 = prop2.name.replace("{{i}}", i3);
            var val2 = prop2.value;
            css[name2] = val2;
          }
          return css;
        }, {}), {
          // node stripes bg
          "stripe-size": "100%",
          "stripe-direction": "horizontal"
        }, [{
          name: "stripe-{{i}}-background-color",
          value: "black"
        }, {
          name: "stripe-{{i}}-background-size",
          value: "0%"
        }, {
          name: "stripe-{{i}}-background-opacity",
          value: 1
        }].reduce(function(css, prop2) {
          for (var i3 = 1; i3 <= styfn$2.stripeBackgroundN; i3++) {
            var name2 = prop2.name.replace("{{i}}", i3);
            var val2 = prop2.value;
            css[name2] = val2;
          }
          return css;
        }, {}), {
          // edge props
          "line-style": "solid",
          "line-color": "#999",
          "line-fill": "solid",
          "line-cap": "butt",
          "line-opacity": 1,
          "line-outline-width": 0,
          "line-outline-color": "#000",
          "line-gradient-stop-colors": "#999",
          "line-gradient-stop-positions": "0%",
          "control-point-step-size": 40,
          "control-point-weights": 0.5,
          "segment-weights": 0.5,
          "segment-distances": 20,
          "segment-radii": 15,
          "radius-type": "arc-radius",
          "taxi-turn": "50%",
          "taxi-radius": 15,
          "taxi-turn-min-distance": 10,
          "taxi-direction": "auto",
          "edge-distances": "intersection",
          "curve-style": "haystack",
          "haystack-radius": 0,
          "arrow-scale": 1,
          "loop-direction": "-45deg",
          "loop-sweep": "-90deg",
          "source-distance-from-node": 0,
          "target-distance-from-node": 0,
          "source-endpoint": "outside-to-node",
          "target-endpoint": "outside-to-node",
          "line-dash-pattern": [6, 3],
          "line-dash-offset": 0
        }, [{
          name: "arrow-shape",
          value: "none"
        }, {
          name: "arrow-color",
          value: "#999"
        }, {
          name: "arrow-fill",
          value: "filled"
        }, {
          name: "arrow-width",
          value: 1
        }].reduce(function(css, prop2) {
          styfn$2.arrowPrefixes.forEach(function(prefix) {
            var name2 = prefix + "-" + prop2.name;
            var val2 = prop2.value;
            css[name2] = val2;
          });
          return css;
        }, {}));
        var parsedProps = {};
        for (var i2 = 0; i2 < this.properties.length; i2++) {
          var prop = this.properties[i2];
          if (prop.pointsTo) {
            continue;
          }
          var name = prop.name;
          var val = rawProps[name];
          var parsedProp = this.parse(name, val);
          parsedProps[name] = parsedProp;
        }
        _p.defaultProperties = parsedProps;
        return _p.defaultProperties;
      };
      styfn$2.addDefaultStylesheet = function() {
        this.selector(":parent").css({
          "shape": "rectangle",
          "padding": 10,
          "background-color": "#eee",
          "border-color": "#ccc",
          "border-width": 1
        }).selector("edge").css({
          "width": 3
        }).selector(":loop").css({
          "curve-style": "bezier"
        }).selector("edge:compound").css({
          "curve-style": "bezier",
          "source-endpoint": "outside-to-line",
          "target-endpoint": "outside-to-line"
        }).selector(":selected").css({
          "background-color": "#0169D9",
          "line-color": "#0169D9",
          "source-arrow-color": "#0169D9",
          "target-arrow-color": "#0169D9",
          "mid-source-arrow-color": "#0169D9",
          "mid-target-arrow-color": "#0169D9"
        }).selector(":parent:selected").css({
          "background-color": "#CCE1F9",
          "border-color": "#aec8e5"
        }).selector(":active").css({
          "overlay-color": "black",
          "overlay-padding": 10,
          "overlay-opacity": 0.25
        });
        this.defaultLength = this.length;
      };
      styfn$1 = {};
      styfn$1.parse = function(name, value2, propIsBypass, propIsFlat) {
        var self2 = this;
        if (fn$6(value2)) {
          return self2.parseImplWarn(name, value2, propIsBypass, propIsFlat);
        }
        var flatKey = propIsFlat === "mapping" || propIsFlat === true || propIsFlat === false || propIsFlat == null ? "dontcare" : propIsFlat;
        var bypassKey = propIsBypass ? "t" : "f";
        var valueKey = "" + value2;
        var argHash = hashStrings(name, valueKey, bypassKey, flatKey);
        var propCache = self2.propCache = self2.propCache || [];
        var ret;
        if (!(ret = propCache[argHash])) {
          ret = propCache[argHash] = self2.parseImplWarn(name, value2, propIsBypass, propIsFlat);
        }
        if (propIsBypass || propIsFlat === "mapping") {
          ret = copy3(ret);
          if (ret) {
            ret.value = copy3(ret.value);
          }
        }
        return ret;
      };
      styfn$1.parseImplWarn = function(name, value2, propIsBypass, propIsFlat) {
        var prop = this.parseImpl(name, value2, propIsBypass, propIsFlat);
        if (!prop && value2 != null) {
          warn("The style property `".concat(name, ": ").concat(value2, "` is invalid"));
        }
        if (prop && (prop.name === "width" || prop.name === "height") && value2 === "label") {
          warn("The style value of `label` is deprecated for `" + prop.name + "`");
        }
        return prop;
      };
      styfn$1.parseImpl = function(name, value2, propIsBypass, propIsFlat) {
        var self2 = this;
        name = camel2dash(name);
        var property2 = self2.properties[name];
        var passedValue = value2;
        var types = self2.types;
        if (!property2) {
          return null;
        }
        if (value2 === void 0) {
          return null;
        }
        if (property2.alias) {
          property2 = property2.pointsTo;
          name = property2.name;
        }
        var valueIsString = string(value2);
        if (valueIsString) {
          value2 = value2.trim();
        }
        var type3 = property2.type;
        if (!type3) {
          return null;
        }
        if (propIsBypass && (value2 === "" || value2 === null)) {
          return {
            name,
            value: value2,
            bypass: true,
            deleteBypass: true
          };
        }
        if (fn$6(value2)) {
          return {
            name,
            value: value2,
            strValue: "fn",
            mapped: types.fn,
            bypass: propIsBypass
          };
        }
        var data5, mapData;
        if (!valueIsString || propIsFlat || value2.length < 7 || value2[1] !== "a") ;
        else if (value2.length >= 7 && value2[0] === "d" && (data5 = new RegExp(types.data.regex).exec(value2))) {
          if (propIsBypass) {
            return false;
          }
          var mapped = types.data;
          return {
            name,
            value: data5,
            strValue: "" + value2,
            mapped,
            field: data5[1],
            bypass: propIsBypass
          };
        } else if (value2.length >= 10 && value2[0] === "m" && (mapData = new RegExp(types.mapData.regex).exec(value2))) {
          if (propIsBypass) {
            return false;
          }
          if (type3.multiple) {
            return false;
          }
          var _mapped = types.mapData;
          if (!(type3.color || type3.number)) {
            return false;
          }
          var valueMin = this.parse(name, mapData[4]);
          if (!valueMin || valueMin.mapped) {
            return false;
          }
          var valueMax = this.parse(name, mapData[5]);
          if (!valueMax || valueMax.mapped) {
            return false;
          }
          if (valueMin.pfValue === valueMax.pfValue || valueMin.strValue === valueMax.strValue) {
            warn("`" + name + ": " + value2 + "` is not a valid mapper because the output range is zero; converting to `" + name + ": " + valueMin.strValue + "`");
            return this.parse(name, valueMin.strValue);
          } else if (type3.color) {
            var c1 = valueMin.value;
            var c22 = valueMax.value;
            var same2 = c1[0] === c22[0] && c1[1] === c22[1] && c1[2] === c22[2] && // optional alpha
            (c1[3] === c22[3] || (c1[3] == null || c1[3] === 1) && (c22[3] == null || c22[3] === 1));
            if (same2) {
              return false;
            }
          }
          return {
            name,
            value: mapData,
            strValue: "" + value2,
            mapped: _mapped,
            field: mapData[1],
            fieldMin: parseFloat(mapData[2]),
            // min & max are numeric
            fieldMax: parseFloat(mapData[3]),
            valueMin: valueMin.value,
            valueMax: valueMax.value,
            bypass: propIsBypass
          };
        }
        if (type3.multiple && propIsFlat !== "multiple") {
          var vals;
          if (valueIsString) {
            vals = value2.split(/\s+/);
          } else if (array2(value2)) {
            vals = value2;
          } else {
            vals = [value2];
          }
          if (type3.evenMultiple && vals.length % 2 !== 0) {
            return null;
          }
          var valArr = [];
          var unitsArr = [];
          var pfValArr = [];
          var strVal = "";
          var hasEnum = false;
          for (var i2 = 0; i2 < vals.length; i2++) {
            var p3 = self2.parse(name, vals[i2], propIsBypass, "multiple");
            hasEnum = hasEnum || string(p3.value);
            valArr.push(p3.value);
            pfValArr.push(p3.pfValue != null ? p3.pfValue : p3.value);
            unitsArr.push(p3.units);
            strVal += (i2 > 0 ? " " : "") + p3.strValue;
          }
          if (type3.validate && !type3.validate(valArr, unitsArr)) {
            return null;
          }
          if (type3.singleEnum && hasEnum) {
            if (valArr.length === 1 && string(valArr[0])) {
              return {
                name,
                value: valArr[0],
                strValue: valArr[0],
                bypass: propIsBypass
              };
            } else {
              return null;
            }
          }
          return {
            name,
            value: valArr,
            pfValue: pfValArr,
            strValue: strVal,
            bypass: propIsBypass,
            units: unitsArr
          };
        }
        var checkEnums = /* @__PURE__ */ __name(function checkEnums2() {
          for (var _i = 0; _i < type3.enums.length; _i++) {
            var en = type3.enums[_i];
            if (en === value2) {
              return {
                name,
                value: value2,
                strValue: "" + value2,
                bypass: propIsBypass
              };
            }
          }
          return null;
        }, "checkEnums");
        if (type3.number) {
          var units;
          var implicitUnits = "px";
          if (type3.units) {
            units = type3.units;
          }
          if (type3.implicitUnits) {
            implicitUnits = type3.implicitUnits;
          }
          if (!type3.unitless) {
            if (valueIsString) {
              var unitsRegex = "px|em" + (type3.allowPercent ? "|\\%" : "");
              if (units) {
                unitsRegex = units;
              }
              var match2 = value2.match("^(" + number6 + ")(" + unitsRegex + ")?$");
              if (match2) {
                value2 = match2[1];
                units = match2[2] || implicitUnits;
              }
            } else if (!units || type3.implicitUnits) {
              units = implicitUnits;
            }
          }
          value2 = parseFloat(value2);
          if (isNaN(value2) && type3.enums === void 0) {
            return null;
          }
          if (isNaN(value2) && type3.enums !== void 0) {
            value2 = passedValue;
            return checkEnums();
          }
          if (type3.integer && !integer(value2)) {
            return null;
          }
          if (type3.min !== void 0 && (value2 < type3.min || type3.strictMin && value2 === type3.min) || type3.max !== void 0 && (value2 > type3.max || type3.strictMax && value2 === type3.max)) {
            return null;
          }
          var ret = {
            name,
            value: value2,
            strValue: "" + value2 + (units ? units : ""),
            units,
            bypass: propIsBypass
          };
          if (type3.unitless || units !== "px" && units !== "em") {
            ret.pfValue = value2;
          } else {
            ret.pfValue = units === "px" || !units ? value2 : this.getEmSizeInPixels() * value2;
          }
          if (units === "ms" || units === "s") {
            ret.pfValue = units === "ms" ? value2 : 1e3 * value2;
          }
          if (units === "deg" || units === "rad") {
            ret.pfValue = units === "rad" ? value2 : deg2rad(value2);
          }
          if (units === "%") {
            ret.pfValue = value2 / 100;
          }
          return ret;
        } else if (type3.propList) {
          var props = [];
          var propsStr = "" + value2;
          if (propsStr === "none") ;
          else {
            var propsSplit = propsStr.split(/\s*,\s*|\s+/);
            for (var _i2 = 0; _i2 < propsSplit.length; _i2++) {
              var propName = propsSplit[_i2].trim();
              if (self2.properties[propName]) {
                props.push(propName);
              } else {
                warn("`" + propName + "` is not a valid property name");
              }
            }
            if (props.length === 0) {
              return null;
            }
          }
          return {
            name,
            value: props,
            strValue: props.length === 0 ? "none" : props.join(" "),
            bypass: propIsBypass
          };
        } else if (type3.color) {
          var tuple = color2tuple(value2);
          if (!tuple) {
            return null;
          }
          return {
            name,
            value: tuple,
            pfValue: tuple,
            strValue: "rgb(" + tuple[0] + "," + tuple[1] + "," + tuple[2] + ")",
            // n.b. no spaces b/c of multiple support
            bypass: propIsBypass
          };
        } else if (type3.regex || type3.regexes) {
          if (type3.enums) {
            var enumProp = checkEnums();
            if (enumProp) {
              return enumProp;
            }
          }
          var regexes = type3.regexes ? type3.regexes : [type3.regex];
          for (var _i3 = 0; _i3 < regexes.length; _i3++) {
            var regex2 = new RegExp(regexes[_i3]);
            var m3 = regex2.exec(value2);
            if (m3) {
              return {
                name,
                value: type3.singleRegexMatchValue ? m3[1] : m3,
                strValue: "" + value2,
                bypass: propIsBypass
              };
            }
          }
          return null;
        } else if (type3.string) {
          return {
            name,
            value: "" + value2,
            strValue: "" + value2,
            bypass: propIsBypass
          };
        } else if (type3.enums) {
          return checkEnums();
        } else {
          return null;
        }
      };
      _Style = /* @__PURE__ */ __name(function Style2(cy) {
        if (!(this instanceof _Style)) {
          return new _Style(cy);
        }
        if (!core2(cy)) {
          error("A style must have a core reference");
          return;
        }
        this._private = {
          cy,
          coreStyle: {}
        };
        this.length = 0;
        this.resetToDefault();
      }, "Style");
      styfn = _Style.prototype;
      styfn.instanceString = function() {
        return "style";
      };
      styfn.clear = function() {
        var _p = this._private;
        var cy = _p.cy;
        var eles = cy.elements();
        for (var i2 = 0; i2 < this.length; i2++) {
          this[i2] = void 0;
        }
        this.length = 0;
        _p.contextStyles = {};
        _p.propDiffs = {};
        this.cleanElements(eles, true);
        eles.forEach(function(ele) {
          var ele_p = ele[0]._private;
          ele_p.styleDirty = true;
          ele_p.appliedInitStyle = false;
        });
        return this;
      };
      styfn.resetToDefault = function() {
        this.clear();
        this.addDefaultStylesheet();
        return this;
      };
      styfn.core = function(propName) {
        return this._private.coreStyle[propName] || this.getDefaultProperty(propName);
      };
      styfn.selector = function(selectorStr) {
        var selector = selectorStr === "core" ? null : new Selector(selectorStr);
        var i2 = this.length++;
        this[i2] = {
          selector,
          properties: [],
          mappedProperties: [],
          index: i2
        };
        return this;
      };
      styfn.css = function() {
        var self2 = this;
        var args = arguments;
        if (args.length === 1) {
          var map5 = args[0];
          for (var i2 = 0; i2 < self2.properties.length; i2++) {
            var prop = self2.properties[i2];
            var mapVal = map5[prop.name];
            if (mapVal === void 0) {
              mapVal = map5[dash2camel(prop.name)];
            }
            if (mapVal !== void 0) {
              this.cssRule(prop.name, mapVal);
            }
          }
        } else if (args.length === 2) {
          this.cssRule(args[0], args[1]);
        }
        return this;
      };
      styfn.style = styfn.css;
      styfn.cssRule = function(name, value2) {
        var property2 = this.parse(name, value2);
        if (property2) {
          var i2 = this.length - 1;
          this[i2].properties.push(property2);
          this[i2].properties[property2.name] = property2;
          if (property2.name.match(/pie-(\d+)-background-size/) && property2.value) {
            this._private.hasPie = true;
          }
          if (property2.name.match(/stripe-(\d+)-background-size/) && property2.value) {
            this._private.hasStripe = true;
          }
          if (property2.mapped) {
            this[i2].mappedProperties.push(property2);
          }
          var currentSelectorIsCore = !this[i2].selector;
          if (currentSelectorIsCore) {
            this._private.coreStyle[property2.name] = property2;
          }
        }
        return this;
      };
      styfn.append = function(style3) {
        if (stylesheet(style3)) {
          style3.appendToStyle(this);
        } else if (array2(style3)) {
          this.appendFromJson(style3);
        } else if (string(style3)) {
          this.appendFromString(style3);
        }
        return this;
      };
      _Style.fromJson = function(cy, json3) {
        var style3 = new _Style(cy);
        style3.fromJson(json3);
        return style3;
      };
      _Style.fromString = function(cy, string3) {
        return new _Style(cy).fromString(string3);
      };
      [styfn$8, styfn$7, styfn$6, styfn$5, styfn$4, styfn$3, styfn$2, styfn$1].forEach(function(props) {
        extend4(styfn, props);
      });
      _Style.types = styfn.types;
      _Style.properties = styfn.properties;
      _Style.propertyGroups = styfn.propertyGroups;
      _Style.propertyGroupNames = styfn.propertyGroupNames;
      _Style.propertyGroupKeys = styfn.propertyGroupKeys;
      corefn$2 = {
        style: /* @__PURE__ */ __name(function style2(newStyle) {
          if (newStyle) {
            var s2 = this.setStyle(newStyle);
            s2.update();
          }
          return this._private.style;
        }, "style"),
        setStyle: /* @__PURE__ */ __name(function setStyle(style3) {
          var _p = this._private;
          if (stylesheet(style3)) {
            _p.style = style3.generateStyle(this);
          } else if (array2(style3)) {
            _p.style = _Style.fromJson(this, style3);
          } else if (string(style3)) {
            _p.style = _Style.fromString(this, style3);
          } else {
            _p.style = _Style(this);
          }
          return _p.style;
        }, "setStyle"),
        // e.g. cy.data() changed => recalc ele mappers
        updateStyle: /* @__PURE__ */ __name(function updateStyle2() {
          this.mutableElements().updateStyle();
        }, "updateStyle")
      };
      defaultSelectionType = "single";
      corefn$1 = {
        autolock: /* @__PURE__ */ __name(function autolock(bool2) {
          if (bool2 !== void 0) {
            this._private.autolock = bool2 ? true : false;
          } else {
            return this._private.autolock;
          }
          return this;
        }, "autolock"),
        autoungrabify: /* @__PURE__ */ __name(function autoungrabify(bool2) {
          if (bool2 !== void 0) {
            this._private.autoungrabify = bool2 ? true : false;
          } else {
            return this._private.autoungrabify;
          }
          return this;
        }, "autoungrabify"),
        autounselectify: /* @__PURE__ */ __name(function autounselectify(bool2) {
          if (bool2 !== void 0) {
            this._private.autounselectify = bool2 ? true : false;
          } else {
            return this._private.autounselectify;
          }
          return this;
        }, "autounselectify"),
        selectionType: /* @__PURE__ */ __name(function selectionType(selType) {
          var _p = this._private;
          if (_p.selectionType == null) {
            _p.selectionType = defaultSelectionType;
          }
          if (selType !== void 0) {
            if (selType === "additive" || selType === "single") {
              _p.selectionType = selType;
            }
          } else {
            return _p.selectionType;
          }
          return this;
        }, "selectionType"),
        panningEnabled: /* @__PURE__ */ __name(function panningEnabled(bool2) {
          if (bool2 !== void 0) {
            this._private.panningEnabled = bool2 ? true : false;
          } else {
            return this._private.panningEnabled;
          }
          return this;
        }, "panningEnabled"),
        userPanningEnabled: /* @__PURE__ */ __name(function userPanningEnabled(bool2) {
          if (bool2 !== void 0) {
            this._private.userPanningEnabled = bool2 ? true : false;
          } else {
            return this._private.userPanningEnabled;
          }
          return this;
        }, "userPanningEnabled"),
        zoomingEnabled: /* @__PURE__ */ __name(function zoomingEnabled(bool2) {
          if (bool2 !== void 0) {
            this._private.zoomingEnabled = bool2 ? true : false;
          } else {
            return this._private.zoomingEnabled;
          }
          return this;
        }, "zoomingEnabled"),
        userZoomingEnabled: /* @__PURE__ */ __name(function userZoomingEnabled(bool2) {
          if (bool2 !== void 0) {
            this._private.userZoomingEnabled = bool2 ? true : false;
          } else {
            return this._private.userZoomingEnabled;
          }
          return this;
        }, "userZoomingEnabled"),
        boxSelectionEnabled: /* @__PURE__ */ __name(function boxSelectionEnabled(bool2) {
          if (bool2 !== void 0) {
            this._private.boxSelectionEnabled = bool2 ? true : false;
          } else {
            return this._private.boxSelectionEnabled;
          }
          return this;
        }, "boxSelectionEnabled"),
        pan: /* @__PURE__ */ __name(function pan() {
          var args = arguments;
          var pan2 = this._private.pan;
          var dim, val, dims, x5, y6;
          switch (args.length) {
            case 0:
              return pan2;
            case 1:
              if (string(args[0])) {
                dim = args[0];
                return pan2[dim];
              } else if (plainObject(args[0])) {
                if (!this._private.panningEnabled) {
                  return this;
                }
                dims = args[0];
                x5 = dims.x;
                y6 = dims.y;
                if (number$1(x5)) {
                  pan2.x = x5;
                }
                if (number$1(y6)) {
                  pan2.y = y6;
                }
                this.emit("pan viewport");
              }
              break;
            case 2:
              if (!this._private.panningEnabled) {
                return this;
              }
              dim = args[0];
              val = args[1];
              if ((dim === "x" || dim === "y") && number$1(val)) {
                pan2[dim] = val;
              }
              this.emit("pan viewport");
              break;
          }
          this.notify("viewport");
          return this;
        }, "pan"),
        panBy: /* @__PURE__ */ __name(function panBy(arg0, arg1) {
          var args = arguments;
          var pan2 = this._private.pan;
          var dim, val, dims, x5, y6;
          if (!this._private.panningEnabled) {
            return this;
          }
          switch (args.length) {
            case 1:
              if (plainObject(arg0)) {
                dims = args[0];
                x5 = dims.x;
                y6 = dims.y;
                if (number$1(x5)) {
                  pan2.x += x5;
                }
                if (number$1(y6)) {
                  pan2.y += y6;
                }
                this.emit("pan viewport");
              }
              break;
            case 2:
              dim = arg0;
              val = arg1;
              if ((dim === "x" || dim === "y") && number$1(val)) {
                pan2[dim] += val;
              }
              this.emit("pan viewport");
              break;
          }
          this.notify("viewport");
          return this;
        }, "panBy"),
        gc: /* @__PURE__ */ __name(function gc() {
          this.notify("gc");
        }, "gc"),
        fit: /* @__PURE__ */ __name(function fit(elements2, padding2) {
          var viewportState = this.getFitViewport(elements2, padding2);
          if (viewportState) {
            var _p = this._private;
            _p.zoom = viewportState.zoom;
            _p.pan = viewportState.pan;
            this.emit("pan zoom viewport");
            this.notify("viewport");
          }
          return this;
        }, "fit"),
        getFitViewport: /* @__PURE__ */ __name(function getFitViewport(elements2, padding2) {
          if (number$1(elements2) && padding2 === void 0) {
            padding2 = elements2;
            elements2 = void 0;
          }
          if (!this._private.panningEnabled || !this._private.zoomingEnabled) {
            return;
          }
          var bb;
          if (string(elements2)) {
            var sel = elements2;
            elements2 = this.$(sel);
          } else if (boundingBox(elements2)) {
            var bbe = elements2;
            bb = {
              x1: bbe.x1,
              y1: bbe.y1,
              x2: bbe.x2,
              y2: bbe.y2
            };
            bb.w = bb.x2 - bb.x1;
            bb.h = bb.y2 - bb.y1;
          } else if (!elementOrCollection(elements2)) {
            elements2 = this.mutableElements();
          }
          if (elementOrCollection(elements2) && elements2.empty()) {
            return;
          }
          bb = bb || elements2.boundingBox();
          var w4 = this.width();
          var h3 = this.height();
          var zoom2;
          padding2 = number$1(padding2) ? padding2 : 0;
          if (!isNaN(w4) && !isNaN(h3) && w4 > 0 && h3 > 0 && !isNaN(bb.w) && !isNaN(bb.h) && bb.w > 0 && bb.h > 0) {
            zoom2 = Math.min((w4 - 2 * padding2) / bb.w, (h3 - 2 * padding2) / bb.h);
            zoom2 = zoom2 > this._private.maxZoom ? this._private.maxZoom : zoom2;
            zoom2 = zoom2 < this._private.minZoom ? this._private.minZoom : zoom2;
            var pan2 = {
              // now pan to middle
              x: (w4 - zoom2 * (bb.x1 + bb.x2)) / 2,
              y: (h3 - zoom2 * (bb.y1 + bb.y2)) / 2
            };
            return {
              zoom: zoom2,
              pan: pan2
            };
          }
          return;
        }, "getFitViewport"),
        zoomRange: /* @__PURE__ */ __name(function zoomRange(min9, max10) {
          var _p = this._private;
          if (max10 == null) {
            var opts = min9;
            min9 = opts.min;
            max10 = opts.max;
          }
          if (number$1(min9) && number$1(max10) && min9 <= max10) {
            _p.minZoom = min9;
            _p.maxZoom = max10;
          } else if (number$1(min9) && max10 === void 0 && min9 <= _p.maxZoom) {
            _p.minZoom = min9;
          } else if (number$1(max10) && min9 === void 0 && max10 >= _p.minZoom) {
            _p.maxZoom = max10;
          }
          return this;
        }, "zoomRange"),
        minZoom: /* @__PURE__ */ __name(function minZoom(zoom2) {
          if (zoom2 === void 0) {
            return this._private.minZoom;
          } else {
            return this.zoomRange({
              min: zoom2
            });
          }
        }, "minZoom"),
        maxZoom: /* @__PURE__ */ __name(function maxZoom(zoom2) {
          if (zoom2 === void 0) {
            return this._private.maxZoom;
          } else {
            return this.zoomRange({
              max: zoom2
            });
          }
        }, "maxZoom"),
        getZoomedViewport: /* @__PURE__ */ __name(function getZoomedViewport(params) {
          var _p = this._private;
          var currentPan = _p.pan;
          var currentZoom = _p.zoom;
          var pos;
          var zoom2;
          var bail = false;
          if (!_p.zoomingEnabled) {
            bail = true;
          }
          if (number$1(params)) {
            zoom2 = params;
          } else if (plainObject(params)) {
            zoom2 = params.level;
            if (params.position != null) {
              pos = modelToRenderedPosition$1(params.position, currentZoom, currentPan);
            } else if (params.renderedPosition != null) {
              pos = params.renderedPosition;
            }
            if (pos != null && !_p.panningEnabled) {
              bail = true;
            }
          }
          zoom2 = zoom2 > _p.maxZoom ? _p.maxZoom : zoom2;
          zoom2 = zoom2 < _p.minZoom ? _p.minZoom : zoom2;
          if (bail || !number$1(zoom2) || zoom2 === currentZoom || pos != null && (!number$1(pos.x) || !number$1(pos.y))) {
            return null;
          }
          if (pos != null) {
            var pan1 = currentPan;
            var zoom1 = currentZoom;
            var zoom22 = zoom2;
            var pan2 = {
              x: -zoom22 / zoom1 * (pos.x - pan1.x) + pos.x,
              y: -zoom22 / zoom1 * (pos.y - pan1.y) + pos.y
            };
            return {
              zoomed: true,
              panned: true,
              zoom: zoom22,
              pan: pan2
            };
          } else {
            return {
              zoomed: true,
              panned: false,
              zoom: zoom2,
              pan: currentPan
            };
          }
        }, "getZoomedViewport"),
        zoom: /* @__PURE__ */ __name(function zoom(params) {
          if (params === void 0) {
            return this._private.zoom;
          } else {
            var vp = this.getZoomedViewport(params);
            var _p = this._private;
            if (vp == null || !vp.zoomed) {
              return this;
            }
            _p.zoom = vp.zoom;
            if (vp.panned) {
              _p.pan.x = vp.pan.x;
              _p.pan.y = vp.pan.y;
            }
            this.emit("zoom" + (vp.panned ? " pan" : "") + " viewport");
            this.notify("viewport");
            return this;
          }
        }, "zoom"),
        viewport: /* @__PURE__ */ __name(function viewport(opts) {
          var _p = this._private;
          var zoomDefd = true;
          var panDefd = true;
          var events = [];
          var zoomFailed = false;
          var panFailed = false;
          if (!opts) {
            return this;
          }
          if (!number$1(opts.zoom)) {
            zoomDefd = false;
          }
          if (!plainObject(opts.pan)) {
            panDefd = false;
          }
          if (!zoomDefd && !panDefd) {
            return this;
          }
          if (zoomDefd) {
            var z3 = opts.zoom;
            if (z3 < _p.minZoom || z3 > _p.maxZoom || !_p.zoomingEnabled) {
              zoomFailed = true;
            } else {
              _p.zoom = z3;
              events.push("zoom");
            }
          }
          if (panDefd && (!zoomFailed || !opts.cancelOnFailedZoom) && _p.panningEnabled) {
            var p3 = opts.pan;
            if (number$1(p3.x)) {
              _p.pan.x = p3.x;
              panFailed = false;
            }
            if (number$1(p3.y)) {
              _p.pan.y = p3.y;
              panFailed = false;
            }
            if (!panFailed) {
              events.push("pan");
            }
          }
          if (events.length > 0) {
            events.push("viewport");
            this.emit(events.join(" "));
            this.notify("viewport");
          }
          return this;
        }, "viewport"),
        center: /* @__PURE__ */ __name(function center2(elements2) {
          var pan2 = this.getCenterPan(elements2);
          if (pan2) {
            this._private.pan = pan2;
            this.emit("pan viewport");
            this.notify("viewport");
          }
          return this;
        }, "center"),
        getCenterPan: /* @__PURE__ */ __name(function getCenterPan(elements2, zoom2) {
          if (!this._private.panningEnabled) {
            return;
          }
          if (string(elements2)) {
            var selector = elements2;
            elements2 = this.mutableElements().filter(selector);
          } else if (!elementOrCollection(elements2)) {
            elements2 = this.mutableElements();
          }
          if (elements2.length === 0) {
            return;
          }
          var bb = elements2.boundingBox();
          var w4 = this.width();
          var h3 = this.height();
          zoom2 = zoom2 === void 0 ? this._private.zoom : zoom2;
          var pan2 = {
            // middle
            x: (w4 - zoom2 * (bb.x1 + bb.x2)) / 2,
            y: (h3 - zoom2 * (bb.y1 + bb.y2)) / 2
          };
          return pan2;
        }, "getCenterPan"),
        reset: /* @__PURE__ */ __name(function reset2() {
          if (!this._private.panningEnabled || !this._private.zoomingEnabled) {
            return this;
          }
          this.viewport({
            pan: {
              x: 0,
              y: 0
            },
            zoom: 1
          });
          return this;
        }, "reset"),
        invalidateSize: /* @__PURE__ */ __name(function invalidateSize() {
          this._private.sizeCache = null;
        }, "invalidateSize"),
        size: /* @__PURE__ */ __name(function size3() {
          var _p = this._private;
          var container2 = _p.container;
          var cy = this;
          return _p.sizeCache = _p.sizeCache || (container2 ? (function() {
            var style3 = cy.window().getComputedStyle(container2);
            var val = /* @__PURE__ */ __name(function val2(name) {
              return parseFloat(style3.getPropertyValue(name));
            }, "val");
            return {
              width: container2.clientWidth - val("padding-left") - val("padding-right"),
              height: container2.clientHeight - val("padding-top") - val("padding-bottom")
            };
          })() : {
            // fallback if no container (not 0 b/c can be used for dividing etc)
            width: 1,
            height: 1
          });
        }, "size"),
        width: /* @__PURE__ */ __name(function width2() {
          return this.size().width;
        }, "width"),
        height: /* @__PURE__ */ __name(function height() {
          return this.size().height;
        }, "height"),
        extent: /* @__PURE__ */ __name(function extent() {
          var pan2 = this._private.pan;
          var zoom2 = this._private.zoom;
          var rb = this.renderedExtent();
          var b3 = {
            x1: (rb.x1 - pan2.x) / zoom2,
            x2: (rb.x2 - pan2.x) / zoom2,
            y1: (rb.y1 - pan2.y) / zoom2,
            y2: (rb.y2 - pan2.y) / zoom2
          };
          b3.w = b3.x2 - b3.x1;
          b3.h = b3.y2 - b3.y1;
          return b3;
        }, "extent"),
        renderedExtent: /* @__PURE__ */ __name(function renderedExtent() {
          var width3 = this.width();
          var height2 = this.height();
          return {
            x1: 0,
            y1: 0,
            x2: width3,
            y2: height2,
            w: width3,
            h: height2
          };
        }, "renderedExtent"),
        multiClickDebounceTime: /* @__PURE__ */ __name(function multiClickDebounceTime(_int) {
          if (_int) this._private.multiClickDebounceTime = _int;
          else return this._private.multiClickDebounceTime;
          return this;
        }, "multiClickDebounceTime")
      };
      corefn$1.centre = corefn$1.center;
      corefn$1.autolockNodes = corefn$1.autolock;
      corefn$1.autoungrabifyNodes = corefn$1.autoungrabify;
      fn2 = {
        data: define2.data({
          field: "data",
          bindingEvent: "data",
          allowBinding: true,
          allowSetting: true,
          settingEvent: "data",
          settingTriggersEvent: true,
          triggerFnName: "trigger",
          allowGetting: true,
          updateStyle: true
        }),
        removeData: define2.removeData({
          field: "data",
          event: "data",
          triggerFnName: "trigger",
          triggerEvent: true,
          updateStyle: true
        }),
        scratch: define2.data({
          field: "scratch",
          bindingEvent: "scratch",
          allowBinding: true,
          allowSetting: true,
          settingEvent: "scratch",
          settingTriggersEvent: true,
          triggerFnName: "trigger",
          allowGetting: true,
          updateStyle: true
        }),
        removeScratch: define2.removeData({
          field: "scratch",
          event: "scratch",
          triggerFnName: "trigger",
          triggerEvent: true,
          updateStyle: true
        })
      };
      fn2.attr = fn2.data;
      fn2.removeAttr = fn2.removeData;
      Core = /* @__PURE__ */ __name(function Core2(opts) {
        var cy = this;
        opts = extend4({}, opts);
        var container2 = opts.container;
        if (container2 && !htmlElement(container2) && htmlElement(container2[0])) {
          container2 = container2[0];
        }
        var reg = container2 ? container2._cyreg : null;
        reg = reg || {};
        if (reg && reg.cy) {
          reg.cy.destroy();
          reg = {};
        }
        var readies = reg.readies = reg.readies || [];
        if (container2) {
          container2._cyreg = reg;
        }
        reg.cy = cy;
        var head2 = _window !== void 0 && container2 !== void 0 && !opts.headless;
        var options2 = opts;
        options2.layout = extend4({
          name: head2 ? "grid" : "null"
        }, options2.layout);
        options2.renderer = extend4({
          name: head2 ? "canvas" : "null"
        }, options2.renderer);
        var defVal = /* @__PURE__ */ __name(function defVal2(def, val, altVal) {
          if (val !== void 0) {
            return val;
          } else if (altVal !== void 0) {
            return altVal;
          } else {
            return def;
          }
        }, "defVal");
        var _p = this._private = {
          container: container2,
          // html dom ele container
          ready: false,
          // whether ready has been triggered
          options: options2,
          // cached options
          elements: new Collection(this),
          // elements in the graph
          listeners: [],
          // list of listeners
          aniEles: new Collection(this),
          // elements being animated
          data: options2.data || {},
          // data for the core
          scratch: {},
          // scratch object for core
          layout: null,
          renderer: null,
          destroyed: false,
          // whether destroy was called
          notificationsEnabled: true,
          // whether notifications are sent to the renderer
          minZoom: 1e-50,
          maxZoom: 1e50,
          zoomingEnabled: defVal(true, options2.zoomingEnabled),
          userZoomingEnabled: defVal(true, options2.userZoomingEnabled),
          panningEnabled: defVal(true, options2.panningEnabled),
          userPanningEnabled: defVal(true, options2.userPanningEnabled),
          boxSelectionEnabled: defVal(true, options2.boxSelectionEnabled),
          autolock: defVal(false, options2.autolock, options2.autolockNodes),
          autoungrabify: defVal(false, options2.autoungrabify, options2.autoungrabifyNodes),
          autounselectify: defVal(false, options2.autounselectify),
          styleEnabled: options2.styleEnabled === void 0 ? head2 : options2.styleEnabled,
          zoom: number$1(options2.zoom) ? options2.zoom : 1,
          pan: {
            x: plainObject(options2.pan) && number$1(options2.pan.x) ? options2.pan.x : 0,
            y: plainObject(options2.pan) && number$1(options2.pan.y) ? options2.pan.y : 0
          },
          animation: {
            // object for currently-running animations
            current: [],
            queue: []
          },
          hasCompoundNodes: false,
          multiClickDebounceTime: defVal(250, options2.multiClickDebounceTime)
        };
        this.createEmitter();
        this.selectionType(options2.selectionType);
        this.zoomRange({
          min: options2.minZoom,
          max: options2.maxZoom
        });
        var loadExtData = /* @__PURE__ */ __name(function loadExtData2(extData, next3) {
          var anyIsPromise = extData.some(promise);
          if (anyIsPromise) {
            return Promise$1.all(extData).then(next3);
          } else {
            next3(extData);
          }
        }, "loadExtData");
        if (_p.styleEnabled) {
          cy.setStyle([]);
        }
        var rendererOptions = extend4({}, options2, options2.renderer);
        cy.initRenderer(rendererOptions);
        var setElesAndLayout = /* @__PURE__ */ __name(function setElesAndLayout2(elements2, onload, ondone) {
          cy.notifications(false);
          var oldEles = cy.mutableElements();
          if (oldEles.length > 0) {
            oldEles.remove();
          }
          if (elements2 != null) {
            if (plainObject(elements2) || array2(elements2)) {
              cy.add(elements2);
            }
          }
          cy.one("layoutready", function(e3) {
            cy.notifications(true);
            cy.emit(e3);
            cy.one("load", onload);
            cy.emitAndNotify("load");
          }).one("layoutstop", function() {
            cy.one("done", ondone);
            cy.emit("done");
          });
          var layoutOpts = extend4({}, cy._private.options.layout);
          layoutOpts.eles = cy.elements();
          cy.layout(layoutOpts).run();
        }, "setElesAndLayout");
        loadExtData([options2.style, options2.elements], function(thens) {
          var initStyle = thens[0];
          var initEles = thens[1];
          if (_p.styleEnabled) {
            cy.style().append(initStyle);
          }
          setElesAndLayout(initEles, function() {
            cy.startAnimationLoop();
            _p.ready = true;
            if (fn$6(options2.ready)) {
              cy.on("ready", options2.ready);
            }
            for (var i2 = 0; i2 < readies.length; i2++) {
              var fn3 = readies[i2];
              cy.on("ready", fn3);
            }
            if (reg) {
              reg.readies = [];
            }
            cy.emit("ready");
          }, options2.done);
        });
      }, "Core");
      corefn = Core.prototype;
      extend4(corefn, {
        instanceString: /* @__PURE__ */ __name(function instanceString3() {
          return "core";
        }, "instanceString"),
        isReady: /* @__PURE__ */ __name(function isReady() {
          return this._private.ready;
        }, "isReady"),
        destroyed: /* @__PURE__ */ __name(function destroyed() {
          return this._private.destroyed;
        }, "destroyed"),
        ready: /* @__PURE__ */ __name(function ready(fn3) {
          if (this.isReady()) {
            this.emitter().emit("ready", [], fn3);
          } else {
            this.on("ready", fn3);
          }
          return this;
        }, "ready"),
        destroy: /* @__PURE__ */ __name(function destroy() {
          var cy = this;
          if (cy.destroyed()) return;
          cy.stopAnimationLoop();
          cy.destroyRenderer();
          this.emit("destroy");
          cy._private.destroyed = true;
          return cy;
        }, "destroy"),
        hasElementWithId: /* @__PURE__ */ __name(function hasElementWithId(id34) {
          return this._private.elements.hasElementWithId(id34);
        }, "hasElementWithId"),
        getElementById: /* @__PURE__ */ __name(function getElementById(id34) {
          return this._private.elements.getElementById(id34);
        }, "getElementById"),
        hasCompoundNodes: /* @__PURE__ */ __name(function hasCompoundNodes() {
          return this._private.hasCompoundNodes;
        }, "hasCompoundNodes"),
        headless: /* @__PURE__ */ __name(function headless() {
          return this._private.renderer.isHeadless();
        }, "headless"),
        styleEnabled: /* @__PURE__ */ __name(function styleEnabled() {
          return this._private.styleEnabled;
        }, "styleEnabled"),
        addToPool: /* @__PURE__ */ __name(function addToPool(eles) {
          this._private.elements.merge(eles);
          return this;
        }, "addToPool"),
        removeFromPool: /* @__PURE__ */ __name(function removeFromPool(eles) {
          this._private.elements.unmerge(eles);
          return this;
        }, "removeFromPool"),
        container: /* @__PURE__ */ __name(function container() {
          return this._private.container || null;
        }, "container"),
        window: /* @__PURE__ */ __name(function window2() {
          var container2 = this._private.container;
          if (container2 == null) return _window;
          var ownerDocument = this._private.container.ownerDocument;
          if (ownerDocument === void 0 || ownerDocument == null) {
            return _window;
          }
          return ownerDocument.defaultView || _window;
        }, "window"),
        mount: /* @__PURE__ */ __name(function mount(container2) {
          if (container2 == null) {
            return;
          }
          var cy = this;
          var _p = cy._private;
          var options2 = _p.options;
          if (!htmlElement(container2) && htmlElement(container2[0])) {
            container2 = container2[0];
          }
          cy.stopAnimationLoop();
          cy.destroyRenderer();
          _p.container = container2;
          _p.styleEnabled = true;
          cy.invalidateSize();
          cy.initRenderer(extend4({}, options2, options2.renderer, {
            // allow custom renderer name to be re-used, otherwise use canvas
            name: options2.renderer.name === "null" ? "canvas" : options2.renderer.name
          }));
          cy.startAnimationLoop();
          cy.style(options2.style);
          cy.emit("mount");
          return cy;
        }, "mount"),
        unmount: /* @__PURE__ */ __name(function unmount() {
          var cy = this;
          cy.stopAnimationLoop();
          cy.destroyRenderer();
          cy.initRenderer({
            name: "null"
          });
          cy.emit("unmount");
          return cy;
        }, "unmount"),
        options: /* @__PURE__ */ __name(function options() {
          return copy3(this._private.options);
        }, "options"),
        json: /* @__PURE__ */ __name(function json2(obj) {
          var cy = this;
          var _p = cy._private;
          var eles = cy.mutableElements();
          var getFreshRef = /* @__PURE__ */ __name(function getFreshRef2(ele) {
            return cy.getElementById(ele.id());
          }, "getFreshRef");
          if (plainObject(obj)) {
            cy.startBatch();
            if (obj.elements) {
              var idInJson = {};
              var updateEles = /* @__PURE__ */ __name(function updateEles2(jsons, gr2) {
                var toAdd = [];
                var toMod = [];
                for (var i3 = 0; i3 < jsons.length; i3++) {
                  var json4 = jsons[i3];
                  if (!json4.data.id) {
                    warn("cy.json() cannot handle elements without an ID attribute");
                    continue;
                  }
                  var id34 = "" + json4.data.id;
                  var ele = cy.getElementById(id34);
                  idInJson[id34] = true;
                  if (ele.length !== 0) {
                    toMod.push({
                      ele,
                      json: json4
                    });
                  } else {
                    if (gr2) {
                      json4.group = gr2;
                      toAdd.push(json4);
                    } else {
                      toAdd.push(json4);
                    }
                  }
                }
                cy.add(toAdd);
                for (var _i = 0; _i < toMod.length; _i++) {
                  var _toMod$_i = toMod[_i], _ele = _toMod$_i.ele, _json = _toMod$_i.json;
                  _ele.json(_json);
                }
              }, "updateEles");
              if (array2(obj.elements)) {
                updateEles(obj.elements);
              } else {
                var grs = ["nodes", "edges"];
                for (var i2 = 0; i2 < grs.length; i2++) {
                  var gr = grs[i2];
                  var elements2 = obj.elements[gr];
                  if (array2(elements2)) {
                    updateEles(elements2, gr);
                  }
                }
              }
              var parentsToRemove = cy.collection();
              eles.filter(function(ele) {
                return !idInJson[ele.id()];
              }).forEach(function(ele) {
                if (ele.isParent()) {
                  parentsToRemove.merge(ele);
                } else {
                  ele.remove();
                }
              });
              parentsToRemove.forEach(function(ele) {
                return ele.children().move({
                  parent: null
                });
              });
              parentsToRemove.forEach(function(ele) {
                return getFreshRef(ele).remove();
              });
            }
            if (obj.style) {
              cy.style(obj.style);
            }
            if (obj.zoom != null && obj.zoom !== _p.zoom) {
              cy.zoom(obj.zoom);
            }
            if (obj.pan) {
              if (obj.pan.x !== _p.pan.x || obj.pan.y !== _p.pan.y) {
                cy.pan(obj.pan);
              }
            }
            if (obj.data) {
              cy.data(obj.data);
            }
            var fields = ["minZoom", "maxZoom", "zoomingEnabled", "userZoomingEnabled", "panningEnabled", "userPanningEnabled", "boxSelectionEnabled", "autolock", "autoungrabify", "autounselectify", "multiClickDebounceTime"];
            for (var _i2 = 0; _i2 < fields.length; _i2++) {
              var f2 = fields[_i2];
              if (obj[f2] != null) {
                cy[f2](obj[f2]);
              }
            }
            cy.endBatch();
            return this;
          } else {
            var flat = !!obj;
            var json3 = {};
            if (flat) {
              json3.elements = this.elements().map(function(ele) {
                return ele.json();
              });
            } else {
              json3.elements = {};
              eles.forEach(function(ele) {
                var group2 = ele.group();
                if (!json3.elements[group2]) {
                  json3.elements[group2] = [];
                }
                json3.elements[group2].push(ele.json());
              });
            }
            if (this._private.styleEnabled) {
              json3.style = cy.style().json();
            }
            json3.data = copy3(cy.data());
            var options2 = _p.options;
            json3.zoomingEnabled = _p.zoomingEnabled;
            json3.userZoomingEnabled = _p.userZoomingEnabled;
            json3.zoom = _p.zoom;
            json3.minZoom = _p.minZoom;
            json3.maxZoom = _p.maxZoom;
            json3.panningEnabled = _p.panningEnabled;
            json3.userPanningEnabled = _p.userPanningEnabled;
            json3.pan = copy3(_p.pan);
            json3.boxSelectionEnabled = _p.boxSelectionEnabled;
            json3.renderer = copy3(options2.renderer);
            json3.hideEdgesOnViewport = options2.hideEdgesOnViewport;
            json3.textureOnViewport = options2.textureOnViewport;
            json3.wheelSensitivity = options2.wheelSensitivity;
            json3.motionBlur = options2.motionBlur;
            json3.multiClickDebounceTime = options2.multiClickDebounceTime;
            return json3;
          }
        }, "json")
      });
      corefn.$id = corefn.getElementById;
      [corefn$9, corefn$8, elesfn, corefn$7, corefn$6, corefn$5, corefn$4, corefn$3, corefn$2, corefn$1, fn2].forEach(function(props) {
        extend4(corefn, props);
      });
      defaults$7 = {
        fit: true,
        // whether to fit the viewport to the graph
        directed: false,
        // whether the tree is directed downwards (or edges can point in any direction if false)
        direction: "downward",
        // determines the direction in which the tree structure is drawn.  The possible values are 'downward', 'upward', 'rightward', or 'leftward'.
        padding: 30,
        // padding on fit
        circle: false,
        // put depths in concentric circles if true, put depths top down if false
        grid: false,
        // whether to create an even grid into which the DAG is placed (circle:false only)
        spacingFactor: 1.75,
        // positive spacing factor, larger => more space between nodes (N.B. n/a if causes overlap)
        boundingBox: void 0,
        // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
        avoidOverlap: true,
        // prevents node overlap, may overflow boundingBox if not enough space
        nodeDimensionsIncludeLabels: false,
        // Excludes the label when calculating node bounding boxes for the layout algorithm
        roots: void 0,
        // the roots of the trees
        depthSort: void 0,
        // a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') }
        animate: false,
        // whether to transition the node positions
        animationDuration: 500,
        // duration of animation in ms if enabled
        animationEasing: void 0,
        // easing of animation if enabled,
        animateFilter: /* @__PURE__ */ __name(function animateFilter(node2, i2) {
          return true;
        }, "animateFilter"),
        // a function that determines whether the node should be animated.  All nodes animated by default on animate enabled.  Non-animated nodes are positioned immediately when the layout starts
        ready: void 0,
        // callback on layoutready
        stop: void 0,
        // callback on layoutstop
        transform: /* @__PURE__ */ __name(function transform2(node2, position5) {
          return position5;
        }, "transform")
        // transform a given node position. Useful for changing flow direction in discrete layouts
      };
      deprecatedOptionDefaults = {
        maximal: false,
        // whether to shift nodes down their natural BFS depths in order to avoid upwards edges (DAGS only); setting acyclic to true sets maximal to true also
        acyclic: false
        // whether the tree is acyclic and thus a node could be shifted (due to the maximal option) multiple times without causing an infinite loop; setting to true sets maximal to true also; if you are uncertain whether a tree is acyclic, set to false to avoid potential infinite loops
      };
      getInfo = /* @__PURE__ */ __name(function getInfo2(ele) {
        return ele.scratch("breadthfirst");
      }, "getInfo");
      setInfo = /* @__PURE__ */ __name(function setInfo2(ele, obj) {
        return ele.scratch("breadthfirst", obj);
      }, "setInfo");
      __name(BreadthFirstLayout, "BreadthFirstLayout");
      BreadthFirstLayout.prototype.run = function() {
        var options2 = this.options;
        var cy = options2.cy;
        var eles = options2.eles;
        var nodes5 = eles.nodes().filter(function(n3) {
          return n3.isChildless();
        });
        var graph = eles;
        var directed = options2.directed;
        var maximal = options2.acyclic || options2.maximal || options2.maximalAdjustments > 0;
        var hasBoundingBox = !!options2.boundingBox;
        var bb = makeBoundingBox(hasBoundingBox ? options2.boundingBox : structuredClone(cy.extent()));
        var roots;
        if (elementOrCollection(options2.roots)) {
          roots = options2.roots;
        } else if (array2(options2.roots)) {
          var rootsArray = [];
          for (var i2 = 0; i2 < options2.roots.length; i2++) {
            var id34 = options2.roots[i2];
            var ele = cy.getElementById(id34);
            rootsArray.push(ele);
          }
          roots = cy.collection(rootsArray);
        } else if (string(options2.roots)) {
          roots = cy.$(options2.roots);
        } else {
          if (directed) {
            roots = nodes5.roots();
          } else {
            var components3 = eles.components();
            roots = cy.collection();
            var _loop = /* @__PURE__ */ __name(function _loop2() {
              var comp = components3[_i];
              var maxDegree = comp.maxDegree(false);
              var compRoots = comp.filter(function(ele2) {
                return ele2.degree(false) === maxDegree;
              });
              roots = roots.add(compRoots);
            }, "_loop");
            for (var _i = 0; _i < components3.length; _i++) {
              _loop();
            }
          }
        }
        var depths = [];
        var foundByBfs = {};
        var addToDepth = /* @__PURE__ */ __name(function addToDepth2(ele2, d3) {
          if (depths[d3] == null) {
            depths[d3] = [];
          }
          var i3 = depths[d3].length;
          depths[d3].push(ele2);
          setInfo(ele2, {
            index: i3,
            depth: d3
          });
        }, "addToDepth");
        var changeDepth = /* @__PURE__ */ __name(function changeDepth2(ele2, newDepth) {
          var _getInfo = getInfo(ele2), depth = _getInfo.depth, index = _getInfo.index;
          depths[depth][index] = null;
          if (ele2.isChildless()) addToDepth(ele2, newDepth);
        }, "changeDepth");
        graph.bfs({
          roots,
          directed: options2.directed,
          visit: /* @__PURE__ */ __name(function visit(node2, edge, pNode, i3, depth) {
            var ele2 = node2[0];
            var id35 = ele2.id();
            if (ele2.isChildless()) addToDepth(ele2, depth);
            foundByBfs[id35] = true;
          }, "visit")
        });
        var orphanNodes = [];
        for (var _i2 = 0; _i2 < nodes5.length; _i2++) {
          var _ele = nodes5[_i2];
          if (foundByBfs[_ele.id()]) {
            continue;
          } else {
            orphanNodes.push(_ele);
          }
        }
        var assignDepthsAt = /* @__PURE__ */ __name(function assignDepthsAt2(i3) {
          var eles2 = depths[i3];
          for (var j3 = 0; j3 < eles2.length; j3++) {
            var _ele2 = eles2[j3];
            if (_ele2 == null) {
              eles2.splice(j3, 1);
              j3--;
              continue;
            }
            setInfo(_ele2, {
              depth: i3,
              index: j3
            });
          }
        }, "assignDepthsAt");
        var adjustMaximally = /* @__PURE__ */ __name(function adjustMaximally2(ele2, shifted2) {
          var eInfo = getInfo(ele2);
          var incomers = ele2.incomers().filter(function(el) {
            return el.isNode() && eles.has(el);
          });
          var maxDepth = -1;
          var id35 = ele2.id();
          for (var k2 = 0; k2 < incomers.length; k2++) {
            var incmr = incomers[k2];
            var iInfo = getInfo(incmr);
            maxDepth = Math.max(maxDepth, iInfo.depth);
          }
          if (eInfo.depth <= maxDepth) {
            if (!options2.acyclic && shifted2[id35]) {
              return null;
            }
            var newDepth = maxDepth + 1;
            changeDepth(ele2, newDepth);
            shifted2[id35] = newDepth;
            return true;
          }
          return false;
        }, "adjustMaximally");
        if (directed && maximal) {
          var Q3 = [];
          var shifted = {};
          var enqueue = /* @__PURE__ */ __name(function enqueue2(n3) {
            return Q3.push(n3);
          }, "enqueue");
          var dequeue = /* @__PURE__ */ __name(function dequeue2() {
            return Q3.shift();
          }, "dequeue");
          nodes5.forEach(function(n3) {
            return Q3.push(n3);
          });
          while (Q3.length > 0) {
            var _ele3 = dequeue();
            var didShift = adjustMaximally(_ele3, shifted);
            if (didShift) {
              _ele3.outgoers().filter(function(el) {
                return el.isNode() && eles.has(el);
              }).forEach(enqueue);
            } else if (didShift === null) {
              warn("Detected double maximal shift for node `" + _ele3.id() + "`.  Bailing maximal adjustment due to cycle.  Use `options.maximal: true` only on DAGs.");
              break;
            }
          }
        }
        var minDistance = 0;
        if (options2.avoidOverlap) {
          for (var _i3 = 0; _i3 < nodes5.length; _i3++) {
            var n2 = nodes5[_i3];
            var nbb = n2.layoutDimensions(options2);
            var w4 = nbb.w;
            var h3 = nbb.h;
            minDistance = Math.max(minDistance, w4, h3);
          }
        }
        var cachedWeightedPercent = {};
        var getWeightedPercent = /* @__PURE__ */ __name(function getWeightedPercent2(ele2) {
          if (cachedWeightedPercent[ele2.id()]) {
            return cachedWeightedPercent[ele2.id()];
          }
          var eleDepth = getInfo(ele2).depth;
          var neighbors = ele2.neighborhood();
          var percent = 0;
          var samples = 0;
          for (var _i4 = 0; _i4 < neighbors.length; _i4++) {
            var neighbor = neighbors[_i4];
            if (neighbor.isEdge() || neighbor.isParent() || !nodes5.has(neighbor)) {
              continue;
            }
            var bf = getInfo(neighbor);
            if (bf == null) {
              continue;
            }
            var index = bf.index;
            var depth = bf.depth;
            if (index == null || depth == null) {
              continue;
            }
            var nDepth = depths[depth].length;
            if (depth < eleDepth) {
              percent += index / nDepth;
              samples++;
            }
          }
          samples = Math.max(1, samples);
          percent = percent / samples;
          if (samples === 0) {
            percent = 0;
          }
          cachedWeightedPercent[ele2.id()] = percent;
          return percent;
        }, "getWeightedPercent");
        var sortFn = /* @__PURE__ */ __name(function sortFn2(a2, b3) {
          var apct = getWeightedPercent(a2);
          var bpct = getWeightedPercent(b3);
          var diff2 = apct - bpct;
          if (diff2 === 0) {
            return ascending3(a2.id(), b3.id());
          } else {
            return diff2;
          }
        }, "sortFn");
        if (options2.depthSort !== void 0) {
          sortFn = options2.depthSort;
        }
        var depthsLen = depths.length;
        for (var _i5 = 0; _i5 < depthsLen; _i5++) {
          depths[_i5].sort(sortFn);
          assignDepthsAt(_i5);
        }
        var orphanDepth = [];
        for (var _i6 = 0; _i6 < orphanNodes.length; _i6++) {
          orphanDepth.push(orphanNodes[_i6]);
        }
        var assignDepths = /* @__PURE__ */ __name(function assignDepths2() {
          for (var _i7 = 0; _i7 < depthsLen; _i7++) {
            assignDepthsAt(_i7);
          }
        }, "assignDepths");
        if (orphanDepth.length) {
          depths.unshift(orphanDepth);
          depthsLen = depths.length;
          assignDepths();
        }
        var biggestDepthSize = 0;
        for (var _i8 = 0; _i8 < depthsLen; _i8++) {
          biggestDepthSize = Math.max(depths[_i8].length, biggestDepthSize);
        }
        var center4 = {
          x: bb.x1 + bb.w / 2,
          y: bb.y1 + bb.h / 2
        };
        var aveNodeSize = nodes5.reduce(function(acc, node2) {
          return (function(box) {
            return {
              w: acc.w === -1 ? box.w : (acc.w + box.w) / 2,
              h: acc.h === -1 ? box.h : (acc.h + box.h) / 2
            };
          })(node2.boundingBox({
            includeLabels: options2.nodeDimensionsIncludeLabels
          }));
        }, {
          w: -1,
          h: -1
        });
        var distanceY = Math.max(
          // only one depth
          depthsLen === 1 ? 0 : (
            // inside a bounding box, no need for top & bottom padding
            hasBoundingBox ? (bb.h - options2.padding * 2 - aveNodeSize.h) / (depthsLen - 1) : (bb.h - options2.padding * 2 - aveNodeSize.h) / (depthsLen + 1)
          ),
          minDistance
        );
        var maxDepthSize = depths.reduce(function(max10, eles2) {
          return Math.max(max10, eles2.length);
        }, 0);
        var getPositionTopBottom = /* @__PURE__ */ __name(function getPositionTopBottom2(ele2) {
          var _getInfo2 = getInfo(ele2), depth = _getInfo2.depth, index = _getInfo2.index;
          if (options2.circle) {
            var radiusStepSize = Math.min(bb.w / 2 / depthsLen, bb.h / 2 / depthsLen);
            radiusStepSize = Math.max(radiusStepSize, minDistance);
            var radius2 = radiusStepSize * depth + radiusStepSize - (depthsLen > 0 && depths[0].length <= 3 ? radiusStepSize / 2 : 0);
            var theta = 2 * Math.PI / depths[depth].length * index;
            if (depth === 0 && depths[0].length === 1) {
              radius2 = 1;
            }
            return {
              x: center4.x + radius2 * Math.cos(theta),
              y: center4.y + radius2 * Math.sin(theta)
            };
          } else {
            var depthSize = depths[depth].length;
            var distanceX = Math.max(
              // only one depth
              depthSize === 1 ? 0 : (
                // inside a bounding box, no need for left & right padding
                hasBoundingBox ? (bb.w - options2.padding * 2 - aveNodeSize.w) / ((options2.grid ? maxDepthSize : depthSize) - 1) : (bb.w - options2.padding * 2 - aveNodeSize.w) / ((options2.grid ? maxDepthSize : depthSize) + 1)
              ),
              minDistance
            );
            var epos = {
              x: center4.x + (index + 1 - (depthSize + 1) / 2) * distanceX,
              y: center4.y + (depth + 1 - (depthsLen + 1) / 2) * distanceY
            };
            return epos;
          }
        }, "getPositionTopBottom");
        var rotateDegrees = {
          "downward": 0,
          "leftward": 90,
          "upward": 180,
          "rightward": -90
        };
        if (Object.keys(rotateDegrees).indexOf(options2.direction) === -1) {
          error("Invalid direction '".concat(options2.direction, "' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(rotateDegrees).join(", ")));
        }
        var getPosition = /* @__PURE__ */ __name(function getPosition2(ele2) {
          return rotatePosAndSkewByBox(getPositionTopBottom(ele2), bb, rotateDegrees[options2.direction]);
        }, "getPosition");
        eles.nodes().layoutPositions(this, options2, getPosition);
        return this;
      };
      defaults$6 = {
        fit: true,
        // whether to fit the viewport to the graph
        padding: 30,
        // the padding on fit
        boundingBox: void 0,
        // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
        avoidOverlap: true,
        // prevents node overlap, may overflow boundingBox and radius if not enough space
        nodeDimensionsIncludeLabels: false,
        // Excludes the label when calculating node bounding boxes for the layout algorithm
        spacingFactor: void 0,
        // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
        radius: void 0,
        // the radius of the circle
        startAngle: 3 / 2 * Math.PI,
        // where nodes start in radians
        sweep: void 0,
        // how many radians should be between the first and last node (defaults to full circle)
        clockwise: true,
        // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
        sort: void 0,
        // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
        animate: false,
        // whether to transition the node positions
        animationDuration: 500,
        // duration of animation in ms if enabled
        animationEasing: void 0,
        // easing of animation if enabled
        animateFilter: /* @__PURE__ */ __name(function animateFilter2(node2, i2) {
          return true;
        }, "animateFilter"),
        // a function that determines whether the node should be animated.  All nodes animated by default on animate enabled.  Non-animated nodes are positioned immediately when the layout starts
        ready: void 0,
        // callback on layoutready
        stop: void 0,
        // callback on layoutstop
        transform: /* @__PURE__ */ __name(function transform3(node2, position5) {
          return position5;
        }, "transform")
        // transform a given node position. Useful for changing flow direction in discrete layouts 
      };
      __name(CircleLayout, "CircleLayout");
      CircleLayout.prototype.run = function() {
        var params = this.options;
        var options2 = params;
        var cy = params.cy;
        var eles = options2.eles;
        var clockwise = options2.counterclockwise !== void 0 ? !options2.counterclockwise : options2.clockwise;
        var nodes5 = eles.nodes().not(":parent");
        if (options2.sort) {
          nodes5 = nodes5.sort(options2.sort);
        }
        var bb = makeBoundingBox(options2.boundingBox ? options2.boundingBox : {
          x1: 0,
          y1: 0,
          w: cy.width(),
          h: cy.height()
        });
        var center4 = {
          x: bb.x1 + bb.w / 2,
          y: bb.y1 + bb.h / 2
        };
        var sweep = options2.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / nodes5.length : options2.sweep;
        var dTheta = sweep / Math.max(1, nodes5.length - 1);
        var r2;
        var minDistance = 0;
        for (var i2 = 0; i2 < nodes5.length; i2++) {
          var n2 = nodes5[i2];
          var nbb = n2.layoutDimensions(options2);
          var w4 = nbb.w;
          var h3 = nbb.h;
          minDistance = Math.max(minDistance, w4, h3);
        }
        if (number$1(options2.radius)) {
          r2 = options2.radius;
        } else if (nodes5.length <= 1) {
          r2 = 0;
        } else {
          r2 = Math.min(bb.h, bb.w) / 2 - minDistance;
        }
        if (nodes5.length > 1 && options2.avoidOverlap) {
          minDistance *= 1.75;
          var dcos = Math.cos(dTheta) - Math.cos(0);
          var dsin = Math.sin(dTheta) - Math.sin(0);
          var rMin = Math.sqrt(minDistance * minDistance / (dcos * dcos + dsin * dsin));
          r2 = Math.max(rMin, r2);
        }
        var getPos = /* @__PURE__ */ __name(function getPos2(ele, i3) {
          var theta = options2.startAngle + i3 * dTheta * (clockwise ? 1 : -1);
          var rx = r2 * Math.cos(theta);
          var ry = r2 * Math.sin(theta);
          var pos = {
            x: center4.x + rx,
            y: center4.y + ry
          };
          return pos;
        }, "getPos");
        eles.nodes().layoutPositions(this, options2, getPos);
        return this;
      };
      defaults$5 = {
        fit: true,
        // whether to fit the viewport to the graph
        padding: 30,
        // the padding on fit
        startAngle: 3 / 2 * Math.PI,
        // where nodes start in radians
        sweep: void 0,
        // how many radians should be between the first and last node (defaults to full circle)
        clockwise: true,
        // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
        equidistant: false,
        // whether levels have an equal radial distance betwen them, may cause bounding box overflow
        minNodeSpacing: 10,
        // min spacing between outside of nodes (used for radius adjustment)
        boundingBox: void 0,
        // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
        avoidOverlap: true,
        // prevents node overlap, may overflow boundingBox if not enough space
        nodeDimensionsIncludeLabels: false,
        // Excludes the label when calculating node bounding boxes for the layout algorithm
        height: void 0,
        // height of layout area (overrides container height)
        width: void 0,
        // width of layout area (overrides container width)
        spacingFactor: void 0,
        // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
        concentric: /* @__PURE__ */ __name(function concentric(node2) {
          return node2.degree();
        }, "concentric"),
        levelWidth: /* @__PURE__ */ __name(function levelWidth(nodes5) {
          return nodes5.maxDegree() / 4;
        }, "levelWidth"),
        animate: false,
        // whether to transition the node positions
        animationDuration: 500,
        // duration of animation in ms if enabled
        animationEasing: void 0,
        // easing of animation if enabled
        animateFilter: /* @__PURE__ */ __name(function animateFilter3(node2, i2) {
          return true;
        }, "animateFilter"),
        // a function that determines whether the node should be animated.  All nodes animated by default on animate enabled.  Non-animated nodes are positioned immediately when the layout starts
        ready: void 0,
        // callback on layoutready
        stop: void 0,
        // callback on layoutstop
        transform: /* @__PURE__ */ __name(function transform4(node2, position5) {
          return position5;
        }, "transform")
        // transform a given node position. Useful for changing flow direction in discrete layouts
      };
      __name(ConcentricLayout, "ConcentricLayout");
      ConcentricLayout.prototype.run = function() {
        var params = this.options;
        var options2 = params;
        var clockwise = options2.counterclockwise !== void 0 ? !options2.counterclockwise : options2.clockwise;
        var cy = params.cy;
        var eles = options2.eles;
        var nodes5 = eles.nodes().not(":parent");
        var bb = makeBoundingBox(options2.boundingBox ? options2.boundingBox : {
          x1: 0,
          y1: 0,
          w: cy.width(),
          h: cy.height()
        });
        var center4 = {
          x: bb.x1 + bb.w / 2,
          y: bb.y1 + bb.h / 2
        };
        var nodeValues = [];
        var maxNodeSize = 0;
        for (var i2 = 0; i2 < nodes5.length; i2++) {
          var node2 = nodes5[i2];
          var value2 = void 0;
          value2 = options2.concentric(node2);
          nodeValues.push({
            value: value2,
            node: node2
          });
          node2._private.scratch.concentric = value2;
        }
        nodes5.updateStyle();
        for (var _i = 0; _i < nodes5.length; _i++) {
          var _node = nodes5[_i];
          var nbb = _node.layoutDimensions(options2);
          maxNodeSize = Math.max(maxNodeSize, nbb.w, nbb.h);
        }
        nodeValues.sort(function(a2, b3) {
          return b3.value - a2.value;
        });
        var levelWidth2 = options2.levelWidth(nodes5);
        var levels = [[]];
        var currentLevel = levels[0];
        for (var _i2 = 0; _i2 < nodeValues.length; _i2++) {
          var val = nodeValues[_i2];
          if (currentLevel.length > 0) {
            var diff2 = Math.abs(currentLevel[0].value - val.value);
            if (diff2 >= levelWidth2) {
              currentLevel = [];
              levels.push(currentLevel);
            }
          }
          currentLevel.push(val);
        }
        var minDist = maxNodeSize + options2.minNodeSpacing;
        if (!options2.avoidOverlap) {
          var firstLvlHasMulti = levels.length > 0 && levels[0].length > 1;
          var maxR = Math.min(bb.w, bb.h) / 2 - minDist;
          var rStep = maxR / (levels.length + firstLvlHasMulti ? 1 : 0);
          minDist = Math.min(minDist, rStep);
        }
        var r2 = 0;
        for (var _i3 = 0; _i3 < levels.length; _i3++) {
          var level = levels[_i3];
          var sweep = options2.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / level.length : options2.sweep;
          var dTheta = level.dTheta = sweep / Math.max(1, level.length - 1);
          if (level.length > 1 && options2.avoidOverlap) {
            var dcos = Math.cos(dTheta) - Math.cos(0);
            var dsin = Math.sin(dTheta) - Math.sin(0);
            var rMin = Math.sqrt(minDist * minDist / (dcos * dcos + dsin * dsin));
            r2 = Math.max(rMin, r2);
          }
          level.r = r2;
          r2 += minDist;
        }
        if (options2.equidistant) {
          var rDeltaMax = 0;
          var _r = 0;
          for (var _i4 = 0; _i4 < levels.length; _i4++) {
            var _level = levels[_i4];
            var rDelta = _level.r - _r;
            rDeltaMax = Math.max(rDeltaMax, rDelta);
          }
          _r = 0;
          for (var _i5 = 0; _i5 < levels.length; _i5++) {
            var _level2 = levels[_i5];
            if (_i5 === 0) {
              _r = _level2.r;
            }
            _level2.r = _r;
            _r += rDeltaMax;
          }
        }
        var pos = {};
        for (var _i6 = 0; _i6 < levels.length; _i6++) {
          var _level3 = levels[_i6];
          var _dTheta = _level3.dTheta;
          var _r2 = _level3.r;
          for (var j3 = 0; j3 < _level3.length; j3++) {
            var _val = _level3[j3];
            var theta = options2.startAngle + (clockwise ? 1 : -1) * _dTheta * j3;
            var p3 = {
              x: center4.x + _r2 * Math.cos(theta),
              y: center4.y + _r2 * Math.sin(theta)
            };
            pos[_val.node.id()] = p3;
          }
        }
        eles.nodes().layoutPositions(this, options2, function(ele) {
          var id34 = ele.id();
          return pos[id34];
        });
        return this;
      };
      defaults$4 = {
        // Called on `layoutready`
        ready: /* @__PURE__ */ __name(function ready2() {
        }, "ready"),
        // Called on `layoutstop`
        stop: /* @__PURE__ */ __name(function stop3() {
        }, "stop"),
        // Whether to animate while running the layout
        // true : Animate continuously as the layout is running
        // false : Just show the end result
        // 'end' : Animate with the end result, from the initial positions to the end positions
        animate: true,
        // Easing of the animation for animate:'end'
        animationEasing: void 0,
        // The duration of the animation for animate:'end'
        animationDuration: void 0,
        // A function that determines whether the node should be animated
        // All nodes animated by default on animate enabled
        // Non-animated nodes are positioned immediately when the layout starts
        animateFilter: /* @__PURE__ */ __name(function animateFilter4(node2, i2) {
          return true;
        }, "animateFilter"),
        // The layout animates only after this many milliseconds for animate:true
        // (prevents flashing on fast runs)
        animationThreshold: 250,
        // Number of iterations between consecutive screen positions update
        refresh: 20,
        // Whether to fit the network view after when done
        fit: true,
        // Padding on fit
        padding: 30,
        // Constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
        boundingBox: void 0,
        // Excludes the label when calculating node bounding boxes for the layout algorithm
        nodeDimensionsIncludeLabels: false,
        // Randomize the initial positions of the nodes (true) or use existing positions (false)
        randomize: false,
        // Extra spacing between components in non-compound graphs
        componentSpacing: 40,
        // Node repulsion (non overlapping) multiplier
        nodeRepulsion: /* @__PURE__ */ __name(function nodeRepulsion(node2) {
          return 2048;
        }, "nodeRepulsion"),
        // Node repulsion (overlapping) multiplier
        nodeOverlap: 4,
        // Ideal edge (non nested) length
        idealEdgeLength: /* @__PURE__ */ __name(function idealEdgeLength(edge) {
          return 32;
        }, "idealEdgeLength"),
        // Divisor to compute edge forces
        edgeElasticity: /* @__PURE__ */ __name(function edgeElasticity(edge) {
          return 32;
        }, "edgeElasticity"),
        // Nesting factor (multiplier) to compute ideal edge length for nested edges
        nestingFactor: 1.2,
        // Gravity force (constant)
        gravity: 1,
        // Maximum number of iterations to perform
        numIter: 1e3,
        // Initial temperature (maximum node displacement)
        initialTemp: 1e3,
        // Cooling factor (how the temperature is reduced between consecutive iterations
        coolingFactor: 0.99,
        // Lower temperature threshold (below this point the layout will end)
        minTemp: 1
      };
      __name(CoseLayout, "CoseLayout");
      CoseLayout.prototype.run = function() {
        var options2 = this.options;
        var cy = options2.cy;
        var layout7 = this;
        layout7.stopped = false;
        if (options2.animate === true || options2.animate === false) {
          layout7.emit({
            type: "layoutstart",
            layout: layout7
          });
        }
        if (true === options2.debug) {
          DEBUG = true;
        } else {
          DEBUG = false;
        }
        var layoutInfo = createLayoutInfo(cy, layout7, options2);
        if (DEBUG) {
          printLayoutInfo(layoutInfo);
        }
        if (options2.randomize) {
          randomizePositions(layoutInfo);
        }
        var startTime = performanceNow();
        var refresh = /* @__PURE__ */ __name(function refresh2() {
          refreshPositions(layoutInfo, cy, options2);
          if (true === options2.fit) {
            cy.fit(options2.padding);
          }
        }, "refresh");
        var mainLoop = /* @__PURE__ */ __name(function mainLoop2(i3) {
          if (layout7.stopped || i3 >= options2.numIter) {
            return false;
          }
          step(layoutInfo, options2);
          layoutInfo.temperature = layoutInfo.temperature * options2.coolingFactor;
          if (layoutInfo.temperature < options2.minTemp) {
            return false;
          }
          return true;
        }, "mainLoop");
        var done = /* @__PURE__ */ __name(function done2() {
          if (options2.animate === true || options2.animate === false) {
            refresh();
            layout7.one("layoutstop", options2.stop);
            layout7.emit({
              type: "layoutstop",
              layout: layout7
            });
          } else {
            var nodes5 = options2.eles.nodes();
            var getScaledPos = getScaleInBoundsFn(layoutInfo, options2, nodes5);
            nodes5.layoutPositions(layout7, options2, getScaledPos);
          }
        }, "done");
        var i2 = 0;
        var loopRet = true;
        if (options2.animate === true) {
          var _frame = /* @__PURE__ */ __name(function frame2() {
            var f2 = 0;
            while (loopRet && f2 < options2.refresh) {
              loopRet = mainLoop(i2);
              i2++;
              f2++;
            }
            if (!loopRet) {
              separateComponents(layoutInfo, options2);
              done();
            } else {
              var now3 = performanceNow();
              if (now3 - startTime >= options2.animationThreshold) {
                refresh();
              }
              requestAnimationFrame2(_frame);
            }
          }, "frame");
          _frame();
        } else {
          while (loopRet) {
            loopRet = mainLoop(i2);
            i2++;
          }
          separateComponents(layoutInfo, options2);
          done();
        }
        return this;
      };
      CoseLayout.prototype.stop = function() {
        this.stopped = true;
        if (this.thread) {
          this.thread.stop();
        }
        this.emit("layoutstop");
        return this;
      };
      CoseLayout.prototype.destroy = function() {
        if (this.thread) {
          this.thread.stop();
        }
        return this;
      };
      createLayoutInfo = /* @__PURE__ */ __name(function createLayoutInfo2(cy, layout7, options2) {
        var edges3 = options2.eles.edges();
        var nodes5 = options2.eles.nodes();
        var bb = makeBoundingBox(options2.boundingBox ? options2.boundingBox : {
          x1: 0,
          y1: 0,
          w: cy.width(),
          h: cy.height()
        });
        var layoutInfo = {
          isCompound: cy.hasCompoundNodes(),
          layoutNodes: [],
          idToIndex: {},
          nodeSize: nodes5.size(),
          graphSet: [],
          indexToGraph: [],
          layoutEdges: [],
          edgeSize: edges3.size(),
          temperature: options2.initialTemp,
          clientWidth: bb.w,
          clientHeight: bb.h,
          boundingBox: bb
        };
        var components3 = options2.eles.components();
        var id2cmptId = {};
        for (var i2 = 0; i2 < components3.length; i2++) {
          var component2 = components3[i2];
          for (var j3 = 0; j3 < component2.length; j3++) {
            var node2 = component2[j3];
            id2cmptId[node2.id()] = i2;
          }
        }
        for (var i2 = 0; i2 < layoutInfo.nodeSize; i2++) {
          var n2 = nodes5[i2];
          var nbb = n2.layoutDimensions(options2);
          var tempNode = {};
          tempNode.isLocked = n2.locked();
          tempNode.id = n2.data("id");
          tempNode.parentId = n2.data("parent");
          tempNode.cmptId = id2cmptId[n2.id()];
          tempNode.children = [];
          tempNode.positionX = n2.position("x");
          tempNode.positionY = n2.position("y");
          tempNode.offsetX = 0;
          tempNode.offsetY = 0;
          tempNode.height = nbb.w;
          tempNode.width = nbb.h;
          tempNode.maxX = tempNode.positionX + tempNode.width / 2;
          tempNode.minX = tempNode.positionX - tempNode.width / 2;
          tempNode.maxY = tempNode.positionY + tempNode.height / 2;
          tempNode.minY = tempNode.positionY - tempNode.height / 2;
          tempNode.padLeft = parseFloat(n2.style("padding"));
          tempNode.padRight = parseFloat(n2.style("padding"));
          tempNode.padTop = parseFloat(n2.style("padding"));
          tempNode.padBottom = parseFloat(n2.style("padding"));
          tempNode.nodeRepulsion = fn$6(options2.nodeRepulsion) ? options2.nodeRepulsion(n2) : options2.nodeRepulsion;
          layoutInfo.layoutNodes.push(tempNode);
          layoutInfo.idToIndex[tempNode.id] = i2;
        }
        var queue = [];
        var start3 = 0;
        var end2 = -1;
        var tempGraph = [];
        for (var i2 = 0; i2 < layoutInfo.nodeSize; i2++) {
          var n2 = layoutInfo.layoutNodes[i2];
          var p_id = n2.parentId;
          if (null != p_id) {
            layoutInfo.layoutNodes[layoutInfo.idToIndex[p_id]].children.push(n2.id);
          } else {
            queue[++end2] = n2.id;
            tempGraph.push(n2.id);
          }
        }
        layoutInfo.graphSet.push(tempGraph);
        while (start3 <= end2) {
          var node_id = queue[start3++];
          var node_ix = layoutInfo.idToIndex[node_id];
          var node2 = layoutInfo.layoutNodes[node_ix];
          var children2 = node2.children;
          if (children2.length > 0) {
            layoutInfo.graphSet.push(children2);
            for (var i2 = 0; i2 < children2.length; i2++) {
              queue[++end2] = children2[i2];
            }
          }
        }
        for (var i2 = 0; i2 < layoutInfo.graphSet.length; i2++) {
          var graph = layoutInfo.graphSet[i2];
          for (var j3 = 0; j3 < graph.length; j3++) {
            var index = layoutInfo.idToIndex[graph[j3]];
            layoutInfo.indexToGraph[index] = i2;
          }
        }
        for (var i2 = 0; i2 < layoutInfo.edgeSize; i2++) {
          var e3 = edges3[i2];
          var tempEdge = {};
          tempEdge.id = e3.data("id");
          tempEdge.sourceId = e3.data("source");
          tempEdge.targetId = e3.data("target");
          var idealLength = fn$6(options2.idealEdgeLength) ? options2.idealEdgeLength(e3) : options2.idealEdgeLength;
          var elasticity = fn$6(options2.edgeElasticity) ? options2.edgeElasticity(e3) : options2.edgeElasticity;
          var sourceIx = layoutInfo.idToIndex[tempEdge.sourceId];
          var targetIx = layoutInfo.idToIndex[tempEdge.targetId];
          var sourceGraph = layoutInfo.indexToGraph[sourceIx];
          var targetGraph = layoutInfo.indexToGraph[targetIx];
          if (sourceGraph != targetGraph) {
            var lca = findLCA(tempEdge.sourceId, tempEdge.targetId, layoutInfo);
            var lcaGraph = layoutInfo.graphSet[lca];
            var depth = 0;
            var tempNode = layoutInfo.layoutNodes[sourceIx];
            while (-1 === lcaGraph.indexOf(tempNode.id)) {
              tempNode = layoutInfo.layoutNodes[layoutInfo.idToIndex[tempNode.parentId]];
              depth++;
            }
            tempNode = layoutInfo.layoutNodes[targetIx];
            while (-1 === lcaGraph.indexOf(tempNode.id)) {
              tempNode = layoutInfo.layoutNodes[layoutInfo.idToIndex[tempNode.parentId]];
              depth++;
            }
            idealLength *= depth * options2.nestingFactor;
          }
          tempEdge.idealLength = idealLength;
          tempEdge.elasticity = elasticity;
          layoutInfo.layoutEdges.push(tempEdge);
        }
        return layoutInfo;
      }, "createLayoutInfo");
      findLCA = /* @__PURE__ */ __name(function findLCA2(node1, node2, layoutInfo) {
        var res = _findLCA_aux(node1, node2, 0, layoutInfo);
        if (2 > res.count) {
          return 0;
        } else {
          return res.graph;
        }
      }, "findLCA");
      _findLCA_aux = /* @__PURE__ */ __name(function findLCA_aux(node1, node2, graphIx, layoutInfo) {
        var graph = layoutInfo.graphSet[graphIx];
        if (-1 < graph.indexOf(node1) && -1 < graph.indexOf(node2)) {
          return {
            count: 2,
            graph: graphIx
          };
        }
        var c3 = 0;
        for (var i2 = 0; i2 < graph.length; i2++) {
          var nodeId = graph[i2];
          var nodeIx = layoutInfo.idToIndex[nodeId];
          var children2 = layoutInfo.layoutNodes[nodeIx].children;
          if (0 === children2.length) {
            continue;
          }
          var childGraphIx = layoutInfo.indexToGraph[layoutInfo.idToIndex[children2[0]]];
          var result = _findLCA_aux(node1, node2, childGraphIx, layoutInfo);
          if (0 === result.count) {
            continue;
          } else if (1 === result.count) {
            c3++;
            if (2 === c3) {
              break;
            }
          } else {
            return result;
          }
        }
        return {
          count: c3,
          graph: graphIx
        };
      }, "findLCA_aux");
      randomizePositions = /* @__PURE__ */ __name(function randomizePositions2(layoutInfo, cy) {
        var width3 = layoutInfo.clientWidth;
        var height2 = layoutInfo.clientHeight;
        for (var i2 = 0; i2 < layoutInfo.nodeSize; i2++) {
          var n2 = layoutInfo.layoutNodes[i2];
          if (0 === n2.children.length && !n2.isLocked) {
            n2.positionX = Math.random() * width3;
            n2.positionY = Math.random() * height2;
          }
        }
      }, "randomizePositions");
      getScaleInBoundsFn = /* @__PURE__ */ __name(function getScaleInBoundsFn2(layoutInfo, options2, nodes5) {
        var bb = layoutInfo.boundingBox;
        var coseBB = {
          x1: Infinity,
          x2: -Infinity,
          y1: Infinity,
          y2: -Infinity
        };
        if (options2.boundingBox) {
          nodes5.forEach(function(node2) {
            var lnode = layoutInfo.layoutNodes[layoutInfo.idToIndex[node2.data("id")]];
            coseBB.x1 = Math.min(coseBB.x1, lnode.positionX);
            coseBB.x2 = Math.max(coseBB.x2, lnode.positionX);
            coseBB.y1 = Math.min(coseBB.y1, lnode.positionY);
            coseBB.y2 = Math.max(coseBB.y2, lnode.positionY);
          });
          coseBB.w = coseBB.x2 - coseBB.x1;
          coseBB.h = coseBB.y2 - coseBB.y1;
        }
        return function(ele, i2) {
          var lnode = layoutInfo.layoutNodes[layoutInfo.idToIndex[ele.data("id")]];
          if (options2.boundingBox) {
            var pctX = coseBB.w === 0 ? 0.5 : (lnode.positionX - coseBB.x1) / coseBB.w;
            var pctY = coseBB.h === 0 ? 0.5 : (lnode.positionY - coseBB.y1) / coseBB.h;
            return {
              x: bb.x1 + pctX * bb.w,
              y: bb.y1 + pctY * bb.h
            };
          } else {
            return {
              x: lnode.positionX,
              y: lnode.positionY
            };
          }
        };
      }, "getScaleInBoundsFn");
      refreshPositions = /* @__PURE__ */ __name(function refreshPositions2(layoutInfo, cy, options2) {
        var layout7 = options2.layout;
        var nodes5 = options2.eles.nodes();
        var getScaledPos = getScaleInBoundsFn(layoutInfo, options2, nodes5);
        nodes5.positions(getScaledPos);
        if (true !== layoutInfo.ready) {
          layoutInfo.ready = true;
          layout7.one("layoutready", options2.ready);
          layout7.emit({
            type: "layoutready",
            layout: this
          });
        }
      }, "refreshPositions");
      step = /* @__PURE__ */ __name(function step2(layoutInfo, options2, _step) {
        calculateNodeForces(layoutInfo, options2);
        calculateEdgeForces(layoutInfo);
        calculateGravityForces(layoutInfo, options2);
        propagateForces(layoutInfo);
        updatePositions(layoutInfo);
      }, "step");
      calculateNodeForces = /* @__PURE__ */ __name(function calculateNodeForces2(layoutInfo, options2) {
        for (var i2 = 0; i2 < layoutInfo.graphSet.length; i2++) {
          var graph = layoutInfo.graphSet[i2];
          var numNodes = graph.length;
          for (var j3 = 0; j3 < numNodes; j3++) {
            var node1 = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[j3]]];
            for (var k2 = j3 + 1; k2 < numNodes; k2++) {
              var node2 = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[k2]]];
              nodeRepulsion2(node1, node2, layoutInfo, options2);
            }
          }
        }
      }, "calculateNodeForces");
      randomDistance = /* @__PURE__ */ __name(function randomDistance2(max10) {
        return -1 + 2 * max10 * Math.random();
      }, "randomDistance");
      nodeRepulsion2 = /* @__PURE__ */ __name(function nodeRepulsion3(node1, node2, layoutInfo, options2) {
        var cmptId1 = node1.cmptId;
        var cmptId2 = node2.cmptId;
        if (cmptId1 !== cmptId2 && !layoutInfo.isCompound) {
          return;
        }
        var directionX = node2.positionX - node1.positionX;
        var directionY = node2.positionY - node1.positionY;
        var maxRandDist = 1;
        if (0 === directionX && 0 === directionY) {
          directionX = randomDistance(maxRandDist);
          directionY = randomDistance(maxRandDist);
        }
        var overlap = nodesOverlap(node1, node2, directionX, directionY);
        if (overlap > 0) {
          var force = options2.nodeOverlap * overlap;
          var distance3 = Math.sqrt(directionX * directionX + directionY * directionY);
          var forceX = force * directionX / distance3;
          var forceY = force * directionY / distance3;
        } else {
          var point1 = findClippingPoint(node1, directionX, directionY);
          var point22 = findClippingPoint(node2, -1 * directionX, -1 * directionY);
          var distanceX = point22.x - point1.x;
          var distanceY = point22.y - point1.y;
          var distanceSqr = distanceX * distanceX + distanceY * distanceY;
          var distance3 = Math.sqrt(distanceSqr);
          var force = (node1.nodeRepulsion + node2.nodeRepulsion) / distanceSqr;
          var forceX = force * distanceX / distance3;
          var forceY = force * distanceY / distance3;
        }
        if (!node1.isLocked) {
          node1.offsetX -= forceX;
          node1.offsetY -= forceY;
        }
        if (!node2.isLocked) {
          node2.offsetX += forceX;
          node2.offsetY += forceY;
        }
        return;
      }, "nodeRepulsion");
      nodesOverlap = /* @__PURE__ */ __name(function nodesOverlap2(node1, node2, dX, dY) {
        if (dX > 0) {
          var overlapX = node1.maxX - node2.minX;
        } else {
          var overlapX = node2.maxX - node1.minX;
        }
        if (dY > 0) {
          var overlapY = node1.maxY - node2.minY;
        } else {
          var overlapY = node2.maxY - node1.minY;
        }
        if (overlapX >= 0 && overlapY >= 0) {
          return Math.sqrt(overlapX * overlapX + overlapY * overlapY);
        } else {
          return 0;
        }
      }, "nodesOverlap");
      findClippingPoint = /* @__PURE__ */ __name(function findClippingPoint2(node2, dX, dY) {
        var X4 = node2.positionX;
        var Y3 = node2.positionY;
        var H2 = node2.height || 1;
        var W3 = node2.width || 1;
        var dirSlope = dY / dX;
        var nodeSlope = H2 / W3;
        var res = {};
        if (0 === dX && 0 < dY) {
          res.x = X4;
          res.y = Y3 + H2 / 2;
          return res;
        }
        if (0 === dX && 0 > dY) {
          res.x = X4;
          res.y = Y3 + H2 / 2;
          return res;
        }
        if (0 < dX && -1 * nodeSlope <= dirSlope && dirSlope <= nodeSlope) {
          res.x = X4 + W3 / 2;
          res.y = Y3 + W3 * dY / 2 / dX;
          return res;
        }
        if (0 > dX && -1 * nodeSlope <= dirSlope && dirSlope <= nodeSlope) {
          res.x = X4 - W3 / 2;
          res.y = Y3 - W3 * dY / 2 / dX;
          return res;
        }
        if (0 < dY && (dirSlope <= -1 * nodeSlope || dirSlope >= nodeSlope)) {
          res.x = X4 + H2 * dX / 2 / dY;
          res.y = Y3 + H2 / 2;
          return res;
        }
        if (0 > dY && (dirSlope <= -1 * nodeSlope || dirSlope >= nodeSlope)) {
          res.x = X4 - H2 * dX / 2 / dY;
          res.y = Y3 - H2 / 2;
          return res;
        }
        return res;
      }, "findClippingPoint");
      calculateEdgeForces = /* @__PURE__ */ __name(function calculateEdgeForces2(layoutInfo, options2) {
        for (var i2 = 0; i2 < layoutInfo.edgeSize; i2++) {
          var edge = layoutInfo.layoutEdges[i2];
          var sourceIx = layoutInfo.idToIndex[edge.sourceId];
          var source = layoutInfo.layoutNodes[sourceIx];
          var targetIx = layoutInfo.idToIndex[edge.targetId];
          var target = layoutInfo.layoutNodes[targetIx];
          var directionX = target.positionX - source.positionX;
          var directionY = target.positionY - source.positionY;
          if (0 === directionX && 0 === directionY) {
            continue;
          }
          var point1 = findClippingPoint(source, directionX, directionY);
          var point22 = findClippingPoint(target, -1 * directionX, -1 * directionY);
          var lx = point22.x - point1.x;
          var ly = point22.y - point1.y;
          var l4 = Math.sqrt(lx * lx + ly * ly);
          var force = Math.pow(edge.idealLength - l4, 2) / edge.elasticity;
          if (0 !== l4) {
            var forceX = force * lx / l4;
            var forceY = force * ly / l4;
          } else {
            var forceX = 0;
            var forceY = 0;
          }
          if (!source.isLocked) {
            source.offsetX += forceX;
            source.offsetY += forceY;
          }
          if (!target.isLocked) {
            target.offsetX -= forceX;
            target.offsetY -= forceY;
          }
        }
      }, "calculateEdgeForces");
      calculateGravityForces = /* @__PURE__ */ __name(function calculateGravityForces2(layoutInfo, options2) {
        if (options2.gravity === 0) {
          return;
        }
        var distThreshold = 1;
        for (var i2 = 0; i2 < layoutInfo.graphSet.length; i2++) {
          var graph = layoutInfo.graphSet[i2];
          var numNodes = graph.length;
          if (0 === i2) {
            var centerX = layoutInfo.clientHeight / 2;
            var centerY = layoutInfo.clientWidth / 2;
          } else {
            var temp = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[0]]];
            var parent4 = layoutInfo.layoutNodes[layoutInfo.idToIndex[temp.parentId]];
            var centerX = parent4.positionX;
            var centerY = parent4.positionY;
          }
          for (var j3 = 0; j3 < numNodes; j3++) {
            var node2 = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[j3]]];
            if (node2.isLocked) {
              continue;
            }
            var dx = centerX - node2.positionX;
            var dy = centerY - node2.positionY;
            var d3 = Math.sqrt(dx * dx + dy * dy);
            if (d3 > distThreshold) {
              var fx = options2.gravity * dx / d3;
              var fy = options2.gravity * dy / d3;
              node2.offsetX += fx;
              node2.offsetY += fy;
            }
          }
        }
      }, "calculateGravityForces");
      propagateForces = /* @__PURE__ */ __name(function propagateForces2(layoutInfo, options2) {
        var queue = [];
        var start3 = 0;
        var end2 = -1;
        queue.push.apply(queue, layoutInfo.graphSet[0]);
        end2 += layoutInfo.graphSet[0].length;
        while (start3 <= end2) {
          var nodeId = queue[start3++];
          var nodeIndex = layoutInfo.idToIndex[nodeId];
          var node2 = layoutInfo.layoutNodes[nodeIndex];
          var children2 = node2.children;
          if (0 < children2.length && !node2.isLocked) {
            var offX = node2.offsetX;
            var offY = node2.offsetY;
            for (var i2 = 0; i2 < children2.length; i2++) {
              var childNode = layoutInfo.layoutNodes[layoutInfo.idToIndex[children2[i2]]];
              childNode.offsetX += offX;
              childNode.offsetY += offY;
              queue[++end2] = children2[i2];
            }
            node2.offsetX = 0;
            node2.offsetY = 0;
          }
        }
      }, "propagateForces");
      updatePositions = /* @__PURE__ */ __name(function updatePositions2(layoutInfo, options2) {
        for (var i2 = 0; i2 < layoutInfo.nodeSize; i2++) {
          var n2 = layoutInfo.layoutNodes[i2];
          if (0 < n2.children.length) {
            n2.maxX = void 0;
            n2.minX = void 0;
            n2.maxY = void 0;
            n2.minY = void 0;
          }
        }
        for (var i2 = 0; i2 < layoutInfo.nodeSize; i2++) {
          var n2 = layoutInfo.layoutNodes[i2];
          if (0 < n2.children.length || n2.isLocked) {
            continue;
          }
          var tempForce = limitForce(n2.offsetX, n2.offsetY, layoutInfo.temperature);
          n2.positionX += tempForce.x;
          n2.positionY += tempForce.y;
          n2.offsetX = 0;
          n2.offsetY = 0;
          n2.minX = n2.positionX - n2.width;
          n2.maxX = n2.positionX + n2.width;
          n2.minY = n2.positionY - n2.height;
          n2.maxY = n2.positionY + n2.height;
          _updateAncestryBoundaries(n2, layoutInfo);
        }
        for (var i2 = 0; i2 < layoutInfo.nodeSize; i2++) {
          var n2 = layoutInfo.layoutNodes[i2];
          if (0 < n2.children.length && !n2.isLocked) {
            n2.positionX = (n2.maxX + n2.minX) / 2;
            n2.positionY = (n2.maxY + n2.minY) / 2;
            n2.width = n2.maxX - n2.minX;
            n2.height = n2.maxY - n2.minY;
          }
        }
      }, "updatePositions");
      limitForce = /* @__PURE__ */ __name(function limitForce2(forceX, forceY, max10) {
        var force = Math.sqrt(forceX * forceX + forceY * forceY);
        if (force > max10) {
          var res = {
            x: max10 * forceX / force,
            y: max10 * forceY / force
          };
        } else {
          var res = {
            x: forceX,
            y: forceY
          };
        }
        return res;
      }, "limitForce");
      _updateAncestryBoundaries = /* @__PURE__ */ __name(function updateAncestryBoundaries(node2, layoutInfo) {
        var parentId = node2.parentId;
        if (null == parentId) {
          return;
        }
        var p3 = layoutInfo.layoutNodes[layoutInfo.idToIndex[parentId]];
        var flag = false;
        if (null == p3.maxX || node2.maxX + p3.padRight > p3.maxX) {
          p3.maxX = node2.maxX + p3.padRight;
          flag = true;
        }
        if (null == p3.minX || node2.minX - p3.padLeft < p3.minX) {
          p3.minX = node2.minX - p3.padLeft;
          flag = true;
        }
        if (null == p3.maxY || node2.maxY + p3.padBottom > p3.maxY) {
          p3.maxY = node2.maxY + p3.padBottom;
          flag = true;
        }
        if (null == p3.minY || node2.minY - p3.padTop < p3.minY) {
          p3.minY = node2.minY - p3.padTop;
          flag = true;
        }
        if (flag) {
          return _updateAncestryBoundaries(p3, layoutInfo);
        }
        return;
      }, "updateAncestryBoundaries");
      separateComponents = /* @__PURE__ */ __name(function separateComponents2(layoutInfo, options2) {
        var nodes5 = layoutInfo.layoutNodes;
        var components3 = [];
        for (var i2 = 0; i2 < nodes5.length; i2++) {
          var node2 = nodes5[i2];
          var cid = node2.cmptId;
          var component2 = components3[cid] = components3[cid] || [];
          component2.push(node2);
        }
        var totalA = 0;
        for (var i2 = 0; i2 < components3.length; i2++) {
          var c3 = components3[i2];
          if (!c3) {
            continue;
          }
          c3.x1 = Infinity;
          c3.x2 = -Infinity;
          c3.y1 = Infinity;
          c3.y2 = -Infinity;
          for (var j3 = 0; j3 < c3.length; j3++) {
            var n2 = c3[j3];
            c3.x1 = Math.min(c3.x1, n2.positionX - n2.width / 2);
            c3.x2 = Math.max(c3.x2, n2.positionX + n2.width / 2);
            c3.y1 = Math.min(c3.y1, n2.positionY - n2.height / 2);
            c3.y2 = Math.max(c3.y2, n2.positionY + n2.height / 2);
          }
          c3.w = c3.x2 - c3.x1;
          c3.h = c3.y2 - c3.y1;
          totalA += c3.w * c3.h;
        }
        components3.sort(function(c1, c22) {
          return c22.w * c22.h - c1.w * c1.h;
        });
        var x5 = 0;
        var y6 = 0;
        var usedW = 0;
        var rowH = 0;
        var maxRowW = Math.sqrt(totalA) * layoutInfo.clientWidth / layoutInfo.clientHeight;
        for (var i2 = 0; i2 < components3.length; i2++) {
          var c3 = components3[i2];
          if (!c3) {
            continue;
          }
          for (var j3 = 0; j3 < c3.length; j3++) {
            var n2 = c3[j3];
            if (!n2.isLocked) {
              n2.positionX += x5 - c3.x1;
              n2.positionY += y6 - c3.y1;
            }
          }
          x5 += c3.w + options2.componentSpacing;
          usedW += c3.w + options2.componentSpacing;
          rowH = Math.max(rowH, c3.h);
          if (usedW > maxRowW) {
            y6 += rowH + options2.componentSpacing;
            x5 = 0;
            usedW = 0;
            rowH = 0;
          }
        }
      }, "separateComponents");
      defaults$3 = {
        fit: true,
        // whether to fit the viewport to the graph
        padding: 30,
        // padding used on fit
        boundingBox: void 0,
        // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
        avoidOverlap: true,
        // prevents node overlap, may overflow boundingBox if not enough space
        avoidOverlapPadding: 10,
        // extra spacing around nodes when avoidOverlap: true
        nodeDimensionsIncludeLabels: false,
        // Excludes the label when calculating node bounding boxes for the layout algorithm
        spacingFactor: void 0,
        // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
        condense: false,
        // uses all available space on false, uses minimal space on true
        rows: void 0,
        // force num of rows in the grid
        cols: void 0,
        // force num of columns in the grid
        position: /* @__PURE__ */ __name(function position3(node2) {
        }, "position"),
        // returns { row, col } for element
        sort: void 0,
        // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
        animate: false,
        // whether to transition the node positions
        animationDuration: 500,
        // duration of animation in ms if enabled
        animationEasing: void 0,
        // easing of animation if enabled
        animateFilter: /* @__PURE__ */ __name(function animateFilter5(node2, i2) {
          return true;
        }, "animateFilter"),
        // a function that determines whether the node should be animated.  All nodes animated by default on animate enabled.  Non-animated nodes are positioned immediately when the layout starts
        ready: void 0,
        // callback on layoutready
        stop: void 0,
        // callback on layoutstop
        transform: /* @__PURE__ */ __name(function transform5(node2, position5) {
          return position5;
        }, "transform")
        // transform a given node position. Useful for changing flow direction in discrete layouts 
      };
      __name(GridLayout, "GridLayout");
      GridLayout.prototype.run = function() {
        var params = this.options;
        var options2 = params;
        var cy = params.cy;
        var eles = options2.eles;
        var nodes5 = eles.nodes().not(":parent");
        if (options2.sort) {
          nodes5 = nodes5.sort(options2.sort);
        }
        var bb = makeBoundingBox(options2.boundingBox ? options2.boundingBox : {
          x1: 0,
          y1: 0,
          w: cy.width(),
          h: cy.height()
        });
        if (bb.h === 0 || bb.w === 0) {
          eles.nodes().layoutPositions(this, options2, function(ele) {
            return {
              x: bb.x1,
              y: bb.y1
            };
          });
        } else {
          var cells = nodes5.size();
          var splits = Math.sqrt(cells * bb.h / bb.w);
          var rows = Math.round(splits);
          var cols = Math.round(bb.w / bb.h * splits);
          var small = /* @__PURE__ */ __name(function small2(val) {
            if (val == null) {
              return Math.min(rows, cols);
            } else {
              var min9 = Math.min(rows, cols);
              if (min9 == rows) {
                rows = val;
              } else {
                cols = val;
              }
            }
          }, "small");
          var large = /* @__PURE__ */ __name(function large2(val) {
            if (val == null) {
              return Math.max(rows, cols);
            } else {
              var max10 = Math.max(rows, cols);
              if (max10 == rows) {
                rows = val;
              } else {
                cols = val;
              }
            }
          }, "large");
          var oRows = options2.rows;
          var oCols = options2.cols != null ? options2.cols : options2.columns;
          if (oRows != null && oCols != null) {
            rows = oRows;
            cols = oCols;
          } else if (oRows != null && oCols == null) {
            rows = oRows;
            cols = Math.ceil(cells / rows);
          } else if (oRows == null && oCols != null) {
            cols = oCols;
            rows = Math.ceil(cells / cols);
          } else if (cols * rows > cells) {
            var sm = small();
            var lg = large();
            if ((sm - 1) * lg >= cells) {
              small(sm - 1);
            } else if ((lg - 1) * sm >= cells) {
              large(lg - 1);
            }
          } else {
            while (cols * rows < cells) {
              var _sm = small();
              var _lg = large();
              if ((_lg + 1) * _sm >= cells) {
                large(_lg + 1);
              } else {
                small(_sm + 1);
              }
            }
          }
          var cellWidth = bb.w / cols;
          var cellHeight = bb.h / rows;
          if (options2.condense) {
            cellWidth = 0;
            cellHeight = 0;
          }
          if (options2.avoidOverlap) {
            for (var i2 = 0; i2 < nodes5.length; i2++) {
              var node2 = nodes5[i2];
              var pos = node2._private.position;
              if (pos.x == null || pos.y == null) {
                pos.x = 0;
                pos.y = 0;
              }
              var nbb = node2.layoutDimensions(options2);
              var p3 = options2.avoidOverlapPadding;
              var w4 = nbb.w + p3;
              var h3 = nbb.h + p3;
              cellWidth = Math.max(cellWidth, w4);
              cellHeight = Math.max(cellHeight, h3);
            }
          }
          var cellUsed = {};
          var used = /* @__PURE__ */ __name(function used2(row2, col2) {
            return cellUsed["c-" + row2 + "-" + col2] ? true : false;
          }, "used");
          var use = /* @__PURE__ */ __name(function use2(row2, col2) {
            cellUsed["c-" + row2 + "-" + col2] = true;
          }, "use");
          var row = 0;
          var col = 0;
          var moveToNextCell = /* @__PURE__ */ __name(function moveToNextCell2() {
            col++;
            if (col >= cols) {
              col = 0;
              row++;
            }
          }, "moveToNextCell");
          var id2manPos = {};
          for (var _i = 0; _i < nodes5.length; _i++) {
            var _node = nodes5[_i];
            var rcPos = options2.position(_node);
            if (rcPos && (rcPos.row !== void 0 || rcPos.col !== void 0)) {
              var _pos = {
                row: rcPos.row,
                col: rcPos.col
              };
              if (_pos.col === void 0) {
                _pos.col = 0;
                while (used(_pos.row, _pos.col)) {
                  _pos.col++;
                }
              } else if (_pos.row === void 0) {
                _pos.row = 0;
                while (used(_pos.row, _pos.col)) {
                  _pos.row++;
                }
              }
              id2manPos[_node.id()] = _pos;
              use(_pos.row, _pos.col);
            }
          }
          var getPos = /* @__PURE__ */ __name(function getPos2(element3, i3) {
            var x5, y6;
            if (element3.locked() || element3.isParent()) {
              return false;
            }
            var rcPos2 = id2manPos[element3.id()];
            if (rcPos2) {
              x5 = rcPos2.col * cellWidth + cellWidth / 2 + bb.x1;
              y6 = rcPos2.row * cellHeight + cellHeight / 2 + bb.y1;
            } else {
              while (used(row, col)) {
                moveToNextCell();
              }
              x5 = col * cellWidth + cellWidth / 2 + bb.x1;
              y6 = row * cellHeight + cellHeight / 2 + bb.y1;
              use(row, col);
              moveToNextCell();
            }
            return {
              x: x5,
              y: y6
            };
          }, "getPos");
          nodes5.layoutPositions(this, options2, getPos);
        }
        return this;
      };
      defaults$2 = {
        ready: /* @__PURE__ */ __name(function ready3() {
        }, "ready"),
        // on layoutready
        stop: /* @__PURE__ */ __name(function stop4() {
        }, "stop")
        // on layoutstop
      };
      __name(NullLayout, "NullLayout");
      NullLayout.prototype.run = function() {
        var options2 = this.options;
        var eles = options2.eles;
        var layout7 = this;
        options2.cy;
        layout7.emit("layoutstart");
        eles.nodes().positions(function() {
          return {
            x: 0,
            y: 0
          };
        });
        layout7.one("layoutready", options2.ready);
        layout7.emit("layoutready");
        layout7.one("layoutstop", options2.stop);
        layout7.emit("layoutstop");
        return this;
      };
      NullLayout.prototype.stop = function() {
        return this;
      };
      defaults$1 = {
        positions: void 0,
        // map of (node id) => (position obj); or function(node){ return somPos; }
        zoom: void 0,
        // the zoom level to set (prob want fit = false if set)
        pan: void 0,
        // the pan level to set (prob want fit = false if set)
        fit: true,
        // whether to fit to viewport
        padding: 30,
        // padding on fit
        spacingFactor: void 0,
        // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
        animate: false,
        // whether to transition the node positions
        animationDuration: 500,
        // duration of animation in ms if enabled
        animationEasing: void 0,
        // easing of animation if enabled
        animateFilter: /* @__PURE__ */ __name(function animateFilter6(node2, i2) {
          return true;
        }, "animateFilter"),
        // a function that determines whether the node should be animated.  All nodes animated by default on animate enabled.  Non-animated nodes are positioned immediately when the layout starts
        ready: void 0,
        // callback on layoutready
        stop: void 0,
        // callback on layoutstop
        transform: /* @__PURE__ */ __name(function transform6(node2, position5) {
          return position5;
        }, "transform")
        // transform a given node position. Useful for changing flow direction in discrete layouts
      };
      __name(PresetLayout, "PresetLayout");
      PresetLayout.prototype.run = function() {
        var options2 = this.options;
        var eles = options2.eles;
        var nodes5 = eles.nodes();
        var posIsFn = fn$6(options2.positions);
        function getPosition(node2) {
          if (options2.positions == null) {
            return copyPosition(node2.position());
          }
          if (posIsFn) {
            return options2.positions(node2);
          }
          var pos = options2.positions[node2._private.data.id];
          if (pos == null) {
            return null;
          }
          return pos;
        }
        __name(getPosition, "getPosition");
        nodes5.layoutPositions(this, options2, function(node2, i2) {
          var position5 = getPosition(node2);
          if (node2.locked() || position5 == null) {
            return false;
          }
          return position5;
        });
        return this;
      };
      defaults3 = {
        fit: true,
        // whether to fit to viewport
        padding: 30,
        // fit padding
        boundingBox: void 0,
        // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
        animate: false,
        // whether to transition the node positions
        animationDuration: 500,
        // duration of animation in ms if enabled
        animationEasing: void 0,
        // easing of animation if enabled
        animateFilter: /* @__PURE__ */ __name(function animateFilter7(node2, i2) {
          return true;
        }, "animateFilter"),
        // a function that determines whether the node should be animated.  All nodes animated by default on animate enabled.  Non-animated nodes are positioned immediately when the layout starts
        ready: void 0,
        // callback on layoutready
        stop: void 0,
        // callback on layoutstop
        transform: /* @__PURE__ */ __name(function transform7(node2, position5) {
          return position5;
        }, "transform")
        // transform a given node position. Useful for changing flow direction in discrete layouts 
      };
      __name(RandomLayout, "RandomLayout");
      RandomLayout.prototype.run = function() {
        var options2 = this.options;
        var cy = options2.cy;
        var eles = options2.eles;
        var bb = makeBoundingBox(options2.boundingBox ? options2.boundingBox : {
          x1: 0,
          y1: 0,
          w: cy.width(),
          h: cy.height()
        });
        var getPos = /* @__PURE__ */ __name(function getPos2(node2, i2) {
          return {
            x: bb.x1 + Math.round(Math.random() * bb.w),
            y: bb.y1 + Math.round(Math.random() * bb.h)
          };
        }, "getPos");
        eles.nodes().layoutPositions(this, options2, getPos);
        return this;
      };
      layout4 = [{
        name: "breadthfirst",
        impl: BreadthFirstLayout
      }, {
        name: "circle",
        impl: CircleLayout
      }, {
        name: "concentric",
        impl: ConcentricLayout
      }, {
        name: "cose",
        impl: CoseLayout
      }, {
        name: "grid",
        impl: GridLayout
      }, {
        name: "null",
        impl: NullLayout
      }, {
        name: "preset",
        impl: PresetLayout
      }, {
        name: "random",
        impl: RandomLayout
      }];
      __name(NullRenderer, "NullRenderer");
      noop4 = /* @__PURE__ */ __name(function noop5() {
      }, "noop");
      throwImgErr = /* @__PURE__ */ __name(function throwImgErr2() {
        throw new Error("A headless instance can not render images");
      }, "throwImgErr");
      NullRenderer.prototype = {
        recalculateRenderedStyle: noop4,
        notify: /* @__PURE__ */ __name(function notify2() {
          this.notifications++;
        }, "notify"),
        init: noop4,
        isHeadless: /* @__PURE__ */ __name(function isHeadless() {
          return true;
        }, "isHeadless"),
        png: throwImgErr,
        jpg: throwImgErr
      };
      BRp$f = {};
      BRp$f.arrowShapeWidth = 0.3;
      BRp$f.registerArrowShapes = function() {
        var arrowShapes = this.arrowShapes = {};
        var renderer13 = this;
        var bbCollide = /* @__PURE__ */ __name(function bbCollide2(x5, y6, size4, angle2, translation, edgeWidth, padding2) {
          var x1 = translation.x - size4 / 2 - padding2;
          var x22 = translation.x + size4 / 2 + padding2;
          var y1 = translation.y - size4 / 2 - padding2;
          var y22 = translation.y + size4 / 2 + padding2;
          var inside = x1 <= x5 && x5 <= x22 && y1 <= y6 && y6 <= y22;
          return inside;
        }, "bbCollide");
        var transform8 = /* @__PURE__ */ __name(function transform9(x5, y6, size4, angle2, translation) {
          var xRotated = x5 * Math.cos(angle2) - y6 * Math.sin(angle2);
          var yRotated = x5 * Math.sin(angle2) + y6 * Math.cos(angle2);
          var xScaled = xRotated * size4;
          var yScaled = yRotated * size4;
          var xTranslated = xScaled + translation.x;
          var yTranslated = yScaled + translation.y;
          return {
            x: xTranslated,
            y: yTranslated
          };
        }, "transform");
        var transformPoints3 = /* @__PURE__ */ __name(function transformPoints4(pts2, size4, angle2, translation) {
          var retPts = [];
          for (var i2 = 0; i2 < pts2.length; i2 += 2) {
            var x5 = pts2[i2];
            var y6 = pts2[i2 + 1];
            retPts.push(transform8(x5, y6, size4, angle2, translation));
          }
          return retPts;
        }, "transformPoints");
        var pointsToArr = /* @__PURE__ */ __name(function pointsToArr2(pts2) {
          var ret = [];
          for (var i2 = 0; i2 < pts2.length; i2++) {
            var p3 = pts2[i2];
            ret.push(p3.x, p3.y);
          }
          return ret;
        }, "pointsToArr");
        var standardGap = /* @__PURE__ */ __name(function standardGap2(edge) {
          return edge.pstyle("width").pfValue * edge.pstyle("arrow-scale").pfValue * 2;
        }, "standardGap");
        var defineArrowShape = /* @__PURE__ */ __name(function defineArrowShape2(name, defn) {
          if (string(defn)) {
            defn = arrowShapes[defn];
          }
          arrowShapes[name] = extend4({
            name,
            points: [-0.15, -0.3, 0.15, -0.3, 0.15, 0.3, -0.15, 0.3],
            collide: /* @__PURE__ */ __name(function collide(x5, y6, size4, angle2, translation, padding2) {
              var points = pointsToArr(transformPoints3(this.points, size4 + 2 * padding2, angle2, translation));
              var inside = pointInsidePolygonPoints(x5, y6, points);
              return inside;
            }, "collide"),
            roughCollide: bbCollide,
            draw: /* @__PURE__ */ __name(function draw31(context, size4, angle2, translation) {
              var points = transformPoints3(this.points, size4, angle2, translation);
              renderer13.arrowShapeImpl("polygon")(context, points);
            }, "draw"),
            spacing: /* @__PURE__ */ __name(function spacing2(edge) {
              return 0;
            }, "spacing"),
            gap: standardGap
          }, defn);
        }, "defineArrowShape");
        defineArrowShape("none", {
          collide: falsify,
          roughCollide: falsify,
          draw: noop$1,
          spacing: zeroify,
          gap: zeroify
        });
        defineArrowShape("triangle", {
          points: [-0.15, -0.3, 0, 0, 0.15, -0.3]
        });
        defineArrowShape("arrow", "triangle");
        defineArrowShape("triangle-backcurve", {
          points: arrowShapes["triangle"].points,
          controlPoint: [0, -0.15],
          roughCollide: bbCollide,
          draw: /* @__PURE__ */ __name(function draw31(context, size4, angle2, translation, edgeWidth) {
            var ptsTrans = transformPoints3(this.points, size4, angle2, translation);
            var ctrlPt = this.controlPoint;
            var ctrlPtTrans = transform8(ctrlPt[0], ctrlPt[1], size4, angle2, translation);
            renderer13.arrowShapeImpl(this.name)(context, ptsTrans, ctrlPtTrans);
          }, "draw"),
          gap: /* @__PURE__ */ __name(function gap(edge) {
            return standardGap(edge) * 0.8;
          }, "gap")
        });
        defineArrowShape("triangle-tee", {
          points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0],
          pointsTee: [-0.15, -0.4, -0.15, -0.5, 0.15, -0.5, 0.15, -0.4],
          collide: /* @__PURE__ */ __name(function collide(x5, y6, size4, angle2, translation, edgeWidth, padding2) {
            var triPts = pointsToArr(transformPoints3(this.points, size4 + 2 * padding2, angle2, translation));
            var teePts = pointsToArr(transformPoints3(this.pointsTee, size4 + 2 * padding2, angle2, translation));
            var inside = pointInsidePolygonPoints(x5, y6, triPts) || pointInsidePolygonPoints(x5, y6, teePts);
            return inside;
          }, "collide"),
          draw: /* @__PURE__ */ __name(function draw31(context, size4, angle2, translation, edgeWidth) {
            var triPts = transformPoints3(this.points, size4, angle2, translation);
            var teePts = transformPoints3(this.pointsTee, size4, angle2, translation);
            renderer13.arrowShapeImpl(this.name)(context, triPts, teePts);
          }, "draw")
        });
        defineArrowShape("circle-triangle", {
          radius: 0.15,
          pointsTr: [0, -0.15, 0.15, -0.45, -0.15, -0.45, 0, -0.15],
          collide: /* @__PURE__ */ __name(function collide(x5, y6, size4, angle2, translation, edgeWidth, padding2) {
            var t4 = translation;
            var circleInside = Math.pow(t4.x - x5, 2) + Math.pow(t4.y - y6, 2) <= Math.pow((size4 + 2 * padding2) * this.radius, 2);
            var triPts = pointsToArr(transformPoints3(this.points, size4 + 2 * padding2, angle2, translation));
            return pointInsidePolygonPoints(x5, y6, triPts) || circleInside;
          }, "collide"),
          draw: /* @__PURE__ */ __name(function draw31(context, size4, angle2, translation, edgeWidth) {
            var triPts = transformPoints3(this.pointsTr, size4, angle2, translation);
            renderer13.arrowShapeImpl(this.name)(context, triPts, translation.x, translation.y, this.radius * size4);
          }, "draw"),
          spacing: /* @__PURE__ */ __name(function spacing2(edge) {
            return renderer13.getArrowWidth(edge.pstyle("width").pfValue, edge.pstyle("arrow-scale").value) * this.radius;
          }, "spacing")
        });
        defineArrowShape("triangle-cross", {
          points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0],
          baseCrossLinePts: [
            -0.15,
            -0.4,
            // first half of the rectangle
            -0.15,
            -0.4,
            0.15,
            -0.4,
            // second half of the rectangle
            0.15,
            -0.4
          ],
          crossLinePts: /* @__PURE__ */ __name(function crossLinePts(size4, edgeWidth) {
            var p3 = this.baseCrossLinePts.slice();
            var shiftFactor = edgeWidth / size4;
            var y0 = 3;
            var y1 = 5;
            p3[y0] = p3[y0] - shiftFactor;
            p3[y1] = p3[y1] - shiftFactor;
            return p3;
          }, "crossLinePts"),
          collide: /* @__PURE__ */ __name(function collide(x5, y6, size4, angle2, translation, edgeWidth, padding2) {
            var triPts = pointsToArr(transformPoints3(this.points, size4 + 2 * padding2, angle2, translation));
            var teePts = pointsToArr(transformPoints3(this.crossLinePts(size4, edgeWidth), size4 + 2 * padding2, angle2, translation));
            var inside = pointInsidePolygonPoints(x5, y6, triPts) || pointInsidePolygonPoints(x5, y6, teePts);
            return inside;
          }, "collide"),
          draw: /* @__PURE__ */ __name(function draw31(context, size4, angle2, translation, edgeWidth) {
            var triPts = transformPoints3(this.points, size4, angle2, translation);
            var crossLinePts = transformPoints3(this.crossLinePts(size4, edgeWidth), size4, angle2, translation);
            renderer13.arrowShapeImpl(this.name)(context, triPts, crossLinePts);
          }, "draw")
        });
        defineArrowShape("vee", {
          points: [-0.15, -0.3, 0, 0, 0.15, -0.3, 0, -0.15],
          gap: /* @__PURE__ */ __name(function gap(edge) {
            return standardGap(edge) * 0.525;
          }, "gap")
        });
        defineArrowShape("circle", {
          radius: 0.15,
          collide: /* @__PURE__ */ __name(function collide(x5, y6, size4, angle2, translation, edgeWidth, padding2) {
            var t4 = translation;
            var inside = Math.pow(t4.x - x5, 2) + Math.pow(t4.y - y6, 2) <= Math.pow((size4 + 2 * padding2) * this.radius, 2);
            return inside;
          }, "collide"),
          draw: /* @__PURE__ */ __name(function draw31(context, size4, angle2, translation, edgeWidth) {
            renderer13.arrowShapeImpl(this.name)(context, translation.x, translation.y, this.radius * size4);
          }, "draw"),
          spacing: /* @__PURE__ */ __name(function spacing2(edge) {
            return renderer13.getArrowWidth(edge.pstyle("width").pfValue, edge.pstyle("arrow-scale").value) * this.radius;
          }, "spacing")
        });
        defineArrowShape("tee", {
          points: [-0.15, 0, -0.15, -0.1, 0.15, -0.1, 0.15, 0],
          spacing: /* @__PURE__ */ __name(function spacing2(edge) {
            return 1;
          }, "spacing"),
          gap: /* @__PURE__ */ __name(function gap(edge) {
            return 1;
          }, "gap")
        });
        defineArrowShape("square", {
          points: [-0.15, 0, 0.15, 0, 0.15, -0.3, -0.15, -0.3]
        });
        defineArrowShape("diamond", {
          points: [-0.15, -0.15, 0, -0.3, 0.15, -0.15, 0, 0],
          gap: /* @__PURE__ */ __name(function gap(edge) {
            return edge.pstyle("width").pfValue * edge.pstyle("arrow-scale").value;
          }, "gap")
        });
        defineArrowShape("chevron", {
          points: [0, 0, -0.15, -0.15, -0.1, -0.2, 0, -0.1, 0.1, -0.2, 0.15, -0.15],
          gap: /* @__PURE__ */ __name(function gap(edge) {
            return 0.95 * edge.pstyle("width").pfValue * edge.pstyle("arrow-scale").value;
          }, "gap")
        });
      };
      BRp$e = {};
      BRp$e.projectIntoViewport = function(clientX, clientY) {
        var cy = this.cy;
        var offsets = this.findContainerClientCoords();
        var offsetLeft = offsets[0];
        var offsetTop = offsets[1];
        var scale3 = offsets[4];
        var pan2 = cy.pan();
        var zoom2 = cy.zoom();
        var x5 = ((clientX - offsetLeft) / scale3 - pan2.x) / zoom2;
        var y6 = ((clientY - offsetTop) / scale3 - pan2.y) / zoom2;
        return [x5, y6];
      };
      BRp$e.findContainerClientCoords = function() {
        if (this.containerBB) {
          return this.containerBB;
        }
        var container2 = this.container;
        var rect3 = container2.getBoundingClientRect();
        var style3 = this.cy.window().getComputedStyle(container2);
        var styleValue2 = /* @__PURE__ */ __name(function styleValue3(name) {
          return parseFloat(style3.getPropertyValue(name));
        }, "styleValue");
        var padding2 = {
          left: styleValue2("padding-left"),
          right: styleValue2("padding-right"),
          top: styleValue2("padding-top"),
          bottom: styleValue2("padding-bottom")
        };
        var border = {
          left: styleValue2("border-left-width"),
          right: styleValue2("border-right-width"),
          top: styleValue2("border-top-width"),
          bottom: styleValue2("border-bottom-width")
        };
        var clientWidth = container2.clientWidth;
        var clientHeight = container2.clientHeight;
        var paddingHor = padding2.left + padding2.right;
        var paddingVer = padding2.top + padding2.bottom;
        var borderHor = border.left + border.right;
        var scale3 = rect3.width / (clientWidth + borderHor);
        var unscaledW = clientWidth - paddingHor;
        var unscaledH = clientHeight - paddingVer;
        var left3 = rect3.left + padding2.left + border.left;
        var top2 = rect3.top + padding2.top + border.top;
        return this.containerBB = [left3, top2, unscaledW, unscaledH, scale3];
      };
      BRp$e.invalidateContainerClientCoordsCache = function() {
        this.containerBB = null;
      };
      BRp$e.findNearestElement = function(x5, y6, interactiveElementsOnly, isTouch) {
        return this.findNearestElements(x5, y6, interactiveElementsOnly, isTouch)[0];
      };
      BRp$e.findNearestElements = function(x5, y6, interactiveElementsOnly, isTouch) {
        var self2 = this;
        var r2 = this;
        var eles = r2.getCachedZSortedEles();
        var near = [];
        var zoom2 = r2.cy.zoom();
        var hasCompounds = r2.cy.hasCompoundNodes();
        var edgeThreshold = (isTouch ? 24 : 8) / zoom2;
        var nodeThreshold = (isTouch ? 8 : 2) / zoom2;
        var labelThreshold = (isTouch ? 8 : 2) / zoom2;
        var minSqDist = Infinity;
        var nearEdge;
        var nearNode;
        if (interactiveElementsOnly) {
          eles = eles.interactive;
        }
        function addEle(ele2, sqDist) {
          if (ele2.isNode()) {
            if (nearNode) {
              return;
            } else {
              nearNode = ele2;
              near.push(ele2);
            }
          }
          if (ele2.isEdge() && (sqDist == null || sqDist < minSqDist)) {
            if (nearEdge) {
              if (nearEdge.pstyle("z-compound-depth").value === ele2.pstyle("z-compound-depth").value && nearEdge.pstyle("z-compound-depth").value === ele2.pstyle("z-compound-depth").value) {
                for (var i3 = 0; i3 < near.length; i3++) {
                  if (near[i3].isEdge()) {
                    near[i3] = ele2;
                    nearEdge = ele2;
                    minSqDist = sqDist != null ? sqDist : minSqDist;
                    break;
                  }
                }
              }
            } else {
              near.push(ele2);
              nearEdge = ele2;
              minSqDist = sqDist != null ? sqDist : minSqDist;
            }
          }
        }
        __name(addEle, "addEle");
        function checkNode(node2) {
          var width3 = node2.outerWidth() + 2 * nodeThreshold;
          var height2 = node2.outerHeight() + 2 * nodeThreshold;
          var hw = width3 / 2;
          var hh = height2 / 2;
          var pos = node2.position();
          var cornerRadius = node2.pstyle("corner-radius").value === "auto" ? "auto" : node2.pstyle("corner-radius").pfValue;
          var rs = node2._private.rscratch;
          if (pos.x - hw <= x5 && x5 <= pos.x + hw && pos.y - hh <= y6 && y6 <= pos.y + hh) {
            var shape = r2.nodeShapes[self2.getNodeShape(node2)];
            if (shape.checkPoint(x5, y6, 0, width3, height2, pos.x, pos.y, cornerRadius, rs)) {
              addEle(node2, 0);
              return true;
            }
          }
        }
        __name(checkNode, "checkNode");
        function checkEdge(edge) {
          var _p = edge._private;
          var rs = _p.rscratch;
          var styleWidth = edge.pstyle("width").pfValue;
          var scale3 = edge.pstyle("arrow-scale").value;
          var width3 = styleWidth / 2 + edgeThreshold;
          var widthSq = width3 * width3;
          var width22 = width3 * 2;
          var src = _p.source;
          var tgt = _p.target;
          var sqDist;
          if (rs.edgeType === "segments" || rs.edgeType === "straight" || rs.edgeType === "haystack") {
            var pts2 = rs.allpts;
            for (var i3 = 0; i3 + 3 < pts2.length; i3 += 2) {
              if (inLineVicinity(x5, y6, pts2[i3], pts2[i3 + 1], pts2[i3 + 2], pts2[i3 + 3], width22) && widthSq > (sqDist = sqdistToFiniteLine(x5, y6, pts2[i3], pts2[i3 + 1], pts2[i3 + 2], pts2[i3 + 3]))) {
                addEle(edge, sqDist);
                return true;
              }
            }
          } else if (rs.edgeType === "bezier" || rs.edgeType === "multibezier" || rs.edgeType === "self" || rs.edgeType === "compound") {
            var pts2 = rs.allpts;
            for (var i3 = 0; i3 + 5 < rs.allpts.length; i3 += 4) {
              if (inBezierVicinity(x5, y6, pts2[i3], pts2[i3 + 1], pts2[i3 + 2], pts2[i3 + 3], pts2[i3 + 4], pts2[i3 + 5], width22) && widthSq > (sqDist = sqdistToQuadraticBezier(x5, y6, pts2[i3], pts2[i3 + 1], pts2[i3 + 2], pts2[i3 + 3], pts2[i3 + 4], pts2[i3 + 5]))) {
                addEle(edge, sqDist);
                return true;
              }
            }
          }
          var src = src || _p.source;
          var tgt = tgt || _p.target;
          var arSize = self2.getArrowWidth(styleWidth, scale3);
          var arrows = [{
            name: "source",
            x: rs.arrowStartX,
            y: rs.arrowStartY,
            angle: rs.srcArrowAngle
          }, {
            name: "target",
            x: rs.arrowEndX,
            y: rs.arrowEndY,
            angle: rs.tgtArrowAngle
          }, {
            name: "mid-source",
            x: rs.midX,
            y: rs.midY,
            angle: rs.midsrcArrowAngle
          }, {
            name: "mid-target",
            x: rs.midX,
            y: rs.midY,
            angle: rs.midtgtArrowAngle
          }];
          for (var i3 = 0; i3 < arrows.length; i3++) {
            var ar = arrows[i3];
            var shape = r2.arrowShapes[edge.pstyle(ar.name + "-arrow-shape").value];
            var edgeWidth = edge.pstyle("width").pfValue;
            if (shape.roughCollide(x5, y6, arSize, ar.angle, {
              x: ar.x,
              y: ar.y
            }, edgeWidth, edgeThreshold) && shape.collide(x5, y6, arSize, ar.angle, {
              x: ar.x,
              y: ar.y
            }, edgeWidth, edgeThreshold)) {
              addEle(edge);
              return true;
            }
          }
          if (hasCompounds && near.length > 0) {
            checkNode(src);
            checkNode(tgt);
          }
        }
        __name(checkEdge, "checkEdge");
        function preprop(obj, name, pre) {
          return getPrefixedProperty(obj, name, pre);
        }
        __name(preprop, "preprop");
        function checkLabel(ele2, prefix) {
          var _p = ele2._private;
          var th = labelThreshold;
          var prefixDash;
          if (prefix) {
            prefixDash = prefix + "-";
          } else {
            prefixDash = "";
          }
          ele2.boundingBox();
          var bb = _p.labelBounds[prefix || "main"];
          var text4 = ele2.pstyle(prefixDash + "label").value;
          var eventsEnabled = ele2.pstyle("text-events").strValue === "yes";
          if (!eventsEnabled || !text4) {
            return;
          }
          var lx = preprop(_p.rscratch, "labelX", prefix);
          var ly = preprop(_p.rscratch, "labelY", prefix);
          var theta = preprop(_p.rscratch, "labelAngle", prefix);
          var ox = ele2.pstyle(prefixDash + "text-margin-x").pfValue;
          var oy = ele2.pstyle(prefixDash + "text-margin-y").pfValue;
          var lx1 = bb.x1 - th - ox;
          var lx2 = bb.x2 + th - ox;
          var ly1 = bb.y1 - th - oy;
          var ly2 = bb.y2 + th - oy;
          if (theta) {
            var cos3 = Math.cos(theta);
            var sin3 = Math.sin(theta);
            var rotate2 = /* @__PURE__ */ __name(function rotate3(x6, y7) {
              x6 = x6 - lx;
              y7 = y7 - ly;
              return {
                x: x6 * cos3 - y7 * sin3 + lx,
                y: x6 * sin3 + y7 * cos3 + ly
              };
            }, "rotate");
            var px1y1 = rotate2(lx1, ly1);
            var px1y2 = rotate2(lx1, ly2);
            var px2y1 = rotate2(lx2, ly1);
            var px2y2 = rotate2(lx2, ly2);
            var points = [
              // with the margin added after the rotation is applied
              px1y1.x + ox,
              px1y1.y + oy,
              px2y1.x + ox,
              px2y1.y + oy,
              px2y2.x + ox,
              px2y2.y + oy,
              px1y2.x + ox,
              px1y2.y + oy
            ];
            if (pointInsidePolygonPoints(x5, y6, points)) {
              addEle(ele2);
              return true;
            }
          } else {
            if (inBoundingBox(bb, x5, y6)) {
              addEle(ele2);
              return true;
            }
          }
        }
        __name(checkLabel, "checkLabel");
        for (var i2 = eles.length - 1; i2 >= 0; i2--) {
          var ele = eles[i2];
          if (ele.isNode()) {
            checkNode(ele) || checkLabel(ele);
          } else {
            checkEdge(ele) || checkLabel(ele) || checkLabel(ele, "source") || checkLabel(ele, "target");
          }
        }
        return near;
      };
      BRp$e.getAllInBox = function(x1, y1, x22, y22) {
        var eles = this.getCachedZSortedEles().interactive;
        var zoom2 = this.cy.zoom();
        var labelThreshold = 2 / zoom2;
        var box = [];
        var x1c = Math.min(x1, x22);
        var x2c = Math.max(x1, x22);
        var y1c = Math.min(y1, y22);
        var y2c = Math.max(y1, y22);
        x1 = x1c;
        x22 = x2c;
        y1 = y1c;
        y22 = y2c;
        var boxBb = makeBoundingBox({
          x1,
          y1,
          x2: x22,
          y2: y22
        });
        var selectionBox = [{
          x: boxBb.x1,
          y: boxBb.y1
        }, {
          x: boxBb.x2,
          y: boxBb.y1
        }, {
          x: boxBb.x2,
          y: boxBb.y2
        }, {
          x: boxBb.x1,
          y: boxBb.y2
        }];
        var boxEdges = [[selectionBox[0], selectionBox[1]], [selectionBox[1], selectionBox[2]], [selectionBox[2], selectionBox[3]], [selectionBox[3], selectionBox[0]]];
        function preprop(obj, name, pre) {
          return getPrefixedProperty(obj, name, pre);
        }
        __name(preprop, "preprop");
        function getRotatedLabelBox(ele2, prefix) {
          var _p2 = ele2._private;
          var th = labelThreshold;
          var prefixDash = "";
          ele2.boundingBox();
          var bb = _p2.labelBounds["main"];
          if (!bb) {
            return null;
          }
          var lx = preprop(_p2.rscratch, "labelX", prefix);
          var ly = preprop(_p2.rscratch, "labelY", prefix);
          var theta = preprop(_p2.rscratch, "labelAngle", prefix);
          var ox = ele2.pstyle(prefixDash + "text-margin-x").pfValue;
          var oy = ele2.pstyle(prefixDash + "text-margin-y").pfValue;
          var lx1 = bb.x1 - th - ox;
          var lx2 = bb.x2 + th - ox;
          var ly1 = bb.y1 - th - oy;
          var ly2 = bb.y2 + th - oy;
          if (theta) {
            var cos3 = Math.cos(theta);
            var sin3 = Math.sin(theta);
            var rotate2 = /* @__PURE__ */ __name(function rotate3(x5, y6) {
              x5 = x5 - lx;
              y6 = y6 - ly;
              return {
                x: x5 * cos3 - y6 * sin3 + lx,
                y: x5 * sin3 + y6 * cos3 + ly
              };
            }, "rotate");
            return [rotate2(lx1, ly1), rotate2(lx2, ly1), rotate2(lx2, ly2), rotate2(lx1, ly2)];
          } else {
            return [{
              x: lx1,
              y: ly1
            }, {
              x: lx2,
              y: ly1
            }, {
              x: lx2,
              y: ly2
            }, {
              x: lx1,
              y: ly2
            }];
          }
        }
        __name(getRotatedLabelBox, "getRotatedLabelBox");
        function doLinesIntersect(p1, p22, q1, q22) {
          function ccw(a2, b4, c3) {
            return (c3.y - a2.y) * (b4.x - a2.x) > (b4.y - a2.y) * (c3.x - a2.x);
          }
          __name(ccw, "ccw");
          return ccw(p1, q1, q22) !== ccw(p22, q1, q22) && ccw(p1, p22, q1) !== ccw(p1, p22, q22);
        }
        __name(doLinesIntersect, "doLinesIntersect");
        for (var e3 = 0; e3 < eles.length; e3++) {
          var ele = eles[e3];
          if (ele.isNode()) {
            var node2 = ele;
            var textEvents = node2.pstyle("text-events").strValue === "yes";
            var nodeBoxSelectMode = node2.pstyle("box-selection").strValue;
            var labelBoxSelectEnabled = node2.pstyle("box-select-labels").strValue === "yes";
            if (nodeBoxSelectMode === "none") {
              continue;
            }
            var includeLabels = (nodeBoxSelectMode === "overlap" || labelBoxSelectEnabled) && textEvents;
            var nodeBb = node2.boundingBox({
              includeNodes: true,
              includeEdges: false,
              includeLabels
            });
            if (nodeBoxSelectMode === "contain") {
              var selected = false;
              if (labelBoxSelectEnabled && textEvents) {
                var rotatedLabelBox = getRotatedLabelBox(node2);
                if (rotatedLabelBox && satPolygonIntersection(rotatedLabelBox, selectionBox)) {
                  box.push(node2);
                  selected = true;
                }
              }
              if (!selected && boundingBoxInBoundingBox(boxBb, nodeBb)) {
                box.push(node2);
              }
            } else if (nodeBoxSelectMode === "overlap") {
              if (boundingBoxesIntersect(boxBb, nodeBb)) {
                var nodeBodyBb = node2.boundingBox({
                  includeNodes: true,
                  includeEdges: true,
                  includeLabels: false,
                  includeMainLabels: false,
                  includeSourceLabels: false,
                  includeTargetLabels: false
                });
                var nodeBodyCorners = [{
                  x: nodeBodyBb.x1,
                  y: nodeBodyBb.y1
                }, {
                  x: nodeBodyBb.x2,
                  y: nodeBodyBb.y1
                }, {
                  x: nodeBodyBb.x2,
                  y: nodeBodyBb.y2
                }, {
                  x: nodeBodyBb.x1,
                  y: nodeBodyBb.y2
                }];
                if (satPolygonIntersection(nodeBodyCorners, selectionBox)) {
                  box.push(node2);
                } else {
                  var _rotatedLabelBox = getRotatedLabelBox(node2);
                  if (_rotatedLabelBox && satPolygonIntersection(_rotatedLabelBox, selectionBox)) {
                    box.push(node2);
                  }
                }
              }
            }
          } else {
            var edge = ele;
            var _p = edge._private;
            var rs = _p.rscratch;
            var edgeBoxSelectMode = edge.pstyle("box-selection").strValue;
            if (edgeBoxSelectMode === "none") {
              continue;
            }
            if (edgeBoxSelectMode === "contain") {
              if (rs.startX != null && rs.startY != null && !inBoundingBox(boxBb, rs.startX, rs.startY)) {
                continue;
              }
              if (rs.endX != null && rs.endY != null && !inBoundingBox(boxBb, rs.endX, rs.endY)) {
                continue;
              }
              if (rs.edgeType === "bezier" || rs.edgeType === "multibezier" || rs.edgeType === "self" || rs.edgeType === "compound" || rs.edgeType === "segments" || rs.edgeType === "haystack") {
                var pts2 = _p.rstyle.bezierPts || _p.rstyle.linePts || _p.rstyle.haystackPts;
                var allInside = true;
                for (var i2 = 0; i2 < pts2.length; i2++) {
                  if (!pointInBoundingBox(boxBb, pts2[i2])) {
                    allInside = false;
                    break;
                  }
                }
                if (allInside) {
                  box.push(edge);
                }
              } else if (rs.edgeType === "straight") {
                box.push(edge);
              }
            } else if (edgeBoxSelectMode === "overlap") {
              var _selected = false;
              if (rs.startX != null && rs.startY != null && rs.endX != null && rs.endY != null && (inBoundingBox(boxBb, rs.startX, rs.startY) || inBoundingBox(boxBb, rs.endX, rs.endY))) {
                box.push(edge);
                _selected = true;
              } else if (!_selected && rs.edgeType === "haystack") {
                var haystackPts = _p.rstyle.haystackPts;
                for (var _i = 0; _i < haystackPts.length; _i++) {
                  if (pointInBoundingBox(boxBb, haystackPts[_i])) {
                    box.push(edge);
                    _selected = true;
                    break;
                  }
                }
              }
              if (!_selected) {
                var _pts = _p.rstyle.bezierPts || _p.rstyle.linePts || _p.rstyle.haystackPts;
                if ((!_pts || _pts.length < 2) && rs.edgeType === "straight") {
                  if (rs.startX != null && rs.startY != null && rs.endX != null && rs.endY != null) {
                    _pts = [{
                      x: rs.startX,
                      y: rs.startY
                    }, {
                      x: rs.endX,
                      y: rs.endY
                    }];
                  }
                }
                if (!_pts || _pts.length < 2) continue;
                for (var _i2 = 0; _i2 < _pts.length - 1; _i2++) {
                  var segStart = _pts[_i2];
                  var segEnd = _pts[_i2 + 1];
                  for (var b3 = 0; b3 < boxEdges.length; b3++) {
                    var _boxEdges$b = _slicedToArray(boxEdges[b3], 2), boxStart = _boxEdges$b[0], boxEnd = _boxEdges$b[1];
                    if (doLinesIntersect(segStart, segEnd, boxStart, boxEnd)) {
                      box.push(edge);
                      _selected = true;
                      break;
                    }
                  }
                  if (_selected) break;
                }
              }
            }
          }
        }
        return box;
      };
      BRp$d = {};
      BRp$d.calculateArrowAngles = function(edge) {
        var rs = edge._private.rscratch;
        var isHaystack = rs.edgeType === "haystack";
        var isBezier = rs.edgeType === "bezier";
        var isMultibezier = rs.edgeType === "multibezier";
        var isSegments = rs.edgeType === "segments";
        var isCompound = rs.edgeType === "compound";
        var isSelf = rs.edgeType === "self";
        var dispX, dispY;
        var startX2, startY2, endX, endY, midX, midY;
        if (isHaystack) {
          startX2 = rs.haystackPts[0];
          startY2 = rs.haystackPts[1];
          endX = rs.haystackPts[2];
          endY = rs.haystackPts[3];
        } else {
          startX2 = rs.arrowStartX;
          startY2 = rs.arrowStartY;
          endX = rs.arrowEndX;
          endY = rs.arrowEndY;
        }
        midX = rs.midX;
        midY = rs.midY;
        if (isSegments) {
          dispX = startX2 - rs.segpts[0];
          dispY = startY2 - rs.segpts[1];
        } else if (isMultibezier || isCompound || isSelf || isBezier) {
          var pts2 = rs.allpts;
          var bX = qbezierAt(pts2[0], pts2[2], pts2[4], 0.1);
          var bY = qbezierAt(pts2[1], pts2[3], pts2[5], 0.1);
          dispX = startX2 - bX;
          dispY = startY2 - bY;
        } else {
          dispX = startX2 - midX;
          dispY = startY2 - midY;
        }
        rs.srcArrowAngle = getAngleFromDisp(dispX, dispY);
        var midX = rs.midX;
        var midY = rs.midY;
        if (isHaystack) {
          midX = (startX2 + endX) / 2;
          midY = (startY2 + endY) / 2;
        }
        dispX = endX - startX2;
        dispY = endY - startY2;
        if (isSegments) {
          var pts2 = rs.allpts;
          if (pts2.length / 2 % 2 === 0) {
            var i2 = pts2.length / 2;
            var i1 = i2 - 2;
            dispX = pts2[i2] - pts2[i1];
            dispY = pts2[i2 + 1] - pts2[i1 + 1];
          } else if (rs.isRound) {
            dispX = rs.midVector[1];
            dispY = -rs.midVector[0];
          } else {
            var i2 = pts2.length / 2 - 1;
            var i1 = i2 - 2;
            dispX = pts2[i2] - pts2[i1];
            dispY = pts2[i2 + 1] - pts2[i1 + 1];
          }
        } else if (isMultibezier || isCompound || isSelf) {
          var pts2 = rs.allpts;
          var cpts = rs.ctrlpts;
          var bp0x, bp0y;
          var bp1x, bp1y;
          if (cpts.length / 2 % 2 === 0) {
            var p0 = pts2.length / 2 - 1;
            var ic = p0 + 2;
            var p1 = ic + 2;
            bp0x = qbezierAt(pts2[p0], pts2[ic], pts2[p1], 0);
            bp0y = qbezierAt(pts2[p0 + 1], pts2[ic + 1], pts2[p1 + 1], 0);
            bp1x = qbezierAt(pts2[p0], pts2[ic], pts2[p1], 1e-4);
            bp1y = qbezierAt(pts2[p0 + 1], pts2[ic + 1], pts2[p1 + 1], 1e-4);
          } else {
            var ic = pts2.length / 2 - 1;
            var p0 = ic - 2;
            var p1 = ic + 2;
            bp0x = qbezierAt(pts2[p0], pts2[ic], pts2[p1], 0.4999);
            bp0y = qbezierAt(pts2[p0 + 1], pts2[ic + 1], pts2[p1 + 1], 0.4999);
            bp1x = qbezierAt(pts2[p0], pts2[ic], pts2[p1], 0.5);
            bp1y = qbezierAt(pts2[p0 + 1], pts2[ic + 1], pts2[p1 + 1], 0.5);
          }
          dispX = bp1x - bp0x;
          dispY = bp1y - bp0y;
        }
        rs.midtgtArrowAngle = getAngleFromDisp(dispX, dispY);
        rs.midDispX = dispX;
        rs.midDispY = dispY;
        dispX *= -1;
        dispY *= -1;
        if (isSegments) {
          var pts2 = rs.allpts;
          if (pts2.length / 2 % 2 === 0) ;
          else if (!rs.isRound) {
            var i2 = pts2.length / 2 - 1;
            var i3 = i2 + 2;
            dispX = -(pts2[i3] - pts2[i2]);
            dispY = -(pts2[i3 + 1] - pts2[i2 + 1]);
          }
        }
        rs.midsrcArrowAngle = getAngleFromDisp(dispX, dispY);
        if (isSegments) {
          dispX = endX - rs.segpts[rs.segpts.length - 2];
          dispY = endY - rs.segpts[rs.segpts.length - 1];
        } else if (isMultibezier || isCompound || isSelf || isBezier) {
          var pts2 = rs.allpts;
          var l4 = pts2.length;
          var bX = qbezierAt(pts2[l4 - 6], pts2[l4 - 4], pts2[l4 - 2], 0.9);
          var bY = qbezierAt(pts2[l4 - 5], pts2[l4 - 3], pts2[l4 - 1], 0.9);
          dispX = endX - bX;
          dispY = endY - bY;
        } else {
          dispX = endX - midX;
          dispY = endY - midY;
        }
        rs.tgtArrowAngle = getAngleFromDisp(dispX, dispY);
      };
      BRp$d.getArrowWidth = BRp$d.getArrowHeight = function(edgeWidth, scale3) {
        var cache3 = this.arrowWidthCache = this.arrowWidthCache || {};
        var cachedVal = cache3[edgeWidth + ", " + scale3];
        if (cachedVal) {
          return cachedVal;
        }
        cachedVal = Math.max(Math.pow(edgeWidth * 13.37, 0.9), 29) * scale3;
        cache3[edgeWidth + ", " + scale3] = cachedVal;
        return cachedVal;
      };
      v1 = {};
      v22 = {};
      asVec = /* @__PURE__ */ __name(function asVec2(p3, pp, v3) {
        v3.x = pp.x - p3.x;
        v3.y = pp.y - p3.y;
        v3.len = Math.sqrt(v3.x * v3.x + v3.y * v3.y);
        v3.nx = v3.x / v3.len;
        v3.ny = v3.y / v3.len;
        v3.ang = Math.atan2(v3.ny, v3.nx);
      }, "asVec");
      invertVec = /* @__PURE__ */ __name(function invertVec2(originalV, invertedV) {
        invertedV.x = originalV.x * -1;
        invertedV.y = originalV.y * -1;
        invertedV.nx = originalV.nx * -1;
        invertedV.ny = originalV.ny * -1;
        invertedV.ang = originalV.ang > 0 ? -(Math.PI - originalV.ang) : Math.PI + originalV.ang;
      }, "invertVec");
      calcCornerArc = /* @__PURE__ */ __name(function calcCornerArc2(previousPoint, currentPoint, nextPoint, radiusMax, isArcRadius) {
        previousPoint !== lastPoint ? asVec(currentPoint, previousPoint, v1) : invertVec(v22, v1);
        asVec(currentPoint, nextPoint, v22);
        sinA = v1.nx * v22.ny - v1.ny * v22.nx;
        sinA90 = v1.nx * v22.nx - v1.ny * -v22.ny;
        angle = Math.asin(Math.max(-1, Math.min(1, sinA)));
        if (Math.abs(angle) < 1e-6) {
          x3 = currentPoint.x;
          y4 = currentPoint.y;
          cRadius = radius = 0;
          return;
        }
        radDirection = 1;
        drawDirection = false;
        if (sinA90 < 0) {
          if (angle < 0) {
            angle = Math.PI + angle;
          } else {
            angle = Math.PI - angle;
            radDirection = -1;
            drawDirection = true;
          }
        } else {
          if (angle > 0) {
            radDirection = -1;
            drawDirection = true;
          }
        }
        if (currentPoint.radius !== void 0) {
          radius = currentPoint.radius;
        } else {
          radius = radiusMax;
        }
        halfAngle = angle / 2;
        limit = Math.min(v1.len / 2, v22.len / 2);
        if (isArcRadius) {
          lenOut = Math.abs(Math.cos(halfAngle) * radius / Math.sin(halfAngle));
          if (lenOut > limit) {
            lenOut = limit;
            cRadius = Math.abs(lenOut * Math.sin(halfAngle) / Math.cos(halfAngle));
          } else {
            cRadius = radius;
          }
        } else {
          lenOut = Math.min(limit, radius);
          cRadius = Math.abs(lenOut * Math.sin(halfAngle) / Math.cos(halfAngle));
        }
        stopX = currentPoint.x + v22.nx * lenOut;
        stopY = currentPoint.y + v22.ny * lenOut;
        x3 = stopX - v22.ny * cRadius * radDirection;
        y4 = stopY + v22.nx * cRadius * radDirection;
        startX = currentPoint.x + v1.nx * lenOut;
        startY = currentPoint.y + v1.ny * lenOut;
        lastPoint = currentPoint;
      }, "calcCornerArc");
      __name(drawPreparedRoundCorner, "drawPreparedRoundCorner");
      __name(getRoundCorner, "getRoundCorner");
      AVOID_IMPOSSIBLE_BEZIER_CONSTANT = 0.01;
      AVOID_IMPOSSIBLE_BEZIER_CONSTANT_L = Math.sqrt(2 * AVOID_IMPOSSIBLE_BEZIER_CONSTANT);
      BRp$c = {};
      BRp$c.findMidptPtsEtc = function(edge, pairInfo) {
        var posPts = pairInfo.posPts, intersectionPts = pairInfo.intersectionPts, vectorNormInverse = pairInfo.vectorNormInverse;
        var midptPts;
        var srcManEndpt = edge.pstyle("source-endpoint");
        var tgtManEndpt = edge.pstyle("target-endpoint");
        var haveManualEndPts = srcManEndpt.units != null && tgtManEndpt.units != null;
        var recalcVectorNormInverse = /* @__PURE__ */ __name(function recalcVectorNormInverse2(x12, y12, x23, y23) {
          var dy = y23 - y12;
          var dx = x23 - x12;
          var l4 = Math.sqrt(dx * dx + dy * dy);
          return {
            x: -dy / l4,
            y: dx / l4
          };
        }, "recalcVectorNormInverse");
        var edgeDistances = edge.pstyle("edge-distances").value;
        switch (edgeDistances) {
          case "node-position":
            midptPts = posPts;
            break;
          case "intersection":
            midptPts = intersectionPts;
            break;
          case "endpoints": {
            if (haveManualEndPts) {
              var _this$manualEndptToPx = this.manualEndptToPx(edge.source()[0], srcManEndpt), _this$manualEndptToPx2 = _slicedToArray(_this$manualEndptToPx, 2), x1 = _this$manualEndptToPx2[0], y1 = _this$manualEndptToPx2[1];
              var _this$manualEndptToPx3 = this.manualEndptToPx(edge.target()[0], tgtManEndpt), _this$manualEndptToPx4 = _slicedToArray(_this$manualEndptToPx3, 2), x22 = _this$manualEndptToPx4[0], y22 = _this$manualEndptToPx4[1];
              var endPts = {
                x1,
                y1,
                x2: x22,
                y2: y22
              };
              vectorNormInverse = recalcVectorNormInverse(x1, y1, x22, y22);
              midptPts = endPts;
            } else {
              warn("Edge ".concat(edge.id(), " has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint.  Falling back on edge-distances:intersection (default)."));
              midptPts = intersectionPts;
            }
            break;
          }
        }
        return {
          midptPts,
          vectorNormInverse
        };
      };
      BRp$c.findHaystackPoints = function(edges3) {
        for (var i2 = 0; i2 < edges3.length; i2++) {
          var edge = edges3[i2];
          var _p = edge._private;
          var rs = _p.rscratch;
          if (!rs.haystack) {
            var angle2 = Math.random() * 2 * Math.PI;
            rs.source = {
              x: Math.cos(angle2),
              y: Math.sin(angle2)
            };
            angle2 = Math.random() * 2 * Math.PI;
            rs.target = {
              x: Math.cos(angle2),
              y: Math.sin(angle2)
            };
          }
          var src = _p.source;
          var tgt = _p.target;
          var srcPos = src.position();
          var tgtPos = tgt.position();
          var srcW = src.width();
          var tgtW = tgt.width();
          var srcH = src.height();
          var tgtH = tgt.height();
          var radius2 = edge.pstyle("haystack-radius").value;
          var halfRadius = radius2 / 2;
          rs.haystackPts = rs.allpts = [rs.source.x * srcW * halfRadius + srcPos.x, rs.source.y * srcH * halfRadius + srcPos.y, rs.target.x * tgtW * halfRadius + tgtPos.x, rs.target.y * tgtH * halfRadius + tgtPos.y];
          rs.midX = (rs.allpts[0] + rs.allpts[2]) / 2;
          rs.midY = (rs.allpts[1] + rs.allpts[3]) / 2;
          rs.edgeType = "haystack";
          rs.haystack = true;
          this.storeEdgeProjections(edge);
          this.calculateArrowAngles(edge);
          this.recalculateEdgeLabelProjections(edge);
          this.calculateLabelAngles(edge);
        }
      };
      BRp$c.findSegmentsPoints = function(edge, pairInfo) {
        var rs = edge._private.rscratch;
        var segmentWs = edge.pstyle("segment-weights");
        var segmentDs = edge.pstyle("segment-distances");
        var segmentRs = edge.pstyle("segment-radii");
        var segmentTs = edge.pstyle("radius-type");
        var segmentsN = Math.min(segmentWs.pfValue.length, segmentDs.pfValue.length);
        var lastRadius = segmentRs.pfValue[segmentRs.pfValue.length - 1];
        var lastRadiusType = segmentTs.pfValue[segmentTs.pfValue.length - 1];
        rs.edgeType = "segments";
        rs.segpts = [];
        rs.radii = [];
        rs.isArcRadius = [];
        for (var s2 = 0; s2 < segmentsN; s2++) {
          var w4 = segmentWs.pfValue[s2];
          var d3 = segmentDs.pfValue[s2];
          var w1 = 1 - w4;
          var w22 = w4;
          var _this$findMidptPtsEtc = this.findMidptPtsEtc(edge, pairInfo), midptPts = _this$findMidptPtsEtc.midptPts, vectorNormInverse = _this$findMidptPtsEtc.vectorNormInverse;
          var adjustedMidpt = {
            x: midptPts.x1 * w1 + midptPts.x2 * w22,
            y: midptPts.y1 * w1 + midptPts.y2 * w22
          };
          rs.segpts.push(adjustedMidpt.x + vectorNormInverse.x * d3, adjustedMidpt.y + vectorNormInverse.y * d3);
          rs.radii.push(segmentRs.pfValue[s2] !== void 0 ? segmentRs.pfValue[s2] : lastRadius);
          rs.isArcRadius.push((segmentTs.pfValue[s2] !== void 0 ? segmentTs.pfValue[s2] : lastRadiusType) === "arc-radius");
        }
      };
      BRp$c.findLoopPoints = function(edge, pairInfo, i2, edgeIsUnbundled) {
        var rs = edge._private.rscratch;
        var dirCounts = pairInfo.dirCounts, srcPos = pairInfo.srcPos;
        var ctrlptDists = edge.pstyle("control-point-distances");
        var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : void 0;
        var loopDir = edge.pstyle("loop-direction").pfValue;
        var loopSwp = edge.pstyle("loop-sweep").pfValue;
        var stepSize = edge.pstyle("control-point-step-size").pfValue;
        rs.edgeType = "self";
        var j3 = i2;
        var loopDist = stepSize;
        if (edgeIsUnbundled) {
          j3 = 0;
          loopDist = ctrlptDist;
        }
        var loopAngle = loopDir - Math.PI / 2;
        var outAngle = loopAngle - loopSwp / 2;
        var inAngle = loopAngle + loopSwp / 2;
        var dc = String(loopDir + "_" + loopSwp);
        j3 = dirCounts[dc] === void 0 ? dirCounts[dc] = 0 : ++dirCounts[dc];
        rs.ctrlpts = [srcPos.x + Math.cos(outAngle) * 1.4 * loopDist * (j3 / 3 + 1), srcPos.y + Math.sin(outAngle) * 1.4 * loopDist * (j3 / 3 + 1), srcPos.x + Math.cos(inAngle) * 1.4 * loopDist * (j3 / 3 + 1), srcPos.y + Math.sin(inAngle) * 1.4 * loopDist * (j3 / 3 + 1)];
      };
      BRp$c.findCompoundLoopPoints = function(edge, pairInfo, i2, edgeIsUnbundled) {
        var rs = edge._private.rscratch;
        rs.edgeType = "compound";
        var srcPos = pairInfo.srcPos, tgtPos = pairInfo.tgtPos, srcW = pairInfo.srcW, srcH = pairInfo.srcH, tgtW = pairInfo.tgtW, tgtH = pairInfo.tgtH;
        var stepSize = edge.pstyle("control-point-step-size").pfValue;
        var ctrlptDists = edge.pstyle("control-point-distances");
        var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : void 0;
        var j3 = i2;
        var loopDist = stepSize;
        if (edgeIsUnbundled) {
          j3 = 0;
          loopDist = ctrlptDist;
        }
        var loopW = 50;
        var loopaPos = {
          x: srcPos.x - srcW / 2,
          y: srcPos.y - srcH / 2
        };
        var loopbPos = {
          x: tgtPos.x - tgtW / 2,
          y: tgtPos.y - tgtH / 2
        };
        var loopPos = {
          x: Math.min(loopaPos.x, loopbPos.x),
          y: Math.min(loopaPos.y, loopbPos.y)
        };
        var minCompoundStretch = 0.5;
        var compoundStretchA = Math.max(minCompoundStretch, Math.log(srcW * AVOID_IMPOSSIBLE_BEZIER_CONSTANT));
        var compoundStretchB = Math.max(minCompoundStretch, Math.log(tgtW * AVOID_IMPOSSIBLE_BEZIER_CONSTANT));
        rs.ctrlpts = [loopPos.x, loopPos.y - (1 + Math.pow(loopW, 1.12) / 100) * loopDist * (j3 / 3 + 1) * compoundStretchA, loopPos.x - (1 + Math.pow(loopW, 1.12) / 100) * loopDist * (j3 / 3 + 1) * compoundStretchB, loopPos.y];
      };
      BRp$c.findStraightEdgePoints = function(edge) {
        edge._private.rscratch.edgeType = "straight";
      };
      BRp$c.findBezierPoints = function(edge, pairInfo, i2, edgeIsUnbundled, edgeIsSwapped) {
        var rs = edge._private.rscratch;
        var stepSize = edge.pstyle("control-point-step-size").pfValue;
        var ctrlptDists = edge.pstyle("control-point-distances");
        var ctrlptWs = edge.pstyle("control-point-weights");
        var bezierN = ctrlptDists && ctrlptWs ? Math.min(ctrlptDists.value.length, ctrlptWs.value.length) : 1;
        var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : void 0;
        var ctrlptWeight = ctrlptWs.value[0];
        var multi = edgeIsUnbundled;
        rs.edgeType = multi ? "multibezier" : "bezier";
        rs.ctrlpts = [];
        for (var b3 = 0; b3 < bezierN; b3++) {
          var normctrlptDist = (0.5 - pairInfo.eles.length / 2 + i2) * stepSize * (edgeIsSwapped ? -1 : 1);
          var manctrlptDist = void 0;
          var sign2 = signum(normctrlptDist);
          if (multi) {
            ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[b3] : stepSize;
            ctrlptWeight = ctrlptWs.value[b3];
          }
          if (edgeIsUnbundled) {
            manctrlptDist = ctrlptDist;
          } else {
            manctrlptDist = ctrlptDist !== void 0 ? sign2 * ctrlptDist : void 0;
          }
          var distanceFromMidpoint = manctrlptDist !== void 0 ? manctrlptDist : normctrlptDist;
          var w1 = 1 - ctrlptWeight;
          var w22 = ctrlptWeight;
          var _this$findMidptPtsEtc2 = this.findMidptPtsEtc(edge, pairInfo), midptPts = _this$findMidptPtsEtc2.midptPts, vectorNormInverse = _this$findMidptPtsEtc2.vectorNormInverse;
          var adjustedMidpt = {
            x: midptPts.x1 * w1 + midptPts.x2 * w22,
            y: midptPts.y1 * w1 + midptPts.y2 * w22
          };
          rs.ctrlpts.push(adjustedMidpt.x + vectorNormInverse.x * distanceFromMidpoint, adjustedMidpt.y + vectorNormInverse.y * distanceFromMidpoint);
        }
      };
      BRp$c.findTaxiPoints = function(edge, pairInfo) {
        var rs = edge._private.rscratch;
        rs.edgeType = "segments";
        var VERTICAL = "vertical";
        var HORIZONTAL = "horizontal";
        var LEFTWARD = "leftward";
        var RIGHTWARD = "rightward";
        var DOWNWARD = "downward";
        var UPWARD = "upward";
        var AUTO = "auto";
        var posPts = pairInfo.posPts, srcW = pairInfo.srcW, srcH = pairInfo.srcH, tgtW = pairInfo.tgtW, tgtH = pairInfo.tgtH;
        var edgeDistances = edge.pstyle("edge-distances").value;
        var dIncludesNodeBody = edgeDistances !== "node-position";
        var taxiDir = edge.pstyle("taxi-direction").value;
        var rawTaxiDir = taxiDir;
        var taxiTurn = edge.pstyle("taxi-turn");
        var turnIsPercent = taxiTurn.units === "%";
        var taxiTurnPfVal = taxiTurn.pfValue;
        var turnIsNegative = taxiTurnPfVal < 0;
        var minD = edge.pstyle("taxi-turn-min-distance").pfValue;
        var dw = dIncludesNodeBody ? (srcW + tgtW) / 2 : 0;
        var dh = dIncludesNodeBody ? (srcH + tgtH) / 2 : 0;
        var pdx = posPts.x2 - posPts.x1;
        var pdy = posPts.y2 - posPts.y1;
        var subDWH = /* @__PURE__ */ __name(function subDWH2(dxy, dwh) {
          if (dxy > 0) {
            return Math.max(dxy - dwh, 0);
          } else {
            return Math.min(dxy + dwh, 0);
          }
        }, "subDWH");
        var dx = subDWH(pdx, dw);
        var dy = subDWH(pdy, dh);
        var isExplicitDir = false;
        if (rawTaxiDir === AUTO) {
          taxiDir = Math.abs(dx) > Math.abs(dy) ? HORIZONTAL : VERTICAL;
        } else if (rawTaxiDir === UPWARD || rawTaxiDir === DOWNWARD) {
          taxiDir = VERTICAL;
          isExplicitDir = true;
        } else if (rawTaxiDir === LEFTWARD || rawTaxiDir === RIGHTWARD) {
          taxiDir = HORIZONTAL;
          isExplicitDir = true;
        }
        var isVert = taxiDir === VERTICAL;
        var l4 = isVert ? dy : dx;
        var pl = isVert ? pdy : pdx;
        var sgnL = signum(pl);
        var forcedDir = false;
        if (!(isExplicitDir && (turnIsPercent || turnIsNegative)) && (rawTaxiDir === DOWNWARD && pl < 0 || rawTaxiDir === UPWARD && pl > 0 || rawTaxiDir === LEFTWARD && pl > 0 || rawTaxiDir === RIGHTWARD && pl < 0)) {
          sgnL *= -1;
          l4 = sgnL * Math.abs(l4);
          forcedDir = true;
        }
        var d3;
        if (turnIsPercent) {
          var p3 = taxiTurnPfVal < 0 ? 1 + taxiTurnPfVal : taxiTurnPfVal;
          d3 = p3 * l4;
        } else {
          var k2 = taxiTurnPfVal < 0 ? l4 : 0;
          d3 = k2 + taxiTurnPfVal * sgnL;
        }
        var getIsTooClose = /* @__PURE__ */ __name(function getIsTooClose2(d4) {
          return Math.abs(d4) < minD || Math.abs(d4) >= Math.abs(l4);
        }, "getIsTooClose");
        var isTooCloseSrc = getIsTooClose(d3);
        var isTooCloseTgt = getIsTooClose(Math.abs(l4) - Math.abs(d3));
        var isTooClose = isTooCloseSrc || isTooCloseTgt;
        if (isTooClose && !forcedDir) {
          if (isVert) {
            var lShapeInsideSrc = Math.abs(pl) <= srcH / 2;
            var lShapeInsideTgt = Math.abs(pdx) <= tgtW / 2;
            if (lShapeInsideSrc) {
              var x5 = (posPts.x1 + posPts.x2) / 2;
              var y1 = posPts.y1, y22 = posPts.y2;
              rs.segpts = [x5, y1, x5, y22];
            } else if (lShapeInsideTgt) {
              var y6 = (posPts.y1 + posPts.y2) / 2;
              var x1 = posPts.x1, x22 = posPts.x2;
              rs.segpts = [x1, y6, x22, y6];
            } else {
              rs.segpts = [posPts.x1, posPts.y2];
            }
          } else {
            var _lShapeInsideSrc = Math.abs(pl) <= srcW / 2;
            var _lShapeInsideTgt = Math.abs(pdy) <= tgtH / 2;
            if (_lShapeInsideSrc) {
              var _y = (posPts.y1 + posPts.y2) / 2;
              var _x = posPts.x1, _x2 = posPts.x2;
              rs.segpts = [_x, _y, _x2, _y];
            } else if (_lShapeInsideTgt) {
              var _x3 = (posPts.x1 + posPts.x2) / 2;
              var _y2 = posPts.y1, _y3 = posPts.y2;
              rs.segpts = [_x3, _y2, _x3, _y3];
            } else {
              rs.segpts = [posPts.x2, posPts.y1];
            }
          }
        } else {
          if (isVert) {
            var _y4 = posPts.y1 + d3 + (dIncludesNodeBody ? srcH / 2 * sgnL : 0);
            var _x4 = posPts.x1, _x5 = posPts.x2;
            rs.segpts = [_x4, _y4, _x5, _y4];
          } else {
            var _x6 = posPts.x1 + d3 + (dIncludesNodeBody ? srcW / 2 * sgnL : 0);
            var _y5 = posPts.y1, _y6 = posPts.y2;
            rs.segpts = [_x6, _y5, _x6, _y6];
          }
        }
        if (rs.isRound) {
          var radius2 = edge.pstyle("taxi-radius").value;
          var isArcRadius = edge.pstyle("radius-type").value[0] === "arc-radius";
          rs.radii = new Array(rs.segpts.length / 2).fill(radius2);
          rs.isArcRadius = new Array(rs.segpts.length / 2).fill(isArcRadius);
        }
      };
      BRp$c.tryToCorrectInvalidPoints = function(edge, pairInfo) {
        var rs = edge._private.rscratch;
        if (rs.edgeType === "bezier") {
          var srcPos = pairInfo.srcPos, tgtPos = pairInfo.tgtPos, srcW = pairInfo.srcW, srcH = pairInfo.srcH, tgtW = pairInfo.tgtW, tgtH = pairInfo.tgtH, srcShape = pairInfo.srcShape, tgtShape = pairInfo.tgtShape, srcCornerRadius = pairInfo.srcCornerRadius, tgtCornerRadius = pairInfo.tgtCornerRadius, srcRs = pairInfo.srcRs, tgtRs = pairInfo.tgtRs;
          var badStart = !number$1(rs.startX) || !number$1(rs.startY);
          var badAStart = !number$1(rs.arrowStartX) || !number$1(rs.arrowStartY);
          var badEnd = !number$1(rs.endX) || !number$1(rs.endY);
          var badAEnd = !number$1(rs.arrowEndX) || !number$1(rs.arrowEndY);
          var minCpADistFactor = 3;
          var arrowW = this.getArrowWidth(edge.pstyle("width").pfValue, edge.pstyle("arrow-scale").value) * this.arrowShapeWidth;
          var minCpADist = minCpADistFactor * arrowW;
          var startACpDist = dist({
            x: rs.ctrlpts[0],
            y: rs.ctrlpts[1]
          }, {
            x: rs.startX,
            y: rs.startY
          });
          var closeStartACp = startACpDist < minCpADist;
          var endACpDist = dist({
            x: rs.ctrlpts[0],
            y: rs.ctrlpts[1]
          }, {
            x: rs.endX,
            y: rs.endY
          });
          var closeEndACp = endACpDist < minCpADist;
          var overlapping = false;
          if (badStart || badAStart || closeStartACp) {
            overlapping = true;
            var cpD = {
              // delta
              x: rs.ctrlpts[0] - srcPos.x,
              y: rs.ctrlpts[1] - srcPos.y
            };
            var cpL = Math.sqrt(cpD.x * cpD.x + cpD.y * cpD.y);
            var cpM = {
              // normalised delta
              x: cpD.x / cpL,
              y: cpD.y / cpL
            };
            var radius2 = Math.max(srcW, srcH);
            var cpProj = {
              // *2 radius guarantees outside shape
              x: rs.ctrlpts[0] + cpM.x * 2 * radius2,
              y: rs.ctrlpts[1] + cpM.y * 2 * radius2
            };
            var srcCtrlPtIntn = srcShape.intersectLine(srcPos.x, srcPos.y, srcW, srcH, cpProj.x, cpProj.y, 0, srcCornerRadius, srcRs);
            if (closeStartACp) {
              rs.ctrlpts[0] = rs.ctrlpts[0] + cpM.x * (minCpADist - startACpDist);
              rs.ctrlpts[1] = rs.ctrlpts[1] + cpM.y * (minCpADist - startACpDist);
            } else {
              rs.ctrlpts[0] = srcCtrlPtIntn[0] + cpM.x * minCpADist;
              rs.ctrlpts[1] = srcCtrlPtIntn[1] + cpM.y * minCpADist;
            }
          }
          if (badEnd || badAEnd || closeEndACp) {
            overlapping = true;
            var _cpD = {
              // delta
              x: rs.ctrlpts[0] - tgtPos.x,
              y: rs.ctrlpts[1] - tgtPos.y
            };
            var _cpL = Math.sqrt(_cpD.x * _cpD.x + _cpD.y * _cpD.y);
            var _cpM = {
              // normalised delta
              x: _cpD.x / _cpL,
              y: _cpD.y / _cpL
            };
            var _radius = Math.max(srcW, srcH);
            var _cpProj = {
              // *2 radius guarantees outside shape
              x: rs.ctrlpts[0] + _cpM.x * 2 * _radius,
              y: rs.ctrlpts[1] + _cpM.y * 2 * _radius
            };
            var tgtCtrlPtIntn = tgtShape.intersectLine(tgtPos.x, tgtPos.y, tgtW, tgtH, _cpProj.x, _cpProj.y, 0, tgtCornerRadius, tgtRs);
            if (closeEndACp) {
              rs.ctrlpts[0] = rs.ctrlpts[0] + _cpM.x * (minCpADist - endACpDist);
              rs.ctrlpts[1] = rs.ctrlpts[1] + _cpM.y * (minCpADist - endACpDist);
            } else {
              rs.ctrlpts[0] = tgtCtrlPtIntn[0] + _cpM.x * minCpADist;
              rs.ctrlpts[1] = tgtCtrlPtIntn[1] + _cpM.y * minCpADist;
            }
          }
          if (overlapping) {
            this.findEndpoints(edge);
          }
        }
      };
      BRp$c.storeAllpts = function(edge) {
        var rs = edge._private.rscratch;
        if (rs.edgeType === "multibezier" || rs.edgeType === "bezier" || rs.edgeType === "self" || rs.edgeType === "compound") {
          rs.allpts = [];
          rs.allpts.push(rs.startX, rs.startY);
          for (var b3 = 0; b3 + 1 < rs.ctrlpts.length; b3 += 2) {
            rs.allpts.push(rs.ctrlpts[b3], rs.ctrlpts[b3 + 1]);
            if (b3 + 3 < rs.ctrlpts.length) {
              rs.allpts.push((rs.ctrlpts[b3] + rs.ctrlpts[b3 + 2]) / 2, (rs.ctrlpts[b3 + 1] + rs.ctrlpts[b3 + 3]) / 2);
            }
          }
          rs.allpts.push(rs.endX, rs.endY);
          var m3, mt;
          if (rs.ctrlpts.length / 2 % 2 === 0) {
            m3 = rs.allpts.length / 2 - 1;
            rs.midX = rs.allpts[m3];
            rs.midY = rs.allpts[m3 + 1];
          } else {
            m3 = rs.allpts.length / 2 - 3;
            mt = 0.5;
            rs.midX = qbezierAt(rs.allpts[m3], rs.allpts[m3 + 2], rs.allpts[m3 + 4], mt);
            rs.midY = qbezierAt(rs.allpts[m3 + 1], rs.allpts[m3 + 3], rs.allpts[m3 + 5], mt);
          }
        } else if (rs.edgeType === "straight") {
          rs.allpts = [rs.startX, rs.startY, rs.endX, rs.endY];
          rs.midX = (rs.startX + rs.endX + rs.arrowStartX + rs.arrowEndX) / 4;
          rs.midY = (rs.startY + rs.endY + rs.arrowStartY + rs.arrowEndY) / 4;
        } else if (rs.edgeType === "segments") {
          rs.allpts = [];
          rs.allpts.push(rs.startX, rs.startY);
          rs.allpts.push.apply(rs.allpts, rs.segpts);
          rs.allpts.push(rs.endX, rs.endY);
          if (rs.isRound) {
            rs.roundCorners = [];
            for (var i2 = 2; i2 + 3 < rs.allpts.length; i2 += 2) {
              var radius2 = rs.radii[i2 / 2 - 1];
              var isArcRadius = rs.isArcRadius[i2 / 2 - 1];
              rs.roundCorners.push(getRoundCorner({
                x: rs.allpts[i2 - 2],
                y: rs.allpts[i2 - 1]
              }, {
                x: rs.allpts[i2],
                y: rs.allpts[i2 + 1],
                radius: radius2
              }, {
                x: rs.allpts[i2 + 2],
                y: rs.allpts[i2 + 3]
              }, radius2, isArcRadius));
            }
          }
          if (rs.segpts.length % 4 === 0) {
            var i22 = rs.segpts.length / 2;
            var i1 = i22 - 2;
            rs.midX = (rs.segpts[i1] + rs.segpts[i22]) / 2;
            rs.midY = (rs.segpts[i1 + 1] + rs.segpts[i22 + 1]) / 2;
          } else {
            var _i = rs.segpts.length / 2 - 1;
            if (!rs.isRound) {
              rs.midX = rs.segpts[_i];
              rs.midY = rs.segpts[_i + 1];
            } else {
              var point8 = {
                x: rs.segpts[_i],
                y: rs.segpts[_i + 1]
              };
              var corner = rs.roundCorners[_i / 2];
              if (corner.radius === 0) {
                var nextPoint = {
                  x: rs.segpts[_i + 2],
                  y: rs.segpts[_i + 3]
                };
                rs.midX = point8.x;
                rs.midY = point8.y;
                rs.midVector = [point8.y - nextPoint.y, nextPoint.x - point8.x];
              } else {
                var v3 = [point8.x - corner.cx, point8.y - corner.cy];
                var factor = corner.radius / Math.sqrt(Math.pow(v3[0], 2) + Math.pow(v3[1], 2));
                v3 = v3.map(function(c3) {
                  return c3 * factor;
                });
                rs.midX = corner.cx + v3[0];
                rs.midY = corner.cy + v3[1];
                rs.midVector = v3;
              }
            }
          }
        }
      };
      BRp$c.checkForInvalidEdgeWarning = function(edge) {
        var rs = edge[0]._private.rscratch;
        if (rs.nodesOverlap || number$1(rs.startX) && number$1(rs.startY) && number$1(rs.endX) && number$1(rs.endY)) {
          rs.loggedErr = false;
        } else {
          if (!rs.loggedErr) {
            rs.loggedErr = true;
            warn("Edge `" + edge.id() + "` has invalid endpoints and so it is impossible to draw.  Adjust your edge style (e.g. control points) accordingly or use an alternative edge type.  This is expected behaviour when the source node and the target node overlap.");
          }
        }
      };
      BRp$c.findEdgeControlPoints = function(edges3) {
        var _this = this;
        if (!edges3 || edges3.length === 0) {
          return;
        }
        var r2 = this;
        var cy = r2.cy;
        var hasCompounds = cy.hasCompoundNodes();
        var hashTable = new Map$1();
        var getKey3 = /* @__PURE__ */ __name(function getKey4(pairId2, edgeIsUnbundled2) {
          return [].concat(_toConsumableArray(pairId2), [edgeIsUnbundled2 ? 1 : 0]).join("-");
        }, "getKey");
        var pairIds = [];
        var haystackEdges = [];
        for (var i2 = 0; i2 < edges3.length; i2++) {
          var edge = edges3[i2];
          var _p = edge._private;
          var curveStyle = edge.pstyle("curve-style").value;
          if (edge.removed() || !edge.takesUpSpace()) {
            continue;
          }
          if (curveStyle === "haystack") {
            haystackEdges.push(edge);
            continue;
          }
          var edgeIsUnbundled = curveStyle === "unbundled-bezier" || endsWith(curveStyle, "segments") || curveStyle === "straight" || curveStyle === "straight-triangle" || endsWith(curveStyle, "taxi");
          var edgeIsBezier = curveStyle === "unbundled-bezier" || curveStyle === "bezier";
          var src = _p.source;
          var tgt = _p.target;
          var srcIndex = src.poolIndex();
          var tgtIndex = tgt.poolIndex();
          var pairId = [srcIndex, tgtIndex].sort();
          var key = getKey3(pairId, edgeIsUnbundled);
          var tableEntry = hashTable.get(key);
          if (tableEntry == null) {
            tableEntry = {
              eles: []
            };
            pairIds.push({
              pairId,
              edgeIsUnbundled
            });
            hashTable.set(key, tableEntry);
          }
          tableEntry.eles.push(edge);
          if (edgeIsUnbundled) {
            tableEntry.hasUnbundled = true;
          }
          if (edgeIsBezier) {
            tableEntry.hasBezier = true;
          }
        }
        var _loop = /* @__PURE__ */ __name(function _loop2() {
          var _pairIds$p = pairIds[p3], pairId2 = _pairIds$p.pairId, edgeIsUnbundled2 = _pairIds$p.edgeIsUnbundled;
          var key2 = getKey3(pairId2, edgeIsUnbundled2);
          var pairInfo = hashTable.get(key2);
          var swappedpairInfo;
          if (!pairInfo.hasUnbundled) {
            var pllEdges = pairInfo.eles[0].parallelEdges().filter(function(e3) {
              return e3.isBundledBezier();
            });
            clearArray(pairInfo.eles);
            pllEdges.forEach(function(edge2) {
              return pairInfo.eles.push(edge2);
            });
            pairInfo.eles.sort(function(edge1, edge2) {
              return edge1.poolIndex() - edge2.poolIndex();
            });
          }
          var firstEdge = pairInfo.eles[0];
          var src2 = firstEdge.source();
          var tgt2 = firstEdge.target();
          if (src2.poolIndex() > tgt2.poolIndex()) {
            var temp = src2;
            src2 = tgt2;
            tgt2 = temp;
          }
          var srcPos = pairInfo.srcPos = src2.position();
          var tgtPos = pairInfo.tgtPos = tgt2.position();
          var srcW = pairInfo.srcW = src2.outerWidth();
          var srcH = pairInfo.srcH = src2.outerHeight();
          var tgtW = pairInfo.tgtW = tgt2.outerWidth();
          var tgtH = pairInfo.tgtH = tgt2.outerHeight();
          var srcShape = pairInfo.srcShape = r2.nodeShapes[_this.getNodeShape(src2)];
          var tgtShape = pairInfo.tgtShape = r2.nodeShapes[_this.getNodeShape(tgt2)];
          var srcCornerRadius = pairInfo.srcCornerRadius = src2.pstyle("corner-radius").value === "auto" ? "auto" : src2.pstyle("corner-radius").pfValue;
          var tgtCornerRadius = pairInfo.tgtCornerRadius = tgt2.pstyle("corner-radius").value === "auto" ? "auto" : tgt2.pstyle("corner-radius").pfValue;
          var tgtRs = pairInfo.tgtRs = tgt2._private.rscratch;
          var srcRs = pairInfo.srcRs = src2._private.rscratch;
          pairInfo.dirCounts = {
            "north": 0,
            "west": 0,
            "south": 0,
            "east": 0,
            "northwest": 0,
            "southwest": 0,
            "northeast": 0,
            "southeast": 0
          };
          for (var _i2 = 0; _i2 < pairInfo.eles.length; _i2++) {
            var _edge = pairInfo.eles[_i2];
            var rs = _edge[0]._private.rscratch;
            var _curveStyle = _edge.pstyle("curve-style").value;
            var _edgeIsUnbundled = _curveStyle === "unbundled-bezier" || endsWith(_curveStyle, "segments") || endsWith(_curveStyle, "taxi");
            var edgeIsSwapped = !src2.same(_edge.source());
            if (!pairInfo.calculatedIntersection && src2 !== tgt2 && (pairInfo.hasBezier || pairInfo.hasUnbundled)) {
              pairInfo.calculatedIntersection = true;
              var srcOutside = srcShape.intersectLine(srcPos.x, srcPos.y, srcW, srcH, tgtPos.x, tgtPos.y, 0, srcCornerRadius, srcRs);
              var srcIntn = pairInfo.srcIntn = srcOutside;
              var tgtOutside = tgtShape.intersectLine(tgtPos.x, tgtPos.y, tgtW, tgtH, srcPos.x, srcPos.y, 0, tgtCornerRadius, tgtRs);
              var tgtIntn = pairInfo.tgtIntn = tgtOutside;
              var intersectionPts = pairInfo.intersectionPts = {
                x1: srcOutside[0],
                x2: tgtOutside[0],
                y1: srcOutside[1],
                y2: tgtOutside[1]
              };
              var posPts = pairInfo.posPts = {
                x1: srcPos.x,
                x2: tgtPos.x,
                y1: srcPos.y,
                y2: tgtPos.y
              };
              var dy = tgtOutside[1] - srcOutside[1];
              var dx = tgtOutside[0] - srcOutside[0];
              var l4 = Math.sqrt(dx * dx + dy * dy);
              if (number$1(l4) && l4 >= AVOID_IMPOSSIBLE_BEZIER_CONSTANT_L) ;
              else {
                l4 = Math.sqrt(Math.max(dx * dx, AVOID_IMPOSSIBLE_BEZIER_CONSTANT) + Math.max(dy * dy, AVOID_IMPOSSIBLE_BEZIER_CONSTANT));
              }
              var vector = pairInfo.vector = {
                x: dx,
                y: dy
              };
              var vectorNorm = pairInfo.vectorNorm = {
                x: vector.x / l4,
                y: vector.y / l4
              };
              var vectorNormInverse = {
                x: -vectorNorm.y,
                y: vectorNorm.x
              };
              pairInfo.nodesOverlap = !number$1(l4) || tgtShape.checkPoint(srcOutside[0], srcOutside[1], 0, tgtW, tgtH, tgtPos.x, tgtPos.y, tgtCornerRadius, tgtRs) || srcShape.checkPoint(tgtOutside[0], tgtOutside[1], 0, srcW, srcH, srcPos.x, srcPos.y, srcCornerRadius, srcRs);
              pairInfo.vectorNormInverse = vectorNormInverse;
              swappedpairInfo = {
                nodesOverlap: pairInfo.nodesOverlap,
                dirCounts: pairInfo.dirCounts,
                calculatedIntersection: true,
                hasBezier: pairInfo.hasBezier,
                hasUnbundled: pairInfo.hasUnbundled,
                eles: pairInfo.eles,
                srcPos: tgtPos,
                srcRs: tgtRs,
                tgtPos: srcPos,
                tgtRs: srcRs,
                srcW: tgtW,
                srcH: tgtH,
                tgtW: srcW,
                tgtH: srcH,
                srcIntn: tgtIntn,
                tgtIntn: srcIntn,
                srcShape: tgtShape,
                tgtShape: srcShape,
                posPts: {
                  x1: posPts.x2,
                  y1: posPts.y2,
                  x2: posPts.x1,
                  y2: posPts.y1
                },
                intersectionPts: {
                  x1: intersectionPts.x2,
                  y1: intersectionPts.y2,
                  x2: intersectionPts.x1,
                  y2: intersectionPts.y1
                },
                vector: {
                  x: -vector.x,
                  y: -vector.y
                },
                vectorNorm: {
                  x: -vectorNorm.x,
                  y: -vectorNorm.y
                },
                vectorNormInverse: {
                  x: -vectorNormInverse.x,
                  y: -vectorNormInverse.y
                }
              };
            }
            var passedPairInfo = edgeIsSwapped ? swappedpairInfo : pairInfo;
            rs.nodesOverlap = passedPairInfo.nodesOverlap;
            rs.srcIntn = passedPairInfo.srcIntn;
            rs.tgtIntn = passedPairInfo.tgtIntn;
            rs.isRound = _curveStyle.startsWith("round");
            if (hasCompounds && (src2.isParent() || src2.isChild() || tgt2.isParent() || tgt2.isChild()) && (src2.parents().anySame(tgt2) || tgt2.parents().anySame(src2) || src2.same(tgt2) && src2.isParent())) {
              _this.findCompoundLoopPoints(_edge, passedPairInfo, _i2, _edgeIsUnbundled);
            } else if (src2 === tgt2) {
              _this.findLoopPoints(_edge, passedPairInfo, _i2, _edgeIsUnbundled);
            } else if (_curveStyle.endsWith("segments")) {
              _this.findSegmentsPoints(_edge, passedPairInfo);
            } else if (_curveStyle.endsWith("taxi")) {
              _this.findTaxiPoints(_edge, passedPairInfo);
            } else if (_curveStyle === "straight" || !_edgeIsUnbundled && pairInfo.eles.length % 2 === 1 && _i2 === Math.floor(pairInfo.eles.length / 2)) {
              _this.findStraightEdgePoints(_edge);
            } else {
              _this.findBezierPoints(_edge, passedPairInfo, _i2, _edgeIsUnbundled, edgeIsSwapped);
            }
            _this.findEndpoints(_edge);
            _this.tryToCorrectInvalidPoints(_edge, passedPairInfo);
            _this.checkForInvalidEdgeWarning(_edge);
            _this.storeAllpts(_edge);
            _this.storeEdgeProjections(_edge);
            _this.calculateArrowAngles(_edge);
            _this.recalculateEdgeLabelProjections(_edge);
            _this.calculateLabelAngles(_edge);
          }
        }, "_loop");
        for (var p3 = 0; p3 < pairIds.length; p3++) {
          _loop();
        }
        this.findHaystackPoints(haystackEdges);
      };
      __name(getPts, "getPts");
      BRp$c.getSegmentPoints = function(edge) {
        var rs = edge[0]._private.rscratch;
        this.recalculateRenderedStyle(edge);
        var type3 = rs.edgeType;
        if (type3 === "segments") {
          return getPts(rs.segpts);
        }
      };
      BRp$c.getControlPoints = function(edge) {
        var rs = edge[0]._private.rscratch;
        this.recalculateRenderedStyle(edge);
        var type3 = rs.edgeType;
        if (type3 === "bezier" || type3 === "multibezier" || type3 === "self" || type3 === "compound") {
          return getPts(rs.ctrlpts);
        }
      };
      BRp$c.getEdgeMidpoint = function(edge) {
        var rs = edge[0]._private.rscratch;
        this.recalculateRenderedStyle(edge);
        return {
          x: rs.midX,
          y: rs.midY
        };
      };
      BRp$b = {};
      BRp$b.manualEndptToPx = function(node2, prop) {
        var r2 = this;
        var npos = node2.position();
        var w4 = node2.outerWidth();
        var h3 = node2.outerHeight();
        var rs = node2._private.rscratch;
        if (prop.value.length === 2) {
          var p3 = [prop.pfValue[0], prop.pfValue[1]];
          if (prop.units[0] === "%") {
            p3[0] = p3[0] * w4;
          }
          if (prop.units[1] === "%") {
            p3[1] = p3[1] * h3;
          }
          p3[0] += npos.x;
          p3[1] += npos.y;
          return p3;
        } else {
          var angle2 = prop.pfValue[0];
          angle2 = -Math.PI / 2 + angle2;
          var l4 = 2 * Math.max(w4, h3);
          var _p = [npos.x + Math.cos(angle2) * l4, npos.y + Math.sin(angle2) * l4];
          return r2.nodeShapes[this.getNodeShape(node2)].intersectLine(npos.x, npos.y, w4, h3, _p[0], _p[1], 0, node2.pstyle("corner-radius").value === "auto" ? "auto" : node2.pstyle("corner-radius").pfValue, rs);
        }
      };
      BRp$b.findEndpoints = function(edge) {
        var _ref, _tgtManEndpt$pfValue, _ref2, _srcManEndpt$pfValue;
        var r2 = this;
        var intersect3;
        var source = edge.source()[0];
        var target = edge.target()[0];
        var srcPos = source.position();
        var tgtPos = target.position();
        var tgtArShape = edge.pstyle("target-arrow-shape").value;
        var srcArShape = edge.pstyle("source-arrow-shape").value;
        var tgtDist = edge.pstyle("target-distance-from-node").pfValue;
        var srcDist = edge.pstyle("source-distance-from-node").pfValue;
        var srcRs = source._private.rscratch;
        var tgtRs = target._private.rscratch;
        var curveStyle = edge.pstyle("curve-style").value;
        var rs = edge._private.rscratch;
        var et2 = rs.edgeType;
        var taxi = endsWith(curveStyle, "taxi");
        var self2 = et2 === "self" || et2 === "compound";
        var bezier = et2 === "bezier" || et2 === "multibezier" || self2;
        var multi = et2 !== "bezier";
        var lines = et2 === "straight" || et2 === "segments";
        var segments = et2 === "segments";
        var hasEndpts = bezier || multi || lines;
        var overrideEndpts = self2 || taxi;
        var srcManEndpt = edge.pstyle("source-endpoint");
        var srcManEndptVal = overrideEndpts ? "outside-to-node" : srcManEndpt.value;
        var srcCornerRadius = source.pstyle("corner-radius").value === "auto" ? "auto" : source.pstyle("corner-radius").pfValue;
        var tgtManEndpt = edge.pstyle("target-endpoint");
        var tgtManEndptVal = overrideEndpts ? "outside-to-node" : tgtManEndpt.value;
        var tgtCornerRadius = target.pstyle("corner-radius").value === "auto" ? "auto" : target.pstyle("corner-radius").pfValue;
        rs.srcManEndpt = srcManEndpt;
        rs.tgtManEndpt = tgtManEndpt;
        var p1;
        var p22;
        var p1_i;
        var p2_i;
        var tgtManEndptPt = (_ref = (tgtManEndpt === null || tgtManEndpt === void 0 || (_tgtManEndpt$pfValue = tgtManEndpt.pfValue) === null || _tgtManEndpt$pfValue === void 0 ? void 0 : _tgtManEndpt$pfValue.length) === 2 ? tgtManEndpt.pfValue : null) !== null && _ref !== void 0 ? _ref : [0, 0];
        var srcManEndptPt = (_ref2 = (srcManEndpt === null || srcManEndpt === void 0 || (_srcManEndpt$pfValue = srcManEndpt.pfValue) === null || _srcManEndpt$pfValue === void 0 ? void 0 : _srcManEndpt$pfValue.length) === 2 ? srcManEndpt.pfValue : null) !== null && _ref2 !== void 0 ? _ref2 : [0, 0];
        if (bezier) {
          var cpStart = [rs.ctrlpts[0], rs.ctrlpts[1]];
          var cpEnd = multi ? [rs.ctrlpts[rs.ctrlpts.length - 2], rs.ctrlpts[rs.ctrlpts.length - 1]] : cpStart;
          p1 = cpEnd;
          p22 = cpStart;
        } else if (lines) {
          var srcArrowFromPt = !segments ? [tgtPos.x + tgtManEndptPt[0], tgtPos.y + tgtManEndptPt[1]] : rs.segpts.slice(0, 2);
          var tgtArrowFromPt = !segments ? [srcPos.x + srcManEndptPt[0], srcPos.y + srcManEndptPt[1]] : rs.segpts.slice(rs.segpts.length - 2);
          p1 = tgtArrowFromPt;
          p22 = srcArrowFromPt;
        }
        if (tgtManEndptVal === "inside-to-node") {
          intersect3 = [tgtPos.x, tgtPos.y];
        } else if (tgtManEndpt.units) {
          intersect3 = this.manualEndptToPx(target, tgtManEndpt);
        } else if (tgtManEndptVal === "outside-to-line") {
          intersect3 = rs.tgtIntn;
        } else {
          if (tgtManEndptVal === "outside-to-node" || tgtManEndptVal === "outside-to-node-or-label") {
            p1_i = p1;
          } else if (tgtManEndptVal === "outside-to-line" || tgtManEndptVal === "outside-to-line-or-label") {
            p1_i = [srcPos.x, srcPos.y];
          }
          intersect3 = r2.nodeShapes[this.getNodeShape(target)].intersectLine(tgtPos.x, tgtPos.y, target.outerWidth(), target.outerHeight(), p1_i[0], p1_i[1], 0, tgtCornerRadius, tgtRs);
          if (tgtManEndptVal === "outside-to-node-or-label" || tgtManEndptVal === "outside-to-line-or-label") {
            var trs = target._private.rscratch;
            var lw = trs.labelWidth;
            var lh = trs.labelHeight;
            var lx = trs.labelX;
            var ly = trs.labelY;
            var lw2 = lw / 2;
            var lh2 = lh / 2;
            var va = target.pstyle("text-valign").value;
            if (va === "top") {
              ly -= lh2;
            } else if (va === "bottom") {
              ly += lh2;
            }
            var ha = target.pstyle("text-halign").value;
            if (ha === "left") {
              lx -= lw2;
            } else if (ha === "right") {
              lx += lw2;
            }
            var labelIntersect = polygonIntersectLine(p1_i[0], p1_i[1], [lx - lw2, ly - lh2, lx + lw2, ly - lh2, lx + lw2, ly + lh2, lx - lw2, ly + lh2], tgtPos.x, tgtPos.y);
            if (labelIntersect.length > 0) {
              var refPt = srcPos;
              var intSqdist = sqdist(refPt, array2point(intersect3));
              var labIntSqdist = sqdist(refPt, array2point(labelIntersect));
              var minSqDist = intSqdist;
              if (labIntSqdist < intSqdist) {
                intersect3 = labelIntersect;
                minSqDist = labIntSqdist;
              }
              if (labelIntersect.length > 2) {
                var labInt2SqDist = sqdist(refPt, {
                  x: labelIntersect[2],
                  y: labelIntersect[3]
                });
                if (labInt2SqDist < minSqDist) {
                  intersect3 = [labelIntersect[2], labelIntersect[3]];
                }
              }
            }
          }
        }
        var arrowEnd = shortenIntersection(intersect3, p1, r2.arrowShapes[tgtArShape].spacing(edge) + tgtDist);
        var edgeEnd = shortenIntersection(intersect3, p1, r2.arrowShapes[tgtArShape].gap(edge) + tgtDist);
        rs.endX = edgeEnd[0];
        rs.endY = edgeEnd[1];
        rs.arrowEndX = arrowEnd[0];
        rs.arrowEndY = arrowEnd[1];
        if (srcManEndptVal === "inside-to-node") {
          intersect3 = [srcPos.x, srcPos.y];
        } else if (srcManEndpt.units) {
          intersect3 = this.manualEndptToPx(source, srcManEndpt);
        } else if (srcManEndptVal === "outside-to-line") {
          intersect3 = rs.srcIntn;
        } else {
          if (srcManEndptVal === "outside-to-node" || srcManEndptVal === "outside-to-node-or-label") {
            p2_i = p22;
          } else if (srcManEndptVal === "outside-to-line" || srcManEndptVal === "outside-to-line-or-label") {
            p2_i = [tgtPos.x, tgtPos.y];
          }
          intersect3 = r2.nodeShapes[this.getNodeShape(source)].intersectLine(srcPos.x, srcPos.y, source.outerWidth(), source.outerHeight(), p2_i[0], p2_i[1], 0, srcCornerRadius, srcRs);
          if (srcManEndptVal === "outside-to-node-or-label" || srcManEndptVal === "outside-to-line-or-label") {
            var srs = source._private.rscratch;
            var _lw = srs.labelWidth;
            var _lh = srs.labelHeight;
            var _lx = srs.labelX;
            var _ly = srs.labelY;
            var _lw2 = _lw / 2;
            var _lh2 = _lh / 2;
            var _va = source.pstyle("text-valign").value;
            if (_va === "top") {
              _ly -= _lh2;
            } else if (_va === "bottom") {
              _ly += _lh2;
            }
            var _ha = source.pstyle("text-halign").value;
            if (_ha === "left") {
              _lx -= _lw2;
            } else if (_ha === "right") {
              _lx += _lw2;
            }
            var _labelIntersect = polygonIntersectLine(p2_i[0], p2_i[1], [_lx - _lw2, _ly - _lh2, _lx + _lw2, _ly - _lh2, _lx + _lw2, _ly + _lh2, _lx - _lw2, _ly + _lh2], srcPos.x, srcPos.y);
            if (_labelIntersect.length > 0) {
              var _refPt = tgtPos;
              var _intSqdist = sqdist(_refPt, array2point(intersect3));
              var _labIntSqdist = sqdist(_refPt, array2point(_labelIntersect));
              var _minSqDist = _intSqdist;
              if (_labIntSqdist < _intSqdist) {
                intersect3 = [_labelIntersect[0], _labelIntersect[1]];
                _minSqDist = _labIntSqdist;
              }
              if (_labelIntersect.length > 2) {
                var _labInt2SqDist = sqdist(_refPt, {
                  x: _labelIntersect[2],
                  y: _labelIntersect[3]
                });
                if (_labInt2SqDist < _minSqDist) {
                  intersect3 = [_labelIntersect[2], _labelIntersect[3]];
                }
              }
            }
          }
        }
        var arrowStart = shortenIntersection(intersect3, p22, r2.arrowShapes[srcArShape].spacing(edge) + srcDist);
        var edgeStart = shortenIntersection(intersect3, p22, r2.arrowShapes[srcArShape].gap(edge) + srcDist);
        rs.startX = edgeStart[0];
        rs.startY = edgeStart[1];
        rs.arrowStartX = arrowStart[0];
        rs.arrowStartY = arrowStart[1];
        if (hasEndpts) {
          if (!number$1(rs.startX) || !number$1(rs.startY) || !number$1(rs.endX) || !number$1(rs.endY)) {
            rs.badLine = true;
          } else {
            rs.badLine = false;
          }
        }
      };
      BRp$b.getSourceEndpoint = function(edge) {
        var rs = edge[0]._private.rscratch;
        this.recalculateRenderedStyle(edge);
        switch (rs.edgeType) {
          case "haystack":
            return {
              x: rs.haystackPts[0],
              y: rs.haystackPts[1]
            };
          default:
            return {
              x: rs.arrowStartX,
              y: rs.arrowStartY
            };
        }
      };
      BRp$b.getTargetEndpoint = function(edge) {
        var rs = edge[0]._private.rscratch;
        this.recalculateRenderedStyle(edge);
        switch (rs.edgeType) {
          case "haystack":
            return {
              x: rs.haystackPts[2],
              y: rs.haystackPts[3]
            };
          default:
            return {
              x: rs.arrowEndX,
              y: rs.arrowEndY
            };
        }
      };
      BRp$a = {};
      __name(pushBezierPts, "pushBezierPts");
      BRp$a.storeEdgeProjections = function(edge) {
        var _p = edge._private;
        var rs = _p.rscratch;
        var et2 = rs.edgeType;
        _p.rstyle.bezierPts = null;
        _p.rstyle.linePts = null;
        _p.rstyle.haystackPts = null;
        if (et2 === "multibezier" || et2 === "bezier" || et2 === "self" || et2 === "compound") {
          _p.rstyle.bezierPts = [];
          for (var i2 = 0; i2 + 5 < rs.allpts.length; i2 += 4) {
            pushBezierPts(this, edge, rs.allpts.slice(i2, i2 + 6));
          }
        } else if (et2 === "segments") {
          var lpts = _p.rstyle.linePts = [];
          for (var i2 = 0; i2 + 1 < rs.allpts.length; i2 += 2) {
            lpts.push({
              x: rs.allpts[i2],
              y: rs.allpts[i2 + 1]
            });
          }
        } else if (et2 === "haystack") {
          var hpts = rs.haystackPts;
          _p.rstyle.haystackPts = [{
            x: hpts[0],
            y: hpts[1]
          }, {
            x: hpts[2],
            y: hpts[3]
          }];
        }
        _p.rstyle.arrowWidth = this.getArrowWidth(edge.pstyle("width").pfValue, edge.pstyle("arrow-scale").value) * this.arrowShapeWidth;
      };
      BRp$a.recalculateEdgeProjections = function(edges3) {
        this.findEdgeControlPoints(edges3);
      };
      BRp$9 = {};
      BRp$9.recalculateNodeLabelProjection = function(node2) {
        var content = node2.pstyle("label").strValue;
        if (emptyString(content)) {
          return;
        }
        var textX, textY;
        var _p = node2._private;
        var nodeWidth = node2.width();
        var nodeHeight = node2.height();
        var padding2 = node2.padding();
        var nodePos = node2.position();
        var textHalign = node2.pstyle("text-halign").strValue;
        var textValign = node2.pstyle("text-valign").strValue;
        var rs = _p.rscratch;
        var rstyle = _p.rstyle;
        switch (textHalign) {
          case "left":
            textX = nodePos.x - nodeWidth / 2 - padding2;
            break;
          case "right":
            textX = nodePos.x + nodeWidth / 2 + padding2;
            break;
          default:
            textX = nodePos.x;
        }
        switch (textValign) {
          case "top":
            textY = nodePos.y - nodeHeight / 2 - padding2;
            break;
          case "bottom":
            textY = nodePos.y + nodeHeight / 2 + padding2;
            break;
          default:
            textY = nodePos.y;
        }
        rs.labelX = textX;
        rs.labelY = textY;
        rstyle.labelX = textX;
        rstyle.labelY = textY;
        this.calculateLabelAngles(node2);
        this.applyLabelDimensions(node2);
      };
      lineAngleFromDelta = /* @__PURE__ */ __name(function lineAngleFromDelta2(dx, dy) {
        var angle2 = Math.atan(dy / dx);
        if (dx === 0 && angle2 < 0) {
          angle2 = angle2 * -1;
        }
        return angle2;
      }, "lineAngleFromDelta");
      lineAngle = /* @__PURE__ */ __name(function lineAngle2(p0, p1) {
        var dx = p1.x - p0.x;
        var dy = p1.y - p0.y;
        return lineAngleFromDelta(dx, dy);
      }, "lineAngle");
      bezierAngle = /* @__PURE__ */ __name(function bezierAngle2(p0, p1, p22, t4) {
        var t03 = bound(0, t4 - 1e-3, 1);
        var t13 = bound(0, t4 + 1e-3, 1);
        var lp0 = qbezierPtAt(p0, p1, p22, t03);
        var lp1 = qbezierPtAt(p0, p1, p22, t13);
        return lineAngle(lp0, lp1);
      }, "bezierAngle");
      BRp$9.recalculateEdgeLabelProjections = function(edge) {
        var p3;
        var _p = edge._private;
        var rs = _p.rscratch;
        var r2 = this;
        var content = {
          mid: edge.pstyle("label").strValue,
          source: edge.pstyle("source-label").strValue,
          target: edge.pstyle("target-label").strValue
        };
        if (content.mid || content.source || content.target) ;
        else {
          return;
        }
        p3 = {
          x: rs.midX,
          y: rs.midY
        };
        var setRs = /* @__PURE__ */ __name(function setRs2(propName, prefix, value2) {
          setPrefixedProperty(_p.rscratch, propName, prefix, value2);
          setPrefixedProperty(_p.rstyle, propName, prefix, value2);
        }, "setRs");
        setRs("labelX", null, p3.x);
        setRs("labelY", null, p3.y);
        var midAngle = lineAngleFromDelta(rs.midDispX, rs.midDispY);
        setRs("labelAutoAngle", null, midAngle);
        var _createControlPointInfo = /* @__PURE__ */ __name(function createControlPointInfo() {
          if (_createControlPointInfo.cache) {
            return _createControlPointInfo.cache;
          }
          var ctrlpts = [];
          for (var i2 = 0; i2 + 5 < rs.allpts.length; i2 += 4) {
            var p0 = {
              x: rs.allpts[i2],
              y: rs.allpts[i2 + 1]
            };
            var p1 = {
              x: rs.allpts[i2 + 2],
              y: rs.allpts[i2 + 3]
            };
            var p22 = {
              x: rs.allpts[i2 + 4],
              y: rs.allpts[i2 + 5]
            };
            ctrlpts.push({
              p0,
              p1,
              p2: p22,
              startDist: 0,
              length: 0,
              segments: []
            });
          }
          var bpts = _p.rstyle.bezierPts;
          var nProjs = r2.bezierProjPcts.length;
          function addSegment(cp2, p02, p12, t03, t13) {
            var length2 = dist(p02, p12);
            var prevSegment = cp2.segments[cp2.segments.length - 1];
            var segment = {
              p0: p02,
              p1: p12,
              t0: t03,
              t1: t13,
              startDist: prevSegment ? prevSegment.startDist + prevSegment.length : 0,
              length: length2
            };
            cp2.segments.push(segment);
            cp2.length += length2;
          }
          __name(addSegment, "addSegment");
          for (var _i = 0; _i < ctrlpts.length; _i++) {
            var cp = ctrlpts[_i];
            var prevCp = ctrlpts[_i - 1];
            if (prevCp) {
              cp.startDist = prevCp.startDist + prevCp.length;
            }
            addSegment(cp, cp.p0, bpts[_i * nProjs], 0, r2.bezierProjPcts[0]);
            for (var j3 = 0; j3 < nProjs - 1; j3++) {
              addSegment(cp, bpts[_i * nProjs + j3], bpts[_i * nProjs + j3 + 1], r2.bezierProjPcts[j3], r2.bezierProjPcts[j3 + 1]);
            }
            addSegment(cp, bpts[_i * nProjs + nProjs - 1], cp.p2, r2.bezierProjPcts[nProjs - 1], 1);
          }
          return _createControlPointInfo.cache = ctrlpts;
        }, "createControlPointInfo");
        var calculateEndProjection = /* @__PURE__ */ __name(function calculateEndProjection2(prefix) {
          var angle2;
          var isSrc = prefix === "source";
          if (!content[prefix]) {
            return;
          }
          var offset = edge.pstyle(prefix + "-text-offset").pfValue;
          switch (rs.edgeType) {
            case "self":
            case "compound":
            case "bezier":
            case "multibezier": {
              var cps = _createControlPointInfo();
              var selected;
              var startDist = 0;
              var totalDist = 0;
              for (var i2 = 0; i2 < cps.length; i2++) {
                var _cp = cps[isSrc ? i2 : cps.length - 1 - i2];
                for (var j3 = 0; j3 < _cp.segments.length; j3++) {
                  var _seg = _cp.segments[isSrc ? j3 : _cp.segments.length - 1 - j3];
                  var lastSeg = i2 === cps.length - 1 && j3 === _cp.segments.length - 1;
                  startDist = totalDist;
                  totalDist += _seg.length;
                  if (totalDist >= offset || lastSeg) {
                    selected = {
                      cp: _cp,
                      segment: _seg
                    };
                    break;
                  }
                }
                if (selected) {
                  break;
                }
              }
              var cp = selected.cp;
              var seg = selected.segment;
              var tSegment = (offset - startDist) / seg.length;
              var segDt = seg.t1 - seg.t0;
              var t4 = isSrc ? seg.t0 + segDt * tSegment : seg.t1 - segDt * tSegment;
              t4 = bound(0, t4, 1);
              p3 = qbezierPtAt(cp.p0, cp.p1, cp.p2, t4);
              angle2 = bezierAngle(cp.p0, cp.p1, cp.p2, t4);
              break;
            }
            case "straight":
            case "segments":
            case "haystack": {
              var d3 = 0, di, d0;
              var p0, p1;
              var l4 = rs.allpts.length;
              for (var _i2 = 0; _i2 + 3 < l4; _i2 += 2) {
                if (isSrc) {
                  p0 = {
                    x: rs.allpts[_i2],
                    y: rs.allpts[_i2 + 1]
                  };
                  p1 = {
                    x: rs.allpts[_i2 + 2],
                    y: rs.allpts[_i2 + 3]
                  };
                } else {
                  p0 = {
                    x: rs.allpts[l4 - 2 - _i2],
                    y: rs.allpts[l4 - 1 - _i2]
                  };
                  p1 = {
                    x: rs.allpts[l4 - 4 - _i2],
                    y: rs.allpts[l4 - 3 - _i2]
                  };
                }
                di = dist(p0, p1);
                d0 = d3;
                d3 += di;
                if (d3 >= offset) {
                  break;
                }
              }
              var pD = offset - d0;
              var _t = pD / di;
              _t = bound(0, _t, 1);
              p3 = lineAt(p0, p1, _t);
              angle2 = lineAngle(p0, p1);
              break;
            }
          }
          setRs("labelX", prefix, p3.x);
          setRs("labelY", prefix, p3.y);
          setRs("labelAutoAngle", prefix, angle2);
        }, "calculateEndProjection");
        calculateEndProjection("source");
        calculateEndProjection("target");
        this.applyLabelDimensions(edge);
      };
      BRp$9.applyLabelDimensions = function(ele) {
        this.applyPrefixedLabelDimensions(ele);
        if (ele.isEdge()) {
          this.applyPrefixedLabelDimensions(ele, "source");
          this.applyPrefixedLabelDimensions(ele, "target");
        }
      };
      BRp$9.applyPrefixedLabelDimensions = function(ele, prefix) {
        var _p = ele._private;
        var text4 = this.getLabelText(ele, prefix);
        var cacheKey = hashString(text4, ele._private.labelDimsKey);
        if (getPrefixedProperty(_p.rscratch, "prefixedLabelDimsKey", prefix) === cacheKey) {
          return;
        }
        setPrefixedProperty(_p.rscratch, "prefixedLabelDimsKey", prefix, cacheKey);
        var labelDims = this.calculateLabelDimensions(ele, text4);
        var lineHeight = ele.pstyle("line-height").pfValue;
        var textWrap = ele.pstyle("text-wrap").strValue;
        var lines = getPrefixedProperty(_p.rscratch, "labelWrapCachedLines", prefix) || [];
        var numLines = textWrap !== "wrap" ? 1 : Math.max(lines.length, 1);
        var normPerLineHeight = labelDims.height / numLines;
        var labelLineHeight = normPerLineHeight * lineHeight;
        var width3 = labelDims.width;
        var height2 = labelDims.height + (numLines - 1) * (lineHeight - 1) * normPerLineHeight;
        setPrefixedProperty(_p.rstyle, "labelWidth", prefix, width3);
        setPrefixedProperty(_p.rscratch, "labelWidth", prefix, width3);
        setPrefixedProperty(_p.rstyle, "labelHeight", prefix, height2);
        setPrefixedProperty(_p.rscratch, "labelHeight", prefix, height2);
        setPrefixedProperty(_p.rscratch, "labelLineHeight", prefix, labelLineHeight);
      };
      BRp$9.getLabelText = function(ele, prefix) {
        var _p = ele._private;
        var pfd = prefix ? prefix + "-" : "";
        var text4 = ele.pstyle(pfd + "label").strValue;
        var textTransform = ele.pstyle("text-transform").value;
        var rscratch = /* @__PURE__ */ __name(function rscratch2(propName, value2) {
          if (value2) {
            setPrefixedProperty(_p.rscratch, propName, prefix, value2);
            return value2;
          } else {
            return getPrefixedProperty(_p.rscratch, propName, prefix);
          }
        }, "rscratch");
        if (!text4) {
          return "";
        }
        if (textTransform == "none") ;
        else if (textTransform == "uppercase") {
          text4 = text4.toUpperCase();
        } else if (textTransform == "lowercase") {
          text4 = text4.toLowerCase();
        }
        var wrapStyle = ele.pstyle("text-wrap").value;
        if (wrapStyle === "wrap") {
          var labelKey = rscratch("labelKey");
          if (labelKey != null && rscratch("labelWrapKey") === labelKey) {
            return rscratch("labelWrapCachedText");
          }
          var zwsp = "\u200B";
          var lines = text4.split("\n");
          var maxW = ele.pstyle("text-max-width").pfValue;
          var overflow = ele.pstyle("text-overflow-wrap").value;
          var overflowAny = overflow === "anywhere";
          var wrappedLines = [];
          var separatorRegex = /[\s\u200b]+|$/g;
          for (var l4 = 0; l4 < lines.length; l4++) {
            var line2 = lines[l4];
            var lineDims = this.calculateLabelDimensions(ele, line2);
            var lineW = lineDims.width;
            if (overflowAny) {
              var processedLine = line2.split("").join(zwsp);
              line2 = processedLine;
            }
            if (lineW > maxW) {
              var separatorMatches = line2.matchAll(separatorRegex);
              var subline = "";
              var previousIndex = 0;
              var _iterator = _createForOfIteratorHelper(separatorMatches), _step;
              try {
                for (_iterator.s(); !(_step = _iterator.n()).done; ) {
                  var separatorMatch = _step.value;
                  var wordSeparator = separatorMatch[0];
                  var word = line2.substring(previousIndex, separatorMatch.index);
                  previousIndex = separatorMatch.index + wordSeparator.length;
                  var testLine = subline.length === 0 ? word : subline + word + wordSeparator;
                  var testDims = this.calculateLabelDimensions(ele, testLine);
                  var testW = testDims.width;
                  if (testW <= maxW) {
                    subline += word + wordSeparator;
                  } else {
                    if (subline) {
                      wrappedLines.push(subline);
                    }
                    subline = word + wordSeparator;
                  }
                }
              } catch (err) {
                _iterator.e(err);
              } finally {
                _iterator.f();
              }
              if (!subline.match(/^[\s\u200b]+$/)) {
                wrappedLines.push(subline);
              }
            } else {
              wrappedLines.push(line2);
            }
          }
          rscratch("labelWrapCachedLines", wrappedLines);
          text4 = rscratch("labelWrapCachedText", wrappedLines.join("\n"));
          rscratch("labelWrapKey", labelKey);
        } else if (wrapStyle === "ellipsis") {
          var _maxW = ele.pstyle("text-max-width").pfValue;
          var ellipsized = "";
          var ellipsis = "\u2026";
          var incLastCh = false;
          if (this.calculateLabelDimensions(ele, text4).width < _maxW) {
            return text4;
          }
          for (var i2 = 0; i2 < text4.length; i2++) {
            var widthWithNextCh = this.calculateLabelDimensions(ele, ellipsized + text4[i2] + ellipsis).width;
            if (widthWithNextCh > _maxW) {
              break;
            }
            ellipsized += text4[i2];
            if (i2 === text4.length - 1) {
              incLastCh = true;
            }
          }
          if (!incLastCh) {
            ellipsized += ellipsis;
          }
          return ellipsized;
        }
        return text4;
      };
      BRp$9.getLabelJustification = function(ele) {
        var justification = ele.pstyle("text-justification").strValue;
        var textHalign = ele.pstyle("text-halign").strValue;
        if (justification === "auto") {
          if (ele.isNode()) {
            switch (textHalign) {
              case "left":
                return "right";
              case "right":
                return "left";
              default:
                return "center";
            }
          } else {
            return "center";
          }
        } else {
          return justification;
        }
      };
      BRp$9.calculateLabelDimensions = function(ele, text4) {
        var r2 = this;
        var containerWindow = r2.cy.window();
        var document2 = containerWindow.document;
        var padding2 = 0;
        var fStyle = ele.pstyle("font-style").strValue;
        var size4 = ele.pstyle("font-size").pfValue;
        var family = ele.pstyle("font-family").strValue;
        var weight8 = ele.pstyle("font-weight").strValue;
        var canvas = this.labelCalcCanvas;
        var c2d = this.labelCalcCanvasContext;
        if (!canvas) {
          canvas = this.labelCalcCanvas = document2.createElement("canvas");
          c2d = this.labelCalcCanvasContext = canvas.getContext("2d");
          var ds = canvas.style;
          ds.position = "absolute";
          ds.left = "-9999px";
          ds.top = "-9999px";
          ds.zIndex = "-1";
          ds.visibility = "hidden";
          ds.pointerEvents = "none";
        }
        c2d.font = "".concat(fStyle, " ").concat(weight8, " ").concat(size4, "px ").concat(family);
        var width3 = 0;
        var height2 = 0;
        var lines = text4.split("\n");
        for (var i2 = 0; i2 < lines.length; i2++) {
          var line2 = lines[i2];
          var metrics = c2d.measureText(line2);
          var w4 = Math.ceil(metrics.width);
          var h3 = size4;
          width3 = Math.max(w4, width3);
          height2 += h3;
        }
        width3 += padding2;
        height2 += padding2;
        return {
          width: width3,
          height: height2
        };
      };
      BRp$9.calculateLabelAngle = function(ele, prefix) {
        var _p = ele._private;
        var rs = _p.rscratch;
        var isEdge2 = ele.isEdge();
        var prefixDash = prefix ? prefix + "-" : "";
        var rot = ele.pstyle(prefixDash + "text-rotation");
        var rotStr = rot.strValue;
        if (rotStr === "none") {
          return 0;
        } else if (isEdge2 && rotStr === "autorotate") {
          return rs.labelAutoAngle;
        } else if (rotStr === "autorotate") {
          return 0;
        } else {
          return rot.pfValue;
        }
      };
      BRp$9.calculateLabelAngles = function(ele) {
        var r2 = this;
        var isEdge2 = ele.isEdge();
        var _p = ele._private;
        var rs = _p.rscratch;
        rs.labelAngle = r2.calculateLabelAngle(ele);
        if (isEdge2) {
          rs.sourceLabelAngle = r2.calculateLabelAngle(ele, "source");
          rs.targetLabelAngle = r2.calculateLabelAngle(ele, "target");
        }
      };
      BRp$8 = {};
      TOO_SMALL_CUT_RECT = 28;
      warnedCutRect = false;
      BRp$8.getNodeShape = function(node2) {
        var r2 = this;
        var shape = node2.pstyle("shape").value;
        if (shape === "cutrectangle" && (node2.width() < TOO_SMALL_CUT_RECT || node2.height() < TOO_SMALL_CUT_RECT)) {
          if (!warnedCutRect) {
            warn("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead");
            warnedCutRect = true;
          }
          return "rectangle";
        }
        if (node2.isParent()) {
          if (shape === "rectangle" || shape === "roundrectangle" || shape === "round-rectangle" || shape === "cutrectangle" || shape === "cut-rectangle" || shape === "barrel") {
            return shape;
          } else {
            return "rectangle";
          }
        }
        if (shape === "polygon") {
          var points = node2.pstyle("shape-polygon-points").value;
          return r2.nodeShapes.makePolygon(points).name;
        }
        return shape;
      };
      BRp$7 = {};
      BRp$7.registerCalculationListeners = function() {
        var cy = this.cy;
        var elesToUpdate = cy.collection();
        var r2 = this;
        var enqueue = /* @__PURE__ */ __name(function enqueue2(eles) {
          var dirtyStyleCaches = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
          elesToUpdate.merge(eles);
          if (dirtyStyleCaches) {
            for (var i2 = 0; i2 < eles.length; i2++) {
              var ele = eles[i2];
              var _p = ele._private;
              var rstyle = _p.rstyle;
              rstyle.clean = false;
              rstyle.cleanConnected = false;
            }
          }
        }, "enqueue");
        r2.binder(cy).on("bounds.* dirty.*", /* @__PURE__ */ __name(function onDirtyBounds(e3) {
          var ele = e3.target;
          enqueue(ele);
        }, "onDirtyBounds")).on("style.* background.*", /* @__PURE__ */ __name(function onDirtyStyle(e3) {
          var ele = e3.target;
          enqueue(ele, false);
        }, "onDirtyStyle"));
        var updateEleCalcs = /* @__PURE__ */ __name(function updateEleCalcs2(willDraw) {
          if (willDraw) {
            var fns = r2.onUpdateEleCalcsFns;
            elesToUpdate.cleanStyle();
            for (var i2 = 0; i2 < elesToUpdate.length; i2++) {
              var ele = elesToUpdate[i2];
              var rstyle = ele._private.rstyle;
              if (ele.isNode() && !rstyle.cleanConnected) {
                enqueue(ele.connectedEdges());
                rstyle.cleanConnected = true;
              }
            }
            if (fns) {
              for (var _i = 0; _i < fns.length; _i++) {
                var fn3 = fns[_i];
                fn3(willDraw, elesToUpdate);
              }
            }
            r2.recalculateRenderedStyle(elesToUpdate);
            elesToUpdate = cy.collection();
          }
        }, "updateEleCalcs");
        r2.flushRenderedStyleQueue = function() {
          updateEleCalcs(true);
        };
        r2.beforeRender(updateEleCalcs, r2.beforeRenderPriorities.eleCalcs);
      };
      BRp$7.onUpdateEleCalcs = function(fn3) {
        var fns = this.onUpdateEleCalcsFns = this.onUpdateEleCalcsFns || [];
        fns.push(fn3);
      };
      BRp$7.recalculateRenderedStyle = function(eles, useCache) {
        var isCleanConnected = /* @__PURE__ */ __name(function isCleanConnected2(ele2) {
          return ele2._private.rstyle.cleanConnected;
        }, "isCleanConnected");
        if (eles.length === 0) {
          return;
        }
        var edges3 = [];
        var nodes5 = [];
        if (this.destroyed) {
          return;
        }
        if (useCache === void 0) {
          useCache = true;
        }
        for (var i2 = 0; i2 < eles.length; i2++) {
          var ele = eles[i2];
          var _p = ele._private;
          var rstyle = _p.rstyle;
          if (ele.isEdge() && (!isCleanConnected(ele.source()) || !isCleanConnected(ele.target()))) {
            rstyle.clean = false;
          }
          if (ele.isEdge() && ele.isBundledBezier()) {
            if (ele.parallelEdges().some(function(ele2) {
              return !ele2._private.rstyle.clean && ele2.isBundledBezier();
            })) {
              rstyle.clean = false;
            }
          }
          if (useCache && rstyle.clean || ele.removed()) {
            continue;
          }
          if (ele.pstyle("display").value === "none") {
            continue;
          }
          if (_p.group === "nodes") {
            nodes5.push(ele);
          } else {
            edges3.push(ele);
          }
          rstyle.clean = true;
        }
        for (var _i2 = 0; _i2 < nodes5.length; _i2++) {
          var _ele = nodes5[_i2];
          var _p2 = _ele._private;
          var _rstyle = _p2.rstyle;
          var pos = _ele.position();
          this.recalculateNodeLabelProjection(_ele);
          _rstyle.nodeX = pos.x;
          _rstyle.nodeY = pos.y;
          _rstyle.nodeW = _ele.pstyle("width").pfValue;
          _rstyle.nodeH = _ele.pstyle("height").pfValue;
        }
        this.recalculateEdgeProjections(edges3);
        for (var _i3 = 0; _i3 < edges3.length; _i3++) {
          var _ele2 = edges3[_i3];
          var _p3 = _ele2._private;
          var _rstyle2 = _p3.rstyle;
          var rs = _p3.rscratch;
          _rstyle2.srcX = rs.arrowStartX;
          _rstyle2.srcY = rs.arrowStartY;
          _rstyle2.tgtX = rs.arrowEndX;
          _rstyle2.tgtY = rs.arrowEndY;
          _rstyle2.midX = rs.midX;
          _rstyle2.midY = rs.midY;
          _rstyle2.labelAngle = rs.labelAngle;
          _rstyle2.sourceLabelAngle = rs.sourceLabelAngle;
          _rstyle2.targetLabelAngle = rs.targetLabelAngle;
        }
      };
      BRp$6 = {};
      BRp$6.updateCachedGrabbedEles = function() {
        var eles = this.cachedZSortedEles;
        if (!eles) {
          return;
        }
        eles.drag = [];
        eles.nondrag = [];
        var grabTargets = [];
        for (var i2 = 0; i2 < eles.length; i2++) {
          var ele = eles[i2];
          var rs = ele._private.rscratch;
          if (ele.grabbed() && !ele.isParent()) {
            grabTargets.push(ele);
          } else if (rs.inDragLayer) {
            eles.drag.push(ele);
          } else {
            eles.nondrag.push(ele);
          }
        }
        for (var i2 = 0; i2 < grabTargets.length; i2++) {
          var ele = grabTargets[i2];
          eles.drag.push(ele);
        }
      };
      BRp$6.invalidateCachedZSortedEles = function() {
        this.cachedZSortedEles = null;
      };
      BRp$6.getCachedZSortedEles = function(forceRecalc) {
        if (forceRecalc || !this.cachedZSortedEles) {
          var eles = this.cy.mutableElements().toArray();
          eles.sort(zIndexSort);
          eles.interactive = eles.filter(function(ele) {
            return ele.interactive();
          });
          this.cachedZSortedEles = eles;
          this.updateCachedGrabbedEles();
        } else {
          eles = this.cachedZSortedEles;
        }
        return eles;
      };
      BRp$5 = {};
      [BRp$e, BRp$d, BRp$c, BRp$b, BRp$a, BRp$9, BRp$8, BRp$7, BRp$6].forEach(function(props) {
        extend4(BRp$5, props);
      });
      BRp$4 = {};
      BRp$4.getCachedImage = function(url, crossOrigin, onLoad) {
        var r2 = this;
        var imageCache = r2.imageCache = r2.imageCache || {};
        var cache3 = imageCache[url];
        if (cache3) {
          if (!cache3.image.complete) {
            cache3.image.addEventListener("load", onLoad);
          }
          return cache3.image;
        } else {
          cache3 = imageCache[url] = imageCache[url] || {};
          var image = cache3.image = new Image();
          image.addEventListener("load", onLoad);
          image.addEventListener("error", function() {
            image.error = true;
          });
          var dataUriPrefix = "data:";
          var isDataUri = url.substring(0, dataUriPrefix.length).toLowerCase() === dataUriPrefix;
          if (!isDataUri) {
            crossOrigin = crossOrigin === "null" ? null : crossOrigin;
            image.crossOrigin = crossOrigin;
          }
          image.src = url;
          return image;
        }
      };
      BRp$3 = {};
      BRp$3.registerBinding = function(target, event3, handler, useCapture) {
        var args = Array.prototype.slice.apply(arguments, [1]);
        if (Array.isArray(target)) {
          var res = [];
          for (var i2 = 0; i2 < target.length; i2++) {
            var t4 = target[i2];
            if (t4 !== void 0) {
              var b3 = this.binder(t4);
              res.push(b3.on.apply(b3, args));
            }
          }
          return res;
        }
        var b3 = this.binder(target);
        return b3.on.apply(b3, args);
      };
      BRp$3.binder = function(tgt) {
        var r2 = this;
        var containerWindow = r2.cy.window();
        var tgtIsDom = tgt === containerWindow || tgt === containerWindow.document || tgt === containerWindow.document.body || domElement(tgt);
        if (r2.supportsPassiveEvents == null) {
          var supportsPassive = false;
          try {
            var opts = Object.defineProperty({}, "passive", {
              get: /* @__PURE__ */ __name(function get5() {
                supportsPassive = true;
                return true;
              }, "get")
            });
            containerWindow.addEventListener("test", null, opts);
          } catch (err) {
          }
          r2.supportsPassiveEvents = supportsPassive;
        }
        var on3 = /* @__PURE__ */ __name(function on4(event3, handler, useCapture) {
          var args = Array.prototype.slice.call(arguments);
          if (tgtIsDom && r2.supportsPassiveEvents) {
            args[2] = {
              capture: useCapture != null ? useCapture : false,
              passive: false,
              once: false
            };
          }
          r2.bindings.push({
            target: tgt,
            args
          });
          (tgt.addEventListener || tgt.on).apply(tgt, args);
          return this;
        }, "on");
        return {
          on: on3,
          addEventListener: on3,
          addListener: on3,
          bind: on3
        };
      };
      BRp$3.nodeIsDraggable = function(node2) {
        return node2 && node2.isNode() && !node2.locked() && node2.grabbable();
      };
      BRp$3.nodeIsGrabbable = function(node2) {
        return this.nodeIsDraggable(node2) && node2.interactive();
      };
      BRp$3.load = function() {
        var r2 = this;
        var containerWindow = r2.cy.window();
        var isSelected = /* @__PURE__ */ __name(function isSelected2(ele) {
          return ele.selected();
        }, "isSelected");
        var getShadowRoot = /* @__PURE__ */ __name(function getShadowRoot2(element3) {
          var rootNode = element3.getRootNode();
          if (rootNode && rootNode.nodeType === 11 && rootNode.host !== void 0) {
            return rootNode;
          }
        }, "getShadowRoot");
        var triggerEvents = /* @__PURE__ */ __name(function triggerEvents2(target, names, e3, position5) {
          if (target == null) {
            target = r2.cy;
          }
          for (var i2 = 0; i2 < names.length; i2++) {
            var name = names[i2];
            target.emit({
              originalEvent: e3,
              type: name,
              position: position5
            });
          }
        }, "triggerEvents");
        var isMultSelKeyDown = /* @__PURE__ */ __name(function isMultSelKeyDown2(e3) {
          return e3.shiftKey || e3.metaKey || e3.ctrlKey;
        }, "isMultSelKeyDown");
        var allowPanningPassthrough = /* @__PURE__ */ __name(function allowPanningPassthrough2(down, downs) {
          var allowPassthrough = true;
          if (r2.cy.hasCompoundNodes() && down && down.pannable()) {
            for (var i2 = 0; downs && i2 < downs.length; i2++) {
              var down = downs[i2];
              if (down.isNode() && down.isParent() && !down.pannable()) {
                allowPassthrough = false;
                break;
              }
            }
          } else {
            allowPassthrough = true;
          }
          return allowPassthrough;
        }, "allowPanningPassthrough");
        var setGrabbed = /* @__PURE__ */ __name(function setGrabbed2(ele) {
          ele[0]._private.grabbed = true;
        }, "setGrabbed");
        var setFreed = /* @__PURE__ */ __name(function setFreed2(ele) {
          ele[0]._private.grabbed = false;
        }, "setFreed");
        var setInDragLayer = /* @__PURE__ */ __name(function setInDragLayer2(ele) {
          ele[0]._private.rscratch.inDragLayer = true;
        }, "setInDragLayer");
        var setOutDragLayer = /* @__PURE__ */ __name(function setOutDragLayer2(ele) {
          ele[0]._private.rscratch.inDragLayer = false;
        }, "setOutDragLayer");
        var setGrabTarget = /* @__PURE__ */ __name(function setGrabTarget2(ele) {
          ele[0]._private.rscratch.isGrabTarget = true;
        }, "setGrabTarget");
        var removeGrabTarget = /* @__PURE__ */ __name(function removeGrabTarget2(ele) {
          ele[0]._private.rscratch.isGrabTarget = false;
        }, "removeGrabTarget");
        var addToDragList = /* @__PURE__ */ __name(function addToDragList2(ele, opts) {
          var list = opts.addToList;
          var listHasEle = list.has(ele);
          if (!listHasEle && ele.grabbable() && !ele.locked()) {
            list.merge(ele);
            setGrabbed(ele);
          }
        }, "addToDragList");
        var addDescendantsToDrag = /* @__PURE__ */ __name(function addDescendantsToDrag2(node2, opts) {
          if (!node2.cy().hasCompoundNodes()) {
            return;
          }
          if (opts.inDragLayer == null && opts.addToList == null) {
            return;
          }
          var innerNodes = node2.descendants();
          if (opts.inDragLayer) {
            innerNodes.forEach(setInDragLayer);
            innerNodes.connectedEdges().forEach(setInDragLayer);
          }
          if (opts.addToList) {
            addToDragList(innerNodes, opts);
          }
        }, "addDescendantsToDrag");
        var addNodesToDrag = /* @__PURE__ */ __name(function addNodesToDrag2(nodes5, opts) {
          opts = opts || {};
          var hasCompoundNodes2 = nodes5.cy().hasCompoundNodes();
          if (opts.inDragLayer) {
            nodes5.forEach(setInDragLayer);
            nodes5.neighborhood().stdFilter(function(ele) {
              return !hasCompoundNodes2 || ele.isEdge();
            }).forEach(setInDragLayer);
          }
          if (opts.addToList) {
            nodes5.forEach(function(ele) {
              addToDragList(ele, opts);
            });
          }
          addDescendantsToDrag(nodes5, opts);
          updateAncestorsInDragLayer(nodes5, {
            inDragLayer: opts.inDragLayer
          });
          r2.updateCachedGrabbedEles();
        }, "addNodesToDrag");
        var addNodeToDrag = addNodesToDrag;
        var freeDraggedElements = /* @__PURE__ */ __name(function freeDraggedElements2(grabbedEles) {
          if (!grabbedEles) {
            return;
          }
          r2.getCachedZSortedEles().forEach(function(ele) {
            setFreed(ele);
            setOutDragLayer(ele);
            removeGrabTarget(ele);
          });
          r2.updateCachedGrabbedEles();
        }, "freeDraggedElements");
        var updateAncestorsInDragLayer = /* @__PURE__ */ __name(function updateAncestorsInDragLayer2(node2, opts) {
          if (opts.inDragLayer == null && opts.addToList == null) {
            return;
          }
          if (!node2.cy().hasCompoundNodes()) {
            return;
          }
          var parent4 = node2.ancestors().orphans();
          if (parent4.same(node2)) {
            return;
          }
          var nodes5 = parent4.descendants().spawnSelf().merge(parent4).unmerge(node2).unmerge(node2.descendants());
          var edges3 = nodes5.connectedEdges();
          if (opts.inDragLayer) {
            edges3.forEach(setInDragLayer);
            nodes5.forEach(setInDragLayer);
          }
          if (opts.addToList) {
            nodes5.forEach(function(ele) {
              addToDragList(ele, opts);
            });
          }
        }, "updateAncestorsInDragLayer");
        var blurActiveDomElement = /* @__PURE__ */ __name(function blurActiveDomElement2() {
          if (document.activeElement != null && document.activeElement.blur != null) {
            document.activeElement.blur();
          }
        }, "blurActiveDomElement");
        var haveMutationsApi = typeof MutationObserver !== "undefined";
        var haveResizeObserverApi = typeof ResizeObserver !== "undefined";
        if (haveMutationsApi) {
          r2.removeObserver = new MutationObserver(function(mutns) {
            for (var i2 = 0; i2 < mutns.length; i2++) {
              var mutn = mutns[i2];
              var rNodes = mutn.removedNodes;
              if (rNodes) {
                for (var j3 = 0; j3 < rNodes.length; j3++) {
                  var rNode = rNodes[j3];
                  if (rNode === r2.container) {
                    r2.destroy();
                    break;
                  }
                }
              }
            }
          });
          if (r2.container.parentNode) {
            r2.removeObserver.observe(r2.container.parentNode, {
              childList: true
            });
          }
        } else {
          r2.registerBinding(r2.container, "DOMNodeRemoved", function(e3) {
            r2.destroy();
          });
        }
        var onResize = debounce(function() {
          r2.cy.resize();
        }, 100);
        if (haveMutationsApi) {
          r2.styleObserver = new MutationObserver(onResize);
          r2.styleObserver.observe(r2.container, {
            attributes: true
          });
        }
        r2.registerBinding(containerWindow, "resize", onResize);
        if (haveResizeObserverApi) {
          r2.resizeObserver = new ResizeObserver(onResize);
          r2.resizeObserver.observe(r2.container);
        }
        var forEachUp = /* @__PURE__ */ __name(function forEachUp2(domEle, fn3) {
          while (domEle != null) {
            fn3(domEle);
            domEle = domEle.parentNode;
          }
        }, "forEachUp");
        var invalidateCoords = /* @__PURE__ */ __name(function invalidateCoords2() {
          r2.invalidateContainerClientCoordsCache();
        }, "invalidateCoords");
        forEachUp(r2.container, function(domEle) {
          r2.registerBinding(domEle, "transitionend", invalidateCoords);
          r2.registerBinding(domEle, "animationend", invalidateCoords);
          r2.registerBinding(domEle, "scroll", invalidateCoords);
        });
        r2.registerBinding(r2.container, "contextmenu", function(e3) {
          e3.preventDefault();
        });
        var inBoxSelection = /* @__PURE__ */ __name(function inBoxSelection2() {
          return r2.selection[4] !== 0;
        }, "inBoxSelection");
        var eventInContainer = /* @__PURE__ */ __name(function eventInContainer2(e3) {
          var containerPageCoords = r2.findContainerClientCoords();
          var x5 = containerPageCoords[0];
          var y6 = containerPageCoords[1];
          var width3 = containerPageCoords[2];
          var height2 = containerPageCoords[3];
          var positions2 = e3.touches ? e3.touches : [e3];
          var atLeastOnePosInside = false;
          for (var i2 = 0; i2 < positions2.length; i2++) {
            var p3 = positions2[i2];
            if (x5 <= p3.clientX && p3.clientX <= x5 + width3 && y6 <= p3.clientY && p3.clientY <= y6 + height2) {
              atLeastOnePosInside = true;
              break;
            }
          }
          if (!atLeastOnePosInside) {
            return false;
          }
          var container2 = r2.container;
          var target = e3.target;
          var tParent = target.parentNode;
          var containerIsTarget = false;
          while (tParent) {
            if (tParent === container2) {
              containerIsTarget = true;
              break;
            }
            tParent = tParent.parentNode;
          }
          if (!containerIsTarget) {
            return false;
          }
          return true;
        }, "eventInContainer");
        r2.registerBinding(r2.container, "mousedown", /* @__PURE__ */ __name(function mousedownHandler(e3) {
          if (!eventInContainer(e3)) {
            return;
          }
          if (r2.hoverData.which === 1 && e3.which !== 1) {
            return;
          }
          e3.preventDefault();
          blurActiveDomElement();
          r2.hoverData.capture = true;
          r2.hoverData.which = e3.which;
          var cy = r2.cy;
          var gpos = [e3.clientX, e3.clientY];
          var pos = r2.projectIntoViewport(gpos[0], gpos[1]);
          var select = r2.selection;
          var nears = r2.findNearestElements(pos[0], pos[1], true, false);
          var near = nears[0];
          var draggedElements = r2.dragData.possibleDragElements;
          r2.hoverData.mdownPos = pos;
          r2.hoverData.mdownGPos = gpos;
          var makeEvent = /* @__PURE__ */ __name(function makeEvent2(type3) {
            return {
              originalEvent: e3,
              type: type3,
              position: {
                x: pos[0],
                y: pos[1]
              }
            };
          }, "makeEvent");
          var checkForTaphold = /* @__PURE__ */ __name(function checkForTaphold2() {
            r2.hoverData.tapholdCancelled = false;
            clearTimeout(r2.hoverData.tapholdTimeout);
            r2.hoverData.tapholdTimeout = setTimeout(function() {
              if (r2.hoverData.tapholdCancelled) {
                return;
              } else {
                var ele = r2.hoverData.down;
                if (ele) {
                  ele.emit(makeEvent("taphold"));
                } else {
                  cy.emit(makeEvent("taphold"));
                }
              }
            }, r2.tapholdDuration);
          }, "checkForTaphold");
          if (e3.which == 3) {
            r2.hoverData.cxtStarted = true;
            var cxtEvt = {
              originalEvent: e3,
              type: "cxttapstart",
              position: {
                x: pos[0],
                y: pos[1]
              }
            };
            if (near) {
              near.activate();
              near.emit(cxtEvt);
              r2.hoverData.down = near;
            } else {
              cy.emit(cxtEvt);
            }
            r2.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime();
            r2.hoverData.cxtDragged = false;
          } else if (e3.which == 1) {
            if (near) {
              near.activate();
            }
            {
              if (near != null) {
                if (r2.nodeIsGrabbable(near)) {
                  var triggerGrab = /* @__PURE__ */ __name(function triggerGrab2(ele) {
                    ele.emit(makeEvent("grab"));
                  }, "triggerGrab");
                  setGrabTarget(near);
                  if (!near.selected()) {
                    draggedElements = r2.dragData.possibleDragElements = cy.collection();
                    addNodeToDrag(near, {
                      addToList: draggedElements
                    });
                    near.emit(makeEvent("grabon")).emit(makeEvent("grab"));
                  } else {
                    draggedElements = r2.dragData.possibleDragElements = cy.collection();
                    var selectedNodes = cy.$(function(ele) {
                      return ele.isNode() && ele.selected() && r2.nodeIsGrabbable(ele);
                    });
                    addNodesToDrag(selectedNodes, {
                      addToList: draggedElements
                    });
                    near.emit(makeEvent("grabon"));
                    selectedNodes.forEach(triggerGrab);
                  }
                  r2.redrawHint("eles", true);
                  r2.redrawHint("drag", true);
                }
              }
              r2.hoverData.down = near;
              r2.hoverData.downs = nears;
              r2.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime();
            }
            triggerEvents(near, ["mousedown", "tapstart", "vmousedown"], e3, {
              x: pos[0],
              y: pos[1]
            });
            if (near == null) {
              select[4] = 1;
              r2.data.bgActivePosistion = {
                x: pos[0],
                y: pos[1]
              };
              r2.redrawHint("select", true);
              r2.redraw();
            } else if (near.pannable()) {
              select[4] = 1;
            }
            checkForTaphold();
          }
          select[0] = select[2] = pos[0];
          select[1] = select[3] = pos[1];
        }, "mousedownHandler"), false);
        var shadowRoot = getShadowRoot(r2.container);
        r2.registerBinding([containerWindow, shadowRoot], "mousemove", /* @__PURE__ */ __name(function mousemoveHandler(e3) {
          var capture = r2.hoverData.capture;
          if (!capture && !eventInContainer(e3)) {
            return;
          }
          var preventDefault2 = false;
          var cy = r2.cy;
          var zoom2 = cy.zoom();
          var gpos = [e3.clientX, e3.clientY];
          var pos = r2.projectIntoViewport(gpos[0], gpos[1]);
          var mdownPos = r2.hoverData.mdownPos;
          var mdownGPos = r2.hoverData.mdownGPos;
          var select = r2.selection;
          var near = null;
          if (!r2.hoverData.draggingEles && !r2.hoverData.dragging && !r2.hoverData.selecting) {
            near = r2.findNearestElement(pos[0], pos[1], true, false);
          }
          var last3 = r2.hoverData.last;
          var down = r2.hoverData.down;
          var disp = [pos[0] - select[2], pos[1] - select[3]];
          var draggedElements = r2.dragData.possibleDragElements;
          var isOverThresholdDrag;
          if (mdownGPos) {
            var dx = gpos[0] - mdownGPos[0];
            var dx2 = dx * dx;
            var dy = gpos[1] - mdownGPos[1];
            var dy2 = dy * dy;
            var dist22 = dx2 + dy2;
            r2.hoverData.isOverThresholdDrag = isOverThresholdDrag = dist22 >= r2.desktopTapThreshold2;
          }
          var multSelKeyDown = isMultSelKeyDown(e3);
          if (isOverThresholdDrag) {
            r2.hoverData.tapholdCancelled = true;
          }
          var updateDragDelta = /* @__PURE__ */ __name(function updateDragDelta2() {
            var dragDelta2 = r2.hoverData.dragDelta = r2.hoverData.dragDelta || [];
            if (dragDelta2.length === 0) {
              dragDelta2.push(disp[0]);
              dragDelta2.push(disp[1]);
            } else {
              dragDelta2[0] += disp[0];
              dragDelta2[1] += disp[1];
            }
          }, "updateDragDelta");
          preventDefault2 = true;
          triggerEvents(near, ["mousemove", "vmousemove", "tapdrag"], e3, {
            x: pos[0],
            y: pos[1]
          });
          var makeEvent = /* @__PURE__ */ __name(function makeEvent2(type3) {
            return {
              originalEvent: e3,
              type: type3,
              position: {
                x: pos[0],
                y: pos[1]
              }
            };
          }, "makeEvent");
          var goIntoBoxMode = /* @__PURE__ */ __name(function goIntoBoxMode2() {
            r2.data.bgActivePosistion = void 0;
            if (!r2.hoverData.selecting) {
              cy.emit(makeEvent("boxstart"));
            }
            select[4] = 1;
            r2.hoverData.selecting = true;
            r2.redrawHint("select", true);
            r2.redraw();
          }, "goIntoBoxMode");
          if (r2.hoverData.which === 3) {
            if (isOverThresholdDrag) {
              var cxtEvt = makeEvent("cxtdrag");
              if (down) {
                down.emit(cxtEvt);
              } else {
                cy.emit(cxtEvt);
              }
              r2.hoverData.cxtDragged = true;
              if (!r2.hoverData.cxtOver || near !== r2.hoverData.cxtOver) {
                if (r2.hoverData.cxtOver) {
                  r2.hoverData.cxtOver.emit(makeEvent("cxtdragout"));
                }
                r2.hoverData.cxtOver = near;
                if (near) {
                  near.emit(makeEvent("cxtdragover"));
                }
              }
            }
          } else if (r2.hoverData.dragging) {
            preventDefault2 = true;
            if (cy.panningEnabled() && cy.userPanningEnabled()) {
              var deltaP;
              if (r2.hoverData.justStartedPan) {
                var mdPos = r2.hoverData.mdownPos;
                deltaP = {
                  x: (pos[0] - mdPos[0]) * zoom2,
                  y: (pos[1] - mdPos[1]) * zoom2
                };
                r2.hoverData.justStartedPan = false;
              } else {
                deltaP = {
                  x: disp[0] * zoom2,
                  y: disp[1] * zoom2
                };
              }
              cy.panBy(deltaP);
              cy.emit(makeEvent("dragpan"));
              r2.hoverData.dragged = true;
            }
            pos = r2.projectIntoViewport(e3.clientX, e3.clientY);
          } else if (select[4] == 1 && (down == null || down.pannable())) {
            if (isOverThresholdDrag) {
              if (!r2.hoverData.dragging && cy.boxSelectionEnabled() && (multSelKeyDown || !cy.panningEnabled() || !cy.userPanningEnabled())) {
                goIntoBoxMode();
              } else if (!r2.hoverData.selecting && cy.panningEnabled() && cy.userPanningEnabled()) {
                var allowPassthrough = allowPanningPassthrough(down, r2.hoverData.downs);
                if (allowPassthrough) {
                  r2.hoverData.dragging = true;
                  r2.hoverData.justStartedPan = true;
                  select[4] = 0;
                  r2.data.bgActivePosistion = array2point(mdownPos);
                  r2.redrawHint("select", true);
                  r2.redraw();
                }
              }
              if (down && down.pannable() && down.active()) {
                down.unactivate();
              }
            }
          } else {
            if (down && down.pannable() && down.active()) {
              down.unactivate();
            }
            if ((!down || !down.grabbed()) && near != last3) {
              if (last3) {
                triggerEvents(last3, ["mouseout", "tapdragout"], e3, {
                  x: pos[0],
                  y: pos[1]
                });
              }
              if (near) {
                triggerEvents(near, ["mouseover", "tapdragover"], e3, {
                  x: pos[0],
                  y: pos[1]
                });
              }
              r2.hoverData.last = near;
            }
            if (down) {
              if (isOverThresholdDrag) {
                if (cy.boxSelectionEnabled() && multSelKeyDown) {
                  if (down && down.grabbed()) {
                    freeDraggedElements(draggedElements);
                    down.emit(makeEvent("freeon"));
                    draggedElements.emit(makeEvent("free"));
                    if (r2.dragData.didDrag) {
                      down.emit(makeEvent("dragfreeon"));
                      draggedElements.emit(makeEvent("dragfree"));
                    }
                  }
                  goIntoBoxMode();
                } else if (down && down.grabbed() && r2.nodeIsDraggable(down)) {
                  var justStartedDrag = !r2.dragData.didDrag;
                  if (justStartedDrag) {
                    r2.redrawHint("eles", true);
                  }
                  r2.dragData.didDrag = true;
                  if (!r2.hoverData.draggingEles) {
                    addNodesToDrag(draggedElements, {
                      inDragLayer: true
                    });
                  }
                  var totalShift = {
                    x: 0,
                    y: 0
                  };
                  if (number$1(disp[0]) && number$1(disp[1])) {
                    totalShift.x += disp[0];
                    totalShift.y += disp[1];
                    if (justStartedDrag) {
                      var dragDelta = r2.hoverData.dragDelta;
                      if (dragDelta && number$1(dragDelta[0]) && number$1(dragDelta[1])) {
                        totalShift.x += dragDelta[0];
                        totalShift.y += dragDelta[1];
                      }
                    }
                  }
                  r2.hoverData.draggingEles = true;
                  draggedElements.silentShift(totalShift).emit(makeEvent("position")).emit(makeEvent("drag"));
                  r2.redrawHint("drag", true);
                  r2.redraw();
                }
              } else {
                updateDragDelta();
              }
            }
            preventDefault2 = true;
          }
          select[2] = pos[0];
          select[3] = pos[1];
          if (preventDefault2) {
            if (e3.stopPropagation) e3.stopPropagation();
            if (e3.preventDefault) e3.preventDefault();
            return false;
          }
        }, "mousemoveHandler"), false);
        var clickTimeout, didDoubleClick, prevClickTimeStamp;
        r2.registerBinding(containerWindow, "mouseup", /* @__PURE__ */ __name(function mouseupHandler(e3) {
          if (r2.hoverData.which === 1 && e3.which !== 1 && r2.hoverData.capture) {
            return;
          }
          var capture = r2.hoverData.capture;
          if (!capture) {
            return;
          }
          r2.hoverData.capture = false;
          var cy = r2.cy;
          var pos = r2.projectIntoViewport(e3.clientX, e3.clientY);
          var select = r2.selection;
          var near = r2.findNearestElement(pos[0], pos[1], true, false);
          var draggedElements = r2.dragData.possibleDragElements;
          var down = r2.hoverData.down;
          var multSelKeyDown = isMultSelKeyDown(e3);
          if (r2.data.bgActivePosistion) {
            r2.redrawHint("select", true);
            r2.redraw();
          }
          r2.hoverData.tapholdCancelled = true;
          r2.data.bgActivePosistion = void 0;
          if (down) {
            down.unactivate();
          }
          var makeEvent = /* @__PURE__ */ __name(function makeEvent2(type3) {
            return {
              originalEvent: e3,
              type: type3,
              position: {
                x: pos[0],
                y: pos[1]
              }
            };
          }, "makeEvent");
          if (r2.hoverData.which === 3) {
            var cxtEvt = makeEvent("cxttapend");
            if (down) {
              down.emit(cxtEvt);
            } else {
              cy.emit(cxtEvt);
            }
            if (!r2.hoverData.cxtDragged) {
              var cxtTap = makeEvent("cxttap");
              if (down) {
                down.emit(cxtTap);
              } else {
                cy.emit(cxtTap);
              }
            }
            r2.hoverData.cxtDragged = false;
            r2.hoverData.which = null;
          } else if (r2.hoverData.which === 1) {
            triggerEvents(near, ["mouseup", "tapend", "vmouseup"], e3, {
              x: pos[0],
              y: pos[1]
            });
            if (!r2.dragData.didDrag && // didn't move a node around
            !r2.hoverData.dragged && // didn't pan
            !r2.hoverData.selecting && // not box selection
            !r2.hoverData.isOverThresholdDrag) {
              triggerEvents(down, ["click", "tap", "vclick"], e3, {
                x: pos[0],
                y: pos[1]
              });
              didDoubleClick = false;
              if (e3.timeStamp - prevClickTimeStamp <= cy.multiClickDebounceTime()) {
                clickTimeout && clearTimeout(clickTimeout);
                didDoubleClick = true;
                prevClickTimeStamp = null;
                triggerEvents(down, ["dblclick", "dbltap", "vdblclick"], e3, {
                  x: pos[0],
                  y: pos[1]
                });
              } else {
                clickTimeout = setTimeout(function() {
                  if (didDoubleClick) return;
                  triggerEvents(down, ["oneclick", "onetap", "voneclick"], e3, {
                    x: pos[0],
                    y: pos[1]
                  });
                }, cy.multiClickDebounceTime());
                prevClickTimeStamp = e3.timeStamp;
              }
            }
            if (down == null && !r2.dragData.didDrag && !r2.hoverData.selecting && !r2.hoverData.dragged && !isMultSelKeyDown(e3)) {
              cy.$(isSelected).unselect(["tapunselect"]);
              if (draggedElements.length > 0) {
                r2.redrawHint("eles", true);
              }
              r2.dragData.possibleDragElements = draggedElements = cy.collection();
            }
            if (near == down && !r2.dragData.didDrag && !r2.hoverData.selecting) {
              if (near != null && near._private.selectable) {
                if (r2.hoverData.dragging) ;
                else if (cy.selectionType() === "additive" || multSelKeyDown) {
                  if (near.selected()) {
                    near.unselect(["tapunselect"]);
                  } else {
                    near.select(["tapselect"]);
                  }
                } else {
                  if (!multSelKeyDown) {
                    cy.$(isSelected).unmerge(near).unselect(["tapunselect"]);
                    near.select(["tapselect"]);
                  }
                }
                r2.redrawHint("eles", true);
              }
            }
            if (r2.hoverData.selecting) {
              var box = cy.collection(r2.getAllInBox(select[0], select[1], select[2], select[3]));
              r2.redrawHint("select", true);
              if (box.length > 0) {
                r2.redrawHint("eles", true);
              }
              cy.emit(makeEvent("boxend"));
              var eleWouldBeSelected = /* @__PURE__ */ __name(function eleWouldBeSelected2(ele) {
                return ele.selectable() && !ele.selected();
              }, "eleWouldBeSelected");
              if (cy.selectionType() === "additive") {
                box.emit(makeEvent("box")).stdFilter(eleWouldBeSelected).select().emit(makeEvent("boxselect"));
              } else {
                if (!multSelKeyDown) {
                  cy.$(isSelected).unmerge(box).unselect();
                }
                box.emit(makeEvent("box")).stdFilter(eleWouldBeSelected).select().emit(makeEvent("boxselect"));
              }
              r2.redraw();
            }
            if (r2.hoverData.dragging) {
              r2.hoverData.dragging = false;
              r2.redrawHint("select", true);
              r2.redrawHint("eles", true);
              r2.redraw();
            }
            if (!select[4]) {
              r2.redrawHint("drag", true);
              r2.redrawHint("eles", true);
              var downWasGrabbed = down && down.grabbed();
              freeDraggedElements(draggedElements);
              if (downWasGrabbed) {
                down.emit(makeEvent("freeon"));
                draggedElements.emit(makeEvent("free"));
                if (r2.dragData.didDrag) {
                  down.emit(makeEvent("dragfreeon"));
                  draggedElements.emit(makeEvent("dragfree"));
                }
              }
            }
          }
          select[4] = 0;
          r2.hoverData.down = null;
          r2.hoverData.cxtStarted = false;
          r2.hoverData.draggingEles = false;
          r2.hoverData.selecting = false;
          r2.hoverData.isOverThresholdDrag = false;
          r2.dragData.didDrag = false;
          r2.hoverData.dragged = false;
          r2.hoverData.dragDelta = [];
          r2.hoverData.mdownPos = null;
          r2.hoverData.mdownGPos = null;
          r2.hoverData.which = null;
        }, "mouseupHandler"), false);
        var wheelDeltas = [];
        var wheelDeltaN = 4;
        var inaccurateScrollDevice;
        var inaccurateScrollFactor = 1e5;
        var allAreDivisibleBy = /* @__PURE__ */ __name(function allAreDivisibleBy2(list, factor) {
          for (var i2 = 0; i2 < list.length; i2++) {
            if (list[i2] % factor !== 0) {
              return false;
            }
          }
          return true;
        }, "allAreDivisibleBy");
        var allAreSameMagnitude = /* @__PURE__ */ __name(function allAreSameMagnitude2(list) {
          var firstMag = Math.abs(list[0]);
          for (var i2 = 1; i2 < list.length; i2++) {
            if (Math.abs(list[i2]) !== firstMag) {
              return false;
            }
          }
          return true;
        }, "allAreSameMagnitude");
        var wheelHandler = /* @__PURE__ */ __name(function wheelHandler2(e3) {
          var clamp = false;
          var delta = e3.deltaY;
          if (delta == null) {
            if (e3.wheelDeltaY != null) {
              delta = e3.wheelDeltaY / 4;
            } else if (e3.wheelDelta != null) {
              delta = e3.wheelDelta / 4;
            }
          }
          if (delta === 0) {
            return;
          }
          if (inaccurateScrollDevice == null) {
            if (wheelDeltas.length >= wheelDeltaN) {
              var wds = wheelDeltas;
              inaccurateScrollDevice = allAreDivisibleBy(wds, 5);
              if (!inaccurateScrollDevice) {
                var firstMag = Math.abs(wds[0]);
                inaccurateScrollDevice = allAreSameMagnitude(wds) && firstMag > 5;
              }
              if (inaccurateScrollDevice) {
                for (var i2 = 0; i2 < wds.length; i2++) {
                  inaccurateScrollFactor = Math.min(Math.abs(wds[i2]), inaccurateScrollFactor);
                }
              }
            } else {
              wheelDeltas.push(delta);
              clamp = true;
            }
          } else if (inaccurateScrollDevice) {
            inaccurateScrollFactor = Math.min(Math.abs(delta), inaccurateScrollFactor);
          }
          if (r2.scrollingPage) {
            return;
          }
          var cy = r2.cy;
          var zoom2 = cy.zoom();
          var pan2 = cy.pan();
          var pos = r2.projectIntoViewport(e3.clientX, e3.clientY);
          var rpos = [pos[0] * zoom2 + pan2.x, pos[1] * zoom2 + pan2.y];
          if (r2.hoverData.draggingEles || r2.hoverData.dragging || r2.hoverData.cxtStarted || inBoxSelection()) {
            e3.preventDefault();
            return;
          }
          if (cy.panningEnabled() && cy.userPanningEnabled() && cy.zoomingEnabled() && cy.userZoomingEnabled()) {
            e3.preventDefault();
            r2.data.wheelZooming = true;
            clearTimeout(r2.data.wheelTimeout);
            r2.data.wheelTimeout = setTimeout(function() {
              r2.data.wheelZooming = false;
              r2.redrawHint("eles", true);
              r2.redraw();
            }, 150);
            var diff2;
            if (clamp && Math.abs(delta) > 5) {
              delta = signum(delta) * 5;
            }
            diff2 = delta / -250;
            if (inaccurateScrollDevice) {
              diff2 /= inaccurateScrollFactor;
              diff2 *= 3;
            }
            diff2 = diff2 * r2.wheelSensitivity;
            var needsWheelFix = e3.deltaMode === 1;
            if (needsWheelFix) {
              diff2 *= 33;
            }
            var newZoom = cy.zoom() * Math.pow(10, diff2);
            if (e3.type === "gesturechange") {
              newZoom = r2.gestureStartZoom * e3.scale;
            }
            cy.zoom({
              level: newZoom,
              renderedPosition: {
                x: rpos[0],
                y: rpos[1]
              }
            });
            cy.emit({
              type: e3.type === "gesturechange" ? "pinchzoom" : "scrollzoom",
              originalEvent: e3,
              position: {
                x: pos[0],
                y: pos[1]
              }
            });
          }
        }, "wheelHandler");
        r2.registerBinding(r2.container, "wheel", wheelHandler, true);
        r2.registerBinding(containerWindow, "scroll", /* @__PURE__ */ __name(function scrollHandler(e3) {
          r2.scrollingPage = true;
          clearTimeout(r2.scrollingPageTimeout);
          r2.scrollingPageTimeout = setTimeout(function() {
            r2.scrollingPage = false;
          }, 250);
        }, "scrollHandler"), true);
        r2.registerBinding(r2.container, "gesturestart", /* @__PURE__ */ __name(function gestureStartHandler(e3) {
          r2.gestureStartZoom = r2.cy.zoom();
          if (!r2.hasTouchStarted) {
            e3.preventDefault();
          }
        }, "gestureStartHandler"), true);
        r2.registerBinding(r2.container, "gesturechange", function(e3) {
          if (!r2.hasTouchStarted) {
            wheelHandler(e3);
          }
        }, true);
        r2.registerBinding(r2.container, "mouseout", /* @__PURE__ */ __name(function mouseOutHandler(e3) {
          var pos = r2.projectIntoViewport(e3.clientX, e3.clientY);
          r2.cy.emit({
            originalEvent: e3,
            type: "mouseout",
            position: {
              x: pos[0],
              y: pos[1]
            }
          });
        }, "mouseOutHandler"), false);
        r2.registerBinding(r2.container, "mouseover", /* @__PURE__ */ __name(function mouseOverHandler(e3) {
          var pos = r2.projectIntoViewport(e3.clientX, e3.clientY);
          r2.cy.emit({
            originalEvent: e3,
            type: "mouseover",
            position: {
              x: pos[0],
              y: pos[1]
            }
          });
        }, "mouseOverHandler"), false);
        var f1x1, f1y1, f2x1, f2y1;
        var distance1, distance1Sq;
        var center1, modelCenter1;
        var offsetLeft, offsetTop;
        var containerWidth, containerHeight;
        var twoFingersStartInside;
        var distance3 = /* @__PURE__ */ __name(function distance4(x1, y1, x22, y22) {
          return Math.sqrt((x22 - x1) * (x22 - x1) + (y22 - y1) * (y22 - y1));
        }, "distance");
        var distanceSq = /* @__PURE__ */ __name(function distanceSq2(x1, y1, x22, y22) {
          return (x22 - x1) * (x22 - x1) + (y22 - y1) * (y22 - y1);
        }, "distanceSq");
        var touchstartHandler;
        r2.registerBinding(r2.container, "touchstart", touchstartHandler = /* @__PURE__ */ __name(function touchstartHandler2(e3) {
          r2.hasTouchStarted = true;
          if (!eventInContainer(e3)) {
            return;
          }
          blurActiveDomElement();
          r2.touchData.capture = true;
          r2.data.bgActivePosistion = void 0;
          var cy = r2.cy;
          var now3 = r2.touchData.now;
          var earlier = r2.touchData.earlier;
          if (e3.touches[0]) {
            var pos = r2.projectIntoViewport(e3.touches[0].clientX, e3.touches[0].clientY);
            now3[0] = pos[0];
            now3[1] = pos[1];
          }
          if (e3.touches[1]) {
            var pos = r2.projectIntoViewport(e3.touches[1].clientX, e3.touches[1].clientY);
            now3[2] = pos[0];
            now3[3] = pos[1];
          }
          if (e3.touches[2]) {
            var pos = r2.projectIntoViewport(e3.touches[2].clientX, e3.touches[2].clientY);
            now3[4] = pos[0];
            now3[5] = pos[1];
          }
          var makeEvent = /* @__PURE__ */ __name(function makeEvent2(type3) {
            return {
              originalEvent: e3,
              type: type3,
              position: {
                x: now3[0],
                y: now3[1]
              }
            };
          }, "makeEvent");
          if (e3.touches[1]) {
            r2.touchData.singleTouchMoved = true;
            freeDraggedElements(r2.dragData.touchDragEles);
            var offsets = r2.findContainerClientCoords();
            offsetLeft = offsets[0];
            offsetTop = offsets[1];
            containerWidth = offsets[2];
            containerHeight = offsets[3];
            f1x1 = e3.touches[0].clientX - offsetLeft;
            f1y1 = e3.touches[0].clientY - offsetTop;
            f2x1 = e3.touches[1].clientX - offsetLeft;
            f2y1 = e3.touches[1].clientY - offsetTop;
            twoFingersStartInside = 0 <= f1x1 && f1x1 <= containerWidth && 0 <= f2x1 && f2x1 <= containerWidth && 0 <= f1y1 && f1y1 <= containerHeight && 0 <= f2y1 && f2y1 <= containerHeight;
            var pan2 = cy.pan();
            var zoom2 = cy.zoom();
            distance1 = distance3(f1x1, f1y1, f2x1, f2y1);
            distance1Sq = distanceSq(f1x1, f1y1, f2x1, f2y1);
            center1 = [(f1x1 + f2x1) / 2, (f1y1 + f2y1) / 2];
            modelCenter1 = [(center1[0] - pan2.x) / zoom2, (center1[1] - pan2.y) / zoom2];
            var cxtDistThreshold = 200;
            var cxtDistThresholdSq = cxtDistThreshold * cxtDistThreshold;
            if (distance1Sq < cxtDistThresholdSq && !e3.touches[2]) {
              var near1 = r2.findNearestElement(now3[0], now3[1], true, true);
              var near2 = r2.findNearestElement(now3[2], now3[3], true, true);
              if (near1 && near1.isNode()) {
                near1.activate().emit(makeEvent("cxttapstart"));
                r2.touchData.start = near1;
              } else if (near2 && near2.isNode()) {
                near2.activate().emit(makeEvent("cxttapstart"));
                r2.touchData.start = near2;
              } else {
                cy.emit(makeEvent("cxttapstart"));
              }
              if (r2.touchData.start) {
                r2.touchData.start._private.grabbed = false;
              }
              r2.touchData.cxt = true;
              r2.touchData.cxtDragged = false;
              r2.data.bgActivePosistion = void 0;
              r2.redraw();
              return;
            }
          }
          if (e3.touches[2]) {
            if (cy.boxSelectionEnabled()) {
              e3.preventDefault();
            }
          } else if (e3.touches[1]) ;
          else if (e3.touches[0]) {
            var nears = r2.findNearestElements(now3[0], now3[1], true, true);
            var near = nears[0];
            if (near != null) {
              near.activate();
              r2.touchData.start = near;
              r2.touchData.starts = nears;
              if (r2.nodeIsGrabbable(near)) {
                var draggedEles = r2.dragData.touchDragEles = cy.collection();
                var selectedNodes = null;
                r2.redrawHint("eles", true);
                r2.redrawHint("drag", true);
                if (near.selected()) {
                  selectedNodes = cy.$(function(ele) {
                    return ele.selected() && r2.nodeIsGrabbable(ele);
                  });
                  addNodesToDrag(selectedNodes, {
                    addToList: draggedEles
                  });
                } else {
                  addNodeToDrag(near, {
                    addToList: draggedEles
                  });
                }
                setGrabTarget(near);
                near.emit(makeEvent("grabon"));
                if (selectedNodes) {
                  selectedNodes.forEach(function(n2) {
                    n2.emit(makeEvent("grab"));
                  });
                } else {
                  near.emit(makeEvent("grab"));
                }
              }
            }
            triggerEvents(near, ["touchstart", "tapstart", "vmousedown"], e3, {
              x: now3[0],
              y: now3[1]
            });
            if (near == null) {
              r2.data.bgActivePosistion = {
                x: pos[0],
                y: pos[1]
              };
              r2.redrawHint("select", true);
              r2.redraw();
            }
            r2.touchData.singleTouchMoved = false;
            r2.touchData.singleTouchStartTime = +/* @__PURE__ */ new Date();
            clearTimeout(r2.touchData.tapholdTimeout);
            r2.touchData.tapholdTimeout = setTimeout(function() {
              if (r2.touchData.singleTouchMoved === false && !r2.pinching && !r2.touchData.selecting) {
                triggerEvents(r2.touchData.start, ["taphold"], e3, {
                  x: now3[0],
                  y: now3[1]
                });
              }
            }, r2.tapholdDuration);
          }
          if (e3.touches.length >= 1) {
            var sPos = r2.touchData.startPosition = [null, null, null, null, null, null];
            for (var i2 = 0; i2 < now3.length; i2++) {
              sPos[i2] = earlier[i2] = now3[i2];
            }
            var touch0 = e3.touches[0];
            r2.touchData.startGPosition = [touch0.clientX, touch0.clientY];
          }
        }, "touchstartHandler"), false);
        var touchmoveHandler;
        r2.registerBinding(containerWindow, "touchmove", touchmoveHandler = /* @__PURE__ */ __name(function touchmoveHandler2(e3) {
          var capture = r2.touchData.capture;
          if (!capture && !eventInContainer(e3)) {
            return;
          }
          var select = r2.selection;
          var cy = r2.cy;
          var now3 = r2.touchData.now;
          var earlier = r2.touchData.earlier;
          var zoom2 = cy.zoom();
          if (e3.touches[0]) {
            var pos = r2.projectIntoViewport(e3.touches[0].clientX, e3.touches[0].clientY);
            now3[0] = pos[0];
            now3[1] = pos[1];
          }
          if (e3.touches[1]) {
            var pos = r2.projectIntoViewport(e3.touches[1].clientX, e3.touches[1].clientY);
            now3[2] = pos[0];
            now3[3] = pos[1];
          }
          if (e3.touches[2]) {
            var pos = r2.projectIntoViewport(e3.touches[2].clientX, e3.touches[2].clientY);
            now3[4] = pos[0];
            now3[5] = pos[1];
          }
          var makeEvent = /* @__PURE__ */ __name(function makeEvent2(type3) {
            return {
              originalEvent: e3,
              type: type3,
              position: {
                x: now3[0],
                y: now3[1]
              }
            };
          }, "makeEvent");
          var startGPos = r2.touchData.startGPosition;
          var isOverThresholdDrag;
          if (capture && e3.touches[0] && startGPos) {
            var disp = [];
            for (var j3 = 0; j3 < now3.length; j3++) {
              disp[j3] = now3[j3] - earlier[j3];
            }
            var dx = e3.touches[0].clientX - startGPos[0];
            var dx2 = dx * dx;
            var dy = e3.touches[0].clientY - startGPos[1];
            var dy2 = dy * dy;
            var dist22 = dx2 + dy2;
            isOverThresholdDrag = dist22 >= r2.touchTapThreshold2;
          }
          if (capture && r2.touchData.cxt) {
            e3.preventDefault();
            var f1x2 = e3.touches[0].clientX - offsetLeft, f1y2 = e3.touches[0].clientY - offsetTop;
            var f2x2 = e3.touches[1].clientX - offsetLeft, f2y2 = e3.touches[1].clientY - offsetTop;
            var distance2Sq = distanceSq(f1x2, f1y2, f2x2, f2y2);
            var factorSq = distance2Sq / distance1Sq;
            var distThreshold = 150;
            var distThresholdSq = distThreshold * distThreshold;
            var factorThreshold = 1.5;
            var factorThresholdSq = factorThreshold * factorThreshold;
            if (factorSq >= factorThresholdSq || distance2Sq >= distThresholdSq) {
              r2.touchData.cxt = false;
              r2.data.bgActivePosistion = void 0;
              r2.redrawHint("select", true);
              var cxtEvt = makeEvent("cxttapend");
              if (r2.touchData.start) {
                r2.touchData.start.unactivate().emit(cxtEvt);
                r2.touchData.start = null;
              } else {
                cy.emit(cxtEvt);
              }
            }
          }
          if (capture && r2.touchData.cxt) {
            var cxtEvt = makeEvent("cxtdrag");
            r2.data.bgActivePosistion = void 0;
            r2.redrawHint("select", true);
            if (r2.touchData.start) {
              r2.touchData.start.emit(cxtEvt);
            } else {
              cy.emit(cxtEvt);
            }
            if (r2.touchData.start) {
              r2.touchData.start._private.grabbed = false;
            }
            r2.touchData.cxtDragged = true;
            var near = r2.findNearestElement(now3[0], now3[1], true, true);
            if (!r2.touchData.cxtOver || near !== r2.touchData.cxtOver) {
              if (r2.touchData.cxtOver) {
                r2.touchData.cxtOver.emit(makeEvent("cxtdragout"));
              }
              r2.touchData.cxtOver = near;
              if (near) {
                near.emit(makeEvent("cxtdragover"));
              }
            }
          } else if (capture && e3.touches[2] && cy.boxSelectionEnabled()) {
            e3.preventDefault();
            r2.data.bgActivePosistion = void 0;
            this.lastThreeTouch = +/* @__PURE__ */ new Date();
            if (!r2.touchData.selecting) {
              cy.emit(makeEvent("boxstart"));
            }
            r2.touchData.selecting = true;
            r2.touchData.didSelect = true;
            select[4] = 1;
            if (!select || select.length === 0 || select[0] === void 0) {
              select[0] = (now3[0] + now3[2] + now3[4]) / 3;
              select[1] = (now3[1] + now3[3] + now3[5]) / 3;
              select[2] = (now3[0] + now3[2] + now3[4]) / 3 + 1;
              select[3] = (now3[1] + now3[3] + now3[5]) / 3 + 1;
            } else {
              select[2] = (now3[0] + now3[2] + now3[4]) / 3;
              select[3] = (now3[1] + now3[3] + now3[5]) / 3;
            }
            r2.redrawHint("select", true);
            r2.redraw();
          } else if (capture && e3.touches[1] && !r2.touchData.didSelect && cy.zoomingEnabled() && cy.panningEnabled() && cy.userZoomingEnabled() && cy.userPanningEnabled()) {
            e3.preventDefault();
            r2.data.bgActivePosistion = void 0;
            r2.redrawHint("select", true);
            var draggedEles = r2.dragData.touchDragEles;
            if (draggedEles) {
              r2.redrawHint("drag", true);
              for (var i2 = 0; i2 < draggedEles.length; i2++) {
                var de_p = draggedEles[i2]._private;
                de_p.grabbed = false;
                de_p.rscratch.inDragLayer = false;
              }
            }
            var _start = r2.touchData.start;
            var f1x2 = e3.touches[0].clientX - offsetLeft, f1y2 = e3.touches[0].clientY - offsetTop;
            var f2x2 = e3.touches[1].clientX - offsetLeft, f2y2 = e3.touches[1].clientY - offsetTop;
            var distance22 = distance3(f1x2, f1y2, f2x2, f2y2);
            var factor = distance22 / distance1;
            if (twoFingersStartInside) {
              var df1x = f1x2 - f1x1;
              var df1y = f1y2 - f1y1;
              var df2x = f2x2 - f2x1;
              var df2y = f2y2 - f2y1;
              var tx = (df1x + df2x) / 2;
              var ty = (df1y + df2y) / 2;
              var zoom1 = cy.zoom();
              var zoom22 = zoom1 * factor;
              var pan1 = cy.pan();
              var ctrx = modelCenter1[0] * zoom1 + pan1.x;
              var ctry = modelCenter1[1] * zoom1 + pan1.y;
              var pan2 = {
                x: -zoom22 / zoom1 * (ctrx - pan1.x - tx) + ctrx,
                y: -zoom22 / zoom1 * (ctry - pan1.y - ty) + ctry
              };
              if (_start && _start.active()) {
                var draggedEles = r2.dragData.touchDragEles;
                freeDraggedElements(draggedEles);
                r2.redrawHint("drag", true);
                r2.redrawHint("eles", true);
                _start.unactivate().emit(makeEvent("freeon"));
                draggedEles.emit(makeEvent("free"));
                if (r2.dragData.didDrag) {
                  _start.emit(makeEvent("dragfreeon"));
                  draggedEles.emit(makeEvent("dragfree"));
                }
              }
              cy.viewport({
                zoom: zoom22,
                pan: pan2,
                cancelOnFailedZoom: true
              });
              cy.emit(makeEvent("pinchzoom"));
              distance1 = distance22;
              f1x1 = f1x2;
              f1y1 = f1y2;
              f2x1 = f2x2;
              f2y1 = f2y2;
              r2.pinching = true;
            }
            if (e3.touches[0]) {
              var pos = r2.projectIntoViewport(e3.touches[0].clientX, e3.touches[0].clientY);
              now3[0] = pos[0];
              now3[1] = pos[1];
            }
            if (e3.touches[1]) {
              var pos = r2.projectIntoViewport(e3.touches[1].clientX, e3.touches[1].clientY);
              now3[2] = pos[0];
              now3[3] = pos[1];
            }
            if (e3.touches[2]) {
              var pos = r2.projectIntoViewport(e3.touches[2].clientX, e3.touches[2].clientY);
              now3[4] = pos[0];
              now3[5] = pos[1];
            }
          } else if (e3.touches[0] && !r2.touchData.didSelect) {
            var start3 = r2.touchData.start;
            var last3 = r2.touchData.last;
            var near;
            if (!r2.hoverData.draggingEles && !r2.swipePanning) {
              near = r2.findNearestElement(now3[0], now3[1], true, true);
            }
            if (capture && start3 != null) {
              e3.preventDefault();
            }
            if (capture && start3 != null && r2.nodeIsDraggable(start3)) {
              if (isOverThresholdDrag) {
                var draggedEles = r2.dragData.touchDragEles;
                var justStartedDrag = !r2.dragData.didDrag;
                if (justStartedDrag) {
                  addNodesToDrag(draggedEles, {
                    inDragLayer: true
                  });
                }
                r2.dragData.didDrag = true;
                var totalShift = {
                  x: 0,
                  y: 0
                };
                if (number$1(disp[0]) && number$1(disp[1])) {
                  totalShift.x += disp[0];
                  totalShift.y += disp[1];
                  if (justStartedDrag) {
                    r2.redrawHint("eles", true);
                    var dragDelta = r2.touchData.dragDelta;
                    if (dragDelta && number$1(dragDelta[0]) && number$1(dragDelta[1])) {
                      totalShift.x += dragDelta[0];
                      totalShift.y += dragDelta[1];
                    }
                  }
                }
                r2.hoverData.draggingEles = true;
                draggedEles.silentShift(totalShift).emit(makeEvent("position")).emit(makeEvent("drag"));
                r2.redrawHint("drag", true);
                if (r2.touchData.startPosition[0] == earlier[0] && r2.touchData.startPosition[1] == earlier[1]) {
                  r2.redrawHint("eles", true);
                }
                r2.redraw();
              } else {
                var dragDelta = r2.touchData.dragDelta = r2.touchData.dragDelta || [];
                if (dragDelta.length === 0) {
                  dragDelta.push(disp[0]);
                  dragDelta.push(disp[1]);
                } else {
                  dragDelta[0] += disp[0];
                  dragDelta[1] += disp[1];
                }
              }
            }
            {
              triggerEvents(start3 || near, ["touchmove", "tapdrag", "vmousemove"], e3, {
                x: now3[0],
                y: now3[1]
              });
              if ((!start3 || !start3.grabbed()) && near != last3) {
                if (last3) {
                  last3.emit(makeEvent("tapdragout"));
                }
                if (near) {
                  near.emit(makeEvent("tapdragover"));
                }
              }
              r2.touchData.last = near;
            }
            if (capture) {
              for (var i2 = 0; i2 < now3.length; i2++) {
                if (now3[i2] && r2.touchData.startPosition[i2] && isOverThresholdDrag) {
                  r2.touchData.singleTouchMoved = true;
                }
              }
            }
            if (capture && (start3 == null || start3.pannable()) && cy.panningEnabled() && cy.userPanningEnabled()) {
              var allowPassthrough = allowPanningPassthrough(start3, r2.touchData.starts);
              if (allowPassthrough) {
                e3.preventDefault();
                if (!r2.data.bgActivePosistion) {
                  r2.data.bgActivePosistion = array2point(r2.touchData.startPosition);
                }
                if (r2.swipePanning) {
                  cy.panBy({
                    x: disp[0] * zoom2,
                    y: disp[1] * zoom2
                  });
                  cy.emit(makeEvent("dragpan"));
                } else if (isOverThresholdDrag) {
                  r2.swipePanning = true;
                  cy.panBy({
                    x: dx * zoom2,
                    y: dy * zoom2
                  });
                  cy.emit(makeEvent("dragpan"));
                  if (start3) {
                    start3.unactivate();
                    r2.redrawHint("select", true);
                    r2.touchData.start = null;
                  }
                }
              }
              var pos = r2.projectIntoViewport(e3.touches[0].clientX, e3.touches[0].clientY);
              now3[0] = pos[0];
              now3[1] = pos[1];
            }
          }
          for (var j3 = 0; j3 < now3.length; j3++) {
            earlier[j3] = now3[j3];
          }
          if (capture && e3.touches.length > 0 && !r2.hoverData.draggingEles && !r2.swipePanning && r2.data.bgActivePosistion != null) {
            r2.data.bgActivePosistion = void 0;
            r2.redrawHint("select", true);
            r2.redraw();
          }
        }, "touchmoveHandler"), false);
        var touchcancelHandler;
        r2.registerBinding(containerWindow, "touchcancel", touchcancelHandler = /* @__PURE__ */ __name(function touchcancelHandler2(e3) {
          var start3 = r2.touchData.start;
          r2.touchData.capture = false;
          if (start3) {
            start3.unactivate();
          }
        }, "touchcancelHandler"));
        var touchendHandler, didDoubleTouch, touchTimeout, prevTouchTimeStamp;
        r2.registerBinding(containerWindow, "touchend", touchendHandler = /* @__PURE__ */ __name(function touchendHandler2(e3) {
          var start3 = r2.touchData.start;
          var capture = r2.touchData.capture;
          if (capture) {
            if (e3.touches.length === 0) {
              r2.touchData.capture = false;
            }
            e3.preventDefault();
          } else {
            return;
          }
          var select = r2.selection;
          r2.swipePanning = false;
          r2.hoverData.draggingEles = false;
          var cy = r2.cy;
          var zoom2 = cy.zoom();
          var now3 = r2.touchData.now;
          var earlier = r2.touchData.earlier;
          if (e3.touches[0]) {
            var pos = r2.projectIntoViewport(e3.touches[0].clientX, e3.touches[0].clientY);
            now3[0] = pos[0];
            now3[1] = pos[1];
          }
          if (e3.touches[1]) {
            var pos = r2.projectIntoViewport(e3.touches[1].clientX, e3.touches[1].clientY);
            now3[2] = pos[0];
            now3[3] = pos[1];
          }
          if (e3.touches[2]) {
            var pos = r2.projectIntoViewport(e3.touches[2].clientX, e3.touches[2].clientY);
            now3[4] = pos[0];
            now3[5] = pos[1];
          }
          var makeEvent = /* @__PURE__ */ __name(function makeEvent2(type3) {
            return {
              originalEvent: e3,
              type: type3,
              position: {
                x: now3[0],
                y: now3[1]
              }
            };
          }, "makeEvent");
          if (start3) {
            start3.unactivate();
          }
          var ctxTapend;
          if (r2.touchData.cxt) {
            ctxTapend = makeEvent("cxttapend");
            if (start3) {
              start3.emit(ctxTapend);
            } else {
              cy.emit(ctxTapend);
            }
            if (!r2.touchData.cxtDragged) {
              var ctxTap = makeEvent("cxttap");
              if (start3) {
                start3.emit(ctxTap);
              } else {
                cy.emit(ctxTap);
              }
            }
            if (r2.touchData.start) {
              r2.touchData.start._private.grabbed = false;
            }
            r2.touchData.cxt = false;
            r2.touchData.start = null;
            r2.redraw();
            return;
          }
          if (!e3.touches[2] && cy.boxSelectionEnabled() && r2.touchData.selecting) {
            r2.touchData.selecting = false;
            var box = cy.collection(r2.getAllInBox(select[0], select[1], select[2], select[3]));
            select[0] = void 0;
            select[1] = void 0;
            select[2] = void 0;
            select[3] = void 0;
            select[4] = 0;
            r2.redrawHint("select", true);
            cy.emit(makeEvent("boxend"));
            var eleWouldBeSelected = /* @__PURE__ */ __name(function eleWouldBeSelected2(ele) {
              return ele.selectable() && !ele.selected();
            }, "eleWouldBeSelected");
            box.emit(makeEvent("box")).stdFilter(eleWouldBeSelected).select().emit(makeEvent("boxselect"));
            if (box.nonempty()) {
              r2.redrawHint("eles", true);
            }
            r2.redraw();
          }
          if (start3 != null) {
            start3.unactivate();
          }
          if (e3.touches[2]) {
            r2.data.bgActivePosistion = void 0;
            r2.redrawHint("select", true);
          } else if (e3.touches[1]) ;
          else if (e3.touches[0]) ;
          else if (!e3.touches[0]) {
            r2.data.bgActivePosistion = void 0;
            r2.redrawHint("select", true);
            var draggedEles = r2.dragData.touchDragEles;
            if (start3 != null) {
              var startWasGrabbed = start3._private.grabbed;
              freeDraggedElements(draggedEles);
              r2.redrawHint("drag", true);
              r2.redrawHint("eles", true);
              if (startWasGrabbed) {
                start3.emit(makeEvent("freeon"));
                draggedEles.emit(makeEvent("free"));
                if (r2.dragData.didDrag) {
                  start3.emit(makeEvent("dragfreeon"));
                  draggedEles.emit(makeEvent("dragfree"));
                }
              }
              triggerEvents(start3, ["touchend", "tapend", "vmouseup", "tapdragout"], e3, {
                x: now3[0],
                y: now3[1]
              });
              start3.unactivate();
              r2.touchData.start = null;
            } else {
              var near = r2.findNearestElement(now3[0], now3[1], true, true);
              triggerEvents(near, ["touchend", "tapend", "vmouseup", "tapdragout"], e3, {
                x: now3[0],
                y: now3[1]
              });
            }
            var dx = r2.touchData.startPosition[0] - now3[0];
            var dx2 = dx * dx;
            var dy = r2.touchData.startPosition[1] - now3[1];
            var dy2 = dy * dy;
            var dist22 = dx2 + dy2;
            var rdist2 = dist22 * zoom2 * zoom2;
            if (!r2.touchData.singleTouchMoved) {
              if (!start3) {
                cy.$(":selected").unselect(["tapunselect"]);
              }
              triggerEvents(start3, ["tap", "vclick"], e3, {
                x: now3[0],
                y: now3[1]
              });
              didDoubleTouch = false;
              if (e3.timeStamp - prevTouchTimeStamp <= cy.multiClickDebounceTime()) {
                touchTimeout && clearTimeout(touchTimeout);
                didDoubleTouch = true;
                prevTouchTimeStamp = null;
                triggerEvents(start3, ["dbltap", "vdblclick"], e3, {
                  x: now3[0],
                  y: now3[1]
                });
              } else {
                touchTimeout = setTimeout(function() {
                  if (didDoubleTouch) return;
                  triggerEvents(start3, ["onetap", "voneclick"], e3, {
                    x: now3[0],
                    y: now3[1]
                  });
                }, cy.multiClickDebounceTime());
                prevTouchTimeStamp = e3.timeStamp;
              }
            }
            if (start3 != null && !r2.dragData.didDrag && start3._private.selectable && rdist2 < r2.touchTapThreshold2 && !r2.pinching) {
              if (cy.selectionType() === "single") {
                cy.$(isSelected).unmerge(start3).unselect(["tapunselect"]);
                start3.select(["tapselect"]);
              } else {
                if (start3.selected()) {
                  start3.unselect(["tapunselect"]);
                } else {
                  start3.select(["tapselect"]);
                }
              }
              r2.redrawHint("eles", true);
            }
            r2.touchData.singleTouchMoved = true;
          }
          for (var j3 = 0; j3 < now3.length; j3++) {
            earlier[j3] = now3[j3];
          }
          r2.dragData.didDrag = false;
          if (e3.touches.length === 0) {
            r2.touchData.dragDelta = [];
            r2.touchData.startPosition = [null, null, null, null, null, null];
            r2.touchData.startGPosition = null;
            r2.touchData.didSelect = false;
          }
          if (e3.touches.length < 2) {
            if (e3.touches.length === 1) {
              r2.touchData.startGPosition = [e3.touches[0].clientX, e3.touches[0].clientY];
            }
            r2.pinching = false;
            r2.redrawHint("eles", true);
            r2.redraw();
          }
        }, "touchendHandler"), false);
        if (typeof TouchEvent === "undefined") {
          var pointers = [];
          var makeTouch = /* @__PURE__ */ __name(function makeTouch2(e3) {
            return {
              clientX: e3.clientX,
              clientY: e3.clientY,
              force: 1,
              identifier: e3.pointerId,
              pageX: e3.pageX,
              pageY: e3.pageY,
              radiusX: e3.width / 2,
              radiusY: e3.height / 2,
              screenX: e3.screenX,
              screenY: e3.screenY,
              target: e3.target
            };
          }, "makeTouch");
          var makePointer = /* @__PURE__ */ __name(function makePointer2(e3) {
            return {
              event: e3,
              touch: makeTouch(e3)
            };
          }, "makePointer");
          var addPointer = /* @__PURE__ */ __name(function addPointer2(e3) {
            pointers.push(makePointer(e3));
          }, "addPointer");
          var removePointer = /* @__PURE__ */ __name(function removePointer2(e3) {
            for (var i2 = 0; i2 < pointers.length; i2++) {
              var p3 = pointers[i2];
              if (p3.event.pointerId === e3.pointerId) {
                pointers.splice(i2, 1);
                return;
              }
            }
          }, "removePointer");
          var updatePointer = /* @__PURE__ */ __name(function updatePointer2(e3) {
            var p3 = pointers.filter(function(p4) {
              return p4.event.pointerId === e3.pointerId;
            })[0];
            p3.event = e3;
            p3.touch = makeTouch(e3);
          }, "updatePointer");
          var addTouchesToEvent = /* @__PURE__ */ __name(function addTouchesToEvent2(e3) {
            e3.touches = pointers.map(function(p3) {
              return p3.touch;
            });
          }, "addTouchesToEvent");
          var pointerIsMouse = /* @__PURE__ */ __name(function pointerIsMouse2(e3) {
            return e3.pointerType === "mouse" || e3.pointerType === 4;
          }, "pointerIsMouse");
          r2.registerBinding(r2.container, "pointerdown", function(e3) {
            if (pointerIsMouse(e3)) {
              return;
            }
            e3.preventDefault();
            addPointer(e3);
            addTouchesToEvent(e3);
            touchstartHandler(e3);
          });
          r2.registerBinding(r2.container, "pointerup", function(e3) {
            if (pointerIsMouse(e3)) {
              return;
            }
            removePointer(e3);
            addTouchesToEvent(e3);
            touchendHandler(e3);
          });
          r2.registerBinding(r2.container, "pointercancel", function(e3) {
            if (pointerIsMouse(e3)) {
              return;
            }
            removePointer(e3);
            addTouchesToEvent(e3);
            touchcancelHandler(e3);
          });
          r2.registerBinding(r2.container, "pointermove", function(e3) {
            if (pointerIsMouse(e3)) {
              return;
            }
            e3.preventDefault();
            updatePointer(e3);
            addTouchesToEvent(e3);
            touchmoveHandler(e3);
          });
        }
      };
      BRp$2 = {};
      BRp$2.generatePolygon = function(name, points) {
        return this.nodeShapes[name] = {
          renderer: this,
          name,
          points,
          draw: /* @__PURE__ */ __name(function draw31(context, centerX, centerY, width3, height2, cornerRadius) {
            this.renderer.nodeShapeImpl("polygon", context, centerX, centerY, width3, height2, this.points);
          }, "draw"),
          intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius) {
            return polygonIntersectLine(x5, y6, this.points, nodeX, nodeY, width3 / 2, height2 / 2, padding2);
          }, "intersectLine"),
          checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius) {
            return pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3, height2, [0, -1], padding2);
          }, "checkPoint"),
          hasMiterBounds: name !== "rectangle",
          miterBounds: /* @__PURE__ */ __name(function miterBounds(centerX, centerY, width3, height2, strokeWidth, strokePosition) {
            return miterBox(this.points, centerX, centerY, width3, height2, strokeWidth);
          }, "miterBounds")
        };
      };
      BRp$2.generateEllipse = function() {
        return this.nodeShapes["ellipse"] = {
          renderer: this,
          name: "ellipse",
          draw: /* @__PURE__ */ __name(function draw31(context, centerX, centerY, width3, height2, cornerRadius) {
            this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width3, height2);
          }, "draw"),
          intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius) {
            return intersectLineEllipse(x5, y6, nodeX, nodeY, width3 / 2 + padding2, height2 / 2 + padding2);
          }, "intersectLine"),
          checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius) {
            return checkInEllipse(x5, y6, width3, height2, centerX, centerY, padding2);
          }, "checkPoint")
        };
      };
      BRp$2.generateRoundPolygon = function(name, points) {
        return this.nodeShapes[name] = {
          renderer: this,
          name,
          points,
          getOrCreateCorners: /* @__PURE__ */ __name(function getOrCreateCorners(centerX, centerY, width3, height2, cornerRadius, rs, field) {
            if (rs[field] !== void 0 && rs[field + "-cx"] === centerX && rs[field + "-cy"] === centerY) {
              return rs[field];
            }
            rs[field] = new Array(points.length / 2);
            rs[field + "-cx"] = centerX;
            rs[field + "-cy"] = centerY;
            var halfW = width3 / 2;
            var halfH = height2 / 2;
            cornerRadius = cornerRadius === "auto" ? getRoundPolygonRadius(width3, height2) : cornerRadius;
            var p3 = new Array(points.length / 2);
            for (var _i = 0; _i < points.length / 2; _i++) {
              p3[_i] = {
                x: centerX + halfW * points[_i * 2],
                y: centerY + halfH * points[_i * 2 + 1]
              };
            }
            var i2, p1, p22, p32, len = p3.length;
            p1 = p3[len - 1];
            for (i2 = 0; i2 < len; i2++) {
              p22 = p3[i2 % len];
              p32 = p3[(i2 + 1) % len];
              rs[field][i2] = getRoundCorner(p1, p22, p32, cornerRadius);
              p1 = p22;
              p22 = p32;
            }
            return rs[field];
          }, "getOrCreateCorners"),
          draw: /* @__PURE__ */ __name(function draw31(context, centerX, centerY, width3, height2, cornerRadius, rs) {
            this.renderer.nodeShapeImpl("round-polygon", context, centerX, centerY, width3, height2, this.points, this.getOrCreateCorners(centerX, centerY, width3, height2, cornerRadius, rs, "drawCorners"));
          }, "draw"),
          intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius, rs) {
            return roundPolygonIntersectLine(x5, y6, this.points, nodeX, nodeY, width3, height2, padding2, this.getOrCreateCorners(nodeX, nodeY, width3, height2, cornerRadius, rs, "corners"));
          }, "intersectLine"),
          checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius, rs) {
            return pointInsideRoundPolygon(x5, y6, this.points, centerX, centerY, width3, height2, this.getOrCreateCorners(centerX, centerY, width3, height2, cornerRadius, rs, "corners"));
          }, "checkPoint")
        };
      };
      BRp$2.generateRoundRectangle = function() {
        return this.nodeShapes["round-rectangle"] = this.nodeShapes["roundrectangle"] = {
          renderer: this,
          name: "round-rectangle",
          points: generateUnitNgonPointsFitToSquare(4, 0),
          draw: /* @__PURE__ */ __name(function draw31(context, centerX, centerY, width3, height2, cornerRadius) {
            this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width3, height2, this.points, cornerRadius);
          }, "draw"),
          intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius) {
            return roundRectangleIntersectLine(x5, y6, nodeX, nodeY, width3, height2, padding2, cornerRadius);
          }, "intersectLine"),
          checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius) {
            var halfWidth = width3 / 2;
            var halfHeight = height2 / 2;
            cornerRadius = cornerRadius === "auto" ? getRoundRectangleRadius(width3, height2) : cornerRadius;
            cornerRadius = Math.min(halfWidth, halfHeight, cornerRadius);
            var diam = cornerRadius * 2;
            if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3, height2 - diam, [0, -1], padding2)) {
              return true;
            }
            if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3 - diam, height2, [0, -1], padding2)) {
              return true;
            }
            if (checkInEllipse(x5, y6, diam, diam, centerX - halfWidth + cornerRadius, centerY - halfHeight + cornerRadius, padding2)) {
              return true;
            }
            if (checkInEllipse(x5, y6, diam, diam, centerX + halfWidth - cornerRadius, centerY - halfHeight + cornerRadius, padding2)) {
              return true;
            }
            if (checkInEllipse(x5, y6, diam, diam, centerX + halfWidth - cornerRadius, centerY + halfHeight - cornerRadius, padding2)) {
              return true;
            }
            if (checkInEllipse(x5, y6, diam, diam, centerX - halfWidth + cornerRadius, centerY + halfHeight - cornerRadius, padding2)) {
              return true;
            }
            return false;
          }, "checkPoint")
        };
      };
      BRp$2.generateCutRectangle = function() {
        return this.nodeShapes["cut-rectangle"] = this.nodeShapes["cutrectangle"] = {
          renderer: this,
          name: "cut-rectangle",
          cornerLength: getCutRectangleCornerLength(),
          points: generateUnitNgonPointsFitToSquare(4, 0),
          draw: /* @__PURE__ */ __name(function draw31(context, centerX, centerY, width3, height2, cornerRadius) {
            this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width3, height2, null, cornerRadius);
          }, "draw"),
          generateCutTrianglePts: /* @__PURE__ */ __name(function generateCutTrianglePts(width3, height2, centerX, centerY, cornerRadius) {
            var cl = cornerRadius === "auto" ? this.cornerLength : cornerRadius;
            var hh = height2 / 2;
            var hw = width3 / 2;
            var xBegin = centerX - hw;
            var xEnd = centerX + hw;
            var yBegin = centerY - hh;
            var yEnd = centerY + hh;
            return {
              topLeft: [xBegin, yBegin + cl, xBegin + cl, yBegin, xBegin + cl, yBegin + cl],
              topRight: [xEnd - cl, yBegin, xEnd, yBegin + cl, xEnd - cl, yBegin + cl],
              bottomRight: [xEnd, yEnd - cl, xEnd - cl, yEnd, xEnd - cl, yEnd - cl],
              bottomLeft: [xBegin + cl, yEnd, xBegin, yEnd - cl, xBegin + cl, yEnd - cl]
            };
          }, "generateCutTrianglePts"),
          intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius) {
            var cPts = this.generateCutTrianglePts(width3 + 2 * padding2, height2 + 2 * padding2, nodeX, nodeY, cornerRadius);
            var pts2 = [].concat.apply([], [cPts.topLeft.splice(0, 4), cPts.topRight.splice(0, 4), cPts.bottomRight.splice(0, 4), cPts.bottomLeft.splice(0, 4)]);
            return polygonIntersectLine(x5, y6, pts2, nodeX, nodeY);
          }, "intersectLine"),
          checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius) {
            var cl = cornerRadius === "auto" ? this.cornerLength : cornerRadius;
            if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3, height2 - 2 * cl, [0, -1], padding2)) {
              return true;
            }
            if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3 - 2 * cl, height2, [0, -1], padding2)) {
              return true;
            }
            var cutTrianglePts = this.generateCutTrianglePts(width3, height2, centerX, centerY);
            return pointInsidePolygonPoints(x5, y6, cutTrianglePts.topLeft) || pointInsidePolygonPoints(x5, y6, cutTrianglePts.topRight) || pointInsidePolygonPoints(x5, y6, cutTrianglePts.bottomRight) || pointInsidePolygonPoints(x5, y6, cutTrianglePts.bottomLeft);
          }, "checkPoint")
        };
      };
      BRp$2.generateBarrel = function() {
        return this.nodeShapes["barrel"] = {
          renderer: this,
          name: "barrel",
          points: generateUnitNgonPointsFitToSquare(4, 0),
          draw: /* @__PURE__ */ __name(function draw31(context, centerX, centerY, width3, height2, cornerRadius) {
            this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width3, height2);
          }, "draw"),
          intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius) {
            var t03 = 0.15;
            var t13 = 0.5;
            var t22 = 0.85;
            var bPts = this.generateBarrelBezierPts(width3 + 2 * padding2, height2 + 2 * padding2, nodeX, nodeY);
            var approximateBarrelCurvePts = /* @__PURE__ */ __name(function approximateBarrelCurvePts2(pts3) {
              var m0 = qbezierPtAt({
                x: pts3[0],
                y: pts3[1]
              }, {
                x: pts3[2],
                y: pts3[3]
              }, {
                x: pts3[4],
                y: pts3[5]
              }, t03);
              var m1 = qbezierPtAt({
                x: pts3[0],
                y: pts3[1]
              }, {
                x: pts3[2],
                y: pts3[3]
              }, {
                x: pts3[4],
                y: pts3[5]
              }, t13);
              var m22 = qbezierPtAt({
                x: pts3[0],
                y: pts3[1]
              }, {
                x: pts3[2],
                y: pts3[3]
              }, {
                x: pts3[4],
                y: pts3[5]
              }, t22);
              return [pts3[0], pts3[1], m0.x, m0.y, m1.x, m1.y, m22.x, m22.y, pts3[4], pts3[5]];
            }, "approximateBarrelCurvePts");
            var pts2 = [].concat(approximateBarrelCurvePts(bPts.topLeft), approximateBarrelCurvePts(bPts.topRight), approximateBarrelCurvePts(bPts.bottomRight), approximateBarrelCurvePts(bPts.bottomLeft));
            return polygonIntersectLine(x5, y6, pts2, nodeX, nodeY);
          }, "intersectLine"),
          generateBarrelBezierPts: /* @__PURE__ */ __name(function generateBarrelBezierPts(width3, height2, centerX, centerY) {
            var hh = height2 / 2;
            var hw = width3 / 2;
            var xBegin = centerX - hw;
            var xEnd = centerX + hw;
            var yBegin = centerY - hh;
            var yEnd = centerY + hh;
            var curveConstants = getBarrelCurveConstants(width3, height2);
            var hOffset = curveConstants.heightOffset;
            var wOffset = curveConstants.widthOffset;
            var ctrlPtXOffset = curveConstants.ctrlPtOffsetPct * width3;
            var pts2 = {
              topLeft: [xBegin, yBegin + hOffset, xBegin + ctrlPtXOffset, yBegin, xBegin + wOffset, yBegin],
              topRight: [xEnd - wOffset, yBegin, xEnd - ctrlPtXOffset, yBegin, xEnd, yBegin + hOffset],
              bottomRight: [xEnd, yEnd - hOffset, xEnd - ctrlPtXOffset, yEnd, xEnd - wOffset, yEnd],
              bottomLeft: [xBegin + wOffset, yEnd, xBegin + ctrlPtXOffset, yEnd, xBegin, yEnd - hOffset]
            };
            pts2.topLeft.isTop = true;
            pts2.topRight.isTop = true;
            pts2.bottomLeft.isBottom = true;
            pts2.bottomRight.isBottom = true;
            return pts2;
          }, "generateBarrelBezierPts"),
          checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius) {
            var curveConstants = getBarrelCurveConstants(width3, height2);
            var hOffset = curveConstants.heightOffset;
            var wOffset = curveConstants.widthOffset;
            if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3, height2 - 2 * hOffset, [0, -1], padding2)) {
              return true;
            }
            if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3 - 2 * wOffset, height2, [0, -1], padding2)) {
              return true;
            }
            var barrelCurvePts = this.generateBarrelBezierPts(width3, height2, centerX, centerY);
            var getCurveT = /* @__PURE__ */ __name(function getCurveT2(x6, y7, curvePts) {
              var x0 = curvePts[4];
              var x1 = curvePts[2];
              var x22 = curvePts[0];
              var y02 = curvePts[5];
              var y23 = curvePts[1];
              var xMin = Math.min(x0, x22);
              var xMax = Math.max(x0, x22);
              var yMin = Math.min(y02, y23);
              var yMax = Math.max(y02, y23);
              if (xMin <= x6 && x6 <= xMax && yMin <= y7 && y7 <= yMax) {
                var coeff = bezierPtsToQuadCoeff(x0, x1, x22);
                var roots = solveQuadratic(coeff[0], coeff[1], coeff[2], x6);
                var validRoots = roots.filter(function(r2) {
                  return 0 <= r2 && r2 <= 1;
                });
                if (validRoots.length > 0) {
                  return validRoots[0];
                }
              }
              return null;
            }, "getCurveT");
            var curveRegions = Object.keys(barrelCurvePts);
            for (var i2 = 0; i2 < curveRegions.length; i2++) {
              var corner = curveRegions[i2];
              var cornerPts = barrelCurvePts[corner];
              var t4 = getCurveT(x5, y6, cornerPts);
              if (t4 == null) {
                continue;
              }
              var y0 = cornerPts[5];
              var y1 = cornerPts[3];
              var y22 = cornerPts[1];
              var bezY = qbezierAt(y0, y1, y22, t4);
              if (cornerPts.isTop && bezY <= y6) {
                return true;
              }
              if (cornerPts.isBottom && y6 <= bezY) {
                return true;
              }
            }
            return false;
          }, "checkPoint")
        };
      };
      BRp$2.generateBottomRoundrectangle = function() {
        return this.nodeShapes["bottom-round-rectangle"] = this.nodeShapes["bottomroundrectangle"] = {
          renderer: this,
          name: "bottom-round-rectangle",
          points: generateUnitNgonPointsFitToSquare(4, 0),
          draw: /* @__PURE__ */ __name(function draw31(context, centerX, centerY, width3, height2, cornerRadius) {
            this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width3, height2, this.points, cornerRadius);
          }, "draw"),
          intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius) {
            var topStartX = nodeX - (width3 / 2 + padding2);
            var topStartY = nodeY - (height2 / 2 + padding2);
            var topEndY = topStartY;
            var topEndX = nodeX + (width3 / 2 + padding2);
            var topIntersections = finiteLinesIntersect(x5, y6, nodeX, nodeY, topStartX, topStartY, topEndX, topEndY, false);
            if (topIntersections.length > 0) {
              return topIntersections;
            }
            return roundRectangleIntersectLine(x5, y6, nodeX, nodeY, width3, height2, padding2, cornerRadius);
          }, "intersectLine"),
          checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius) {
            cornerRadius = cornerRadius === "auto" ? getRoundRectangleRadius(width3, height2) : cornerRadius;
            var diam = 2 * cornerRadius;
            if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3, height2 - diam, [0, -1], padding2)) {
              return true;
            }
            if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3 - diam, height2, [0, -1], padding2)) {
              return true;
            }
            var outerWidth = width3 / 2 + 2 * padding2;
            var outerHeight = height2 / 2 + 2 * padding2;
            var points = [centerX - outerWidth, centerY - outerHeight, centerX - outerWidth, centerY, centerX + outerWidth, centerY, centerX + outerWidth, centerY - outerHeight];
            if (pointInsidePolygonPoints(x5, y6, points)) {
              return true;
            }
            if (checkInEllipse(x5, y6, diam, diam, centerX + width3 / 2 - cornerRadius, centerY + height2 / 2 - cornerRadius, padding2)) {
              return true;
            }
            if (checkInEllipse(x5, y6, diam, diam, centerX - width3 / 2 + cornerRadius, centerY + height2 / 2 - cornerRadius, padding2)) {
              return true;
            }
            return false;
          }, "checkPoint")
        };
      };
      BRp$2.registerNodeShapes = function() {
        var nodeShapes = this.nodeShapes = {};
        var renderer13 = this;
        this.generateEllipse();
        this.generatePolygon("triangle", generateUnitNgonPointsFitToSquare(3, 0));
        this.generateRoundPolygon("round-triangle", generateUnitNgonPointsFitToSquare(3, 0));
        this.generatePolygon("rectangle", generateUnitNgonPointsFitToSquare(4, 0));
        nodeShapes["square"] = nodeShapes["rectangle"];
        this.generateRoundRectangle();
        this.generateCutRectangle();
        this.generateBarrel();
        this.generateBottomRoundrectangle();
        {
          var diamondPoints = [0, 1, 1, 0, 0, -1, -1, 0];
          this.generatePolygon("diamond", diamondPoints);
          this.generateRoundPolygon("round-diamond", diamondPoints);
        }
        this.generatePolygon("pentagon", generateUnitNgonPointsFitToSquare(5, 0));
        this.generateRoundPolygon("round-pentagon", generateUnitNgonPointsFitToSquare(5, 0));
        this.generatePolygon("hexagon", generateUnitNgonPointsFitToSquare(6, 0));
        this.generateRoundPolygon("round-hexagon", generateUnitNgonPointsFitToSquare(6, 0));
        this.generatePolygon("heptagon", generateUnitNgonPointsFitToSquare(7, 0));
        this.generateRoundPolygon("round-heptagon", generateUnitNgonPointsFitToSquare(7, 0));
        this.generatePolygon("octagon", generateUnitNgonPointsFitToSquare(8, 0));
        this.generateRoundPolygon("round-octagon", generateUnitNgonPointsFitToSquare(8, 0));
        var star5Points = new Array(20);
        {
          var outerPoints = generateUnitNgonPoints(5, 0);
          var innerPoints = generateUnitNgonPoints(5, Math.PI / 5);
          var innerRadius = 0.5 * (3 - Math.sqrt(5));
          innerRadius *= 1.57;
          for (var i2 = 0; i2 < innerPoints.length / 2; i2++) {
            innerPoints[i2 * 2] *= innerRadius;
            innerPoints[i2 * 2 + 1] *= innerRadius;
          }
          for (var i2 = 0; i2 < 20 / 4; i2++) {
            star5Points[i2 * 4] = outerPoints[i2 * 2];
            star5Points[i2 * 4 + 1] = outerPoints[i2 * 2 + 1];
            star5Points[i2 * 4 + 2] = innerPoints[i2 * 2];
            star5Points[i2 * 4 + 3] = innerPoints[i2 * 2 + 1];
          }
        }
        star5Points = fitPolygonToSquare(star5Points);
        this.generatePolygon("star", star5Points);
        this.generatePolygon("vee", [-1, -1, 0, -0.333, 1, -1, 0, 1]);
        this.generatePolygon("rhomboid", [-1, -1, 0.333, -1, 1, 1, -0.333, 1]);
        this.generatePolygon("right-rhomboid", [-0.333, -1, 1, -1, 0.333, 1, -1, 1]);
        this.nodeShapes["concavehexagon"] = this.generatePolygon("concave-hexagon", [-1, -0.95, -0.75, 0, -1, 0.95, 1, 0.95, 0.75, 0, 1, -0.95]);
        {
          var tagPoints = [-1, -1, 0.25, -1, 1, 0, 0.25, 1, -1, 1];
          this.generatePolygon("tag", tagPoints);
          this.generateRoundPolygon("round-tag", tagPoints);
        }
        nodeShapes.makePolygon = function(points) {
          var key = points.join("$");
          var name = "polygon-" + key;
          var shape;
          if (shape = this[name]) {
            return shape;
          }
          return renderer13.generatePolygon(name, points);
        };
      };
      BRp$1 = {};
      BRp$1.timeToRender = function() {
        return this.redrawTotalTime / this.redrawCount;
      };
      BRp$1.redraw = function(options2) {
        options2 = options2 || staticEmptyObject();
        var r2 = this;
        if (r2.averageRedrawTime === void 0) {
          r2.averageRedrawTime = 0;
        }
        if (r2.lastRedrawTime === void 0) {
          r2.lastRedrawTime = 0;
        }
        if (r2.lastDrawTime === void 0) {
          r2.lastDrawTime = 0;
        }
        r2.requestedFrame = true;
        r2.renderOptions = options2;
      };
      BRp$1.beforeRender = function(fn3, priority3) {
        if (this.destroyed) {
          return;
        }
        if (priority3 == null) {
          error("Priority is not optional for beforeRender");
        }
        var cbs = this.beforeRenderCallbacks;
        cbs.push({
          fn: fn3,
          priority: priority3
        });
        cbs.sort(function(a2, b3) {
          return b3.priority - a2.priority;
        });
      };
      beforeRenderCallbacks = /* @__PURE__ */ __name(function beforeRenderCallbacks2(r2, willDraw, startTime) {
        var cbs = r2.beforeRenderCallbacks;
        for (var i2 = 0; i2 < cbs.length; i2++) {
          cbs[i2].fn(willDraw, startTime);
        }
      }, "beforeRenderCallbacks");
      BRp$1.startRenderLoop = function() {
        var r2 = this;
        var cy = r2.cy;
        if (r2.renderLoopStarted) {
          return;
        } else {
          r2.renderLoopStarted = true;
        }
        var _renderFn = /* @__PURE__ */ __name(function renderFn(requestTime) {
          if (r2.destroyed) {
            return;
          }
          if (cy.batching()) ;
          else if (r2.requestedFrame && !r2.skipFrame) {
            beforeRenderCallbacks(r2, true, requestTime);
            var startTime = performanceNow();
            r2.render(r2.renderOptions);
            var endTime = r2.lastDrawTime = performanceNow();
            if (r2.averageRedrawTime === void 0) {
              r2.averageRedrawTime = endTime - startTime;
            }
            if (r2.redrawCount === void 0) {
              r2.redrawCount = 0;
            }
            r2.redrawCount++;
            if (r2.redrawTotalTime === void 0) {
              r2.redrawTotalTime = 0;
            }
            var duration = endTime - startTime;
            r2.redrawTotalTime += duration;
            r2.lastRedrawTime = duration;
            r2.averageRedrawTime = r2.averageRedrawTime / 2 + duration / 2;
            r2.requestedFrame = false;
          } else {
            beforeRenderCallbacks(r2, false, requestTime);
          }
          r2.skipFrame = false;
          requestAnimationFrame2(_renderFn);
        }, "renderFn");
        requestAnimationFrame2(_renderFn);
      };
      BaseRenderer = /* @__PURE__ */ __name(function BaseRenderer2(options2) {
        this.init(options2);
      }, "BaseRenderer");
      BR = BaseRenderer;
      BRp = BR.prototype;
      BRp.clientFunctions = ["redrawHint", "render", "renderTo", "matchCanvasSize", "nodeShapeImpl", "arrowShapeImpl"];
      BRp.init = function(options2) {
        var r2 = this;
        r2.options = options2;
        r2.cy = options2.cy;
        var ctr = r2.container = options2.cy.container();
        var containerWindow = r2.cy.window();
        if (containerWindow) {
          var document2 = containerWindow.document;
          var head2 = document2.head;
          var stylesheetId = "__________cytoscape_stylesheet";
          var className = "__________cytoscape_container";
          var stylesheetAlreadyExists = document2.getElementById(stylesheetId) != null;
          if (ctr.className.indexOf(className) < 0) {
            ctr.className = (ctr.className || "") + " " + className;
          }
          if (!stylesheetAlreadyExists) {
            var stylesheet3 = document2.createElement("style");
            stylesheet3.id = stylesheetId;
            stylesheet3.textContent = "." + className + " { position: relative; }";
            head2.insertBefore(stylesheet3, head2.children[0]);
          }
          var computedStyle = containerWindow.getComputedStyle(ctr);
          var position5 = computedStyle.getPropertyValue("position");
          if (position5 === "static") {
            warn("A Cytoscape container has style position:static and so can not use UI extensions properly");
          }
        }
        r2.selection = [void 0, void 0, void 0, void 0, 0];
        r2.bezierProjPcts = [0.05, 0.225, 0.4, 0.5, 0.6, 0.775, 0.95];
        r2.hoverData = {
          down: null,
          last: null,
          downTime: null,
          triggerMode: null,
          dragging: false,
          initialPan: [null, null],
          capture: false
        };
        r2.dragData = {
          possibleDragElements: []
        };
        r2.touchData = {
          start: null,
          capture: false,
          // These 3 fields related to tap, taphold events
          startPosition: [null, null, null, null, null, null],
          singleTouchStartTime: null,
          singleTouchMoved: true,
          now: [null, null, null, null, null, null],
          earlier: [null, null, null, null, null, null]
        };
        r2.redraws = 0;
        r2.showFps = options2.showFps;
        r2.debug = options2.debug;
        r2.webgl = options2.webgl;
        r2.hideEdgesOnViewport = options2.hideEdgesOnViewport;
        r2.textureOnViewport = options2.textureOnViewport;
        r2.wheelSensitivity = options2.wheelSensitivity;
        r2.motionBlurEnabled = options2.motionBlur;
        r2.forcedPixelRatio = number$1(options2.pixelRatio) ? options2.pixelRatio : null;
        r2.motionBlur = options2.motionBlur;
        r2.motionBlurOpacity = options2.motionBlurOpacity;
        r2.motionBlurTransparency = 1 - r2.motionBlurOpacity;
        r2.motionBlurPxRatio = 1;
        r2.mbPxRBlurry = 1;
        r2.minMbLowQualFrames = 4;
        r2.fullQualityMb = false;
        r2.clearedForMotionBlur = [];
        r2.desktopTapThreshold = options2.desktopTapThreshold;
        r2.desktopTapThreshold2 = options2.desktopTapThreshold * options2.desktopTapThreshold;
        r2.touchTapThreshold = options2.touchTapThreshold;
        r2.touchTapThreshold2 = options2.touchTapThreshold * options2.touchTapThreshold;
        r2.tapholdDuration = 500;
        r2.bindings = [];
        r2.beforeRenderCallbacks = [];
        r2.beforeRenderPriorities = {
          // higher priority execs before lower one
          animations: 400,
          eleCalcs: 300,
          eleTxrDeq: 200,
          lyrTxrDeq: 150,
          lyrTxrSkip: 100
        };
        r2.registerNodeShapes();
        r2.registerArrowShapes();
        r2.registerCalculationListeners();
      };
      BRp.notify = function(eventName, eles) {
        var r2 = this;
        var cy = r2.cy;
        if (this.destroyed) {
          return;
        }
        if (eventName === "init") {
          r2.load();
          return;
        }
        if (eventName === "destroy") {
          r2.destroy();
          return;
        }
        if (eventName === "add" || eventName === "remove" || eventName === "move" && cy.hasCompoundNodes() || eventName === "load" || eventName === "zorder" || eventName === "mount") {
          r2.invalidateCachedZSortedEles();
        }
        if (eventName === "viewport") {
          r2.redrawHint("select", true);
        }
        if (eventName === "gc") {
          r2.redrawHint("gc", true);
        }
        if (eventName === "load" || eventName === "resize" || eventName === "mount") {
          r2.invalidateContainerClientCoordsCache();
          r2.matchCanvasSize(r2.container);
        }
        r2.redrawHint("eles", true);
        r2.redrawHint("drag", true);
        this.startRenderLoop();
        this.redraw();
      };
      BRp.destroy = function() {
        var r2 = this;
        r2.destroyed = true;
        r2.cy.stopAnimationLoop();
        for (var i2 = 0; i2 < r2.bindings.length; i2++) {
          var binding = r2.bindings[i2];
          var b3 = binding;
          var tgt = b3.target;
          (tgt.off || tgt.removeEventListener).apply(tgt, b3.args);
        }
        r2.bindings = [];
        r2.beforeRenderCallbacks = [];
        r2.onUpdateEleCalcsFns = [];
        if (r2.removeObserver) {
          r2.removeObserver.disconnect();
        }
        if (r2.styleObserver) {
          r2.styleObserver.disconnect();
        }
        if (r2.resizeObserver) {
          r2.resizeObserver.disconnect();
        }
        if (r2.labelCalcDiv) {
          try {
            document.body.removeChild(r2.labelCalcDiv);
          } catch (e3) {
          }
        }
      };
      BRp.isHeadless = function() {
        return false;
      };
      [BRp$f, BRp$5, BRp$4, BRp$3, BRp$2, BRp$1].forEach(function(props) {
        extend4(BRp, props);
      });
      fullFpsTime = 1e3 / 60;
      defs = {
        setupDequeueing: /* @__PURE__ */ __name(function setupDequeueing(opts) {
          return /* @__PURE__ */ __name(function setupDequeueingImpl() {
            var self2 = this;
            var r2 = this.renderer;
            if (self2.dequeueingSetup) {
              return;
            } else {
              self2.dequeueingSetup = true;
            }
            var queueRedraw = debounce(function() {
              r2.redrawHint("eles", true);
              r2.redrawHint("drag", true);
              r2.redraw();
            }, opts.deqRedrawThreshold);
            var dequeue = /* @__PURE__ */ __name(function dequeue2(willDraw, frameStartTime) {
              var startTime = performanceNow();
              var avgRenderTime = r2.averageRedrawTime;
              var renderTime = r2.lastRedrawTime;
              var deqd = [];
              var extent2 = r2.cy.extent();
              var pixelRatio = r2.getPixelRatio();
              if (!willDraw) {
                r2.flushRenderedStyleQueue();
              }
              while (true) {
                var now3 = performanceNow();
                var duration = now3 - startTime;
                var frameDuration = now3 - frameStartTime;
                if (renderTime < fullFpsTime) {
                  var timeAvailable = fullFpsTime - (willDraw ? avgRenderTime : 0);
                  if (frameDuration >= opts.deqFastCost * timeAvailable) {
                    break;
                  }
                } else {
                  if (willDraw) {
                    if (duration >= opts.deqCost * renderTime || duration >= opts.deqAvgCost * avgRenderTime) {
                      break;
                    }
                  } else if (frameDuration >= opts.deqNoDrawCost * fullFpsTime) {
                    break;
                  }
                }
                var thisDeqd = opts.deq(self2, pixelRatio, extent2);
                if (thisDeqd.length > 0) {
                  for (var i2 = 0; i2 < thisDeqd.length; i2++) {
                    deqd.push(thisDeqd[i2]);
                  }
                } else {
                  break;
                }
              }
              if (deqd.length > 0) {
                opts.onDeqd(self2, deqd);
                if (!willDraw && opts.shouldRedraw(self2, deqd, pixelRatio, extent2)) {
                  queueRedraw();
                }
              }
            }, "dequeue");
            var priority3 = opts.priority || noop$1;
            r2.beforeRender(dequeue, priority3(self2));
          }, "setupDequeueingImpl");
        }, "setupDequeueing")
      };
      ElementTextureCacheLookup = /* @__PURE__ */ (function() {
        function ElementTextureCacheLookup2(getKey3) {
          var doesEleInvalidateKey = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : falsify;
          _classCallCheck(this, ElementTextureCacheLookup2);
          this.idsByKey = new Map$1();
          this.keyForId = new Map$1();
          this.cachesByLvl = new Map$1();
          this.lvls = [];
          this.getKey = getKey3;
          this.doesEleInvalidateKey = doesEleInvalidateKey;
        }
        __name(ElementTextureCacheLookup2, "ElementTextureCacheLookup");
        return _createClass(ElementTextureCacheLookup2, [{
          key: "getIdsFor",
          value: /* @__PURE__ */ __name(function getIdsFor(key) {
            if (key == null) {
              error("Can not get id list for null key");
            }
            var idsByKey = this.idsByKey;
            var ids = this.idsByKey.get(key);
            if (!ids) {
              ids = new Set$1();
              idsByKey.set(key, ids);
            }
            return ids;
          }, "getIdsFor")
        }, {
          key: "addIdForKey",
          value: /* @__PURE__ */ __name(function addIdForKey(key, id34) {
            if (key != null) {
              this.getIdsFor(key).add(id34);
            }
          }, "addIdForKey")
        }, {
          key: "deleteIdForKey",
          value: /* @__PURE__ */ __name(function deleteIdForKey(key, id34) {
            if (key != null) {
              this.getIdsFor(key)["delete"](id34);
            }
          }, "deleteIdForKey")
        }, {
          key: "getNumberOfIdsForKey",
          value: /* @__PURE__ */ __name(function getNumberOfIdsForKey(key) {
            if (key == null) {
              return 0;
            } else {
              return this.getIdsFor(key).size;
            }
          }, "getNumberOfIdsForKey")
        }, {
          key: "updateKeyMappingFor",
          value: /* @__PURE__ */ __name(function updateKeyMappingFor(ele) {
            var id34 = ele.id();
            var prevKey = this.keyForId.get(id34);
            var currKey = this.getKey(ele);
            this.deleteIdForKey(prevKey, id34);
            this.addIdForKey(currKey, id34);
            this.keyForId.set(id34, currKey);
          }, "updateKeyMappingFor")
        }, {
          key: "deleteKeyMappingFor",
          value: /* @__PURE__ */ __name(function deleteKeyMappingFor(ele) {
            var id34 = ele.id();
            var prevKey = this.keyForId.get(id34);
            this.deleteIdForKey(prevKey, id34);
            this.keyForId["delete"](id34);
          }, "deleteKeyMappingFor")
        }, {
          key: "keyHasChangedFor",
          value: /* @__PURE__ */ __name(function keyHasChangedFor(ele) {
            var id34 = ele.id();
            var prevKey = this.keyForId.get(id34);
            var newKey = this.getKey(ele);
            return prevKey !== newKey;
          }, "keyHasChangedFor")
        }, {
          key: "isInvalid",
          value: /* @__PURE__ */ __name(function isInvalid(ele) {
            return this.keyHasChangedFor(ele) || this.doesEleInvalidateKey(ele);
          }, "isInvalid")
        }, {
          key: "getCachesAt",
          value: /* @__PURE__ */ __name(function getCachesAt(lvl) {
            var cachesByLvl = this.cachesByLvl, lvls = this.lvls;
            var caches = cachesByLvl.get(lvl);
            if (!caches) {
              caches = new Map$1();
              cachesByLvl.set(lvl, caches);
              lvls.push(lvl);
            }
            return caches;
          }, "getCachesAt")
        }, {
          key: "getCache",
          value: /* @__PURE__ */ __name(function getCache(key, lvl) {
            return this.getCachesAt(lvl).get(key);
          }, "getCache")
        }, {
          key: "get",
          value: /* @__PURE__ */ __name(function get5(ele, lvl) {
            var key = this.getKey(ele);
            var cache3 = this.getCache(key, lvl);
            if (cache3 != null) {
              this.updateKeyMappingFor(ele);
            }
            return cache3;
          }, "get")
        }, {
          key: "getForCachedKey",
          value: /* @__PURE__ */ __name(function getForCachedKey(ele, lvl) {
            var key = this.keyForId.get(ele.id());
            var cache3 = this.getCache(key, lvl);
            return cache3;
          }, "getForCachedKey")
        }, {
          key: "hasCache",
          value: /* @__PURE__ */ __name(function hasCache(key, lvl) {
            return this.getCachesAt(lvl).has(key);
          }, "hasCache")
        }, {
          key: "has",
          value: /* @__PURE__ */ __name(function has2(ele, lvl) {
            var key = this.getKey(ele);
            return this.hasCache(key, lvl);
          }, "has")
        }, {
          key: "setCache",
          value: /* @__PURE__ */ __name(function setCache(key, lvl, cache3) {
            cache3.key = key;
            this.getCachesAt(lvl).set(key, cache3);
          }, "setCache")
        }, {
          key: "set",
          value: /* @__PURE__ */ __name(function set5(ele, lvl, cache3) {
            var key = this.getKey(ele);
            this.setCache(key, lvl, cache3);
            this.updateKeyMappingFor(ele);
          }, "set")
        }, {
          key: "deleteCache",
          value: /* @__PURE__ */ __name(function deleteCache(key, lvl) {
            this.getCachesAt(lvl)["delete"](key);
          }, "deleteCache")
        }, {
          key: "delete",
          value: /* @__PURE__ */ __name(function _delete(ele, lvl) {
            var key = this.getKey(ele);
            this.deleteCache(key, lvl);
          }, "_delete")
        }, {
          key: "invalidateKey",
          value: /* @__PURE__ */ __name(function invalidateKey(key) {
            var _this = this;
            this.lvls.forEach(function(lvl) {
              return _this.deleteCache(key, lvl);
            });
          }, "invalidateKey")
          // returns true if no other eles reference the invalidated cache (n.b. other eles may need the cache with the same key)
        }, {
          key: "invalidate",
          value: /* @__PURE__ */ __name(function invalidate(ele) {
            var id34 = ele.id();
            var key = this.keyForId.get(id34);
            this.deleteKeyMappingFor(ele);
            var entireKeyInvalidated = this.doesEleInvalidateKey(ele);
            if (entireKeyInvalidated) {
              this.invalidateKey(key);
            }
            return entireKeyInvalidated || this.getNumberOfIdsForKey(key) === 0;
          }, "invalidate")
        }]);
      })();
      minTxrH = 25;
      txrStepH = 50;
      minLvl$1 = -4;
      maxLvl$1 = 3;
      maxZoom$1 = 7.99;
      eleTxrSpacing = 8;
      defTxrWidth = 1024;
      maxTxrW = 1024;
      maxTxrH = 1024;
      minUtility = 0.2;
      maxFullness = 0.8;
      maxFullnessChecks = 10;
      deqCost$1 = 0.15;
      deqAvgCost$1 = 0.1;
      deqNoDrawCost$1 = 0.9;
      deqFastCost$1 = 0.9;
      deqRedrawThreshold$1 = 100;
      maxDeqSize$1 = 1;
      getTxrReasons = {
        dequeue: "dequeue",
        downscale: "downscale",
        highQuality: "highQuality"
      };
      initDefaults = defaults$g({
        getKey: null,
        doesEleInvalidateKey: falsify,
        drawElement: null,
        getBoundingBox: null,
        getRotationPoint: null,
        getRotationOffset: null,
        isVisible: trueify,
        allowEdgeTxrCaching: true,
        allowParentTxrCaching: true
      });
      ElementTextureCache = /* @__PURE__ */ __name(function ElementTextureCache2(renderer13, initOptions) {
        var self2 = this;
        self2.renderer = renderer13;
        self2.onDequeues = [];
        var opts = initDefaults(initOptions);
        extend4(self2, opts);
        self2.lookup = new ElementTextureCacheLookup(opts.getKey, opts.doesEleInvalidateKey);
        self2.setupDequeueing();
      }, "ElementTextureCache");
      ETCp = ElementTextureCache.prototype;
      ETCp.reasons = getTxrReasons;
      ETCp.getTextureQueue = function(txrH) {
        var self2 = this;
        self2.eleImgCaches = self2.eleImgCaches || {};
        return self2.eleImgCaches[txrH] = self2.eleImgCaches[txrH] || [];
      };
      ETCp.getRetiredTextureQueue = function(txrH) {
        var self2 = this;
        var rtxtrQs = self2.eleImgCaches.retired = self2.eleImgCaches.retired || {};
        var rtxtrQ = rtxtrQs[txrH] = rtxtrQs[txrH] || [];
        return rtxtrQ;
      };
      ETCp.getElementQueue = function() {
        var self2 = this;
        var q3 = self2.eleCacheQueue = self2.eleCacheQueue || new Heap(function(a2, b3) {
          return b3.reqs - a2.reqs;
        });
        return q3;
      };
      ETCp.getElementKeyToQueue = function() {
        var self2 = this;
        var k2q = self2.eleKeyToCacheQueue = self2.eleKeyToCacheQueue || {};
        return k2q;
      };
      ETCp.getElement = function(ele, bb, pxRatio, lvl, reason) {
        var self2 = this;
        var r2 = this.renderer;
        var zoom2 = r2.cy.zoom();
        var lookup2 = this.lookup;
        if (!bb || bb.w === 0 || bb.h === 0 || isNaN(bb.w) || isNaN(bb.h) || !ele.visible() || ele.removed()) {
          return null;
        }
        if (!self2.allowEdgeTxrCaching && ele.isEdge() || !self2.allowParentTxrCaching && ele.isParent()) {
          return null;
        }
        if (lvl == null) {
          lvl = Math.ceil(log22(zoom2 * pxRatio));
        }
        if (lvl < minLvl$1) {
          lvl = minLvl$1;
        } else if (zoom2 >= maxZoom$1 || lvl > maxLvl$1) {
          return null;
        }
        var scale3 = Math.pow(2, lvl);
        var eleScaledH = bb.h * scale3;
        var eleScaledW = bb.w * scale3;
        var scaledLabelShown = r2.eleTextBiggerThanMin(ele, scale3);
        if (!this.isVisible(ele, scaledLabelShown)) {
          return null;
        }
        var eleCache = lookup2.get(ele, lvl);
        if (eleCache && eleCache.invalidated) {
          eleCache.invalidated = false;
          eleCache.texture.invalidatedWidth -= eleCache.width;
        }
        if (eleCache) {
          return eleCache;
        }
        var txrH;
        if (eleScaledH <= minTxrH) {
          txrH = minTxrH;
        } else if (eleScaledH <= txrStepH) {
          txrH = txrStepH;
        } else {
          txrH = Math.ceil(eleScaledH / txrStepH) * txrStepH;
        }
        if (eleScaledH > maxTxrH || eleScaledW > maxTxrW) {
          return null;
        }
        var txrQ = self2.getTextureQueue(txrH);
        var txr = txrQ[txrQ.length - 2];
        var addNewTxr = /* @__PURE__ */ __name(function addNewTxr2() {
          return self2.recycleTexture(txrH, eleScaledW) || self2.addTexture(txrH, eleScaledW);
        }, "addNewTxr");
        if (!txr) {
          txr = txrQ[txrQ.length - 1];
        }
        if (!txr) {
          txr = addNewTxr();
        }
        if (txr.width - txr.usedWidth < eleScaledW) {
          txr = addNewTxr();
        }
        var scalableFrom = /* @__PURE__ */ __name(function scalableFrom2(otherCache) {
          return otherCache && otherCache.scaledLabelShown === scaledLabelShown;
        }, "scalableFrom");
        var deqing = reason && reason === getTxrReasons.dequeue;
        var highQualityReq = reason && reason === getTxrReasons.highQuality;
        var downscaleReq = reason && reason === getTxrReasons.downscale;
        var higherCache;
        for (var l4 = lvl + 1; l4 <= maxLvl$1; l4++) {
          var c3 = lookup2.get(ele, l4);
          if (c3) {
            higherCache = c3;
            break;
          }
        }
        var oneUpCache = higherCache && higherCache.level === lvl + 1 ? higherCache : null;
        var downscale = /* @__PURE__ */ __name(function downscale2() {
          txr.context.drawImage(oneUpCache.texture.canvas, oneUpCache.x, 0, oneUpCache.width, oneUpCache.height, txr.usedWidth, 0, eleScaledW, eleScaledH);
        }, "downscale");
        txr.context.setTransform(1, 0, 0, 1, 0, 0);
        txr.context.clearRect(txr.usedWidth, 0, eleScaledW, txrH);
        if (scalableFrom(oneUpCache)) {
          downscale();
        } else if (scalableFrom(higherCache)) {
          if (highQualityReq) {
            for (var _l = higherCache.level; _l > lvl; _l--) {
              oneUpCache = self2.getElement(ele, bb, pxRatio, _l, getTxrReasons.downscale);
            }
            downscale();
          } else {
            self2.queueElement(ele, higherCache.level - 1);
            return higherCache;
          }
        } else {
          var lowerCache;
          if (!deqing && !highQualityReq && !downscaleReq) {
            for (var _l2 = lvl - 1; _l2 >= minLvl$1; _l2--) {
              var _c = lookup2.get(ele, _l2);
              if (_c) {
                lowerCache = _c;
                break;
              }
            }
          }
          if (scalableFrom(lowerCache)) {
            self2.queueElement(ele, lvl);
            return lowerCache;
          }
          txr.context.translate(txr.usedWidth, 0);
          txr.context.scale(scale3, scale3);
          this.drawElement(txr.context, ele, bb, scaledLabelShown, false);
          txr.context.scale(1 / scale3, 1 / scale3);
          txr.context.translate(-txr.usedWidth, 0);
        }
        eleCache = {
          x: txr.usedWidth,
          texture: txr,
          level: lvl,
          scale: scale3,
          width: eleScaledW,
          height: eleScaledH,
          scaledLabelShown
        };
        txr.usedWidth += Math.ceil(eleScaledW + eleTxrSpacing);
        txr.eleCaches.push(eleCache);
        lookup2.set(ele, lvl, eleCache);
        self2.checkTextureFullness(txr);
        return eleCache;
      };
      ETCp.invalidateElements = function(eles) {
        for (var i2 = 0; i2 < eles.length; i2++) {
          this.invalidateElement(eles[i2]);
        }
      };
      ETCp.invalidateElement = function(ele) {
        var self2 = this;
        var lookup2 = self2.lookup;
        var caches = [];
        var invalid = lookup2.isInvalid(ele);
        if (!invalid) {
          return;
        }
        for (var lvl = minLvl$1; lvl <= maxLvl$1; lvl++) {
          var cache3 = lookup2.getForCachedKey(ele, lvl);
          if (cache3) {
            caches.push(cache3);
          }
        }
        var noOtherElesUseCache = lookup2.invalidate(ele);
        if (noOtherElesUseCache) {
          for (var i2 = 0; i2 < caches.length; i2++) {
            var _cache = caches[i2];
            var txr = _cache.texture;
            txr.invalidatedWidth += _cache.width;
            _cache.invalidated = true;
            self2.checkTextureUtility(txr);
          }
        }
        self2.removeFromQueue(ele);
      };
      ETCp.checkTextureUtility = function(txr) {
        if (txr.invalidatedWidth >= minUtility * txr.width) {
          this.retireTexture(txr);
        }
      };
      ETCp.checkTextureFullness = function(txr) {
        var self2 = this;
        var txrQ = self2.getTextureQueue(txr.height);
        if (txr.usedWidth / txr.width > maxFullness && txr.fullnessChecks >= maxFullnessChecks) {
          removeFromArray(txrQ, txr);
        } else {
          txr.fullnessChecks++;
        }
      };
      ETCp.retireTexture = function(txr) {
        var self2 = this;
        var txrH = txr.height;
        var txrQ = self2.getTextureQueue(txrH);
        var lookup2 = this.lookup;
        removeFromArray(txrQ, txr);
        txr.retired = true;
        var eleCaches = txr.eleCaches;
        for (var i2 = 0; i2 < eleCaches.length; i2++) {
          var eleCache = eleCaches[i2];
          lookup2.deleteCache(eleCache.key, eleCache.level);
        }
        clearArray(eleCaches);
        var rtxtrQ = self2.getRetiredTextureQueue(txrH);
        rtxtrQ.push(txr);
      };
      ETCp.addTexture = function(txrH, minW) {
        var self2 = this;
        var txrQ = self2.getTextureQueue(txrH);
        var txr = {};
        txrQ.push(txr);
        txr.eleCaches = [];
        txr.height = txrH;
        txr.width = Math.max(defTxrWidth, minW);
        txr.usedWidth = 0;
        txr.invalidatedWidth = 0;
        txr.fullnessChecks = 0;
        txr.canvas = self2.renderer.makeOffscreenCanvas(txr.width, txr.height);
        txr.context = txr.canvas.getContext("2d");
        return txr;
      };
      ETCp.recycleTexture = function(txrH, minW) {
        var self2 = this;
        var txrQ = self2.getTextureQueue(txrH);
        var rtxtrQ = self2.getRetiredTextureQueue(txrH);
        for (var i2 = 0; i2 < rtxtrQ.length; i2++) {
          var txr = rtxtrQ[i2];
          if (txr.width >= minW) {
            txr.retired = false;
            txr.usedWidth = 0;
            txr.invalidatedWidth = 0;
            txr.fullnessChecks = 0;
            clearArray(txr.eleCaches);
            txr.context.setTransform(1, 0, 0, 1, 0, 0);
            txr.context.clearRect(0, 0, txr.width, txr.height);
            removeFromArray(rtxtrQ, txr);
            txrQ.push(txr);
            return txr;
          }
        }
      };
      ETCp.queueElement = function(ele, lvl) {
        var self2 = this;
        var q3 = self2.getElementQueue();
        var k2q = self2.getElementKeyToQueue();
        var key = this.getKey(ele);
        var existingReq = k2q[key];
        if (existingReq) {
          existingReq.level = Math.max(existingReq.level, lvl);
          existingReq.eles.merge(ele);
          existingReq.reqs++;
          q3.updateItem(existingReq);
        } else {
          var req = {
            eles: ele.spawn().merge(ele),
            level: lvl,
            reqs: 1,
            key
          };
          q3.push(req);
          k2q[key] = req;
        }
      };
      ETCp.dequeue = function(pxRatio) {
        var self2 = this;
        var q3 = self2.getElementQueue();
        var k2q = self2.getElementKeyToQueue();
        var dequeued = [];
        var lookup2 = self2.lookup;
        for (var i2 = 0; i2 < maxDeqSize$1; i2++) {
          if (q3.size() > 0) {
            var req = q3.pop();
            var key = req.key;
            var ele = req.eles[0];
            var cacheExists = lookup2.hasCache(ele, req.level);
            k2q[key] = null;
            if (cacheExists) {
              continue;
            }
            dequeued.push(req);
            var bb = self2.getBoundingBox(ele);
            self2.getElement(ele, bb, pxRatio, req.level, getTxrReasons.dequeue);
          } else {
            break;
          }
        }
        return dequeued;
      };
      ETCp.removeFromQueue = function(ele) {
        var self2 = this;
        var q3 = self2.getElementQueue();
        var k2q = self2.getElementKeyToQueue();
        var key = this.getKey(ele);
        var req = k2q[key];
        if (req != null) {
          if (req.eles.length === 1) {
            req.reqs = MAX_INT$1;
            q3.updateItem(req);
            q3.pop();
            k2q[key] = null;
          } else {
            req.eles.unmerge(ele);
          }
        }
      };
      ETCp.onDequeue = function(fn3) {
        this.onDequeues.push(fn3);
      };
      ETCp.offDequeue = function(fn3) {
        removeFromArray(this.onDequeues, fn3);
      };
      ETCp.setupDequeueing = defs.setupDequeueing({
        deqRedrawThreshold: deqRedrawThreshold$1,
        deqCost: deqCost$1,
        deqAvgCost: deqAvgCost$1,
        deqNoDrawCost: deqNoDrawCost$1,
        deqFastCost: deqFastCost$1,
        deq: /* @__PURE__ */ __name(function deq(self2, pxRatio, extent2) {
          return self2.dequeue(pxRatio, extent2);
        }, "deq"),
        onDeqd: /* @__PURE__ */ __name(function onDeqd(self2, deqd) {
          for (var i2 = 0; i2 < self2.onDequeues.length; i2++) {
            var fn3 = self2.onDequeues[i2];
            fn3(deqd);
          }
        }, "onDeqd"),
        shouldRedraw: /* @__PURE__ */ __name(function shouldRedraw(self2, deqd, pxRatio, extent2) {
          for (var i2 = 0; i2 < deqd.length; i2++) {
            var eles = deqd[i2].eles;
            for (var j3 = 0; j3 < eles.length; j3++) {
              var bb = eles[j3].boundingBox();
              if (boundingBoxesIntersect(bb, extent2)) {
                return true;
              }
            }
          }
          return false;
        }, "shouldRedraw"),
        priority: /* @__PURE__ */ __name(function priority(self2) {
          return self2.renderer.beforeRenderPriorities.eleTxrDeq;
        }, "priority")
      });
      defNumLayers = 1;
      minLvl = -4;
      maxLvl = 2;
      maxZoom2 = 3.99;
      deqRedrawThreshold = 50;
      refineEleDebounceTime = 50;
      deqCost = 0.15;
      deqAvgCost = 0.1;
      deqNoDrawCost = 0.9;
      deqFastCost = 0.9;
      maxDeqSize = 1;
      invalidThreshold = 250;
      maxLayerArea = 4e3 * 4e3;
      maxLayerDim = 32767;
      useHighQualityEleTxrReqs = true;
      LayeredTextureCache = /* @__PURE__ */ __name(function LayeredTextureCache2(renderer13) {
        var self2 = this;
        var r2 = self2.renderer = renderer13;
        var cy = r2.cy;
        self2.layersByLevel = {};
        self2.firstGet = true;
        self2.lastInvalidationTime = performanceNow() - 2 * invalidThreshold;
        self2.skipping = false;
        self2.eleTxrDeqs = cy.collection();
        self2.scheduleElementRefinement = debounce(function() {
          self2.refineElementTextures(self2.eleTxrDeqs);
          self2.eleTxrDeqs.unmerge(self2.eleTxrDeqs);
        }, refineEleDebounceTime);
        r2.beforeRender(function(willDraw, now3) {
          if (now3 - self2.lastInvalidationTime <= invalidThreshold) {
            self2.skipping = true;
          } else {
            self2.skipping = false;
          }
        }, r2.beforeRenderPriorities.lyrTxrSkip);
        var qSort = /* @__PURE__ */ __name(function qSort2(a2, b3) {
          return b3.reqs - a2.reqs;
        }, "qSort");
        self2.layersQueue = new Heap(qSort);
        self2.setupDequeueing();
      }, "LayeredTextureCache");
      LTCp = LayeredTextureCache.prototype;
      layerIdPool = 0;
      MAX_INT = Math.pow(2, 53) - 1;
      LTCp.makeLayer = function(bb, lvl) {
        var scale3 = Math.pow(2, lvl);
        var w4 = Math.ceil(bb.w * scale3);
        var h3 = Math.ceil(bb.h * scale3);
        var canvas = this.renderer.makeOffscreenCanvas(w4, h3);
        var layer = {
          id: layerIdPool = ++layerIdPool % MAX_INT,
          bb,
          level: lvl,
          width: w4,
          height: h3,
          canvas,
          context: canvas.getContext("2d"),
          eles: [],
          elesQueue: [],
          reqs: 0
        };
        var cxt = layer.context;
        var dx = -layer.bb.x1;
        var dy = -layer.bb.y1;
        cxt.scale(scale3, scale3);
        cxt.translate(dx, dy);
        return layer;
      };
      LTCp.getLayers = function(eles, pxRatio, lvl) {
        var self2 = this;
        var r2 = self2.renderer;
        var cy = r2.cy;
        var zoom2 = cy.zoom();
        var firstGet = self2.firstGet;
        self2.firstGet = false;
        if (lvl == null) {
          lvl = Math.ceil(log22(zoom2 * pxRatio));
          if (lvl < minLvl) {
            lvl = minLvl;
          } else if (zoom2 >= maxZoom2 || lvl > maxLvl) {
            return null;
          }
        }
        self2.validateLayersElesOrdering(lvl, eles);
        var layersByLvl = self2.layersByLevel;
        var scale3 = Math.pow(2, lvl);
        var layers = layersByLvl[lvl] = layersByLvl[lvl] || [];
        var bb;
        var lvlComplete = self2.levelIsComplete(lvl, eles);
        var tmpLayers;
        var checkTempLevels = /* @__PURE__ */ __name(function checkTempLevels2() {
          var canUseAsTmpLvl = /* @__PURE__ */ __name(function canUseAsTmpLvl2(l4) {
            self2.validateLayersElesOrdering(l4, eles);
            if (self2.levelIsComplete(l4, eles)) {
              tmpLayers = layersByLvl[l4];
              return true;
            }
          }, "canUseAsTmpLvl");
          var checkLvls = /* @__PURE__ */ __name(function checkLvls2(dir2) {
            if (tmpLayers) {
              return;
            }
            for (var l4 = lvl + dir2; minLvl <= l4 && l4 <= maxLvl; l4 += dir2) {
              if (canUseAsTmpLvl(l4)) {
                break;
              }
            }
          }, "checkLvls");
          checkLvls(1);
          checkLvls(-1);
          for (var i3 = layers.length - 1; i3 >= 0; i3--) {
            var layer2 = layers[i3];
            if (layer2.invalid) {
              removeFromArray(layers, layer2);
            }
          }
        }, "checkTempLevels");
        if (!lvlComplete) {
          checkTempLevels();
        } else {
          return layers;
        }
        var getBb = /* @__PURE__ */ __name(function getBb2() {
          if (!bb) {
            bb = makeBoundingBox();
            for (var i3 = 0; i3 < eles.length; i3++) {
              updateBoundingBox(bb, eles[i3].boundingBox());
            }
          }
          return bb;
        }, "getBb");
        var makeLayer = /* @__PURE__ */ __name(function makeLayer2(opts) {
          opts = opts || {};
          var after = opts.after;
          getBb();
          var w4 = Math.ceil(bb.w * scale3);
          var h3 = Math.ceil(bb.h * scale3);
          if (w4 > maxLayerDim || h3 > maxLayerDim) {
            return null;
          }
          var area = w4 * h3;
          if (area > maxLayerArea) {
            return null;
          }
          var layer2 = self2.makeLayer(bb, lvl);
          if (after != null) {
            var index = layers.indexOf(after) + 1;
            layers.splice(index, 0, layer2);
          } else if (opts.insert === void 0 || opts.insert) {
            layers.unshift(layer2);
          }
          return layer2;
        }, "makeLayer");
        if (self2.skipping && !firstGet) {
          return null;
        }
        var layer = null;
        var maxElesPerLayer = eles.length / defNumLayers;
        var allowLazyQueueing = !firstGet;
        for (var i2 = 0; i2 < eles.length; i2++) {
          var ele = eles[i2];
          var rs = ele._private.rscratch;
          var caches = rs.imgLayerCaches = rs.imgLayerCaches || {};
          var existingLayer = caches[lvl];
          if (existingLayer) {
            layer = existingLayer;
            continue;
          }
          if (!layer || layer.eles.length >= maxElesPerLayer || !boundingBoxInBoundingBox(layer.bb, ele.boundingBox())) {
            layer = makeLayer({
              insert: true,
              after: layer
            });
            if (!layer) {
              return null;
            }
          }
          if (tmpLayers || allowLazyQueueing) {
            self2.queueLayer(layer, ele);
          } else {
            self2.drawEleInLayer(layer, ele, lvl, pxRatio);
          }
          layer.eles.push(ele);
          caches[lvl] = layer;
        }
        if (tmpLayers) {
          return tmpLayers;
        }
        if (allowLazyQueueing) {
          return null;
        }
        return layers;
      };
      LTCp.getEleLevelForLayerLevel = function(lvl, pxRatio) {
        return lvl;
      };
      LTCp.drawEleInLayer = function(layer, ele, lvl, pxRatio) {
        var self2 = this;
        var r2 = this.renderer;
        var context = layer.context;
        var bb = ele.boundingBox();
        if (bb.w === 0 || bb.h === 0 || !ele.visible()) {
          return;
        }
        lvl = self2.getEleLevelForLayerLevel(lvl, pxRatio);
        {
          r2.setImgSmoothing(context, false);
        }
        {
          r2.drawCachedElement(context, ele, null, null, lvl, useHighQualityEleTxrReqs);
        }
        {
          r2.setImgSmoothing(context, true);
        }
      };
      LTCp.levelIsComplete = function(lvl, eles) {
        var self2 = this;
        var layers = self2.layersByLevel[lvl];
        if (!layers || layers.length === 0) {
          return false;
        }
        var numElesInLayers = 0;
        for (var i2 = 0; i2 < layers.length; i2++) {
          var layer = layers[i2];
          if (layer.reqs > 0) {
            return false;
          }
          if (layer.invalid) {
            return false;
          }
          numElesInLayers += layer.eles.length;
        }
        if (numElesInLayers !== eles.length) {
          return false;
        }
        return true;
      };
      LTCp.validateLayersElesOrdering = function(lvl, eles) {
        var layers = this.layersByLevel[lvl];
        if (!layers) {
          return;
        }
        for (var i2 = 0; i2 < layers.length; i2++) {
          var layer = layers[i2];
          var offset = -1;
          for (var j3 = 0; j3 < eles.length; j3++) {
            if (layer.eles[0] === eles[j3]) {
              offset = j3;
              break;
            }
          }
          if (offset < 0) {
            this.invalidateLayer(layer);
            continue;
          }
          var o2 = offset;
          for (var j3 = 0; j3 < layer.eles.length; j3++) {
            if (layer.eles[j3] !== eles[o2 + j3]) {
              this.invalidateLayer(layer);
              break;
            }
          }
        }
      };
      LTCp.updateElementsInLayers = function(eles, update2) {
        var self2 = this;
        var isEles = element(eles[0]);
        for (var i2 = 0; i2 < eles.length; i2++) {
          var req = isEles ? null : eles[i2];
          var ele = isEles ? eles[i2] : eles[i2].ele;
          var rs = ele._private.rscratch;
          var caches = rs.imgLayerCaches = rs.imgLayerCaches || {};
          for (var l4 = minLvl; l4 <= maxLvl; l4++) {
            var layer = caches[l4];
            if (!layer) {
              continue;
            }
            if (req && self2.getEleLevelForLayerLevel(layer.level) !== req.level) {
              continue;
            }
            update2(layer, ele, req);
          }
        }
      };
      LTCp.haveLayers = function() {
        var self2 = this;
        var haveLayers = false;
        for (var l4 = minLvl; l4 <= maxLvl; l4++) {
          var layers = self2.layersByLevel[l4];
          if (layers && layers.length > 0) {
            haveLayers = true;
            break;
          }
        }
        return haveLayers;
      };
      LTCp.invalidateElements = function(eles) {
        var self2 = this;
        if (eles.length === 0) {
          return;
        }
        self2.lastInvalidationTime = performanceNow();
        if (eles.length === 0 || !self2.haveLayers()) {
          return;
        }
        self2.updateElementsInLayers(eles, /* @__PURE__ */ __name(function invalAssocLayers(layer, ele, req) {
          self2.invalidateLayer(layer);
        }, "invalAssocLayers"));
      };
      LTCp.invalidateLayer = function(layer) {
        this.lastInvalidationTime = performanceNow();
        if (layer.invalid) {
          return;
        }
        var lvl = layer.level;
        var eles = layer.eles;
        var layers = this.layersByLevel[lvl];
        removeFromArray(layers, layer);
        layer.elesQueue = [];
        layer.invalid = true;
        if (layer.replacement) {
          layer.replacement.invalid = true;
        }
        for (var i2 = 0; i2 < eles.length; i2++) {
          var caches = eles[i2]._private.rscratch.imgLayerCaches;
          if (caches) {
            caches[lvl] = null;
          }
        }
      };
      LTCp.refineElementTextures = function(eles) {
        var self2 = this;
        self2.updateElementsInLayers(eles, /* @__PURE__ */ __name(function refineEachEle(layer, ele, req) {
          var rLyr = layer.replacement;
          if (!rLyr) {
            rLyr = layer.replacement = self2.makeLayer(layer.bb, layer.level);
            rLyr.replaces = layer;
            rLyr.eles = layer.eles;
          }
          if (!rLyr.reqs) {
            for (var i2 = 0; i2 < rLyr.eles.length; i2++) {
              self2.queueLayer(rLyr, rLyr.eles[i2]);
            }
          }
        }, "refineEachEle"));
      };
      LTCp.enqueueElementRefinement = function(ele) {
        this.eleTxrDeqs.merge(ele);
        this.scheduleElementRefinement();
      };
      LTCp.queueLayer = function(layer, ele) {
        var self2 = this;
        var q3 = self2.layersQueue;
        var elesQ = layer.elesQueue;
        var hasId = elesQ.hasId = elesQ.hasId || {};
        if (layer.replacement) {
          return;
        }
        if (ele) {
          if (hasId[ele.id()]) {
            return;
          }
          elesQ.push(ele);
          hasId[ele.id()] = true;
        }
        if (layer.reqs) {
          layer.reqs++;
          q3.updateItem(layer);
        } else {
          layer.reqs = 1;
          q3.push(layer);
        }
      };
      LTCp.dequeue = function(pxRatio) {
        var self2 = this;
        var q3 = self2.layersQueue;
        var deqd = [];
        var eleDeqs = 0;
        while (eleDeqs < maxDeqSize) {
          if (q3.size() === 0) {
            break;
          }
          var layer = q3.peek();
          if (layer.replacement) {
            q3.pop();
            continue;
          }
          if (layer.replaces && layer !== layer.replaces.replacement) {
            q3.pop();
            continue;
          }
          if (layer.invalid) {
            q3.pop();
            continue;
          }
          var ele = layer.elesQueue.shift();
          if (ele) {
            self2.drawEleInLayer(layer, ele, layer.level, pxRatio);
            eleDeqs++;
          }
          if (deqd.length === 0) {
            deqd.push(true);
          }
          if (layer.elesQueue.length === 0) {
            q3.pop();
            layer.reqs = 0;
            if (layer.replaces) {
              self2.applyLayerReplacement(layer);
            }
            self2.requestRedraw();
          }
        }
        return deqd;
      };
      LTCp.applyLayerReplacement = function(layer) {
        var self2 = this;
        var layersInLevel = self2.layersByLevel[layer.level];
        var replaced = layer.replaces;
        var index = layersInLevel.indexOf(replaced);
        if (index < 0 || replaced.invalid) {
          return;
        }
        layersInLevel[index] = layer;
        for (var i2 = 0; i2 < layer.eles.length; i2++) {
          var _p = layer.eles[i2]._private;
          var cache3 = _p.imgLayerCaches = _p.imgLayerCaches || {};
          if (cache3) {
            cache3[layer.level] = layer;
          }
        }
        self2.requestRedraw();
      };
      LTCp.requestRedraw = debounce(function() {
        var r2 = this.renderer;
        r2.redrawHint("eles", true);
        r2.redrawHint("drag", true);
        r2.redraw();
      }, 100);
      LTCp.setupDequeueing = defs.setupDequeueing({
        deqRedrawThreshold,
        deqCost,
        deqAvgCost,
        deqNoDrawCost,
        deqFastCost,
        deq: /* @__PURE__ */ __name(function deq2(self2, pxRatio) {
          return self2.dequeue(pxRatio);
        }, "deq"),
        onDeqd: noop$1,
        shouldRedraw: trueify,
        priority: /* @__PURE__ */ __name(function priority2(self2) {
          return self2.renderer.beforeRenderPriorities.lyrTxrDeq;
        }, "priority")
      });
      CRp$b = {};
      __name(polygon, "polygon");
      __name(triangleBackcurve, "triangleBackcurve");
      __name(triangleTee, "triangleTee");
      __name(circleTriangle, "circleTriangle");
      __name(circle$1, "circle$1");
      CRp$b.arrowShapeImpl = function(name) {
        return (impl || (impl = {
          "polygon": polygon,
          "triangle-backcurve": triangleBackcurve,
          "triangle-tee": triangleTee,
          "circle-triangle": circleTriangle,
          "triangle-cross": triangleTee,
          "circle": circle$1
        }))[name];
      };
      CRp$a = {};
      CRp$a.drawElement = function(context, ele, shiftToOriginWithBb, showLabel, showOverlay, showOpacity) {
        var r2 = this;
        if (ele.isNode()) {
          r2.drawNode(context, ele, shiftToOriginWithBb, showLabel, showOverlay, showOpacity);
        } else {
          r2.drawEdge(context, ele, shiftToOriginWithBb, showLabel, showOverlay, showOpacity);
        }
      };
      CRp$a.drawElementOverlay = function(context, ele) {
        var r2 = this;
        if (ele.isNode()) {
          r2.drawNodeOverlay(context, ele);
        } else {
          r2.drawEdgeOverlay(context, ele);
        }
      };
      CRp$a.drawElementUnderlay = function(context, ele) {
        var r2 = this;
        if (ele.isNode()) {
          r2.drawNodeUnderlay(context, ele);
        } else {
          r2.drawEdgeUnderlay(context, ele);
        }
      };
      CRp$a.drawCachedElementPortion = function(context, ele, eleTxrCache, pxRatio, lvl, reason, getRotation, getOpacity3) {
        var r2 = this;
        var bb = eleTxrCache.getBoundingBox(ele);
        if (bb.w === 0 || bb.h === 0) {
          return;
        }
        var eleCache = eleTxrCache.getElement(ele, bb, pxRatio, lvl, reason);
        if (eleCache != null) {
          var opacity = getOpacity3(r2, ele);
          if (opacity === 0) {
            return;
          }
          var theta = getRotation(r2, ele);
          var x1 = bb.x1, y1 = bb.y1, w4 = bb.w, h3 = bb.h;
          var x5, y6, sx, sy, smooth;
          if (theta !== 0) {
            var rotPt = eleTxrCache.getRotationPoint(ele);
            sx = rotPt.x;
            sy = rotPt.y;
            context.translate(sx, sy);
            context.rotate(theta);
            smooth = r2.getImgSmoothing(context);
            if (!smooth) {
              r2.setImgSmoothing(context, true);
            }
            var off = eleTxrCache.getRotationOffset(ele);
            x5 = off.x;
            y6 = off.y;
          } else {
            x5 = x1;
            y6 = y1;
          }
          var oldGlobalAlpha;
          if (opacity !== 1) {
            oldGlobalAlpha = context.globalAlpha;
            context.globalAlpha = oldGlobalAlpha * opacity;
          }
          context.drawImage(eleCache.texture.canvas, eleCache.x, 0, eleCache.width, eleCache.height, x5, y6, w4, h3);
          if (opacity !== 1) {
            context.globalAlpha = oldGlobalAlpha;
          }
          if (theta !== 0) {
            context.rotate(-theta);
            context.translate(-sx, -sy);
            if (!smooth) {
              r2.setImgSmoothing(context, false);
            }
          }
        } else {
          eleTxrCache.drawElement(context, ele);
        }
      };
      getZeroRotation = /* @__PURE__ */ __name(function getZeroRotation2() {
        return 0;
      }, "getZeroRotation");
      getLabelRotation = /* @__PURE__ */ __name(function getLabelRotation2(r2, ele) {
        return r2.getTextAngle(ele, null);
      }, "getLabelRotation");
      getSourceLabelRotation = /* @__PURE__ */ __name(function getSourceLabelRotation2(r2, ele) {
        return r2.getTextAngle(ele, "source");
      }, "getSourceLabelRotation");
      getTargetLabelRotation = /* @__PURE__ */ __name(function getTargetLabelRotation2(r2, ele) {
        return r2.getTextAngle(ele, "target");
      }, "getTargetLabelRotation");
      getOpacity = /* @__PURE__ */ __name(function getOpacity2(r2, ele) {
        return ele.effectiveOpacity();
      }, "getOpacity");
      getTextOpacity = /* @__PURE__ */ __name(function getTextOpacity2(e3, ele) {
        return ele.pstyle("text-opacity").pfValue * ele.effectiveOpacity();
      }, "getTextOpacity");
      CRp$a.drawCachedElement = function(context, ele, pxRatio, extent2, lvl, requestHighQuality) {
        var r2 = this;
        var _r$data = r2.data, eleTxrCache = _r$data.eleTxrCache, lblTxrCache = _r$data.lblTxrCache, slbTxrCache = _r$data.slbTxrCache, tlbTxrCache = _r$data.tlbTxrCache;
        var bb = ele.boundingBox();
        var reason = requestHighQuality === true ? eleTxrCache.reasons.highQuality : null;
        if (bb.w === 0 || bb.h === 0 || !ele.visible()) {
          return;
        }
        if (!extent2 || boundingBoxesIntersect(bb, extent2)) {
          var isEdge2 = ele.isEdge();
          var badLine = ele.element()._private.rscratch.badLine;
          r2.drawElementUnderlay(context, ele);
          r2.drawCachedElementPortion(context, ele, eleTxrCache, pxRatio, lvl, reason, getZeroRotation, getOpacity);
          if (!isEdge2 || !badLine) {
            r2.drawCachedElementPortion(context, ele, lblTxrCache, pxRatio, lvl, reason, getLabelRotation, getTextOpacity);
          }
          if (isEdge2 && !badLine) {
            r2.drawCachedElementPortion(context, ele, slbTxrCache, pxRatio, lvl, reason, getSourceLabelRotation, getTextOpacity);
            r2.drawCachedElementPortion(context, ele, tlbTxrCache, pxRatio, lvl, reason, getTargetLabelRotation, getTextOpacity);
          }
          r2.drawElementOverlay(context, ele);
        }
      };
      CRp$a.drawElements = function(context, eles) {
        var r2 = this;
        for (var i2 = 0; i2 < eles.length; i2++) {
          var ele = eles[i2];
          r2.drawElement(context, ele);
        }
      };
      CRp$a.drawCachedElements = function(context, eles, pxRatio, extent2) {
        var r2 = this;
        for (var i2 = 0; i2 < eles.length; i2++) {
          var ele = eles[i2];
          r2.drawCachedElement(context, ele, pxRatio, extent2);
        }
      };
      CRp$a.drawCachedNodes = function(context, eles, pxRatio, extent2) {
        var r2 = this;
        for (var i2 = 0; i2 < eles.length; i2++) {
          var ele = eles[i2];
          if (!ele.isNode()) {
            continue;
          }
          r2.drawCachedElement(context, ele, pxRatio, extent2);
        }
      };
      CRp$a.drawLayeredElements = function(context, eles, pxRatio, extent2) {
        var r2 = this;
        var layers = r2.data.lyrTxrCache.getLayers(eles, pxRatio);
        if (layers) {
          for (var i2 = 0; i2 < layers.length; i2++) {
            var layer = layers[i2];
            var bb = layer.bb;
            if (bb.w === 0 || bb.h === 0) {
              continue;
            }
            context.drawImage(layer.canvas, bb.x1, bb.y1, bb.w, bb.h);
          }
        } else {
          r2.drawCachedElements(context, eles, pxRatio, extent2);
        }
      };
      CRp$9 = {};
      CRp$9.drawEdge = function(context, edge, shiftToOriginWithBb) {
        var drawLabel4 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
        var shouldDrawOverlay = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
        var shouldDrawOpacity = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true;
        var r2 = this;
        var rs = edge._private.rscratch;
        if (shouldDrawOpacity && !edge.visible()) {
          return;
        }
        if (rs.badLine || rs.allpts == null || isNaN(rs.allpts[0])) {
          return;
        }
        var bb;
        if (shiftToOriginWithBb) {
          bb = shiftToOriginWithBb;
          context.translate(-bb.x1, -bb.y1);
        }
        var opacity = shouldDrawOpacity ? edge.pstyle("opacity").value : 1;
        var lineOpacity = shouldDrawOpacity ? edge.pstyle("line-opacity").value : 1;
        var curveStyle = edge.pstyle("curve-style").value;
        var lineStyle = edge.pstyle("line-style").value;
        var edgeWidth = edge.pstyle("width").pfValue;
        var lineCap = edge.pstyle("line-cap").value;
        var lineOutlineWidth = edge.pstyle("line-outline-width").value;
        var lineOutlineColor = edge.pstyle("line-outline-color").value;
        var effectiveLineOpacity = opacity * lineOpacity;
        var effectiveArrowOpacity = opacity * lineOpacity;
        var drawLine2 = /* @__PURE__ */ __name(function drawLine3() {
          var strokeOpacity = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : effectiveLineOpacity;
          if (curveStyle === "straight-triangle") {
            r2.eleStrokeStyle(context, edge, strokeOpacity);
            r2.drawEdgeTrianglePath(edge, context, rs.allpts);
          } else {
            context.lineWidth = edgeWidth;
            context.lineCap = lineCap;
            r2.eleStrokeStyle(context, edge, strokeOpacity);
            r2.drawEdgePath(edge, context, rs.allpts, lineStyle);
            context.lineCap = "butt";
          }
        }, "drawLine");
        var drawLineOutline = /* @__PURE__ */ __name(function drawLineOutline2() {
          var strokeOpacity = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : effectiveLineOpacity;
          context.lineWidth = edgeWidth + lineOutlineWidth;
          context.lineCap = lineCap;
          if (lineOutlineWidth > 0) {
            r2.colorStrokeStyle(context, lineOutlineColor[0], lineOutlineColor[1], lineOutlineColor[2], strokeOpacity);
          } else {
            context.lineCap = "butt";
            return;
          }
          if (curveStyle === "straight-triangle") {
            r2.drawEdgeTrianglePath(edge, context, rs.allpts);
          } else {
            r2.drawEdgePath(edge, context, rs.allpts, lineStyle);
            context.lineCap = "butt";
          }
        }, "drawLineOutline");
        var drawOverlay = /* @__PURE__ */ __name(function drawOverlay2() {
          if (!shouldDrawOverlay) {
            return;
          }
          r2.drawEdgeOverlay(context, edge);
        }, "drawOverlay");
        var drawUnderlay = /* @__PURE__ */ __name(function drawUnderlay2() {
          if (!shouldDrawOverlay) {
            return;
          }
          r2.drawEdgeUnderlay(context, edge);
        }, "drawUnderlay");
        var drawArrows2 = /* @__PURE__ */ __name(function drawArrows3() {
          var arrowOpacity = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : effectiveArrowOpacity;
          r2.drawArrowheads(context, edge, arrowOpacity);
        }, "drawArrows");
        var drawText6 = /* @__PURE__ */ __name(function drawText7() {
          r2.drawElementText(context, edge, null, drawLabel4);
        }, "drawText");
        context.lineJoin = "round";
        var ghost = edge.pstyle("ghost").value === "yes";
        if (ghost) {
          var gx = edge.pstyle("ghost-offset-x").pfValue;
          var gy = edge.pstyle("ghost-offset-y").pfValue;
          var ghostOpacity = edge.pstyle("ghost-opacity").value;
          var effectiveGhostOpacity = effectiveLineOpacity * ghostOpacity;
          context.translate(gx, gy);
          drawLine2(effectiveGhostOpacity);
          drawArrows2(effectiveGhostOpacity);
          context.translate(-gx, -gy);
        } else {
          drawLineOutline();
        }
        drawUnderlay();
        drawLine2();
        drawArrows2();
        drawOverlay();
        drawText6();
        if (shiftToOriginWithBb) {
          context.translate(bb.x1, bb.y1);
        }
      };
      drawEdgeOverlayUnderlay = /* @__PURE__ */ __name(function drawEdgeOverlayUnderlay2(overlayOrUnderlay) {
        if (!["overlay", "underlay"].includes(overlayOrUnderlay)) {
          throw new Error("Invalid state");
        }
        return function(context, edge) {
          if (!edge.visible()) {
            return;
          }
          var opacity = edge.pstyle("".concat(overlayOrUnderlay, "-opacity")).value;
          if (opacity === 0) {
            return;
          }
          var r2 = this;
          var usePaths = r2.usePaths();
          var rs = edge._private.rscratch;
          var padding2 = edge.pstyle("".concat(overlayOrUnderlay, "-padding")).pfValue;
          var width3 = 2 * padding2;
          var color2 = edge.pstyle("".concat(overlayOrUnderlay, "-color")).value;
          context.lineWidth = width3;
          if (rs.edgeType === "self" && !usePaths) {
            context.lineCap = "butt";
          } else {
            context.lineCap = "round";
          }
          r2.colorStrokeStyle(context, color2[0], color2[1], color2[2], opacity);
          r2.drawEdgePath(edge, context, rs.allpts, "solid");
        };
      }, "drawEdgeOverlayUnderlay");
      CRp$9.drawEdgeOverlay = drawEdgeOverlayUnderlay("overlay");
      CRp$9.drawEdgeUnderlay = drawEdgeOverlayUnderlay("underlay");
      CRp$9.drawEdgePath = function(edge, context, pts2, type3) {
        var rs = edge._private.rscratch;
        var canvasCxt = context;
        var path4;
        var pathCacheHit = false;
        var usePaths = this.usePaths();
        var lineDashPattern = edge.pstyle("line-dash-pattern").pfValue;
        var lineDashOffset = edge.pstyle("line-dash-offset").pfValue;
        if (usePaths) {
          var pathCacheKey = pts2.join("$");
          var keyMatches = rs.pathCacheKey && rs.pathCacheKey === pathCacheKey;
          if (keyMatches) {
            path4 = context = rs.pathCache;
            pathCacheHit = true;
          } else {
            path4 = context = new Path2D();
            rs.pathCacheKey = pathCacheKey;
            rs.pathCache = path4;
          }
        }
        if (canvasCxt.setLineDash) {
          switch (type3) {
            case "dotted":
              canvasCxt.setLineDash([1, 1]);
              break;
            case "dashed":
              canvasCxt.setLineDash(lineDashPattern);
              canvasCxt.lineDashOffset = lineDashOffset;
              break;
            case "solid":
              canvasCxt.setLineDash([]);
              break;
          }
        }
        if (!pathCacheHit && !rs.badLine) {
          if (context.beginPath) {
            context.beginPath();
          }
          context.moveTo(pts2[0], pts2[1]);
          switch (rs.edgeType) {
            case "bezier":
            case "self":
            case "compound":
            case "multibezier":
              for (var i2 = 2; i2 + 3 < pts2.length; i2 += 4) {
                context.quadraticCurveTo(pts2[i2], pts2[i2 + 1], pts2[i2 + 2], pts2[i2 + 3]);
              }
              break;
            case "straight":
            case "haystack":
              for (var _i = 2; _i + 1 < pts2.length; _i += 2) {
                context.lineTo(pts2[_i], pts2[_i + 1]);
              }
              break;
            case "segments":
              if (rs.isRound) {
                var _iterator = _createForOfIteratorHelper(rs.roundCorners), _step;
                try {
                  for (_iterator.s(); !(_step = _iterator.n()).done; ) {
                    var corner = _step.value;
                    drawPreparedRoundCorner(context, corner);
                  }
                } catch (err) {
                  _iterator.e(err);
                } finally {
                  _iterator.f();
                }
                context.lineTo(pts2[pts2.length - 2], pts2[pts2.length - 1]);
              } else {
                for (var _i2 = 2; _i2 + 1 < pts2.length; _i2 += 2) {
                  context.lineTo(pts2[_i2], pts2[_i2 + 1]);
                }
              }
              break;
          }
        }
        context = canvasCxt;
        if (usePaths) {
          context.stroke(path4);
        } else {
          context.stroke();
        }
        if (context.setLineDash) {
          context.setLineDash([]);
        }
      };
      CRp$9.drawEdgeTrianglePath = function(edge, context, pts2) {
        context.fillStyle = context.strokeStyle;
        var edgeWidth = edge.pstyle("width").pfValue;
        for (var i2 = 0; i2 + 1 < pts2.length; i2 += 2) {
          var vector = [pts2[i2 + 2] - pts2[i2], pts2[i2 + 3] - pts2[i2 + 1]];
          var length2 = Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
          var normal = [vector[1] / length2, -vector[0] / length2];
          var triangleHead = [normal[0] * edgeWidth / 2, normal[1] * edgeWidth / 2];
          context.beginPath();
          context.moveTo(pts2[i2] - triangleHead[0], pts2[i2 + 1] - triangleHead[1]);
          context.lineTo(pts2[i2] + triangleHead[0], pts2[i2 + 1] + triangleHead[1]);
          context.lineTo(pts2[i2 + 2], pts2[i2 + 3]);
          context.closePath();
          context.fill();
        }
      };
      CRp$9.drawArrowheads = function(context, edge, opacity) {
        var rs = edge._private.rscratch;
        var isHaystack = rs.edgeType === "haystack";
        if (!isHaystack) {
          this.drawArrowhead(context, edge, "source", rs.arrowStartX, rs.arrowStartY, rs.srcArrowAngle, opacity);
        }
        this.drawArrowhead(context, edge, "mid-target", rs.midX, rs.midY, rs.midtgtArrowAngle, opacity);
        this.drawArrowhead(context, edge, "mid-source", rs.midX, rs.midY, rs.midsrcArrowAngle, opacity);
        if (!isHaystack) {
          this.drawArrowhead(context, edge, "target", rs.arrowEndX, rs.arrowEndY, rs.tgtArrowAngle, opacity);
        }
      };
      CRp$9.drawArrowhead = function(context, edge, prefix, x5, y6, angle2, opacity) {
        if (isNaN(x5) || x5 == null || isNaN(y6) || y6 == null || isNaN(angle2) || angle2 == null) {
          return;
        }
        var self2 = this;
        var arrowShape = edge.pstyle(prefix + "-arrow-shape").value;
        if (arrowShape === "none") {
          return;
        }
        var arrowClearFill = edge.pstyle(prefix + "-arrow-fill").value === "hollow" ? "both" : "filled";
        var arrowFill = edge.pstyle(prefix + "-arrow-fill").value;
        var edgeWidth = edge.pstyle("width").pfValue;
        var pArrowWidth = edge.pstyle(prefix + "-arrow-width");
        var arrowWidth = pArrowWidth.value === "match-line" ? edgeWidth : pArrowWidth.pfValue;
        if (pArrowWidth.units === "%") arrowWidth *= edgeWidth;
        var edgeOpacity = edge.pstyle("opacity").value;
        if (opacity === void 0) {
          opacity = edgeOpacity;
        }
        var gco = context.globalCompositeOperation;
        if (opacity !== 1 || arrowFill === "hollow") {
          context.globalCompositeOperation = "destination-out";
          self2.colorFillStyle(context, 255, 255, 255, 1);
          self2.colorStrokeStyle(context, 255, 255, 255, 1);
          self2.drawArrowShape(edge, context, arrowClearFill, edgeWidth, arrowShape, arrowWidth, x5, y6, angle2);
          context.globalCompositeOperation = gco;
        }
        var color2 = edge.pstyle(prefix + "-arrow-color").value;
        self2.colorFillStyle(context, color2[0], color2[1], color2[2], opacity);
        self2.colorStrokeStyle(context, color2[0], color2[1], color2[2], opacity);
        self2.drawArrowShape(edge, context, arrowFill, edgeWidth, arrowShape, arrowWidth, x5, y6, angle2);
      };
      CRp$9.drawArrowShape = function(edge, context, fill, edgeWidth, shape, shapeWidth, x5, y6, angle2) {
        var r2 = this;
        var usePaths = this.usePaths() && shape !== "triangle-cross";
        var pathCacheHit = false;
        var path4;
        var canvasContext = context;
        var translation = {
          x: x5,
          y: y6
        };
        var scale3 = edge.pstyle("arrow-scale").value;
        var size4 = this.getArrowWidth(edgeWidth, scale3);
        var shapeImpl = r2.arrowShapes[shape];
        if (usePaths) {
          var cache3 = r2.arrowPathCache = r2.arrowPathCache || [];
          var key = hashString(shape);
          var cachedPath = cache3[key];
          if (cachedPath != null) {
            path4 = context = cachedPath;
            pathCacheHit = true;
          } else {
            path4 = context = new Path2D();
            cache3[key] = path4;
          }
        }
        if (!pathCacheHit) {
          if (context.beginPath) {
            context.beginPath();
          }
          if (usePaths) {
            shapeImpl.draw(context, 1, 0, {
              x: 0,
              y: 0
            }, 1);
          } else {
            shapeImpl.draw(context, size4, angle2, translation, edgeWidth);
          }
          if (context.closePath) {
            context.closePath();
          }
        }
        context = canvasContext;
        if (usePaths) {
          context.translate(x5, y6);
          context.rotate(angle2);
          context.scale(size4, size4);
        }
        if (fill === "filled" || fill === "both") {
          if (usePaths) {
            context.fill(path4);
          } else {
            context.fill();
          }
        }
        if (fill === "hollow" || fill === "both") {
          context.lineWidth = shapeWidth / (usePaths ? size4 : 1);
          context.lineJoin = "miter";
          if (usePaths) {
            context.stroke(path4);
          } else {
            context.stroke();
          }
        }
        if (usePaths) {
          context.scale(1 / size4, 1 / size4);
          context.rotate(-angle2);
          context.translate(-x5, -y6);
        }
      };
      CRp$8 = {};
      CRp$8.safeDrawImage = function(context, img, ix, iy, iw, ih, x5, y6, w4, h3) {
        if (iw <= 0 || ih <= 0 || w4 <= 0 || h3 <= 0) {
          return;
        }
        try {
          context.drawImage(img, ix, iy, iw, ih, x5, y6, w4, h3);
        } catch (e3) {
          warn(e3);
        }
      };
      CRp$8.drawInscribedImage = function(context, img, node2, index, nodeOpacity) {
        var r2 = this;
        var pos = node2.position();
        var nodeX = pos.x;
        var nodeY = pos.y;
        var styleObj = node2.cy().style();
        var getIndexedStyle = styleObj.getIndexedStyle.bind(styleObj);
        var fit2 = getIndexedStyle(node2, "background-fit", "value", index);
        var repeat2 = getIndexedStyle(node2, "background-repeat", "value", index);
        var nodeW = node2.width();
        var nodeH = node2.height();
        var paddingX2 = node2.padding() * 2;
        var nodeTW = nodeW + (getIndexedStyle(node2, "background-width-relative-to", "value", index) === "inner" ? 0 : paddingX2);
        var nodeTH = nodeH + (getIndexedStyle(node2, "background-height-relative-to", "value", index) === "inner" ? 0 : paddingX2);
        var rs = node2._private.rscratch;
        var clip = getIndexedStyle(node2, "background-clip", "value", index);
        var shouldClip = clip === "node";
        var imgOpacity = getIndexedStyle(node2, "background-image-opacity", "value", index) * nodeOpacity;
        var smooth = getIndexedStyle(node2, "background-image-smoothing", "value", index);
        var cornerRadius = node2.pstyle("corner-radius").value;
        if (cornerRadius !== "auto") cornerRadius = node2.pstyle("corner-radius").pfValue;
        var imgW = img.width || img.cachedW;
        var imgH = img.height || img.cachedH;
        if (null == imgW || null == imgH) {
          document.body.appendChild(img);
          imgW = img.cachedW = img.width || img.offsetWidth;
          imgH = img.cachedH = img.height || img.offsetHeight;
          document.body.removeChild(img);
        }
        var w4 = imgW;
        var h3 = imgH;
        if (getIndexedStyle(node2, "background-width", "value", index) !== "auto") {
          if (getIndexedStyle(node2, "background-width", "units", index) === "%") {
            w4 = getIndexedStyle(node2, "background-width", "pfValue", index) * nodeTW;
          } else {
            w4 = getIndexedStyle(node2, "background-width", "pfValue", index);
          }
        }
        if (getIndexedStyle(node2, "background-height", "value", index) !== "auto") {
          if (getIndexedStyle(node2, "background-height", "units", index) === "%") {
            h3 = getIndexedStyle(node2, "background-height", "pfValue", index) * nodeTH;
          } else {
            h3 = getIndexedStyle(node2, "background-height", "pfValue", index);
          }
        }
        if (w4 === 0 || h3 === 0) {
          return;
        }
        if (fit2 === "contain") {
          var scale3 = Math.min(nodeTW / w4, nodeTH / h3);
          w4 *= scale3;
          h3 *= scale3;
        } else if (fit2 === "cover") {
          var scale3 = Math.max(nodeTW / w4, nodeTH / h3);
          w4 *= scale3;
          h3 *= scale3;
        }
        var x5 = nodeX - nodeTW / 2;
        var posXUnits = getIndexedStyle(node2, "background-position-x", "units", index);
        var posXPfVal = getIndexedStyle(node2, "background-position-x", "pfValue", index);
        if (posXUnits === "%") {
          x5 += (nodeTW - w4) * posXPfVal;
        } else {
          x5 += posXPfVal;
        }
        var offXUnits = getIndexedStyle(node2, "background-offset-x", "units", index);
        var offXPfVal = getIndexedStyle(node2, "background-offset-x", "pfValue", index);
        if (offXUnits === "%") {
          x5 += (nodeTW - w4) * offXPfVal;
        } else {
          x5 += offXPfVal;
        }
        var y6 = nodeY - nodeTH / 2;
        var posYUnits = getIndexedStyle(node2, "background-position-y", "units", index);
        var posYPfVal = getIndexedStyle(node2, "background-position-y", "pfValue", index);
        if (posYUnits === "%") {
          y6 += (nodeTH - h3) * posYPfVal;
        } else {
          y6 += posYPfVal;
        }
        var offYUnits = getIndexedStyle(node2, "background-offset-y", "units", index);
        var offYPfVal = getIndexedStyle(node2, "background-offset-y", "pfValue", index);
        if (offYUnits === "%") {
          y6 += (nodeTH - h3) * offYPfVal;
        } else {
          y6 += offYPfVal;
        }
        if (rs.pathCache) {
          x5 -= nodeX;
          y6 -= nodeY;
          nodeX = 0;
          nodeY = 0;
        }
        var gAlpha = context.globalAlpha;
        context.globalAlpha = imgOpacity;
        var smoothingEnabled = r2.getImgSmoothing(context);
        var isSmoothingSwitched = false;
        if (smooth === "no" && smoothingEnabled) {
          r2.setImgSmoothing(context, false);
          isSmoothingSwitched = true;
        } else if (smooth === "yes" && !smoothingEnabled) {
          r2.setImgSmoothing(context, true);
          isSmoothingSwitched = true;
        }
        if (repeat2 === "no-repeat") {
          if (shouldClip) {
            context.save();
            if (rs.pathCache) {
              context.clip(rs.pathCache);
            } else {
              r2.nodeShapes[r2.getNodeShape(node2)].draw(context, nodeX, nodeY, nodeTW, nodeTH, cornerRadius, rs);
              context.clip();
            }
          }
          r2.safeDrawImage(context, img, 0, 0, imgW, imgH, x5, y6, w4, h3);
          if (shouldClip) {
            context.restore();
          }
        } else {
          var pattern = context.createPattern(img, repeat2);
          context.fillStyle = pattern;
          r2.nodeShapes[r2.getNodeShape(node2)].draw(context, nodeX, nodeY, nodeTW, nodeTH, cornerRadius, rs);
          context.translate(x5, y6);
          context.fill();
          context.translate(-x5, -y6);
        }
        context.globalAlpha = gAlpha;
        if (isSmoothingSwitched) {
          r2.setImgSmoothing(context, smoothingEnabled);
        }
      };
      CRp$7 = {};
      CRp$7.eleTextBiggerThanMin = function(ele, scale3) {
        if (!scale3) {
          var zoom2 = ele.cy().zoom();
          var pxRatio = this.getPixelRatio();
          var lvl = Math.ceil(log22(zoom2 * pxRatio));
          scale3 = Math.pow(2, lvl);
        }
        var computedSize = ele.pstyle("font-size").pfValue * scale3;
        var minSize = ele.pstyle("min-zoomed-font-size").pfValue;
        if (computedSize < minSize) {
          return false;
        }
        return true;
      };
      CRp$7.drawElementText = function(context, ele, shiftToOriginWithBb, force, prefix) {
        var useEleOpacity = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true;
        var r2 = this;
        if (force == null) {
          if (useEleOpacity && !r2.eleTextBiggerThanMin(ele)) {
            return;
          }
        } else if (force === false) {
          return;
        }
        if (ele.isNode()) {
          var label = ele.pstyle("label");
          if (!label || !label.value) {
            return;
          }
          var justification = r2.getLabelJustification(ele);
          context.textAlign = justification;
          context.textBaseline = "bottom";
        } else {
          var badLine = ele.element()._private.rscratch.badLine;
          var _label = ele.pstyle("label");
          var srcLabel = ele.pstyle("source-label");
          var tgtLabel = ele.pstyle("target-label");
          if (badLine || (!_label || !_label.value) && (!srcLabel || !srcLabel.value) && (!tgtLabel || !tgtLabel.value)) {
            return;
          }
          context.textAlign = "center";
          context.textBaseline = "bottom";
        }
        var applyRotation = !shiftToOriginWithBb;
        var bb;
        if (shiftToOriginWithBb) {
          bb = shiftToOriginWithBb;
          context.translate(-bb.x1, -bb.y1);
        }
        if (prefix == null) {
          r2.drawText(context, ele, null, applyRotation, useEleOpacity);
          if (ele.isEdge()) {
            r2.drawText(context, ele, "source", applyRotation, useEleOpacity);
            r2.drawText(context, ele, "target", applyRotation, useEleOpacity);
          }
        } else {
          r2.drawText(context, ele, prefix, applyRotation, useEleOpacity);
        }
        if (shiftToOriginWithBb) {
          context.translate(bb.x1, bb.y1);
        }
      };
      CRp$7.getFontCache = function(context) {
        var cache3;
        this.fontCaches = this.fontCaches || [];
        for (var i2 = 0; i2 < this.fontCaches.length; i2++) {
          cache3 = this.fontCaches[i2];
          if (cache3.context === context) {
            return cache3;
          }
        }
        cache3 = {
          context
        };
        this.fontCaches.push(cache3);
        return cache3;
      };
      CRp$7.setupTextStyle = function(context, ele) {
        var useEleOpacity = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
        var labelStyle = ele.pstyle("font-style").strValue;
        var labelSize = ele.pstyle("font-size").pfValue + "px";
        var labelFamily = ele.pstyle("font-family").strValue;
        var labelWeight = ele.pstyle("font-weight").strValue;
        var opacity = useEleOpacity ? ele.effectiveOpacity() * ele.pstyle("text-opacity").value : 1;
        var outlineOpacity = ele.pstyle("text-outline-opacity").value * opacity;
        var color2 = ele.pstyle("color").value;
        var outlineColor = ele.pstyle("text-outline-color").value;
        context.font = labelStyle + " " + labelWeight + " " + labelSize + " " + labelFamily;
        context.lineJoin = "round";
        this.colorFillStyle(context, color2[0], color2[1], color2[2], opacity);
        this.colorStrokeStyle(context, outlineColor[0], outlineColor[1], outlineColor[2], outlineOpacity);
      };
      __name(circle3, "circle");
      __name(roundRect, "roundRect");
      CRp$7.getTextAngle = function(ele, prefix) {
        var theta;
        var _p = ele._private;
        var rscratch = _p.rscratch;
        var pdash = prefix ? prefix + "-" : "";
        var rotation = ele.pstyle(pdash + "text-rotation");
        if (rotation.strValue === "autorotate") {
          var textAngle = getPrefixedProperty(rscratch, "labelAngle", prefix);
          theta = ele.isEdge() ? textAngle : 0;
        } else if (rotation.strValue === "none") {
          theta = 0;
        } else {
          theta = rotation.pfValue;
        }
        return theta;
      };
      CRp$7.drawText = function(context, ele, prefix) {
        var applyRotation = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
        var useEleOpacity = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
        var _p = ele._private;
        var rscratch = _p.rscratch;
        var parentOpacity = useEleOpacity ? ele.effectiveOpacity() : 1;
        if (useEleOpacity && (parentOpacity === 0 || ele.pstyle("text-opacity").value === 0)) {
          return;
        }
        if (prefix === "main") {
          prefix = null;
        }
        var textX = getPrefixedProperty(rscratch, "labelX", prefix);
        var textY = getPrefixedProperty(rscratch, "labelY", prefix);
        var orgTextX, orgTextY;
        var text4 = this.getLabelText(ele, prefix);
        if (text4 != null && text4 !== "" && !isNaN(textX) && !isNaN(textY)) {
          this.setupTextStyle(context, ele, useEleOpacity);
          var pdash = prefix ? prefix + "-" : "";
          var textW = getPrefixedProperty(rscratch, "labelWidth", prefix);
          var textH = getPrefixedProperty(rscratch, "labelHeight", prefix);
          var marginX = ele.pstyle(pdash + "text-margin-x").pfValue;
          var marginY = ele.pstyle(pdash + "text-margin-y").pfValue;
          var isEdge2 = ele.isEdge();
          var halign = ele.pstyle("text-halign").value;
          var valign = ele.pstyle("text-valign").value;
          if (isEdge2) {
            halign = "center";
            valign = "center";
          }
          textX += marginX;
          textY += marginY;
          var theta;
          if (!applyRotation) {
            theta = 0;
          } else {
            theta = this.getTextAngle(ele, prefix);
          }
          if (theta !== 0) {
            orgTextX = textX;
            orgTextY = textY;
            context.translate(orgTextX, orgTextY);
            context.rotate(theta);
            textX = 0;
            textY = 0;
          }
          switch (valign) {
            case "top":
              break;
            case "center":
              textY += textH / 2;
              break;
            case "bottom":
              textY += textH;
              break;
          }
          var backgroundOpacity = ele.pstyle("text-background-opacity").value;
          var borderOpacity = ele.pstyle("text-border-opacity").value;
          var textBorderWidth = ele.pstyle("text-border-width").pfValue;
          var backgroundPadding = ele.pstyle("text-background-padding").pfValue;
          var styleShape = ele.pstyle("text-background-shape").strValue;
          var rounded = styleShape === "round-rectangle" || styleShape === "roundrectangle";
          var circled = styleShape === "circle";
          var roundRadius = 2;
          if (backgroundOpacity > 0 || textBorderWidth > 0 && borderOpacity > 0) {
            var textFill = context.fillStyle;
            var textStroke = context.strokeStyle;
            var textLineWidth = context.lineWidth;
            var textBackgroundColor = ele.pstyle("text-background-color").value;
            var textBorderColor = ele.pstyle("text-border-color").value;
            var textBorderStyle = ele.pstyle("text-border-style").value;
            var doFill = backgroundOpacity > 0;
            var doStroke = textBorderWidth > 0 && borderOpacity > 0;
            var bgX = textX - backgroundPadding;
            switch (halign) {
              case "left":
                bgX -= textW;
                break;
              case "center":
                bgX -= textW / 2;
                break;
            }
            var bgY = textY - textH - backgroundPadding;
            var bgW = textW + 2 * backgroundPadding;
            var bgH = textH + 2 * backgroundPadding;
            if (doFill) {
              context.fillStyle = "rgba(".concat(textBackgroundColor[0], ",").concat(textBackgroundColor[1], ",").concat(textBackgroundColor[2], ",").concat(backgroundOpacity * parentOpacity, ")");
            }
            if (doStroke) {
              context.strokeStyle = "rgba(".concat(textBorderColor[0], ",").concat(textBorderColor[1], ",").concat(textBorderColor[2], ",").concat(borderOpacity * parentOpacity, ")");
              context.lineWidth = textBorderWidth;
              if (context.setLineDash) {
                switch (textBorderStyle) {
                  case "dotted":
                    context.setLineDash([1, 1]);
                    break;
                  case "dashed":
                    context.setLineDash([4, 2]);
                    break;
                  case "double":
                    context.lineWidth = textBorderWidth / 4;
                    context.setLineDash([]);
                    break;
                  case "solid":
                  default:
                    context.setLineDash([]);
                    break;
                }
              }
            }
            if (rounded) {
              context.beginPath();
              roundRect(context, bgX, bgY, bgW, bgH, roundRadius);
            } else if (circled) {
              context.beginPath();
              circle3(context, bgX, bgY, bgW, bgH);
            } else {
              context.beginPath();
              context.rect(bgX, bgY, bgW, bgH);
            }
            if (doFill) context.fill();
            if (doStroke) context.stroke();
            if (doStroke && textBorderStyle === "double") {
              var whiteWidth = textBorderWidth / 2;
              context.beginPath();
              if (rounded) {
                roundRect(context, bgX + whiteWidth, bgY + whiteWidth, bgW - 2 * whiteWidth, bgH - 2 * whiteWidth, roundRadius);
              } else {
                context.rect(bgX + whiteWidth, bgY + whiteWidth, bgW - 2 * whiteWidth, bgH - 2 * whiteWidth);
              }
              context.stroke();
            }
            context.fillStyle = textFill;
            context.strokeStyle = textStroke;
            context.lineWidth = textLineWidth;
            if (context.setLineDash) context.setLineDash([]);
          }
          var lineWidth = 2 * ele.pstyle("text-outline-width").pfValue;
          if (lineWidth > 0) {
            context.lineWidth = lineWidth;
          }
          if (ele.pstyle("text-wrap").value === "wrap") {
            var lines = getPrefixedProperty(rscratch, "labelWrapCachedLines", prefix);
            var lineHeight = getPrefixedProperty(rscratch, "labelLineHeight", prefix);
            var halfTextW = textW / 2;
            var justification = this.getLabelJustification(ele);
            if (justification === "auto") ;
            else if (halign === "left") {
              if (justification === "left") {
                textX += -textW;
              } else if (justification === "center") {
                textX += -halfTextW;
              }
            } else if (halign === "center") {
              if (justification === "left") {
                textX += -halfTextW;
              } else if (justification === "right") {
                textX += halfTextW;
              }
            } else if (halign === "right") {
              if (justification === "center") {
                textX += halfTextW;
              } else if (justification === "right") {
                textX += textW;
              }
            }
            switch (valign) {
              case "top":
                textY -= (lines.length - 1) * lineHeight;
                break;
              case "center":
              case "bottom":
                textY -= (lines.length - 1) * lineHeight;
                break;
            }
            for (var l4 = 0; l4 < lines.length; l4++) {
              if (lineWidth > 0) {
                context.strokeText(lines[l4], textX, textY);
              }
              context.fillText(lines[l4], textX, textY);
              textY += lineHeight;
            }
          } else {
            if (lineWidth > 0) {
              context.strokeText(text4, textX, textY);
            }
            context.fillText(text4, textX, textY);
          }
          if (theta !== 0) {
            context.rotate(-theta);
            context.translate(-orgTextX, -orgTextY);
          }
        }
      };
      CRp$6 = {};
      CRp$6.drawNode = function(context, node2, shiftToOriginWithBb) {
        var drawLabel4 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
        var shouldDrawOverlay = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
        var shouldDrawOpacity = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true;
        var r2 = this;
        var nodeWidth, nodeHeight;
        var _p = node2._private;
        var rs = _p.rscratch;
        var pos = node2.position();
        if (!number$1(pos.x) || !number$1(pos.y)) {
          return;
        }
        if (shouldDrawOpacity && !node2.visible()) {
          return;
        }
        var eleOpacity = shouldDrawOpacity ? node2.effectiveOpacity() : 1;
        var usePaths = r2.usePaths();
        var path4;
        var pathCacheHit = false;
        var padding2 = node2.padding();
        nodeWidth = node2.width() + 2 * padding2;
        nodeHeight = node2.height() + 2 * padding2;
        var bb;
        if (shiftToOriginWithBb) {
          bb = shiftToOriginWithBb;
          context.translate(-bb.x1, -bb.y1);
        }
        var bgImgProp = node2.pstyle("background-image");
        var urls = bgImgProp.value;
        var urlDefined = new Array(urls.length);
        var image = new Array(urls.length);
        var numImages = 0;
        for (var i2 = 0; i2 < urls.length; i2++) {
          var url = urls[i2];
          var defd = urlDefined[i2] = url != null && url !== "none";
          if (defd) {
            var bgImgCrossOrigin = node2.cy().style().getIndexedStyle(node2, "background-image-crossorigin", "value", i2);
            numImages++;
            image[i2] = r2.getCachedImage(url, bgImgCrossOrigin, function() {
              _p.backgroundTimestamp = Date.now();
              node2.emitAndNotify("background");
            });
          }
        }
        var darkness = node2.pstyle("background-blacken").value;
        var borderWidth = node2.pstyle("border-width").pfValue;
        var bgOpacity = node2.pstyle("background-opacity").value * eleOpacity;
        var borderColor = node2.pstyle("border-color").value;
        var borderStyle = node2.pstyle("border-style").value;
        var borderJoin = node2.pstyle("border-join").value;
        var borderCap = node2.pstyle("border-cap").value;
        var borderPosition = node2.pstyle("border-position").value;
        var borderPattern = node2.pstyle("border-dash-pattern").pfValue;
        var borderOffset = node2.pstyle("border-dash-offset").pfValue;
        var borderOpacity = node2.pstyle("border-opacity").value * eleOpacity;
        var outlineWidth = node2.pstyle("outline-width").pfValue;
        var outlineColor = node2.pstyle("outline-color").value;
        var outlineStyle = node2.pstyle("outline-style").value;
        var outlineOpacity = node2.pstyle("outline-opacity").value * eleOpacity;
        var outlineOffset = node2.pstyle("outline-offset").value;
        var cornerRadius = node2.pstyle("corner-radius").value;
        if (cornerRadius !== "auto") cornerRadius = node2.pstyle("corner-radius").pfValue;
        var setupShapeColor = /* @__PURE__ */ __name(function setupShapeColor2() {
          var bgOpy = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : bgOpacity;
          r2.eleFillStyle(context, node2, bgOpy);
        }, "setupShapeColor");
        var setupBorderColor = /* @__PURE__ */ __name(function setupBorderColor2() {
          var bdrOpy = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : borderOpacity;
          r2.colorStrokeStyle(context, borderColor[0], borderColor[1], borderColor[2], bdrOpy);
        }, "setupBorderColor");
        var setupOutlineColor = /* @__PURE__ */ __name(function setupOutlineColor2() {
          var otlnOpy = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : outlineOpacity;
          r2.colorStrokeStyle(context, outlineColor[0], outlineColor[1], outlineColor[2], otlnOpy);
        }, "setupOutlineColor");
        var getPath = /* @__PURE__ */ __name(function getPath2(width3, height2, shape, points) {
          var pathCache = r2.nodePathCache = r2.nodePathCache || [];
          var key = hashStrings(shape === "polygon" ? shape + "," + points.join(",") : shape, "" + height2, "" + width3, "" + cornerRadius);
          var cachedPath = pathCache[key];
          var path5;
          var cacheHit = false;
          if (cachedPath != null) {
            path5 = cachedPath;
            cacheHit = true;
            rs.pathCache = path5;
          } else {
            path5 = new Path2D();
            pathCache[key] = rs.pathCache = path5;
          }
          return {
            path: path5,
            cacheHit
          };
        }, "getPath");
        var styleShape = node2.pstyle("shape").strValue;
        var shapePts = node2.pstyle("shape-polygon-points").pfValue;
        if (usePaths) {
          context.translate(pos.x, pos.y);
          var shapePath = getPath(nodeWidth, nodeHeight, styleShape, shapePts);
          path4 = shapePath.path;
          pathCacheHit = shapePath.cacheHit;
        }
        var drawShape = /* @__PURE__ */ __name(function drawShape2() {
          if (!pathCacheHit) {
            var npos = pos;
            if (usePaths) {
              npos = {
                x: 0,
                y: 0
              };
            }
            r2.nodeShapes[r2.getNodeShape(node2)].draw(path4 || context, npos.x, npos.y, nodeWidth, nodeHeight, cornerRadius, rs);
          }
          if (usePaths) {
            context.fill(path4);
          } else {
            context.fill();
          }
        }, "drawShape");
        var drawImages = /* @__PURE__ */ __name(function drawImages2() {
          var nodeOpacity = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : eleOpacity;
          var inside = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
          var prevBging = _p.backgrounding;
          var totalCompleted = 0;
          for (var _i = 0; _i < image.length; _i++) {
            var bgContainment = node2.cy().style().getIndexedStyle(node2, "background-image-containment", "value", _i);
            if (inside && bgContainment === "over" || !inside && bgContainment === "inside") {
              totalCompleted++;
              continue;
            }
            if (urlDefined[_i] && image[_i].complete && !image[_i].error) {
              totalCompleted++;
              r2.drawInscribedImage(context, image[_i], node2, _i, nodeOpacity);
            }
          }
          _p.backgrounding = !(totalCompleted === numImages);
          if (prevBging !== _p.backgrounding) {
            node2.updateStyle(false);
          }
        }, "drawImages");
        var drawPie = /* @__PURE__ */ __name(function drawPie2() {
          var redrawShape = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
          var pieOpacity = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : eleOpacity;
          if (r2.hasPie(node2)) {
            r2.drawPie(context, node2, pieOpacity);
            if (redrawShape) {
              if (!usePaths) {
                r2.nodeShapes[r2.getNodeShape(node2)].draw(context, pos.x, pos.y, nodeWidth, nodeHeight, cornerRadius, rs);
              }
            }
          }
        }, "drawPie");
        var drawStripe = /* @__PURE__ */ __name(function drawStripe2() {
          var redrawShape = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
          var stripeOpacity = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : eleOpacity;
          if (r2.hasStripe(node2)) {
            context.save();
            if (usePaths) {
              context.clip(rs.pathCache);
            } else {
              r2.nodeShapes[r2.getNodeShape(node2)].draw(context, pos.x, pos.y, nodeWidth, nodeHeight, cornerRadius, rs);
              context.clip();
            }
            r2.drawStripe(context, node2, stripeOpacity);
            context.restore();
            if (redrawShape) {
              if (!usePaths) {
                r2.nodeShapes[r2.getNodeShape(node2)].draw(context, pos.x, pos.y, nodeWidth, nodeHeight, cornerRadius, rs);
              }
            }
          }
        }, "drawStripe");
        var darken2 = /* @__PURE__ */ __name(function darken3() {
          var darkenOpacity = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : eleOpacity;
          var opacity = (darkness > 0 ? darkness : -darkness) * darkenOpacity;
          var c3 = darkness > 0 ? 0 : 255;
          if (darkness !== 0) {
            r2.colorFillStyle(context, c3, c3, c3, opacity);
            if (usePaths) {
              context.fill(path4);
            } else {
              context.fill();
            }
          }
        }, "darken");
        var drawBorder = /* @__PURE__ */ __name(function drawBorder2() {
          if (borderWidth > 0) {
            context.lineWidth = borderWidth;
            context.lineCap = borderCap;
            context.lineJoin = borderJoin;
            if (context.setLineDash) {
              switch (borderStyle) {
                case "dotted":
                  context.setLineDash([1, 1]);
                  break;
                case "dashed":
                  context.setLineDash(borderPattern);
                  context.lineDashOffset = borderOffset;
                  break;
                case "solid":
                case "double":
                  context.setLineDash([]);
                  break;
              }
            }
            if (borderPosition !== "center") {
              context.save();
              context.lineWidth *= 2;
              if (borderPosition === "inside") {
                usePaths ? context.clip(path4) : context.clip();
              } else {
                var region = new Path2D();
                region.rect(-nodeWidth / 2 - borderWidth, -nodeHeight / 2 - borderWidth, nodeWidth + 2 * borderWidth, nodeHeight + 2 * borderWidth);
                region.addPath(path4);
                context.clip(region, "evenodd");
              }
              usePaths ? context.stroke(path4) : context.stroke();
              context.restore();
            } else {
              usePaths ? context.stroke(path4) : context.stroke();
            }
            if (borderStyle === "double") {
              context.lineWidth = borderWidth / 3;
              var gco = context.globalCompositeOperation;
              context.globalCompositeOperation = "destination-out";
              if (usePaths) {
                context.stroke(path4);
              } else {
                context.stroke();
              }
              context.globalCompositeOperation = gco;
            }
            if (context.setLineDash) {
              context.setLineDash([]);
            }
          }
        }, "drawBorder");
        var drawOutline = /* @__PURE__ */ __name(function drawOutline2() {
          if (outlineWidth > 0) {
            context.lineWidth = outlineWidth;
            context.lineCap = "butt";
            if (context.setLineDash) {
              switch (outlineStyle) {
                case "dotted":
                  context.setLineDash([1, 1]);
                  break;
                case "dashed":
                  context.setLineDash([4, 2]);
                  break;
                case "solid":
                case "double":
                  context.setLineDash([]);
                  break;
              }
            }
            var npos = pos;
            if (usePaths) {
              npos = {
                x: 0,
                y: 0
              };
            }
            var shape = r2.getNodeShape(node2);
            var bWidth = borderWidth;
            if (borderPosition === "inside") bWidth = 0;
            if (borderPosition === "outside") bWidth *= 2;
            var scaleX = (nodeWidth + bWidth + (outlineWidth + outlineOffset)) / nodeWidth;
            var scaleY = (nodeHeight + bWidth + (outlineWidth + outlineOffset)) / nodeHeight;
            var sWidth = nodeWidth * scaleX;
            var sHeight = nodeHeight * scaleY;
            var points = r2.nodeShapes[shape].points;
            var _path;
            if (usePaths) {
              var outlinePath = getPath(sWidth, sHeight, shape, points);
              _path = outlinePath.path;
            }
            if (shape === "ellipse") {
              r2.drawEllipsePath(_path || context, npos.x, npos.y, sWidth, sHeight);
            } else if (["round-diamond", "round-heptagon", "round-hexagon", "round-octagon", "round-pentagon", "round-polygon", "round-triangle", "round-tag"].includes(shape)) {
              var sMult = 0;
              var offsetX = 0;
              var offsetY = 0;
              if (shape === "round-diamond") {
                sMult = (bWidth + outlineOffset + outlineWidth) * 1.4;
              } else if (shape === "round-heptagon") {
                sMult = (bWidth + outlineOffset + outlineWidth) * 1.075;
                offsetY = -(bWidth / 2 + outlineOffset + outlineWidth) / 35;
              } else if (shape === "round-hexagon") {
                sMult = (bWidth + outlineOffset + outlineWidth) * 1.12;
              } else if (shape === "round-pentagon") {
                sMult = (bWidth + outlineOffset + outlineWidth) * 1.13;
                offsetY = -(bWidth / 2 + outlineOffset + outlineWidth) / 15;
              } else if (shape === "round-tag") {
                sMult = (bWidth + outlineOffset + outlineWidth) * 1.12;
                offsetX = (bWidth / 2 + outlineWidth + outlineOffset) * 0.07;
              } else if (shape === "round-triangle") {
                sMult = (bWidth + outlineOffset + outlineWidth) * (Math.PI / 2);
                offsetY = -(bWidth + outlineOffset / 2 + outlineWidth) / Math.PI;
              }
              if (sMult !== 0) {
                scaleX = (nodeWidth + sMult) / nodeWidth;
                sWidth = nodeWidth * scaleX;
                if (!["round-hexagon", "round-tag"].includes(shape)) {
                  scaleY = (nodeHeight + sMult) / nodeHeight;
                  sHeight = nodeHeight * scaleY;
                }
              }
              cornerRadius = cornerRadius === "auto" ? getRoundPolygonRadius(sWidth, sHeight) : cornerRadius;
              var halfW = sWidth / 2;
              var halfH = sHeight / 2;
              var radius2 = cornerRadius + (bWidth + outlineWidth + outlineOffset) / 2;
              var p3 = new Array(points.length / 2);
              var corners = new Array(points.length / 2);
              for (var _i2 = 0; _i2 < points.length / 2; _i2++) {
                p3[_i2] = {
                  x: npos.x + offsetX + halfW * points[_i2 * 2],
                  y: npos.y + offsetY + halfH * points[_i2 * 2 + 1]
                };
              }
              var _i3, p1, p22, p32, len = p3.length;
              p1 = p3[len - 1];
              for (_i3 = 0; _i3 < len; _i3++) {
                p22 = p3[_i3 % len];
                p32 = p3[(_i3 + 1) % len];
                corners[_i3] = getRoundCorner(p1, p22, p32, radius2);
                p1 = p22;
                p22 = p32;
              }
              r2.drawRoundPolygonPath(_path || context, npos.x + offsetX, npos.y + offsetY, nodeWidth * scaleX, nodeHeight * scaleY, points, corners);
            } else if (["roundrectangle", "round-rectangle"].includes(shape)) {
              cornerRadius = cornerRadius === "auto" ? getRoundRectangleRadius(sWidth, sHeight) : cornerRadius;
              r2.drawRoundRectanglePath(_path || context, npos.x, npos.y, sWidth, sHeight, cornerRadius + (bWidth + outlineWidth + outlineOffset) / 2);
            } else if (["cutrectangle", "cut-rectangle"].includes(shape)) {
              cornerRadius = cornerRadius === "auto" ? getCutRectangleCornerLength() : cornerRadius;
              r2.drawCutRectanglePath(_path || context, npos.x, npos.y, sWidth, sHeight, null, cornerRadius + (bWidth + outlineWidth + outlineOffset) / 4);
            } else if (["bottomroundrectangle", "bottom-round-rectangle"].includes(shape)) {
              cornerRadius = cornerRadius === "auto" ? getRoundRectangleRadius(sWidth, sHeight) : cornerRadius;
              r2.drawBottomRoundRectanglePath(_path || context, npos.x, npos.y, sWidth, sHeight, cornerRadius + (bWidth + outlineWidth + outlineOffset) / 2);
            } else if (shape === "barrel") {
              r2.drawBarrelPath(_path || context, npos.x, npos.y, sWidth, sHeight);
            } else if (shape.startsWith("polygon") || ["rhomboid", "right-rhomboid", "round-tag", "tag", "vee"].includes(shape)) {
              var pad3 = (bWidth + outlineWidth + outlineOffset) / nodeWidth;
              points = joinLines(expandPolygon(points, pad3));
              r2.drawPolygonPath(_path || context, npos.x, npos.y, nodeWidth, nodeHeight, points);
            } else {
              var _pad = (bWidth + outlineWidth + outlineOffset) / nodeWidth;
              points = joinLines(expandPolygon(points, -_pad));
              r2.drawPolygonPath(_path || context, npos.x, npos.y, nodeWidth, nodeHeight, points);
            }
            if (usePaths) {
              context.stroke(_path);
            } else {
              context.stroke();
            }
            if (outlineStyle === "double") {
              context.lineWidth = bWidth / 3;
              var gco = context.globalCompositeOperation;
              context.globalCompositeOperation = "destination-out";
              if (usePaths) {
                context.stroke(_path);
              } else {
                context.stroke();
              }
              context.globalCompositeOperation = gco;
            }
            if (context.setLineDash) {
              context.setLineDash([]);
            }
          }
        }, "drawOutline");
        var drawOverlay = /* @__PURE__ */ __name(function drawOverlay2() {
          if (shouldDrawOverlay) {
            r2.drawNodeOverlay(context, node2, pos, nodeWidth, nodeHeight);
          }
        }, "drawOverlay");
        var drawUnderlay = /* @__PURE__ */ __name(function drawUnderlay2() {
          if (shouldDrawOverlay) {
            r2.drawNodeUnderlay(context, node2, pos, nodeWidth, nodeHeight);
          }
        }, "drawUnderlay");
        var drawText6 = /* @__PURE__ */ __name(function drawText7() {
          r2.drawElementText(context, node2, null, drawLabel4);
        }, "drawText");
        var ghost = node2.pstyle("ghost").value === "yes";
        if (ghost) {
          var gx = node2.pstyle("ghost-offset-x").pfValue;
          var gy = node2.pstyle("ghost-offset-y").pfValue;
          var ghostOpacity = node2.pstyle("ghost-opacity").value;
          var effGhostOpacity = ghostOpacity * eleOpacity;
          context.translate(gx, gy);
          setupOutlineColor();
          drawOutline();
          setupShapeColor(ghostOpacity * bgOpacity);
          drawShape();
          drawImages(effGhostOpacity, true);
          setupBorderColor(ghostOpacity * borderOpacity);
          drawBorder();
          drawPie(darkness !== 0 || borderWidth !== 0);
          drawStripe(darkness !== 0 || borderWidth !== 0);
          drawImages(effGhostOpacity, false);
          darken2(effGhostOpacity);
          context.translate(-gx, -gy);
        }
        if (usePaths) {
          context.translate(-pos.x, -pos.y);
        }
        drawUnderlay();
        if (usePaths) {
          context.translate(pos.x, pos.y);
        }
        setupOutlineColor();
        drawOutline();
        setupShapeColor();
        drawShape();
        drawImages(eleOpacity, true);
        setupBorderColor();
        drawBorder();
        drawPie(darkness !== 0 || borderWidth !== 0);
        drawStripe(darkness !== 0 || borderWidth !== 0);
        drawImages(eleOpacity, false);
        darken2();
        if (usePaths) {
          context.translate(-pos.x, -pos.y);
        }
        drawText6();
        drawOverlay();
        if (shiftToOriginWithBb) {
          context.translate(bb.x1, bb.y1);
        }
      };
      drawNodeOverlayUnderlay = /* @__PURE__ */ __name(function drawNodeOverlayUnderlay2(overlayOrUnderlay) {
        if (!["overlay", "underlay"].includes(overlayOrUnderlay)) {
          throw new Error("Invalid state");
        }
        return function(context, node2, pos, nodeWidth, nodeHeight) {
          var r2 = this;
          if (!node2.visible()) {
            return;
          }
          var padding2 = node2.pstyle("".concat(overlayOrUnderlay, "-padding")).pfValue;
          var opacity = node2.pstyle("".concat(overlayOrUnderlay, "-opacity")).value;
          var color2 = node2.pstyle("".concat(overlayOrUnderlay, "-color")).value;
          var shape = node2.pstyle("".concat(overlayOrUnderlay, "-shape")).value;
          var radius2 = node2.pstyle("".concat(overlayOrUnderlay, "-corner-radius")).value;
          if (opacity > 0) {
            pos = pos || node2.position();
            if (nodeWidth == null || nodeHeight == null) {
              var _padding = node2.padding();
              nodeWidth = node2.width() + 2 * _padding;
              nodeHeight = node2.height() + 2 * _padding;
            }
            r2.colorFillStyle(context, color2[0], color2[1], color2[2], opacity);
            r2.nodeShapes[shape].draw(context, pos.x, pos.y, nodeWidth + padding2 * 2, nodeHeight + padding2 * 2, radius2);
            context.fill();
          }
        };
      }, "drawNodeOverlayUnderlay");
      CRp$6.drawNodeOverlay = drawNodeOverlayUnderlay("overlay");
      CRp$6.drawNodeUnderlay = drawNodeOverlayUnderlay("underlay");
      CRp$6.hasPie = function(node2) {
        node2 = node2[0];
        return node2._private.hasPie;
      };
      CRp$6.hasStripe = function(node2) {
        node2 = node2[0];
        return node2._private.hasStripe;
      };
      CRp$6.drawPie = function(context, node2, nodeOpacity, pos) {
        node2 = node2[0];
        pos = pos || node2.position();
        var cyStyle = node2.cy().style();
        var pieSize = node2.pstyle("pie-size");
        var hole = node2.pstyle("pie-hole");
        var overallStartAngle = node2.pstyle("pie-start-angle").pfValue;
        var x5 = pos.x;
        var y6 = pos.y;
        var nodeW = node2.width();
        var nodeH = node2.height();
        var radius2 = Math.min(nodeW, nodeH) / 2;
        var holeRadius;
        var lastPercent = 0;
        var usePaths = this.usePaths();
        if (usePaths) {
          x5 = 0;
          y6 = 0;
        }
        if (pieSize.units === "%") {
          radius2 = radius2 * pieSize.pfValue;
        } else if (pieSize.pfValue !== void 0) {
          radius2 = pieSize.pfValue / 2;
        }
        if (hole.units === "%") {
          holeRadius = radius2 * hole.pfValue;
        } else if (hole.pfValue !== void 0) {
          holeRadius = hole.pfValue / 2;
        }
        if (holeRadius >= radius2) {
          return;
        }
        for (var i2 = 1; i2 <= cyStyle.pieBackgroundN; i2++) {
          var size4 = node2.pstyle("pie-" + i2 + "-background-size").value;
          var color2 = node2.pstyle("pie-" + i2 + "-background-color").value;
          var opacity = node2.pstyle("pie-" + i2 + "-background-opacity").value * nodeOpacity;
          var percent = size4 / 100;
          if (percent + lastPercent > 1) {
            percent = 1 - lastPercent;
          }
          var angleStart = 1.5 * Math.PI + 2 * Math.PI * lastPercent;
          angleStart += overallStartAngle;
          var angleDelta = 2 * Math.PI * percent;
          var angleEnd = angleStart + angleDelta;
          if (size4 === 0 || lastPercent >= 1 || lastPercent + percent > 1) {
            continue;
          }
          if (holeRadius === 0) {
            context.beginPath();
            context.moveTo(x5, y6);
            context.arc(x5, y6, radius2, angleStart, angleEnd);
            context.closePath();
          } else {
            context.beginPath();
            context.arc(x5, y6, radius2, angleStart, angleEnd);
            context.arc(x5, y6, holeRadius, angleEnd, angleStart, true);
            context.closePath();
          }
          this.colorFillStyle(context, color2[0], color2[1], color2[2], opacity);
          context.fill();
          lastPercent += percent;
        }
      };
      CRp$6.drawStripe = function(context, node2, nodeOpacity, pos) {
        node2 = node2[0];
        pos = pos || node2.position();
        var cyStyle = node2.cy().style();
        var x5 = pos.x;
        var y6 = pos.y;
        var nodeW = node2.width();
        var nodeH = node2.height();
        var lastPercent = 0;
        var usePaths = this.usePaths();
        context.save();
        var direction2 = node2.pstyle("stripe-direction").value;
        var stripeSize = node2.pstyle("stripe-size");
        switch (direction2) {
          case "vertical":
            break;
          // default
          case "righward":
            context.rotate(-Math.PI / 2);
            break;
        }
        var stripeW = nodeW;
        var stripeH = nodeH;
        if (stripeSize.units === "%") {
          stripeW = stripeW * stripeSize.pfValue;
          stripeH = stripeH * stripeSize.pfValue;
        } else if (stripeSize.pfValue !== void 0) {
          stripeW = stripeSize.pfValue;
          stripeH = stripeSize.pfValue;
        }
        if (usePaths) {
          x5 = 0;
          y6 = 0;
        }
        y6 -= stripeW / 2;
        x5 -= stripeH / 2;
        for (var i2 = 1; i2 <= cyStyle.stripeBackgroundN; i2++) {
          var size4 = node2.pstyle("stripe-" + i2 + "-background-size").value;
          var color2 = node2.pstyle("stripe-" + i2 + "-background-color").value;
          var opacity = node2.pstyle("stripe-" + i2 + "-background-opacity").value * nodeOpacity;
          var percent = size4 / 100;
          if (percent + lastPercent > 1) {
            percent = 1 - lastPercent;
          }
          if (size4 === 0 || lastPercent >= 1 || lastPercent + percent > 1) {
            continue;
          }
          context.beginPath();
          context.rect(x5, y6 + stripeH * lastPercent, stripeW, stripeH * percent);
          context.closePath();
          this.colorFillStyle(context, color2[0], color2[1], color2[2], opacity);
          context.fill();
          lastPercent += percent;
        }
        context.restore();
      };
      CRp$5 = {};
      motionBlurDelay = 100;
      CRp$5.getPixelRatio = function() {
        var context = this.data.contexts[0];
        if (this.forcedPixelRatio != null) {
          return this.forcedPixelRatio;
        }
        var containerWindow = this.cy.window();
        var backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1;
        return (containerWindow.devicePixelRatio || 1) / backingStore;
      };
      CRp$5.paintCache = function(context) {
        var caches = this.paintCaches = this.paintCaches || [];
        var needToCreateCache = true;
        var cache3;
        for (var i2 = 0; i2 < caches.length; i2++) {
          cache3 = caches[i2];
          if (cache3.context === context) {
            needToCreateCache = false;
            break;
          }
        }
        if (needToCreateCache) {
          cache3 = {
            context
          };
          caches.push(cache3);
        }
        return cache3;
      };
      CRp$5.createGradientStyleFor = function(context, shapeStyleName, ele, fill, opacity) {
        var gradientStyle;
        var usePaths = this.usePaths();
        var colors2 = ele.pstyle(shapeStyleName + "-gradient-stop-colors").value, positions2 = ele.pstyle(shapeStyleName + "-gradient-stop-positions").pfValue;
        if (fill === "radial-gradient") {
          if (ele.isEdge()) {
            var start3 = ele.sourceEndpoint(), end2 = ele.targetEndpoint(), mid = ele.midpoint();
            var d1 = dist(start3, mid);
            var d22 = dist(end2, mid);
            gradientStyle = context.createRadialGradient(mid.x, mid.y, 0, mid.x, mid.y, Math.max(d1, d22));
          } else {
            var pos = usePaths ? {
              x: 0,
              y: 0
            } : ele.position(), width3 = ele.paddedWidth(), height2 = ele.paddedHeight();
            gradientStyle = context.createRadialGradient(pos.x, pos.y, 0, pos.x, pos.y, Math.max(width3, height2));
          }
        } else {
          if (ele.isEdge()) {
            var _start = ele.sourceEndpoint(), _end = ele.targetEndpoint();
            gradientStyle = context.createLinearGradient(_start.x, _start.y, _end.x, _end.y);
          } else {
            var _pos = usePaths ? {
              x: 0,
              y: 0
            } : ele.position(), _width = ele.paddedWidth(), _height = ele.paddedHeight(), halfWidth = _width / 2, halfHeight = _height / 2;
            var direction2 = ele.pstyle("background-gradient-direction").value;
            switch (direction2) {
              case "to-bottom":
                gradientStyle = context.createLinearGradient(_pos.x, _pos.y - halfHeight, _pos.x, _pos.y + halfHeight);
                break;
              case "to-top":
                gradientStyle = context.createLinearGradient(_pos.x, _pos.y + halfHeight, _pos.x, _pos.y - halfHeight);
                break;
              case "to-left":
                gradientStyle = context.createLinearGradient(_pos.x + halfWidth, _pos.y, _pos.x - halfWidth, _pos.y);
                break;
              case "to-right":
                gradientStyle = context.createLinearGradient(_pos.x - halfWidth, _pos.y, _pos.x + halfWidth, _pos.y);
                break;
              case "to-bottom-right":
              case "to-right-bottom":
                gradientStyle = context.createLinearGradient(_pos.x - halfWidth, _pos.y - halfHeight, _pos.x + halfWidth, _pos.y + halfHeight);
                break;
              case "to-top-right":
              case "to-right-top":
                gradientStyle = context.createLinearGradient(_pos.x - halfWidth, _pos.y + halfHeight, _pos.x + halfWidth, _pos.y - halfHeight);
                break;
              case "to-bottom-left":
              case "to-left-bottom":
                gradientStyle = context.createLinearGradient(_pos.x + halfWidth, _pos.y - halfHeight, _pos.x - halfWidth, _pos.y + halfHeight);
                break;
              case "to-top-left":
              case "to-left-top":
                gradientStyle = context.createLinearGradient(_pos.x + halfWidth, _pos.y + halfHeight, _pos.x - halfWidth, _pos.y - halfHeight);
                break;
            }
          }
        }
        if (!gradientStyle) return null;
        var hasPositions = positions2.length === colors2.length;
        var length2 = colors2.length;
        for (var i2 = 0; i2 < length2; i2++) {
          gradientStyle.addColorStop(hasPositions ? positions2[i2] : i2 / (length2 - 1), "rgba(" + colors2[i2][0] + "," + colors2[i2][1] + "," + colors2[i2][2] + "," + opacity + ")");
        }
        return gradientStyle;
      };
      CRp$5.gradientFillStyle = function(context, ele, fill, opacity) {
        var gradientStyle = this.createGradientStyleFor(context, "background", ele, fill, opacity);
        if (!gradientStyle) return null;
        context.fillStyle = gradientStyle;
      };
      CRp$5.colorFillStyle = function(context, r2, g2, b3, a2) {
        context.fillStyle = "rgba(" + r2 + "," + g2 + "," + b3 + "," + a2 + ")";
      };
      CRp$5.eleFillStyle = function(context, ele, opacity) {
        var backgroundFill = ele.pstyle("background-fill").value;
        if (backgroundFill === "linear-gradient" || backgroundFill === "radial-gradient") {
          this.gradientFillStyle(context, ele, backgroundFill, opacity);
        } else {
          var backgroundColor = ele.pstyle("background-color").value;
          this.colorFillStyle(context, backgroundColor[0], backgroundColor[1], backgroundColor[2], opacity);
        }
      };
      CRp$5.gradientStrokeStyle = function(context, ele, fill, opacity) {
        var gradientStyle = this.createGradientStyleFor(context, "line", ele, fill, opacity);
        if (!gradientStyle) return null;
        context.strokeStyle = gradientStyle;
      };
      CRp$5.colorStrokeStyle = function(context, r2, g2, b3, a2) {
        context.strokeStyle = "rgba(" + r2 + "," + g2 + "," + b3 + "," + a2 + ")";
      };
      CRp$5.eleStrokeStyle = function(context, ele, opacity) {
        var lineFill = ele.pstyle("line-fill").value;
        if (lineFill === "linear-gradient" || lineFill === "radial-gradient") {
          this.gradientStrokeStyle(context, ele, lineFill, opacity);
        } else {
          var lineColor = ele.pstyle("line-color").value;
          this.colorStrokeStyle(context, lineColor[0], lineColor[1], lineColor[2], opacity);
        }
      };
      CRp$5.matchCanvasSize = function(container2) {
        var r2 = this;
        var data5 = r2.data;
        var bb = r2.findContainerClientCoords();
        var width3 = bb[2];
        var height2 = bb[3];
        var pixelRatio = r2.getPixelRatio();
        var mbPxRatio = r2.motionBlurPxRatio;
        if (container2 === r2.data.bufferCanvases[r2.MOTIONBLUR_BUFFER_NODE] || container2 === r2.data.bufferCanvases[r2.MOTIONBLUR_BUFFER_DRAG]) {
          pixelRatio = mbPxRatio;
        }
        var canvasWidth = width3 * pixelRatio;
        var canvasHeight = height2 * pixelRatio;
        var canvas;
        if (canvasWidth === r2.canvasWidth && canvasHeight === r2.canvasHeight) {
          return;
        }
        r2.fontCaches = null;
        var canvasContainer = data5.canvasContainer;
        canvasContainer.style.width = width3 + "px";
        canvasContainer.style.height = height2 + "px";
        for (var i2 = 0; i2 < r2.CANVAS_LAYERS; i2++) {
          canvas = data5.canvases[i2];
          canvas.width = canvasWidth;
          canvas.height = canvasHeight;
          canvas.style.width = width3 + "px";
          canvas.style.height = height2 + "px";
        }
        for (var i2 = 0; i2 < r2.BUFFER_COUNT; i2++) {
          canvas = data5.bufferCanvases[i2];
          canvas.width = canvasWidth;
          canvas.height = canvasHeight;
          canvas.style.width = width3 + "px";
          canvas.style.height = height2 + "px";
        }
        r2.textureMult = 1;
        if (pixelRatio <= 1) {
          canvas = data5.bufferCanvases[r2.TEXTURE_BUFFER];
          r2.textureMult = 2;
          canvas.width = canvasWidth * r2.textureMult;
          canvas.height = canvasHeight * r2.textureMult;
        }
        r2.canvasWidth = canvasWidth;
        r2.canvasHeight = canvasHeight;
        r2.pixelRatio = pixelRatio;
      };
      CRp$5.renderTo = function(cxt, zoom2, pan2, pxRatio) {
        this.render({
          forcedContext: cxt,
          forcedZoom: zoom2,
          forcedPan: pan2,
          drawAllLayers: true,
          forcedPxRatio: pxRatio
        });
      };
      CRp$5.clearCanvas = function() {
        var r2 = this;
        var data5 = r2.data;
        function clear21(context) {
          context.clearRect(0, 0, r2.canvasWidth, r2.canvasHeight);
        }
        __name(clear21, "clear");
        clear21(data5.contexts[r2.NODE]);
        clear21(data5.contexts[r2.DRAG]);
      };
      CRp$5.render = function(options2) {
        var r2 = this;
        options2 = options2 || staticEmptyObject();
        var cy = r2.cy;
        var forcedContext = options2.forcedContext;
        var drawAllLayers = options2.drawAllLayers;
        var drawOnlyNodeLayer = options2.drawOnlyNodeLayer;
        var forcedZoom = options2.forcedZoom;
        var forcedPan = options2.forcedPan;
        var pixelRatio = options2.forcedPxRatio === void 0 ? this.getPixelRatio() : options2.forcedPxRatio;
        var data5 = r2.data;
        var needDraw = data5.canvasNeedsRedraw;
        var textureDraw = r2.textureOnViewport && !forcedContext && (r2.pinching || r2.hoverData.dragging || r2.swipePanning || r2.data.wheelZooming);
        var motionBlur = options2.motionBlur !== void 0 ? options2.motionBlur : r2.motionBlur;
        var mbPxRatio = r2.motionBlurPxRatio;
        var hasCompoundNodes2 = cy.hasCompoundNodes();
        var inNodeDragGesture = r2.hoverData.draggingEles;
        var inBoxSelection = r2.hoverData.selecting || r2.touchData.selecting ? true : false;
        motionBlur = motionBlur && !forcedContext && r2.motionBlurEnabled && !inBoxSelection;
        var motionBlurFadeEffect = motionBlur;
        if (!forcedContext) {
          if (r2.prevPxRatio !== pixelRatio) {
            r2.invalidateContainerClientCoordsCache();
            r2.matchCanvasSize(r2.container);
            r2.redrawHint("eles", true);
            r2.redrawHint("drag", true);
          }
          r2.prevPxRatio = pixelRatio;
        }
        if (!forcedContext && r2.motionBlurTimeout) {
          clearTimeout(r2.motionBlurTimeout);
        }
        if (motionBlur) {
          if (r2.mbFrames == null) {
            r2.mbFrames = 0;
          }
          r2.mbFrames++;
          if (r2.mbFrames < 3) {
            motionBlurFadeEffect = false;
          }
          if (r2.mbFrames > r2.minMbLowQualFrames) {
            r2.motionBlurPxRatio = r2.mbPxRBlurry;
          }
        }
        if (r2.clearingMotionBlur) {
          r2.motionBlurPxRatio = 1;
        }
        if (r2.textureDrawLastFrame && !textureDraw) {
          needDraw[r2.NODE] = true;
          needDraw[r2.SELECT_BOX] = true;
        }
        var style3 = cy.style();
        var zoom2 = cy.zoom();
        var effectiveZoom = forcedZoom !== void 0 ? forcedZoom : zoom2;
        var pan2 = cy.pan();
        var effectivePan = {
          x: pan2.x,
          y: pan2.y
        };
        var vp = {
          zoom: zoom2,
          pan: {
            x: pan2.x,
            y: pan2.y
          }
        };
        var prevVp = r2.prevViewport;
        var viewportIsDiff = prevVp === void 0 || vp.zoom !== prevVp.zoom || vp.pan.x !== prevVp.pan.x || vp.pan.y !== prevVp.pan.y;
        if (!viewportIsDiff && !(inNodeDragGesture && !hasCompoundNodes2)) {
          r2.motionBlurPxRatio = 1;
        }
        if (forcedPan) {
          effectivePan = forcedPan;
        }
        effectiveZoom *= pixelRatio;
        effectivePan.x *= pixelRatio;
        effectivePan.y *= pixelRatio;
        var eles = r2.getCachedZSortedEles();
        function mbclear(context2, x5, y6, w4, h3) {
          var gco = context2.globalCompositeOperation;
          context2.globalCompositeOperation = "destination-out";
          r2.colorFillStyle(context2, 255, 255, 255, r2.motionBlurTransparency);
          context2.fillRect(x5, y6, w4, h3);
          context2.globalCompositeOperation = gco;
        }
        __name(mbclear, "mbclear");
        function setContextTransform2(context2, clear22) {
          var ePan, eZoom, w4, h3;
          if (!r2.clearingMotionBlur && (context2 === data5.bufferContexts[r2.MOTIONBLUR_BUFFER_NODE] || context2 === data5.bufferContexts[r2.MOTIONBLUR_BUFFER_DRAG])) {
            ePan = {
              x: pan2.x * mbPxRatio,
              y: pan2.y * mbPxRatio
            };
            eZoom = zoom2 * mbPxRatio;
            w4 = r2.canvasWidth * mbPxRatio;
            h3 = r2.canvasHeight * mbPxRatio;
          } else {
            ePan = effectivePan;
            eZoom = effectiveZoom;
            w4 = r2.canvasWidth;
            h3 = r2.canvasHeight;
          }
          context2.setTransform(1, 0, 0, 1, 0, 0);
          if (clear22 === "motionBlur") {
            mbclear(context2, 0, 0, w4, h3);
          } else if (!forcedContext && (clear22 === void 0 || clear22)) {
            context2.clearRect(0, 0, w4, h3);
          }
          if (!drawAllLayers) {
            context2.translate(ePan.x, ePan.y);
            context2.scale(eZoom, eZoom);
          }
          if (forcedPan) {
            context2.translate(forcedPan.x, forcedPan.y);
          }
          if (forcedZoom) {
            context2.scale(forcedZoom, forcedZoom);
          }
        }
        __name(setContextTransform2, "setContextTransform");
        if (!textureDraw) {
          r2.textureDrawLastFrame = false;
        }
        if (textureDraw) {
          r2.textureDrawLastFrame = true;
          if (!r2.textureCache) {
            r2.textureCache = {};
            r2.textureCache.bb = cy.mutableElements().boundingBox();
            r2.textureCache.texture = r2.data.bufferCanvases[r2.TEXTURE_BUFFER];
            var cxt = r2.data.bufferContexts[r2.TEXTURE_BUFFER];
            cxt.setTransform(1, 0, 0, 1, 0, 0);
            cxt.clearRect(0, 0, r2.canvasWidth * r2.textureMult, r2.canvasHeight * r2.textureMult);
            r2.render({
              forcedContext: cxt,
              drawOnlyNodeLayer: true,
              forcedPxRatio: pixelRatio * r2.textureMult
            });
            var vp = r2.textureCache.viewport = {
              zoom: cy.zoom(),
              pan: cy.pan(),
              width: r2.canvasWidth,
              height: r2.canvasHeight
            };
            vp.mpan = {
              x: (0 - vp.pan.x) / vp.zoom,
              y: (0 - vp.pan.y) / vp.zoom
            };
          }
          needDraw[r2.DRAG] = false;
          needDraw[r2.NODE] = false;
          var context = data5.contexts[r2.NODE];
          var texture = r2.textureCache.texture;
          var vp = r2.textureCache.viewport;
          context.setTransform(1, 0, 0, 1, 0, 0);
          if (motionBlur) {
            mbclear(context, 0, 0, vp.width, vp.height);
          } else {
            context.clearRect(0, 0, vp.width, vp.height);
          }
          var outsideBgColor = style3.core("outside-texture-bg-color").value;
          var outsideBgOpacity = style3.core("outside-texture-bg-opacity").value;
          r2.colorFillStyle(context, outsideBgColor[0], outsideBgColor[1], outsideBgColor[2], outsideBgOpacity);
          context.fillRect(0, 0, vp.width, vp.height);
          var zoom2 = cy.zoom();
          setContextTransform2(context, false);
          context.clearRect(vp.mpan.x, vp.mpan.y, vp.width / vp.zoom / pixelRatio, vp.height / vp.zoom / pixelRatio);
          context.drawImage(texture, vp.mpan.x, vp.mpan.y, vp.width / vp.zoom / pixelRatio, vp.height / vp.zoom / pixelRatio);
        } else if (r2.textureOnViewport && !forcedContext) {
          r2.textureCache = null;
        }
        var extent2 = cy.extent();
        var vpManip = r2.pinching || r2.hoverData.dragging || r2.swipePanning || r2.data.wheelZooming || r2.hoverData.draggingEles || r2.cy.animated();
        var hideEdges = r2.hideEdgesOnViewport && vpManip;
        var needMbClear = [];
        needMbClear[r2.NODE] = !needDraw[r2.NODE] && motionBlur && !r2.clearedForMotionBlur[r2.NODE] || r2.clearingMotionBlur;
        if (needMbClear[r2.NODE]) {
          r2.clearedForMotionBlur[r2.NODE] = true;
        }
        needMbClear[r2.DRAG] = !needDraw[r2.DRAG] && motionBlur && !r2.clearedForMotionBlur[r2.DRAG] || r2.clearingMotionBlur;
        if (needMbClear[r2.DRAG]) {
          r2.clearedForMotionBlur[r2.DRAG] = true;
        }
        if (needDraw[r2.NODE] || drawAllLayers || drawOnlyNodeLayer || needMbClear[r2.NODE]) {
          var useBuffer = motionBlur && !needMbClear[r2.NODE] && mbPxRatio !== 1;
          var context = forcedContext || (useBuffer ? r2.data.bufferContexts[r2.MOTIONBLUR_BUFFER_NODE] : data5.contexts[r2.NODE]);
          var clear21 = motionBlur && !useBuffer ? "motionBlur" : void 0;
          setContextTransform2(context, clear21);
          if (hideEdges) {
            r2.drawCachedNodes(context, eles.nondrag, pixelRatio, extent2);
          } else {
            r2.drawLayeredElements(context, eles.nondrag, pixelRatio, extent2);
          }
          if (r2.debug) {
            r2.drawDebugPoints(context, eles.nondrag);
          }
          if (!drawAllLayers && !motionBlur) {
            needDraw[r2.NODE] = false;
          }
        }
        if (!drawOnlyNodeLayer && (needDraw[r2.DRAG] || drawAllLayers || needMbClear[r2.DRAG])) {
          var useBuffer = motionBlur && !needMbClear[r2.DRAG] && mbPxRatio !== 1;
          var context = forcedContext || (useBuffer ? r2.data.bufferContexts[r2.MOTIONBLUR_BUFFER_DRAG] : data5.contexts[r2.DRAG]);
          setContextTransform2(context, motionBlur && !useBuffer ? "motionBlur" : void 0);
          if (hideEdges) {
            r2.drawCachedNodes(context, eles.drag, pixelRatio, extent2);
          } else {
            r2.drawCachedElements(context, eles.drag, pixelRatio, extent2);
          }
          if (r2.debug) {
            r2.drawDebugPoints(context, eles.drag);
          }
          if (!drawAllLayers && !motionBlur) {
            needDraw[r2.DRAG] = false;
          }
        }
        this.drawSelectionRectangle(options2, setContextTransform2);
        if (motionBlur && mbPxRatio !== 1) {
          var cxtNode = data5.contexts[r2.NODE];
          var txtNode = r2.data.bufferCanvases[r2.MOTIONBLUR_BUFFER_NODE];
          var cxtDrag = data5.contexts[r2.DRAG];
          var txtDrag = r2.data.bufferCanvases[r2.MOTIONBLUR_BUFFER_DRAG];
          var drawMotionBlur = /* @__PURE__ */ __name(function drawMotionBlur2(cxt2, txt, needClear) {
            cxt2.setTransform(1, 0, 0, 1, 0, 0);
            if (needClear || !motionBlurFadeEffect) {
              cxt2.clearRect(0, 0, r2.canvasWidth, r2.canvasHeight);
            } else {
              mbclear(cxt2, 0, 0, r2.canvasWidth, r2.canvasHeight);
            }
            var pxr = mbPxRatio;
            cxt2.drawImage(
              txt,
              // img
              0,
              0,
              // sx, sy
              r2.canvasWidth * pxr,
              r2.canvasHeight * pxr,
              // sw, sh
              0,
              0,
              // x, y
              r2.canvasWidth,
              r2.canvasHeight
              // w, h
            );
          }, "drawMotionBlur");
          if (needDraw[r2.NODE] || needMbClear[r2.NODE]) {
            drawMotionBlur(cxtNode, txtNode, needMbClear[r2.NODE]);
            needDraw[r2.NODE] = false;
          }
          if (needDraw[r2.DRAG] || needMbClear[r2.DRAG]) {
            drawMotionBlur(cxtDrag, txtDrag, needMbClear[r2.DRAG]);
            needDraw[r2.DRAG] = false;
          }
        }
        r2.prevViewport = vp;
        if (r2.clearingMotionBlur) {
          r2.clearingMotionBlur = false;
          r2.motionBlurCleared = true;
          r2.motionBlur = true;
        }
        if (motionBlur) {
          r2.motionBlurTimeout = setTimeout(function() {
            r2.motionBlurTimeout = null;
            r2.clearedForMotionBlur[r2.NODE] = false;
            r2.clearedForMotionBlur[r2.DRAG] = false;
            r2.motionBlur = false;
            r2.clearingMotionBlur = !textureDraw;
            r2.mbFrames = 0;
            needDraw[r2.NODE] = true;
            needDraw[r2.DRAG] = true;
            r2.redraw();
          }, motionBlurDelay);
        }
        if (!forcedContext) {
          cy.emit("render");
        }
      };
      CRp$5.drawSelectionRectangle = function(options2, setContextTransform2) {
        var r2 = this;
        var cy = r2.cy;
        var data5 = r2.data;
        var style3 = cy.style();
        var drawOnlyNodeLayer = options2.drawOnlyNodeLayer;
        var drawAllLayers = options2.drawAllLayers;
        var needDraw = data5.canvasNeedsRedraw;
        var forcedContext = options2.forcedContext;
        if (r2.showFps || !drawOnlyNodeLayer && needDraw[r2.SELECT_BOX] && !drawAllLayers) {
          var context = forcedContext || data5.contexts[r2.SELECT_BOX];
          setContextTransform2(context);
          if (r2.selection[4] == 1 && (r2.hoverData.selecting || r2.touchData.selecting)) {
            var zoom2 = r2.cy.zoom();
            var borderWidth = style3.core("selection-box-border-width").value / zoom2;
            context.lineWidth = borderWidth;
            context.fillStyle = "rgba(" + style3.core("selection-box-color").value[0] + "," + style3.core("selection-box-color").value[1] + "," + style3.core("selection-box-color").value[2] + "," + style3.core("selection-box-opacity").value + ")";
            context.fillRect(r2.selection[0], r2.selection[1], r2.selection[2] - r2.selection[0], r2.selection[3] - r2.selection[1]);
            if (borderWidth > 0) {
              context.strokeStyle = "rgba(" + style3.core("selection-box-border-color").value[0] + "," + style3.core("selection-box-border-color").value[1] + "," + style3.core("selection-box-border-color").value[2] + "," + style3.core("selection-box-opacity").value + ")";
              context.strokeRect(r2.selection[0], r2.selection[1], r2.selection[2] - r2.selection[0], r2.selection[3] - r2.selection[1]);
            }
          }
          if (data5.bgActivePosistion && !r2.hoverData.selecting) {
            var zoom2 = r2.cy.zoom();
            var pos = data5.bgActivePosistion;
            context.fillStyle = "rgba(" + style3.core("active-bg-color").value[0] + "," + style3.core("active-bg-color").value[1] + "," + style3.core("active-bg-color").value[2] + "," + style3.core("active-bg-opacity").value + ")";
            context.beginPath();
            context.arc(pos.x, pos.y, style3.core("active-bg-size").pfValue / zoom2, 0, 2 * Math.PI);
            context.fill();
          }
          var timeToRender = r2.lastRedrawTime;
          if (r2.showFps && timeToRender) {
            timeToRender = Math.round(timeToRender);
            var fps = Math.round(1e3 / timeToRender);
            var text4 = "1 frame = " + timeToRender + " ms = " + fps + " fps";
            context.setTransform(1, 0, 0, 1, 0, 0);
            context.fillStyle = "rgba(255, 0, 0, 0.75)";
            context.strokeStyle = "rgba(255, 0, 0, 0.75)";
            context.font = "30px Arial";
            if (!fpsHeight) {
              var dims = context.measureText(text4);
              fpsHeight = dims.actualBoundingBoxAscent;
            }
            context.fillText(text4, 0, fpsHeight);
            var maxFps = 60;
            context.strokeRect(0, fpsHeight + 10, 250, 20);
            context.fillRect(0, fpsHeight + 10, 250 * Math.min(fps / maxFps, 1), 20);
          }
          if (!drawAllLayers) {
            needDraw[r2.SELECT_BOX] = false;
          }
        }
      };
      __name(compileShader, "compileShader");
      __name(createProgram, "createProgram");
      __name(createTextureCanvas, "createTextureCanvas");
      __name(getEffectivePanZoom, "getEffectivePanZoom");
      __name(getEffectiveZoom, "getEffectiveZoom");
      __name(modelToRenderedPosition2, "modelToRenderedPosition");
      __name(isSimpleShape, "isSimpleShape");
      __name(arrayEqual, "arrayEqual");
      __name(toWebGLColor, "toWebGLColor");
      __name(indexToVec4, "indexToVec4");
      __name(vec4ToIndex, "vec4ToIndex");
      __name(createTexture, "createTexture");
      __name(getTypeInfo, "getTypeInfo");
      __name(createTypedArray, "createTypedArray");
      __name(createTypedArrayView, "createTypedArrayView");
      __name(createBufferStaticDraw, "createBufferStaticDraw");
      __name(createBufferDynamicDraw, "createBufferDynamicDraw");
      __name(create3x3MatrixBufferDynamicDraw, "create3x3MatrixBufferDynamicDraw");
      __name(createPickingFrameBuffer, "createPickingFrameBuffer");
      ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array;
      if (!Math.hypot) Math.hypot = function() {
        var y6 = 0, i2 = arguments.length;
        while (i2--) {
          y6 += arguments[i2] * arguments[i2];
        }
        return Math.sqrt(y6);
      };
      __name(create3, "create");
      __name(identity6, "identity");
      __name(multiply, "multiply");
      __name(translate, "translate");
      __name(rotate, "rotate");
      __name(scale, "scale");
      __name(projection, "projection");
      Atlas = /* @__PURE__ */ (function() {
        function Atlas2(r2, texSize, texRows, createTextureCanvas2) {
          _classCallCheck(this, Atlas2);
          this.debugID = Math.floor(Math.random() * 1e4);
          this.r = r2;
          this.texSize = texSize;
          this.texRows = texRows;
          this.texHeight = Math.floor(texSize / texRows);
          this.enableWrapping = true;
          this.locked = false;
          this.texture = null;
          this.needsBuffer = true;
          this.freePointer = {
            x: 0,
            row: 0
          };
          this.keyToLocation = /* @__PURE__ */ new Map();
          this.canvas = createTextureCanvas2(r2, texSize, texSize);
          this.scratch = createTextureCanvas2(r2, texSize, this.texHeight, "scratch");
        }
        __name(Atlas2, "Atlas");
        return _createClass(Atlas2, [{
          key: "lock",
          value: /* @__PURE__ */ __name(function lock() {
            this.locked = true;
          }, "lock")
        }, {
          key: "getKeys",
          value: /* @__PURE__ */ __name(function getKeys() {
            return new Set(this.keyToLocation.keys());
          }, "getKeys")
        }, {
          key: "getScale",
          value: /* @__PURE__ */ __name(function getScale(_ref) {
            var w4 = _ref.w, h3 = _ref.h;
            var texHeight = this.texHeight, maxTexWidth = this.texSize;
            var scale3 = texHeight / h3;
            var texW = w4 * scale3;
            var texH = h3 * scale3;
            if (texW > maxTexWidth) {
              scale3 = maxTexWidth / w4;
              texW = w4 * scale3;
              texH = h3 * scale3;
            }
            return {
              scale: scale3,
              texW,
              texH
            };
          }, "getScale")
        }, {
          key: "draw",
          value: /* @__PURE__ */ __name(function draw31(key, bb, doDrawing) {
            var _this = this;
            if (this.locked) throw new Error("can't draw, atlas is locked");
            var texSize = this.texSize, texRows = this.texRows, texHeight = this.texHeight;
            var _this$getScale = this.getScale(bb), scale3 = _this$getScale.scale, texW = _this$getScale.texW, texH = _this$getScale.texH;
            var drawAt = /* @__PURE__ */ __name(function drawAt2(location, canvas) {
              if (doDrawing && canvas) {
                var context = canvas.context;
                var x5 = location.x, row = location.row;
                var xOffset = x5;
                var yOffset = texHeight * row;
                context.save();
                context.translate(xOffset, yOffset);
                context.scale(scale3, scale3);
                doDrawing(context, bb);
                context.restore();
              }
            }, "drawAt");
            var locations = [null, null];
            var drawNormal = /* @__PURE__ */ __name(function drawNormal2() {
              drawAt(_this.freePointer, _this.canvas);
              locations[0] = {
                x: _this.freePointer.x,
                y: _this.freePointer.row * texHeight,
                w: texW,
                h: texH
              };
              locations[1] = {
                // create a second location with a width of 0, for convenience
                x: _this.freePointer.x + texW,
                y: _this.freePointer.row * texHeight,
                w: 0,
                h: texH
              };
              _this.freePointer.x += texW;
              if (_this.freePointer.x == texSize) {
                _this.freePointer.x = 0;
                _this.freePointer.row++;
              }
            }, "drawNormal");
            var drawWrapped = /* @__PURE__ */ __name(function drawWrapped2() {
              var scratch = _this.scratch, canvas = _this.canvas;
              scratch.clear();
              drawAt({
                x: 0,
                row: 0
              }, scratch);
              var firstTexW = texSize - _this.freePointer.x;
              var secondTexW = texW - firstTexW;
              var h3 = texHeight;
              {
                var dx = _this.freePointer.x;
                var dy = _this.freePointer.row * texHeight;
                var w4 = firstTexW;
                canvas.context.drawImage(scratch, 0, 0, w4, h3, dx, dy, w4, h3);
                locations[0] = {
                  x: dx,
                  y: dy,
                  w: w4,
                  h: texH
                };
              }
              {
                var sx = firstTexW;
                var _dy = (_this.freePointer.row + 1) * texHeight;
                var _w = secondTexW;
                if (canvas) {
                  canvas.context.drawImage(scratch, sx, 0, _w, h3, 0, _dy, _w, h3);
                }
                locations[1] = {
                  x: 0,
                  y: _dy,
                  w: _w,
                  h: texH
                };
              }
              _this.freePointer.x = secondTexW;
              _this.freePointer.row++;
            }, "drawWrapped");
            var moveToStartOfNextRow = /* @__PURE__ */ __name(function moveToStartOfNextRow2() {
              _this.freePointer.x = 0;
              _this.freePointer.row++;
            }, "moveToStartOfNextRow");
            if (this.freePointer.x + texW <= texSize) {
              drawNormal();
            } else if (this.freePointer.row >= texRows - 1) {
              return false;
            } else if (this.freePointer.x === texSize) {
              moveToStartOfNextRow();
              drawNormal();
            } else if (this.enableWrapping) {
              drawWrapped();
            } else {
              moveToStartOfNextRow();
              drawNormal();
            }
            this.keyToLocation.set(key, locations);
            this.needsBuffer = true;
            return locations;
          }, "draw")
        }, {
          key: "getOffsets",
          value: /* @__PURE__ */ __name(function getOffsets(key) {
            return this.keyToLocation.get(key);
          }, "getOffsets")
        }, {
          key: "isEmpty",
          value: /* @__PURE__ */ __name(function isEmpty2() {
            return this.freePointer.x === 0 && this.freePointer.row === 0;
          }, "isEmpty")
        }, {
          key: "canFit",
          value: /* @__PURE__ */ __name(function canFit(bb) {
            if (this.locked) return false;
            var texSize = this.texSize, texRows = this.texRows;
            var _this$getScale2 = this.getScale(bb), texW = _this$getScale2.texW;
            if (this.freePointer.x + texW > texSize) {
              return this.freePointer.row < texRows - 1;
            }
            return true;
          }, "canFit")
          // called on every frame
        }, {
          key: "bufferIfNeeded",
          value: /* @__PURE__ */ __name(function bufferIfNeeded(gl) {
            if (!this.texture) {
              this.texture = createTexture(gl, this.debugID);
            }
            if (this.needsBuffer) {
              this.texture.buffer(this.canvas);
              this.needsBuffer = false;
              if (this.locked) {
                this.canvas = null;
                this.scratch = null;
              }
            }
          }, "bufferIfNeeded")
        }, {
          key: "dispose",
          value: /* @__PURE__ */ __name(function dispose() {
            if (this.texture) {
              this.texture.deleteTexture();
              this.texture = null;
            }
            this.canvas = null;
            this.scratch = null;
            this.locked = true;
          }, "dispose")
        }]);
      })();
      AtlasCollection = /* @__PURE__ */ (function() {
        function AtlasCollection2(r2, texSize, texRows, createTextureCanvas2) {
          _classCallCheck(this, AtlasCollection2);
          this.r = r2;
          this.texSize = texSize;
          this.texRows = texRows;
          this.createTextureCanvas = createTextureCanvas2;
          this.atlases = [];
          this.styleKeyToAtlas = /* @__PURE__ */ new Map();
          this.markedKeys = /* @__PURE__ */ new Set();
        }
        __name(AtlasCollection2, "AtlasCollection");
        return _createClass(AtlasCollection2, [{
          key: "getKeys",
          value: /* @__PURE__ */ __name(function getKeys() {
            return new Set(this.styleKeyToAtlas.keys());
          }, "getKeys")
        }, {
          key: "_createAtlas",
          value: /* @__PURE__ */ __name(function _createAtlas() {
            var r2 = this.r, texSize = this.texSize, texRows = this.texRows, createTextureCanvas2 = this.createTextureCanvas;
            return new Atlas(r2, texSize, texRows, createTextureCanvas2);
          }, "_createAtlas")
        }, {
          key: "_getScratchCanvas",
          value: /* @__PURE__ */ __name(function _getScratchCanvas() {
            if (!this.scratch) {
              var r2 = this.r, texSize = this.texSize, texRows = this.texRows, createTextureCanvas2 = this.createTextureCanvas;
              var texHeight = Math.floor(texSize / texRows);
              this.scratch = createTextureCanvas2(r2, texSize, texHeight, "scratch");
            }
            return this.scratch;
          }, "_getScratchCanvas")
        }, {
          key: "draw",
          value: /* @__PURE__ */ __name(function draw31(key, bb, doDrawing) {
            var atlas = this.styleKeyToAtlas.get(key);
            if (!atlas) {
              atlas = this.atlases[this.atlases.length - 1];
              if (!atlas || !atlas.canFit(bb)) {
                if (atlas) atlas.lock();
                atlas = this._createAtlas();
                this.atlases.push(atlas);
              }
              atlas.draw(key, bb, doDrawing);
              this.styleKeyToAtlas.set(key, atlas);
            }
            return atlas;
          }, "draw")
        }, {
          key: "getAtlas",
          value: /* @__PURE__ */ __name(function getAtlas(key) {
            return this.styleKeyToAtlas.get(key);
          }, "getAtlas")
        }, {
          key: "hasAtlas",
          value: /* @__PURE__ */ __name(function hasAtlas(key) {
            return this.styleKeyToAtlas.has(key);
          }, "hasAtlas")
        }, {
          key: "markKeyForGC",
          value: /* @__PURE__ */ __name(function markKeyForGC(key) {
            this.markedKeys.add(key);
          }, "markKeyForGC")
        }, {
          key: "gc",
          value: /* @__PURE__ */ __name(function gc2() {
            var _this2 = this;
            var markedKeys = this.markedKeys;
            if (markedKeys.size === 0) {
              console.log("nothing to garbage collect");
              return;
            }
            var newAtlases = [];
            var newStyleKeyToAtlas = /* @__PURE__ */ new Map();
            var newAtlas = null;
            var _iterator = _createForOfIteratorHelper(this.atlases), _step;
            try {
              var _loop = /* @__PURE__ */ __name(function _loop2() {
                var atlas = _step.value;
                var keys2 = atlas.getKeys();
                var keysToCollect = intersection2(markedKeys, keys2);
                if (keysToCollect.size === 0) {
                  newAtlases.push(atlas);
                  keys2.forEach(function(k2) {
                    return newStyleKeyToAtlas.set(k2, atlas);
                  });
                  return 1;
                }
                if (!newAtlas) {
                  newAtlas = _this2._createAtlas();
                  newAtlases.push(newAtlas);
                }
                var _iterator2 = _createForOfIteratorHelper(keys2), _step2;
                try {
                  for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
                    var key = _step2.value;
                    if (!keysToCollect.has(key)) {
                      var _atlas$getOffsets = atlas.getOffsets(key), _atlas$getOffsets2 = _slicedToArray(_atlas$getOffsets, 2), s1 = _atlas$getOffsets2[0], s2 = _atlas$getOffsets2[1];
                      if (!newAtlas.canFit({
                        w: s1.w + s2.w,
                        h: s1.h
                      })) {
                        newAtlas.lock();
                        newAtlas = _this2._createAtlas();
                        newAtlases.push(newAtlas);
                      }
                      if (atlas.canvas) {
                        _this2._copyTextureToNewAtlas(key, atlas, newAtlas);
                        newStyleKeyToAtlas.set(key, newAtlas);
                      }
                    }
                  }
                } catch (err) {
                  _iterator2.e(err);
                } finally {
                  _iterator2.f();
                }
                atlas.dispose();
              }, "_loop");
              for (_iterator.s(); !(_step = _iterator.n()).done; ) {
                if (_loop()) continue;
              }
            } catch (err) {
              _iterator.e(err);
            } finally {
              _iterator.f();
            }
            this.atlases = newAtlases;
            this.styleKeyToAtlas = newStyleKeyToAtlas;
            this.markedKeys = /* @__PURE__ */ new Set();
          }, "gc")
        }, {
          key: "_copyTextureToNewAtlas",
          value: /* @__PURE__ */ __name(function _copyTextureToNewAtlas(key, oldAtlas, newAtlas) {
            var _oldAtlas$getOffsets = oldAtlas.getOffsets(key), _oldAtlas$getOffsets2 = _slicedToArray(_oldAtlas$getOffsets, 2), s1 = _oldAtlas$getOffsets2[0], s2 = _oldAtlas$getOffsets2[1];
            if (s2.w === 0) {
              newAtlas.draw(key, s1, function(context) {
                context.drawImage(oldAtlas.canvas, s1.x, s1.y, s1.w, s1.h, 0, 0, s1.w, s1.h);
              });
            } else {
              var scratch = this._getScratchCanvas();
              scratch.clear();
              scratch.context.drawImage(oldAtlas.canvas, s1.x, s1.y, s1.w, s1.h, 0, 0, s1.w, s1.h);
              scratch.context.drawImage(oldAtlas.canvas, s2.x, s2.y, s2.w, s2.h, s1.w, 0, s2.w, s2.h);
              var w4 = s1.w + s2.w;
              var h3 = s1.h;
              newAtlas.draw(key, {
                w: w4,
                h: h3
              }, function(context) {
                context.drawImage(
                  scratch,
                  0,
                  0,
                  w4,
                  h3,
                  0,
                  0,
                  w4,
                  h3
                  // the destination context has already been translated to the correct position
                );
              });
            }
          }, "_copyTextureToNewAtlas")
        }, {
          key: "getCounts",
          value: /* @__PURE__ */ __name(function getCounts() {
            return {
              keyCount: this.styleKeyToAtlas.size,
              atlasCount: new Set(this.styleKeyToAtlas.values()).size
            };
          }, "getCounts")
        }]);
      })();
      __name(intersection2, "intersection");
      AtlasManager = /* @__PURE__ */ (function() {
        function AtlasManager2(r2, globalOptions) {
          _classCallCheck(this, AtlasManager2);
          this.r = r2;
          this.globalOptions = globalOptions;
          this.atlasSize = globalOptions.webglTexSize;
          this.maxAtlasesPerBatch = globalOptions.webglTexPerBatch;
          this.renderTypes = /* @__PURE__ */ new Map();
          this.collections = /* @__PURE__ */ new Map();
          this.typeAndIdToKey = /* @__PURE__ */ new Map();
        }
        __name(AtlasManager2, "AtlasManager");
        return _createClass(AtlasManager2, [{
          key: "getAtlasSize",
          value: /* @__PURE__ */ __name(function getAtlasSize() {
            return this.atlasSize;
          }, "getAtlasSize")
        }, {
          key: "addAtlasCollection",
          value: /* @__PURE__ */ __name(function addAtlasCollection(collectionName, atlasCollectionOptions) {
            var _this$globalOptions = this.globalOptions, webglTexSize = _this$globalOptions.webglTexSize, createTextureCanvas2 = _this$globalOptions.createTextureCanvas;
            var texRows = atlasCollectionOptions.texRows;
            var cachedCreateTextureCanvas = this._cacheScratchCanvas(createTextureCanvas2);
            var atlasCollection = new AtlasCollection(this.r, webglTexSize, texRows, cachedCreateTextureCanvas);
            this.collections.set(collectionName, atlasCollection);
          }, "addAtlasCollection")
        }, {
          key: "addRenderType",
          value: /* @__PURE__ */ __name(function addRenderType(type3, renderTypeOptions) {
            var collection4 = renderTypeOptions.collection;
            if (!this.collections.has(collection4)) throw new Error("invalid atlas collection name '".concat(collection4, "'"));
            var atlasCollection = this.collections.get(collection4);
            var opts = extend4({
              type: type3,
              atlasCollection
            }, renderTypeOptions);
            this.renderTypes.set(type3, opts);
          }, "addRenderType")
        }, {
          key: "getRenderTypeOpts",
          value: /* @__PURE__ */ __name(function getRenderTypeOpts(type3) {
            return this.renderTypes.get(type3);
          }, "getRenderTypeOpts")
        }, {
          key: "getAtlasCollection",
          value: /* @__PURE__ */ __name(function getAtlasCollection(name) {
            return this.collections.get(name);
          }, "getAtlasCollection")
        }, {
          key: "_cacheScratchCanvas",
          value: /* @__PURE__ */ __name(function _cacheScratchCanvas(createTextureCanvas2) {
            var prevW = -1;
            var prevH = -1;
            var scratchCanvas = null;
            return function(r2, w4, h3, scratch) {
              if (scratch) {
                if (!scratchCanvas || w4 != prevW || h3 != prevH) {
                  prevW = w4;
                  prevH = h3;
                  scratchCanvas = createTextureCanvas2(r2, w4, h3);
                }
                return scratchCanvas;
              } else {
                return createTextureCanvas2(r2, w4, h3);
              }
            };
          }, "_cacheScratchCanvas")
        }, {
          key: "_key",
          value: /* @__PURE__ */ __name(function _key(renderType, id34) {
            return "".concat(renderType, "-").concat(id34);
          }, "_key")
          /** Marks textues associated with the element for garbage collection. */
        }, {
          key: "invalidate",
          value: /* @__PURE__ */ __name(function invalidate(eles) {
            var _this3 = this;
            var _ref2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref2$forceRedraw = _ref2.forceRedraw, forceRedraw = _ref2$forceRedraw === void 0 ? false : _ref2$forceRedraw, _ref2$filterEle = _ref2.filterEle, filterEle = _ref2$filterEle === void 0 ? function() {
              return true;
            } : _ref2$filterEle, _ref2$filterType = _ref2.filterType, filterType = _ref2$filterType === void 0 ? function() {
              return true;
            } : _ref2$filterType;
            var needGC = false;
            var runGCNow = false;
            var _iterator3 = _createForOfIteratorHelper(eles), _step3;
            try {
              for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
                var ele = _step3.value;
                if (filterEle(ele)) {
                  var _iterator4 = _createForOfIteratorHelper(this.renderTypes.values()), _step4;
                  try {
                    var _loop2 = /* @__PURE__ */ __name(function _loop22() {
                      var opts = _step4.value;
                      var renderType = opts.type;
                      if (filterType(renderType)) {
                        var atlasCollection = _this3.collections.get(opts.collection);
                        var key = opts.getKey(ele);
                        var keyArray = Array.isArray(key) ? key : [key];
                        if (forceRedraw) {
                          keyArray.forEach(function(key2) {
                            return atlasCollection.markKeyForGC(key2);
                          });
                          runGCNow = true;
                        } else {
                          var id34 = opts.getID ? opts.getID(ele) : ele.id();
                          var mapKey = _this3._key(renderType, id34);
                          var oldKeyArray = _this3.typeAndIdToKey.get(mapKey);
                          if (oldKeyArray !== void 0 && !arrayEqual(keyArray, oldKeyArray)) {
                            needGC = true;
                            _this3.typeAndIdToKey["delete"](mapKey);
                            oldKeyArray.forEach(function(oldKey) {
                              return atlasCollection.markKeyForGC(oldKey);
                            });
                          }
                        }
                      }
                    }, "_loop2");
                    for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) {
                      _loop2();
                    }
                  } catch (err) {
                    _iterator4.e(err);
                  } finally {
                    _iterator4.f();
                  }
                }
              }
            } catch (err) {
              _iterator3.e(err);
            } finally {
              _iterator3.f();
            }
            if (runGCNow) {
              this.gc();
              needGC = false;
            }
            return needGC;
          }, "invalidate")
          /** Garbage collect */
        }, {
          key: "gc",
          value: /* @__PURE__ */ __name(function gc2() {
            var _iterator5 = _createForOfIteratorHelper(this.collections.values()), _step5;
            try {
              for (_iterator5.s(); !(_step5 = _iterator5.n()).done; ) {
                var collection4 = _step5.value;
                collection4.gc();
              }
            } catch (err) {
              _iterator5.e(err);
            } finally {
              _iterator5.f();
            }
          }, "gc")
        }, {
          key: "getOrCreateAtlas",
          value: /* @__PURE__ */ __name(function getOrCreateAtlas(ele, type3, bb, styleKey) {
            var opts = this.renderTypes.get(type3);
            var atlasCollection = this.collections.get(opts.collection);
            var drawn = false;
            var atlas = atlasCollection.draw(styleKey, bb, function(context) {
              if (opts.drawClipped) {
                context.save();
                context.beginPath();
                context.rect(0, 0, bb.w, bb.h);
                context.clip();
                opts.drawElement(context, ele, bb, true, true);
                context.restore();
              } else {
                opts.drawElement(context, ele, bb, true, true);
              }
              drawn = true;
            });
            if (drawn) {
              var id34 = opts.getID ? opts.getID(ele) : ele.id();
              var mapKey = this._key(type3, id34);
              if (this.typeAndIdToKey.has(mapKey)) {
                this.typeAndIdToKey.get(mapKey).push(styleKey);
              } else {
                this.typeAndIdToKey.set(mapKey, [styleKey]);
              }
            }
            return atlas;
          }, "getOrCreateAtlas")
        }, {
          key: "getAtlasInfo",
          value: /* @__PURE__ */ __name(function getAtlasInfo(ele, type3) {
            var _this4 = this;
            var opts = this.renderTypes.get(type3);
            var key = opts.getKey(ele);
            var keyArray = Array.isArray(key) ? key : [key];
            return keyArray.map(function(styleKey) {
              var bb = opts.getBoundingBox(ele, styleKey);
              var atlas = _this4.getOrCreateAtlas(ele, type3, bb, styleKey);
              var _atlas$getOffsets3 = atlas.getOffsets(styleKey), _atlas$getOffsets4 = _slicedToArray(_atlas$getOffsets3, 2), tex1 = _atlas$getOffsets4[0], tex2 = _atlas$getOffsets4[1];
              return {
                atlas,
                tex: tex1,
                tex1,
                tex2,
                bb
              };
            });
          }, "getAtlasInfo")
        }, {
          key: "getDebugInfo",
          value: /* @__PURE__ */ __name(function getDebugInfo() {
            var debugInfo = [];
            var _iterator6 = _createForOfIteratorHelper(this.collections), _step6;
            try {
              for (_iterator6.s(); !(_step6 = _iterator6.n()).done; ) {
                var _step6$value = _slicedToArray(_step6.value, 2), name = _step6$value[0], collection4 = _step6$value[1];
                var _collection$getCounts = collection4.getCounts(), keyCount = _collection$getCounts.keyCount, atlasCount = _collection$getCounts.atlasCount;
                debugInfo.push({
                  type: name,
                  keyCount,
                  atlasCount
                });
              }
            } catch (err) {
              _iterator6.e(err);
            } finally {
              _iterator6.f();
            }
            return debugInfo;
          }, "getDebugInfo")
        }]);
      })();
      AtlasBatchManager = /* @__PURE__ */ (function() {
        function AtlasBatchManager2(globalOptions) {
          _classCallCheck(this, AtlasBatchManager2);
          this.globalOptions = globalOptions;
          this.atlasSize = globalOptions.webglTexSize;
          this.maxAtlasesPerBatch = globalOptions.webglTexPerBatch;
          this.batchAtlases = [];
        }
        __name(AtlasBatchManager2, "AtlasBatchManager");
        return _createClass(AtlasBatchManager2, [{
          key: "getMaxAtlasesPerBatch",
          value: /* @__PURE__ */ __name(function getMaxAtlasesPerBatch() {
            return this.maxAtlasesPerBatch;
          }, "getMaxAtlasesPerBatch")
        }, {
          key: "getAtlasSize",
          value: /* @__PURE__ */ __name(function getAtlasSize() {
            return this.atlasSize;
          }, "getAtlasSize")
        }, {
          key: "getIndexArray",
          value: /* @__PURE__ */ __name(function getIndexArray() {
            return Array.from({
              length: this.maxAtlasesPerBatch
            }, function(v3, i2) {
              return i2;
            });
          }, "getIndexArray")
        }, {
          key: "startBatch",
          value: /* @__PURE__ */ __name(function startBatch2() {
            this.batchAtlases = [];
          }, "startBatch")
        }, {
          key: "getAtlasCount",
          value: /* @__PURE__ */ __name(function getAtlasCount() {
            return this.batchAtlases.length;
          }, "getAtlasCount")
        }, {
          key: "getAtlases",
          value: /* @__PURE__ */ __name(function getAtlases() {
            return this.batchAtlases;
          }, "getAtlases")
        }, {
          key: "canAddToCurrentBatch",
          value: /* @__PURE__ */ __name(function canAddToCurrentBatch(atlas) {
            if (this.batchAtlases.length === this.maxAtlasesPerBatch) {
              return this.batchAtlases.includes(atlas);
            }
            return true;
          }, "canAddToCurrentBatch")
        }, {
          key: "getAtlasIndexForBatch",
          value: /* @__PURE__ */ __name(function getAtlasIndexForBatch(atlas) {
            var atlasID = this.batchAtlases.indexOf(atlas);
            if (atlasID < 0) {
              if (this.batchAtlases.length === this.maxAtlasesPerBatch) {
                throw new Error("cannot add more atlases to batch");
              }
              this.batchAtlases.push(atlas);
              atlasID = this.batchAtlases.length - 1;
            }
            return atlasID;
          }, "getAtlasIndexForBatch")
        }]);
      })();
      circleSD = "\n  float circleSD(vec2 p, float r) {\n    return distance(vec2(0), p) - r; // signed distance\n  }\n";
      rectangleSD = "\n  float rectangleSD(vec2 p, vec2 b) {\n    vec2 d = abs(p)-b;\n    return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);\n  }\n";
      roundRectangleSD = "\n  float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {\n    cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;\n    cr.x  = (p.y > 0.0) ? cr.x  : cr.y;\n    vec2 q = abs(p) - b + cr.x;\n    return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;\n  }\n";
      ellipseSD = "\n  float ellipseSD(vec2 p, vec2 ab) {\n    p = abs( p ); // symmetry\n\n    // find root with Newton solver\n    vec2 q = ab*(p-ab);\n    float w = (q.x<q.y)? 1.570796327 : 0.0;\n    for( int i=0; i<5; i++ ) {\n      vec2 cs = vec2(cos(w),sin(w));\n      vec2 u = ab*vec2( cs.x,cs.y);\n      vec2 v = ab*vec2(-cs.y,cs.x);\n      w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));\n    }\n    \n    // compute final point and distance\n    float d = length(p-ab*vec2(cos(w),sin(w)));\n    \n    // return signed distance\n    return (dot(p/ab,p/ab)>1.0) ? d : -d;\n  }\n";
      RENDER_TARGET = {
        SCREEN: {
          name: "screen",
          screen: true
        },
        PICKING: {
          name: "picking",
          picking: true
        }
      };
      TEX_PICKING_MODE = {
        // render the texture just like in RENDER_TARGET.SCREEN mode
        IGNORE: 1,
        // don't render the texture at all
        USE_BB: 2
        // render the bounding box as an opaque rectangle
      };
      TEXTURE = 0;
      EDGE_STRAIGHT = 1;
      EDGE_CURVE_SEGMENT = 2;
      EDGE_ARROW = 3;
      RECTANGLE = 4;
      ROUND_RECTANGLE = 5;
      BOTTOM_ROUND_RECTANGLE = 6;
      ELLIPSE = 7;
      ElementDrawingWebGL = /* @__PURE__ */ (function() {
        function ElementDrawingWebGL2(r2, gl, opts) {
          _classCallCheck(this, ElementDrawingWebGL2);
          this.r = r2;
          this.gl = gl;
          this.maxInstances = opts.webglBatchSize;
          this.atlasSize = opts.webglTexSize;
          this.bgColor = opts.bgColor;
          this.debug = opts.webglDebug;
          this.batchDebugInfo = [];
          opts.enableWrapping = true;
          opts.createTextureCanvas = createTextureCanvas;
          this.atlasManager = new AtlasManager(r2, opts);
          this.batchManager = new AtlasBatchManager(opts);
          this.simpleShapeOptions = /* @__PURE__ */ new Map();
          this.program = this._createShaderProgram(RENDER_TARGET.SCREEN);
          this.pickingProgram = this._createShaderProgram(RENDER_TARGET.PICKING);
          this.vao = this._createVAO();
        }
        __name(ElementDrawingWebGL2, "ElementDrawingWebGL");
        return _createClass(ElementDrawingWebGL2, [{
          key: "addAtlasCollection",
          value: /* @__PURE__ */ __name(function addAtlasCollection(collectionName, opts) {
            this.atlasManager.addAtlasCollection(collectionName, opts);
          }, "addAtlasCollection")
          /**
           * @typedef { Object } TextureRenderTypeOpts
           * @property { string } collection - name of atlas collection to render textures to
           * @property { function } getKey - returns the "style key" for an element, may be a single value or an array for multi-line lables
           * @property { function } drawElement - uses a canvas renderer to draw the element to the texture atlas
           * @property { boolean  } drawClipped - if true the context will be clipped to the bounding box before drawElement() is called, may affect performance
           * @property { function } getBoundingBox - returns the bounding box for an element
           * @property { function } getRotation
           * @property { function } getRotationPoint
           * @property { function } getRotationOffset
           * @property { function } isVisible - an extra check for visibility in addition to ele.visible()
           * @property { function } getTexPickingMode - returns a value from the TEX_PICKING_MODE enum
           */
          /**
           * @param { string } typeName
           * @param { TextureRenderTypeOpts } opts
           */
        }, {
          key: "addTextureAtlasRenderType",
          value: /* @__PURE__ */ __name(function addTextureAtlasRenderType(typeName, opts) {
            this.atlasManager.addRenderType(typeName, opts);
          }, "addTextureAtlasRenderType")
          /**
           * @typedef { Object } SimpleShapeRenderTypeOpts
           * @property { function } getBoundingBox - returns the bounding box for an element
           * @property { function } isVisible - this is an extra check for visibility in addition to ele.visible()
           * @property { function } isSimple - check if element is a simple shape, or if it needs to fall back to texture rendering
           * @property { ShapeVisualProperties } shapeProps
           */
          /**
           * @typedef { Object } ShapeVisualProperties
           * @property { string } shape
           * @property { string } color
           * @property { string } opacity
           * @property { string } padding
           * @property { string } radius
           * @property { boolean } border
          */
          /**
           * @param { string } typeName
           * @param { SimpleShapeRenderTypeOpts } opts
           */
        }, {
          key: "addSimpleShapeRenderType",
          value: /* @__PURE__ */ __name(function addSimpleShapeRenderType(typeName, opts) {
            this.simpleShapeOptions.set(typeName, opts);
          }, "addSimpleShapeRenderType")
          /**
           * Inform the atlasManager when element style keys may have changed.
           * The atlasManager can then mark unused textures for "garbage collection".
           */
        }, {
          key: "invalidate",
          value: /* @__PURE__ */ __name(function invalidate(eles) {
            var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, type3 = _ref.type;
            var atlasManager = this.atlasManager;
            if (type3) {
              return atlasManager.invalidate(eles, {
                filterType: /* @__PURE__ */ __name(function filterType(t4) {
                  return t4 === type3;
                }, "filterType"),
                forceRedraw: true
              });
            } else {
              return atlasManager.invalidate(eles);
            }
          }, "invalidate")
          /**
           * Run texture garbage collection.
           */
        }, {
          key: "gc",
          value: /* @__PURE__ */ __name(function gc2() {
            this.atlasManager.gc();
          }, "gc")
        }, {
          key: "_createShaderProgram",
          value: /* @__PURE__ */ __name(function _createShaderProgram(renderTarget) {
            var gl = this.gl;
            var vertexShaderSource = "#version 300 es\n      precision highp float;\n\n      uniform mat3 uPanZoomMatrix;\n      uniform int  uAtlasSize;\n      \n      // instanced\n      in vec2 aPosition; // a vertex from the unit square\n      \n      in mat3 aTransform; // used to transform verticies, eg into a bounding box\n      in int aVertType; // the type of thing we are rendering\n\n      // the z-index that is output when using picking mode\n      in vec4 aIndex;\n      \n      // For textures\n      in int aAtlasId; // which shader unit/atlas to use\n      in vec4 aTex; // x/y/w/h of texture in atlas\n\n      // for edges\n      in vec4 aPointAPointB;\n      in vec4 aPointCPointD;\n      in vec2 aLineWidth; // also used for node border width\n\n      // simple shapes\n      in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]\n      in vec4 aColor; // also used for edges\n      in vec4 aBorderColor; // aLineWidth is used for border width\n\n      // output values passed to the fragment shader\n      out vec2 vTexCoord;\n      out vec4 vColor;\n      out vec2 vPosition;\n      // flat values are not interpolated\n      flat out int vAtlasId; \n      flat out int vVertType;\n      flat out vec2 vTopRight;\n      flat out vec2 vBotLeft;\n      flat out vec4 vCornerRadius;\n      flat out vec4 vBorderColor;\n      flat out vec2 vBorderWidth;\n      flat out vec4 vIndex;\n      \n      void main(void) {\n        int vid = gl_VertexID;\n        vec2 position = aPosition; // TODO make this a vec3, simplifies some code below\n\n        if(aVertType == ".concat(TEXTURE, ") {\n          float texX = aTex.x; // texture coordinates\n          float texY = aTex.y;\n          float texW = aTex.z;\n          float texH = aTex.w;\n\n          if(vid == 1 || vid == 2 || vid == 4) {\n            texX += texW;\n          }\n          if(vid == 2 || vid == 4 || vid == 5) {\n            texY += texH;\n          }\n\n          float d = float(uAtlasSize);\n          vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n          gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n        }\n        else if(aVertType == ").concat(RECTANGLE, " || aVertType == ").concat(ELLIPSE, " \n             || aVertType == ").concat(ROUND_RECTANGLE, " || aVertType == ").concat(BOTTOM_ROUND_RECTANGLE, ") { // simple shapes\n\n          // the bounding box is needed by the fragment shader\n          vBotLeft  = (aTransform * vec3(0, 0, 1)).xy; // flat\n          vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat\n          vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated\n\n          // calculations are done in the fragment shader, just pass these along\n          vColor = aColor;\n          vCornerRadius = aCornerRadius;\n          vBorderColor = aBorderColor;\n          vBorderWidth = aLineWidth;\n\n          gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n        }\n        else if(aVertType == ").concat(EDGE_STRAIGHT, ") {\n          vec2 source = aPointAPointB.xy;\n          vec2 target = aPointAPointB.zw;\n\n          // adjust the geometry so that the line is centered on the edge\n          position.y = position.y - 0.5;\n\n          // stretch the unit square into a long skinny rectangle\n          vec2 xBasis = target - source;\n          vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n          vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;\n\n          gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n          vColor = aColor;\n        } \n        else if(aVertType == ").concat(EDGE_CURVE_SEGMENT, ") {\n          vec2 pointA = aPointAPointB.xy;\n          vec2 pointB = aPointAPointB.zw;\n          vec2 pointC = aPointCPointD.xy;\n          vec2 pointD = aPointCPointD.zw;\n\n          // adjust the geometry so that the line is centered on the edge\n          position.y = position.y - 0.5;\n\n          vec2 p0, p1, p2, pos;\n          if(position.x == 0.0) { // The left side of the unit square\n            p0 = pointA;\n            p1 = pointB;\n            p2 = pointC;\n            pos = position;\n          } else { // The right side of the unit square, use same approach but flip the geometry upside down\n            p0 = pointD;\n            p1 = pointC;\n            p2 = pointB;\n            pos = vec2(0.0, -position.y);\n          }\n\n          vec2 p01 = p1 - p0;\n          vec2 p12 = p2 - p1;\n          vec2 p21 = p1 - p2;\n\n          // Find the normal vector.\n          vec2 tangent = normalize(normalize(p12) + normalize(p01));\n          vec2 normal = vec2(-tangent.y, tangent.x);\n\n          // Find the vector perpendicular to p0 -> p1.\n          vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n          // Determine the bend direction.\n          float sigma = sign(dot(p01 + p21, normal));\n          float width = aLineWidth[0];\n\n          if(sign(pos.y) == -sigma) {\n            // This is an intersecting vertex. Adjust the position so that there's no overlap.\n            vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n            gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n          } else {\n            // This is a non-intersecting vertex. Treat it like a mitre join.\n            vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n            gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n          }\n\n          vColor = aColor;\n        } \n        else if(aVertType == ").concat(EDGE_ARROW, " && vid < 3) {\n          // massage the first triangle into an edge arrow\n          if(vid == 0)\n            position = vec2(-0.15, -0.3);\n          if(vid == 1)\n            position = vec2(  0.0,  0.0);\n          if(vid == 2)\n            position = vec2( 0.15, -0.3);\n\n          gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n          vColor = aColor;\n        }\n        else {\n          gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n        }\n\n        vAtlasId = aAtlasId;\n        vVertType = aVertType;\n        vIndex = aIndex;\n      }\n    ");
            var idxs = this.batchManager.getIndexArray();
            var fragmentShaderSource = "#version 300 es\n      precision highp float;\n\n      // declare texture unit for each texture atlas in the batch\n      ".concat(idxs.map(function(i3) {
              return "uniform sampler2D uTexture".concat(i3, ";");
            }).join("\n	"), "\n\n      uniform vec4 uBGColor;\n      uniform float uZoom;\n\n      in vec2 vTexCoord;\n      in vec4 vColor;\n      in vec2 vPosition; // model coordinates\n\n      flat in int vAtlasId;\n      flat in vec4 vIndex;\n      flat in int vVertType;\n      flat in vec2 vTopRight;\n      flat in vec2 vBotLeft;\n      flat in vec4 vCornerRadius;\n      flat in vec4 vBorderColor;\n      flat in vec2 vBorderWidth;\n\n      out vec4 outColor;\n\n      ").concat(circleSD, "\n      ").concat(rectangleSD, "\n      ").concat(roundRectangleSD, "\n      ").concat(ellipseSD, "\n\n      vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha\n        return vec4( \n          top.rgb + (bot.rgb * (1.0 - top.a)),\n          top.a   + (bot.a   * (1.0 - top.a)) \n        );\n      }\n\n      vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance\n        // scale to the zoom level so that borders don't look blurry when zoomed in\n        // note 1.5 is an aribitrary value chosen because it looks good\n        return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); \n      }\n\n      void main(void) {\n        if(vVertType == ").concat(TEXTURE, ") {\n          // look up the texel from the texture unit\n          ").concat(idxs.map(function(i3) {
              return "if(vAtlasId == ".concat(i3, ") outColor = texture(uTexture").concat(i3, ", vTexCoord);");
            }).join("\n	else "), "\n        } \n        else if(vVertType == ").concat(EDGE_ARROW, ") {\n          // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';\n          outColor = blend(vColor, uBGColor);\n          outColor.a = 1.0; // make opaque, masks out line under arrow\n        }\n        else if(vVertType == ").concat(RECTANGLE, " && vBorderWidth == vec2(0.0)) { // simple rectangle with no border\n          outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done\n        }\n        else if(vVertType == ").concat(RECTANGLE, " || vVertType == ").concat(ELLIPSE, " \n          || vVertType == ").concat(ROUND_RECTANGLE, " || vVertType == ").concat(BOTTOM_ROUND_RECTANGLE, ") { // use SDF\n\n          float outerBorder = vBorderWidth[0];\n          float innerBorder = vBorderWidth[1];\n          float borderPadding = outerBorder * 2.0;\n          float w = vTopRight.x - vBotLeft.x - borderPadding;\n          float h = vTopRight.y - vBotLeft.y - borderPadding;\n          vec2 b = vec2(w/2.0, h/2.0); // half width, half height\n          vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center\n\n          float d; // signed distance\n          if(vVertType == ").concat(RECTANGLE, ") {\n            d = rectangleSD(p, b);\n          } else if(vVertType == ").concat(ELLIPSE, " && w == h) {\n            d = circleSD(p, b.x); // faster than ellipse\n          } else if(vVertType == ").concat(ELLIPSE, ") {\n            d = ellipseSD(p, b);\n          } else {\n            d = roundRectangleSD(p, b, vCornerRadius.wzyx);\n          }\n\n          // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling\n          // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box\n          if(d > 0.0) {\n            if(d > outerBorder) {\n              discard;\n            } else {\n              outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);\n            }\n          } else {\n            if(d > innerBorder) {\n              vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;\n              vec4 innerBorderColor = blend(vBorderColor, vColor);\n              outColor = distInterp(innerBorderColor, outerColor, d);\n            } \n            else {\n              vec4 outerColor;\n              if(innerBorder == 0.0 && outerBorder == 0.0) {\n                outerColor = vec4(0);\n              } else if(innerBorder == 0.0) {\n                outerColor = vBorderColor;\n              } else {\n                outerColor = blend(vBorderColor, vColor);\n              }\n              outColor = distInterp(vColor, outerColor, d - innerBorder);\n            }\n          }\n        }\n        else {\n          outColor = vColor;\n        }\n\n        ").concat(renderTarget.picking ? "if(outColor.a == 0.0) discard;\n             else outColor = vIndex;" : "", "\n      }\n    ");
            var program = createProgram(gl, vertexShaderSource, fragmentShaderSource);
            program.aPosition = gl.getAttribLocation(program, "aPosition");
            program.aIndex = gl.getAttribLocation(program, "aIndex");
            program.aVertType = gl.getAttribLocation(program, "aVertType");
            program.aTransform = gl.getAttribLocation(program, "aTransform");
            program.aAtlasId = gl.getAttribLocation(program, "aAtlasId");
            program.aTex = gl.getAttribLocation(program, "aTex");
            program.aPointAPointB = gl.getAttribLocation(program, "aPointAPointB");
            program.aPointCPointD = gl.getAttribLocation(program, "aPointCPointD");
            program.aLineWidth = gl.getAttribLocation(program, "aLineWidth");
            program.aColor = gl.getAttribLocation(program, "aColor");
            program.aCornerRadius = gl.getAttribLocation(program, "aCornerRadius");
            program.aBorderColor = gl.getAttribLocation(program, "aBorderColor");
            program.uPanZoomMatrix = gl.getUniformLocation(program, "uPanZoomMatrix");
            program.uAtlasSize = gl.getUniformLocation(program, "uAtlasSize");
            program.uBGColor = gl.getUniformLocation(program, "uBGColor");
            program.uZoom = gl.getUniformLocation(program, "uZoom");
            program.uTextures = [];
            for (var i2 = 0; i2 < this.batchManager.getMaxAtlasesPerBatch(); i2++) {
              program.uTextures.push(gl.getUniformLocation(program, "uTexture".concat(i2)));
            }
            return program;
          }, "_createShaderProgram")
        }, {
          key: "_createVAO",
          value: /* @__PURE__ */ __name(function _createVAO() {
            var unitSquare = [0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1];
            this.vertexCount = unitSquare.length / 2;
            var n2 = this.maxInstances;
            var gl = this.gl, program = this.program;
            var vao = gl.createVertexArray();
            gl.bindVertexArray(vao);
            createBufferStaticDraw(gl, "vec2", program.aPosition, unitSquare);
            this.transformBuffer = create3x3MatrixBufferDynamicDraw(gl, n2, program.aTransform);
            this.indexBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aIndex);
            this.vertTypeBuffer = createBufferDynamicDraw(gl, n2, "int", program.aVertType);
            this.atlasIdBuffer = createBufferDynamicDraw(gl, n2, "int", program.aAtlasId);
            this.texBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aTex);
            this.pointAPointBBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aPointAPointB);
            this.pointCPointDBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aPointCPointD);
            this.lineWidthBuffer = createBufferDynamicDraw(gl, n2, "vec2", program.aLineWidth);
            this.colorBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aColor);
            this.cornerRadiusBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aCornerRadius);
            this.borderColorBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aBorderColor);
            gl.bindVertexArray(null);
            return vao;
          }, "_createVAO")
        }, {
          key: "buffers",
          get: /* @__PURE__ */ __name(function get5() {
            var _this = this;
            if (!this._buffers) {
              this._buffers = Object.keys(this).filter(function(k2) {
                return endsWith(k2, "Buffer");
              }).map(function(k2) {
                return _this[k2];
              });
            }
            return this._buffers;
          }, "get")
        }, {
          key: "startFrame",
          value: /* @__PURE__ */ __name(function startFrame(panZoomMatrix) {
            var renderTarget = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : RENDER_TARGET.SCREEN;
            this.panZoomMatrix = panZoomMatrix;
            this.renderTarget = renderTarget;
            this.batchDebugInfo = [];
            this.wrappedCount = 0;
            this.simpleCount = 0;
            this.startBatch();
          }, "startFrame")
        }, {
          key: "startBatch",
          value: /* @__PURE__ */ __name(function startBatch2() {
            this.instanceCount = 0;
            this.batchManager.startBatch();
          }, "startBatch")
        }, {
          key: "endFrame",
          value: /* @__PURE__ */ __name(function endFrame() {
            this.endBatch();
          }, "endFrame")
        }, {
          key: "_isVisible",
          value: /* @__PURE__ */ __name(function _isVisible(ele, opts) {
            if (ele.visible()) {
              if (opts && opts.isVisible) {
                return opts.isVisible(ele);
              }
              return true;
            }
            return false;
          }, "_isVisible")
          /**
           * Draws a texture using the texture atlas.
           */
        }, {
          key: "drawTexture",
          value: /* @__PURE__ */ __name(function drawTexture(ele, eleIndex, type3) {
            var atlasManager = this.atlasManager, batchManager = this.batchManager;
            var opts = atlasManager.getRenderTypeOpts(type3);
            if (!this._isVisible(ele, opts)) {
              return;
            }
            if (ele.isEdge() && !this._isValidEdge(ele)) {
              return;
            }
            if (this.renderTarget.picking && opts.getTexPickingMode) {
              var mode = opts.getTexPickingMode(ele);
              if (mode === TEX_PICKING_MODE.IGNORE) {
                return;
              } else if (mode == TEX_PICKING_MODE.USE_BB) {
                this.drawPickingRectangle(ele, eleIndex, type3);
                return;
              }
            }
            var atlasInfoArray = atlasManager.getAtlasInfo(ele, type3);
            var _iterator = _createForOfIteratorHelper(atlasInfoArray), _step;
            try {
              for (_iterator.s(); !(_step = _iterator.n()).done; ) {
                var atlasInfo = _step.value;
                var atlas = atlasInfo.atlas, tex1 = atlasInfo.tex1, tex2 = atlasInfo.tex2;
                if (!batchManager.canAddToCurrentBatch(atlas)) {
                  this.endBatch();
                }
                var atlasIndex = batchManager.getAtlasIndexForBatch(atlas);
                for (var _i = 0, _arr = [[tex1, true], [tex2, false]]; _i < _arr.length; _i++) {
                  var _arr$_i = _slicedToArray(_arr[_i], 2), tex = _arr$_i[0], first3 = _arr$_i[1];
                  if (tex.w != 0) {
                    var instance2 = this.instanceCount;
                    this.vertTypeBuffer.getView(instance2)[0] = TEXTURE;
                    var indexView = this.indexBuffer.getView(instance2);
                    indexToVec4(eleIndex, indexView);
                    var atlasIdView = this.atlasIdBuffer.getView(instance2);
                    atlasIdView[0] = atlasIndex;
                    var texView = this.texBuffer.getView(instance2);
                    texView[0] = tex.x;
                    texView[1] = tex.y;
                    texView[2] = tex.w;
                    texView[3] = tex.h;
                    var matrixView = this.transformBuffer.getMatrixView(instance2);
                    this.setTransformMatrix(ele, matrixView, opts, atlasInfo, first3);
                    this.instanceCount++;
                    if (!first3) this.wrappedCount++;
                    if (this.instanceCount >= this.maxInstances) {
                      this.endBatch();
                    }
                  }
                }
              }
            } catch (err) {
              _iterator.e(err);
            } finally {
              _iterator.f();
            }
          }, "drawTexture")
          /**
           * matrix is expected to be a 9 element array
           * this function follows same pattern as CRp.drawCachedElementPortion(...)
           */
        }, {
          key: "setTransformMatrix",
          value: /* @__PURE__ */ __name(function setTransformMatrix(ele, matrix, opts, atlasInfo) {
            var first3 = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
            var padding2 = 0;
            if (opts.shapeProps && opts.shapeProps.padding) {
              padding2 = ele.pstyle(opts.shapeProps.padding).pfValue;
            }
            if (atlasInfo) {
              var bb = atlasInfo.bb, tex1 = atlasInfo.tex1, tex2 = atlasInfo.tex2;
              var ratio = tex1.w / (tex1.w + tex2.w);
              if (!first3) {
                ratio = 1 - ratio;
              }
              var adjBB = this._getAdjustedBB(bb, padding2, first3, ratio);
              this._applyTransformMatrix(matrix, adjBB, opts, ele);
            } else {
              var _bb = opts.getBoundingBox(ele);
              var _adjBB = this._getAdjustedBB(_bb, padding2, true, 1);
              this._applyTransformMatrix(matrix, _adjBB, opts, ele);
            }
          }, "setTransformMatrix")
        }, {
          key: "_applyTransformMatrix",
          value: /* @__PURE__ */ __name(function _applyTransformMatrix(matrix, adjBB, opts, ele) {
            var x5, y6;
            identity6(matrix);
            var theta = opts.getRotation ? opts.getRotation(ele) : 0;
            if (theta !== 0) {
              var _opts$getRotationPoin = opts.getRotationPoint(ele), sx = _opts$getRotationPoin.x, sy = _opts$getRotationPoin.y;
              translate(matrix, matrix, [sx, sy]);
              rotate(matrix, matrix, theta);
              var offset = opts.getRotationOffset(ele);
              x5 = offset.x + (adjBB.xOffset || 0);
              y6 = offset.y + (adjBB.yOffset || 0);
            } else {
              x5 = adjBB.x1;
              y6 = adjBB.y1;
            }
            translate(matrix, matrix, [x5, y6]);
            scale(matrix, matrix, [adjBB.w, adjBB.h]);
          }, "_applyTransformMatrix")
          /**
           * Adjusts a node or label BB to accomodate padding and split for wrapped textures.
           * @param bb - the original bounding box
           * @param padding - the padding to add to the bounding box
           * @param first - whether this is the first part of a wrapped texture
           * @param ratio - the ratio of the texture width of part of the text to the entire texture
           */
        }, {
          key: "_getAdjustedBB",
          value: /* @__PURE__ */ __name(function _getAdjustedBB(bb, padding2, first3, ratio) {
            var x1 = bb.x1, y1 = bb.y1, w4 = bb.w, h3 = bb.h, yOffset = bb.yOffset;
            if (padding2) {
              x1 -= padding2;
              y1 -= padding2;
              w4 += 2 * padding2;
              h3 += 2 * padding2;
            }
            var xOffset = 0;
            var adjW = w4 * ratio;
            if (first3 && ratio < 1) {
              w4 = adjW;
            } else if (!first3 && ratio < 1) {
              xOffset = w4 - adjW;
              x1 += xOffset;
              w4 = adjW;
            }
            return {
              x1,
              y1,
              w: w4,
              h: h3,
              xOffset,
              yOffset
            };
          }, "_getAdjustedBB")
          /**
           * Draw a solid opaque rectangle matching the element's Bounding Box.
           * Used by the PICKING mode to make the entire BB of a label clickable.
           */
        }, {
          key: "drawPickingRectangle",
          value: /* @__PURE__ */ __name(function drawPickingRectangle(ele, eleIndex, type3) {
            var opts = this.atlasManager.getRenderTypeOpts(type3);
            var instance2 = this.instanceCount;
            this.vertTypeBuffer.getView(instance2)[0] = RECTANGLE;
            var indexView = this.indexBuffer.getView(instance2);
            indexToVec4(eleIndex, indexView);
            var colorView = this.colorBuffer.getView(instance2);
            toWebGLColor([0, 0, 0], 1, colorView);
            var matrixView = this.transformBuffer.getMatrixView(instance2);
            this.setTransformMatrix(ele, matrixView, opts);
            this.simpleCount++;
            this.instanceCount++;
            if (this.instanceCount >= this.maxInstances) {
              this.endBatch();
            }
          }, "drawPickingRectangle")
          /**
           * Draw a node using either a texture or a "simple shape".
           */
        }, {
          key: "drawNode",
          value: /* @__PURE__ */ __name(function drawNode2(node2, eleIndex, type3) {
            var opts = this.simpleShapeOptions.get(type3);
            if (!this._isVisible(node2, opts)) {
              return;
            }
            var props = opts.shapeProps;
            var vertType = this._getVertTypeForShape(node2, props.shape);
            if (vertType === void 0 || opts.isSimple && !opts.isSimple(node2)) {
              this.drawTexture(node2, eleIndex, type3);
              return;
            }
            var instance2 = this.instanceCount;
            this.vertTypeBuffer.getView(instance2)[0] = vertType;
            if (vertType === ROUND_RECTANGLE || vertType === BOTTOM_ROUND_RECTANGLE) {
              var bb = opts.getBoundingBox(node2);
              var radius2 = this._getCornerRadius(node2, props.radius, bb);
              var radiusView = this.cornerRadiusBuffer.getView(instance2);
              radiusView[0] = radius2;
              radiusView[1] = radius2;
              radiusView[2] = radius2;
              radiusView[3] = radius2;
              if (vertType === BOTTOM_ROUND_RECTANGLE) {
                radiusView[0] = 0;
                radiusView[2] = 0;
              }
            }
            var indexView = this.indexBuffer.getView(instance2);
            indexToVec4(eleIndex, indexView);
            var color2 = node2.pstyle(props.color).value;
            var opacity = node2.pstyle(props.opacity).value;
            var colorView = this.colorBuffer.getView(instance2);
            toWebGLColor(color2, opacity, colorView);
            var lineWidthView = this.lineWidthBuffer.getView(instance2);
            lineWidthView[0] = 0;
            lineWidthView[1] = 0;
            if (props.border) {
              var borderWidth = node2.pstyle("border-width").value;
              if (borderWidth > 0) {
                var borderColor = node2.pstyle("border-color").value;
                var borderOpacity = node2.pstyle("border-opacity").value;
                var borderColorView = this.borderColorBuffer.getView(instance2);
                toWebGLColor(borderColor, borderOpacity, borderColorView);
                var borderPos = node2.pstyle("border-position").value;
                if (borderPos === "inside") {
                  lineWidthView[0] = 0;
                  lineWidthView[1] = -borderWidth;
                } else if (borderPos === "outside") {
                  lineWidthView[0] = borderWidth;
                  lineWidthView[1] = 0;
                } else {
                  var halfWidth = borderWidth / 2;
                  lineWidthView[0] = halfWidth;
                  lineWidthView[1] = -halfWidth;
                }
              }
            }
            var matrixView = this.transformBuffer.getMatrixView(instance2);
            this.setTransformMatrix(node2, matrixView, opts);
            this.simpleCount++;
            this.instanceCount++;
            if (this.instanceCount >= this.maxInstances) {
              this.endBatch();
            }
          }, "drawNode")
        }, {
          key: "_getVertTypeForShape",
          value: /* @__PURE__ */ __name(function _getVertTypeForShape(node2, shapeProp) {
            var shape = node2.pstyle(shapeProp).value;
            switch (shape) {
              case "rectangle":
                return RECTANGLE;
              case "ellipse":
                return ELLIPSE;
              case "roundrectangle":
              case "round-rectangle":
                return ROUND_RECTANGLE;
              case "bottom-round-rectangle":
                return BOTTOM_ROUND_RECTANGLE;
              default:
                return void 0;
            }
          }, "_getVertTypeForShape")
        }, {
          key: "_getCornerRadius",
          value: /* @__PURE__ */ __name(function _getCornerRadius(node2, radiusProp, _ref2) {
            var w4 = _ref2.w, h3 = _ref2.h;
            if (node2.pstyle(radiusProp).value === "auto") {
              return getRoundRectangleRadius(w4, h3);
            } else {
              var radius2 = node2.pstyle(radiusProp).pfValue;
              var halfWidth = w4 / 2;
              var halfHeight = h3 / 2;
              return Math.min(radius2, halfHeight, halfWidth);
            }
          }, "_getCornerRadius")
          /**
           * Only supports drawing triangles at the moment.
           */
        }, {
          key: "drawEdgeArrow",
          value: /* @__PURE__ */ __name(function drawEdgeArrow(edge, eleIndex, prefix) {
            if (!edge.visible()) {
              return;
            }
            var rs = edge._private.rscratch;
            var x5, y6, angle2;
            if (prefix === "source") {
              x5 = rs.arrowStartX;
              y6 = rs.arrowStartY;
              angle2 = rs.srcArrowAngle;
            } else {
              x5 = rs.arrowEndX;
              y6 = rs.arrowEndY;
              angle2 = rs.tgtArrowAngle;
            }
            if (isNaN(x5) || x5 == null || isNaN(y6) || y6 == null || isNaN(angle2) || angle2 == null) {
              return;
            }
            var arrowShape = edge.pstyle(prefix + "-arrow-shape").value;
            if (arrowShape === "none") {
              return;
            }
            var color2 = edge.pstyle(prefix + "-arrow-color").value;
            var baseOpacity = edge.pstyle("opacity").value;
            var lineOpacity = edge.pstyle("line-opacity").value;
            var opacity = baseOpacity * lineOpacity;
            var lineWidth = edge.pstyle("width").pfValue;
            var scale$1 = edge.pstyle("arrow-scale").value;
            var size4 = this.r.getArrowWidth(lineWidth, scale$1);
            var instance2 = this.instanceCount;
            var transform8 = this.transformBuffer.getMatrixView(instance2);
            identity6(transform8);
            translate(transform8, transform8, [x5, y6]);
            scale(transform8, transform8, [size4, size4]);
            rotate(transform8, transform8, angle2);
            this.vertTypeBuffer.getView(instance2)[0] = EDGE_ARROW;
            var indexView = this.indexBuffer.getView(instance2);
            indexToVec4(eleIndex, indexView);
            var colorView = this.colorBuffer.getView(instance2);
            toWebGLColor(color2, opacity, colorView);
            this.instanceCount++;
            if (this.instanceCount >= this.maxInstances) {
              this.endBatch();
            }
          }, "drawEdgeArrow")
          /**
           * Draw straight-line or bezier curve edges.
           */
        }, {
          key: "drawEdgeLine",
          value: /* @__PURE__ */ __name(function drawEdgeLine(edge, eleIndex) {
            if (!edge.visible()) {
              return;
            }
            var points = this._getEdgePoints(edge);
            if (!points) {
              return;
            }
            var baseOpacity = edge.pstyle("opacity").value;
            var lineOpacity = edge.pstyle("line-opacity").value;
            var width3 = edge.pstyle("width").pfValue;
            var color2 = edge.pstyle("line-color").value;
            var opacity = baseOpacity * lineOpacity;
            if (points.length / 2 + this.instanceCount > this.maxInstances) {
              this.endBatch();
            }
            if (points.length == 4) {
              var instance2 = this.instanceCount;
              this.vertTypeBuffer.getView(instance2)[0] = EDGE_STRAIGHT;
              var indexView = this.indexBuffer.getView(instance2);
              indexToVec4(eleIndex, indexView);
              var colorView = this.colorBuffer.getView(instance2);
              toWebGLColor(color2, opacity, colorView);
              var lineWidthBuffer = this.lineWidthBuffer.getView(instance2);
              lineWidthBuffer[0] = width3;
              var sourceTargetView = this.pointAPointBBuffer.getView(instance2);
              sourceTargetView[0] = points[0];
              sourceTargetView[1] = points[1];
              sourceTargetView[2] = points[2];
              sourceTargetView[3] = points[3];
              this.instanceCount++;
              if (this.instanceCount >= this.maxInstances) {
                this.endBatch();
              }
            } else {
              for (var i2 = 0; i2 < points.length - 2; i2 += 2) {
                var _instance = this.instanceCount;
                this.vertTypeBuffer.getView(_instance)[0] = EDGE_CURVE_SEGMENT;
                var _indexView = this.indexBuffer.getView(_instance);
                indexToVec4(eleIndex, _indexView);
                var _colorView = this.colorBuffer.getView(_instance);
                toWebGLColor(color2, opacity, _colorView);
                var _lineWidthBuffer = this.lineWidthBuffer.getView(_instance);
                _lineWidthBuffer[0] = width3;
                var pAx = points[i2 - 2], pAy = points[i2 - 1];
                var pBx = points[i2], pBy = points[i2 + 1];
                var pCx = points[i2 + 2], pCy = points[i2 + 3];
                var pDx = points[i2 + 4], pDy = points[i2 + 5];
                if (i2 == 0) {
                  pAx = 2 * pBx - pCx + 1e-3;
                  pAy = 2 * pBy - pCy + 1e-3;
                }
                if (i2 == points.length - 4) {
                  pDx = 2 * pCx - pBx + 1e-3;
                  pDy = 2 * pCy - pBy + 1e-3;
                }
                var pointABView = this.pointAPointBBuffer.getView(_instance);
                pointABView[0] = pAx;
                pointABView[1] = pAy;
                pointABView[2] = pBx;
                pointABView[3] = pBy;
                var pointCDView = this.pointCPointDBuffer.getView(_instance);
                pointCDView[0] = pCx;
                pointCDView[1] = pCy;
                pointCDView[2] = pDx;
                pointCDView[3] = pDy;
                this.instanceCount++;
                if (this.instanceCount >= this.maxInstances) {
                  this.endBatch();
                }
              }
            }
          }, "drawEdgeLine")
        }, {
          key: "_isValidEdge",
          value: /* @__PURE__ */ __name(function _isValidEdge(edge) {
            var rs = edge._private.rscratch;
            if (rs.badLine || rs.allpts == null || isNaN(rs.allpts[0])) {
              return false;
            }
            return true;
          }, "_isValidEdge")
        }, {
          key: "_getEdgePoints",
          value: /* @__PURE__ */ __name(function _getEdgePoints(edge) {
            var rs = edge._private.rscratch;
            if (!this._isValidEdge(edge)) {
              return;
            }
            var controlPoints4 = rs.allpts;
            if (controlPoints4.length == 4) {
              return controlPoints4;
            }
            var numSegments = this._getNumSegments(edge);
            return this._getCurveSegmentPoints(controlPoints4, numSegments);
          }, "_getEdgePoints")
        }, {
          key: "_getNumSegments",
          value: /* @__PURE__ */ __name(function _getNumSegments(edge) {
            var numSegments = 15;
            return Math.min(Math.max(numSegments, 5), this.maxInstances);
          }, "_getNumSegments")
        }, {
          key: "_getCurveSegmentPoints",
          value: /* @__PURE__ */ __name(function _getCurveSegmentPoints(controlPoints4, segments) {
            if (controlPoints4.length == 4) {
              return controlPoints4;
            }
            var curvePoints = Array((segments + 1) * 2);
            for (var i2 = 0; i2 <= segments; i2++) {
              if (i2 == 0) {
                curvePoints[0] = controlPoints4[0];
                curvePoints[1] = controlPoints4[1];
              } else if (i2 == segments) {
                curvePoints[i2 * 2] = controlPoints4[controlPoints4.length - 2];
                curvePoints[i2 * 2 + 1] = controlPoints4[controlPoints4.length - 1];
              } else {
                var t4 = i2 / segments;
                this._setCurvePoint(controlPoints4, t4, curvePoints, i2 * 2);
              }
            }
            return curvePoints;
          }, "_getCurveSegmentPoints")
        }, {
          key: "_setCurvePoint",
          value: /* @__PURE__ */ __name(function _setCurvePoint(points, t4, curvePoints, cpi) {
            if (points.length <= 2) {
              curvePoints[cpi] = points[0];
              curvePoints[cpi + 1] = points[1];
            } else {
              var newpoints = Array(points.length - 2);
              for (var i2 = 0; i2 < newpoints.length; i2 += 2) {
                var x5 = (1 - t4) * points[i2] + t4 * points[i2 + 2];
                var y6 = (1 - t4) * points[i2 + 1] + t4 * points[i2 + 3];
                newpoints[i2] = x5;
                newpoints[i2 + 1] = y6;
              }
              return this._setCurvePoint(newpoints, t4, curvePoints, cpi);
            }
          }, "_setCurvePoint")
        }, {
          key: "endBatch",
          value: /* @__PURE__ */ __name(function endBatch2() {
            var gl = this.gl, vao = this.vao, vertexCount = this.vertexCount, count2 = this.instanceCount;
            if (count2 === 0) return;
            var program = this.renderTarget.picking ? this.pickingProgram : this.program;
            gl.useProgram(program);
            gl.bindVertexArray(vao);
            var _iterator2 = _createForOfIteratorHelper(this.buffers), _step2;
            try {
              for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
                var buffer = _step2.value;
                buffer.bufferSubData(count2);
              }
            } catch (err) {
              _iterator2.e(err);
            } finally {
              _iterator2.f();
            }
            var atlases = this.batchManager.getAtlases();
            for (var i2 = 0; i2 < atlases.length; i2++) {
              atlases[i2].bufferIfNeeded(gl);
            }
            for (var _i2 = 0; _i2 < atlases.length; _i2++) {
              gl.activeTexture(gl.TEXTURE0 + _i2);
              gl.bindTexture(gl.TEXTURE_2D, atlases[_i2].texture);
              gl.uniform1i(program.uTextures[_i2], _i2);
            }
            gl.uniform1f(program.uZoom, getEffectiveZoom(this.r));
            gl.uniformMatrix3fv(program.uPanZoomMatrix, false, this.panZoomMatrix);
            gl.uniform1i(program.uAtlasSize, this.batchManager.getAtlasSize());
            var webglBgColor = toWebGLColor(this.bgColor, 1);
            gl.uniform4fv(program.uBGColor, webglBgColor);
            gl.drawArraysInstanced(gl.TRIANGLES, 0, vertexCount, count2);
            gl.bindVertexArray(null);
            gl.bindTexture(gl.TEXTURE_2D, null);
            if (this.debug) {
              this.batchDebugInfo.push({
                count: count2,
                // instance count
                atlasCount: atlases.length
              });
            }
            this.startBatch();
          }, "endBatch")
        }, {
          key: "getDebugInfo",
          value: /* @__PURE__ */ __name(function getDebugInfo() {
            var atlasInfo = this.atlasManager.getDebugInfo();
            var totalAtlases = atlasInfo.reduce(function(count2, info2) {
              return count2 + info2.atlasCount;
            }, 0);
            var batchInfo = this.batchDebugInfo;
            var totalInstances = batchInfo.reduce(function(count2, info2) {
              return count2 + info2.count;
            }, 0);
            return {
              atlasInfo,
              totalAtlases,
              wrappedCount: this.wrappedCount,
              simpleCount: this.simpleCount,
              batchCount: batchInfo.length,
              batchInfo,
              totalInstances
            };
          }, "getDebugInfo")
        }]);
      })();
      CRp$4 = {};
      CRp$4.initWebgl = function(opts, fns) {
        var r2 = this;
        var gl = r2.data.contexts[r2.WEBGL];
        opts.bgColor = getBGColor(r2);
        opts.webglTexSize = Math.min(opts.webglTexSize, gl.getParameter(gl.MAX_TEXTURE_SIZE));
        opts.webglTexRows = Math.min(opts.webglTexRows, 54);
        opts.webglTexRowsNodes = Math.min(opts.webglTexRowsNodes, 54);
        opts.webglBatchSize = Math.min(opts.webglBatchSize, 16384);
        opts.webglTexPerBatch = Math.min(opts.webglTexPerBatch, gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS));
        r2.webglDebug = opts.webglDebug;
        r2.webglDebugShowAtlases = opts.webglDebugShowAtlases;
        r2.pickingFrameBuffer = createPickingFrameBuffer(gl);
        r2.pickingFrameBuffer.needsDraw = true;
        r2.drawing = new ElementDrawingWebGL(r2, gl, opts);
        var getLabelRotation3 = /* @__PURE__ */ __name(function getLabelRotation4(prop) {
          return function(ele) {
            return r2.getTextAngle(ele, prop);
          };
        }, "getLabelRotation");
        var isLabelVisible = /* @__PURE__ */ __name(function isLabelVisible2(prop) {
          return function(ele) {
            var label = ele.pstyle(prop);
            return label && label.value;
          };
        }, "isLabelVisible");
        var isLayerVisible = /* @__PURE__ */ __name(function isLayerVisible2(prefix) {
          return function(node2) {
            return node2.pstyle("".concat(prefix, "-opacity")).value > 0;
          };
        }, "isLayerVisible");
        var getTexPickingMode = /* @__PURE__ */ __name(function getTexPickingMode2(ele) {
          var enabled = ele.pstyle("text-events").strValue === "yes";
          return enabled ? TEX_PICKING_MODE.USE_BB : TEX_PICKING_MODE.IGNORE;
        }, "getTexPickingMode");
        var getBBForSimpleShape = /* @__PURE__ */ __name(function getBBForSimpleShape2(node2) {
          var _node$position = node2.position(), x5 = _node$position.x, y6 = _node$position.y;
          var w4 = node2.outerWidth();
          var h3 = node2.outerHeight();
          return {
            w: w4,
            h: h3,
            x1: x5 - w4 / 2,
            y1: y6 - h3 / 2
          };
        }, "getBBForSimpleShape");
        r2.drawing.addAtlasCollection("node", {
          texRows: opts.webglTexRowsNodes
        });
        r2.drawing.addAtlasCollection("label", {
          texRows: opts.webglTexRows
        });
        r2.drawing.addTextureAtlasRenderType("node-body", {
          collection: "node",
          getKey: fns.getStyleKey,
          getBoundingBox: fns.getElementBox,
          drawElement: fns.drawElement
        });
        r2.drawing.addSimpleShapeRenderType("node-body", {
          getBoundingBox: getBBForSimpleShape,
          isSimple: isSimpleShape,
          shapeProps: {
            shape: "shape",
            color: "background-color",
            opacity: "background-opacity",
            radius: "corner-radius",
            border: true
          }
        });
        r2.drawing.addSimpleShapeRenderType("node-overlay", {
          getBoundingBox: getBBForSimpleShape,
          isVisible: isLayerVisible("overlay"),
          shapeProps: {
            shape: "overlay-shape",
            color: "overlay-color",
            opacity: "overlay-opacity",
            padding: "overlay-padding",
            radius: "overlay-corner-radius"
          }
        });
        r2.drawing.addSimpleShapeRenderType("node-underlay", {
          getBoundingBox: getBBForSimpleShape,
          isVisible: isLayerVisible("underlay"),
          shapeProps: {
            shape: "underlay-shape",
            color: "underlay-color",
            opacity: "underlay-opacity",
            padding: "underlay-padding",
            radius: "underlay-corner-radius"
          }
        });
        r2.drawing.addTextureAtlasRenderType("label", {
          // node label or edge mid label
          collection: "label",
          getTexPickingMode,
          getKey: getStyleKeysForLabel(fns.getLabelKey, null),
          getBoundingBox: getBoundingBoxForLabel(fns.getLabelBox, null),
          drawClipped: true,
          drawElement: fns.drawLabel,
          getRotation: getLabelRotation3(null),
          getRotationPoint: fns.getLabelRotationPoint,
          getRotationOffset: fns.getLabelRotationOffset,
          isVisible: isLabelVisible("label")
        });
        r2.drawing.addTextureAtlasRenderType("edge-source-label", {
          collection: "label",
          getTexPickingMode,
          getKey: getStyleKeysForLabel(fns.getSourceLabelKey, "source"),
          getBoundingBox: getBoundingBoxForLabel(fns.getSourceLabelBox, "source"),
          drawClipped: true,
          drawElement: fns.drawSourceLabel,
          getRotation: getLabelRotation3("source"),
          getRotationPoint: fns.getSourceLabelRotationPoint,
          getRotationOffset: fns.getSourceLabelRotationOffset,
          isVisible: isLabelVisible("source-label")
        });
        r2.drawing.addTextureAtlasRenderType("edge-target-label", {
          collection: "label",
          getTexPickingMode,
          getKey: getStyleKeysForLabel(fns.getTargetLabelKey, "target"),
          getBoundingBox: getBoundingBoxForLabel(fns.getTargetLabelBox, "target"),
          drawClipped: true,
          drawElement: fns.drawTargetLabel,
          getRotation: getLabelRotation3("target"),
          getRotationPoint: fns.getTargetLabelRotationPoint,
          getRotationOffset: fns.getTargetLabelRotationOffset,
          isVisible: isLabelVisible("target-label")
        });
        var setGCFlag = debounce(function() {
          console.log("garbage collect flag set");
          r2.data.gc = true;
        }, 1e4);
        r2.onUpdateEleCalcs(function(willDraw, eles) {
          var gcNeeded = false;
          if (eles && eles.length > 0) {
            gcNeeded |= r2.drawing.invalidate(eles);
          }
          if (gcNeeded) {
            setGCFlag();
          }
        });
        overrideCanvasRendererFunctions(r2);
      };
      __name(getBGColor, "getBGColor");
      __name(getLabelLines, "getLabelLines");
      getStyleKeysForLabel = /* @__PURE__ */ __name(function getStyleKeysForLabel2(getKey3, prefix) {
        return function(ele) {
          var key = getKey3(ele);
          var lines = getLabelLines(ele, prefix);
          if (lines.length > 1) {
            return lines.map(function(line2, index) {
              return "".concat(key, "_").concat(index);
            });
          }
          return key;
        };
      }, "getStyleKeysForLabel");
      getBoundingBoxForLabel = /* @__PURE__ */ __name(function getBoundingBoxForLabel2(getBoundingBox2, prefix) {
        return function(ele, styleKey) {
          var bb = getBoundingBox2(ele);
          if (typeof styleKey === "string") {
            var ui = styleKey.indexOf("_");
            if (ui > 0) {
              var lineIndex = Number(styleKey.substring(ui + 1));
              var lines = getLabelLines(ele, prefix);
              var h3 = bb.h / lines.length;
              var yOffset = h3 * lineIndex;
              var y1 = bb.y1 + yOffset;
              return {
                x1: bb.x1,
                w: bb.w,
                y1,
                h: h3,
                yOffset
              };
            }
          }
          return bb;
        };
      }, "getBoundingBoxForLabel");
      __name(overrideCanvasRendererFunctions, "overrideCanvasRendererFunctions");
      __name(clearWebgl, "clearWebgl");
      __name(clearCanvas, "clearCanvas");
      __name(createPanZoomMatrix, "createPanZoomMatrix");
      __name(setContextTransform, "setContextTransform");
      __name(drawSelectionRectangle, "drawSelectionRectangle");
      __name(drawAxes, "drawAxes");
      __name(drawAtlases, "drawAtlases");
      __name(getPickingIndexes, "getPickingIndexes");
      __name(findNearestElementsWebgl, "findNearestElementsWebgl");
      __name(drawEle, "drawEle");
      __name(renderWebgl, "renderWebgl");
      CRp$3 = {};
      CRp$3.drawPolygonPath = function(context, x5, y6, width3, height2, points) {
        var halfW = width3 / 2;
        var halfH = height2 / 2;
        if (context.beginPath) {
          context.beginPath();
        }
        context.moveTo(x5 + halfW * points[0], y6 + halfH * points[1]);
        for (var i2 = 1; i2 < points.length / 2; i2++) {
          context.lineTo(x5 + halfW * points[i2 * 2], y6 + halfH * points[i2 * 2 + 1]);
        }
        context.closePath();
      };
      CRp$3.drawRoundPolygonPath = function(context, x5, y6, width3, height2, points, corners) {
        corners.forEach(function(corner) {
          return drawPreparedRoundCorner(context, corner);
        });
        context.closePath();
      };
      CRp$3.drawRoundRectanglePath = function(context, x5, y6, width3, height2, radius2) {
        var halfWidth = width3 / 2;
        var halfHeight = height2 / 2;
        var cornerRadius = radius2 === "auto" ? getRoundRectangleRadius(width3, height2) : Math.min(radius2, halfHeight, halfWidth);
        if (context.beginPath) {
          context.beginPath();
        }
        context.moveTo(x5, y6 - halfHeight);
        context.arcTo(x5 + halfWidth, y6 - halfHeight, x5 + halfWidth, y6, cornerRadius);
        context.arcTo(x5 + halfWidth, y6 + halfHeight, x5, y6 + halfHeight, cornerRadius);
        context.arcTo(x5 - halfWidth, y6 + halfHeight, x5 - halfWidth, y6, cornerRadius);
        context.arcTo(x5 - halfWidth, y6 - halfHeight, x5, y6 - halfHeight, cornerRadius);
        context.lineTo(x5, y6 - halfHeight);
        context.closePath();
      };
      CRp$3.drawBottomRoundRectanglePath = function(context, x5, y6, width3, height2, radius2) {
        var halfWidth = width3 / 2;
        var halfHeight = height2 / 2;
        var cornerRadius = radius2 === "auto" ? getRoundRectangleRadius(width3, height2) : radius2;
        if (context.beginPath) {
          context.beginPath();
        }
        context.moveTo(x5, y6 - halfHeight);
        context.lineTo(x5 + halfWidth, y6 - halfHeight);
        context.lineTo(x5 + halfWidth, y6);
        context.arcTo(x5 + halfWidth, y6 + halfHeight, x5, y6 + halfHeight, cornerRadius);
        context.arcTo(x5 - halfWidth, y6 + halfHeight, x5 - halfWidth, y6, cornerRadius);
        context.lineTo(x5 - halfWidth, y6 - halfHeight);
        context.lineTo(x5, y6 - halfHeight);
        context.closePath();
      };
      CRp$3.drawCutRectanglePath = function(context, x5, y6, width3, height2, points, corners) {
        var halfWidth = width3 / 2;
        var halfHeight = height2 / 2;
        var cornerLength = corners === "auto" ? getCutRectangleCornerLength() : corners;
        if (context.beginPath) {
          context.beginPath();
        }
        context.moveTo(x5 - halfWidth + cornerLength, y6 - halfHeight);
        context.lineTo(x5 + halfWidth - cornerLength, y6 - halfHeight);
        context.lineTo(x5 + halfWidth, y6 - halfHeight + cornerLength);
        context.lineTo(x5 + halfWidth, y6 + halfHeight - cornerLength);
        context.lineTo(x5 + halfWidth - cornerLength, y6 + halfHeight);
        context.lineTo(x5 - halfWidth + cornerLength, y6 + halfHeight);
        context.lineTo(x5 - halfWidth, y6 + halfHeight - cornerLength);
        context.lineTo(x5 - halfWidth, y6 - halfHeight + cornerLength);
        context.closePath();
      };
      CRp$3.drawBarrelPath = function(context, x5, y6, width3, height2) {
        var halfWidth = width3 / 2;
        var halfHeight = height2 / 2;
        var xBegin = x5 - halfWidth;
        var xEnd = x5 + halfWidth;
        var yBegin = y6 - halfHeight;
        var yEnd = y6 + halfHeight;
        var barrelCurveConstants = getBarrelCurveConstants(width3, height2);
        var wOffset = barrelCurveConstants.widthOffset;
        var hOffset = barrelCurveConstants.heightOffset;
        var ctrlPtXOffset = barrelCurveConstants.ctrlPtOffsetPct * wOffset;
        if (context.beginPath) {
          context.beginPath();
        }
        context.moveTo(xBegin, yBegin + hOffset);
        context.lineTo(xBegin, yEnd - hOffset);
        context.quadraticCurveTo(xBegin + ctrlPtXOffset, yEnd, xBegin + wOffset, yEnd);
        context.lineTo(xEnd - wOffset, yEnd);
        context.quadraticCurveTo(xEnd - ctrlPtXOffset, yEnd, xEnd, yEnd - hOffset);
        context.lineTo(xEnd, yBegin + hOffset);
        context.quadraticCurveTo(xEnd - ctrlPtXOffset, yBegin, xEnd - wOffset, yBegin);
        context.lineTo(xBegin + wOffset, yBegin);
        context.quadraticCurveTo(xBegin + ctrlPtXOffset, yBegin, xBegin, yBegin + hOffset);
        context.closePath();
      };
      sin0 = Math.sin(0);
      cos0 = Math.cos(0);
      sin2 = {};
      cos2 = {};
      ellipseStepSize = Math.PI / 40;
      for (i2 = 0 * Math.PI; i2 < 2 * Math.PI; i2 += ellipseStepSize) {
        sin2[i2] = Math.sin(i2);
        cos2[i2] = Math.cos(i2);
      }
      CRp$3.drawEllipsePath = function(context, centerX, centerY, width3, height2) {
        if (context.beginPath) {
          context.beginPath();
        }
        if (context.ellipse) {
          context.ellipse(centerX, centerY, width3 / 2, height2 / 2, 0, 0, 2 * Math.PI);
        } else {
          var xPos, yPos;
          var rw = width3 / 2;
          var rh = height2 / 2;
          for (var i2 = 0 * Math.PI; i2 < 2 * Math.PI; i2 += ellipseStepSize) {
            xPos = centerX - rw * sin2[i2] * sin0 + rw * cos2[i2] * cos0;
            yPos = centerY + rh * cos2[i2] * sin0 + rh * sin2[i2] * cos0;
            if (i2 === 0) {
              context.moveTo(xPos, yPos);
            } else {
              context.lineTo(xPos, yPos);
            }
          }
        }
        context.closePath();
      };
      CRp$2 = {};
      CRp$2.createBuffer = function(w4, h3) {
        var buffer = document.createElement("canvas");
        buffer.width = w4;
        buffer.height = h3;
        return [buffer, buffer.getContext("2d")];
      };
      CRp$2.bufferCanvasImage = function(options2) {
        var cy = this.cy;
        var eles = cy.mutableElements();
        var bb = eles.boundingBox();
        var ctrRect = this.findContainerClientCoords();
        var width3 = options2.full ? Math.ceil(bb.w) : ctrRect[2];
        var height2 = options2.full ? Math.ceil(bb.h) : ctrRect[3];
        var specdMaxDims = number$1(options2.maxWidth) || number$1(options2.maxHeight);
        var pxRatio = this.getPixelRatio();
        var scale3 = 1;
        if (options2.scale !== void 0) {
          width3 *= options2.scale;
          height2 *= options2.scale;
          scale3 = options2.scale;
        } else if (specdMaxDims) {
          var maxScaleW = Infinity;
          var maxScaleH = Infinity;
          if (number$1(options2.maxWidth)) {
            maxScaleW = scale3 * options2.maxWidth / width3;
          }
          if (number$1(options2.maxHeight)) {
            maxScaleH = scale3 * options2.maxHeight / height2;
          }
          scale3 = Math.min(maxScaleW, maxScaleH);
          width3 *= scale3;
          height2 *= scale3;
        }
        if (!specdMaxDims) {
          width3 *= pxRatio;
          height2 *= pxRatio;
          scale3 *= pxRatio;
        }
        var buffCanvas = document.createElement("canvas");
        buffCanvas.width = width3;
        buffCanvas.height = height2;
        buffCanvas.style.width = width3 + "px";
        buffCanvas.style.height = height2 + "px";
        var buffCxt = buffCanvas.getContext("2d");
        if (width3 > 0 && height2 > 0) {
          buffCxt.clearRect(0, 0, width3, height2);
          buffCxt.globalCompositeOperation = "source-over";
          var zsortedEles = this.getCachedZSortedEles();
          if (options2.full) {
            buffCxt.translate(-bb.x1 * scale3, -bb.y1 * scale3);
            buffCxt.scale(scale3, scale3);
            this.drawElements(buffCxt, zsortedEles);
            buffCxt.scale(1 / scale3, 1 / scale3);
            buffCxt.translate(bb.x1 * scale3, bb.y1 * scale3);
          } else {
            var pan2 = cy.pan();
            var translation = {
              x: pan2.x * scale3,
              y: pan2.y * scale3
            };
            scale3 *= cy.zoom();
            buffCxt.translate(translation.x, translation.y);
            buffCxt.scale(scale3, scale3);
            this.drawElements(buffCxt, zsortedEles);
            buffCxt.scale(1 / scale3, 1 / scale3);
            buffCxt.translate(-translation.x, -translation.y);
          }
          if (options2.bg) {
            buffCxt.globalCompositeOperation = "destination-over";
            buffCxt.fillStyle = options2.bg;
            buffCxt.rect(0, 0, width3, height2);
            buffCxt.fill();
          }
        }
        return buffCanvas;
      };
      __name(b64ToBlob, "b64ToBlob");
      __name(b64UriToB64, "b64UriToB64");
      __name(output, "output");
      CRp$2.png = function(options2) {
        return output(options2, this.bufferCanvasImage(options2), "image/png");
      };
      CRp$2.jpg = function(options2) {
        return output(options2, this.bufferCanvasImage(options2), "image/jpeg");
      };
      CRp$1 = {};
      CRp$1.nodeShapeImpl = function(name, context, centerX, centerY, width3, height2, points, corners) {
        switch (name) {
          case "ellipse":
            return this.drawEllipsePath(context, centerX, centerY, width3, height2);
          case "polygon":
            return this.drawPolygonPath(context, centerX, centerY, width3, height2, points);
          case "round-polygon":
            return this.drawRoundPolygonPath(context, centerX, centerY, width3, height2, points, corners);
          case "roundrectangle":
          case "round-rectangle":
            return this.drawRoundRectanglePath(context, centerX, centerY, width3, height2, corners);
          case "cutrectangle":
          case "cut-rectangle":
            return this.drawCutRectanglePath(context, centerX, centerY, width3, height2, points, corners);
          case "bottomroundrectangle":
          case "bottom-round-rectangle":
            return this.drawBottomRoundRectanglePath(context, centerX, centerY, width3, height2, corners);
          case "barrel":
            return this.drawBarrelPath(context, centerX, centerY, width3, height2);
        }
      };
      CR = CanvasRenderer;
      CRp = CanvasRenderer.prototype;
      CRp.CANVAS_LAYERS = 3;
      CRp.SELECT_BOX = 0;
      CRp.DRAG = 1;
      CRp.NODE = 2;
      CRp.WEBGL = 3;
      CRp.CANVAS_TYPES = ["2d", "2d", "2d", "webgl2"];
      CRp.BUFFER_COUNT = 3;
      CRp.TEXTURE_BUFFER = 0;
      CRp.MOTIONBLUR_BUFFER_NODE = 1;
      CRp.MOTIONBLUR_BUFFER_DRAG = 2;
      __name(CanvasRenderer, "CanvasRenderer");
      CRp.redrawHint = function(group2, bool2) {
        var r2 = this;
        switch (group2) {
          case "eles":
            r2.data.canvasNeedsRedraw[CRp.NODE] = bool2;
            break;
          case "drag":
            r2.data.canvasNeedsRedraw[CRp.DRAG] = bool2;
            break;
          case "select":
            r2.data.canvasNeedsRedraw[CRp.SELECT_BOX] = bool2;
            break;
          case "gc":
            r2.data.gc = true;
            break;
        }
      };
      pathsImpld = typeof Path2D !== "undefined";
      CRp.path2dEnabled = function(on3) {
        if (on3 === void 0) {
          return this.pathsEnabled;
        }
        this.pathsEnabled = on3 ? true : false;
      };
      CRp.usePaths = function() {
        return pathsImpld && this.pathsEnabled;
      };
      CRp.setImgSmoothing = function(context, bool2) {
        if (context.imageSmoothingEnabled != null) {
          context.imageSmoothingEnabled = bool2;
        } else {
          context.webkitImageSmoothingEnabled = bool2;
          context.mozImageSmoothingEnabled = bool2;
          context.msImageSmoothingEnabled = bool2;
        }
      };
      CRp.getImgSmoothing = function(context) {
        if (context.imageSmoothingEnabled != null) {
          return context.imageSmoothingEnabled;
        } else {
          return context.webkitImageSmoothingEnabled || context.mozImageSmoothingEnabled || context.msImageSmoothingEnabled;
        }
      };
      CRp.makeOffscreenCanvas = function(width3, height2) {
        var canvas;
        if ((typeof OffscreenCanvas === "undefined" ? "undefined" : _typeof(OffscreenCanvas)) !== "undefined") {
          canvas = new OffscreenCanvas(width3, height2);
        } else {
          var containerWindow = this.cy.window();
          var document2 = containerWindow.document;
          canvas = document2.createElement("canvas");
          canvas.width = width3;
          canvas.height = height2;
        }
        return canvas;
      };
      [CRp$b, CRp$a, CRp$9, CRp$8, CRp$7, CRp$6, CRp$5, CRp$4, CRp$3, CRp$2, CRp$1].forEach(function(props) {
        extend4(CRp, props);
      });
      renderer2 = [{
        name: "null",
        impl: NullRenderer
      }, {
        name: "base",
        impl: BR
      }, {
        name: "canvas",
        impl: CR
      }];
      incExts = [{
        type: "layout",
        extensions: layout4
      }, {
        type: "renderer",
        extensions: renderer2
      }];
      extensions = {};
      modules = {};
      __name(setExtension, "setExtension");
      __name(getExtension, "getExtension");
      __name(setModule, "setModule");
      __name(getModule, "getModule");
      extension2 = /* @__PURE__ */ __name(function extension3() {
        if (arguments.length === 2) {
          return getExtension.apply(null, arguments);
        } else if (arguments.length === 3) {
          return setExtension.apply(null, arguments);
        } else if (arguments.length === 4) {
          return getModule.apply(null, arguments);
        } else if (arguments.length === 5) {
          return setModule.apply(null, arguments);
        } else {
          error("Invalid extension access syntax");
        }
      }, "extension");
      Core.prototype.extension = extension2;
      incExts.forEach(function(group2) {
        group2.extensions.forEach(function(ext) {
          setExtension(group2.type, ext.name, ext.impl);
        });
      });
      _Stylesheet = /* @__PURE__ */ __name(function Stylesheet() {
        if (!(this instanceof _Stylesheet)) {
          return new _Stylesheet();
        }
        this.length = 0;
      }, "Stylesheet");
      sheetfn = _Stylesheet.prototype;
      sheetfn.instanceString = function() {
        return "stylesheet";
      };
      sheetfn.selector = function(selector) {
        var i2 = this.length++;
        this[i2] = {
          selector,
          properties: []
        };
        return this;
      };
      sheetfn.css = function(name, value2) {
        var i2 = this.length - 1;
        if (string(name)) {
          this[i2].properties.push({
            name,
            value: value2
          });
        } else if (plainObject(name)) {
          var map5 = name;
          var propNames = Object.keys(map5);
          for (var j3 = 0; j3 < propNames.length; j3++) {
            var key = propNames[j3];
            var mapVal = map5[key];
            if (mapVal == null) {
              continue;
            }
            var prop = _Style.properties[key] || _Style.properties[dash2camel(key)];
            if (prop == null) {
              continue;
            }
            var _name = prop.name;
            var _value = mapVal;
            this[i2].properties.push({
              name: _name,
              value: _value
            });
          }
        }
        return this;
      };
      sheetfn.style = sheetfn.css;
      sheetfn.generateStyle = function(cy) {
        var style3 = new _Style(cy);
        return this.appendToStyle(style3);
      };
      sheetfn.appendToStyle = function(style3) {
        for (var i2 = 0; i2 < this.length; i2++) {
          var context = this[i2];
          var selector = context.selector;
          var props = context.properties;
          style3.selector(selector);
          for (var j3 = 0; j3 < props.length; j3++) {
            var prop = props[j3];
            style3.css(prop.name, prop.value);
          }
        }
        return style3;
      };
      version2 = "3.33.1";
      cytoscape2 = /* @__PURE__ */ __name(function cytoscape3(options2) {
        if (options2 === void 0) {
          options2 = {};
        }
        if (plainObject(options2)) {
          return new Core(options2);
        } else if (string(options2)) {
          return extension2.apply(extension2, arguments);
        }
      }, "cytoscape");
      cytoscape2.use = function(ext) {
        var args = Array.prototype.slice.call(arguments, 1);
        args.unshift(cytoscape2);
        ext.apply(null, args);
        return this;
      };
      cytoscape2.warnings = function(bool2) {
        return warnings(bool2);
      };
      cytoscape2.version = version2;
      cytoscape2.stylesheet = cytoscape2.Stylesheet = _Stylesheet;
    }
  });

  // ../../node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.js
  var require_layout_base = __commonJS({
    "../../node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.js"(exports2, module2) {
      "use strict";
      (/* @__PURE__ */ __name((function webpackUniversalModuleDefinition(root3, factory) {
        if (typeof exports2 === "object" && typeof module2 === "object")
          module2.exports = factory();
        else if (typeof define === "function" && define.amd)
          define([], factory);
        else if (typeof exports2 === "object")
          exports2["layoutBase"] = factory();
        else
          root3["layoutBase"] = factory();
      }), "webpackUniversalModuleDefinition"))(exports2, function() {
        return (
          /******/
          (function(modules2) {
            var installedModules = {};
            function __webpack_require__(moduleId) {
              if (installedModules[moduleId]) {
                return installedModules[moduleId].exports;
              }
              var module3 = installedModules[moduleId] = {
                /******/
                i: moduleId,
                /******/
                l: false,
                /******/
                exports: {}
                /******/
              };
              modules2[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__);
              module3.l = true;
              return module3.exports;
            }
            __name(__webpack_require__, "__webpack_require__");
            __webpack_require__.m = modules2;
            __webpack_require__.c = installedModules;
            __webpack_require__.i = function(value2) {
              return value2;
            };
            __webpack_require__.d = function(exports3, name, getter) {
              if (!__webpack_require__.o(exports3, name)) {
                Object.defineProperty(exports3, name, {
                  /******/
                  configurable: false,
                  /******/
                  enumerable: true,
                  /******/
                  get: getter
                  /******/
                });
              }
            };
            __webpack_require__.n = function(module3) {
              var getter = module3 && module3.__esModule ? (
                /******/
                /* @__PURE__ */ __name(function getDefault() {
                  return module3["default"];
                }, "getDefault")
              ) : (
                /******/
                /* @__PURE__ */ __name(function getModuleExports() {
                  return module3;
                }, "getModuleExports")
              );
              __webpack_require__.d(getter, "a", getter);
              return getter;
            };
            __webpack_require__.o = function(object3, property2) {
              return Object.prototype.hasOwnProperty.call(object3, property2);
            };
            __webpack_require__.p = "";
            return __webpack_require__(__webpack_require__.s = 26);
          })([
            /* 0 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function LayoutConstants() {
              }
              __name(LayoutConstants, "LayoutConstants");
              LayoutConstants.QUALITY = 1;
              LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED = false;
              LayoutConstants.DEFAULT_INCREMENTAL = false;
              LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT = true;
              LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT = false;
              LayoutConstants.DEFAULT_ANIMATION_PERIOD = 50;
              LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES = false;
              LayoutConstants.DEFAULT_GRAPH_MARGIN = 15;
              LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = false;
              LayoutConstants.SIMPLE_NODE_SIZE = 40;
              LayoutConstants.SIMPLE_NODE_HALF_SIZE = LayoutConstants.SIMPLE_NODE_SIZE / 2;
              LayoutConstants.EMPTY_COMPOUND_NODE_SIZE = 40;
              LayoutConstants.MIN_EDGE_LENGTH = 1;
              LayoutConstants.WORLD_BOUNDARY = 1e6;
              LayoutConstants.INITIAL_WORLD_BOUNDARY = LayoutConstants.WORLD_BOUNDARY / 1e3;
              LayoutConstants.WORLD_CENTER_X = 1200;
              LayoutConstants.WORLD_CENTER_Y = 900;
              module3.exports = LayoutConstants;
            }),
            /* 1 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LGraphObject = __webpack_require__(2);
              var IGeometry = __webpack_require__(8);
              var IMath = __webpack_require__(9);
              function LEdge(source, target, vEdge) {
                LGraphObject.call(this, vEdge);
                this.isOverlapingSourceAndTarget = false;
                this.vGraphObject = vEdge;
                this.bendpoints = [];
                this.source = source;
                this.target = target;
              }
              __name(LEdge, "LEdge");
              LEdge.prototype = Object.create(LGraphObject.prototype);
              for (var prop in LGraphObject) {
                LEdge[prop] = LGraphObject[prop];
              }
              LEdge.prototype.getSource = function() {
                return this.source;
              };
              LEdge.prototype.getTarget = function() {
                return this.target;
              };
              LEdge.prototype.isInterGraph = function() {
                return this.isInterGraph;
              };
              LEdge.prototype.getLength = function() {
                return this.length;
              };
              LEdge.prototype.isOverlapingSourceAndTarget = function() {
                return this.isOverlapingSourceAndTarget;
              };
              LEdge.prototype.getBendpoints = function() {
                return this.bendpoints;
              };
              LEdge.prototype.getLca = function() {
                return this.lca;
              };
              LEdge.prototype.getSourceInLca = function() {
                return this.sourceInLca;
              };
              LEdge.prototype.getTargetInLca = function() {
                return this.targetInLca;
              };
              LEdge.prototype.getOtherEnd = function(node2) {
                if (this.source === node2) {
                  return this.target;
                } else if (this.target === node2) {
                  return this.source;
                } else {
                  throw "Node is not incident with this edge";
                }
              };
              LEdge.prototype.getOtherEndInGraph = function(node2, graph) {
                var otherEnd = this.getOtherEnd(node2);
                var root3 = graph.getGraphManager().getRoot();
                while (true) {
                  if (otherEnd.getOwner() == graph) {
                    return otherEnd;
                  }
                  if (otherEnd.getOwner() == root3) {
                    break;
                  }
                  otherEnd = otherEnd.getOwner().getParent();
                }
                return null;
              };
              LEdge.prototype.updateLength = function() {
                var clipPointCoordinates = new Array(4);
                this.isOverlapingSourceAndTarget = IGeometry.getIntersection(this.target.getRect(), this.source.getRect(), clipPointCoordinates);
                if (!this.isOverlapingSourceAndTarget) {
                  this.lengthX = clipPointCoordinates[0] - clipPointCoordinates[2];
                  this.lengthY = clipPointCoordinates[1] - clipPointCoordinates[3];
                  if (Math.abs(this.lengthX) < 1) {
                    this.lengthX = IMath.sign(this.lengthX);
                  }
                  if (Math.abs(this.lengthY) < 1) {
                    this.lengthY = IMath.sign(this.lengthY);
                  }
                  this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY);
                }
              };
              LEdge.prototype.updateLengthSimple = function() {
                this.lengthX = this.target.getCenterX() - this.source.getCenterX();
                this.lengthY = this.target.getCenterY() - this.source.getCenterY();
                if (Math.abs(this.lengthX) < 1) {
                  this.lengthX = IMath.sign(this.lengthX);
                }
                if (Math.abs(this.lengthY) < 1) {
                  this.lengthY = IMath.sign(this.lengthY);
                }
                this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY);
              };
              module3.exports = LEdge;
            }),
            /* 2 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function LGraphObject(vGraphObject) {
                this.vGraphObject = vGraphObject;
              }
              __name(LGraphObject, "LGraphObject");
              module3.exports = LGraphObject;
            }),
            /* 3 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LGraphObject = __webpack_require__(2);
              var Integer = __webpack_require__(10);
              var RectangleD = __webpack_require__(13);
              var LayoutConstants = __webpack_require__(0);
              var RandomSeed = __webpack_require__(16);
              var PointD = __webpack_require__(4);
              function LNode(gm, loc, size4, vNode) {
                if (size4 == null && vNode == null) {
                  vNode = loc;
                }
                LGraphObject.call(this, vNode);
                if (gm.graphManager != null) gm = gm.graphManager;
                this.estimatedSize = Integer.MIN_VALUE;
                this.inclusionTreeDepth = Integer.MAX_VALUE;
                this.vGraphObject = vNode;
                this.edges = [];
                this.graphManager = gm;
                if (size4 != null && loc != null) this.rect = new RectangleD(loc.x, loc.y, size4.width, size4.height);
                else this.rect = new RectangleD();
              }
              __name(LNode, "LNode");
              LNode.prototype = Object.create(LGraphObject.prototype);
              for (var prop in LGraphObject) {
                LNode[prop] = LGraphObject[prop];
              }
              LNode.prototype.getEdges = function() {
                return this.edges;
              };
              LNode.prototype.getChild = function() {
                return this.child;
              };
              LNode.prototype.getOwner = function() {
                return this.owner;
              };
              LNode.prototype.getWidth = function() {
                return this.rect.width;
              };
              LNode.prototype.setWidth = function(width3) {
                this.rect.width = width3;
              };
              LNode.prototype.getHeight = function() {
                return this.rect.height;
              };
              LNode.prototype.setHeight = function(height2) {
                this.rect.height = height2;
              };
              LNode.prototype.getCenterX = function() {
                return this.rect.x + this.rect.width / 2;
              };
              LNode.prototype.getCenterY = function() {
                return this.rect.y + this.rect.height / 2;
              };
              LNode.prototype.getCenter = function() {
                return new PointD(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2);
              };
              LNode.prototype.getLocation = function() {
                return new PointD(this.rect.x, this.rect.y);
              };
              LNode.prototype.getRect = function() {
                return this.rect;
              };
              LNode.prototype.getDiagonal = function() {
                return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height);
              };
              LNode.prototype.getHalfTheDiagonal = function() {
                return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2;
              };
              LNode.prototype.setRect = function(upperLeft, dimension) {
                this.rect.x = upperLeft.x;
                this.rect.y = upperLeft.y;
                this.rect.width = dimension.width;
                this.rect.height = dimension.height;
              };
              LNode.prototype.setCenter = function(cx, cy) {
                this.rect.x = cx - this.rect.width / 2;
                this.rect.y = cy - this.rect.height / 2;
              };
              LNode.prototype.setLocation = function(x5, y6) {
                this.rect.x = x5;
                this.rect.y = y6;
              };
              LNode.prototype.moveBy = function(dx, dy) {
                this.rect.x += dx;
                this.rect.y += dy;
              };
              LNode.prototype.getEdgeListToNode = function(to) {
                var edgeList2 = [];
                var edge;
                var self2 = this;
                self2.edges.forEach(function(edge2) {
                  if (edge2.target == to) {
                    if (edge2.source != self2) throw "Incorrect edge source!";
                    edgeList2.push(edge2);
                  }
                });
                return edgeList2;
              };
              LNode.prototype.getEdgesBetween = function(other) {
                var edgeList2 = [];
                var edge;
                var self2 = this;
                self2.edges.forEach(function(edge2) {
                  if (!(edge2.source == self2 || edge2.target == self2)) throw "Incorrect edge source and/or target";
                  if (edge2.target == other || edge2.source == other) {
                    edgeList2.push(edge2);
                  }
                });
                return edgeList2;
              };
              LNode.prototype.getNeighborsList = function() {
                var neighbors = /* @__PURE__ */ new Set();
                var self2 = this;
                self2.edges.forEach(function(edge) {
                  if (edge.source == self2) {
                    neighbors.add(edge.target);
                  } else {
                    if (edge.target != self2) {
                      throw "Incorrect incidency!";
                    }
                    neighbors.add(edge.source);
                  }
                });
                return neighbors;
              };
              LNode.prototype.withChildren = function() {
                var withNeighborsList = /* @__PURE__ */ new Set();
                var childNode;
                var children2;
                withNeighborsList.add(this);
                if (this.child != null) {
                  var nodes5 = this.child.getNodes();
                  for (var i2 = 0; i2 < nodes5.length; i2++) {
                    childNode = nodes5[i2];
                    children2 = childNode.withChildren();
                    children2.forEach(function(node2) {
                      withNeighborsList.add(node2);
                    });
                  }
                }
                return withNeighborsList;
              };
              LNode.prototype.getNoOfChildren = function() {
                var noOfChildren = 0;
                var childNode;
                if (this.child == null) {
                  noOfChildren = 1;
                } else {
                  var nodes5 = this.child.getNodes();
                  for (var i2 = 0; i2 < nodes5.length; i2++) {
                    childNode = nodes5[i2];
                    noOfChildren += childNode.getNoOfChildren();
                  }
                }
                if (noOfChildren == 0) {
                  noOfChildren = 1;
                }
                return noOfChildren;
              };
              LNode.prototype.getEstimatedSize = function() {
                if (this.estimatedSize == Integer.MIN_VALUE) {
                  throw "assert failed";
                }
                return this.estimatedSize;
              };
              LNode.prototype.calcEstimatedSize = function() {
                if (this.child == null) {
                  return this.estimatedSize = (this.rect.width + this.rect.height) / 2;
                } else {
                  this.estimatedSize = this.child.calcEstimatedSize();
                  this.rect.width = this.estimatedSize;
                  this.rect.height = this.estimatedSize;
                  return this.estimatedSize;
                }
              };
              LNode.prototype.scatter = function() {
                var randomCenterX;
                var randomCenterY;
                var minX = -LayoutConstants.INITIAL_WORLD_BOUNDARY;
                var maxX = LayoutConstants.INITIAL_WORLD_BOUNDARY;
                randomCenterX = LayoutConstants.WORLD_CENTER_X + RandomSeed.nextDouble() * (maxX - minX) + minX;
                var minY = -LayoutConstants.INITIAL_WORLD_BOUNDARY;
                var maxY = LayoutConstants.INITIAL_WORLD_BOUNDARY;
                randomCenterY = LayoutConstants.WORLD_CENTER_Y + RandomSeed.nextDouble() * (maxY - minY) + minY;
                this.rect.x = randomCenterX;
                this.rect.y = randomCenterY;
              };
              LNode.prototype.updateBounds = function() {
                if (this.getChild() == null) {
                  throw "assert failed";
                }
                if (this.getChild().getNodes().length != 0) {
                  var childGraph = this.getChild();
                  childGraph.updateBounds(true);
                  this.rect.x = childGraph.getLeft();
                  this.rect.y = childGraph.getTop();
                  this.setWidth(childGraph.getRight() - childGraph.getLeft());
                  this.setHeight(childGraph.getBottom() - childGraph.getTop());
                  if (LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS) {
                    var width3 = childGraph.getRight() - childGraph.getLeft();
                    var height2 = childGraph.getBottom() - childGraph.getTop();
                    if (this.labelWidth > width3) {
                      this.rect.x -= (this.labelWidth - width3) / 2;
                      this.setWidth(this.labelWidth);
                    }
                    if (this.labelHeight > height2) {
                      if (this.labelPos == "center") {
                        this.rect.y -= (this.labelHeight - height2) / 2;
                      } else if (this.labelPos == "top") {
                        this.rect.y -= this.labelHeight - height2;
                      }
                      this.setHeight(this.labelHeight);
                    }
                  }
                }
              };
              LNode.prototype.getInclusionTreeDepth = function() {
                if (this.inclusionTreeDepth == Integer.MAX_VALUE) {
                  throw "assert failed";
                }
                return this.inclusionTreeDepth;
              };
              LNode.prototype.transform = function(trans) {
                var left3 = this.rect.x;
                if (left3 > LayoutConstants.WORLD_BOUNDARY) {
                  left3 = LayoutConstants.WORLD_BOUNDARY;
                } else if (left3 < -LayoutConstants.WORLD_BOUNDARY) {
                  left3 = -LayoutConstants.WORLD_BOUNDARY;
                }
                var top2 = this.rect.y;
                if (top2 > LayoutConstants.WORLD_BOUNDARY) {
                  top2 = LayoutConstants.WORLD_BOUNDARY;
                } else if (top2 < -LayoutConstants.WORLD_BOUNDARY) {
                  top2 = -LayoutConstants.WORLD_BOUNDARY;
                }
                var leftTop = new PointD(left3, top2);
                var vLeftTop = trans.inverseTransformPoint(leftTop);
                this.setLocation(vLeftTop.x, vLeftTop.y);
              };
              LNode.prototype.getLeft = function() {
                return this.rect.x;
              };
              LNode.prototype.getRight = function() {
                return this.rect.x + this.rect.width;
              };
              LNode.prototype.getTop = function() {
                return this.rect.y;
              };
              LNode.prototype.getBottom = function() {
                return this.rect.y + this.rect.height;
              };
              LNode.prototype.getParent = function() {
                if (this.owner == null) {
                  return null;
                }
                return this.owner.getParent();
              };
              module3.exports = LNode;
            }),
            /* 4 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function PointD(x5, y6) {
                if (x5 == null && y6 == null) {
                  this.x = 0;
                  this.y = 0;
                } else {
                  this.x = x5;
                  this.y = y6;
                }
              }
              __name(PointD, "PointD");
              PointD.prototype.getX = function() {
                return this.x;
              };
              PointD.prototype.getY = function() {
                return this.y;
              };
              PointD.prototype.setX = function(x5) {
                this.x = x5;
              };
              PointD.prototype.setY = function(y6) {
                this.y = y6;
              };
              PointD.prototype.getDifference = function(pt) {
                return new DimensionD(this.x - pt.x, this.y - pt.y);
              };
              PointD.prototype.getCopy = function() {
                return new PointD(this.x, this.y);
              };
              PointD.prototype.translate = function(dim) {
                this.x += dim.width;
                this.y += dim.height;
                return this;
              };
              module3.exports = PointD;
            }),
            /* 5 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LGraphObject = __webpack_require__(2);
              var Integer = __webpack_require__(10);
              var LayoutConstants = __webpack_require__(0);
              var LGraphManager = __webpack_require__(6);
              var LNode = __webpack_require__(3);
              var LEdge = __webpack_require__(1);
              var RectangleD = __webpack_require__(13);
              var Point3 = __webpack_require__(12);
              var LinkedList = __webpack_require__(11);
              function LGraph(parent4, obj2, vGraph) {
                LGraphObject.call(this, vGraph);
                this.estimatedSize = Integer.MIN_VALUE;
                this.margin = LayoutConstants.DEFAULT_GRAPH_MARGIN;
                this.edges = [];
                this.nodes = [];
                this.isConnected = false;
                this.parent = parent4;
                if (obj2 != null && obj2 instanceof LGraphManager) {
                  this.graphManager = obj2;
                } else if (obj2 != null && obj2 instanceof Layout) {
                  this.graphManager = obj2.graphManager;
                }
              }
              __name(LGraph, "LGraph");
              LGraph.prototype = Object.create(LGraphObject.prototype);
              for (var prop in LGraphObject) {
                LGraph[prop] = LGraphObject[prop];
              }
              LGraph.prototype.getNodes = function() {
                return this.nodes;
              };
              LGraph.prototype.getEdges = function() {
                return this.edges;
              };
              LGraph.prototype.getGraphManager = function() {
                return this.graphManager;
              };
              LGraph.prototype.getParent = function() {
                return this.parent;
              };
              LGraph.prototype.getLeft = function() {
                return this.left;
              };
              LGraph.prototype.getRight = function() {
                return this.right;
              };
              LGraph.prototype.getTop = function() {
                return this.top;
              };
              LGraph.prototype.getBottom = function() {
                return this.bottom;
              };
              LGraph.prototype.isConnected = function() {
                return this.isConnected;
              };
              LGraph.prototype.add = function(obj1, sourceNode, targetNode) {
                if (sourceNode == null && targetNode == null) {
                  var newNode = obj1;
                  if (this.graphManager == null) {
                    throw "Graph has no graph mgr!";
                  }
                  if (this.getNodes().indexOf(newNode) > -1) {
                    throw "Node already in graph!";
                  }
                  newNode.owner = this;
                  this.getNodes().push(newNode);
                  return newNode;
                } else {
                  var newEdge = obj1;
                  if (!(this.getNodes().indexOf(sourceNode) > -1 && this.getNodes().indexOf(targetNode) > -1)) {
                    throw "Source or target not in graph!";
                  }
                  if (!(sourceNode.owner == targetNode.owner && sourceNode.owner == this)) {
                    throw "Both owners must be this graph!";
                  }
                  if (sourceNode.owner != targetNode.owner) {
                    return null;
                  }
                  newEdge.source = sourceNode;
                  newEdge.target = targetNode;
                  newEdge.isInterGraph = false;
                  this.getEdges().push(newEdge);
                  sourceNode.edges.push(newEdge);
                  if (targetNode != sourceNode) {
                    targetNode.edges.push(newEdge);
                  }
                  return newEdge;
                }
              };
              LGraph.prototype.remove = function(obj) {
                var node2 = obj;
                if (obj instanceof LNode) {
                  if (node2 == null) {
                    throw "Node is null!";
                  }
                  if (!(node2.owner != null && node2.owner == this)) {
                    throw "Owner graph is invalid!";
                  }
                  if (this.graphManager == null) {
                    throw "Owner graph manager is invalid!";
                  }
                  var edgesToBeRemoved = node2.edges.slice();
                  var edge;
                  var s2 = edgesToBeRemoved.length;
                  for (var i2 = 0; i2 < s2; i2++) {
                    edge = edgesToBeRemoved[i2];
                    if (edge.isInterGraph) {
                      this.graphManager.remove(edge);
                    } else {
                      edge.source.owner.remove(edge);
                    }
                  }
                  var index = this.nodes.indexOf(node2);
                  if (index == -1) {
                    throw "Node not in owner node list!";
                  }
                  this.nodes.splice(index, 1);
                } else if (obj instanceof LEdge) {
                  var edge = obj;
                  if (edge == null) {
                    throw "Edge is null!";
                  }
                  if (!(edge.source != null && edge.target != null)) {
                    throw "Source and/or target is null!";
                  }
                  if (!(edge.source.owner != null && edge.target.owner != null && edge.source.owner == this && edge.target.owner == this)) {
                    throw "Source and/or target owner is invalid!";
                  }
                  var sourceIndex = edge.source.edges.indexOf(edge);
                  var targetIndex = edge.target.edges.indexOf(edge);
                  if (!(sourceIndex > -1 && targetIndex > -1)) {
                    throw "Source and/or target doesn't know this edge!";
                  }
                  edge.source.edges.splice(sourceIndex, 1);
                  if (edge.target != edge.source) {
                    edge.target.edges.splice(targetIndex, 1);
                  }
                  var index = edge.source.owner.getEdges().indexOf(edge);
                  if (index == -1) {
                    throw "Not in owner's edge list!";
                  }
                  edge.source.owner.getEdges().splice(index, 1);
                }
              };
              LGraph.prototype.updateLeftTop = function() {
                var top2 = Integer.MAX_VALUE;
                var left3 = Integer.MAX_VALUE;
                var nodeTop;
                var nodeLeft;
                var margin;
                var nodes5 = this.getNodes();
                var s2 = nodes5.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  var lNode = nodes5[i2];
                  nodeTop = lNode.getTop();
                  nodeLeft = lNode.getLeft();
                  if (top2 > nodeTop) {
                    top2 = nodeTop;
                  }
                  if (left3 > nodeLeft) {
                    left3 = nodeLeft;
                  }
                }
                if (top2 == Integer.MAX_VALUE) {
                  return null;
                }
                if (nodes5[0].getParent().paddingLeft != void 0) {
                  margin = nodes5[0].getParent().paddingLeft;
                } else {
                  margin = this.margin;
                }
                this.left = left3 - margin;
                this.top = top2 - margin;
                return new Point3(this.left, this.top);
              };
              LGraph.prototype.updateBounds = function(recursive) {
                var left3 = Integer.MAX_VALUE;
                var right3 = -Integer.MAX_VALUE;
                var top2 = Integer.MAX_VALUE;
                var bottom2 = -Integer.MAX_VALUE;
                var nodeLeft;
                var nodeRight;
                var nodeTop;
                var nodeBottom;
                var margin;
                var nodes5 = this.nodes;
                var s2 = nodes5.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  var lNode = nodes5[i2];
                  if (recursive && lNode.child != null) {
                    lNode.updateBounds();
                  }
                  nodeLeft = lNode.getLeft();
                  nodeRight = lNode.getRight();
                  nodeTop = lNode.getTop();
                  nodeBottom = lNode.getBottom();
                  if (left3 > nodeLeft) {
                    left3 = nodeLeft;
                  }
                  if (right3 < nodeRight) {
                    right3 = nodeRight;
                  }
                  if (top2 > nodeTop) {
                    top2 = nodeTop;
                  }
                  if (bottom2 < nodeBottom) {
                    bottom2 = nodeBottom;
                  }
                }
                var boundingRect = new RectangleD(left3, top2, right3 - left3, bottom2 - top2);
                if (left3 == Integer.MAX_VALUE) {
                  this.left = this.parent.getLeft();
                  this.right = this.parent.getRight();
                  this.top = this.parent.getTop();
                  this.bottom = this.parent.getBottom();
                }
                if (nodes5[0].getParent().paddingLeft != void 0) {
                  margin = nodes5[0].getParent().paddingLeft;
                } else {
                  margin = this.margin;
                }
                this.left = boundingRect.x - margin;
                this.right = boundingRect.x + boundingRect.width + margin;
                this.top = boundingRect.y - margin;
                this.bottom = boundingRect.y + boundingRect.height + margin;
              };
              LGraph.calculateBounds = function(nodes5) {
                var left3 = Integer.MAX_VALUE;
                var right3 = -Integer.MAX_VALUE;
                var top2 = Integer.MAX_VALUE;
                var bottom2 = -Integer.MAX_VALUE;
                var nodeLeft;
                var nodeRight;
                var nodeTop;
                var nodeBottom;
                var s2 = nodes5.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  var lNode = nodes5[i2];
                  nodeLeft = lNode.getLeft();
                  nodeRight = lNode.getRight();
                  nodeTop = lNode.getTop();
                  nodeBottom = lNode.getBottom();
                  if (left3 > nodeLeft) {
                    left3 = nodeLeft;
                  }
                  if (right3 < nodeRight) {
                    right3 = nodeRight;
                  }
                  if (top2 > nodeTop) {
                    top2 = nodeTop;
                  }
                  if (bottom2 < nodeBottom) {
                    bottom2 = nodeBottom;
                  }
                }
                var boundingRect = new RectangleD(left3, top2, right3 - left3, bottom2 - top2);
                return boundingRect;
              };
              LGraph.prototype.getInclusionTreeDepth = function() {
                if (this == this.graphManager.getRoot()) {
                  return 1;
                } else {
                  return this.parent.getInclusionTreeDepth();
                }
              };
              LGraph.prototype.getEstimatedSize = function() {
                if (this.estimatedSize == Integer.MIN_VALUE) {
                  throw "assert failed";
                }
                return this.estimatedSize;
              };
              LGraph.prototype.calcEstimatedSize = function() {
                var size4 = 0;
                var nodes5 = this.nodes;
                var s2 = nodes5.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  var lNode = nodes5[i2];
                  size4 += lNode.calcEstimatedSize();
                }
                if (size4 == 0) {
                  this.estimatedSize = LayoutConstants.EMPTY_COMPOUND_NODE_SIZE;
                } else {
                  this.estimatedSize = size4 / Math.sqrt(this.nodes.length);
                }
                return this.estimatedSize;
              };
              LGraph.prototype.updateConnected = function() {
                var self2 = this;
                if (this.nodes.length == 0) {
                  this.isConnected = true;
                  return;
                }
                var queue = new LinkedList();
                var visited = /* @__PURE__ */ new Set();
                var currentNode = this.nodes[0];
                var neighborEdges;
                var currentNeighbor;
                var childrenOfNode = currentNode.withChildren();
                childrenOfNode.forEach(function(node2) {
                  queue.push(node2);
                  visited.add(node2);
                });
                while (queue.length !== 0) {
                  currentNode = queue.shift();
                  neighborEdges = currentNode.getEdges();
                  var size4 = neighborEdges.length;
                  for (var i2 = 0; i2 < size4; i2++) {
                    var neighborEdge = neighborEdges[i2];
                    currentNeighbor = neighborEdge.getOtherEndInGraph(currentNode, this);
                    if (currentNeighbor != null && !visited.has(currentNeighbor)) {
                      var childrenOfNeighbor = currentNeighbor.withChildren();
                      childrenOfNeighbor.forEach(function(node2) {
                        queue.push(node2);
                        visited.add(node2);
                      });
                    }
                  }
                }
                this.isConnected = false;
                if (visited.size >= this.nodes.length) {
                  var noOfVisitedInThisGraph = 0;
                  visited.forEach(function(visitedNode) {
                    if (visitedNode.owner == self2) {
                      noOfVisitedInThisGraph++;
                    }
                  });
                  if (noOfVisitedInThisGraph == this.nodes.length) {
                    this.isConnected = true;
                  }
                }
              };
              module3.exports = LGraph;
            }),
            /* 6 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LGraph;
              var LEdge = __webpack_require__(1);
              function LGraphManager(layout7) {
                LGraph = __webpack_require__(5);
                this.layout = layout7;
                this.graphs = [];
                this.edges = [];
              }
              __name(LGraphManager, "LGraphManager");
              LGraphManager.prototype.addRoot = function() {
                var ngraph = this.layout.newGraph();
                var nnode = this.layout.newNode(null);
                var root3 = this.add(ngraph, nnode);
                this.setRootGraph(root3);
                return this.rootGraph;
              };
              LGraphManager.prototype.add = function(newGraph, parentNode, newEdge, sourceNode, targetNode) {
                if (newEdge == null && sourceNode == null && targetNode == null) {
                  if (newGraph == null) {
                    throw "Graph is null!";
                  }
                  if (parentNode == null) {
                    throw "Parent node is null!";
                  }
                  if (this.graphs.indexOf(newGraph) > -1) {
                    throw "Graph already in this graph mgr!";
                  }
                  this.graphs.push(newGraph);
                  if (newGraph.parent != null) {
                    throw "Already has a parent!";
                  }
                  if (parentNode.child != null) {
                    throw "Already has a child!";
                  }
                  newGraph.parent = parentNode;
                  parentNode.child = newGraph;
                  return newGraph;
                } else {
                  targetNode = newEdge;
                  sourceNode = parentNode;
                  newEdge = newGraph;
                  var sourceGraph = sourceNode.getOwner();
                  var targetGraph = targetNode.getOwner();
                  if (!(sourceGraph != null && sourceGraph.getGraphManager() == this)) {
                    throw "Source not in this graph mgr!";
                  }
                  if (!(targetGraph != null && targetGraph.getGraphManager() == this)) {
                    throw "Target not in this graph mgr!";
                  }
                  if (sourceGraph == targetGraph) {
                    newEdge.isInterGraph = false;
                    return sourceGraph.add(newEdge, sourceNode, targetNode);
                  } else {
                    newEdge.isInterGraph = true;
                    newEdge.source = sourceNode;
                    newEdge.target = targetNode;
                    if (this.edges.indexOf(newEdge) > -1) {
                      throw "Edge already in inter-graph edge list!";
                    }
                    this.edges.push(newEdge);
                    if (!(newEdge.source != null && newEdge.target != null)) {
                      throw "Edge source and/or target is null!";
                    }
                    if (!(newEdge.source.edges.indexOf(newEdge) == -1 && newEdge.target.edges.indexOf(newEdge) == -1)) {
                      throw "Edge already in source and/or target incidency list!";
                    }
                    newEdge.source.edges.push(newEdge);
                    newEdge.target.edges.push(newEdge);
                    return newEdge;
                  }
                }
              };
              LGraphManager.prototype.remove = function(lObj) {
                if (lObj instanceof LGraph) {
                  var graph = lObj;
                  if (graph.getGraphManager() != this) {
                    throw "Graph not in this graph mgr";
                  }
                  if (!(graph == this.rootGraph || graph.parent != null && graph.parent.graphManager == this)) {
                    throw "Invalid parent node!";
                  }
                  var edgesToBeRemoved = [];
                  edgesToBeRemoved = edgesToBeRemoved.concat(graph.getEdges());
                  var edge;
                  var s2 = edgesToBeRemoved.length;
                  for (var i2 = 0; i2 < s2; i2++) {
                    edge = edgesToBeRemoved[i2];
                    graph.remove(edge);
                  }
                  var nodesToBeRemoved = [];
                  nodesToBeRemoved = nodesToBeRemoved.concat(graph.getNodes());
                  var node2;
                  s2 = nodesToBeRemoved.length;
                  for (var i2 = 0; i2 < s2; i2++) {
                    node2 = nodesToBeRemoved[i2];
                    graph.remove(node2);
                  }
                  if (graph == this.rootGraph) {
                    this.setRootGraph(null);
                  }
                  var index = this.graphs.indexOf(graph);
                  this.graphs.splice(index, 1);
                  graph.parent = null;
                } else if (lObj instanceof LEdge) {
                  edge = lObj;
                  if (edge == null) {
                    throw "Edge is null!";
                  }
                  if (!edge.isInterGraph) {
                    throw "Not an inter-graph edge!";
                  }
                  if (!(edge.source != null && edge.target != null)) {
                    throw "Source and/or target is null!";
                  }
                  if (!(edge.source.edges.indexOf(edge) != -1 && edge.target.edges.indexOf(edge) != -1)) {
                    throw "Source and/or target doesn't know this edge!";
                  }
                  var index = edge.source.edges.indexOf(edge);
                  edge.source.edges.splice(index, 1);
                  index = edge.target.edges.indexOf(edge);
                  edge.target.edges.splice(index, 1);
                  if (!(edge.source.owner != null && edge.source.owner.getGraphManager() != null)) {
                    throw "Edge owner graph or owner graph manager is null!";
                  }
                  if (edge.source.owner.getGraphManager().edges.indexOf(edge) == -1) {
                    throw "Not in owner graph manager's edge list!";
                  }
                  var index = edge.source.owner.getGraphManager().edges.indexOf(edge);
                  edge.source.owner.getGraphManager().edges.splice(index, 1);
                }
              };
              LGraphManager.prototype.updateBounds = function() {
                this.rootGraph.updateBounds(true);
              };
              LGraphManager.prototype.getGraphs = function() {
                return this.graphs;
              };
              LGraphManager.prototype.getAllNodes = function() {
                if (this.allNodes == null) {
                  var nodeList = [];
                  var graphs = this.getGraphs();
                  var s2 = graphs.length;
                  for (var i2 = 0; i2 < s2; i2++) {
                    nodeList = nodeList.concat(graphs[i2].getNodes());
                  }
                  this.allNodes = nodeList;
                }
                return this.allNodes;
              };
              LGraphManager.prototype.resetAllNodes = function() {
                this.allNodes = null;
              };
              LGraphManager.prototype.resetAllEdges = function() {
                this.allEdges = null;
              };
              LGraphManager.prototype.resetAllNodesToApplyGravitation = function() {
                this.allNodesToApplyGravitation = null;
              };
              LGraphManager.prototype.getAllEdges = function() {
                if (this.allEdges == null) {
                  var edgeList2 = [];
                  var graphs = this.getGraphs();
                  var s2 = graphs.length;
                  for (var i2 = 0; i2 < graphs.length; i2++) {
                    edgeList2 = edgeList2.concat(graphs[i2].getEdges());
                  }
                  edgeList2 = edgeList2.concat(this.edges);
                  this.allEdges = edgeList2;
                }
                return this.allEdges;
              };
              LGraphManager.prototype.getAllNodesToApplyGravitation = function() {
                return this.allNodesToApplyGravitation;
              };
              LGraphManager.prototype.setAllNodesToApplyGravitation = function(nodeList) {
                if (this.allNodesToApplyGravitation != null) {
                  throw "assert failed";
                }
                this.allNodesToApplyGravitation = nodeList;
              };
              LGraphManager.prototype.getRoot = function() {
                return this.rootGraph;
              };
              LGraphManager.prototype.setRootGraph = function(graph) {
                if (graph.getGraphManager() != this) {
                  throw "Root not in this graph mgr!";
                }
                this.rootGraph = graph;
                if (graph.parent == null) {
                  graph.parent = this.layout.newNode("Root node");
                }
              };
              LGraphManager.prototype.getLayout = function() {
                return this.layout;
              };
              LGraphManager.prototype.isOneAncestorOfOther = function(firstNode, secondNode) {
                if (!(firstNode != null && secondNode != null)) {
                  throw "assert failed";
                }
                if (firstNode == secondNode) {
                  return true;
                }
                var ownerGraph = firstNode.getOwner();
                var parentNode;
                do {
                  parentNode = ownerGraph.getParent();
                  if (parentNode == null) {
                    break;
                  }
                  if (parentNode == secondNode) {
                    return true;
                  }
                  ownerGraph = parentNode.getOwner();
                  if (ownerGraph == null) {
                    break;
                  }
                } while (true);
                ownerGraph = secondNode.getOwner();
                do {
                  parentNode = ownerGraph.getParent();
                  if (parentNode == null) {
                    break;
                  }
                  if (parentNode == firstNode) {
                    return true;
                  }
                  ownerGraph = parentNode.getOwner();
                  if (ownerGraph == null) {
                    break;
                  }
                } while (true);
                return false;
              };
              LGraphManager.prototype.calcLowestCommonAncestors = function() {
                var edge;
                var sourceNode;
                var targetNode;
                var sourceAncestorGraph;
                var targetAncestorGraph;
                var edges3 = this.getAllEdges();
                var s2 = edges3.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  edge = edges3[i2];
                  sourceNode = edge.source;
                  targetNode = edge.target;
                  edge.lca = null;
                  edge.sourceInLca = sourceNode;
                  edge.targetInLca = targetNode;
                  if (sourceNode == targetNode) {
                    edge.lca = sourceNode.getOwner();
                    continue;
                  }
                  sourceAncestorGraph = sourceNode.getOwner();
                  while (edge.lca == null) {
                    edge.targetInLca = targetNode;
                    targetAncestorGraph = targetNode.getOwner();
                    while (edge.lca == null) {
                      if (targetAncestorGraph == sourceAncestorGraph) {
                        edge.lca = targetAncestorGraph;
                        break;
                      }
                      if (targetAncestorGraph == this.rootGraph) {
                        break;
                      }
                      if (edge.lca != null) {
                        throw "assert failed";
                      }
                      edge.targetInLca = targetAncestorGraph.getParent();
                      targetAncestorGraph = edge.targetInLca.getOwner();
                    }
                    if (sourceAncestorGraph == this.rootGraph) {
                      break;
                    }
                    if (edge.lca == null) {
                      edge.sourceInLca = sourceAncestorGraph.getParent();
                      sourceAncestorGraph = edge.sourceInLca.getOwner();
                    }
                  }
                  if (edge.lca == null) {
                    throw "assert failed";
                  }
                }
              };
              LGraphManager.prototype.calcLowestCommonAncestor = function(firstNode, secondNode) {
                if (firstNode == secondNode) {
                  return firstNode.getOwner();
                }
                var firstOwnerGraph = firstNode.getOwner();
                do {
                  if (firstOwnerGraph == null) {
                    break;
                  }
                  var secondOwnerGraph = secondNode.getOwner();
                  do {
                    if (secondOwnerGraph == null) {
                      break;
                    }
                    if (secondOwnerGraph == firstOwnerGraph) {
                      return secondOwnerGraph;
                    }
                    secondOwnerGraph = secondOwnerGraph.getParent().getOwner();
                  } while (true);
                  firstOwnerGraph = firstOwnerGraph.getParent().getOwner();
                } while (true);
                return firstOwnerGraph;
              };
              LGraphManager.prototype.calcInclusionTreeDepths = function(graph, depth) {
                if (graph == null && depth == null) {
                  graph = this.rootGraph;
                  depth = 1;
                }
                var node2;
                var nodes5 = graph.getNodes();
                var s2 = nodes5.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  node2 = nodes5[i2];
                  node2.inclusionTreeDepth = depth;
                  if (node2.child != null) {
                    this.calcInclusionTreeDepths(node2.child, depth + 1);
                  }
                }
              };
              LGraphManager.prototype.includesInvalidEdge = function() {
                var edge;
                var s2 = this.edges.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  edge = this.edges[i2];
                  if (this.isOneAncestorOfOther(edge.source, edge.target)) {
                    return true;
                  }
                }
                return false;
              };
              module3.exports = LGraphManager;
            }),
            /* 7 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LayoutConstants = __webpack_require__(0);
              function FDLayoutConstants() {
              }
              __name(FDLayoutConstants, "FDLayoutConstants");
              for (var prop in LayoutConstants) {
                FDLayoutConstants[prop] = LayoutConstants[prop];
              }
              FDLayoutConstants.MAX_ITERATIONS = 2500;
              FDLayoutConstants.DEFAULT_EDGE_LENGTH = 50;
              FDLayoutConstants.DEFAULT_SPRING_STRENGTH = 0.45;
              FDLayoutConstants.DEFAULT_REPULSION_STRENGTH = 4500;
              FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = 0.4;
              FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1;
              FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8;
              FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5;
              FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = true;
              FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = true;
              FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = 0.3;
              FDLayoutConstants.COOLING_ADAPTATION_FACTOR = 0.33;
              FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT = 1e3;
              FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT = 5e3;
              FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100;
              FDLayoutConstants.MAX_NODE_DISPLACEMENT = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3;
              FDLayoutConstants.MIN_REPULSION_DIST = FDLayoutConstants.DEFAULT_EDGE_LENGTH / 10;
              FDLayoutConstants.CONVERGENCE_CHECK_PERIOD = 100;
              FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = 0.1;
              FDLayoutConstants.MIN_EDGE_LENGTH = 1;
              FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD = 10;
              module3.exports = FDLayoutConstants;
            }),
            /* 8 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var Point3 = __webpack_require__(12);
              function IGeometry() {
              }
              __name(IGeometry, "IGeometry");
              IGeometry.calcSeparationAmount = function(rectA, rectB, overlapAmount, separationBuffer) {
                if (!rectA.intersects(rectB)) {
                  throw "assert failed";
                }
                var directions = new Array(2);
                this.decideDirectionsForOverlappingNodes(rectA, rectB, directions);
                overlapAmount[0] = Math.min(rectA.getRight(), rectB.getRight()) - Math.max(rectA.x, rectB.x);
                overlapAmount[1] = Math.min(rectA.getBottom(), rectB.getBottom()) - Math.max(rectA.y, rectB.y);
                if (rectA.getX() <= rectB.getX() && rectA.getRight() >= rectB.getRight()) {
                  overlapAmount[0] += Math.min(rectB.getX() - rectA.getX(), rectA.getRight() - rectB.getRight());
                } else if (rectB.getX() <= rectA.getX() && rectB.getRight() >= rectA.getRight()) {
                  overlapAmount[0] += Math.min(rectA.getX() - rectB.getX(), rectB.getRight() - rectA.getRight());
                }
                if (rectA.getY() <= rectB.getY() && rectA.getBottom() >= rectB.getBottom()) {
                  overlapAmount[1] += Math.min(rectB.getY() - rectA.getY(), rectA.getBottom() - rectB.getBottom());
                } else if (rectB.getY() <= rectA.getY() && rectB.getBottom() >= rectA.getBottom()) {
                  overlapAmount[1] += Math.min(rectA.getY() - rectB.getY(), rectB.getBottom() - rectA.getBottom());
                }
                var slope = Math.abs((rectB.getCenterY() - rectA.getCenterY()) / (rectB.getCenterX() - rectA.getCenterX()));
                if (rectB.getCenterY() === rectA.getCenterY() && rectB.getCenterX() === rectA.getCenterX()) {
                  slope = 1;
                }
                var moveByY = slope * overlapAmount[0];
                var moveByX = overlapAmount[1] / slope;
                if (overlapAmount[0] < moveByX) {
                  moveByX = overlapAmount[0];
                } else {
                  moveByY = overlapAmount[1];
                }
                overlapAmount[0] = -1 * directions[0] * (moveByX / 2 + separationBuffer);
                overlapAmount[1] = -1 * directions[1] * (moveByY / 2 + separationBuffer);
              };
              IGeometry.decideDirectionsForOverlappingNodes = function(rectA, rectB, directions) {
                if (rectA.getCenterX() < rectB.getCenterX()) {
                  directions[0] = -1;
                } else {
                  directions[0] = 1;
                }
                if (rectA.getCenterY() < rectB.getCenterY()) {
                  directions[1] = -1;
                } else {
                  directions[1] = 1;
                }
              };
              IGeometry.getIntersection2 = function(rectA, rectB, result) {
                var p1x = rectA.getCenterX();
                var p1y = rectA.getCenterY();
                var p2x = rectB.getCenterX();
                var p2y = rectB.getCenterY();
                if (rectA.intersects(rectB)) {
                  result[0] = p1x;
                  result[1] = p1y;
                  result[2] = p2x;
                  result[3] = p2y;
                  return true;
                }
                var topLeftAx = rectA.getX();
                var topLeftAy = rectA.getY();
                var topRightAx = rectA.getRight();
                var bottomLeftAx = rectA.getX();
                var bottomLeftAy = rectA.getBottom();
                var bottomRightAx = rectA.getRight();
                var halfWidthA = rectA.getWidthHalf();
                var halfHeightA = rectA.getHeightHalf();
                var topLeftBx = rectB.getX();
                var topLeftBy = rectB.getY();
                var topRightBx = rectB.getRight();
                var bottomLeftBx = rectB.getX();
                var bottomLeftBy = rectB.getBottom();
                var bottomRightBx = rectB.getRight();
                var halfWidthB = rectB.getWidthHalf();
                var halfHeightB = rectB.getHeightHalf();
                var clipPointAFound = false;
                var clipPointBFound = false;
                if (p1x === p2x) {
                  if (p1y > p2y) {
                    result[0] = p1x;
                    result[1] = topLeftAy;
                    result[2] = p2x;
                    result[3] = bottomLeftBy;
                    return false;
                  } else if (p1y < p2y) {
                    result[0] = p1x;
                    result[1] = bottomLeftAy;
                    result[2] = p2x;
                    result[3] = topLeftBy;
                    return false;
                  } else {
                  }
                } else if (p1y === p2y) {
                  if (p1x > p2x) {
                    result[0] = topLeftAx;
                    result[1] = p1y;
                    result[2] = topRightBx;
                    result[3] = p2y;
                    return false;
                  } else if (p1x < p2x) {
                    result[0] = topRightAx;
                    result[1] = p1y;
                    result[2] = topLeftBx;
                    result[3] = p2y;
                    return false;
                  } else {
                  }
                } else {
                  var slopeA = rectA.height / rectA.width;
                  var slopeB = rectB.height / rectB.width;
                  var slopePrime = (p2y - p1y) / (p2x - p1x);
                  var cardinalDirectionA = void 0;
                  var cardinalDirectionB = void 0;
                  var tempPointAx = void 0;
                  var tempPointAy = void 0;
                  var tempPointBx = void 0;
                  var tempPointBy = void 0;
                  if (-slopeA === slopePrime) {
                    if (p1x > p2x) {
                      result[0] = bottomLeftAx;
                      result[1] = bottomLeftAy;
                      clipPointAFound = true;
                    } else {
                      result[0] = topRightAx;
                      result[1] = topLeftAy;
                      clipPointAFound = true;
                    }
                  } else if (slopeA === slopePrime) {
                    if (p1x > p2x) {
                      result[0] = topLeftAx;
                      result[1] = topLeftAy;
                      clipPointAFound = true;
                    } else {
                      result[0] = bottomRightAx;
                      result[1] = bottomLeftAy;
                      clipPointAFound = true;
                    }
                  }
                  if (-slopeB === slopePrime) {
                    if (p2x > p1x) {
                      result[2] = bottomLeftBx;
                      result[3] = bottomLeftBy;
                      clipPointBFound = true;
                    } else {
                      result[2] = topRightBx;
                      result[3] = topLeftBy;
                      clipPointBFound = true;
                    }
                  } else if (slopeB === slopePrime) {
                    if (p2x > p1x) {
                      result[2] = topLeftBx;
                      result[3] = topLeftBy;
                      clipPointBFound = true;
                    } else {
                      result[2] = bottomRightBx;
                      result[3] = bottomLeftBy;
                      clipPointBFound = true;
                    }
                  }
                  if (clipPointAFound && clipPointBFound) {
                    return false;
                  }
                  if (p1x > p2x) {
                    if (p1y > p2y) {
                      cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 4);
                      cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 2);
                    } else {
                      cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 3);
                      cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 1);
                    }
                  } else {
                    if (p1y > p2y) {
                      cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 1);
                      cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 3);
                    } else {
                      cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 2);
                      cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 4);
                    }
                  }
                  if (!clipPointAFound) {
                    switch (cardinalDirectionA) {
                      case 1:
                        tempPointAy = topLeftAy;
                        tempPointAx = p1x + -halfHeightA / slopePrime;
                        result[0] = tempPointAx;
                        result[1] = tempPointAy;
                        break;
                      case 2:
                        tempPointAx = bottomRightAx;
                        tempPointAy = p1y + halfWidthA * slopePrime;
                        result[0] = tempPointAx;
                        result[1] = tempPointAy;
                        break;
                      case 3:
                        tempPointAy = bottomLeftAy;
                        tempPointAx = p1x + halfHeightA / slopePrime;
                        result[0] = tempPointAx;
                        result[1] = tempPointAy;
                        break;
                      case 4:
                        tempPointAx = bottomLeftAx;
                        tempPointAy = p1y + -halfWidthA * slopePrime;
                        result[0] = tempPointAx;
                        result[1] = tempPointAy;
                        break;
                    }
                  }
                  if (!clipPointBFound) {
                    switch (cardinalDirectionB) {
                      case 1:
                        tempPointBy = topLeftBy;
                        tempPointBx = p2x + -halfHeightB / slopePrime;
                        result[2] = tempPointBx;
                        result[3] = tempPointBy;
                        break;
                      case 2:
                        tempPointBx = bottomRightBx;
                        tempPointBy = p2y + halfWidthB * slopePrime;
                        result[2] = tempPointBx;
                        result[3] = tempPointBy;
                        break;
                      case 3:
                        tempPointBy = bottomLeftBy;
                        tempPointBx = p2x + halfHeightB / slopePrime;
                        result[2] = tempPointBx;
                        result[3] = tempPointBy;
                        break;
                      case 4:
                        tempPointBx = bottomLeftBx;
                        tempPointBy = p2y + -halfWidthB * slopePrime;
                        result[2] = tempPointBx;
                        result[3] = tempPointBy;
                        break;
                    }
                  }
                }
                return false;
              };
              IGeometry.getCardinalDirection = function(slope, slopePrime, line2) {
                if (slope > slopePrime) {
                  return line2;
                } else {
                  return 1 + line2 % 4;
                }
              };
              IGeometry.getIntersection = function(s1, s2, f1, f2) {
                if (f2 == null) {
                  return this.getIntersection2(s1, s2, f1);
                }
                var x1 = s1.x;
                var y1 = s1.y;
                var x22 = s2.x;
                var y22 = s2.y;
                var x32 = f1.x;
                var y32 = f1.y;
                var x42 = f2.x;
                var y42 = f2.y;
                var x5 = void 0, y6 = void 0;
                var a1 = void 0, a2 = void 0, b1 = void 0, b22 = void 0, c1 = void 0, c22 = void 0;
                var denom = void 0;
                a1 = y22 - y1;
                b1 = x1 - x22;
                c1 = x22 * y1 - x1 * y22;
                a2 = y42 - y32;
                b22 = x32 - x42;
                c22 = x42 * y32 - x32 * y42;
                denom = a1 * b22 - a2 * b1;
                if (denom === 0) {
                  return null;
                }
                x5 = (b1 * c22 - b22 * c1) / denom;
                y6 = (a2 * c1 - a1 * c22) / denom;
                return new Point3(x5, y6);
              };
              IGeometry.angleOfVector = function(Cx, Cy, Nx, Ny) {
                var C_angle = void 0;
                if (Cx !== Nx) {
                  C_angle = Math.atan((Ny - Cy) / (Nx - Cx));
                  if (Nx < Cx) {
                    C_angle += Math.PI;
                  } else if (Ny < Cy) {
                    C_angle += this.TWO_PI;
                  }
                } else if (Ny < Cy) {
                  C_angle = this.ONE_AND_HALF_PI;
                } else {
                  C_angle = this.HALF_PI;
                }
                return C_angle;
              };
              IGeometry.doIntersect = function(p1, p22, p3, p4) {
                var a2 = p1.x;
                var b3 = p1.y;
                var c3 = p22.x;
                var d3 = p22.y;
                var p5 = p3.x;
                var q3 = p3.y;
                var r2 = p4.x;
                var s2 = p4.y;
                var det = (c3 - a2) * (s2 - q3) - (r2 - p5) * (d3 - b3);
                if (det === 0) {
                  return false;
                } else {
                  var lambda = ((s2 - q3) * (r2 - a2) + (p5 - r2) * (s2 - b3)) / det;
                  var gamma2 = ((b3 - d3) * (r2 - a2) + (c3 - a2) * (s2 - b3)) / det;
                  return 0 < lambda && lambda < 1 && 0 < gamma2 && gamma2 < 1;
                }
              };
              IGeometry.HALF_PI = 0.5 * Math.PI;
              IGeometry.ONE_AND_HALF_PI = 1.5 * Math.PI;
              IGeometry.TWO_PI = 2 * Math.PI;
              IGeometry.THREE_PI = 3 * Math.PI;
              module3.exports = IGeometry;
            }),
            /* 9 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function IMath() {
              }
              __name(IMath, "IMath");
              IMath.sign = function(value2) {
                if (value2 > 0) {
                  return 1;
                } else if (value2 < 0) {
                  return -1;
                } else {
                  return 0;
                }
              };
              IMath.floor = function(value2) {
                return value2 < 0 ? Math.ceil(value2) : Math.floor(value2);
              };
              IMath.ceil = function(value2) {
                return value2 < 0 ? Math.floor(value2) : Math.ceil(value2);
              };
              module3.exports = IMath;
            }),
            /* 10 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function Integer() {
              }
              __name(Integer, "Integer");
              Integer.MAX_VALUE = 2147483647;
              Integer.MIN_VALUE = -2147483648;
              module3.exports = Integer;
            }),
            /* 11 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var _createClass2 = /* @__PURE__ */ (function() {
                function defineProperties(target, props) {
                  for (var i2 = 0; i2 < props.length; i2++) {
                    var descriptor = props[i2];
                    descriptor.enumerable = descriptor.enumerable || false;
                    descriptor.configurable = true;
                    if ("value" in descriptor) descriptor.writable = true;
                    Object.defineProperty(target, descriptor.key, descriptor);
                  }
                }
                __name(defineProperties, "defineProperties");
                return function(Constructor, protoProps, staticProps) {
                  if (protoProps) defineProperties(Constructor.prototype, protoProps);
                  if (staticProps) defineProperties(Constructor, staticProps);
                  return Constructor;
                };
              })();
              function _classCallCheck2(instance2, Constructor) {
                if (!(instance2 instanceof Constructor)) {
                  throw new TypeError("Cannot call a class as a function");
                }
              }
              __name(_classCallCheck2, "_classCallCheck");
              var nodeFrom = /* @__PURE__ */ __name(function nodeFrom2(value2) {
                return { value: value2, next: null, prev: null };
              }, "nodeFrom");
              var add3 = /* @__PURE__ */ __name(function add4(prev2, node2, next3, list) {
                if (prev2 !== null) {
                  prev2.next = node2;
                } else {
                  list.head = node2;
                }
                if (next3 !== null) {
                  next3.prev = node2;
                } else {
                  list.tail = node2;
                }
                node2.prev = prev2;
                node2.next = next3;
                list.length++;
                return node2;
              }, "add");
              var _remove = /* @__PURE__ */ __name(function _remove2(node2, list) {
                var prev2 = node2.prev, next3 = node2.next;
                if (prev2 !== null) {
                  prev2.next = next3;
                } else {
                  list.head = next3;
                }
                if (next3 !== null) {
                  next3.prev = prev2;
                } else {
                  list.tail = prev2;
                }
                node2.prev = node2.next = null;
                list.length--;
                return node2;
              }, "_remove");
              var LinkedList = (function() {
                function LinkedList2(vals) {
                  var _this = this;
                  _classCallCheck2(this, LinkedList2);
                  this.length = 0;
                  this.head = null;
                  this.tail = null;
                  if (vals != null) {
                    vals.forEach(function(v3) {
                      return _this.push(v3);
                    });
                  }
                }
                __name(LinkedList2, "LinkedList");
                _createClass2(LinkedList2, [{
                  key: "size",
                  value: /* @__PURE__ */ __name(function size4() {
                    return this.length;
                  }, "size")
                }, {
                  key: "insertBefore",
                  value: /* @__PURE__ */ __name(function insertBefore(val, otherNode) {
                    return add3(otherNode.prev, nodeFrom(val), otherNode, this);
                  }, "insertBefore")
                }, {
                  key: "insertAfter",
                  value: /* @__PURE__ */ __name(function insertAfter(val, otherNode) {
                    return add3(otherNode, nodeFrom(val), otherNode.next, this);
                  }, "insertAfter")
                }, {
                  key: "insertNodeBefore",
                  value: /* @__PURE__ */ __name(function insertNodeBefore(newNode, otherNode) {
                    return add3(otherNode.prev, newNode, otherNode, this);
                  }, "insertNodeBefore")
                }, {
                  key: "insertNodeAfter",
                  value: /* @__PURE__ */ __name(function insertNodeAfter(newNode, otherNode) {
                    return add3(otherNode, newNode, otherNode.next, this);
                  }, "insertNodeAfter")
                }, {
                  key: "push",
                  value: /* @__PURE__ */ __name(function push3(val) {
                    return add3(this.tail, nodeFrom(val), null, this);
                  }, "push")
                }, {
                  key: "unshift",
                  value: /* @__PURE__ */ __name(function unshift(val) {
                    return add3(null, nodeFrom(val), this.head, this);
                  }, "unshift")
                }, {
                  key: "remove",
                  value: /* @__PURE__ */ __name(function remove3(node2) {
                    return _remove(node2, this);
                  }, "remove")
                }, {
                  key: "pop",
                  value: /* @__PURE__ */ __name(function pop() {
                    return _remove(this.tail, this).value;
                  }, "pop")
                }, {
                  key: "popNode",
                  value: /* @__PURE__ */ __name(function popNode() {
                    return _remove(this.tail, this);
                  }, "popNode")
                }, {
                  key: "shift",
                  value: /* @__PURE__ */ __name(function shift2() {
                    return _remove(this.head, this).value;
                  }, "shift")
                }, {
                  key: "shiftNode",
                  value: /* @__PURE__ */ __name(function shiftNode() {
                    return _remove(this.head, this);
                  }, "shiftNode")
                }, {
                  key: "get_object_at",
                  value: /* @__PURE__ */ __name(function get_object_at(index) {
                    if (index <= this.length()) {
                      var i2 = 1;
                      var current = this.head;
                      while (i2 < index) {
                        current = current.next;
                        i2++;
                      }
                      return current.value;
                    }
                  }, "get_object_at")
                }, {
                  key: "set_object_at",
                  value: /* @__PURE__ */ __name(function set_object_at(index, value2) {
                    if (index <= this.length()) {
                      var i2 = 1;
                      var current = this.head;
                      while (i2 < index) {
                        current = current.next;
                        i2++;
                      }
                      current.value = value2;
                    }
                  }, "set_object_at")
                }]);
                return LinkedList2;
              })();
              module3.exports = LinkedList;
            }),
            /* 12 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function Point3(x5, y6, p3) {
                this.x = null;
                this.y = null;
                if (x5 == null && y6 == null && p3 == null) {
                  this.x = 0;
                  this.y = 0;
                } else if (typeof x5 == "number" && typeof y6 == "number" && p3 == null) {
                  this.x = x5;
                  this.y = y6;
                } else if (x5.constructor.name == "Point" && y6 == null && p3 == null) {
                  p3 = x5;
                  this.x = p3.x;
                  this.y = p3.y;
                }
              }
              __name(Point3, "Point");
              Point3.prototype.getX = function() {
                return this.x;
              };
              Point3.prototype.getY = function() {
                return this.y;
              };
              Point3.prototype.getLocation = function() {
                return new Point3(this.x, this.y);
              };
              Point3.prototype.setLocation = function(x5, y6, p3) {
                if (x5.constructor.name == "Point" && y6 == null && p3 == null) {
                  p3 = x5;
                  this.setLocation(p3.x, p3.y);
                } else if (typeof x5 == "number" && typeof y6 == "number" && p3 == null) {
                  if (parseInt(x5) == x5 && parseInt(y6) == y6) {
                    this.move(x5, y6);
                  } else {
                    this.x = Math.floor(x5 + 0.5);
                    this.y = Math.floor(y6 + 0.5);
                  }
                }
              };
              Point3.prototype.move = function(x5, y6) {
                this.x = x5;
                this.y = y6;
              };
              Point3.prototype.translate = function(dx, dy) {
                this.x += dx;
                this.y += dy;
              };
              Point3.prototype.equals = function(obj) {
                if (obj.constructor.name == "Point") {
                  var pt = obj;
                  return this.x == pt.x && this.y == pt.y;
                }
                return this == obj;
              };
              Point3.prototype.toString = function() {
                return new Point3().constructor.name + "[x=" + this.x + ",y=" + this.y + "]";
              };
              module3.exports = Point3;
            }),
            /* 13 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function RectangleD(x5, y6, width3, height2) {
                this.x = 0;
                this.y = 0;
                this.width = 0;
                this.height = 0;
                if (x5 != null && y6 != null && width3 != null && height2 != null) {
                  this.x = x5;
                  this.y = y6;
                  this.width = width3;
                  this.height = height2;
                }
              }
              __name(RectangleD, "RectangleD");
              RectangleD.prototype.getX = function() {
                return this.x;
              };
              RectangleD.prototype.setX = function(x5) {
                this.x = x5;
              };
              RectangleD.prototype.getY = function() {
                return this.y;
              };
              RectangleD.prototype.setY = function(y6) {
                this.y = y6;
              };
              RectangleD.prototype.getWidth = function() {
                return this.width;
              };
              RectangleD.prototype.setWidth = function(width3) {
                this.width = width3;
              };
              RectangleD.prototype.getHeight = function() {
                return this.height;
              };
              RectangleD.prototype.setHeight = function(height2) {
                this.height = height2;
              };
              RectangleD.prototype.getRight = function() {
                return this.x + this.width;
              };
              RectangleD.prototype.getBottom = function() {
                return this.y + this.height;
              };
              RectangleD.prototype.intersects = function(a2) {
                if (this.getRight() < a2.x) {
                  return false;
                }
                if (this.getBottom() < a2.y) {
                  return false;
                }
                if (a2.getRight() < this.x) {
                  return false;
                }
                if (a2.getBottom() < this.y) {
                  return false;
                }
                return true;
              };
              RectangleD.prototype.getCenterX = function() {
                return this.x + this.width / 2;
              };
              RectangleD.prototype.getMinX = function() {
                return this.getX();
              };
              RectangleD.prototype.getMaxX = function() {
                return this.getX() + this.width;
              };
              RectangleD.prototype.getCenterY = function() {
                return this.y + this.height / 2;
              };
              RectangleD.prototype.getMinY = function() {
                return this.getY();
              };
              RectangleD.prototype.getMaxY = function() {
                return this.getY() + this.height;
              };
              RectangleD.prototype.getWidthHalf = function() {
                return this.width / 2;
              };
              RectangleD.prototype.getHeightHalf = function() {
                return this.height / 2;
              };
              module3.exports = RectangleD;
            }),
            /* 14 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
                return typeof obj;
              } : function(obj) {
                return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
              };
              function UniqueIDGeneretor() {
              }
              __name(UniqueIDGeneretor, "UniqueIDGeneretor");
              UniqueIDGeneretor.lastID = 0;
              UniqueIDGeneretor.createID = function(obj) {
                if (UniqueIDGeneretor.isPrimitive(obj)) {
                  return obj;
                }
                if (obj.uniqueID != null) {
                  return obj.uniqueID;
                }
                obj.uniqueID = UniqueIDGeneretor.getString();
                UniqueIDGeneretor.lastID++;
                return obj.uniqueID;
              };
              UniqueIDGeneretor.getString = function(id34) {
                if (id34 == null) id34 = UniqueIDGeneretor.lastID;
                return "Object#" + id34;
              };
              UniqueIDGeneretor.isPrimitive = function(arg) {
                var type3 = typeof arg === "undefined" ? "undefined" : _typeof2(arg);
                return arg == null || type3 != "object" && type3 != "function";
              };
              module3.exports = UniqueIDGeneretor;
            }),
            /* 15 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function _toConsumableArray2(arr) {
                if (Array.isArray(arr)) {
                  for (var i2 = 0, arr2 = Array(arr.length); i2 < arr.length; i2++) {
                    arr2[i2] = arr[i2];
                  }
                  return arr2;
                } else {
                  return Array.from(arr);
                }
              }
              __name(_toConsumableArray2, "_toConsumableArray");
              var LayoutConstants = __webpack_require__(0);
              var LGraphManager = __webpack_require__(6);
              var LNode = __webpack_require__(3);
              var LEdge = __webpack_require__(1);
              var LGraph = __webpack_require__(5);
              var PointD = __webpack_require__(4);
              var Transform2 = __webpack_require__(17);
              var Emitter4 = __webpack_require__(27);
              function Layout2(isRemoteUse) {
                Emitter4.call(this);
                this.layoutQuality = LayoutConstants.QUALITY;
                this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED;
                this.incremental = LayoutConstants.DEFAULT_INCREMENTAL;
                this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT;
                this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT;
                this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD;
                this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES;
                this.edgeToDummyNodes = /* @__PURE__ */ new Map();
                this.graphManager = new LGraphManager(this);
                this.isLayoutFinished = false;
                this.isSubLayout = false;
                this.isRemoteUse = false;
                if (isRemoteUse != null) {
                  this.isRemoteUse = isRemoteUse;
                }
              }
              __name(Layout2, "Layout");
              Layout2.RANDOM_SEED = 1;
              Layout2.prototype = Object.create(Emitter4.prototype);
              Layout2.prototype.getGraphManager = function() {
                return this.graphManager;
              };
              Layout2.prototype.getAllNodes = function() {
                return this.graphManager.getAllNodes();
              };
              Layout2.prototype.getAllEdges = function() {
                return this.graphManager.getAllEdges();
              };
              Layout2.prototype.getAllNodesToApplyGravitation = function() {
                return this.graphManager.getAllNodesToApplyGravitation();
              };
              Layout2.prototype.newGraphManager = function() {
                var gm = new LGraphManager(this);
                this.graphManager = gm;
                return gm;
              };
              Layout2.prototype.newGraph = function(vGraph) {
                return new LGraph(null, this.graphManager, vGraph);
              };
              Layout2.prototype.newNode = function(vNode) {
                return new LNode(this.graphManager, vNode);
              };
              Layout2.prototype.newEdge = function(vEdge) {
                return new LEdge(null, null, vEdge);
              };
              Layout2.prototype.checkLayoutSuccess = function() {
                return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge();
              };
              Layout2.prototype.runLayout = function() {
                this.isLayoutFinished = false;
                if (this.tilingPreLayout) {
                  this.tilingPreLayout();
                }
                this.initParameters();
                var isLayoutSuccessfull;
                if (this.checkLayoutSuccess()) {
                  isLayoutSuccessfull = false;
                } else {
                  isLayoutSuccessfull = this.layout();
                }
                if (LayoutConstants.ANIMATE === "during") {
                  return false;
                }
                if (isLayoutSuccessfull) {
                  if (!this.isSubLayout) {
                    this.doPostLayout();
                  }
                }
                if (this.tilingPostLayout) {
                  this.tilingPostLayout();
                }
                this.isLayoutFinished = true;
                return isLayoutSuccessfull;
              };
              Layout2.prototype.doPostLayout = function() {
                if (!this.incremental) {
                  this.transform();
                }
                this.update();
              };
              Layout2.prototype.update2 = function() {
                if (this.createBendsAsNeeded) {
                  this.createBendpointsFromDummyNodes();
                  this.graphManager.resetAllEdges();
                }
                if (!this.isRemoteUse) {
                  var edge;
                  var allEdges = this.graphManager.getAllEdges();
                  for (var i2 = 0; i2 < allEdges.length; i2++) {
                    edge = allEdges[i2];
                  }
                  var node2;
                  var nodes5 = this.graphManager.getRoot().getNodes();
                  for (var i2 = 0; i2 < nodes5.length; i2++) {
                    node2 = nodes5[i2];
                  }
                  this.update(this.graphManager.getRoot());
                }
              };
              Layout2.prototype.update = function(obj) {
                if (obj == null) {
                  this.update2();
                } else if (obj instanceof LNode) {
                  var node2 = obj;
                  if (node2.getChild() != null) {
                    var nodes5 = node2.getChild().getNodes();
                    for (var i2 = 0; i2 < nodes5.length; i2++) {
                      update(nodes5[i2]);
                    }
                  }
                  if (node2.vGraphObject != null) {
                    var vNode = node2.vGraphObject;
                    vNode.update(node2);
                  }
                } else if (obj instanceof LEdge) {
                  var edge = obj;
                  if (edge.vGraphObject != null) {
                    var vEdge = edge.vGraphObject;
                    vEdge.update(edge);
                  }
                } else if (obj instanceof LGraph) {
                  var graph = obj;
                  if (graph.vGraphObject != null) {
                    var vGraph = graph.vGraphObject;
                    vGraph.update(graph);
                  }
                }
              };
              Layout2.prototype.initParameters = function() {
                if (!this.isSubLayout) {
                  this.layoutQuality = LayoutConstants.QUALITY;
                  this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT;
                  this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD;
                  this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT;
                  this.incremental = LayoutConstants.DEFAULT_INCREMENTAL;
                  this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED;
                  this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES;
                }
                if (this.animationDuringLayout) {
                  this.animationOnLayout = false;
                }
              };
              Layout2.prototype.transform = function(newLeftTop) {
                if (newLeftTop == void 0) {
                  this.transform(new PointD(0, 0));
                } else {
                  var trans = new Transform2();
                  var leftTop = this.graphManager.getRoot().updateLeftTop();
                  if (leftTop != null) {
                    trans.setWorldOrgX(newLeftTop.x);
                    trans.setWorldOrgY(newLeftTop.y);
                    trans.setDeviceOrgX(leftTop.x);
                    trans.setDeviceOrgY(leftTop.y);
                    var nodes5 = this.getAllNodes();
                    var node2;
                    for (var i2 = 0; i2 < nodes5.length; i2++) {
                      node2 = nodes5[i2];
                      node2.transform(trans);
                    }
                  }
                }
              };
              Layout2.prototype.positionNodesRandomly = function(graph) {
                if (graph == void 0) {
                  this.positionNodesRandomly(this.getGraphManager().getRoot());
                  this.getGraphManager().getRoot().updateBounds(true);
                } else {
                  var lNode;
                  var childGraph;
                  var nodes5 = graph.getNodes();
                  for (var i2 = 0; i2 < nodes5.length; i2++) {
                    lNode = nodes5[i2];
                    childGraph = lNode.getChild();
                    if (childGraph == null) {
                      lNode.scatter();
                    } else if (childGraph.getNodes().length == 0) {
                      lNode.scatter();
                    } else {
                      this.positionNodesRandomly(childGraph);
                      lNode.updateBounds();
                    }
                  }
                }
              };
              Layout2.prototype.getFlatForest = function() {
                var flatForest = [];
                var isForest = true;
                var allNodes = this.graphManager.getRoot().getNodes();
                var isFlat = true;
                for (var i2 = 0; i2 < allNodes.length; i2++) {
                  if (allNodes[i2].getChild() != null) {
                    isFlat = false;
                  }
                }
                if (!isFlat) {
                  return flatForest;
                }
                var visited = /* @__PURE__ */ new Set();
                var toBeVisited = [];
                var parents3 = /* @__PURE__ */ new Map();
                var unProcessedNodes = [];
                unProcessedNodes = unProcessedNodes.concat(allNodes);
                while (unProcessedNodes.length > 0 && isForest) {
                  toBeVisited.push(unProcessedNodes[0]);
                  while (toBeVisited.length > 0 && isForest) {
                    var currentNode = toBeVisited[0];
                    toBeVisited.splice(0, 1);
                    visited.add(currentNode);
                    var neighborEdges = currentNode.getEdges();
                    for (var i2 = 0; i2 < neighborEdges.length; i2++) {
                      var currentNeighbor = neighborEdges[i2].getOtherEnd(currentNode);
                      if (parents3.get(currentNode) != currentNeighbor) {
                        if (!visited.has(currentNeighbor)) {
                          toBeVisited.push(currentNeighbor);
                          parents3.set(currentNeighbor, currentNode);
                        } else {
                          isForest = false;
                          break;
                        }
                      }
                    }
                  }
                  if (!isForest) {
                    flatForest = [];
                  } else {
                    var temp = [].concat(_toConsumableArray2(visited));
                    flatForest.push(temp);
                    for (var i2 = 0; i2 < temp.length; i2++) {
                      var value2 = temp[i2];
                      var index = unProcessedNodes.indexOf(value2);
                      if (index > -1) {
                        unProcessedNodes.splice(index, 1);
                      }
                    }
                    visited = /* @__PURE__ */ new Set();
                    parents3 = /* @__PURE__ */ new Map();
                  }
                }
                return flatForest;
              };
              Layout2.prototype.createDummyNodesForBendpoints = function(edge) {
                var dummyNodes = [];
                var prev2 = edge.source;
                var graph = this.graphManager.calcLowestCommonAncestor(edge.source, edge.target);
                for (var i2 = 0; i2 < edge.bendpoints.length; i2++) {
                  var dummyNode = this.newNode(null);
                  dummyNode.setRect(new Point(0, 0), new Dimension(1, 1));
                  graph.add(dummyNode);
                  var dummyEdge = this.newEdge(null);
                  this.graphManager.add(dummyEdge, prev2, dummyNode);
                  dummyNodes.add(dummyNode);
                  prev2 = dummyNode;
                }
                var dummyEdge = this.newEdge(null);
                this.graphManager.add(dummyEdge, prev2, edge.target);
                this.edgeToDummyNodes.set(edge, dummyNodes);
                if (edge.isInterGraph()) {
                  this.graphManager.remove(edge);
                } else {
                  graph.remove(edge);
                }
                return dummyNodes;
              };
              Layout2.prototype.createBendpointsFromDummyNodes = function() {
                var edges3 = [];
                edges3 = edges3.concat(this.graphManager.getAllEdges());
                edges3 = [].concat(_toConsumableArray2(this.edgeToDummyNodes.keys())).concat(edges3);
                for (var k2 = 0; k2 < edges3.length; k2++) {
                  var lEdge = edges3[k2];
                  if (lEdge.bendpoints.length > 0) {
                    var path4 = this.edgeToDummyNodes.get(lEdge);
                    for (var i2 = 0; i2 < path4.length; i2++) {
                      var dummyNode = path4[i2];
                      var p3 = new PointD(dummyNode.getCenterX(), dummyNode.getCenterY());
                      var ebp = lEdge.bendpoints.get(i2);
                      ebp.x = p3.x;
                      ebp.y = p3.y;
                      dummyNode.getOwner().remove(dummyNode);
                    }
                    this.graphManager.add(lEdge, lEdge.source, lEdge.target);
                  }
                }
              };
              Layout2.transform = function(sliderValue, defaultValue, minDiv, maxMul) {
                if (minDiv != void 0 && maxMul != void 0) {
                  var value2 = defaultValue;
                  if (sliderValue <= 50) {
                    var minValue = defaultValue / minDiv;
                    value2 -= (defaultValue - minValue) / 50 * (50 - sliderValue);
                  } else {
                    var maxValue = defaultValue * maxMul;
                    value2 += (maxValue - defaultValue) / 50 * (sliderValue - 50);
                  }
                  return value2;
                } else {
                  var a2, b3;
                  if (sliderValue <= 50) {
                    a2 = 9 * defaultValue / 500;
                    b3 = defaultValue / 10;
                  } else {
                    a2 = 9 * defaultValue / 50;
                    b3 = -8 * defaultValue;
                  }
                  return a2 * sliderValue + b3;
                }
              };
              Layout2.findCenterOfTree = function(nodes5) {
                var list = [];
                list = list.concat(nodes5);
                var removedNodes = [];
                var remainingDegrees = /* @__PURE__ */ new Map();
                var foundCenter = false;
                var centerNode = null;
                if (list.length == 1 || list.length == 2) {
                  foundCenter = true;
                  centerNode = list[0];
                }
                for (var i2 = 0; i2 < list.length; i2++) {
                  var node2 = list[i2];
                  var degree = node2.getNeighborsList().size;
                  remainingDegrees.set(node2, node2.getNeighborsList().size);
                  if (degree == 1) {
                    removedNodes.push(node2);
                  }
                }
                var tempList = [];
                tempList = tempList.concat(removedNodes);
                while (!foundCenter) {
                  var tempList2 = [];
                  tempList2 = tempList2.concat(tempList);
                  tempList = [];
                  for (var i2 = 0; i2 < list.length; i2++) {
                    var node2 = list[i2];
                    var index = list.indexOf(node2);
                    if (index >= 0) {
                      list.splice(index, 1);
                    }
                    var neighbours = node2.getNeighborsList();
                    neighbours.forEach(function(neighbour) {
                      if (removedNodes.indexOf(neighbour) < 0) {
                        var otherDegree = remainingDegrees.get(neighbour);
                        var newDegree = otherDegree - 1;
                        if (newDegree == 1) {
                          tempList.push(neighbour);
                        }
                        remainingDegrees.set(neighbour, newDegree);
                      }
                    });
                  }
                  removedNodes = removedNodes.concat(tempList);
                  if (list.length == 1 || list.length == 2) {
                    foundCenter = true;
                    centerNode = list[0];
                  }
                }
                return centerNode;
              };
              Layout2.prototype.setGraphManager = function(gm) {
                this.graphManager = gm;
              };
              module3.exports = Layout2;
            }),
            /* 16 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function RandomSeed() {
              }
              __name(RandomSeed, "RandomSeed");
              RandomSeed.seed = 1;
              RandomSeed.x = 0;
              RandomSeed.nextDouble = function() {
                RandomSeed.x = Math.sin(RandomSeed.seed++) * 1e4;
                return RandomSeed.x - Math.floor(RandomSeed.x);
              };
              module3.exports = RandomSeed;
            }),
            /* 17 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var PointD = __webpack_require__(4);
              function Transform2(x5, y6) {
                this.lworldOrgX = 0;
                this.lworldOrgY = 0;
                this.ldeviceOrgX = 0;
                this.ldeviceOrgY = 0;
                this.lworldExtX = 1;
                this.lworldExtY = 1;
                this.ldeviceExtX = 1;
                this.ldeviceExtY = 1;
              }
              __name(Transform2, "Transform");
              Transform2.prototype.getWorldOrgX = function() {
                return this.lworldOrgX;
              };
              Transform2.prototype.setWorldOrgX = function(wox) {
                this.lworldOrgX = wox;
              };
              Transform2.prototype.getWorldOrgY = function() {
                return this.lworldOrgY;
              };
              Transform2.prototype.setWorldOrgY = function(woy) {
                this.lworldOrgY = woy;
              };
              Transform2.prototype.getWorldExtX = function() {
                return this.lworldExtX;
              };
              Transform2.prototype.setWorldExtX = function(wex) {
                this.lworldExtX = wex;
              };
              Transform2.prototype.getWorldExtY = function() {
                return this.lworldExtY;
              };
              Transform2.prototype.setWorldExtY = function(wey) {
                this.lworldExtY = wey;
              };
              Transform2.prototype.getDeviceOrgX = function() {
                return this.ldeviceOrgX;
              };
              Transform2.prototype.setDeviceOrgX = function(dox) {
                this.ldeviceOrgX = dox;
              };
              Transform2.prototype.getDeviceOrgY = function() {
                return this.ldeviceOrgY;
              };
              Transform2.prototype.setDeviceOrgY = function(doy) {
                this.ldeviceOrgY = doy;
              };
              Transform2.prototype.getDeviceExtX = function() {
                return this.ldeviceExtX;
              };
              Transform2.prototype.setDeviceExtX = function(dex) {
                this.ldeviceExtX = dex;
              };
              Transform2.prototype.getDeviceExtY = function() {
                return this.ldeviceExtY;
              };
              Transform2.prototype.setDeviceExtY = function(dey) {
                this.ldeviceExtY = dey;
              };
              Transform2.prototype.transformX = function(x5) {
                var xDevice = 0;
                var worldExtX = this.lworldExtX;
                if (worldExtX != 0) {
                  xDevice = this.ldeviceOrgX + (x5 - this.lworldOrgX) * this.ldeviceExtX / worldExtX;
                }
                return xDevice;
              };
              Transform2.prototype.transformY = function(y6) {
                var yDevice = 0;
                var worldExtY = this.lworldExtY;
                if (worldExtY != 0) {
                  yDevice = this.ldeviceOrgY + (y6 - this.lworldOrgY) * this.ldeviceExtY / worldExtY;
                }
                return yDevice;
              };
              Transform2.prototype.inverseTransformX = function(x5) {
                var xWorld = 0;
                var deviceExtX = this.ldeviceExtX;
                if (deviceExtX != 0) {
                  xWorld = this.lworldOrgX + (x5 - this.ldeviceOrgX) * this.lworldExtX / deviceExtX;
                }
                return xWorld;
              };
              Transform2.prototype.inverseTransformY = function(y6) {
                var yWorld = 0;
                var deviceExtY = this.ldeviceExtY;
                if (deviceExtY != 0) {
                  yWorld = this.lworldOrgY + (y6 - this.ldeviceOrgY) * this.lworldExtY / deviceExtY;
                }
                return yWorld;
              };
              Transform2.prototype.inverseTransformPoint = function(inPoint) {
                var outPoint = new PointD(this.inverseTransformX(inPoint.x), this.inverseTransformY(inPoint.y));
                return outPoint;
              };
              module3.exports = Transform2;
            }),
            /* 18 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function _toConsumableArray2(arr) {
                if (Array.isArray(arr)) {
                  for (var i2 = 0, arr2 = Array(arr.length); i2 < arr.length; i2++) {
                    arr2[i2] = arr[i2];
                  }
                  return arr2;
                } else {
                  return Array.from(arr);
                }
              }
              __name(_toConsumableArray2, "_toConsumableArray");
              var Layout2 = __webpack_require__(15);
              var FDLayoutConstants = __webpack_require__(7);
              var LayoutConstants = __webpack_require__(0);
              var IGeometry = __webpack_require__(8);
              var IMath = __webpack_require__(9);
              function FDLayout() {
                Layout2.call(this);
                this.useSmartIdealEdgeLengthCalculation = FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION;
                this.idealEdgeLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH;
                this.springConstant = FDLayoutConstants.DEFAULT_SPRING_STRENGTH;
                this.repulsionConstant = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH;
                this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH;
                this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH;
                this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR;
                this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR;
                this.displacementThresholdPerNode = 3 * FDLayoutConstants.DEFAULT_EDGE_LENGTH / 100;
                this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL;
                this.initialCoolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL;
                this.totalDisplacement = 0;
                this.oldTotalDisplacement = 0;
                this.maxIterations = FDLayoutConstants.MAX_ITERATIONS;
              }
              __name(FDLayout, "FDLayout");
              FDLayout.prototype = Object.create(Layout2.prototype);
              for (var prop in Layout2) {
                FDLayout[prop] = Layout2[prop];
              }
              FDLayout.prototype.initParameters = function() {
                Layout2.prototype.initParameters.call(this, arguments);
                this.totalIterations = 0;
                this.notAnimatedIterations = 0;
                this.useFRGridVariant = FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION;
                this.grid = [];
              };
              FDLayout.prototype.calcIdealEdgeLengths = function() {
                var edge;
                var lcaDepth;
                var source;
                var target;
                var sizeOfSourceInLca;
                var sizeOfTargetInLca;
                var allEdges = this.getGraphManager().getAllEdges();
                for (var i2 = 0; i2 < allEdges.length; i2++) {
                  edge = allEdges[i2];
                  edge.idealLength = this.idealEdgeLength;
                  if (edge.isInterGraph) {
                    source = edge.getSource();
                    target = edge.getTarget();
                    sizeOfSourceInLca = edge.getSourceInLca().getEstimatedSize();
                    sizeOfTargetInLca = edge.getTargetInLca().getEstimatedSize();
                    if (this.useSmartIdealEdgeLengthCalculation) {
                      edge.idealLength += sizeOfSourceInLca + sizeOfTargetInLca - 2 * LayoutConstants.SIMPLE_NODE_SIZE;
                    }
                    lcaDepth = edge.getLca().getInclusionTreeDepth();
                    edge.idealLength += FDLayoutConstants.DEFAULT_EDGE_LENGTH * FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (source.getInclusionTreeDepth() + target.getInclusionTreeDepth() - 2 * lcaDepth);
                  }
                }
              };
              FDLayout.prototype.initSpringEmbedder = function() {
                var s2 = this.getAllNodes().length;
                if (this.incremental) {
                  if (s2 > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) {
                    this.coolingFactor = Math.max(this.coolingFactor * FDLayoutConstants.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (s2 - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * this.coolingFactor * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR));
                  }
                  this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL;
                } else {
                  if (s2 > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) {
                    this.coolingFactor = Math.max(FDLayoutConstants.COOLING_ADAPTATION_FACTOR, 1 - (s2 - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR));
                  } else {
                    this.coolingFactor = 1;
                  }
                  this.initialCoolingFactor = this.coolingFactor;
                  this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT;
                }
                this.maxIterations = Math.max(this.getAllNodes().length * 5, this.maxIterations);
                this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length;
                this.repulsionRange = this.calcRepulsionRange();
              };
              FDLayout.prototype.calcSpringForces = function() {
                var lEdges = this.getAllEdges();
                var edge;
                for (var i2 = 0; i2 < lEdges.length; i2++) {
                  edge = lEdges[i2];
                  this.calcSpringForce(edge, edge.idealLength);
                }
              };
              FDLayout.prototype.calcRepulsionForces = function() {
                var gridUpdateAllowed = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
                var forceToNodeSurroundingUpdate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
                var i2, j3;
                var nodeA, nodeB;
                var lNodes = this.getAllNodes();
                var processedNodeSet;
                if (this.useFRGridVariant) {
                  if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed) {
                    this.updateGrid();
                  }
                  processedNodeSet = /* @__PURE__ */ new Set();
                  for (i2 = 0; i2 < lNodes.length; i2++) {
                    nodeA = lNodes[i2];
                    this.calculateRepulsionForceOfANode(nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate);
                    processedNodeSet.add(nodeA);
                  }
                } else {
                  for (i2 = 0; i2 < lNodes.length; i2++) {
                    nodeA = lNodes[i2];
                    for (j3 = i2 + 1; j3 < lNodes.length; j3++) {
                      nodeB = lNodes[j3];
                      if (nodeA.getOwner() != nodeB.getOwner()) {
                        continue;
                      }
                      this.calcRepulsionForce(nodeA, nodeB);
                    }
                  }
                }
              };
              FDLayout.prototype.calcGravitationalForces = function() {
                var node2;
                var lNodes = this.getAllNodesToApplyGravitation();
                for (var i2 = 0; i2 < lNodes.length; i2++) {
                  node2 = lNodes[i2];
                  this.calcGravitationalForce(node2);
                }
              };
              FDLayout.prototype.moveNodes = function() {
                var lNodes = this.getAllNodes();
                var node2;
                for (var i2 = 0; i2 < lNodes.length; i2++) {
                  node2 = lNodes[i2];
                  node2.move();
                }
              };
              FDLayout.prototype.calcSpringForce = function(edge, idealLength) {
                var sourceNode = edge.getSource();
                var targetNode = edge.getTarget();
                var length2;
                var springForce;
                var springForceX;
                var springForceY;
                if (this.uniformLeafNodeSizes && sourceNode.getChild() == null && targetNode.getChild() == null) {
                  edge.updateLengthSimple();
                } else {
                  edge.updateLength();
                  if (edge.isOverlapingSourceAndTarget) {
                    return;
                  }
                }
                length2 = edge.getLength();
                if (length2 == 0) return;
                springForce = this.springConstant * (length2 - idealLength);
                springForceX = springForce * (edge.lengthX / length2);
                springForceY = springForce * (edge.lengthY / length2);
                sourceNode.springForceX += springForceX;
                sourceNode.springForceY += springForceY;
                targetNode.springForceX -= springForceX;
                targetNode.springForceY -= springForceY;
              };
              FDLayout.prototype.calcRepulsionForce = function(nodeA, nodeB) {
                var rectA = nodeA.getRect();
                var rectB = nodeB.getRect();
                var overlapAmount = new Array(2);
                var clipPoints = new Array(4);
                var distanceX;
                var distanceY;
                var distanceSquared;
                var distance3;
                var repulsionForce;
                var repulsionForceX;
                var repulsionForceY;
                if (rectA.intersects(rectB)) {
                  IGeometry.calcSeparationAmount(rectA, rectB, overlapAmount, FDLayoutConstants.DEFAULT_EDGE_LENGTH / 2);
                  repulsionForceX = 2 * overlapAmount[0];
                  repulsionForceY = 2 * overlapAmount[1];
                  var childrenConstant = nodeA.noOfChildren * nodeB.noOfChildren / (nodeA.noOfChildren + nodeB.noOfChildren);
                  nodeA.repulsionForceX -= childrenConstant * repulsionForceX;
                  nodeA.repulsionForceY -= childrenConstant * repulsionForceY;
                  nodeB.repulsionForceX += childrenConstant * repulsionForceX;
                  nodeB.repulsionForceY += childrenConstant * repulsionForceY;
                } else {
                  if (this.uniformLeafNodeSizes && nodeA.getChild() == null && nodeB.getChild() == null) {
                    distanceX = rectB.getCenterX() - rectA.getCenterX();
                    distanceY = rectB.getCenterY() - rectA.getCenterY();
                  } else {
                    IGeometry.getIntersection(rectA, rectB, clipPoints);
                    distanceX = clipPoints[2] - clipPoints[0];
                    distanceY = clipPoints[3] - clipPoints[1];
                  }
                  if (Math.abs(distanceX) < FDLayoutConstants.MIN_REPULSION_DIST) {
                    distanceX = IMath.sign(distanceX) * FDLayoutConstants.MIN_REPULSION_DIST;
                  }
                  if (Math.abs(distanceY) < FDLayoutConstants.MIN_REPULSION_DIST) {
                    distanceY = IMath.sign(distanceY) * FDLayoutConstants.MIN_REPULSION_DIST;
                  }
                  distanceSquared = distanceX * distanceX + distanceY * distanceY;
                  distance3 = Math.sqrt(distanceSquared);
                  repulsionForce = this.repulsionConstant * nodeA.noOfChildren * nodeB.noOfChildren / distanceSquared;
                  repulsionForceX = repulsionForce * distanceX / distance3;
                  repulsionForceY = repulsionForce * distanceY / distance3;
                  nodeA.repulsionForceX -= repulsionForceX;
                  nodeA.repulsionForceY -= repulsionForceY;
                  nodeB.repulsionForceX += repulsionForceX;
                  nodeB.repulsionForceY += repulsionForceY;
                }
              };
              FDLayout.prototype.calcGravitationalForce = function(node2) {
                var ownerGraph;
                var ownerCenterX;
                var ownerCenterY;
                var distanceX;
                var distanceY;
                var absDistanceX;
                var absDistanceY;
                var estimatedSize;
                ownerGraph = node2.getOwner();
                ownerCenterX = (ownerGraph.getRight() + ownerGraph.getLeft()) / 2;
                ownerCenterY = (ownerGraph.getTop() + ownerGraph.getBottom()) / 2;
                distanceX = node2.getCenterX() - ownerCenterX;
                distanceY = node2.getCenterY() - ownerCenterY;
                absDistanceX = Math.abs(distanceX) + node2.getWidth() / 2;
                absDistanceY = Math.abs(distanceY) + node2.getHeight() / 2;
                if (node2.getOwner() == this.graphManager.getRoot()) {
                  estimatedSize = ownerGraph.getEstimatedSize() * this.gravityRangeFactor;
                  if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) {
                    node2.gravitationForceX = -this.gravityConstant * distanceX;
                    node2.gravitationForceY = -this.gravityConstant * distanceY;
                  }
                } else {
                  estimatedSize = ownerGraph.getEstimatedSize() * this.compoundGravityRangeFactor;
                  if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) {
                    node2.gravitationForceX = -this.gravityConstant * distanceX * this.compoundGravityConstant;
                    node2.gravitationForceY = -this.gravityConstant * distanceY * this.compoundGravityConstant;
                  }
                }
              };
              FDLayout.prototype.isConverged = function() {
                var converged;
                var oscilating = false;
                if (this.totalIterations > this.maxIterations / 3) {
                  oscilating = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2;
                }
                converged = this.totalDisplacement < this.totalDisplacementThreshold;
                this.oldTotalDisplacement = this.totalDisplacement;
                return converged || oscilating;
              };
              FDLayout.prototype.animate = function() {
                if (this.animationDuringLayout && !this.isSubLayout) {
                  if (this.notAnimatedIterations == this.animationPeriod) {
                    this.update();
                    this.notAnimatedIterations = 0;
                  } else {
                    this.notAnimatedIterations++;
                  }
                }
              };
              FDLayout.prototype.calcNoOfChildrenForAllNodes = function() {
                var node2;
                var allNodes = this.graphManager.getAllNodes();
                for (var i2 = 0; i2 < allNodes.length; i2++) {
                  node2 = allNodes[i2];
                  node2.noOfChildren = node2.getNoOfChildren();
                }
              };
              FDLayout.prototype.calcGrid = function(graph) {
                var sizeX = 0;
                var sizeY = 0;
                sizeX = parseInt(Math.ceil((graph.getRight() - graph.getLeft()) / this.repulsionRange));
                sizeY = parseInt(Math.ceil((graph.getBottom() - graph.getTop()) / this.repulsionRange));
                var grid = new Array(sizeX);
                for (var i2 = 0; i2 < sizeX; i2++) {
                  grid[i2] = new Array(sizeY);
                }
                for (var i2 = 0; i2 < sizeX; i2++) {
                  for (var j3 = 0; j3 < sizeY; j3++) {
                    grid[i2][j3] = new Array();
                  }
                }
                return grid;
              };
              FDLayout.prototype.addNodeToGrid = function(v3, left3, top2) {
                var startX2 = 0;
                var finishX = 0;
                var startY2 = 0;
                var finishY = 0;
                startX2 = parseInt(Math.floor((v3.getRect().x - left3) / this.repulsionRange));
                finishX = parseInt(Math.floor((v3.getRect().width + v3.getRect().x - left3) / this.repulsionRange));
                startY2 = parseInt(Math.floor((v3.getRect().y - top2) / this.repulsionRange));
                finishY = parseInt(Math.floor((v3.getRect().height + v3.getRect().y - top2) / this.repulsionRange));
                for (var i2 = startX2; i2 <= finishX; i2++) {
                  for (var j3 = startY2; j3 <= finishY; j3++) {
                    this.grid[i2][j3].push(v3);
                    v3.setGridCoordinates(startX2, finishX, startY2, finishY);
                  }
                }
              };
              FDLayout.prototype.updateGrid = function() {
                var i2;
                var nodeA;
                var lNodes = this.getAllNodes();
                this.grid = this.calcGrid(this.graphManager.getRoot());
                for (i2 = 0; i2 < lNodes.length; i2++) {
                  nodeA = lNodes[i2];
                  this.addNodeToGrid(nodeA, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop());
                }
              };
              FDLayout.prototype.calculateRepulsionForceOfANode = function(nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate) {
                if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed || forceToNodeSurroundingUpdate) {
                  var surrounding = /* @__PURE__ */ new Set();
                  nodeA.surrounding = new Array();
                  var nodeB;
                  var grid = this.grid;
                  for (var i2 = nodeA.startX - 1; i2 < nodeA.finishX + 2; i2++) {
                    for (var j3 = nodeA.startY - 1; j3 < nodeA.finishY + 2; j3++) {
                      if (!(i2 < 0 || j3 < 0 || i2 >= grid.length || j3 >= grid[0].length)) {
                        for (var k2 = 0; k2 < grid[i2][j3].length; k2++) {
                          nodeB = grid[i2][j3][k2];
                          if (nodeA.getOwner() != nodeB.getOwner() || nodeA == nodeB) {
                            continue;
                          }
                          if (!processedNodeSet.has(nodeB) && !surrounding.has(nodeB)) {
                            var distanceX = Math.abs(nodeA.getCenterX() - nodeB.getCenterX()) - (nodeA.getWidth() / 2 + nodeB.getWidth() / 2);
                            var distanceY = Math.abs(nodeA.getCenterY() - nodeB.getCenterY()) - (nodeA.getHeight() / 2 + nodeB.getHeight() / 2);
                            if (distanceX <= this.repulsionRange && distanceY <= this.repulsionRange) {
                              surrounding.add(nodeB);
                            }
                          }
                        }
                      }
                    }
                  }
                  nodeA.surrounding = [].concat(_toConsumableArray2(surrounding));
                }
                for (i2 = 0; i2 < nodeA.surrounding.length; i2++) {
                  this.calcRepulsionForce(nodeA, nodeA.surrounding[i2]);
                }
              };
              FDLayout.prototype.calcRepulsionRange = function() {
                return 0;
              };
              module3.exports = FDLayout;
            }),
            /* 19 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LEdge = __webpack_require__(1);
              var FDLayoutConstants = __webpack_require__(7);
              function FDLayoutEdge(source, target, vEdge) {
                LEdge.call(this, source, target, vEdge);
                this.idealLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH;
              }
              __name(FDLayoutEdge, "FDLayoutEdge");
              FDLayoutEdge.prototype = Object.create(LEdge.prototype);
              for (var prop in LEdge) {
                FDLayoutEdge[prop] = LEdge[prop];
              }
              module3.exports = FDLayoutEdge;
            }),
            /* 20 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LNode = __webpack_require__(3);
              function FDLayoutNode(gm, loc, size4, vNode) {
                LNode.call(this, gm, loc, size4, vNode);
                this.springForceX = 0;
                this.springForceY = 0;
                this.repulsionForceX = 0;
                this.repulsionForceY = 0;
                this.gravitationForceX = 0;
                this.gravitationForceY = 0;
                this.displacementX = 0;
                this.displacementY = 0;
                this.startX = 0;
                this.finishX = 0;
                this.startY = 0;
                this.finishY = 0;
                this.surrounding = [];
              }
              __name(FDLayoutNode, "FDLayoutNode");
              FDLayoutNode.prototype = Object.create(LNode.prototype);
              for (var prop in LNode) {
                FDLayoutNode[prop] = LNode[prop];
              }
              FDLayoutNode.prototype.setGridCoordinates = function(_startX, _finishX, _startY, _finishY) {
                this.startX = _startX;
                this.finishX = _finishX;
                this.startY = _startY;
                this.finishY = _finishY;
              };
              module3.exports = FDLayoutNode;
            }),
            /* 21 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function DimensionD2(width3, height2) {
                this.width = 0;
                this.height = 0;
                if (width3 !== null && height2 !== null) {
                  this.height = height2;
                  this.width = width3;
                }
              }
              __name(DimensionD2, "DimensionD");
              DimensionD2.prototype.getWidth = function() {
                return this.width;
              };
              DimensionD2.prototype.setWidth = function(width3) {
                this.width = width3;
              };
              DimensionD2.prototype.getHeight = function() {
                return this.height;
              };
              DimensionD2.prototype.setHeight = function(height2) {
                this.height = height2;
              };
              module3.exports = DimensionD2;
            }),
            /* 22 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var UniqueIDGeneretor = __webpack_require__(14);
              function HashMap() {
                this.map = {};
                this.keys = [];
              }
              __name(HashMap, "HashMap");
              HashMap.prototype.put = function(key, value2) {
                var theId = UniqueIDGeneretor.createID(key);
                if (!this.contains(theId)) {
                  this.map[theId] = value2;
                  this.keys.push(key);
                }
              };
              HashMap.prototype.contains = function(key) {
                var theId = UniqueIDGeneretor.createID(key);
                return this.map[key] != null;
              };
              HashMap.prototype.get = function(key) {
                var theId = UniqueIDGeneretor.createID(key);
                return this.map[theId];
              };
              HashMap.prototype.keySet = function() {
                return this.keys;
              };
              module3.exports = HashMap;
            }),
            /* 23 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var UniqueIDGeneretor = __webpack_require__(14);
              function HashSet() {
                this.set = {};
              }
              __name(HashSet, "HashSet");
              ;
              HashSet.prototype.add = function(obj) {
                var theId = UniqueIDGeneretor.createID(obj);
                if (!this.contains(theId)) this.set[theId] = obj;
              };
              HashSet.prototype.remove = function(obj) {
                delete this.set[UniqueIDGeneretor.createID(obj)];
              };
              HashSet.prototype.clear = function() {
                this.set = {};
              };
              HashSet.prototype.contains = function(obj) {
                return this.set[UniqueIDGeneretor.createID(obj)] == obj;
              };
              HashSet.prototype.isEmpty = function() {
                return this.size() === 0;
              };
              HashSet.prototype.size = function() {
                return Object.keys(this.set).length;
              };
              HashSet.prototype.addAllTo = function(list) {
                var keys2 = Object.keys(this.set);
                var length2 = keys2.length;
                for (var i2 = 0; i2 < length2; i2++) {
                  list.push(this.set[keys2[i2]]);
                }
              };
              HashSet.prototype.size = function() {
                return Object.keys(this.set).length;
              };
              HashSet.prototype.addAll = function(list) {
                var s2 = list.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  var v3 = list[i2];
                  this.add(v3);
                }
              };
              module3.exports = HashSet;
            }),
            /* 24 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var _createClass2 = /* @__PURE__ */ (function() {
                function defineProperties(target, props) {
                  for (var i2 = 0; i2 < props.length; i2++) {
                    var descriptor = props[i2];
                    descriptor.enumerable = descriptor.enumerable || false;
                    descriptor.configurable = true;
                    if ("value" in descriptor) descriptor.writable = true;
                    Object.defineProperty(target, descriptor.key, descriptor);
                  }
                }
                __name(defineProperties, "defineProperties");
                return function(Constructor, protoProps, staticProps) {
                  if (protoProps) defineProperties(Constructor.prototype, protoProps);
                  if (staticProps) defineProperties(Constructor, staticProps);
                  return Constructor;
                };
              })();
              function _classCallCheck2(instance2, Constructor) {
                if (!(instance2 instanceof Constructor)) {
                  throw new TypeError("Cannot call a class as a function");
                }
              }
              __name(_classCallCheck2, "_classCallCheck");
              var LinkedList = __webpack_require__(11);
              var Quicksort = (function() {
                function Quicksort2(A2, compareFunction) {
                  _classCallCheck2(this, Quicksort2);
                  if (compareFunction !== null || compareFunction !== void 0) this.compareFunction = this._defaultCompareFunction;
                  var length2 = void 0;
                  if (A2 instanceof LinkedList) length2 = A2.size();
                  else length2 = A2.length;
                  this._quicksort(A2, 0, length2 - 1);
                }
                __name(Quicksort2, "Quicksort");
                _createClass2(Quicksort2, [{
                  key: "_quicksort",
                  value: /* @__PURE__ */ __name(function _quicksort(A2, p3, r2) {
                    if (p3 < r2) {
                      var q3 = this._partition(A2, p3, r2);
                      this._quicksort(A2, p3, q3);
                      this._quicksort(A2, q3 + 1, r2);
                    }
                  }, "_quicksort")
                }, {
                  key: "_partition",
                  value: /* @__PURE__ */ __name(function _partition(A2, p3, r2) {
                    var x5 = this._get(A2, p3);
                    var i2 = p3;
                    var j3 = r2;
                    while (true) {
                      while (this.compareFunction(x5, this._get(A2, j3))) {
                        j3--;
                      }
                      while (this.compareFunction(this._get(A2, i2), x5)) {
                        i2++;
                      }
                      if (i2 < j3) {
                        this._swap(A2, i2, j3);
                        i2++;
                        j3--;
                      } else return j3;
                    }
                  }, "_partition")
                }, {
                  key: "_get",
                  value: /* @__PURE__ */ __name(function _get(object3, index) {
                    if (object3 instanceof LinkedList) return object3.get_object_at(index);
                    else return object3[index];
                  }, "_get")
                }, {
                  key: "_set",
                  value: /* @__PURE__ */ __name(function _set(object3, index, value2) {
                    if (object3 instanceof LinkedList) object3.set_object_at(index, value2);
                    else object3[index] = value2;
                  }, "_set")
                }, {
                  key: "_swap",
                  value: /* @__PURE__ */ __name(function _swap(A2, i2, j3) {
                    var temp = this._get(A2, i2);
                    this._set(A2, i2, this._get(A2, j3));
                    this._set(A2, j3, temp);
                  }, "_swap")
                }, {
                  key: "_defaultCompareFunction",
                  value: /* @__PURE__ */ __name(function _defaultCompareFunction(a2, b3) {
                    return b3 > a2;
                  }, "_defaultCompareFunction")
                }]);
                return Quicksort2;
              })();
              module3.exports = Quicksort;
            }),
            /* 25 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var _createClass2 = /* @__PURE__ */ (function() {
                function defineProperties(target, props) {
                  for (var i2 = 0; i2 < props.length; i2++) {
                    var descriptor = props[i2];
                    descriptor.enumerable = descriptor.enumerable || false;
                    descriptor.configurable = true;
                    if ("value" in descriptor) descriptor.writable = true;
                    Object.defineProperty(target, descriptor.key, descriptor);
                  }
                }
                __name(defineProperties, "defineProperties");
                return function(Constructor, protoProps, staticProps) {
                  if (protoProps) defineProperties(Constructor.prototype, protoProps);
                  if (staticProps) defineProperties(Constructor, staticProps);
                  return Constructor;
                };
              })();
              function _classCallCheck2(instance2, Constructor) {
                if (!(instance2 instanceof Constructor)) {
                  throw new TypeError("Cannot call a class as a function");
                }
              }
              __name(_classCallCheck2, "_classCallCheck");
              var NeedlemanWunsch = (function() {
                function NeedlemanWunsch2(sequence1, sequence2) {
                  var match_score = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
                  var mismatch_penalty = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : -1;
                  var gap_penalty = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : -1;
                  _classCallCheck2(this, NeedlemanWunsch2);
                  this.sequence1 = sequence1;
                  this.sequence2 = sequence2;
                  this.match_score = match_score;
                  this.mismatch_penalty = mismatch_penalty;
                  this.gap_penalty = gap_penalty;
                  this.iMax = sequence1.length + 1;
                  this.jMax = sequence2.length + 1;
                  this.grid = new Array(this.iMax);
                  for (var i2 = 0; i2 < this.iMax; i2++) {
                    this.grid[i2] = new Array(this.jMax);
                    for (var j3 = 0; j3 < this.jMax; j3++) {
                      this.grid[i2][j3] = 0;
                    }
                  }
                  this.tracebackGrid = new Array(this.iMax);
                  for (var _i = 0; _i < this.iMax; _i++) {
                    this.tracebackGrid[_i] = new Array(this.jMax);
                    for (var _j = 0; _j < this.jMax; _j++) {
                      this.tracebackGrid[_i][_j] = [null, null, null];
                    }
                  }
                  this.alignments = [];
                  this.score = -1;
                  this.computeGrids();
                }
                __name(NeedlemanWunsch2, "NeedlemanWunsch");
                _createClass2(NeedlemanWunsch2, [{
                  key: "getScore",
                  value: /* @__PURE__ */ __name(function getScore() {
                    return this.score;
                  }, "getScore")
                }, {
                  key: "getAlignments",
                  value: /* @__PURE__ */ __name(function getAlignments2() {
                    return this.alignments;
                  }, "getAlignments")
                  // Main dynamic programming procedure
                }, {
                  key: "computeGrids",
                  value: /* @__PURE__ */ __name(function computeGrids() {
                    for (var j3 = 1; j3 < this.jMax; j3++) {
                      this.grid[0][j3] = this.grid[0][j3 - 1] + this.gap_penalty;
                      this.tracebackGrid[0][j3] = [false, false, true];
                    }
                    for (var i2 = 1; i2 < this.iMax; i2++) {
                      this.grid[i2][0] = this.grid[i2 - 1][0] + this.gap_penalty;
                      this.tracebackGrid[i2][0] = [false, true, false];
                    }
                    for (var _i2 = 1; _i2 < this.iMax; _i2++) {
                      for (var _j2 = 1; _j2 < this.jMax; _j2++) {
                        var diag = void 0;
                        if (this.sequence1[_i2 - 1] === this.sequence2[_j2 - 1]) diag = this.grid[_i2 - 1][_j2 - 1] + this.match_score;
                        else diag = this.grid[_i2 - 1][_j2 - 1] + this.mismatch_penalty;
                        var up = this.grid[_i2 - 1][_j2] + this.gap_penalty;
                        var left3 = this.grid[_i2][_j2 - 1] + this.gap_penalty;
                        var maxOf = [diag, up, left3];
                        var indices = this.arrayAllMaxIndexes(maxOf);
                        this.grid[_i2][_j2] = maxOf[indices[0]];
                        this.tracebackGrid[_i2][_j2] = [indices.includes(0), indices.includes(1), indices.includes(2)];
                      }
                    }
                    this.score = this.grid[this.iMax - 1][this.jMax - 1];
                  }, "computeGrids")
                  // Gets all possible valid sequence combinations
                }, {
                  key: "alignmentTraceback",
                  value: /* @__PURE__ */ __name(function alignmentTraceback() {
                    var inProcessAlignments = [];
                    inProcessAlignments.push({
                      pos: [this.sequence1.length, this.sequence2.length],
                      seq1: "",
                      seq2: ""
                    });
                    while (inProcessAlignments[0]) {
                      var current = inProcessAlignments[0];
                      var directions = this.tracebackGrid[current.pos[0]][current.pos[1]];
                      if (directions[0]) {
                        inProcessAlignments.push({
                          pos: [current.pos[0] - 1, current.pos[1] - 1],
                          seq1: this.sequence1[current.pos[0] - 1] + current.seq1,
                          seq2: this.sequence2[current.pos[1] - 1] + current.seq2
                        });
                      }
                      if (directions[1]) {
                        inProcessAlignments.push({
                          pos: [current.pos[0] - 1, current.pos[1]],
                          seq1: this.sequence1[current.pos[0] - 1] + current.seq1,
                          seq2: "-" + current.seq2
                        });
                      }
                      if (directions[2]) {
                        inProcessAlignments.push({
                          pos: [current.pos[0], current.pos[1] - 1],
                          seq1: "-" + current.seq1,
                          seq2: this.sequence2[current.pos[1] - 1] + current.seq2
                        });
                      }
                      if (current.pos[0] === 0 && current.pos[1] === 0) this.alignments.push({
                        sequence1: current.seq1,
                        sequence2: current.seq2
                      });
                      inProcessAlignments.shift();
                    }
                    return this.alignments;
                  }, "alignmentTraceback")
                  // Helper Functions
                }, {
                  key: "getAllIndexes",
                  value: /* @__PURE__ */ __name(function getAllIndexes(arr, val) {
                    var indexes = [], i2 = -1;
                    while ((i2 = arr.indexOf(val, i2 + 1)) !== -1) {
                      indexes.push(i2);
                    }
                    return indexes;
                  }, "getAllIndexes")
                }, {
                  key: "arrayAllMaxIndexes",
                  value: /* @__PURE__ */ __name(function arrayAllMaxIndexes(array4) {
                    return this.getAllIndexes(array4, Math.max.apply(null, array4));
                  }, "arrayAllMaxIndexes")
                }]);
                return NeedlemanWunsch2;
              })();
              module3.exports = NeedlemanWunsch;
            }),
            /* 26 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var layoutBase = /* @__PURE__ */ __name(function layoutBase2() {
                return;
              }, "layoutBase");
              layoutBase.FDLayout = __webpack_require__(18);
              layoutBase.FDLayoutConstants = __webpack_require__(7);
              layoutBase.FDLayoutEdge = __webpack_require__(19);
              layoutBase.FDLayoutNode = __webpack_require__(20);
              layoutBase.DimensionD = __webpack_require__(21);
              layoutBase.HashMap = __webpack_require__(22);
              layoutBase.HashSet = __webpack_require__(23);
              layoutBase.IGeometry = __webpack_require__(8);
              layoutBase.IMath = __webpack_require__(9);
              layoutBase.Integer = __webpack_require__(10);
              layoutBase.Point = __webpack_require__(12);
              layoutBase.PointD = __webpack_require__(4);
              layoutBase.RandomSeed = __webpack_require__(16);
              layoutBase.RectangleD = __webpack_require__(13);
              layoutBase.Transform = __webpack_require__(17);
              layoutBase.UniqueIDGeneretor = __webpack_require__(14);
              layoutBase.Quicksort = __webpack_require__(24);
              layoutBase.LinkedList = __webpack_require__(11);
              layoutBase.LGraphObject = __webpack_require__(2);
              layoutBase.LGraph = __webpack_require__(5);
              layoutBase.LEdge = __webpack_require__(1);
              layoutBase.LGraphManager = __webpack_require__(6);
              layoutBase.LNode = __webpack_require__(3);
              layoutBase.Layout = __webpack_require__(15);
              layoutBase.LayoutConstants = __webpack_require__(0);
              layoutBase.NeedlemanWunsch = __webpack_require__(25);
              module3.exports = layoutBase;
            }),
            /* 27 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function Emitter4() {
                this.listeners = [];
              }
              __name(Emitter4, "Emitter");
              var p3 = Emitter4.prototype;
              p3.addListener = function(event3, callback) {
                this.listeners.push({
                  event: event3,
                  callback
                });
              };
              p3.removeListener = function(event3, callback) {
                for (var i2 = this.listeners.length; i2 >= 0; i2--) {
                  var l4 = this.listeners[i2];
                  if (l4.event === event3 && l4.callback === callback) {
                    this.listeners.splice(i2, 1);
                  }
                }
              };
              p3.emit = function(event3, data5) {
                for (var i2 = 0; i2 < this.listeners.length; i2++) {
                  var l4 = this.listeners[i2];
                  if (event3 === l4.event) {
                    l4.callback(data5);
                  }
                }
              };
              module3.exports = Emitter4;
            })
            /******/
          ])
        );
      });
    }
  });

  // ../../node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.js
  var require_cose_base = __commonJS({
    "../../node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.js"(exports2, module2) {
      "use strict";
      (/* @__PURE__ */ __name((function webpackUniversalModuleDefinition(root3, factory) {
        if (typeof exports2 === "object" && typeof module2 === "object")
          module2.exports = factory(require_layout_base());
        else if (typeof define === "function" && define.amd)
          define(["layout-base"], factory);
        else if (typeof exports2 === "object")
          exports2["coseBase"] = factory(require_layout_base());
        else
          root3["coseBase"] = factory(root3["layoutBase"]);
      }), "webpackUniversalModuleDefinition"))(exports2, function(__WEBPACK_EXTERNAL_MODULE_0__) {
        return (
          /******/
          (function(modules2) {
            var installedModules = {};
            function __webpack_require__(moduleId) {
              if (installedModules[moduleId]) {
                return installedModules[moduleId].exports;
              }
              var module3 = installedModules[moduleId] = {
                /******/
                i: moduleId,
                /******/
                l: false,
                /******/
                exports: {}
                /******/
              };
              modules2[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__);
              module3.l = true;
              return module3.exports;
            }
            __name(__webpack_require__, "__webpack_require__");
            __webpack_require__.m = modules2;
            __webpack_require__.c = installedModules;
            __webpack_require__.i = function(value2) {
              return value2;
            };
            __webpack_require__.d = function(exports3, name, getter) {
              if (!__webpack_require__.o(exports3, name)) {
                Object.defineProperty(exports3, name, {
                  /******/
                  configurable: false,
                  /******/
                  enumerable: true,
                  /******/
                  get: getter
                  /******/
                });
              }
            };
            __webpack_require__.n = function(module3) {
              var getter = module3 && module3.__esModule ? (
                /******/
                /* @__PURE__ */ __name(function getDefault() {
                  return module3["default"];
                }, "getDefault")
              ) : (
                /******/
                /* @__PURE__ */ __name(function getModuleExports() {
                  return module3;
                }, "getModuleExports")
              );
              __webpack_require__.d(getter, "a", getter);
              return getter;
            };
            __webpack_require__.o = function(object3, property2) {
              return Object.prototype.hasOwnProperty.call(object3, property2);
            };
            __webpack_require__.p = "";
            return __webpack_require__(__webpack_require__.s = 7);
          })([
            /* 0 */
            /***/
            (function(module3, exports3) {
              module3.exports = __WEBPACK_EXTERNAL_MODULE_0__;
            }),
            /* 1 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var FDLayoutConstants = __webpack_require__(0).FDLayoutConstants;
              function CoSEConstants() {
              }
              __name(CoSEConstants, "CoSEConstants");
              for (var prop in FDLayoutConstants) {
                CoSEConstants[prop] = FDLayoutConstants[prop];
              }
              CoSEConstants.DEFAULT_USE_MULTI_LEVEL_SCALING = false;
              CoSEConstants.DEFAULT_RADIAL_SEPARATION = FDLayoutConstants.DEFAULT_EDGE_LENGTH;
              CoSEConstants.DEFAULT_COMPONENT_SEPERATION = 60;
              CoSEConstants.TILE = true;
              CoSEConstants.TILING_PADDING_VERTICAL = 10;
              CoSEConstants.TILING_PADDING_HORIZONTAL = 10;
              CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = false;
              module3.exports = CoSEConstants;
            }),
            /* 2 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var FDLayoutEdge = __webpack_require__(0).FDLayoutEdge;
              function CoSEEdge(source, target, vEdge) {
                FDLayoutEdge.call(this, source, target, vEdge);
              }
              __name(CoSEEdge, "CoSEEdge");
              CoSEEdge.prototype = Object.create(FDLayoutEdge.prototype);
              for (var prop in FDLayoutEdge) {
                CoSEEdge[prop] = FDLayoutEdge[prop];
              }
              module3.exports = CoSEEdge;
            }),
            /* 3 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LGraph = __webpack_require__(0).LGraph;
              function CoSEGraph(parent4, graphMgr, vGraph) {
                LGraph.call(this, parent4, graphMgr, vGraph);
              }
              __name(CoSEGraph, "CoSEGraph");
              CoSEGraph.prototype = Object.create(LGraph.prototype);
              for (var prop in LGraph) {
                CoSEGraph[prop] = LGraph[prop];
              }
              module3.exports = CoSEGraph;
            }),
            /* 4 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LGraphManager = __webpack_require__(0).LGraphManager;
              function CoSEGraphManager(layout7) {
                LGraphManager.call(this, layout7);
              }
              __name(CoSEGraphManager, "CoSEGraphManager");
              CoSEGraphManager.prototype = Object.create(LGraphManager.prototype);
              for (var prop in LGraphManager) {
                CoSEGraphManager[prop] = LGraphManager[prop];
              }
              module3.exports = CoSEGraphManager;
            }),
            /* 5 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var FDLayoutNode = __webpack_require__(0).FDLayoutNode;
              var IMath = __webpack_require__(0).IMath;
              function CoSENode(gm, loc, size4, vNode) {
                FDLayoutNode.call(this, gm, loc, size4, vNode);
              }
              __name(CoSENode, "CoSENode");
              CoSENode.prototype = Object.create(FDLayoutNode.prototype);
              for (var prop in FDLayoutNode) {
                CoSENode[prop] = FDLayoutNode[prop];
              }
              CoSENode.prototype.move = function() {
                var layout7 = this.graphManager.getLayout();
                this.displacementX = layout7.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren;
                this.displacementY = layout7.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren;
                if (Math.abs(this.displacementX) > layout7.coolingFactor * layout7.maxNodeDisplacement) {
                  this.displacementX = layout7.coolingFactor * layout7.maxNodeDisplacement * IMath.sign(this.displacementX);
                }
                if (Math.abs(this.displacementY) > layout7.coolingFactor * layout7.maxNodeDisplacement) {
                  this.displacementY = layout7.coolingFactor * layout7.maxNodeDisplacement * IMath.sign(this.displacementY);
                }
                if (this.child == null) {
                  this.moveBy(this.displacementX, this.displacementY);
                } else if (this.child.getNodes().length == 0) {
                  this.moveBy(this.displacementX, this.displacementY);
                } else {
                  this.propogateDisplacementToChildren(this.displacementX, this.displacementY);
                }
                layout7.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY);
                this.springForceX = 0;
                this.springForceY = 0;
                this.repulsionForceX = 0;
                this.repulsionForceY = 0;
                this.gravitationForceX = 0;
                this.gravitationForceY = 0;
                this.displacementX = 0;
                this.displacementY = 0;
              };
              CoSENode.prototype.propogateDisplacementToChildren = function(dX, dY) {
                var nodes5 = this.getChild().getNodes();
                var node2;
                for (var i2 = 0; i2 < nodes5.length; i2++) {
                  node2 = nodes5[i2];
                  if (node2.getChild() == null) {
                    node2.moveBy(dX, dY);
                    node2.displacementX += dX;
                    node2.displacementY += dY;
                  } else {
                    node2.propogateDisplacementToChildren(dX, dY);
                  }
                }
              };
              CoSENode.prototype.setPred1 = function(pred12) {
                this.pred1 = pred12;
              };
              CoSENode.prototype.getPred1 = function() {
                return pred1;
              };
              CoSENode.prototype.getPred2 = function() {
                return pred2;
              };
              CoSENode.prototype.setNext = function(next3) {
                this.next = next3;
              };
              CoSENode.prototype.getNext = function() {
                return next;
              };
              CoSENode.prototype.setProcessed = function(processed2) {
                this.processed = processed2;
              };
              CoSENode.prototype.isProcessed = function() {
                return processed;
              };
              module3.exports = CoSENode;
            }),
            /* 6 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var FDLayout = __webpack_require__(0).FDLayout;
              var CoSEGraphManager = __webpack_require__(4);
              var CoSEGraph = __webpack_require__(3);
              var CoSENode = __webpack_require__(5);
              var CoSEEdge = __webpack_require__(2);
              var CoSEConstants = __webpack_require__(1);
              var FDLayoutConstants = __webpack_require__(0).FDLayoutConstants;
              var LayoutConstants = __webpack_require__(0).LayoutConstants;
              var Point3 = __webpack_require__(0).Point;
              var PointD = __webpack_require__(0).PointD;
              var Layout2 = __webpack_require__(0).Layout;
              var Integer = __webpack_require__(0).Integer;
              var IGeometry = __webpack_require__(0).IGeometry;
              var LGraph = __webpack_require__(0).LGraph;
              var Transform2 = __webpack_require__(0).Transform;
              function CoSELayout() {
                FDLayout.call(this);
                this.toBeTiled = {};
              }
              __name(CoSELayout, "CoSELayout");
              CoSELayout.prototype = Object.create(FDLayout.prototype);
              for (var prop in FDLayout) {
                CoSELayout[prop] = FDLayout[prop];
              }
              CoSELayout.prototype.newGraphManager = function() {
                var gm = new CoSEGraphManager(this);
                this.graphManager = gm;
                return gm;
              };
              CoSELayout.prototype.newGraph = function(vGraph) {
                return new CoSEGraph(null, this.graphManager, vGraph);
              };
              CoSELayout.prototype.newNode = function(vNode) {
                return new CoSENode(this.graphManager, vNode);
              };
              CoSELayout.prototype.newEdge = function(vEdge) {
                return new CoSEEdge(null, null, vEdge);
              };
              CoSELayout.prototype.initParameters = function() {
                FDLayout.prototype.initParameters.call(this, arguments);
                if (!this.isSubLayout) {
                  if (CoSEConstants.DEFAULT_EDGE_LENGTH < 10) {
                    this.idealEdgeLength = 10;
                  } else {
                    this.idealEdgeLength = CoSEConstants.DEFAULT_EDGE_LENGTH;
                  }
                  this.useSmartIdealEdgeLengthCalculation = CoSEConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION;
                  this.springConstant = FDLayoutConstants.DEFAULT_SPRING_STRENGTH;
                  this.repulsionConstant = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH;
                  this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH;
                  this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH;
                  this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR;
                  this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR;
                  this.prunedNodesAll = [];
                  this.growTreeIterations = 0;
                  this.afterGrowthIterations = 0;
                  this.isTreeGrowing = false;
                  this.isGrowthFinished = false;
                  this.coolingCycle = 0;
                  this.maxCoolingCycle = this.maxIterations / FDLayoutConstants.CONVERGENCE_CHECK_PERIOD;
                  this.finalTemperature = FDLayoutConstants.CONVERGENCE_CHECK_PERIOD / this.maxIterations;
                  this.coolingAdjuster = 1;
                }
              };
              CoSELayout.prototype.layout = function() {
                var createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED;
                if (createBendsAsNeeded) {
                  this.createBendpoints();
                  this.graphManager.resetAllEdges();
                }
                this.level = 0;
                return this.classicLayout();
              };
              CoSELayout.prototype.classicLayout = function() {
                this.nodesWithGravity = this.calculateNodesToApplyGravitationTo();
                this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity);
                this.calcNoOfChildrenForAllNodes();
                this.graphManager.calcLowestCommonAncestors();
                this.graphManager.calcInclusionTreeDepths();
                this.graphManager.getRoot().calcEstimatedSize();
                this.calcIdealEdgeLengths();
                if (!this.incremental) {
                  var forest = this.getFlatForest();
                  if (forest.length > 0) {
                    this.positionNodesRadially(forest);
                  } else {
                    this.reduceTrees();
                    this.graphManager.resetAllNodesToApplyGravitation();
                    var allNodes = new Set(this.getAllNodes());
                    var intersection4 = this.nodesWithGravity.filter(function(x5) {
                      return allNodes.has(x5);
                    });
                    this.graphManager.setAllNodesToApplyGravitation(intersection4);
                    this.positionNodesRandomly();
                  }
                } else {
                  if (CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL) {
                    this.reduceTrees();
                    this.graphManager.resetAllNodesToApplyGravitation();
                    var allNodes = new Set(this.getAllNodes());
                    var intersection4 = this.nodesWithGravity.filter(function(x5) {
                      return allNodes.has(x5);
                    });
                    this.graphManager.setAllNodesToApplyGravitation(intersection4);
                  }
                }
                this.initSpringEmbedder();
                this.runSpringEmbedder();
                return true;
              };
              CoSELayout.prototype.tick = function() {
                this.totalIterations++;
                if (this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished) {
                  if (this.prunedNodesAll.length > 0) {
                    this.isTreeGrowing = true;
                  } else {
                    return true;
                  }
                }
                if (this.totalIterations % FDLayoutConstants.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) {
                  if (this.isConverged()) {
                    if (this.prunedNodesAll.length > 0) {
                      this.isTreeGrowing = true;
                    } else {
                      return true;
                    }
                  }
                  this.coolingCycle++;
                  if (this.layoutQuality == 0) {
                    this.coolingAdjuster = this.coolingCycle;
                  } else if (this.layoutQuality == 1) {
                    this.coolingAdjuster = this.coolingCycle / 3;
                  }
                  this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature);
                  this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor));
                }
                if (this.isTreeGrowing) {
                  if (this.growTreeIterations % 10 == 0) {
                    if (this.prunedNodesAll.length > 0) {
                      this.graphManager.updateBounds();
                      this.updateGrid();
                      this.growTree(this.prunedNodesAll);
                      this.graphManager.resetAllNodesToApplyGravitation();
                      var allNodes = new Set(this.getAllNodes());
                      var intersection4 = this.nodesWithGravity.filter(function(x5) {
                        return allNodes.has(x5);
                      });
                      this.graphManager.setAllNodesToApplyGravitation(intersection4);
                      this.graphManager.updateBounds();
                      this.updateGrid();
                      this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL;
                    } else {
                      this.isTreeGrowing = false;
                      this.isGrowthFinished = true;
                    }
                  }
                  this.growTreeIterations++;
                }
                if (this.isGrowthFinished) {
                  if (this.isConverged()) {
                    return true;
                  }
                  if (this.afterGrowthIterations % 10 == 0) {
                    this.graphManager.updateBounds();
                    this.updateGrid();
                  }
                  this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100);
                  this.afterGrowthIterations++;
                }
                var gridUpdateAllowed = !this.isTreeGrowing && !this.isGrowthFinished;
                var forceToNodeSurroundingUpdate = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished;
                this.totalDisplacement = 0;
                this.graphManager.updateBounds();
                this.calcSpringForces();
                this.calcRepulsionForces(gridUpdateAllowed, forceToNodeSurroundingUpdate);
                this.calcGravitationalForces();
                this.moveNodes();
                this.animate();
                return false;
              };
              CoSELayout.prototype.getPositionsData = function() {
                var allNodes = this.graphManager.getAllNodes();
                var pData = {};
                for (var i2 = 0; i2 < allNodes.length; i2++) {
                  var rect3 = allNodes[i2].rect;
                  var id34 = allNodes[i2].id;
                  pData[id34] = {
                    id: id34,
                    x: rect3.getCenterX(),
                    y: rect3.getCenterY(),
                    w: rect3.width,
                    h: rect3.height
                  };
                }
                return pData;
              };
              CoSELayout.prototype.runSpringEmbedder = function() {
                this.initialAnimationPeriod = 25;
                this.animationPeriod = this.initialAnimationPeriod;
                var layoutEnded = false;
                if (FDLayoutConstants.ANIMATE === "during") {
                  this.emit("layoutstarted");
                } else {
                  while (!layoutEnded) {
                    layoutEnded = this.tick();
                  }
                  this.graphManager.updateBounds();
                }
              };
              CoSELayout.prototype.calculateNodesToApplyGravitationTo = function() {
                var nodeList = [];
                var graph;
                var graphs = this.graphManager.getGraphs();
                var size4 = graphs.length;
                var i2;
                for (i2 = 0; i2 < size4; i2++) {
                  graph = graphs[i2];
                  graph.updateConnected();
                  if (!graph.isConnected) {
                    nodeList = nodeList.concat(graph.getNodes());
                  }
                }
                return nodeList;
              };
              CoSELayout.prototype.createBendpoints = function() {
                var edges3 = [];
                edges3 = edges3.concat(this.graphManager.getAllEdges());
                var visited = /* @__PURE__ */ new Set();
                var i2;
                for (i2 = 0; i2 < edges3.length; i2++) {
                  var edge = edges3[i2];
                  if (!visited.has(edge)) {
                    var source = edge.getSource();
                    var target = edge.getTarget();
                    if (source == target) {
                      edge.getBendpoints().push(new PointD());
                      edge.getBendpoints().push(new PointD());
                      this.createDummyNodesForBendpoints(edge);
                      visited.add(edge);
                    } else {
                      var edgeList2 = [];
                      edgeList2 = edgeList2.concat(source.getEdgeListToNode(target));
                      edgeList2 = edgeList2.concat(target.getEdgeListToNode(source));
                      if (!visited.has(edgeList2[0])) {
                        if (edgeList2.length > 1) {
                          var k2;
                          for (k2 = 0; k2 < edgeList2.length; k2++) {
                            var multiEdge = edgeList2[k2];
                            multiEdge.getBendpoints().push(new PointD());
                            this.createDummyNodesForBendpoints(multiEdge);
                          }
                        }
                        edgeList2.forEach(function(edge2) {
                          visited.add(edge2);
                        });
                      }
                    }
                  }
                  if (visited.size == edges3.length) {
                    break;
                  }
                }
              };
              CoSELayout.prototype.positionNodesRadially = function(forest) {
                var currentStartingPoint = new Point3(0, 0);
                var numberOfColumns = Math.ceil(Math.sqrt(forest.length));
                var height2 = 0;
                var currentY = 0;
                var currentX = 0;
                var point8 = new PointD(0, 0);
                for (var i2 = 0; i2 < forest.length; i2++) {
                  if (i2 % numberOfColumns == 0) {
                    currentX = 0;
                    currentY = height2;
                    if (i2 != 0) {
                      currentY += CoSEConstants.DEFAULT_COMPONENT_SEPERATION;
                    }
                    height2 = 0;
                  }
                  var tree = forest[i2];
                  var centerNode = Layout2.findCenterOfTree(tree);
                  currentStartingPoint.x = currentX;
                  currentStartingPoint.y = currentY;
                  point8 = CoSELayout.radialLayout(tree, centerNode, currentStartingPoint);
                  if (point8.y > height2) {
                    height2 = Math.floor(point8.y);
                  }
                  currentX = Math.floor(point8.x + CoSEConstants.DEFAULT_COMPONENT_SEPERATION);
                }
                this.transform(new PointD(LayoutConstants.WORLD_CENTER_X - point8.x / 2, LayoutConstants.WORLD_CENTER_Y - point8.y / 2));
              };
              CoSELayout.radialLayout = function(tree, centerNode, startingPoint) {
                var radialSep = Math.max(this.maxDiagonalInTree(tree), CoSEConstants.DEFAULT_RADIAL_SEPARATION);
                CoSELayout.branchRadialLayout(centerNode, null, 0, 359, 0, radialSep);
                var bounds4 = LGraph.calculateBounds(tree);
                var transform8 = new Transform2();
                transform8.setDeviceOrgX(bounds4.getMinX());
                transform8.setDeviceOrgY(bounds4.getMinY());
                transform8.setWorldOrgX(startingPoint.x);
                transform8.setWorldOrgY(startingPoint.y);
                for (var i2 = 0; i2 < tree.length; i2++) {
                  var node2 = tree[i2];
                  node2.transform(transform8);
                }
                var bottomRight = new PointD(bounds4.getMaxX(), bounds4.getMaxY());
                return transform8.inverseTransformPoint(bottomRight);
              };
              CoSELayout.branchRadialLayout = function(node2, parentOfNode, startAngle, endAngle, distance3, radialSeparation) {
                var halfInterval = (endAngle - startAngle + 1) / 2;
                if (halfInterval < 0) {
                  halfInterval += 180;
                }
                var nodeAngle = (halfInterval + startAngle) % 360;
                var teta = nodeAngle * IGeometry.TWO_PI / 360;
                var cos_teta = Math.cos(teta);
                var x_ = distance3 * Math.cos(teta);
                var y_ = distance3 * Math.sin(teta);
                node2.setCenter(x_, y_);
                var neighborEdges = [];
                neighborEdges = neighborEdges.concat(node2.getEdges());
                var childCount = neighborEdges.length;
                if (parentOfNode != null) {
                  childCount--;
                }
                var branchCount = 0;
                var incEdgesCount = neighborEdges.length;
                var startIndex;
                var edges3 = node2.getEdgesBetween(parentOfNode);
                while (edges3.length > 1) {
                  var temp = edges3[0];
                  edges3.splice(0, 1);
                  var index = neighborEdges.indexOf(temp);
                  if (index >= 0) {
                    neighborEdges.splice(index, 1);
                  }
                  incEdgesCount--;
                  childCount--;
                }
                if (parentOfNode != null) {
                  startIndex = (neighborEdges.indexOf(edges3[0]) + 1) % incEdgesCount;
                } else {
                  startIndex = 0;
                }
                var stepAngle = Math.abs(endAngle - startAngle) / childCount;
                for (var i2 = startIndex; branchCount != childCount; i2 = ++i2 % incEdgesCount) {
                  var currentNeighbor = neighborEdges[i2].getOtherEnd(node2);
                  if (currentNeighbor == parentOfNode) {
                    continue;
                  }
                  var childStartAngle = (startAngle + branchCount * stepAngle) % 360;
                  var childEndAngle = (childStartAngle + stepAngle) % 360;
                  CoSELayout.branchRadialLayout(currentNeighbor, node2, childStartAngle, childEndAngle, distance3 + radialSeparation, radialSeparation);
                  branchCount++;
                }
              };
              CoSELayout.maxDiagonalInTree = function(tree) {
                var maxDiagonal = Integer.MIN_VALUE;
                for (var i2 = 0; i2 < tree.length; i2++) {
                  var node2 = tree[i2];
                  var diagonal = node2.getDiagonal();
                  if (diagonal > maxDiagonal) {
                    maxDiagonal = diagonal;
                  }
                }
                return maxDiagonal;
              };
              CoSELayout.prototype.calcRepulsionRange = function() {
                return 2 * (this.level + 1) * this.idealEdgeLength;
              };
              CoSELayout.prototype.groupZeroDegreeMembers = function() {
                var self2 = this;
                var tempMemberGroups = {};
                this.memberGroups = {};
                this.idToDummyNode = {};
                var zeroDegree = [];
                var allNodes = this.graphManager.getAllNodes();
                for (var i2 = 0; i2 < allNodes.length; i2++) {
                  var node2 = allNodes[i2];
                  var parent4 = node2.getParent();
                  if (this.getNodeDegreeWithChildren(node2) === 0 && (parent4.id == void 0 || !this.getToBeTiled(parent4))) {
                    zeroDegree.push(node2);
                  }
                }
                for (var i2 = 0; i2 < zeroDegree.length; i2++) {
                  var node2 = zeroDegree[i2];
                  var p_id = node2.getParent().id;
                  if (typeof tempMemberGroups[p_id] === "undefined") tempMemberGroups[p_id] = [];
                  tempMemberGroups[p_id] = tempMemberGroups[p_id].concat(node2);
                }
                Object.keys(tempMemberGroups).forEach(function(p_id2) {
                  if (tempMemberGroups[p_id2].length > 1) {
                    var dummyCompoundId = "DummyCompound_" + p_id2;
                    self2.memberGroups[dummyCompoundId] = tempMemberGroups[p_id2];
                    var parent5 = tempMemberGroups[p_id2][0].getParent();
                    var dummyCompound = new CoSENode(self2.graphManager);
                    dummyCompound.id = dummyCompoundId;
                    dummyCompound.paddingLeft = parent5.paddingLeft || 0;
                    dummyCompound.paddingRight = parent5.paddingRight || 0;
                    dummyCompound.paddingBottom = parent5.paddingBottom || 0;
                    dummyCompound.paddingTop = parent5.paddingTop || 0;
                    self2.idToDummyNode[dummyCompoundId] = dummyCompound;
                    var dummyParentGraph = self2.getGraphManager().add(self2.newGraph(), dummyCompound);
                    var parentGraph = parent5.getChild();
                    parentGraph.add(dummyCompound);
                    for (var i3 = 0; i3 < tempMemberGroups[p_id2].length; i3++) {
                      var node3 = tempMemberGroups[p_id2][i3];
                      parentGraph.remove(node3);
                      dummyParentGraph.add(node3);
                    }
                  }
                });
              };
              CoSELayout.prototype.clearCompounds = function() {
                var childGraphMap = {};
                var idToNode = {};
                this.performDFSOnCompounds();
                for (var i2 = 0; i2 < this.compoundOrder.length; i2++) {
                  idToNode[this.compoundOrder[i2].id] = this.compoundOrder[i2];
                  childGraphMap[this.compoundOrder[i2].id] = [].concat(this.compoundOrder[i2].getChild().getNodes());
                  this.graphManager.remove(this.compoundOrder[i2].getChild());
                  this.compoundOrder[i2].child = null;
                }
                this.graphManager.resetAllNodes();
                this.tileCompoundMembers(childGraphMap, idToNode);
              };
              CoSELayout.prototype.clearZeroDegreeMembers = function() {
                var self2 = this;
                var tiledZeroDegreePack = this.tiledZeroDegreePack = [];
                Object.keys(this.memberGroups).forEach(function(id34) {
                  var compoundNode = self2.idToDummyNode[id34];
                  tiledZeroDegreePack[id34] = self2.tileNodes(self2.memberGroups[id34], compoundNode.paddingLeft + compoundNode.paddingRight);
                  compoundNode.rect.width = tiledZeroDegreePack[id34].width;
                  compoundNode.rect.height = tiledZeroDegreePack[id34].height;
                });
              };
              CoSELayout.prototype.repopulateCompounds = function() {
                for (var i2 = this.compoundOrder.length - 1; i2 >= 0; i2--) {
                  var lCompoundNode = this.compoundOrder[i2];
                  var id34 = lCompoundNode.id;
                  var horizontalMargin = lCompoundNode.paddingLeft;
                  var verticalMargin = lCompoundNode.paddingTop;
                  this.adjustLocations(this.tiledMemberPack[id34], lCompoundNode.rect.x, lCompoundNode.rect.y, horizontalMargin, verticalMargin);
                }
              };
              CoSELayout.prototype.repopulateZeroDegreeMembers = function() {
                var self2 = this;
                var tiledPack = this.tiledZeroDegreePack;
                Object.keys(tiledPack).forEach(function(id34) {
                  var compoundNode = self2.idToDummyNode[id34];
                  var horizontalMargin = compoundNode.paddingLeft;
                  var verticalMargin = compoundNode.paddingTop;
                  self2.adjustLocations(tiledPack[id34], compoundNode.rect.x, compoundNode.rect.y, horizontalMargin, verticalMargin);
                });
              };
              CoSELayout.prototype.getToBeTiled = function(node2) {
                var id34 = node2.id;
                if (this.toBeTiled[id34] != null) {
                  return this.toBeTiled[id34];
                }
                var childGraph = node2.getChild();
                if (childGraph == null) {
                  this.toBeTiled[id34] = false;
                  return false;
                }
                var children2 = childGraph.getNodes();
                for (var i2 = 0; i2 < children2.length; i2++) {
                  var theChild = children2[i2];
                  if (this.getNodeDegree(theChild) > 0) {
                    this.toBeTiled[id34] = false;
                    return false;
                  }
                  if (theChild.getChild() == null) {
                    this.toBeTiled[theChild.id] = false;
                    continue;
                  }
                  if (!this.getToBeTiled(theChild)) {
                    this.toBeTiled[id34] = false;
                    return false;
                  }
                }
                this.toBeTiled[id34] = true;
                return true;
              };
              CoSELayout.prototype.getNodeDegree = function(node2) {
                var id34 = node2.id;
                var edges3 = node2.getEdges();
                var degree = 0;
                for (var i2 = 0; i2 < edges3.length; i2++) {
                  var edge = edges3[i2];
                  if (edge.getSource().id !== edge.getTarget().id) {
                    degree = degree + 1;
                  }
                }
                return degree;
              };
              CoSELayout.prototype.getNodeDegreeWithChildren = function(node2) {
                var degree = this.getNodeDegree(node2);
                if (node2.getChild() == null) {
                  return degree;
                }
                var children2 = node2.getChild().getNodes();
                for (var i2 = 0; i2 < children2.length; i2++) {
                  var child = children2[i2];
                  degree += this.getNodeDegreeWithChildren(child);
                }
                return degree;
              };
              CoSELayout.prototype.performDFSOnCompounds = function() {
                this.compoundOrder = [];
                this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes());
              };
              CoSELayout.prototype.fillCompexOrderByDFS = function(children2) {
                for (var i2 = 0; i2 < children2.length; i2++) {
                  var child = children2[i2];
                  if (child.getChild() != null) {
                    this.fillCompexOrderByDFS(child.getChild().getNodes());
                  }
                  if (this.getToBeTiled(child)) {
                    this.compoundOrder.push(child);
                  }
                }
              };
              CoSELayout.prototype.adjustLocations = function(organization, x5, y6, compoundHorizontalMargin, compoundVerticalMargin) {
                x5 += compoundHorizontalMargin;
                y6 += compoundVerticalMargin;
                var left3 = x5;
                for (var i2 = 0; i2 < organization.rows.length; i2++) {
                  var row = organization.rows[i2];
                  x5 = left3;
                  var maxHeight = 0;
                  for (var j3 = 0; j3 < row.length; j3++) {
                    var lnode = row[j3];
                    lnode.rect.x = x5;
                    lnode.rect.y = y6;
                    x5 += lnode.rect.width + organization.horizontalPadding;
                    if (lnode.rect.height > maxHeight) maxHeight = lnode.rect.height;
                  }
                  y6 += maxHeight + organization.verticalPadding;
                }
              };
              CoSELayout.prototype.tileCompoundMembers = function(childGraphMap, idToNode) {
                var self2 = this;
                this.tiledMemberPack = [];
                Object.keys(childGraphMap).forEach(function(id34) {
                  var compoundNode = idToNode[id34];
                  self2.tiledMemberPack[id34] = self2.tileNodes(childGraphMap[id34], compoundNode.paddingLeft + compoundNode.paddingRight);
                  compoundNode.rect.width = self2.tiledMemberPack[id34].width;
                  compoundNode.rect.height = self2.tiledMemberPack[id34].height;
                });
              };
              CoSELayout.prototype.tileNodes = function(nodes5, minWidth) {
                var verticalPadding = CoSEConstants.TILING_PADDING_VERTICAL;
                var horizontalPadding = CoSEConstants.TILING_PADDING_HORIZONTAL;
                var organization = {
                  rows: [],
                  rowWidth: [],
                  rowHeight: [],
                  width: 0,
                  height: minWidth,
                  // assume minHeight equals to minWidth
                  verticalPadding,
                  horizontalPadding
                };
                nodes5.sort(function(n1, n2) {
                  if (n1.rect.width * n1.rect.height > n2.rect.width * n2.rect.height) return -1;
                  if (n1.rect.width * n1.rect.height < n2.rect.width * n2.rect.height) return 1;
                  return 0;
                });
                for (var i2 = 0; i2 < nodes5.length; i2++) {
                  var lNode = nodes5[i2];
                  if (organization.rows.length == 0) {
                    this.insertNodeToRow(organization, lNode, 0, minWidth);
                  } else if (this.canAddHorizontal(organization, lNode.rect.width, lNode.rect.height)) {
                    this.insertNodeToRow(organization, lNode, this.getShortestRowIndex(organization), minWidth);
                  } else {
                    this.insertNodeToRow(organization, lNode, organization.rows.length, minWidth);
                  }
                  this.shiftToLastRow(organization);
                }
                return organization;
              };
              CoSELayout.prototype.insertNodeToRow = function(organization, node2, rowIndex, minWidth) {
                var minCompoundSize = minWidth;
                if (rowIndex == organization.rows.length) {
                  var secondDimension = [];
                  organization.rows.push(secondDimension);
                  organization.rowWidth.push(minCompoundSize);
                  organization.rowHeight.push(0);
                }
                var w4 = organization.rowWidth[rowIndex] + node2.rect.width;
                if (organization.rows[rowIndex].length > 0) {
                  w4 += organization.horizontalPadding;
                }
                organization.rowWidth[rowIndex] = w4;
                if (organization.width < w4) {
                  organization.width = w4;
                }
                var h3 = node2.rect.height;
                if (rowIndex > 0) h3 += organization.verticalPadding;
                var extraHeight = 0;
                if (h3 > organization.rowHeight[rowIndex]) {
                  extraHeight = organization.rowHeight[rowIndex];
                  organization.rowHeight[rowIndex] = h3;
                  extraHeight = organization.rowHeight[rowIndex] - extraHeight;
                }
                organization.height += extraHeight;
                organization.rows[rowIndex].push(node2);
              };
              CoSELayout.prototype.getShortestRowIndex = function(organization) {
                var r2 = -1;
                var min9 = Number.MAX_VALUE;
                for (var i2 = 0; i2 < organization.rows.length; i2++) {
                  if (organization.rowWidth[i2] < min9) {
                    r2 = i2;
                    min9 = organization.rowWidth[i2];
                  }
                }
                return r2;
              };
              CoSELayout.prototype.getLongestRowIndex = function(organization) {
                var r2 = -1;
                var max10 = Number.MIN_VALUE;
                for (var i2 = 0; i2 < organization.rows.length; i2++) {
                  if (organization.rowWidth[i2] > max10) {
                    r2 = i2;
                    max10 = organization.rowWidth[i2];
                  }
                }
                return r2;
              };
              CoSELayout.prototype.canAddHorizontal = function(organization, extraWidth, extraHeight) {
                var sri = this.getShortestRowIndex(organization);
                if (sri < 0) {
                  return true;
                }
                var min9 = organization.rowWidth[sri];
                if (min9 + organization.horizontalPadding + extraWidth <= organization.width) return true;
                var hDiff = 0;
                if (organization.rowHeight[sri] < extraHeight) {
                  if (sri > 0) hDiff = extraHeight + organization.verticalPadding - organization.rowHeight[sri];
                }
                var add_to_row_ratio;
                if (organization.width - min9 >= extraWidth + organization.horizontalPadding) {
                  add_to_row_ratio = (organization.height + hDiff) / (min9 + extraWidth + organization.horizontalPadding);
                } else {
                  add_to_row_ratio = (organization.height + hDiff) / organization.width;
                }
                hDiff = extraHeight + organization.verticalPadding;
                var add_new_row_ratio;
                if (organization.width < extraWidth) {
                  add_new_row_ratio = (organization.height + hDiff) / extraWidth;
                } else {
                  add_new_row_ratio = (organization.height + hDiff) / organization.width;
                }
                if (add_new_row_ratio < 1) add_new_row_ratio = 1 / add_new_row_ratio;
                if (add_to_row_ratio < 1) add_to_row_ratio = 1 / add_to_row_ratio;
                return add_to_row_ratio < add_new_row_ratio;
              };
              CoSELayout.prototype.shiftToLastRow = function(organization) {
                var longest = this.getLongestRowIndex(organization);
                var last3 = organization.rowWidth.length - 1;
                var row = organization.rows[longest];
                var node2 = row[row.length - 1];
                var diff2 = node2.width + organization.horizontalPadding;
                if (organization.width - organization.rowWidth[last3] > diff2 && longest != last3) {
                  row.splice(-1, 1);
                  organization.rows[last3].push(node2);
                  organization.rowWidth[longest] = organization.rowWidth[longest] - diff2;
                  organization.rowWidth[last3] = organization.rowWidth[last3] + diff2;
                  organization.width = organization.rowWidth[instance.getLongestRowIndex(organization)];
                  var maxHeight = Number.MIN_VALUE;
                  for (var i2 = 0; i2 < row.length; i2++) {
                    if (row[i2].height > maxHeight) maxHeight = row[i2].height;
                  }
                  if (longest > 0) maxHeight += organization.verticalPadding;
                  var prevTotal = organization.rowHeight[longest] + organization.rowHeight[last3];
                  organization.rowHeight[longest] = maxHeight;
                  if (organization.rowHeight[last3] < node2.height + organization.verticalPadding) organization.rowHeight[last3] = node2.height + organization.verticalPadding;
                  var finalTotal = organization.rowHeight[longest] + organization.rowHeight[last3];
                  organization.height += finalTotal - prevTotal;
                  this.shiftToLastRow(organization);
                }
              };
              CoSELayout.prototype.tilingPreLayout = function() {
                if (CoSEConstants.TILE) {
                  this.groupZeroDegreeMembers();
                  this.clearCompounds();
                  this.clearZeroDegreeMembers();
                }
              };
              CoSELayout.prototype.tilingPostLayout = function() {
                if (CoSEConstants.TILE) {
                  this.repopulateZeroDegreeMembers();
                  this.repopulateCompounds();
                }
              };
              CoSELayout.prototype.reduceTrees = function() {
                var prunedNodesAll = [];
                var containsLeaf = true;
                var node2;
                while (containsLeaf) {
                  var allNodes = this.graphManager.getAllNodes();
                  var prunedNodesInStepTemp = [];
                  containsLeaf = false;
                  for (var i2 = 0; i2 < allNodes.length; i2++) {
                    node2 = allNodes[i2];
                    if (node2.getEdges().length == 1 && !node2.getEdges()[0].isInterGraph && node2.getChild() == null) {
                      prunedNodesInStepTemp.push([node2, node2.getEdges()[0], node2.getOwner()]);
                      containsLeaf = true;
                    }
                  }
                  if (containsLeaf == true) {
                    var prunedNodesInStep = [];
                    for (var j3 = 0; j3 < prunedNodesInStepTemp.length; j3++) {
                      if (prunedNodesInStepTemp[j3][0].getEdges().length == 1) {
                        prunedNodesInStep.push(prunedNodesInStepTemp[j3]);
                        prunedNodesInStepTemp[j3][0].getOwner().remove(prunedNodesInStepTemp[j3][0]);
                      }
                    }
                    prunedNodesAll.push(prunedNodesInStep);
                    this.graphManager.resetAllNodes();
                    this.graphManager.resetAllEdges();
                  }
                }
                this.prunedNodesAll = prunedNodesAll;
              };
              CoSELayout.prototype.growTree = function(prunedNodesAll) {
                var lengthOfPrunedNodesInStep = prunedNodesAll.length;
                var prunedNodesInStep = prunedNodesAll[lengthOfPrunedNodesInStep - 1];
                var nodeData2;
                for (var i2 = 0; i2 < prunedNodesInStep.length; i2++) {
                  nodeData2 = prunedNodesInStep[i2];
                  this.findPlaceforPrunedNode(nodeData2);
                  nodeData2[2].add(nodeData2[0]);
                  nodeData2[2].add(nodeData2[1], nodeData2[1].source, nodeData2[1].target);
                }
                prunedNodesAll.splice(prunedNodesAll.length - 1, 1);
                this.graphManager.resetAllNodes();
                this.graphManager.resetAllEdges();
              };
              CoSELayout.prototype.findPlaceforPrunedNode = function(nodeData2) {
                var gridForPrunedNode;
                var nodeToConnect;
                var prunedNode = nodeData2[0];
                if (prunedNode == nodeData2[1].source) {
                  nodeToConnect = nodeData2[1].target;
                } else {
                  nodeToConnect = nodeData2[1].source;
                }
                var startGridX = nodeToConnect.startX;
                var finishGridX = nodeToConnect.finishX;
                var startGridY = nodeToConnect.startY;
                var finishGridY = nodeToConnect.finishY;
                var upNodeCount = 0;
                var downNodeCount = 0;
                var rightNodeCount = 0;
                var leftNodeCount = 0;
                var controlRegions = [upNodeCount, rightNodeCount, downNodeCount, leftNodeCount];
                if (startGridY > 0) {
                  for (var i2 = startGridX; i2 <= finishGridX; i2++) {
                    controlRegions[0] += this.grid[i2][startGridY - 1].length + this.grid[i2][startGridY].length - 1;
                  }
                }
                if (finishGridX < this.grid.length - 1) {
                  for (var i2 = startGridY; i2 <= finishGridY; i2++) {
                    controlRegions[1] += this.grid[finishGridX + 1][i2].length + this.grid[finishGridX][i2].length - 1;
                  }
                }
                if (finishGridY < this.grid[0].length - 1) {
                  for (var i2 = startGridX; i2 <= finishGridX; i2++) {
                    controlRegions[2] += this.grid[i2][finishGridY + 1].length + this.grid[i2][finishGridY].length - 1;
                  }
                }
                if (startGridX > 0) {
                  for (var i2 = startGridY; i2 <= finishGridY; i2++) {
                    controlRegions[3] += this.grid[startGridX - 1][i2].length + this.grid[startGridX][i2].length - 1;
                  }
                }
                var min9 = Integer.MAX_VALUE;
                var minCount;
                var minIndex;
                for (var j3 = 0; j3 < controlRegions.length; j3++) {
                  if (controlRegions[j3] < min9) {
                    min9 = controlRegions[j3];
                    minCount = 1;
                    minIndex = j3;
                  } else if (controlRegions[j3] == min9) {
                    minCount++;
                  }
                }
                if (minCount == 3 && min9 == 0) {
                  if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[2] == 0) {
                    gridForPrunedNode = 1;
                  } else if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[3] == 0) {
                    gridForPrunedNode = 0;
                  } else if (controlRegions[0] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) {
                    gridForPrunedNode = 3;
                  } else if (controlRegions[1] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) {
                    gridForPrunedNode = 2;
                  }
                } else if (minCount == 2 && min9 == 0) {
                  var random2 = Math.floor(Math.random() * 2);
                  if (controlRegions[0] == 0 && controlRegions[1] == 0) {
                    ;
                    if (random2 == 0) {
                      gridForPrunedNode = 0;
                    } else {
                      gridForPrunedNode = 1;
                    }
                  } else if (controlRegions[0] == 0 && controlRegions[2] == 0) {
                    if (random2 == 0) {
                      gridForPrunedNode = 0;
                    } else {
                      gridForPrunedNode = 2;
                    }
                  } else if (controlRegions[0] == 0 && controlRegions[3] == 0) {
                    if (random2 == 0) {
                      gridForPrunedNode = 0;
                    } else {
                      gridForPrunedNode = 3;
                    }
                  } else if (controlRegions[1] == 0 && controlRegions[2] == 0) {
                    if (random2 == 0) {
                      gridForPrunedNode = 1;
                    } else {
                      gridForPrunedNode = 2;
                    }
                  } else if (controlRegions[1] == 0 && controlRegions[3] == 0) {
                    if (random2 == 0) {
                      gridForPrunedNode = 1;
                    } else {
                      gridForPrunedNode = 3;
                    }
                  } else {
                    if (random2 == 0) {
                      gridForPrunedNode = 2;
                    } else {
                      gridForPrunedNode = 3;
                    }
                  }
                } else if (minCount == 4 && min9 == 0) {
                  var random2 = Math.floor(Math.random() * 4);
                  gridForPrunedNode = random2;
                } else {
                  gridForPrunedNode = minIndex;
                }
                if (gridForPrunedNode == 0) {
                  prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() - nodeToConnect.getHeight() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getHeight() / 2);
                } else if (gridForPrunedNode == 1) {
                  prunedNode.setCenter(nodeToConnect.getCenterX() + nodeToConnect.getWidth() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getWidth() / 2, nodeToConnect.getCenterY());
                } else if (gridForPrunedNode == 2) {
                  prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() + nodeToConnect.getHeight() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getHeight() / 2);
                } else {
                  prunedNode.setCenter(nodeToConnect.getCenterX() - nodeToConnect.getWidth() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getWidth() / 2, nodeToConnect.getCenterY());
                }
              };
              module3.exports = CoSELayout;
            }),
            /* 7 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var coseBase = {};
              coseBase.layoutBase = __webpack_require__(0);
              coseBase.CoSEConstants = __webpack_require__(1);
              coseBase.CoSEEdge = __webpack_require__(2);
              coseBase.CoSEGraph = __webpack_require__(3);
              coseBase.CoSEGraphManager = __webpack_require__(4);
              coseBase.CoSELayout = __webpack_require__(6);
              coseBase.CoSENode = __webpack_require__(5);
              module3.exports = coseBase;
            })
            /******/
          ])
        );
      });
    }
  });

  // ../../node_modules/.pnpm/cytoscape-cose-bilkent@4.1.0_cytoscape@3.33.1/node_modules/cytoscape-cose-bilkent/cytoscape-cose-bilkent.js
  var require_cytoscape_cose_bilkent = __commonJS({
    "../../node_modules/.pnpm/cytoscape-cose-bilkent@4.1.0_cytoscape@3.33.1/node_modules/cytoscape-cose-bilkent/cytoscape-cose-bilkent.js"(exports2, module2) {
      "use strict";
      (/* @__PURE__ */ __name((function webpackUniversalModuleDefinition(root3, factory) {
        if (typeof exports2 === "object" && typeof module2 === "object")
          module2.exports = factory(require_cose_base());
        else if (typeof define === "function" && define.amd)
          define(["cose-base"], factory);
        else if (typeof exports2 === "object")
          exports2["cytoscapeCoseBilkent"] = factory(require_cose_base());
        else
          root3["cytoscapeCoseBilkent"] = factory(root3["coseBase"]);
      }), "webpackUniversalModuleDefinition"))(exports2, function(__WEBPACK_EXTERNAL_MODULE_0__) {
        return (
          /******/
          (function(modules2) {
            var installedModules = {};
            function __webpack_require__(moduleId) {
              if (installedModules[moduleId]) {
                return installedModules[moduleId].exports;
              }
              var module3 = installedModules[moduleId] = {
                /******/
                i: moduleId,
                /******/
                l: false,
                /******/
                exports: {}
                /******/
              };
              modules2[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__);
              module3.l = true;
              return module3.exports;
            }
            __name(__webpack_require__, "__webpack_require__");
            __webpack_require__.m = modules2;
            __webpack_require__.c = installedModules;
            __webpack_require__.i = function(value2) {
              return value2;
            };
            __webpack_require__.d = function(exports3, name, getter) {
              if (!__webpack_require__.o(exports3, name)) {
                Object.defineProperty(exports3, name, {
                  /******/
                  configurable: false,
                  /******/
                  enumerable: true,
                  /******/
                  get: getter
                  /******/
                });
              }
            };
            __webpack_require__.n = function(module3) {
              var getter = module3 && module3.__esModule ? (
                /******/
                /* @__PURE__ */ __name(function getDefault() {
                  return module3["default"];
                }, "getDefault")
              ) : (
                /******/
                /* @__PURE__ */ __name(function getModuleExports() {
                  return module3;
                }, "getModuleExports")
              );
              __webpack_require__.d(getter, "a", getter);
              return getter;
            };
            __webpack_require__.o = function(object3, property2) {
              return Object.prototype.hasOwnProperty.call(object3, property2);
            };
            __webpack_require__.p = "";
            return __webpack_require__(__webpack_require__.s = 1);
          })([
            /* 0 */
            /***/
            (function(module3, exports3) {
              module3.exports = __WEBPACK_EXTERNAL_MODULE_0__;
            }),
            /* 1 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LayoutConstants = __webpack_require__(0).layoutBase.LayoutConstants;
              var FDLayoutConstants = __webpack_require__(0).layoutBase.FDLayoutConstants;
              var CoSEConstants = __webpack_require__(0).CoSEConstants;
              var CoSELayout = __webpack_require__(0).CoSELayout;
              var CoSENode = __webpack_require__(0).CoSENode;
              var PointD = __webpack_require__(0).layoutBase.PointD;
              var DimensionD2 = __webpack_require__(0).layoutBase.DimensionD;
              var defaults4 = {
                // Called on `layoutready`
                ready: /* @__PURE__ */ __name(function ready4() {
                }, "ready"),
                // Called on `layoutstop`
                stop: /* @__PURE__ */ __name(function stop5() {
                }, "stop"),
                // 'draft', 'default' or 'proof" 
                // - 'draft' fast cooling rate 
                // - 'default' moderate cooling rate 
                // - "proof" slow cooling rate
                quality: "default",
                // include labels in node dimensions
                nodeDimensionsIncludeLabels: false,
                // number of ticks per frame; higher is faster but more jerky
                refresh: 30,
                // Whether to fit the network view after when done
                fit: true,
                // Padding on fit
                padding: 10,
                // Whether to enable incremental mode
                randomize: true,
                // Node repulsion (non overlapping) multiplier
                nodeRepulsion: 4500,
                // Ideal edge (non nested) length
                idealEdgeLength: 50,
                // Divisor to compute edge forces
                edgeElasticity: 0.45,
                // Nesting factor (multiplier) to compute ideal edge length for nested edges
                nestingFactor: 0.1,
                // Gravity force (constant)
                gravity: 0.25,
                // Maximum number of iterations to perform
                numIter: 2500,
                // For enabling tiling
                tile: true,
                // Type of layout animation. The option set is {'during', 'end', false}
                animate: "end",
                // Duration for animate:end
                animationDuration: 500,
                // Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function)
                tilingPaddingVertical: 10,
                // Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function)
                tilingPaddingHorizontal: 10,
                // Gravity range (constant) for compounds
                gravityRangeCompound: 1.5,
                // Gravity force (constant) for compounds
                gravityCompound: 1,
                // Gravity range (constant)
                gravityRange: 3.8,
                // Initial cooling factor for incremental layout
                initialEnergyOnIncremental: 0.5
              };
              function extend5(defaults5, options2) {
                var obj = {};
                for (var i2 in defaults5) {
                  obj[i2] = defaults5[i2];
                }
                for (var i2 in options2) {
                  obj[i2] = options2[i2];
                }
                return obj;
              }
              __name(extend5, "extend");
              ;
              function _CoSELayout(_options) {
                this.options = extend5(defaults4, _options);
                getUserOptions(this.options);
              }
              __name(_CoSELayout, "_CoSELayout");
              var getUserOptions = /* @__PURE__ */ __name(function getUserOptions2(options2) {
                if (options2.nodeRepulsion != null) CoSEConstants.DEFAULT_REPULSION_STRENGTH = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH = options2.nodeRepulsion;
                if (options2.idealEdgeLength != null) CoSEConstants.DEFAULT_EDGE_LENGTH = FDLayoutConstants.DEFAULT_EDGE_LENGTH = options2.idealEdgeLength;
                if (options2.edgeElasticity != null) CoSEConstants.DEFAULT_SPRING_STRENGTH = FDLayoutConstants.DEFAULT_SPRING_STRENGTH = options2.edgeElasticity;
                if (options2.nestingFactor != null) CoSEConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = options2.nestingFactor;
                if (options2.gravity != null) CoSEConstants.DEFAULT_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = options2.gravity;
                if (options2.numIter != null) CoSEConstants.MAX_ITERATIONS = FDLayoutConstants.MAX_ITERATIONS = options2.numIter;
                if (options2.gravityRange != null) CoSEConstants.DEFAULT_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = options2.gravityRange;
                if (options2.gravityCompound != null) CoSEConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = options2.gravityCompound;
                if (options2.gravityRangeCompound != null) CoSEConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = options2.gravityRangeCompound;
                if (options2.initialEnergyOnIncremental != null) CoSEConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = options2.initialEnergyOnIncremental;
                if (options2.quality == "draft") LayoutConstants.QUALITY = 0;
                else if (options2.quality == "proof") LayoutConstants.QUALITY = 2;
                else LayoutConstants.QUALITY = 1;
                CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS = FDLayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = options2.nodeDimensionsIncludeLabels;
                CoSEConstants.DEFAULT_INCREMENTAL = FDLayoutConstants.DEFAULT_INCREMENTAL = LayoutConstants.DEFAULT_INCREMENTAL = !options2.randomize;
                CoSEConstants.ANIMATE = FDLayoutConstants.ANIMATE = LayoutConstants.ANIMATE = options2.animate;
                CoSEConstants.TILE = options2.tile;
                CoSEConstants.TILING_PADDING_VERTICAL = typeof options2.tilingPaddingVertical === "function" ? options2.tilingPaddingVertical.call() : options2.tilingPaddingVertical;
                CoSEConstants.TILING_PADDING_HORIZONTAL = typeof options2.tilingPaddingHorizontal === "function" ? options2.tilingPaddingHorizontal.call() : options2.tilingPaddingHorizontal;
              }, "getUserOptions");
              _CoSELayout.prototype.run = function() {
                var ready4;
                var frameId;
                var options2 = this.options;
                var idToLNode = this.idToLNode = {};
                var layout7 = this.layout = new CoSELayout();
                var self2 = this;
                self2.stopped = false;
                this.cy = this.options.cy;
                this.cy.trigger({ type: "layoutstart", layout: this });
                var gm = layout7.newGraphManager();
                this.gm = gm;
                var nodes5 = this.options.eles.nodes();
                var edges3 = this.options.eles.edges();
                this.root = gm.addRoot();
                this.processChildrenList(this.root, this.getTopMostNodes(nodes5), layout7);
                for (var i2 = 0; i2 < edges3.length; i2++) {
                  var edge = edges3[i2];
                  var sourceNode = this.idToLNode[edge.data("source")];
                  var targetNode = this.idToLNode[edge.data("target")];
                  if (sourceNode !== targetNode && sourceNode.getEdgesBetween(targetNode).length == 0) {
                    var e1 = gm.add(layout7.newEdge(), sourceNode, targetNode);
                    e1.id = edge.id();
                  }
                }
                var getPositions = /* @__PURE__ */ __name(function getPositions2(ele, i3) {
                  if (typeof ele === "number") {
                    ele = i3;
                  }
                  var theId = ele.data("id");
                  var lNode = self2.idToLNode[theId];
                  return {
                    x: lNode.getRect().getCenterX(),
                    y: lNode.getRect().getCenterY()
                  };
                }, "getPositions");
                var iterateAnimated = /* @__PURE__ */ __name(function iterateAnimated2() {
                  var afterReposition = /* @__PURE__ */ __name(function afterReposition2() {
                    if (options2.fit) {
                      options2.cy.fit(options2.eles, options2.padding);
                    }
                    if (!ready4) {
                      ready4 = true;
                      self2.cy.one("layoutready", options2.ready);
                      self2.cy.trigger({ type: "layoutready", layout: self2 });
                    }
                  }, "afterReposition");
                  var ticksPerFrame = self2.options.refresh;
                  var isDone;
                  for (var i3 = 0; i3 < ticksPerFrame && !isDone; i3++) {
                    isDone = self2.stopped || self2.layout.tick();
                  }
                  if (isDone) {
                    if (layout7.checkLayoutSuccess() && !layout7.isSubLayout) {
                      layout7.doPostLayout();
                    }
                    if (layout7.tilingPostLayout) {
                      layout7.tilingPostLayout();
                    }
                    layout7.isLayoutFinished = true;
                    self2.options.eles.nodes().positions(getPositions);
                    afterReposition();
                    self2.cy.one("layoutstop", self2.options.stop);
                    self2.cy.trigger({ type: "layoutstop", layout: self2 });
                    if (frameId) {
                      cancelAnimationFrame(frameId);
                    }
                    ready4 = false;
                    return;
                  }
                  var animationData = self2.layout.getPositionsData();
                  options2.eles.nodes().positions(function(ele, i4) {
                    if (typeof ele === "number") {
                      ele = i4;
                    }
                    if (!ele.isParent()) {
                      var theId = ele.id();
                      var pNode = animationData[theId];
                      var temp = ele;
                      while (pNode == null) {
                        pNode = animationData[temp.data("parent")] || animationData["DummyCompound_" + temp.data("parent")];
                        animationData[theId] = pNode;
                        temp = temp.parent()[0];
                        if (temp == void 0) {
                          break;
                        }
                      }
                      if (pNode != null) {
                        return {
                          x: pNode.x,
                          y: pNode.y
                        };
                      } else {
                        return {
                          x: ele.position("x"),
                          y: ele.position("y")
                        };
                      }
                    }
                  });
                  afterReposition();
                  frameId = requestAnimationFrame(iterateAnimated2);
                }, "iterateAnimated");
                layout7.addListener("layoutstarted", function() {
                  if (self2.options.animate === "during") {
                    frameId = requestAnimationFrame(iterateAnimated);
                  }
                });
                layout7.runLayout();
                if (this.options.animate !== "during") {
                  self2.options.eles.nodes().not(":parent").layoutPositions(self2, self2.options, getPositions);
                  ready4 = false;
                }
                return this;
              };
              _CoSELayout.prototype.getTopMostNodes = function(nodes5) {
                var nodesMap2 = {};
                for (var i2 = 0; i2 < nodes5.length; i2++) {
                  nodesMap2[nodes5[i2].id()] = true;
                }
                var roots = nodes5.filter(function(ele, i3) {
                  if (typeof ele === "number") {
                    ele = i3;
                  }
                  var parent4 = ele.parent()[0];
                  while (parent4 != null) {
                    if (nodesMap2[parent4.id()]) {
                      return false;
                    }
                    parent4 = parent4.parent()[0];
                  }
                  return true;
                });
                return roots;
              };
              _CoSELayout.prototype.processChildrenList = function(parent4, children2, layout7) {
                var size4 = children2.length;
                for (var i2 = 0; i2 < size4; i2++) {
                  var theChild = children2[i2];
                  var children_of_children = theChild.children();
                  var theNode;
                  var dimensions2 = theChild.layoutDimensions({
                    nodeDimensionsIncludeLabels: this.options.nodeDimensionsIncludeLabels
                  });
                  if (theChild.outerWidth() != null && theChild.outerHeight() != null) {
                    theNode = parent4.add(new CoSENode(layout7.graphManager, new PointD(theChild.position("x") - dimensions2.w / 2, theChild.position("y") - dimensions2.h / 2), new DimensionD2(parseFloat(dimensions2.w), parseFloat(dimensions2.h))));
                  } else {
                    theNode = parent4.add(new CoSENode(this.graphManager));
                  }
                  theNode.id = theChild.data("id");
                  theNode.paddingLeft = parseInt(theChild.css("padding"));
                  theNode.paddingTop = parseInt(theChild.css("padding"));
                  theNode.paddingRight = parseInt(theChild.css("padding"));
                  theNode.paddingBottom = parseInt(theChild.css("padding"));
                  if (this.options.nodeDimensionsIncludeLabels) {
                    if (theChild.isParent()) {
                      var labelWidth = theChild.boundingBox({ includeLabels: true, includeNodes: false }).w;
                      var labelHeight = theChild.boundingBox({ includeLabels: true, includeNodes: false }).h;
                      var labelPos = theChild.css("text-halign");
                      theNode.labelWidth = labelWidth;
                      theNode.labelHeight = labelHeight;
                      theNode.labelPos = labelPos;
                    }
                  }
                  this.idToLNode[theChild.data("id")] = theNode;
                  if (isNaN(theNode.rect.x)) {
                    theNode.rect.x = 0;
                  }
                  if (isNaN(theNode.rect.y)) {
                    theNode.rect.y = 0;
                  }
                  if (children_of_children != null && children_of_children.length > 0) {
                    var theNewGraph;
                    theNewGraph = layout7.getGraphManager().add(layout7.newGraph(), theNode);
                    this.processChildrenList(theNewGraph, children_of_children, layout7);
                  }
                }
              };
              _CoSELayout.prototype.stop = function() {
                this.stopped = true;
                return this;
              };
              var register = /* @__PURE__ */ __name(function register2(cytoscape4) {
                cytoscape4("layout", "cose-bilkent", _CoSELayout);
              }, "register");
              if (typeof cytoscape !== "undefined") {
                register(cytoscape);
              }
              module3.exports = register;
            })
            /******/
          ])
        );
      });
    }
  });

  // src/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.ts
  function addNodes(nodes5, cy) {
    nodes5.forEach((node2) => {
      const nodeData2 = {
        id: node2.id,
        labelText: node2.label,
        height: node2.height,
        width: node2.width,
        padding: node2.padding ?? 0
      };
      Object.keys(node2).forEach((key) => {
        if (!["id", "label", "height", "width", "padding", "x", "y"].includes(key)) {
          nodeData2[key] = node2[key];
        }
      });
      cy.add({
        group: "nodes",
        data: nodeData2,
        position: {
          x: node2.x ?? 0,
          y: node2.y ?? 0
        }
      });
    });
  }
  function addEdges(edges3, cy) {
    edges3.forEach((edge) => {
      const edgeData2 = {
        id: edge.id,
        source: edge.start,
        target: edge.end
      };
      Object.keys(edge).forEach((key) => {
        if (!["id", "start", "end"].includes(key)) {
          edgeData2[key] = edge[key];
        }
      });
      cy.add({
        group: "edges",
        data: edgeData2
      });
    });
  }
  function createCytoscapeInstance(data5) {
    return new Promise((resolve2) => {
      const renderEl = select_default2("body").append("div").attr("id", "cy").attr("style", "display:none");
      const cy = cytoscape2({
        container: document.getElementById("cy"),
        // container to render in
        style: [
          {
            selector: "edge",
            style: {
              "curve-style": "bezier"
            }
          }
        ]
      });
      renderEl.remove();
      addNodes(data5.nodes, cy);
      addEdges(data5.edges, cy);
      cy.nodes().forEach(function(n2) {
        n2.layoutDimensions = () => {
          const nodeData2 = n2.data();
          return { w: nodeData2.width, h: nodeData2.height };
        };
      });
      const layoutConfig = {
        name: "cose-bilkent",
        // @ts-ignore Types for cose-bilkent are not correct?
        quality: "proof",
        styleEnabled: false,
        animate: false
      };
      cy.layout(layoutConfig).run();
      cy.ready((e3) => {
        log.info("Cytoscape ready", e3);
        resolve2(cy);
      });
    });
  }
  function extractPositionedNodes(cy) {
    return cy.nodes().map((node2) => {
      const data5 = node2.data();
      const position5 = node2.position();
      const positionedNode = {
        id: data5.id,
        x: position5.x,
        y: position5.y
      };
      Object.keys(data5).forEach((key) => {
        if (key !== "id") {
          positionedNode[key] = data5[key];
        }
      });
      return positionedNode;
    });
  }
  function extractPositionedEdges(cy) {
    return cy.edges().map((edge) => {
      const data5 = edge.data();
      const rscratch = edge._private.rscratch;
      const positionedEdge = {
        id: data5.id,
        source: data5.source,
        target: data5.target,
        startX: rscratch.startX,
        startY: rscratch.startY,
        midX: rscratch.midX,
        midY: rscratch.midY,
        endX: rscratch.endX,
        endY: rscratch.endY
      };
      Object.keys(data5).forEach((key) => {
        if (!["id", "source", "target"].includes(key)) {
          positionedEdge[key] = data5[key];
        }
      });
      return positionedEdge;
    });
  }
  var import_cytoscape_cose_bilkent;
  var init_cytoscape_setup = __esm({
    "src/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.ts"() {
      "use strict";
      init_cytoscape_esm();
      import_cytoscape_cose_bilkent = __toESM(require_cytoscape_cose_bilkent(), 1);
      init_src32();
      init_logger();
      cytoscape2.use(import_cytoscape_cose_bilkent.default);
      __name(addNodes, "addNodes");
      __name(addEdges, "addEdges");
      __name(createCytoscapeInstance, "createCytoscapeInstance");
      __name(extractPositionedNodes, "extractPositionedNodes");
      __name(extractPositionedEdges, "extractPositionedEdges");
    }
  });

  // src/rendering-util/layout-algorithms/cose-bilkent/layout.ts
  async function executeCoseBilkentLayout(data5, _config) {
    log.debug("Starting cose-bilkent layout algorithm");
    try {
      validateLayoutData(data5);
      const cy = await createCytoscapeInstance(data5);
      const positionedNodes = extractPositionedNodes(cy);
      const positionedEdges = extractPositionedEdges(cy);
      log.debug(`Layout completed: ${positionedNodes.length} nodes, ${positionedEdges.length} edges`);
      return {
        nodes: positionedNodes,
        edges: positionedEdges
      };
    } catch (error3) {
      log.error("Error in cose-bilkent layout algorithm:", error3);
      throw error3;
    }
  }
  function validateLayoutData(data5) {
    if (!data5) {
      throw new Error("Layout data is required");
    }
    if (!data5.config) {
      throw new Error("Configuration is required in layout data");
    }
    if (!data5.rootNode) {
      throw new Error("Root node is required");
    }
    if (!data5.nodes || !Array.isArray(data5.nodes)) {
      throw new Error("No nodes found in layout data");
    }
    if (!Array.isArray(data5.edges)) {
      throw new Error("Edges array is required in layout data");
    }
    return true;
  }
  var init_layout2 = __esm({
    "src/rendering-util/layout-algorithms/cose-bilkent/layout.ts"() {
      "use strict";
      init_logger();
      init_cytoscape_setup();
      __name(executeCoseBilkentLayout, "executeCoseBilkentLayout");
      __name(validateLayoutData, "validateLayoutData");
    }
  });

  // src/rendering-util/layout-algorithms/cose-bilkent/render.ts
  var render4;
  var init_render = __esm({
    "src/rendering-util/layout-algorithms/cose-bilkent/render.ts"() {
      "use strict";
      init_layout2();
      render4 = /* @__PURE__ */ __name(async (data4Layout, svg2, {
        insertCluster: insertCluster2,
        insertEdge: insertEdge3,
        insertEdgeLabel: insertEdgeLabel3,
        insertMarkers: insertMarkers4,
        insertNode: insertNode3,
        log: log3,
        positionEdgeLabel: positionEdgeLabel3
      }, { algorithm: _algorithm }) => {
        const nodeDb2 = {};
        const clusterDb2 = {};
        const element3 = svg2.select("g");
        insertMarkers4(element3, data4Layout.markers, data4Layout.type, data4Layout.diagramId);
        const subGraphsEl = element3.insert("g").attr("class", "subgraphs");
        const edgePaths = element3.insert("g").attr("class", "edgePaths");
        const edgeLabels3 = element3.insert("g").attr("class", "edgeLabels");
        const nodes5 = element3.insert("g").attr("class", "nodes");
        log3.debug("Inserting nodes into DOM for dimension calculation");
        await Promise.all(
          data4Layout.nodes.map(async (node2) => {
            if (node2.isGroup) {
              const clusterNode = { ...node2 };
              clusterDb2[node2.id] = clusterNode;
              nodeDb2[node2.id] = clusterNode;
              await insertCluster2(subGraphsEl, node2);
            } else {
              const nodeWithPosition = { ...node2 };
              nodeDb2[node2.id] = nodeWithPosition;
              const nodeEl = await insertNode3(nodes5, node2, {
                config: data4Layout.config,
                dir: data4Layout.direction || "TB"
              });
              const boundingBox3 = nodeEl.node().getBBox();
              nodeWithPosition.width = boundingBox3.width;
              nodeWithPosition.height = boundingBox3.height;
              nodeWithPosition.domId = nodeEl;
              log3.debug(`Node ${node2.id} dimensions: ${boundingBox3.width}x${boundingBox3.height}`);
            }
          })
        );
        log3.debug("Running cose-bilkent layout algorithm");
        const updatedLayoutData = {
          ...data4Layout,
          nodes: data4Layout.nodes.map((node2) => {
            const nodeWithDimensions = nodeDb2[node2.id];
            return {
              ...node2,
              width: nodeWithDimensions.width,
              height: nodeWithDimensions.height
            };
          })
        };
        const layoutResult = await executeCoseBilkentLayout(updatedLayoutData, data4Layout.config);
        log3.debug("Positioning nodes based on layout results");
        layoutResult.nodes.forEach((positionedNode) => {
          const node2 = nodeDb2[positionedNode.id];
          if (node2?.domId) {
            node2.domId.attr(
              "transform",
              `translate(${positionedNode.x}, ${positionedNode.y})`
            );
            node2.x = positionedNode.x;
            node2.y = positionedNode.y;
            log3.debug(`Positioned node ${node2.id} at center (${positionedNode.x}, ${positionedNode.y})`);
          }
        });
        layoutResult.edges.forEach((positionedEdge) => {
          const edge = data4Layout.edges.find((e3) => e3.id === positionedEdge.id);
          if (edge) {
            edge.points = [
              { x: positionedEdge.startX, y: positionedEdge.startY },
              { x: positionedEdge.midX, y: positionedEdge.midY },
              { x: positionedEdge.endX, y: positionedEdge.endY }
            ];
          }
        });
        log3.debug("Inserting and positioning edges");
        await Promise.all(
          data4Layout.edges.map(async (edge) => {
            const _edgeLabel = await insertEdgeLabel3(edgeLabels3, edge);
            const startNode = nodeDb2[edge.start ?? ""];
            const endNode = nodeDb2[edge.end ?? ""];
            if (startNode && endNode) {
              const positionedEdge = layoutResult.edges.find((e3) => e3.id === edge.id);
              if (positionedEdge) {
                log3.debug("APA01 positionedEdge", positionedEdge);
                const edgeWithPath = { ...edge };
                const paths = insertEdge3(
                  edgePaths,
                  edgeWithPath,
                  clusterDb2,
                  data4Layout.type,
                  startNode,
                  endNode,
                  data4Layout.diagramId
                );
                positionEdgeLabel3(edgeWithPath, paths);
              } else {
                const edgeWithPath = {
                  ...edge,
                  points: [
                    { x: startNode.x || 0, y: startNode.y || 0 },
                    { x: endNode.x || 0, y: endNode.y || 0 }
                  ]
                };
                const paths = insertEdge3(
                  edgePaths,
                  edgeWithPath,
                  clusterDb2,
                  data4Layout.type,
                  startNode,
                  endNode,
                  data4Layout.diagramId
                );
                positionEdgeLabel3(edgeWithPath, paths);
              }
            }
          })
        );
        log3.debug("Cose-bilkent rendering completed");
      }, "render");
    }
  });

  // src/rendering-util/layout-algorithms/cose-bilkent/index.ts
  var cose_bilkent_exports = {};
  __export(cose_bilkent_exports, {
    render: () => render5
  });
  var render5;
  var init_cose_bilkent = __esm({
    "src/rendering-util/layout-algorithms/cose-bilkent/index.ts"() {
      "use strict";
      init_render();
      render5 = render4;
    }
  });

  // src/rendering-util/render.ts
  var layoutAlgorithms, registerLayoutLoaders, registerDefaultLayoutLoaders, render6, getRegisteredLayoutAlgorithm;
  var init_render2 = __esm({
    "src/rendering-util/render.ts"() {
      "use strict";
      init_internals();
      init_logger();
      layoutAlgorithms = {};
      registerLayoutLoaders = /* @__PURE__ */ __name((loaders) => {
        for (const loader33 of loaders) {
          layoutAlgorithms[loader33.name] = loader33;
        }
      }, "registerLayoutLoaders");
      registerDefaultLayoutLoaders = /* @__PURE__ */ __name(() => {
        registerLayoutLoaders([
          {
            name: "dagre",
            loader: /* @__PURE__ */ __name(async () => await Promise.resolve().then(() => (init_dagre2(), dagre_exports)), "loader")
          },
          ...true ? [
            {
              name: "cose-bilkent",
              loader: /* @__PURE__ */ __name(async () => await Promise.resolve().then(() => (init_cose_bilkent(), cose_bilkent_exports)), "loader")
            }
          ] : []
        ]);
      }, "registerDefaultLayoutLoaders");
      registerDefaultLayoutLoaders();
      render6 = /* @__PURE__ */ __name(async (data4Layout, svg2) => {
        if (!(data4Layout.layoutAlgorithm in layoutAlgorithms)) {
          throw new Error(`Unknown layout algorithm: ${data4Layout.layoutAlgorithm}`);
        }
        if (data4Layout.diagramId) {
          for (const node2 of data4Layout.nodes) {
            const originalDomId = node2.domId || node2.id;
            node2.domId = `${data4Layout.diagramId}-${originalDomId}`;
          }
        }
        const layoutDefinition = layoutAlgorithms[data4Layout.layoutAlgorithm];
        const layoutRenderer = await layoutDefinition.loader();
        const { theme, themeVariables } = data4Layout.config;
        const { useGradient, gradientStart, gradientStop } = themeVariables;
        const svgId = svg2.attr("id");
        svg2.append("defs").append("filter").attr("id", `${svgId}-drop-shadow`).attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", `${theme?.includes("dark") ? "#FFFFFF" : "#000000"}`);
        svg2.append("defs").append("filter").attr("id", `${svgId}-drop-shadow-small`).attr("height", "150%").attr("width", "150%").append("feDropShadow").attr("dx", "2").attr("dy", "2").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", `${theme?.includes("dark") ? "#FFFFFF" : "#000000"}`);
        if (useGradient) {
          const gradient = svg2.append("linearGradient").attr("id", svg2.attr("id") + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
          gradient.append("svg:stop").attr("offset", "0%").attr("stop-color", gradientStart).attr("stop-opacity", 1);
          gradient.append("svg:stop").attr("offset", "100%").attr("stop-color", gradientStop).attr("stop-opacity", 1);
        }
        return layoutRenderer.render(data4Layout, svg2, internalHelpers, {
          algorithm: layoutDefinition.algorithm
        });
      }, "render");
      getRegisteredLayoutAlgorithm = /* @__PURE__ */ __name((algorithm = "", { fallback = "dagre" } = {}) => {
        if (algorithm in layoutAlgorithms) {
          return algorithm;
        }
        if (fallback in layoutAlgorithms) {
          log.warn(`Layout algorithm ${algorithm} is not registered. Using ${fallback} as fallback.`);
          return fallback;
        }
        throw new Error(`Both layout algorithms ${algorithm} and ${fallback} are not registered.`);
      }, "getRegisteredLayoutAlgorithm");
    }
  });

  // src/rendering-util/setupViewPortForSVG.ts
  var setupViewPortForSVG, calculateDimensionsWithPadding, createViewBox;
  var init_setupViewPortForSVG = __esm({
    "src/rendering-util/setupViewPortForSVG.ts"() {
      "use strict";
      init_setupGraphViewbox();
      init_logger();
      setupViewPortForSVG = /* @__PURE__ */ __name((svg2, padding2, cssDiagram, useMaxWidth) => {
        svg2.attr("class", cssDiagram);
        const { width: width3, height: height2, x: x5, y: y6 } = calculateDimensionsWithPadding(svg2, padding2);
        configureSvgSize(svg2, height2, width3, useMaxWidth);
        const viewBox = createViewBox(x5, y6, width3, height2, padding2);
        svg2.attr("viewBox", viewBox);
        log.debug(`viewBox configured: ${viewBox} with padding: ${padding2}`);
      }, "setupViewPortForSVG");
      calculateDimensionsWithPadding = /* @__PURE__ */ __name((svg2, padding2) => {
        const bounds4 = svg2.node()?.getBBox() || { width: 0, height: 0, x: 0, y: 0 };
        return {
          width: bounds4.width + padding2 * 2,
          height: bounds4.height + padding2 * 2,
          x: bounds4.x,
          y: bounds4.y
        };
      }, "calculateDimensionsWithPadding");
      createViewBox = /* @__PURE__ */ __name((x5, y6, width3, height2, padding2) => {
        return `${x5 - padding2} ${y6 - padding2} ${width3} ${height2}`;
      }, "createViewBox");
    }
  });

  // src/diagrams/flowchart/flowRenderer-v3-unified.ts
  var getClasses, draw2, flowRenderer_v3_unified_default;
  var init_flowRenderer_v3_unified = __esm({
    "src/diagrams/flowchart/flowRenderer-v3-unified.ts"() {
      "use strict";
      init_diagramAPI();
      init_logger();
      init_insertElementsForSize();
      init_render2();
      init_setupViewPortForSVG();
      init_utils2();
      getClasses = /* @__PURE__ */ __name(function(text4, diagramObj) {
        return diagramObj.db.getClasses();
      }, "getClasses");
      draw2 = /* @__PURE__ */ __name(async function(text4, id34, _version, diag) {
        log.info("REF0:");
        log.info("Drawing state diagram (v2)", id34);
        const { securityLevel, flowchart: conf5, layout: layout7 } = getConfig2();
        diag.db.setDiagramId(id34);
        log.debug("Before getData: ");
        const data4Layout = diag.db.getData();
        log.debug("Data: ", data4Layout);
        const svg2 = getDiagramElement(id34, securityLevel);
        const direction2 = diag.db.getDirection();
        data4Layout.type = diag.type;
        data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(layout7);
        if (data4Layout.layoutAlgorithm === "dagre" && layout7 === "elk") {
          log.warn(
            "flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback."
          );
        }
        data4Layout.direction = direction2;
        data4Layout.nodeSpacing = conf5?.nodeSpacing || 50;
        data4Layout.rankSpacing = conf5?.rankSpacing || 50;
        data4Layout.markers = ["point", "circle", "cross"];
        data4Layout.diagramId = id34;
        log.debug("REF1:", data4Layout);
        await render6(data4Layout, svg2);
        const padding2 = data4Layout.config.flowchart?.diagramPadding ?? 8;
        utils_default2.insertTitle(
          svg2,
          "flowchartTitleText",
          conf5?.titleTopMargin || 0,
          diag.db.getDiagramTitle()
        );
        setupViewPortForSVG(svg2, padding2, "flowchart", conf5?.useMaxWidth || false);
      }, "draw");
      flowRenderer_v3_unified_default = {
        getClasses,
        draw: draw2
      };
    }
  });

  // src/diagrams/flowchart/parser/flow.jison
  var parser2, flow_default;
  var init_flow = __esm({
    "src/diagrams/flowchart/parser/flow.jison"() {
      "use strict";
      parser2 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [1, 4], $V1 = [1, 3], $V2 = [1, 5], $V3 = [1, 8, 9, 10, 11, 27, 34, 36, 38, 44, 60, 84, 85, 86, 87, 88, 89, 102, 105, 106, 109, 111, 114, 115, 116, 121, 122, 123, 124, 125], $V4 = [2, 2], $V5 = [1, 13], $V6 = [1, 14], $V7 = [1, 15], $V8 = [1, 16], $V9 = [1, 23], $Va = [1, 25], $Vb = [1, 26], $Vc = [1, 27], $Vd = [1, 50], $Ve = [1, 49], $Vf = [1, 29], $Vg = [1, 30], $Vh = [1, 31], $Vi = [1, 32], $Vj = [1, 33], $Vk = [1, 45], $Vl = [1, 47], $Vm = [1, 43], $Vn = [1, 48], $Vo = [1, 44], $Vp = [1, 51], $Vq = [1, 46], $Vr = [1, 52], $Vs = [1, 53], $Vt = [1, 34], $Vu = [1, 35], $Vv = [1, 36], $Vw = [1, 37], $Vx = [1, 38], $Vy = [1, 58], $Vz = [1, 8, 9, 10, 11, 27, 32, 34, 36, 38, 44, 60, 84, 85, 86, 87, 88, 89, 102, 105, 106, 109, 111, 114, 115, 116, 121, 122, 123, 124, 125], $VA = [1, 62], $VB = [1, 61], $VC = [1, 63], $VD = [8, 9, 11, 75, 77, 78], $VE = [1, 79], $VF = [1, 92], $VG = [1, 97], $VH = [1, 96], $VI = [1, 93], $VJ = [1, 89], $VK = [1, 95], $VL = [1, 91], $VM = [1, 98], $VN = [1, 94], $VO = [1, 99], $VP = [1, 90], $VQ = [8, 9, 10, 11, 40, 75, 77, 78], $VR = [8, 9, 10, 11, 40, 46, 75, 77, 78], $VS = [8, 9, 10, 11, 29, 40, 44, 46, 48, 50, 52, 54, 56, 58, 60, 63, 65, 67, 68, 70, 75, 77, 78, 89, 102, 105, 106, 109, 111, 114, 115, 116], $VT = [8, 9, 11, 44, 60, 75, 77, 78, 89, 102, 105, 106, 109, 111, 114, 115, 116], $VU = [44, 60, 89, 102, 105, 106, 109, 111, 114, 115, 116], $VV = [1, 122], $VW = [1, 123], $VX = [1, 125], $VY = [1, 124], $VZ = [44, 60, 62, 74, 89, 102, 105, 106, 109, 111, 114, 115, 116], $V_ = [1, 134], $V$ = [1, 148], $V01 = [1, 149], $V11 = [1, 150], $V21 = [1, 151], $V31 = [1, 136], $V41 = [1, 138], $V51 = [1, 142], $V61 = [1, 143], $V71 = [1, 144], $V81 = [1, 145], $V91 = [1, 146], $Va1 = [1, 147], $Vb1 = [1, 152], $Vc1 = [1, 153], $Vd1 = [1, 132], $Ve1 = [1, 133], $Vf1 = [1, 140], $Vg1 = [1, 135], $Vh1 = [1, 139], $Vi1 = [1, 137], $Vj1 = [8, 9, 10, 11, 27, 32, 34, 36, 38, 44, 60, 84, 85, 86, 87, 88, 89, 102, 105, 106, 109, 111, 114, 115, 116, 121, 122, 123, 124, 125], $Vk1 = [1, 155], $Vl1 = [1, 157], $Vm1 = [8, 9, 11], $Vn1 = [8, 9, 10, 11, 14, 44, 60, 89, 105, 106, 109, 111, 114, 115, 116], $Vo1 = [1, 177], $Vp1 = [1, 173], $Vq1 = [1, 174], $Vr1 = [1, 178], $Vs1 = [1, 175], $Vt1 = [1, 176], $Vu1 = [77, 116, 119], $Vv1 = [8, 9, 10, 11, 12, 14, 27, 29, 32, 44, 60, 75, 84, 85, 86, 87, 88, 89, 90, 105, 109, 111, 114, 115, 116], $Vw1 = [10, 106], $Vx1 = [31, 49, 51, 53, 55, 57, 62, 64, 66, 67, 69, 71, 116, 117, 118], $Vy1 = [1, 248], $Vz1 = [1, 246], $VA1 = [1, 250], $VB1 = [1, 244], $VC1 = [1, 245], $VD1 = [1, 247], $VE1 = [1, 249], $VF1 = [1, 251], $VG1 = [1, 269], $VH1 = [8, 9, 11, 106], $VI1 = [8, 9, 10, 11, 60, 84, 105, 106, 109, 110, 111, 112];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "graphConfig": 4, "document": 5, "line": 6, "statement": 7, "SEMI": 8, "NEWLINE": 9, "SPACE": 10, "EOF": 11, "GRAPH": 12, "NODIR": 13, "DIR": 14, "FirstStmtSeparator": 15, "ending": 16, "endToken": 17, "spaceList": 18, "spaceListNewline": 19, "vertexStatement": 20, "separator": 21, "styleStatement": 22, "linkStyleStatement": 23, "classDefStatement": 24, "classStatement": 25, "clickStatement": 26, "subgraph": 27, "textNoTags": 28, "SQS": 29, "text": 30, "SQE": 31, "end": 32, "direction": 33, "acc_title": 34, "acc_title_value": 35, "acc_descr": 36, "acc_descr_value": 37, "acc_descr_multiline_value": 38, "shapeData": 39, "SHAPE_DATA": 40, "link": 41, "node": 42, "styledVertex": 43, "AMP": 44, "vertex": 45, "STYLE_SEPARATOR": 46, "idString": 47, "DOUBLECIRCLESTART": 48, "DOUBLECIRCLEEND": 49, "PS": 50, "PE": 51, "(-": 52, "-)": 53, "STADIUMSTART": 54, "STADIUMEND": 55, "SUBROUTINESTART": 56, "SUBROUTINEEND": 57, "VERTEX_WITH_PROPS_START": 58, "NODE_STRING[field]": 59, "COLON": 60, "NODE_STRING[value]": 61, "PIPE": 62, "CYLINDERSTART": 63, "CYLINDEREND": 64, "DIAMOND_START": 65, "DIAMOND_STOP": 66, "TAGEND": 67, "TRAPSTART": 68, "TRAPEND": 69, "INVTRAPSTART": 70, "INVTRAPEND": 71, "linkStatement": 72, "arrowText": 73, "TESTSTR": 74, "START_LINK": 75, "edgeText": 76, "LINK": 77, "LINK_ID": 78, "edgeTextToken": 79, "STR": 80, "MD_STR": 81, "textToken": 82, "keywords": 83, "STYLE": 84, "LINKSTYLE": 85, "CLASSDEF": 86, "CLASS": 87, "CLICK": 88, "DOWN": 89, "UP": 90, "textNoTagsToken": 91, "stylesOpt": 92, "idString[vertex]": 93, "idString[class]": 94, "CALLBACKNAME": 95, "CALLBACKARGS": 96, "HREF": 97, "LINK_TARGET": 98, "STR[link]": 99, "STR[tooltip]": 100, "alphaNum": 101, "DEFAULT": 102, "numList": 103, "INTERPOLATE": 104, "NUM": 105, "COMMA": 106, "style": 107, "styleComponent": 108, "NODE_STRING": 109, "UNIT": 110, "BRKT": 111, "PCT": 112, "idStringToken": 113, "MINUS": 114, "MULT": 115, "UNICODE_TEXT": 116, "TEXT": 117, "TAGSTART": 118, "EDGE_TEXT": 119, "alphaNumToken": 120, "direction_tb": 121, "direction_bt": 122, "direction_rl": 123, "direction_lr": 124, "direction_td": 125, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 8: "SEMI", 9: "NEWLINE", 10: "SPACE", 11: "EOF", 12: "GRAPH", 13: "NODIR", 14: "DIR", 27: "subgraph", 29: "SQS", 31: "SQE", 32: "end", 34: "acc_title", 35: "acc_title_value", 36: "acc_descr", 37: "acc_descr_value", 38: "acc_descr_multiline_value", 40: "SHAPE_DATA", 44: "AMP", 46: "STYLE_SEPARATOR", 48: "DOUBLECIRCLESTART", 49: "DOUBLECIRCLEEND", 50: "PS", 51: "PE", 52: "(-", 53: "-)", 54: "STADIUMSTART", 55: "STADIUMEND", 56: "SUBROUTINESTART", 57: "SUBROUTINEEND", 58: "VERTEX_WITH_PROPS_START", 59: "NODE_STRING[field]", 60: "COLON", 61: "NODE_STRING[value]", 62: "PIPE", 63: "CYLINDERSTART", 64: "CYLINDEREND", 65: "DIAMOND_START", 66: "DIAMOND_STOP", 67: "TAGEND", 68: "TRAPSTART", 69: "TRAPEND", 70: "INVTRAPSTART", 71: "INVTRAPEND", 74: "TESTSTR", 75: "START_LINK", 77: "LINK", 78: "LINK_ID", 80: "STR", 81: "MD_STR", 84: "STYLE", 85: "LINKSTYLE", 86: "CLASSDEF", 87: "CLASS", 88: "CLICK", 89: "DOWN", 90: "UP", 93: "idString[vertex]", 94: "idString[class]", 95: "CALLBACKNAME", 96: "CALLBACKARGS", 97: "HREF", 98: "LINK_TARGET", 99: "STR[link]", 100: "STR[tooltip]", 102: "DEFAULT", 104: "INTERPOLATE", 105: "NUM", 106: "COMMA", 109: "NODE_STRING", 110: "UNIT", 111: "BRKT", 112: "PCT", 114: "MINUS", 115: "MULT", 116: "UNICODE_TEXT", 117: "TEXT", 118: "TAGSTART", 119: "EDGE_TEXT", 121: "direction_tb", 122: "direction_bt", 123: "direction_rl", 124: "direction_lr", 125: "direction_td" },
          productions_: [0, [3, 2], [5, 0], [5, 2], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [4, 2], [4, 2], [4, 2], [4, 3], [16, 2], [16, 1], [17, 1], [17, 1], [17, 1], [15, 1], [15, 1], [15, 2], [19, 2], [19, 2], [19, 1], [19, 1], [18, 2], [18, 1], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 9], [7, 6], [7, 4], [7, 1], [7, 2], [7, 2], [7, 1], [21, 1], [21, 1], [21, 1], [39, 2], [39, 1], [20, 4], [20, 3], [20, 4], [20, 2], [20, 2], [20, 1], [42, 1], [42, 6], [42, 5], [43, 1], [43, 3], [45, 4], [45, 4], [45, 6], [45, 4], [45, 4], [45, 4], [45, 8], [45, 4], [45, 4], [45, 4], [45, 6], [45, 4], [45, 4], [45, 4], [45, 4], [45, 4], [45, 1], [41, 2], [41, 3], [41, 3], [41, 1], [41, 3], [41, 4], [76, 1], [76, 2], [76, 1], [76, 1], [72, 1], [72, 2], [73, 3], [30, 1], [30, 2], [30, 1], [30, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [28, 1], [28, 2], [28, 1], [28, 1], [24, 5], [25, 5], [26, 2], [26, 4], [26, 3], [26, 5], [26, 3], [26, 5], [26, 5], [26, 7], [26, 2], [26, 4], [26, 2], [26, 4], [26, 4], [26, 6], [22, 5], [23, 5], [23, 5], [23, 9], [23, 9], [23, 7], [23, 7], [103, 1], [103, 3], [92, 1], [92, 3], [107, 1], [107, 2], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [82, 1], [82, 1], [82, 1], [82, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [79, 1], [79, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [47, 1], [47, 2], [101, 1], [101, 2], [33, 1], [33, 1], [33, 1], [33, 1], [33, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 2:
                this.$ = [];
                break;
              case 3:
                if (!Array.isArray($$[$0]) || $$[$0].length > 0) {
                  $$[$0 - 1].push($$[$0]);
                }
                this.$ = $$[$0 - 1];
                break;
              case 4:
              case 183:
                this.$ = $$[$0];
                break;
              case 11:
                yy.setDirection("TB");
                this.$ = "TB";
                break;
              case 12:
                yy.setDirection($$[$0 - 1]);
                this.$ = $$[$0 - 1];
                break;
              case 27:
                this.$ = $$[$0 - 1].nodes;
                break;
              case 28:
              case 29:
              case 30:
              case 31:
              case 32:
                this.$ = [];
                break;
              case 33:
                this.$ = yy.addSubGraph($$[$0 - 6], $$[$0 - 1], $$[$0 - 4]);
                break;
              case 34:
                this.$ = yy.addSubGraph($$[$0 - 3], $$[$0 - 1], $$[$0 - 3]);
                break;
              case 35:
                this.$ = yy.addSubGraph(void 0, $$[$0 - 1], void 0);
                break;
              case 37:
                this.$ = $$[$0].trim();
                yy.setAccTitle(this.$);
                break;
              case 38:
              case 39:
                this.$ = $$[$0].trim();
                yy.setAccDescription(this.$);
                break;
              case 43:
                this.$ = $$[$0 - 1] + $$[$0];
                break;
              case 44:
                this.$ = $$[$0];
                break;
              case 45:
                yy.addVertex($$[$0 - 1][$$[$0 - 1].length - 1], void 0, void 0, void 0, void 0, void 0, void 0, $$[$0]);
                yy.addLink($$[$0 - 3].stmt, $$[$0 - 1], $$[$0 - 2]);
                this.$ = { stmt: $$[$0 - 1], nodes: $$[$0 - 1].concat($$[$0 - 3].nodes) };
                break;
              case 46:
                yy.addLink($$[$0 - 2].stmt, $$[$0], $$[$0 - 1]);
                this.$ = { stmt: $$[$0], nodes: $$[$0].concat($$[$0 - 2].nodes) };
                break;
              case 47:
                yy.addLink($$[$0 - 3].stmt, $$[$0 - 1], $$[$0 - 2]);
                this.$ = { stmt: $$[$0 - 1], nodes: $$[$0 - 1].concat($$[$0 - 3].nodes) };
                break;
              case 48:
                this.$ = { stmt: $$[$0 - 1], nodes: $$[$0 - 1] };
                break;
              case 49:
                yy.addVertex($$[$0 - 1][$$[$0 - 1].length - 1], void 0, void 0, void 0, void 0, void 0, void 0, $$[$0]);
                this.$ = { stmt: $$[$0 - 1], nodes: $$[$0 - 1], shapeData: $$[$0] };
                break;
              case 50:
                this.$ = { stmt: $$[$0], nodes: $$[$0] };
                break;
              case 51:
                this.$ = [$$[$0]];
                break;
              case 52:
                yy.addVertex($$[$0 - 5][$$[$0 - 5].length - 1], void 0, void 0, void 0, void 0, void 0, void 0, $$[$0 - 4]);
                this.$ = $$[$0 - 5].concat($$[$0]);
                break;
              case 53:
                this.$ = $$[$0 - 4].concat($$[$0]);
                break;
              case 54:
                this.$ = $$[$0];
                break;
              case 55:
                this.$ = $$[$0 - 2];
                yy.setClass($$[$0 - 2], $$[$0]);
                break;
              case 56:
                this.$ = $$[$0 - 3];
                yy.addVertex($$[$0 - 3], $$[$0 - 1], "square");
                break;
              case 57:
                this.$ = $$[$0 - 3];
                yy.addVertex($$[$0 - 3], $$[$0 - 1], "doublecircle");
                break;
              case 58:
                this.$ = $$[$0 - 5];
                yy.addVertex($$[$0 - 5], $$[$0 - 2], "circle");
                break;
              case 59:
                this.$ = $$[$0 - 3];
                yy.addVertex($$[$0 - 3], $$[$0 - 1], "ellipse");
                break;
              case 60:
                this.$ = $$[$0 - 3];
                yy.addVertex($$[$0 - 3], $$[$0 - 1], "stadium");
                break;
              case 61:
                this.$ = $$[$0 - 3];
                yy.addVertex($$[$0 - 3], $$[$0 - 1], "subroutine");
                break;
              case 62:
                this.$ = $$[$0 - 7];
                yy.addVertex($$[$0 - 7], $$[$0 - 1], "rect", void 0, void 0, void 0, Object.fromEntries([[$$[$0 - 5], $$[$0 - 3]]]));
                break;
              case 63:
                this.$ = $$[$0 - 3];
                yy.addVertex($$[$0 - 3], $$[$0 - 1], "cylinder");
                break;
              case 64:
                this.$ = $$[$0 - 3];
                yy.addVertex($$[$0 - 3], $$[$0 - 1], "round");
                break;
              case 65:
                this.$ = $$[$0 - 3];
                yy.addVertex($$[$0 - 3], $$[$0 - 1], "diamond");
                break;
              case 66:
                this.$ = $$[$0 - 5];
                yy.addVertex($$[$0 - 5], $$[$0 - 2], "hexagon");
                break;
              case 67:
                this.$ = $$[$0 - 3];
                yy.addVertex($$[$0 - 3], $$[$0 - 1], "odd");
                break;
              case 68:
                this.$ = $$[$0 - 3];
                yy.addVertex($$[$0 - 3], $$[$0 - 1], "trapezoid");
                break;
              case 69:
                this.$ = $$[$0 - 3];
                yy.addVertex($$[$0 - 3], $$[$0 - 1], "inv_trapezoid");
                break;
              case 70:
                this.$ = $$[$0 - 3];
                yy.addVertex($$[$0 - 3], $$[$0 - 1], "lean_right");
                break;
              case 71:
                this.$ = $$[$0 - 3];
                yy.addVertex($$[$0 - 3], $$[$0 - 1], "lean_left");
                break;
              case 72:
                this.$ = $$[$0];
                yy.addVertex($$[$0]);
                break;
              case 73:
                $$[$0 - 1].text = $$[$0];
                this.$ = $$[$0 - 1];
                break;
              case 74:
              case 75:
                $$[$0 - 2].text = $$[$0 - 1];
                this.$ = $$[$0 - 2];
                break;
              case 76:
                this.$ = $$[$0];
                break;
              case 77:
                var inf = yy.destructLink($$[$0], $$[$0 - 2]);
                this.$ = { "type": inf.type, "stroke": inf.stroke, "length": inf.length, "text": $$[$0 - 1] };
                break;
              case 78:
                var inf = yy.destructLink($$[$0], $$[$0 - 2]);
                this.$ = { "type": inf.type, "stroke": inf.stroke, "length": inf.length, "text": $$[$0 - 1], "id": $$[$0 - 3] };
                break;
              case 79:
                this.$ = { text: $$[$0], type: "text" };
                break;
              case 80:
                this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type };
                break;
              case 81:
                this.$ = { text: $$[$0], type: "string" };
                break;
              case 82:
                this.$ = { text: $$[$0], type: "markdown" };
                break;
              case 83:
                var inf = yy.destructLink($$[$0]);
                this.$ = { "type": inf.type, "stroke": inf.stroke, "length": inf.length };
                break;
              case 84:
                var inf = yy.destructLink($$[$0]);
                this.$ = { "type": inf.type, "stroke": inf.stroke, "length": inf.length, "id": $$[$0 - 1] };
                break;
              case 85:
                this.$ = $$[$0 - 1];
                break;
              case 86:
                this.$ = { text: $$[$0], type: "text" };
                break;
              case 87:
                this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type };
                break;
              case 88:
                this.$ = { text: $$[$0], type: "string" };
                break;
              case 89:
              case 104:
                this.$ = { text: $$[$0], type: "markdown" };
                break;
              case 101:
                this.$ = { text: $$[$0], type: "text" };
                break;
              case 102:
                this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type };
                break;
              case 103:
                this.$ = { text: $$[$0], type: "text" };
                break;
              case 105:
                this.$ = $$[$0 - 4];
                yy.addClass($$[$0 - 2], $$[$0]);
                break;
              case 106:
                this.$ = $$[$0 - 4];
                yy.setClass($$[$0 - 2], $$[$0]);
                break;
              case 107:
              case 115:
                this.$ = $$[$0 - 1];
                yy.setClickEvent($$[$0 - 1], $$[$0]);
                break;
              case 108:
              case 116:
                this.$ = $$[$0 - 3];
                yy.setClickEvent($$[$0 - 3], $$[$0 - 2]);
                yy.setTooltip($$[$0 - 3], $$[$0]);
                break;
              case 109:
                this.$ = $$[$0 - 2];
                yy.setClickEvent($$[$0 - 2], $$[$0 - 1], $$[$0]);
                break;
              case 110:
                this.$ = $$[$0 - 4];
                yy.setClickEvent($$[$0 - 4], $$[$0 - 3], $$[$0 - 2]);
                yy.setTooltip($$[$0 - 4], $$[$0]);
                break;
              case 111:
                this.$ = $$[$0 - 2];
                yy.setLink($$[$0 - 2], $$[$0]);
                break;
              case 112:
                this.$ = $$[$0 - 4];
                yy.setLink($$[$0 - 4], $$[$0 - 2]);
                yy.setTooltip($$[$0 - 4], $$[$0]);
                break;
              case 113:
                this.$ = $$[$0 - 4];
                yy.setLink($$[$0 - 4], $$[$0 - 2], $$[$0]);
                break;
              case 114:
                this.$ = $$[$0 - 6];
                yy.setLink($$[$0 - 6], $$[$0 - 4], $$[$0]);
                yy.setTooltip($$[$0 - 6], $$[$0 - 2]);
                break;
              case 117:
                this.$ = $$[$0 - 1];
                yy.setLink($$[$0 - 1], $$[$0]);
                break;
              case 118:
                this.$ = $$[$0 - 3];
                yy.setLink($$[$0 - 3], $$[$0 - 2]);
                yy.setTooltip($$[$0 - 3], $$[$0]);
                break;
              case 119:
                this.$ = $$[$0 - 3];
                yy.setLink($$[$0 - 3], $$[$0 - 2], $$[$0]);
                break;
              case 120:
                this.$ = $$[$0 - 5];
                yy.setLink($$[$0 - 5], $$[$0 - 4], $$[$0]);
                yy.setTooltip($$[$0 - 5], $$[$0 - 2]);
                break;
              case 121:
                this.$ = $$[$0 - 4];
                yy.addVertex($$[$0 - 2], void 0, void 0, $$[$0]);
                break;
              case 122:
                this.$ = $$[$0 - 4];
                yy.updateLink([$$[$0 - 2]], $$[$0]);
                break;
              case 123:
                this.$ = $$[$0 - 4];
                yy.updateLink($$[$0 - 2], $$[$0]);
                break;
              case 124:
                this.$ = $$[$0 - 8];
                yy.updateLinkInterpolate([$$[$0 - 6]], $$[$0 - 2]);
                yy.updateLink([$$[$0 - 6]], $$[$0]);
                break;
              case 125:
                this.$ = $$[$0 - 8];
                yy.updateLinkInterpolate($$[$0 - 6], $$[$0 - 2]);
                yy.updateLink($$[$0 - 6], $$[$0]);
                break;
              case 126:
                this.$ = $$[$0 - 6];
                yy.updateLinkInterpolate([$$[$0 - 4]], $$[$0]);
                break;
              case 127:
                this.$ = $$[$0 - 6];
                yy.updateLinkInterpolate($$[$0 - 4], $$[$0]);
                break;
              case 128:
              case 130:
                this.$ = [$$[$0]];
                break;
              case 129:
              case 131:
                $$[$0 - 2].push($$[$0]);
                this.$ = $$[$0 - 2];
                break;
              case 133:
                this.$ = $$[$0 - 1] + $$[$0];
                break;
              case 181:
                this.$ = $$[$0];
                break;
              case 182:
                this.$ = $$[$0 - 1] + "" + $$[$0];
                break;
              case 184:
                this.$ = $$[$0 - 1] + "" + $$[$0];
                break;
              case 185:
                this.$ = { stmt: "dir", value: "TB" };
                break;
              case 186:
                this.$ = { stmt: "dir", value: "BT" };
                break;
              case 187:
                this.$ = { stmt: "dir", value: "RL" };
                break;
              case 188:
                this.$ = { stmt: "dir", value: "LR" };
                break;
              case 189:
                this.$ = { stmt: "dir", value: "TD" };
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: 2, 9: $V0, 10: $V1, 12: $V2 }, { 1: [3] }, o2($V3, $V4, { 5: 6 }), { 4: 7, 9: $V0, 10: $V1, 12: $V2 }, { 4: 8, 9: $V0, 10: $V1, 12: $V2 }, { 13: [1, 9], 14: [1, 10] }, { 1: [2, 1], 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 42: 28, 43: 39, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 84: $Vf, 85: $Vg, 86: $Vh, 87: $Vi, 88: $Vj, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs, 121: $Vt, 122: $Vu, 123: $Vv, 124: $Vw, 125: $Vx }, o2($V3, [2, 9]), o2($V3, [2, 10]), o2($V3, [2, 11]), { 8: [1, 55], 9: [1, 56], 10: $Vy, 15: 54, 18: 57 }, o2($Vz, [2, 3]), o2($Vz, [2, 4]), o2($Vz, [2, 5]), o2($Vz, [2, 6]), o2($Vz, [2, 7]), o2($Vz, [2, 8]), { 8: $VA, 9: $VB, 11: $VC, 21: 59, 41: 60, 72: 64, 75: [1, 65], 77: [1, 67], 78: [1, 66] }, { 8: $VA, 9: $VB, 11: $VC, 21: 68 }, { 8: $VA, 9: $VB, 11: $VC, 21: 69 }, { 8: $VA, 9: $VB, 11: $VC, 21: 70 }, { 8: $VA, 9: $VB, 11: $VC, 21: 71 }, { 8: $VA, 9: $VB, 11: $VC, 21: 72 }, { 8: $VA, 9: $VB, 10: [1, 73], 11: $VC, 21: 74 }, o2($Vz, [2, 36]), { 35: [1, 75] }, { 37: [1, 76] }, o2($Vz, [2, 39]), o2($VD, [2, 50], { 18: 77, 39: 78, 10: $Vy, 40: $VE }), { 10: [1, 80] }, { 10: [1, 81] }, { 10: [1, 82] }, { 10: [1, 83] }, { 14: $VF, 44: $VG, 60: $VH, 80: [1, 87], 89: $VI, 95: [1, 84], 97: [1, 85], 101: 86, 105: $VJ, 106: $VK, 109: $VL, 111: $VM, 114: $VN, 115: $VO, 116: $VP, 120: 88 }, o2($Vz, [2, 185]), o2($Vz, [2, 186]), o2($Vz, [2, 187]), o2($Vz, [2, 188]), o2($Vz, [2, 189]), o2($VQ, [2, 51]), o2($VQ, [2, 54], { 46: [1, 100] }), o2($VR, [2, 72], { 113: 113, 29: [1, 101], 44: $Vd, 48: [1, 102], 50: [1, 103], 52: [1, 104], 54: [1, 105], 56: [1, 106], 58: [1, 107], 60: $Ve, 63: [1, 108], 65: [1, 109], 67: [1, 110], 68: [1, 111], 70: [1, 112], 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 114: $Vq, 115: $Vr, 116: $Vs }), o2($VS, [2, 181]), o2($VS, [2, 142]), o2($VS, [2, 143]), o2($VS, [2, 144]), o2($VS, [2, 145]), o2($VS, [2, 146]), o2($VS, [2, 147]), o2($VS, [2, 148]), o2($VS, [2, 149]), o2($VS, [2, 150]), o2($VS, [2, 151]), o2($VS, [2, 152]), o2($V3, [2, 12]), o2($V3, [2, 18]), o2($V3, [2, 19]), { 9: [1, 114] }, o2($VT, [2, 26], { 18: 115, 10: $Vy }), o2($Vz, [2, 27]), { 42: 116, 43: 39, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, o2($Vz, [2, 40]), o2($Vz, [2, 41]), o2($Vz, [2, 42]), o2($VU, [2, 76], { 73: 117, 62: [1, 119], 74: [1, 118] }), { 76: 120, 79: 121, 80: $VV, 81: $VW, 116: $VX, 119: $VY }, { 75: [1, 126], 77: [1, 127] }, o2($VZ, [2, 83]), o2($Vz, [2, 28]), o2($Vz, [2, 29]), o2($Vz, [2, 30]), o2($Vz, [2, 31]), o2($Vz, [2, 32]), { 10: $V_, 12: $V$, 14: $V01, 27: $V11, 28: 128, 32: $V21, 44: $V31, 60: $V41, 75: $V51, 80: [1, 130], 81: [1, 131], 83: 141, 84: $V61, 85: $V71, 86: $V81, 87: $V91, 88: $Va1, 89: $Vb1, 90: $Vc1, 91: 129, 105: $Vd1, 109: $Ve1, 111: $Vf1, 114: $Vg1, 115: $Vh1, 116: $Vi1 }, o2($Vj1, $V4, { 5: 154 }), o2($Vz, [2, 37]), o2($Vz, [2, 38]), o2($VD, [2, 48], { 44: $Vk1 }), o2($VD, [2, 49], { 18: 156, 10: $Vy, 40: $Vl1 }), o2($VQ, [2, 44]), { 44: $Vd, 47: 158, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, { 102: [1, 159], 103: 160, 105: [1, 161] }, { 44: $Vd, 47: 162, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, { 44: $Vd, 47: 163, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, o2($Vm1, [2, 107], { 10: [1, 164], 96: [1, 165] }), { 80: [1, 166] }, o2($Vm1, [2, 115], { 120: 168, 10: [1, 167], 14: $VF, 44: $VG, 60: $VH, 89: $VI, 105: $VJ, 106: $VK, 109: $VL, 111: $VM, 114: $VN, 115: $VO, 116: $VP }), o2($Vm1, [2, 117], { 10: [1, 169] }), o2($Vn1, [2, 183]), o2($Vn1, [2, 170]), o2($Vn1, [2, 171]), o2($Vn1, [2, 172]), o2($Vn1, [2, 173]), o2($Vn1, [2, 174]), o2($Vn1, [2, 175]), o2($Vn1, [2, 176]), o2($Vn1, [2, 177]), o2($Vn1, [2, 178]), o2($Vn1, [2, 179]), o2($Vn1, [2, 180]), { 44: $Vd, 47: 170, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, { 30: 171, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 179, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 181, 50: [1, 180], 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 182, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 183, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 184, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 109: [1, 185] }, { 30: 186, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 187, 65: [1, 188], 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 189, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 190, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 191, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($VS, [2, 182]), o2($V3, [2, 20]), o2($VT, [2, 25]), o2($VD, [2, 46], { 39: 192, 18: 193, 10: $Vy, 40: $VE }), o2($VU, [2, 73], { 10: [1, 194] }), { 10: [1, 195] }, { 30: 196, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 77: [1, 197], 79: 198, 116: $VX, 119: $VY }, o2($Vu1, [2, 79]), o2($Vu1, [2, 81]), o2($Vu1, [2, 82]), o2($Vu1, [2, 168]), o2($Vu1, [2, 169]), { 76: 199, 79: 121, 80: $VV, 81: $VW, 116: $VX, 119: $VY }, o2($VZ, [2, 84]), { 8: $VA, 9: $VB, 10: $V_, 11: $VC, 12: $V$, 14: $V01, 21: 201, 27: $V11, 29: [1, 200], 32: $V21, 44: $V31, 60: $V41, 75: $V51, 83: 141, 84: $V61, 85: $V71, 86: $V81, 87: $V91, 88: $Va1, 89: $Vb1, 90: $Vc1, 91: 202, 105: $Vd1, 109: $Ve1, 111: $Vf1, 114: $Vg1, 115: $Vh1, 116: $Vi1 }, o2($Vv1, [2, 101]), o2($Vv1, [2, 103]), o2($Vv1, [2, 104]), o2($Vv1, [2, 157]), o2($Vv1, [2, 158]), o2($Vv1, [2, 159]), o2($Vv1, [2, 160]), o2($Vv1, [2, 161]), o2($Vv1, [2, 162]), o2($Vv1, [2, 163]), o2($Vv1, [2, 164]), o2($Vv1, [2, 165]), o2($Vv1, [2, 166]), o2($Vv1, [2, 167]), o2($Vv1, [2, 90]), o2($Vv1, [2, 91]), o2($Vv1, [2, 92]), o2($Vv1, [2, 93]), o2($Vv1, [2, 94]), o2($Vv1, [2, 95]), o2($Vv1, [2, 96]), o2($Vv1, [2, 97]), o2($Vv1, [2, 98]), o2($Vv1, [2, 99]), o2($Vv1, [2, 100]), { 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 32: [1, 203], 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 42: 28, 43: 39, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 84: $Vf, 85: $Vg, 86: $Vh, 87: $Vi, 88: $Vj, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs, 121: $Vt, 122: $Vu, 123: $Vv, 124: $Vw, 125: $Vx }, { 10: $Vy, 18: 204 }, { 44: [1, 205] }, o2($VQ, [2, 43]), { 10: [1, 206], 44: $Vd, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 113, 114: $Vq, 115: $Vr, 116: $Vs }, { 10: [1, 207] }, { 10: [1, 208], 106: [1, 209] }, o2($Vw1, [2, 128]), { 10: [1, 210], 44: $Vd, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 113, 114: $Vq, 115: $Vr, 116: $Vs }, { 10: [1, 211], 44: $Vd, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 113, 114: $Vq, 115: $Vr, 116: $Vs }, { 80: [1, 212] }, o2($Vm1, [2, 109], { 10: [1, 213] }), o2($Vm1, [2, 111], { 10: [1, 214] }), { 80: [1, 215] }, o2($Vn1, [2, 184]), { 80: [1, 216], 98: [1, 217] }, o2($VQ, [2, 55], { 113: 113, 44: $Vd, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 114: $Vq, 115: $Vr, 116: $Vs }), { 31: [1, 218], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($Vx1, [2, 86]), o2($Vx1, [2, 88]), o2($Vx1, [2, 89]), o2($Vx1, [2, 153]), o2($Vx1, [2, 154]), o2($Vx1, [2, 155]), o2($Vx1, [2, 156]), { 49: [1, 220], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 221, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 51: [1, 222], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 53: [1, 223], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 55: [1, 224], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 57: [1, 225], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 60: [1, 226] }, { 64: [1, 227], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 66: [1, 228], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 229, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 31: [1, 230], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 67: $Vo1, 69: [1, 231], 71: [1, 232], 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 67: $Vo1, 69: [1, 234], 71: [1, 233], 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($VD, [2, 45], { 18: 156, 10: $Vy, 40: $Vl1 }), o2($VD, [2, 47], { 44: $Vk1 }), o2($VU, [2, 75]), o2($VU, [2, 74]), { 62: [1, 235], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($VU, [2, 77]), o2($Vu1, [2, 80]), { 77: [1, 236], 79: 198, 116: $VX, 119: $VY }, { 30: 237, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($Vj1, $V4, { 5: 238 }), o2($Vv1, [2, 102]), o2($Vz, [2, 35]), { 43: 239, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, { 10: $Vy, 18: 240 }, { 10: $Vy1, 60: $Vz1, 84: $VA1, 92: 241, 105: $VB1, 107: 242, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, { 10: $Vy1, 60: $Vz1, 84: $VA1, 92: 252, 104: [1, 253], 105: $VB1, 107: 242, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, { 10: $Vy1, 60: $Vz1, 84: $VA1, 92: 254, 104: [1, 255], 105: $VB1, 107: 242, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, { 105: [1, 256] }, { 10: $Vy1, 60: $Vz1, 84: $VA1, 92: 257, 105: $VB1, 107: 242, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, { 44: $Vd, 47: 258, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, o2($Vm1, [2, 108]), { 80: [1, 259] }, { 80: [1, 260], 98: [1, 261] }, o2($Vm1, [2, 116]), o2($Vm1, [2, 118], { 10: [1, 262] }), o2($Vm1, [2, 119]), o2($VR, [2, 56]), o2($Vx1, [2, 87]), o2($VR, [2, 57]), { 51: [1, 263], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($VR, [2, 64]), o2($VR, [2, 59]), o2($VR, [2, 60]), o2($VR, [2, 61]), { 109: [1, 264] }, o2($VR, [2, 63]), o2($VR, [2, 65]), { 66: [1, 265], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($VR, [2, 67]), o2($VR, [2, 68]), o2($VR, [2, 70]), o2($VR, [2, 69]), o2($VR, [2, 71]), o2([10, 44, 60, 89, 102, 105, 106, 109, 111, 114, 115, 116], [2, 85]), o2($VU, [2, 78]), { 31: [1, 266], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 32: [1, 267], 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 42: 28, 43: 39, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 84: $Vf, 85: $Vg, 86: $Vh, 87: $Vi, 88: $Vj, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs, 121: $Vt, 122: $Vu, 123: $Vv, 124: $Vw, 125: $Vx }, o2($VQ, [2, 53]), { 43: 268, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, o2($Vm1, [2, 121], { 106: $VG1 }), o2($VH1, [2, 130], { 108: 270, 10: $Vy1, 60: $Vz1, 84: $VA1, 105: $VB1, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }), o2($VI1, [2, 132]), o2($VI1, [2, 134]), o2($VI1, [2, 135]), o2($VI1, [2, 136]), o2($VI1, [2, 137]), o2($VI1, [2, 138]), o2($VI1, [2, 139]), o2($VI1, [2, 140]), o2($VI1, [2, 141]), o2($Vm1, [2, 122], { 106: $VG1 }), { 10: [1, 271] }, o2($Vm1, [2, 123], { 106: $VG1 }), { 10: [1, 272] }, o2($Vw1, [2, 129]), o2($Vm1, [2, 105], { 106: $VG1 }), o2($Vm1, [2, 106], { 113: 113, 44: $Vd, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 114: $Vq, 115: $Vr, 116: $Vs }), o2($Vm1, [2, 110]), o2($Vm1, [2, 112], { 10: [1, 273] }), o2($Vm1, [2, 113]), { 98: [1, 274] }, { 51: [1, 275] }, { 62: [1, 276] }, { 66: [1, 277] }, { 8: $VA, 9: $VB, 11: $VC, 21: 278 }, o2($Vz, [2, 34]), o2($VQ, [2, 52]), { 10: $Vy1, 60: $Vz1, 84: $VA1, 105: $VB1, 107: 279, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, o2($VI1, [2, 133]), { 14: $VF, 44: $VG, 60: $VH, 89: $VI, 101: 280, 105: $VJ, 106: $VK, 109: $VL, 111: $VM, 114: $VN, 115: $VO, 116: $VP, 120: 88 }, { 14: $VF, 44: $VG, 60: $VH, 89: $VI, 101: 281, 105: $VJ, 106: $VK, 109: $VL, 111: $VM, 114: $VN, 115: $VO, 116: $VP, 120: 88 }, { 98: [1, 282] }, o2($Vm1, [2, 120]), o2($VR, [2, 58]), { 30: 283, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($VR, [2, 66]), o2($Vj1, $V4, { 5: 284 }), o2($VH1, [2, 131], { 108: 270, 10: $Vy1, 60: $Vz1, 84: $VA1, 105: $VB1, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }), o2($Vm1, [2, 126], { 120: 168, 10: [1, 285], 14: $VF, 44: $VG, 60: $VH, 89: $VI, 105: $VJ, 106: $VK, 109: $VL, 111: $VM, 114: $VN, 115: $VO, 116: $VP }), o2($Vm1, [2, 127], { 120: 168, 10: [1, 286], 14: $VF, 44: $VG, 60: $VH, 89: $VI, 105: $VJ, 106: $VK, 109: $VL, 111: $VM, 114: $VN, 115: $VO, 116: $VP }), o2($Vm1, [2, 114]), { 31: [1, 287], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 32: [1, 288], 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 42: 28, 43: 39, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 84: $Vf, 85: $Vg, 86: $Vh, 87: $Vi, 88: $Vj, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs, 121: $Vt, 122: $Vu, 123: $Vv, 124: $Vw, 125: $Vx }, { 10: $Vy1, 60: $Vz1, 84: $VA1, 92: 289, 105: $VB1, 107: 242, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, { 10: $Vy1, 60: $Vz1, 84: $VA1, 92: 290, 105: $VB1, 107: 242, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, o2($VR, [2, 62]), o2($Vz, [2, 33]), o2($Vm1, [2, 124], { 106: $VG1 }), o2($Vm1, [2, 125], { 106: $VG1 })],
          defaultActions: {},
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: {},
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  this.begin("acc_title");
                  return 34;
                  break;
                case 1:
                  this.popState();
                  return "acc_title_value";
                  break;
                case 2:
                  this.begin("acc_descr");
                  return 36;
                  break;
                case 3:
                  this.popState();
                  return "acc_descr_value";
                  break;
                case 4:
                  this.begin("acc_descr_multiline");
                  break;
                case 5:
                  this.popState();
                  break;
                case 6:
                  return "acc_descr_multiline_value";
                  break;
                case 7:
                  this.pushState("shapeData");
                  yy_.yytext = "";
                  return 40;
                  break;
                case 8:
                  this.pushState("shapeDataStr");
                  return 40;
                  break;
                case 9:
                  this.popState();
                  return 40;
                  break;
                case 10:
                  const re3 = /\n\s*/g;
                  yy_.yytext = yy_.yytext.replace(re3, "<br/>");
                  return 40;
                  break;
                case 11:
                  return 40;
                  break;
                case 12:
                  this.popState();
                  break;
                case 13:
                  this.begin("callbackname");
                  break;
                case 14:
                  this.popState();
                  break;
                case 15:
                  this.popState();
                  this.begin("callbackargs");
                  break;
                case 16:
                  return 95;
                  break;
                case 17:
                  this.popState();
                  break;
                case 18:
                  return 96;
                  break;
                case 19:
                  return "MD_STR";
                  break;
                case 20:
                  this.popState();
                  break;
                case 21:
                  this.begin("md_string");
                  break;
                case 22:
                  return "STR";
                  break;
                case 23:
                  this.popState();
                  break;
                case 24:
                  this.pushState("string");
                  break;
                case 25:
                  return 84;
                  break;
                case 26:
                  return 102;
                  break;
                case 27:
                  return 85;
                  break;
                case 28:
                  return 104;
                  break;
                case 29:
                  return 86;
                  break;
                case 30:
                  return 87;
                  break;
                case 31:
                  return 97;
                  break;
                case 32:
                  this.begin("click");
                  break;
                case 33:
                  this.popState();
                  break;
                case 34:
                  return 88;
                  break;
                case 35:
                  if (yy.lex.firstGraph()) {
                    this.begin("dir");
                  }
                  return 12;
                  break;
                case 36:
                  if (yy.lex.firstGraph()) {
                    this.begin("dir");
                  }
                  return 12;
                  break;
                case 37:
                  if (yy.lex.firstGraph()) {
                    this.begin("dir");
                  }
                  return 12;
                  break;
                case 38:
                  return 27;
                  break;
                case 39:
                  return 32;
                  break;
                case 40:
                  return 98;
                  break;
                case 41:
                  return 98;
                  break;
                case 42:
                  return 98;
                  break;
                case 43:
                  return 98;
                  break;
                case 44:
                  this.popState();
                  return 13;
                  break;
                case 45:
                  this.popState();
                  return 14;
                  break;
                case 46:
                  this.popState();
                  return 14;
                  break;
                case 47:
                  this.popState();
                  return 14;
                  break;
                case 48:
                  this.popState();
                  return 14;
                  break;
                case 49:
                  this.popState();
                  return 14;
                  break;
                case 50:
                  this.popState();
                  return 14;
                  break;
                case 51:
                  this.popState();
                  return 14;
                  break;
                case 52:
                  this.popState();
                  return 14;
                  break;
                case 53:
                  this.popState();
                  return 14;
                  break;
                case 54:
                  this.popState();
                  return 14;
                  break;
                case 55:
                  return 121;
                  break;
                case 56:
                  return 122;
                  break;
                case 57:
                  return 123;
                  break;
                case 58:
                  return 124;
                  break;
                case 59:
                  return 125;
                  break;
                case 60:
                  return 78;
                  break;
                case 61:
                  return 105;
                  break;
                case 62:
                  return 111;
                  break;
                case 63:
                  return 46;
                  break;
                case 64:
                  return 60;
                  break;
                case 65:
                  return 44;
                  break;
                case 66:
                  return 8;
                  break;
                case 67:
                  return 106;
                  break;
                case 68:
                  return 115;
                  break;
                case 69:
                  this.popState();
                  return 77;
                  break;
                case 70:
                  this.pushState("edgeText");
                  return 75;
                  break;
                case 71:
                  return 119;
                  break;
                case 72:
                  this.popState();
                  return 77;
                  break;
                case 73:
                  this.pushState("thickEdgeText");
                  return 75;
                  break;
                case 74:
                  return 119;
                  break;
                case 75:
                  this.popState();
                  return 77;
                  break;
                case 76:
                  this.pushState("dottedEdgeText");
                  return 75;
                  break;
                case 77:
                  return 119;
                  break;
                case 78:
                  return 77;
                  break;
                case 79:
                  this.popState();
                  return 53;
                  break;
                case 80:
                  return "TEXT";
                  break;
                case 81:
                  this.pushState("ellipseText");
                  return 52;
                  break;
                case 82:
                  this.popState();
                  return 55;
                  break;
                case 83:
                  this.pushState("text");
                  return 54;
                  break;
                case 84:
                  this.popState();
                  return 57;
                  break;
                case 85:
                  this.pushState("text");
                  return 56;
                  break;
                case 86:
                  return 58;
                  break;
                case 87:
                  this.pushState("text");
                  return 67;
                  break;
                case 88:
                  this.popState();
                  return 64;
                  break;
                case 89:
                  this.pushState("text");
                  return 63;
                  break;
                case 90:
                  this.popState();
                  return 49;
                  break;
                case 91:
                  this.pushState("text");
                  return 48;
                  break;
                case 92:
                  this.popState();
                  return 69;
                  break;
                case 93:
                  this.popState();
                  return 71;
                  break;
                case 94:
                  return 117;
                  break;
                case 95:
                  this.pushState("trapText");
                  return 68;
                  break;
                case 96:
                  this.pushState("trapText");
                  return 70;
                  break;
                case 97:
                  return 118;
                  break;
                case 98:
                  return 67;
                  break;
                case 99:
                  return 90;
                  break;
                case 100:
                  return "SEP";
                  break;
                case 101:
                  return 89;
                  break;
                case 102:
                  return 115;
                  break;
                case 103:
                  return 111;
                  break;
                case 104:
                  return 44;
                  break;
                case 105:
                  return 109;
                  break;
                case 106:
                  return 114;
                  break;
                case 107:
                  return 116;
                  break;
                case 108:
                  this.popState();
                  return 62;
                  break;
                case 109:
                  this.pushState("text");
                  return 62;
                  break;
                case 110:
                  this.popState();
                  return 51;
                  break;
                case 111:
                  this.pushState("text");
                  return 50;
                  break;
                case 112:
                  this.popState();
                  return 31;
                  break;
                case 113:
                  this.pushState("text");
                  return 29;
                  break;
                case 114:
                  this.popState();
                  return 66;
                  break;
                case 115:
                  this.pushState("text");
                  return 65;
                  break;
                case 116:
                  return "TEXT";
                  break;
                case 117:
                  return "QUOTE";
                  break;
                case 118:
                  return 9;
                  break;
                case 119:
                  return 10;
                  break;
                case 120:
                  return 11;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:@\{)/, /^(?:["])/, /^(?:["])/, /^(?:[^\"]+)/, /^(?:[^}^"]+)/, /^(?:\})/, /^(?:call[\s]+)/, /^(?:\([\s]*\))/, /^(?:\()/, /^(?:[^(]*)/, /^(?:\))/, /^(?:[^)]*)/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["][`])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:["])/, /^(?:style\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\b)/, /^(?:class\b)/, /^(?:href[\s])/, /^(?:click[\s]+)/, /^(?:[\s\n])/, /^(?:[^\s\n]*)/, /^(?:flowchart-elk\b)/, /^(?:graph\b)/, /^(?:flowchart\b)/, /^(?:subgraph\b)/, /^(?:end\b\s*)/, /^(?:_self\b)/, /^(?:_blank\b)/, /^(?:_parent\b)/, /^(?:_top\b)/, /^(?:(\r?\n)*\s*\n)/, /^(?:\s*LR\b)/, /^(?:\s*RL\b)/, /^(?:\s*TB\b)/, /^(?:\s*BT\b)/, /^(?:\s*TD\b)/, /^(?:\s*BR\b)/, /^(?:\s*<)/, /^(?:\s*>)/, /^(?:\s*\^)/, /^(?:\s*v\b)/, /^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:.*direction\s+TD[^\n]*)/, /^(?:[^\s\"]+@(?=[^\{\"]))/, /^(?:[0-9]+)/, /^(?:#)/, /^(?::::)/, /^(?::)/, /^(?:&)/, /^(?:;)/, /^(?:,)/, /^(?:\*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:[^-]|-(?!-)+)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:[^=]|=(?!))/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:[^\.]|\.(?!))/, /^(?:\s*~~[\~]+\s*)/, /^(?:[-/\)][\)])/, /^(?:[^\(\)\[\]\{\}]|!\)+)/, /^(?:\(-)/, /^(?:\]\))/, /^(?:\(\[)/, /^(?:\]\])/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:>)/, /^(?:\)\])/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\(\(\()/, /^(?:[\\(?=\])][\]])/, /^(?:\/(?=\])\])/, /^(?:\/(?!\])|\\(?!\])|[^\\\[\]\(\)\{\}\/]+)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:<)/, /^(?:>)/, /^(?:\^)/, /^(?:\\\|)/, /^(?:v\b)/, /^(?:\*)/, /^(?:#)/, /^(?:&)/, /^(?:([A-Za-z0-9!"\#$%&'*+\.`?\\_\/]|-(?=[^\>\-\.])|(?!))+)/, /^(?:-)/, /^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/, /^(?:\|)/, /^(?:\|)/, /^(?:\))/, /^(?:\()/, /^(?:\])/, /^(?:\[)/, /^(?:(\}))/, /^(?:\{)/, /^(?:[^\[\]\(\)\{\}\|\"]+)/, /^(?:")/, /^(?:(\r?\n)+)/, /^(?:\s)/, /^(?:$)/],
            conditions: { "shapeDataEndBracket": { "rules": [21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "shapeDataStr": { "rules": [9, 10, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "shapeData": { "rules": [8, 11, 12, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "callbackargs": { "rules": [17, 18, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "callbackname": { "rules": [14, 15, 16, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "href": { "rules": [21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "click": { "rules": [21, 24, 33, 34, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "dottedEdgeText": { "rules": [21, 24, 75, 77, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "thickEdgeText": { "rules": [21, 24, 72, 74, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "edgeText": { "rules": [21, 24, 69, 71, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "trapText": { "rules": [21, 24, 78, 81, 83, 85, 89, 91, 92, 93, 94, 95, 96, 109, 111, 113, 115], "inclusive": false }, "ellipseText": { "rules": [21, 24, 78, 79, 80, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "text": { "rules": [21, 24, 78, 81, 82, 83, 84, 85, 88, 89, 90, 91, 95, 96, 108, 109, 110, 111, 112, 113, 114, 115, 116], "inclusive": false }, "vertex": { "rules": [21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "dir": { "rules": [21, 24, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "acc_descr_multiline": { "rules": [5, 6, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "acc_descr": { "rules": [3, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "acc_title": { "rules": [1, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "md_string": { "rules": [19, 20, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "string": { "rules": [21, 22, 23, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "INITIAL": { "rules": [0, 2, 4, 7, 13, 21, 24, 25, 26, 27, 28, 29, 30, 31, 32, 35, 36, 37, 38, 39, 40, 41, 42, 43, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 72, 73, 75, 76, 78, 81, 83, 85, 86, 87, 89, 91, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 109, 111, 113, 115, 117, 118, 119, 120], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser2.parser = parser2;
      flow_default = parser2;
    }
  });

  // src/diagrams/flowchart/parser/flowParser.ts
  var newParser, flowParser_default;
  var init_flowParser = __esm({
    "src/diagrams/flowchart/parser/flowParser.ts"() {
      "use strict";
      init_flow();
      newParser = Object.assign({}, flow_default);
      newParser.parse = (src) => {
        const newSrc = src.replace(/}\s*\n/g, "}\n");
        return flow_default.parse(newSrc);
      };
      flowParser_default = newParser;
    }
  });

  // src/diagrams/globalStyles.ts
  var getIconStyles;
  var init_globalStyles = __esm({
    "src/diagrams/globalStyles.ts"() {
      "use strict";
      getIconStyles = /* @__PURE__ */ __name(() => `
  /* Font Awesome icon styling - consolidated */
  .label-icon {
    display: inline-block;
    height: 1em;
    overflow: visible;
    vertical-align: -0.125em;
  }
  
  .node .label-icon path {
    fill: currentColor;
    stroke: revert;
    stroke-width: revert;
  }
`, "getIconStyles");
    }
  });

  // src/diagrams/flowchart/styles.ts
  var fade, getStyles3, styles_default3;
  var init_styles3 = __esm({
    "src/diagrams/flowchart/styles.ts"() {
      "use strict";
      init_dist();
      init_globalStyles();
      fade = /* @__PURE__ */ __name((color2, opacity) => {
        const channel2 = channel_default2;
        const r2 = channel2(color2, "r");
        const g2 = channel2(color2, "g");
        const b3 = channel2(color2, "b");
        return rgba_default(r2, g2, b3, opacity);
      }, "fade");
      getStyles3 = /* @__PURE__ */ __name((options2) => `.label {
    font-family: ${options2.fontFamily};
    color: ${options2.nodeTextColor || options2.textColor};
  }
  .cluster-label text {
    fill: ${options2.titleColor};
  }
  .cluster-label span {
    color: ${options2.titleColor};
  }
  .cluster-label span p {
    background-color: transparent;
  }

  .label text,span {
    fill: ${options2.nodeTextColor || options2.textColor};
    color: ${options2.nodeTextColor || options2.textColor};
  }

  .node rect,
  .node circle,
  .node ellipse,
  .node polygon,
  .node path {
    fill: ${options2.mainBkg};
    stroke: ${options2.nodeBorder};
    stroke-width: ${options2.strokeWidth ?? 1}px;
  }
  .rough-node .label text , .node .label text, .image-shape .label, .icon-shape .label {
    text-anchor: middle;
  }
  // .flowchart-label .text-outer-tspan {
  //   text-anchor: middle;
  // }
  // .flowchart-label .text-inner-tspan {
  //   text-anchor: start;
  // }

  .node .katex path {
    fill: #000;
    stroke: #000;
    stroke-width: 1px;
  }

  .rough-node .label,.node .label, .image-shape .label, .icon-shape .label {
    text-align: center;
  }
  .node.clickable {
    cursor: pointer;
  }


  .root .anchor path {
    fill: ${options2.lineColor} !important;
    stroke-width: 0;
    stroke: ${options2.lineColor};
  }

  .arrowheadPath {
    fill: ${options2.arrowheadColor};
  }

  .edgePath .path {
    stroke: ${options2.lineColor};
    stroke-width: ${options2.strokeWidth ?? 2}px;
  }

  .flowchart-link {
    stroke: ${options2.lineColor};
    fill: none;
  }

  .edgeLabel {
    background-color: ${options2.edgeLabelBackground};
    p {
      background-color: ${options2.edgeLabelBackground};
    }
    rect {
      opacity: 0.5;
      background-color: ${options2.edgeLabelBackground};
      fill: ${options2.edgeLabelBackground};
    }
    text-align: center;
  }

  /* For html labels only */
  .labelBkg {
    background-color: ${fade(options2.edgeLabelBackground, 0.5)};
    // background-color:
  }

  .cluster rect {
    fill: ${options2.clusterBkg};
    stroke: ${options2.clusterBorder};
    stroke-width: 1px;
  }

  .cluster text {
    fill: ${options2.titleColor};
  }

  .cluster span {
    color: ${options2.titleColor};
  }
  /* .cluster div {
    color: ${options2.titleColor};
  } */

  div.mermaidTooltip {
    position: absolute;
    text-align: center;
    max-width: 200px;
    padding: 2px;
    font-family: ${options2.fontFamily};
    font-size: 12px;
    background: ${options2.tertiaryColor};
    border: 1px solid ${options2.border2};
    border-radius: 2px;
    pointer-events: none;
    z-index: 100;
  }

  .flowchartTitleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${options2.textColor};
  }

  rect.text {
    fill: none;
    stroke-width: 0;
  }

  .icon-shape, .image-shape {
    background-color: ${options2.edgeLabelBackground};
    p {
      background-color: ${options2.edgeLabelBackground};
      padding: 2px;
    }
    .label rect {
      opacity: 0.5;
      background-color: ${options2.edgeLabelBackground};
      fill: ${options2.edgeLabelBackground};
    }
    text-align: center;
  }
  ${getIconStyles()}
`, "getStyles");
      styles_default3 = getStyles3;
    }
  });

  // src/diagrams/flowchart/flowDiagram.ts
  var flowDiagram_exports = {};
  __export(flowDiagram_exports, {
    diagram: () => diagram2
  });
  var diagram2;
  var init_flowDiagram = __esm({
    "src/diagrams/flowchart/flowDiagram.ts"() {
      "use strict";
      init_diagramAPI();
      init_flowDb();
      init_flowRenderer_v3_unified();
      init_flowParser();
      init_styles3();
      diagram2 = {
        parser: flowParser_default,
        get db() {
          return new FlowDB();
        },
        renderer: flowRenderer_v3_unified_default,
        styles: styles_default3,
        init: /* @__PURE__ */ __name((cnf) => {
          if (!cnf.flowchart) {
            cnf.flowchart = {};
          }
          if (cnf.layout) {
            setConfig2({ layout: cnf.layout });
          }
          cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
          setConfig2({ flowchart: { arrowMarkerAbsolute: cnf.arrowMarkerAbsolute } });
        }, "init")
      };
    }
  });

  // src/diagrams/er/parser/erDiagram.jison
  var parser3, erDiagram_default;
  var init_erDiagram = __esm({
    "src/diagrams/er/parser/erDiagram.jison"() {
      "use strict";
      parser3 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [6, 8, 10, 22, 24, 26, 28, 33, 34, 35, 36, 37, 40, 43, 44, 48, 50, 51, 52], $V1 = [1, 10], $V2 = [1, 11], $V3 = [1, 12], $V4 = [1, 13], $V5 = [1, 23], $V6 = [1, 24], $V7 = [1, 25], $V8 = [1, 26], $V9 = [1, 27], $Va = [1, 19], $Vb = [1, 28], $Vc = [1, 29], $Vd = [1, 20], $Ve = [1, 18], $Vf = [1, 21], $Vg = [1, 22], $Vh = [1, 36], $Vi = [1, 37], $Vj = [1, 38], $Vk = [1, 39], $Vl = [1, 40], $Vm = [6, 8, 10, 13, 15, 17, 20, 21, 22, 24, 26, 28, 33, 34, 35, 36, 37, 40, 43, 44, 48, 50, 51, 52, 65, 66, 67, 68, 69], $Vn = [1, 45], $Vo = [1, 46], $Vp = [1, 55], $Vq = [40, 48, 50, 51, 52, 70, 71], $Vr = [1, 66], $Vs = [1, 64], $Vt = [1, 61], $Vu = [1, 65], $Vv = [1, 67], $Vw = [6, 8, 10, 13, 17, 22, 24, 26, 28, 33, 34, 35, 36, 37, 40, 41, 42, 43, 44, 48, 49, 50, 51, 52, 65, 66, 67, 68, 69], $Vx = [65, 66, 67, 68, 69], $Vy = [1, 84], $Vz = [1, 83], $VA = [1, 81], $VB = [1, 82], $VC = [6, 10, 42, 47], $VD = [6, 10, 13, 41, 42, 47, 48, 49], $VE = [1, 92], $VF = [1, 91], $VG = [1, 90], $VH = [19, 58], $VI = [1, 101], $VJ = [1, 100], $VK = [19, 58, 60, 62];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "ER_DIAGRAM": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NEWLINE": 10, "entityName": 11, "relSpec": 12, "COLON": 13, "role": 14, "STYLE_SEPARATOR": 15, "idList": 16, "BLOCK_START": 17, "attributes": 18, "BLOCK_STOP": 19, "SQS": 20, "SQE": 21, "title": 22, "title_value": 23, "acc_title": 24, "acc_title_value": 25, "acc_descr": 26, "acc_descr_value": 27, "acc_descr_multiline_value": 28, "direction": 29, "classDefStatement": 30, "classStatement": 31, "styleStatement": 32, "direction_tb": 33, "direction_bt": 34, "direction_rl": 35, "direction_lr": 36, "CLASSDEF": 37, "stylesOpt": 38, "separator": 39, "UNICODE_TEXT": 40, "STYLE_TEXT": 41, "COMMA": 42, "CLASS": 43, "STYLE": 44, "style": 45, "styleComponent": 46, "SEMI": 47, "NUM": 48, "BRKT": 49, "ENTITY_NAME": 50, "DECIMAL_NUM": 51, "ENTITY_ONE": 52, "attribute": 53, "attributeType": 54, "attributeName": 55, "attributeKeyTypeList": 56, "attributeComment": 57, "ATTRIBUTE_WORD": 58, "attributeKeyType": 59, ",": 60, "ATTRIBUTE_KEY": 61, "COMMENT": 62, "cardinality": 63, "relType": 64, "ZERO_OR_ONE": 65, "ZERO_OR_MORE": 66, "ONE_OR_MORE": 67, "ONLY_ONE": 68, "MD_PARENT": 69, "NON_IDENTIFYING": 70, "IDENTIFYING": 71, "WORD": 72, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 4: "ER_DIAGRAM", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 13: "COLON", 15: "STYLE_SEPARATOR", 17: "BLOCK_START", 19: "BLOCK_STOP", 20: "SQS", 21: "SQE", 22: "title", 23: "title_value", 24: "acc_title", 25: "acc_title_value", 26: "acc_descr", 27: "acc_descr_value", 28: "acc_descr_multiline_value", 33: "direction_tb", 34: "direction_bt", 35: "direction_rl", 36: "direction_lr", 37: "CLASSDEF", 40: "UNICODE_TEXT", 41: "STYLE_TEXT", 42: "COMMA", 43: "CLASS", 44: "STYLE", 47: "SEMI", 48: "NUM", 49: "BRKT", 50: "ENTITY_NAME", 51: "DECIMAL_NUM", 52: "ENTITY_ONE", 58: "ATTRIBUTE_WORD", 60: ",", 61: "ATTRIBUTE_KEY", 62: "COMMENT", 65: "ZERO_OR_ONE", 66: "ZERO_OR_MORE", 67: "ONE_OR_MORE", 68: "ONLY_ONE", 69: "MD_PARENT", 70: "NON_IDENTIFYING", 71: "IDENTIFYING", 72: "WORD" },
          productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 5], [9, 9], [9, 7], [9, 7], [9, 4], [9, 6], [9, 3], [9, 5], [9, 1], [9, 3], [9, 7], [9, 9], [9, 6], [9, 8], [9, 4], [9, 6], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [29, 1], [29, 1], [29, 1], [29, 1], [30, 4], [16, 1], [16, 1], [16, 3], [16, 3], [31, 3], [32, 4], [38, 1], [38, 3], [45, 1], [45, 2], [39, 1], [39, 1], [39, 1], [46, 1], [46, 1], [46, 1], [46, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [18, 1], [18, 2], [53, 2], [53, 3], [53, 3], [53, 4], [54, 1], [55, 1], [56, 1], [56, 3], [59, 1], [57, 1], [12, 3], [63, 1], [63, 1], [63, 1], [63, 1], [63, 1], [64, 1], [64, 1], [14, 1], [14, 1], [14, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 1:
                break;
              case 2:
                this.$ = [];
                break;
              case 3:
                $$[$0 - 1].push($$[$0]);
                this.$ = $$[$0 - 1];
                break;
              case 4:
              case 5:
                this.$ = $$[$0];
                break;
              case 6:
              case 7:
                this.$ = [];
                break;
              case 8:
                yy.addEntity($$[$0 - 4]);
                yy.addEntity($$[$0 - 2]);
                yy.addRelationship($$[$0 - 4], $$[$0], $$[$0 - 2], $$[$0 - 3]);
                break;
              case 9:
                yy.addEntity($$[$0 - 8]);
                yy.addEntity($$[$0 - 4]);
                yy.addRelationship($$[$0 - 8], $$[$0], $$[$0 - 4], $$[$0 - 5]);
                yy.setClass([$$[$0 - 8]], $$[$0 - 6]);
                yy.setClass([$$[$0 - 4]], $$[$0 - 2]);
                break;
              case 10:
                yy.addEntity($$[$0 - 6]);
                yy.addEntity($$[$0 - 2]);
                yy.addRelationship($$[$0 - 6], $$[$0], $$[$0 - 2], $$[$0 - 3]);
                yy.setClass([$$[$0 - 6]], $$[$0 - 4]);
                break;
              case 11:
                yy.addEntity($$[$0 - 6]);
                yy.addEntity($$[$0 - 4]);
                yy.addRelationship($$[$0 - 6], $$[$0], $$[$0 - 4], $$[$0 - 5]);
                yy.setClass([$$[$0 - 4]], $$[$0 - 2]);
                break;
              case 12:
                yy.addEntity($$[$0 - 3]);
                yy.addAttributes($$[$0 - 3], $$[$0 - 1]);
                break;
              case 13:
                yy.addEntity($$[$0 - 5]);
                yy.addAttributes($$[$0 - 5], $$[$0 - 1]);
                yy.setClass([$$[$0 - 5]], $$[$0 - 3]);
                break;
              case 14:
                yy.addEntity($$[$0 - 2]);
                break;
              case 15:
                yy.addEntity($$[$0 - 4]);
                yy.setClass([$$[$0 - 4]], $$[$0 - 2]);
                break;
              case 16:
                yy.addEntity($$[$0]);
                break;
              case 17:
                yy.addEntity($$[$0 - 2]);
                yy.setClass([$$[$0 - 2]], $$[$0]);
                break;
              case 18:
                yy.addEntity($$[$0 - 6], $$[$0 - 4]);
                yy.addAttributes($$[$0 - 6], $$[$0 - 1]);
                break;
              case 19:
                yy.addEntity($$[$0 - 8], $$[$0 - 6]);
                yy.addAttributes($$[$0 - 8], $$[$0 - 1]);
                yy.setClass([$$[$0 - 8]], $$[$0 - 3]);
                break;
              case 20:
                yy.addEntity($$[$0 - 5], $$[$0 - 3]);
                break;
              case 21:
                yy.addEntity($$[$0 - 7], $$[$0 - 5]);
                yy.setClass([$$[$0 - 7]], $$[$0 - 2]);
                break;
              case 22:
                yy.addEntity($$[$0 - 3], $$[$0 - 1]);
                break;
              case 23:
                yy.addEntity($$[$0 - 5], $$[$0 - 3]);
                yy.setClass([$$[$0 - 5]], $$[$0]);
                break;
              case 24:
              case 25:
                this.$ = $$[$0].trim();
                yy.setAccTitle(this.$);
                break;
              case 26:
              case 27:
                this.$ = $$[$0].trim();
                yy.setAccDescription(this.$);
                break;
              case 32:
                yy.setDirection("TB");
                break;
              case 33:
                yy.setDirection("BT");
                break;
              case 34:
                yy.setDirection("RL");
                break;
              case 35:
                yy.setDirection("LR");
                break;
              case 36:
                this.$ = $$[$0 - 3];
                yy.addClass($$[$0 - 2], $$[$0 - 1]);
                break;
              case 37:
              case 38:
              case 59:
              case 67:
                this.$ = [$$[$0]];
                break;
              case 39:
              case 40:
                this.$ = $$[$0 - 2].concat([$$[$0]]);
                break;
              case 41:
                this.$ = $$[$0 - 2];
                yy.setClass($$[$0 - 1], $$[$0]);
                break;
              case 42:
                ;
                this.$ = $$[$0 - 3];
                yy.addCssStyles($$[$0 - 2], $$[$0 - 1]);
                break;
              case 43:
                this.$ = [$$[$0]];
                break;
              case 44:
                $$[$0 - 2].push($$[$0]);
                this.$ = $$[$0 - 2];
                break;
              case 46:
                this.$ = $$[$0 - 1] + $$[$0];
                break;
              case 54:
              case 79:
              case 80:
                this.$ = $$[$0].replace(/"/g, "");
                break;
              case 55:
              case 56:
              case 57:
              case 58:
              case 81:
                this.$ = $$[$0];
                break;
              case 60:
                $$[$0].push($$[$0 - 1]);
                this.$ = $$[$0];
                break;
              case 61:
                this.$ = { type: $$[$0 - 1], name: $$[$0] };
                break;
              case 62:
                this.$ = { type: $$[$0 - 2], name: $$[$0 - 1], keys: $$[$0] };
                break;
              case 63:
                this.$ = { type: $$[$0 - 2], name: $$[$0 - 1], comment: $$[$0] };
                break;
              case 64:
                this.$ = { type: $$[$0 - 3], name: $$[$0 - 2], keys: $$[$0 - 1], comment: $$[$0] };
                break;
              case 65:
              case 66:
              case 69:
                this.$ = $$[$0];
                break;
              case 68:
                $$[$0 - 2].push($$[$0]);
                this.$ = $$[$0 - 2];
                break;
              case 70:
                this.$ = $$[$0].replace(/"/g, "");
                break;
              case 71:
                this.$ = { cardA: $$[$0], relType: $$[$0 - 1], cardB: $$[$0 - 2] };
                break;
              case 72:
                this.$ = yy.Cardinality.ZERO_OR_ONE;
                break;
              case 73:
                this.$ = yy.Cardinality.ZERO_OR_MORE;
                break;
              case 74:
                this.$ = yy.Cardinality.ONE_OR_MORE;
                break;
              case 75:
                this.$ = yy.Cardinality.ONLY_ONE;
                break;
              case 76:
                this.$ = yy.Cardinality.MD_PARENT;
                break;
              case 77:
                this.$ = yy.Identification.NON_IDENTIFYING;
                break;
              case 78:
                this.$ = yy.Identification.IDENTIFYING;
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o2($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 9, 22: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 14, 30: 15, 31: 16, 32: 17, 33: $V5, 34: $V6, 35: $V7, 36: $V8, 37: $V9, 40: $Va, 43: $Vb, 44: $Vc, 48: $Vd, 50: $Ve, 51: $Vf, 52: $Vg }, o2($V0, [2, 7], { 1: [2, 1] }), o2($V0, [2, 3]), { 9: 30, 11: 9, 22: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 14, 30: 15, 31: 16, 32: 17, 33: $V5, 34: $V6, 35: $V7, 36: $V8, 37: $V9, 40: $Va, 43: $Vb, 44: $Vc, 48: $Vd, 50: $Ve, 51: $Vf, 52: $Vg }, o2($V0, [2, 5]), o2($V0, [2, 6]), o2($V0, [2, 16], { 12: 31, 63: 35, 15: [1, 32], 17: [1, 33], 20: [1, 34], 65: $Vh, 66: $Vi, 67: $Vj, 68: $Vk, 69: $Vl }), { 23: [1, 41] }, { 25: [1, 42] }, { 27: [1, 43] }, o2($V0, [2, 27]), o2($V0, [2, 28]), o2($V0, [2, 29]), o2($V0, [2, 30]), o2($V0, [2, 31]), o2($Vm, [2, 54]), o2($Vm, [2, 55]), o2($Vm, [2, 56]), o2($Vm, [2, 57]), o2($Vm, [2, 58]), o2($V0, [2, 32]), o2($V0, [2, 33]), o2($V0, [2, 34]), o2($V0, [2, 35]), { 16: 44, 40: $Vn, 41: $Vo }, { 16: 47, 40: $Vn, 41: $Vo }, { 16: 48, 40: $Vn, 41: $Vo }, o2($V0, [2, 4]), { 11: 49, 40: $Va, 48: $Vd, 50: $Ve, 51: $Vf, 52: $Vg }, { 16: 50, 40: $Vn, 41: $Vo }, { 18: 51, 19: [1, 52], 53: 53, 54: 54, 58: $Vp }, { 11: 56, 40: $Va, 48: $Vd, 50: $Ve, 51: $Vf, 52: $Vg }, { 64: 57, 70: [1, 58], 71: [1, 59] }, o2($Vq, [2, 72]), o2($Vq, [2, 73]), o2($Vq, [2, 74]), o2($Vq, [2, 75]), o2($Vq, [2, 76]), o2($V0, [2, 24]), o2($V0, [2, 25]), o2($V0, [2, 26]), { 13: $Vr, 38: 60, 41: $Vs, 42: $Vt, 45: 62, 46: 63, 48: $Vu, 49: $Vv }, o2($Vw, [2, 37]), o2($Vw, [2, 38]), { 16: 68, 40: $Vn, 41: $Vo, 42: $Vt }, { 13: $Vr, 38: 69, 41: $Vs, 42: $Vt, 45: 62, 46: 63, 48: $Vu, 49: $Vv }, { 13: [1, 70], 15: [1, 71] }, o2($V0, [2, 17], { 63: 35, 12: 72, 17: [1, 73], 42: $Vt, 65: $Vh, 66: $Vi, 67: $Vj, 68: $Vk, 69: $Vl }), { 19: [1, 74] }, o2($V0, [2, 14]), { 18: 75, 19: [2, 59], 53: 53, 54: 54, 58: $Vp }, { 55: 76, 58: [1, 77] }, { 58: [2, 65] }, { 21: [1, 78] }, { 63: 79, 65: $Vh, 66: $Vi, 67: $Vj, 68: $Vk, 69: $Vl }, o2($Vx, [2, 77]), o2($Vx, [2, 78]), { 6: $Vy, 10: $Vz, 39: 80, 42: $VA, 47: $VB }, { 40: [1, 85], 41: [1, 86] }, o2($VC, [2, 43], { 46: 87, 13: $Vr, 41: $Vs, 48: $Vu, 49: $Vv }), o2($VD, [2, 45]), o2($VD, [2, 50]), o2($VD, [2, 51]), o2($VD, [2, 52]), o2($VD, [2, 53]), o2($V0, [2, 41], { 42: $Vt }), { 6: $Vy, 10: $Vz, 39: 88, 42: $VA, 47: $VB }, { 14: 89, 40: $VE, 50: $VF, 72: $VG }, { 16: 93, 40: $Vn, 41: $Vo }, { 11: 94, 40: $Va, 48: $Vd, 50: $Ve, 51: $Vf, 52: $Vg }, { 18: 95, 19: [1, 96], 53: 53, 54: 54, 58: $Vp }, o2($V0, [2, 12]), { 19: [2, 60] }, o2($VH, [2, 61], { 56: 97, 57: 98, 59: 99, 61: $VI, 62: $VJ }), o2([19, 58, 61, 62], [2, 66]), o2($V0, [2, 22], { 15: [1, 103], 17: [1, 102] }), o2([40, 48, 50, 51, 52], [2, 71]), o2($V0, [2, 36]), { 13: $Vr, 41: $Vs, 45: 104, 46: 63, 48: $Vu, 49: $Vv }, o2($V0, [2, 47]), o2($V0, [2, 48]), o2($V0, [2, 49]), o2($Vw, [2, 39]), o2($Vw, [2, 40]), o2($VD, [2, 46]), o2($V0, [2, 42]), o2($V0, [2, 8]), o2($V0, [2, 79]), o2($V0, [2, 80]), o2($V0, [2, 81]), { 13: [1, 105], 42: $Vt }, { 13: [1, 107], 15: [1, 106] }, { 19: [1, 108] }, o2($V0, [2, 15]), o2($VH, [2, 62], { 57: 109, 60: [1, 110], 62: $VJ }), o2($VH, [2, 63]), o2($VK, [2, 67]), o2($VH, [2, 70]), o2($VK, [2, 69]), { 18: 111, 19: [1, 112], 53: 53, 54: 54, 58: $Vp }, { 16: 113, 40: $Vn, 41: $Vo }, o2($VC, [2, 44], { 46: 87, 13: $Vr, 41: $Vs, 48: $Vu, 49: $Vv }), { 14: 114, 40: $VE, 50: $VF, 72: $VG }, { 16: 115, 40: $Vn, 41: $Vo }, { 14: 116, 40: $VE, 50: $VF, 72: $VG }, o2($V0, [2, 13]), o2($VH, [2, 64]), { 59: 117, 61: $VI }, { 19: [1, 118] }, o2($V0, [2, 20]), o2($V0, [2, 23], { 17: [1, 119], 42: $Vt }), o2($V0, [2, 11]), { 13: [1, 120], 42: $Vt }, o2($V0, [2, 10]), o2($VK, [2, 68]), o2($V0, [2, 18]), { 18: 121, 19: [1, 122], 53: 53, 54: 54, 58: $Vp }, { 14: 123, 40: $VE, 50: $VF, 72: $VG }, { 19: [1, 124] }, o2($V0, [2, 21]), o2($V0, [2, 9]), o2($V0, [2, 19])],
          defaultActions: { 55: [2, 65], 75: [2, 60] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  this.begin("acc_title");
                  return 24;
                  break;
                case 1:
                  this.popState();
                  return "acc_title_value";
                  break;
                case 2:
                  this.begin("acc_descr");
                  return 26;
                  break;
                case 3:
                  this.popState();
                  return "acc_descr_value";
                  break;
                case 4:
                  this.begin("acc_descr_multiline");
                  break;
                case 5:
                  this.popState();
                  break;
                case 6:
                  return "acc_descr_multiline_value";
                  break;
                case 7:
                  return 33;
                  break;
                case 8:
                  return 34;
                  break;
                case 9:
                  return 35;
                  break;
                case 10:
                  return 36;
                  break;
                case 11:
                  return 10;
                  break;
                case 12:
                  break;
                case 13:
                  return 8;
                  break;
                case 14:
                  return 50;
                  break;
                case 15:
                  return 72;
                  break;
                case 16:
                  return 4;
                  break;
                case 17:
                  this.begin("block");
                  return 17;
                  break;
                case 18:
                  return 49;
                  break;
                case 19:
                  return 49;
                  break;
                case 20:
                  return 42;
                  break;
                case 21:
                  return 15;
                  break;
                case 22:
                  return 13;
                  break;
                case 23:
                  break;
                case 24:
                  return 61;
                  break;
                case 25:
                  return 58;
                  break;
                case 26:
                  return 58;
                  break;
                case 27:
                  return 62;
                  break;
                case 28:
                  break;
                case 29:
                  this.popState();
                  return 19;
                  break;
                case 30:
                  return yy_.yytext[0];
                  break;
                case 31:
                  return 20;
                  break;
                case 32:
                  return 21;
                  break;
                case 33:
                  this.begin("style");
                  return 44;
                  break;
                case 34:
                  this.popState();
                  return 10;
                  break;
                case 35:
                  break;
                case 36:
                  return 13;
                  break;
                case 37:
                  return 42;
                  break;
                case 38:
                  return 49;
                  break;
                case 39:
                  this.begin("style");
                  return 37;
                  break;
                case 40:
                  return 43;
                  break;
                case 41:
                  return 65;
                  break;
                case 42:
                  return 67;
                  break;
                case 43:
                  return 67;
                  break;
                case 44:
                  return 67;
                  break;
                case 45:
                  return 65;
                  break;
                case 46:
                  return 65;
                  break;
                case 47:
                  return 66;
                  break;
                case 48:
                  return 66;
                  break;
                case 49:
                  return 66;
                  break;
                case 50:
                  return 66;
                  break;
                case 51:
                  return 66;
                  break;
                case 52:
                  return 67;
                  break;
                case 53:
                  return 66;
                  break;
                case 54:
                  return 67;
                  break;
                case 55:
                  return 68;
                  break;
                case 56:
                  return 68;
                  break;
                case 57:
                  return 51;
                  break;
                case 58:
                  return 68;
                  break;
                case 59:
                  return 68;
                  break;
                case 60:
                  return 68;
                  break;
                case 61:
                  return 52;
                  break;
                case 62:
                  return 48;
                  break;
                case 63:
                  return 68;
                  break;
                case 64:
                  return 65;
                  break;
                case 65:
                  return 66;
                  break;
                case 66:
                  return 67;
                  break;
                case 67:
                  return 69;
                  break;
                case 68:
                  return 70;
                  break;
                case 69:
                  return 71;
                  break;
                case 70:
                  return 71;
                  break;
                case 71:
                  return 70;
                  break;
                case 72:
                  return 70;
                  break;
                case 73:
                  return 70;
                  break;
                case 74:
                  return 41;
                  break;
                case 75:
                  return 47;
                  break;
                case 76:
                  return 40;
                  break;
                case 77:
                  return yy_.yytext[0];
                  break;
                case 78:
                  return 6;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:[\s]+)/i, /^(?:"[^"%\r\n\v\b\\]+")/i, /^(?:"[^"]*")/i, /^(?:erDiagram\b)/i, /^(?:\{)/i, /^(?:#)/i, /^(?:#)/i, /^(?:,)/i, /^(?::::)/i, /^(?::)/i, /^(?:\s+)/i, /^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i, /^(?:([^\s]*)[~].*[~]([^\s]*))/i, /^(?:([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\u00C0-\uFFFF\*]*))/i, /^(?:"[^"]*")/i, /^(?:[\n]+)/i, /^(?:\})/i, /^(?:.)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:style\b)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?::)/i, /^(?:,)/i, /^(?:#)/i, /^(?:classDef\b)/i, /^(?:class\b)/i, /^(?:one or zero\b)/i, /^(?:one or more\b)/i, /^(?:one or many\b)/i, /^(?:1\+)/i, /^(?:\|o\b)/i, /^(?:zero or one\b)/i, /^(?:zero or more\b)/i, /^(?:zero or many\b)/i, /^(?:0\+)/i, /^(?:\}o\b)/i, /^(?:many\(0\))/i, /^(?:many\(1\))/i, /^(?:many\b)/i, /^(?:\}\|)/i, /^(?:one\b)/i, /^(?:only one\b)/i, /^(?:[0-9]+\.[0-9]+)/i, /^(?:1(?=\s+[A-Za-z_"']))/i, /^(?:1(?=\s+[0-9]))/i, /^(?:1(?=(--|\.\.|\.-|-\.)))/i, /^(?:1\b)/i, /^(?:[0-9]+)/i, /^(?:\|\|)/i, /^(?:o\|)/i, /^(?:o\{)/i, /^(?:\|\{)/i, /^(?:u(?=[\.\-\|]))/i, /^(?:\.\.)/i, /^(?:--)/i, /^(?:to\b)/i, /^(?:optionally to\b)/i, /^(?:\.-)/i, /^(?:-\.)/i, /^(?:([^\x00-\x7F]|\w|-|\*)+)/i, /^(?:;)/i, /^(?:([^\x00-\x7F]|\w|-|\*|\.)+)/i, /^(?:.)/i, /^(?:$)/i],
            conditions: { "style": { "rules": [34, 35, 36, 37, 38, 74, 75], "inclusive": false }, "acc_descr_multiline": { "rules": [5, 6], "inclusive": false }, "acc_descr": { "rules": [3], "inclusive": false }, "acc_title": { "rules": [1], "inclusive": false }, "block": { "rules": [23, 24, 25, 26, 27, 28, 29, 30], "inclusive": false }, "INITIAL": { "rules": [0, 2, 4, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 31, 32, 33, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 76, 77, 78], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser3.parser = parser3;
      erDiagram_default = parser3;
    }
  });

  // src/diagrams/er/erDb.ts
  var ErDB;
  var init_erDb = __esm({
    "src/diagrams/er/erDb.ts"() {
      "use strict";
      init_logger();
      init_diagramAPI();
      init_commonDb();
      init_utils2();
      ErDB = class {
        constructor() {
          this.entities = /* @__PURE__ */ new Map();
          this.relationships = [];
          this.classes = /* @__PURE__ */ new Map();
          this.direction = "TB";
          this.Cardinality = {
            ZERO_OR_ONE: "ZERO_OR_ONE",
            ZERO_OR_MORE: "ZERO_OR_MORE",
            ONE_OR_MORE: "ONE_OR_MORE",
            ONLY_ONE: "ONLY_ONE",
            MD_PARENT: "MD_PARENT"
          };
          this.Identification = {
            NON_IDENTIFYING: "NON_IDENTIFYING",
            IDENTIFYING: "IDENTIFYING"
          };
          this.setAccTitle = setAccTitle;
          this.getAccTitle = getAccTitle;
          this.setAccDescription = setAccDescription;
          this.getAccDescription = getAccDescription;
          this.setDiagramTitle = setDiagramTitle;
          this.getDiagramTitle = getDiagramTitle;
          this.getConfig = /* @__PURE__ */ __name(() => getConfig2().er, "getConfig");
          this.clear();
          this.addEntity = this.addEntity.bind(this);
          this.addAttributes = this.addAttributes.bind(this);
          this.addRelationship = this.addRelationship.bind(this);
          this.setDirection = this.setDirection.bind(this);
          this.addCssStyles = this.addCssStyles.bind(this);
          this.addClass = this.addClass.bind(this);
          this.setClass = this.setClass.bind(this);
          this.setAccTitle = this.setAccTitle.bind(this);
          this.setAccDescription = this.setAccDescription.bind(this);
        }
        static {
          __name(this, "ErDB");
        }
        /**
         * Add entity
         * @param name - The name of the entity
         * @param alias - The alias of the entity
         */
        addEntity(name, alias = "") {
          if (!this.entities.has(name)) {
            this.entities.set(name, {
              id: `entity-${name}-${this.entities.size}`,
              label: name,
              attributes: [],
              alias,
              shape: "erBox",
              look: getConfig2().look ?? "default",
              cssClasses: "default",
              cssStyles: [],
              labelType: "markdown"
            });
            log.info("Added new entity :", name);
          } else if (!this.entities.get(name)?.alias && alias) {
            this.entities.get(name).alias = alias;
            log.info(`Add alias '${alias}' to entity '${name}'`);
          }
          return this.entities.get(name);
        }
        getEntity(name) {
          return this.entities.get(name);
        }
        getEntities() {
          return this.entities;
        }
        getClasses() {
          return this.classes;
        }
        addAttributes(entityName, attribs) {
          const entity = this.addEntity(entityName);
          let i2;
          for (i2 = attribs.length - 1; i2 >= 0; i2--) {
            if (!attribs[i2].keys) {
              attribs[i2].keys = [];
            }
            if (!attribs[i2].comment) {
              attribs[i2].comment = "";
            }
            entity.attributes.push(attribs[i2]);
            log.debug("Added attribute ", attribs[i2].name);
          }
        }
        /**
         * Add a relationship
         *
         * @param entA - The first entity in the relationship
         * @param rolA - The role played by the first entity in relation to the second
         * @param entB - The second entity in the relationship
         * @param rSpec - The details of the relationship between the two entities
         */
        addRelationship(entA, rolA, entB, rSpec) {
          const entityA = this.entities.get(entA);
          const entityB = this.entities.get(entB);
          if (!entityA || !entityB) {
            return;
          }
          const rel2 = {
            entityA: entityA.id,
            roleA: rolA,
            entityB: entityB.id,
            relSpec: rSpec
          };
          this.relationships.push(rel2);
          log.debug("Added new relationship :", rel2);
        }
        getRelationships() {
          return this.relationships;
        }
        getDirection() {
          return this.direction;
        }
        setDirection(dir2) {
          this.direction = dir2;
        }
        getCompiledStyles(classDefs) {
          let compiledStyles = [];
          for (const customClass of classDefs) {
            const cssClass = this.classes.get(customClass);
            if (cssClass?.styles) {
              compiledStyles = [...compiledStyles, ...cssClass.styles ?? []].map((s2) => s2.trim());
            }
            if (cssClass?.textStyles) {
              compiledStyles = [...compiledStyles, ...cssClass.textStyles ?? []].map((s2) => s2.trim());
            }
          }
          return compiledStyles;
        }
        addCssStyles(ids, styles5) {
          for (const id34 of ids) {
            const entity = this.entities.get(id34);
            if (!styles5 || !entity) {
              return;
            }
            for (const style3 of styles5) {
              entity.cssStyles.push(style3);
            }
          }
        }
        addClass(ids, style3) {
          ids.forEach((id34) => {
            let classNode = this.classes.get(id34);
            if (classNode === void 0) {
              classNode = { id: id34, styles: [], textStyles: [] };
              this.classes.set(id34, classNode);
            }
            if (style3) {
              style3.forEach(function(s2) {
                if (/color/.exec(s2)) {
                  const newStyle = s2.replace("fill", "bgFill");
                  classNode.textStyles.push(newStyle);
                }
                classNode.styles.push(s2);
              });
            }
          });
        }
        setClass(ids, classNames) {
          for (const id34 of ids) {
            const entity = this.entities.get(id34);
            if (entity) {
              for (const className of classNames) {
                entity.cssClasses += " " + className;
              }
            }
          }
        }
        clear() {
          this.entities = /* @__PURE__ */ new Map();
          this.classes = /* @__PURE__ */ new Map();
          this.relationships = [];
          clear();
        }
        getData() {
          const nodes5 = [];
          const edges3 = [];
          const config5 = getConfig2();
          let colorIndex = 0;
          for (const entityKey of this.entities.keys()) {
            const entityNode = this.entities.get(entityKey);
            if (entityNode) {
              entityNode.cssCompiledStyles = this.getCompiledStyles(entityNode.cssClasses.split(" "));
              entityNode.colorIndex = colorIndex++;
              nodes5.push(entityNode);
            }
          }
          let count2 = 0;
          for (const relationship of this.relationships) {
            const edge = {
              id: getEdgeId(relationship.entityA, relationship.entityB, {
                prefix: "id",
                counter: count2++
              }),
              type: "normal",
              curve: "basis",
              start: relationship.entityA,
              end: relationship.entityB,
              label: relationship.roleA,
              labelpos: "c",
              thickness: "normal",
              classes: "relationshipLine",
              arrowTypeStart: relationship.relSpec.cardB.toLowerCase(),
              arrowTypeEnd: relationship.relSpec.cardA.toLowerCase(),
              pattern: relationship.relSpec.relType == "IDENTIFYING" ? "solid" : "dashed",
              look: config5.look,
              labelType: "markdown"
            };
            edges3.push(edge);
          }
          return { nodes: nodes5, edges: edges3, other: {}, config: config5, direction: "TB" };
        }
      };
    }
  });

  // src/diagrams/er/erRenderer-unified.ts
  var erRenderer_unified_exports = {};
  __export(erRenderer_unified_exports, {
    draw: () => draw3
  });
  var draw3;
  var init_erRenderer_unified = __esm({
    "src/diagrams/er/erRenderer-unified.ts"() {
      "use strict";
      init_diagramAPI();
      init_logger();
      init_insertElementsForSize();
      init_render2();
      init_setupViewPortForSVG();
      init_utils2();
      init_src32();
      draw3 = /* @__PURE__ */ __name(async function(text4, id34, _version, diag) {
        log.info("REF0:");
        log.info("Drawing er diagram (unified)", id34);
        const { securityLevel, er: conf5, layout: layout7 } = getConfig2();
        const data4Layout = diag.db.getData();
        const svg2 = getDiagramElement(id34, securityLevel);
        data4Layout.type = diag.type;
        data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(layout7);
        data4Layout.config.flowchart.nodeSpacing = conf5?.nodeSpacing || 140;
        data4Layout.config.flowchart.rankSpacing = conf5?.rankSpacing || 80;
        data4Layout.direction = diag.db.getDirection();
        const { config: config5 } = data4Layout;
        const { look } = config5;
        if (look === "neo") {
          data4Layout.markers = [
            "only_one_neo",
            "zero_or_one_neo",
            "one_or_more_neo",
            "zero_or_more_neo"
          ];
        } else {
          data4Layout.markers = ["only_one", "zero_or_one", "one_or_more", "zero_or_more"];
        }
        data4Layout.diagramId = id34;
        await render6(data4Layout, svg2);
        if (data4Layout.layoutAlgorithm === "elk") {
          svg2.select(".edges").lower();
        }
        const backgroundNodes = svg2.selectAll('[id*="-background"]');
        if (Array.from(backgroundNodes).length > 0) {
          backgroundNodes.each(function() {
            const backgroundNode = select_default2(this);
            const backgroundId = backgroundNode.attr("id");
            const nonBackgroundId = backgroundId.replace("-background", "");
            const nonBackgroundNode = svg2.select(`#${CSS.escape(nonBackgroundId)}`);
            if (!nonBackgroundNode.empty()) {
              const transform8 = nonBackgroundNode.attr("transform");
              backgroundNode.attr("transform", transform8);
            }
          });
        }
        const padding2 = 8;
        utils_default2.insertTitle(
          svg2,
          "erDiagramTitleText",
          conf5?.titleTopMargin ?? 25,
          diag.db.getDiagramTitle()
        );
        setupViewPortForSVG(svg2, padding2, "erDiagram", conf5?.useMaxWidth ?? true);
      }, "draw");
    }
  });

  // src/diagrams/er/styles.ts
  var fade2, COLOR_THEMES2, genColor, getStyles4, styles_default4;
  var init_styles4 = __esm({
    "src/diagrams/er/styles.ts"() {
      "use strict";
      init_dist();
      fade2 = /* @__PURE__ */ __name((color2, opacity) => {
        const channel2 = channel_default2;
        const r2 = channel2(color2, "r");
        const g2 = channel2(color2, "g");
        const b3 = channel2(color2, "b");
        return rgba_default(r2, g2, b3, opacity);
      }, "fade");
      COLOR_THEMES2 = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]);
      genColor = /* @__PURE__ */ __name((options2) => {
        const { theme, look, bkgColorArray, borderColorArray } = options2;
        if (!COLOR_THEMES2.has(theme)) {
          return "";
        }
        const hasBkgColors = bkgColorArray?.length > 0;
        let sections6 = "";
        for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
          sections6 += `

    [data-look="${look}"][data-color-id="color-${i2}"].node path {
    stroke: ${borderColorArray[i2]};
    ${hasBkgColors ? `fill: ${bkgColorArray[i2]};` : ""}
    }

    [data-look="${look}"][data-color-id="color-${i2}"].node  rect {
    stroke: ${borderColorArray[i2]};
    ${hasBkgColors ? `fill: ${bkgColorArray[i2]};` : ""}
     }
    `;
        }
        return sections6;
      }, "genColor");
      getStyles4 = /* @__PURE__ */ __name((options2) => {
        const { look, theme, erEdgeLabelBackground, strokeWidth } = options2;
        return `
    ${genColor(options2)}
  .entityBox {
    fill: ${options2.mainBkg};
    stroke: ${options2.nodeBorder};
  }

  .relationshipLabelBox {
    fill: ${options2.tertiaryColor};
    opacity: 0.7;
    background-color: ${options2.tertiaryColor};
      rect {
        opacity: 0.5;
      }
  }

  .labelBkg {
    background-color: ${COLOR_THEMES2.has(theme) && erEdgeLabelBackground ? erEdgeLabelBackground : fade2(options2.tertiaryColor, 0.5)};
  }

  .edgeLabel {
    background-color: ${COLOR_THEMES2.has(theme) && erEdgeLabelBackground ? erEdgeLabelBackground : options2.edgeLabelBackground};
  }
  .edgeLabel .label rect {
    fill: ${COLOR_THEMES2.has(theme) && erEdgeLabelBackground ? erEdgeLabelBackground : options2.edgeLabelBackground};
  }
  .edgeLabel .label text {
    fill: ${options2.textColor};
  }

  .edgeLabel .label {
    fill: ${options2.nodeBorder};
    font-size: 14px;
  }

  .label {
    font-family: ${options2.fontFamily};
    color: ${options2.nodeTextColor || options2.textColor};
  }

  .edge-pattern-dashed {
    stroke-dasharray: 8,8;
  }

  .node rect,
  .node circle,
  .node ellipse,
  .node polygon
  {
    fill: ${options2.mainBkg};
    stroke: ${options2.nodeBorder};
    stroke-width: ${look === "neo" ? strokeWidth : "1px"};
  }

  .relationshipLine {
    stroke: ${options2.lineColor};
    stroke-width: ${look === "neo" ? strokeWidth : "1px"};
    fill: none;
  }

  .marker {
    fill: none !important;
    stroke: ${options2.lineColor} !important;
    stroke-width: 1;
  }
  [data-look=neo].labelBkg {
    background-color: ${fade2(options2.tertiaryColor, 0.5)};
  }
`;
      }, "getStyles");
      styles_default4 = getStyles4;
    }
  });

  // src/diagrams/er/erDiagram.ts
  var erDiagram_exports = {};
  __export(erDiagram_exports, {
    diagram: () => diagram3
  });
  var diagram3;
  var init_erDiagram2 = __esm({
    "src/diagrams/er/erDiagram.ts"() {
      "use strict";
      init_erDiagram();
      init_erDb();
      init_erRenderer_unified();
      init_styles4();
      diagram3 = {
        parser: erDiagram_default,
        get db() {
          return new ErDB();
        },
        renderer: erRenderer_unified_exports,
        styles: styles_default4
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/syntax-tree.js
  function isAstNode(obj) {
    return typeof obj === "object" && obj !== null && typeof obj.$type === "string";
  }
  function isReference(obj) {
    return typeof obj === "object" && obj !== null && typeof obj.$refText === "string" && "ref" in obj;
  }
  function isMultiReference(obj) {
    return typeof obj === "object" && obj !== null && typeof obj.$refText === "string" && "items" in obj;
  }
  function isAstNodeDescription(obj) {
    return typeof obj === "object" && obj !== null && typeof obj.name === "string" && typeof obj.type === "string" && typeof obj.path === "string";
  }
  function isLinkingError(obj) {
    return typeof obj === "object" && obj !== null && typeof obj.info === "object" && typeof obj.message === "string";
  }
  function isCompositeCstNode(node2) {
    return typeof node2 === "object" && node2 !== null && Array.isArray(node2.content);
  }
  function isLeafCstNode(node2) {
    return typeof node2 === "object" && node2 !== null && typeof node2.tokenType === "object";
  }
  function isRootCstNode(node2) {
    return isCompositeCstNode(node2) && typeof node2.fullText === "string";
  }
  var AbstractAstReflection;
  var init_syntax_tree = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/syntax-tree.js"() {
      "use strict";
      __name(isAstNode, "isAstNode");
      __name(isReference, "isReference");
      __name(isMultiReference, "isMultiReference");
      __name(isAstNodeDescription, "isAstNodeDescription");
      __name(isLinkingError, "isLinkingError");
      AbstractAstReflection = class {
        static {
          __name(this, "AbstractAstReflection");
        }
        constructor() {
          this.subtypes = {};
          this.allSubtypes = {};
        }
        getAllTypes() {
          return Object.keys(this.types);
        }
        getReferenceType(refInfo) {
          const metaData = this.types[refInfo.container.$type];
          if (!metaData) {
            throw new Error(`Type ${refInfo.container.$type || "undefined"} not found.`);
          }
          const referenceType = metaData.properties[refInfo.property]?.referenceType;
          if (!referenceType) {
            throw new Error(`Property ${refInfo.property || "undefined"} of type ${refInfo.container.$type} is not a reference.`);
          }
          return referenceType;
        }
        getTypeMetaData(type3) {
          const result = this.types[type3];
          if (!result) {
            return {
              name: type3,
              properties: {},
              superTypes: []
            };
          }
          return result;
        }
        isInstance(node2, type3) {
          return isAstNode(node2) && this.isSubtype(node2.$type, type3);
        }
        isSubtype(subtype, supertype) {
          if (subtype === supertype) {
            return true;
          }
          let nested = this.subtypes[subtype];
          if (!nested) {
            nested = this.subtypes[subtype] = {};
          }
          const existing = nested[supertype];
          if (existing !== void 0) {
            return existing;
          } else {
            const metaData = this.types[subtype];
            const result = metaData ? metaData.superTypes.some((s2) => this.isSubtype(s2, supertype)) : false;
            nested[supertype] = result;
            return result;
          }
        }
        getAllSubTypes(type3) {
          const existing = this.allSubtypes[type3];
          if (existing) {
            return existing;
          } else {
            const allTypes = this.getAllTypes();
            const types = [];
            for (const possibleSubType of allTypes) {
              if (this.isSubtype(possibleSubType, type3)) {
                types.push(possibleSubType);
              }
            }
            this.allSubtypes[type3] = types;
            return types;
          }
        }
      };
      __name(isCompositeCstNode, "isCompositeCstNode");
      __name(isLeafCstNode, "isLeafCstNode");
      __name(isRootCstNode, "isRootCstNode");
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/stream.js
  function toString5(item) {
    if (typeof item === "string") {
      return item;
    }
    if (typeof item === "undefined") {
      return "undefined";
    }
    if (typeof item.toString === "function") {
      return item.toString();
    }
    return Object.prototype.toString.call(item);
  }
  function isIterable(obj) {
    return !!obj && typeof obj[Symbol.iterator] === "function";
  }
  function stream(...collections) {
    if (collections.length === 1) {
      const collection4 = collections[0];
      if (collection4 instanceof StreamImpl) {
        return collection4;
      }
      if (isIterable(collection4)) {
        return new StreamImpl(() => collection4[Symbol.iterator](), (iterator) => iterator.next());
      }
      if (typeof collection4.length === "number") {
        return new StreamImpl(() => ({ index: 0 }), (state4) => {
          if (state4.index < collection4.length) {
            return { done: false, value: collection4[state4.index++] };
          } else {
            return DONE_RESULT;
          }
        });
      }
    }
    if (collections.length > 1) {
      return new StreamImpl(() => ({ collIndex: 0, arrIndex: 0 }), (state4) => {
        do {
          if (state4.iterator) {
            const next3 = state4.iterator.next();
            if (!next3.done) {
              return next3;
            }
            state4.iterator = void 0;
          }
          if (state4.array) {
            if (state4.arrIndex < state4.array.length) {
              return { done: false, value: state4.array[state4.arrIndex++] };
            }
            state4.array = void 0;
            state4.arrIndex = 0;
          }
          if (state4.collIndex < collections.length) {
            const collection4 = collections[state4.collIndex++];
            if (isIterable(collection4)) {
              state4.iterator = collection4[Symbol.iterator]();
            } else if (collection4 && typeof collection4.length === "number") {
              state4.array = collection4;
            }
          }
        } while (state4.iterator || state4.array || state4.collIndex < collections.length);
        return DONE_RESULT;
      });
    }
    return EMPTY_STREAM;
  }
  var StreamImpl, EMPTY_STREAM, DONE_RESULT, TreeStreamImpl, Reduction;
  var init_stream = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/stream.js"() {
      "use strict";
      StreamImpl = class _StreamImpl {
        static {
          __name(this, "StreamImpl");
        }
        constructor(startFn, nextFn) {
          this.startFn = startFn;
          this.nextFn = nextFn;
        }
        iterator() {
          const iterator = {
            state: this.startFn(),
            next: /* @__PURE__ */ __name(() => this.nextFn(iterator.state), "next"),
            [Symbol.iterator]: () => iterator
          };
          return iterator;
        }
        [Symbol.iterator]() {
          return this.iterator();
        }
        isEmpty() {
          const iterator = this.iterator();
          return Boolean(iterator.next().done);
        }
        count() {
          const iterator = this.iterator();
          let count2 = 0;
          let next3 = iterator.next();
          while (!next3.done) {
            count2++;
            next3 = iterator.next();
          }
          return count2;
        }
        toArray() {
          const result = [];
          const iterator = this.iterator();
          let next3;
          do {
            next3 = iterator.next();
            if (next3.value !== void 0) {
              result.push(next3.value);
            }
          } while (!next3.done);
          return result;
        }
        toSet() {
          return new Set(this);
        }
        toMap(keyFn, valueFn) {
          const entryStream = this.map((element3) => [
            keyFn ? keyFn(element3) : element3,
            valueFn ? valueFn(element3) : element3
          ]);
          return new Map(entryStream);
        }
        toString() {
          return this.join();
        }
        concat(other) {
          return new _StreamImpl(() => ({ first: this.startFn(), firstDone: false, iterator: other[Symbol.iterator]() }), (state4) => {
            let result;
            if (!state4.firstDone) {
              do {
                result = this.nextFn(state4.first);
                if (!result.done) {
                  return result;
                }
              } while (!result.done);
              state4.firstDone = true;
            }
            do {
              result = state4.iterator.next();
              if (!result.done) {
                return result;
              }
            } while (!result.done);
            return DONE_RESULT;
          });
        }
        join(separator = ",") {
          const iterator = this.iterator();
          let value2 = "";
          let result;
          let addSeparator = false;
          do {
            result = iterator.next();
            if (!result.done) {
              if (addSeparator) {
                value2 += separator;
              }
              value2 += toString5(result.value);
            }
            addSeparator = true;
          } while (!result.done);
          return value2;
        }
        indexOf(searchElement, fromIndex = 0) {
          const iterator = this.iterator();
          let index = 0;
          let next3 = iterator.next();
          while (!next3.done) {
            if (index >= fromIndex && next3.value === searchElement) {
              return index;
            }
            next3 = iterator.next();
            index++;
          }
          return -1;
        }
        every(predicate) {
          const iterator = this.iterator();
          let next3 = iterator.next();
          while (!next3.done) {
            if (!predicate(next3.value)) {
              return false;
            }
            next3 = iterator.next();
          }
          return true;
        }
        some(predicate) {
          const iterator = this.iterator();
          let next3 = iterator.next();
          while (!next3.done) {
            if (predicate(next3.value)) {
              return true;
            }
            next3 = iterator.next();
          }
          return false;
        }
        forEach(callbackfn) {
          const iterator = this.iterator();
          let index = 0;
          let next3 = iterator.next();
          while (!next3.done) {
            callbackfn(next3.value, index);
            next3 = iterator.next();
            index++;
          }
        }
        map(callbackfn) {
          return new _StreamImpl(this.startFn, (state4) => {
            const { done, value: value2 } = this.nextFn(state4);
            if (done) {
              return DONE_RESULT;
            } else {
              return { done: false, value: callbackfn(value2) };
            }
          });
        }
        filter(predicate) {
          return new _StreamImpl(this.startFn, (state4) => {
            let result;
            do {
              result = this.nextFn(state4);
              if (!result.done && predicate(result.value)) {
                return result;
              }
            } while (!result.done);
            return DONE_RESULT;
          });
        }
        nonNullable() {
          return this.filter((e3) => e3 !== void 0 && e3 !== null);
        }
        reduce(callbackfn, initialValue) {
          const iterator = this.iterator();
          let previousValue = initialValue;
          let next3 = iterator.next();
          while (!next3.done) {
            if (previousValue === void 0) {
              previousValue = next3.value;
            } else {
              previousValue = callbackfn(previousValue, next3.value);
            }
            next3 = iterator.next();
          }
          return previousValue;
        }
        reduceRight(callbackfn, initialValue) {
          return this.recursiveReduce(this.iterator(), callbackfn, initialValue);
        }
        recursiveReduce(iterator, callbackfn, initialValue) {
          const next3 = iterator.next();
          if (next3.done) {
            return initialValue;
          }
          const previousValue = this.recursiveReduce(iterator, callbackfn, initialValue);
          if (previousValue === void 0) {
            return next3.value;
          }
          return callbackfn(previousValue, next3.value);
        }
        find(predicate) {
          const iterator = this.iterator();
          let next3 = iterator.next();
          while (!next3.done) {
            if (predicate(next3.value)) {
              return next3.value;
            }
            next3 = iterator.next();
          }
          return void 0;
        }
        findIndex(predicate) {
          const iterator = this.iterator();
          let index = 0;
          let next3 = iterator.next();
          while (!next3.done) {
            if (predicate(next3.value)) {
              return index;
            }
            next3 = iterator.next();
            index++;
          }
          return -1;
        }
        includes(searchElement) {
          const iterator = this.iterator();
          let next3 = iterator.next();
          while (!next3.done) {
            if (next3.value === searchElement) {
              return true;
            }
            next3 = iterator.next();
          }
          return false;
        }
        flatMap(callbackfn) {
          return new _StreamImpl(() => ({ this: this.startFn() }), (state4) => {
            do {
              if (state4.iterator) {
                const next3 = state4.iterator.next();
                if (next3.done) {
                  state4.iterator = void 0;
                } else {
                  return next3;
                }
              }
              const { done, value: value2 } = this.nextFn(state4.this);
              if (!done) {
                const mapped = callbackfn(value2);
                if (isIterable(mapped)) {
                  state4.iterator = mapped[Symbol.iterator]();
                } else {
                  return { done: false, value: mapped };
                }
              }
            } while (state4.iterator);
            return DONE_RESULT;
          });
        }
        flat(depth) {
          if (depth === void 0) {
            depth = 1;
          }
          if (depth <= 0) {
            return this;
          }
          const stream2 = depth > 1 ? this.flat(depth - 1) : this;
          return new _StreamImpl(() => ({ this: stream2.startFn() }), (state4) => {
            do {
              if (state4.iterator) {
                const next3 = state4.iterator.next();
                if (next3.done) {
                  state4.iterator = void 0;
                } else {
                  return next3;
                }
              }
              const { done, value: value2 } = stream2.nextFn(state4.this);
              if (!done) {
                if (isIterable(value2)) {
                  state4.iterator = value2[Symbol.iterator]();
                } else {
                  return { done: false, value: value2 };
                }
              }
            } while (state4.iterator);
            return DONE_RESULT;
          });
        }
        head() {
          const iterator = this.iterator();
          const result = iterator.next();
          if (result.done) {
            return void 0;
          }
          return result.value;
        }
        tail(skipCount = 1) {
          return new _StreamImpl(() => {
            const state4 = this.startFn();
            for (let i2 = 0; i2 < skipCount; i2++) {
              const next3 = this.nextFn(state4);
              if (next3.done) {
                return state4;
              }
            }
            return state4;
          }, this.nextFn);
        }
        limit(maxSize) {
          return new _StreamImpl(() => ({ size: 0, state: this.startFn() }), (state4) => {
            state4.size++;
            if (state4.size > maxSize) {
              return DONE_RESULT;
            }
            return this.nextFn(state4.state);
          });
        }
        distinct(by) {
          return new _StreamImpl(() => ({ set: /* @__PURE__ */ new Set(), internalState: this.startFn() }), (state4) => {
            let result;
            do {
              result = this.nextFn(state4.internalState);
              if (!result.done) {
                const value2 = by ? by(result.value) : result.value;
                if (!state4.set.has(value2)) {
                  state4.set.add(value2);
                  return result;
                }
              }
            } while (!result.done);
            return DONE_RESULT;
          });
        }
        exclude(other, key) {
          const otherKeySet = /* @__PURE__ */ new Set();
          for (const item of other) {
            const value2 = key ? key(item) : item;
            otherKeySet.add(value2);
          }
          return this.filter((e3) => {
            const ownKey = key ? key(e3) : e3;
            return !otherKeySet.has(ownKey);
          });
        }
      };
      __name(toString5, "toString");
      __name(isIterable, "isIterable");
      EMPTY_STREAM = new StreamImpl(() => void 0, () => DONE_RESULT);
      DONE_RESULT = Object.freeze({ done: true, value: void 0 });
      __name(stream, "stream");
      TreeStreamImpl = class extends StreamImpl {
        static {
          __name(this, "TreeStreamImpl");
        }
        constructor(root3, children2, options2) {
          super(() => ({
            iterators: options2?.includeRoot ? [[root3][Symbol.iterator]()] : [children2(root3)[Symbol.iterator]()],
            pruned: false
          }), (state4) => {
            if (state4.pruned) {
              state4.iterators.pop();
              state4.pruned = false;
            }
            while (state4.iterators.length > 0) {
              const iterator = state4.iterators[state4.iterators.length - 1];
              const next3 = iterator.next();
              if (next3.done) {
                state4.iterators.pop();
              } else {
                state4.iterators.push(children2(next3.value)[Symbol.iterator]());
                return next3;
              }
            }
            return DONE_RESULT;
          });
        }
        iterator() {
          const iterator = {
            state: this.startFn(),
            next: /* @__PURE__ */ __name(() => this.nextFn(iterator.state), "next"),
            prune: /* @__PURE__ */ __name(() => {
              iterator.state.pruned = true;
            }, "prune"),
            [Symbol.iterator]: () => iterator
          };
          return iterator;
        }
      };
      (function(Reduction2) {
        function sum2(stream2) {
          return stream2.reduce((a2, b3) => a2 + b3, 0);
        }
        __name(sum2, "sum");
        Reduction2.sum = sum2;
        function product(stream2) {
          return stream2.reduce((a2, b3) => a2 * b3, 0);
        }
        __name(product, "product");
        Reduction2.product = product;
        function min9(stream2) {
          return stream2.reduce((a2, b3) => Math.min(a2, b3));
        }
        __name(min9, "min");
        Reduction2.min = min9;
        function max10(stream2) {
          return stream2.reduce((a2, b3) => Math.max(a2, b3));
        }
        __name(max10, "max");
        Reduction2.max = max10;
      })(Reduction || (Reduction = {}));
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/ast-utils.js
  var ast_utils_exports = {};
  __export(ast_utils_exports, {
    assignMandatoryProperties: () => assignMandatoryProperties,
    copyAstNode: () => copyAstNode,
    findRootNode: () => findRootNode,
    getContainerOfType: () => getContainerOfType,
    getDocument: () => getDocument,
    getReferenceNodes: () => getReferenceNodes,
    hasContainerOfType: () => hasContainerOfType,
    linkContentToContainer: () => linkContentToContainer,
    streamAllContents: () => streamAllContents,
    streamAst: () => streamAst,
    streamContents: () => streamContents,
    streamReferences: () => streamReferences
  });
  function linkContentToContainer(node2, options2 = {}) {
    for (const [name, value2] of Object.entries(node2)) {
      if (!name.startsWith("$")) {
        if (Array.isArray(value2)) {
          value2.forEach((item, index) => {
            if (isAstNode(item)) {
              item.$container = node2;
              item.$containerProperty = name;
              item.$containerIndex = index;
              if (options2.deep) {
                linkContentToContainer(item, options2);
              }
            }
          });
        } else if (isAstNode(value2)) {
          value2.$container = node2;
          value2.$containerProperty = name;
          if (options2.deep) {
            linkContentToContainer(value2, options2);
          }
        }
      }
    }
  }
  function getContainerOfType(node2, typePredicate) {
    let item = node2;
    while (item) {
      if (typePredicate(item)) {
        return item;
      }
      item = item.$container;
    }
    return void 0;
  }
  function hasContainerOfType(node2, predicate) {
    let item = node2;
    while (item) {
      if (predicate(item)) {
        return true;
      }
      item = item.$container;
    }
    return false;
  }
  function getDocument(node2) {
    const rootNode = findRootNode(node2);
    const result = rootNode.$document;
    if (!result) {
      throw new Error("AST node has no document.");
    }
    return result;
  }
  function findRootNode(node2) {
    while (node2.$container) {
      node2 = node2.$container;
    }
    return node2;
  }
  function getReferenceNodes(reference) {
    if (isReference(reference)) {
      return reference.ref ? [reference.ref] : [];
    } else if (isMultiReference(reference)) {
      return reference.items.map((item) => item.ref);
    }
    return [];
  }
  function streamContents(node2, options2) {
    if (!node2) {
      throw new Error("Node must be an AstNode.");
    }
    const range3 = options2?.range;
    return new StreamImpl(() => ({
      keys: Object.keys(node2),
      keyIndex: 0,
      arrayIndex: 0
    }), (state4) => {
      while (state4.keyIndex < state4.keys.length) {
        const property2 = state4.keys[state4.keyIndex];
        if (!property2.startsWith("$")) {
          const value2 = node2[property2];
          if (isAstNode(value2)) {
            state4.keyIndex++;
            if (isAstNodeInRange(value2, range3)) {
              return { done: false, value: value2 };
            }
          } else if (Array.isArray(value2)) {
            while (state4.arrayIndex < value2.length) {
              const index = state4.arrayIndex++;
              const element3 = value2[index];
              if (isAstNode(element3) && isAstNodeInRange(element3, range3)) {
                return { done: false, value: element3 };
              }
            }
            state4.arrayIndex = 0;
          }
        }
        state4.keyIndex++;
      }
      return DONE_RESULT;
    });
  }
  function streamAllContents(root3, options2) {
    if (!root3) {
      throw new Error("Root node must be an AstNode.");
    }
    return new TreeStreamImpl(root3, (node2) => streamContents(node2, options2));
  }
  function streamAst(root3, options2) {
    if (!root3) {
      throw new Error("Root node must be an AstNode.");
    } else if (options2?.range && !isAstNodeInRange(root3, options2.range)) {
      return new TreeStreamImpl(root3, () => []);
    }
    return new TreeStreamImpl(root3, (node2) => streamContents(node2, options2), { includeRoot: true });
  }
  function isAstNodeInRange(astNode, range3) {
    if (!range3) {
      return true;
    }
    const nodeRange = astNode.$cstNode?.range;
    if (!nodeRange) {
      return false;
    }
    return inRange(nodeRange, range3);
  }
  function streamReferences(node2) {
    return new StreamImpl(() => ({
      keys: Object.keys(node2),
      keyIndex: 0,
      arrayIndex: 0
    }), (state4) => {
      while (state4.keyIndex < state4.keys.length) {
        const property2 = state4.keys[state4.keyIndex];
        if (!property2.startsWith("$")) {
          const value2 = node2[property2];
          if (isReference(value2) || isMultiReference(value2)) {
            state4.keyIndex++;
            return { done: false, value: { reference: value2, container: node2, property: property2 } };
          } else if (Array.isArray(value2)) {
            while (state4.arrayIndex < value2.length) {
              const index = state4.arrayIndex++;
              const element3 = value2[index];
              if (isReference(element3) || isMultiReference(value2)) {
                return { done: false, value: { reference: element3, container: node2, property: property2, index } };
              }
            }
            state4.arrayIndex = 0;
          }
        }
        state4.keyIndex++;
      }
      return DONE_RESULT;
    });
  }
  function assignMandatoryProperties(reflection3, node2) {
    const typeMetaData = reflection3.getTypeMetaData(node2.$type);
    const genericNode = node2;
    for (const property2 of Object.values(typeMetaData.properties)) {
      if (property2.defaultValue !== void 0 && genericNode[property2.name] === void 0) {
        genericNode[property2.name] = copyDefaultValue(property2.defaultValue);
      }
    }
  }
  function copyDefaultValue(propertyType) {
    if (Array.isArray(propertyType)) {
      return [...propertyType.map(copyDefaultValue)];
    } else {
      return propertyType;
    }
  }
  function copyAstNode(node2, buildReference, trace) {
    const copy5 = { $type: node2.$type };
    if (trace) {
      trace.set(node2, copy5);
      trace.set(copy5, node2);
    }
    for (const [name, value2] of Object.entries(node2)) {
      if (!name.startsWith("$")) {
        if (isAstNode(value2)) {
          copy5[name] = copyAstNode(value2, buildReference, trace);
        } else if (isReference(value2)) {
          copy5[name] = buildReference(copy5, name, value2.$refNode, value2.$refText, value2);
        } else if (Array.isArray(value2)) {
          const copiedArray = [];
          for (const element3 of value2) {
            if (isAstNode(element3)) {
              copiedArray.push(copyAstNode(element3, buildReference, trace));
            } else if (isReference(element3)) {
              copiedArray.push(buildReference(copy5, name, element3.$refNode, element3.$refText, element3));
            } else {
              copiedArray.push(element3);
            }
          }
          copy5[name] = copiedArray;
        } else {
          copy5[name] = value2;
        }
      }
    }
    linkContentToContainer(copy5, { deep: true });
    return copy5;
  }
  var init_ast_utils = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/ast-utils.js"() {
      "use strict";
      init_syntax_tree();
      init_stream();
      init_cst_utils();
      __name(linkContentToContainer, "linkContentToContainer");
      __name(getContainerOfType, "getContainerOfType");
      __name(hasContainerOfType, "hasContainerOfType");
      __name(getDocument, "getDocument");
      __name(findRootNode, "findRootNode");
      __name(getReferenceNodes, "getReferenceNodes");
      __name(streamContents, "streamContents");
      __name(streamAllContents, "streamAllContents");
      __name(streamAst, "streamAst");
      __name(isAstNodeInRange, "isAstNodeInRange");
      __name(streamReferences, "streamReferences");
      __name(assignMandatoryProperties, "assignMandatoryProperties");
      __name(copyDefaultValue, "copyDefaultValue");
      __name(copyAstNode, "copyAstNode");
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/languages/generated/ast.js
  var ast_exports = {};
  __export(ast_exports, {
    AbstractElement: () => AbstractElement,
    AbstractParserRule: () => AbstractParserRule,
    AbstractRule: () => AbstractRule,
    AbstractType: () => AbstractType,
    Action: () => Action,
    Alternatives: () => Alternatives,
    ArrayLiteral: () => ArrayLiteral,
    ArrayType: () => ArrayType,
    Assignment: () => Assignment,
    BooleanLiteral: () => BooleanLiteral,
    CharacterRange: () => CharacterRange,
    Condition: () => Condition,
    Conjunction: () => Conjunction,
    CrossReference: () => CrossReference,
    Disjunction: () => Disjunction,
    EndOfFile: () => EndOfFile,
    Grammar: () => Grammar,
    GrammarImport: () => GrammarImport,
    Group: () => Group,
    InferredType: () => InferredType,
    InfixRule: () => InfixRule,
    InfixRuleOperatorList: () => InfixRuleOperatorList,
    InfixRuleOperators: () => InfixRuleOperators,
    Interface: () => Interface,
    Keyword: () => Keyword2,
    LangiumGrammarAstReflection: () => LangiumGrammarAstReflection,
    LangiumGrammarTerminals: () => LangiumGrammarTerminals,
    NamedArgument: () => NamedArgument,
    NegatedToken: () => NegatedToken,
    Negation: () => Negation,
    NumberLiteral: () => NumberLiteral,
    Parameter: () => Parameter,
    ParameterReference: () => ParameterReference,
    ParserRule: () => ParserRule,
    ReferenceType: () => ReferenceType,
    RegexToken: () => RegexToken,
    ReturnType: () => ReturnType,
    RuleCall: () => RuleCall,
    SimpleType: () => SimpleType,
    StringLiteral: () => StringLiteral,
    TerminalAlternatives: () => TerminalAlternatives,
    TerminalElement: () => TerminalElement,
    TerminalGroup: () => TerminalGroup,
    TerminalRule: () => TerminalRule,
    TerminalRuleCall: () => TerminalRuleCall,
    Type: () => Type3,
    TypeAttribute: () => TypeAttribute,
    TypeDefinition: () => TypeDefinition,
    UnionType: () => UnionType,
    UnorderedGroup: () => UnorderedGroup,
    UntilToken: () => UntilToken,
    ValueLiteral: () => ValueLiteral,
    Wildcard: () => Wildcard,
    isAbstractElement: () => isAbstractElement,
    isAbstractParserRule: () => isAbstractParserRule,
    isAbstractRule: () => isAbstractRule,
    isAbstractType: () => isAbstractType,
    isAction: () => isAction,
    isAlternatives: () => isAlternatives,
    isArrayLiteral: () => isArrayLiteral,
    isArrayType: () => isArrayType,
    isAssignment: () => isAssignment,
    isBooleanLiteral: () => isBooleanLiteral,
    isCharacterRange: () => isCharacterRange,
    isCondition: () => isCondition,
    isConjunction: () => isConjunction,
    isCrossReference: () => isCrossReference,
    isDisjunction: () => isDisjunction,
    isEndOfFile: () => isEndOfFile,
    isGrammar: () => isGrammar,
    isGrammarImport: () => isGrammarImport,
    isGroup: () => isGroup,
    isInferredType: () => isInferredType,
    isInfixRule: () => isInfixRule,
    isInfixRuleOperatorList: () => isInfixRuleOperatorList,
    isInfixRuleOperators: () => isInfixRuleOperators,
    isInterface: () => isInterface,
    isKeyword: () => isKeyword,
    isNamedArgument: () => isNamedArgument,
    isNegatedToken: () => isNegatedToken,
    isNegation: () => isNegation,
    isNumberLiteral: () => isNumberLiteral,
    isParameter: () => isParameter,
    isParameterReference: () => isParameterReference,
    isParserRule: () => isParserRule,
    isReferenceType: () => isReferenceType,
    isRegexToken: () => isRegexToken,
    isReturnType: () => isReturnType,
    isRuleCall: () => isRuleCall,
    isSimpleType: () => isSimpleType,
    isStringLiteral: () => isStringLiteral,
    isTerminalAlternatives: () => isTerminalAlternatives,
    isTerminalElement: () => isTerminalElement,
    isTerminalGroup: () => isTerminalGroup,
    isTerminalRule: () => isTerminalRule,
    isTerminalRuleCall: () => isTerminalRuleCall,
    isType: () => isType,
    isTypeAttribute: () => isTypeAttribute,
    isTypeDefinition: () => isTypeDefinition,
    isUnionType: () => isUnionType,
    isUnorderedGroup: () => isUnorderedGroup,
    isUntilToken: () => isUntilToken,
    isValueLiteral: () => isValueLiteral,
    isWildcard: () => isWildcard,
    reflection: () => reflection
  });
  function isAbstractElement(item) {
    return reflection.isInstance(item, AbstractElement.$type);
  }
  function isAbstractParserRule(item) {
    return reflection.isInstance(item, AbstractParserRule.$type);
  }
  function isAbstractRule(item) {
    return reflection.isInstance(item, AbstractRule.$type);
  }
  function isAbstractType(item) {
    return reflection.isInstance(item, AbstractType.$type);
  }
  function isAction(item) {
    return reflection.isInstance(item, Action.$type);
  }
  function isAlternatives(item) {
    return reflection.isInstance(item, Alternatives.$type);
  }
  function isArrayLiteral(item) {
    return reflection.isInstance(item, ArrayLiteral.$type);
  }
  function isArrayType(item) {
    return reflection.isInstance(item, ArrayType.$type);
  }
  function isAssignment(item) {
    return reflection.isInstance(item, Assignment.$type);
  }
  function isBooleanLiteral(item) {
    return reflection.isInstance(item, BooleanLiteral.$type);
  }
  function isCharacterRange(item) {
    return reflection.isInstance(item, CharacterRange.$type);
  }
  function isCondition(item) {
    return reflection.isInstance(item, Condition.$type);
  }
  function isConjunction(item) {
    return reflection.isInstance(item, Conjunction.$type);
  }
  function isCrossReference(item) {
    return reflection.isInstance(item, CrossReference.$type);
  }
  function isDisjunction(item) {
    return reflection.isInstance(item, Disjunction.$type);
  }
  function isEndOfFile(item) {
    return reflection.isInstance(item, EndOfFile.$type);
  }
  function isGrammar(item) {
    return reflection.isInstance(item, Grammar.$type);
  }
  function isGrammarImport(item) {
    return reflection.isInstance(item, GrammarImport.$type);
  }
  function isGroup(item) {
    return reflection.isInstance(item, Group.$type);
  }
  function isInferredType(item) {
    return reflection.isInstance(item, InferredType.$type);
  }
  function isInfixRule(item) {
    return reflection.isInstance(item, InfixRule.$type);
  }
  function isInfixRuleOperatorList(item) {
    return reflection.isInstance(item, InfixRuleOperatorList.$type);
  }
  function isInfixRuleOperators(item) {
    return reflection.isInstance(item, InfixRuleOperators.$type);
  }
  function isInterface(item) {
    return reflection.isInstance(item, Interface.$type);
  }
  function isKeyword(item) {
    return reflection.isInstance(item, Keyword2.$type);
  }
  function isNamedArgument(item) {
    return reflection.isInstance(item, NamedArgument.$type);
  }
  function isNegatedToken(item) {
    return reflection.isInstance(item, NegatedToken.$type);
  }
  function isNegation(item) {
    return reflection.isInstance(item, Negation.$type);
  }
  function isNumberLiteral(item) {
    return reflection.isInstance(item, NumberLiteral.$type);
  }
  function isParameter(item) {
    return reflection.isInstance(item, Parameter.$type);
  }
  function isParameterReference(item) {
    return reflection.isInstance(item, ParameterReference.$type);
  }
  function isParserRule(item) {
    return reflection.isInstance(item, ParserRule.$type);
  }
  function isReferenceType(item) {
    return reflection.isInstance(item, ReferenceType.$type);
  }
  function isRegexToken(item) {
    return reflection.isInstance(item, RegexToken.$type);
  }
  function isReturnType(item) {
    return reflection.isInstance(item, ReturnType.$type);
  }
  function isRuleCall(item) {
    return reflection.isInstance(item, RuleCall.$type);
  }
  function isSimpleType(item) {
    return reflection.isInstance(item, SimpleType.$type);
  }
  function isStringLiteral(item) {
    return reflection.isInstance(item, StringLiteral.$type);
  }
  function isTerminalAlternatives(item) {
    return reflection.isInstance(item, TerminalAlternatives.$type);
  }
  function isTerminalElement(item) {
    return reflection.isInstance(item, TerminalElement.$type);
  }
  function isTerminalGroup(item) {
    return reflection.isInstance(item, TerminalGroup.$type);
  }
  function isTerminalRule(item) {
    return reflection.isInstance(item, TerminalRule.$type);
  }
  function isTerminalRuleCall(item) {
    return reflection.isInstance(item, TerminalRuleCall.$type);
  }
  function isType(item) {
    return reflection.isInstance(item, Type3.$type);
  }
  function isTypeAttribute(item) {
    return reflection.isInstance(item, TypeAttribute.$type);
  }
  function isTypeDefinition(item) {
    return reflection.isInstance(item, TypeDefinition.$type);
  }
  function isUnionType(item) {
    return reflection.isInstance(item, UnionType.$type);
  }
  function isUnorderedGroup(item) {
    return reflection.isInstance(item, UnorderedGroup.$type);
  }
  function isUntilToken(item) {
    return reflection.isInstance(item, UntilToken.$type);
  }
  function isValueLiteral(item) {
    return reflection.isInstance(item, ValueLiteral.$type);
  }
  function isWildcard(item) {
    return reflection.isInstance(item, Wildcard.$type);
  }
  var LangiumGrammarTerminals, AbstractElement, AbstractParserRule, AbstractRule, AbstractType, Action, Alternatives, ArrayLiteral, ArrayType, Assignment, BooleanLiteral, CharacterRange, Condition, Conjunction, CrossReference, Disjunction, EndOfFile, Grammar, GrammarImport, Group, InferredType, InfixRule, InfixRuleOperatorList, InfixRuleOperators, Interface, Keyword2, NamedArgument, NegatedToken, Negation, NumberLiteral, Parameter, ParameterReference, ParserRule, ReferenceType, RegexToken, ReturnType, RuleCall, SimpleType, StringLiteral, TerminalAlternatives, TerminalElement, TerminalGroup, TerminalRule, TerminalRuleCall, Type3, TypeAttribute, TypeDefinition, UnionType, UnorderedGroup, UntilToken, ValueLiteral, Wildcard, LangiumGrammarAstReflection, reflection;
  var init_ast = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/languages/generated/ast.js"() {
      "use strict";
      init_syntax_tree();
      LangiumGrammarTerminals = {
        ID: /\^?[_a-zA-Z][\w_]*/,
        STRING: /"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/,
        NUMBER: /NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/,
        RegexLiteral: /\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/,
        WS: /\s+/,
        ML_COMMENT: /\/\*[\s\S]*?\*\//,
        SL_COMMENT: /\/\/[^\n\r]*/
      };
      AbstractElement = {
        $type: "AbstractElement",
        cardinality: "cardinality"
      };
      __name(isAbstractElement, "isAbstractElement");
      AbstractParserRule = {
        $type: "AbstractParserRule"
      };
      __name(isAbstractParserRule, "isAbstractParserRule");
      AbstractRule = {
        $type: "AbstractRule"
      };
      __name(isAbstractRule, "isAbstractRule");
      AbstractType = {
        $type: "AbstractType"
      };
      __name(isAbstractType, "isAbstractType");
      Action = {
        $type: "Action",
        cardinality: "cardinality",
        feature: "feature",
        inferredType: "inferredType",
        operator: "operator",
        type: "type"
      };
      __name(isAction, "isAction");
      Alternatives = {
        $type: "Alternatives",
        cardinality: "cardinality",
        elements: "elements"
      };
      __name(isAlternatives, "isAlternatives");
      ArrayLiteral = {
        $type: "ArrayLiteral",
        elements: "elements"
      };
      __name(isArrayLiteral, "isArrayLiteral");
      ArrayType = {
        $type: "ArrayType",
        elementType: "elementType"
      };
      __name(isArrayType, "isArrayType");
      Assignment = {
        $type: "Assignment",
        cardinality: "cardinality",
        feature: "feature",
        operator: "operator",
        predicate: "predicate",
        terminal: "terminal"
      };
      __name(isAssignment, "isAssignment");
      BooleanLiteral = {
        $type: "BooleanLiteral",
        true: "true"
      };
      __name(isBooleanLiteral, "isBooleanLiteral");
      CharacterRange = {
        $type: "CharacterRange",
        cardinality: "cardinality",
        left: "left",
        lookahead: "lookahead",
        parenthesized: "parenthesized",
        right: "right"
      };
      __name(isCharacterRange, "isCharacterRange");
      Condition = {
        $type: "Condition"
      };
      __name(isCondition, "isCondition");
      Conjunction = {
        $type: "Conjunction",
        left: "left",
        right: "right"
      };
      __name(isConjunction, "isConjunction");
      CrossReference = {
        $type: "CrossReference",
        cardinality: "cardinality",
        deprecatedSyntax: "deprecatedSyntax",
        isMulti: "isMulti",
        terminal: "terminal",
        type: "type"
      };
      __name(isCrossReference, "isCrossReference");
      Disjunction = {
        $type: "Disjunction",
        left: "left",
        right: "right"
      };
      __name(isDisjunction, "isDisjunction");
      EndOfFile = {
        $type: "EndOfFile",
        cardinality: "cardinality"
      };
      __name(isEndOfFile, "isEndOfFile");
      Grammar = {
        $type: "Grammar",
        imports: "imports",
        interfaces: "interfaces",
        isDeclared: "isDeclared",
        name: "name",
        rules: "rules",
        types: "types"
      };
      __name(isGrammar, "isGrammar");
      GrammarImport = {
        $type: "GrammarImport",
        path: "path"
      };
      __name(isGrammarImport, "isGrammarImport");
      Group = {
        $type: "Group",
        cardinality: "cardinality",
        elements: "elements",
        guardCondition: "guardCondition",
        predicate: "predicate"
      };
      __name(isGroup, "isGroup");
      InferredType = {
        $type: "InferredType",
        name: "name"
      };
      __name(isInferredType, "isInferredType");
      InfixRule = {
        $type: "InfixRule",
        call: "call",
        dataType: "dataType",
        inferredType: "inferredType",
        name: "name",
        operators: "operators",
        parameters: "parameters",
        returnType: "returnType"
      };
      __name(isInfixRule, "isInfixRule");
      InfixRuleOperatorList = {
        $type: "InfixRuleOperatorList",
        associativity: "associativity",
        operators: "operators"
      };
      __name(isInfixRuleOperatorList, "isInfixRuleOperatorList");
      InfixRuleOperators = {
        $type: "InfixRuleOperators",
        precedences: "precedences"
      };
      __name(isInfixRuleOperators, "isInfixRuleOperators");
      Interface = {
        $type: "Interface",
        attributes: "attributes",
        name: "name",
        superTypes: "superTypes"
      };
      __name(isInterface, "isInterface");
      Keyword2 = {
        $type: "Keyword",
        cardinality: "cardinality",
        predicate: "predicate",
        value: "value"
      };
      __name(isKeyword, "isKeyword");
      NamedArgument = {
        $type: "NamedArgument",
        calledByName: "calledByName",
        parameter: "parameter",
        value: "value"
      };
      __name(isNamedArgument, "isNamedArgument");
      NegatedToken = {
        $type: "NegatedToken",
        cardinality: "cardinality",
        lookahead: "lookahead",
        parenthesized: "parenthesized",
        terminal: "terminal"
      };
      __name(isNegatedToken, "isNegatedToken");
      Negation = {
        $type: "Negation",
        value: "value"
      };
      __name(isNegation, "isNegation");
      NumberLiteral = {
        $type: "NumberLiteral",
        value: "value"
      };
      __name(isNumberLiteral, "isNumberLiteral");
      Parameter = {
        $type: "Parameter",
        name: "name"
      };
      __name(isParameter, "isParameter");
      ParameterReference = {
        $type: "ParameterReference",
        parameter: "parameter"
      };
      __name(isParameterReference, "isParameterReference");
      ParserRule = {
        $type: "ParserRule",
        dataType: "dataType",
        definition: "definition",
        entry: "entry",
        fragment: "fragment",
        inferredType: "inferredType",
        name: "name",
        parameters: "parameters",
        returnType: "returnType"
      };
      __name(isParserRule, "isParserRule");
      ReferenceType = {
        $type: "ReferenceType",
        isMulti: "isMulti",
        referenceType: "referenceType"
      };
      __name(isReferenceType, "isReferenceType");
      RegexToken = {
        $type: "RegexToken",
        cardinality: "cardinality",
        lookahead: "lookahead",
        parenthesized: "parenthesized",
        regex: "regex"
      };
      __name(isRegexToken, "isRegexToken");
      ReturnType = {
        $type: "ReturnType",
        name: "name"
      };
      __name(isReturnType, "isReturnType");
      RuleCall = {
        $type: "RuleCall",
        arguments: "arguments",
        cardinality: "cardinality",
        predicate: "predicate",
        rule: "rule"
      };
      __name(isRuleCall, "isRuleCall");
      SimpleType = {
        $type: "SimpleType",
        primitiveType: "primitiveType",
        stringType: "stringType",
        typeRef: "typeRef"
      };
      __name(isSimpleType, "isSimpleType");
      StringLiteral = {
        $type: "StringLiteral",
        value: "value"
      };
      __name(isStringLiteral, "isStringLiteral");
      TerminalAlternatives = {
        $type: "TerminalAlternatives",
        cardinality: "cardinality",
        elements: "elements",
        lookahead: "lookahead",
        parenthesized: "parenthesized"
      };
      __name(isTerminalAlternatives, "isTerminalAlternatives");
      TerminalElement = {
        $type: "TerminalElement",
        cardinality: "cardinality",
        lookahead: "lookahead",
        parenthesized: "parenthesized"
      };
      __name(isTerminalElement, "isTerminalElement");
      TerminalGroup = {
        $type: "TerminalGroup",
        cardinality: "cardinality",
        elements: "elements",
        lookahead: "lookahead",
        parenthesized: "parenthesized"
      };
      __name(isTerminalGroup, "isTerminalGroup");
      TerminalRule = {
        $type: "TerminalRule",
        definition: "definition",
        fragment: "fragment",
        hidden: "hidden",
        name: "name",
        type: "type"
      };
      __name(isTerminalRule, "isTerminalRule");
      TerminalRuleCall = {
        $type: "TerminalRuleCall",
        cardinality: "cardinality",
        lookahead: "lookahead",
        parenthesized: "parenthesized",
        rule: "rule"
      };
      __name(isTerminalRuleCall, "isTerminalRuleCall");
      Type3 = {
        $type: "Type",
        name: "name",
        type: "type"
      };
      __name(isType, "isType");
      TypeAttribute = {
        $type: "TypeAttribute",
        defaultValue: "defaultValue",
        isOptional: "isOptional",
        name: "name",
        type: "type"
      };
      __name(isTypeAttribute, "isTypeAttribute");
      TypeDefinition = {
        $type: "TypeDefinition"
      };
      __name(isTypeDefinition, "isTypeDefinition");
      UnionType = {
        $type: "UnionType",
        types: "types"
      };
      __name(isUnionType, "isUnionType");
      UnorderedGroup = {
        $type: "UnorderedGroup",
        cardinality: "cardinality",
        elements: "elements"
      };
      __name(isUnorderedGroup, "isUnorderedGroup");
      UntilToken = {
        $type: "UntilToken",
        cardinality: "cardinality",
        lookahead: "lookahead",
        parenthesized: "parenthesized",
        terminal: "terminal"
      };
      __name(isUntilToken, "isUntilToken");
      ValueLiteral = {
        $type: "ValueLiteral"
      };
      __name(isValueLiteral, "isValueLiteral");
      Wildcard = {
        $type: "Wildcard",
        cardinality: "cardinality",
        lookahead: "lookahead",
        parenthesized: "parenthesized"
      };
      __name(isWildcard, "isWildcard");
      LangiumGrammarAstReflection = class extends AbstractAstReflection {
        static {
          __name(this, "LangiumGrammarAstReflection");
        }
        constructor() {
          super(...arguments);
          this.types = {
            AbstractElement: {
              name: AbstractElement.$type,
              properties: {
                cardinality: {
                  name: AbstractElement.cardinality
                }
              },
              superTypes: []
            },
            AbstractParserRule: {
              name: AbstractParserRule.$type,
              properties: {},
              superTypes: [AbstractRule.$type, AbstractType.$type]
            },
            AbstractRule: {
              name: AbstractRule.$type,
              properties: {},
              superTypes: []
            },
            AbstractType: {
              name: AbstractType.$type,
              properties: {},
              superTypes: []
            },
            Action: {
              name: Action.$type,
              properties: {
                cardinality: {
                  name: Action.cardinality
                },
                feature: {
                  name: Action.feature
                },
                inferredType: {
                  name: Action.inferredType
                },
                operator: {
                  name: Action.operator
                },
                type: {
                  name: Action.type,
                  referenceType: AbstractType.$type
                }
              },
              superTypes: [AbstractElement.$type]
            },
            Alternatives: {
              name: Alternatives.$type,
              properties: {
                cardinality: {
                  name: Alternatives.cardinality
                },
                elements: {
                  name: Alternatives.elements,
                  defaultValue: []
                }
              },
              superTypes: [AbstractElement.$type]
            },
            ArrayLiteral: {
              name: ArrayLiteral.$type,
              properties: {
                elements: {
                  name: ArrayLiteral.elements,
                  defaultValue: []
                }
              },
              superTypes: [ValueLiteral.$type]
            },
            ArrayType: {
              name: ArrayType.$type,
              properties: {
                elementType: {
                  name: ArrayType.elementType
                }
              },
              superTypes: [TypeDefinition.$type]
            },
            Assignment: {
              name: Assignment.$type,
              properties: {
                cardinality: {
                  name: Assignment.cardinality
                },
                feature: {
                  name: Assignment.feature
                },
                operator: {
                  name: Assignment.operator
                },
                predicate: {
                  name: Assignment.predicate
                },
                terminal: {
                  name: Assignment.terminal
                }
              },
              superTypes: [AbstractElement.$type]
            },
            BooleanLiteral: {
              name: BooleanLiteral.$type,
              properties: {
                true: {
                  name: BooleanLiteral.true,
                  defaultValue: false
                }
              },
              superTypes: [Condition.$type, ValueLiteral.$type]
            },
            CharacterRange: {
              name: CharacterRange.$type,
              properties: {
                cardinality: {
                  name: CharacterRange.cardinality
                },
                left: {
                  name: CharacterRange.left
                },
                lookahead: {
                  name: CharacterRange.lookahead
                },
                parenthesized: {
                  name: CharacterRange.parenthesized,
                  defaultValue: false
                },
                right: {
                  name: CharacterRange.right
                }
              },
              superTypes: [TerminalElement.$type]
            },
            Condition: {
              name: Condition.$type,
              properties: {},
              superTypes: []
            },
            Conjunction: {
              name: Conjunction.$type,
              properties: {
                left: {
                  name: Conjunction.left
                },
                right: {
                  name: Conjunction.right
                }
              },
              superTypes: [Condition.$type]
            },
            CrossReference: {
              name: CrossReference.$type,
              properties: {
                cardinality: {
                  name: CrossReference.cardinality
                },
                deprecatedSyntax: {
                  name: CrossReference.deprecatedSyntax,
                  defaultValue: false
                },
                isMulti: {
                  name: CrossReference.isMulti,
                  defaultValue: false
                },
                terminal: {
                  name: CrossReference.terminal
                },
                type: {
                  name: CrossReference.type,
                  referenceType: AbstractType.$type
                }
              },
              superTypes: [AbstractElement.$type]
            },
            Disjunction: {
              name: Disjunction.$type,
              properties: {
                left: {
                  name: Disjunction.left
                },
                right: {
                  name: Disjunction.right
                }
              },
              superTypes: [Condition.$type]
            },
            EndOfFile: {
              name: EndOfFile.$type,
              properties: {
                cardinality: {
                  name: EndOfFile.cardinality
                }
              },
              superTypes: [AbstractElement.$type]
            },
            Grammar: {
              name: Grammar.$type,
              properties: {
                imports: {
                  name: Grammar.imports,
                  defaultValue: []
                },
                interfaces: {
                  name: Grammar.interfaces,
                  defaultValue: []
                },
                isDeclared: {
                  name: Grammar.isDeclared,
                  defaultValue: false
                },
                name: {
                  name: Grammar.name
                },
                rules: {
                  name: Grammar.rules,
                  defaultValue: []
                },
                types: {
                  name: Grammar.types,
                  defaultValue: []
                }
              },
              superTypes: []
            },
            GrammarImport: {
              name: GrammarImport.$type,
              properties: {
                path: {
                  name: GrammarImport.path
                }
              },
              superTypes: []
            },
            Group: {
              name: Group.$type,
              properties: {
                cardinality: {
                  name: Group.cardinality
                },
                elements: {
                  name: Group.elements,
                  defaultValue: []
                },
                guardCondition: {
                  name: Group.guardCondition
                },
                predicate: {
                  name: Group.predicate
                }
              },
              superTypes: [AbstractElement.$type]
            },
            InferredType: {
              name: InferredType.$type,
              properties: {
                name: {
                  name: InferredType.name
                }
              },
              superTypes: [AbstractType.$type]
            },
            InfixRule: {
              name: InfixRule.$type,
              properties: {
                call: {
                  name: InfixRule.call
                },
                dataType: {
                  name: InfixRule.dataType
                },
                inferredType: {
                  name: InfixRule.inferredType
                },
                name: {
                  name: InfixRule.name
                },
                operators: {
                  name: InfixRule.operators
                },
                parameters: {
                  name: InfixRule.parameters,
                  defaultValue: []
                },
                returnType: {
                  name: InfixRule.returnType,
                  referenceType: AbstractType.$type
                }
              },
              superTypes: [AbstractParserRule.$type]
            },
            InfixRuleOperatorList: {
              name: InfixRuleOperatorList.$type,
              properties: {
                associativity: {
                  name: InfixRuleOperatorList.associativity
                },
                operators: {
                  name: InfixRuleOperatorList.operators,
                  defaultValue: []
                }
              },
              superTypes: []
            },
            InfixRuleOperators: {
              name: InfixRuleOperators.$type,
              properties: {
                precedences: {
                  name: InfixRuleOperators.precedences,
                  defaultValue: []
                }
              },
              superTypes: []
            },
            Interface: {
              name: Interface.$type,
              properties: {
                attributes: {
                  name: Interface.attributes,
                  defaultValue: []
                },
                name: {
                  name: Interface.name
                },
                superTypes: {
                  name: Interface.superTypes,
                  defaultValue: [],
                  referenceType: AbstractType.$type
                }
              },
              superTypes: [AbstractType.$type]
            },
            Keyword: {
              name: Keyword2.$type,
              properties: {
                cardinality: {
                  name: Keyword2.cardinality
                },
                predicate: {
                  name: Keyword2.predicate
                },
                value: {
                  name: Keyword2.value
                }
              },
              superTypes: [AbstractElement.$type]
            },
            NamedArgument: {
              name: NamedArgument.$type,
              properties: {
                calledByName: {
                  name: NamedArgument.calledByName,
                  defaultValue: false
                },
                parameter: {
                  name: NamedArgument.parameter,
                  referenceType: Parameter.$type
                },
                value: {
                  name: NamedArgument.value
                }
              },
              superTypes: []
            },
            NegatedToken: {
              name: NegatedToken.$type,
              properties: {
                cardinality: {
                  name: NegatedToken.cardinality
                },
                lookahead: {
                  name: NegatedToken.lookahead
                },
                parenthesized: {
                  name: NegatedToken.parenthesized,
                  defaultValue: false
                },
                terminal: {
                  name: NegatedToken.terminal
                }
              },
              superTypes: [TerminalElement.$type]
            },
            Negation: {
              name: Negation.$type,
              properties: {
                value: {
                  name: Negation.value
                }
              },
              superTypes: [Condition.$type]
            },
            NumberLiteral: {
              name: NumberLiteral.$type,
              properties: {
                value: {
                  name: NumberLiteral.value
                }
              },
              superTypes: [ValueLiteral.$type]
            },
            Parameter: {
              name: Parameter.$type,
              properties: {
                name: {
                  name: Parameter.name
                }
              },
              superTypes: []
            },
            ParameterReference: {
              name: ParameterReference.$type,
              properties: {
                parameter: {
                  name: ParameterReference.parameter,
                  referenceType: Parameter.$type
                }
              },
              superTypes: [Condition.$type]
            },
            ParserRule: {
              name: ParserRule.$type,
              properties: {
                dataType: {
                  name: ParserRule.dataType
                },
                definition: {
                  name: ParserRule.definition
                },
                entry: {
                  name: ParserRule.entry,
                  defaultValue: false
                },
                fragment: {
                  name: ParserRule.fragment,
                  defaultValue: false
                },
                inferredType: {
                  name: ParserRule.inferredType
                },
                name: {
                  name: ParserRule.name
                },
                parameters: {
                  name: ParserRule.parameters,
                  defaultValue: []
                },
                returnType: {
                  name: ParserRule.returnType,
                  referenceType: AbstractType.$type
                }
              },
              superTypes: [AbstractParserRule.$type]
            },
            ReferenceType: {
              name: ReferenceType.$type,
              properties: {
                isMulti: {
                  name: ReferenceType.isMulti,
                  defaultValue: false
                },
                referenceType: {
                  name: ReferenceType.referenceType
                }
              },
              superTypes: [TypeDefinition.$type]
            },
            RegexToken: {
              name: RegexToken.$type,
              properties: {
                cardinality: {
                  name: RegexToken.cardinality
                },
                lookahead: {
                  name: RegexToken.lookahead
                },
                parenthesized: {
                  name: RegexToken.parenthesized,
                  defaultValue: false
                },
                regex: {
                  name: RegexToken.regex
                }
              },
              superTypes: [TerminalElement.$type]
            },
            ReturnType: {
              name: ReturnType.$type,
              properties: {
                name: {
                  name: ReturnType.name
                }
              },
              superTypes: []
            },
            RuleCall: {
              name: RuleCall.$type,
              properties: {
                arguments: {
                  name: RuleCall.arguments,
                  defaultValue: []
                },
                cardinality: {
                  name: RuleCall.cardinality
                },
                predicate: {
                  name: RuleCall.predicate
                },
                rule: {
                  name: RuleCall.rule,
                  referenceType: AbstractRule.$type
                }
              },
              superTypes: [AbstractElement.$type]
            },
            SimpleType: {
              name: SimpleType.$type,
              properties: {
                primitiveType: {
                  name: SimpleType.primitiveType
                },
                stringType: {
                  name: SimpleType.stringType
                },
                typeRef: {
                  name: SimpleType.typeRef,
                  referenceType: AbstractType.$type
                }
              },
              superTypes: [TypeDefinition.$type]
            },
            StringLiteral: {
              name: StringLiteral.$type,
              properties: {
                value: {
                  name: StringLiteral.value
                }
              },
              superTypes: [ValueLiteral.$type]
            },
            TerminalAlternatives: {
              name: TerminalAlternatives.$type,
              properties: {
                cardinality: {
                  name: TerminalAlternatives.cardinality
                },
                elements: {
                  name: TerminalAlternatives.elements,
                  defaultValue: []
                },
                lookahead: {
                  name: TerminalAlternatives.lookahead
                },
                parenthesized: {
                  name: TerminalAlternatives.parenthesized,
                  defaultValue: false
                }
              },
              superTypes: [TerminalElement.$type]
            },
            TerminalElement: {
              name: TerminalElement.$type,
              properties: {
                cardinality: {
                  name: TerminalElement.cardinality
                },
                lookahead: {
                  name: TerminalElement.lookahead
                },
                parenthesized: {
                  name: TerminalElement.parenthesized,
                  defaultValue: false
                }
              },
              superTypes: [AbstractElement.$type]
            },
            TerminalGroup: {
              name: TerminalGroup.$type,
              properties: {
                cardinality: {
                  name: TerminalGroup.cardinality
                },
                elements: {
                  name: TerminalGroup.elements,
                  defaultValue: []
                },
                lookahead: {
                  name: TerminalGroup.lookahead
                },
                parenthesized: {
                  name: TerminalGroup.parenthesized,
                  defaultValue: false
                }
              },
              superTypes: [TerminalElement.$type]
            },
            TerminalRule: {
              name: TerminalRule.$type,
              properties: {
                definition: {
                  name: TerminalRule.definition
                },
                fragment: {
                  name: TerminalRule.fragment,
                  defaultValue: false
                },
                hidden: {
                  name: TerminalRule.hidden,
                  defaultValue: false
                },
                name: {
                  name: TerminalRule.name
                },
                type: {
                  name: TerminalRule.type
                }
              },
              superTypes: [AbstractRule.$type]
            },
            TerminalRuleCall: {
              name: TerminalRuleCall.$type,
              properties: {
                cardinality: {
                  name: TerminalRuleCall.cardinality
                },
                lookahead: {
                  name: TerminalRuleCall.lookahead
                },
                parenthesized: {
                  name: TerminalRuleCall.parenthesized,
                  defaultValue: false
                },
                rule: {
                  name: TerminalRuleCall.rule,
                  referenceType: TerminalRule.$type
                }
              },
              superTypes: [TerminalElement.$type]
            },
            Type: {
              name: Type3.$type,
              properties: {
                name: {
                  name: Type3.name
                },
                type: {
                  name: Type3.type
                }
              },
              superTypes: [AbstractType.$type]
            },
            TypeAttribute: {
              name: TypeAttribute.$type,
              properties: {
                defaultValue: {
                  name: TypeAttribute.defaultValue
                },
                isOptional: {
                  name: TypeAttribute.isOptional,
                  defaultValue: false
                },
                name: {
                  name: TypeAttribute.name
                },
                type: {
                  name: TypeAttribute.type
                }
              },
              superTypes: []
            },
            TypeDefinition: {
              name: TypeDefinition.$type,
              properties: {},
              superTypes: []
            },
            UnionType: {
              name: UnionType.$type,
              properties: {
                types: {
                  name: UnionType.types,
                  defaultValue: []
                }
              },
              superTypes: [TypeDefinition.$type]
            },
            UnorderedGroup: {
              name: UnorderedGroup.$type,
              properties: {
                cardinality: {
                  name: UnorderedGroup.cardinality
                },
                elements: {
                  name: UnorderedGroup.elements,
                  defaultValue: []
                }
              },
              superTypes: [AbstractElement.$type]
            },
            UntilToken: {
              name: UntilToken.$type,
              properties: {
                cardinality: {
                  name: UntilToken.cardinality
                },
                lookahead: {
                  name: UntilToken.lookahead
                },
                parenthesized: {
                  name: UntilToken.parenthesized,
                  defaultValue: false
                },
                terminal: {
                  name: UntilToken.terminal
                }
              },
              superTypes: [TerminalElement.$type]
            },
            ValueLiteral: {
              name: ValueLiteral.$type,
              properties: {},
              superTypes: []
            },
            Wildcard: {
              name: Wildcard.$type,
              properties: {
                cardinality: {
                  name: Wildcard.cardinality
                },
                lookahead: {
                  name: Wildcard.lookahead
                },
                parenthesized: {
                  name: Wildcard.parenthesized,
                  defaultValue: false
                }
              },
              superTypes: [TerminalElement.$type]
            }
          };
        }
      };
      reflection = new LangiumGrammarAstReflection();
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/cst-utils.js
  var cst_utils_exports = {};
  __export(cst_utils_exports, {
    DefaultNameRegexp: () => DefaultNameRegexp,
    RangeComparison: () => RangeComparison,
    compareRange: () => compareRange,
    findCommentNode: () => findCommentNode,
    findDeclarationNodeAtOffset: () => findDeclarationNodeAtOffset,
    findLeafNodeAtOffset: () => findLeafNodeAtOffset,
    findLeafNodeBeforeOffset: () => findLeafNodeBeforeOffset,
    flattenCst: () => flattenCst,
    getDatatypeNode: () => getDatatypeNode,
    getInteriorNodes: () => getInteriorNodes,
    getNextNode: () => getNextNode,
    getPreviousNode: () => getPreviousNode,
    getStartlineNode: () => getStartlineNode,
    inRange: () => inRange,
    isChildNode: () => isChildNode,
    isCommentNode: () => isCommentNode,
    streamCst: () => streamCst,
    toDocumentSegment: () => toDocumentSegment,
    tokenToRange: () => tokenToRange
  });
  function getDatatypeNode(cstNode) {
    let current = cstNode;
    let found = false;
    while (current) {
      const definingRule = getContainerOfType(current.grammarSource, isParserRule);
      if (definingRule && definingRule.dataType) {
        current = current.container;
        found = true;
      } else if (found) {
        return current;
      } else {
        return void 0;
      }
    }
    return void 0;
  }
  function streamCst(node2) {
    return new TreeStreamImpl(node2, (element3) => {
      if (isCompositeCstNode(element3)) {
        return element3.content;
      } else {
        return [];
      }
    }, { includeRoot: true });
  }
  function flattenCst(node2) {
    return streamCst(node2).filter(isLeafCstNode);
  }
  function isChildNode(child, parent4) {
    while (child.container) {
      child = child.container;
      if (child === parent4) {
        return true;
      }
    }
    return false;
  }
  function tokenToRange(token2) {
    return {
      start: {
        character: token2.startColumn - 1,
        line: token2.startLine - 1
      },
      end: {
        character: token2.endColumn,
        // endColumn uses the correct index
        line: token2.endLine - 1
      }
    };
  }
  function toDocumentSegment(node2) {
    if (!node2) {
      return void 0;
    }
    const { offset, end: end2, range: range3 } = node2;
    return {
      range: range3,
      offset,
      end: end2,
      length: end2 - offset
    };
  }
  function compareRange(range3, to) {
    if (range3.end.line < to.start.line || range3.end.line === to.start.line && range3.end.character <= to.start.character) {
      return RangeComparison.Before;
    } else if (range3.start.line > to.end.line || range3.start.line === to.end.line && range3.start.character >= to.end.character) {
      return RangeComparison.After;
    }
    const startInside = range3.start.line > to.start.line || range3.start.line === to.start.line && range3.start.character >= to.start.character;
    const endInside = range3.end.line < to.end.line || range3.end.line === to.end.line && range3.end.character <= to.end.character;
    if (startInside && endInside) {
      return RangeComparison.Inside;
    } else if (startInside) {
      return RangeComparison.OverlapBack;
    } else if (endInside) {
      return RangeComparison.OverlapFront;
    } else {
      return RangeComparison.Outside;
    }
  }
  function inRange(range3, to) {
    const comparison = compareRange(range3, to);
    return comparison > RangeComparison.After;
  }
  function findDeclarationNodeAtOffset(cstNode, offset, nameRegexp = DefaultNameRegexp) {
    if (cstNode) {
      if (offset > 0) {
        const localOffset = offset - cstNode.offset;
        const textAtOffset = cstNode.text.charAt(localOffset);
        if (!nameRegexp.test(textAtOffset)) {
          offset--;
        }
      }
      return findLeafNodeAtOffset(cstNode, offset);
    }
    return void 0;
  }
  function findCommentNode(cstNode, commentNames) {
    if (cstNode) {
      const previous = getPreviousNode(cstNode, true);
      if (previous && isCommentNode(previous, commentNames)) {
        return previous;
      }
      if (isRootCstNode(cstNode)) {
        const endIndex = cstNode.content.findIndex((e3) => !e3.hidden);
        for (let i2 = endIndex - 1; i2 >= 0; i2--) {
          const child = cstNode.content[i2];
          if (isCommentNode(child, commentNames)) {
            return child;
          }
        }
      }
    }
    return void 0;
  }
  function isCommentNode(cstNode, commentNames) {
    return isLeafCstNode(cstNode) && commentNames.includes(cstNode.tokenType.name);
  }
  function findLeafNodeAtOffset(node2, offset) {
    if (isLeafCstNode(node2)) {
      return node2;
    } else if (isCompositeCstNode(node2)) {
      const searchResult = binarySearch(node2, offset, false);
      if (searchResult) {
        return findLeafNodeAtOffset(searchResult, offset);
      }
    }
    return void 0;
  }
  function findLeafNodeBeforeOffset(node2, offset) {
    if (isLeafCstNode(node2)) {
      return node2;
    } else if (isCompositeCstNode(node2)) {
      const searchResult = binarySearch(node2, offset, true);
      if (searchResult) {
        return findLeafNodeBeforeOffset(searchResult, offset);
      }
    }
    return void 0;
  }
  function binarySearch(node2, offset, closest) {
    let left3 = 0;
    let right3 = node2.content.length - 1;
    let closestNode = void 0;
    while (left3 <= right3) {
      const middle = Math.floor((left3 + right3) / 2);
      const middleNode = node2.content[middle];
      if (middleNode.offset <= offset && middleNode.end > offset) {
        return middleNode;
      }
      if (middleNode.end <= offset) {
        closestNode = closest ? middleNode : void 0;
        left3 = middle + 1;
      } else {
        right3 = middle - 1;
      }
    }
    return closestNode;
  }
  function getPreviousNode(node2, hidden = true) {
    while (node2.container) {
      const parent4 = node2.container;
      let index = parent4.content.indexOf(node2);
      while (index > 0) {
        index--;
        const previous = parent4.content[index];
        if (hidden || !previous.hidden) {
          return previous;
        }
      }
      node2 = parent4;
    }
    return void 0;
  }
  function getNextNode(node2, hidden = true) {
    while (node2.container) {
      const parent4 = node2.container;
      let index = parent4.content.indexOf(node2);
      const last3 = parent4.content.length - 1;
      while (index < last3) {
        index++;
        const next3 = parent4.content[index];
        if (hidden || !next3.hidden) {
          return next3;
        }
      }
      node2 = parent4;
    }
    return void 0;
  }
  function getStartlineNode(node2) {
    if (node2.range.start.character === 0) {
      return node2;
    }
    const line2 = node2.range.start.line;
    let last3 = node2;
    let index;
    while (node2.container) {
      const parent4 = node2.container;
      const selfIndex = index ?? parent4.content.indexOf(node2);
      if (selfIndex === 0) {
        node2 = parent4;
        index = void 0;
      } else {
        index = selfIndex - 1;
        node2 = parent4.content[index];
      }
      if (node2.range.start.line !== line2) {
        break;
      }
      last3 = node2;
    }
    return last3;
  }
  function getInteriorNodes(start3, end2) {
    const commonParent = getCommonParent(start3, end2);
    if (!commonParent) {
      return [];
    }
    return commonParent.parent.content.slice(commonParent.a + 1, commonParent.b);
  }
  function getCommonParent(a2, b3) {
    const aParents = getParentChain(a2);
    const bParents = getParentChain(b3);
    let current;
    for (let i2 = 0; i2 < aParents.length && i2 < bParents.length; i2++) {
      const aParent = aParents[i2];
      const bParent = bParents[i2];
      if (aParent.parent === bParent.parent) {
        current = {
          parent: aParent.parent,
          a: aParent.index,
          b: bParent.index
        };
      } else {
        break;
      }
    }
    return current;
  }
  function getParentChain(node2) {
    const chain = [];
    while (node2.container) {
      const parent4 = node2.container;
      const index = parent4.content.indexOf(node2);
      chain.push({
        parent: parent4,
        index
      });
      node2 = parent4;
    }
    return chain.reverse();
  }
  var RangeComparison, DefaultNameRegexp;
  var init_cst_utils = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/cst-utils.js"() {
      "use strict";
      init_syntax_tree();
      init_stream();
      init_ast_utils();
      init_ast();
      __name(getDatatypeNode, "getDatatypeNode");
      __name(streamCst, "streamCst");
      __name(flattenCst, "flattenCst");
      __name(isChildNode, "isChildNode");
      __name(tokenToRange, "tokenToRange");
      __name(toDocumentSegment, "toDocumentSegment");
      (function(RangeComparison2) {
        RangeComparison2[RangeComparison2["Before"] = 0] = "Before";
        RangeComparison2[RangeComparison2["After"] = 1] = "After";
        RangeComparison2[RangeComparison2["OverlapFront"] = 2] = "OverlapFront";
        RangeComparison2[RangeComparison2["OverlapBack"] = 3] = "OverlapBack";
        RangeComparison2[RangeComparison2["Inside"] = 4] = "Inside";
        RangeComparison2[RangeComparison2["Outside"] = 5] = "Outside";
      })(RangeComparison || (RangeComparison = {}));
      __name(compareRange, "compareRange");
      __name(inRange, "inRange");
      DefaultNameRegexp = /^[\w\p{L}]$/u;
      __name(findDeclarationNodeAtOffset, "findDeclarationNodeAtOffset");
      __name(findCommentNode, "findCommentNode");
      __name(isCommentNode, "isCommentNode");
      __name(findLeafNodeAtOffset, "findLeafNodeAtOffset");
      __name(findLeafNodeBeforeOffset, "findLeafNodeBeforeOffset");
      __name(binarySearch, "binarySearch");
      __name(getPreviousNode, "getPreviousNode");
      __name(getNextNode, "getNextNode");
      __name(getStartlineNode, "getStartlineNode");
      __name(getInteriorNodes, "getInteriorNodes");
      __name(getCommonParent, "getCommonParent");
      __name(getParentChain, "getParentChain");
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/errors.js
  function assertUnreachable(_3, message = "Error: Got unexpected value.") {
    throw new Error(message);
  }
  function assertCondition(condition, message = "Error: Condition is violated.") {
    if (!condition) {
      throw new Error(message);
    }
  }
  var ErrorWithLocation;
  var init_errors2 = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/errors.js"() {
      "use strict";
      ErrorWithLocation = class extends Error {
        static {
          __name(this, "ErrorWithLocation");
        }
        constructor(node2, message) {
          super(node2 ? `${message} at ${node2.range.start.line}:${node2.range.start.character}` : message);
        }
      };
      __name(assertUnreachable, "assertUnreachable");
      __name(assertCondition, "assertCondition");
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.1/node_modules/@chevrotain/regexp-to-ast/lib/src/utils.js
  function cc(char2) {
    return char2.charCodeAt(0);
  }
  function insertToSet(item, set5) {
    if (Array.isArray(item)) {
      item.forEach(function(subItem) {
        set5.push(subItem);
      });
    } else {
      set5.push(item);
    }
  }
  function addFlag(flagObj, flagKey) {
    if (flagObj[flagKey] === true) {
      throw "duplicate flag " + flagKey;
    }
    const x5 = flagObj[flagKey];
    flagObj[flagKey] = true;
  }
  function ASSERT_EXISTS(obj) {
    if (obj === void 0) {
      throw Error("Internal Error - Should never get here!");
    }
    return true;
  }
  function ASSERT_NEVER_REACH_HERE() {
    throw Error("Internal Error - Should never get here!");
  }
  function isCharacter(obj) {
    return obj["type"] === "Character";
  }
  var init_utils3 = __esm({
    "../../node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.1/node_modules/@chevrotain/regexp-to-ast/lib/src/utils.js"() {
      "use strict";
      __name(cc, "cc");
      __name(insertToSet, "insertToSet");
      __name(addFlag, "addFlag");
      __name(ASSERT_EXISTS, "ASSERT_EXISTS");
      __name(ASSERT_NEVER_REACH_HERE, "ASSERT_NEVER_REACH_HERE");
      __name(isCharacter, "isCharacter");
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.1/node_modules/@chevrotain/regexp-to-ast/lib/src/character-classes.js
  var digitsCharCodes, wordCharCodes, whitespaceCodes;
  var init_character_classes = __esm({
    "../../node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.1/node_modules/@chevrotain/regexp-to-ast/lib/src/character-classes.js"() {
      "use strict";
      init_utils3();
      digitsCharCodes = [];
      for (let i2 = cc("0"); i2 <= cc("9"); i2++) {
        digitsCharCodes.push(i2);
      }
      wordCharCodes = [cc("_")].concat(digitsCharCodes);
      for (let i2 = cc("a"); i2 <= cc("z"); i2++) {
        wordCharCodes.push(i2);
      }
      for (let i2 = cc("A"); i2 <= cc("Z"); i2++) {
        wordCharCodes.push(i2);
      }
      whitespaceCodes = [
        cc(" "),
        cc("\f"),
        cc("\n"),
        cc("\r"),
        cc("	"),
        cc("\v"),
        cc("	"),
        cc("\xA0"),
        cc("\u1680"),
        cc("\u2000"),
        cc("\u2001"),
        cc("\u2002"),
        cc("\u2003"),
        cc("\u2004"),
        cc("\u2005"),
        cc("\u2006"),
        cc("\u2007"),
        cc("\u2008"),
        cc("\u2009"),
        cc("\u200A"),
        cc("\u2028"),
        cc("\u2029"),
        cc("\u202F"),
        cc("\u205F"),
        cc("\u3000"),
        cc("\uFEFF")
      ];
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.1/node_modules/@chevrotain/regexp-to-ast/lib/src/regexp-parser.js
  var hexDigitPattern, decimalPattern, decimalPatternNoZero, RegExpParser;
  var init_regexp_parser = __esm({
    "../../node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.1/node_modules/@chevrotain/regexp-to-ast/lib/src/regexp-parser.js"() {
      "use strict";
      init_utils3();
      init_character_classes();
      hexDigitPattern = /[0-9a-fA-F]/;
      decimalPattern = /[0-9]/;
      decimalPatternNoZero = /[1-9]/;
      RegExpParser = class {
        static {
          __name(this, "RegExpParser");
        }
        constructor() {
          this.idx = 0;
          this.input = "";
          this.groupIdx = 0;
        }
        saveState() {
          return {
            idx: this.idx,
            input: this.input,
            groupIdx: this.groupIdx
          };
        }
        restoreState(newState2) {
          this.idx = newState2.idx;
          this.input = newState2.input;
          this.groupIdx = newState2.groupIdx;
        }
        pattern(input) {
          this.idx = 0;
          this.input = input;
          this.groupIdx = 0;
          this.consumeChar("/");
          const value2 = this.disjunction();
          this.consumeChar("/");
          const flags = {
            type: "Flags",
            loc: { begin: this.idx, end: input.length },
            global: false,
            ignoreCase: false,
            multiLine: false,
            unicode: false,
            sticky: false
          };
          while (this.isRegExpFlag()) {
            switch (this.popChar()) {
              case "g":
                addFlag(flags, "global");
                break;
              case "i":
                addFlag(flags, "ignoreCase");
                break;
              case "m":
                addFlag(flags, "multiLine");
                break;
              case "u":
                addFlag(flags, "unicode");
                break;
              case "y":
                addFlag(flags, "sticky");
                break;
            }
          }
          if (this.idx !== this.input.length) {
            throw Error("Redundant input: " + this.input.substring(this.idx));
          }
          return {
            type: "Pattern",
            flags,
            value: value2,
            loc: this.loc(0)
          };
        }
        disjunction() {
          const alts = [];
          const begin = this.idx;
          alts.push(this.alternative());
          while (this.peekChar() === "|") {
            this.consumeChar("|");
            alts.push(this.alternative());
          }
          return { type: "Disjunction", value: alts, loc: this.loc(begin) };
        }
        alternative() {
          const terms = [];
          const begin = this.idx;
          while (this.isTerm()) {
            terms.push(this.term());
          }
          return { type: "Alternative", value: terms, loc: this.loc(begin) };
        }
        term() {
          if (this.isAssertion()) {
            return this.assertion();
          } else {
            return this.atom();
          }
        }
        assertion() {
          const begin = this.idx;
          switch (this.popChar()) {
            case "^":
              return {
                type: "StartAnchor",
                loc: this.loc(begin)
              };
            case "$":
              return { type: "EndAnchor", loc: this.loc(begin) };
            // '\b' or '\B'
            case "\\":
              switch (this.popChar()) {
                case "b":
                  return {
                    type: "WordBoundary",
                    loc: this.loc(begin)
                  };
                case "B":
                  return {
                    type: "NonWordBoundary",
                    loc: this.loc(begin)
                  };
              }
              throw Error("Invalid Assertion Escape");
            // '(?=' or '(?!'
            case "(":
              this.consumeChar("?");
              let type3;
              switch (this.popChar()) {
                case "=":
                  type3 = "Lookahead";
                  break;
                case "!":
                  type3 = "NegativeLookahead";
                  break;
                case "<": {
                  switch (this.popChar()) {
                    case "=":
                      type3 = "Lookbehind";
                      break;
                    case "!":
                      type3 = "NegativeLookbehind";
                  }
                  break;
                }
              }
              ASSERT_EXISTS(type3);
              const disjunction = this.disjunction();
              this.consumeChar(")");
              return {
                type: type3,
                value: disjunction,
                loc: this.loc(begin)
              };
          }
          return ASSERT_NEVER_REACH_HERE();
        }
        quantifier(isBacktracking = false) {
          let range3 = void 0;
          const begin = this.idx;
          switch (this.popChar()) {
            case "*":
              range3 = {
                atLeast: 0,
                atMost: Infinity
              };
              break;
            case "+":
              range3 = {
                atLeast: 1,
                atMost: Infinity
              };
              break;
            case "?":
              range3 = {
                atLeast: 0,
                atMost: 1
              };
              break;
            case "{":
              const atLeast = this.integerIncludingZero();
              switch (this.popChar()) {
                case "}":
                  range3 = {
                    atLeast,
                    atMost: atLeast
                  };
                  break;
                case ",":
                  let atMost;
                  if (this.isDigit()) {
                    atMost = this.integerIncludingZero();
                    range3 = {
                      atLeast,
                      atMost
                    };
                  } else {
                    range3 = {
                      atLeast,
                      atMost: Infinity
                    };
                  }
                  this.consumeChar("}");
                  break;
              }
              if (isBacktracking === true && range3 === void 0) {
                return void 0;
              }
              ASSERT_EXISTS(range3);
              break;
          }
          if (isBacktracking === true && range3 === void 0) {
            return void 0;
          }
          if (ASSERT_EXISTS(range3)) {
            if (this.peekChar(0) === "?") {
              this.consumeChar("?");
              range3.greedy = false;
            } else {
              range3.greedy = true;
            }
            range3.type = "Quantifier";
            range3.loc = this.loc(begin);
            return range3;
          }
        }
        atom() {
          let atom2;
          const begin = this.idx;
          switch (this.peekChar()) {
            case ".":
              atom2 = this.dotAll();
              break;
            case "\\":
              atom2 = this.atomEscape();
              break;
            case "[":
              atom2 = this.characterClass();
              break;
            case "(":
              atom2 = this.group();
              break;
          }
          if (atom2 === void 0 && this.isPatternCharacter()) {
            atom2 = this.patternCharacter();
          }
          if (ASSERT_EXISTS(atom2)) {
            atom2.loc = this.loc(begin);
            if (this.isQuantifier()) {
              atom2.quantifier = this.quantifier();
            }
            return atom2;
          }
          return ASSERT_NEVER_REACH_HERE();
        }
        dotAll() {
          this.consumeChar(".");
          return {
            type: "Set",
            complement: true,
            value: [cc("\n"), cc("\r"), cc("\u2028"), cc("\u2029")]
          };
        }
        atomEscape() {
          this.consumeChar("\\");
          switch (this.peekChar()) {
            case "1":
            case "2":
            case "3":
            case "4":
            case "5":
            case "6":
            case "7":
            case "8":
            case "9":
              return this.decimalEscapeAtom();
            case "d":
            case "D":
            case "s":
            case "S":
            case "w":
            case "W":
              return this.characterClassEscape();
            case "f":
            case "n":
            case "r":
            case "t":
            case "v":
              return this.controlEscapeAtom();
            case "c":
              return this.controlLetterEscapeAtom();
            case "0":
              return this.nulCharacterAtom();
            case "x":
              return this.hexEscapeSequenceAtom();
            case "u":
              return this.regExpUnicodeEscapeSequenceAtom();
            default:
              return this.identityEscapeAtom();
          }
        }
        decimalEscapeAtom() {
          const value2 = this.positiveInteger();
          return { type: "GroupBackReference", value: value2 };
        }
        characterClassEscape() {
          let set5;
          let complement = false;
          switch (this.popChar()) {
            case "d":
              set5 = digitsCharCodes;
              break;
            case "D":
              set5 = digitsCharCodes;
              complement = true;
              break;
            case "s":
              set5 = whitespaceCodes;
              break;
            case "S":
              set5 = whitespaceCodes;
              complement = true;
              break;
            case "w":
              set5 = wordCharCodes;
              break;
            case "W":
              set5 = wordCharCodes;
              complement = true;
              break;
          }
          if (ASSERT_EXISTS(set5)) {
            return { type: "Set", value: set5, complement };
          }
          return ASSERT_NEVER_REACH_HERE();
        }
        controlEscapeAtom() {
          let escapeCode;
          switch (this.popChar()) {
            case "f":
              escapeCode = cc("\f");
              break;
            case "n":
              escapeCode = cc("\n");
              break;
            case "r":
              escapeCode = cc("\r");
              break;
            case "t":
              escapeCode = cc("	");
              break;
            case "v":
              escapeCode = cc("\v");
              break;
          }
          if (ASSERT_EXISTS(escapeCode)) {
            return { type: "Character", value: escapeCode };
          }
          return ASSERT_NEVER_REACH_HERE();
        }
        controlLetterEscapeAtom() {
          this.consumeChar("c");
          const letter = this.popChar();
          if (/[a-zA-Z]/.test(letter) === false) {
            throw Error("Invalid ");
          }
          const letterCode = letter.toUpperCase().charCodeAt(0) - 64;
          return { type: "Character", value: letterCode };
        }
        nulCharacterAtom() {
          this.consumeChar("0");
          return { type: "Character", value: cc("\0") };
        }
        hexEscapeSequenceAtom() {
          this.consumeChar("x");
          return this.parseHexDigits(2);
        }
        regExpUnicodeEscapeSequenceAtom() {
          this.consumeChar("u");
          return this.parseHexDigits(4);
        }
        identityEscapeAtom() {
          const escapedChar = this.popChar();
          return { type: "Character", value: cc(escapedChar) };
        }
        classPatternCharacterAtom() {
          switch (this.peekChar()) {
            // istanbul ignore next
            case "\n":
            // istanbul ignore next
            case "\r":
            // istanbul ignore next
            case "\u2028":
            // istanbul ignore next
            case "\u2029":
            // istanbul ignore next
            case "\\":
            // istanbul ignore next
            case "]":
              throw Error("TBD");
            default:
              const nextChar = this.popChar();
              return { type: "Character", value: cc(nextChar) };
          }
        }
        characterClass() {
          const set5 = [];
          let complement = false;
          this.consumeChar("[");
          if (this.peekChar(0) === "^") {
            this.consumeChar("^");
            complement = true;
          }
          while (this.isClassAtom()) {
            const from2 = this.classAtom();
            const isFromSingleChar = from2.type === "Character";
            if (isCharacter(from2) && this.isRangeDash()) {
              this.consumeChar("-");
              const to = this.classAtom();
              const isToSingleChar = to.type === "Character";
              if (isCharacter(to)) {
                if (to.value < from2.value) {
                  throw Error("Range out of order in character class");
                }
                set5.push({ from: from2.value, to: to.value });
              } else {
                insertToSet(from2.value, set5);
                set5.push(cc("-"));
                insertToSet(to.value, set5);
              }
            } else {
              insertToSet(from2.value, set5);
            }
          }
          this.consumeChar("]");
          return { type: "Set", complement, value: set5 };
        }
        classAtom() {
          switch (this.peekChar()) {
            // istanbul ignore next
            case "]":
            // istanbul ignore next
            case "\n":
            // istanbul ignore next
            case "\r":
            // istanbul ignore next
            case "\u2028":
            // istanbul ignore next
            case "\u2029":
              throw Error("TBD");
            case "\\":
              return this.classEscape();
            default:
              return this.classPatternCharacterAtom();
          }
        }
        classEscape() {
          this.consumeChar("\\");
          switch (this.peekChar()) {
            // Matches a backspace.
            // (Not to be confused with \b word boundary outside characterClass)
            case "b":
              this.consumeChar("b");
              return { type: "Character", value: cc("\b") };
            case "d":
            case "D":
            case "s":
            case "S":
            case "w":
            case "W":
              return this.characterClassEscape();
            case "f":
            case "n":
            case "r":
            case "t":
            case "v":
              return this.controlEscapeAtom();
            case "c":
              return this.controlLetterEscapeAtom();
            case "0":
              return this.nulCharacterAtom();
            case "x":
              return this.hexEscapeSequenceAtom();
            case "u":
              return this.regExpUnicodeEscapeSequenceAtom();
            default:
              return this.identityEscapeAtom();
          }
        }
        group() {
          let capturing = true;
          this.consumeChar("(");
          switch (this.peekChar(0)) {
            case "?":
              this.consumeChar("?");
              this.consumeChar(":");
              capturing = false;
              break;
            default:
              this.groupIdx++;
              break;
          }
          const value2 = this.disjunction();
          this.consumeChar(")");
          const groupAst = {
            type: "Group",
            capturing,
            value: value2
          };
          if (capturing) {
            groupAst["idx"] = this.groupIdx;
          }
          return groupAst;
        }
        positiveInteger() {
          let number7 = this.popChar();
          if (decimalPatternNoZero.test(number7) === false) {
            throw Error("Expecting a positive integer");
          }
          while (decimalPattern.test(this.peekChar(0))) {
            number7 += this.popChar();
          }
          return parseInt(number7, 10);
        }
        integerIncludingZero() {
          let number7 = this.popChar();
          if (decimalPattern.test(number7) === false) {
            throw Error("Expecting an integer");
          }
          while (decimalPattern.test(this.peekChar(0))) {
            number7 += this.popChar();
          }
          return parseInt(number7, 10);
        }
        patternCharacter() {
          const nextChar = this.popChar();
          switch (nextChar) {
            // istanbul ignore next
            case "\n":
            // istanbul ignore next
            case "\r":
            // istanbul ignore next
            case "\u2028":
            // istanbul ignore next
            case "\u2029":
            // istanbul ignore next
            case "^":
            // istanbul ignore next
            case "$":
            // istanbul ignore next
            case "\\":
            // istanbul ignore next
            case ".":
            // istanbul ignore next
            case "*":
            // istanbul ignore next
            case "+":
            // istanbul ignore next
            case "?":
            // istanbul ignore next
            case "(":
            // istanbul ignore next
            case ")":
            // istanbul ignore next
            case "[":
            // istanbul ignore next
            case "|":
              throw Error("TBD");
            default:
              return { type: "Character", value: cc(nextChar) };
          }
        }
        isRegExpFlag() {
          switch (this.peekChar(0)) {
            case "g":
            case "i":
            case "m":
            case "u":
            case "y":
              return true;
            default:
              return false;
          }
        }
        isRangeDash() {
          return this.peekChar() === "-" && this.isClassAtom(1);
        }
        isDigit() {
          return decimalPattern.test(this.peekChar(0));
        }
        isClassAtom(howMuch = 0) {
          switch (this.peekChar(howMuch)) {
            case "]":
            case "\n":
            case "\r":
            case "\u2028":
            case "\u2029":
              return false;
            default:
              return true;
          }
        }
        isTerm() {
          return this.isAtom() || this.isAssertion();
        }
        isAtom() {
          if (this.isPatternCharacter()) {
            return true;
          }
          switch (this.peekChar(0)) {
            case ".":
            case "\\":
            // atomEscape
            case "[":
            // characterClass
            // TODO: isAtom must be called before isAssertion - disambiguate
            case "(":
              return true;
            default:
              return false;
          }
        }
        isAssertion() {
          switch (this.peekChar(0)) {
            case "^":
            case "$":
              return true;
            // '\b' or '\B'
            case "\\":
              switch (this.peekChar(1)) {
                case "b":
                case "B":
                  return true;
                default:
                  return false;
              }
            // '(?=' or '(?!' or `(?<=` or `(?<!`
            case "(":
              return this.peekChar(1) === "?" && (this.peekChar(2) === "=" || this.peekChar(2) === "!" || this.peekChar(2) === "<" && (this.peekChar(3) === "=" || this.peekChar(3) === "!"));
            default:
              return false;
          }
        }
        isQuantifier() {
          const prevState = this.saveState();
          try {
            return this.quantifier(true) !== void 0;
          } catch (e3) {
            return false;
          } finally {
            this.restoreState(prevState);
          }
        }
        isPatternCharacter() {
          switch (this.peekChar()) {
            case "^":
            case "$":
            case "\\":
            case ".":
            case "*":
            case "+":
            case "?":
            case "(":
            case ")":
            case "[":
            case "|":
            case "/":
            case "\n":
            case "\r":
            case "\u2028":
            case "\u2029":
              return false;
            default:
              return true;
          }
        }
        parseHexDigits(howMany) {
          let hexString = "";
          for (let i2 = 0; i2 < howMany; i2++) {
            const hexChar = this.popChar();
            if (hexDigitPattern.test(hexChar) === false) {
              throw Error("Expecting a HexDecimal digits");
            }
            hexString += hexChar;
          }
          const charCode = parseInt(hexString, 16);
          return { type: "Character", value: charCode };
        }
        peekChar(howMuch = 0) {
          return this.input[this.idx + howMuch];
        }
        popChar() {
          const nextChar = this.peekChar(0);
          this.consumeChar(void 0);
          return nextChar;
        }
        consumeChar(char2) {
          if (char2 !== void 0 && this.input[this.idx] !== char2) {
            throw Error("Expected: '" + char2 + "' but found: '" + this.input[this.idx] + "' at offset: " + this.idx);
          }
          if (this.idx >= this.input.length) {
            throw Error("Unexpected end of input");
          }
          this.idx++;
        }
        loc(begin) {
          return { begin, end: this.idx };
        }
      };
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.1/node_modules/@chevrotain/regexp-to-ast/lib/src/base-regexp-visitor.js
  var BaseRegExpVisitor;
  var init_base_regexp_visitor = __esm({
    "../../node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.1/node_modules/@chevrotain/regexp-to-ast/lib/src/base-regexp-visitor.js"() {
      "use strict";
      BaseRegExpVisitor = class {
        static {
          __name(this, "BaseRegExpVisitor");
        }
        visitChildren(node2) {
          for (const key in node2) {
            const child = node2[key];
            if (node2.hasOwnProperty(key)) {
              if (child.type !== void 0) {
                this.visit(child);
              } else if (Array.isArray(child)) {
                child.forEach((subChild) => {
                  this.visit(subChild);
                }, this);
              }
            }
          }
        }
        visit(node2) {
          switch (node2.type) {
            case "Pattern":
              this.visitPattern(node2);
              break;
            case "Flags":
              this.visitFlags(node2);
              break;
            case "Disjunction":
              this.visitDisjunction(node2);
              break;
            case "Alternative":
              this.visitAlternative(node2);
              break;
            case "StartAnchor":
              this.visitStartAnchor(node2);
              break;
            case "EndAnchor":
              this.visitEndAnchor(node2);
              break;
            case "WordBoundary":
              this.visitWordBoundary(node2);
              break;
            case "NonWordBoundary":
              this.visitNonWordBoundary(node2);
              break;
            case "Lookahead":
              this.visitLookahead(node2);
              break;
            case "NegativeLookahead":
              this.visitNegativeLookahead(node2);
              break;
            case "Lookbehind":
              this.visitLookbehind(node2);
              break;
            case "NegativeLookbehind":
              this.visitNegativeLookbehind(node2);
              break;
            case "Character":
              this.visitCharacter(node2);
              break;
            case "Set":
              this.visitSet(node2);
              break;
            case "Group":
              this.visitGroup(node2);
              break;
            case "GroupBackReference":
              this.visitGroupBackReference(node2);
              break;
            case "Quantifier":
              this.visitQuantifier(node2);
              break;
          }
          this.visitChildren(node2);
        }
        visitPattern(node2) {
        }
        visitFlags(node2) {
        }
        visitDisjunction(node2) {
        }
        visitAlternative(node2) {
        }
        // Assertion
        visitStartAnchor(node2) {
        }
        visitEndAnchor(node2) {
        }
        visitWordBoundary(node2) {
        }
        visitNonWordBoundary(node2) {
        }
        visitLookahead(node2) {
        }
        visitNegativeLookahead(node2) {
        }
        visitLookbehind(node2) {
        }
        visitNegativeLookbehind(node2) {
        }
        // atoms
        visitCharacter(node2) {
        }
        visitSet(node2) {
        }
        visitGroup(node2) {
        }
        visitGroupBackReference(node2) {
        }
        visitQuantifier(node2) {
        }
      };
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.1/node_modules/@chevrotain/regexp-to-ast/lib/src/api.js
  var init_api = __esm({
    "../../node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.1/node_modules/@chevrotain/regexp-to-ast/lib/src/api.js"() {
      "use strict";
      init_regexp_parser();
      init_base_regexp_visitor();
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/regexp-utils.js
  var regexp_utils_exports = {};
  __export(regexp_utils_exports, {
    NEWLINE_REGEXP: () => NEWLINE_REGEXP,
    escapeRegExp: () => escapeRegExp,
    getTerminalParts: () => getTerminalParts,
    isMultilineComment: () => isMultilineComment,
    isWhitespace: () => isWhitespace2,
    partialMatches: () => partialMatches,
    partialRegExp: () => partialRegExp,
    whitespaceCharacters: () => whitespaceCharacters
  });
  function getTerminalParts(regexp) {
    try {
      if (typeof regexp !== "string") {
        regexp = regexp.source;
      }
      regexp = `/${regexp}/`;
      const pattern = regexpParser.pattern(regexp);
      const parts = [];
      for (const alternative of pattern.value.value) {
        visitor.reset(regexp);
        visitor.visit(alternative);
        parts.push({
          start: visitor.startRegexp,
          end: visitor.endRegex
        });
      }
      return parts;
    } catch {
      return [];
    }
  }
  function isMultilineComment(regexp) {
    try {
      if (typeof regexp === "string") {
        regexp = new RegExp(regexp);
      }
      regexp = regexp.toString();
      visitor.reset(regexp);
      visitor.visit(regexpParser.pattern(regexp));
      return visitor.multiline;
    } catch {
      return false;
    }
  }
  function isWhitespace2(value2) {
    const regexp = typeof value2 === "string" ? new RegExp(value2) : value2;
    return whitespaceCharacters.some((ws) => regexp.test(ws));
  }
  function escapeRegExp(value2) {
    return value2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  }
  function partialMatches(regex2, input) {
    const partial = partialRegExp(regex2);
    const match2 = input.match(partial);
    return !!match2 && match2[0].length > 0;
  }
  function partialRegExp(regex2) {
    if (typeof regex2 === "string") {
      regex2 = new RegExp(regex2);
    }
    const re3 = regex2, source = regex2.source;
    let i2 = 0;
    function process2() {
      let result = "", tmp;
      function appendRaw(nbChars) {
        result += source.substr(i2, nbChars);
        i2 += nbChars;
      }
      __name(appendRaw, "appendRaw");
      function appendOptional(nbChars) {
        result += "(?:" + source.substr(i2, nbChars) + "|$)";
        i2 += nbChars;
      }
      __name(appendOptional, "appendOptional");
      while (i2 < source.length) {
        switch (source[i2]) {
          case "\\":
            switch (source[i2 + 1]) {
              case "c":
                appendOptional(3);
                break;
              case "x":
                appendOptional(4);
                break;
              case "u":
                if (re3.unicode) {
                  if (source[i2 + 2] === "{") {
                    appendOptional(source.indexOf("}", i2) - i2 + 1);
                  } else {
                    appendOptional(6);
                  }
                } else {
                  appendOptional(2);
                }
                break;
              case "p":
              case "P":
                if (re3.unicode) {
                  appendOptional(source.indexOf("}", i2) - i2 + 1);
                } else {
                  appendOptional(2);
                }
                break;
              case "k":
                appendOptional(source.indexOf(">", i2) - i2 + 1);
                break;
              default:
                appendOptional(2);
                break;
            }
            break;
          case "[":
            tmp = /\[(?:\\.|.)*?\]/g;
            tmp.lastIndex = i2;
            tmp = tmp.exec(source) || [];
            appendOptional(tmp[0].length);
            break;
          case "|":
          case "^":
          case "$":
          case "*":
          case "+":
          case "?":
            appendRaw(1);
            break;
          case "{":
            tmp = /\{\d+,?\d*\}/g;
            tmp.lastIndex = i2;
            tmp = tmp.exec(source);
            if (tmp) {
              appendRaw(tmp[0].length);
            } else {
              appendOptional(1);
            }
            break;
          case "(":
            if (source[i2 + 1] === "?") {
              switch (source[i2 + 2]) {
                case ":":
                  result += "(?:";
                  i2 += 3;
                  result += process2() + "|$)";
                  break;
                case "=":
                  result += "(?=";
                  i2 += 3;
                  result += process2() + ")";
                  break;
                case "!":
                  tmp = i2;
                  i2 += 3;
                  process2();
                  result += source.substr(tmp, i2 - tmp);
                  break;
                case "<":
                  switch (source[i2 + 3]) {
                    case "=":
                    case "!":
                      tmp = i2;
                      i2 += 4;
                      process2();
                      result += source.substr(tmp, i2 - tmp);
                      break;
                    default:
                      appendRaw(source.indexOf(">", i2) - i2 + 1);
                      result += process2() + "|$)";
                      break;
                  }
                  break;
              }
            } else {
              appendRaw(1);
              result += process2() + "|$)";
            }
            break;
          case ")":
            ++i2;
            return result;
          default:
            appendOptional(1);
            break;
        }
      }
      return result;
    }
    __name(process2, "process");
    return new RegExp(process2(), regex2.flags);
  }
  var NEWLINE_REGEXP, regexpParser, TerminalRegExpVisitor, visitor, whitespaceCharacters;
  var init_regexp_utils = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/regexp-utils.js"() {
      "use strict";
      init_api();
      NEWLINE_REGEXP = /\r?\n/gm;
      regexpParser = new RegExpParser();
      TerminalRegExpVisitor = class extends BaseRegExpVisitor {
        static {
          __name(this, "TerminalRegExpVisitor");
        }
        constructor() {
          super(...arguments);
          this.isStarting = true;
          this.endRegexpStack = [];
          this.multiline = false;
        }
        get endRegex() {
          return this.endRegexpStack.join("");
        }
        reset(regex2) {
          this.multiline = false;
          this.regex = regex2;
          this.startRegexp = "";
          this.isStarting = true;
          this.endRegexpStack = [];
        }
        visitGroup(node2) {
          if (node2.quantifier) {
            this.isStarting = false;
            this.endRegexpStack = [];
          }
        }
        visitCharacter(node2) {
          const char2 = String.fromCharCode(node2.value);
          if (!this.multiline && char2 === "\n") {
            this.multiline = true;
          }
          if (node2.quantifier) {
            this.isStarting = false;
            this.endRegexpStack = [];
          } else {
            const escapedChar = escapeRegExp(char2);
            this.endRegexpStack.push(escapedChar);
            if (this.isStarting) {
              this.startRegexp += escapedChar;
            }
          }
        }
        visitSet(node2) {
          if (!this.multiline) {
            const set5 = this.regex.substring(node2.loc.begin, node2.loc.end);
            const regex2 = new RegExp(set5);
            this.multiline = Boolean("\n".match(regex2));
          }
          if (node2.quantifier) {
            this.isStarting = false;
            this.endRegexpStack = [];
          } else {
            const set5 = this.regex.substring(node2.loc.begin, node2.loc.end);
            this.endRegexpStack.push(set5);
            if (this.isStarting) {
              this.startRegexp += set5;
            }
          }
        }
        visitChildren(node2) {
          if (node2.type === "Group") {
            const group2 = node2;
            if (group2.quantifier) {
              return;
            }
          }
          super.visitChildren(node2);
        }
      };
      visitor = new TerminalRegExpVisitor();
      __name(getTerminalParts, "getTerminalParts");
      __name(isMultilineComment, "isMultilineComment");
      whitespaceCharacters = "\f\n\r	\v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF".split("");
      __name(isWhitespace2, "isWhitespace");
      __name(escapeRegExp, "escapeRegExp");
      __name(partialMatches, "partialMatches");
      __name(partialRegExp, "partialRegExp");
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/grammar-utils.js
  var grammar_utils_exports = {};
  __export(grammar_utils_exports, {
    findAssignment: () => findAssignment,
    findNameAssignment: () => findNameAssignment,
    findNodeForKeyword: () => findNodeForKeyword,
    findNodeForProperty: () => findNodeForProperty,
    findNodesForKeyword: () => findNodesForKeyword,
    findNodesForKeywordInternal: () => findNodesForKeywordInternal,
    findNodesForProperty: () => findNodesForProperty,
    getActionAtElement: () => getActionAtElement,
    getActionType: () => getActionType,
    getAllReachableRules: () => getAllReachableRules,
    getAllRulesUsedForCrossReferences: () => getAllRulesUsedForCrossReferences,
    getCrossReferenceTerminal: () => getCrossReferenceTerminal,
    getEntryRule: () => getEntryRule,
    getExplicitRuleType: () => getExplicitRuleType,
    getHiddenRules: () => getHiddenRules,
    getRuleType: () => getRuleType,
    getRuleTypeName: () => getRuleTypeName,
    getTypeName: () => getTypeName,
    isArrayCardinality: () => isArrayCardinality,
    isArrayOperator: () => isArrayOperator,
    isCommentTerminal: () => isCommentTerminal,
    isDataType: () => isDataType,
    isDataTypeRule: () => isDataTypeRule,
    isOptionalCardinality: () => isOptionalCardinality,
    terminalRegex: () => terminalRegex
  });
  function getEntryRule(grammar) {
    return grammar.rules.find((e3) => isParserRule(e3) && e3.entry);
  }
  function getHiddenRules(grammar) {
    return grammar.rules.filter((e3) => isTerminalRule(e3) && e3.hidden);
  }
  function getAllReachableRules(grammar, allTerminals) {
    const ruleNames = /* @__PURE__ */ new Set();
    const entryRule = getEntryRule(grammar);
    if (!entryRule) {
      return new Set(grammar.rules);
    }
    const topMostRules = [entryRule].concat(getHiddenRules(grammar));
    for (const rule of topMostRules) {
      ruleDfs(rule, ruleNames, allTerminals);
    }
    const rules = /* @__PURE__ */ new Set();
    for (const rule of grammar.rules) {
      if (ruleNames.has(rule.name) || isTerminalRule(rule) && rule.hidden) {
        rules.add(rule);
      }
    }
    return rules;
  }
  function ruleDfs(rule, visitedSet, allTerminals) {
    visitedSet.add(rule.name);
    streamAllContents(rule).forEach((node2) => {
      if (isRuleCall(node2) || allTerminals && isTerminalRuleCall(node2)) {
        const refRule = node2.rule.ref;
        if (refRule && !visitedSet.has(refRule.name)) {
          ruleDfs(refRule, visitedSet, allTerminals);
        }
      }
    });
  }
  function getAllRulesUsedForCrossReferences(grammar) {
    const result = /* @__PURE__ */ new Set();
    streamAllContents(grammar).forEach((node2) => {
      if (isCrossReference(node2)) {
        if (isParserRule(node2.type.ref)) {
          result.add(node2.type.ref);
        }
        if (isInferredType(node2.type.ref) && isParserRule(node2.type.ref.$container)) {
          result.add(node2.type.ref.$container);
        }
      }
    });
    return result;
  }
  function getCrossReferenceTerminal(crossRef) {
    if (crossRef.terminal) {
      return crossRef.terminal;
    } else if (crossRef.type.ref) {
      const nameAssigment = findNameAssignment(crossRef.type.ref);
      return nameAssigment?.terminal;
    }
    return void 0;
  }
  function isCommentTerminal(terminalRule) {
    return terminalRule.hidden && !isWhitespace2(terminalRegex(terminalRule));
  }
  function findNodesForProperty(node2, property2) {
    if (!node2 || !property2) {
      return [];
    }
    return findNodesForPropertyInternal(node2, property2, node2.astNode, true);
  }
  function findNodeForProperty(node2, property2, index) {
    if (!node2 || !property2) {
      return void 0;
    }
    const nodes5 = findNodesForPropertyInternal(node2, property2, node2.astNode, true);
    if (nodes5.length === 0) {
      return void 0;
    }
    if (index !== void 0) {
      index = Math.max(0, Math.min(index, nodes5.length - 1));
    } else {
      index = 0;
    }
    return nodes5[index];
  }
  function findNodesForPropertyInternal(node2, property2, element3, first3) {
    if (!first3) {
      const nodeFeature = getContainerOfType(node2.grammarSource, isAssignment);
      if (nodeFeature && nodeFeature.feature === property2) {
        return [node2];
      }
    }
    if (isCompositeCstNode(node2) && node2.astNode === element3) {
      return node2.content.flatMap((e3) => findNodesForPropertyInternal(e3, property2, element3, false));
    }
    return [];
  }
  function findNodesForKeyword(node2, keyword) {
    if (!node2) {
      return [];
    }
    return findNodesForKeywordInternal(node2, keyword, node2?.astNode);
  }
  function findNodeForKeyword(node2, keyword, index) {
    if (!node2) {
      return void 0;
    }
    const nodes5 = findNodesForKeywordInternal(node2, keyword, node2?.astNode);
    if (nodes5.length === 0) {
      return void 0;
    }
    if (index !== void 0) {
      index = Math.max(0, Math.min(index, nodes5.length - 1));
    } else {
      index = 0;
    }
    return nodes5[index];
  }
  function findNodesForKeywordInternal(node2, keyword, element3) {
    if (node2.astNode !== element3) {
      return [];
    }
    if (isKeyword(node2.grammarSource) && node2.grammarSource.value === keyword) {
      return [node2];
    }
    const treeIterator = streamCst(node2).iterator();
    let result;
    const keywordNodes = [];
    do {
      result = treeIterator.next();
      if (!result.done) {
        const childNode = result.value;
        if (childNode.astNode === element3) {
          if (isKeyword(childNode.grammarSource) && childNode.grammarSource.value === keyword) {
            keywordNodes.push(childNode);
          }
        } else {
          treeIterator.prune();
        }
      }
    } while (!result.done);
    return keywordNodes;
  }
  function findAssignment(cstNode) {
    const astNode = cstNode.astNode;
    while (astNode === cstNode.container?.astNode) {
      const assignment = getContainerOfType(cstNode.grammarSource, isAssignment);
      if (assignment) {
        return assignment;
      }
      cstNode = cstNode.container;
    }
    return void 0;
  }
  function findNameAssignment(type3) {
    let startNode = type3;
    if (isInferredType(startNode)) {
      if (isAction(startNode.$container)) {
        startNode = startNode.$container.$container;
      } else if (isAbstractParserRule(startNode.$container)) {
        startNode = startNode.$container;
      } else {
        assertUnreachable(startNode.$container);
      }
    }
    return findNameAssignmentInternal(type3, startNode, /* @__PURE__ */ new Map());
  }
  function findNameAssignmentInternal(type3, startNode, cache3) {
    function go(node2, refType) {
      let childAssignment = void 0;
      const parentAssignment = getContainerOfType(node2, isAssignment);
      if (!parentAssignment) {
        childAssignment = findNameAssignmentInternal(refType, refType, cache3);
      }
      cache3.set(type3, childAssignment);
      return childAssignment;
    }
    __name(go, "go");
    if (cache3.has(type3)) {
      return cache3.get(type3);
    }
    cache3.set(type3, void 0);
    for (const node2 of streamAllContents(startNode)) {
      if (isAssignment(node2) && node2.feature.toLowerCase() === "name") {
        cache3.set(type3, node2);
        return node2;
      } else if (isRuleCall(node2) && isParserRule(node2.rule.ref)) {
        return go(node2, node2.rule.ref);
      } else if (isSimpleType(node2) && node2.typeRef?.ref) {
        return go(node2, node2.typeRef.ref);
      }
    }
    return void 0;
  }
  function getActionAtElement(element3) {
    const parent4 = element3.$container;
    if (isGroup(parent4)) {
      const elements2 = parent4.elements;
      const index = elements2.indexOf(element3);
      for (let i2 = index - 1; i2 >= 0; i2--) {
        const item = elements2[i2];
        if (isAction(item)) {
          return item;
        } else {
          const action = streamAllContents(elements2[i2]).find(isAction);
          if (action) {
            return action;
          }
        }
      }
    }
    if (isAbstractElement(parent4)) {
      return getActionAtElement(parent4);
    } else {
      return void 0;
    }
  }
  function isOptionalCardinality(cardinality, element3) {
    return cardinality === "?" || cardinality === "*" || isGroup(element3) && Boolean(element3.guardCondition);
  }
  function isArrayCardinality(cardinality) {
    return cardinality === "*" || cardinality === "+";
  }
  function isArrayOperator(operator) {
    return operator === "+=";
  }
  function isDataTypeRule(rule) {
    return isDataTypeRuleInternal(rule, /* @__PURE__ */ new Set());
  }
  function isDataTypeRuleInternal(rule, visited) {
    if (visited.has(rule)) {
      return true;
    } else {
      visited.add(rule);
    }
    for (const node2 of streamAllContents(rule)) {
      if (isRuleCall(node2)) {
        if (!node2.rule.ref) {
          return false;
        }
        if (isParserRule(node2.rule.ref) && !isDataTypeRuleInternal(node2.rule.ref, visited)) {
          return false;
        }
        if (isInfixRule(node2.rule.ref)) {
          return false;
        }
      } else if (isAssignment(node2)) {
        return false;
      } else if (isAction(node2)) {
        return false;
      }
    }
    return Boolean(rule.definition);
  }
  function isDataType(type3) {
    return isDataTypeInternal(type3.type, /* @__PURE__ */ new Set());
  }
  function isDataTypeInternal(type3, visited) {
    if (visited.has(type3)) {
      return true;
    } else {
      visited.add(type3);
    }
    if (isArrayType(type3)) {
      return false;
    } else if (isReferenceType(type3)) {
      return false;
    } else if (isUnionType(type3)) {
      return type3.types.every((e3) => isDataTypeInternal(e3, visited));
    } else if (isSimpleType(type3)) {
      if (type3.primitiveType !== void 0) {
        return true;
      } else if (type3.stringType !== void 0) {
        return true;
      } else if (type3.typeRef !== void 0) {
        const ref = type3.typeRef.ref;
        if (isType(ref)) {
          return isDataTypeInternal(ref.type, visited);
        } else {
          return false;
        }
      } else {
        return false;
      }
    } else {
      return false;
    }
  }
  function getExplicitRuleType(rule) {
    if (isTerminalRule(rule)) {
      return void 0;
    }
    if (rule.inferredType) {
      return rule.inferredType.name;
    } else if (rule.dataType) {
      return rule.dataType;
    } else if (rule.returnType) {
      const refType = rule.returnType.ref;
      if (refType) {
        return refType.name;
      }
    }
    return void 0;
  }
  function getTypeName(type3) {
    if (isAbstractParserRule(type3)) {
      return isParserRule(type3) && isDataTypeRule(type3) ? type3.name : getExplicitRuleType(type3) ?? type3.name;
    } else if (isInterface(type3) || isType(type3) || isReturnType(type3)) {
      return type3.name;
    } else if (isAction(type3)) {
      const actionType = getActionType(type3);
      if (actionType) {
        return actionType;
      }
    } else if (isInferredType(type3)) {
      return type3.name;
    }
    throw new Error("Cannot get name of Unknown Type");
  }
  function getActionType(action) {
    if (action.inferredType) {
      return action.inferredType.name;
    } else if (action.type?.ref) {
      return getTypeName(action.type.ref);
    }
    return void 0;
  }
  function getRuleTypeName(rule) {
    if (isTerminalRule(rule)) {
      return rule.type?.name ?? "string";
    } else {
      return isParserRule(rule) && isDataTypeRule(rule) ? rule.name : getExplicitRuleType(rule) ?? rule.name;
    }
  }
  function getRuleType(rule) {
    if (isTerminalRule(rule)) {
      return rule.type?.name ?? "string";
    } else {
      return getExplicitRuleType(rule) ?? rule.name;
    }
  }
  function terminalRegex(terminalRule) {
    const flags = {
      s: false,
      i: false,
      u: false
    };
    const source = abstractElementToRegex(terminalRule.definition, flags);
    const flagText = Object.entries(flags).filter(([, value2]) => value2).map(([name]) => name).join("");
    return new RegExp(source, flagText);
  }
  function abstractElementToRegex(element3, flags) {
    if (isTerminalAlternatives(element3)) {
      return terminalAlternativesToRegex(element3);
    } else if (isTerminalGroup(element3)) {
      return terminalGroupToRegex(element3);
    } else if (isCharacterRange(element3)) {
      return characterRangeToRegex(element3);
    } else if (isTerminalRuleCall(element3)) {
      const rule = element3.rule.ref;
      if (!rule) {
        throw new Error("Missing rule reference.");
      }
      return withCardinality(abstractElementToRegex(rule.definition), {
        cardinality: element3.cardinality,
        lookahead: element3.lookahead,
        parenthesized: element3.parenthesized
      });
    } else if (isNegatedToken(element3)) {
      return negateTokenToRegex(element3);
    } else if (isUntilToken(element3)) {
      return untilTokenToRegex(element3);
    } else if (isRegexToken(element3)) {
      const lastSlash = element3.regex.lastIndexOf("/");
      const source = element3.regex.substring(1, lastSlash);
      const regexFlags = element3.regex.substring(lastSlash + 1);
      if (flags) {
        flags.i = regexFlags.includes("i");
        flags.s = regexFlags.includes("s");
        flags.u = regexFlags.includes("u");
      }
      return withCardinality(source, {
        cardinality: element3.cardinality,
        lookahead: element3.lookahead,
        parenthesized: element3.parenthesized,
        wrap: false
      });
    } else if (isWildcard(element3)) {
      return withCardinality(WILDCARD, {
        cardinality: element3.cardinality,
        lookahead: element3.lookahead,
        parenthesized: element3.parenthesized
      });
    } else {
      throw new Error(`Invalid terminal element: ${element3?.$type}, ${element3?.$cstNode?.text}`);
    }
  }
  function terminalAlternativesToRegex(alternatives) {
    return withCardinality(alternatives.elements.map((e3) => abstractElementToRegex(e3)).join("|"), {
      cardinality: alternatives.cardinality,
      lookahead: alternatives.lookahead,
      parenthesized: alternatives.parenthesized,
      wrap: false
      // wrapping is not required for top level alternatives, and nested alternatives are already parenthesized according to the grammar
    });
  }
  function terminalGroupToRegex(group2) {
    return withCardinality(group2.elements.map((e3) => abstractElementToRegex(e3)).join(""), {
      cardinality: group2.cardinality,
      lookahead: group2.lookahead,
      parenthesized: group2.parenthesized,
      wrap: false
      // wrapping is not required for top level group, and nested group are already parenthesized according to the grammar
    });
  }
  function untilTokenToRegex(until) {
    return withCardinality(`${WILDCARD}*?${abstractElementToRegex(until.terminal)}`, {
      cardinality: until.cardinality,
      lookahead: until.lookahead,
      parenthesized: until.parenthesized
    });
  }
  function negateTokenToRegex(negate2) {
    return withCardinality(`(?!${abstractElementToRegex(negate2.terminal)})${WILDCARD}*?`, {
      cardinality: negate2.cardinality,
      lookahead: negate2.lookahead,
      parenthesized: negate2.parenthesized
    });
  }
  function characterRangeToRegex(range3) {
    if (range3.right) {
      return withCardinality(`[${keywordToRegex(range3.left)}-${keywordToRegex(range3.right)}]`, {
        cardinality: range3.cardinality,
        lookahead: range3.lookahead,
        parenthesized: range3.parenthesized,
        wrap: false
      });
    }
    return withCardinality(keywordToRegex(range3.left), {
      cardinality: range3.cardinality,
      lookahead: range3.lookahead,
      parenthesized: range3.parenthesized,
      wrap: false
    });
  }
  function keywordToRegex(keyword) {
    return escapeRegExp(keyword.value);
  }
  function withCardinality(regex2, options2) {
    if (options2.parenthesized || options2.lookahead || options2.wrap !== false) {
      const groupConfig = options2.lookahead ?? (options2.parenthesized ? "" : "?:");
      regex2 = `(${groupConfig}${regex2})`;
    }
    if (options2.cardinality) {
      return `${regex2}${options2.cardinality}`;
    }
    return regex2;
  }
  var WILDCARD;
  var init_grammar_utils = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/grammar-utils.js"() {
      "use strict";
      init_errors2();
      init_ast();
      init_syntax_tree();
      init_ast_utils();
      init_cst_utils();
      init_regexp_utils();
      __name(getEntryRule, "getEntryRule");
      __name(getHiddenRules, "getHiddenRules");
      __name(getAllReachableRules, "getAllReachableRules");
      __name(ruleDfs, "ruleDfs");
      __name(getAllRulesUsedForCrossReferences, "getAllRulesUsedForCrossReferences");
      __name(getCrossReferenceTerminal, "getCrossReferenceTerminal");
      __name(isCommentTerminal, "isCommentTerminal");
      __name(findNodesForProperty, "findNodesForProperty");
      __name(findNodeForProperty, "findNodeForProperty");
      __name(findNodesForPropertyInternal, "findNodesForPropertyInternal");
      __name(findNodesForKeyword, "findNodesForKeyword");
      __name(findNodeForKeyword, "findNodeForKeyword");
      __name(findNodesForKeywordInternal, "findNodesForKeywordInternal");
      __name(findAssignment, "findAssignment");
      __name(findNameAssignment, "findNameAssignment");
      __name(findNameAssignmentInternal, "findNameAssignmentInternal");
      __name(getActionAtElement, "getActionAtElement");
      __name(isOptionalCardinality, "isOptionalCardinality");
      __name(isArrayCardinality, "isArrayCardinality");
      __name(isArrayOperator, "isArrayOperator");
      __name(isDataTypeRule, "isDataTypeRule");
      __name(isDataTypeRuleInternal, "isDataTypeRuleInternal");
      __name(isDataType, "isDataType");
      __name(isDataTypeInternal, "isDataTypeInternal");
      __name(getExplicitRuleType, "getExplicitRuleType");
      __name(getTypeName, "getTypeName");
      __name(getActionType, "getActionType");
      __name(getRuleTypeName, "getRuleTypeName");
      __name(getRuleType, "getRuleType");
      __name(terminalRegex, "terminalRegex");
      WILDCARD = /[\s\S]/.source;
      __name(abstractElementToRegex, "abstractElementToRegex");
      __name(terminalAlternativesToRegex, "terminalAlternativesToRegex");
      __name(terminalGroupToRegex, "terminalGroupToRegex");
      __name(untilTokenToRegex, "untilTokenToRegex");
      __name(negateTokenToRegex, "negateTokenToRegex");
      __name(characterRangeToRegex, "characterRangeToRegex");
      __name(keywordToRegex, "keywordToRegex");
      __name(withCardinality, "withCardinality");
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/languages/grammar-config.js
  function createGrammarConfig(services) {
    const rules = [];
    const grammar = services.Grammar;
    for (const rule of grammar.rules) {
      if (isTerminalRule(rule) && isCommentTerminal(rule) && isMultilineComment(terminalRegex(rule))) {
        rules.push(rule.name);
      }
    }
    return {
      multilineCommentRules: rules,
      nameRegexp: DefaultNameRegexp
    };
  }
  var init_grammar_config = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/languages/grammar-config.js"() {
      "use strict";
      init_cst_utils();
      init_grammar_utils();
      init_regexp_utils();
      init_ast();
      __name(createGrammarConfig, "createGrammarConfig");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/version.js
  var init_version = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/version.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+utils@11.1.1/node_modules/@chevrotain/utils/lib/src/print.js
  function PRINT_ERROR(msg) {
    if (console && console.error) {
      console.error(`Error: ${msg}`);
    }
  }
  function PRINT_WARNING(msg) {
    if (console && console.warn) {
      console.warn(`Warning: ${msg}`);
    }
  }
  var init_print = __esm({
    "../../node_modules/.pnpm/@chevrotain+utils@11.1.1/node_modules/@chevrotain/utils/lib/src/print.js"() {
      "use strict";
      __name(PRINT_ERROR, "PRINT_ERROR");
      __name(PRINT_WARNING, "PRINT_WARNING");
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+utils@11.1.1/node_modules/@chevrotain/utils/lib/src/timer.js
  function timer2(func) {
    const start3 = (/* @__PURE__ */ new Date()).getTime();
    const val = func();
    const end2 = (/* @__PURE__ */ new Date()).getTime();
    const total = end2 - start3;
    return { time: total, value: val };
  }
  var init_timer2 = __esm({
    "../../node_modules/.pnpm/@chevrotain+utils@11.1.1/node_modules/@chevrotain/utils/lib/src/timer.js"() {
      "use strict";
      __name(timer2, "timer");
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+utils@11.1.1/node_modules/@chevrotain/utils/lib/src/to-fast-properties.js
  function toFastProperties(toBecomeFast) {
    function FakeConstructor() {
    }
    __name(FakeConstructor, "FakeConstructor");
    FakeConstructor.prototype = toBecomeFast;
    const fakeInstance = new FakeConstructor();
    function fakeAccess() {
      return typeof fakeInstance.bar;
    }
    __name(fakeAccess, "fakeAccess");
    fakeAccess();
    fakeAccess();
    if (1)
      return toBecomeFast;
    (0, eval)(toBecomeFast);
  }
  var init_to_fast_properties = __esm({
    "../../node_modules/.pnpm/@chevrotain+utils@11.1.1/node_modules/@chevrotain/utils/lib/src/to-fast-properties.js"() {
      "use strict";
      __name(toFastProperties, "toFastProperties");
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+utils@11.1.1/node_modules/@chevrotain/utils/lib/src/api.js
  var init_api2 = __esm({
    "../../node_modules/.pnpm/@chevrotain+utils@11.1.1/node_modules/@chevrotain/utils/lib/src/api.js"() {
      "use strict";
      init_print();
      init_timer2();
      init_to_fast_properties();
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+gast@11.1.1/node_modules/@chevrotain/gast/lib/src/model.js
  function tokenLabel(tokType) {
    if (hasTokenLabel(tokType)) {
      return tokType.LABEL;
    } else {
      return tokType.name;
    }
  }
  function hasTokenLabel(obj) {
    return isString_default(obj.LABEL) && obj.LABEL !== "";
  }
  function serializeGrammar(topRules) {
    return map_default(topRules, serializeProduction);
  }
  function serializeProduction(node2) {
    function convertDefinition(definition) {
      return map_default(definition, serializeProduction);
    }
    __name(convertDefinition, "convertDefinition");
    if (node2 instanceof NonTerminal) {
      const serializedNonTerminal = {
        type: "NonTerminal",
        name: node2.nonTerminalName,
        idx: node2.idx
      };
      if (isString_default(node2.label)) {
        serializedNonTerminal.label = node2.label;
      }
      return serializedNonTerminal;
    } else if (node2 instanceof Alternative) {
      return {
        type: "Alternative",
        definition: convertDefinition(node2.definition)
      };
    } else if (node2 instanceof Option2) {
      return {
        type: "Option",
        idx: node2.idx,
        definition: convertDefinition(node2.definition)
      };
    } else if (node2 instanceof RepetitionMandatory) {
      return {
        type: "RepetitionMandatory",
        idx: node2.idx,
        definition: convertDefinition(node2.definition)
      };
    } else if (node2 instanceof RepetitionMandatoryWithSeparator) {
      return {
        type: "RepetitionMandatoryWithSeparator",
        idx: node2.idx,
        separator: serializeProduction(new Terminal({ terminalType: node2.separator })),
        definition: convertDefinition(node2.definition)
      };
    } else if (node2 instanceof RepetitionWithSeparator) {
      return {
        type: "RepetitionWithSeparator",
        idx: node2.idx,
        separator: serializeProduction(new Terminal({ terminalType: node2.separator })),
        definition: convertDefinition(node2.definition)
      };
    } else if (node2 instanceof Repetition) {
      return {
        type: "Repetition",
        idx: node2.idx,
        definition: convertDefinition(node2.definition)
      };
    } else if (node2 instanceof Alternation) {
      return {
        type: "Alternation",
        idx: node2.idx,
        definition: convertDefinition(node2.definition)
      };
    } else if (node2 instanceof Terminal) {
      const serializedTerminal = {
        type: "Terminal",
        name: node2.terminalType.name,
        label: tokenLabel(node2.terminalType),
        idx: node2.idx
      };
      if (isString_default(node2.label)) {
        serializedTerminal.terminalLabel = node2.label;
      }
      const pattern = node2.terminalType.PATTERN;
      if (node2.terminalType.PATTERN) {
        serializedTerminal.pattern = isRegExp_default(pattern) ? pattern.source : pattern;
      }
      return serializedTerminal;
    } else if (node2 instanceof Rule) {
      return {
        type: "Rule",
        name: node2.name,
        orgText: node2.orgText,
        definition: convertDefinition(node2.definition)
      };
    } else {
      throw Error("non exhaustive match");
    }
  }
  var AbstractProduction, NonTerminal, Rule, Alternative, Option2, RepetitionMandatory, RepetitionMandatoryWithSeparator, Repetition, RepetitionWithSeparator, Alternation, Terminal;
  var init_model = __esm({
    "../../node_modules/.pnpm/@chevrotain+gast@11.1.1/node_modules/@chevrotain/gast/lib/src/model.js"() {
      "use strict";
      init_lodash();
      __name(tokenLabel, "tokenLabel");
      __name(hasTokenLabel, "hasTokenLabel");
      AbstractProduction = class {
        static {
          __name(this, "AbstractProduction");
        }
        get definition() {
          return this._definition;
        }
        set definition(value2) {
          this._definition = value2;
        }
        constructor(_definition) {
          this._definition = _definition;
        }
        accept(visitor2) {
          visitor2.visit(this);
          forEach_default(this.definition, (prod) => {
            prod.accept(visitor2);
          });
        }
      };
      NonTerminal = class extends AbstractProduction {
        static {
          __name(this, "NonTerminal");
        }
        constructor(options2) {
          super([]);
          this.idx = 1;
          assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0));
        }
        set definition(definition) {
        }
        get definition() {
          if (this.referencedRule !== void 0) {
            return this.referencedRule.definition;
          }
          return [];
        }
        accept(visitor2) {
          visitor2.visit(this);
        }
      };
      Rule = class extends AbstractProduction {
        static {
          __name(this, "Rule");
        }
        constructor(options2) {
          super(options2.definition);
          this.orgText = "";
          assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0));
        }
      };
      Alternative = class extends AbstractProduction {
        static {
          __name(this, "Alternative");
        }
        constructor(options2) {
          super(options2.definition);
          this.ignoreAmbiguities = false;
          assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0));
        }
      };
      Option2 = class extends AbstractProduction {
        static {
          __name(this, "Option");
        }
        constructor(options2) {
          super(options2.definition);
          this.idx = 1;
          assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0));
        }
      };
      RepetitionMandatory = class extends AbstractProduction {
        static {
          __name(this, "RepetitionMandatory");
        }
        constructor(options2) {
          super(options2.definition);
          this.idx = 1;
          assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0));
        }
      };
      RepetitionMandatoryWithSeparator = class extends AbstractProduction {
        static {
          __name(this, "RepetitionMandatoryWithSeparator");
        }
        constructor(options2) {
          super(options2.definition);
          this.idx = 1;
          assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0));
        }
      };
      Repetition = class extends AbstractProduction {
        static {
          __name(this, "Repetition");
        }
        constructor(options2) {
          super(options2.definition);
          this.idx = 1;
          assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0));
        }
      };
      RepetitionWithSeparator = class extends AbstractProduction {
        static {
          __name(this, "RepetitionWithSeparator");
        }
        constructor(options2) {
          super(options2.definition);
          this.idx = 1;
          assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0));
        }
      };
      Alternation = class extends AbstractProduction {
        static {
          __name(this, "Alternation");
        }
        get definition() {
          return this._definition;
        }
        set definition(value2) {
          this._definition = value2;
        }
        constructor(options2) {
          super(options2.definition);
          this.idx = 1;
          this.ignoreAmbiguities = false;
          this.hasPredicates = false;
          assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0));
        }
      };
      Terminal = class {
        static {
          __name(this, "Terminal");
        }
        constructor(options2) {
          this.idx = 1;
          assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0));
        }
        accept(visitor2) {
          visitor2.visit(this);
        }
      };
      __name(serializeGrammar, "serializeGrammar");
      __name(serializeProduction, "serializeProduction");
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+gast@11.1.1/node_modules/@chevrotain/gast/lib/src/visitor.js
  var GAstVisitor;
  var init_visitor = __esm({
    "../../node_modules/.pnpm/@chevrotain+gast@11.1.1/node_modules/@chevrotain/gast/lib/src/visitor.js"() {
      "use strict";
      init_model();
      GAstVisitor = class {
        static {
          __name(this, "GAstVisitor");
        }
        visit(node2) {
          const nodeAny = node2;
          switch (nodeAny.constructor) {
            case NonTerminal:
              return this.visitNonTerminal(nodeAny);
            case Alternative:
              return this.visitAlternative(nodeAny);
            case Option2:
              return this.visitOption(nodeAny);
            case RepetitionMandatory:
              return this.visitRepetitionMandatory(nodeAny);
            case RepetitionMandatoryWithSeparator:
              return this.visitRepetitionMandatoryWithSeparator(nodeAny);
            case RepetitionWithSeparator:
              return this.visitRepetitionWithSeparator(nodeAny);
            case Repetition:
              return this.visitRepetition(nodeAny);
            case Alternation:
              return this.visitAlternation(nodeAny);
            case Terminal:
              return this.visitTerminal(nodeAny);
            case Rule:
              return this.visitRule(nodeAny);
            /* c8 ignore next 2 */
            default:
              throw Error("non exhaustive match");
          }
        }
        /* c8 ignore next */
        visitNonTerminal(node2) {
        }
        /* c8 ignore next */
        visitAlternative(node2) {
        }
        /* c8 ignore next */
        visitOption(node2) {
        }
        /* c8 ignore next */
        visitRepetition(node2) {
        }
        /* c8 ignore next */
        visitRepetitionMandatory(node2) {
        }
        /* c8 ignore next 3 */
        visitRepetitionMandatoryWithSeparator(node2) {
        }
        /* c8 ignore next */
        visitRepetitionWithSeparator(node2) {
        }
        /* c8 ignore next */
        visitAlternation(node2) {
        }
        /* c8 ignore next */
        visitTerminal(node2) {
        }
        /* c8 ignore next */
        visitRule(node2) {
        }
      };
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+gast@11.1.1/node_modules/@chevrotain/gast/lib/src/helpers.js
  function isSequenceProd(prod) {
    return prod instanceof Alternative || prod instanceof Option2 || prod instanceof Repetition || prod instanceof RepetitionMandatory || prod instanceof RepetitionMandatoryWithSeparator || prod instanceof RepetitionWithSeparator || prod instanceof Terminal || prod instanceof Rule;
  }
  function isOptionalProd(prod, alreadyVisited = []) {
    const isDirectlyOptional = prod instanceof Option2 || prod instanceof Repetition || prod instanceof RepetitionWithSeparator;
    if (isDirectlyOptional) {
      return true;
    }
    if (prod instanceof Alternation) {
      return some_default(prod.definition, (subProd) => {
        return isOptionalProd(subProd, alreadyVisited);
      });
    } else if (prod instanceof NonTerminal && includes_default(alreadyVisited, prod)) {
      return false;
    } else if (prod instanceof AbstractProduction) {
      if (prod instanceof NonTerminal) {
        alreadyVisited.push(prod);
      }
      return every_default(prod.definition, (subProd) => {
        return isOptionalProd(subProd, alreadyVisited);
      });
    } else {
      return false;
    }
  }
  function isBranchingProd(prod) {
    return prod instanceof Alternation;
  }
  function getProductionDslName(prod) {
    if (prod instanceof NonTerminal) {
      return "SUBRULE";
    } else if (prod instanceof Option2) {
      return "OPTION";
    } else if (prod instanceof Alternation) {
      return "OR";
    } else if (prod instanceof RepetitionMandatory) {
      return "AT_LEAST_ONE";
    } else if (prod instanceof RepetitionMandatoryWithSeparator) {
      return "AT_LEAST_ONE_SEP";
    } else if (prod instanceof RepetitionWithSeparator) {
      return "MANY_SEP";
    } else if (prod instanceof Repetition) {
      return "MANY";
    } else if (prod instanceof Terminal) {
      return "CONSUME";
    } else {
      throw Error("non exhaustive match");
    }
  }
  var init_helpers = __esm({
    "../../node_modules/.pnpm/@chevrotain+gast@11.1.1/node_modules/@chevrotain/gast/lib/src/helpers.js"() {
      "use strict";
      init_lodash();
      init_model();
      __name(isSequenceProd, "isSequenceProd");
      __name(isOptionalProd, "isOptionalProd");
      __name(isBranchingProd, "isBranchingProd");
      __name(getProductionDslName, "getProductionDslName");
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+gast@11.1.1/node_modules/@chevrotain/gast/lib/src/api.js
  var init_api3 = __esm({
    "../../node_modules/.pnpm/@chevrotain+gast@11.1.1/node_modules/@chevrotain/gast/lib/src/api.js"() {
      "use strict";
      init_model();
      init_visitor();
      init_helpers();
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/rest.js
  function restForRepetitionWithSeparator(repSepProd, currRest, prevRest) {
    const repSepRest = [
      new Option2({
        definition: [
          new Terminal({ terminalType: repSepProd.separator })
        ].concat(repSepProd.definition)
      })
    ];
    const fullRepSepRest = repSepRest.concat(currRest, prevRest);
    return fullRepSepRest;
  }
  var RestWalker;
  var init_rest = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/rest.js"() {
      "use strict";
      init_lodash();
      init_api3();
      RestWalker = class {
        static {
          __name(this, "RestWalker");
        }
        walk(prod, prevRest = []) {
          forEach_default(prod.definition, (subProd, index) => {
            const currRest = drop_default(prod.definition, index + 1);
            if (subProd instanceof NonTerminal) {
              this.walkProdRef(subProd, currRest, prevRest);
            } else if (subProd instanceof Terminal) {
              this.walkTerminal(subProd, currRest, prevRest);
            } else if (subProd instanceof Alternative) {
              this.walkFlat(subProd, currRest, prevRest);
            } else if (subProd instanceof Option2) {
              this.walkOption(subProd, currRest, prevRest);
            } else if (subProd instanceof RepetitionMandatory) {
              this.walkAtLeastOne(subProd, currRest, prevRest);
            } else if (subProd instanceof RepetitionMandatoryWithSeparator) {
              this.walkAtLeastOneSep(subProd, currRest, prevRest);
            } else if (subProd instanceof RepetitionWithSeparator) {
              this.walkManySep(subProd, currRest, prevRest);
            } else if (subProd instanceof Repetition) {
              this.walkMany(subProd, currRest, prevRest);
            } else if (subProd instanceof Alternation) {
              this.walkOr(subProd, currRest, prevRest);
            } else {
              throw Error("non exhaustive match");
            }
          });
        }
        walkTerminal(terminal, currRest, prevRest) {
        }
        walkProdRef(refProd, currRest, prevRest) {
        }
        walkFlat(flatProd, currRest, prevRest) {
          const fullOrRest = currRest.concat(prevRest);
          this.walk(flatProd, fullOrRest);
        }
        walkOption(optionProd, currRest, prevRest) {
          const fullOrRest = currRest.concat(prevRest);
          this.walk(optionProd, fullOrRest);
        }
        walkAtLeastOne(atLeastOneProd, currRest, prevRest) {
          const fullAtLeastOneRest = [
            new Option2({ definition: atLeastOneProd.definition })
          ].concat(currRest, prevRest);
          this.walk(atLeastOneProd, fullAtLeastOneRest);
        }
        walkAtLeastOneSep(atLeastOneSepProd, currRest, prevRest) {
          const fullAtLeastOneSepRest = restForRepetitionWithSeparator(atLeastOneSepProd, currRest, prevRest);
          this.walk(atLeastOneSepProd, fullAtLeastOneSepRest);
        }
        walkMany(manyProd, currRest, prevRest) {
          const fullManyRest = [
            new Option2({ definition: manyProd.definition })
          ].concat(currRest, prevRest);
          this.walk(manyProd, fullManyRest);
        }
        walkManySep(manySepProd, currRest, prevRest) {
          const fullManySepRest = restForRepetitionWithSeparator(manySepProd, currRest, prevRest);
          this.walk(manySepProd, fullManySepRest);
        }
        walkOr(orProd, currRest, prevRest) {
          const fullOrRest = currRest.concat(prevRest);
          forEach_default(orProd.definition, (alt) => {
            const prodWrapper = new Alternative({ definition: [alt] });
            this.walk(prodWrapper, fullOrRest);
          });
        }
      };
      __name(restForRepetitionWithSeparator, "restForRepetitionWithSeparator");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/first.js
  function first2(prod) {
    if (prod instanceof NonTerminal) {
      return first2(prod.referencedRule);
    } else if (prod instanceof Terminal) {
      return firstForTerminal(prod);
    } else if (isSequenceProd(prod)) {
      return firstForSequence(prod);
    } else if (isBranchingProd(prod)) {
      return firstForBranching(prod);
    } else {
      throw Error("non exhaustive match");
    }
  }
  function firstForSequence(prod) {
    let firstSet = [];
    const seq2 = prod.definition;
    let nextSubProdIdx = 0;
    let hasInnerProdsRemaining = seq2.length > nextSubProdIdx;
    let currSubProd;
    let isLastInnerProdOptional = true;
    while (hasInnerProdsRemaining && isLastInnerProdOptional) {
      currSubProd = seq2[nextSubProdIdx];
      isLastInnerProdOptional = isOptionalProd(currSubProd);
      firstSet = firstSet.concat(first2(currSubProd));
      nextSubProdIdx = nextSubProdIdx + 1;
      hasInnerProdsRemaining = seq2.length > nextSubProdIdx;
    }
    return uniq_default(firstSet);
  }
  function firstForBranching(prod) {
    const allAlternativesFirsts = map_default(prod.definition, (innerProd) => {
      return first2(innerProd);
    });
    return uniq_default(flatten_default(allAlternativesFirsts));
  }
  function firstForTerminal(terminal) {
    return [terminal.terminalType];
  }
  var init_first2 = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/first.js"() {
      "use strict";
      init_lodash();
      init_api3();
      __name(first2, "first");
      __name(firstForSequence, "firstForSequence");
      __name(firstForBranching, "firstForBranching");
      __name(firstForTerminal, "firstForTerminal");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/constants.js
  var IN;
  var init_constants2 = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/constants.js"() {
      "use strict";
      IN = "_~IN~_";
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/follow.js
  function computeAllProdsFollows(topProductions) {
    const reSyncFollows = {};
    forEach_default(topProductions, (topProd) => {
      const currRefsFollow = new ResyncFollowsWalker(topProd).startWalking();
      assign_default(reSyncFollows, currRefsFollow);
    });
    return reSyncFollows;
  }
  function buildBetweenProdsFollowPrefix(inner2, occurenceInParent) {
    return inner2.name + occurenceInParent + IN;
  }
  var ResyncFollowsWalker;
  var init_follow = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/follow.js"() {
      "use strict";
      init_rest();
      init_first2();
      init_lodash();
      init_constants2();
      init_api3();
      ResyncFollowsWalker = class extends RestWalker {
        static {
          __name(this, "ResyncFollowsWalker");
        }
        constructor(topProd) {
          super();
          this.topProd = topProd;
          this.follows = {};
        }
        startWalking() {
          this.walk(this.topProd);
          return this.follows;
        }
        walkTerminal(terminal, currRest, prevRest) {
        }
        walkProdRef(refProd, currRest, prevRest) {
          const followName = buildBetweenProdsFollowPrefix(refProd.referencedRule, refProd.idx) + this.topProd.name;
          const fullRest = currRest.concat(prevRest);
          const restProd = new Alternative({ definition: fullRest });
          const t_in_topProd_follows = first2(restProd);
          this.follows[followName] = t_in_topProd_follows;
        }
      };
      __name(computeAllProdsFollows, "computeAllProdsFollows");
      __name(buildBetweenProdsFollowPrefix, "buildBetweenProdsFollowPrefix");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/reg_exp_parser.js
  function getRegExpAst(regExp) {
    const regExpStr = regExp.toString();
    if (regExpAstCache.hasOwnProperty(regExpStr)) {
      return regExpAstCache[regExpStr];
    } else {
      const regExpAst = regExpParser.pattern(regExpStr);
      regExpAstCache[regExpStr] = regExpAst;
      return regExpAst;
    }
  }
  function clearRegExpParserCache() {
    regExpAstCache = {};
  }
  var regExpAstCache, regExpParser;
  var init_reg_exp_parser = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/reg_exp_parser.js"() {
      "use strict";
      init_api();
      regExpAstCache = {};
      regExpParser = new RegExpParser();
      __name(getRegExpAst, "getRegExpAst");
      __name(clearRegExpParserCache, "clearRegExpParserCache");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/reg_exp.js
  function getOptimizedStartCodesIndices(regExp, ensureOptimizations = false) {
    try {
      const ast = getRegExpAst(regExp);
      const firstChars = firstCharOptimizedIndices(ast.value, {}, ast.flags.ignoreCase);
      return firstChars;
    } catch (e3) {
      if (e3.message === complementErrorMessage) {
        if (ensureOptimizations) {
          PRINT_WARNING(`${failedOptimizationPrefixMsg}	Unable to optimize: < ${regExp.toString()} >
	Complement Sets cannot be automatically optimized.
	This will disable the lexer's first char optimizations.
	See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);
        }
      } else {
        let msgSuffix = "";
        if (ensureOptimizations) {
          msgSuffix = "\n	This will disable the lexer's first char optimizations.\n	See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.";
        }
        PRINT_ERROR(`${failedOptimizationPrefixMsg}
	Failed parsing: < ${regExp.toString()} >
	Using the @chevrotain/regexp-to-ast library
	Please open an issue at: https://github.com/chevrotain/chevrotain/issues` + msgSuffix);
      }
    }
    return [];
  }
  function firstCharOptimizedIndices(ast, result, ignoreCase) {
    switch (ast.type) {
      case "Disjunction":
        for (let i2 = 0; i2 < ast.value.length; i2++) {
          firstCharOptimizedIndices(ast.value[i2], result, ignoreCase);
        }
        break;
      case "Alternative":
        const terms = ast.value;
        for (let i2 = 0; i2 < terms.length; i2++) {
          const term = terms[i2];
          switch (term.type) {
            case "EndAnchor":
            // A group back reference cannot affect potential starting char.
            // because if a back reference is the first production than automatically
            // the group being referenced has had to come BEFORE so its codes have already been added
            case "GroupBackReference":
            // assertions do not affect potential starting codes
            case "Lookahead":
            case "NegativeLookahead":
            case "Lookbehind":
            case "NegativeLookbehind":
            case "StartAnchor":
            case "WordBoundary":
            case "NonWordBoundary":
              continue;
          }
          const atom2 = term;
          switch (atom2.type) {
            case "Character":
              addOptimizedIdxToResult(atom2.value, result, ignoreCase);
              break;
            case "Set":
              if (atom2.complement === true) {
                throw Error(complementErrorMessage);
              }
              forEach_default(atom2.value, (code) => {
                if (typeof code === "number") {
                  addOptimizedIdxToResult(code, result, ignoreCase);
                } else {
                  const range3 = code;
                  if (ignoreCase === true) {
                    for (let rangeCode = range3.from; rangeCode <= range3.to; rangeCode++) {
                      addOptimizedIdxToResult(rangeCode, result, ignoreCase);
                    }
                  } else {
                    for (let rangeCode = range3.from; rangeCode <= range3.to && rangeCode < minOptimizationVal; rangeCode++) {
                      addOptimizedIdxToResult(rangeCode, result, ignoreCase);
                    }
                    if (range3.to >= minOptimizationVal) {
                      const minUnOptVal = range3.from >= minOptimizationVal ? range3.from : minOptimizationVal;
                      const maxUnOptVal = range3.to;
                      const minOptIdx = charCodeToOptimizedIndex(minUnOptVal);
                      const maxOptIdx = charCodeToOptimizedIndex(maxUnOptVal);
                      for (let currOptIdx = minOptIdx; currOptIdx <= maxOptIdx; currOptIdx++) {
                        result[currOptIdx] = currOptIdx;
                      }
                    }
                  }
                }
              });
              break;
            case "Group":
              firstCharOptimizedIndices(atom2.value, result, ignoreCase);
              break;
            /* istanbul ignore next */
            default:
              throw Error("Non Exhaustive Match");
          }
          const isOptionalQuantifier = atom2.quantifier !== void 0 && atom2.quantifier.atLeast === 0;
          if (
            // A group may be optional due to empty contents /(?:)/
            // or if everything inside it is optional /((a)?)/
            atom2.type === "Group" && isWholeOptional(atom2) === false || // If this term is not a group it may only be optional if it has an optional quantifier
            atom2.type !== "Group" && isOptionalQuantifier === false
          ) {
            break;
          }
        }
        break;
      /* istanbul ignore next */
      default:
        throw Error("non exhaustive match!");
    }
    return values_default(result);
  }
  function addOptimizedIdxToResult(code, result, ignoreCase) {
    const optimizedCharIdx = charCodeToOptimizedIndex(code);
    result[optimizedCharIdx] = optimizedCharIdx;
    if (ignoreCase === true) {
      handleIgnoreCase(code, result);
    }
  }
  function handleIgnoreCase(code, result) {
    const char2 = String.fromCharCode(code);
    const upperChar = char2.toUpperCase();
    if (upperChar !== char2) {
      const optimizedCharIdx = charCodeToOptimizedIndex(upperChar.charCodeAt(0));
      result[optimizedCharIdx] = optimizedCharIdx;
    } else {
      const lowerChar = char2.toLowerCase();
      if (lowerChar !== char2) {
        const optimizedCharIdx = charCodeToOptimizedIndex(lowerChar.charCodeAt(0));
        result[optimizedCharIdx] = optimizedCharIdx;
      }
    }
  }
  function findCode(setNode, targetCharCodes) {
    return find_default2(setNode.value, (codeOrRange) => {
      if (typeof codeOrRange === "number") {
        return includes_default(targetCharCodes, codeOrRange);
      } else {
        const range3 = codeOrRange;
        return find_default2(targetCharCodes, (targetCode) => range3.from <= targetCode && targetCode <= range3.to) !== void 0;
      }
    });
  }
  function isWholeOptional(ast) {
    const quantifier = ast.quantifier;
    if (quantifier && quantifier.atLeast === 0) {
      return true;
    }
    if (!ast.value) {
      return false;
    }
    return isArray_default(ast.value) ? every_default(ast.value, isWholeOptional) : isWholeOptional(ast.value);
  }
  function canMatchCharCode(charCodes, pattern) {
    if (pattern instanceof RegExp) {
      const ast = getRegExpAst(pattern);
      const charCodeFinder = new CharCodeFinder(charCodes);
      charCodeFinder.visit(ast);
      return charCodeFinder.found;
    } else {
      return find_default2(pattern, (char2) => {
        return includes_default(charCodes, char2.charCodeAt(0));
      }) !== void 0;
    }
  }
  var complementErrorMessage, failedOptimizationPrefixMsg, CharCodeFinder;
  var init_reg_exp = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/reg_exp.js"() {
      "use strict";
      init_api();
      init_lodash();
      init_api2();
      init_reg_exp_parser();
      init_lexer();
      complementErrorMessage = "Complement Sets are not supported for first char optimization";
      failedOptimizationPrefixMsg = 'Unable to use "first char" lexer optimizations:\n';
      __name(getOptimizedStartCodesIndices, "getOptimizedStartCodesIndices");
      __name(firstCharOptimizedIndices, "firstCharOptimizedIndices");
      __name(addOptimizedIdxToResult, "addOptimizedIdxToResult");
      __name(handleIgnoreCase, "handleIgnoreCase");
      __name(findCode, "findCode");
      __name(isWholeOptional, "isWholeOptional");
      CharCodeFinder = class extends BaseRegExpVisitor {
        static {
          __name(this, "CharCodeFinder");
        }
        constructor(targetCharCodes) {
          super();
          this.targetCharCodes = targetCharCodes;
          this.found = false;
        }
        visitChildren(node2) {
          if (this.found === true) {
            return;
          }
          switch (node2.type) {
            case "Lookahead":
              this.visitLookahead(node2);
              return;
            case "NegativeLookahead":
              this.visitNegativeLookahead(node2);
              return;
            case "Lookbehind":
              this.visitLookbehind(node2);
              return;
            case "NegativeLookbehind":
              this.visitNegativeLookbehind(node2);
              return;
          }
          super.visitChildren(node2);
        }
        visitCharacter(node2) {
          if (includes_default(this.targetCharCodes, node2.value)) {
            this.found = true;
          }
        }
        visitSet(node2) {
          if (node2.complement) {
            if (findCode(node2, this.targetCharCodes) === void 0) {
              this.found = true;
            }
          } else {
            if (findCode(node2, this.targetCharCodes) !== void 0) {
              this.found = true;
            }
          }
        }
      };
      __name(canMatchCharCode, "canMatchCharCode");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/lexer.js
  function analyzeTokenTypes(tokenTypes, options2) {
    options2 = defaults_default(options2, {
      useSticky: SUPPORT_STICKY,
      debug: false,
      safeMode: false,
      positionTracking: "full",
      lineTerminatorCharacters: ["\r", "\n"],
      tracer: /* @__PURE__ */ __name((msg, action) => action(), "tracer")
    });
    const tracer = options2.tracer;
    tracer("initCharCodeToOptimizedIndexMap", () => {
      initCharCodeToOptimizedIndexMap();
    });
    let onlyRelevantTypes;
    tracer("Reject Lexer.NA", () => {
      onlyRelevantTypes = reject_default(tokenTypes, (currType) => {
        return currType[PATTERN] === Lexer2.NA;
      });
    });
    let hasCustom = false;
    let allTransformedPatterns;
    tracer("Transform Patterns", () => {
      hasCustom = false;
      allTransformedPatterns = map_default(onlyRelevantTypes, (currType) => {
        const currPattern = currType[PATTERN];
        if (isRegExp_default(currPattern)) {
          const regExpSource = currPattern.source;
          if (regExpSource.length === 1 && // only these regExp meta characters which can appear in a length one regExp
          regExpSource !== "^" && regExpSource !== "$" && regExpSource !== "." && !currPattern.ignoreCase) {
            return regExpSource;
          } else if (regExpSource.length === 2 && regExpSource[0] === "\\" && // not a meta character
          !includes_default([
            "d",
            "D",
            "s",
            "S",
            "t",
            "r",
            "n",
            "t",
            "0",
            "c",
            "b",
            "B",
            "f",
            "v",
            "w",
            "W"
          ], regExpSource[1])) {
            return regExpSource[1];
          } else {
            return options2.useSticky ? addStickyFlag(currPattern) : addStartOfInput(currPattern);
          }
        } else if (isFunction_default(currPattern)) {
          hasCustom = true;
          return { exec: currPattern };
        } else if (typeof currPattern === "object") {
          hasCustom = true;
          return currPattern;
        } else if (typeof currPattern === "string") {
          if (currPattern.length === 1) {
            return currPattern;
          } else {
            const escapedRegExpString = currPattern.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
            const wrappedRegExp = new RegExp(escapedRegExpString);
            return options2.useSticky ? addStickyFlag(wrappedRegExp) : addStartOfInput(wrappedRegExp);
          }
        } else {
          throw Error("non exhaustive match");
        }
      });
    });
    let patternIdxToType;
    let patternIdxToGroup;
    let patternIdxToLongerAltIdxArr;
    let patternIdxToPushMode;
    let patternIdxToPopMode;
    tracer("misc mapping", () => {
      patternIdxToType = map_default(onlyRelevantTypes, (currType) => currType.tokenTypeIdx);
      patternIdxToGroup = map_default(onlyRelevantTypes, (clazz) => {
        const groupName = clazz.GROUP;
        if (groupName === Lexer2.SKIPPED) {
          return void 0;
        } else if (isString_default(groupName)) {
          return groupName;
        } else if (isUndefined_default(groupName)) {
          return false;
        } else {
          throw Error("non exhaustive match");
        }
      });
      patternIdxToLongerAltIdxArr = map_default(onlyRelevantTypes, (clazz) => {
        const longerAltType = clazz.LONGER_ALT;
        if (longerAltType) {
          const longerAltIdxArr = isArray_default(longerAltType) ? map_default(longerAltType, (type3) => indexOf_default(onlyRelevantTypes, type3)) : [indexOf_default(onlyRelevantTypes, longerAltType)];
          return longerAltIdxArr;
        }
      });
      patternIdxToPushMode = map_default(onlyRelevantTypes, (clazz) => clazz.PUSH_MODE);
      patternIdxToPopMode = map_default(onlyRelevantTypes, (clazz) => has_default(clazz, "POP_MODE"));
    });
    let patternIdxToCanLineTerminator;
    tracer("Line Terminator Handling", () => {
      const lineTerminatorCharCodes = getCharCodes(options2.lineTerminatorCharacters);
      patternIdxToCanLineTerminator = map_default(onlyRelevantTypes, (tokType) => false);
      if (options2.positionTracking !== "onlyOffset") {
        patternIdxToCanLineTerminator = map_default(onlyRelevantTypes, (tokType) => {
          if (has_default(tokType, "LINE_BREAKS")) {
            return !!tokType.LINE_BREAKS;
          } else {
            return checkLineBreaksIssues(tokType, lineTerminatorCharCodes) === false && canMatchCharCode(lineTerminatorCharCodes, tokType.PATTERN);
          }
        });
      }
    });
    let patternIdxToIsCustom;
    let patternIdxToShort;
    let emptyGroups;
    let patternIdxToConfig;
    tracer("Misc Mapping #2", () => {
      patternIdxToIsCustom = map_default(onlyRelevantTypes, isCustomPattern);
      patternIdxToShort = map_default(allTransformedPatterns, isShortPattern);
      emptyGroups = reduce_default(onlyRelevantTypes, (acc, clazz) => {
        const groupName = clazz.GROUP;
        if (isString_default(groupName) && !(groupName === Lexer2.SKIPPED)) {
          acc[groupName] = [];
        }
        return acc;
      }, {});
      patternIdxToConfig = map_default(allTransformedPatterns, (x5, idx) => {
        return {
          pattern: allTransformedPatterns[idx],
          longerAlt: patternIdxToLongerAltIdxArr[idx],
          canLineTerminator: patternIdxToCanLineTerminator[idx],
          isCustom: patternIdxToIsCustom[idx],
          short: patternIdxToShort[idx],
          group: patternIdxToGroup[idx],
          push: patternIdxToPushMode[idx],
          pop: patternIdxToPopMode[idx],
          tokenTypeIdx: patternIdxToType[idx],
          tokenType: onlyRelevantTypes[idx]
        };
      });
    });
    let canBeOptimized = true;
    let charCodeToPatternIdxToConfig = [];
    if (!options2.safeMode) {
      tracer("First Char Optimization", () => {
        charCodeToPatternIdxToConfig = reduce_default(onlyRelevantTypes, (result, currTokType, idx) => {
          if (typeof currTokType.PATTERN === "string") {
            const charCode = currTokType.PATTERN.charCodeAt(0);
            const optimizedIdx = charCodeToOptimizedIndex(charCode);
            addToMapOfArrays(result, optimizedIdx, patternIdxToConfig[idx]);
          } else if (isArray_default(currTokType.START_CHARS_HINT)) {
            let lastOptimizedIdx;
            forEach_default(currTokType.START_CHARS_HINT, (charOrInt) => {
              const charCode = typeof charOrInt === "string" ? charOrInt.charCodeAt(0) : charOrInt;
              const currOptimizedIdx = charCodeToOptimizedIndex(charCode);
              if (lastOptimizedIdx !== currOptimizedIdx) {
                lastOptimizedIdx = currOptimizedIdx;
                addToMapOfArrays(result, currOptimizedIdx, patternIdxToConfig[idx]);
              }
            });
          } else if (isRegExp_default(currTokType.PATTERN)) {
            if (currTokType.PATTERN.unicode) {
              canBeOptimized = false;
              if (options2.ensureOptimizations) {
                PRINT_ERROR(`${failedOptimizationPrefixMsg}	Unable to analyze < ${currTokType.PATTERN.toString()} > pattern.
	The regexp unicode flag is not currently supported by the regexp-to-ast library.
	This will disable the lexer's first char optimizations.
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);
              }
            } else {
              const optimizedCodes = getOptimizedStartCodesIndices(currTokType.PATTERN, options2.ensureOptimizations);
              if (isEmpty_default(optimizedCodes)) {
                canBeOptimized = false;
              }
              forEach_default(optimizedCodes, (code) => {
                addToMapOfArrays(result, code, patternIdxToConfig[idx]);
              });
            }
          } else {
            if (options2.ensureOptimizations) {
              PRINT_ERROR(`${failedOptimizationPrefixMsg}	TokenType: <${currTokType.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
	This will disable the lexer's first char optimizations.
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`);
            }
            canBeOptimized = false;
          }
          return result;
        }, []);
      });
    }
    return {
      emptyGroups,
      patternIdxToConfig,
      charCodeToPatternIdxToConfig,
      hasCustom,
      canBeOptimized
    };
  }
  function validatePatterns(tokenTypes, validModesNames) {
    let errors = [];
    const missingResult = findMissingPatterns(tokenTypes);
    errors = errors.concat(missingResult.errors);
    const invalidResult = findInvalidPatterns(missingResult.valid);
    const validTokenTypes = invalidResult.valid;
    errors = errors.concat(invalidResult.errors);
    errors = errors.concat(validateRegExpPattern(validTokenTypes));
    errors = errors.concat(findInvalidGroupType(validTokenTypes));
    errors = errors.concat(findModesThatDoNotExist(validTokenTypes, validModesNames));
    errors = errors.concat(findUnreachablePatterns(validTokenTypes));
    return errors;
  }
  function validateRegExpPattern(tokenTypes) {
    let errors = [];
    const withRegExpPatterns = filter_default3(tokenTypes, (currTokType) => isRegExp_default(currTokType[PATTERN]));
    errors = errors.concat(findEndOfInputAnchor(withRegExpPatterns));
    errors = errors.concat(findStartOfInputAnchor(withRegExpPatterns));
    errors = errors.concat(findUnsupportedFlags(withRegExpPatterns));
    errors = errors.concat(findDuplicatePatterns(withRegExpPatterns));
    errors = errors.concat(findEmptyMatchRegExps(withRegExpPatterns));
    return errors;
  }
  function findMissingPatterns(tokenTypes) {
    const tokenTypesWithMissingPattern = filter_default3(tokenTypes, (currType) => {
      return !has_default(currType, PATTERN);
    });
    const errors = map_default(tokenTypesWithMissingPattern, (currType) => {
      return {
        message: "Token Type: ->" + currType.name + "<- missing static 'PATTERN' property",
        type: LexerDefinitionErrorType.MISSING_PATTERN,
        tokenTypes: [currType]
      };
    });
    const valid2 = difference_default(tokenTypes, tokenTypesWithMissingPattern);
    return { errors, valid: valid2 };
  }
  function findInvalidPatterns(tokenTypes) {
    const tokenTypesWithInvalidPattern = filter_default3(tokenTypes, (currType) => {
      const pattern = currType[PATTERN];
      return !isRegExp_default(pattern) && !isFunction_default(pattern) && !has_default(pattern, "exec") && !isString_default(pattern);
    });
    const errors = map_default(tokenTypesWithInvalidPattern, (currType) => {
      return {
        message: "Token Type: ->" + currType.name + "<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",
        type: LexerDefinitionErrorType.INVALID_PATTERN,
        tokenTypes: [currType]
      };
    });
    const valid2 = difference_default(tokenTypes, tokenTypesWithInvalidPattern);
    return { errors, valid: valid2 };
  }
  function findEndOfInputAnchor(tokenTypes) {
    class EndAnchorFinder extends BaseRegExpVisitor {
      static {
        __name(this, "EndAnchorFinder");
      }
      constructor() {
        super(...arguments);
        this.found = false;
      }
      visitEndAnchor(node2) {
        this.found = true;
      }
    }
    const invalidRegex = filter_default3(tokenTypes, (currType) => {
      const pattern = currType.PATTERN;
      try {
        const regexpAst = getRegExpAst(pattern);
        const endAnchorVisitor = new EndAnchorFinder();
        endAnchorVisitor.visit(regexpAst);
        return endAnchorVisitor.found;
      } catch (e3) {
        return end_of_input.test(pattern.source);
      }
    });
    const errors = map_default(invalidRegex, (currType) => {
      return {
        message: "Unexpected RegExp Anchor Error:\n	Token Type: ->" + currType.name + "<- static 'PATTERN' cannot contain end of input anchor '$'\n	See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS	for details.",
        type: LexerDefinitionErrorType.EOI_ANCHOR_FOUND,
        tokenTypes: [currType]
      };
    });
    return errors;
  }
  function findEmptyMatchRegExps(tokenTypes) {
    const matchesEmptyString = filter_default3(tokenTypes, (currType) => {
      const pattern = currType.PATTERN;
      return pattern.test("");
    });
    const errors = map_default(matchesEmptyString, (currType) => {
      return {
        message: "Token Type: ->" + currType.name + "<- static 'PATTERN' must not match an empty string",
        type: LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,
        tokenTypes: [currType]
      };
    });
    return errors;
  }
  function findStartOfInputAnchor(tokenTypes) {
    class StartAnchorFinder extends BaseRegExpVisitor {
      static {
        __name(this, "StartAnchorFinder");
      }
      constructor() {
        super(...arguments);
        this.found = false;
      }
      visitStartAnchor(node2) {
        this.found = true;
      }
    }
    const invalidRegex = filter_default3(tokenTypes, (currType) => {
      const pattern = currType.PATTERN;
      try {
        const regexpAst = getRegExpAst(pattern);
        const startAnchorVisitor = new StartAnchorFinder();
        startAnchorVisitor.visit(regexpAst);
        return startAnchorVisitor.found;
      } catch (e3) {
        return start_of_input.test(pattern.source);
      }
    });
    const errors = map_default(invalidRegex, (currType) => {
      return {
        message: "Unexpected RegExp Anchor Error:\n	Token Type: ->" + currType.name + "<- static 'PATTERN' cannot contain start of input anchor '^'\n	See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS	for details.",
        type: LexerDefinitionErrorType.SOI_ANCHOR_FOUND,
        tokenTypes: [currType]
      };
    });
    return errors;
  }
  function findUnsupportedFlags(tokenTypes) {
    const invalidFlags = filter_default3(tokenTypes, (currType) => {
      const pattern = currType[PATTERN];
      return pattern instanceof RegExp && (pattern.multiline || pattern.global);
    });
    const errors = map_default(invalidFlags, (currType) => {
      return {
        message: "Token Type: ->" + currType.name + "<- static 'PATTERN' may NOT contain global('g') or multiline('m')",
        type: LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,
        tokenTypes: [currType]
      };
    });
    return errors;
  }
  function findDuplicatePatterns(tokenTypes) {
    const found = [];
    let identicalPatterns = map_default(tokenTypes, (outerType) => {
      return reduce_default(tokenTypes, (result, innerType) => {
        if (outerType.PATTERN.source === innerType.PATTERN.source && !includes_default(found, innerType) && innerType.PATTERN !== Lexer2.NA) {
          found.push(innerType);
          result.push(innerType);
          return result;
        }
        return result;
      }, []);
    });
    identicalPatterns = compact_default(identicalPatterns);
    const duplicatePatterns = filter_default3(identicalPatterns, (currIdenticalSet) => {
      return currIdenticalSet.length > 1;
    });
    const errors = map_default(duplicatePatterns, (setOfIdentical) => {
      const tokenTypeNames = map_default(setOfIdentical, (currType) => {
        return currType.name;
      });
      const dupPatternSrc = head_default(setOfIdentical).PATTERN;
      return {
        message: `The same RegExp pattern ->${dupPatternSrc}<-has been used in all of the following Token Types: ${tokenTypeNames.join(", ")} <-`,
        type: LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,
        tokenTypes: setOfIdentical
      };
    });
    return errors;
  }
  function findInvalidGroupType(tokenTypes) {
    const invalidTypes = filter_default3(tokenTypes, (clazz) => {
      if (!has_default(clazz, "GROUP")) {
        return false;
      }
      const group2 = clazz.GROUP;
      return group2 !== Lexer2.SKIPPED && group2 !== Lexer2.NA && !isString_default(group2);
    });
    const errors = map_default(invalidTypes, (currType) => {
      return {
        message: "Token Type: ->" + currType.name + "<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",
        type: LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,
        tokenTypes: [currType]
      };
    });
    return errors;
  }
  function findModesThatDoNotExist(tokenTypes, validModes) {
    const invalidModes = filter_default3(tokenTypes, (clazz) => {
      return clazz.PUSH_MODE !== void 0 && !includes_default(validModes, clazz.PUSH_MODE);
    });
    const errors = map_default(invalidModes, (tokType) => {
      const msg = `Token Type: ->${tokType.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${tokType.PUSH_MODE}<-which does not exist`;
      return {
        message: msg,
        type: LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,
        tokenTypes: [tokType]
      };
    });
    return errors;
  }
  function findUnreachablePatterns(tokenTypes) {
    const errors = [];
    const canBeTested = reduce_default(tokenTypes, (result, tokType, idx) => {
      const pattern = tokType.PATTERN;
      if (pattern === Lexer2.NA) {
        return result;
      }
      if (isString_default(pattern)) {
        result.push({ str: pattern, idx, tokenType: tokType });
      } else if (isRegExp_default(pattern) && noMetaChar(pattern)) {
        result.push({ str: pattern.source, idx, tokenType: tokType });
      }
      return result;
    }, []);
    forEach_default(tokenTypes, (aTokType, aIdx) => {
      forEach_default(canBeTested, ({ str: bStr, idx: bIdx, tokenType: bTokType }) => {
        if (aIdx < bIdx && tryToMatchStrToPattern(bStr, aTokType.PATTERN)) {
          const msg = `Token: ->${bTokType.name}<- can never be matched.
Because it appears AFTER the Token Type ->${aTokType.name}<-in the lexer's definition.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;
          errors.push({
            message: msg,
            type: LexerDefinitionErrorType.UNREACHABLE_PATTERN,
            tokenTypes: [aTokType, bTokType]
          });
        }
      });
    });
    return errors;
  }
  function tryToMatchStrToPattern(str2, pattern) {
    if (isRegExp_default(pattern)) {
      if (usesLookAheadOrBehind(pattern)) {
        return false;
      }
      const regExpArray = pattern.exec(str2);
      return regExpArray !== null && regExpArray.index === 0;
    } else if (isFunction_default(pattern)) {
      return pattern(str2, 0, [], {});
    } else if (has_default(pattern, "exec")) {
      return pattern.exec(str2, 0, [], {});
    } else if (typeof pattern === "string") {
      return pattern === str2;
    } else {
      throw Error("non exhaustive match");
    }
  }
  function noMetaChar(regExp) {
    const metaChars = [
      ".",
      "\\",
      "[",
      "]",
      "|",
      "^",
      "$",
      "(",
      ")",
      "?",
      "*",
      "+",
      "{"
    ];
    return find_default2(metaChars, (char2) => regExp.source.indexOf(char2) !== -1) === void 0;
  }
  function usesLookAheadOrBehind(regExp) {
    return /(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(regExp.source);
  }
  function addStartOfInput(pattern) {
    const flags = pattern.ignoreCase ? "i" : "";
    return new RegExp(`^(?:${pattern.source})`, flags);
  }
  function addStickyFlag(pattern) {
    const flags = pattern.ignoreCase ? "iy" : "y";
    return new RegExp(`${pattern.source}`, flags);
  }
  function performRuntimeChecks(lexerDefinition, trackLines, lineTerminatorCharacters) {
    const errors = [];
    if (!has_default(lexerDefinition, DEFAULT_MODE)) {
      errors.push({
        message: "A MultiMode Lexer cannot be initialized without a <" + DEFAULT_MODE + "> property in its definition\n",
        type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE
      });
    }
    if (!has_default(lexerDefinition, MODES)) {
      errors.push({
        message: "A MultiMode Lexer cannot be initialized without a <" + MODES + "> property in its definition\n",
        type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY
      });
    }
    if (has_default(lexerDefinition, MODES) && has_default(lexerDefinition, DEFAULT_MODE) && !has_default(lexerDefinition.modes, lexerDefinition.defaultMode)) {
      errors.push({
        message: `A MultiMode Lexer cannot be initialized with a ${DEFAULT_MODE}: <${lexerDefinition.defaultMode}>which does not exist
`,
        type: LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST
      });
    }
    if (has_default(lexerDefinition, MODES)) {
      forEach_default(lexerDefinition.modes, (currModeValue, currModeName) => {
        forEach_default(currModeValue, (currTokType, currIdx) => {
          if (isUndefined_default(currTokType)) {
            errors.push({
              message: `A Lexer cannot be initialized using an undefined Token Type. Mode:<${currModeName}> at index: <${currIdx}>
`,
              type: LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED
            });
          } else if (has_default(currTokType, "LONGER_ALT")) {
            const longerAlt = isArray_default(currTokType.LONGER_ALT) ? currTokType.LONGER_ALT : [currTokType.LONGER_ALT];
            forEach_default(longerAlt, (currLongerAlt) => {
              if (!isUndefined_default(currLongerAlt) && !includes_default(currModeValue, currLongerAlt)) {
                errors.push({
                  message: `A MultiMode Lexer cannot be initialized with a longer_alt <${currLongerAlt.name}> on token <${currTokType.name}> outside of mode <${currModeName}>
`,
                  type: LexerDefinitionErrorType.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE
                });
              }
            });
          }
        });
      });
    }
    return errors;
  }
  function performWarningRuntimeChecks(lexerDefinition, trackLines, lineTerminatorCharacters) {
    const warnings3 = [];
    let hasAnyLineBreak = false;
    const allTokenTypes = compact_default(flatten_default(values_default(lexerDefinition.modes)));
    const concreteTokenTypes = reject_default(allTokenTypes, (currType) => currType[PATTERN] === Lexer2.NA);
    const terminatorCharCodes = getCharCodes(lineTerminatorCharacters);
    if (trackLines) {
      forEach_default(concreteTokenTypes, (tokType) => {
        const currIssue = checkLineBreaksIssues(tokType, terminatorCharCodes);
        if (currIssue !== false) {
          const message = buildLineBreakIssueMessage(tokType, currIssue);
          const warningDescriptor = {
            message,
            type: currIssue.issue,
            tokenType: tokType
          };
          warnings3.push(warningDescriptor);
        } else {
          if (has_default(tokType, "LINE_BREAKS")) {
            if (tokType.LINE_BREAKS === true) {
              hasAnyLineBreak = true;
            }
          } else {
            if (canMatchCharCode(terminatorCharCodes, tokType.PATTERN)) {
              hasAnyLineBreak = true;
            }
          }
        }
      });
    }
    if (trackLines && !hasAnyLineBreak) {
      warnings3.push({
        message: "Warning: No LINE_BREAKS Found.\n	This Lexer has been defined to track line and column information,\n	But none of the Token Types can be identified as matching a line terminator.\n	See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n	for details.",
        type: LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS
      });
    }
    return warnings3;
  }
  function cloneEmptyGroups(emptyGroups) {
    const clonedResult = {};
    const groupKeys = keys_default(emptyGroups);
    forEach_default(groupKeys, (currKey) => {
      const currGroupValue = emptyGroups[currKey];
      if (isArray_default(currGroupValue)) {
        clonedResult[currKey] = [];
      } else {
        throw Error("non exhaustive match");
      }
    });
    return clonedResult;
  }
  function isCustomPattern(tokenType) {
    const pattern = tokenType.PATTERN;
    if (isRegExp_default(pattern)) {
      return false;
    } else if (isFunction_default(pattern)) {
      return true;
    } else if (has_default(pattern, "exec")) {
      return true;
    } else if (isString_default(pattern)) {
      return false;
    } else {
      throw Error("non exhaustive match");
    }
  }
  function isShortPattern(pattern) {
    if (isString_default(pattern) && pattern.length === 1) {
      return pattern.charCodeAt(0);
    } else {
      return false;
    }
  }
  function checkLineBreaksIssues(tokType, lineTerminatorCharCodes) {
    if (has_default(tokType, "LINE_BREAKS")) {
      return false;
    } else {
      if (isRegExp_default(tokType.PATTERN)) {
        try {
          canMatchCharCode(lineTerminatorCharCodes, tokType.PATTERN);
        } catch (e3) {
          return {
            issue: LexerDefinitionErrorType.IDENTIFY_TERMINATOR,
            errMsg: e3.message
          };
        }
        return false;
      } else if (isString_default(tokType.PATTERN)) {
        return false;
      } else if (isCustomPattern(tokType)) {
        return { issue: LexerDefinitionErrorType.CUSTOM_LINE_BREAK };
      } else {
        throw Error("non exhaustive match");
      }
    }
  }
  function buildLineBreakIssueMessage(tokType, details) {
    if (details.issue === LexerDefinitionErrorType.IDENTIFY_TERMINATOR) {
      return `Warning: unable to identify line terminator usage in pattern.
	The problem is in the <${tokType.name}> Token Type
	 Root cause: ${details.errMsg}.
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;
    } else if (details.issue === LexerDefinitionErrorType.CUSTOM_LINE_BREAK) {
      return `Warning: A Custom Token Pattern should specify the <line_breaks> option.
	The problem is in the <${tokType.name}> Token Type
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;
    } else {
      throw Error("non exhaustive match");
    }
  }
  function getCharCodes(charsOrCodes) {
    const charCodes = map_default(charsOrCodes, (numOrString) => {
      if (isString_default(numOrString)) {
        return numOrString.charCodeAt(0);
      } else {
        return numOrString;
      }
    });
    return charCodes;
  }
  function addToMapOfArrays(map5, key, value2) {
    if (map5[key] === void 0) {
      map5[key] = [value2];
    } else {
      map5[key].push(value2);
    }
  }
  function charCodeToOptimizedIndex(charCode) {
    return charCode < minOptimizationVal ? charCode : charCodeToOptimizedIdxMap[charCode];
  }
  function initCharCodeToOptimizedIndexMap() {
    if (isEmpty_default(charCodeToOptimizedIdxMap)) {
      charCodeToOptimizedIdxMap = new Array(65536);
      for (let i2 = 0; i2 < 65536; i2++) {
        charCodeToOptimizedIdxMap[i2] = i2 > 255 ? 255 + ~~(i2 / 255) : i2;
      }
    }
  }
  var PATTERN, DEFAULT_MODE, MODES, SUPPORT_STICKY, end_of_input, start_of_input, LineTerminatorOptimizedTester, minOptimizationVal, charCodeToOptimizedIdxMap;
  var init_lexer = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/lexer.js"() {
      "use strict";
      init_api();
      init_lexer_public();
      init_lodash();
      init_api2();
      init_reg_exp();
      init_reg_exp_parser();
      PATTERN = "PATTERN";
      DEFAULT_MODE = "defaultMode";
      MODES = "modes";
      SUPPORT_STICKY = typeof new RegExp("(?:)").sticky === "boolean";
      __name(analyzeTokenTypes, "analyzeTokenTypes");
      __name(validatePatterns, "validatePatterns");
      __name(validateRegExpPattern, "validateRegExpPattern");
      __name(findMissingPatterns, "findMissingPatterns");
      __name(findInvalidPatterns, "findInvalidPatterns");
      end_of_input = /[^\\][$]/;
      __name(findEndOfInputAnchor, "findEndOfInputAnchor");
      __name(findEmptyMatchRegExps, "findEmptyMatchRegExps");
      start_of_input = /[^\\[][\^]|^\^/;
      __name(findStartOfInputAnchor, "findStartOfInputAnchor");
      __name(findUnsupportedFlags, "findUnsupportedFlags");
      __name(findDuplicatePatterns, "findDuplicatePatterns");
      __name(findInvalidGroupType, "findInvalidGroupType");
      __name(findModesThatDoNotExist, "findModesThatDoNotExist");
      __name(findUnreachablePatterns, "findUnreachablePatterns");
      __name(tryToMatchStrToPattern, "tryToMatchStrToPattern");
      __name(noMetaChar, "noMetaChar");
      __name(usesLookAheadOrBehind, "usesLookAheadOrBehind");
      __name(addStartOfInput, "addStartOfInput");
      __name(addStickyFlag, "addStickyFlag");
      __name(performRuntimeChecks, "performRuntimeChecks");
      __name(performWarningRuntimeChecks, "performWarningRuntimeChecks");
      __name(cloneEmptyGroups, "cloneEmptyGroups");
      __name(isCustomPattern, "isCustomPattern");
      __name(isShortPattern, "isShortPattern");
      LineTerminatorOptimizedTester = {
        // implements /\n|\r\n?/g.test
        test: /* @__PURE__ */ __name(function(text4) {
          const len = text4.length;
          for (let i2 = this.lastIndex; i2 < len; i2++) {
            const c3 = text4.charCodeAt(i2);
            if (c3 === 10) {
              this.lastIndex = i2 + 1;
              return true;
            } else if (c3 === 13) {
              if (text4.charCodeAt(i2 + 1) === 10) {
                this.lastIndex = i2 + 2;
              } else {
                this.lastIndex = i2 + 1;
              }
              return true;
            }
          }
          return false;
        }, "test"),
        lastIndex: 0
      };
      __name(checkLineBreaksIssues, "checkLineBreaksIssues");
      __name(buildLineBreakIssueMessage, "buildLineBreakIssueMessage");
      __name(getCharCodes, "getCharCodes");
      __name(addToMapOfArrays, "addToMapOfArrays");
      minOptimizationVal = 256;
      charCodeToOptimizedIdxMap = [];
      __name(charCodeToOptimizedIndex, "charCodeToOptimizedIndex");
      __name(initCharCodeToOptimizedIndexMap, "initCharCodeToOptimizedIndexMap");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/tokens.js
  function tokenStructuredMatcher(tokInstance, tokConstructor) {
    const instanceType = tokInstance.tokenTypeIdx;
    if (instanceType === tokConstructor.tokenTypeIdx) {
      return true;
    } else {
      return tokConstructor.isParent === true && tokConstructor.categoryMatchesMap[instanceType] === true;
    }
  }
  function tokenStructuredMatcherNoCategories(token2, tokType) {
    return token2.tokenTypeIdx === tokType.tokenTypeIdx;
  }
  function augmentTokenTypes(tokenTypes) {
    const tokenTypesAndParents = expandCategories(tokenTypes);
    assignTokenDefaultProps(tokenTypesAndParents);
    assignCategoriesMapProp(tokenTypesAndParents);
    assignCategoriesTokensProp(tokenTypesAndParents);
    forEach_default(tokenTypesAndParents, (tokType) => {
      tokType.isParent = tokType.categoryMatches.length > 0;
    });
  }
  function expandCategories(tokenTypes) {
    let result = clone_default2(tokenTypes);
    let categories = tokenTypes;
    let searching = true;
    while (searching) {
      categories = compact_default(flatten_default(map_default(categories, (currTokType) => currTokType.CATEGORIES)));
      const newCategories = difference_default(categories, result);
      result = result.concat(newCategories);
      if (isEmpty_default(newCategories)) {
        searching = false;
      } else {
        categories = newCategories;
      }
    }
    return result;
  }
  function assignTokenDefaultProps(tokenTypes) {
    forEach_default(tokenTypes, (currTokType) => {
      if (!hasShortKeyProperty(currTokType)) {
        tokenIdxToClass[tokenShortNameIdx] = currTokType;
        currTokType.tokenTypeIdx = tokenShortNameIdx++;
      }
      if (hasCategoriesProperty(currTokType) && !isArray_default(currTokType.CATEGORIES)) {
        currTokType.CATEGORIES = [currTokType.CATEGORIES];
      }
      if (!hasCategoriesProperty(currTokType)) {
        currTokType.CATEGORIES = [];
      }
      if (!hasExtendingTokensTypesProperty(currTokType)) {
        currTokType.categoryMatches = [];
      }
      if (!hasExtendingTokensTypesMapProperty(currTokType)) {
        currTokType.categoryMatchesMap = {};
      }
    });
  }
  function assignCategoriesTokensProp(tokenTypes) {
    forEach_default(tokenTypes, (currTokType) => {
      currTokType.categoryMatches = [];
      forEach_default(currTokType.categoryMatchesMap, (val, key) => {
        currTokType.categoryMatches.push(tokenIdxToClass[key].tokenTypeIdx);
      });
    });
  }
  function assignCategoriesMapProp(tokenTypes) {
    forEach_default(tokenTypes, (currTokType) => {
      singleAssignCategoriesToksMap([], currTokType);
    });
  }
  function singleAssignCategoriesToksMap(path4, nextNode) {
    forEach_default(path4, (pathNode) => {
      nextNode.categoryMatchesMap[pathNode.tokenTypeIdx] = true;
    });
    forEach_default(nextNode.CATEGORIES, (nextCategory) => {
      const newPath = path4.concat(nextNode);
      if (!includes_default(newPath, nextCategory)) {
        singleAssignCategoriesToksMap(newPath, nextCategory);
      }
    });
  }
  function hasShortKeyProperty(tokType) {
    return has_default(tokType, "tokenTypeIdx");
  }
  function hasCategoriesProperty(tokType) {
    return has_default(tokType, "CATEGORIES");
  }
  function hasExtendingTokensTypesProperty(tokType) {
    return has_default(tokType, "categoryMatches");
  }
  function hasExtendingTokensTypesMapProperty(tokType) {
    return has_default(tokType, "categoryMatchesMap");
  }
  function isTokenType(tokType) {
    return has_default(tokType, "tokenTypeIdx");
  }
  var tokenShortNameIdx, tokenIdxToClass;
  var init_tokens = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/tokens.js"() {
      "use strict";
      init_lodash();
      __name(tokenStructuredMatcher, "tokenStructuredMatcher");
      __name(tokenStructuredMatcherNoCategories, "tokenStructuredMatcherNoCategories");
      tokenShortNameIdx = 1;
      tokenIdxToClass = {};
      __name(augmentTokenTypes, "augmentTokenTypes");
      __name(expandCategories, "expandCategories");
      __name(assignTokenDefaultProps, "assignTokenDefaultProps");
      __name(assignCategoriesTokensProp, "assignCategoriesTokensProp");
      __name(assignCategoriesMapProp, "assignCategoriesMapProp");
      __name(singleAssignCategoriesToksMap, "singleAssignCategoriesToksMap");
      __name(hasShortKeyProperty, "hasShortKeyProperty");
      __name(hasCategoriesProperty, "hasCategoriesProperty");
      __name(hasExtendingTokensTypesProperty, "hasExtendingTokensTypesProperty");
      __name(hasExtendingTokensTypesMapProperty, "hasExtendingTokensTypesMapProperty");
      __name(isTokenType, "isTokenType");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/lexer_errors_public.js
  var defaultLexerErrorProvider;
  var init_lexer_errors_public = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/lexer_errors_public.js"() {
      "use strict";
      defaultLexerErrorProvider = {
        buildUnableToPopLexerModeMessage(token2) {
          return `Unable to pop Lexer Mode after encountering Token ->${token2.image}<- The Mode Stack is empty`;
        },
        buildUnexpectedCharactersMessage(fullText, startOffset, length2, line2, column2, mode) {
          return `unexpected character: ->${fullText.charAt(startOffset)}<- at offset: ${startOffset}, skipped ${length2} characters.`;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/lexer_public.js
  var LexerDefinitionErrorType, DEFAULT_LEXER_CONFIG, Lexer2;
  var init_lexer_public = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/lexer_public.js"() {
      "use strict";
      init_lexer();
      init_lodash();
      init_api2();
      init_tokens();
      init_lexer_errors_public();
      init_reg_exp_parser();
      (function(LexerDefinitionErrorType2) {
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["MISSING_PATTERN"] = 0] = "MISSING_PATTERN";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["INVALID_PATTERN"] = 1] = "INVALID_PATTERN";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["EOI_ANCHOR_FOUND"] = 2] = "EOI_ANCHOR_FOUND";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["UNSUPPORTED_FLAGS_FOUND"] = 3] = "UNSUPPORTED_FLAGS_FOUND";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["DUPLICATE_PATTERNS_FOUND"] = 4] = "DUPLICATE_PATTERNS_FOUND";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["INVALID_GROUP_TYPE_FOUND"] = 5] = "INVALID_GROUP_TYPE_FOUND";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["PUSH_MODE_DOES_NOT_EXIST"] = 6] = "PUSH_MODE_DOES_NOT_EXIST";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE"] = 7] = "MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY"] = 8] = "MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST"] = 9] = "MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED"] = 10] = "LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["SOI_ANCHOR_FOUND"] = 11] = "SOI_ANCHOR_FOUND";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["EMPTY_MATCH_PATTERN"] = 12] = "EMPTY_MATCH_PATTERN";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["NO_LINE_BREAKS_FLAGS"] = 13] = "NO_LINE_BREAKS_FLAGS";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["UNREACHABLE_PATTERN"] = 14] = "UNREACHABLE_PATTERN";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["IDENTIFY_TERMINATOR"] = 15] = "IDENTIFY_TERMINATOR";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["CUSTOM_LINE_BREAK"] = 16] = "CUSTOM_LINE_BREAK";
        LexerDefinitionErrorType2[LexerDefinitionErrorType2["MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"] = 17] = "MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";
      })(LexerDefinitionErrorType || (LexerDefinitionErrorType = {}));
      DEFAULT_LEXER_CONFIG = {
        deferDefinitionErrorsHandling: false,
        positionTracking: "full",
        lineTerminatorsPattern: /\n|\r\n?/g,
        lineTerminatorCharacters: ["\n", "\r"],
        ensureOptimizations: false,
        safeMode: false,
        errorMessageProvider: defaultLexerErrorProvider,
        traceInitPerf: false,
        skipValidations: false,
        recoveryEnabled: true
      };
      Object.freeze(DEFAULT_LEXER_CONFIG);
      Lexer2 = class {
        static {
          __name(this, "Lexer");
        }
        constructor(lexerDefinition, config5 = DEFAULT_LEXER_CONFIG) {
          this.lexerDefinition = lexerDefinition;
          this.lexerDefinitionErrors = [];
          this.lexerDefinitionWarning = [];
          this.patternIdxToConfig = {};
          this.charCodeToPatternIdxToConfig = {};
          this.modes = [];
          this.emptyGroups = {};
          this.trackStartLines = true;
          this.trackEndLines = true;
          this.hasCustom = false;
          this.canModeBeOptimized = {};
          this.TRACE_INIT = (phaseDesc, phaseImpl) => {
            if (this.traceInitPerf === true) {
              this.traceInitIndent++;
              const indent = new Array(this.traceInitIndent + 1).join("	");
              if (this.traceInitIndent < this.traceInitMaxIdent) {
                console.log(`${indent}--> <${phaseDesc}>`);
              }
              const { time: time4, value: value2 } = timer2(phaseImpl);
              const traceMethod = time4 > 10 ? console.warn : console.log;
              if (this.traceInitIndent < this.traceInitMaxIdent) {
                traceMethod(`${indent}<-- <${phaseDesc}> time: ${time4}ms`);
              }
              this.traceInitIndent--;
              return value2;
            } else {
              return phaseImpl();
            }
          };
          if (typeof config5 === "boolean") {
            throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");
          }
          this.config = assign_default({}, DEFAULT_LEXER_CONFIG, config5);
          const traceInitVal = this.config.traceInitPerf;
          if (traceInitVal === true) {
            this.traceInitMaxIdent = Infinity;
            this.traceInitPerf = true;
          } else if (typeof traceInitVal === "number") {
            this.traceInitMaxIdent = traceInitVal;
            this.traceInitPerf = true;
          }
          this.traceInitIndent = -1;
          this.TRACE_INIT("Lexer Constructor", () => {
            let actualDefinition;
            let hasOnlySingleMode = true;
            this.TRACE_INIT("Lexer Config handling", () => {
              if (this.config.lineTerminatorsPattern === DEFAULT_LEXER_CONFIG.lineTerminatorsPattern) {
                this.config.lineTerminatorsPattern = LineTerminatorOptimizedTester;
              } else {
                if (this.config.lineTerminatorCharacters === DEFAULT_LEXER_CONFIG.lineTerminatorCharacters) {
                  throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");
                }
              }
              if (config5.safeMode && config5.ensureOptimizations) {
                throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');
              }
              this.trackStartLines = /full|onlyStart/i.test(this.config.positionTracking);
              this.trackEndLines = /full/i.test(this.config.positionTracking);
              if (isArray_default(lexerDefinition)) {
                actualDefinition = {
                  modes: { defaultMode: clone_default2(lexerDefinition) },
                  defaultMode: DEFAULT_MODE
                };
              } else {
                hasOnlySingleMode = false;
                actualDefinition = clone_default2(lexerDefinition);
              }
            });
            if (this.config.skipValidations === false) {
              this.TRACE_INIT("performRuntimeChecks", () => {
                this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(performRuntimeChecks(actualDefinition, this.trackStartLines, this.config.lineTerminatorCharacters));
              });
              this.TRACE_INIT("performWarningRuntimeChecks", () => {
                this.lexerDefinitionWarning = this.lexerDefinitionWarning.concat(performWarningRuntimeChecks(actualDefinition, this.trackStartLines, this.config.lineTerminatorCharacters));
              });
            }
            actualDefinition.modes = actualDefinition.modes ? actualDefinition.modes : {};
            forEach_default(actualDefinition.modes, (currModeValue, currModeName) => {
              actualDefinition.modes[currModeName] = reject_default(currModeValue, (currTokType) => isUndefined_default(currTokType));
            });
            const allModeNames = keys_default(actualDefinition.modes);
            forEach_default(actualDefinition.modes, (currModDef, currModName) => {
              this.TRACE_INIT(`Mode: <${currModName}> processing`, () => {
                this.modes.push(currModName);
                if (this.config.skipValidations === false) {
                  this.TRACE_INIT(`validatePatterns`, () => {
                    this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(validatePatterns(currModDef, allModeNames));
                  });
                }
                if (isEmpty_default(this.lexerDefinitionErrors)) {
                  augmentTokenTypes(currModDef);
                  let currAnalyzeResult;
                  this.TRACE_INIT(`analyzeTokenTypes`, () => {
                    currAnalyzeResult = analyzeTokenTypes(currModDef, {
                      lineTerminatorCharacters: this.config.lineTerminatorCharacters,
                      positionTracking: config5.positionTracking,
                      ensureOptimizations: config5.ensureOptimizations,
                      safeMode: config5.safeMode,
                      tracer: this.TRACE_INIT
                    });
                  });
                  this.patternIdxToConfig[currModName] = currAnalyzeResult.patternIdxToConfig;
                  this.charCodeToPatternIdxToConfig[currModName] = currAnalyzeResult.charCodeToPatternIdxToConfig;
                  this.emptyGroups = assign_default({}, this.emptyGroups, currAnalyzeResult.emptyGroups);
                  this.hasCustom = currAnalyzeResult.hasCustom || this.hasCustom;
                  this.canModeBeOptimized[currModName] = currAnalyzeResult.canBeOptimized;
                }
              });
            });
            this.defaultMode = actualDefinition.defaultMode;
            if (!isEmpty_default(this.lexerDefinitionErrors) && !this.config.deferDefinitionErrorsHandling) {
              const allErrMessages = map_default(this.lexerDefinitionErrors, (error3) => {
                return error3.message;
              });
              const allErrMessagesString = allErrMessages.join("-----------------------\n");
              throw new Error("Errors detected in definition of Lexer:\n" + allErrMessagesString);
            }
            forEach_default(this.lexerDefinitionWarning, (warningDescriptor) => {
              PRINT_WARNING(warningDescriptor.message);
            });
            this.TRACE_INIT("Choosing sub-methods implementations", () => {
              if (SUPPORT_STICKY) {
                this.chopInput = identity_default4;
                this.match = this.matchWithTest;
              } else {
                this.updateLastIndex = noop_default2;
                this.match = this.matchWithExec;
              }
              if (hasOnlySingleMode) {
                this.handleModes = noop_default2;
              }
              if (this.trackStartLines === false) {
                this.computeNewColumn = identity_default4;
              }
              if (this.trackEndLines === false) {
                this.updateTokenEndLineColumnLocation = noop_default2;
              }
              if (/full/i.test(this.config.positionTracking)) {
                this.createTokenInstance = this.createFullToken;
              } else if (/onlyStart/i.test(this.config.positionTracking)) {
                this.createTokenInstance = this.createStartOnlyToken;
              } else if (/onlyOffset/i.test(this.config.positionTracking)) {
                this.createTokenInstance = this.createOffsetOnlyToken;
              } else {
                throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);
              }
              if (this.hasCustom) {
                this.addToken = this.addTokenUsingPush;
                this.handlePayload = this.handlePayloadWithCustom;
              } else {
                this.addToken = this.addTokenUsingMemberAccess;
                this.handlePayload = this.handlePayloadNoCustom;
              }
            });
            this.TRACE_INIT("Failed Optimization Warnings", () => {
              const unOptimizedModes = reduce_default(this.canModeBeOptimized, (cannotBeOptimized, canBeOptimized, modeName) => {
                if (canBeOptimized === false) {
                  cannotBeOptimized.push(modeName);
                }
                return cannotBeOptimized;
              }, []);
              if (config5.ensureOptimizations && !isEmpty_default(unOptimizedModes)) {
                throw Error(`Lexer Modes: < ${unOptimizedModes.join(", ")} > cannot be optimized.
	 Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
	 Or inspect the console log for details on how to resolve these issues.`);
              }
            });
            this.TRACE_INIT("clearRegExpParserCache", () => {
              clearRegExpParserCache();
            });
            this.TRACE_INIT("toFastProperties", () => {
              toFastProperties(this);
            });
          });
        }
        tokenize(text4, initialMode = this.defaultMode) {
          if (!isEmpty_default(this.lexerDefinitionErrors)) {
            const allErrMessages = map_default(this.lexerDefinitionErrors, (error3) => {
              return error3.message;
            });
            const allErrMessagesString = allErrMessages.join("-----------------------\n");
            throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n" + allErrMessagesString);
          }
          return this.tokenizeInternal(text4, initialMode);
        }
        // There is quite a bit of duplication between this and "tokenizeInternalLazy"
        // This is intentional due to performance considerations.
        // this method also used quite a bit of `!` none null assertions because it is too optimized
        // for `tsc` to always understand it is "safe"
        tokenizeInternal(text4, initialMode) {
          let i2, j3, k2, matchAltImage, longerAlt, matchedImage, payload, altPayload, imageLength, group2, tokType, newToken, errLength, droppedChar, msg, match2;
          const orgText = text4;
          const orgLength = orgText.length;
          let offset = 0;
          let matchedTokensIndex = 0;
          const guessedNumberOfTokens = this.hasCustom ? 0 : Math.floor(text4.length / 10);
          const matchedTokens = new Array(guessedNumberOfTokens);
          const errors = [];
          let line2 = this.trackStartLines ? 1 : void 0;
          let column2 = this.trackStartLines ? 1 : void 0;
          const groups = cloneEmptyGroups(this.emptyGroups);
          const trackLines = this.trackStartLines;
          const lineTerminatorPattern = this.config.lineTerminatorsPattern;
          let currModePatternsLength = 0;
          let patternIdxToConfig = [];
          let currCharCodeToPatternIdxToConfig = [];
          const modeStack = [];
          const emptyArray = [];
          Object.freeze(emptyArray);
          let getPossiblePatterns;
          function getPossiblePatternsSlow() {
            return patternIdxToConfig;
          }
          __name(getPossiblePatternsSlow, "getPossiblePatternsSlow");
          function getPossiblePatternsOptimized(charCode) {
            const optimizedCharIdx = charCodeToOptimizedIndex(charCode);
            const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx];
            if (possiblePatterns === void 0) {
              return emptyArray;
            } else {
              return possiblePatterns;
            }
          }
          __name(getPossiblePatternsOptimized, "getPossiblePatternsOptimized");
          const pop_mode = /* @__PURE__ */ __name((popToken) => {
            if (modeStack.length === 1 && // if we have both a POP_MODE and a PUSH_MODE this is in-fact a "transition"
            // So no error should occur.
            popToken.tokenType.PUSH_MODE === void 0) {
              const msg2 = this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(popToken);
              errors.push({
                offset: popToken.startOffset,
                line: popToken.startLine,
                column: popToken.startColumn,
                length: popToken.image.length,
                message: msg2
              });
            } else {
              modeStack.pop();
              const newMode = last_default(modeStack);
              patternIdxToConfig = this.patternIdxToConfig[newMode];
              currCharCodeToPatternIdxToConfig = this.charCodeToPatternIdxToConfig[newMode];
              currModePatternsLength = patternIdxToConfig.length;
              const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false;
              if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {
                getPossiblePatterns = getPossiblePatternsOptimized;
              } else {
                getPossiblePatterns = getPossiblePatternsSlow;
              }
            }
          }, "pop_mode");
          function push_mode(newMode) {
            modeStack.push(newMode);
            currCharCodeToPatternIdxToConfig = this.charCodeToPatternIdxToConfig[newMode];
            patternIdxToConfig = this.patternIdxToConfig[newMode];
            currModePatternsLength = patternIdxToConfig.length;
            currModePatternsLength = patternIdxToConfig.length;
            const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false;
            if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {
              getPossiblePatterns = getPossiblePatternsOptimized;
            } else {
              getPossiblePatterns = getPossiblePatternsSlow;
            }
          }
          __name(push_mode, "push_mode");
          push_mode.call(this, initialMode);
          let currConfig;
          const recoveryEnabled = this.config.recoveryEnabled;
          while (offset < orgLength) {
            matchedImage = null;
            const nextCharCode = orgText.charCodeAt(offset);
            const chosenPatternIdxToConfig = getPossiblePatterns(nextCharCode);
            const chosenPatternsLength = chosenPatternIdxToConfig.length;
            for (i2 = 0; i2 < chosenPatternsLength; i2++) {
              currConfig = chosenPatternIdxToConfig[i2];
              const currPattern = currConfig.pattern;
              payload = null;
              const singleCharCode = currConfig.short;
              if (singleCharCode !== false) {
                if (nextCharCode === singleCharCode) {
                  matchedImage = currPattern;
                }
              } else if (currConfig.isCustom === true) {
                match2 = currPattern.exec(orgText, offset, matchedTokens, groups);
                if (match2 !== null) {
                  matchedImage = match2[0];
                  if (match2.payload !== void 0) {
                    payload = match2.payload;
                  }
                } else {
                  matchedImage = null;
                }
              } else {
                this.updateLastIndex(currPattern, offset);
                matchedImage = this.match(currPattern, text4, offset);
              }
              if (matchedImage !== null) {
                longerAlt = currConfig.longerAlt;
                if (longerAlt !== void 0) {
                  const longerAltLength = longerAlt.length;
                  for (k2 = 0; k2 < longerAltLength; k2++) {
                    const longerAltConfig = patternIdxToConfig[longerAlt[k2]];
                    const longerAltPattern = longerAltConfig.pattern;
                    altPayload = null;
                    if (longerAltConfig.isCustom === true) {
                      match2 = longerAltPattern.exec(orgText, offset, matchedTokens, groups);
                      if (match2 !== null) {
                        matchAltImage = match2[0];
                        if (match2.payload !== void 0) {
                          altPayload = match2.payload;
                        }
                      } else {
                        matchAltImage = null;
                      }
                    } else {
                      this.updateLastIndex(longerAltPattern, offset);
                      matchAltImage = this.match(longerAltPattern, text4, offset);
                    }
                    if (matchAltImage && matchAltImage.length > matchedImage.length) {
                      matchedImage = matchAltImage;
                      payload = altPayload;
                      currConfig = longerAltConfig;
                      break;
                    }
                  }
                }
                break;
              }
            }
            if (matchedImage !== null) {
              imageLength = matchedImage.length;
              group2 = currConfig.group;
              if (group2 !== void 0) {
                tokType = currConfig.tokenTypeIdx;
                newToken = this.createTokenInstance(matchedImage, offset, tokType, currConfig.tokenType, line2, column2, imageLength);
                this.handlePayload(newToken, payload);
                if (group2 === false) {
                  matchedTokensIndex = this.addToken(matchedTokens, matchedTokensIndex, newToken);
                } else {
                  groups[group2].push(newToken);
                }
              }
              text4 = this.chopInput(text4, imageLength);
              offset = offset + imageLength;
              column2 = this.computeNewColumn(column2, imageLength);
              if (trackLines === true && currConfig.canLineTerminator === true) {
                let numOfLTsInMatch = 0;
                let foundTerminator;
                let lastLTEndOffset;
                lineTerminatorPattern.lastIndex = 0;
                do {
                  foundTerminator = lineTerminatorPattern.test(matchedImage);
                  if (foundTerminator === true) {
                    lastLTEndOffset = lineTerminatorPattern.lastIndex - 1;
                    numOfLTsInMatch++;
                  }
                } while (foundTerminator === true);
                if (numOfLTsInMatch !== 0) {
                  line2 = line2 + numOfLTsInMatch;
                  column2 = imageLength - lastLTEndOffset;
                  this.updateTokenEndLineColumnLocation(newToken, group2, lastLTEndOffset, numOfLTsInMatch, line2, column2, imageLength);
                }
              }
              this.handleModes(currConfig, pop_mode, push_mode, newToken);
            } else {
              const errorStartOffset = offset;
              const errorLine = line2;
              const errorColumn = column2;
              let foundResyncPoint = recoveryEnabled === false;
              while (foundResyncPoint === false && offset < orgLength) {
                text4 = this.chopInput(text4, 1);
                offset++;
                for (j3 = 0; j3 < currModePatternsLength; j3++) {
                  const currConfig2 = patternIdxToConfig[j3];
                  const currPattern = currConfig2.pattern;
                  const singleCharCode = currConfig2.short;
                  if (singleCharCode !== false) {
                    if (orgText.charCodeAt(offset) === singleCharCode) {
                      foundResyncPoint = true;
                    }
                  } else if (currConfig2.isCustom === true) {
                    foundResyncPoint = currPattern.exec(orgText, offset, matchedTokens, groups) !== null;
                  } else {
                    this.updateLastIndex(currPattern, offset);
                    foundResyncPoint = currPattern.exec(text4) !== null;
                  }
                  if (foundResyncPoint === true) {
                    break;
                  }
                }
              }
              errLength = offset - errorStartOffset;
              column2 = this.computeNewColumn(column2, errLength);
              msg = this.config.errorMessageProvider.buildUnexpectedCharactersMessage(orgText, errorStartOffset, errLength, errorLine, errorColumn, last_default(modeStack));
              errors.push({
                offset: errorStartOffset,
                line: errorLine,
                column: errorColumn,
                length: errLength,
                message: msg
              });
              if (recoveryEnabled === false) {
                break;
              }
            }
          }
          if (!this.hasCustom) {
            matchedTokens.length = matchedTokensIndex;
          }
          return {
            tokens: matchedTokens,
            groups,
            errors
          };
        }
        handleModes(config5, pop_mode, push_mode, newToken) {
          if (config5.pop === true) {
            const pushMode = config5.push;
            pop_mode(newToken);
            if (pushMode !== void 0) {
              push_mode.call(this, pushMode);
            }
          } else if (config5.push !== void 0) {
            push_mode.call(this, config5.push);
          }
        }
        chopInput(text4, length2) {
          return text4.substring(length2);
        }
        updateLastIndex(regExp, newLastIndex) {
          regExp.lastIndex = newLastIndex;
        }
        // TODO: decrease this under 600 characters? inspect stripping comments option in TSC compiler
        updateTokenEndLineColumnLocation(newToken, group2, lastLTIdx, numOfLTsInMatch, line2, column2, imageLength) {
          let lastCharIsLT, fixForEndingInLT;
          if (group2 !== void 0) {
            lastCharIsLT = lastLTIdx === imageLength - 1;
            fixForEndingInLT = lastCharIsLT ? -1 : 0;
            if (!(numOfLTsInMatch === 1 && lastCharIsLT === true)) {
              newToken.endLine = line2 + fixForEndingInLT;
              newToken.endColumn = column2 - 1 + -fixForEndingInLT;
            }
          }
        }
        computeNewColumn(oldColumn, imageLength) {
          return oldColumn + imageLength;
        }
        createOffsetOnlyToken(image, startOffset, tokenTypeIdx, tokenType) {
          return {
            image,
            startOffset,
            tokenTypeIdx,
            tokenType
          };
        }
        createStartOnlyToken(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn) {
          return {
            image,
            startOffset,
            startLine,
            startColumn,
            tokenTypeIdx,
            tokenType
          };
        }
        createFullToken(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn, imageLength) {
          return {
            image,
            startOffset,
            endOffset: startOffset + imageLength - 1,
            startLine,
            endLine: startLine,
            startColumn,
            endColumn: startColumn + imageLength - 1,
            tokenTypeIdx,
            tokenType
          };
        }
        addTokenUsingPush(tokenVector, index, tokenToAdd) {
          tokenVector.push(tokenToAdd);
          return index;
        }
        addTokenUsingMemberAccess(tokenVector, index, tokenToAdd) {
          tokenVector[index] = tokenToAdd;
          index++;
          return index;
        }
        handlePayloadNoCustom(token2, payload) {
        }
        handlePayloadWithCustom(token2, payload) {
          if (payload !== null) {
            token2.payload = payload;
          }
        }
        matchWithTest(pattern, text4, offset) {
          const found = pattern.test(text4);
          if (found === true) {
            return text4.substring(offset, pattern.lastIndex);
          }
          return null;
        }
        matchWithExec(pattern, text4) {
          const regExpArray = pattern.exec(text4);
          return regExpArray !== null ? regExpArray[0] : null;
        }
      };
      Lexer2.SKIPPED = "This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";
      Lexer2.NA = /NOT_APPLICABLE/;
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/tokens_public.js
  function tokenLabel2(tokType) {
    if (hasTokenLabel2(tokType)) {
      return tokType.LABEL;
    } else {
      return tokType.name;
    }
  }
  function hasTokenLabel2(obj) {
    return isString_default(obj.LABEL) && obj.LABEL !== "";
  }
  function createToken(config5) {
    return createTokenInternal(config5);
  }
  function createTokenInternal(config5) {
    const pattern = config5.pattern;
    const tokenType = {};
    tokenType.name = config5.name;
    if (!isUndefined_default(pattern)) {
      tokenType.PATTERN = pattern;
    }
    if (has_default(config5, PARENT)) {
      throw "The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";
    }
    if (has_default(config5, CATEGORIES)) {
      tokenType.CATEGORIES = config5[CATEGORIES];
    }
    augmentTokenTypes([tokenType]);
    if (has_default(config5, LABEL)) {
      tokenType.LABEL = config5[LABEL];
    }
    if (has_default(config5, GROUP)) {
      tokenType.GROUP = config5[GROUP];
    }
    if (has_default(config5, POP_MODE)) {
      tokenType.POP_MODE = config5[POP_MODE];
    }
    if (has_default(config5, PUSH_MODE)) {
      tokenType.PUSH_MODE = config5[PUSH_MODE];
    }
    if (has_default(config5, LONGER_ALT)) {
      tokenType.LONGER_ALT = config5[LONGER_ALT];
    }
    if (has_default(config5, LINE_BREAKS)) {
      tokenType.LINE_BREAKS = config5[LINE_BREAKS];
    }
    if (has_default(config5, START_CHARS_HINT)) {
      tokenType.START_CHARS_HINT = config5[START_CHARS_HINT];
    }
    return tokenType;
  }
  function createTokenInstance(tokType, image, startOffset, endOffset, startLine, endLine, startColumn, endColumn) {
    return {
      image,
      startOffset,
      endOffset,
      startLine,
      endLine,
      startColumn,
      endColumn,
      tokenTypeIdx: tokType.tokenTypeIdx,
      tokenType: tokType
    };
  }
  function tokenMatcher(token2, tokType) {
    return tokenStructuredMatcher(token2, tokType);
  }
  var PARENT, CATEGORIES, LABEL, GROUP, PUSH_MODE, POP_MODE, LONGER_ALT, LINE_BREAKS, START_CHARS_HINT, EOF;
  var init_tokens_public = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/scan/tokens_public.js"() {
      "use strict";
      init_lodash();
      init_lexer_public();
      init_tokens();
      __name(tokenLabel2, "tokenLabel");
      __name(hasTokenLabel2, "hasTokenLabel");
      PARENT = "parent";
      CATEGORIES = "categories";
      LABEL = "label";
      GROUP = "group";
      PUSH_MODE = "push_mode";
      POP_MODE = "pop_mode";
      LONGER_ALT = "longer_alt";
      LINE_BREAKS = "line_breaks";
      START_CHARS_HINT = "start_chars_hint";
      __name(createToken, "createToken");
      __name(createTokenInternal, "createTokenInternal");
      EOF = createToken({ name: "EOF", pattern: Lexer2.NA });
      augmentTokenTypes([EOF]);
      __name(createTokenInstance, "createTokenInstance");
      __name(tokenMatcher, "tokenMatcher");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/errors_public.js
  var defaultParserErrorProvider, defaultGrammarResolverErrorProvider, defaultGrammarValidatorErrorProvider;
  var init_errors_public = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/errors_public.js"() {
      "use strict";
      init_tokens_public();
      init_lodash();
      init_api3();
      defaultParserErrorProvider = {
        buildMismatchTokenMessage({ expected, actual, previous, ruleName }) {
          const hasLabel = hasTokenLabel2(expected);
          const expectedMsg = hasLabel ? `--> ${tokenLabel2(expected)} <--` : `token of type --> ${expected.name} <--`;
          const msg = `Expecting ${expectedMsg} but found --> '${actual.image}' <--`;
          return msg;
        },
        buildNotAllInputParsedMessage({ firstRedundant, ruleName }) {
          return "Redundant input, expecting EOF but found: " + firstRedundant.image;
        },
        buildNoViableAltMessage({ expectedPathsPerAlt, actual, previous, customUserDescription, ruleName }) {
          const errPrefix = "Expecting: ";
          const actualText = head_default(actual).image;
          const errSuffix = "\nbut found: '" + actualText + "'";
          if (customUserDescription) {
            return errPrefix + customUserDescription + errSuffix;
          } else {
            const allLookAheadPaths = reduce_default(expectedPathsPerAlt, (result, currAltPaths) => result.concat(currAltPaths), []);
            const nextValidTokenSequences = map_default(allLookAheadPaths, (currPath) => `[${map_default(currPath, (currTokenType) => tokenLabel2(currTokenType)).join(", ")}]`);
            const nextValidSequenceItems = map_default(nextValidTokenSequences, (itemMsg, idx) => `  ${idx + 1}. ${itemMsg}`);
            const calculatedDescription = `one of these possible Token sequences:
${nextValidSequenceItems.join("\n")}`;
            return errPrefix + calculatedDescription + errSuffix;
          }
        },
        buildEarlyExitMessage({ expectedIterationPaths, actual, customUserDescription, ruleName }) {
          const errPrefix = "Expecting: ";
          const actualText = head_default(actual).image;
          const errSuffix = "\nbut found: '" + actualText + "'";
          if (customUserDescription) {
            return errPrefix + customUserDescription + errSuffix;
          } else {
            const nextValidTokenSequences = map_default(expectedIterationPaths, (currPath) => `[${map_default(currPath, (currTokenType) => tokenLabel2(currTokenType)).join(",")}]`);
            const calculatedDescription = `expecting at least one iteration which starts with one of these possible Token sequences::
  <${nextValidTokenSequences.join(" ,")}>`;
            return errPrefix + calculatedDescription + errSuffix;
          }
        }
      };
      Object.freeze(defaultParserErrorProvider);
      defaultGrammarResolverErrorProvider = {
        buildRuleNotFoundError(topLevelRule, undefinedRule) {
          const msg = "Invalid grammar, reference to a rule which is not defined: ->" + undefinedRule.nonTerminalName + "<-\ninside top level rule: ->" + topLevelRule.name + "<-";
          return msg;
        }
      };
      defaultGrammarValidatorErrorProvider = {
        buildDuplicateFoundError(topLevelRule, duplicateProds) {
          function getExtraProductionArgument2(prod) {
            if (prod instanceof Terminal) {
              return prod.terminalType.name;
            } else if (prod instanceof NonTerminal) {
              return prod.nonTerminalName;
            } else {
              return "";
            }
          }
          __name(getExtraProductionArgument2, "getExtraProductionArgument");
          const topLevelName = topLevelRule.name;
          const duplicateProd = head_default(duplicateProds);
          const index = duplicateProd.idx;
          const dslName = getProductionDslName(duplicateProd);
          const extraArgument = getExtraProductionArgument2(duplicateProd);
          const hasExplicitIndex = index > 0;
          let msg = `->${dslName}${hasExplicitIndex ? index : ""}<- ${extraArgument ? `with argument: ->${extraArgument}<-` : ""}
                  appears more than once (${duplicateProds.length} times) in the top level rule: ->${topLevelName}<-.                  
                  For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES 
                  `;
          msg = msg.replace(/[ \t]+/g, " ");
          msg = msg.replace(/\s\s+/g, "\n");
          return msg;
        },
        buildNamespaceConflictError(rule) {
          const errMsg = `Namespace conflict found in grammar.
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${rule.name}>.
To resolve this make sure each Terminal and Non-Terminal names are unique
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
and Non-Terminal names start with a lower case letter.`;
          return errMsg;
        },
        buildAlternationPrefixAmbiguityError(options2) {
          const pathMsg = map_default(options2.prefixPath, (currTok) => tokenLabel2(currTok)).join(", ");
          const occurrence = options2.alternation.idx === 0 ? "" : options2.alternation.idx;
          const errMsg = `Ambiguous alternatives: <${options2.ambiguityIndices.join(" ,")}> due to common lookahead prefix
in <OR${occurrence}> inside <${options2.topLevelRule.name}> Rule,
<${pathMsg}> may appears as a prefix path in all these alternatives.
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
For Further details.`;
          return errMsg;
        },
        buildAlternationAmbiguityError(options2) {
          const pathMsg = map_default(options2.prefixPath, (currtok) => tokenLabel2(currtok)).join(", ");
          const occurrence = options2.alternation.idx === 0 ? "" : options2.alternation.idx;
          let currMessage = `Ambiguous Alternatives Detected: <${options2.ambiguityIndices.join(" ,")}> in <OR${occurrence}> inside <${options2.topLevelRule.name}> Rule,
<${pathMsg}> may appears as a prefix path in all these alternatives.
`;
          currMessage = currMessage + `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`;
          return currMessage;
        },
        buildEmptyRepetitionError(options2) {
          let dslName = getProductionDslName(options2.repetition);
          if (options2.repetition.idx !== 0) {
            dslName += options2.repetition.idx;
          }
          const errMsg = `The repetition <${dslName}> within Rule <${options2.topLevelRule.name}> can never consume any tokens.
This could lead to an infinite loop.`;
          return errMsg;
        },
        // TODO: remove - `errors_public` from nyc.config.js exclude
        //       once this method is fully removed from this file
        buildTokenNameError(options2) {
          return "deprecated";
        },
        buildEmptyAlternationError(options2) {
          const errMsg = `Ambiguous empty alternative: <${options2.emptyChoiceIdx + 1}> in <OR${options2.alternation.idx}> inside <${options2.topLevelRule.name}> Rule.
Only the last alternative may be an empty alternative.`;
          return errMsg;
        },
        buildTooManyAlternativesError(options2) {
          const errMsg = `An Alternation cannot have more than 256 alternatives:
<OR${options2.alternation.idx}> inside <${options2.topLevelRule.name}> Rule.
 has ${options2.alternation.definition.length + 1} alternatives.`;
          return errMsg;
        },
        buildLeftRecursionError(options2) {
          const ruleName = options2.topLevelRule.name;
          const pathNames = map_default(options2.leftRecursionPath, (currRule) => currRule.name);
          const leftRecursivePath = `${ruleName} --> ${pathNames.concat([ruleName]).join(" --> ")}`;
          const errMsg = `Left Recursion found in grammar.
rule: <${ruleName}> can be invoked from itself (directly or indirectly)
without consuming any Tokens. The grammar path that causes this is: 
 ${leftRecursivePath}
 To fix this refactor your grammar to remove the left recursion.
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`;
          return errMsg;
        },
        // TODO: remove - `errors_public` from nyc.config.js exclude
        //       once this method is fully removed from this file
        buildInvalidRuleNameError(options2) {
          return "deprecated";
        },
        buildDuplicateRuleNameError(options2) {
          let ruleName;
          if (options2.topLevelRule instanceof Rule) {
            ruleName = options2.topLevelRule.name;
          } else {
            ruleName = options2.topLevelRule;
          }
          const errMsg = `Duplicate definition, rule: ->${ruleName}<- is already defined in the grammar: ->${options2.grammarName}<-`;
          return errMsg;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/resolver.js
  function resolveGrammar(topLevels, errMsgProvider) {
    const refResolver = new GastRefResolverVisitor(topLevels, errMsgProvider);
    refResolver.resolveRefs();
    return refResolver.errors;
  }
  var GastRefResolverVisitor;
  var init_resolver = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/resolver.js"() {
      "use strict";
      init_parser();
      init_lodash();
      init_api3();
      __name(resolveGrammar, "resolveGrammar");
      GastRefResolverVisitor = class extends GAstVisitor {
        static {
          __name(this, "GastRefResolverVisitor");
        }
        constructor(nameToTopRule, errMsgProvider) {
          super();
          this.nameToTopRule = nameToTopRule;
          this.errMsgProvider = errMsgProvider;
          this.errors = [];
        }
        resolveRefs() {
          forEach_default(values_default(this.nameToTopRule), (prod) => {
            this.currTopLevel = prod;
            prod.accept(this);
          });
        }
        visitNonTerminal(node2) {
          const ref = this.nameToTopRule[node2.nonTerminalName];
          if (!ref) {
            const msg = this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel, node2);
            this.errors.push({
              message: msg,
              type: ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,
              ruleName: this.currTopLevel.name,
              unresolvedRefName: node2.nonTerminalName
            });
          } else {
            node2.referencedRule = ref;
          }
        }
      };
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js
  function possiblePathsFrom(targetDef, maxLength, currPath = []) {
    currPath = clone_default2(currPath);
    let result = [];
    let i2 = 0;
    function remainingPathWith(nextDef) {
      return nextDef.concat(drop_default(targetDef, i2 + 1));
    }
    __name(remainingPathWith, "remainingPathWith");
    function getAlternativesForProd(definition) {
      const alternatives = possiblePathsFrom(remainingPathWith(definition), maxLength, currPath);
      return result.concat(alternatives);
    }
    __name(getAlternativesForProd, "getAlternativesForProd");
    while (currPath.length < maxLength && i2 < targetDef.length) {
      const prod = targetDef[i2];
      if (prod instanceof Alternative) {
        return getAlternativesForProd(prod.definition);
      } else if (prod instanceof NonTerminal) {
        return getAlternativesForProd(prod.definition);
      } else if (prod instanceof Option2) {
        result = getAlternativesForProd(prod.definition);
      } else if (prod instanceof RepetitionMandatory) {
        const newDef = prod.definition.concat([
          new Repetition({
            definition: prod.definition
          })
        ]);
        return getAlternativesForProd(newDef);
      } else if (prod instanceof RepetitionMandatoryWithSeparator) {
        const newDef = [
          new Alternative({ definition: prod.definition }),
          new Repetition({
            definition: [new Terminal({ terminalType: prod.separator })].concat(prod.definition)
          })
        ];
        return getAlternativesForProd(newDef);
      } else if (prod instanceof RepetitionWithSeparator) {
        const newDef = prod.definition.concat([
          new Repetition({
            definition: [new Terminal({ terminalType: prod.separator })].concat(prod.definition)
          })
        ]);
        result = getAlternativesForProd(newDef);
      } else if (prod instanceof Repetition) {
        const newDef = prod.definition.concat([
          new Repetition({
            definition: prod.definition
          })
        ]);
        result = getAlternativesForProd(newDef);
      } else if (prod instanceof Alternation) {
        forEach_default(prod.definition, (currAlt) => {
          if (isEmpty_default(currAlt.definition) === false) {
            result = getAlternativesForProd(currAlt.definition);
          }
        });
        return result;
      } else if (prod instanceof Terminal) {
        currPath.push(prod.terminalType);
      } else {
        throw Error("non exhaustive match");
      }
      i2++;
    }
    result.push({
      partialPath: currPath,
      suffixDef: drop_default(targetDef, i2)
    });
    return result;
  }
  function nextPossibleTokensAfter(initialDef, tokenVector, tokMatcher, maxLookAhead) {
    const EXIT_NON_TERMINAL = "EXIT_NONE_TERMINAL";
    const EXIT_NON_TERMINAL_ARR = [EXIT_NON_TERMINAL];
    const EXIT_ALTERNATIVE = "EXIT_ALTERNATIVE";
    let foundCompletePath = false;
    const tokenVectorLength = tokenVector.length;
    const minimalAlternativesIndex = tokenVectorLength - maxLookAhead - 1;
    const result = [];
    const possiblePaths = [];
    possiblePaths.push({
      idx: -1,
      def: initialDef,
      ruleStack: [],
      occurrenceStack: []
    });
    while (!isEmpty_default(possiblePaths)) {
      const currPath = possiblePaths.pop();
      if (currPath === EXIT_ALTERNATIVE) {
        if (foundCompletePath && last_default(possiblePaths).idx <= minimalAlternativesIndex) {
          possiblePaths.pop();
        }
        continue;
      }
      const currDef = currPath.def;
      const currIdx = currPath.idx;
      const currRuleStack = currPath.ruleStack;
      const currOccurrenceStack = currPath.occurrenceStack;
      if (isEmpty_default(currDef)) {
        continue;
      }
      const prod = currDef[0];
      if (prod === EXIT_NON_TERMINAL) {
        const nextPath = {
          idx: currIdx,
          def: drop_default(currDef),
          ruleStack: dropRight_default(currRuleStack),
          occurrenceStack: dropRight_default(currOccurrenceStack)
        };
        possiblePaths.push(nextPath);
      } else if (prod instanceof Terminal) {
        if (currIdx < tokenVectorLength - 1) {
          const nextIdx = currIdx + 1;
          const actualToken = tokenVector[nextIdx];
          if (tokMatcher(actualToken, prod.terminalType)) {
            const nextPath = {
              idx: nextIdx,
              def: drop_default(currDef),
              ruleStack: currRuleStack,
              occurrenceStack: currOccurrenceStack
            };
            possiblePaths.push(nextPath);
          }
        } else if (currIdx === tokenVectorLength - 1) {
          result.push({
            nextTokenType: prod.terminalType,
            nextTokenOccurrence: prod.idx,
            ruleStack: currRuleStack,
            occurrenceStack: currOccurrenceStack
          });
          foundCompletePath = true;
        } else {
          throw Error("non exhaustive match");
        }
      } else if (prod instanceof NonTerminal) {
        const newRuleStack = clone_default2(currRuleStack);
        newRuleStack.push(prod.nonTerminalName);
        const newOccurrenceStack = clone_default2(currOccurrenceStack);
        newOccurrenceStack.push(prod.idx);
        const nextPath = {
          idx: currIdx,
          def: prod.definition.concat(EXIT_NON_TERMINAL_ARR, drop_default(currDef)),
          ruleStack: newRuleStack,
          occurrenceStack: newOccurrenceStack
        };
        possiblePaths.push(nextPath);
      } else if (prod instanceof Option2) {
        const nextPathWithout = {
          idx: currIdx,
          def: drop_default(currDef),
          ruleStack: currRuleStack,
          occurrenceStack: currOccurrenceStack
        };
        possiblePaths.push(nextPathWithout);
        possiblePaths.push(EXIT_ALTERNATIVE);
        const nextPathWith = {
          idx: currIdx,
          def: prod.definition.concat(drop_default(currDef)),
          ruleStack: currRuleStack,
          occurrenceStack: currOccurrenceStack
        };
        possiblePaths.push(nextPathWith);
      } else if (prod instanceof RepetitionMandatory) {
        const secondIteration = new Repetition({
          definition: prod.definition,
          idx: prod.idx
        });
        const nextDef = prod.definition.concat([secondIteration], drop_default(currDef));
        const nextPath = {
          idx: currIdx,
          def: nextDef,
          ruleStack: currRuleStack,
          occurrenceStack: currOccurrenceStack
        };
        possiblePaths.push(nextPath);
      } else if (prod instanceof RepetitionMandatoryWithSeparator) {
        const separatorGast = new Terminal({
          terminalType: prod.separator
        });
        const secondIteration = new Repetition({
          definition: [separatorGast].concat(prod.definition),
          idx: prod.idx
        });
        const nextDef = prod.definition.concat([secondIteration], drop_default(currDef));
        const nextPath = {
          idx: currIdx,
          def: nextDef,
          ruleStack: currRuleStack,
          occurrenceStack: currOccurrenceStack
        };
        possiblePaths.push(nextPath);
      } else if (prod instanceof RepetitionWithSeparator) {
        const nextPathWithout = {
          idx: currIdx,
          def: drop_default(currDef),
          ruleStack: currRuleStack,
          occurrenceStack: currOccurrenceStack
        };
        possiblePaths.push(nextPathWithout);
        possiblePaths.push(EXIT_ALTERNATIVE);
        const separatorGast = new Terminal({
          terminalType: prod.separator
        });
        const nthRepetition = new Repetition({
          definition: [separatorGast].concat(prod.definition),
          idx: prod.idx
        });
        const nextDef = prod.definition.concat([nthRepetition], drop_default(currDef));
        const nextPathWith = {
          idx: currIdx,
          def: nextDef,
          ruleStack: currRuleStack,
          occurrenceStack: currOccurrenceStack
        };
        possiblePaths.push(nextPathWith);
      } else if (prod instanceof Repetition) {
        const nextPathWithout = {
          idx: currIdx,
          def: drop_default(currDef),
          ruleStack: currRuleStack,
          occurrenceStack: currOccurrenceStack
        };
        possiblePaths.push(nextPathWithout);
        possiblePaths.push(EXIT_ALTERNATIVE);
        const nthRepetition = new Repetition({
          definition: prod.definition,
          idx: prod.idx
        });
        const nextDef = prod.definition.concat([nthRepetition], drop_default(currDef));
        const nextPathWith = {
          idx: currIdx,
          def: nextDef,
          ruleStack: currRuleStack,
          occurrenceStack: currOccurrenceStack
        };
        possiblePaths.push(nextPathWith);
      } else if (prod instanceof Alternation) {
        for (let i2 = prod.definition.length - 1; i2 >= 0; i2--) {
          const currAlt = prod.definition[i2];
          const currAltPath = {
            idx: currIdx,
            def: currAlt.definition.concat(drop_default(currDef)),
            ruleStack: currRuleStack,
            occurrenceStack: currOccurrenceStack
          };
          possiblePaths.push(currAltPath);
          possiblePaths.push(EXIT_ALTERNATIVE);
        }
      } else if (prod instanceof Alternative) {
        possiblePaths.push({
          idx: currIdx,
          def: prod.definition.concat(drop_default(currDef)),
          ruleStack: currRuleStack,
          occurrenceStack: currOccurrenceStack
        });
      } else if (prod instanceof Rule) {
        possiblePaths.push(expandTopLevelRule(prod, currIdx, currRuleStack, currOccurrenceStack));
      } else {
        throw Error("non exhaustive match");
      }
    }
    return result;
  }
  function expandTopLevelRule(topRule, currIdx, currRuleStack, currOccurrenceStack) {
    const newRuleStack = clone_default2(currRuleStack);
    newRuleStack.push(topRule.name);
    const newCurrOccurrenceStack = clone_default2(currOccurrenceStack);
    newCurrOccurrenceStack.push(1);
    return {
      idx: currIdx,
      def: topRule.definition,
      ruleStack: newRuleStack,
      occurrenceStack: newCurrOccurrenceStack
    };
  }
  var AbstractNextPossibleTokensWalker, NextAfterTokenWalker, AbstractNextTerminalAfterProductionWalker, NextTerminalAfterManyWalker, NextTerminalAfterManySepWalker, NextTerminalAfterAtLeastOneWalker, NextTerminalAfterAtLeastOneSepWalker;
  var init_interpreter = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js"() {
      "use strict";
      init_lodash();
      init_first2();
      init_rest();
      init_api3();
      AbstractNextPossibleTokensWalker = class extends RestWalker {
        static {
          __name(this, "AbstractNextPossibleTokensWalker");
        }
        constructor(topProd, path4) {
          super();
          this.topProd = topProd;
          this.path = path4;
          this.possibleTokTypes = [];
          this.nextProductionName = "";
          this.nextProductionOccurrence = 0;
          this.found = false;
          this.isAtEndOfPath = false;
        }
        startWalking() {
          this.found = false;
          if (this.path.ruleStack[0] !== this.topProd.name) {
            throw Error("The path does not start with the walker's top Rule!");
          }
          this.ruleStack = clone_default2(this.path.ruleStack).reverse();
          this.occurrenceStack = clone_default2(this.path.occurrenceStack).reverse();
          this.ruleStack.pop();
          this.occurrenceStack.pop();
          this.updateExpectedNext();
          this.walk(this.topProd);
          return this.possibleTokTypes;
        }
        walk(prod, prevRest = []) {
          if (!this.found) {
            super.walk(prod, prevRest);
          }
        }
        walkProdRef(refProd, currRest, prevRest) {
          if (refProd.referencedRule.name === this.nextProductionName && refProd.idx === this.nextProductionOccurrence) {
            const fullRest = currRest.concat(prevRest);
            this.updateExpectedNext();
            this.walk(refProd.referencedRule, fullRest);
          }
        }
        updateExpectedNext() {
          if (isEmpty_default(this.ruleStack)) {
            this.nextProductionName = "";
            this.nextProductionOccurrence = 0;
            this.isAtEndOfPath = true;
          } else {
            this.nextProductionName = this.ruleStack.pop();
            this.nextProductionOccurrence = this.occurrenceStack.pop();
          }
        }
      };
      NextAfterTokenWalker = class extends AbstractNextPossibleTokensWalker {
        static {
          __name(this, "NextAfterTokenWalker");
        }
        constructor(topProd, path4) {
          super(topProd, path4);
          this.path = path4;
          this.nextTerminalName = "";
          this.nextTerminalOccurrence = 0;
          this.nextTerminalName = this.path.lastTok.name;
          this.nextTerminalOccurrence = this.path.lastTokOccurrence;
        }
        walkTerminal(terminal, currRest, prevRest) {
          if (this.isAtEndOfPath && terminal.terminalType.name === this.nextTerminalName && terminal.idx === this.nextTerminalOccurrence && !this.found) {
            const fullRest = currRest.concat(prevRest);
            const restProd = new Alternative({ definition: fullRest });
            this.possibleTokTypes = first2(restProd);
            this.found = true;
          }
        }
      };
      AbstractNextTerminalAfterProductionWalker = class extends RestWalker {
        static {
          __name(this, "AbstractNextTerminalAfterProductionWalker");
        }
        constructor(topRule, occurrence) {
          super();
          this.topRule = topRule;
          this.occurrence = occurrence;
          this.result = {
            token: void 0,
            occurrence: void 0,
            isEndOfRule: void 0
          };
        }
        startWalking() {
          this.walk(this.topRule);
          return this.result;
        }
      };
      NextTerminalAfterManyWalker = class extends AbstractNextTerminalAfterProductionWalker {
        static {
          __name(this, "NextTerminalAfterManyWalker");
        }
        walkMany(manyProd, currRest, prevRest) {
          if (manyProd.idx === this.occurrence) {
            const firstAfterMany = head_default(currRest.concat(prevRest));
            this.result.isEndOfRule = firstAfterMany === void 0;
            if (firstAfterMany instanceof Terminal) {
              this.result.token = firstAfterMany.terminalType;
              this.result.occurrence = firstAfterMany.idx;
            }
          } else {
            super.walkMany(manyProd, currRest, prevRest);
          }
        }
      };
      NextTerminalAfterManySepWalker = class extends AbstractNextTerminalAfterProductionWalker {
        static {
          __name(this, "NextTerminalAfterManySepWalker");
        }
        walkManySep(manySepProd, currRest, prevRest) {
          if (manySepProd.idx === this.occurrence) {
            const firstAfterManySep = head_default(currRest.concat(prevRest));
            this.result.isEndOfRule = firstAfterManySep === void 0;
            if (firstAfterManySep instanceof Terminal) {
              this.result.token = firstAfterManySep.terminalType;
              this.result.occurrence = firstAfterManySep.idx;
            }
          } else {
            super.walkManySep(manySepProd, currRest, prevRest);
          }
        }
      };
      NextTerminalAfterAtLeastOneWalker = class extends AbstractNextTerminalAfterProductionWalker {
        static {
          __name(this, "NextTerminalAfterAtLeastOneWalker");
        }
        walkAtLeastOne(atLeastOneProd, currRest, prevRest) {
          if (atLeastOneProd.idx === this.occurrence) {
            const firstAfterAtLeastOne = head_default(currRest.concat(prevRest));
            this.result.isEndOfRule = firstAfterAtLeastOne === void 0;
            if (firstAfterAtLeastOne instanceof Terminal) {
              this.result.token = firstAfterAtLeastOne.terminalType;
              this.result.occurrence = firstAfterAtLeastOne.idx;
            }
          } else {
            super.walkAtLeastOne(atLeastOneProd, currRest, prevRest);
          }
        }
      };
      NextTerminalAfterAtLeastOneSepWalker = class extends AbstractNextTerminalAfterProductionWalker {
        static {
          __name(this, "NextTerminalAfterAtLeastOneSepWalker");
        }
        walkAtLeastOneSep(atleastOneSepProd, currRest, prevRest) {
          if (atleastOneSepProd.idx === this.occurrence) {
            const firstAfterfirstAfterAtLeastOneSep = head_default(currRest.concat(prevRest));
            this.result.isEndOfRule = firstAfterfirstAfterAtLeastOneSep === void 0;
            if (firstAfterfirstAfterAtLeastOneSep instanceof Terminal) {
              this.result.token = firstAfterfirstAfterAtLeastOneSep.terminalType;
              this.result.occurrence = firstAfterfirstAfterAtLeastOneSep.idx;
            }
          } else {
            super.walkAtLeastOneSep(atleastOneSepProd, currRest, prevRest);
          }
        }
      };
      __name(possiblePathsFrom, "possiblePathsFrom");
      __name(nextPossibleTokensAfter, "nextPossibleTokensAfter");
      __name(expandTopLevelRule, "expandTopLevelRule");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js
  function getProdType(prod) {
    if (prod instanceof Option2 || prod === "Option") {
      return PROD_TYPE.OPTION;
    } else if (prod instanceof Repetition || prod === "Repetition") {
      return PROD_TYPE.REPETITION;
    } else if (prod instanceof RepetitionMandatory || prod === "RepetitionMandatory") {
      return PROD_TYPE.REPETITION_MANDATORY;
    } else if (prod instanceof RepetitionMandatoryWithSeparator || prod === "RepetitionMandatoryWithSeparator") {
      return PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR;
    } else if (prod instanceof RepetitionWithSeparator || prod === "RepetitionWithSeparator") {
      return PROD_TYPE.REPETITION_WITH_SEPARATOR;
    } else if (prod instanceof Alternation || prod === "Alternation") {
      return PROD_TYPE.ALTERNATION;
    } else {
      throw Error("non exhaustive match");
    }
  }
  function getLookaheadPaths(options2) {
    const { occurrence, rule, prodType, maxLookahead } = options2;
    const type3 = getProdType(prodType);
    if (type3 === PROD_TYPE.ALTERNATION) {
      return getLookaheadPathsForOr(occurrence, rule, maxLookahead);
    } else {
      return getLookaheadPathsForOptionalProd(occurrence, rule, type3, maxLookahead);
    }
  }
  function buildLookaheadFuncForOr(occurrence, ruleGrammar, maxLookahead, hasPredicates, dynamicTokensEnabled, laFuncBuilder) {
    const lookAheadPaths = getLookaheadPathsForOr(occurrence, ruleGrammar, maxLookahead);
    const tokenMatcher2 = areTokenCategoriesNotUsed(lookAheadPaths) ? tokenStructuredMatcherNoCategories : tokenStructuredMatcher;
    return laFuncBuilder(lookAheadPaths, hasPredicates, tokenMatcher2, dynamicTokensEnabled);
  }
  function buildLookaheadFuncForOptionalProd(occurrence, ruleGrammar, k2, dynamicTokensEnabled, prodType, lookaheadBuilder) {
    const lookAheadPaths = getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k2);
    const tokenMatcher2 = areTokenCategoriesNotUsed(lookAheadPaths) ? tokenStructuredMatcherNoCategories : tokenStructuredMatcher;
    return lookaheadBuilder(lookAheadPaths[0], tokenMatcher2, dynamicTokensEnabled);
  }
  function buildAlternativesLookAheadFunc(alts, hasPredicates, tokenMatcher2, dynamicTokensEnabled) {
    const numOfAlts = alts.length;
    const areAllOneTokenLookahead = every_default(alts, (currAlt) => {
      return every_default(currAlt, (currPath) => {
        return currPath.length === 1;
      });
    });
    if (hasPredicates) {
      return function(orAlts) {
        const predicates = map_default(orAlts, (currAlt) => currAlt.GATE);
        for (let t4 = 0; t4 < numOfAlts; t4++) {
          const currAlt = alts[t4];
          const currNumOfPaths = currAlt.length;
          const currPredicate = predicates[t4];
          if (currPredicate !== void 0 && currPredicate.call(this) === false) {
            continue;
          }
          nextPath: for (let j3 = 0; j3 < currNumOfPaths; j3++) {
            const currPath = currAlt[j3];
            const currPathLength = currPath.length;
            for (let i2 = 0; i2 < currPathLength; i2++) {
              const nextToken = this.LA(i2 + 1);
              if (tokenMatcher2(nextToken, currPath[i2]) === false) {
                continue nextPath;
              }
            }
            return t4;
          }
        }
        return void 0;
      };
    } else if (areAllOneTokenLookahead && !dynamicTokensEnabled) {
      const singleTokenAlts = map_default(alts, (currAlt) => {
        return flatten_default(currAlt);
      });
      const choiceToAlt = reduce_default(singleTokenAlts, (result, currAlt, idx) => {
        forEach_default(currAlt, (currTokType) => {
          if (!has_default(result, currTokType.tokenTypeIdx)) {
            result[currTokType.tokenTypeIdx] = idx;
          }
          forEach_default(currTokType.categoryMatches, (currExtendingType) => {
            if (!has_default(result, currExtendingType)) {
              result[currExtendingType] = idx;
            }
          });
        });
        return result;
      }, {});
      return function() {
        const nextToken = this.LA(1);
        return choiceToAlt[nextToken.tokenTypeIdx];
      };
    } else {
      return function() {
        for (let t4 = 0; t4 < numOfAlts; t4++) {
          const currAlt = alts[t4];
          const currNumOfPaths = currAlt.length;
          nextPath: for (let j3 = 0; j3 < currNumOfPaths; j3++) {
            const currPath = currAlt[j3];
            const currPathLength = currPath.length;
            for (let i2 = 0; i2 < currPathLength; i2++) {
              const nextToken = this.LA(i2 + 1);
              if (tokenMatcher2(nextToken, currPath[i2]) === false) {
                continue nextPath;
              }
            }
            return t4;
          }
        }
        return void 0;
      };
    }
  }
  function buildSingleAlternativeLookaheadFunction(alt, tokenMatcher2, dynamicTokensEnabled) {
    const areAllOneTokenLookahead = every_default(alt, (currPath) => {
      return currPath.length === 1;
    });
    const numOfPaths = alt.length;
    if (areAllOneTokenLookahead && !dynamicTokensEnabled) {
      const singleTokensTypes = flatten_default(alt);
      if (singleTokensTypes.length === 1 && isEmpty_default(singleTokensTypes[0].categoryMatches)) {
        const expectedTokenType = singleTokensTypes[0];
        const expectedTokenUniqueKey = expectedTokenType.tokenTypeIdx;
        return function() {
          return this.LA(1).tokenTypeIdx === expectedTokenUniqueKey;
        };
      } else {
        const choiceToAlt = reduce_default(singleTokensTypes, (result, currTokType, idx) => {
          result[currTokType.tokenTypeIdx] = true;
          forEach_default(currTokType.categoryMatches, (currExtendingType) => {
            result[currExtendingType] = true;
          });
          return result;
        }, []);
        return function() {
          const nextToken = this.LA(1);
          return choiceToAlt[nextToken.tokenTypeIdx] === true;
        };
      }
    } else {
      return function() {
        nextPath: for (let j3 = 0; j3 < numOfPaths; j3++) {
          const currPath = alt[j3];
          const currPathLength = currPath.length;
          for (let i2 = 0; i2 < currPathLength; i2++) {
            const nextToken = this.LA(i2 + 1);
            if (tokenMatcher2(nextToken, currPath[i2]) === false) {
              continue nextPath;
            }
          }
          return true;
        }
        return false;
      };
    }
  }
  function initializeArrayOfArrays(size4) {
    const result = new Array(size4);
    for (let i2 = 0; i2 < size4; i2++) {
      result[i2] = [];
    }
    return result;
  }
  function pathToHashKeys(path4) {
    let keys2 = [""];
    for (let i2 = 0; i2 < path4.length; i2++) {
      const tokType = path4[i2];
      const longerKeys = [];
      for (let j3 = 0; j3 < keys2.length; j3++) {
        const currShorterKey = keys2[j3];
        longerKeys.push(currShorterKey + "_" + tokType.tokenTypeIdx);
        for (let t4 = 0; t4 < tokType.categoryMatches.length; t4++) {
          const categoriesKeySuffix = "_" + tokType.categoryMatches[t4];
          longerKeys.push(currShorterKey + categoriesKeySuffix);
        }
      }
      keys2 = longerKeys;
    }
    return keys2;
  }
  function isUniquePrefixHash(altKnownPathsKeys, searchPathKeys, idx) {
    for (let currAltIdx = 0; currAltIdx < altKnownPathsKeys.length; currAltIdx++) {
      if (currAltIdx === idx) {
        continue;
      }
      const otherAltKnownPathsKeys = altKnownPathsKeys[currAltIdx];
      for (let searchIdx = 0; searchIdx < searchPathKeys.length; searchIdx++) {
        const searchKey = searchPathKeys[searchIdx];
        if (otherAltKnownPathsKeys[searchKey] === true) {
          return false;
        }
      }
    }
    return true;
  }
  function lookAheadSequenceFromAlternatives(altsDefs, k2) {
    const partialAlts = map_default(altsDefs, (currAlt) => possiblePathsFrom([currAlt], 1));
    const finalResult = initializeArrayOfArrays(partialAlts.length);
    const altsHashes = map_default(partialAlts, (currAltPaths) => {
      const dict = {};
      forEach_default(currAltPaths, (item) => {
        const keys2 = pathToHashKeys(item.partialPath);
        forEach_default(keys2, (currKey) => {
          dict[currKey] = true;
        });
      });
      return dict;
    });
    let newData = partialAlts;
    for (let pathLength = 1; pathLength <= k2; pathLength++) {
      const currDataset = newData;
      newData = initializeArrayOfArrays(currDataset.length);
      for (let altIdx = 0; altIdx < currDataset.length; altIdx++) {
        const currAltPathsAndSuffixes = currDataset[altIdx];
        for (let currPathIdx = 0; currPathIdx < currAltPathsAndSuffixes.length; currPathIdx++) {
          const currPathPrefix = currAltPathsAndSuffixes[currPathIdx].partialPath;
          const suffixDef = currAltPathsAndSuffixes[currPathIdx].suffixDef;
          const prefixKeys = pathToHashKeys(currPathPrefix);
          const isUnique = isUniquePrefixHash(altsHashes, prefixKeys, altIdx);
          if (isUnique || isEmpty_default(suffixDef) || currPathPrefix.length === k2) {
            const currAltResult = finalResult[altIdx];
            if (containsPath(currAltResult, currPathPrefix) === false) {
              currAltResult.push(currPathPrefix);
              for (let j3 = 0; j3 < prefixKeys.length; j3++) {
                const currKey = prefixKeys[j3];
                altsHashes[altIdx][currKey] = true;
              }
            }
          } else {
            const newPartialPathsAndSuffixes = possiblePathsFrom(suffixDef, pathLength + 1, currPathPrefix);
            newData[altIdx] = newData[altIdx].concat(newPartialPathsAndSuffixes);
            forEach_default(newPartialPathsAndSuffixes, (item) => {
              const prefixKeys2 = pathToHashKeys(item.partialPath);
              forEach_default(prefixKeys2, (key) => {
                altsHashes[altIdx][key] = true;
              });
            });
          }
        }
      }
    }
    return finalResult;
  }
  function getLookaheadPathsForOr(occurrence, ruleGrammar, k2, orProd) {
    const visitor2 = new InsideDefinitionFinderVisitor(occurrence, PROD_TYPE.ALTERNATION, orProd);
    ruleGrammar.accept(visitor2);
    return lookAheadSequenceFromAlternatives(visitor2.result, k2);
  }
  function getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k2) {
    const insideDefVisitor = new InsideDefinitionFinderVisitor(occurrence, prodType);
    ruleGrammar.accept(insideDefVisitor);
    const insideDef = insideDefVisitor.result;
    const afterDefWalker = new RestDefinitionFinderWalker(ruleGrammar, occurrence, prodType);
    const afterDef = afterDefWalker.startWalking();
    const insideFlat = new Alternative({ definition: insideDef });
    const afterFlat = new Alternative({ definition: afterDef });
    return lookAheadSequenceFromAlternatives([insideFlat, afterFlat], k2);
  }
  function containsPath(alternative, searchPath) {
    compareOtherPath: for (let i2 = 0; i2 < alternative.length; i2++) {
      const otherPath = alternative[i2];
      if (otherPath.length !== searchPath.length) {
        continue;
      }
      for (let j3 = 0; j3 < otherPath.length; j3++) {
        const searchTok = searchPath[j3];
        const otherTok = otherPath[j3];
        const matchingTokens = searchTok === otherTok || otherTok.categoryMatchesMap[searchTok.tokenTypeIdx] !== void 0;
        if (matchingTokens === false) {
          continue compareOtherPath;
        }
      }
      return true;
    }
    return false;
  }
  function isStrictPrefixOfPath(prefix, other) {
    return prefix.length < other.length && every_default(prefix, (tokType, idx) => {
      const otherTokType = other[idx];
      return tokType === otherTokType || otherTokType.categoryMatchesMap[tokType.tokenTypeIdx];
    });
  }
  function areTokenCategoriesNotUsed(lookAheadPaths) {
    return every_default(lookAheadPaths, (singleAltPaths) => every_default(singleAltPaths, (singlePath) => every_default(singlePath, (token2) => isEmpty_default(token2.categoryMatches))));
  }
  var PROD_TYPE, RestDefinitionFinderWalker, InsideDefinitionFinderVisitor;
  var init_lookahead = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js"() {
      "use strict";
      init_lodash();
      init_interpreter();
      init_rest();
      init_tokens();
      init_api3();
      (function(PROD_TYPE2) {
        PROD_TYPE2[PROD_TYPE2["OPTION"] = 0] = "OPTION";
        PROD_TYPE2[PROD_TYPE2["REPETITION"] = 1] = "REPETITION";
        PROD_TYPE2[PROD_TYPE2["REPETITION_MANDATORY"] = 2] = "REPETITION_MANDATORY";
        PROD_TYPE2[PROD_TYPE2["REPETITION_MANDATORY_WITH_SEPARATOR"] = 3] = "REPETITION_MANDATORY_WITH_SEPARATOR";
        PROD_TYPE2[PROD_TYPE2["REPETITION_WITH_SEPARATOR"] = 4] = "REPETITION_WITH_SEPARATOR";
        PROD_TYPE2[PROD_TYPE2["ALTERNATION"] = 5] = "ALTERNATION";
      })(PROD_TYPE || (PROD_TYPE = {}));
      __name(getProdType, "getProdType");
      __name(getLookaheadPaths, "getLookaheadPaths");
      __name(buildLookaheadFuncForOr, "buildLookaheadFuncForOr");
      __name(buildLookaheadFuncForOptionalProd, "buildLookaheadFuncForOptionalProd");
      __name(buildAlternativesLookAheadFunc, "buildAlternativesLookAheadFunc");
      __name(buildSingleAlternativeLookaheadFunction, "buildSingleAlternativeLookaheadFunction");
      RestDefinitionFinderWalker = class extends RestWalker {
        static {
          __name(this, "RestDefinitionFinderWalker");
        }
        constructor(topProd, targetOccurrence, targetProdType) {
          super();
          this.topProd = topProd;
          this.targetOccurrence = targetOccurrence;
          this.targetProdType = targetProdType;
        }
        startWalking() {
          this.walk(this.topProd);
          return this.restDef;
        }
        checkIsTarget(node2, expectedProdType, currRest, prevRest) {
          if (node2.idx === this.targetOccurrence && this.targetProdType === expectedProdType) {
            this.restDef = currRest.concat(prevRest);
            return true;
          }
          return false;
        }
        walkOption(optionProd, currRest, prevRest) {
          if (!this.checkIsTarget(optionProd, PROD_TYPE.OPTION, currRest, prevRest)) {
            super.walkOption(optionProd, currRest, prevRest);
          }
        }
        walkAtLeastOne(atLeastOneProd, currRest, prevRest) {
          if (!this.checkIsTarget(atLeastOneProd, PROD_TYPE.REPETITION_MANDATORY, currRest, prevRest)) {
            super.walkOption(atLeastOneProd, currRest, prevRest);
          }
        }
        walkAtLeastOneSep(atLeastOneSepProd, currRest, prevRest) {
          if (!this.checkIsTarget(atLeastOneSepProd, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, currRest, prevRest)) {
            super.walkOption(atLeastOneSepProd, currRest, prevRest);
          }
        }
        walkMany(manyProd, currRest, prevRest) {
          if (!this.checkIsTarget(manyProd, PROD_TYPE.REPETITION, currRest, prevRest)) {
            super.walkOption(manyProd, currRest, prevRest);
          }
        }
        walkManySep(manySepProd, currRest, prevRest) {
          if (!this.checkIsTarget(manySepProd, PROD_TYPE.REPETITION_WITH_SEPARATOR, currRest, prevRest)) {
            super.walkOption(manySepProd, currRest, prevRest);
          }
        }
      };
      InsideDefinitionFinderVisitor = class extends GAstVisitor {
        static {
          __name(this, "InsideDefinitionFinderVisitor");
        }
        constructor(targetOccurrence, targetProdType, targetRef) {
          super();
          this.targetOccurrence = targetOccurrence;
          this.targetProdType = targetProdType;
          this.targetRef = targetRef;
          this.result = [];
        }
        checkIsTarget(node2, expectedProdName) {
          if (node2.idx === this.targetOccurrence && this.targetProdType === expectedProdName && (this.targetRef === void 0 || node2 === this.targetRef)) {
            this.result = node2.definition;
          }
        }
        visitOption(node2) {
          this.checkIsTarget(node2, PROD_TYPE.OPTION);
        }
        visitRepetition(node2) {
          this.checkIsTarget(node2, PROD_TYPE.REPETITION);
        }
        visitRepetitionMandatory(node2) {
          this.checkIsTarget(node2, PROD_TYPE.REPETITION_MANDATORY);
        }
        visitRepetitionMandatoryWithSeparator(node2) {
          this.checkIsTarget(node2, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR);
        }
        visitRepetitionWithSeparator(node2) {
          this.checkIsTarget(node2, PROD_TYPE.REPETITION_WITH_SEPARATOR);
        }
        visitAlternation(node2) {
          this.checkIsTarget(node2, PROD_TYPE.ALTERNATION);
        }
      };
      __name(initializeArrayOfArrays, "initializeArrayOfArrays");
      __name(pathToHashKeys, "pathToHashKeys");
      __name(isUniquePrefixHash, "isUniquePrefixHash");
      __name(lookAheadSequenceFromAlternatives, "lookAheadSequenceFromAlternatives");
      __name(getLookaheadPathsForOr, "getLookaheadPathsForOr");
      __name(getLookaheadPathsForOptionalProd, "getLookaheadPathsForOptionalProd");
      __name(containsPath, "containsPath");
      __name(isStrictPrefixOfPath, "isStrictPrefixOfPath");
      __name(areTokenCategoriesNotUsed, "areTokenCategoriesNotUsed");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/checks.js
  function validateLookahead(options2) {
    const lookaheadValidationErrorMessages = options2.lookaheadStrategy.validate({
      rules: options2.rules,
      tokenTypes: options2.tokenTypes,
      grammarName: options2.grammarName
    });
    return map_default(lookaheadValidationErrorMessages, (errorMessage) => Object.assign({ type: ParserDefinitionErrorType.CUSTOM_LOOKAHEAD_VALIDATION }, errorMessage));
  }
  function validateGrammar(topLevels, tokenTypes, errMsgProvider, grammarName) {
    const duplicateErrors = flatMap_default(topLevels, (currTopLevel) => validateDuplicateProductions(currTopLevel, errMsgProvider));
    const termsNamespaceConflictErrors = checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider);
    const tooManyAltsErrors = flatMap_default(topLevels, (curRule) => validateTooManyAlts(curRule, errMsgProvider));
    const duplicateRulesError = flatMap_default(topLevels, (curRule) => validateRuleDoesNotAlreadyExist(curRule, topLevels, grammarName, errMsgProvider));
    return duplicateErrors.concat(termsNamespaceConflictErrors, tooManyAltsErrors, duplicateRulesError);
  }
  function validateDuplicateProductions(topLevelRule, errMsgProvider) {
    const collectorVisitor2 = new OccurrenceValidationCollector();
    topLevelRule.accept(collectorVisitor2);
    const allRuleProductions = collectorVisitor2.allProductions;
    const productionGroups = groupBy_default(allRuleProductions, identifyProductionForDuplicates);
    const duplicates = pickBy_default(productionGroups, (currGroup) => {
      return currGroup.length > 1;
    });
    const errors = map_default(values_default(duplicates), (currDuplicates) => {
      const firstProd = head_default(currDuplicates);
      const msg = errMsgProvider.buildDuplicateFoundError(topLevelRule, currDuplicates);
      const dslName = getProductionDslName(firstProd);
      const defError = {
        message: msg,
        type: ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,
        ruleName: topLevelRule.name,
        dslName,
        occurrence: firstProd.idx
      };
      const param = getExtraProductionArgument(firstProd);
      if (param) {
        defError.parameter = param;
      }
      return defError;
    });
    return errors;
  }
  function identifyProductionForDuplicates(prod) {
    return `${getProductionDslName(prod)}_#_${prod.idx}_#_${getExtraProductionArgument(prod)}`;
  }
  function getExtraProductionArgument(prod) {
    if (prod instanceof Terminal) {
      return prod.terminalType.name;
    } else if (prod instanceof NonTerminal) {
      return prod.nonTerminalName;
    } else {
      return "";
    }
  }
  function validateRuleDoesNotAlreadyExist(rule, allRules, className, errMsgProvider) {
    const errors = [];
    const occurrences = reduce_default(allRules, (result, curRule) => {
      if (curRule.name === rule.name) {
        return result + 1;
      }
      return result;
    }, 0);
    if (occurrences > 1) {
      const errMsg = errMsgProvider.buildDuplicateRuleNameError({
        topLevelRule: rule,
        grammarName: className
      });
      errors.push({
        message: errMsg,
        type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME,
        ruleName: rule.name
      });
    }
    return errors;
  }
  function validateRuleIsOverridden(ruleName, definedRulesNames, className) {
    const errors = [];
    let errMsg;
    if (!includes_default(definedRulesNames, ruleName)) {
      errMsg = `Invalid rule override, rule: ->${ruleName}<- cannot be overridden in the grammar: ->${className}<-as it is not defined in any of the super grammars `;
      errors.push({
        message: errMsg,
        type: ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,
        ruleName
      });
    }
    return errors;
  }
  function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path4 = []) {
    const errors = [];
    const nextNonTerminals = getFirstNoneTerminal(currRule.definition);
    if (isEmpty_default(nextNonTerminals)) {
      return [];
    } else {
      const ruleName = topRule.name;
      const foundLeftRecursion = includes_default(nextNonTerminals, topRule);
      if (foundLeftRecursion) {
        errors.push({
          message: errMsgProvider.buildLeftRecursionError({
            topLevelRule: topRule,
            leftRecursionPath: path4
          }),
          type: ParserDefinitionErrorType.LEFT_RECURSION,
          ruleName
        });
      }
      const validNextSteps = difference_default(nextNonTerminals, path4.concat([topRule]));
      const errorsFromNextSteps = flatMap_default(validNextSteps, (currRefRule) => {
        const newPath = clone_default2(path4);
        newPath.push(currRefRule);
        return validateNoLeftRecursion(topRule, currRefRule, errMsgProvider, newPath);
      });
      return errors.concat(errorsFromNextSteps);
    }
  }
  function getFirstNoneTerminal(definition) {
    let result = [];
    if (isEmpty_default(definition)) {
      return result;
    }
    const firstProd = head_default(definition);
    if (firstProd instanceof NonTerminal) {
      result.push(firstProd.referencedRule);
    } else if (firstProd instanceof Alternative || firstProd instanceof Option2 || firstProd instanceof RepetitionMandatory || firstProd instanceof RepetitionMandatoryWithSeparator || firstProd instanceof RepetitionWithSeparator || firstProd instanceof Repetition) {
      result = result.concat(getFirstNoneTerminal(firstProd.definition));
    } else if (firstProd instanceof Alternation) {
      result = flatten_default(map_default(firstProd.definition, (currSubDef) => getFirstNoneTerminal(currSubDef.definition)));
    } else if (firstProd instanceof Terminal) {
    } else {
      throw Error("non exhaustive match");
    }
    const isFirstOptional = isOptionalProd(firstProd);
    const hasMore = definition.length > 1;
    if (isFirstOptional && hasMore) {
      const rest = drop_default(definition);
      return result.concat(getFirstNoneTerminal(rest));
    } else {
      return result;
    }
  }
  function validateEmptyOrAlternative(topLevelRule, errMsgProvider) {
    const orCollector = new OrCollector();
    topLevelRule.accept(orCollector);
    const ors = orCollector.alternations;
    const errors = flatMap_default(ors, (currOr) => {
      const exceptLast = dropRight_default(currOr.definition);
      return flatMap_default(exceptLast, (currAlternative, currAltIdx) => {
        const possibleFirstInAlt = nextPossibleTokensAfter([currAlternative], [], tokenStructuredMatcher, 1);
        if (isEmpty_default(possibleFirstInAlt)) {
          return [
            {
              message: errMsgProvider.buildEmptyAlternationError({
                topLevelRule,
                alternation: currOr,
                emptyChoiceIdx: currAltIdx
              }),
              type: ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,
              ruleName: topLevelRule.name,
              occurrence: currOr.idx,
              alternative: currAltIdx + 1
            }
          ];
        } else {
          return [];
        }
      });
    });
    return errors;
  }
  function validateAmbiguousAlternationAlternatives(topLevelRule, globalMaxLookahead, errMsgProvider) {
    const orCollector = new OrCollector();
    topLevelRule.accept(orCollector);
    let ors = orCollector.alternations;
    ors = reject_default(ors, (currOr) => currOr.ignoreAmbiguities === true);
    const errors = flatMap_default(ors, (currOr) => {
      const currOccurrence = currOr.idx;
      const actualMaxLookahead = currOr.maxLookahead || globalMaxLookahead;
      const alternatives = getLookaheadPathsForOr(currOccurrence, topLevelRule, actualMaxLookahead, currOr);
      const altsAmbiguityErrors = checkAlternativesAmbiguities(alternatives, currOr, topLevelRule, errMsgProvider);
      const altsPrefixAmbiguityErrors = checkPrefixAlternativesAmbiguities(alternatives, currOr, topLevelRule, errMsgProvider);
      return altsAmbiguityErrors.concat(altsPrefixAmbiguityErrors);
    });
    return errors;
  }
  function validateTooManyAlts(topLevelRule, errMsgProvider) {
    const orCollector = new OrCollector();
    topLevelRule.accept(orCollector);
    const ors = orCollector.alternations;
    const errors = flatMap_default(ors, (currOr) => {
      if (currOr.definition.length > 255) {
        return [
          {
            message: errMsgProvider.buildTooManyAlternativesError({
              topLevelRule,
              alternation: currOr
            }),
            type: ParserDefinitionErrorType.TOO_MANY_ALTS,
            ruleName: topLevelRule.name,
            occurrence: currOr.idx
          }
        ];
      } else {
        return [];
      }
    });
    return errors;
  }
  function validateSomeNonEmptyLookaheadPath(topLevelRules, maxLookahead, errMsgProvider) {
    const errors = [];
    forEach_default(topLevelRules, (currTopRule) => {
      const collectorVisitor2 = new RepetitionCollector();
      currTopRule.accept(collectorVisitor2);
      const allRuleProductions = collectorVisitor2.allProductions;
      forEach_default(allRuleProductions, (currProd) => {
        const prodType = getProdType(currProd);
        const actualMaxLookahead = currProd.maxLookahead || maxLookahead;
        const currOccurrence = currProd.idx;
        const paths = getLookaheadPathsForOptionalProd(currOccurrence, currTopRule, prodType, actualMaxLookahead);
        const pathsInsideProduction = paths[0];
        if (isEmpty_default(flatten_default(pathsInsideProduction))) {
          const errMsg = errMsgProvider.buildEmptyRepetitionError({
            topLevelRule: currTopRule,
            repetition: currProd
          });
          errors.push({
            message: errMsg,
            type: ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,
            ruleName: currTopRule.name
          });
        }
      });
    });
    return errors;
  }
  function checkAlternativesAmbiguities(alternatives, alternation2, rule, errMsgProvider) {
    const foundAmbiguousPaths = [];
    const identicalAmbiguities = reduce_default(alternatives, (result, currAlt, currAltIdx) => {
      if (alternation2.definition[currAltIdx].ignoreAmbiguities === true) {
        return result;
      }
      forEach_default(currAlt, (currPath) => {
        const altsCurrPathAppearsIn = [currAltIdx];
        forEach_default(alternatives, (currOtherAlt, currOtherAltIdx) => {
          if (currAltIdx !== currOtherAltIdx && containsPath(currOtherAlt, currPath) && // ignore (skip) ambiguities with this "other" alternative
          alternation2.definition[currOtherAltIdx].ignoreAmbiguities !== true) {
            altsCurrPathAppearsIn.push(currOtherAltIdx);
          }
        });
        if (altsCurrPathAppearsIn.length > 1 && !containsPath(foundAmbiguousPaths, currPath)) {
          foundAmbiguousPaths.push(currPath);
          result.push({
            alts: altsCurrPathAppearsIn,
            path: currPath
          });
        }
      });
      return result;
    }, []);
    const currErrors = map_default(identicalAmbiguities, (currAmbDescriptor) => {
      const ambgIndices = map_default(currAmbDescriptor.alts, (currAltIdx) => currAltIdx + 1);
      const currMessage = errMsgProvider.buildAlternationAmbiguityError({
        topLevelRule: rule,
        alternation: alternation2,
        ambiguityIndices: ambgIndices,
        prefixPath: currAmbDescriptor.path
      });
      return {
        message: currMessage,
        type: ParserDefinitionErrorType.AMBIGUOUS_ALTS,
        ruleName: rule.name,
        occurrence: alternation2.idx,
        alternatives: currAmbDescriptor.alts
      };
    });
    return currErrors;
  }
  function checkPrefixAlternativesAmbiguities(alternatives, alternation2, rule, errMsgProvider) {
    const pathsAndIndices = reduce_default(alternatives, (result, currAlt, idx) => {
      const currPathsAndIdx = map_default(currAlt, (currPath) => {
        return { idx, path: currPath };
      });
      return result.concat(currPathsAndIdx);
    }, []);
    const errors = compact_default(flatMap_default(pathsAndIndices, (currPathAndIdx) => {
      const alternativeGast = alternation2.definition[currPathAndIdx.idx];
      if (alternativeGast.ignoreAmbiguities === true) {
        return [];
      }
      const targetIdx = currPathAndIdx.idx;
      const targetPath = currPathAndIdx.path;
      const prefixAmbiguitiesPathsAndIndices = filter_default3(pathsAndIndices, (searchPathAndIdx) => {
        return (
          // ignore (skip) ambiguities with this "other" alternative
          alternation2.definition[searchPathAndIdx.idx].ignoreAmbiguities !== true && searchPathAndIdx.idx < targetIdx && // checking for strict prefix because identical lookaheads
          // will be be detected using a different validation.
          isStrictPrefixOfPath(searchPathAndIdx.path, targetPath)
        );
      });
      const currPathPrefixErrors = map_default(prefixAmbiguitiesPathsAndIndices, (currAmbPathAndIdx) => {
        const ambgIndices = [currAmbPathAndIdx.idx + 1, targetIdx + 1];
        const occurrence = alternation2.idx === 0 ? "" : alternation2.idx;
        const message = errMsgProvider.buildAlternationPrefixAmbiguityError({
          topLevelRule: rule,
          alternation: alternation2,
          ambiguityIndices: ambgIndices,
          prefixPath: currAmbPathAndIdx.path
        });
        return {
          message,
          type: ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,
          ruleName: rule.name,
          occurrence,
          alternatives: ambgIndices
        };
      });
      return currPathPrefixErrors;
    }));
    return errors;
  }
  function checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider) {
    const errors = [];
    const tokenNames = map_default(tokenTypes, (currToken) => currToken.name);
    forEach_default(topLevels, (currRule) => {
      const currRuleName = currRule.name;
      if (includes_default(tokenNames, currRuleName)) {
        const errMsg = errMsgProvider.buildNamespaceConflictError(currRule);
        errors.push({
          message: errMsg,
          type: ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,
          ruleName: currRuleName
        });
      }
    });
    return errors;
  }
  var OccurrenceValidationCollector, OrCollector, RepetitionCollector;
  var init_checks = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/checks.js"() {
      "use strict";
      init_lodash();
      init_parser();
      init_api3();
      init_lookahead();
      init_interpreter();
      init_tokens();
      __name(validateLookahead, "validateLookahead");
      __name(validateGrammar, "validateGrammar");
      __name(validateDuplicateProductions, "validateDuplicateProductions");
      __name(identifyProductionForDuplicates, "identifyProductionForDuplicates");
      __name(getExtraProductionArgument, "getExtraProductionArgument");
      OccurrenceValidationCollector = class extends GAstVisitor {
        static {
          __name(this, "OccurrenceValidationCollector");
        }
        constructor() {
          super(...arguments);
          this.allProductions = [];
        }
        visitNonTerminal(subrule) {
          this.allProductions.push(subrule);
        }
        visitOption(option2) {
          this.allProductions.push(option2);
        }
        visitRepetitionWithSeparator(manySep) {
          this.allProductions.push(manySep);
        }
        visitRepetitionMandatory(atLeastOne) {
          this.allProductions.push(atLeastOne);
        }
        visitRepetitionMandatoryWithSeparator(atLeastOneSep) {
          this.allProductions.push(atLeastOneSep);
        }
        visitRepetition(many) {
          this.allProductions.push(many);
        }
        visitAlternation(or) {
          this.allProductions.push(or);
        }
        visitTerminal(terminal) {
          this.allProductions.push(terminal);
        }
      };
      __name(validateRuleDoesNotAlreadyExist, "validateRuleDoesNotAlreadyExist");
      __name(validateRuleIsOverridden, "validateRuleIsOverridden");
      __name(validateNoLeftRecursion, "validateNoLeftRecursion");
      __name(getFirstNoneTerminal, "getFirstNoneTerminal");
      OrCollector = class extends GAstVisitor {
        static {
          __name(this, "OrCollector");
        }
        constructor() {
          super(...arguments);
          this.alternations = [];
        }
        visitAlternation(node2) {
          this.alternations.push(node2);
        }
      };
      __name(validateEmptyOrAlternative, "validateEmptyOrAlternative");
      __name(validateAmbiguousAlternationAlternatives, "validateAmbiguousAlternationAlternatives");
      RepetitionCollector = class extends GAstVisitor {
        static {
          __name(this, "RepetitionCollector");
        }
        constructor() {
          super(...arguments);
          this.allProductions = [];
        }
        visitRepetitionWithSeparator(manySep) {
          this.allProductions.push(manySep);
        }
        visitRepetitionMandatory(atLeastOne) {
          this.allProductions.push(atLeastOne);
        }
        visitRepetitionMandatoryWithSeparator(atLeastOneSep) {
          this.allProductions.push(atLeastOneSep);
        }
        visitRepetition(many) {
          this.allProductions.push(many);
        }
      };
      __name(validateTooManyAlts, "validateTooManyAlts");
      __name(validateSomeNonEmptyLookaheadPath, "validateSomeNonEmptyLookaheadPath");
      __name(checkAlternativesAmbiguities, "checkAlternativesAmbiguities");
      __name(checkPrefixAlternativesAmbiguities, "checkPrefixAlternativesAmbiguities");
      __name(checkTerminalAndNoneTerminalsNameSpace, "checkTerminalAndNoneTerminalsNameSpace");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js
  function resolveGrammar2(options2) {
    const actualOptions = defaults_default(options2, {
      errMsgProvider: defaultGrammarResolverErrorProvider
    });
    const topRulesTable = {};
    forEach_default(options2.rules, (rule) => {
      topRulesTable[rule.name] = rule;
    });
    return resolveGrammar(topRulesTable, actualOptions.errMsgProvider);
  }
  function validateGrammar2(options2) {
    options2 = defaults_default(options2, {
      errMsgProvider: defaultGrammarValidatorErrorProvider
    });
    return validateGrammar(options2.rules, options2.tokenTypes, options2.errMsgProvider, options2.grammarName);
  }
  var init_gast_resolver_public = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js"() {
      "use strict";
      init_lodash();
      init_resolver();
      init_checks();
      init_errors_public();
      __name(resolveGrammar2, "resolveGrammar");
      __name(validateGrammar2, "validateGrammar");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/exceptions_public.js
  function isRecognitionException(error3) {
    return includes_default(RECOGNITION_EXCEPTION_NAMES, error3.name);
  }
  var MISMATCHED_TOKEN_EXCEPTION, NO_VIABLE_ALT_EXCEPTION, EARLY_EXIT_EXCEPTION, NOT_ALL_INPUT_PARSED_EXCEPTION, RECOGNITION_EXCEPTION_NAMES, RecognitionException, MismatchedTokenException, NoViableAltException, NotAllInputParsedException, EarlyExitException;
  var init_exceptions_public = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/exceptions_public.js"() {
      "use strict";
      init_lodash();
      MISMATCHED_TOKEN_EXCEPTION = "MismatchedTokenException";
      NO_VIABLE_ALT_EXCEPTION = "NoViableAltException";
      EARLY_EXIT_EXCEPTION = "EarlyExitException";
      NOT_ALL_INPUT_PARSED_EXCEPTION = "NotAllInputParsedException";
      RECOGNITION_EXCEPTION_NAMES = [
        MISMATCHED_TOKEN_EXCEPTION,
        NO_VIABLE_ALT_EXCEPTION,
        EARLY_EXIT_EXCEPTION,
        NOT_ALL_INPUT_PARSED_EXCEPTION
      ];
      Object.freeze(RECOGNITION_EXCEPTION_NAMES);
      __name(isRecognitionException, "isRecognitionException");
      RecognitionException = class extends Error {
        static {
          __name(this, "RecognitionException");
        }
        constructor(message, token2) {
          super(message);
          this.token = token2;
          this.resyncedTokens = [];
          Object.setPrototypeOf(this, new.target.prototype);
          if (Error.captureStackTrace) {
            Error.captureStackTrace(this, this.constructor);
          }
        }
      };
      MismatchedTokenException = class extends RecognitionException {
        static {
          __name(this, "MismatchedTokenException");
        }
        constructor(message, token2, previousToken) {
          super(message, token2);
          this.previousToken = previousToken;
          this.name = MISMATCHED_TOKEN_EXCEPTION;
        }
      };
      NoViableAltException = class extends RecognitionException {
        static {
          __name(this, "NoViableAltException");
        }
        constructor(message, token2, previousToken) {
          super(message, token2);
          this.previousToken = previousToken;
          this.name = NO_VIABLE_ALT_EXCEPTION;
        }
      };
      NotAllInputParsedException = class extends RecognitionException {
        static {
          __name(this, "NotAllInputParsedException");
        }
        constructor(message, token2) {
          super(message, token2);
          this.name = NOT_ALL_INPUT_PARSED_EXCEPTION;
        }
      };
      EarlyExitException = class extends RecognitionException {
        static {
          __name(this, "EarlyExitException");
        }
        constructor(message, token2, previousToken) {
          super(message, token2);
          this.previousToken = previousToken;
          this.name = EARLY_EXIT_EXCEPTION;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js
  function attemptInRepetitionRecovery(prodFunc, args, lookaheadFunc, dslMethodIdx, prodOccurrence, nextToksWalker, notStuck) {
    const key = this.getKeyForAutomaticLookahead(dslMethodIdx, prodOccurrence);
    let firstAfterRepInfo = this.firstAfterRepMap[key];
    if (firstAfterRepInfo === void 0) {
      const currRuleName = this.getCurrRuleFullName();
      const ruleGrammar = this.getGAstProductions()[currRuleName];
      const walker = new nextToksWalker(ruleGrammar, prodOccurrence);
      firstAfterRepInfo = walker.startWalking();
      this.firstAfterRepMap[key] = firstAfterRepInfo;
    }
    let expectTokAfterLastMatch = firstAfterRepInfo.token;
    let nextTokIdx = firstAfterRepInfo.occurrence;
    const isEndOfRule = firstAfterRepInfo.isEndOfRule;
    if (this.RULE_STACK.length === 1 && isEndOfRule && expectTokAfterLastMatch === void 0) {
      expectTokAfterLastMatch = EOF;
      nextTokIdx = 1;
    }
    if (expectTokAfterLastMatch === void 0 || nextTokIdx === void 0) {
      return;
    }
    if (this.shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx, notStuck)) {
      this.tryInRepetitionRecovery(prodFunc, args, lookaheadFunc, expectTokAfterLastMatch);
    }
  }
  var EOF_FOLLOW_KEY, IN_RULE_RECOVERY_EXCEPTION, InRuleRecoveryException, Recoverable;
  var init_recoverable = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js"() {
      "use strict";
      init_tokens_public();
      init_lodash();
      init_exceptions_public();
      init_constants2();
      init_parser();
      EOF_FOLLOW_KEY = {};
      IN_RULE_RECOVERY_EXCEPTION = "InRuleRecoveryException";
      InRuleRecoveryException = class extends Error {
        static {
          __name(this, "InRuleRecoveryException");
        }
        constructor(message) {
          super(message);
          this.name = IN_RULE_RECOVERY_EXCEPTION;
        }
      };
      Recoverable = class {
        static {
          __name(this, "Recoverable");
        }
        initRecoverable(config5) {
          this.firstAfterRepMap = {};
          this.resyncFollows = {};
          this.recoveryEnabled = has_default(config5, "recoveryEnabled") ? config5.recoveryEnabled : DEFAULT_PARSER_CONFIG.recoveryEnabled;
          if (this.recoveryEnabled) {
            this.attemptInRepetitionRecovery = attemptInRepetitionRecovery;
          }
        }
        getTokenToInsert(tokType) {
          const tokToInsert = createTokenInstance(tokType, "", NaN, NaN, NaN, NaN, NaN, NaN);
          tokToInsert.isInsertedInRecovery = true;
          return tokToInsert;
        }
        canTokenTypeBeInsertedInRecovery(tokType) {
          return true;
        }
        canTokenTypeBeDeletedInRecovery(tokType) {
          return true;
        }
        tryInRepetitionRecovery(grammarRule, grammarRuleArgs, lookAheadFunc, expectedTokType) {
          const reSyncTokType = this.findReSyncTokenType();
          const savedLexerState = this.exportLexerState();
          const resyncedTokens = [];
          let passedResyncPoint = false;
          const nextTokenWithoutResync = this.LA(1);
          let currToken = this.LA(1);
          const generateErrorMessage = /* @__PURE__ */ __name(() => {
            const previousToken = this.LA(0);
            const msg = this.errorMessageProvider.buildMismatchTokenMessage({
              expected: expectedTokType,
              actual: nextTokenWithoutResync,
              previous: previousToken,
              ruleName: this.getCurrRuleFullName()
            });
            const error3 = new MismatchedTokenException(msg, nextTokenWithoutResync, this.LA(0));
            error3.resyncedTokens = dropRight_default(resyncedTokens);
            this.SAVE_ERROR(error3);
          }, "generateErrorMessage");
          while (!passedResyncPoint) {
            if (this.tokenMatcher(currToken, expectedTokType)) {
              generateErrorMessage();
              return;
            } else if (lookAheadFunc.call(this)) {
              generateErrorMessage();
              grammarRule.apply(this, grammarRuleArgs);
              return;
            } else if (this.tokenMatcher(currToken, reSyncTokType)) {
              passedResyncPoint = true;
            } else {
              currToken = this.SKIP_TOKEN();
              this.addToResyncTokens(currToken, resyncedTokens);
            }
          }
          this.importLexerState(savedLexerState);
        }
        shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx, notStuck) {
          if (notStuck === false) {
            return false;
          }
          if (this.tokenMatcher(this.LA(1), expectTokAfterLastMatch)) {
            return false;
          }
          if (this.isBackTracking()) {
            return false;
          }
          if (this.canPerformInRuleRecovery(expectTokAfterLastMatch, this.getFollowsForInRuleRecovery(expectTokAfterLastMatch, nextTokIdx))) {
            return false;
          }
          return true;
        }
        // Error Recovery functionality
        getFollowsForInRuleRecovery(tokType, tokIdxInRule) {
          const grammarPath = this.getCurrentGrammarPath(tokType, tokIdxInRule);
          const follows = this.getNextPossibleTokenTypes(grammarPath);
          return follows;
        }
        tryInRuleRecovery(expectedTokType, follows) {
          if (this.canRecoverWithSingleTokenInsertion(expectedTokType, follows)) {
            const tokToInsert = this.getTokenToInsert(expectedTokType);
            return tokToInsert;
          }
          if (this.canRecoverWithSingleTokenDeletion(expectedTokType)) {
            const nextTok = this.SKIP_TOKEN();
            this.consumeToken();
            return nextTok;
          }
          throw new InRuleRecoveryException("sad sad panda");
        }
        canPerformInRuleRecovery(expectedToken, follows) {
          return this.canRecoverWithSingleTokenInsertion(expectedToken, follows) || this.canRecoverWithSingleTokenDeletion(expectedToken);
        }
        canRecoverWithSingleTokenInsertion(expectedTokType, follows) {
          if (!this.canTokenTypeBeInsertedInRecovery(expectedTokType)) {
            return false;
          }
          if (isEmpty_default(follows)) {
            return false;
          }
          const mismatchedTok = this.LA(1);
          const isMisMatchedTokInFollows = find_default2(follows, (possibleFollowsTokType) => {
            return this.tokenMatcher(mismatchedTok, possibleFollowsTokType);
          }) !== void 0;
          return isMisMatchedTokInFollows;
        }
        canRecoverWithSingleTokenDeletion(expectedTokType) {
          if (!this.canTokenTypeBeDeletedInRecovery(expectedTokType)) {
            return false;
          }
          const isNextTokenWhatIsExpected = this.tokenMatcher(this.LA(2), expectedTokType);
          return isNextTokenWhatIsExpected;
        }
        isInCurrentRuleReSyncSet(tokenTypeIdx) {
          const followKey = this.getCurrFollowKey();
          const currentRuleReSyncSet = this.getFollowSetFromFollowKey(followKey);
          return includes_default(currentRuleReSyncSet, tokenTypeIdx);
        }
        findReSyncTokenType() {
          const allPossibleReSyncTokTypes = this.flattenFollowSet();
          let nextToken = this.LA(1);
          let k2 = 2;
          while (true) {
            const foundMatch = find_default2(allPossibleReSyncTokTypes, (resyncTokType) => {
              const canMatch = tokenMatcher(nextToken, resyncTokType);
              return canMatch;
            });
            if (foundMatch !== void 0) {
              return foundMatch;
            }
            nextToken = this.LA(k2);
            k2++;
          }
        }
        getCurrFollowKey() {
          if (this.RULE_STACK.length === 1) {
            return EOF_FOLLOW_KEY;
          }
          const currRuleShortName = this.getLastExplicitRuleShortName();
          const currRuleIdx = this.getLastExplicitRuleOccurrenceIndex();
          const prevRuleShortName = this.getPreviousExplicitRuleShortName();
          return {
            ruleName: this.shortRuleNameToFullName(currRuleShortName),
            idxInCallingRule: currRuleIdx,
            inRule: this.shortRuleNameToFullName(prevRuleShortName)
          };
        }
        buildFullFollowKeyStack() {
          const explicitRuleStack = this.RULE_STACK;
          const explicitOccurrenceStack = this.RULE_OCCURRENCE_STACK;
          return map_default(explicitRuleStack, (ruleName, idx) => {
            if (idx === 0) {
              return EOF_FOLLOW_KEY;
            }
            return {
              ruleName: this.shortRuleNameToFullName(ruleName),
              idxInCallingRule: explicitOccurrenceStack[idx],
              inRule: this.shortRuleNameToFullName(explicitRuleStack[idx - 1])
            };
          });
        }
        flattenFollowSet() {
          const followStack = map_default(this.buildFullFollowKeyStack(), (currKey) => {
            return this.getFollowSetFromFollowKey(currKey);
          });
          return flatten_default(followStack);
        }
        getFollowSetFromFollowKey(followKey) {
          if (followKey === EOF_FOLLOW_KEY) {
            return [EOF];
          }
          const followName = followKey.ruleName + followKey.idxInCallingRule + IN + followKey.inRule;
          return this.resyncFollows[followName];
        }
        // It does not make any sense to include a virtual EOF token in the list of resynced tokens
        // as EOF does not really exist and thus does not contain any useful information (line/column numbers)
        addToResyncTokens(token2, resyncTokens) {
          if (!this.tokenMatcher(token2, EOF)) {
            resyncTokens.push(token2);
          }
          return resyncTokens;
        }
        reSyncTo(tokType) {
          const resyncedTokens = [];
          let nextTok = this.LA(1);
          while (this.tokenMatcher(nextTok, tokType) === false) {
            nextTok = this.SKIP_TOKEN();
            this.addToResyncTokens(nextTok, resyncedTokens);
          }
          return dropRight_default(resyncedTokens);
        }
        attemptInRepetitionRecovery(prodFunc, args, lookaheadFunc, dslMethodIdx, prodOccurrence, nextToksWalker, notStuck) {
        }
        getCurrentGrammarPath(tokType, tokIdxInRule) {
          const pathRuleStack = this.getHumanReadableRuleStack();
          const pathOccurrenceStack = clone_default2(this.RULE_OCCURRENCE_STACK);
          const grammarPath = {
            ruleStack: pathRuleStack,
            occurrenceStack: pathOccurrenceStack,
            lastTok: tokType,
            lastTokOccurrence: tokIdxInRule
          };
          return grammarPath;
        }
        getHumanReadableRuleStack() {
          return map_default(this.RULE_STACK, (currShortName) => this.shortRuleNameToFullName(currShortName));
        }
      };
      __name(attemptInRepetitionRecovery, "attemptInRepetitionRecovery");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/keys.js
  function getKeyForAutomaticLookahead(ruleIdx, dslMethodIdx, occurrence) {
    return occurrence | dslMethodIdx | ruleIdx;
  }
  var BITS_FOR_METHOD_TYPE, BITS_FOR_OCCURRENCE_IDX, BITS_FOR_ALT_IDX, OR_IDX, OPTION_IDX, MANY_IDX, AT_LEAST_ONE_IDX, MANY_SEP_IDX, AT_LEAST_ONE_SEP_IDX, BITS_START_FOR_ALT_IDX;
  var init_keys2 = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/keys.js"() {
      "use strict";
      BITS_FOR_METHOD_TYPE = 4;
      BITS_FOR_OCCURRENCE_IDX = 8;
      BITS_FOR_ALT_IDX = 8;
      OR_IDX = 1 << BITS_FOR_OCCURRENCE_IDX;
      OPTION_IDX = 2 << BITS_FOR_OCCURRENCE_IDX;
      MANY_IDX = 3 << BITS_FOR_OCCURRENCE_IDX;
      AT_LEAST_ONE_IDX = 4 << BITS_FOR_OCCURRENCE_IDX;
      MANY_SEP_IDX = 5 << BITS_FOR_OCCURRENCE_IDX;
      AT_LEAST_ONE_SEP_IDX = 6 << BITS_FOR_OCCURRENCE_IDX;
      __name(getKeyForAutomaticLookahead, "getKeyForAutomaticLookahead");
      BITS_START_FOR_ALT_IDX = 32 - BITS_FOR_ALT_IDX;
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js
  var LLkLookaheadStrategy;
  var init_llk_lookahead = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js"() {
      "use strict";
      init_lodash();
      init_errors_public();
      init_parser();
      init_checks();
      init_lookahead();
      LLkLookaheadStrategy = class {
        static {
          __name(this, "LLkLookaheadStrategy");
        }
        constructor(options2) {
          var _a;
          this.maxLookahead = (_a = options2 === null || options2 === void 0 ? void 0 : options2.maxLookahead) !== null && _a !== void 0 ? _a : DEFAULT_PARSER_CONFIG.maxLookahead;
        }
        validate(options2) {
          const leftRecursionErrors = this.validateNoLeftRecursion(options2.rules);
          if (isEmpty_default(leftRecursionErrors)) {
            const emptyAltErrors = this.validateEmptyOrAlternatives(options2.rules);
            const ambiguousAltsErrors = this.validateAmbiguousAlternationAlternatives(options2.rules, this.maxLookahead);
            const emptyRepetitionErrors = this.validateSomeNonEmptyLookaheadPath(options2.rules, this.maxLookahead);
            const allErrors = [
              ...leftRecursionErrors,
              ...emptyAltErrors,
              ...ambiguousAltsErrors,
              ...emptyRepetitionErrors
            ];
            return allErrors;
          }
          return leftRecursionErrors;
        }
        validateNoLeftRecursion(rules) {
          return flatMap_default(rules, (currTopRule) => validateNoLeftRecursion(currTopRule, currTopRule, defaultGrammarValidatorErrorProvider));
        }
        validateEmptyOrAlternatives(rules) {
          return flatMap_default(rules, (currTopRule) => validateEmptyOrAlternative(currTopRule, defaultGrammarValidatorErrorProvider));
        }
        validateAmbiguousAlternationAlternatives(rules, maxLookahead) {
          return flatMap_default(rules, (currTopRule) => validateAmbiguousAlternationAlternatives(currTopRule, maxLookahead, defaultGrammarValidatorErrorProvider));
        }
        validateSomeNonEmptyLookaheadPath(rules, maxLookahead) {
          return validateSomeNonEmptyLookaheadPath(rules, maxLookahead, defaultGrammarValidatorErrorProvider);
        }
        buildLookaheadForAlternation(options2) {
          return buildLookaheadFuncForOr(options2.prodOccurrence, options2.rule, options2.maxLookahead, options2.hasPredicates, options2.dynamicTokensEnabled, buildAlternativesLookAheadFunc);
        }
        buildLookaheadForOptional(options2) {
          return buildLookaheadFuncForOptionalProd(options2.prodOccurrence, options2.rule, options2.maxLookahead, options2.dynamicTokensEnabled, getProdType(options2.prodType), buildSingleAlternativeLookaheadFunction);
        }
      };
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js
  function collectMethods(rule) {
    collectorVisitor.reset();
    rule.accept(collectorVisitor);
    const dslMethods = collectorVisitor.dslMethods;
    collectorVisitor.reset();
    return dslMethods;
  }
  var LooksAhead, DslMethodsCollectorVisitor, collectorVisitor;
  var init_looksahead = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js"() {
      "use strict";
      init_lodash();
      init_parser();
      init_keys2();
      init_api3();
      init_llk_lookahead();
      LooksAhead = class {
        static {
          __name(this, "LooksAhead");
        }
        initLooksAhead(config5) {
          this.dynamicTokensEnabled = has_default(config5, "dynamicTokensEnabled") ? config5.dynamicTokensEnabled : DEFAULT_PARSER_CONFIG.dynamicTokensEnabled;
          this.maxLookahead = has_default(config5, "maxLookahead") ? config5.maxLookahead : DEFAULT_PARSER_CONFIG.maxLookahead;
          this.lookaheadStrategy = has_default(config5, "lookaheadStrategy") ? config5.lookaheadStrategy : new LLkLookaheadStrategy({ maxLookahead: this.maxLookahead });
          this.lookAheadFuncsCache = /* @__PURE__ */ new Map();
        }
        preComputeLookaheadFunctions(rules) {
          forEach_default(rules, (currRule) => {
            this.TRACE_INIT(`${currRule.name} Rule Lookahead`, () => {
              const { alternation: alternation2, repetition: repetition2, option: option2, repetitionMandatory: repetitionMandatory2, repetitionMandatoryWithSeparator, repetitionWithSeparator } = collectMethods(currRule);
              forEach_default(alternation2, (currProd) => {
                const prodIdx = currProd.idx === 0 ? "" : currProd.idx;
                this.TRACE_INIT(`${getProductionDslName(currProd)}${prodIdx}`, () => {
                  const laFunc = this.lookaheadStrategy.buildLookaheadForAlternation({
                    prodOccurrence: currProd.idx,
                    rule: currRule,
                    maxLookahead: currProd.maxLookahead || this.maxLookahead,
                    hasPredicates: currProd.hasPredicates,
                    dynamicTokensEnabled: this.dynamicTokensEnabled
                  });
                  const key = getKeyForAutomaticLookahead(this.fullRuleNameToShort[currRule.name], OR_IDX, currProd.idx);
                  this.setLaFuncCache(key, laFunc);
                });
              });
              forEach_default(repetition2, (currProd) => {
                this.computeLookaheadFunc(currRule, currProd.idx, MANY_IDX, "Repetition", currProd.maxLookahead, getProductionDslName(currProd));
              });
              forEach_default(option2, (currProd) => {
                this.computeLookaheadFunc(currRule, currProd.idx, OPTION_IDX, "Option", currProd.maxLookahead, getProductionDslName(currProd));
              });
              forEach_default(repetitionMandatory2, (currProd) => {
                this.computeLookaheadFunc(currRule, currProd.idx, AT_LEAST_ONE_IDX, "RepetitionMandatory", currProd.maxLookahead, getProductionDslName(currProd));
              });
              forEach_default(repetitionMandatoryWithSeparator, (currProd) => {
                this.computeLookaheadFunc(currRule, currProd.idx, AT_LEAST_ONE_SEP_IDX, "RepetitionMandatoryWithSeparator", currProd.maxLookahead, getProductionDslName(currProd));
              });
              forEach_default(repetitionWithSeparator, (currProd) => {
                this.computeLookaheadFunc(currRule, currProd.idx, MANY_SEP_IDX, "RepetitionWithSeparator", currProd.maxLookahead, getProductionDslName(currProd));
              });
            });
          });
        }
        computeLookaheadFunc(rule, prodOccurrence, prodKey, prodType, prodMaxLookahead, dslMethodName) {
          this.TRACE_INIT(`${dslMethodName}${prodOccurrence === 0 ? "" : prodOccurrence}`, () => {
            const laFunc = this.lookaheadStrategy.buildLookaheadForOptional({
              prodOccurrence,
              rule,
              maxLookahead: prodMaxLookahead || this.maxLookahead,
              dynamicTokensEnabled: this.dynamicTokensEnabled,
              prodType
            });
            const key = getKeyForAutomaticLookahead(this.fullRuleNameToShort[rule.name], prodKey, prodOccurrence);
            this.setLaFuncCache(key, laFunc);
          });
        }
        // this actually returns a number, but it is always used as a string (object prop key)
        getKeyForAutomaticLookahead(dslMethodIdx, occurrence) {
          const currRuleShortName = this.getLastExplicitRuleShortName();
          return getKeyForAutomaticLookahead(currRuleShortName, dslMethodIdx, occurrence);
        }
        getLaFuncFromCache(key) {
          return this.lookAheadFuncsCache.get(key);
        }
        /* istanbul ignore next */
        setLaFuncCache(key, value2) {
          this.lookAheadFuncsCache.set(key, value2);
        }
      };
      DslMethodsCollectorVisitor = class extends GAstVisitor {
        static {
          __name(this, "DslMethodsCollectorVisitor");
        }
        constructor() {
          super(...arguments);
          this.dslMethods = {
            option: [],
            alternation: [],
            repetition: [],
            repetitionWithSeparator: [],
            repetitionMandatory: [],
            repetitionMandatoryWithSeparator: []
          };
        }
        reset() {
          this.dslMethods = {
            option: [],
            alternation: [],
            repetition: [],
            repetitionWithSeparator: [],
            repetitionMandatory: [],
            repetitionMandatoryWithSeparator: []
          };
        }
        visitOption(option2) {
          this.dslMethods.option.push(option2);
        }
        visitRepetitionWithSeparator(manySep) {
          this.dslMethods.repetitionWithSeparator.push(manySep);
        }
        visitRepetitionMandatory(atLeastOne) {
          this.dslMethods.repetitionMandatory.push(atLeastOne);
        }
        visitRepetitionMandatoryWithSeparator(atLeastOneSep) {
          this.dslMethods.repetitionMandatoryWithSeparator.push(atLeastOneSep);
        }
        visitRepetition(many) {
          this.dslMethods.repetition.push(many);
        }
        visitAlternation(or) {
          this.dslMethods.alternation.push(or);
        }
      };
      collectorVisitor = new DslMethodsCollectorVisitor();
      __name(collectMethods, "collectMethods");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/cst/cst.js
  function setNodeLocationOnlyOffset(currNodeLocation, newLocationInfo) {
    if (isNaN(currNodeLocation.startOffset) === true) {
      currNodeLocation.startOffset = newLocationInfo.startOffset;
      currNodeLocation.endOffset = newLocationInfo.endOffset;
    } else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) {
      currNodeLocation.endOffset = newLocationInfo.endOffset;
    }
  }
  function setNodeLocationFull(currNodeLocation, newLocationInfo) {
    if (isNaN(currNodeLocation.startOffset) === true) {
      currNodeLocation.startOffset = newLocationInfo.startOffset;
      currNodeLocation.startColumn = newLocationInfo.startColumn;
      currNodeLocation.startLine = newLocationInfo.startLine;
      currNodeLocation.endOffset = newLocationInfo.endOffset;
      currNodeLocation.endColumn = newLocationInfo.endColumn;
      currNodeLocation.endLine = newLocationInfo.endLine;
    } else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) {
      currNodeLocation.endOffset = newLocationInfo.endOffset;
      currNodeLocation.endColumn = newLocationInfo.endColumn;
      currNodeLocation.endLine = newLocationInfo.endLine;
    }
  }
  function addTerminalToCst(node2, token2, tokenTypeName) {
    if (node2.children[tokenTypeName] === void 0) {
      node2.children[tokenTypeName] = [token2];
    } else {
      node2.children[tokenTypeName].push(token2);
    }
  }
  function addNoneTerminalToCst(node2, ruleName, ruleResult) {
    if (node2.children[ruleName] === void 0) {
      node2.children[ruleName] = [ruleResult];
    } else {
      node2.children[ruleName].push(ruleResult);
    }
  }
  var init_cst = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/cst/cst.js"() {
      "use strict";
      __name(setNodeLocationOnlyOffset, "setNodeLocationOnlyOffset");
      __name(setNodeLocationFull, "setNodeLocationFull");
      __name(addTerminalToCst, "addTerminalToCst");
      __name(addNoneTerminalToCst, "addNoneTerminalToCst");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/lang/lang_extensions.js
  function defineNameProp(obj, nameValue) {
    Object.defineProperty(obj, NAME, {
      enumerable: false,
      configurable: true,
      writable: false,
      value: nameValue
    });
  }
  var NAME;
  var init_lang_extensions = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/lang/lang_extensions.js"() {
      "use strict";
      NAME = "name";
      __name(defineNameProp, "defineNameProp");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js
  function defaultVisit(ctx, param) {
    const childrenNames = keys_default(ctx);
    const childrenNamesLength = childrenNames.length;
    for (let i2 = 0; i2 < childrenNamesLength; i2++) {
      const currChildName = childrenNames[i2];
      const currChildArray = ctx[currChildName];
      const currChildArrayLength = currChildArray.length;
      for (let j3 = 0; j3 < currChildArrayLength; j3++) {
        const currChild = currChildArray[j3];
        if (currChild.tokenTypeIdx === void 0) {
          this[currChild.name](currChild.children, param);
        }
      }
    }
  }
  function createBaseSemanticVisitorConstructor(grammarName, ruleNames) {
    const derivedConstructor = /* @__PURE__ */ __name(function() {
    }, "derivedConstructor");
    defineNameProp(derivedConstructor, grammarName + "BaseSemantics");
    const semanticProto = {
      visit: /* @__PURE__ */ __name(function(cstNode, param) {
        if (isArray_default(cstNode)) {
          cstNode = cstNode[0];
        }
        if (isUndefined_default(cstNode)) {
          return void 0;
        }
        return this[cstNode.name](cstNode.children, param);
      }, "visit"),
      validateVisitor: /* @__PURE__ */ __name(function() {
        const semanticDefinitionErrors = validateVisitor(this, ruleNames);
        if (!isEmpty_default(semanticDefinitionErrors)) {
          const errorMessages = map_default(semanticDefinitionErrors, (currDefError) => currDefError.msg);
          throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
	${errorMessages.join("\n\n").replace(/\n/g, "\n	")}`);
        }
      }, "validateVisitor")
    };
    derivedConstructor.prototype = semanticProto;
    derivedConstructor.prototype.constructor = derivedConstructor;
    derivedConstructor._RULE_NAMES = ruleNames;
    return derivedConstructor;
  }
  function createBaseVisitorConstructorWithDefaults(grammarName, ruleNames, baseConstructor) {
    const derivedConstructor = /* @__PURE__ */ __name(function() {
    }, "derivedConstructor");
    defineNameProp(derivedConstructor, grammarName + "BaseSemanticsWithDefaults");
    const withDefaultsProto = Object.create(baseConstructor.prototype);
    forEach_default(ruleNames, (ruleName) => {
      withDefaultsProto[ruleName] = defaultVisit;
    });
    derivedConstructor.prototype = withDefaultsProto;
    derivedConstructor.prototype.constructor = derivedConstructor;
    return derivedConstructor;
  }
  function validateVisitor(visitorInstance, ruleNames) {
    const missingErrors = validateMissingCstMethods(visitorInstance, ruleNames);
    return missingErrors;
  }
  function validateMissingCstMethods(visitorInstance, ruleNames) {
    const missingRuleNames = filter_default3(ruleNames, (currRuleName) => {
      return isFunction_default(visitorInstance[currRuleName]) === false;
    });
    const errors = map_default(missingRuleNames, (currRuleName) => {
      return {
        msg: `Missing visitor method: <${currRuleName}> on ${visitorInstance.constructor.name} CST Visitor.`,
        type: CstVisitorDefinitionError.MISSING_METHOD,
        methodName: currRuleName
      };
    });
    return compact_default(errors);
  }
  var CstVisitorDefinitionError;
  var init_cst_visitor = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js"() {
      "use strict";
      init_lodash();
      init_lang_extensions();
      __name(defaultVisit, "defaultVisit");
      __name(createBaseSemanticVisitorConstructor, "createBaseSemanticVisitorConstructor");
      __name(createBaseVisitorConstructorWithDefaults, "createBaseVisitorConstructorWithDefaults");
      (function(CstVisitorDefinitionError2) {
        CstVisitorDefinitionError2[CstVisitorDefinitionError2["REDUNDANT_METHOD"] = 0] = "REDUNDANT_METHOD";
        CstVisitorDefinitionError2[CstVisitorDefinitionError2["MISSING_METHOD"] = 1] = "MISSING_METHOD";
      })(CstVisitorDefinitionError || (CstVisitorDefinitionError = {}));
      __name(validateVisitor, "validateVisitor");
      __name(validateMissingCstMethods, "validateMissingCstMethods");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js
  var TreeBuilder;
  var init_tree_builder = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js"() {
      "use strict";
      init_cst();
      init_lodash();
      init_cst_visitor();
      init_parser();
      TreeBuilder = class {
        static {
          __name(this, "TreeBuilder");
        }
        initTreeBuilder(config5) {
          this.CST_STACK = [];
          this.outputCst = config5.outputCst;
          this.nodeLocationTracking = has_default(config5, "nodeLocationTracking") ? config5.nodeLocationTracking : DEFAULT_PARSER_CONFIG.nodeLocationTracking;
          if (!this.outputCst) {
            this.cstInvocationStateUpdate = noop_default2;
            this.cstFinallyStateUpdate = noop_default2;
            this.cstPostTerminal = noop_default2;
            this.cstPostNonTerminal = noop_default2;
            this.cstPostRule = noop_default2;
          } else {
            if (/full/i.test(this.nodeLocationTracking)) {
              if (this.recoveryEnabled) {
                this.setNodeLocationFromToken = setNodeLocationFull;
                this.setNodeLocationFromNode = setNodeLocationFull;
                this.cstPostRule = noop_default2;
                this.setInitialNodeLocation = this.setInitialNodeLocationFullRecovery;
              } else {
                this.setNodeLocationFromToken = noop_default2;
                this.setNodeLocationFromNode = noop_default2;
                this.cstPostRule = this.cstPostRuleFull;
                this.setInitialNodeLocation = this.setInitialNodeLocationFullRegular;
              }
            } else if (/onlyOffset/i.test(this.nodeLocationTracking)) {
              if (this.recoveryEnabled) {
                this.setNodeLocationFromToken = setNodeLocationOnlyOffset;
                this.setNodeLocationFromNode = setNodeLocationOnlyOffset;
                this.cstPostRule = noop_default2;
                this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRecovery;
              } else {
                this.setNodeLocationFromToken = noop_default2;
                this.setNodeLocationFromNode = noop_default2;
                this.cstPostRule = this.cstPostRuleOnlyOffset;
                this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRegular;
              }
            } else if (/none/i.test(this.nodeLocationTracking)) {
              this.setNodeLocationFromToken = noop_default2;
              this.setNodeLocationFromNode = noop_default2;
              this.cstPostRule = noop_default2;
              this.setInitialNodeLocation = noop_default2;
            } else {
              throw Error(`Invalid <nodeLocationTracking> config option: "${config5.nodeLocationTracking}"`);
            }
          }
        }
        setInitialNodeLocationOnlyOffsetRecovery(cstNode) {
          cstNode.location = {
            startOffset: NaN,
            endOffset: NaN
          };
        }
        setInitialNodeLocationOnlyOffsetRegular(cstNode) {
          cstNode.location = {
            // without error recovery the starting Location of a new CstNode is guaranteed
            // To be the next Token's startOffset (for valid inputs).
            // For invalid inputs there won't be any CSTOutput so this potential
            // inaccuracy does not matter
            startOffset: this.LA(1).startOffset,
            endOffset: NaN
          };
        }
        setInitialNodeLocationFullRecovery(cstNode) {
          cstNode.location = {
            startOffset: NaN,
            startLine: NaN,
            startColumn: NaN,
            endOffset: NaN,
            endLine: NaN,
            endColumn: NaN
          };
        }
        /**
             *  @see setInitialNodeLocationOnlyOffsetRegular for explanation why this work
        
             * @param cstNode
             */
        setInitialNodeLocationFullRegular(cstNode) {
          const nextToken = this.LA(1);
          cstNode.location = {
            startOffset: nextToken.startOffset,
            startLine: nextToken.startLine,
            startColumn: nextToken.startColumn,
            endOffset: NaN,
            endLine: NaN,
            endColumn: NaN
          };
        }
        cstInvocationStateUpdate(fullRuleName) {
          const cstNode = {
            name: fullRuleName,
            children: /* @__PURE__ */ Object.create(null)
          };
          this.setInitialNodeLocation(cstNode);
          this.CST_STACK.push(cstNode);
        }
        cstFinallyStateUpdate() {
          this.CST_STACK.pop();
        }
        cstPostRuleFull(ruleCstNode) {
          const prevToken = this.LA(0);
          const loc = ruleCstNode.location;
          if (loc.startOffset <= prevToken.startOffset === true) {
            loc.endOffset = prevToken.endOffset;
            loc.endLine = prevToken.endLine;
            loc.endColumn = prevToken.endColumn;
          } else {
            loc.startOffset = NaN;
            loc.startLine = NaN;
            loc.startColumn = NaN;
          }
        }
        cstPostRuleOnlyOffset(ruleCstNode) {
          const prevToken = this.LA(0);
          const loc = ruleCstNode.location;
          if (loc.startOffset <= prevToken.startOffset === true) {
            loc.endOffset = prevToken.endOffset;
          } else {
            loc.startOffset = NaN;
          }
        }
        cstPostTerminal(key, consumedToken) {
          const rootCst = this.CST_STACK[this.CST_STACK.length - 1];
          addTerminalToCst(rootCst, consumedToken, key);
          this.setNodeLocationFromToken(rootCst.location, consumedToken);
        }
        cstPostNonTerminal(ruleCstResult, ruleName) {
          const preCstNode = this.CST_STACK[this.CST_STACK.length - 1];
          addNoneTerminalToCst(preCstNode, ruleName, ruleCstResult);
          this.setNodeLocationFromNode(preCstNode.location, ruleCstResult.location);
        }
        getBaseCstVisitorConstructor() {
          if (isUndefined_default(this.baseCstVisitorConstructor)) {
            const newBaseCstVisitorConstructor = createBaseSemanticVisitorConstructor(this.className, keys_default(this.gastProductionsCache));
            this.baseCstVisitorConstructor = newBaseCstVisitorConstructor;
            return newBaseCstVisitorConstructor;
          }
          return this.baseCstVisitorConstructor;
        }
        getBaseCstVisitorConstructorWithDefaults() {
          if (isUndefined_default(this.baseCstVisitorWithDefaultsConstructor)) {
            const newConstructor = createBaseVisitorConstructorWithDefaults(this.className, keys_default(this.gastProductionsCache), this.getBaseCstVisitorConstructor());
            this.baseCstVisitorWithDefaultsConstructor = newConstructor;
            return newConstructor;
          }
          return this.baseCstVisitorWithDefaultsConstructor;
        }
        getLastExplicitRuleShortName() {
          const ruleStack = this.RULE_STACK;
          return ruleStack[ruleStack.length - 1];
        }
        getPreviousExplicitRuleShortName() {
          const ruleStack = this.RULE_STACK;
          return ruleStack[ruleStack.length - 2];
        }
        getLastExplicitRuleOccurrenceIndex() {
          const occurrenceStack = this.RULE_OCCURRENCE_STACK;
          return occurrenceStack[occurrenceStack.length - 1];
        }
      };
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js
  var LexerAdapter;
  var init_lexer_adapter = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js"() {
      "use strict";
      init_parser();
      LexerAdapter = class {
        static {
          __name(this, "LexerAdapter");
        }
        initLexerAdapter() {
          this.tokVector = [];
          this.tokVectorLength = 0;
          this.currIdx = -1;
        }
        set input(newInput) {
          if (this.selfAnalysisDone !== true) {
            throw Error(`Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.`);
          }
          this.reset();
          this.tokVector = newInput;
          this.tokVectorLength = newInput.length;
        }
        get input() {
          return this.tokVector;
        }
        // skips a token and returns the next token
        SKIP_TOKEN() {
          if (this.currIdx <= this.tokVector.length - 2) {
            this.consumeToken();
            return this.LA(1);
          } else {
            return END_OF_FILE;
          }
        }
        // Lexer (accessing Token vector) related methods which can be overridden to implement lazy lexers
        // or lexers dependent on parser context.
        LA(howMuch) {
          const soughtIdx = this.currIdx + howMuch;
          if (soughtIdx < 0 || this.tokVectorLength <= soughtIdx) {
            return END_OF_FILE;
          } else {
            return this.tokVector[soughtIdx];
          }
        }
        consumeToken() {
          this.currIdx++;
        }
        exportLexerState() {
          return this.currIdx;
        }
        importLexerState(newState2) {
          this.currIdx = newState2;
        }
        resetLexerState() {
          this.currIdx = -1;
        }
        moveToTerminatedState() {
          this.currIdx = this.tokVector.length - 1;
        }
        getLexerPosition() {
          return this.exportLexerState();
        }
      };
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js
  var RecognizerApi;
  var init_recognizer_api = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js"() {
      "use strict";
      init_lodash();
      init_exceptions_public();
      init_parser();
      init_errors_public();
      init_checks();
      init_api3();
      RecognizerApi = class {
        static {
          __name(this, "RecognizerApi");
        }
        ACTION(impl2) {
          return impl2.call(this);
        }
        consume(idx, tokType, options2) {
          return this.consumeInternal(tokType, idx, options2);
        }
        subrule(idx, ruleToCall, options2) {
          return this.subruleInternal(ruleToCall, idx, options2);
        }
        option(idx, actionORMethodDef) {
          return this.optionInternal(actionORMethodDef, idx);
        }
        or(idx, altsOrOpts) {
          return this.orInternal(altsOrOpts, idx);
        }
        many(idx, actionORMethodDef) {
          return this.manyInternal(idx, actionORMethodDef);
        }
        atLeastOne(idx, actionORMethodDef) {
          return this.atLeastOneInternal(idx, actionORMethodDef);
        }
        CONSUME(tokType, options2) {
          return this.consumeInternal(tokType, 0, options2);
        }
        CONSUME1(tokType, options2) {
          return this.consumeInternal(tokType, 1, options2);
        }
        CONSUME2(tokType, options2) {
          return this.consumeInternal(tokType, 2, options2);
        }
        CONSUME3(tokType, options2) {
          return this.consumeInternal(tokType, 3, options2);
        }
        CONSUME4(tokType, options2) {
          return this.consumeInternal(tokType, 4, options2);
        }
        CONSUME5(tokType, options2) {
          return this.consumeInternal(tokType, 5, options2);
        }
        CONSUME6(tokType, options2) {
          return this.consumeInternal(tokType, 6, options2);
        }
        CONSUME7(tokType, options2) {
          return this.consumeInternal(tokType, 7, options2);
        }
        CONSUME8(tokType, options2) {
          return this.consumeInternal(tokType, 8, options2);
        }
        CONSUME9(tokType, options2) {
          return this.consumeInternal(tokType, 9, options2);
        }
        SUBRULE(ruleToCall, options2) {
          return this.subruleInternal(ruleToCall, 0, options2);
        }
        SUBRULE1(ruleToCall, options2) {
          return this.subruleInternal(ruleToCall, 1, options2);
        }
        SUBRULE2(ruleToCall, options2) {
          return this.subruleInternal(ruleToCall, 2, options2);
        }
        SUBRULE3(ruleToCall, options2) {
          return this.subruleInternal(ruleToCall, 3, options2);
        }
        SUBRULE4(ruleToCall, options2) {
          return this.subruleInternal(ruleToCall, 4, options2);
        }
        SUBRULE5(ruleToCall, options2) {
          return this.subruleInternal(ruleToCall, 5, options2);
        }
        SUBRULE6(ruleToCall, options2) {
          return this.subruleInternal(ruleToCall, 6, options2);
        }
        SUBRULE7(ruleToCall, options2) {
          return this.subruleInternal(ruleToCall, 7, options2);
        }
        SUBRULE8(ruleToCall, options2) {
          return this.subruleInternal(ruleToCall, 8, options2);
        }
        SUBRULE9(ruleToCall, options2) {
          return this.subruleInternal(ruleToCall, 9, options2);
        }
        OPTION(actionORMethodDef) {
          return this.optionInternal(actionORMethodDef, 0);
        }
        OPTION1(actionORMethodDef) {
          return this.optionInternal(actionORMethodDef, 1);
        }
        OPTION2(actionORMethodDef) {
          return this.optionInternal(actionORMethodDef, 2);
        }
        OPTION3(actionORMethodDef) {
          return this.optionInternal(actionORMethodDef, 3);
        }
        OPTION4(actionORMethodDef) {
          return this.optionInternal(actionORMethodDef, 4);
        }
        OPTION5(actionORMethodDef) {
          return this.optionInternal(actionORMethodDef, 5);
        }
        OPTION6(actionORMethodDef) {
          return this.optionInternal(actionORMethodDef, 6);
        }
        OPTION7(actionORMethodDef) {
          return this.optionInternal(actionORMethodDef, 7);
        }
        OPTION8(actionORMethodDef) {
          return this.optionInternal(actionORMethodDef, 8);
        }
        OPTION9(actionORMethodDef) {
          return this.optionInternal(actionORMethodDef, 9);
        }
        OR(altsOrOpts) {
          return this.orInternal(altsOrOpts, 0);
        }
        OR1(altsOrOpts) {
          return this.orInternal(altsOrOpts, 1);
        }
        OR2(altsOrOpts) {
          return this.orInternal(altsOrOpts, 2);
        }
        OR3(altsOrOpts) {
          return this.orInternal(altsOrOpts, 3);
        }
        OR4(altsOrOpts) {
          return this.orInternal(altsOrOpts, 4);
        }
        OR5(altsOrOpts) {
          return this.orInternal(altsOrOpts, 5);
        }
        OR6(altsOrOpts) {
          return this.orInternal(altsOrOpts, 6);
        }
        OR7(altsOrOpts) {
          return this.orInternal(altsOrOpts, 7);
        }
        OR8(altsOrOpts) {
          return this.orInternal(altsOrOpts, 8);
        }
        OR9(altsOrOpts) {
          return this.orInternal(altsOrOpts, 9);
        }
        MANY(actionORMethodDef) {
          this.manyInternal(0, actionORMethodDef);
        }
        MANY1(actionORMethodDef) {
          this.manyInternal(1, actionORMethodDef);
        }
        MANY2(actionORMethodDef) {
          this.manyInternal(2, actionORMethodDef);
        }
        MANY3(actionORMethodDef) {
          this.manyInternal(3, actionORMethodDef);
        }
        MANY4(actionORMethodDef) {
          this.manyInternal(4, actionORMethodDef);
        }
        MANY5(actionORMethodDef) {
          this.manyInternal(5, actionORMethodDef);
        }
        MANY6(actionORMethodDef) {
          this.manyInternal(6, actionORMethodDef);
        }
        MANY7(actionORMethodDef) {
          this.manyInternal(7, actionORMethodDef);
        }
        MANY8(actionORMethodDef) {
          this.manyInternal(8, actionORMethodDef);
        }
        MANY9(actionORMethodDef) {
          this.manyInternal(9, actionORMethodDef);
        }
        MANY_SEP(options2) {
          this.manySepFirstInternal(0, options2);
        }
        MANY_SEP1(options2) {
          this.manySepFirstInternal(1, options2);
        }
        MANY_SEP2(options2) {
          this.manySepFirstInternal(2, options2);
        }
        MANY_SEP3(options2) {
          this.manySepFirstInternal(3, options2);
        }
        MANY_SEP4(options2) {
          this.manySepFirstInternal(4, options2);
        }
        MANY_SEP5(options2) {
          this.manySepFirstInternal(5, options2);
        }
        MANY_SEP6(options2) {
          this.manySepFirstInternal(6, options2);
        }
        MANY_SEP7(options2) {
          this.manySepFirstInternal(7, options2);
        }
        MANY_SEP8(options2) {
          this.manySepFirstInternal(8, options2);
        }
        MANY_SEP9(options2) {
          this.manySepFirstInternal(9, options2);
        }
        AT_LEAST_ONE(actionORMethodDef) {
          this.atLeastOneInternal(0, actionORMethodDef);
        }
        AT_LEAST_ONE1(actionORMethodDef) {
          return this.atLeastOneInternal(1, actionORMethodDef);
        }
        AT_LEAST_ONE2(actionORMethodDef) {
          this.atLeastOneInternal(2, actionORMethodDef);
        }
        AT_LEAST_ONE3(actionORMethodDef) {
          this.atLeastOneInternal(3, actionORMethodDef);
        }
        AT_LEAST_ONE4(actionORMethodDef) {
          this.atLeastOneInternal(4, actionORMethodDef);
        }
        AT_LEAST_ONE5(actionORMethodDef) {
          this.atLeastOneInternal(5, actionORMethodDef);
        }
        AT_LEAST_ONE6(actionORMethodDef) {
          this.atLeastOneInternal(6, actionORMethodDef);
        }
        AT_LEAST_ONE7(actionORMethodDef) {
          this.atLeastOneInternal(7, actionORMethodDef);
        }
        AT_LEAST_ONE8(actionORMethodDef) {
          this.atLeastOneInternal(8, actionORMethodDef);
        }
        AT_LEAST_ONE9(actionORMethodDef) {
          this.atLeastOneInternal(9, actionORMethodDef);
        }
        AT_LEAST_ONE_SEP(options2) {
          this.atLeastOneSepFirstInternal(0, options2);
        }
        AT_LEAST_ONE_SEP1(options2) {
          this.atLeastOneSepFirstInternal(1, options2);
        }
        AT_LEAST_ONE_SEP2(options2) {
          this.atLeastOneSepFirstInternal(2, options2);
        }
        AT_LEAST_ONE_SEP3(options2) {
          this.atLeastOneSepFirstInternal(3, options2);
        }
        AT_LEAST_ONE_SEP4(options2) {
          this.atLeastOneSepFirstInternal(4, options2);
        }
        AT_LEAST_ONE_SEP5(options2) {
          this.atLeastOneSepFirstInternal(5, options2);
        }
        AT_LEAST_ONE_SEP6(options2) {
          this.atLeastOneSepFirstInternal(6, options2);
        }
        AT_LEAST_ONE_SEP7(options2) {
          this.atLeastOneSepFirstInternal(7, options2);
        }
        AT_LEAST_ONE_SEP8(options2) {
          this.atLeastOneSepFirstInternal(8, options2);
        }
        AT_LEAST_ONE_SEP9(options2) {
          this.atLeastOneSepFirstInternal(9, options2);
        }
        RULE(name, implementation, config5 = DEFAULT_RULE_CONFIG) {
          if (includes_default(this.definedRulesNames, name)) {
            const errMsg = defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({
              topLevelRule: name,
              grammarName: this.className
            });
            const error3 = {
              message: errMsg,
              type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME,
              ruleName: name
            };
            this.definitionErrors.push(error3);
          }
          this.definedRulesNames.push(name);
          const ruleImplementation = this.defineRule(name, implementation, config5);
          this[name] = ruleImplementation;
          return ruleImplementation;
        }
        OVERRIDE_RULE(name, impl2, config5 = DEFAULT_RULE_CONFIG) {
          const ruleErrors = validateRuleIsOverridden(name, this.definedRulesNames, this.className);
          this.definitionErrors = this.definitionErrors.concat(ruleErrors);
          const ruleImplementation = this.defineRule(name, impl2, config5);
          this[name] = ruleImplementation;
          return ruleImplementation;
        }
        BACKTRACK(grammarRule, args) {
          return function() {
            this.isBackTrackingStack.push(1);
            const orgState = this.saveRecogState();
            try {
              grammarRule.apply(this, args);
              return true;
            } catch (e3) {
              if (isRecognitionException(e3)) {
                return false;
              } else {
                throw e3;
              }
            } finally {
              this.reloadRecogState(orgState);
              this.isBackTrackingStack.pop();
            }
          };
        }
        // GAST export APIs
        getGAstProductions() {
          return this.gastProductionsCache;
        }
        getSerializedGastProductions() {
          return serializeGrammar(values_default(this.gastProductionsCache));
        }
      };
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js
  var RecognizerEngine;
  var init_recognizer_engine = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js"() {
      "use strict";
      init_lodash();
      init_keys2();
      init_exceptions_public();
      init_lookahead();
      init_interpreter();
      init_parser();
      init_recoverable();
      init_tokens_public();
      init_tokens();
      RecognizerEngine = class {
        static {
          __name(this, "RecognizerEngine");
        }
        initRecognizerEngine(tokenVocabulary, config5) {
          this.className = this.constructor.name;
          this.shortRuleNameToFull = {};
          this.fullRuleNameToShort = {};
          this.ruleShortNameIdx = 256;
          this.tokenMatcher = tokenStructuredMatcherNoCategories;
          this.subruleIdx = 0;
          this.definedRulesNames = [];
          this.tokensMap = {};
          this.isBackTrackingStack = [];
          this.RULE_STACK = [];
          this.RULE_OCCURRENCE_STACK = [];
          this.gastProductionsCache = {};
          if (has_default(config5, "serializedGrammar")) {
            throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n	See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n	For Further details.");
          }
          if (isArray_default(tokenVocabulary)) {
            if (isEmpty_default(tokenVocabulary)) {
              throw Error("A Token Vocabulary cannot be empty.\n	Note that the first argument for the parser constructor\n	is no longer a Token vector (since v4.0).");
            }
            if (typeof tokenVocabulary[0].startOffset === "number") {
              throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n	See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n	For Further details.");
            }
          }
          if (isArray_default(tokenVocabulary)) {
            this.tokensMap = reduce_default(tokenVocabulary, (acc, tokType) => {
              acc[tokType.name] = tokType;
              return acc;
            }, {});
          } else if (has_default(tokenVocabulary, "modes") && every_default(flatten_default(values_default(tokenVocabulary.modes)), isTokenType)) {
            const allTokenTypes2 = flatten_default(values_default(tokenVocabulary.modes));
            const uniqueTokens = uniq_default(allTokenTypes2);
            this.tokensMap = reduce_default(uniqueTokens, (acc, tokType) => {
              acc[tokType.name] = tokType;
              return acc;
            }, {});
          } else if (isObject_default(tokenVocabulary)) {
            this.tokensMap = clone_default2(tokenVocabulary);
          } else {
            throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");
          }
          this.tokensMap["EOF"] = EOF;
          const allTokenTypes = has_default(tokenVocabulary, "modes") ? flatten_default(values_default(tokenVocabulary.modes)) : values_default(tokenVocabulary);
          const noTokenCategoriesUsed = every_default(allTokenTypes, (tokenConstructor) => isEmpty_default(tokenConstructor.categoryMatches));
          this.tokenMatcher = noTokenCategoriesUsed ? tokenStructuredMatcherNoCategories : tokenStructuredMatcher;
          augmentTokenTypes(values_default(this.tokensMap));
        }
        defineRule(ruleName, impl2, config5) {
          if (this.selfAnalysisDone) {
            throw Error(`Grammar rule <${ruleName}> may not be defined after the 'performSelfAnalysis' method has been called'
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);
          }
          const resyncEnabled = has_default(config5, "resyncEnabled") ? config5.resyncEnabled : DEFAULT_RULE_CONFIG.resyncEnabled;
          const recoveryValueFunc = has_default(config5, "recoveryValueFunc") ? config5.recoveryValueFunc : DEFAULT_RULE_CONFIG.recoveryValueFunc;
          const shortName = this.ruleShortNameIdx << BITS_FOR_METHOD_TYPE + BITS_FOR_OCCURRENCE_IDX;
          this.ruleShortNameIdx++;
          this.shortRuleNameToFull[shortName] = ruleName;
          this.fullRuleNameToShort[ruleName] = shortName;
          let invokeRuleWithTry;
          if (this.outputCst === true) {
            invokeRuleWithTry = /* @__PURE__ */ __name(function invokeRuleWithTry2(...args) {
              try {
                this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx);
                impl2.apply(this, args);
                const cst = this.CST_STACK[this.CST_STACK.length - 1];
                this.cstPostRule(cst);
                return cst;
              } catch (e3) {
                return this.invokeRuleCatch(e3, resyncEnabled, recoveryValueFunc);
              } finally {
                this.ruleFinallyStateUpdate();
              }
            }, "invokeRuleWithTry");
          } else {
            invokeRuleWithTry = /* @__PURE__ */ __name(function invokeRuleWithTryCst(...args) {
              try {
                this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx);
                return impl2.apply(this, args);
              } catch (e3) {
                return this.invokeRuleCatch(e3, resyncEnabled, recoveryValueFunc);
              } finally {
                this.ruleFinallyStateUpdate();
              }
            }, "invokeRuleWithTryCst");
          }
          const wrappedGrammarRule = Object.assign(invokeRuleWithTry, { ruleName, originalGrammarAction: impl2 });
          return wrappedGrammarRule;
        }
        invokeRuleCatch(e3, resyncEnabledConfig, recoveryValueFunc) {
          const isFirstInvokedRule = this.RULE_STACK.length === 1;
          const reSyncEnabled = resyncEnabledConfig && !this.isBackTracking() && this.recoveryEnabled;
          if (isRecognitionException(e3)) {
            const recogError = e3;
            if (reSyncEnabled) {
              const reSyncTokType = this.findReSyncTokenType();
              if (this.isInCurrentRuleReSyncSet(reSyncTokType)) {
                recogError.resyncedTokens = this.reSyncTo(reSyncTokType);
                if (this.outputCst) {
                  const partialCstResult = this.CST_STACK[this.CST_STACK.length - 1];
                  partialCstResult.recoveredNode = true;
                  return partialCstResult;
                } else {
                  return recoveryValueFunc(e3);
                }
              } else {
                if (this.outputCst) {
                  const partialCstResult = this.CST_STACK[this.CST_STACK.length - 1];
                  partialCstResult.recoveredNode = true;
                  recogError.partialCstResult = partialCstResult;
                }
                throw recogError;
              }
            } else if (isFirstInvokedRule) {
              this.moveToTerminatedState();
              return recoveryValueFunc(e3);
            } else {
              throw recogError;
            }
          } else {
            throw e3;
          }
        }
        // Implementation of parsing DSL
        optionInternal(actionORMethodDef, occurrence) {
          const key = this.getKeyForAutomaticLookahead(OPTION_IDX, occurrence);
          return this.optionInternalLogic(actionORMethodDef, occurrence, key);
        }
        optionInternalLogic(actionORMethodDef, occurrence, key) {
          let lookAheadFunc = this.getLaFuncFromCache(key);
          let action;
          if (typeof actionORMethodDef !== "function") {
            action = actionORMethodDef.DEF;
            const predicate = actionORMethodDef.GATE;
            if (predicate !== void 0) {
              const orgLookaheadFunction = lookAheadFunc;
              lookAheadFunc = /* @__PURE__ */ __name(() => {
                return predicate.call(this) && orgLookaheadFunction.call(this);
              }, "lookAheadFunc");
            }
          } else {
            action = actionORMethodDef;
          }
          if (lookAheadFunc.call(this) === true) {
            return action.call(this);
          }
          return void 0;
        }
        atLeastOneInternal(prodOccurrence, actionORMethodDef) {
          const laKey = this.getKeyForAutomaticLookahead(AT_LEAST_ONE_IDX, prodOccurrence);
          return this.atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, laKey);
        }
        atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, key) {
          let lookAheadFunc = this.getLaFuncFromCache(key);
          let action;
          if (typeof actionORMethodDef !== "function") {
            action = actionORMethodDef.DEF;
            const predicate = actionORMethodDef.GATE;
            if (predicate !== void 0) {
              const orgLookaheadFunction = lookAheadFunc;
              lookAheadFunc = /* @__PURE__ */ __name(() => {
                return predicate.call(this) && orgLookaheadFunction.call(this);
              }, "lookAheadFunc");
            }
          } else {
            action = actionORMethodDef;
          }
          if (lookAheadFunc.call(this) === true) {
            let notStuck = this.doSingleRepetition(action);
            while (lookAheadFunc.call(this) === true && notStuck === true) {
              notStuck = this.doSingleRepetition(action);
            }
          } else {
            throw this.raiseEarlyExitException(prodOccurrence, PROD_TYPE.REPETITION_MANDATORY, actionORMethodDef.ERR_MSG);
          }
          this.attemptInRepetitionRecovery(this.atLeastOneInternal, [prodOccurrence, actionORMethodDef], lookAheadFunc, AT_LEAST_ONE_IDX, prodOccurrence, NextTerminalAfterAtLeastOneWalker);
        }
        atLeastOneSepFirstInternal(prodOccurrence, options2) {
          const laKey = this.getKeyForAutomaticLookahead(AT_LEAST_ONE_SEP_IDX, prodOccurrence);
          this.atLeastOneSepFirstInternalLogic(prodOccurrence, options2, laKey);
        }
        atLeastOneSepFirstInternalLogic(prodOccurrence, options2, key) {
          const action = options2.DEF;
          const separator = options2.SEP;
          const firstIterationLookaheadFunc = this.getLaFuncFromCache(key);
          if (firstIterationLookaheadFunc.call(this) === true) {
            action.call(this);
            const separatorLookAheadFunc = /* @__PURE__ */ __name(() => {
              return this.tokenMatcher(this.LA(1), separator);
            }, "separatorLookAheadFunc");
            while (this.tokenMatcher(this.LA(1), separator) === true) {
              this.CONSUME(separator);
              action.call(this);
            }
            this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [
              prodOccurrence,
              separator,
              separatorLookAheadFunc,
              action,
              NextTerminalAfterAtLeastOneSepWalker
            ], separatorLookAheadFunc, AT_LEAST_ONE_SEP_IDX, prodOccurrence, NextTerminalAfterAtLeastOneSepWalker);
          } else {
            throw this.raiseEarlyExitException(prodOccurrence, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, options2.ERR_MSG);
          }
        }
        manyInternal(prodOccurrence, actionORMethodDef) {
          const laKey = this.getKeyForAutomaticLookahead(MANY_IDX, prodOccurrence);
          return this.manyInternalLogic(prodOccurrence, actionORMethodDef, laKey);
        }
        manyInternalLogic(prodOccurrence, actionORMethodDef, key) {
          let lookaheadFunction = this.getLaFuncFromCache(key);
          let action;
          if (typeof actionORMethodDef !== "function") {
            action = actionORMethodDef.DEF;
            const predicate = actionORMethodDef.GATE;
            if (predicate !== void 0) {
              const orgLookaheadFunction = lookaheadFunction;
              lookaheadFunction = /* @__PURE__ */ __name(() => {
                return predicate.call(this) && orgLookaheadFunction.call(this);
              }, "lookaheadFunction");
            }
          } else {
            action = actionORMethodDef;
          }
          let notStuck = true;
          while (lookaheadFunction.call(this) === true && notStuck === true) {
            notStuck = this.doSingleRepetition(action);
          }
          this.attemptInRepetitionRecovery(
            this.manyInternal,
            [prodOccurrence, actionORMethodDef],
            lookaheadFunction,
            MANY_IDX,
            prodOccurrence,
            NextTerminalAfterManyWalker,
            // The notStuck parameter is only relevant when "attemptInRepetitionRecovery"
            // is invoked from manyInternal, in the MANY_SEP case and AT_LEAST_ONE[_SEP]
            // An infinite loop cannot occur as:
            // - Either the lookahead is guaranteed to consume something (Single Token Separator)
            // - AT_LEAST_ONE by definition is guaranteed to consume something (or error out).
            notStuck
          );
        }
        manySepFirstInternal(prodOccurrence, options2) {
          const laKey = this.getKeyForAutomaticLookahead(MANY_SEP_IDX, prodOccurrence);
          this.manySepFirstInternalLogic(prodOccurrence, options2, laKey);
        }
        manySepFirstInternalLogic(prodOccurrence, options2, key) {
          const action = options2.DEF;
          const separator = options2.SEP;
          const firstIterationLaFunc = this.getLaFuncFromCache(key);
          if (firstIterationLaFunc.call(this) === true) {
            action.call(this);
            const separatorLookAheadFunc = /* @__PURE__ */ __name(() => {
              return this.tokenMatcher(this.LA(1), separator);
            }, "separatorLookAheadFunc");
            while (this.tokenMatcher(this.LA(1), separator) === true) {
              this.CONSUME(separator);
              action.call(this);
            }
            this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [
              prodOccurrence,
              separator,
              separatorLookAheadFunc,
              action,
              NextTerminalAfterManySepWalker
            ], separatorLookAheadFunc, MANY_SEP_IDX, prodOccurrence, NextTerminalAfterManySepWalker);
          }
        }
        repetitionSepSecondInternal(prodOccurrence, separator, separatorLookAheadFunc, action, nextTerminalAfterWalker) {
          while (separatorLookAheadFunc()) {
            this.CONSUME(separator);
            action.call(this);
          }
          this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [
            prodOccurrence,
            separator,
            separatorLookAheadFunc,
            action,
            nextTerminalAfterWalker
          ], separatorLookAheadFunc, AT_LEAST_ONE_SEP_IDX, prodOccurrence, nextTerminalAfterWalker);
        }
        doSingleRepetition(action) {
          const beforeIteration = this.getLexerPosition();
          action.call(this);
          const afterIteration = this.getLexerPosition();
          return afterIteration > beforeIteration;
        }
        orInternal(altsOrOpts, occurrence) {
          const laKey = this.getKeyForAutomaticLookahead(OR_IDX, occurrence);
          const alts = isArray_default(altsOrOpts) ? altsOrOpts : altsOrOpts.DEF;
          const laFunc = this.getLaFuncFromCache(laKey);
          const altIdxToTake = laFunc.call(this, alts);
          if (altIdxToTake !== void 0) {
            const chosenAlternative = alts[altIdxToTake];
            return chosenAlternative.ALT.call(this);
          }
          this.raiseNoAltException(occurrence, altsOrOpts.ERR_MSG);
        }
        ruleFinallyStateUpdate() {
          this.RULE_STACK.pop();
          this.RULE_OCCURRENCE_STACK.pop();
          this.cstFinallyStateUpdate();
          if (this.RULE_STACK.length === 0 && this.isAtEndOfInput() === false) {
            const firstRedundantTok = this.LA(1);
            const errMsg = this.errorMessageProvider.buildNotAllInputParsedMessage({
              firstRedundant: firstRedundantTok,
              ruleName: this.getCurrRuleFullName()
            });
            this.SAVE_ERROR(new NotAllInputParsedException(errMsg, firstRedundantTok));
          }
        }
        subruleInternal(ruleToCall, idx, options2) {
          let ruleResult;
          try {
            const args = options2 !== void 0 ? options2.ARGS : void 0;
            this.subruleIdx = idx;
            ruleResult = ruleToCall.apply(this, args);
            this.cstPostNonTerminal(ruleResult, options2 !== void 0 && options2.LABEL !== void 0 ? options2.LABEL : ruleToCall.ruleName);
            return ruleResult;
          } catch (e3) {
            throw this.subruleInternalError(e3, options2, ruleToCall.ruleName);
          }
        }
        subruleInternalError(e3, options2, ruleName) {
          if (isRecognitionException(e3) && e3.partialCstResult !== void 0) {
            this.cstPostNonTerminal(e3.partialCstResult, options2 !== void 0 && options2.LABEL !== void 0 ? options2.LABEL : ruleName);
            delete e3.partialCstResult;
          }
          throw e3;
        }
        consumeInternal(tokType, idx, options2) {
          let consumedToken;
          try {
            const nextToken = this.LA(1);
            if (this.tokenMatcher(nextToken, tokType) === true) {
              this.consumeToken();
              consumedToken = nextToken;
            } else {
              this.consumeInternalError(tokType, nextToken, options2);
            }
          } catch (eFromConsumption) {
            consumedToken = this.consumeInternalRecovery(tokType, idx, eFromConsumption);
          }
          this.cstPostTerminal(options2 !== void 0 && options2.LABEL !== void 0 ? options2.LABEL : tokType.name, consumedToken);
          return consumedToken;
        }
        consumeInternalError(tokType, nextToken, options2) {
          let msg;
          const previousToken = this.LA(0);
          if (options2 !== void 0 && options2.ERR_MSG) {
            msg = options2.ERR_MSG;
          } else {
            msg = this.errorMessageProvider.buildMismatchTokenMessage({
              expected: tokType,
              actual: nextToken,
              previous: previousToken,
              ruleName: this.getCurrRuleFullName()
            });
          }
          throw this.SAVE_ERROR(new MismatchedTokenException(msg, nextToken, previousToken));
        }
        consumeInternalRecovery(tokType, idx, eFromConsumption) {
          if (this.recoveryEnabled && // TODO: more robust checking of the exception type. Perhaps Typescript extending expressions?
          eFromConsumption.name === "MismatchedTokenException" && !this.isBackTracking()) {
            const follows = this.getFollowsForInRuleRecovery(tokType, idx);
            try {
              return this.tryInRuleRecovery(tokType, follows);
            } catch (eFromInRuleRecovery) {
              if (eFromInRuleRecovery.name === IN_RULE_RECOVERY_EXCEPTION) {
                throw eFromConsumption;
              } else {
                throw eFromInRuleRecovery;
              }
            }
          } else {
            throw eFromConsumption;
          }
        }
        saveRecogState() {
          const savedErrors = this.errors;
          const savedRuleStack = clone_default2(this.RULE_STACK);
          return {
            errors: savedErrors,
            lexerState: this.exportLexerState(),
            RULE_STACK: savedRuleStack,
            CST_STACK: this.CST_STACK
          };
        }
        reloadRecogState(newState2) {
          this.errors = newState2.errors;
          this.importLexerState(newState2.lexerState);
          this.RULE_STACK = newState2.RULE_STACK;
        }
        ruleInvocationStateUpdate(shortName, fullName, idxInCallingRule) {
          this.RULE_OCCURRENCE_STACK.push(idxInCallingRule);
          this.RULE_STACK.push(shortName);
          this.cstInvocationStateUpdate(fullName);
        }
        isBackTracking() {
          return this.isBackTrackingStack.length !== 0;
        }
        getCurrRuleFullName() {
          const shortName = this.getLastExplicitRuleShortName();
          return this.shortRuleNameToFull[shortName];
        }
        shortRuleNameToFullName(shortName) {
          return this.shortRuleNameToFull[shortName];
        }
        isAtEndOfInput() {
          return this.tokenMatcher(this.LA(1), EOF);
        }
        reset() {
          this.resetLexerState();
          this.subruleIdx = 0;
          this.isBackTrackingStack = [];
          this.errors = [];
          this.RULE_STACK = [];
          this.CST_STACK = [];
          this.RULE_OCCURRENCE_STACK = [];
        }
      };
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js
  var ErrorHandler;
  var init_error_handler = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js"() {
      "use strict";
      init_exceptions_public();
      init_lodash();
      init_lookahead();
      init_parser();
      ErrorHandler = class {
        static {
          __name(this, "ErrorHandler");
        }
        initErrorHandler(config5) {
          this._errors = [];
          this.errorMessageProvider = has_default(config5, "errorMessageProvider") ? config5.errorMessageProvider : DEFAULT_PARSER_CONFIG.errorMessageProvider;
        }
        SAVE_ERROR(error3) {
          if (isRecognitionException(error3)) {
            error3.context = {
              ruleStack: this.getHumanReadableRuleStack(),
              ruleOccurrenceStack: clone_default2(this.RULE_OCCURRENCE_STACK)
            };
            this._errors.push(error3);
            return error3;
          } else {
            throw Error("Trying to save an Error which is not a RecognitionException");
          }
        }
        get errors() {
          return clone_default2(this._errors);
        }
        set errors(newErrors) {
          this._errors = newErrors;
        }
        // TODO: consider caching the error message computed information
        raiseEarlyExitException(occurrence, prodType, userDefinedErrMsg) {
          const ruleName = this.getCurrRuleFullName();
          const ruleGrammar = this.getGAstProductions()[ruleName];
          const lookAheadPathsPerAlternative = getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, this.maxLookahead);
          const insideProdPaths = lookAheadPathsPerAlternative[0];
          const actualTokens = [];
          for (let i2 = 1; i2 <= this.maxLookahead; i2++) {
            actualTokens.push(this.LA(i2));
          }
          const msg = this.errorMessageProvider.buildEarlyExitMessage({
            expectedIterationPaths: insideProdPaths,
            actual: actualTokens,
            previous: this.LA(0),
            customUserDescription: userDefinedErrMsg,
            ruleName
          });
          throw this.SAVE_ERROR(new EarlyExitException(msg, this.LA(1), this.LA(0)));
        }
        // TODO: consider caching the error message computed information
        raiseNoAltException(occurrence, errMsgTypes) {
          const ruleName = this.getCurrRuleFullName();
          const ruleGrammar = this.getGAstProductions()[ruleName];
          const lookAheadPathsPerAlternative = getLookaheadPathsForOr(occurrence, ruleGrammar, this.maxLookahead);
          const actualTokens = [];
          for (let i2 = 1; i2 <= this.maxLookahead; i2++) {
            actualTokens.push(this.LA(i2));
          }
          const previousToken = this.LA(0);
          const errMsg = this.errorMessageProvider.buildNoViableAltMessage({
            expectedPathsPerAlt: lookAheadPathsPerAlternative,
            actual: actualTokens,
            previous: previousToken,
            customUserDescription: errMsgTypes,
            ruleName: this.getCurrRuleFullName()
          });
          throw this.SAVE_ERROR(new NoViableAltException(errMsg, this.LA(1), previousToken));
        }
      };
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js
  var ContentAssist;
  var init_context_assist = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js"() {
      "use strict";
      init_interpreter();
      init_lodash();
      ContentAssist = class {
        static {
          __name(this, "ContentAssist");
        }
        initContentAssist() {
        }
        computeContentAssist(startRuleName, precedingInput) {
          const startRuleGast = this.gastProductionsCache[startRuleName];
          if (isUndefined_default(startRuleGast)) {
            throw Error(`Rule ->${startRuleName}<- does not exist in this grammar.`);
          }
          return nextPossibleTokensAfter([startRuleGast], precedingInput, this.tokenMatcher, this.maxLookahead);
        }
        // TODO: should this be a member method or a utility? it does not have any state or usage of 'this'...
        // TODO: should this be more explicitly part of the public API?
        getNextPossibleTokenTypes(grammarPath) {
          const topRuleName = head_default(grammarPath.ruleStack);
          const gastProductions = this.getGAstProductions();
          const topProduction = gastProductions[topRuleName];
          const nextPossibleTokenTypes = new NextAfterTokenWalker(topProduction, grammarPath).startWalking();
          return nextPossibleTokenTypes;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js
  function recordProd(prodConstructor, mainProdArg, occurrence, handleSep = false) {
    assertMethodIdxIsValid(occurrence);
    const prevProd = last_default(this.recordingProdStack);
    const grammarAction = isFunction_default(mainProdArg) ? mainProdArg : mainProdArg.DEF;
    const newProd = new prodConstructor({ definition: [], idx: occurrence });
    if (handleSep) {
      newProd.separator = mainProdArg.SEP;
    }
    if (has_default(mainProdArg, "MAX_LOOKAHEAD")) {
      newProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD;
    }
    this.recordingProdStack.push(newProd);
    grammarAction.call(this);
    prevProd.definition.push(newProd);
    this.recordingProdStack.pop();
    return RECORDING_NULL_OBJECT;
  }
  function recordOrProd(mainProdArg, occurrence) {
    assertMethodIdxIsValid(occurrence);
    const prevProd = last_default(this.recordingProdStack);
    const hasOptions = isArray_default(mainProdArg) === false;
    const alts = hasOptions === false ? mainProdArg : mainProdArg.DEF;
    const newOrProd = new Alternation({
      definition: [],
      idx: occurrence,
      ignoreAmbiguities: hasOptions && mainProdArg.IGNORE_AMBIGUITIES === true
    });
    if (has_default(mainProdArg, "MAX_LOOKAHEAD")) {
      newOrProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD;
    }
    const hasPredicates = some_default(alts, (currAlt) => isFunction_default(currAlt.GATE));
    newOrProd.hasPredicates = hasPredicates;
    prevProd.definition.push(newOrProd);
    forEach_default(alts, (currAlt) => {
      const currAltFlat = new Alternative({ definition: [] });
      newOrProd.definition.push(currAltFlat);
      if (has_default(currAlt, "IGNORE_AMBIGUITIES")) {
        currAltFlat.ignoreAmbiguities = currAlt.IGNORE_AMBIGUITIES;
      } else if (has_default(currAlt, "GATE")) {
        currAltFlat.ignoreAmbiguities = true;
      }
      this.recordingProdStack.push(currAltFlat);
      currAlt.ALT.call(this);
      this.recordingProdStack.pop();
    });
    return RECORDING_NULL_OBJECT;
  }
  function getIdxSuffix(idx) {
    return idx === 0 ? "" : `${idx}`;
  }
  function assertMethodIdxIsValid(idx) {
    if (idx < 0 || idx > MAX_METHOD_IDX) {
      const error3 = new Error(
        // The stack trace will contain all the needed details
        `Invalid DSL Method idx value: <${idx}>
	Idx value must be a none negative value smaller than ${MAX_METHOD_IDX + 1}`
      );
      error3.KNOWN_RECORDER_ERROR = true;
      throw error3;
    }
  }
  var RECORDING_NULL_OBJECT, HANDLE_SEPARATOR, MAX_METHOD_IDX, RFT, RECORDING_PHASE_TOKEN, RECORDING_PHASE_CSTNODE, GastRecorder;
  var init_gast_recorder = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js"() {
      "use strict";
      init_lodash();
      init_api3();
      init_lexer_public();
      init_tokens();
      init_tokens_public();
      init_parser();
      init_keys2();
      RECORDING_NULL_OBJECT = {
        description: "This Object indicates the Parser is during Recording Phase"
      };
      Object.freeze(RECORDING_NULL_OBJECT);
      HANDLE_SEPARATOR = true;
      MAX_METHOD_IDX = Math.pow(2, BITS_FOR_OCCURRENCE_IDX) - 1;
      RFT = createToken({ name: "RECORDING_PHASE_TOKEN", pattern: Lexer2.NA });
      augmentTokenTypes([RFT]);
      RECORDING_PHASE_TOKEN = createTokenInstance(
        RFT,
        "This IToken indicates the Parser is in Recording Phase\n	See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",
        // Using "-1" instead of NaN (as in EOF) because an actual number is less likely to
        // cause errors if the output of LA or CONSUME would be (incorrectly) used during the recording phase.
        -1,
        -1,
        -1,
        -1,
        -1,
        -1
      );
      Object.freeze(RECORDING_PHASE_TOKEN);
      RECORDING_PHASE_CSTNODE = {
        name: "This CSTNode indicates the Parser is in Recording Phase\n	See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",
        children: {}
      };
      GastRecorder = class {
        static {
          __name(this, "GastRecorder");
        }
        initGastRecorder(config5) {
          this.recordingProdStack = [];
          this.RECORDING_PHASE = false;
        }
        enableRecording() {
          this.RECORDING_PHASE = true;
          this.TRACE_INIT("Enable Recording", () => {
            for (let i2 = 0; i2 < 10; i2++) {
              const idx = i2 > 0 ? i2 : "";
              this[`CONSUME${idx}`] = function(arg1, arg2) {
                return this.consumeInternalRecord(arg1, i2, arg2);
              };
              this[`SUBRULE${idx}`] = function(arg1, arg2) {
                return this.subruleInternalRecord(arg1, i2, arg2);
              };
              this[`OPTION${idx}`] = function(arg1) {
                return this.optionInternalRecord(arg1, i2);
              };
              this[`OR${idx}`] = function(arg1) {
                return this.orInternalRecord(arg1, i2);
              };
              this[`MANY${idx}`] = function(arg1) {
                this.manyInternalRecord(i2, arg1);
              };
              this[`MANY_SEP${idx}`] = function(arg1) {
                this.manySepFirstInternalRecord(i2, arg1);
              };
              this[`AT_LEAST_ONE${idx}`] = function(arg1) {
                this.atLeastOneInternalRecord(i2, arg1);
              };
              this[`AT_LEAST_ONE_SEP${idx}`] = function(arg1) {
                this.atLeastOneSepFirstInternalRecord(i2, arg1);
              };
            }
            this[`consume`] = function(idx, arg1, arg2) {
              return this.consumeInternalRecord(arg1, idx, arg2);
            };
            this[`subrule`] = function(idx, arg1, arg2) {
              return this.subruleInternalRecord(arg1, idx, arg2);
            };
            this[`option`] = function(idx, arg1) {
              return this.optionInternalRecord(arg1, idx);
            };
            this[`or`] = function(idx, arg1) {
              return this.orInternalRecord(arg1, idx);
            };
            this[`many`] = function(idx, arg1) {
              this.manyInternalRecord(idx, arg1);
            };
            this[`atLeastOne`] = function(idx, arg1) {
              this.atLeastOneInternalRecord(idx, arg1);
            };
            this.ACTION = this.ACTION_RECORD;
            this.BACKTRACK = this.BACKTRACK_RECORD;
            this.LA = this.LA_RECORD;
          });
        }
        disableRecording() {
          this.RECORDING_PHASE = false;
          this.TRACE_INIT("Deleting Recording methods", () => {
            const that = this;
            for (let i2 = 0; i2 < 10; i2++) {
              const idx = i2 > 0 ? i2 : "";
              delete that[`CONSUME${idx}`];
              delete that[`SUBRULE${idx}`];
              delete that[`OPTION${idx}`];
              delete that[`OR${idx}`];
              delete that[`MANY${idx}`];
              delete that[`MANY_SEP${idx}`];
              delete that[`AT_LEAST_ONE${idx}`];
              delete that[`AT_LEAST_ONE_SEP${idx}`];
            }
            delete that[`consume`];
            delete that[`subrule`];
            delete that[`option`];
            delete that[`or`];
            delete that[`many`];
            delete that[`atLeastOne`];
            delete that.ACTION;
            delete that.BACKTRACK;
            delete that.LA;
          });
        }
        //   Parser methods are called inside an ACTION?
        //   Maybe try/catch/finally on ACTIONS while disabling the recorders state changes?
        // @ts-expect-error -- noop place holder
        ACTION_RECORD(impl2) {
        }
        // Executing backtracking logic will break our recording logic assumptions
        BACKTRACK_RECORD(grammarRule, args) {
          return () => true;
        }
        // LA is part of the official API and may be used for custom lookahead logic
        // by end users who may forget to wrap it in ACTION or inside a GATE
        LA_RECORD(howMuch) {
          return END_OF_FILE;
        }
        topLevelRuleRecord(name, def) {
          try {
            const newTopLevelRule = new Rule({ definition: [], name });
            newTopLevelRule.name = name;
            this.recordingProdStack.push(newTopLevelRule);
            def.call(this);
            this.recordingProdStack.pop();
            return newTopLevelRule;
          } catch (originalError) {
            if (originalError.KNOWN_RECORDER_ERROR !== true) {
              try {
                originalError.message = originalError.message + '\n	 This error was thrown during the "grammar recording phase" For more info see:\n	https://chevrotain.io/docs/guide/internals.html#grammar-recording';
              } catch (mutabilityError) {
                throw originalError;
              }
            }
            throw originalError;
          }
        }
        // Implementation of parsing DSL
        optionInternalRecord(actionORMethodDef, occurrence) {
          return recordProd.call(this, Option2, actionORMethodDef, occurrence);
        }
        atLeastOneInternalRecord(occurrence, actionORMethodDef) {
          recordProd.call(this, RepetitionMandatory, actionORMethodDef, occurrence);
        }
        atLeastOneSepFirstInternalRecord(occurrence, options2) {
          recordProd.call(this, RepetitionMandatoryWithSeparator, options2, occurrence, HANDLE_SEPARATOR);
        }
        manyInternalRecord(occurrence, actionORMethodDef) {
          recordProd.call(this, Repetition, actionORMethodDef, occurrence);
        }
        manySepFirstInternalRecord(occurrence, options2) {
          recordProd.call(this, RepetitionWithSeparator, options2, occurrence, HANDLE_SEPARATOR);
        }
        orInternalRecord(altsOrOpts, occurrence) {
          return recordOrProd.call(this, altsOrOpts, occurrence);
        }
        subruleInternalRecord(ruleToCall, occurrence, options2) {
          assertMethodIdxIsValid(occurrence);
          if (!ruleToCall || has_default(ruleToCall, "ruleName") === false) {
            const error3 = new Error(`<SUBRULE${getIdxSuffix(occurrence)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(ruleToCall)}>
 inside top level rule: <${this.recordingProdStack[0].name}>`);
            error3.KNOWN_RECORDER_ERROR = true;
            throw error3;
          }
          const prevProd = last_default(this.recordingProdStack);
          const ruleName = ruleToCall.ruleName;
          const newNoneTerminal = new NonTerminal({
            idx: occurrence,
            nonTerminalName: ruleName,
            label: options2 === null || options2 === void 0 ? void 0 : options2.LABEL,
            // The resolving of the `referencedRule` property will be done once all the Rule's GASTs have been created
            referencedRule: void 0
          });
          prevProd.definition.push(newNoneTerminal);
          return this.outputCst ? RECORDING_PHASE_CSTNODE : RECORDING_NULL_OBJECT;
        }
        consumeInternalRecord(tokType, occurrence, options2) {
          assertMethodIdxIsValid(occurrence);
          if (!hasShortKeyProperty(tokType)) {
            const error3 = new Error(`<CONSUME${getIdxSuffix(occurrence)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(tokType)}>
 inside top level rule: <${this.recordingProdStack[0].name}>`);
            error3.KNOWN_RECORDER_ERROR = true;
            throw error3;
          }
          const prevProd = last_default(this.recordingProdStack);
          const newNoneTerminal = new Terminal({
            idx: occurrence,
            terminalType: tokType,
            label: options2 === null || options2 === void 0 ? void 0 : options2.LABEL
          });
          prevProd.definition.push(newNoneTerminal);
          return RECORDING_PHASE_TOKEN;
        }
      };
      __name(recordProd, "recordProd");
      __name(recordOrProd, "recordOrProd");
      __name(getIdxSuffix, "getIdxSuffix");
      __name(assertMethodIdxIsValid, "assertMethodIdxIsValid");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js
  var PerformanceTracer;
  var init_perf_tracer = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js"() {
      "use strict";
      init_lodash();
      init_api2();
      init_parser();
      PerformanceTracer = class {
        static {
          __name(this, "PerformanceTracer");
        }
        initPerformanceTracer(config5) {
          if (has_default(config5, "traceInitPerf")) {
            const userTraceInitPerf = config5.traceInitPerf;
            const traceIsNumber = typeof userTraceInitPerf === "number";
            this.traceInitMaxIdent = traceIsNumber ? userTraceInitPerf : Infinity;
            this.traceInitPerf = traceIsNumber ? userTraceInitPerf > 0 : userTraceInitPerf;
          } else {
            this.traceInitMaxIdent = 0;
            this.traceInitPerf = DEFAULT_PARSER_CONFIG.traceInitPerf;
          }
          this.traceInitIndent = -1;
        }
        TRACE_INIT(phaseDesc, phaseImpl) {
          if (this.traceInitPerf === true) {
            this.traceInitIndent++;
            const indent = new Array(this.traceInitIndent + 1).join("	");
            if (this.traceInitIndent < this.traceInitMaxIdent) {
              console.log(`${indent}--> <${phaseDesc}>`);
            }
            const { time: time4, value: value2 } = timer2(phaseImpl);
            const traceMethod = time4 > 10 ? console.warn : console.log;
            if (this.traceInitIndent < this.traceInitMaxIdent) {
              traceMethod(`${indent}<-- <${phaseDesc}> time: ${time4}ms`);
            }
            this.traceInitIndent--;
            return value2;
          } else {
            return phaseImpl();
          }
        }
      };
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/utils/apply_mixins.js
  function applyMixins(derivedCtor, baseCtors) {
    baseCtors.forEach((baseCtor) => {
      const baseProto = baseCtor.prototype;
      Object.getOwnPropertyNames(baseProto).forEach((propName) => {
        if (propName === "constructor") {
          return;
        }
        const basePropDescriptor = Object.getOwnPropertyDescriptor(baseProto, propName);
        if (basePropDescriptor && (basePropDescriptor.get || basePropDescriptor.set)) {
          Object.defineProperty(derivedCtor.prototype, propName, basePropDescriptor);
        } else {
          derivedCtor.prototype[propName] = baseCtor.prototype[propName];
        }
      });
    });
  }
  var init_apply_mixins = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/utils/apply_mixins.js"() {
      "use strict";
      __name(applyMixins, "applyMixins");
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/parser.js
  function EMPTY_ALT(value2 = void 0) {
    return function() {
      return value2;
    };
  }
  var END_OF_FILE, DEFAULT_PARSER_CONFIG, DEFAULT_RULE_CONFIG, ParserDefinitionErrorType, Parser2, EmbeddedActionsParser;
  var init_parser = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/parse/parser/parser.js"() {
      "use strict";
      init_lodash();
      init_api2();
      init_follow();
      init_tokens_public();
      init_errors_public();
      init_gast_resolver_public();
      init_recoverable();
      init_looksahead();
      init_tree_builder();
      init_lexer_adapter();
      init_recognizer_api();
      init_recognizer_engine();
      init_error_handler();
      init_context_assist();
      init_gast_recorder();
      init_perf_tracer();
      init_apply_mixins();
      init_checks();
      END_OF_FILE = createTokenInstance(EOF, "", NaN, NaN, NaN, NaN, NaN, NaN);
      Object.freeze(END_OF_FILE);
      DEFAULT_PARSER_CONFIG = Object.freeze({
        recoveryEnabled: false,
        maxLookahead: 3,
        dynamicTokensEnabled: false,
        outputCst: true,
        errorMessageProvider: defaultParserErrorProvider,
        nodeLocationTracking: "none",
        traceInitPerf: false,
        skipValidations: false
      });
      DEFAULT_RULE_CONFIG = Object.freeze({
        recoveryValueFunc: /* @__PURE__ */ __name(() => void 0, "recoveryValueFunc"),
        resyncEnabled: true
      });
      (function(ParserDefinitionErrorType2) {
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["INVALID_RULE_NAME"] = 0] = "INVALID_RULE_NAME";
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["DUPLICATE_RULE_NAME"] = 1] = "DUPLICATE_RULE_NAME";
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["INVALID_RULE_OVERRIDE"] = 2] = "INVALID_RULE_OVERRIDE";
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["DUPLICATE_PRODUCTIONS"] = 3] = "DUPLICATE_PRODUCTIONS";
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["UNRESOLVED_SUBRULE_REF"] = 4] = "UNRESOLVED_SUBRULE_REF";
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["LEFT_RECURSION"] = 5] = "LEFT_RECURSION";
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["NONE_LAST_EMPTY_ALT"] = 6] = "NONE_LAST_EMPTY_ALT";
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["AMBIGUOUS_ALTS"] = 7] = "AMBIGUOUS_ALTS";
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["CONFLICT_TOKENS_RULES_NAMESPACE"] = 8] = "CONFLICT_TOKENS_RULES_NAMESPACE";
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["INVALID_TOKEN_NAME"] = 9] = "INVALID_TOKEN_NAME";
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["NO_NON_EMPTY_LOOKAHEAD"] = 10] = "NO_NON_EMPTY_LOOKAHEAD";
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["AMBIGUOUS_PREFIX_ALTS"] = 11] = "AMBIGUOUS_PREFIX_ALTS";
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["TOO_MANY_ALTS"] = 12] = "TOO_MANY_ALTS";
        ParserDefinitionErrorType2[ParserDefinitionErrorType2["CUSTOM_LOOKAHEAD_VALIDATION"] = 13] = "CUSTOM_LOOKAHEAD_VALIDATION";
      })(ParserDefinitionErrorType || (ParserDefinitionErrorType = {}));
      __name(EMPTY_ALT, "EMPTY_ALT");
      Parser2 = class _Parser {
        static {
          __name(this, "Parser");
        }
        /**
         *  @deprecated use the **instance** method with the same name instead
         */
        static performSelfAnalysis(parserInstance) {
          throw Error("The **static** `performSelfAnalysis` method has been deprecated.	\nUse the **instance** method with the same name instead.");
        }
        performSelfAnalysis() {
          this.TRACE_INIT("performSelfAnalysis", () => {
            let defErrorsMsgs;
            this.selfAnalysisDone = true;
            const className = this.className;
            this.TRACE_INIT("toFastProps", () => {
              toFastProperties(this);
            });
            this.TRACE_INIT("Grammar Recording", () => {
              try {
                this.enableRecording();
                forEach_default(this.definedRulesNames, (currRuleName) => {
                  const wrappedRule = this[currRuleName];
                  const originalGrammarAction = wrappedRule["originalGrammarAction"];
                  let recordedRuleGast;
                  this.TRACE_INIT(`${currRuleName} Rule`, () => {
                    recordedRuleGast = this.topLevelRuleRecord(currRuleName, originalGrammarAction);
                  });
                  this.gastProductionsCache[currRuleName] = recordedRuleGast;
                });
              } finally {
                this.disableRecording();
              }
            });
            let resolverErrors = [];
            this.TRACE_INIT("Grammar Resolving", () => {
              resolverErrors = resolveGrammar2({
                rules: values_default(this.gastProductionsCache)
              });
              this.definitionErrors = this.definitionErrors.concat(resolverErrors);
            });
            this.TRACE_INIT("Grammar Validations", () => {
              if (isEmpty_default(resolverErrors) && this.skipValidations === false) {
                const validationErrors = validateGrammar2({
                  rules: values_default(this.gastProductionsCache),
                  tokenTypes: values_default(this.tokensMap),
                  errMsgProvider: defaultGrammarValidatorErrorProvider,
                  grammarName: className
                });
                const lookaheadValidationErrors = validateLookahead({
                  lookaheadStrategy: this.lookaheadStrategy,
                  rules: values_default(this.gastProductionsCache),
                  tokenTypes: values_default(this.tokensMap),
                  grammarName: className
                });
                this.definitionErrors = this.definitionErrors.concat(validationErrors, lookaheadValidationErrors);
              }
            });
            if (isEmpty_default(this.definitionErrors)) {
              if (this.recoveryEnabled) {
                this.TRACE_INIT("computeAllProdsFollows", () => {
                  const allFollows = computeAllProdsFollows(values_default(this.gastProductionsCache));
                  this.resyncFollows = allFollows;
                });
              }
              this.TRACE_INIT("ComputeLookaheadFunctions", () => {
                var _a, _b;
                (_b = (_a = this.lookaheadStrategy).initialize) === null || _b === void 0 ? void 0 : _b.call(_a, {
                  rules: values_default(this.gastProductionsCache)
                });
                this.preComputeLookaheadFunctions(values_default(this.gastProductionsCache));
              });
            }
            if (!_Parser.DEFER_DEFINITION_ERRORS_HANDLING && !isEmpty_default(this.definitionErrors)) {
              defErrorsMsgs = map_default(this.definitionErrors, (defError) => defError.message);
              throw new Error(`Parser Definition Errors detected:
 ${defErrorsMsgs.join("\n-------------------------------\n")}`);
            }
          });
        }
        constructor(tokenVocabulary, config5) {
          this.definitionErrors = [];
          this.selfAnalysisDone = false;
          const that = this;
          that.initErrorHandler(config5);
          that.initLexerAdapter();
          that.initLooksAhead(config5);
          that.initRecognizerEngine(tokenVocabulary, config5);
          that.initRecoverable(config5);
          that.initTreeBuilder(config5);
          that.initContentAssist();
          that.initGastRecorder(config5);
          that.initPerformanceTracer(config5);
          if (has_default(config5, "ignoredIssues")) {
            throw new Error("The <ignoredIssues> IParserConfig property has been deprecated.\n	Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n	See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n	For further details.");
          }
          this.skipValidations = has_default(config5, "skipValidations") ? config5.skipValidations : DEFAULT_PARSER_CONFIG.skipValidations;
        }
      };
      Parser2.DEFER_DEFINITION_ERRORS_HANDLING = false;
      applyMixins(Parser2, [
        Recoverable,
        LooksAhead,
        TreeBuilder,
        LexerAdapter,
        RecognizerEngine,
        RecognizerApi,
        ErrorHandler,
        ContentAssist,
        GastRecorder,
        PerformanceTracer
      ]);
      EmbeddedActionsParser = class extends Parser2 {
        static {
          __name(this, "EmbeddedActionsParser");
        }
        constructor(tokenVocabulary, config5 = DEFAULT_PARSER_CONFIG) {
          const configClone = clone_default2(config5);
          configClone.outputCst = false;
          super(tokenVocabulary, configClone);
        }
      };
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+cst-dts-gen@11.1.1/node_modules/@chevrotain/cst-dts-gen/lib/src/model.js
  var init_model2 = __esm({
    "../../node_modules/.pnpm/@chevrotain+cst-dts-gen@11.1.1/node_modules/@chevrotain/cst-dts-gen/lib/src/model.js"() {
      "use strict";
      init_api3();
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+cst-dts-gen@11.1.1/node_modules/@chevrotain/cst-dts-gen/lib/src/generate.js
  var init_generate = __esm({
    "../../node_modules/.pnpm/@chevrotain+cst-dts-gen@11.1.1/node_modules/@chevrotain/cst-dts-gen/lib/src/generate.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/@chevrotain+cst-dts-gen@11.1.1/node_modules/@chevrotain/cst-dts-gen/lib/src/api.js
  var init_api4 = __esm({
    "../../node_modules/.pnpm/@chevrotain+cst-dts-gen@11.1.1/node_modules/@chevrotain/cst-dts-gen/lib/src/api.js"() {
      "use strict";
      init_model2();
      init_generate();
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/diagrams/render_public.js
  var init_render_public = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/diagrams/render_public.js"() {
      "use strict";
      init_version();
    }
  });

  // ../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/api.js
  var init_api5 = __esm({
    "../../node_modules/.pnpm/chevrotain@11.1.1/node_modules/chevrotain/lib/src/api.js"() {
      "use strict";
      init_version();
      init_parser();
      init_lexer_public();
      init_tokens_public();
      init_lookahead();
      init_llk_lookahead();
      init_errors_public();
      init_exceptions_public();
      init_lexer_errors_public();
      init_api3();
      init_api3();
      init_api4();
      init_render_public();
    }
  });

  // ../../node_modules/.pnpm/chevrotain-allstar@0.3.1_chevrotain@11.1.1/node_modules/chevrotain-allstar/lib/atn.js
  function buildATNKey(rule, type3, occurrence) {
    return `${rule.name}_${type3}_${occurrence}`;
  }
  function createATN(rules) {
    const atn = {
      decisionMap: {},
      decisionStates: [],
      ruleToStartState: /* @__PURE__ */ new Map(),
      ruleToStopState: /* @__PURE__ */ new Map(),
      states: []
    };
    createRuleStartAndStopATNStates(atn, rules);
    const ruleLength = rules.length;
    for (let i2 = 0; i2 < ruleLength; i2++) {
      const rule = rules[i2];
      const ruleBlock = block(atn, rule, rule);
      if (ruleBlock === void 0) {
        continue;
      }
      buildRuleHandle(atn, rule, ruleBlock);
    }
    return atn;
  }
  function createRuleStartAndStopATNStates(atn, rules) {
    const ruleLength = rules.length;
    for (let i2 = 0; i2 < ruleLength; i2++) {
      const rule = rules[i2];
      const start3 = newState(atn, rule, void 0, {
        type: ATN_RULE_START
      });
      const stop5 = newState(atn, rule, void 0, {
        type: ATN_RULE_STOP
      });
      start3.stop = stop5;
      atn.ruleToStartState.set(rule, start3);
      atn.ruleToStopState.set(rule, stop5);
    }
  }
  function atom(atn, rule, production) {
    if (production instanceof Terminal) {
      return tokenRef(atn, rule, production.terminalType, production);
    } else if (production instanceof NonTerminal) {
      return ruleRef(atn, rule, production);
    } else if (production instanceof Alternation) {
      return alternation(atn, rule, production);
    } else if (production instanceof Option2) {
      return option(atn, rule, production);
    } else if (production instanceof Repetition) {
      return repetition(atn, rule, production);
    } else if (production instanceof RepetitionWithSeparator) {
      return repetitionSep(atn, rule, production);
    } else if (production instanceof RepetitionMandatory) {
      return repetitionMandatory(atn, rule, production);
    } else if (production instanceof RepetitionMandatoryWithSeparator) {
      return repetitionMandatorySep(atn, rule, production);
    } else {
      return block(atn, rule, production);
    }
  }
  function repetition(atn, rule, repetition2) {
    const starState = newState(atn, rule, repetition2, {
      type: ATN_STAR_BLOCK_START
    });
    defineDecisionState(atn, starState);
    const handle = makeAlts(atn, rule, starState, repetition2, block(atn, rule, repetition2));
    return star(atn, rule, repetition2, handle);
  }
  function repetitionSep(atn, rule, repetition2) {
    const starState = newState(atn, rule, repetition2, {
      type: ATN_STAR_BLOCK_START
    });
    defineDecisionState(atn, starState);
    const handle = makeAlts(atn, rule, starState, repetition2, block(atn, rule, repetition2));
    const sep2 = tokenRef(atn, rule, repetition2.separator, repetition2);
    return star(atn, rule, repetition2, handle, sep2);
  }
  function repetitionMandatory(atn, rule, repetition2) {
    const plusState = newState(atn, rule, repetition2, {
      type: ATN_PLUS_BLOCK_START
    });
    defineDecisionState(atn, plusState);
    const handle = makeAlts(atn, rule, plusState, repetition2, block(atn, rule, repetition2));
    return plus(atn, rule, repetition2, handle);
  }
  function repetitionMandatorySep(atn, rule, repetition2) {
    const plusState = newState(atn, rule, repetition2, {
      type: ATN_PLUS_BLOCK_START
    });
    defineDecisionState(atn, plusState);
    const handle = makeAlts(atn, rule, plusState, repetition2, block(atn, rule, repetition2));
    const sep2 = tokenRef(atn, rule, repetition2.separator, repetition2);
    return plus(atn, rule, repetition2, handle, sep2);
  }
  function alternation(atn, rule, alternation2) {
    const start3 = newState(atn, rule, alternation2, {
      type: ATN_BASIC
    });
    defineDecisionState(atn, start3);
    const alts = map_default(alternation2.definition, (e3) => atom(atn, rule, e3));
    const handle = makeAlts(atn, rule, start3, alternation2, ...alts);
    return handle;
  }
  function option(atn, rule, option2) {
    const start3 = newState(atn, rule, option2, {
      type: ATN_BASIC
    });
    defineDecisionState(atn, start3);
    const handle = makeAlts(atn, rule, start3, option2, block(atn, rule, option2));
    return optional(atn, rule, option2, handle);
  }
  function block(atn, rule, block2) {
    const handles = filter_default3(map_default(block2.definition, (e3) => atom(atn, rule, e3)), (e3) => e3 !== void 0);
    if (handles.length === 1) {
      return handles[0];
    } else if (handles.length === 0) {
      return void 0;
    } else {
      return makeBlock(atn, handles);
    }
  }
  function plus(atn, rule, plus2, handle, sep2) {
    const blkStart = handle.left;
    const blkEnd = handle.right;
    const loop = newState(atn, rule, plus2, {
      type: ATN_PLUS_LOOP_BACK
    });
    defineDecisionState(atn, loop);
    const end2 = newState(atn, rule, plus2, {
      type: ATN_LOOP_END
    });
    blkStart.loopback = loop;
    end2.loopback = loop;
    atn.decisionMap[buildATNKey(rule, sep2 ? "RepetitionMandatoryWithSeparator" : "RepetitionMandatory", plus2.idx)] = loop;
    epsilon4(blkEnd, loop);
    if (sep2 === void 0) {
      epsilon4(loop, blkStart);
      epsilon4(loop, end2);
    } else {
      epsilon4(loop, end2);
      epsilon4(loop, sep2.left);
      epsilon4(sep2.right, blkStart);
    }
    return {
      left: blkStart,
      right: end2
    };
  }
  function star(atn, rule, star2, handle, sep2) {
    const start3 = handle.left;
    const end2 = handle.right;
    const entry = newState(atn, rule, star2, {
      type: ATN_STAR_LOOP_ENTRY
    });
    defineDecisionState(atn, entry);
    const loopEnd = newState(atn, rule, star2, {
      type: ATN_LOOP_END
    });
    const loop = newState(atn, rule, star2, {
      type: ATN_STAR_LOOP_BACK
    });
    entry.loopback = loop;
    loopEnd.loopback = loop;
    epsilon4(entry, start3);
    epsilon4(entry, loopEnd);
    epsilon4(end2, loop);
    if (sep2 !== void 0) {
      epsilon4(loop, loopEnd);
      epsilon4(loop, sep2.left);
      epsilon4(sep2.right, start3);
    } else {
      epsilon4(loop, entry);
    }
    atn.decisionMap[buildATNKey(rule, sep2 ? "RepetitionWithSeparator" : "Repetition", star2.idx)] = entry;
    return {
      left: entry,
      right: loopEnd
    };
  }
  function optional(atn, rule, optional2, handle) {
    const start3 = handle.left;
    const end2 = handle.right;
    epsilon4(start3, end2);
    atn.decisionMap[buildATNKey(rule, "Option", optional2.idx)] = start3;
    return handle;
  }
  function defineDecisionState(atn, state4) {
    atn.decisionStates.push(state4);
    state4.decision = atn.decisionStates.length - 1;
    return state4.decision;
  }
  function makeAlts(atn, rule, start3, production, ...alts) {
    const end2 = newState(atn, rule, production, {
      type: ATN_BLOCK_END,
      start: start3
    });
    start3.end = end2;
    for (const alt of alts) {
      if (alt !== void 0) {
        epsilon4(start3, alt.left);
        epsilon4(alt.right, end2);
      } else {
        epsilon4(start3, end2);
      }
    }
    const handle = {
      left: start3,
      right: end2
    };
    atn.decisionMap[buildATNKey(rule, getProdType2(production), production.idx)] = start3;
    return handle;
  }
  function getProdType2(production) {
    if (production instanceof Alternation) {
      return "Alternation";
    } else if (production instanceof Option2) {
      return "Option";
    } else if (production instanceof Repetition) {
      return "Repetition";
    } else if (production instanceof RepetitionWithSeparator) {
      return "RepetitionWithSeparator";
    } else if (production instanceof RepetitionMandatory) {
      return "RepetitionMandatory";
    } else if (production instanceof RepetitionMandatoryWithSeparator) {
      return "RepetitionMandatoryWithSeparator";
    } else {
      throw new Error("Invalid production type encountered");
    }
  }
  function makeBlock(atn, alts) {
    const altsLength = alts.length;
    for (let i2 = 0; i2 < altsLength - 1; i2++) {
      const handle = alts[i2];
      let transition2;
      if (handle.left.transitions.length === 1) {
        transition2 = handle.left.transitions[0];
      }
      const isRuleTransition = transition2 instanceof RuleTransition;
      const ruleTransition = transition2;
      const next3 = alts[i2 + 1].left;
      if (handle.left.type === ATN_BASIC && handle.right.type === ATN_BASIC && transition2 !== void 0 && (isRuleTransition && ruleTransition.followState === handle.right || transition2.target === handle.right)) {
        if (isRuleTransition) {
          ruleTransition.followState = next3;
        } else {
          transition2.target = next3;
        }
        removeState(atn, handle.right);
      } else {
        epsilon4(handle.right, next3);
      }
    }
    const first3 = alts[0];
    const last3 = alts[altsLength - 1];
    return {
      left: first3.left,
      right: last3.right
    };
  }
  function tokenRef(atn, rule, tokenType, production) {
    const left3 = newState(atn, rule, production, {
      type: ATN_BASIC
    });
    const right3 = newState(atn, rule, production, {
      type: ATN_BASIC
    });
    addTransition(left3, new AtomTransition(right3, tokenType));
    return {
      left: left3,
      right: right3
    };
  }
  function ruleRef(atn, currentRule, nonTerminal) {
    const rule = nonTerminal.referencedRule;
    const start3 = atn.ruleToStartState.get(rule);
    const left3 = newState(atn, currentRule, nonTerminal, {
      type: ATN_BASIC
    });
    const right3 = newState(atn, currentRule, nonTerminal, {
      type: ATN_BASIC
    });
    const call = new RuleTransition(start3, rule, right3);
    addTransition(left3, call);
    return {
      left: left3,
      right: right3
    };
  }
  function buildRuleHandle(atn, rule, block2) {
    const start3 = atn.ruleToStartState.get(rule);
    epsilon4(start3, block2.left);
    const stop5 = atn.ruleToStopState.get(rule);
    epsilon4(block2.right, stop5);
    const handle = {
      left: start3,
      right: stop5
    };
    return handle;
  }
  function epsilon4(a2, b3) {
    const transition2 = new EpsilonTransition(b3);
    addTransition(a2, transition2);
  }
  function newState(atn, rule, production, partial) {
    const t4 = Object.assign({
      atn,
      production,
      epsilonOnlyTransitions: false,
      rule,
      transitions: [],
      nextTokenWithinRule: [],
      stateNumber: atn.states.length
    }, partial);
    atn.states.push(t4);
    return t4;
  }
  function addTransition(state4, transition2) {
    if (state4.transitions.length === 0) {
      state4.epsilonOnlyTransitions = transition2.isEpsilon();
    }
    state4.transitions.push(transition2);
  }
  function removeState(atn, state4) {
    atn.states.splice(atn.states.indexOf(state4), 1);
  }
  var ATN_BASIC, ATN_RULE_START, ATN_PLUS_BLOCK_START, ATN_STAR_BLOCK_START, ATN_RULE_STOP, ATN_BLOCK_END, ATN_STAR_LOOP_BACK, ATN_STAR_LOOP_ENTRY, ATN_PLUS_LOOP_BACK, ATN_LOOP_END, AbstractTransition, AtomTransition, EpsilonTransition, RuleTransition;
  var init_atn = __esm({
    "../../node_modules/.pnpm/chevrotain-allstar@0.3.1_chevrotain@11.1.1/node_modules/chevrotain-allstar/lib/atn.js"() {
      "use strict";
      init_map();
      init_filter3();
      init_api5();
      __name(buildATNKey, "buildATNKey");
      ATN_BASIC = 1;
      ATN_RULE_START = 2;
      ATN_PLUS_BLOCK_START = 4;
      ATN_STAR_BLOCK_START = 5;
      ATN_RULE_STOP = 7;
      ATN_BLOCK_END = 8;
      ATN_STAR_LOOP_BACK = 9;
      ATN_STAR_LOOP_ENTRY = 10;
      ATN_PLUS_LOOP_BACK = 11;
      ATN_LOOP_END = 12;
      AbstractTransition = class {
        static {
          __name(this, "AbstractTransition");
        }
        constructor(target) {
          this.target = target;
        }
        isEpsilon() {
          return false;
        }
      };
      AtomTransition = class extends AbstractTransition {
        static {
          __name(this, "AtomTransition");
        }
        constructor(target, tokenType) {
          super(target);
          this.tokenType = tokenType;
        }
      };
      EpsilonTransition = class extends AbstractTransition {
        static {
          __name(this, "EpsilonTransition");
        }
        constructor(target) {
          super(target);
        }
        isEpsilon() {
          return true;
        }
      };
      RuleTransition = class extends AbstractTransition {
        static {
          __name(this, "RuleTransition");
        }
        constructor(ruleStart, rule, followState) {
          super(ruleStart);
          this.rule = rule;
          this.followState = followState;
        }
        isEpsilon() {
          return true;
        }
      };
      __name(createATN, "createATN");
      __name(createRuleStartAndStopATNStates, "createRuleStartAndStopATNStates");
      __name(atom, "atom");
      __name(repetition, "repetition");
      __name(repetitionSep, "repetitionSep");
      __name(repetitionMandatory, "repetitionMandatory");
      __name(repetitionMandatorySep, "repetitionMandatorySep");
      __name(alternation, "alternation");
      __name(option, "option");
      __name(block, "block");
      __name(plus, "plus");
      __name(star, "star");
      __name(optional, "optional");
      __name(defineDecisionState, "defineDecisionState");
      __name(makeAlts, "makeAlts");
      __name(getProdType2, "getProdType");
      __name(makeBlock, "makeBlock");
      __name(tokenRef, "tokenRef");
      __name(ruleRef, "ruleRef");
      __name(buildRuleHandle, "buildRuleHandle");
      __name(epsilon4, "epsilon");
      __name(newState, "newState");
      __name(addTransition, "addTransition");
      __name(removeState, "removeState");
    }
  });

  // ../../node_modules/.pnpm/chevrotain-allstar@0.3.1_chevrotain@11.1.1/node_modules/chevrotain-allstar/lib/dfa.js
  function getATNConfigKey(config5, alt = true) {
    return `${alt ? `a${config5.alt}` : ""}s${config5.state.stateNumber}:${config5.stack.map((e3) => e3.stateNumber.toString()).join("_")}`;
  }
  var DFA_ERROR, ATNConfigSet;
  var init_dfa = __esm({
    "../../node_modules/.pnpm/chevrotain-allstar@0.3.1_chevrotain@11.1.1/node_modules/chevrotain-allstar/lib/dfa.js"() {
      "use strict";
      init_map();
      DFA_ERROR = {};
      ATNConfigSet = class {
        static {
          __name(this, "ATNConfigSet");
        }
        constructor() {
          this.map = {};
          this.configs = [];
        }
        get size() {
          return this.configs.length;
        }
        finalize() {
          this.map = {};
        }
        add(config5) {
          const key = getATNConfigKey(config5);
          if (!(key in this.map)) {
            this.map[key] = this.configs.length;
            this.configs.push(config5);
          }
        }
        get elements() {
          return this.configs;
        }
        get alts() {
          return map_default(this.configs, (e3) => e3.alt);
        }
        get key() {
          let value2 = "";
          for (const k2 in this.map) {
            value2 += k2 + ":";
          }
          return value2;
        }
      };
      __name(getATNConfigKey, "getATNConfigKey");
    }
  });

  // ../../node_modules/.pnpm/chevrotain-allstar@0.3.1_chevrotain@11.1.1/node_modules/chevrotain-allstar/lib/all-star-lookahead.js
  function createDFACache(startState, decision) {
    const map5 = {};
    return (predicateSet) => {
      const key = predicateSet.toString();
      let existing = map5[key];
      if (existing !== void 0) {
        return existing;
      } else {
        existing = {
          atnStartState: startState,
          decision,
          states: {}
        };
        map5[key] = existing;
        return existing;
      }
    };
  }
  function isLL1Sequence(sequences, allowEmpty = true) {
    const fullSet = /* @__PURE__ */ new Set();
    for (const alt of sequences) {
      const altSet = /* @__PURE__ */ new Set();
      for (const tokType of alt) {
        if (tokType === void 0) {
          if (allowEmpty) {
            break;
          } else {
            return false;
          }
        }
        const indices = [tokType.tokenTypeIdx].concat(tokType.categoryMatches);
        for (const index of indices) {
          if (fullSet.has(index)) {
            if (!altSet.has(index)) {
              return false;
            }
          } else {
            fullSet.add(index);
            altSet.add(index);
          }
        }
      }
    }
    return true;
  }
  function initATNSimulator(atn) {
    const decisionLength = atn.decisionStates.length;
    const decisionToDFA = Array(decisionLength);
    for (let i2 = 0; i2 < decisionLength; i2++) {
      decisionToDFA[i2] = createDFACache(atn.decisionStates[i2], i2);
    }
    return decisionToDFA;
  }
  function adaptivePredict(dfaCaches, decision, predicateSet, logging) {
    const dfa = dfaCaches[decision](predicateSet);
    let start3 = dfa.start;
    if (start3 === void 0) {
      const closure2 = computeStartState(dfa.atnStartState);
      start3 = addDFAState(dfa, newDFAState(closure2));
      dfa.start = start3;
    }
    const alt = performLookahead.apply(this, [dfa, start3, predicateSet, logging]);
    return alt;
  }
  function performLookahead(dfa, s0, predicateSet, logging) {
    let previousD = s0;
    let i2 = 1;
    const path4 = [];
    let t4 = this.LA(i2++);
    while (true) {
      let d3 = getExistingTargetState(previousD, t4);
      if (d3 === void 0) {
        d3 = computeLookaheadTarget.apply(this, [dfa, previousD, t4, i2, predicateSet, logging]);
      }
      if (d3 === DFA_ERROR) {
        return buildAdaptivePredictError(path4, previousD, t4);
      }
      if (d3.isAcceptState === true) {
        return d3.prediction;
      }
      previousD = d3;
      path4.push(t4);
      t4 = this.LA(i2++);
    }
  }
  function computeLookaheadTarget(dfa, previousD, token2, lookahead, predicateSet, logging) {
    const reach = computeReachSet(previousD.configs, token2, predicateSet);
    if (reach.size === 0) {
      addDFAEdge(dfa, previousD, token2, DFA_ERROR);
      return DFA_ERROR;
    }
    let newState2 = newDFAState(reach);
    const predictedAlt = getUniqueAlt(reach, predicateSet);
    if (predictedAlt !== void 0) {
      newState2.isAcceptState = true;
      newState2.prediction = predictedAlt;
      newState2.configs.uniqueAlt = predictedAlt;
    } else if (hasConflictTerminatingPrediction(reach)) {
      const prediction = min_default(reach.alts);
      newState2.isAcceptState = true;
      newState2.prediction = prediction;
      newState2.configs.uniqueAlt = prediction;
      reportLookaheadAmbiguity.apply(this, [dfa, lookahead, reach.alts, logging]);
    }
    newState2 = addDFAEdge(dfa, previousD, token2, newState2);
    return newState2;
  }
  function reportLookaheadAmbiguity(dfa, lookahead, ambiguityIndices, logging) {
    const prefixPath = [];
    for (let i2 = 1; i2 <= lookahead; i2++) {
      prefixPath.push(this.LA(i2).tokenType);
    }
    const atnState = dfa.atnStartState;
    const topLevelRule = atnState.rule;
    const production = atnState.production;
    const message = buildAmbiguityError({
      topLevelRule,
      ambiguityIndices,
      production,
      prefixPath
    });
    logging(message);
  }
  function buildAmbiguityError(options2) {
    const pathMsg = map_default(options2.prefixPath, (currtok) => tokenLabel2(currtok)).join(", ");
    const occurrence = options2.production.idx === 0 ? "" : options2.production.idx;
    let currMessage = `Ambiguous Alternatives Detected: <${options2.ambiguityIndices.join(", ")}> in <${getProductionDslName2(options2.production)}${occurrence}> inside <${options2.topLevelRule.name}> Rule,
<${pathMsg}> may appears as a prefix path in all these alternatives.
`;
    currMessage = currMessage + `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`;
    return currMessage;
  }
  function getProductionDslName2(prod) {
    if (prod instanceof NonTerminal) {
      return "SUBRULE";
    } else if (prod instanceof Option2) {
      return "OPTION";
    } else if (prod instanceof Alternation) {
      return "OR";
    } else if (prod instanceof RepetitionMandatory) {
      return "AT_LEAST_ONE";
    } else if (prod instanceof RepetitionMandatoryWithSeparator) {
      return "AT_LEAST_ONE_SEP";
    } else if (prod instanceof RepetitionWithSeparator) {
      return "MANY_SEP";
    } else if (prod instanceof Repetition) {
      return "MANY";
    } else if (prod instanceof Terminal) {
      return "CONSUME";
    } else {
      throw Error("non exhaustive match");
    }
  }
  function buildAdaptivePredictError(path4, previous, current) {
    const nextTransitions = flatMap_default(previous.configs.elements, (e3) => e3.state.transitions);
    const nextTokenTypes = uniqBy_default(nextTransitions.filter((e3) => e3 instanceof AtomTransition).map((e3) => e3.tokenType), (e3) => e3.tokenTypeIdx);
    return {
      actualToken: current,
      possibleTokenTypes: nextTokenTypes,
      tokenPath: path4
    };
  }
  function getExistingTargetState(state4, token2) {
    return state4.edges[token2.tokenTypeIdx];
  }
  function computeReachSet(configs, token2, predicateSet) {
    const intermediate = new ATNConfigSet();
    const skippedStopStates = [];
    for (const c3 of configs.elements) {
      if (predicateSet.is(c3.alt) === false) {
        continue;
      }
      if (c3.state.type === ATN_RULE_STOP) {
        skippedStopStates.push(c3);
        continue;
      }
      const transitionLength = c3.state.transitions.length;
      for (let i2 = 0; i2 < transitionLength; i2++) {
        const transition2 = c3.state.transitions[i2];
        const target = getReachableTarget(transition2, token2);
        if (target !== void 0) {
          intermediate.add({
            state: target,
            alt: c3.alt,
            stack: c3.stack
          });
        }
      }
    }
    let reach;
    if (skippedStopStates.length === 0 && intermediate.size === 1) {
      reach = intermediate;
    }
    if (reach === void 0) {
      reach = new ATNConfigSet();
      for (const c3 of intermediate.elements) {
        closure(c3, reach);
      }
    }
    if (skippedStopStates.length > 0 && !hasConfigInRuleStopState(reach)) {
      for (const c3 of skippedStopStates) {
        reach.add(c3);
      }
    }
    return reach;
  }
  function getReachableTarget(transition2, token2) {
    if (transition2 instanceof AtomTransition && tokenMatcher(token2, transition2.tokenType)) {
      return transition2.target;
    }
    return void 0;
  }
  function getUniqueAlt(configs, predicateSet) {
    let alt;
    for (const c3 of configs.elements) {
      if (predicateSet.is(c3.alt) === true) {
        if (alt === void 0) {
          alt = c3.alt;
        } else if (alt !== c3.alt) {
          return void 0;
        }
      }
    }
    return alt;
  }
  function newDFAState(closure2) {
    return {
      configs: closure2,
      edges: {},
      isAcceptState: false,
      prediction: -1
    };
  }
  function addDFAEdge(dfa, from2, token2, to) {
    to = addDFAState(dfa, to);
    from2.edges[token2.tokenTypeIdx] = to;
    return to;
  }
  function addDFAState(dfa, state4) {
    if (state4 === DFA_ERROR) {
      return state4;
    }
    const mapKey = state4.configs.key;
    const existing = dfa.states[mapKey];
    if (existing !== void 0) {
      return existing;
    }
    state4.configs.finalize();
    dfa.states[mapKey] = state4;
    return state4;
  }
  function computeStartState(atnState) {
    const configs = new ATNConfigSet();
    const numberOfTransitions = atnState.transitions.length;
    for (let i2 = 0; i2 < numberOfTransitions; i2++) {
      const target = atnState.transitions[i2].target;
      const config5 = {
        state: target,
        alt: i2,
        stack: []
      };
      closure(config5, configs);
    }
    return configs;
  }
  function closure(config5, configs) {
    const p3 = config5.state;
    if (p3.type === ATN_RULE_STOP) {
      if (config5.stack.length > 0) {
        const atnStack = [...config5.stack];
        const followState = atnStack.pop();
        const followConfig = {
          state: followState,
          alt: config5.alt,
          stack: atnStack
        };
        closure(followConfig, configs);
      } else {
        configs.add(config5);
      }
      return;
    }
    if (!p3.epsilonOnlyTransitions) {
      configs.add(config5);
    }
    const transitionLength = p3.transitions.length;
    for (let i2 = 0; i2 < transitionLength; i2++) {
      const transition2 = p3.transitions[i2];
      const c3 = getEpsilonTarget(config5, transition2);
      if (c3 !== void 0) {
        closure(c3, configs);
      }
    }
  }
  function getEpsilonTarget(config5, transition2) {
    if (transition2 instanceof EpsilonTransition) {
      return {
        state: transition2.target,
        alt: config5.alt,
        stack: config5.stack
      };
    } else if (transition2 instanceof RuleTransition) {
      const stack = [...config5.stack, transition2.followState];
      return {
        state: transition2.target,
        alt: config5.alt,
        stack
      };
    }
    return void 0;
  }
  function hasConfigInRuleStopState(configs) {
    for (const c3 of configs.elements) {
      if (c3.state.type === ATN_RULE_STOP) {
        return true;
      }
    }
    return false;
  }
  function allConfigsInRuleStopStates(configs) {
    for (const c3 of configs.elements) {
      if (c3.state.type !== ATN_RULE_STOP) {
        return false;
      }
    }
    return true;
  }
  function hasConflictTerminatingPrediction(configs) {
    if (allConfigsInRuleStopStates(configs)) {
      return true;
    }
    const altSets = getConflictingAltSets(configs.elements);
    const heuristic2 = hasConflictingAltSet(altSets) && !hasStateAssociatedWithOneAlt(altSets);
    return heuristic2;
  }
  function getConflictingAltSets(configs) {
    const configToAlts = /* @__PURE__ */ new Map();
    for (const c3 of configs) {
      const key = getATNConfigKey(c3, false);
      let alts = configToAlts.get(key);
      if (alts === void 0) {
        alts = {};
        configToAlts.set(key, alts);
      }
      alts[c3.alt] = true;
    }
    return configToAlts;
  }
  function hasConflictingAltSet(altSets) {
    for (const value2 of Array.from(altSets.values())) {
      if (Object.keys(value2).length > 1) {
        return true;
      }
    }
    return false;
  }
  function hasStateAssociatedWithOneAlt(altSets) {
    for (const value2 of Array.from(altSets.values())) {
      if (Object.keys(value2).length === 1) {
        return true;
      }
    }
    return false;
  }
  var PredicateSet, EMPTY_PREDICATES, LLStarLookaheadStrategy;
  var init_all_star_lookahead = __esm({
    "../../node_modules/.pnpm/chevrotain-allstar@0.3.1_chevrotain@11.1.1/node_modules/chevrotain-allstar/lib/all-star-lookahead.js"() {
      "use strict";
      init_api5();
      init_atn();
      init_dfa();
      init_min2();
      init_flatMap();
      init_uniqBy();
      init_map();
      init_flatten();
      init_forEach();
      init_isEmpty();
      init_reduce();
      __name(createDFACache, "createDFACache");
      PredicateSet = class {
        static {
          __name(this, "PredicateSet");
        }
        constructor() {
          this.predicates = [];
        }
        is(index) {
          return index >= this.predicates.length || this.predicates[index];
        }
        set(index, value2) {
          this.predicates[index] = value2;
        }
        toString() {
          let value2 = "";
          const size4 = this.predicates.length;
          for (let i2 = 0; i2 < size4; i2++) {
            value2 += this.predicates[i2] === true ? "1" : "0";
          }
          return value2;
        }
      };
      EMPTY_PREDICATES = new PredicateSet();
      LLStarLookaheadStrategy = class extends LLkLookaheadStrategy {
        static {
          __name(this, "LLStarLookaheadStrategy");
        }
        constructor(options2) {
          var _a;
          super();
          this.logging = (_a = options2 === null || options2 === void 0 ? void 0 : options2.logging) !== null && _a !== void 0 ? _a : ((message) => console.log(message));
        }
        initialize(options2) {
          this.atn = createATN(options2.rules);
          this.dfas = initATNSimulator(this.atn);
        }
        validateAmbiguousAlternationAlternatives() {
          return [];
        }
        validateEmptyOrAlternatives() {
          return [];
        }
        buildLookaheadForAlternation(options2) {
          const { prodOccurrence, rule, hasPredicates, dynamicTokensEnabled } = options2;
          const dfas = this.dfas;
          const logging = this.logging;
          const key = buildATNKey(rule, "Alternation", prodOccurrence);
          const decisionState = this.atn.decisionMap[key];
          const decisionIndex = decisionState.decision;
          const partialAlts = map_default(getLookaheadPaths({
            maxLookahead: 1,
            occurrence: prodOccurrence,
            prodType: "Alternation",
            rule
          }), (currAlt) => map_default(currAlt, (path4) => path4[0]));
          if (isLL1Sequence(partialAlts, false) && !dynamicTokensEnabled) {
            const choiceToAlt = reduce_default(partialAlts, (result, currAlt, idx) => {
              forEach_default(currAlt, (currTokType) => {
                if (currTokType) {
                  result[currTokType.tokenTypeIdx] = idx;
                  forEach_default(currTokType.categoryMatches, (currExtendingType) => {
                    result[currExtendingType] = idx;
                  });
                }
              });
              return result;
            }, {});
            if (hasPredicates) {
              return function(orAlts) {
                var _a;
                const nextToken = this.LA(1);
                const prediction = choiceToAlt[nextToken.tokenTypeIdx];
                if (orAlts !== void 0 && prediction !== void 0) {
                  const gate = (_a = orAlts[prediction]) === null || _a === void 0 ? void 0 : _a.GATE;
                  if (gate !== void 0 && gate.call(this) === false) {
                    return void 0;
                  }
                }
                return prediction;
              };
            } else {
              return function() {
                const nextToken = this.LA(1);
                return choiceToAlt[nextToken.tokenTypeIdx];
              };
            }
          } else if (hasPredicates) {
            return function(orAlts) {
              const predicates = new PredicateSet();
              const length2 = orAlts === void 0 ? 0 : orAlts.length;
              for (let i2 = 0; i2 < length2; i2++) {
                const gate = orAlts === null || orAlts === void 0 ? void 0 : orAlts[i2].GATE;
                predicates.set(i2, gate === void 0 || gate.call(this));
              }
              const result = adaptivePredict.call(this, dfas, decisionIndex, predicates, logging);
              return typeof result === "number" ? result : void 0;
            };
          } else {
            return function() {
              const result = adaptivePredict.call(this, dfas, decisionIndex, EMPTY_PREDICATES, logging);
              return typeof result === "number" ? result : void 0;
            };
          }
        }
        buildLookaheadForOptional(options2) {
          const { prodOccurrence, rule, prodType, dynamicTokensEnabled } = options2;
          const dfas = this.dfas;
          const logging = this.logging;
          const key = buildATNKey(rule, prodType, prodOccurrence);
          const decisionState = this.atn.decisionMap[key];
          const decisionIndex = decisionState.decision;
          const alts = map_default(getLookaheadPaths({
            maxLookahead: 1,
            occurrence: prodOccurrence,
            prodType,
            rule
          }), (e3) => {
            return map_default(e3, (g2) => g2[0]);
          });
          if (isLL1Sequence(alts) && alts[0][0] && !dynamicTokensEnabled) {
            const alt = alts[0];
            const singleTokensTypes = flatten_default(alt);
            if (singleTokensTypes.length === 1 && isEmpty_default(singleTokensTypes[0].categoryMatches)) {
              const expectedTokenType = singleTokensTypes[0];
              const expectedTokenUniqueKey = expectedTokenType.tokenTypeIdx;
              return function() {
                return this.LA(1).tokenTypeIdx === expectedTokenUniqueKey;
              };
            } else {
              const choiceToAlt = reduce_default(singleTokensTypes, (result, currTokType) => {
                if (currTokType !== void 0) {
                  result[currTokType.tokenTypeIdx] = true;
                  forEach_default(currTokType.categoryMatches, (currExtendingType) => {
                    result[currExtendingType] = true;
                  });
                }
                return result;
              }, {});
              return function() {
                const nextToken = this.LA(1);
                return choiceToAlt[nextToken.tokenTypeIdx] === true;
              };
            }
          }
          return function() {
            const result = adaptivePredict.call(this, dfas, decisionIndex, EMPTY_PREDICATES, logging);
            return typeof result === "object" ? false : result === 0;
          };
        }
      };
      __name(isLL1Sequence, "isLL1Sequence");
      __name(initATNSimulator, "initATNSimulator");
      __name(adaptivePredict, "adaptivePredict");
      __name(performLookahead, "performLookahead");
      __name(computeLookaheadTarget, "computeLookaheadTarget");
      __name(reportLookaheadAmbiguity, "reportLookaheadAmbiguity");
      __name(buildAmbiguityError, "buildAmbiguityError");
      __name(getProductionDslName2, "getProductionDslName");
      __name(buildAdaptivePredictError, "buildAdaptivePredictError");
      __name(getExistingTargetState, "getExistingTargetState");
      __name(computeReachSet, "computeReachSet");
      __name(getReachableTarget, "getReachableTarget");
      __name(getUniqueAlt, "getUniqueAlt");
      __name(newDFAState, "newDFAState");
      __name(addDFAEdge, "addDFAEdge");
      __name(addDFAState, "addDFAState");
      __name(computeStartState, "computeStartState");
      __name(closure, "closure");
      __name(getEpsilonTarget, "getEpsilonTarget");
      __name(hasConfigInRuleStopState, "hasConfigInRuleStopState");
      __name(allConfigsInRuleStopStates, "allConfigsInRuleStopStates");
      __name(hasConflictTerminatingPrediction, "hasConflictTerminatingPrediction");
      __name(getConflictingAltSets, "getConflictingAltSets");
      __name(hasConflictingAltSet, "hasConflictingAltSet");
      __name(hasStateAssociatedWithOneAlt, "hasStateAssociatedWithOneAlt");
    }
  });

  // ../../node_modules/.pnpm/chevrotain-allstar@0.3.1_chevrotain@11.1.1/node_modules/chevrotain-allstar/lib/index.js
  var init_lib2 = __esm({
    "../../node_modules/.pnpm/chevrotain-allstar@0.3.1_chevrotain@11.1.1/node_modules/chevrotain-allstar/lib/index.js"() {
      "use strict";
      init_all_star_lookahead();
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js
  var main_exports = {};
  __export(main_exports, {
    AnnotatedTextEdit: () => AnnotatedTextEdit,
    ChangeAnnotation: () => ChangeAnnotation,
    ChangeAnnotationIdentifier: () => ChangeAnnotationIdentifier,
    CodeAction: () => CodeAction,
    CodeActionContext: () => CodeActionContext,
    CodeActionKind: () => CodeActionKind,
    CodeActionTriggerKind: () => CodeActionTriggerKind,
    CodeDescription: () => CodeDescription,
    CodeLens: () => CodeLens,
    Color: () => Color3,
    ColorInformation: () => ColorInformation,
    ColorPresentation: () => ColorPresentation,
    Command: () => Command,
    CompletionItem: () => CompletionItem,
    CompletionItemKind: () => CompletionItemKind,
    CompletionItemLabelDetails: () => CompletionItemLabelDetails,
    CompletionItemTag: () => CompletionItemTag,
    CompletionList: () => CompletionList,
    CreateFile: () => CreateFile,
    DeleteFile: () => DeleteFile,
    Diagnostic: () => Diagnostic,
    DiagnosticRelatedInformation: () => DiagnosticRelatedInformation,
    DiagnosticSeverity: () => DiagnosticSeverity,
    DiagnosticTag: () => DiagnosticTag,
    DocumentHighlight: () => DocumentHighlight,
    DocumentHighlightKind: () => DocumentHighlightKind,
    DocumentLink: () => DocumentLink,
    DocumentSymbol: () => DocumentSymbol,
    DocumentUri: () => DocumentUri,
    EOL: () => EOL,
    FoldingRange: () => FoldingRange,
    FoldingRangeKind: () => FoldingRangeKind,
    FormattingOptions: () => FormattingOptions,
    Hover: () => Hover,
    InlayHint: () => InlayHint,
    InlayHintKind: () => InlayHintKind,
    InlayHintLabelPart: () => InlayHintLabelPart,
    InlineCompletionContext: () => InlineCompletionContext,
    InlineCompletionItem: () => InlineCompletionItem,
    InlineCompletionList: () => InlineCompletionList,
    InlineCompletionTriggerKind: () => InlineCompletionTriggerKind,
    InlineValueContext: () => InlineValueContext,
    InlineValueEvaluatableExpression: () => InlineValueEvaluatableExpression,
    InlineValueText: () => InlineValueText,
    InlineValueVariableLookup: () => InlineValueVariableLookup,
    InsertReplaceEdit: () => InsertReplaceEdit,
    InsertTextFormat: () => InsertTextFormat,
    InsertTextMode: () => InsertTextMode,
    Location: () => Location,
    LocationLink: () => LocationLink,
    MarkedString: () => MarkedString,
    MarkupContent: () => MarkupContent,
    MarkupKind: () => MarkupKind,
    OptionalVersionedTextDocumentIdentifier: () => OptionalVersionedTextDocumentIdentifier,
    ParameterInformation: () => ParameterInformation,
    Position: () => Position,
    Range: () => Range,
    RenameFile: () => RenameFile,
    SelectedCompletionInfo: () => SelectedCompletionInfo,
    SelectionRange: () => SelectionRange,
    SemanticTokenModifiers: () => SemanticTokenModifiers,
    SemanticTokenTypes: () => SemanticTokenTypes,
    SemanticTokens: () => SemanticTokens,
    SignatureInformation: () => SignatureInformation,
    StringValue: () => StringValue,
    SymbolInformation: () => SymbolInformation,
    SymbolKind: () => SymbolKind,
    SymbolTag: () => SymbolTag,
    TextDocument: () => TextDocument,
    TextDocumentEdit: () => TextDocumentEdit,
    TextDocumentIdentifier: () => TextDocumentIdentifier,
    TextDocumentItem: () => TextDocumentItem,
    TextEdit: () => TextEdit,
    URI: () => URI,
    VersionedTextDocumentIdentifier: () => VersionedTextDocumentIdentifier,
    WorkspaceChange: () => WorkspaceChange,
    WorkspaceEdit: () => WorkspaceEdit,
    WorkspaceFolder: () => WorkspaceFolder,
    WorkspaceSymbol: () => WorkspaceSymbol,
    integer: () => integer3,
    uinteger: () => uinteger
  });
  var DocumentUri, URI, integer3, uinteger, Position, Range, Location, LocationLink, Color3, ColorInformation, ColorPresentation, FoldingRangeKind, FoldingRange, DiagnosticRelatedInformation, DiagnosticSeverity, DiagnosticTag, CodeDescription, Diagnostic, Command, TextEdit, ChangeAnnotation, ChangeAnnotationIdentifier, AnnotatedTextEdit, TextDocumentEdit, CreateFile, RenameFile, DeleteFile, WorkspaceEdit, TextEditChangeImpl, ChangeAnnotations, WorkspaceChange, TextDocumentIdentifier, VersionedTextDocumentIdentifier, OptionalVersionedTextDocumentIdentifier, TextDocumentItem, MarkupKind, MarkupContent, CompletionItemKind, InsertTextFormat, CompletionItemTag, InsertReplaceEdit, InsertTextMode, CompletionItemLabelDetails, CompletionItem, CompletionList, MarkedString, Hover, ParameterInformation, SignatureInformation, DocumentHighlightKind, DocumentHighlight, SymbolKind, SymbolTag, SymbolInformation, WorkspaceSymbol, DocumentSymbol, CodeActionKind, CodeActionTriggerKind, CodeActionContext, CodeAction, CodeLens, FormattingOptions, DocumentLink, SelectionRange, SemanticTokenTypes, SemanticTokenModifiers, SemanticTokens, InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression, InlineValueContext, InlayHintKind, InlayHintLabelPart, InlayHint, StringValue, InlineCompletionItem, InlineCompletionList, InlineCompletionTriggerKind, SelectedCompletionInfo, InlineCompletionContext, WorkspaceFolder, EOL, TextDocument, FullTextDocument, Is;
  var init_main = __esm({
    "../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"() {
      "use strict";
      (function(DocumentUri2) {
        function is2(value2) {
          return typeof value2 === "string";
        }
        __name(is2, "is");
        DocumentUri2.is = is2;
      })(DocumentUri || (DocumentUri = {}));
      (function(URI3) {
        function is2(value2) {
          return typeof value2 === "string";
        }
        __name(is2, "is");
        URI3.is = is2;
      })(URI || (URI = {}));
      (function(integer4) {
        integer4.MIN_VALUE = -2147483648;
        integer4.MAX_VALUE = 2147483647;
        function is2(value2) {
          return typeof value2 === "number" && integer4.MIN_VALUE <= value2 && value2 <= integer4.MAX_VALUE;
        }
        __name(is2, "is");
        integer4.is = is2;
      })(integer3 || (integer3 = {}));
      (function(uinteger2) {
        uinteger2.MIN_VALUE = 0;
        uinteger2.MAX_VALUE = 2147483647;
        function is2(value2) {
          return typeof value2 === "number" && uinteger2.MIN_VALUE <= value2 && value2 <= uinteger2.MAX_VALUE;
        }
        __name(is2, "is");
        uinteger2.is = is2;
      })(uinteger || (uinteger = {}));
      (function(Position2) {
        function create4(line2, character2) {
          if (line2 === Number.MAX_VALUE) {
            line2 = uinteger.MAX_VALUE;
          }
          if (character2 === Number.MAX_VALUE) {
            character2 = uinteger.MAX_VALUE;
          }
          return { line: line2, character: character2 };
        }
        __name(create4, "create");
        Position2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
        }
        __name(is2, "is");
        Position2.is = is2;
      })(Position || (Position = {}));
      (function(Range2) {
        function create4(one4, two, three, four) {
          if (Is.uinteger(one4) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
            return { start: Position.create(one4, two), end: Position.create(three, four) };
          } else if (Position.is(one4) && Position.is(two)) {
            return { start: one4, end: two };
          } else {
            throw new Error(`Range#create called with invalid arguments[${one4}, ${two}, ${three}, ${four}]`);
          }
        }
        __name(create4, "create");
        Range2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
        }
        __name(is2, "is");
        Range2.is = is2;
      })(Range || (Range = {}));
      (function(Location2) {
        function create4(uri, range3) {
          return { uri, range: range3 };
        }
        __name(create4, "create");
        Location2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
        }
        __name(is2, "is");
        Location2.is = is2;
      })(Location || (Location = {}));
      (function(LocationLink2) {
        function create4(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
          return { targetUri, targetRange, targetSelectionRange, originSelectionRange };
        }
        __name(create4, "create");
        LocationLink2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range.is(candidate.targetSelectionRange) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
        }
        __name(is2, "is");
        LocationLink2.is = is2;
      })(LocationLink || (LocationLink = {}));
      (function(Color4) {
        function create4(red, green, blue, alpha) {
          return {
            red,
            green,
            blue,
            alpha
          };
        }
        __name(create4, "create");
        Color4.create = create4;
        function is2(value2) {
          const candidate = value2;
          return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1);
        }
        __name(is2, "is");
        Color4.is = is2;
      })(Color3 || (Color3 = {}));
      (function(ColorInformation2) {
        function create4(range3, color2) {
          return {
            range: range3,
            color: color2
          };
        }
        __name(create4, "create");
        ColorInformation2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color3.is(candidate.color);
        }
        __name(is2, "is");
        ColorInformation2.is = is2;
      })(ColorInformation || (ColorInformation = {}));
      (function(ColorPresentation2) {
        function create4(label, textEdit, additionalTextEdits) {
          return {
            label,
            textEdit,
            additionalTextEdits
          };
        }
        __name(create4, "create");
        ColorPresentation2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
        }
        __name(is2, "is");
        ColorPresentation2.is = is2;
      })(ColorPresentation || (ColorPresentation = {}));
      (function(FoldingRangeKind2) {
        FoldingRangeKind2.Comment = "comment";
        FoldingRangeKind2.Imports = "imports";
        FoldingRangeKind2.Region = "region";
      })(FoldingRangeKind || (FoldingRangeKind = {}));
      (function(FoldingRange2) {
        function create4(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) {
          const result = {
            startLine,
            endLine
          };
          if (Is.defined(startCharacter)) {
            result.startCharacter = startCharacter;
          }
          if (Is.defined(endCharacter)) {
            result.endCharacter = endCharacter;
          }
          if (Is.defined(kind)) {
            result.kind = kind;
          }
          if (Is.defined(collapsedText)) {
            result.collapsedText = collapsedText;
          }
          return result;
        }
        __name(create4, "create");
        FoldingRange2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
        }
        __name(is2, "is");
        FoldingRange2.is = is2;
      })(FoldingRange || (FoldingRange = {}));
      (function(DiagnosticRelatedInformation2) {
        function create4(location, message) {
          return {
            location,
            message
          };
        }
        __name(create4, "create");
        DiagnosticRelatedInformation2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
        }
        __name(is2, "is");
        DiagnosticRelatedInformation2.is = is2;
      })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
      (function(DiagnosticSeverity2) {
        DiagnosticSeverity2.Error = 1;
        DiagnosticSeverity2.Warning = 2;
        DiagnosticSeverity2.Information = 3;
        DiagnosticSeverity2.Hint = 4;
      })(DiagnosticSeverity || (DiagnosticSeverity = {}));
      (function(DiagnosticTag2) {
        DiagnosticTag2.Unnecessary = 1;
        DiagnosticTag2.Deprecated = 2;
      })(DiagnosticTag || (DiagnosticTag = {}));
      (function(CodeDescription2) {
        function is2(value2) {
          const candidate = value2;
          return Is.objectLiteral(candidate) && Is.string(candidate.href);
        }
        __name(is2, "is");
        CodeDescription2.is = is2;
      })(CodeDescription || (CodeDescription = {}));
      (function(Diagnostic2) {
        function create4(range3, message, severity, code, source, relatedInformation) {
          let result = { range: range3, message };
          if (Is.defined(severity)) {
            result.severity = severity;
          }
          if (Is.defined(code)) {
            result.code = code;
          }
          if (Is.defined(source)) {
            result.source = source;
          }
          if (Is.defined(relatedInformation)) {
            result.relatedInformation = relatedInformation;
          }
          return result;
        }
        __name(create4, "create");
        Diagnostic2.create = create4;
        function is2(value2) {
          var _a;
          let candidate = value2;
          return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
        }
        __name(is2, "is");
        Diagnostic2.is = is2;
      })(Diagnostic || (Diagnostic = {}));
      (function(Command2) {
        function create4(title2, command, ...args) {
          let result = { title: title2, command };
          if (Is.defined(args) && args.length > 0) {
            result.arguments = args;
          }
          return result;
        }
        __name(create4, "create");
        Command2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
        }
        __name(is2, "is");
        Command2.is = is2;
      })(Command || (Command = {}));
      (function(TextEdit2) {
        function replace2(range3, newText) {
          return { range: range3, newText };
        }
        __name(replace2, "replace");
        TextEdit2.replace = replace2;
        function insert(position5, newText) {
          return { range: { start: position5, end: position5 }, newText };
        }
        __name(insert, "insert");
        TextEdit2.insert = insert;
        function del(range3) {
          return { range: range3, newText: "" };
        }
        __name(del, "del");
        TextEdit2.del = del;
        function is2(value2) {
          const candidate = value2;
          return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range);
        }
        __name(is2, "is");
        TextEdit2.is = is2;
      })(TextEdit || (TextEdit = {}));
      (function(ChangeAnnotation2) {
        function create4(label, needsConfirmation, description) {
          const result = { label };
          if (needsConfirmation !== void 0) {
            result.needsConfirmation = needsConfirmation;
          }
          if (description !== void 0) {
            result.description = description;
          }
          return result;
        }
        __name(create4, "create");
        ChangeAnnotation2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0);
        }
        __name(is2, "is");
        ChangeAnnotation2.is = is2;
      })(ChangeAnnotation || (ChangeAnnotation = {}));
      (function(ChangeAnnotationIdentifier2) {
        function is2(value2) {
          const candidate = value2;
          return Is.string(candidate);
        }
        __name(is2, "is");
        ChangeAnnotationIdentifier2.is = is2;
      })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
      (function(AnnotatedTextEdit2) {
        function replace2(range3, newText, annotation) {
          return { range: range3, newText, annotationId: annotation };
        }
        __name(replace2, "replace");
        AnnotatedTextEdit2.replace = replace2;
        function insert(position5, newText, annotation) {
          return { range: { start: position5, end: position5 }, newText, annotationId: annotation };
        }
        __name(insert, "insert");
        AnnotatedTextEdit2.insert = insert;
        function del(range3, annotation) {
          return { range: range3, newText: "", annotationId: annotation };
        }
        __name(del, "del");
        AnnotatedTextEdit2.del = del;
        function is2(value2) {
          const candidate = value2;
          return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
        }
        __name(is2, "is");
        AnnotatedTextEdit2.is = is2;
      })(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
      (function(TextDocumentEdit2) {
        function create4(textDocument, edits) {
          return { textDocument, edits };
        }
        __name(create4, "create");
        TextDocumentEdit2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits);
        }
        __name(is2, "is");
        TextDocumentEdit2.is = is2;
      })(TextDocumentEdit || (TextDocumentEdit = {}));
      (function(CreateFile2) {
        function create4(uri, options2, annotation) {
          let result = {
            kind: "create",
            uri
          };
          if (options2 !== void 0 && (options2.overwrite !== void 0 || options2.ignoreIfExists !== void 0)) {
            result.options = options2;
          }
          if (annotation !== void 0) {
            result.annotationId = annotation;
          }
          return result;
        }
        __name(create4, "create");
        CreateFile2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
        }
        __name(is2, "is");
        CreateFile2.is = is2;
      })(CreateFile || (CreateFile = {}));
      (function(RenameFile2) {
        function create4(oldUri, newUri, options2, annotation) {
          let result = {
            kind: "rename",
            oldUri,
            newUri
          };
          if (options2 !== void 0 && (options2.overwrite !== void 0 || options2.ignoreIfExists !== void 0)) {
            result.options = options2;
          }
          if (annotation !== void 0) {
            result.annotationId = annotation;
          }
          return result;
        }
        __name(create4, "create");
        RenameFile2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
        }
        __name(is2, "is");
        RenameFile2.is = is2;
      })(RenameFile || (RenameFile = {}));
      (function(DeleteFile2) {
        function create4(uri, options2, annotation) {
          let result = {
            kind: "delete",
            uri
          };
          if (options2 !== void 0 && (options2.recursive !== void 0 || options2.ignoreIfNotExists !== void 0)) {
            result.options = options2;
          }
          if (annotation !== void 0) {
            result.annotationId = annotation;
          }
          return result;
        }
        __name(create4, "create");
        DeleteFile2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
        }
        __name(is2, "is");
        DeleteFile2.is = is2;
      })(DeleteFile || (DeleteFile = {}));
      (function(WorkspaceEdit2) {
        function is2(value2) {
          let candidate = value2;
          return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every((change2) => {
            if (Is.string(change2.kind)) {
              return CreateFile.is(change2) || RenameFile.is(change2) || DeleteFile.is(change2);
            } else {
              return TextDocumentEdit.is(change2);
            }
          }));
        }
        __name(is2, "is");
        WorkspaceEdit2.is = is2;
      })(WorkspaceEdit || (WorkspaceEdit = {}));
      TextEditChangeImpl = class {
        static {
          __name(this, "TextEditChangeImpl");
        }
        constructor(edits, changeAnnotations) {
          this.edits = edits;
          this.changeAnnotations = changeAnnotations;
        }
        insert(position5, newText, annotation) {
          let edit;
          let id34;
          if (annotation === void 0) {
            edit = TextEdit.insert(position5, newText);
          } else if (ChangeAnnotationIdentifier.is(annotation)) {
            id34 = annotation;
            edit = AnnotatedTextEdit.insert(position5, newText, annotation);
          } else {
            this.assertChangeAnnotations(this.changeAnnotations);
            id34 = this.changeAnnotations.manage(annotation);
            edit = AnnotatedTextEdit.insert(position5, newText, id34);
          }
          this.edits.push(edit);
          if (id34 !== void 0) {
            return id34;
          }
        }
        replace(range3, newText, annotation) {
          let edit;
          let id34;
          if (annotation === void 0) {
            edit = TextEdit.replace(range3, newText);
          } else if (ChangeAnnotationIdentifier.is(annotation)) {
            id34 = annotation;
            edit = AnnotatedTextEdit.replace(range3, newText, annotation);
          } else {
            this.assertChangeAnnotations(this.changeAnnotations);
            id34 = this.changeAnnotations.manage(annotation);
            edit = AnnotatedTextEdit.replace(range3, newText, id34);
          }
          this.edits.push(edit);
          if (id34 !== void 0) {
            return id34;
          }
        }
        delete(range3, annotation) {
          let edit;
          let id34;
          if (annotation === void 0) {
            edit = TextEdit.del(range3);
          } else if (ChangeAnnotationIdentifier.is(annotation)) {
            id34 = annotation;
            edit = AnnotatedTextEdit.del(range3, annotation);
          } else {
            this.assertChangeAnnotations(this.changeAnnotations);
            id34 = this.changeAnnotations.manage(annotation);
            edit = AnnotatedTextEdit.del(range3, id34);
          }
          this.edits.push(edit);
          if (id34 !== void 0) {
            return id34;
          }
        }
        add(edit) {
          this.edits.push(edit);
        }
        all() {
          return this.edits;
        }
        clear() {
          this.edits.splice(0, this.edits.length);
        }
        assertChangeAnnotations(value2) {
          if (value2 === void 0) {
            throw new Error(`Text edit change is not configured to manage change annotations.`);
          }
        }
      };
      ChangeAnnotations = class {
        static {
          __name(this, "ChangeAnnotations");
        }
        constructor(annotations) {
          this._annotations = annotations === void 0 ? /* @__PURE__ */ Object.create(null) : annotations;
          this._counter = 0;
          this._size = 0;
        }
        all() {
          return this._annotations;
        }
        get size() {
          return this._size;
        }
        manage(idOrAnnotation, annotation) {
          let id34;
          if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
            id34 = idOrAnnotation;
          } else {
            id34 = this.nextId();
            annotation = idOrAnnotation;
          }
          if (this._annotations[id34] !== void 0) {
            throw new Error(`Id ${id34} is already in use.`);
          }
          if (annotation === void 0) {
            throw new Error(`No annotation provided for id ${id34}`);
          }
          this._annotations[id34] = annotation;
          this._size++;
          return id34;
        }
        nextId() {
          this._counter++;
          return this._counter.toString();
        }
      };
      WorkspaceChange = class {
        static {
          __name(this, "WorkspaceChange");
        }
        constructor(workspaceEdit) {
          this._textEditChanges = /* @__PURE__ */ Object.create(null);
          if (workspaceEdit !== void 0) {
            this._workspaceEdit = workspaceEdit;
            if (workspaceEdit.documentChanges) {
              this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
              workspaceEdit.changeAnnotations = this._changeAnnotations.all();
              workspaceEdit.documentChanges.forEach((change2) => {
                if (TextDocumentEdit.is(change2)) {
                  const textEditChange = new TextEditChangeImpl(change2.edits, this._changeAnnotations);
                  this._textEditChanges[change2.textDocument.uri] = textEditChange;
                }
              });
            } else if (workspaceEdit.changes) {
              Object.keys(workspaceEdit.changes).forEach((key) => {
                const textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
                this._textEditChanges[key] = textEditChange;
              });
            }
          } else {
            this._workspaceEdit = {};
          }
        }
        /**
         * Returns the underlying {@link WorkspaceEdit} literal
         * use to be returned from a workspace edit operation like rename.
         */
        get edit() {
          this.initDocumentChanges();
          if (this._changeAnnotations !== void 0) {
            if (this._changeAnnotations.size === 0) {
              this._workspaceEdit.changeAnnotations = void 0;
            } else {
              this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
            }
          }
          return this._workspaceEdit;
        }
        getTextEditChange(key) {
          if (OptionalVersionedTextDocumentIdentifier.is(key)) {
            this.initDocumentChanges();
            if (this._workspaceEdit.documentChanges === void 0) {
              throw new Error("Workspace edit is not configured for document changes.");
            }
            const textDocument = { uri: key.uri, version: key.version };
            let result = this._textEditChanges[textDocument.uri];
            if (!result) {
              const edits = [];
              const textDocumentEdit = {
                textDocument,
                edits
              };
              this._workspaceEdit.documentChanges.push(textDocumentEdit);
              result = new TextEditChangeImpl(edits, this._changeAnnotations);
              this._textEditChanges[textDocument.uri] = result;
            }
            return result;
          } else {
            this.initChanges();
            if (this._workspaceEdit.changes === void 0) {
              throw new Error("Workspace edit is not configured for normal text edit changes.");
            }
            let result = this._textEditChanges[key];
            if (!result) {
              let edits = [];
              this._workspaceEdit.changes[key] = edits;
              result = new TextEditChangeImpl(edits);
              this._textEditChanges[key] = result;
            }
            return result;
          }
        }
        initDocumentChanges() {
          if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
            this._changeAnnotations = new ChangeAnnotations();
            this._workspaceEdit.documentChanges = [];
            this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
          }
        }
        initChanges() {
          if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
            this._workspaceEdit.changes = /* @__PURE__ */ Object.create(null);
          }
        }
        createFile(uri, optionsOrAnnotation, options2) {
          this.initDocumentChanges();
          if (this._workspaceEdit.documentChanges === void 0) {
            throw new Error("Workspace edit is not configured for document changes.");
          }
          let annotation;
          if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
            annotation = optionsOrAnnotation;
          } else {
            options2 = optionsOrAnnotation;
          }
          let operation;
          let id34;
          if (annotation === void 0) {
            operation = CreateFile.create(uri, options2);
          } else {
            id34 = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
            operation = CreateFile.create(uri, options2, id34);
          }
          this._workspaceEdit.documentChanges.push(operation);
          if (id34 !== void 0) {
            return id34;
          }
        }
        renameFile(oldUri, newUri, optionsOrAnnotation, options2) {
          this.initDocumentChanges();
          if (this._workspaceEdit.documentChanges === void 0) {
            throw new Error("Workspace edit is not configured for document changes.");
          }
          let annotation;
          if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
            annotation = optionsOrAnnotation;
          } else {
            options2 = optionsOrAnnotation;
          }
          let operation;
          let id34;
          if (annotation === void 0) {
            operation = RenameFile.create(oldUri, newUri, options2);
          } else {
            id34 = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
            operation = RenameFile.create(oldUri, newUri, options2, id34);
          }
          this._workspaceEdit.documentChanges.push(operation);
          if (id34 !== void 0) {
            return id34;
          }
        }
        deleteFile(uri, optionsOrAnnotation, options2) {
          this.initDocumentChanges();
          if (this._workspaceEdit.documentChanges === void 0) {
            throw new Error("Workspace edit is not configured for document changes.");
          }
          let annotation;
          if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
            annotation = optionsOrAnnotation;
          } else {
            options2 = optionsOrAnnotation;
          }
          let operation;
          let id34;
          if (annotation === void 0) {
            operation = DeleteFile.create(uri, options2);
          } else {
            id34 = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
            operation = DeleteFile.create(uri, options2, id34);
          }
          this._workspaceEdit.documentChanges.push(operation);
          if (id34 !== void 0) {
            return id34;
          }
        }
      };
      (function(TextDocumentIdentifier2) {
        function create4(uri) {
          return { uri };
        }
        __name(create4, "create");
        TextDocumentIdentifier2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.defined(candidate) && Is.string(candidate.uri);
        }
        __name(is2, "is");
        TextDocumentIdentifier2.is = is2;
      })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
      (function(VersionedTextDocumentIdentifier2) {
        function create4(uri, version3) {
          return { uri, version: version3 };
        }
        __name(create4, "create");
        VersionedTextDocumentIdentifier2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
        }
        __name(is2, "is");
        VersionedTextDocumentIdentifier2.is = is2;
      })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
      (function(OptionalVersionedTextDocumentIdentifier2) {
        function create4(uri, version3) {
          return { uri, version: version3 };
        }
        __name(create4, "create");
        OptionalVersionedTextDocumentIdentifier2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
        }
        __name(is2, "is");
        OptionalVersionedTextDocumentIdentifier2.is = is2;
      })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
      (function(TextDocumentItem2) {
        function create4(uri, languageId, version3, text4) {
          return { uri, languageId, version: version3, text: text4 };
        }
        __name(create4, "create");
        TextDocumentItem2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
        }
        __name(is2, "is");
        TextDocumentItem2.is = is2;
      })(TextDocumentItem || (TextDocumentItem = {}));
      (function(MarkupKind2) {
        MarkupKind2.PlainText = "plaintext";
        MarkupKind2.Markdown = "markdown";
        function is2(value2) {
          const candidate = value2;
          return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown;
        }
        __name(is2, "is");
        MarkupKind2.is = is2;
      })(MarkupKind || (MarkupKind = {}));
      (function(MarkupContent2) {
        function is2(value2) {
          const candidate = value2;
          return Is.objectLiteral(value2) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
        }
        __name(is2, "is");
        MarkupContent2.is = is2;
      })(MarkupContent || (MarkupContent = {}));
      (function(CompletionItemKind2) {
        CompletionItemKind2.Text = 1;
        CompletionItemKind2.Method = 2;
        CompletionItemKind2.Function = 3;
        CompletionItemKind2.Constructor = 4;
        CompletionItemKind2.Field = 5;
        CompletionItemKind2.Variable = 6;
        CompletionItemKind2.Class = 7;
        CompletionItemKind2.Interface = 8;
        CompletionItemKind2.Module = 9;
        CompletionItemKind2.Property = 10;
        CompletionItemKind2.Unit = 11;
        CompletionItemKind2.Value = 12;
        CompletionItemKind2.Enum = 13;
        CompletionItemKind2.Keyword = 14;
        CompletionItemKind2.Snippet = 15;
        CompletionItemKind2.Color = 16;
        CompletionItemKind2.File = 17;
        CompletionItemKind2.Reference = 18;
        CompletionItemKind2.Folder = 19;
        CompletionItemKind2.EnumMember = 20;
        CompletionItemKind2.Constant = 21;
        CompletionItemKind2.Struct = 22;
        CompletionItemKind2.Event = 23;
        CompletionItemKind2.Operator = 24;
        CompletionItemKind2.TypeParameter = 25;
      })(CompletionItemKind || (CompletionItemKind = {}));
      (function(InsertTextFormat2) {
        InsertTextFormat2.PlainText = 1;
        InsertTextFormat2.Snippet = 2;
      })(InsertTextFormat || (InsertTextFormat = {}));
      (function(CompletionItemTag2) {
        CompletionItemTag2.Deprecated = 1;
      })(CompletionItemTag || (CompletionItemTag = {}));
      (function(InsertReplaceEdit2) {
        function create4(newText, insert, replace2) {
          return { newText, insert, replace: replace2 };
        }
        __name(create4, "create");
        InsertReplaceEdit2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
        }
        __name(is2, "is");
        InsertReplaceEdit2.is = is2;
      })(InsertReplaceEdit || (InsertReplaceEdit = {}));
      (function(InsertTextMode2) {
        InsertTextMode2.asIs = 1;
        InsertTextMode2.adjustIndentation = 2;
      })(InsertTextMode || (InsertTextMode = {}));
      (function(CompletionItemLabelDetails2) {
        function is2(value2) {
          const candidate = value2;
          return candidate && (Is.string(candidate.detail) || candidate.detail === void 0) && (Is.string(candidate.description) || candidate.description === void 0);
        }
        __name(is2, "is");
        CompletionItemLabelDetails2.is = is2;
      })(CompletionItemLabelDetails || (CompletionItemLabelDetails = {}));
      (function(CompletionItem2) {
        function create4(label) {
          return { label };
        }
        __name(create4, "create");
        CompletionItem2.create = create4;
      })(CompletionItem || (CompletionItem = {}));
      (function(CompletionList2) {
        function create4(items, isIncomplete) {
          return { items: items ? items : [], isIncomplete: !!isIncomplete };
        }
        __name(create4, "create");
        CompletionList2.create = create4;
      })(CompletionList || (CompletionList = {}));
      (function(MarkedString2) {
        function fromPlainText(plainText) {
          return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&");
        }
        __name(fromPlainText, "fromPlainText");
        MarkedString2.fromPlainText = fromPlainText;
        function is2(value2) {
          const candidate = value2;
          return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value);
        }
        __name(is2, "is");
        MarkedString2.is = is2;
      })(MarkedString || (MarkedString = {}));
      (function(Hover2) {
        function is2(value2) {
          let candidate = value2;
          return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value2.range === void 0 || Range.is(value2.range));
        }
        __name(is2, "is");
        Hover2.is = is2;
      })(Hover || (Hover = {}));
      (function(ParameterInformation2) {
        function create4(label, documentation) {
          return documentation ? { label, documentation } : { label };
        }
        __name(create4, "create");
        ParameterInformation2.create = create4;
      })(ParameterInformation || (ParameterInformation = {}));
      (function(SignatureInformation2) {
        function create4(label, documentation, ...parameters) {
          let result = { label };
          if (Is.defined(documentation)) {
            result.documentation = documentation;
          }
          if (Is.defined(parameters)) {
            result.parameters = parameters;
          } else {
            result.parameters = [];
          }
          return result;
        }
        __name(create4, "create");
        SignatureInformation2.create = create4;
      })(SignatureInformation || (SignatureInformation = {}));
      (function(DocumentHighlightKind2) {
        DocumentHighlightKind2.Text = 1;
        DocumentHighlightKind2.Read = 2;
        DocumentHighlightKind2.Write = 3;
      })(DocumentHighlightKind || (DocumentHighlightKind = {}));
      (function(DocumentHighlight2) {
        function create4(range3, kind) {
          let result = { range: range3 };
          if (Is.number(kind)) {
            result.kind = kind;
          }
          return result;
        }
        __name(create4, "create");
        DocumentHighlight2.create = create4;
      })(DocumentHighlight || (DocumentHighlight = {}));
      (function(SymbolKind2) {
        SymbolKind2.File = 1;
        SymbolKind2.Module = 2;
        SymbolKind2.Namespace = 3;
        SymbolKind2.Package = 4;
        SymbolKind2.Class = 5;
        SymbolKind2.Method = 6;
        SymbolKind2.Property = 7;
        SymbolKind2.Field = 8;
        SymbolKind2.Constructor = 9;
        SymbolKind2.Enum = 10;
        SymbolKind2.Interface = 11;
        SymbolKind2.Function = 12;
        SymbolKind2.Variable = 13;
        SymbolKind2.Constant = 14;
        SymbolKind2.String = 15;
        SymbolKind2.Number = 16;
        SymbolKind2.Boolean = 17;
        SymbolKind2.Array = 18;
        SymbolKind2.Object = 19;
        SymbolKind2.Key = 20;
        SymbolKind2.Null = 21;
        SymbolKind2.EnumMember = 22;
        SymbolKind2.Struct = 23;
        SymbolKind2.Event = 24;
        SymbolKind2.Operator = 25;
        SymbolKind2.TypeParameter = 26;
      })(SymbolKind || (SymbolKind = {}));
      (function(SymbolTag2) {
        SymbolTag2.Deprecated = 1;
      })(SymbolTag || (SymbolTag = {}));
      (function(SymbolInformation2) {
        function create4(name, kind, range3, uri, containerName) {
          let result = {
            name,
            kind,
            location: { uri, range: range3 }
          };
          if (containerName) {
            result.containerName = containerName;
          }
          return result;
        }
        __name(create4, "create");
        SymbolInformation2.create = create4;
      })(SymbolInformation || (SymbolInformation = {}));
      (function(WorkspaceSymbol2) {
        function create4(name, kind, uri, range3) {
          return range3 !== void 0 ? { name, kind, location: { uri, range: range3 } } : { name, kind, location: { uri } };
        }
        __name(create4, "create");
        WorkspaceSymbol2.create = create4;
      })(WorkspaceSymbol || (WorkspaceSymbol = {}));
      (function(DocumentSymbol2) {
        function create4(name, detail, kind, range3, selectionRange, children2) {
          let result = {
            name,
            detail,
            kind,
            range: range3,
            selectionRange
          };
          if (children2 !== void 0) {
            result.children = children2;
          }
          return result;
        }
        __name(create4, "create");
        DocumentSymbol2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range.is(candidate.range) && Range.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags));
        }
        __name(is2, "is");
        DocumentSymbol2.is = is2;
      })(DocumentSymbol || (DocumentSymbol = {}));
      (function(CodeActionKind2) {
        CodeActionKind2.Empty = "";
        CodeActionKind2.QuickFix = "quickfix";
        CodeActionKind2.Refactor = "refactor";
        CodeActionKind2.RefactorExtract = "refactor.extract";
        CodeActionKind2.RefactorInline = "refactor.inline";
        CodeActionKind2.RefactorRewrite = "refactor.rewrite";
        CodeActionKind2.Source = "source";
        CodeActionKind2.SourceOrganizeImports = "source.organizeImports";
        CodeActionKind2.SourceFixAll = "source.fixAll";
      })(CodeActionKind || (CodeActionKind = {}));
      (function(CodeActionTriggerKind2) {
        CodeActionTriggerKind2.Invoked = 1;
        CodeActionTriggerKind2.Automatic = 2;
      })(CodeActionTriggerKind || (CodeActionTriggerKind = {}));
      (function(CodeActionContext2) {
        function create4(diagnostics, only, triggerKind) {
          let result = { diagnostics };
          if (only !== void 0 && only !== null) {
            result.only = only;
          }
          if (triggerKind !== void 0 && triggerKind !== null) {
            result.triggerKind = triggerKind;
          }
          return result;
        }
        __name(create4, "create");
        CodeActionContext2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic);
        }
        __name(is2, "is");
        CodeActionContext2.is = is2;
      })(CodeActionContext || (CodeActionContext = {}));
      (function(CodeAction2) {
        function create4(title2, kindOrCommandOrEdit, kind) {
          let result = { title: title2 };
          let checkKind = true;
          if (typeof kindOrCommandOrEdit === "string") {
            checkKind = false;
            result.kind = kindOrCommandOrEdit;
          } else if (Command.is(kindOrCommandOrEdit)) {
            result.command = kindOrCommandOrEdit;
          } else {
            result.edit = kindOrCommandOrEdit;
          }
          if (checkKind && kind !== void 0) {
            result.kind = kind;
          }
          return result;
        }
        __name(create4, "create");
        CodeAction2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
        }
        __name(is2, "is");
        CodeAction2.is = is2;
      })(CodeAction || (CodeAction = {}));
      (function(CodeLens2) {
        function create4(range3, data5) {
          let result = { range: range3 };
          if (Is.defined(data5)) {
            result.data = data5;
          }
          return result;
        }
        __name(create4, "create");
        CodeLens2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
        }
        __name(is2, "is");
        CodeLens2.is = is2;
      })(CodeLens || (CodeLens = {}));
      (function(FormattingOptions2) {
        function create4(tabSize, insertSpaces) {
          return { tabSize, insertSpaces };
        }
        __name(create4, "create");
        FormattingOptions2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
        }
        __name(is2, "is");
        FormattingOptions2.is = is2;
      })(FormattingOptions || (FormattingOptions = {}));
      (function(DocumentLink2) {
        function create4(range3, target, data5) {
          return { range: range3, target, data: data5 };
        }
        __name(create4, "create");
        DocumentLink2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
        }
        __name(is2, "is");
        DocumentLink2.is = is2;
      })(DocumentLink || (DocumentLink = {}));
      (function(SelectionRange2) {
        function create4(range3, parent4) {
          return { range: range3, parent: parent4 };
        }
        __name(create4, "create");
        SelectionRange2.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent));
        }
        __name(is2, "is");
        SelectionRange2.is = is2;
      })(SelectionRange || (SelectionRange = {}));
      (function(SemanticTokenTypes2) {
        SemanticTokenTypes2["namespace"] = "namespace";
        SemanticTokenTypes2["type"] = "type";
        SemanticTokenTypes2["class"] = "class";
        SemanticTokenTypes2["enum"] = "enum";
        SemanticTokenTypes2["interface"] = "interface";
        SemanticTokenTypes2["struct"] = "struct";
        SemanticTokenTypes2["typeParameter"] = "typeParameter";
        SemanticTokenTypes2["parameter"] = "parameter";
        SemanticTokenTypes2["variable"] = "variable";
        SemanticTokenTypes2["property"] = "property";
        SemanticTokenTypes2["enumMember"] = "enumMember";
        SemanticTokenTypes2["event"] = "event";
        SemanticTokenTypes2["function"] = "function";
        SemanticTokenTypes2["method"] = "method";
        SemanticTokenTypes2["macro"] = "macro";
        SemanticTokenTypes2["keyword"] = "keyword";
        SemanticTokenTypes2["modifier"] = "modifier";
        SemanticTokenTypes2["comment"] = "comment";
        SemanticTokenTypes2["string"] = "string";
        SemanticTokenTypes2["number"] = "number";
        SemanticTokenTypes2["regexp"] = "regexp";
        SemanticTokenTypes2["operator"] = "operator";
        SemanticTokenTypes2["decorator"] = "decorator";
      })(SemanticTokenTypes || (SemanticTokenTypes = {}));
      (function(SemanticTokenModifiers2) {
        SemanticTokenModifiers2["declaration"] = "declaration";
        SemanticTokenModifiers2["definition"] = "definition";
        SemanticTokenModifiers2["readonly"] = "readonly";
        SemanticTokenModifiers2["static"] = "static";
        SemanticTokenModifiers2["deprecated"] = "deprecated";
        SemanticTokenModifiers2["abstract"] = "abstract";
        SemanticTokenModifiers2["async"] = "async";
        SemanticTokenModifiers2["modification"] = "modification";
        SemanticTokenModifiers2["documentation"] = "documentation";
        SemanticTokenModifiers2["defaultLibrary"] = "defaultLibrary";
      })(SemanticTokenModifiers || (SemanticTokenModifiers = {}));
      (function(SemanticTokens2) {
        function is2(value2) {
          const candidate = value2;
          return Is.objectLiteral(candidate) && (candidate.resultId === void 0 || typeof candidate.resultId === "string") && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === "number");
        }
        __name(is2, "is");
        SemanticTokens2.is = is2;
      })(SemanticTokens || (SemanticTokens = {}));
      (function(InlineValueText2) {
        function create4(range3, text4) {
          return { range: range3, text: text4 };
        }
        __name(create4, "create");
        InlineValueText2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text);
        }
        __name(is2, "is");
        InlineValueText2.is = is2;
      })(InlineValueText || (InlineValueText = {}));
      (function(InlineValueVariableLookup2) {
        function create4(range3, variableName, caseSensitiveLookup) {
          return { range: range3, variableName, caseSensitiveLookup };
        }
        __name(create4, "create");
        InlineValueVariableLookup2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0);
        }
        __name(is2, "is");
        InlineValueVariableLookup2.is = is2;
      })(InlineValueVariableLookup || (InlineValueVariableLookup = {}));
      (function(InlineValueEvaluatableExpression2) {
        function create4(range3, expression) {
          return { range: range3, expression };
        }
        __name(create4, "create");
        InlineValueEvaluatableExpression2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0);
        }
        __name(is2, "is");
        InlineValueEvaluatableExpression2.is = is2;
      })(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {}));
      (function(InlineValueContext2) {
        function create4(frameId, stoppedLocation) {
          return { frameId, stoppedLocation };
        }
        __name(create4, "create");
        InlineValueContext2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return Is.defined(candidate) && Range.is(value2.stoppedLocation);
        }
        __name(is2, "is");
        InlineValueContext2.is = is2;
      })(InlineValueContext || (InlineValueContext = {}));
      (function(InlayHintKind2) {
        InlayHintKind2.Type = 1;
        InlayHintKind2.Parameter = 2;
        function is2(value2) {
          return value2 === 1 || value2 === 2;
        }
        __name(is2, "is");
        InlayHintKind2.is = is2;
      })(InlayHintKind || (InlayHintKind = {}));
      (function(InlayHintLabelPart2) {
        function create4(value2) {
          return { value: value2 };
        }
        __name(create4, "create");
        InlayHintLabelPart2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.location === void 0 || Location.is(candidate.location)) && (candidate.command === void 0 || Command.is(candidate.command));
        }
        __name(is2, "is");
        InlayHintLabelPart2.is = is2;
      })(InlayHintLabelPart || (InlayHintLabelPart = {}));
      (function(InlayHint2) {
        function create4(position5, label, kind) {
          const result = { position: position5, label };
          if (kind !== void 0) {
            result.kind = kind;
          }
          return result;
        }
        __name(create4, "create");
        InlayHint2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return Is.objectLiteral(candidate) && Position.is(candidate.position) && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is)) && (candidate.kind === void 0 || InlayHintKind.is(candidate.kind)) && candidate.textEdits === void 0 || Is.typedArray(candidate.textEdits, TextEdit.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight));
        }
        __name(is2, "is");
        InlayHint2.is = is2;
      })(InlayHint || (InlayHint = {}));
      (function(StringValue2) {
        function createSnippet(value2) {
          return { kind: "snippet", value: value2 };
        }
        __name(createSnippet, "createSnippet");
        StringValue2.createSnippet = createSnippet;
      })(StringValue || (StringValue = {}));
      (function(InlineCompletionItem2) {
        function create4(insertText, filterText, range3, command) {
          return { insertText, filterText, range: range3, command };
        }
        __name(create4, "create");
        InlineCompletionItem2.create = create4;
      })(InlineCompletionItem || (InlineCompletionItem = {}));
      (function(InlineCompletionList2) {
        function create4(items) {
          return { items };
        }
        __name(create4, "create");
        InlineCompletionList2.create = create4;
      })(InlineCompletionList || (InlineCompletionList = {}));
      (function(InlineCompletionTriggerKind2) {
        InlineCompletionTriggerKind2.Invoked = 0;
        InlineCompletionTriggerKind2.Automatic = 1;
      })(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));
      (function(SelectedCompletionInfo2) {
        function create4(range3, text4) {
          return { range: range3, text: text4 };
        }
        __name(create4, "create");
        SelectedCompletionInfo2.create = create4;
      })(SelectedCompletionInfo || (SelectedCompletionInfo = {}));
      (function(InlineCompletionContext2) {
        function create4(triggerKind, selectedCompletionInfo) {
          return { triggerKind, selectedCompletionInfo };
        }
        __name(create4, "create");
        InlineCompletionContext2.create = create4;
      })(InlineCompletionContext || (InlineCompletionContext = {}));
      (function(WorkspaceFolder2) {
        function is2(value2) {
          const candidate = value2;
          return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name);
        }
        __name(is2, "is");
        WorkspaceFolder2.is = is2;
      })(WorkspaceFolder || (WorkspaceFolder = {}));
      EOL = ["\n", "\r\n", "\r"];
      (function(TextDocument3) {
        function create4(uri, languageId, version3, content) {
          return new FullTextDocument(uri, languageId, version3, content);
        }
        __name(create4, "create");
        TextDocument3.create = create4;
        function is2(value2) {
          let candidate = value2;
          return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
        }
        __name(is2, "is");
        TextDocument3.is = is2;
        function applyEdits(document2, edits) {
          let text4 = document2.getText();
          let sortedEdits = mergeSort2(edits, (a2, b3) => {
            let diff2 = a2.range.start.line - b3.range.start.line;
            if (diff2 === 0) {
              return a2.range.start.character - b3.range.start.character;
            }
            return diff2;
          });
          let lastModifiedOffset = text4.length;
          for (let i2 = sortedEdits.length - 1; i2 >= 0; i2--) {
            let e3 = sortedEdits[i2];
            let startOffset = document2.offsetAt(e3.range.start);
            let endOffset = document2.offsetAt(e3.range.end);
            if (endOffset <= lastModifiedOffset) {
              text4 = text4.substring(0, startOffset) + e3.newText + text4.substring(endOffset, text4.length);
            } else {
              throw new Error("Overlapping edit");
            }
            lastModifiedOffset = startOffset;
          }
          return text4;
        }
        __name(applyEdits, "applyEdits");
        TextDocument3.applyEdits = applyEdits;
        function mergeSort2(data5, compare) {
          if (data5.length <= 1) {
            return data5;
          }
          const p3 = data5.length / 2 | 0;
          const left3 = data5.slice(0, p3);
          const right3 = data5.slice(p3);
          mergeSort2(left3, compare);
          mergeSort2(right3, compare);
          let leftIdx = 0;
          let rightIdx = 0;
          let i2 = 0;
          while (leftIdx < left3.length && rightIdx < right3.length) {
            let ret = compare(left3[leftIdx], right3[rightIdx]);
            if (ret <= 0) {
              data5[i2++] = left3[leftIdx++];
            } else {
              data5[i2++] = right3[rightIdx++];
            }
          }
          while (leftIdx < left3.length) {
            data5[i2++] = left3[leftIdx++];
          }
          while (rightIdx < right3.length) {
            data5[i2++] = right3[rightIdx++];
          }
          return data5;
        }
        __name(mergeSort2, "mergeSort");
      })(TextDocument || (TextDocument = {}));
      FullTextDocument = class {
        static {
          __name(this, "FullTextDocument");
        }
        constructor(uri, languageId, version3, content) {
          this._uri = uri;
          this._languageId = languageId;
          this._version = version3;
          this._content = content;
          this._lineOffsets = void 0;
        }
        get uri() {
          return this._uri;
        }
        get languageId() {
          return this._languageId;
        }
        get version() {
          return this._version;
        }
        getText(range3) {
          if (range3) {
            let start3 = this.offsetAt(range3.start);
            let end2 = this.offsetAt(range3.end);
            return this._content.substring(start3, end2);
          }
          return this._content;
        }
        update(event3, version3) {
          this._content = event3.text;
          this._version = version3;
          this._lineOffsets = void 0;
        }
        getLineOffsets() {
          if (this._lineOffsets === void 0) {
            let lineOffsets = [];
            let text4 = this._content;
            let isLineStart = true;
            for (let i2 = 0; i2 < text4.length; i2++) {
              if (isLineStart) {
                lineOffsets.push(i2);
                isLineStart = false;
              }
              let ch = text4.charAt(i2);
              isLineStart = ch === "\r" || ch === "\n";
              if (ch === "\r" && i2 + 1 < text4.length && text4.charAt(i2 + 1) === "\n") {
                i2++;
              }
            }
            if (isLineStart && text4.length > 0) {
              lineOffsets.push(text4.length);
            }
            this._lineOffsets = lineOffsets;
          }
          return this._lineOffsets;
        }
        positionAt(offset) {
          offset = Math.max(Math.min(offset, this._content.length), 0);
          let lineOffsets = this.getLineOffsets();
          let low = 0, high = lineOffsets.length;
          if (high === 0) {
            return Position.create(0, offset);
          }
          while (low < high) {
            let mid = Math.floor((low + high) / 2);
            if (lineOffsets[mid] > offset) {
              high = mid;
            } else {
              low = mid + 1;
            }
          }
          let line2 = low - 1;
          return Position.create(line2, offset - lineOffsets[line2]);
        }
        offsetAt(position5) {
          let lineOffsets = this.getLineOffsets();
          if (position5.line >= lineOffsets.length) {
            return this._content.length;
          } else if (position5.line < 0) {
            return 0;
          }
          let lineOffset = lineOffsets[position5.line];
          let nextLineOffset = position5.line + 1 < lineOffsets.length ? lineOffsets[position5.line + 1] : this._content.length;
          return Math.max(Math.min(lineOffset + position5.character, nextLineOffset), lineOffset);
        }
        get lineCount() {
          return this.getLineOffsets().length;
        }
      };
      (function(Is2) {
        const toString6 = Object.prototype.toString;
        function defined(value2) {
          return typeof value2 !== "undefined";
        }
        __name(defined, "defined");
        Is2.defined = defined;
        function undefined2(value2) {
          return typeof value2 === "undefined";
        }
        __name(undefined2, "undefined");
        Is2.undefined = undefined2;
        function boolean(value2) {
          return value2 === true || value2 === false;
        }
        __name(boolean, "boolean");
        Is2.boolean = boolean;
        function string3(value2) {
          return toString6.call(value2) === "[object String]";
        }
        __name(string3, "string");
        Is2.string = string3;
        function number7(value2) {
          return toString6.call(value2) === "[object Number]";
        }
        __name(number7, "number");
        Is2.number = number7;
        function numberRange(value2, min9, max10) {
          return toString6.call(value2) === "[object Number]" && min9 <= value2 && value2 <= max10;
        }
        __name(numberRange, "numberRange");
        Is2.numberRange = numberRange;
        function integer4(value2) {
          return toString6.call(value2) === "[object Number]" && -2147483648 <= value2 && value2 <= 2147483647;
        }
        __name(integer4, "integer");
        Is2.integer = integer4;
        function uinteger2(value2) {
          return toString6.call(value2) === "[object Number]" && 0 <= value2 && value2 <= 2147483647;
        }
        __name(uinteger2, "uinteger");
        Is2.uinteger = uinteger2;
        function func(value2) {
          return toString6.call(value2) === "[object Function]";
        }
        __name(func, "func");
        Is2.func = func;
        function objectLiteral(value2) {
          return value2 !== null && typeof value2 === "object";
        }
        __name(objectLiteral, "objectLiteral");
        Is2.objectLiteral = objectLiteral;
        function typedArray(value2, check) {
          return Array.isArray(value2) && value2.every(check);
        }
        __name(typedArray, "typedArray");
        Is2.typedArray = typedArray;
      })(Is || (Is = {}));
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/cst-node-builder.js
  var CstNodeBuilder, AbstractCstNode, LeafCstNodeImpl, CompositeCstNodeImpl, CstNodeContainer, RootCstNodeImpl;
  var init_cst_node_builder = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/cst-node-builder.js"() {
      "use strict";
      init_main();
      init_cst_utils();
      CstNodeBuilder = class {
        static {
          __name(this, "CstNodeBuilder");
        }
        constructor() {
          this.nodeStack = [];
        }
        get current() {
          return this.nodeStack[this.nodeStack.length - 1] ?? this.rootNode;
        }
        buildRootNode(input) {
          this.rootNode = new RootCstNodeImpl(input);
          this.rootNode.root = this.rootNode;
          this.nodeStack = [this.rootNode];
          return this.rootNode;
        }
        buildCompositeNode(feature) {
          const compositeNode = new CompositeCstNodeImpl();
          compositeNode.grammarSource = feature;
          compositeNode.root = this.rootNode;
          this.current.content.push(compositeNode);
          this.nodeStack.push(compositeNode);
          return compositeNode;
        }
        buildLeafNode(token2, feature) {
          const leafNode = new LeafCstNodeImpl(token2.startOffset, token2.image.length, tokenToRange(token2), token2.tokenType, !feature);
          leafNode.grammarSource = feature;
          leafNode.root = this.rootNode;
          this.current.content.push(leafNode);
          return leafNode;
        }
        removeNode(node2) {
          const parent4 = node2.container;
          if (parent4) {
            const index = parent4.content.indexOf(node2);
            if (index >= 0) {
              parent4.content.splice(index, 1);
            }
          }
        }
        addHiddenNodes(tokens2) {
          const nodes5 = [];
          for (const token2 of tokens2) {
            const leafNode = new LeafCstNodeImpl(token2.startOffset, token2.image.length, tokenToRange(token2), token2.tokenType, true);
            leafNode.root = this.rootNode;
            nodes5.push(leafNode);
          }
          let current = this.current;
          let added = false;
          if (current.content.length > 0) {
            current.content.push(...nodes5);
            return;
          }
          while (current.container) {
            const index = current.container.content.indexOf(current);
            if (index > 0) {
              current.container.content.splice(index, 0, ...nodes5);
              added = true;
              break;
            }
            current = current.container;
          }
          if (!added) {
            this.rootNode.content.unshift(...nodes5);
          }
        }
        construct(item) {
          const current = this.current;
          if (typeof item.$type === "string" && !item.$infix) {
            this.current.astNode = item;
          }
          item.$cstNode = current;
          const node2 = this.nodeStack.pop();
          if (node2?.content.length === 0) {
            this.removeNode(node2);
          }
        }
      };
      AbstractCstNode = class {
        static {
          __name(this, "AbstractCstNode");
        }
        get hidden() {
          return false;
        }
        get astNode() {
          const node2 = typeof this._astNode?.$type === "string" ? this._astNode : this.container?.astNode;
          if (!node2) {
            throw new Error("This node has no associated AST element");
          }
          return node2;
        }
        set astNode(value2) {
          this._astNode = value2;
        }
        get text() {
          return this.root.fullText.substring(this.offset, this.end);
        }
      };
      LeafCstNodeImpl = class extends AbstractCstNode {
        static {
          __name(this, "LeafCstNodeImpl");
        }
        get offset() {
          return this._offset;
        }
        get length() {
          return this._length;
        }
        get end() {
          return this._offset + this._length;
        }
        get hidden() {
          return this._hidden;
        }
        get tokenType() {
          return this._tokenType;
        }
        get range() {
          return this._range;
        }
        constructor(offset, length2, range3, tokenType, hidden = false) {
          super();
          this._hidden = hidden;
          this._offset = offset;
          this._tokenType = tokenType;
          this._length = length2;
          this._range = range3;
        }
      };
      CompositeCstNodeImpl = class extends AbstractCstNode {
        static {
          __name(this, "CompositeCstNodeImpl");
        }
        constructor() {
          super(...arguments);
          this.content = new CstNodeContainer(this);
        }
        get offset() {
          return this.firstNonHiddenNode?.offset ?? 0;
        }
        get length() {
          return this.end - this.offset;
        }
        get end() {
          return this.lastNonHiddenNode?.end ?? 0;
        }
        get range() {
          const firstNode = this.firstNonHiddenNode;
          const lastNode = this.lastNonHiddenNode;
          if (firstNode && lastNode) {
            if (this._rangeCache === void 0) {
              const { range: firstRange } = firstNode;
              const { range: lastRange } = lastNode;
              this._rangeCache = { start: firstRange.start, end: lastRange.end.line < firstRange.start.line ? firstRange.start : lastRange.end };
            }
            return this._rangeCache;
          } else {
            return { start: Position.create(0, 0), end: Position.create(0, 0) };
          }
        }
        get firstNonHiddenNode() {
          for (const child of this.content) {
            if (!child.hidden) {
              return child;
            }
          }
          return this.content[0];
        }
        get lastNonHiddenNode() {
          for (let i2 = this.content.length - 1; i2 >= 0; i2--) {
            const child = this.content[i2];
            if (!child.hidden) {
              return child;
            }
          }
          return this.content[this.content.length - 1];
        }
      };
      CstNodeContainer = class _CstNodeContainer extends Array {
        static {
          __name(this, "CstNodeContainer");
        }
        constructor(parent4) {
          super();
          this.parent = parent4;
          Object.setPrototypeOf(this, _CstNodeContainer.prototype);
        }
        push(...items) {
          this.addParents(items);
          return super.push(...items);
        }
        unshift(...items) {
          this.addParents(items);
          return super.unshift(...items);
        }
        splice(start3, count2, ...items) {
          this.addParents(items);
          return super.splice(start3, count2, ...items);
        }
        addParents(items) {
          for (const item of items) {
            item.container = this.parent;
          }
        }
      };
      RootCstNodeImpl = class extends CompositeCstNodeImpl {
        static {
          __name(this, "RootCstNodeImpl");
        }
        get text() {
          return this._text.substring(this.offset, this.end);
        }
        get fullText() {
          return this._text;
        }
        constructor(input) {
          super();
          this._text = "";
          this._text = input ?? "";
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/langium-parser.js
  function isDataTypeNode(node2) {
    return node2.$type === DatatypeSymbol;
  }
  var DatatypeSymbol, ruleSuffix, withRuleSuffix, AbstractLangiumParser, LangiumParser, AbstractParserErrorMessageProvider, LangiumParserErrorMessageProvider, LangiumCompletionParser, defaultConfig3, ChevrotainWrapper, ProfilerWrapper;
  var init_langium_parser = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/langium-parser.js"() {
      "use strict";
      init_ast();
      init_api5();
      init_lib2();
      init_ast();
      init_grammar_utils();
      init_ast_utils();
      init_cst_node_builder();
      DatatypeSymbol = Symbol("Datatype");
      __name(isDataTypeNode, "isDataTypeNode");
      ruleSuffix = "\u200B";
      withRuleSuffix = /* @__PURE__ */ __name((name) => name.endsWith(ruleSuffix) ? name : name + ruleSuffix, "withRuleSuffix");
      AbstractLangiumParser = class {
        static {
          __name(this, "AbstractLangiumParser");
        }
        constructor(services) {
          this._unorderedGroups = /* @__PURE__ */ new Map();
          this.allRules = /* @__PURE__ */ new Map();
          this.lexer = services.parser.Lexer;
          const tokens2 = this.lexer.definition;
          const production = services.LanguageMetaData.mode === "production";
          if (services.shared.profilers.LangiumProfiler?.isActive("parsing")) {
            this.wrapper = new ProfilerWrapper(tokens2, {
              ...services.parser.ParserConfig,
              skipValidations: production,
              errorMessageProvider: services.parser.ParserErrorMessageProvider
            }, services.shared.profilers.LangiumProfiler.createTask("parsing", services.LanguageMetaData.languageId));
          } else {
            this.wrapper = new ChevrotainWrapper(tokens2, {
              ...services.parser.ParserConfig,
              skipValidations: production,
              errorMessageProvider: services.parser.ParserErrorMessageProvider
            });
          }
        }
        alternatives(idx, choices) {
          this.wrapper.wrapOr(idx, choices);
        }
        optional(idx, callback) {
          this.wrapper.wrapOption(idx, callback);
        }
        many(idx, callback) {
          this.wrapper.wrapMany(idx, callback);
        }
        atLeastOne(idx, callback) {
          this.wrapper.wrapAtLeastOne(idx, callback);
        }
        getRule(name) {
          return this.allRules.get(name);
        }
        isRecording() {
          return this.wrapper.IS_RECORDING;
        }
        get unorderedGroups() {
          return this._unorderedGroups;
        }
        getRuleStack() {
          return this.wrapper.RULE_STACK;
        }
        finalize() {
          this.wrapper.wrapSelfAnalysis();
        }
      };
      LangiumParser = class extends AbstractLangiumParser {
        static {
          __name(this, "LangiumParser");
        }
        get current() {
          return this.stack[this.stack.length - 1];
        }
        constructor(services) {
          super(services);
          this.nodeBuilder = new CstNodeBuilder();
          this.stack = [];
          this.assignmentMap = /* @__PURE__ */ new Map();
          this.operatorPrecedence = /* @__PURE__ */ new Map();
          this.linker = services.references.Linker;
          this.converter = services.parser.ValueConverter;
          this.astReflection = services.shared.AstReflection;
        }
        rule(rule, impl2) {
          const type3 = this.computeRuleType(rule);
          let infixName = void 0;
          if (isInfixRule(rule)) {
            infixName = rule.name;
            this.registerPrecedenceMap(rule);
          }
          const ruleMethod = this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name), this.startImplementation(type3, infixName, impl2).bind(this));
          this.allRules.set(rule.name, ruleMethod);
          if (isParserRule(rule) && rule.entry) {
            this.mainRule = ruleMethod;
          }
          return ruleMethod;
        }
        registerPrecedenceMap(rule) {
          const name = rule.name;
          const map5 = /* @__PURE__ */ new Map();
          for (let i2 = 0; i2 < rule.operators.precedences.length; i2++) {
            const precedence = rule.operators.precedences[i2];
            for (const keyword of precedence.operators) {
              map5.set(keyword.value, {
                precedence: i2,
                rightAssoc: precedence.associativity === "right"
              });
            }
          }
          this.operatorPrecedence.set(name, map5);
        }
        computeRuleType(rule) {
          if (isInfixRule(rule)) {
            return getTypeName(rule);
          } else if (rule.fragment) {
            return void 0;
          } else if (isDataTypeRule(rule)) {
            return DatatypeSymbol;
          } else {
            return getTypeName(rule);
          }
        }
        parse(input, options2 = {}) {
          this.nodeBuilder.buildRootNode(input);
          const lexerResult = this.lexerResult = this.lexer.tokenize(input);
          this.wrapper.input = lexerResult.tokens;
          const ruleMethod = options2.rule ? this.allRules.get(options2.rule) : this.mainRule;
          if (!ruleMethod) {
            throw new Error(options2.rule ? `No rule found with name '${options2.rule}'` : "No main rule available.");
          }
          const result = this.doParse(ruleMethod);
          this.nodeBuilder.addHiddenNodes(lexerResult.hidden);
          this.unorderedGroups.clear();
          this.lexerResult = void 0;
          linkContentToContainer(result, { deep: true });
          return {
            value: result,
            lexerErrors: lexerResult.errors,
            lexerReport: lexerResult.report,
            parserErrors: this.wrapper.errors
          };
        }
        doParse(rule) {
          let result = this.wrapper.rule(rule);
          if (this.stack.length > 0) {
            result = this.construct();
          }
          if (result === void 0) {
            throw new Error("No result from parser");
          } else if (this.stack.length > 0) {
            throw new Error("Parser stack is not empty after parsing");
          }
          return result;
        }
        startImplementation($type, infixName, implementation) {
          return (args) => {
            const createNode = !this.isRecording() && $type !== void 0;
            if (createNode) {
              const node2 = { $type };
              this.stack.push(node2);
              if ($type === DatatypeSymbol) {
                node2.value = "";
              } else if (infixName !== void 0) {
                node2.$infixName = infixName;
              }
            }
            implementation(args);
            return createNode ? this.construct() : void 0;
          };
        }
        extractHiddenTokens(token2) {
          const hiddenTokens = this.lexerResult.hidden;
          if (!hiddenTokens.length) {
            return [];
          }
          const offset = token2.startOffset;
          for (let i2 = 0; i2 < hiddenTokens.length; i2++) {
            const token3 = hiddenTokens[i2];
            if (token3.startOffset > offset) {
              return hiddenTokens.splice(0, i2);
            }
          }
          return hiddenTokens.splice(0, hiddenTokens.length);
        }
        consume(idx, tokenType, feature) {
          const token2 = this.wrapper.wrapConsume(idx, tokenType);
          if (!this.isRecording() && this.isValidToken(token2)) {
            const hiddenTokens = this.extractHiddenTokens(token2);
            this.nodeBuilder.addHiddenNodes(hiddenTokens);
            const leafNode = this.nodeBuilder.buildLeafNode(token2, feature);
            const { assignment, crossRef } = this.getAssignment(feature);
            const current = this.current;
            if (assignment) {
              const convertedValue = isKeyword(feature) ? token2.image : this.converter.convert(token2.image, leafNode);
              this.assign(assignment.operator, assignment.feature, convertedValue, leafNode, crossRef);
            } else if (isDataTypeNode(current)) {
              let text4 = token2.image;
              if (!isKeyword(feature)) {
                text4 = this.converter.convert(text4, leafNode).toString();
              }
              current.value += text4;
            }
          }
        }
        /**
         * Most consumed parser tokens are valid. However there are two cases in which they are not valid:
         *
         * 1. They were inserted during error recovery by the parser. These tokens don't really exist and should not be further processed
         * 2. They contain invalid token ranges. This might include the special EOF token, or other tokens produced by invalid token builders.
         */
        isValidToken(token2) {
          return !token2.isInsertedInRecovery && !isNaN(token2.startOffset) && typeof token2.endOffset === "number" && !isNaN(token2.endOffset);
        }
        subrule(idx, rule, fragment, feature, args) {
          let cstNode;
          if (!this.isRecording() && !fragment) {
            cstNode = this.nodeBuilder.buildCompositeNode(feature);
          }
          let result;
          try {
            result = this.wrapper.wrapSubrule(idx, rule, args);
          } finally {
            if (!this.isRecording()) {
              if (result === void 0 && !fragment) {
                result = this.construct();
              }
              if (result !== void 0 && cstNode && cstNode.length > 0) {
                this.performSubruleAssignment(result, feature, cstNode);
              }
            }
          }
        }
        performSubruleAssignment(result, feature, cstNode) {
          const { assignment, crossRef } = this.getAssignment(feature);
          if (assignment) {
            this.assign(assignment.operator, assignment.feature, result, cstNode, crossRef);
          } else if (!assignment) {
            const current = this.current;
            if (isDataTypeNode(current)) {
              current.value += result.toString();
            } else if (typeof result === "object" && result) {
              const object3 = this.assignWithoutOverride(result, current);
              const newItem = object3;
              this.stack.pop();
              this.stack.push(newItem);
            }
          }
        }
        action($type, action) {
          if (!this.isRecording()) {
            let last3 = this.current;
            if (action.feature && action.operator) {
              last3 = this.construct();
              this.nodeBuilder.removeNode(last3.$cstNode);
              const node2 = this.nodeBuilder.buildCompositeNode(action);
              node2.content.push(last3.$cstNode);
              const newItem = { $type };
              this.stack.push(newItem);
              this.assign(action.operator, action.feature, last3, last3.$cstNode);
            } else {
              last3.$type = $type;
            }
          }
        }
        construct() {
          if (this.isRecording()) {
            return void 0;
          }
          const obj = this.stack.pop();
          this.nodeBuilder.construct(obj);
          if ("$infixName" in obj) {
            return this.constructInfix(obj, this.operatorPrecedence.get(obj.$infixName));
          } else if (isDataTypeNode(obj)) {
            return this.converter.convert(obj.value, obj.$cstNode);
          } else {
            assignMandatoryProperties(this.astReflection, obj);
          }
          return obj;
        }
        constructInfix(obj, precedence) {
          const parts = obj.parts;
          if (!Array.isArray(parts) || parts.length === 0) {
            return void 0;
          }
          const operators = obj.operators;
          if (!Array.isArray(operators) || parts.length < 2) {
            return parts[0];
          }
          let lowestPrecedenceIdx = 0;
          let lowestPrecedenceValue = -1;
          for (let i2 = 0; i2 < operators.length; i2++) {
            const operator = operators[i2];
            const opPrecedence = precedence.get(operator) ?? {
              precedence: Infinity,
              rightAssoc: false
            };
            if (opPrecedence.precedence > lowestPrecedenceValue) {
              lowestPrecedenceValue = opPrecedence.precedence;
              lowestPrecedenceIdx = i2;
            } else if (opPrecedence.precedence === lowestPrecedenceValue) {
              if (!opPrecedence.rightAssoc) {
                lowestPrecedenceIdx = i2;
              }
            }
          }
          const leftOperators = operators.slice(0, lowestPrecedenceIdx);
          const rightOperators = operators.slice(lowestPrecedenceIdx + 1);
          const leftParts = parts.slice(0, lowestPrecedenceIdx + 1);
          const rightParts = parts.slice(lowestPrecedenceIdx + 1);
          const leftInfix = {
            $infixName: obj.$infixName,
            $type: obj.$type,
            $cstNode: obj.$cstNode,
            parts: leftParts,
            operators: leftOperators
          };
          const rightInfix = {
            $infixName: obj.$infixName,
            $type: obj.$type,
            $cstNode: obj.$cstNode,
            parts: rightParts,
            operators: rightOperators
          };
          const leftTree = this.constructInfix(leftInfix, precedence);
          const rightTree = this.constructInfix(rightInfix, precedence);
          return {
            $type: obj.$type,
            $cstNode: obj.$cstNode,
            left: leftTree,
            operator: operators[lowestPrecedenceIdx],
            right: rightTree
          };
        }
        getAssignment(feature) {
          if (!this.assignmentMap.has(feature)) {
            const assignment = getContainerOfType(feature, isAssignment);
            this.assignmentMap.set(feature, {
              assignment,
              crossRef: assignment && isCrossReference(assignment.terminal) ? assignment.terminal.isMulti ? "multi" : "single" : void 0
            });
          }
          return this.assignmentMap.get(feature);
        }
        assign(operator, feature, value2, cstNode, crossRef) {
          const obj = this.current;
          let item;
          if (crossRef === "single" && typeof value2 === "string") {
            item = this.linker.buildReference(obj, feature, cstNode, value2);
          } else if (crossRef === "multi" && typeof value2 === "string") {
            item = this.linker.buildMultiReference(obj, feature, cstNode, value2);
          } else {
            item = value2;
          }
          switch (operator) {
            case "=": {
              obj[feature] = item;
              break;
            }
            case "?=": {
              obj[feature] = true;
              break;
            }
            case "+=": {
              if (!Array.isArray(obj[feature])) {
                obj[feature] = [];
              }
              obj[feature].push(item);
            }
          }
        }
        assignWithoutOverride(target, source) {
          for (const [name, existingValue] of Object.entries(source)) {
            const newValue = target[name];
            if (newValue === void 0) {
              target[name] = existingValue;
            } else if (Array.isArray(newValue) && Array.isArray(existingValue)) {
              existingValue.push(...newValue);
              target[name] = existingValue;
            }
          }
          const targetCstNode = target.$cstNode;
          if (targetCstNode) {
            targetCstNode.astNode = void 0;
            target.$cstNode = void 0;
          }
          return target;
        }
        get definitionErrors() {
          return this.wrapper.definitionErrors;
        }
      };
      AbstractParserErrorMessageProvider = class {
        static {
          __name(this, "AbstractParserErrorMessageProvider");
        }
        buildMismatchTokenMessage(options2) {
          return defaultParserErrorProvider.buildMismatchTokenMessage(options2);
        }
        buildNotAllInputParsedMessage(options2) {
          return defaultParserErrorProvider.buildNotAllInputParsedMessage(options2);
        }
        buildNoViableAltMessage(options2) {
          return defaultParserErrorProvider.buildNoViableAltMessage(options2);
        }
        buildEarlyExitMessage(options2) {
          return defaultParserErrorProvider.buildEarlyExitMessage(options2);
        }
      };
      LangiumParserErrorMessageProvider = class extends AbstractParserErrorMessageProvider {
        static {
          __name(this, "LangiumParserErrorMessageProvider");
        }
        buildMismatchTokenMessage({ expected, actual }) {
          const expectedMsg = expected.LABEL ? "`" + expected.LABEL + "`" : expected.name.endsWith(":KW") ? `keyword '${expected.name.substring(0, expected.name.length - 3)}'` : `token of type '${expected.name}'`;
          return `Expecting ${expectedMsg} but found \`${actual.image}\`.`;
        }
        buildNotAllInputParsedMessage({ firstRedundant }) {
          return `Expecting end of file but found \`${firstRedundant.image}\`.`;
        }
      };
      LangiumCompletionParser = class extends AbstractLangiumParser {
        static {
          __name(this, "LangiumCompletionParser");
        }
        constructor() {
          super(...arguments);
          this.tokens = [];
          this.elementStack = [];
          this.lastElementStack = [];
          this.nextTokenIndex = 0;
          this.stackSize = 0;
        }
        action() {
        }
        construct() {
          return void 0;
        }
        parse(input) {
          this.resetState();
          const tokens2 = this.lexer.tokenize(input, { mode: "partial" });
          this.tokens = tokens2.tokens;
          this.wrapper.input = [...this.tokens];
          this.mainRule.call(this.wrapper, {});
          this.unorderedGroups.clear();
          return {
            tokens: this.tokens,
            elementStack: [...this.lastElementStack],
            tokenIndex: this.nextTokenIndex
          };
        }
        rule(rule, impl2) {
          const ruleMethod = this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name), this.startImplementation(impl2).bind(this));
          this.allRules.set(rule.name, ruleMethod);
          if (rule.entry) {
            this.mainRule = ruleMethod;
          }
          return ruleMethod;
        }
        resetState() {
          this.elementStack = [];
          this.lastElementStack = [];
          this.nextTokenIndex = 0;
          this.stackSize = 0;
        }
        startImplementation(implementation) {
          return (args) => {
            const size4 = this.keepStackSize();
            try {
              implementation(args);
            } finally {
              this.resetStackSize(size4);
            }
          };
        }
        removeUnexpectedElements() {
          this.elementStack.splice(this.stackSize);
        }
        keepStackSize() {
          const size4 = this.elementStack.length;
          this.stackSize = size4;
          return size4;
        }
        resetStackSize(size4) {
          this.removeUnexpectedElements();
          this.stackSize = size4;
        }
        consume(idx, tokenType, feature) {
          this.wrapper.wrapConsume(idx, tokenType);
          if (!this.isRecording()) {
            this.lastElementStack = [...this.elementStack, feature];
            this.nextTokenIndex = this.currIdx + 1;
          }
        }
        subrule(idx, rule, fragment, feature, args) {
          this.before(feature);
          this.wrapper.wrapSubrule(idx, rule, args);
          this.after(feature);
        }
        before(element3) {
          if (!this.isRecording()) {
            this.elementStack.push(element3);
          }
        }
        after(element3) {
          if (!this.isRecording()) {
            const index = this.elementStack.lastIndexOf(element3);
            if (index >= 0) {
              this.elementStack.splice(index);
            }
          }
        }
        get currIdx() {
          return this.wrapper.currIdx;
        }
      };
      defaultConfig3 = {
        recoveryEnabled: true,
        nodeLocationTracking: "full",
        skipValidations: true,
        errorMessageProvider: new LangiumParserErrorMessageProvider()
      };
      ChevrotainWrapper = class extends EmbeddedActionsParser {
        static {
          __name(this, "ChevrotainWrapper");
        }
        constructor(tokens2, config5) {
          const useDefaultLookahead = config5 && "maxLookahead" in config5;
          super(tokens2, {
            ...defaultConfig3,
            lookaheadStrategy: useDefaultLookahead ? new LLkLookaheadStrategy({ maxLookahead: config5.maxLookahead }) : new LLStarLookaheadStrategy({
              // If validations are skipped, don't log the lookahead warnings
              logging: config5.skipValidations ? () => {
              } : void 0
            }),
            ...config5
          });
        }
        get IS_RECORDING() {
          return this.RECORDING_PHASE;
        }
        DEFINE_RULE(name, impl2, config5) {
          return this.RULE(name, impl2, config5);
        }
        wrapSelfAnalysis() {
          this.performSelfAnalysis();
        }
        wrapConsume(idx, tokenType) {
          return this.consume(idx, tokenType, void 0);
        }
        wrapSubrule(idx, rule, args) {
          return this.subrule(idx, rule, {
            ARGS: [args]
          });
        }
        wrapOr(idx, choices) {
          this.or(idx, choices);
        }
        wrapOption(idx, callback) {
          this.option(idx, callback);
        }
        wrapMany(idx, callback) {
          this.many(idx, callback);
        }
        wrapAtLeastOne(idx, callback) {
          this.atLeastOne(idx, callback);
        }
        rule(rule) {
          return rule.call(this, {});
        }
      };
      ProfilerWrapper = class extends ChevrotainWrapper {
        static {
          __name(this, "ProfilerWrapper");
        }
        constructor(tokens2, config5, task) {
          super(tokens2, config5);
          this.task = task;
        }
        rule(rule) {
          this.task.start();
          this.task.startSubTask(this.ruleName(rule));
          try {
            return super.rule(rule);
          } finally {
            this.task.stopSubTask(this.ruleName(rule));
            this.task.stop();
          }
        }
        ruleName(rule) {
          return rule.ruleName;
        }
        subrule(idx, ruleToCall, options2) {
          this.task.startSubTask(this.ruleName(ruleToCall));
          try {
            return super.subrule(idx, ruleToCall, options2);
          } finally {
            this.task.stopSubTask(this.ruleName(ruleToCall));
          }
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/parser-builder-base.js
  function createParser(grammar, parser28, tokens2) {
    const parserContext = {
      parser: parser28,
      tokens: tokens2,
      ruleNames: /* @__PURE__ */ new Map()
    };
    buildRules(parserContext, grammar);
    return parser28;
  }
  function buildRules(parserContext, grammar) {
    const reachable = getAllReachableRules(grammar, false);
    const parserRules = stream(grammar.rules).filter(isParserRule).filter((rule) => reachable.has(rule));
    for (const rule of parserRules) {
      const ctx = {
        ...parserContext,
        consume: 1,
        optional: 1,
        subrule: 1,
        many: 1,
        or: 1
      };
      parserContext.parser.rule(rule, buildElement(ctx, rule.definition));
    }
    const infixRules = stream(grammar.rules).filter(isInfixRule).filter((rule) => reachable.has(rule));
    for (const rule of infixRules) {
      parserContext.parser.rule(rule, buildInfixRule(parserContext, rule));
    }
  }
  function buildInfixRule(ctx, rule) {
    const expressionRule = rule.call.rule.ref;
    if (!expressionRule) {
      throw new Error("Could not resolve reference to infix operator rule: " + rule.call.rule.$refText);
    }
    if (isTerminalRule(expressionRule)) {
      throw new Error("Cannot use terminal rule in infix expression");
    }
    const allKeywords = rule.operators.precedences.flatMap((e3) => e3.operators);
    const outerGroup = {
      $type: "Group",
      elements: []
    };
    const part1Assignment = {
      $container: outerGroup,
      $type: "Assignment",
      feature: "parts",
      operator: "+=",
      terminal: rule.call
    };
    const innerGroup = {
      $container: outerGroup,
      $type: "Group",
      elements: [],
      cardinality: "*"
    };
    outerGroup.elements.push(part1Assignment, innerGroup);
    const alternatives = {
      $type: "Alternatives",
      elements: allKeywords
    };
    const operatorAssignment = {
      $container: innerGroup,
      $type: "Assignment",
      feature: "operators",
      operator: "+=",
      terminal: alternatives
    };
    const part2Assignment = {
      ...part1Assignment,
      $container: innerGroup
    };
    innerGroup.elements.push(operatorAssignment, part2Assignment);
    const tokens2 = allKeywords.map((e3) => ctx.tokens[e3.value]);
    const orAlts = tokens2.map((token2, index) => ({
      ALT: /* @__PURE__ */ __name(() => ctx.parser.consume(index, token2, operatorAssignment), "ALT")
    }));
    let subrule;
    return (args) => {
      subrule ?? (subrule = getRule(ctx, expressionRule));
      ctx.parser.subrule(0, subrule, false, part1Assignment, args);
      ctx.parser.many(0, {
        DEF: /* @__PURE__ */ __name(() => {
          ctx.parser.alternatives(0, orAlts);
          ctx.parser.subrule(1, subrule, false, part2Assignment, args);
        }, "DEF")
      });
    };
  }
  function buildElement(ctx, element3, ignoreGuard = false) {
    let method;
    if (isKeyword(element3)) {
      method = buildKeyword(ctx, element3);
    } else if (isAction(element3)) {
      method = buildAction(ctx, element3);
    } else if (isAssignment(element3)) {
      method = buildElement(ctx, element3.terminal);
    } else if (isCrossReference(element3)) {
      method = buildCrossReference(ctx, element3);
    } else if (isRuleCall(element3)) {
      method = buildRuleCall(ctx, element3);
    } else if (isAlternatives(element3)) {
      method = buildAlternatives(ctx, element3);
    } else if (isUnorderedGroup(element3)) {
      method = buildUnorderedGroup(ctx, element3);
    } else if (isGroup(element3)) {
      method = buildGroup4(ctx, element3);
    } else if (isEndOfFile(element3)) {
      const idx = ctx.consume++;
      method = /* @__PURE__ */ __name(() => ctx.parser.consume(idx, EOF, element3), "method");
    } else {
      throw new ErrorWithLocation(element3.$cstNode, `Unexpected element type: ${element3.$type}`);
    }
    return wrap(ctx, ignoreGuard ? void 0 : getGuardCondition(element3), method, element3.cardinality);
  }
  function buildAction(ctx, action) {
    const actionType = getTypeName(action);
    return () => ctx.parser.action(actionType, action);
  }
  function buildRuleCall(ctx, ruleCall) {
    const rule = ruleCall.rule.ref;
    if (isAbstractParserRule(rule)) {
      const idx = ctx.subrule++;
      const fragment = isParserRule(rule) && rule.fragment;
      const predicate = ruleCall.arguments.length > 0 ? buildRuleCallPredicate(rule, ruleCall.arguments) : () => ({});
      let subrule;
      return (args) => {
        subrule ?? (subrule = getRule(ctx, rule));
        ctx.parser.subrule(idx, subrule, fragment, ruleCall, predicate(args));
      };
    } else if (isTerminalRule(rule)) {
      const idx = ctx.consume++;
      const method = getToken(ctx, rule.name);
      return () => ctx.parser.consume(idx, method, ruleCall);
    } else if (!rule) {
      throw new ErrorWithLocation(ruleCall.$cstNode, `Undefined rule: ${ruleCall.rule.$refText}`);
    } else {
      assertUnreachable(rule);
    }
  }
  function buildRuleCallPredicate(rule, namedArgs) {
    const hasNamedArguments = namedArgs.some((arg) => arg.calledByName);
    if (hasNamedArguments) {
      const namedPredicates = namedArgs.map((arg) => ({
        parameterName: arg.parameter?.ref?.name,
        predicate: buildPredicate(arg.value)
      }));
      return (args) => {
        const ruleArgs = {};
        for (const { parameterName, predicate } of namedPredicates) {
          if (parameterName) {
            ruleArgs[parameterName] = predicate(args);
          }
        }
        return ruleArgs;
      };
    } else {
      const predicates = namedArgs.map((arg) => buildPredicate(arg.value));
      return (args) => {
        const ruleArgs = {};
        for (let i2 = 0; i2 < predicates.length; i2++) {
          if (i2 < rule.parameters.length) {
            const parameterName = rule.parameters[i2].name;
            const predicate = predicates[i2];
            ruleArgs[parameterName] = predicate(args);
          }
        }
        return ruleArgs;
      };
    }
  }
  function buildPredicate(condition) {
    if (isDisjunction(condition)) {
      const left3 = buildPredicate(condition.left);
      const right3 = buildPredicate(condition.right);
      return (args) => left3(args) || right3(args);
    } else if (isConjunction(condition)) {
      const left3 = buildPredicate(condition.left);
      const right3 = buildPredicate(condition.right);
      return (args) => left3(args) && right3(args);
    } else if (isNegation(condition)) {
      const value2 = buildPredicate(condition.value);
      return (args) => !value2(args);
    } else if (isParameterReference(condition)) {
      const name = condition.parameter.ref.name;
      return (args) => args !== void 0 && args[name] === true;
    } else if (isBooleanLiteral(condition)) {
      const value2 = Boolean(condition.true);
      return () => value2;
    }
    assertUnreachable(condition);
  }
  function buildAlternatives(ctx, alternatives) {
    if (alternatives.elements.length === 1) {
      return buildElement(ctx, alternatives.elements[0]);
    } else {
      const methods = [];
      for (const element3 of alternatives.elements) {
        const predicatedMethod = {
          // Since we handle the guard condition in the alternative already
          // We can ignore the group guard condition inside
          ALT: buildElement(ctx, element3, true)
        };
        const guard = getGuardCondition(element3);
        if (guard) {
          predicatedMethod.GATE = buildPredicate(guard);
        }
        methods.push(predicatedMethod);
      }
      const idx = ctx.or++;
      return (args) => ctx.parser.alternatives(idx, methods.map((method) => {
        const alt = {
          ALT: /* @__PURE__ */ __name(() => method.ALT(args), "ALT")
        };
        const gate = method.GATE;
        if (gate) {
          alt.GATE = () => gate(args);
        }
        return alt;
      }));
    }
  }
  function buildUnorderedGroup(ctx, group2) {
    if (group2.elements.length === 1) {
      return buildElement(ctx, group2.elements[0]);
    }
    const methods = [];
    for (const element3 of group2.elements) {
      const predicatedMethod = {
        // Since we handle the guard condition in the alternative already
        // We can ignore the group guard condition inside
        ALT: buildElement(ctx, element3, true)
      };
      const guard = getGuardCondition(element3);
      if (guard) {
        predicatedMethod.GATE = buildPredicate(guard);
      }
      methods.push(predicatedMethod);
    }
    const orIdx = ctx.or++;
    const idFunc = /* @__PURE__ */ __name((groupIdx, lParser) => {
      const stackId = lParser.getRuleStack().join("-");
      return `uGroup_${groupIdx}_${stackId}`;
    }, "idFunc");
    const alternatives = /* @__PURE__ */ __name((args) => ctx.parser.alternatives(orIdx, methods.map((method, idx) => {
      const alt = { ALT: /* @__PURE__ */ __name(() => true, "ALT") };
      const parser28 = ctx.parser;
      alt.ALT = () => {
        method.ALT(args);
        if (!parser28.isRecording()) {
          const key = idFunc(orIdx, parser28);
          if (!parser28.unorderedGroups.get(key)) {
            parser28.unorderedGroups.set(key, []);
          }
          const groupState = parser28.unorderedGroups.get(key);
          if (typeof groupState?.[idx] === "undefined") {
            groupState[idx] = true;
          }
        }
      };
      const gate = method.GATE;
      if (gate) {
        alt.GATE = () => gate(args);
      } else {
        alt.GATE = () => {
          const trackedAlternatives = parser28.unorderedGroups.get(idFunc(orIdx, parser28));
          const allow = !trackedAlternatives?.[idx];
          return allow;
        };
      }
      return alt;
    })), "alternatives");
    const wrapped = wrap(ctx, getGuardCondition(group2), alternatives, "*");
    return (args) => {
      wrapped(args);
      if (!ctx.parser.isRecording()) {
        ctx.parser.unorderedGroups.delete(idFunc(orIdx, ctx.parser));
      }
    };
  }
  function buildGroup4(ctx, group2) {
    const methods = group2.elements.map((e3) => buildElement(ctx, e3));
    return (args) => methods.forEach((method) => method(args));
  }
  function getGuardCondition(element3) {
    if (isGroup(element3)) {
      return element3.guardCondition;
    }
    return void 0;
  }
  function buildCrossReference(ctx, crossRef, terminal = crossRef.terminal) {
    if (!terminal) {
      if (!crossRef.type.ref) {
        throw new Error("Could not resolve reference to type: " + crossRef.type.$refText);
      }
      const assignment = findNameAssignment(crossRef.type.ref);
      const assignTerminal = assignment?.terminal;
      if (!assignTerminal) {
        throw new Error("Could not find name assignment for type: " + getTypeName(crossRef.type.ref));
      }
      return buildCrossReference(ctx, crossRef, assignTerminal);
    } else if (isRuleCall(terminal) && isParserRule(terminal.rule.ref)) {
      const rule = terminal.rule.ref;
      const idx = ctx.subrule++;
      let subrule;
      return (args) => {
        subrule ?? (subrule = getRule(ctx, rule));
        ctx.parser.subrule(idx, subrule, false, crossRef, args);
      };
    } else if (isRuleCall(terminal) && isTerminalRule(terminal.rule.ref)) {
      const idx = ctx.consume++;
      const terminalRule = getToken(ctx, terminal.rule.ref.name);
      return () => ctx.parser.consume(idx, terminalRule, crossRef);
    } else if (isKeyword(terminal)) {
      const idx = ctx.consume++;
      const keyword = getToken(ctx, terminal.value);
      return () => ctx.parser.consume(idx, keyword, crossRef);
    } else {
      throw new Error("Could not build cross reference parser");
    }
  }
  function buildKeyword(ctx, keyword) {
    const idx = ctx.consume++;
    const token2 = ctx.tokens[keyword.value];
    if (!token2) {
      throw new Error("Could not find token for keyword: " + keyword.value);
    }
    return () => ctx.parser.consume(idx, token2, keyword);
  }
  function wrap(ctx, guard, method, cardinality) {
    const gate = guard && buildPredicate(guard);
    if (!cardinality) {
      if (gate) {
        const idx = ctx.or++;
        return (args) => ctx.parser.alternatives(idx, [
          {
            ALT: /* @__PURE__ */ __name(() => method(args), "ALT"),
            GATE: /* @__PURE__ */ __name(() => gate(args), "GATE")
          },
          {
            ALT: EMPTY_ALT(),
            GATE: /* @__PURE__ */ __name(() => !gate(args), "GATE")
          }
        ]);
      } else {
        return method;
      }
    }
    if (cardinality === "*") {
      const idx = ctx.many++;
      return (args) => ctx.parser.many(idx, {
        DEF: /* @__PURE__ */ __name(() => method(args), "DEF"),
        GATE: gate ? () => gate(args) : void 0
      });
    } else if (cardinality === "+") {
      const idx = ctx.many++;
      if (gate) {
        const orIdx = ctx.or++;
        return (args) => ctx.parser.alternatives(orIdx, [
          {
            ALT: /* @__PURE__ */ __name(() => ctx.parser.atLeastOne(idx, {
              DEF: /* @__PURE__ */ __name(() => method(args), "DEF")
            }), "ALT"),
            GATE: /* @__PURE__ */ __name(() => gate(args), "GATE")
          },
          {
            ALT: EMPTY_ALT(),
            GATE: /* @__PURE__ */ __name(() => !gate(args), "GATE")
          }
        ]);
      } else {
        return (args) => ctx.parser.atLeastOne(idx, {
          DEF: /* @__PURE__ */ __name(() => method(args), "DEF")
        });
      }
    } else if (cardinality === "?") {
      const idx = ctx.optional++;
      return (args) => ctx.parser.optional(idx, {
        DEF: /* @__PURE__ */ __name(() => method(args), "DEF"),
        GATE: gate ? () => gate(args) : void 0
      });
    } else {
      assertUnreachable(cardinality);
    }
  }
  function getRule(ctx, element3) {
    const name = getRuleName(ctx, element3);
    const rule = ctx.parser.getRule(name);
    if (!rule)
      throw new Error(`Rule "${name}" not found."`);
    return rule;
  }
  function getRuleName(ctx, element3) {
    if (isAbstractParserRule(element3)) {
      return element3.name;
    } else if (ctx.ruleNames.has(element3)) {
      return ctx.ruleNames.get(element3);
    } else {
      let item = element3;
      let parent4 = item.$container;
      let ruleName = element3.$type;
      while (!isParserRule(parent4)) {
        if (isGroup(parent4) || isAlternatives(parent4) || isUnorderedGroup(parent4)) {
          const index = parent4.elements.indexOf(item);
          ruleName = index.toString() + ":" + ruleName;
        }
        item = parent4;
        parent4 = parent4.$container;
      }
      const rule = parent4;
      ruleName = rule.name + ":" + ruleName;
      ctx.ruleNames.set(element3, ruleName);
      return ruleName;
    }
  }
  function getToken(ctx, name) {
    const token2 = ctx.tokens[name];
    if (!token2)
      throw new Error(`Token "${name}" not found."`);
    return token2;
  }
  var init_parser_builder_base = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/parser-builder-base.js"() {
      "use strict";
      init_api5();
      init_ast();
      init_errors2();
      init_stream();
      init_grammar_utils();
      __name(createParser, "createParser");
      __name(buildRules, "buildRules");
      __name(buildInfixRule, "buildInfixRule");
      __name(buildElement, "buildElement");
      __name(buildAction, "buildAction");
      __name(buildRuleCall, "buildRuleCall");
      __name(buildRuleCallPredicate, "buildRuleCallPredicate");
      __name(buildPredicate, "buildPredicate");
      __name(buildAlternatives, "buildAlternatives");
      __name(buildUnorderedGroup, "buildUnorderedGroup");
      __name(buildGroup4, "buildGroup");
      __name(getGuardCondition, "getGuardCondition");
      __name(buildCrossReference, "buildCrossReference");
      __name(buildKeyword, "buildKeyword");
      __name(wrap, "wrap");
      __name(getRule, "getRule");
      __name(getRuleName, "getRuleName");
      __name(getToken, "getToken");
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/completion-parser-builder.js
  function createCompletionParser(services) {
    const grammar = services.Grammar;
    const lexer = services.parser.Lexer;
    const parser28 = new LangiumCompletionParser(services);
    createParser(grammar, parser28, lexer.definition);
    parser28.finalize();
    return parser28;
  }
  var init_completion_parser_builder = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/completion-parser-builder.js"() {
      "use strict";
      init_langium_parser();
      init_parser_builder_base();
      __name(createCompletionParser, "createCompletionParser");
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/langium-parser-builder.js
  function createLangiumParser(services) {
    const parser28 = prepareLangiumParser(services);
    parser28.finalize();
    return parser28;
  }
  function prepareLangiumParser(services) {
    const grammar = services.Grammar;
    const lexer = services.parser.Lexer;
    const parser28 = new LangiumParser(services);
    return createParser(grammar, parser28, lexer.definition);
  }
  var init_langium_parser_builder = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/langium-parser-builder.js"() {
      "use strict";
      init_langium_parser();
      init_parser_builder_base();
      __name(createLangiumParser, "createLangiumParser");
      __name(prepareLangiumParser, "prepareLangiumParser");
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/token-builder.js
  var DefaultTokenBuilder;
  var init_token_builder = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/token-builder.js"() {
      "use strict";
      init_api5();
      init_ast();
      init_ast_utils();
      init_grammar_utils();
      init_regexp_utils();
      init_stream();
      DefaultTokenBuilder = class {
        static {
          __name(this, "DefaultTokenBuilder");
        }
        constructor() {
          this.diagnostics = [];
        }
        buildTokens(grammar, options2) {
          const reachableRules = stream(getAllReachableRules(grammar, false));
          const terminalTokens = this.buildTerminalTokens(reachableRules);
          const tokens2 = this.buildKeywordTokens(reachableRules, terminalTokens, options2);
          tokens2.push(...terminalTokens);
          return tokens2;
        }
        // eslint-disable-next-line @typescript-eslint/no-unused-vars
        flushLexingReport(text4) {
          return { diagnostics: this.popDiagnostics() };
        }
        popDiagnostics() {
          const diagnostics = [...this.diagnostics];
          this.diagnostics = [];
          return diagnostics;
        }
        buildTerminalTokens(rules) {
          return rules.filter(isTerminalRule).filter((e3) => !e3.fragment).map((terminal) => this.buildTerminalToken(terminal)).toArray();
        }
        buildTerminalToken(terminal) {
          const regex2 = terminalRegex(terminal);
          const pattern = this.requiresCustomPattern(regex2) ? this.regexPatternFunction(regex2) : regex2;
          const tokenType = {
            name: terminal.name,
            PATTERN: pattern
          };
          if (typeof pattern === "function") {
            tokenType.LINE_BREAKS = true;
          }
          if (terminal.hidden) {
            tokenType.GROUP = isWhitespace2(regex2) ? Lexer2.SKIPPED : "hidden";
          }
          return tokenType;
        }
        requiresCustomPattern(regex2) {
          if (regex2.flags.includes("u") || regex2.flags.includes("s")) {
            return true;
          } else {
            return false;
          }
        }
        regexPatternFunction(regex2) {
          const stickyRegex = new RegExp(regex2, regex2.flags + "y");
          return (text4, offset) => {
            stickyRegex.lastIndex = offset;
            const execResult = stickyRegex.exec(text4);
            return execResult;
          };
        }
        buildKeywordTokens(rules, terminalTokens, options2) {
          return rules.filter(isAbstractParserRule).flatMap((rule) => streamAllContents(rule).filter(isKeyword)).distinct((e3) => e3.value).toArray().sort((a2, b3) => b3.value.length - a2.value.length).map((keyword) => this.buildKeywordToken(keyword, terminalTokens, Boolean(options2?.caseInsensitive)));
        }
        buildKeywordToken(keyword, terminalTokens, caseInsensitive) {
          const keywordPattern = this.buildKeywordPattern(keyword, caseInsensitive);
          const tokenType = {
            name: keyword.value,
            PATTERN: keywordPattern,
            LONGER_ALT: this.findLongerAlt(keyword, terminalTokens)
          };
          if (typeof keywordPattern === "function") {
            tokenType.LINE_BREAKS = true;
          }
          return tokenType;
        }
        buildKeywordPattern(keyword, caseInsensitive) {
          return caseInsensitive ? new RegExp(escapeRegExp(keyword.value), "i") : keyword.value;
        }
        findLongerAlt(keyword, terminalTokens) {
          return terminalTokens.reduce((longerAlts, token2) => {
            const pattern = token2?.PATTERN;
            if (pattern?.source && partialMatches("^" + pattern.source + "$", keyword.value)) {
              longerAlts.push(token2);
            }
            return longerAlts;
          }, []);
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/value-converter.js
  var DefaultValueConverter, ValueConverter;
  var init_value_converter = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/value-converter.js"() {
      "use strict";
      init_ast();
      init_grammar_utils();
      DefaultValueConverter = class {
        static {
          __name(this, "DefaultValueConverter");
        }
        convert(input, cstNode) {
          let feature = cstNode.grammarSource;
          if (isCrossReference(feature)) {
            feature = getCrossReferenceTerminal(feature);
          }
          if (isRuleCall(feature)) {
            const rule = feature.rule.ref;
            if (!rule) {
              throw new Error("This cst node was not parsed by a rule.");
            }
            return this.runConverter(rule, input, cstNode);
          }
          return input;
        }
        // eslint-disable-next-line @typescript-eslint/no-unused-vars
        runConverter(rule, input, cstNode) {
          switch (rule.name.toUpperCase()) {
            case "INT":
              return ValueConverter.convertInt(input);
            case "STRING":
              return ValueConverter.convertString(input);
            case "ID":
              return ValueConverter.convertID(input);
          }
          switch (getRuleType(rule)?.toLowerCase()) {
            case "number":
              return ValueConverter.convertNumber(input);
            case "boolean":
              return ValueConverter.convertBoolean(input);
            case "bigint":
              return ValueConverter.convertBigint(input);
            case "date":
              return ValueConverter.convertDate(input);
            default:
              return input;
          }
        }
      };
      (function(ValueConverter2) {
        function convertString(input) {
          let result = "";
          for (let i2 = 1; i2 < input.length - 1; i2++) {
            const c3 = input.charAt(i2);
            if (c3 === "\\") {
              const c1 = input.charAt(++i2);
              result += convertEscapeCharacter(c1);
            } else {
              result += c3;
            }
          }
          return result;
        }
        __name(convertString, "convertString");
        ValueConverter2.convertString = convertString;
        function convertEscapeCharacter(char2) {
          switch (char2) {
            case "b":
              return "\b";
            case "f":
              return "\f";
            case "n":
              return "\n";
            case "r":
              return "\r";
            case "t":
              return "	";
            case "v":
              return "\v";
            case "0":
              return "\0";
            default:
              return char2;
          }
        }
        __name(convertEscapeCharacter, "convertEscapeCharacter");
        function convertID(input) {
          if (input.charAt(0) === "^") {
            return input.substring(1);
          } else {
            return input;
          }
        }
        __name(convertID, "convertID");
        ValueConverter2.convertID = convertID;
        function convertInt(input) {
          return parseInt(input);
        }
        __name(convertInt, "convertInt");
        ValueConverter2.convertInt = convertInt;
        function convertBigint(input) {
          return BigInt(input);
        }
        __name(convertBigint, "convertBigint");
        ValueConverter2.convertBigint = convertBigint;
        function convertDate(input) {
          return new Date(input);
        }
        __name(convertDate, "convertDate");
        ValueConverter2.convertDate = convertDate;
        function convertNumber(input) {
          return Number(input);
        }
        __name(convertNumber, "convertNumber");
        ValueConverter2.convertNumber = convertNumber;
        function convertBoolean(input) {
          return input.toLowerCase() === "true";
        }
        __name(convertBoolean, "convertBoolean");
        ValueConverter2.convertBoolean = convertBoolean;
      })(ValueConverter || (ValueConverter = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/ral.js
  var require_ral = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/ral.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      var _ral;
      function RAL() {
        if (_ral === void 0) {
          throw new Error(`No runtime abstraction layer installed`);
        }
        return _ral;
      }
      __name(RAL, "RAL");
      (function(RAL2) {
        function install(ral) {
          if (ral === void 0) {
            throw new Error(`No runtime abstraction layer provided`);
          }
          _ral = ral;
        }
        __name(install, "install");
        RAL2.install = install;
      })(RAL || (RAL = {}));
      exports2.default = RAL;
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/is.js
  var require_is = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/is.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0;
      function boolean(value2) {
        return value2 === true || value2 === false;
      }
      __name(boolean, "boolean");
      exports2.boolean = boolean;
      function string3(value2) {
        return typeof value2 === "string" || value2 instanceof String;
      }
      __name(string3, "string");
      exports2.string = string3;
      function number7(value2) {
        return typeof value2 === "number" || value2 instanceof Number;
      }
      __name(number7, "number");
      exports2.number = number7;
      function error3(value2) {
        return value2 instanceof Error;
      }
      __name(error3, "error");
      exports2.error = error3;
      function func(value2) {
        return typeof value2 === "function";
      }
      __name(func, "func");
      exports2.func = func;
      function array4(value2) {
        return Array.isArray(value2);
      }
      __name(array4, "array");
      exports2.array = array4;
      function stringArray(value2) {
        return array4(value2) && value2.every((elem) => string3(elem));
      }
      __name(stringArray, "stringArray");
      exports2.stringArray = stringArray;
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/events.js
  var require_events = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/events.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.Emitter = exports2.Event = void 0;
      var ral_1 = require_ral();
      var Event3;
      (function(Event4) {
        const _disposable = { dispose() {
        } };
        Event4.None = function() {
          return _disposable;
        };
      })(Event3 || (exports2.Event = Event3 = {}));
      var CallbackList = class {
        static {
          __name(this, "CallbackList");
        }
        add(callback, context = null, bucket) {
          if (!this._callbacks) {
            this._callbacks = [];
            this._contexts = [];
          }
          this._callbacks.push(callback);
          this._contexts.push(context);
          if (Array.isArray(bucket)) {
            bucket.push({ dispose: /* @__PURE__ */ __name(() => this.remove(callback, context), "dispose") });
          }
        }
        remove(callback, context = null) {
          if (!this._callbacks) {
            return;
          }
          let foundCallbackWithDifferentContext = false;
          for (let i2 = 0, len = this._callbacks.length; i2 < len; i2++) {
            if (this._callbacks[i2] === callback) {
              if (this._contexts[i2] === context) {
                this._callbacks.splice(i2, 1);
                this._contexts.splice(i2, 1);
                return;
              } else {
                foundCallbackWithDifferentContext = true;
              }
            }
          }
          if (foundCallbackWithDifferentContext) {
            throw new Error("When adding a listener with a context, you should remove it with the same context");
          }
        }
        invoke(...args) {
          if (!this._callbacks) {
            return [];
          }
          const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
          for (let i2 = 0, len = callbacks.length; i2 < len; i2++) {
            try {
              ret.push(callbacks[i2].apply(contexts[i2], args));
            } catch (e3) {
              (0, ral_1.default)().console.error(e3);
            }
          }
          return ret;
        }
        isEmpty() {
          return !this._callbacks || this._callbacks.length === 0;
        }
        dispose() {
          this._callbacks = void 0;
          this._contexts = void 0;
        }
      };
      var Emitter4 = class _Emitter {
        static {
          __name(this, "Emitter");
        }
        constructor(_options) {
          this._options = _options;
        }
        /**
         * For the public to allow to subscribe
         * to events from this Emitter
         */
        get event() {
          if (!this._event) {
            this._event = (listener, thisArgs, disposables) => {
              if (!this._callbacks) {
                this._callbacks = new CallbackList();
              }
              if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
                this._options.onFirstListenerAdd(this);
              }
              this._callbacks.add(listener, thisArgs);
              const result = {
                dispose: /* @__PURE__ */ __name(() => {
                  if (!this._callbacks) {
                    return;
                  }
                  this._callbacks.remove(listener, thisArgs);
                  result.dispose = _Emitter._noop;
                  if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
                    this._options.onLastListenerRemove(this);
                  }
                }, "dispose")
              };
              if (Array.isArray(disposables)) {
                disposables.push(result);
              }
              return result;
            };
          }
          return this._event;
        }
        /**
         * To be kept private to fire an event to
         * subscribers
         */
        fire(event3) {
          if (this._callbacks) {
            this._callbacks.invoke.call(this._callbacks, event3);
          }
        }
        dispose() {
          if (this._callbacks) {
            this._callbacks.dispose();
            this._callbacks = void 0;
          }
        }
      };
      exports2.Emitter = Emitter4;
      Emitter4._noop = function() {
      };
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/cancellation.js
  var require_cancellation = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/cancellation.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.CancellationTokenSource = exports2.CancellationToken = void 0;
      var ral_1 = require_ral();
      var Is2 = require_is();
      var events_1 = require_events();
      var CancellationToken11;
      (function(CancellationToken12) {
        CancellationToken12.None = Object.freeze({
          isCancellationRequested: false,
          onCancellationRequested: events_1.Event.None
        });
        CancellationToken12.Cancelled = Object.freeze({
          isCancellationRequested: true,
          onCancellationRequested: events_1.Event.None
        });
        function is2(value2) {
          const candidate = value2;
          return candidate && (candidate === CancellationToken12.None || candidate === CancellationToken12.Cancelled || Is2.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested);
        }
        __name(is2, "is");
        CancellationToken12.is = is2;
      })(CancellationToken11 || (exports2.CancellationToken = CancellationToken11 = {}));
      var shortcutEvent = Object.freeze(function(callback, context) {
        const handle = (0, ral_1.default)().timer.setTimeout(callback.bind(context), 0);
        return { dispose() {
          handle.dispose();
        } };
      });
      var MutableToken = class {
        static {
          __name(this, "MutableToken");
        }
        constructor() {
          this._isCancelled = false;
        }
        cancel() {
          if (!this._isCancelled) {
            this._isCancelled = true;
            if (this._emitter) {
              this._emitter.fire(void 0);
              this.dispose();
            }
          }
        }
        get isCancellationRequested() {
          return this._isCancelled;
        }
        get onCancellationRequested() {
          if (this._isCancelled) {
            return shortcutEvent;
          }
          if (!this._emitter) {
            this._emitter = new events_1.Emitter();
          }
          return this._emitter.event;
        }
        dispose() {
          if (this._emitter) {
            this._emitter.dispose();
            this._emitter = void 0;
          }
        }
      };
      var CancellationTokenSource3 = class {
        static {
          __name(this, "CancellationTokenSource");
        }
        get token() {
          if (!this._token) {
            this._token = new MutableToken();
          }
          return this._token;
        }
        cancel() {
          if (!this._token) {
            this._token = CancellationToken11.Cancelled;
          } else {
            this._token.cancel();
          }
        }
        dispose() {
          if (!this._token) {
            this._token = CancellationToken11.None;
          } else if (this._token instanceof MutableToken) {
            this._token.dispose();
          }
        }
      };
      exports2.CancellationTokenSource = CancellationTokenSource3;
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/cancellation.js
  var cancellation_exports = {};
  var init_cancellation = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/cancellation.js"() {
      "use strict";
      __reExport(cancellation_exports, __toESM(require_cancellation(), 1));
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/promise-utils.js
  function delayNextTick() {
    return new Promise((resolve2) => {
      if (typeof setImmediate === "undefined") {
        setTimeout(resolve2, 0);
      } else {
        setImmediate(resolve2);
      }
    });
  }
  function startCancelableOperation() {
    lastTick = performance.now();
    return new cancellation_exports.CancellationTokenSource();
  }
  function setInterruptionPeriod(period) {
    globalInterruptionPeriod = period;
  }
  function isOperationCancelled(err) {
    return err === OperationCancelled;
  }
  async function interruptAndCheck(token2) {
    if (token2 === cancellation_exports.CancellationToken.None) {
      return;
    }
    const current = performance.now();
    if (current - lastTick >= globalInterruptionPeriod) {
      lastTick = current;
      await delayNextTick();
      lastTick = performance.now();
    }
    if (token2.isCancellationRequested) {
      throw OperationCancelled;
    }
  }
  var lastTick, globalInterruptionPeriod, OperationCancelled, Deferred;
  var init_promise_utils = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/promise-utils.js"() {
      "use strict";
      init_cancellation();
      __name(delayNextTick, "delayNextTick");
      lastTick = 0;
      globalInterruptionPeriod = 10;
      __name(startCancelableOperation, "startCancelableOperation");
      __name(setInterruptionPeriod, "setInterruptionPeriod");
      OperationCancelled = Symbol("OperationCancelled");
      __name(isOperationCancelled, "isOperationCancelled");
      __name(interruptAndCheck, "interruptAndCheck");
      Deferred = class {
        static {
          __name(this, "Deferred");
        }
        constructor() {
          this.promise = new Promise((resolve2, reject3) => {
            this.resolve = (arg) => {
              resolve2(arg);
              return this;
            };
            this.reject = (err) => {
              reject3(err);
              return this;
            };
          });
        }
      };
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-textdocument@1.0.12/node_modules/vscode-languageserver-textdocument/lib/esm/main.js
  function mergeSort(data5, compare) {
    if (data5.length <= 1) {
      return data5;
    }
    const p3 = data5.length / 2 | 0;
    const left3 = data5.slice(0, p3);
    const right3 = data5.slice(p3);
    mergeSort(left3, compare);
    mergeSort(right3, compare);
    let leftIdx = 0;
    let rightIdx = 0;
    let i2 = 0;
    while (leftIdx < left3.length && rightIdx < right3.length) {
      const ret = compare(left3[leftIdx], right3[rightIdx]);
      if (ret <= 0) {
        data5[i2++] = left3[leftIdx++];
      } else {
        data5[i2++] = right3[rightIdx++];
      }
    }
    while (leftIdx < left3.length) {
      data5[i2++] = left3[leftIdx++];
    }
    while (rightIdx < right3.length) {
      data5[i2++] = right3[rightIdx++];
    }
    return data5;
  }
  function computeLineOffsets(text4, isAtLineStart, textOffset = 0) {
    const result = isAtLineStart ? [textOffset] : [];
    for (let i2 = 0; i2 < text4.length; i2++) {
      const ch = text4.charCodeAt(i2);
      if (isEOL(ch)) {
        if (ch === 13 && i2 + 1 < text4.length && text4.charCodeAt(i2 + 1) === 10) {
          i2++;
        }
        result.push(textOffset + i2 + 1);
      }
    }
    return result;
  }
  function isEOL(char2) {
    return char2 === 13 || char2 === 10;
  }
  function getWellformedRange(range3) {
    const start3 = range3.start;
    const end2 = range3.end;
    if (start3.line > end2.line || start3.line === end2.line && start3.character > end2.character) {
      return { start: end2, end: start3 };
    }
    return range3;
  }
  function getWellformedEdit(textEdit) {
    const range3 = getWellformedRange(textEdit.range);
    if (range3 !== textEdit.range) {
      return { newText: textEdit.newText, range: range3 };
    }
    return textEdit;
  }
  var FullTextDocument2, TextDocument2;
  var init_main2 = __esm({
    "../../node_modules/.pnpm/vscode-languageserver-textdocument@1.0.12/node_modules/vscode-languageserver-textdocument/lib/esm/main.js"() {
      "use strict";
      FullTextDocument2 = class _FullTextDocument {
        static {
          __name(this, "FullTextDocument");
        }
        constructor(uri, languageId, version3, content) {
          this._uri = uri;
          this._languageId = languageId;
          this._version = version3;
          this._content = content;
          this._lineOffsets = void 0;
        }
        get uri() {
          return this._uri;
        }
        get languageId() {
          return this._languageId;
        }
        get version() {
          return this._version;
        }
        getText(range3) {
          if (range3) {
            const start3 = this.offsetAt(range3.start);
            const end2 = this.offsetAt(range3.end);
            return this._content.substring(start3, end2);
          }
          return this._content;
        }
        update(changes, version3) {
          for (const change2 of changes) {
            if (_FullTextDocument.isIncremental(change2)) {
              const range3 = getWellformedRange(change2.range);
              const startOffset = this.offsetAt(range3.start);
              const endOffset = this.offsetAt(range3.end);
              this._content = this._content.substring(0, startOffset) + change2.text + this._content.substring(endOffset, this._content.length);
              const startLine = Math.max(range3.start.line, 0);
              const endLine = Math.max(range3.end.line, 0);
              let lineOffsets = this._lineOffsets;
              const addedLineOffsets = computeLineOffsets(change2.text, false, startOffset);
              if (endLine - startLine === addedLineOffsets.length) {
                for (let i2 = 0, len = addedLineOffsets.length; i2 < len; i2++) {
                  lineOffsets[i2 + startLine + 1] = addedLineOffsets[i2];
                }
              } else {
                if (addedLineOffsets.length < 1e4) {
                  lineOffsets.splice(startLine + 1, endLine - startLine, ...addedLineOffsets);
                } else {
                  this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1));
                }
              }
              const diff2 = change2.text.length - (endOffset - startOffset);
              if (diff2 !== 0) {
                for (let i2 = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i2 < len; i2++) {
                  lineOffsets[i2] = lineOffsets[i2] + diff2;
                }
              }
            } else if (_FullTextDocument.isFull(change2)) {
              this._content = change2.text;
              this._lineOffsets = void 0;
            } else {
              throw new Error("Unknown change event received");
            }
          }
          this._version = version3;
        }
        getLineOffsets() {
          if (this._lineOffsets === void 0) {
            this._lineOffsets = computeLineOffsets(this._content, true);
          }
          return this._lineOffsets;
        }
        positionAt(offset) {
          offset = Math.max(Math.min(offset, this._content.length), 0);
          const lineOffsets = this.getLineOffsets();
          let low = 0, high = lineOffsets.length;
          if (high === 0) {
            return { line: 0, character: offset };
          }
          while (low < high) {
            const mid = Math.floor((low + high) / 2);
            if (lineOffsets[mid] > offset) {
              high = mid;
            } else {
              low = mid + 1;
            }
          }
          const line2 = low - 1;
          offset = this.ensureBeforeEOL(offset, lineOffsets[line2]);
          return { line: line2, character: offset - lineOffsets[line2] };
        }
        offsetAt(position5) {
          const lineOffsets = this.getLineOffsets();
          if (position5.line >= lineOffsets.length) {
            return this._content.length;
          } else if (position5.line < 0) {
            return 0;
          }
          const lineOffset = lineOffsets[position5.line];
          if (position5.character <= 0) {
            return lineOffset;
          }
          const nextLineOffset = position5.line + 1 < lineOffsets.length ? lineOffsets[position5.line + 1] : this._content.length;
          const offset = Math.min(lineOffset + position5.character, nextLineOffset);
          return this.ensureBeforeEOL(offset, lineOffset);
        }
        ensureBeforeEOL(offset, lineOffset) {
          while (offset > lineOffset && isEOL(this._content.charCodeAt(offset - 1))) {
            offset--;
          }
          return offset;
        }
        get lineCount() {
          return this.getLineOffsets().length;
        }
        static isIncremental(event3) {
          const candidate = event3;
          return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number");
        }
        static isFull(event3) {
          const candidate = event3;
          return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0;
        }
      };
      (function(TextDocument3) {
        function create4(uri, languageId, version3, content) {
          return new FullTextDocument2(uri, languageId, version3, content);
        }
        __name(create4, "create");
        TextDocument3.create = create4;
        function update2(document2, changes, version3) {
          if (document2 instanceof FullTextDocument2) {
            document2.update(changes, version3);
            return document2;
          } else {
            throw new Error("TextDocument.update: document must be created by TextDocument.create");
          }
        }
        __name(update2, "update");
        TextDocument3.update = update2;
        function applyEdits(document2, edits) {
          const text4 = document2.getText();
          const sortedEdits = mergeSort(edits.map(getWellformedEdit), (a2, b3) => {
            const diff2 = a2.range.start.line - b3.range.start.line;
            if (diff2 === 0) {
              return a2.range.start.character - b3.range.start.character;
            }
            return diff2;
          });
          let lastModifiedOffset = 0;
          const spans = [];
          for (const e3 of sortedEdits) {
            const startOffset = document2.offsetAt(e3.range.start);
            if (startOffset < lastModifiedOffset) {
              throw new Error("Overlapping edit");
            } else if (startOffset > lastModifiedOffset) {
              spans.push(text4.substring(lastModifiedOffset, startOffset));
            }
            if (e3.newText.length) {
              spans.push(e3.newText);
            }
            lastModifiedOffset = document2.offsetAt(e3.range.end);
          }
          spans.push(text4.substr(lastModifiedOffset));
          return spans.join("");
        }
        __name(applyEdits, "applyEdits");
        TextDocument3.applyEdits = applyEdits;
      })(TextDocument2 || (TextDocument2 = {}));
      __name(mergeSort, "mergeSort");
      __name(computeLineOffsets, "computeLineOffsets");
      __name(isEOL, "isEOL");
      __name(getWellformedRange, "getWellformedRange");
      __name(getWellformedEdit, "getWellformedEdit");
    }
  });

  // ../../node_modules/.pnpm/vscode-uri@3.1.0/node_modules/vscode-uri/lib/esm/index.mjs
  var LIB, URI2, Utils2;
  var init_esm2 = __esm({
    "../../node_modules/.pnpm/vscode-uri@3.1.0/node_modules/vscode-uri/lib/esm/index.mjs"() {
      "use strict";
      (() => {
        "use strict";
        var t4 = { 975: (t5) => {
          function e4(t6) {
            if ("string" != typeof t6) throw new TypeError("Path must be a string. Received " + JSON.stringify(t6));
          }
          __name(e4, "e");
          function r3(t6, e6) {
            for (var r4, n4 = "", i3 = 0, o3 = -1, s3 = 0, h4 = 0; h4 <= t6.length; ++h4) {
              if (h4 < t6.length) r4 = t6.charCodeAt(h4);
              else {
                if (47 === r4) break;
                r4 = 47;
              }
              if (47 === r4) {
                if (o3 === h4 - 1 || 1 === s3) ;
                else if (o3 !== h4 - 1 && 2 === s3) {
                  if (n4.length < 2 || 2 !== i3 || 46 !== n4.charCodeAt(n4.length - 1) || 46 !== n4.charCodeAt(n4.length - 2)) {
                    if (n4.length > 2) {
                      var a3 = n4.lastIndexOf("/");
                      if (a3 !== n4.length - 1) {
                        -1 === a3 ? (n4 = "", i3 = 0) : i3 = (n4 = n4.slice(0, a3)).length - 1 - n4.lastIndexOf("/"), o3 = h4, s3 = 0;
                        continue;
                      }
                    } else if (2 === n4.length || 1 === n4.length) {
                      n4 = "", i3 = 0, o3 = h4, s3 = 0;
                      continue;
                    }
                  }
                  e6 && (n4.length > 0 ? n4 += "/.." : n4 = "..", i3 = 2);
                } else n4.length > 0 ? n4 += "/" + t6.slice(o3 + 1, h4) : n4 = t6.slice(o3 + 1, h4), i3 = h4 - o3 - 1;
                o3 = h4, s3 = 0;
              } else 46 === r4 && -1 !== s3 ? ++s3 : s3 = -1;
            }
            return n4;
          }
          __name(r3, "r");
          var n3 = { resolve: /* @__PURE__ */ __name(function() {
            for (var t6, n4 = "", i3 = false, o3 = arguments.length - 1; o3 >= -1 && !i3; o3--) {
              var s3;
              o3 >= 0 ? s3 = arguments[o3] : (void 0 === t6 && (t6 = process.cwd()), s3 = t6), e4(s3), 0 !== s3.length && (n4 = s3 + "/" + n4, i3 = 47 === s3.charCodeAt(0));
            }
            return n4 = r3(n4, !i3), i3 ? n4.length > 0 ? "/" + n4 : "/" : n4.length > 0 ? n4 : ".";
          }, "resolve"), normalize: /* @__PURE__ */ __name(function(t6) {
            if (e4(t6), 0 === t6.length) return ".";
            var n4 = 47 === t6.charCodeAt(0), i3 = 47 === t6.charCodeAt(t6.length - 1);
            return 0 !== (t6 = r3(t6, !n4)).length || n4 || (t6 = "."), t6.length > 0 && i3 && (t6 += "/"), n4 ? "/" + t6 : t6;
          }, "normalize"), isAbsolute: /* @__PURE__ */ __name(function(t6) {
            return e4(t6), t6.length > 0 && 47 === t6.charCodeAt(0);
          }, "isAbsolute"), join: /* @__PURE__ */ __name(function() {
            if (0 === arguments.length) return ".";
            for (var t6, r4 = 0; r4 < arguments.length; ++r4) {
              var i3 = arguments[r4];
              e4(i3), i3.length > 0 && (void 0 === t6 ? t6 = i3 : t6 += "/" + i3);
            }
            return void 0 === t6 ? "." : n3.normalize(t6);
          }, "join"), relative: /* @__PURE__ */ __name(function(t6, r4) {
            if (e4(t6), e4(r4), t6 === r4) return "";
            if ((t6 = n3.resolve(t6)) === (r4 = n3.resolve(r4))) return "";
            for (var i3 = 1; i3 < t6.length && 47 === t6.charCodeAt(i3); ++i3) ;
            for (var o3 = t6.length, s3 = o3 - i3, h4 = 1; h4 < r4.length && 47 === r4.charCodeAt(h4); ++h4) ;
            for (var a3 = r4.length - h4, c4 = s3 < a3 ? s3 : a3, f3 = -1, u3 = 0; u3 <= c4; ++u3) {
              if (u3 === c4) {
                if (a3 > c4) {
                  if (47 === r4.charCodeAt(h4 + u3)) return r4.slice(h4 + u3 + 1);
                  if (0 === u3) return r4.slice(h4 + u3);
                } else s3 > c4 && (47 === t6.charCodeAt(i3 + u3) ? f3 = u3 : 0 === u3 && (f3 = 0));
                break;
              }
              var l5 = t6.charCodeAt(i3 + u3);
              if (l5 !== r4.charCodeAt(h4 + u3)) break;
              47 === l5 && (f3 = u3);
            }
            var g3 = "";
            for (u3 = i3 + f3 + 1; u3 <= o3; ++u3) u3 !== o3 && 47 !== t6.charCodeAt(u3) || (0 === g3.length ? g3 += ".." : g3 += "/..");
            return g3.length > 0 ? g3 + r4.slice(h4 + f3) : (h4 += f3, 47 === r4.charCodeAt(h4) && ++h4, r4.slice(h4));
          }, "relative"), _makeLong: /* @__PURE__ */ __name(function(t6) {
            return t6;
          }, "_makeLong"), dirname: /* @__PURE__ */ __name(function(t6) {
            if (e4(t6), 0 === t6.length) return ".";
            for (var r4 = t6.charCodeAt(0), n4 = 47 === r4, i3 = -1, o3 = true, s3 = t6.length - 1; s3 >= 1; --s3) if (47 === (r4 = t6.charCodeAt(s3))) {
              if (!o3) {
                i3 = s3;
                break;
              }
            } else o3 = false;
            return -1 === i3 ? n4 ? "/" : "." : n4 && 1 === i3 ? "//" : t6.slice(0, i3);
          }, "dirname"), basename: /* @__PURE__ */ __name(function(t6, r4) {
            if (void 0 !== r4 && "string" != typeof r4) throw new TypeError('"ext" argument must be a string');
            e4(t6);
            var n4, i3 = 0, o3 = -1, s3 = true;
            if (void 0 !== r4 && r4.length > 0 && r4.length <= t6.length) {
              if (r4.length === t6.length && r4 === t6) return "";
              var h4 = r4.length - 1, a3 = -1;
              for (n4 = t6.length - 1; n4 >= 0; --n4) {
                var c4 = t6.charCodeAt(n4);
                if (47 === c4) {
                  if (!s3) {
                    i3 = n4 + 1;
                    break;
                  }
                } else -1 === a3 && (s3 = false, a3 = n4 + 1), h4 >= 0 && (c4 === r4.charCodeAt(h4) ? -1 == --h4 && (o3 = n4) : (h4 = -1, o3 = a3));
              }
              return i3 === o3 ? o3 = a3 : -1 === o3 && (o3 = t6.length), t6.slice(i3, o3);
            }
            for (n4 = t6.length - 1; n4 >= 0; --n4) if (47 === t6.charCodeAt(n4)) {
              if (!s3) {
                i3 = n4 + 1;
                break;
              }
            } else -1 === o3 && (s3 = false, o3 = n4 + 1);
            return -1 === o3 ? "" : t6.slice(i3, o3);
          }, "basename"), extname: /* @__PURE__ */ __name(function(t6) {
            e4(t6);
            for (var r4 = -1, n4 = 0, i3 = -1, o3 = true, s3 = 0, h4 = t6.length - 1; h4 >= 0; --h4) {
              var a3 = t6.charCodeAt(h4);
              if (47 !== a3) -1 === i3 && (o3 = false, i3 = h4 + 1), 46 === a3 ? -1 === r4 ? r4 = h4 : 1 !== s3 && (s3 = 1) : -1 !== r4 && (s3 = -1);
              else if (!o3) {
                n4 = h4 + 1;
                break;
              }
            }
            return -1 === r4 || -1 === i3 || 0 === s3 || 1 === s3 && r4 === i3 - 1 && r4 === n4 + 1 ? "" : t6.slice(r4, i3);
          }, "extname"), format: /* @__PURE__ */ __name(function(t6) {
            if (null === t6 || "object" != typeof t6) throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof t6);
            return (function(t7, e6) {
              var r4 = e6.dir || e6.root, n4 = e6.base || (e6.name || "") + (e6.ext || "");
              return r4 ? r4 === e6.root ? r4 + n4 : r4 + "/" + n4 : n4;
            })(0, t6);
          }, "format"), parse: /* @__PURE__ */ __name(function(t6) {
            e4(t6);
            var r4 = { root: "", dir: "", base: "", ext: "", name: "" };
            if (0 === t6.length) return r4;
            var n4, i3 = t6.charCodeAt(0), o3 = 47 === i3;
            o3 ? (r4.root = "/", n4 = 1) : n4 = 0;
            for (var s3 = -1, h4 = 0, a3 = -1, c4 = true, f3 = t6.length - 1, u3 = 0; f3 >= n4; --f3) if (47 !== (i3 = t6.charCodeAt(f3))) -1 === a3 && (c4 = false, a3 = f3 + 1), 46 === i3 ? -1 === s3 ? s3 = f3 : 1 !== u3 && (u3 = 1) : -1 !== s3 && (u3 = -1);
            else if (!c4) {
              h4 = f3 + 1;
              break;
            }
            return -1 === s3 || -1 === a3 || 0 === u3 || 1 === u3 && s3 === a3 - 1 && s3 === h4 + 1 ? -1 !== a3 && (r4.base = r4.name = 0 === h4 && o3 ? t6.slice(1, a3) : t6.slice(h4, a3)) : (0 === h4 && o3 ? (r4.name = t6.slice(1, s3), r4.base = t6.slice(1, a3)) : (r4.name = t6.slice(h4, s3), r4.base = t6.slice(h4, a3)), r4.ext = t6.slice(s3, a3)), h4 > 0 ? r4.dir = t6.slice(0, h4 - 1) : o3 && (r4.dir = "/"), r4;
          }, "parse"), sep: "/", delimiter: ":", win32: null, posix: null };
          n3.posix = n3, t5.exports = n3;
        } }, e3 = {};
        function r2(n3) {
          var i3 = e3[n3];
          if (void 0 !== i3) return i3.exports;
          var o3 = e3[n3] = { exports: {} };
          return t4[n3](o3, o3.exports, r2), o3.exports;
        }
        __name(r2, "r");
        r2.d = (t5, e4) => {
          for (var n3 in e4) r2.o(e4, n3) && !r2.o(t5, n3) && Object.defineProperty(t5, n3, { enumerable: true, get: e4[n3] });
        }, r2.o = (t5, e4) => Object.prototype.hasOwnProperty.call(t5, e4), r2.r = (t5) => {
          "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t5, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t5, "__esModule", { value: true });
        };
        var n2 = {};
        let i2;
        if (r2.r(n2), r2.d(n2, { URI: /* @__PURE__ */ __name(() => l4, "URI"), Utils: /* @__PURE__ */ __name(() => I3, "Utils") }), "object" == typeof process) i2 = "win32" === process.platform;
        else if ("object" == typeof navigator) {
          let t5 = navigator.userAgent;
          i2 = t5.indexOf("Windows") >= 0;
        }
        const o2 = /^\w[\w\d+.-]*$/, s2 = /^\//, h3 = /^\/\//;
        function a2(t5, e4) {
          if (!t5.scheme && e4) throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${t5.authority}", path: "${t5.path}", query: "${t5.query}", fragment: "${t5.fragment}"}`);
          if (t5.scheme && !o2.test(t5.scheme)) throw new Error("[UriError]: Scheme contains illegal characters.");
          if (t5.path) {
            if (t5.authority) {
              if (!s2.test(t5.path)) throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character');
            } else if (h3.test(t5.path)) throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")');
          }
        }
        __name(a2, "a");
        const c3 = "", f2 = "/", u2 = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
        class l4 {
          static {
            __name(this, "l");
          }
          static isUri(t5) {
            return t5 instanceof l4 || !!t5 && "string" == typeof t5.authority && "string" == typeof t5.fragment && "string" == typeof t5.path && "string" == typeof t5.query && "string" == typeof t5.scheme && "string" == typeof t5.fsPath && "function" == typeof t5.with && "function" == typeof t5.toString;
          }
          scheme;
          authority;
          path;
          query;
          fragment;
          constructor(t5, e4, r3, n3, i3, o3 = false) {
            "object" == typeof t5 ? (this.scheme = t5.scheme || c3, this.authority = t5.authority || c3, this.path = t5.path || c3, this.query = t5.query || c3, this.fragment = t5.fragment || c3) : (this.scheme = /* @__PURE__ */ (function(t6, e6) {
              return t6 || e6 ? t6 : "file";
            })(t5, o3), this.authority = e4 || c3, this.path = (function(t6, e6) {
              switch (t6) {
                case "https":
                case "http":
                case "file":
                  e6 ? e6[0] !== f2 && (e6 = f2 + e6) : e6 = f2;
              }
              return e6;
            })(this.scheme, r3 || c3), this.query = n3 || c3, this.fragment = i3 || c3, a2(this, o3));
          }
          get fsPath() {
            return v3(this, false);
          }
          with(t5) {
            if (!t5) return this;
            let { scheme: e4, authority: r3, path: n3, query: i3, fragment: o3 } = t5;
            return void 0 === e4 ? e4 = this.scheme : null === e4 && (e4 = c3), void 0 === r3 ? r3 = this.authority : null === r3 && (r3 = c3), void 0 === n3 ? n3 = this.path : null === n3 && (n3 = c3), void 0 === i3 ? i3 = this.query : null === i3 && (i3 = c3), void 0 === o3 ? o3 = this.fragment : null === o3 && (o3 = c3), e4 === this.scheme && r3 === this.authority && n3 === this.path && i3 === this.query && o3 === this.fragment ? this : new d3(e4, r3, n3, i3, o3);
          }
          static parse(t5, e4 = false) {
            const r3 = u2.exec(t5);
            return r3 ? new d3(r3[2] || c3, w4(r3[4] || c3), w4(r3[5] || c3), w4(r3[7] || c3), w4(r3[9] || c3), e4) : new d3(c3, c3, c3, c3, c3);
          }
          static file(t5) {
            let e4 = c3;
            if (i2 && (t5 = t5.replace(/\\/g, f2)), t5[0] === f2 && t5[1] === f2) {
              const r3 = t5.indexOf(f2, 2);
              -1 === r3 ? (e4 = t5.substring(2), t5 = f2) : (e4 = t5.substring(2, r3), t5 = t5.substring(r3) || f2);
            }
            return new d3("file", e4, t5, c3, c3);
          }
          static from(t5) {
            const e4 = new d3(t5.scheme, t5.authority, t5.path, t5.query, t5.fragment);
            return a2(e4, true), e4;
          }
          toString(t5 = false) {
            return b3(this, t5);
          }
          toJSON() {
            return this;
          }
          static revive(t5) {
            if (t5) {
              if (t5 instanceof l4) return t5;
              {
                const e4 = new d3(t5);
                return e4._formatted = t5.external, e4._fsPath = t5._sep === g2 ? t5.fsPath : null, e4;
              }
            }
            return t5;
          }
        }
        const g2 = i2 ? 1 : void 0;
        class d3 extends l4 {
          static {
            __name(this, "d");
          }
          _formatted = null;
          _fsPath = null;
          get fsPath() {
            return this._fsPath || (this._fsPath = v3(this, false)), this._fsPath;
          }
          toString(t5 = false) {
            return t5 ? b3(this, true) : (this._formatted || (this._formatted = b3(this, false)), this._formatted);
          }
          toJSON() {
            const t5 = { $mid: 1 };
            return this._fsPath && (t5.fsPath = this._fsPath, t5._sep = g2), this._formatted && (t5.external = this._formatted), this.path && (t5.path = this.path), this.scheme && (t5.scheme = this.scheme), this.authority && (t5.authority = this.authority), this.query && (t5.query = this.query), this.fragment && (t5.fragment = this.fragment), t5;
          }
        }
        const p3 = { 58: "%3A", 47: "%2F", 63: "%3F", 35: "%23", 91: "%5B", 93: "%5D", 64: "%40", 33: "%21", 36: "%24", 38: "%26", 39: "%27", 40: "%28", 41: "%29", 42: "%2A", 43: "%2B", 44: "%2C", 59: "%3B", 61: "%3D", 32: "%20" };
        function m3(t5, e4, r3) {
          let n3, i3 = -1;
          for (let o3 = 0; o3 < t5.length; o3++) {
            const s3 = t5.charCodeAt(o3);
            if (s3 >= 97 && s3 <= 122 || s3 >= 65 && s3 <= 90 || s3 >= 48 && s3 <= 57 || 45 === s3 || 46 === s3 || 95 === s3 || 126 === s3 || e4 && 47 === s3 || r3 && 91 === s3 || r3 && 93 === s3 || r3 && 58 === s3) -1 !== i3 && (n3 += encodeURIComponent(t5.substring(i3, o3)), i3 = -1), void 0 !== n3 && (n3 += t5.charAt(o3));
            else {
              void 0 === n3 && (n3 = t5.substr(0, o3));
              const e6 = p3[s3];
              void 0 !== e6 ? (-1 !== i3 && (n3 += encodeURIComponent(t5.substring(i3, o3)), i3 = -1), n3 += e6) : -1 === i3 && (i3 = o3);
            }
          }
          return -1 !== i3 && (n3 += encodeURIComponent(t5.substring(i3))), void 0 !== n3 ? n3 : t5;
        }
        __name(m3, "m");
        function y6(t5) {
          let e4;
          for (let r3 = 0; r3 < t5.length; r3++) {
            const n3 = t5.charCodeAt(r3);
            35 === n3 || 63 === n3 ? (void 0 === e4 && (e4 = t5.substr(0, r3)), e4 += p3[n3]) : void 0 !== e4 && (e4 += t5[r3]);
          }
          return void 0 !== e4 ? e4 : t5;
        }
        __name(y6, "y");
        function v3(t5, e4) {
          let r3;
          return r3 = t5.authority && t5.path.length > 1 && "file" === t5.scheme ? `//${t5.authority}${t5.path}` : 47 === t5.path.charCodeAt(0) && (t5.path.charCodeAt(1) >= 65 && t5.path.charCodeAt(1) <= 90 || t5.path.charCodeAt(1) >= 97 && t5.path.charCodeAt(1) <= 122) && 58 === t5.path.charCodeAt(2) ? e4 ? t5.path.substr(1) : t5.path[1].toLowerCase() + t5.path.substr(2) : t5.path, i2 && (r3 = r3.replace(/\//g, "\\")), r3;
        }
        __name(v3, "v");
        function b3(t5, e4) {
          const r3 = e4 ? y6 : m3;
          let n3 = "", { scheme: i3, authority: o3, path: s3, query: h4, fragment: a3 } = t5;
          if (i3 && (n3 += i3, n3 += ":"), (o3 || "file" === i3) && (n3 += f2, n3 += f2), o3) {
            let t6 = o3.indexOf("@");
            if (-1 !== t6) {
              const e6 = o3.substr(0, t6);
              o3 = o3.substr(t6 + 1), t6 = e6.lastIndexOf(":"), -1 === t6 ? n3 += r3(e6, false, false) : (n3 += r3(e6.substr(0, t6), false, false), n3 += ":", n3 += r3(e6.substr(t6 + 1), false, true)), n3 += "@";
            }
            o3 = o3.toLowerCase(), t6 = o3.lastIndexOf(":"), -1 === t6 ? n3 += r3(o3, false, true) : (n3 += r3(o3.substr(0, t6), false, true), n3 += o3.substr(t6));
          }
          if (s3) {
            if (s3.length >= 3 && 47 === s3.charCodeAt(0) && 58 === s3.charCodeAt(2)) {
              const t6 = s3.charCodeAt(1);
              t6 >= 65 && t6 <= 90 && (s3 = `/${String.fromCharCode(t6 + 32)}:${s3.substr(3)}`);
            } else if (s3.length >= 2 && 58 === s3.charCodeAt(1)) {
              const t6 = s3.charCodeAt(0);
              t6 >= 65 && t6 <= 90 && (s3 = `${String.fromCharCode(t6 + 32)}:${s3.substr(2)}`);
            }
            n3 += r3(s3, true, false);
          }
          return h4 && (n3 += "?", n3 += r3(h4, false, false)), a3 && (n3 += "#", n3 += e4 ? a3 : m3(a3, false, false)), n3;
        }
        __name(b3, "b");
        function C3(t5) {
          try {
            return decodeURIComponent(t5);
          } catch {
            return t5.length > 3 ? t5.substr(0, 3) + C3(t5.substr(3)) : t5;
          }
        }
        __name(C3, "C");
        const A2 = /(%[0-9A-Za-z][0-9A-Za-z])+/g;
        function w4(t5) {
          return t5.match(A2) ? t5.replace(A2, ((t6) => C3(t6))) : t5;
        }
        __name(w4, "w");
        var x5 = r2(975);
        const P3 = x5.posix || x5, _3 = "/";
        var I3;
        !(function(t5) {
          t5.joinPath = function(t6, ...e4) {
            return t6.with({ path: P3.join(t6.path, ...e4) });
          }, t5.resolvePath = function(t6, ...e4) {
            let r3 = t6.path, n3 = false;
            r3[0] !== _3 && (r3 = _3 + r3, n3 = true);
            let i3 = P3.resolve(r3, ...e4);
            return n3 && i3[0] === _3 && !t6.authority && (i3 = i3.substring(1)), t6.with({ path: i3 });
          }, t5.dirname = function(t6) {
            if (0 === t6.path.length || t6.path === _3) return t6;
            let e4 = P3.dirname(t6.path);
            return 1 === e4.length && 46 === e4.charCodeAt(0) && (e4 = ""), t6.with({ path: e4 });
          }, t5.basename = function(t6) {
            return P3.basename(t6.path);
          }, t5.extname = function(t6) {
            return P3.extname(t6.path);
          };
        })(I3 || (I3 = {})), LIB = n2;
      })();
      ({ URI: URI2, Utils: Utils2 } = LIB);
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/uri-utils.js
  var UriUtils, UriTrie;
  var init_uri_utils = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/uri-utils.js"() {
      "use strict";
      init_esm2();
      (function(UriUtils2) {
        UriUtils2.basename = Utils2.basename;
        UriUtils2.dirname = Utils2.dirname;
        UriUtils2.extname = Utils2.extname;
        UriUtils2.joinPath = Utils2.joinPath;
        UriUtils2.resolvePath = Utils2.resolvePath;
        const isWindows = typeof process === "object" && process?.platform === "win32";
        function equals(a2, b3) {
          return a2?.toString() === b3?.toString();
        }
        __name(equals, "equals");
        UriUtils2.equals = equals;
        function relative(from2, to) {
          const fromPath = typeof from2 === "string" ? URI2.parse(from2).path : from2.path;
          const toPath2 = typeof to === "string" ? URI2.parse(to).path : to.path;
          const fromParts = fromPath.split("/").filter((e3) => e3.length > 0);
          const toParts = toPath2.split("/").filter((e3) => e3.length > 0);
          if (isWindows) {
            const upperCaseDriveLetter = /^[A-Z]:$/;
            if (fromParts[0] && upperCaseDriveLetter.test(fromParts[0])) {
              fromParts[0] = fromParts[0].toLowerCase();
            }
            if (toParts[0] && upperCaseDriveLetter.test(toParts[0])) {
              toParts[0] = toParts[0].toLowerCase();
            }
            if (fromParts[0] !== toParts[0]) {
              return toPath2.substring(1);
            }
          }
          let i2 = 0;
          for (; i2 < fromParts.length; i2++) {
            if (fromParts[i2] !== toParts[i2]) {
              break;
            }
          }
          const backPart = "../".repeat(fromParts.length - i2);
          const toPart = toParts.slice(i2).join("/");
          return backPart + toPart;
        }
        __name(relative, "relative");
        UriUtils2.relative = relative;
        function normalize4(uri) {
          return URI2.parse(uri.toString()).toString();
        }
        __name(normalize4, "normalize");
        UriUtils2.normalize = normalize4;
        function contains2(parent4, child) {
          let parentPath = typeof parent4 === "string" ? parent4 : parent4.path;
          let childPath = typeof child === "string" ? child : child.path;
          if (childPath.charAt(childPath.length - 1) === "/") {
            childPath = childPath.slice(0, -1);
          }
          if (parentPath.charAt(parentPath.length - 1) === "/") {
            parentPath = parentPath.slice(0, -1);
          }
          if (childPath === parentPath) {
            return true;
          }
          if (childPath.length < parentPath.length) {
            return false;
          }
          if (childPath.charAt(parentPath.length) !== "/") {
            return false;
          }
          return childPath.startsWith(parentPath);
        }
        __name(contains2, "contains");
        UriUtils2.contains = contains2;
      })(UriUtils || (UriUtils = {}));
      UriTrie = class {
        static {
          __name(this, "UriTrie");
        }
        constructor() {
          this.root = { name: "", children: /* @__PURE__ */ new Map() };
        }
        normalizeUri(uri) {
          return UriUtils.normalize(uri);
        }
        clear() {
          this.root.children.clear();
        }
        insert(uri, element3) {
          const node2 = this.getNode(this.normalizeUri(uri), true);
          node2.element = element3;
        }
        delete(uri) {
          const nodeToDelete = this.getNode(this.normalizeUri(uri), false);
          if (nodeToDelete?.parent) {
            nodeToDelete.parent.children.delete(nodeToDelete.name);
          }
        }
        has(uri) {
          return this.getNode(this.normalizeUri(uri), false)?.element !== void 0;
        }
        hasNode(uri) {
          return this.getNode(this.normalizeUri(uri), false) !== void 0;
        }
        find(uri) {
          return this.getNode(this.normalizeUri(uri), false)?.element;
        }
        findNode(uri) {
          const uriString = this.normalizeUri(uri);
          const node2 = this.getNode(uriString, false);
          if (!node2) {
            return void 0;
          }
          return {
            name: node2.name,
            uri: UriUtils.joinPath(URI2.parse(uriString), node2.name).toString(),
            element: node2.element
          };
        }
        findChildren(uri) {
          const uriString = this.normalizeUri(uri);
          const node2 = this.getNode(uriString, false);
          if (!node2) {
            return [];
          }
          return Array.from(node2.children.values()).map((child) => ({
            name: child.name,
            uri: UriUtils.joinPath(URI2.parse(uriString), child.name).toString(),
            element: child.element
          }));
        }
        all() {
          return this.collectValues(this.root);
        }
        findAll(prefix) {
          const node2 = this.getNode(UriUtils.normalize(prefix), false);
          if (!node2) {
            return [];
          }
          return this.collectValues(node2);
        }
        getNode(uri, create4) {
          const parts = uri.split("/");
          if (uri.charAt(uri.length - 1) === "/") {
            parts.pop();
          }
          let current = this.root;
          for (const part of parts) {
            let child = current.children.get(part);
            if (!child) {
              if (create4) {
                child = {
                  name: part,
                  children: /* @__PURE__ */ new Map(),
                  parent: current
                };
                current.children.set(part, child);
              } else {
                return void 0;
              }
            }
            current = child;
          }
          return current;
        }
        collectValues(node2) {
          const result = [];
          if (node2.element) {
            result.push(node2.element);
          }
          for (const child of node2.children.values()) {
            result.push(...this.collectValues(child));
          }
          return result;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/documents.js
  var DocumentState, DefaultLangiumDocumentFactory, DefaultLangiumDocuments;
  var init_documents = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/documents.js"() {
      "use strict";
      init_main2();
      init_documents();
      init_cancellation();
      init_stream();
      init_uri_utils();
      (function(DocumentState2) {
        DocumentState2[DocumentState2["Changed"] = 0] = "Changed";
        DocumentState2[DocumentState2["Parsed"] = 1] = "Parsed";
        DocumentState2[DocumentState2["IndexedContent"] = 2] = "IndexedContent";
        DocumentState2[DocumentState2["ComputedScopes"] = 3] = "ComputedScopes";
        DocumentState2[DocumentState2["Linked"] = 4] = "Linked";
        DocumentState2[DocumentState2["IndexedReferences"] = 5] = "IndexedReferences";
        DocumentState2[DocumentState2["Validated"] = 6] = "Validated";
      })(DocumentState || (DocumentState = {}));
      DefaultLangiumDocumentFactory = class {
        static {
          __name(this, "DefaultLangiumDocumentFactory");
        }
        constructor(services) {
          this.serviceRegistry = services.ServiceRegistry;
          this.textDocuments = services.workspace.TextDocuments;
          this.fileSystemProvider = services.workspace.FileSystemProvider;
        }
        async fromUri(uri, cancellationToken = cancellation_exports.CancellationToken.None) {
          const content = await this.fileSystemProvider.readFile(uri);
          return this.createAsync(uri, content, cancellationToken);
        }
        fromTextDocument(textDocument, uri, token2) {
          uri = uri ?? URI2.parse(textDocument.uri);
          if (cancellation_exports.CancellationToken.is(token2)) {
            return this.createAsync(uri, textDocument, token2);
          } else {
            return this.create(uri, textDocument, token2);
          }
        }
        fromString(text4, uri, token2) {
          if (cancellation_exports.CancellationToken.is(token2)) {
            return this.createAsync(uri, text4, token2);
          } else {
            return this.create(uri, text4, token2);
          }
        }
        fromModel(model, uri) {
          return this.create(uri, { $model: model });
        }
        create(uri, content, options2) {
          if (typeof content === "string") {
            const parseResult = this.parse(uri, content, options2);
            return this.createLangiumDocument(parseResult, uri, void 0, content);
          } else if ("$model" in content) {
            const parseResult = { value: content.$model, parserErrors: [], lexerErrors: [] };
            return this.createLangiumDocument(parseResult, uri);
          } else {
            const parseResult = this.parse(uri, content.getText(), options2);
            return this.createLangiumDocument(parseResult, uri, content);
          }
        }
        async createAsync(uri, content, cancelToken) {
          if (typeof content === "string") {
            const parseResult = await this.parseAsync(uri, content, cancelToken);
            return this.createLangiumDocument(parseResult, uri, void 0, content);
          } else {
            const parseResult = await this.parseAsync(uri, content.getText(), cancelToken);
            return this.createLangiumDocument(parseResult, uri, content);
          }
        }
        /**
         * Create a LangiumDocument from a given parse result.
         *
         * A TextDocument is created on demand if it is not provided as argument here. Usually this
         * should not be necessary because the main purpose of the TextDocument is to convert between
         * text ranges and offsets, which is done solely in LSP request handling.
         *
         * With the introduction of {@link update} below this method is supposed to be mainly called
         * during workspace initialization and on addition/recognition of new files, while changes in
         * existing documents are processed via {@link update}.
         */
        createLangiumDocument(parseResult, uri, textDocument, text4) {
          let document2;
          if (textDocument) {
            document2 = {
              parseResult,
              uri,
              state: DocumentState.Parsed,
              references: [],
              textDocument
            };
          } else {
            const textDocumentGetter = this.createTextDocumentGetter(uri, text4);
            document2 = {
              parseResult,
              uri,
              state: DocumentState.Parsed,
              references: [],
              get textDocument() {
                return textDocumentGetter();
              }
            };
          }
          parseResult.value.$document = document2;
          return document2;
        }
        async update(document2, cancellationToken) {
          const oldText = document2.parseResult.value.$cstNode?.root.fullText;
          const textDocument = this.textDocuments?.get(document2.uri.toString());
          const text4 = textDocument ? textDocument.getText() : await this.fileSystemProvider.readFile(document2.uri);
          if (textDocument) {
            Object.defineProperty(document2, "textDocument", {
              value: textDocument
            });
          } else {
            const textDocumentGetter = this.createTextDocumentGetter(document2.uri, text4);
            Object.defineProperty(document2, "textDocument", {
              get: textDocumentGetter
            });
          }
          if (oldText !== text4) {
            document2.parseResult = await this.parseAsync(document2.uri, text4, cancellationToken);
            document2.parseResult.value.$document = document2;
          }
          document2.state = DocumentState.Parsed;
          return document2;
        }
        parse(uri, text4, options2) {
          const services = this.serviceRegistry.getServices(uri);
          return services.parser.LangiumParser.parse(text4, options2);
        }
        parseAsync(uri, text4, cancellationToken) {
          const services = this.serviceRegistry.getServices(uri);
          return services.parser.AsyncParser.parse(text4, cancellationToken);
        }
        createTextDocumentGetter(uri, text4) {
          const serviceRegistry = this.serviceRegistry;
          let textDoc = void 0;
          return () => {
            return textDoc ?? (textDoc = TextDocument2.create(uri.toString(), serviceRegistry.getServices(uri).LanguageMetaData.languageId, 0, text4 ?? ""));
          };
        }
      };
      DefaultLangiumDocuments = class {
        static {
          __name(this, "DefaultLangiumDocuments");
        }
        constructor(services) {
          this.documentTrie = new UriTrie();
          this.services = services;
          this.langiumDocumentFactory = services.workspace.LangiumDocumentFactory;
          this.documentBuilder = () => services.workspace.DocumentBuilder;
        }
        get all() {
          return stream(this.documentTrie.all());
        }
        addDocument(document2) {
          const uriString = document2.uri.toString();
          if (this.documentTrie.has(uriString)) {
            throw new Error(`A document with the URI '${uriString}' is already present.`);
          }
          this.documentTrie.insert(uriString, document2);
        }
        getDocument(uri) {
          const uriString = uri.toString();
          return this.documentTrie.find(uriString);
        }
        getDocuments(folder) {
          const uriString = folder.toString();
          return this.documentTrie.findAll(uriString);
        }
        async getOrCreateDocument(uri, cancellationToken) {
          let document2 = this.getDocument(uri);
          if (document2) {
            return document2;
          }
          document2 = await this.langiumDocumentFactory.fromUri(uri, cancellationToken);
          this.addDocument(document2);
          return document2;
        }
        createDocument(uri, text4, cancellationToken) {
          if (cancellationToken) {
            return this.langiumDocumentFactory.fromString(text4, uri, cancellationToken).then((document2) => {
              this.addDocument(document2);
              return document2;
            });
          } else {
            const document2 = this.langiumDocumentFactory.fromString(text4, uri);
            this.addDocument(document2);
            return document2;
          }
        }
        hasDocument(uri) {
          return this.documentTrie.has(uri.toString());
        }
        /**
         * @deprecated Since 4.2 use `DocumentBuilder.resetToState(DocumentState.Changed)` instead
         * TODO remove this for the next major release
         */
        invalidateDocument(uri) {
          const uriString = uri.toString();
          const langiumDoc = this.documentTrie.find(uriString);
          if (langiumDoc) {
            this.documentBuilder().resetToState(langiumDoc, DocumentState.Changed);
          }
          return langiumDoc;
        }
        deleteDocument(uri) {
          const uriString = uri.toString();
          const langiumDoc = this.documentTrie.find(uriString);
          if (langiumDoc) {
            langiumDoc.state = DocumentState.Changed;
            this.documentTrie.delete(uriString);
          }
          return langiumDoc;
        }
        deleteDocuments(folder) {
          const uriString = folder.toString();
          const langiumDocs = this.documentTrie.findAll(uriString);
          for (const langiumDoc of langiumDocs) {
            langiumDoc.state = DocumentState.Changed;
          }
          this.documentTrie.delete(uriString);
          return langiumDocs;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/linker.js
  var RefResolving, DefaultLinker;
  var init_linker = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/linker.js"() {
      "use strict";
      init_cancellation();
      init_syntax_tree();
      init_ast_utils();
      init_promise_utils();
      init_documents();
      RefResolving = Symbol("RefResolving");
      DefaultLinker = class {
        static {
          __name(this, "DefaultLinker");
        }
        constructor(services) {
          this.reflection = services.shared.AstReflection;
          this.langiumDocuments = () => services.shared.workspace.LangiumDocuments;
          this.scopeProvider = services.references.ScopeProvider;
          this.astNodeLocator = services.workspace.AstNodeLocator;
          this.profiler = services.shared.profilers.LangiumProfiler;
          this.languageId = services.LanguageMetaData.languageId;
        }
        async link(document2, cancelToken = cancellation_exports.CancellationToken.None) {
          if (this.profiler?.isActive("linking")) {
            const task = this.profiler.createTask("linking", this.languageId);
            task.start();
            try {
              for (const node2 of streamAst(document2.parseResult.value)) {
                await interruptAndCheck(cancelToken);
                streamReferences(node2).forEach((ref) => {
                  const name = `${node2.$type}:${ref.property}`;
                  task.startSubTask(name);
                  try {
                    this.doLink(ref, document2);
                  } finally {
                    task.stopSubTask(name);
                  }
                });
              }
            } finally {
              task.stop();
            }
          } else {
            for (const node2 of streamAst(document2.parseResult.value)) {
              await interruptAndCheck(cancelToken);
              streamReferences(node2).forEach((ref) => this.doLink(ref, document2));
            }
          }
        }
        doLink(refInfo, document2) {
          const ref = refInfo.reference;
          if ("_ref" in ref && ref._ref === void 0) {
            ref._ref = RefResolving;
            try {
              const description = this.getCandidate(refInfo);
              if (isLinkingError(description)) {
                ref._ref = description;
              } else {
                ref._nodeDescription = description;
                const linkedNode = this.loadAstNode(description);
                ref._ref = linkedNode ?? this.createLinkingError(refInfo, description);
              }
            } catch (err) {
              console.error(`An error occurred while resolving reference to '${ref.$refText}':`, err);
              const errorMessage = err.message ?? String(err);
              ref._ref = {
                info: refInfo,
                message: `An error occurred while resolving reference to '${ref.$refText}': ${errorMessage}`
              };
            }
            document2.references.push(ref);
          } else if ("_items" in ref && ref._items === void 0) {
            ref._items = RefResolving;
            try {
              const descriptions = this.getCandidates(refInfo);
              const items = [];
              if (isLinkingError(descriptions)) {
                ref._linkingError = descriptions;
              } else {
                for (const description of descriptions) {
                  const linkedNode = this.loadAstNode(description);
                  if (linkedNode) {
                    items.push({ ref: linkedNode, $nodeDescription: description });
                  }
                }
              }
              ref._items = items;
            } catch (err) {
              ref._linkingError = {
                info: refInfo,
                message: `An error occurred while resolving reference to '${ref.$refText}': ${err}`
              };
              ref._items = [];
            }
            document2.references.push(ref);
          }
        }
        unlink(document2) {
          for (const ref of document2.references) {
            if ("_ref" in ref) {
              ref._ref = void 0;
              delete ref._nodeDescription;
            } else if ("_items" in ref) {
              ref._items = void 0;
              delete ref._linkingError;
            }
          }
          document2.references = [];
        }
        getCandidate(refInfo) {
          const scope = this.scopeProvider.getScope(refInfo);
          const description = scope.getElement(refInfo.reference.$refText);
          return description ?? this.createLinkingError(refInfo);
        }
        getCandidates(refInfo) {
          const scope = this.scopeProvider.getScope(refInfo);
          const descriptions = scope.getElements(refInfo.reference.$refText).distinct((desc) => `${desc.documentUri}#${desc.path}`).toArray();
          return descriptions.length > 0 ? descriptions : this.createLinkingError(refInfo);
        }
        buildReference(node2, property2, refNode, refText) {
          const linker = this;
          const reference = {
            $refNode: refNode,
            $refText: refText,
            _ref: void 0,
            get ref() {
              if (isAstNode(this._ref)) {
                return this._ref;
              } else if (isAstNodeDescription(this._nodeDescription)) {
                const linkedNode = linker.loadAstNode(this._nodeDescription);
                this._ref = linkedNode ?? linker.createLinkingError({ reference, container: node2, property: property2 }, this._nodeDescription);
              } else if (this._ref === void 0) {
                this._ref = RefResolving;
                const document2 = findRootNode(node2).$document;
                const refData = linker.getLinkedNode({ reference, container: node2, property: property2 });
                if (refData.error && document2 && document2.state < DocumentState.ComputedScopes) {
                  return this._ref = void 0;
                }
                this._ref = refData.node ?? refData.error;
                this._nodeDescription = refData.descr;
                document2?.references.push(this);
              } else if (this._ref === RefResolving) {
                linker.throwCyclicReferenceError(node2, property2, refText);
              }
              return isAstNode(this._ref) ? this._ref : void 0;
            },
            get $nodeDescription() {
              return this._nodeDescription;
            },
            get error() {
              return isLinkingError(this._ref) ? this._ref : void 0;
            }
          };
          return reference;
        }
        buildMultiReference(node2, property2, refNode, refText) {
          const linker = this;
          const reference = {
            $refNode: refNode,
            $refText: refText,
            _items: void 0,
            get items() {
              if (Array.isArray(this._items)) {
                return this._items;
              } else if (this._items === void 0) {
                this._items = RefResolving;
                const document2 = findRootNode(node2).$document;
                const descriptions = linker.getCandidates({
                  reference,
                  container: node2,
                  property: property2
                });
                const items = [];
                if (isLinkingError(descriptions)) {
                  this._linkingError = descriptions;
                } else {
                  for (const description of descriptions) {
                    const linkedNode = linker.loadAstNode(description);
                    if (linkedNode) {
                      items.push({ ref: linkedNode, $nodeDescription: description });
                    }
                  }
                }
                this._items = items;
                document2?.references.push(this);
              } else if (this._items === RefResolving) {
                linker.throwCyclicReferenceError(node2, property2, refText);
              }
              return Array.isArray(this._items) ? this._items : [];
            },
            get error() {
              if (this._linkingError) {
                return this._linkingError;
              }
              const refs = this.items;
              if (refs.length > 0) {
                return void 0;
              } else {
                return this._linkingError = linker.createLinkingError({ reference, container: node2, property: property2 });
              }
            }
          };
          return reference;
        }
        throwCyclicReferenceError(node2, property2, refText) {
          throw new Error(`Cyclic reference resolution detected: ${this.astNodeLocator.getAstNodePath(node2)}/${property2} (symbol '${refText}')`);
        }
        getLinkedNode(refInfo) {
          try {
            const description = this.getCandidate(refInfo);
            if (isLinkingError(description)) {
              return { error: description };
            }
            const linkedNode = this.loadAstNode(description);
            if (linkedNode) {
              return { node: linkedNode, descr: description };
            } else {
              return {
                descr: description,
                error: this.createLinkingError(refInfo, description)
              };
            }
          } catch (err) {
            console.error(`An error occurred while resolving reference to '${refInfo.reference.$refText}':`, err);
            const errorMessage = err.message ?? String(err);
            return {
              error: {
                info: refInfo,
                message: `An error occurred while resolving reference to '${refInfo.reference.$refText}': ${errorMessage}`
              }
            };
          }
        }
        loadAstNode(nodeDescription) {
          if (nodeDescription.node) {
            return nodeDescription.node;
          }
          const doc = this.langiumDocuments().getDocument(nodeDescription.documentUri);
          if (!doc) {
            return void 0;
          }
          return this.astNodeLocator.getAstNode(doc.parseResult.value, nodeDescription.path);
        }
        createLinkingError(refInfo, targetDescription) {
          const document2 = findRootNode(refInfo.container).$document;
          if (document2 && document2.state < DocumentState.ComputedScopes) {
            console.warn(`Attempted reference resolution before document reached ComputedScopes state (${document2.uri}).`);
          }
          const referenceType = this.reflection.getReferenceType(refInfo);
          return {
            info: refInfo,
            message: `Could not resolve reference to ${referenceType} named '${refInfo.reference.$refText}'.`,
            targetDescription
          };
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/name-provider.js
  function isNamed(node2) {
    return typeof node2.name === "string";
  }
  var DefaultNameProvider;
  var init_name_provider = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/name-provider.js"() {
      "use strict";
      init_grammar_utils();
      __name(isNamed, "isNamed");
      DefaultNameProvider = class {
        static {
          __name(this, "DefaultNameProvider");
        }
        getName(node2) {
          if (isNamed(node2)) {
            return node2.name;
          }
          return void 0;
        }
        getNameNode(node2) {
          return findNodeForProperty(node2.$cstNode, "name");
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/references.js
  var DefaultReferences;
  var init_references = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/references.js"() {
      "use strict";
      init_grammar_utils();
      init_syntax_tree();
      init_ast_utils();
      init_cst_utils();
      init_stream();
      init_uri_utils();
      init_ast();
      DefaultReferences = class {
        static {
          __name(this, "DefaultReferences");
        }
        constructor(services) {
          this.nameProvider = services.references.NameProvider;
          this.index = services.shared.workspace.IndexManager;
          this.nodeLocator = services.workspace.AstNodeLocator;
          this.documents = services.shared.workspace.LangiumDocuments;
          this.hasMultiReference = streamAst(services.Grammar).some((node2) => isCrossReference(node2) && node2.isMulti);
        }
        findDeclarations(sourceCstNode) {
          if (sourceCstNode) {
            const assignment = findAssignment(sourceCstNode);
            const nodeElem = sourceCstNode.astNode;
            if (assignment && nodeElem) {
              const reference = nodeElem[assignment.feature];
              if (isReference(reference) || isMultiReference(reference)) {
                return getReferenceNodes(reference);
              } else if (Array.isArray(reference)) {
                for (const ref of reference) {
                  if ((isReference(ref) || isMultiReference(ref)) && ref.$refNode && ref.$refNode.offset <= sourceCstNode.offset && ref.$refNode.end >= sourceCstNode.end) {
                    return getReferenceNodes(ref);
                  }
                }
              }
            }
            if (nodeElem) {
              const nameNode = this.nameProvider.getNameNode(nodeElem);
              if (nameNode && (nameNode === sourceCstNode || isChildNode(sourceCstNode, nameNode))) {
                return this.getSelfNodes(nodeElem);
              }
            }
          }
          return [];
        }
        /**
         * Returns all self-references for the specified node.
         * Since the node can be part of a multi-reference, this method returns all nodes that are part of the same multi-reference.
         */
        getSelfNodes(node2) {
          if (!this.hasMultiReference) {
            return [node2];
          } else {
            const references = this.index.findAllReferences(node2, this.nodeLocator.getAstNodePath(node2));
            const headNode = this.getNodeFromReferenceDescription(references.head());
            if (headNode) {
              for (const ref of streamReferences(headNode)) {
                if (isMultiReference(ref.reference) && ref.reference.items.some((item) => item.ref === node2)) {
                  return ref.reference.items.map((item) => item.ref);
                }
              }
            }
            return [node2];
          }
        }
        getNodeFromReferenceDescription(ref) {
          if (!ref) {
            return void 0;
          }
          const doc = this.documents.getDocument(ref.sourceUri);
          if (doc) {
            return this.nodeLocator.getAstNode(doc.parseResult.value, ref.sourcePath);
          }
          return void 0;
        }
        findDeclarationNodes(sourceCstNode) {
          const astNodes = this.findDeclarations(sourceCstNode);
          const cstNodes = [];
          for (const astNode of astNodes) {
            const cstNode = this.nameProvider.getNameNode(astNode) ?? astNode.$cstNode;
            if (cstNode) {
              cstNodes.push(cstNode);
            }
          }
          return cstNodes;
        }
        findReferences(targetNode, options2) {
          const refs = [];
          if (options2.includeDeclaration) {
            refs.push(...this.getSelfReferences(targetNode));
          }
          let indexReferences = this.index.findAllReferences(targetNode, this.nodeLocator.getAstNodePath(targetNode));
          if (options2.documentUri) {
            indexReferences = indexReferences.filter((ref) => UriUtils.equals(ref.sourceUri, options2.documentUri));
          }
          refs.push(...indexReferences);
          return stream(refs);
        }
        getSelfReferences(targetNode) {
          const selfNodes = this.getSelfNodes(targetNode);
          const references = [];
          for (const selfNode of selfNodes) {
            const nameNode = this.nameProvider.getNameNode(selfNode);
            if (nameNode) {
              const doc = getDocument(selfNode);
              const path4 = this.nodeLocator.getAstNodePath(selfNode);
              references.push({
                sourceUri: doc.uri,
                sourcePath: path4,
                targetUri: doc.uri,
                targetPath: path4,
                segment: toDocumentSegment(nameNode),
                local: true
              });
            }
          }
          return references;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/collections.js
  var MultiMap, BiMap;
  var init_collections = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/collections.js"() {
      "use strict";
      init_stream();
      MultiMap = class {
        static {
          __name(this, "MultiMap");
        }
        constructor(elements2) {
          this.map = /* @__PURE__ */ new Map();
          if (elements2) {
            for (const [key, value2] of elements2) {
              this.add(key, value2);
            }
          }
        }
        /**
         * The total number of values in the multimap.
         */
        get size() {
          return Reduction.sum(stream(this.map.values()).map((a2) => a2.length));
        }
        /**
         * Clear all entries in the multimap.
         */
        clear() {
          this.map.clear();
        }
        /**
         * Operates differently depending on whether a `value` is given:
         *  * With a value, this method deletes the specific key / value pair from the multimap.
         *  * Without a value, all values associated with the given key are deleted.
         *
         * @returns `true` if a value existed and has been removed, or `false` if the specified
         *     key / value does not exist.
         */
        delete(key, value2) {
          if (value2 === void 0) {
            return this.map.delete(key);
          } else {
            const values2 = this.map.get(key);
            if (values2) {
              const index = values2.indexOf(value2);
              if (index >= 0) {
                if (values2.length === 1) {
                  this.map.delete(key);
                } else {
                  values2.splice(index, 1);
                }
                return true;
              }
            }
            return false;
          }
        }
        /**
         * Returns an array of all values associated with the given key. If no value exists,
         * an empty array is returned.
         *
         * _Note:_ The returned array is assumed not to be modified. Use the `set` method to add a
         * value and `delete` to remove a value from the multimap.
         */
        get(key) {
          return this.map.get(key) ?? [];
        }
        /**
         * Returns a stream of all values associated with the given key. If no value exists,
         * {@link EMPTY_STREAM} is returned.
         */
        getStream(key) {
          const values2 = this.map.get(key);
          return values2 ? stream(values2) : EMPTY_STREAM;
        }
        /**
         * Operates differently depending on whether a `value` is given:
         *  * With a value, this method returns `true` if the specific key / value pair is present in the multimap.
         *  * Without a value, this method returns `true` if the given key is present in the multimap.
         */
        has(key, value2) {
          if (value2 === void 0) {
            return this.map.has(key);
          } else {
            const values2 = this.map.get(key);
            if (values2) {
              return values2.indexOf(value2) >= 0;
            }
            return false;
          }
        }
        /**
         * Add the given key / value pair to the multimap.
         */
        add(key, value2) {
          if (this.map.has(key)) {
            this.map.get(key).push(value2);
          } else {
            this.map.set(key, [value2]);
          }
          return this;
        }
        /**
         * Add the given set of key / value pairs to the multimap.
         */
        addAll(key, values2) {
          if (this.map.has(key)) {
            this.map.get(key).push(...values2);
          } else {
            this.map.set(key, Array.from(values2));
          }
          return this;
        }
        /**
         * Invokes the given callback function for every key / value pair in the multimap.
         */
        forEach(callbackfn) {
          this.map.forEach((array4, key) => array4.forEach((value2) => callbackfn(value2, key, this)));
        }
        /**
         * Returns an iterator of key, value pairs for every entry in the map.
         */
        [Symbol.iterator]() {
          return this.entries().iterator();
        }
        /**
         * Returns a stream of key, value pairs for every entry in the map.
         */
        entries() {
          return stream(this.map.entries()).flatMap(([key, array4]) => array4.map((value2) => [key, value2]));
        }
        /**
         * Returns a stream of keys in the map.
         */
        keys() {
          return stream(this.map.keys());
        }
        /**
         * Returns a stream of values in the map.
         */
        values() {
          return stream(this.map.values()).flat();
        }
        /**
         * Returns a stream of key, value set pairs for every key in the map.
         */
        entriesGroupedByKey() {
          return stream(this.map.entries());
        }
      };
      BiMap = class {
        static {
          __name(this, "BiMap");
        }
        get size() {
          return this.map.size;
        }
        constructor(elements2) {
          this.map = /* @__PURE__ */ new Map();
          this.inverse = /* @__PURE__ */ new Map();
          if (elements2) {
            for (const [key, value2] of elements2) {
              this.set(key, value2);
            }
          }
        }
        clear() {
          this.map.clear();
          this.inverse.clear();
        }
        set(key, value2) {
          this.map.set(key, value2);
          this.inverse.set(value2, key);
          return this;
        }
        get(key) {
          return this.map.get(key);
        }
        getKey(value2) {
          return this.inverse.get(value2);
        }
        delete(key) {
          const value2 = this.map.get(key);
          if (value2 !== void 0) {
            this.map.delete(key);
            this.inverse.delete(value2);
            return true;
          }
          return false;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/scope-computation.js
  var DefaultScopeComputation;
  var init_scope_computation = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/scope-computation.js"() {
      "use strict";
      init_ast_utils();
      init_cancellation();
      init_collections();
      init_promise_utils();
      DefaultScopeComputation = class {
        static {
          __name(this, "DefaultScopeComputation");
        }
        constructor(services) {
          this.nameProvider = services.references.NameProvider;
          this.descriptions = services.workspace.AstNodeDescriptionProvider;
        }
        async collectExportedSymbols(document2, cancelToken = cancellation_exports.CancellationToken.None) {
          return this.collectExportedSymbolsForNode(document2.parseResult.value, document2, void 0, cancelToken);
        }
        /**
         * Creates {@link AstNodeDescription AstNodeDescriptions} for the given {@link AstNode parentNode} and its children.
         * The list of children to be considered is determined by the function parameter {@link children}.
         * By default only the direct children of {@link parentNode} are visited, nested nodes are not exported.
         *
         * @param parentNode AST node to be exported, i.e., of which an {@link AstNodeDescription} shall be added to the returned list.
         * @param document The document containing the AST node to be exported.
         * @param children A function called with {@link parentNode} as single argument and returning an {@link Iterable} supplying the children to be visited, which must be directly or transitively contained in {@link parentNode}.
         * @param cancelToken Indicates when to cancel the current operation.
         * @throws `OperationCancelled` if a user action occurs during execution.
         * @returns A list of {@link AstNodeDescription AstNodeDescriptions} to be published to index.
         */
        async collectExportedSymbolsForNode(parentNode, document2, children2 = streamContents, cancelToken = cancellation_exports.CancellationToken.None) {
          const exports2 = [];
          this.addExportedSymbol(parentNode, exports2, document2);
          for (const node2 of children2(parentNode)) {
            await interruptAndCheck(cancelToken);
            this.addExportedSymbol(node2, exports2, document2);
          }
          return exports2;
        }
        /**
         * Adds a single node to the list of exports if it has a name. Override this method to change how
         * symbols are exported, e.g. by modifying their exported name.
         */
        addExportedSymbol(node2, exports2, document2) {
          const name = this.nameProvider.getName(node2);
          if (name) {
            exports2.push(this.descriptions.createDescription(node2, name, document2));
          }
        }
        // --- local symbols gathering ---
        async collectLocalSymbols(document2, cancelToken = cancellation_exports.CancellationToken.None) {
          const rootNode = document2.parseResult.value;
          const symbols2 = new MultiMap();
          for (const node2 of streamAllContents(rootNode)) {
            await interruptAndCheck(cancelToken);
            this.addLocalSymbol(node2, document2, symbols2);
          }
          return symbols2;
        }
        /**
         * Adds a single node to the local symbols of its containing document if it has a name.
         * The default implementation makes the node visible in the subtree of its container if it does have a container.
         * Override this method to change this, e.g. by increasing the visibility to a higher level in the AST.
         */
        addLocalSymbol(node2, document2, symbols2) {
          const container2 = node2.$container;
          if (container2) {
            const name = this.nameProvider.getName(node2);
            if (name) {
              symbols2.add(container2, this.descriptions.createDescription(node2, name, document2));
            }
          }
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/scope.js
  var StreamScope, MapScope, MultiMapScope, EMPTY_SCOPE;
  var init_scope = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/scope.js"() {
      "use strict";
      init_collections();
      init_stream();
      StreamScope = class {
        static {
          __name(this, "StreamScope");
        }
        constructor(elements2, outerScope, options2) {
          this.elements = elements2;
          this.outerScope = outerScope;
          this.caseInsensitive = options2?.caseInsensitive ?? false;
          this.concatOuterScope = options2?.concatOuterScope ?? true;
        }
        getAllElements() {
          if (this.outerScope) {
            return this.elements.concat(this.outerScope.getAllElements());
          } else {
            return this.elements;
          }
        }
        getElement(name) {
          const lowerCaseName = this.caseInsensitive ? name.toLowerCase() : name;
          const local = this.caseInsensitive ? this.elements.find((e3) => e3.name.toLowerCase() === lowerCaseName) : this.elements.find((e3) => e3.name === name);
          if (local) {
            return local;
          }
          if (this.outerScope) {
            return this.outerScope.getElement(name);
          }
          return void 0;
        }
        getElements(name) {
          const lowerCaseName = this.caseInsensitive ? name.toLowerCase() : name;
          const local = this.caseInsensitive ? this.elements.filter((e3) => e3.name.toLowerCase() === lowerCaseName) : this.elements.filter((e3) => e3.name === name);
          if ((this.concatOuterScope || local.isEmpty()) && this.outerScope) {
            return local.concat(this.outerScope.getElements(name));
          } else {
            return local;
          }
        }
      };
      MapScope = class {
        static {
          __name(this, "MapScope");
        }
        constructor(elements2, outerScope, options2) {
          this.elements = /* @__PURE__ */ new Map();
          this.caseInsensitive = options2?.caseInsensitive ?? false;
          this.concatOuterScope = options2?.concatOuterScope ?? true;
          for (const element3 of elements2) {
            const name = this.caseInsensitive ? element3.name.toLowerCase() : element3.name;
            this.elements.set(name, element3);
          }
          this.outerScope = outerScope;
        }
        getElement(name) {
          const localName = this.caseInsensitive ? name.toLowerCase() : name;
          const local = this.elements.get(localName);
          if (local) {
            return local;
          }
          if (this.outerScope) {
            return this.outerScope.getElement(name);
          }
          return void 0;
        }
        getElements(name) {
          const localName = this.caseInsensitive ? name.toLowerCase() : name;
          const local = this.elements.get(localName);
          const arr = local ? [local] : [];
          if ((this.concatOuterScope || arr.length > 0) && this.outerScope) {
            return stream(arr).concat(this.outerScope.getElements(name));
          } else {
            return stream(arr);
          }
        }
        getAllElements() {
          let elementStream = stream(this.elements.values());
          if (this.outerScope) {
            elementStream = elementStream.concat(this.outerScope.getAllElements());
          }
          return elementStream;
        }
      };
      MultiMapScope = class {
        static {
          __name(this, "MultiMapScope");
        }
        constructor(elements2, outerScope, options2) {
          this.elements = new MultiMap();
          this.caseInsensitive = options2?.caseInsensitive ?? false;
          this.concatOuterScope = options2?.concatOuterScope ?? true;
          for (const element3 of elements2) {
            const name = this.caseInsensitive ? element3.name.toLowerCase() : element3.name;
            this.elements.add(name, element3);
          }
          this.outerScope = outerScope;
        }
        getElement(name) {
          const localName = this.caseInsensitive ? name.toLowerCase() : name;
          const local = this.elements.get(localName)[0];
          if (local) {
            return local;
          }
          if (this.outerScope) {
            return this.outerScope.getElement(name);
          }
          return void 0;
        }
        getElements(name) {
          const localName = this.caseInsensitive ? name.toLowerCase() : name;
          const local = this.elements.get(localName);
          if ((this.concatOuterScope || local.length === 0) && this.outerScope) {
            return stream(local).concat(this.outerScope.getElements(name));
          } else {
            return stream(local);
          }
        }
        getAllElements() {
          let elementStream = stream(this.elements.values());
          if (this.outerScope) {
            elementStream = elementStream.concat(this.outerScope.getAllElements());
          }
          return elementStream;
        }
      };
      EMPTY_SCOPE = {
        getElement() {
          return void 0;
        },
        getElements() {
          return EMPTY_STREAM;
        },
        getAllElements() {
          return EMPTY_STREAM;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/caching.js
  var DisposableCache, SimpleCache, ContextCache, DocumentCache, WorkspaceCache;
  var init_caching = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/caching.js"() {
      "use strict";
      DisposableCache = class {
        static {
          __name(this, "DisposableCache");
        }
        constructor() {
          this.toDispose = [];
          this.isDisposed = false;
        }
        onDispose(disposable) {
          this.toDispose.push(disposable);
        }
        dispose() {
          this.throwIfDisposed();
          this.clear();
          this.isDisposed = true;
          this.toDispose.forEach((disposable) => disposable.dispose());
        }
        throwIfDisposed() {
          if (this.isDisposed) {
            throw new Error("This cache has already been disposed");
          }
        }
      };
      SimpleCache = class extends DisposableCache {
        static {
          __name(this, "SimpleCache");
        }
        constructor() {
          super(...arguments);
          this.cache = /* @__PURE__ */ new Map();
        }
        has(key) {
          this.throwIfDisposed();
          return this.cache.has(key);
        }
        set(key, value2) {
          this.throwIfDisposed();
          this.cache.set(key, value2);
        }
        get(key, provider) {
          this.throwIfDisposed();
          if (this.cache.has(key)) {
            return this.cache.get(key);
          } else if (provider) {
            const value2 = provider();
            this.cache.set(key, value2);
            return value2;
          } else {
            return void 0;
          }
        }
        delete(key) {
          this.throwIfDisposed();
          return this.cache.delete(key);
        }
        clear() {
          this.throwIfDisposed();
          this.cache.clear();
        }
      };
      ContextCache = class extends DisposableCache {
        static {
          __name(this, "ContextCache");
        }
        constructor(converter) {
          super();
          this.cache = /* @__PURE__ */ new Map();
          this.converter = converter ?? ((value2) => value2);
        }
        has(contextKey, key) {
          this.throwIfDisposed();
          return this.cacheForContext(contextKey).has(key);
        }
        set(contextKey, key, value2) {
          this.throwIfDisposed();
          this.cacheForContext(contextKey).set(key, value2);
        }
        get(contextKey, key, provider) {
          this.throwIfDisposed();
          const contextCache = this.cacheForContext(contextKey);
          if (contextCache.has(key)) {
            return contextCache.get(key);
          } else if (provider) {
            const value2 = provider();
            contextCache.set(key, value2);
            return value2;
          } else {
            return void 0;
          }
        }
        delete(contextKey, key) {
          this.throwIfDisposed();
          return this.cacheForContext(contextKey).delete(key);
        }
        clear(contextKey) {
          this.throwIfDisposed();
          if (contextKey) {
            const mapKey = this.converter(contextKey);
            this.cache.delete(mapKey);
          } else {
            this.cache.clear();
          }
        }
        cacheForContext(contextKey) {
          const mapKey = this.converter(contextKey);
          let documentCache = this.cache.get(mapKey);
          if (!documentCache) {
            documentCache = /* @__PURE__ */ new Map();
            this.cache.set(mapKey, documentCache);
          }
          return documentCache;
        }
      };
      DocumentCache = class extends ContextCache {
        static {
          __name(this, "DocumentCache");
        }
        /**
         * Creates a new document cache.
         *
         * @param sharedServices Service container instance to hook into document lifecycle events.
         * @param state Optional document state on which the cache should evict.
         * If not provided, the cache will evict on `DocumentBuilder#onUpdate`.
         * *Deleted* documents are considered in both cases.
         *
         * Providing a state here will use `DocumentBuilder#onDocumentPhase` instead,
         * which triggers on all documents that have been affected by this change, assuming that the
         * state is `DocumentState.Linked` or a later state.
         */
        constructor(sharedServices, state4) {
          super((uri) => uri.toString());
          if (state4) {
            this.toDispose.push(sharedServices.workspace.DocumentBuilder.onDocumentPhase(state4, (document2) => {
              this.clear(document2.uri.toString());
            }));
            this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate((_changed, deleted) => {
              for (const uri of deleted) {
                this.clear(uri);
              }
            }));
          } else {
            this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate((changed, deleted) => {
              const allUris = changed.concat(deleted);
              for (const uri of allUris) {
                this.clear(uri);
              }
            }));
          }
        }
      };
      WorkspaceCache = class extends SimpleCache {
        static {
          __name(this, "WorkspaceCache");
        }
        /**
         * Creates a new workspace cache.
         *
         * @param sharedServices Service container instance to hook into document lifecycle events.
         * @param state Optional document state on which the cache should evict.
         * If not provided, the cache will evict on `DocumentBuilder#onUpdate`.
         * *Deleted* documents are considered in both cases.
         */
        constructor(sharedServices, state4) {
          super();
          if (state4) {
            this.toDispose.push(sharedServices.workspace.DocumentBuilder.onBuildPhase(state4, () => {
              this.clear();
            }));
            this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate((_changed, deleted) => {
              if (deleted.length > 0) {
                this.clear();
              }
            }));
          } else {
            this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate(() => {
              this.clear();
            }));
          }
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/scope-provider.js
  var DefaultScopeProvider;
  var init_scope_provider = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/scope-provider.js"() {
      "use strict";
      init_scope();
      init_ast_utils();
      init_stream();
      init_caching();
      DefaultScopeProvider = class {
        static {
          __name(this, "DefaultScopeProvider");
        }
        constructor(services) {
          this.reflection = services.shared.AstReflection;
          this.nameProvider = services.references.NameProvider;
          this.descriptions = services.workspace.AstNodeDescriptionProvider;
          this.indexManager = services.shared.workspace.IndexManager;
          this.globalScopeCache = new WorkspaceCache(services.shared);
        }
        getScope(context) {
          const scopes = [];
          const referenceType = this.reflection.getReferenceType(context);
          const localSymbols = getDocument(context.container).localSymbols;
          if (localSymbols) {
            let currentNode = context.container;
            do {
              if (localSymbols.has(currentNode)) {
                scopes.push(localSymbols.getStream(currentNode).filter((desc) => this.reflection.isSubtype(desc.type, referenceType)));
              }
              currentNode = currentNode.$container;
            } while (currentNode);
          }
          let result = this.getGlobalScope(referenceType, context);
          for (let i2 = scopes.length - 1; i2 >= 0; i2--) {
            result = this.createScope(scopes[i2], result);
          }
          return result;
        }
        /**
         * Create a scope for the given collection of AST node descriptions.
         */
        createScope(elements2, outerScope, options2) {
          return new StreamScope(stream(elements2), outerScope, options2);
        }
        /**
         * Create a scope for the given collection of AST nodes, which need to be transformed into respective
         * descriptions first. This is done using the `NameProvider` and `AstNodeDescriptionProvider` services.
         */
        createScopeForNodes(elements2, outerScope, options2) {
          const s2 = stream(elements2).map((e3) => {
            const name = this.nameProvider.getName(e3);
            if (name) {
              return this.descriptions.createDescription(e3, name);
            }
            return void 0;
          }).nonNullable();
          return new StreamScope(s2, outerScope, options2);
        }
        /**
         * Create a global scope filtered for the given reference type.
         */
        getGlobalScope(referenceType, _context) {
          return this.globalScopeCache.get(referenceType, () => new MultiMapScope(this.indexManager.allElements(referenceType)));
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/serializer/json-serializer.js
  function isAstNodeWithComment(node2) {
    return typeof node2.$comment === "string";
  }
  function isIntermediateReference(obj) {
    return typeof obj === "object" && !!obj && ("$ref" in obj || "$error" in obj);
  }
  var DefaultJsonSerializer;
  var init_json_serializer = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/serializer/json-serializer.js"() {
      "use strict";
      init_esm2();
      init_syntax_tree();
      init_ast_utils();
      init_grammar_utils();
      __name(isAstNodeWithComment, "isAstNodeWithComment");
      __name(isIntermediateReference, "isIntermediateReference");
      DefaultJsonSerializer = class {
        static {
          __name(this, "DefaultJsonSerializer");
        }
        constructor(services) {
          this.ignoreProperties = /* @__PURE__ */ new Set(["$container", "$containerProperty", "$containerIndex", "$document", "$cstNode"]);
          this.langiumDocuments = services.shared.workspace.LangiumDocuments;
          this.astNodeLocator = services.workspace.AstNodeLocator;
          this.nameProvider = services.references.NameProvider;
          this.commentProvider = services.documentation.CommentProvider;
        }
        serialize(node2, options2) {
          const serializeOptions = options2 ?? {};
          const specificReplacer = options2?.replacer;
          const defaultReplacer = /* @__PURE__ */ __name((key, value2) => this.replacer(key, value2, serializeOptions), "defaultReplacer");
          const replacer = specificReplacer ? (key, value2) => specificReplacer(key, value2, defaultReplacer) : defaultReplacer;
          try {
            this.currentDocument = getDocument(node2);
            return JSON.stringify(node2, replacer, options2?.space);
          } finally {
            this.currentDocument = void 0;
          }
        }
        deserialize(content, options2) {
          const deserializeOptions = options2 ?? {};
          const root3 = JSON.parse(content);
          this.linkNode(root3, root3, deserializeOptions);
          return root3;
        }
        replacer(key, value2, { refText, sourceText, textRegions, comments, uriConverter }) {
          if (this.ignoreProperties.has(key)) {
            return void 0;
          } else if (isReference(value2)) {
            const refValue = value2.ref;
            const $refText = refText ? value2.$refText : void 0;
            if (refValue) {
              const targetDocument = getDocument(refValue);
              let targetUri = "";
              if (this.currentDocument && this.currentDocument !== targetDocument) {
                if (uriConverter) {
                  targetUri = uriConverter(targetDocument.uri, refValue);
                } else {
                  targetUri = targetDocument.uri.toString();
                }
              }
              const targetPath = this.astNodeLocator.getAstNodePath(refValue);
              return {
                $ref: `${targetUri}#${targetPath}`,
                $refText
              };
            } else {
              return {
                $error: value2.error?.message ?? "Could not resolve reference",
                $refText
              };
            }
          } else if (isMultiReference(value2)) {
            const $refText = refText ? value2.$refText : void 0;
            const $refs = [];
            for (const item of value2.items) {
              const refValue = item.ref;
              const targetDocument = getDocument(item.ref);
              let targetUri = "";
              if (this.currentDocument && this.currentDocument !== targetDocument) {
                if (uriConverter) {
                  targetUri = uriConverter(targetDocument.uri, refValue);
                } else {
                  targetUri = targetDocument.uri.toString();
                }
              }
              const targetPath = this.astNodeLocator.getAstNodePath(refValue);
              $refs.push(`${targetUri}#${targetPath}`);
            }
            return {
              $refs,
              $refText
            };
          } else if (isAstNode(value2)) {
            let astNode = void 0;
            if (textRegions) {
              astNode = this.addAstNodeRegionWithAssignmentsTo({ ...value2 });
              if ((!key || value2.$document) && astNode?.$textRegion) {
                astNode.$textRegion.documentURI = this.currentDocument?.uri.toString();
              }
            }
            if (sourceText && !key) {
              astNode ?? (astNode = { ...value2 });
              astNode.$sourceText = value2.$cstNode?.text;
            }
            if (comments) {
              astNode ?? (astNode = { ...value2 });
              const comment2 = this.commentProvider.getComment(value2);
              if (comment2) {
                astNode.$comment = comment2.replace(/\r/g, "");
              }
            }
            return astNode ?? value2;
          } else {
            return value2;
          }
        }
        addAstNodeRegionWithAssignmentsTo(node2) {
          const createDocumentSegment = /* @__PURE__ */ __name((cstNode) => ({
            offset: cstNode.offset,
            end: cstNode.end,
            length: cstNode.length,
            range: cstNode.range
          }), "createDocumentSegment");
          if (node2.$cstNode) {
            const textRegion = node2.$textRegion = createDocumentSegment(node2.$cstNode);
            const assignments = textRegion.assignments = {};
            Object.keys(node2).filter((key) => !key.startsWith("$")).forEach((key) => {
              const propertyAssignments = findNodesForProperty(node2.$cstNode, key).map(createDocumentSegment);
              if (propertyAssignments.length !== 0) {
                assignments[key] = propertyAssignments;
              }
            });
            return node2;
          }
          return void 0;
        }
        linkNode(node2, root3, options2, container2, containerProperty, containerIndex) {
          for (const [propertyName, item] of Object.entries(node2)) {
            if (Array.isArray(item)) {
              for (let index = 0; index < item.length; index++) {
                const element3 = item[index];
                if (isIntermediateReference(element3)) {
                  item[index] = this.reviveReference(node2, propertyName, root3, element3, options2);
                } else if (isAstNode(element3)) {
                  this.linkNode(element3, root3, options2, node2, propertyName, index);
                }
              }
            } else if (isIntermediateReference(item)) {
              node2[propertyName] = this.reviveReference(node2, propertyName, root3, item, options2);
            } else if (isAstNode(item)) {
              this.linkNode(item, root3, options2, node2, propertyName);
            }
          }
          const mutable = node2;
          mutable.$container = container2;
          mutable.$containerProperty = containerProperty;
          mutable.$containerIndex = containerIndex;
        }
        reviveReference(container2, property2, root3, reference, options2) {
          let refText = reference.$refText;
          let error3 = reference.$error;
          let ref;
          if (reference.$ref) {
            const refNode = this.getRefNode(root3, reference.$ref, options2.uriConverter);
            if (isAstNode(refNode)) {
              if (!refText) {
                refText = this.nameProvider.getName(refNode);
              }
              return {
                $refText: refText ?? "",
                ref: refNode
              };
            } else {
              error3 = refNode;
            }
          } else if (reference.$refs) {
            const refs = [];
            for (const refUri of reference.$refs) {
              const refNode = this.getRefNode(root3, refUri, options2.uriConverter);
              if (isAstNode(refNode)) {
                refs.push({ ref: refNode });
              }
            }
            if (refs.length === 0) {
              ref = {
                $refText: refText ?? "",
                items: refs
              };
              error3 ?? (error3 = "Could not resolve multi-reference");
            } else {
              return {
                $refText: refText ?? "",
                items: refs
              };
            }
          }
          if (error3) {
            ref ?? (ref = {
              $refText: refText ?? "",
              ref: void 0
            });
            ref.error = {
              info: {
                container: container2,
                property: property2,
                reference: ref
              },
              message: error3
            };
            return ref;
          } else {
            return void 0;
          }
        }
        getRefNode(root3, uri, uriConverter) {
          try {
            const fragmentIndex = uri.indexOf("#");
            if (fragmentIndex === 0) {
              const node3 = this.astNodeLocator.getAstNode(root3, uri.substring(1));
              if (!node3) {
                return "Could not resolve path: " + uri;
              }
              return node3;
            }
            if (fragmentIndex < 0) {
              const documentUri2 = uriConverter ? uriConverter(uri) : URI2.parse(uri);
              const document3 = this.langiumDocuments.getDocument(documentUri2);
              if (!document3) {
                return "Could not find document for URI: " + uri;
              }
              return document3.parseResult.value;
            }
            const documentUri = uriConverter ? uriConverter(uri.substring(0, fragmentIndex)) : URI2.parse(uri.substring(0, fragmentIndex));
            const document2 = this.langiumDocuments.getDocument(documentUri);
            if (!document2) {
              return "Could not find document for URI: " + uri;
            }
            if (fragmentIndex === uri.length - 1) {
              return document2.parseResult.value;
            }
            const node2 = this.astNodeLocator.getAstNode(document2.parseResult.value, uri.substring(fragmentIndex + 1));
            if (!node2) {
              return "Could not resolve URI: " + uri;
            }
            return node2;
          } catch (err) {
            return String(err);
          }
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/service-registry.js
  var DefaultServiceRegistry;
  var init_service_registry = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/service-registry.js"() {
      "use strict";
      init_uri_utils();
      DefaultServiceRegistry = class {
        static {
          __name(this, "DefaultServiceRegistry");
        }
        /**
         * @deprecated Since 3.1.0. Use the new `fileExtensionMap` (or `languageIdMap`) property instead.
         */
        get map() {
          return this.fileExtensionMap;
        }
        constructor(services) {
          this.languageIdMap = /* @__PURE__ */ new Map();
          this.fileExtensionMap = /* @__PURE__ */ new Map();
          this.fileNameMap = /* @__PURE__ */ new Map();
          this.textDocuments = services?.workspace.TextDocuments;
        }
        register(language) {
          const data5 = language.LanguageMetaData;
          for (const ext of data5.fileExtensions) {
            if (this.fileExtensionMap.has(ext)) {
              console.warn(`The file extension ${ext} is used by multiple languages. It is now assigned to '${data5.languageId}'.`);
            }
            this.fileExtensionMap.set(ext, language);
          }
          if (data5.fileNames) {
            for (const name of data5.fileNames) {
              if (this.fileNameMap.has(name)) {
                console.warn(`The file name ${name} is used by multiple languages. It is now assigned to '${data5.languageId}'.`);
              }
              this.fileNameMap.set(name, language);
            }
          }
          this.languageIdMap.set(data5.languageId, language);
        }
        getServices(uri) {
          if (this.languageIdMap.size === 0) {
            throw new Error("The service registry is empty. Use `register` to register the services of a language.");
          }
          const languageId = this.textDocuments?.get(uri)?.languageId;
          if (languageId !== void 0) {
            const services2 = this.languageIdMap.get(languageId);
            if (services2) {
              return services2;
            }
          }
          const ext = UriUtils.extname(uri);
          const name = UriUtils.basename(uri);
          const services = this.fileNameMap.get(name) ?? this.fileExtensionMap.get(ext);
          if (!services) {
            if (languageId) {
              throw new Error(`The service registry contains no services for the extension '${ext}' for language '${languageId}'.`);
            } else {
              throw new Error(`The service registry contains no services for the extension '${ext}'.`);
            }
          }
          return services;
        }
        hasServices(uri) {
          try {
            this.getServices(uri);
            return true;
          } catch {
            return false;
          }
        }
        get all() {
          return Array.from(this.languageIdMap.values());
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/validation/validation-registry.js
  function diagnosticData(code) {
    return { code };
  }
  var ValidationCategory, ValidationRegistry;
  var init_validation_registry = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/validation/validation-registry.js"() {
      "use strict";
      init_lib3();
      init_collections();
      init_promise_utils();
      init_stream();
      __name(diagnosticData, "diagnosticData");
      (function(ValidationCategory2) {
        ValidationCategory2.defaults = ["fast", "slow", "built-in"];
        ValidationCategory2.all = ValidationCategory2.defaults;
      })(ValidationCategory || (ValidationCategory = {}));
      ValidationRegistry = class {
        static {
          __name(this, "ValidationRegistry");
        }
        constructor(services) {
          this.entries = new MultiMap();
          this.knownCategories = new Set(ValidationCategory.defaults);
          this.entriesBefore = [];
          this.entriesAfter = [];
          this.reflection = services.shared.AstReflection;
        }
        /**
         * Register a set of validation checks. Each value in the record can be either a single validation check (i.e. a function)
         * or an array of validation checks.
         *
         * @param checksRecord Set of validation checks to register.
         * @param thisObj Optional object to be used as `this` when calling the validation check functions.
         * @param category Optional category for the validation checks (defaults to `'fast'`).
         */
        register(checksRecord, thisObj = this, category = "fast") {
          if (category === "built-in") {
            throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");
          }
          this.knownCategories.add(category);
          for (const [type3, ch] of Object.entries(checksRecord)) {
            const callbacks = ch;
            if (Array.isArray(callbacks)) {
              for (const check of callbacks) {
                const entry = {
                  check: this.wrapValidationException(check, thisObj),
                  category
                };
                this.addEntry(type3, entry);
              }
            } else if (typeof callbacks === "function") {
              const entry = {
                check: this.wrapValidationException(callbacks, thisObj),
                category
              };
              this.addEntry(type3, entry);
            } else {
              assertUnreachable(callbacks);
            }
          }
        }
        wrapValidationException(check, thisObj) {
          return async (node2, accept, cancelToken) => {
            await this.handleException(() => check.call(thisObj, node2, accept, cancelToken), "An error occurred during validation", accept, node2);
          };
        }
        async handleException(functionality, messageContext, accept, node2) {
          try {
            await functionality();
          } catch (err) {
            if (isOperationCancelled(err)) {
              throw err;
            }
            console.error(`${messageContext}:`, err);
            if (err instanceof Error && err.stack) {
              console.error(err.stack);
            }
            const messageDetails = err instanceof Error ? err.message : String(err);
            accept("error", `${messageContext}: ${messageDetails}`, { node: node2 });
          }
        }
        addEntry(type3, entry) {
          if (type3 === "AstNode") {
            this.entries.add("AstNode", entry);
            return;
          }
          for (const subtype of this.reflection.getAllSubTypes(type3)) {
            this.entries.add(subtype, entry);
          }
        }
        getChecks(type3, categories) {
          let checks = stream(this.entries.get(type3)).concat(this.entries.get("AstNode"));
          if (categories) {
            checks = checks.filter((entry) => categories.includes(entry.category));
          }
          return checks.map((entry) => entry.check);
        }
        /**
         * Register logic which will be executed once before validating all the nodes of an AST/Langium document.
         * This helps to prepare or initialize some information which are required or reusable for the following checks on the AstNodes.
         *
         * As an example, for validating unique fully-qualified names of nodes in the AST,
         * here the map for mapping names to nodes could be established.
         * During the usual checks on the nodes, they are put into this map with their name.
         *
         * Note that this approach makes validations stateful, which is relevant e.g. when cancelling the validation.
         * Therefore it is recommended to clear stored information
         * _before_ validating an AST to validate each AST unaffected from other ASTs
         * AND _after_ validating the AST to free memory by information which are no longer used.
         *
         * @param checkBefore a set-up function which will be called once before actually validating an AST
         * @param thisObj Optional object to be used as `this` when calling the validation check functions.
         */
        registerBeforeDocument(checkBefore, thisObj = this) {
          this.entriesBefore.push(this.wrapPreparationException(checkBefore, "An error occurred during set-up of the validation", thisObj));
        }
        /**
         * Register logic which will be executed once after validating all the nodes of an AST/Langium document.
         * This helps to finally evaluate information which are collected during the checks on the AstNodes.
         *
         * As an example, for validating unique fully-qualified names of nodes in the AST,
         * here the map with all the collected nodes and their names is checked
         * and validation hints are created for all nodes with the same name.
         *
         * Note that this approach makes validations stateful, which is relevant e.g. when cancelling the validation.
         * Therefore it is recommended to clear stored information
         * _before_ validating an AST to validate each AST unaffected from other ASTs
         * AND _after_ validating the AST to free memory by information which are no longer used.
         *
         * @param checkBefore a set-up function which will be called once before actually validating an AST
         * @param thisObj Optional object to be used as `this` when calling the validation check functions.
         */
        registerAfterDocument(checkAfter, thisObj = this) {
          this.entriesAfter.push(this.wrapPreparationException(checkAfter, "An error occurred during tear-down of the validation", thisObj));
        }
        wrapPreparationException(check, messageContext, thisObj) {
          return async (rootNode, accept, categories, cancelToken) => {
            await this.handleException(() => check.call(thisObj, rootNode, accept, categories, cancelToken), messageContext, accept, rootNode);
          };
        }
        get checksBefore() {
          return this.entriesBefore;
        }
        get checksAfter() {
          return this.entriesAfter;
        }
        getAllValidationCategories(_document) {
          return this.knownCategories;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/validation/document-validator.js
  function getDiagnosticRange(info2) {
    if (info2.range) {
      return info2.range;
    }
    let cstNode;
    if (typeof info2.property === "string") {
      cstNode = findNodeForProperty(info2.node.$cstNode, info2.property, info2.index);
    } else if (typeof info2.keyword === "string") {
      cstNode = findNodeForKeyword(info2.node.$cstNode, info2.keyword, info2.index);
    }
    cstNode ?? (cstNode = info2.node.$cstNode);
    if (!cstNode) {
      return {
        start: { line: 0, character: 0 },
        end: { line: 0, character: 0 }
      };
    }
    return cstNode.range;
  }
  function toDiagnosticSeverity(severity) {
    switch (severity) {
      case "error":
        return 1;
      case "warning":
        return 2;
      case "info":
        return 3;
      case "hint":
        return 4;
      default:
        throw new Error("Invalid diagnostic severity: " + severity);
    }
  }
  function toDiagnosticData(severity) {
    switch (severity) {
      case "error":
        return diagnosticData(DocumentValidator.LexingError);
      case "warning":
        return diagnosticData(DocumentValidator.LexingWarning);
      case "info":
        return diagnosticData(DocumentValidator.LexingInfo);
      case "hint":
        return diagnosticData(DocumentValidator.LexingHint);
      default:
        throw new Error("Invalid diagnostic severity: " + severity);
    }
  }
  var VALIDATE_EACH_NODE, DefaultDocumentValidator, DocumentValidator;
  var init_document_validator = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/validation/document-validator.js"() {
      "use strict";
      init_cancellation();
      init_grammar_utils();
      init_ast_utils();
      init_cst_utils();
      init_promise_utils();
      init_validation_registry();
      VALIDATE_EACH_NODE = Object.freeze({
        validateNode: true,
        validateChildren: true
      });
      DefaultDocumentValidator = class {
        static {
          __name(this, "DefaultDocumentValidator");
        }
        constructor(services) {
          this.validationRegistry = services.validation.ValidationRegistry;
          this.metadata = services.LanguageMetaData;
          this.profiler = services.shared.profilers.LangiumProfiler;
          this.languageId = services.LanguageMetaData.languageId;
        }
        async validateDocument(document2, options2 = {}, cancelToken = cancellation_exports.CancellationToken.None) {
          const parseResult = document2.parseResult;
          const diagnostics = [];
          await interruptAndCheck(cancelToken);
          if (!options2.categories || options2.categories.includes("built-in")) {
            this.processLexingErrors(parseResult, diagnostics, options2);
            if (options2.stopAfterLexingErrors && diagnostics.some((d3) => d3.data?.code === DocumentValidator.LexingError)) {
              return diagnostics;
            }
            this.processParsingErrors(parseResult, diagnostics, options2);
            if (options2.stopAfterParsingErrors && diagnostics.some((d3) => d3.data?.code === DocumentValidator.ParsingError)) {
              return diagnostics;
            }
            this.processLinkingErrors(document2, diagnostics, options2);
            if (options2.stopAfterLinkingErrors && diagnostics.some((d3) => d3.data?.code === DocumentValidator.LinkingError)) {
              return diagnostics;
            }
          }
          try {
            diagnostics.push(...await this.validateAst(parseResult.value, options2, cancelToken));
          } catch (err) {
            if (isOperationCancelled(err)) {
              throw err;
            }
            console.error("An error occurred during validation:", err);
          }
          await interruptAndCheck(cancelToken);
          return diagnostics;
        }
        processLexingErrors(parseResult, diagnostics, _options) {
          const lexerDiagnostics = [...parseResult.lexerErrors, ...parseResult.lexerReport?.diagnostics ?? []];
          for (const lexerDiagnostic of lexerDiagnostics) {
            const severity = lexerDiagnostic.severity ?? "error";
            const diagnostic = {
              severity: toDiagnosticSeverity(severity),
              range: {
                start: {
                  line: lexerDiagnostic.line - 1,
                  character: lexerDiagnostic.column - 1
                },
                end: {
                  line: lexerDiagnostic.line - 1,
                  character: lexerDiagnostic.column + lexerDiagnostic.length - 1
                }
              },
              message: lexerDiagnostic.message,
              data: toDiagnosticData(severity),
              source: this.getSource()
            };
            diagnostics.push(diagnostic);
          }
        }
        processParsingErrors(parseResult, diagnostics, _options) {
          for (const parserError of parseResult.parserErrors) {
            let range3 = void 0;
            if (isNaN(parserError.token.startOffset)) {
              if ("previousToken" in parserError) {
                const token2 = parserError.previousToken;
                if (!isNaN(token2.startOffset)) {
                  const position5 = { line: token2.endLine - 1, character: token2.endColumn };
                  range3 = { start: position5, end: position5 };
                } else {
                  const position5 = { line: 0, character: 0 };
                  range3 = { start: position5, end: position5 };
                }
              }
            } else {
              range3 = tokenToRange(parserError.token);
            }
            if (range3) {
              const diagnostic = {
                severity: toDiagnosticSeverity("error"),
                range: range3,
                message: parserError.message,
                data: diagnosticData(DocumentValidator.ParsingError),
                source: this.getSource()
              };
              diagnostics.push(diagnostic);
            }
          }
        }
        processLinkingErrors(document2, diagnostics, _options) {
          for (const reference of document2.references) {
            const linkingError = reference.error;
            if (linkingError) {
              const info2 = {
                node: linkingError.info.container,
                range: reference.$refNode?.range,
                property: linkingError.info.property,
                index: linkingError.info.index,
                data: {
                  code: DocumentValidator.LinkingError,
                  containerType: linkingError.info.container.$type,
                  property: linkingError.info.property,
                  refText: linkingError.info.reference.$refText
                }
              };
              diagnostics.push(this.toDiagnostic("error", linkingError.message, info2));
            }
          }
        }
        async validateAst(rootNode, options2, cancelToken = cancellation_exports.CancellationToken.None) {
          const validationItems = [];
          const acceptor = /* @__PURE__ */ __name((severity, message, info2) => {
            validationItems.push(this.toDiagnostic(severity, message, info2));
          }, "acceptor");
          await this.validateAstBefore(rootNode, options2, acceptor, cancelToken);
          await this.validateAstNodes(rootNode, options2, acceptor, cancelToken);
          await this.validateAstAfter(rootNode, options2, acceptor, cancelToken);
          return validationItems;
        }
        async validateAstBefore(rootNode, options2, acceptor, cancelToken = cancellation_exports.CancellationToken.None) {
          const checksBefore = this.validationRegistry.checksBefore;
          for (const checkBefore of checksBefore) {
            await interruptAndCheck(cancelToken);
            await checkBefore(rootNode, acceptor, options2.categories ?? [], cancelToken);
          }
        }
        async validateAstNodes(rootNode, options2, acceptor, cancelToken = cancellation_exports.CancellationToken.None) {
          if (this.profiler?.isActive("validating")) {
            const task = this.profiler.createTask("validating", this.languageId);
            task.start();
            try {
              const nodes5 = streamAst(rootNode).iterator();
              for (const node2 of nodes5) {
                task.startSubTask(node2.$type);
                const nodeOptions = this.validateSingleNodeOptions(node2, options2);
                if (nodeOptions.validateNode) {
                  try {
                    const checks = this.validationRegistry.getChecks(node2.$type, options2.categories);
                    for (const check of checks) {
                      await check(node2, acceptor, cancelToken);
                    }
                  } finally {
                    task.stopSubTask(node2.$type);
                  }
                }
                if (!nodeOptions.validateChildren) {
                  nodes5.prune();
                }
              }
            } finally {
              task.stop();
            }
          } else {
            const nodes5 = streamAst(rootNode).iterator();
            for (const node2 of nodes5) {
              await interruptAndCheck(cancelToken);
              const nodeOptions = this.validateSingleNodeOptions(node2, options2);
              if (nodeOptions.validateNode) {
                const checks = this.validationRegistry.getChecks(node2.$type, options2.categories);
                for (const check of checks) {
                  await check(node2, acceptor, cancelToken);
                }
              }
              if (!nodeOptions.validateChildren) {
                nodes5.prune();
              }
            }
          }
        }
        validateSingleNodeOptions(_node, _options) {
          return VALIDATE_EACH_NODE;
        }
        async validateAstAfter(rootNode, options2, acceptor, cancelToken = cancellation_exports.CancellationToken.None) {
          const checksAfter = this.validationRegistry.checksAfter;
          for (const checkAfter of checksAfter) {
            await interruptAndCheck(cancelToken);
            await checkAfter(rootNode, acceptor, options2.categories ?? [], cancelToken);
          }
        }
        toDiagnostic(severity, message, info2) {
          return {
            message,
            range: getDiagnosticRange(info2),
            severity: toDiagnosticSeverity(severity),
            code: info2.code,
            codeDescription: info2.codeDescription,
            tags: info2.tags,
            relatedInformation: info2.relatedInformation,
            data: info2.data,
            source: this.getSource()
          };
        }
        getSource() {
          return this.metadata.languageId;
        }
      };
      __name(getDiagnosticRange, "getDiagnosticRange");
      __name(toDiagnosticSeverity, "toDiagnosticSeverity");
      __name(toDiagnosticData, "toDiagnosticData");
      (function(DocumentValidator2) {
        DocumentValidator2.LexingError = "lexing-error";
        DocumentValidator2.LexingWarning = "lexing-warning";
        DocumentValidator2.LexingInfo = "lexing-info";
        DocumentValidator2.LexingHint = "lexing-hint";
        DocumentValidator2.ParsingError = "parsing-error";
        DocumentValidator2.LinkingError = "linking-error";
      })(DocumentValidator || (DocumentValidator = {}));
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/ast-descriptions.js
  var DefaultAstNodeDescriptionProvider, DefaultReferenceDescriptionProvider;
  var init_ast_descriptions = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/ast-descriptions.js"() {
      "use strict";
      init_cancellation();
      init_syntax_tree();
      init_ast_utils();
      init_cst_utils();
      init_promise_utils();
      init_uri_utils();
      DefaultAstNodeDescriptionProvider = class {
        static {
          __name(this, "DefaultAstNodeDescriptionProvider");
        }
        constructor(services) {
          this.astNodeLocator = services.workspace.AstNodeLocator;
          this.nameProvider = services.references.NameProvider;
        }
        createDescription(node2, name, document2) {
          const doc = document2 ?? getDocument(node2);
          name ?? (name = this.nameProvider.getName(node2));
          const path4 = this.astNodeLocator.getAstNodePath(node2);
          if (!name) {
            throw new Error(`Node at path ${path4} has no name.`);
          }
          let nameNodeSegment;
          const nameSegmentGetter = /* @__PURE__ */ __name(() => nameNodeSegment ?? (nameNodeSegment = toDocumentSegment(this.nameProvider.getNameNode(node2) ?? node2.$cstNode)), "nameSegmentGetter");
          return {
            node: node2,
            name,
            get nameSegment() {
              return nameSegmentGetter();
            },
            selectionSegment: toDocumentSegment(node2.$cstNode),
            type: node2.$type,
            documentUri: doc.uri,
            path: path4
          };
        }
      };
      DefaultReferenceDescriptionProvider = class {
        static {
          __name(this, "DefaultReferenceDescriptionProvider");
        }
        constructor(services) {
          this.nodeLocator = services.workspace.AstNodeLocator;
        }
        async createDescriptions(document2, cancelToken = cancellation_exports.CancellationToken.None) {
          const descr = [];
          const rootNode = document2.parseResult.value;
          for (const astNode of streamAst(rootNode)) {
            await interruptAndCheck(cancelToken);
            streamReferences(astNode).forEach((refInfo) => {
              if (!refInfo.reference.error) {
                descr.push(...this.createInfoDescriptions(refInfo));
              }
            });
          }
          return descr;
        }
        createInfoDescriptions(refInfo) {
          const reference = refInfo.reference;
          if (reference.error || !reference.$refNode) {
            return [];
          }
          let items = [];
          if (isReference(reference) && reference.$nodeDescription) {
            items = [reference.$nodeDescription];
          } else if (isMultiReference(reference)) {
            items = reference.items.map((e3) => e3.$nodeDescription).filter((e3) => e3 !== void 0);
          }
          const sourceUri = getDocument(refInfo.container).uri;
          const sourcePath = this.nodeLocator.getAstNodePath(refInfo.container);
          const descriptions = [];
          const segment = toDocumentSegment(reference.$refNode);
          for (const item of items) {
            descriptions.push({
              sourceUri,
              sourcePath,
              targetUri: item.documentUri,
              targetPath: item.path,
              segment,
              local: UriUtils.equals(item.documentUri, sourceUri)
            });
          }
          return descriptions;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/ast-node-locator.js
  var DefaultAstNodeLocator;
  var init_ast_node_locator = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/ast-node-locator.js"() {
      "use strict";
      DefaultAstNodeLocator = class {
        static {
          __name(this, "DefaultAstNodeLocator");
        }
        constructor() {
          this.segmentSeparator = "/";
          this.indexSeparator = "@";
        }
        getAstNodePath(node2) {
          if (node2.$container) {
            const containerPath = this.getAstNodePath(node2.$container);
            const newSegment = this.getPathSegment(node2);
            const nodePath = containerPath + this.segmentSeparator + newSegment;
            return nodePath;
          }
          return "";
        }
        getPathSegment({ $containerProperty, $containerIndex }) {
          if (!$containerProperty) {
            throw new Error("Missing '$containerProperty' in AST node.");
          }
          if ($containerIndex !== void 0) {
            return $containerProperty + this.indexSeparator + $containerIndex;
          }
          return $containerProperty;
        }
        getAstNode(node2, path4) {
          const segments = path4.split(this.segmentSeparator);
          return segments.reduce((previousValue, currentValue) => {
            if (!previousValue || currentValue.length === 0) {
              return previousValue;
            }
            const propertyIndex = currentValue.indexOf(this.indexSeparator);
            if (propertyIndex > 0) {
              const property2 = currentValue.substring(0, propertyIndex);
              const arrayIndex = parseInt(currentValue.substring(propertyIndex + 1));
              const array4 = previousValue[property2];
              return array4?.[arrayIndex];
            }
            return previousValue[currentValue];
          }, node2);
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/event.js
  var event_exports = {};
  var init_event3 = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/event.js"() {
      "use strict";
      __reExport(event_exports, __toESM(require_events(), 1));
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/configuration.js
  var DefaultConfigurationProvider;
  var init_configuration = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/configuration.js"() {
      "use strict";
      init_event3();
      init_promise_utils();
      DefaultConfigurationProvider = class {
        static {
          __name(this, "DefaultConfigurationProvider");
        }
        constructor(services) {
          this._ready = new Deferred();
          this.onConfigurationSectionUpdateEmitter = new event_exports.Emitter();
          this.settings = {};
          this.workspaceConfig = false;
          this.serviceRegistry = services.ServiceRegistry;
        }
        get ready() {
          return this._ready.promise;
        }
        initialize(params) {
          this.workspaceConfig = params.capabilities.workspace?.configuration ?? false;
        }
        async initialized(params) {
          if (this.workspaceConfig) {
            if (params.register) {
              const languages = this.serviceRegistry.all;
              params.register({
                // Listen to configuration changes for all languages
                section: languages.map((lang) => this.toSectionName(lang.LanguageMetaData.languageId))
              });
            }
            if (params.fetchConfiguration) {
              const configToUpdate = this.serviceRegistry.all.map((lang) => ({
                // Fetch the configuration changes for all languages
                section: this.toSectionName(lang.LanguageMetaData.languageId)
              }));
              const configs = await params.fetchConfiguration(configToUpdate);
              configToUpdate.forEach((conf5, idx) => {
                this.updateSectionConfiguration(conf5.section, configs[idx]);
              });
            }
          }
          this._ready.resolve();
        }
        /**
         *  Updates the cached configurations using the `change` notification parameters.
         *
         * @param change The parameters of a change configuration notification.
         * `settings` property of the change object could be expressed as `Record<string, Record<string, any>>`
         */
        updateConfiguration(change2) {
          if (typeof change2.settings !== "object" || change2.settings === null) {
            return;
          }
          Object.entries(change2.settings).forEach(([section, configuration]) => {
            this.updateSectionConfiguration(section, configuration);
            this.onConfigurationSectionUpdateEmitter.fire({ section, configuration });
          });
        }
        updateSectionConfiguration(section, configuration) {
          this.settings[section] = configuration;
        }
        /**
        * Returns a configuration value stored for the given language.
        *
        * @param language The language id
        * @param configuration Configuration name
        */
        async getConfiguration(language, configuration) {
          await this.ready;
          const sectionName = this.toSectionName(language);
          if (this.settings[sectionName]) {
            return this.settings[sectionName][configuration];
          }
        }
        toSectionName(languageId) {
          return `${languageId}`;
        }
        get onConfigurationSectionUpdate() {
          return this.onConfigurationSectionUpdateEmitter.event;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messages.js
  var require_messages = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messages.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.Message = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType = exports2.RequestType0 = exports2.AbstractMessageSignature = exports2.ParameterStructures = exports2.ResponseError = exports2.ErrorCodes = void 0;
      var is2 = require_is();
      var ErrorCodes;
      (function(ErrorCodes2) {
        ErrorCodes2.ParseError = -32700;
        ErrorCodes2.InvalidRequest = -32600;
        ErrorCodes2.MethodNotFound = -32601;
        ErrorCodes2.InvalidParams = -32602;
        ErrorCodes2.InternalError = -32603;
        ErrorCodes2.jsonrpcReservedErrorRangeStart = -32099;
        ErrorCodes2.serverErrorStart = -32099;
        ErrorCodes2.MessageWriteError = -32099;
        ErrorCodes2.MessageReadError = -32098;
        ErrorCodes2.PendingResponseRejected = -32097;
        ErrorCodes2.ConnectionInactive = -32096;
        ErrorCodes2.ServerNotInitialized = -32002;
        ErrorCodes2.UnknownErrorCode = -32001;
        ErrorCodes2.jsonrpcReservedErrorRangeEnd = -32e3;
        ErrorCodes2.serverErrorEnd = -32e3;
      })(ErrorCodes || (exports2.ErrorCodes = ErrorCodes = {}));
      var ResponseError2 = class _ResponseError extends Error {
        static {
          __name(this, "ResponseError");
        }
        constructor(code, message, data5) {
          super(message);
          this.code = is2.number(code) ? code : ErrorCodes.UnknownErrorCode;
          this.data = data5;
          Object.setPrototypeOf(this, _ResponseError.prototype);
        }
        toJson() {
          const result = {
            code: this.code,
            message: this.message
          };
          if (this.data !== void 0) {
            result.data = this.data;
          }
          return result;
        }
      };
      exports2.ResponseError = ResponseError2;
      var ParameterStructures = class _ParameterStructures {
        static {
          __name(this, "ParameterStructures");
        }
        constructor(kind) {
          this.kind = kind;
        }
        static is(value2) {
          return value2 === _ParameterStructures.auto || value2 === _ParameterStructures.byName || value2 === _ParameterStructures.byPosition;
        }
        toString() {
          return this.kind;
        }
      };
      exports2.ParameterStructures = ParameterStructures;
      ParameterStructures.auto = new ParameterStructures("auto");
      ParameterStructures.byPosition = new ParameterStructures("byPosition");
      ParameterStructures.byName = new ParameterStructures("byName");
      var AbstractMessageSignature = class {
        static {
          __name(this, "AbstractMessageSignature");
        }
        constructor(method, numberOfParams) {
          this.method = method;
          this.numberOfParams = numberOfParams;
        }
        get parameterStructures() {
          return ParameterStructures.auto;
        }
      };
      exports2.AbstractMessageSignature = AbstractMessageSignature;
      var RequestType0 = class extends AbstractMessageSignature {
        static {
          __name(this, "RequestType0");
        }
        constructor(method) {
          super(method, 0);
        }
      };
      exports2.RequestType0 = RequestType0;
      var RequestType = class extends AbstractMessageSignature {
        static {
          __name(this, "RequestType");
        }
        constructor(method, _parameterStructures = ParameterStructures.auto) {
          super(method, 1);
          this._parameterStructures = _parameterStructures;
        }
        get parameterStructures() {
          return this._parameterStructures;
        }
      };
      exports2.RequestType = RequestType;
      var RequestType1 = class extends AbstractMessageSignature {
        static {
          __name(this, "RequestType1");
        }
        constructor(method, _parameterStructures = ParameterStructures.auto) {
          super(method, 1);
          this._parameterStructures = _parameterStructures;
        }
        get parameterStructures() {
          return this._parameterStructures;
        }
      };
      exports2.RequestType1 = RequestType1;
      var RequestType2 = class extends AbstractMessageSignature {
        static {
          __name(this, "RequestType2");
        }
        constructor(method) {
          super(method, 2);
        }
      };
      exports2.RequestType2 = RequestType2;
      var RequestType3 = class extends AbstractMessageSignature {
        static {
          __name(this, "RequestType3");
        }
        constructor(method) {
          super(method, 3);
        }
      };
      exports2.RequestType3 = RequestType3;
      var RequestType4 = class extends AbstractMessageSignature {
        static {
          __name(this, "RequestType4");
        }
        constructor(method) {
          super(method, 4);
        }
      };
      exports2.RequestType4 = RequestType4;
      var RequestType5 = class extends AbstractMessageSignature {
        static {
          __name(this, "RequestType5");
        }
        constructor(method) {
          super(method, 5);
        }
      };
      exports2.RequestType5 = RequestType5;
      var RequestType6 = class extends AbstractMessageSignature {
        static {
          __name(this, "RequestType6");
        }
        constructor(method) {
          super(method, 6);
        }
      };
      exports2.RequestType6 = RequestType6;
      var RequestType7 = class extends AbstractMessageSignature {
        static {
          __name(this, "RequestType7");
        }
        constructor(method) {
          super(method, 7);
        }
      };
      exports2.RequestType7 = RequestType7;
      var RequestType8 = class extends AbstractMessageSignature {
        static {
          __name(this, "RequestType8");
        }
        constructor(method) {
          super(method, 8);
        }
      };
      exports2.RequestType8 = RequestType8;
      var RequestType9 = class extends AbstractMessageSignature {
        static {
          __name(this, "RequestType9");
        }
        constructor(method) {
          super(method, 9);
        }
      };
      exports2.RequestType9 = RequestType9;
      var NotificationType = class extends AbstractMessageSignature {
        static {
          __name(this, "NotificationType");
        }
        constructor(method, _parameterStructures = ParameterStructures.auto) {
          super(method, 1);
          this._parameterStructures = _parameterStructures;
        }
        get parameterStructures() {
          return this._parameterStructures;
        }
      };
      exports2.NotificationType = NotificationType;
      var NotificationType0 = class extends AbstractMessageSignature {
        static {
          __name(this, "NotificationType0");
        }
        constructor(method) {
          super(method, 0);
        }
      };
      exports2.NotificationType0 = NotificationType0;
      var NotificationType1 = class extends AbstractMessageSignature {
        static {
          __name(this, "NotificationType1");
        }
        constructor(method, _parameterStructures = ParameterStructures.auto) {
          super(method, 1);
          this._parameterStructures = _parameterStructures;
        }
        get parameterStructures() {
          return this._parameterStructures;
        }
      };
      exports2.NotificationType1 = NotificationType1;
      var NotificationType2 = class extends AbstractMessageSignature {
        static {
          __name(this, "NotificationType2");
        }
        constructor(method) {
          super(method, 2);
        }
      };
      exports2.NotificationType2 = NotificationType2;
      var NotificationType3 = class extends AbstractMessageSignature {
        static {
          __name(this, "NotificationType3");
        }
        constructor(method) {
          super(method, 3);
        }
      };
      exports2.NotificationType3 = NotificationType3;
      var NotificationType4 = class extends AbstractMessageSignature {
        static {
          __name(this, "NotificationType4");
        }
        constructor(method) {
          super(method, 4);
        }
      };
      exports2.NotificationType4 = NotificationType4;
      var NotificationType5 = class extends AbstractMessageSignature {
        static {
          __name(this, "NotificationType5");
        }
        constructor(method) {
          super(method, 5);
        }
      };
      exports2.NotificationType5 = NotificationType5;
      var NotificationType6 = class extends AbstractMessageSignature {
        static {
          __name(this, "NotificationType6");
        }
        constructor(method) {
          super(method, 6);
        }
      };
      exports2.NotificationType6 = NotificationType6;
      var NotificationType7 = class extends AbstractMessageSignature {
        static {
          __name(this, "NotificationType7");
        }
        constructor(method) {
          super(method, 7);
        }
      };
      exports2.NotificationType7 = NotificationType7;
      var NotificationType8 = class extends AbstractMessageSignature {
        static {
          __name(this, "NotificationType8");
        }
        constructor(method) {
          super(method, 8);
        }
      };
      exports2.NotificationType8 = NotificationType8;
      var NotificationType9 = class extends AbstractMessageSignature {
        static {
          __name(this, "NotificationType9");
        }
        constructor(method) {
          super(method, 9);
        }
      };
      exports2.NotificationType9 = NotificationType9;
      var Message;
      (function(Message2) {
        function isRequest(message) {
          const candidate = message;
          return candidate && is2.string(candidate.method) && (is2.string(candidate.id) || is2.number(candidate.id));
        }
        __name(isRequest, "isRequest");
        Message2.isRequest = isRequest;
        function isNotification(message) {
          const candidate = message;
          return candidate && is2.string(candidate.method) && message.id === void 0;
        }
        __name(isNotification, "isNotification");
        Message2.isNotification = isNotification;
        function isResponse(message) {
          const candidate = message;
          return candidate && (candidate.result !== void 0 || !!candidate.error) && (is2.string(candidate.id) || is2.number(candidate.id) || candidate.id === null);
        }
        __name(isResponse, "isResponse");
        Message2.isResponse = isResponse;
      })(Message || (exports2.Message = Message = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/linkedMap.js
  var require_linkedMap = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(exports2) {
      "use strict";
      var _a;
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.LRUCache = exports2.LinkedMap = exports2.Touch = void 0;
      var Touch;
      (function(Touch2) {
        Touch2.None = 0;
        Touch2.First = 1;
        Touch2.AsOld = Touch2.First;
        Touch2.Last = 2;
        Touch2.AsNew = Touch2.Last;
      })(Touch || (exports2.Touch = Touch = {}));
      var LinkedMap = class {
        static {
          __name(this, "LinkedMap");
        }
        constructor() {
          this[_a] = "LinkedMap";
          this._map = /* @__PURE__ */ new Map();
          this._head = void 0;
          this._tail = void 0;
          this._size = 0;
          this._state = 0;
        }
        clear() {
          this._map.clear();
          this._head = void 0;
          this._tail = void 0;
          this._size = 0;
          this._state++;
        }
        isEmpty() {
          return !this._head && !this._tail;
        }
        get size() {
          return this._size;
        }
        get first() {
          return this._head?.value;
        }
        get last() {
          return this._tail?.value;
        }
        has(key) {
          return this._map.has(key);
        }
        get(key, touch = Touch.None) {
          const item = this._map.get(key);
          if (!item) {
            return void 0;
          }
          if (touch !== Touch.None) {
            this.touch(item, touch);
          }
          return item.value;
        }
        set(key, value2, touch = Touch.None) {
          let item = this._map.get(key);
          if (item) {
            item.value = value2;
            if (touch !== Touch.None) {
              this.touch(item, touch);
            }
          } else {
            item = { key, value: value2, next: void 0, previous: void 0 };
            switch (touch) {
              case Touch.None:
                this.addItemLast(item);
                break;
              case Touch.First:
                this.addItemFirst(item);
                break;
              case Touch.Last:
                this.addItemLast(item);
                break;
              default:
                this.addItemLast(item);
                break;
            }
            this._map.set(key, item);
            this._size++;
          }
          return this;
        }
        delete(key) {
          return !!this.remove(key);
        }
        remove(key) {
          const item = this._map.get(key);
          if (!item) {
            return void 0;
          }
          this._map.delete(key);
          this.removeItem(item);
          this._size--;
          return item.value;
        }
        shift() {
          if (!this._head && !this._tail) {
            return void 0;
          }
          if (!this._head || !this._tail) {
            throw new Error("Invalid list");
          }
          const item = this._head;
          this._map.delete(item.key);
          this.removeItem(item);
          this._size--;
          return item.value;
        }
        forEach(callbackfn, thisArg) {
          const state4 = this._state;
          let current = this._head;
          while (current) {
            if (thisArg) {
              callbackfn.bind(thisArg)(current.value, current.key, this);
            } else {
              callbackfn(current.value, current.key, this);
            }
            if (this._state !== state4) {
              throw new Error(`LinkedMap got modified during iteration.`);
            }
            current = current.next;
          }
        }
        keys() {
          const state4 = this._state;
          let current = this._head;
          const iterator = {
            [Symbol.iterator]: () => {
              return iterator;
            },
            next: /* @__PURE__ */ __name(() => {
              if (this._state !== state4) {
                throw new Error(`LinkedMap got modified during iteration.`);
              }
              if (current) {
                const result = { value: current.key, done: false };
                current = current.next;
                return result;
              } else {
                return { value: void 0, done: true };
              }
            }, "next")
          };
          return iterator;
        }
        values() {
          const state4 = this._state;
          let current = this._head;
          const iterator = {
            [Symbol.iterator]: () => {
              return iterator;
            },
            next: /* @__PURE__ */ __name(() => {
              if (this._state !== state4) {
                throw new Error(`LinkedMap got modified during iteration.`);
              }
              if (current) {
                const result = { value: current.value, done: false };
                current = current.next;
                return result;
              } else {
                return { value: void 0, done: true };
              }
            }, "next")
          };
          return iterator;
        }
        entries() {
          const state4 = this._state;
          let current = this._head;
          const iterator = {
            [Symbol.iterator]: () => {
              return iterator;
            },
            next: /* @__PURE__ */ __name(() => {
              if (this._state !== state4) {
                throw new Error(`LinkedMap got modified during iteration.`);
              }
              if (current) {
                const result = { value: [current.key, current.value], done: false };
                current = current.next;
                return result;
              } else {
                return { value: void 0, done: true };
              }
            }, "next")
          };
          return iterator;
        }
        [(_a = Symbol.toStringTag, Symbol.iterator)]() {
          return this.entries();
        }
        trimOld(newSize) {
          if (newSize >= this.size) {
            return;
          }
          if (newSize === 0) {
            this.clear();
            return;
          }
          let current = this._head;
          let currentSize = this.size;
          while (current && currentSize > newSize) {
            this._map.delete(current.key);
            current = current.next;
            currentSize--;
          }
          this._head = current;
          this._size = currentSize;
          if (current) {
            current.previous = void 0;
          }
          this._state++;
        }
        addItemFirst(item) {
          if (!this._head && !this._tail) {
            this._tail = item;
          } else if (!this._head) {
            throw new Error("Invalid list");
          } else {
            item.next = this._head;
            this._head.previous = item;
          }
          this._head = item;
          this._state++;
        }
        addItemLast(item) {
          if (!this._head && !this._tail) {
            this._head = item;
          } else if (!this._tail) {
            throw new Error("Invalid list");
          } else {
            item.previous = this._tail;
            this._tail.next = item;
          }
          this._tail = item;
          this._state++;
        }
        removeItem(item) {
          if (item === this._head && item === this._tail) {
            this._head = void 0;
            this._tail = void 0;
          } else if (item === this._head) {
            if (!item.next) {
              throw new Error("Invalid list");
            }
            item.next.previous = void 0;
            this._head = item.next;
          } else if (item === this._tail) {
            if (!item.previous) {
              throw new Error("Invalid list");
            }
            item.previous.next = void 0;
            this._tail = item.previous;
          } else {
            const next3 = item.next;
            const previous = item.previous;
            if (!next3 || !previous) {
              throw new Error("Invalid list");
            }
            next3.previous = previous;
            previous.next = next3;
          }
          item.next = void 0;
          item.previous = void 0;
          this._state++;
        }
        touch(item, touch) {
          if (!this._head || !this._tail) {
            throw new Error("Invalid list");
          }
          if (touch !== Touch.First && touch !== Touch.Last) {
            return;
          }
          if (touch === Touch.First) {
            if (item === this._head) {
              return;
            }
            const next3 = item.next;
            const previous = item.previous;
            if (item === this._tail) {
              previous.next = void 0;
              this._tail = previous;
            } else {
              next3.previous = previous;
              previous.next = next3;
            }
            item.previous = void 0;
            item.next = this._head;
            this._head.previous = item;
            this._head = item;
            this._state++;
          } else if (touch === Touch.Last) {
            if (item === this._tail) {
              return;
            }
            const next3 = item.next;
            const previous = item.previous;
            if (item === this._head) {
              next3.previous = void 0;
              this._head = next3;
            } else {
              next3.previous = previous;
              previous.next = next3;
            }
            item.next = void 0;
            item.previous = this._tail;
            this._tail.next = item;
            this._tail = item;
            this._state++;
          }
        }
        toJSON() {
          const data5 = [];
          this.forEach((value2, key) => {
            data5.push([key, value2]);
          });
          return data5;
        }
        fromJSON(data5) {
          this.clear();
          for (const [key, value2] of data5) {
            this.set(key, value2);
          }
        }
      };
      exports2.LinkedMap = LinkedMap;
      var LRUCache = class extends LinkedMap {
        static {
          __name(this, "LRUCache");
        }
        constructor(limit2, ratio = 1) {
          super();
          this._limit = limit2;
          this._ratio = Math.min(Math.max(0, ratio), 1);
        }
        get limit() {
          return this._limit;
        }
        set limit(limit2) {
          this._limit = limit2;
          this.checkTrim();
        }
        get ratio() {
          return this._ratio;
        }
        set ratio(ratio) {
          this._ratio = Math.min(Math.max(0, ratio), 1);
          this.checkTrim();
        }
        get(key, touch = Touch.AsNew) {
          return super.get(key, touch);
        }
        peek(key) {
          return super.get(key, Touch.None);
        }
        set(key, value2) {
          super.set(key, value2, Touch.Last);
          this.checkTrim();
          return this;
        }
        checkTrim() {
          if (this.size > this._limit) {
            this.trimOld(Math.round(this._limit * this._ratio));
          }
        }
      };
      exports2.LRUCache = LRUCache;
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/disposable.js
  var require_disposable = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/disposable.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.Disposable = void 0;
      var Disposable2;
      (function(Disposable3) {
        function create4(func) {
          return {
            dispose: func
          };
        }
        __name(create4, "create");
        Disposable3.create = create4;
      })(Disposable2 || (exports2.Disposable = Disposable2 = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js
  var require_sharedArrayCancellation = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.SharedArrayReceiverStrategy = exports2.SharedArraySenderStrategy = void 0;
      var cancellation_1 = require_cancellation();
      var CancellationState;
      (function(CancellationState2) {
        CancellationState2.Continue = 0;
        CancellationState2.Cancelled = 1;
      })(CancellationState || (CancellationState = {}));
      var SharedArraySenderStrategy = class {
        static {
          __name(this, "SharedArraySenderStrategy");
        }
        constructor() {
          this.buffers = /* @__PURE__ */ new Map();
        }
        enableCancellation(request) {
          if (request.id === null) {
            return;
          }
          const buffer = new SharedArrayBuffer(4);
          const data5 = new Int32Array(buffer, 0, 1);
          data5[0] = CancellationState.Continue;
          this.buffers.set(request.id, buffer);
          request.$cancellationData = buffer;
        }
        async sendCancellation(_conn, id34) {
          const buffer = this.buffers.get(id34);
          if (buffer === void 0) {
            return;
          }
          const data5 = new Int32Array(buffer, 0, 1);
          Atomics.store(data5, 0, CancellationState.Cancelled);
        }
        cleanup(id34) {
          this.buffers.delete(id34);
        }
        dispose() {
          this.buffers.clear();
        }
      };
      exports2.SharedArraySenderStrategy = SharedArraySenderStrategy;
      var SharedArrayBufferCancellationToken = class {
        static {
          __name(this, "SharedArrayBufferCancellationToken");
        }
        constructor(buffer) {
          this.data = new Int32Array(buffer, 0, 1);
        }
        get isCancellationRequested() {
          return Atomics.load(this.data, 0) === CancellationState.Cancelled;
        }
        get onCancellationRequested() {
          throw new Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`);
        }
      };
      var SharedArrayBufferCancellationTokenSource = class {
        static {
          __name(this, "SharedArrayBufferCancellationTokenSource");
        }
        constructor(buffer) {
          this.token = new SharedArrayBufferCancellationToken(buffer);
        }
        cancel() {
        }
        dispose() {
        }
      };
      var SharedArrayReceiverStrategy = class {
        static {
          __name(this, "SharedArrayReceiverStrategy");
        }
        constructor() {
          this.kind = "request";
        }
        createCancellationTokenSource(request) {
          const buffer = request.$cancellationData;
          if (buffer === void 0) {
            return new cancellation_1.CancellationTokenSource();
          }
          return new SharedArrayBufferCancellationTokenSource(buffer);
        }
      };
      exports2.SharedArrayReceiverStrategy = SharedArrayReceiverStrategy;
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/semaphore.js
  var require_semaphore = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/semaphore.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.Semaphore = void 0;
      var ral_1 = require_ral();
      var Semaphore = class {
        static {
          __name(this, "Semaphore");
        }
        constructor(capacity = 1) {
          if (capacity <= 0) {
            throw new Error("Capacity must be greater than 0");
          }
          this._capacity = capacity;
          this._active = 0;
          this._waiting = [];
        }
        lock(thunk) {
          return new Promise((resolve2, reject3) => {
            this._waiting.push({ thunk, resolve: resolve2, reject: reject3 });
            this.runNext();
          });
        }
        get active() {
          return this._active;
        }
        runNext() {
          if (this._waiting.length === 0 || this._active === this._capacity) {
            return;
          }
          (0, ral_1.default)().timer.setImmediate(() => this.doRunNext());
        }
        doRunNext() {
          if (this._waiting.length === 0 || this._active === this._capacity) {
            return;
          }
          const next3 = this._waiting.shift();
          this._active++;
          if (this._active > this._capacity) {
            throw new Error(`To many thunks active`);
          }
          try {
            const result = next3.thunk();
            if (result instanceof Promise) {
              result.then((value2) => {
                this._active--;
                next3.resolve(value2);
                this.runNext();
              }, (err) => {
                this._active--;
                next3.reject(err);
                this.runNext();
              });
            } else {
              this._active--;
              next3.resolve(result);
              this.runNext();
            }
          } catch (err) {
            this._active--;
            next3.reject(err);
            this.runNext();
          }
        }
      };
      exports2.Semaphore = Semaphore;
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageReader.js
  var require_messageReader = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageReader.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = void 0;
      var ral_1 = require_ral();
      var Is2 = require_is();
      var events_1 = require_events();
      var semaphore_1 = require_semaphore();
      var MessageReader;
      (function(MessageReader2) {
        function is2(value2) {
          let candidate = value2;
          return candidate && Is2.func(candidate.listen) && Is2.func(candidate.dispose) && Is2.func(candidate.onError) && Is2.func(candidate.onClose) && Is2.func(candidate.onPartialMessage);
        }
        __name(is2, "is");
        MessageReader2.is = is2;
      })(MessageReader || (exports2.MessageReader = MessageReader = {}));
      var AbstractMessageReader = class {
        static {
          __name(this, "AbstractMessageReader");
        }
        constructor() {
          this.errorEmitter = new events_1.Emitter();
          this.closeEmitter = new events_1.Emitter();
          this.partialMessageEmitter = new events_1.Emitter();
        }
        dispose() {
          this.errorEmitter.dispose();
          this.closeEmitter.dispose();
        }
        get onError() {
          return this.errorEmitter.event;
        }
        fireError(error3) {
          this.errorEmitter.fire(this.asError(error3));
        }
        get onClose() {
          return this.closeEmitter.event;
        }
        fireClose() {
          this.closeEmitter.fire(void 0);
        }
        get onPartialMessage() {
          return this.partialMessageEmitter.event;
        }
        firePartialMessage(info2) {
          this.partialMessageEmitter.fire(info2);
        }
        asError(error3) {
          if (error3 instanceof Error) {
            return error3;
          } else {
            return new Error(`Reader received error. Reason: ${Is2.string(error3.message) ? error3.message : "unknown"}`);
          }
        }
      };
      exports2.AbstractMessageReader = AbstractMessageReader;
      var ResolvedMessageReaderOptions;
      (function(ResolvedMessageReaderOptions2) {
        function fromOptions(options2) {
          let charset;
          let result;
          let contentDecoder;
          const contentDecoders = /* @__PURE__ */ new Map();
          let contentTypeDecoder;
          const contentTypeDecoders = /* @__PURE__ */ new Map();
          if (options2 === void 0 || typeof options2 === "string") {
            charset = options2 ?? "utf-8";
          } else {
            charset = options2.charset ?? "utf-8";
            if (options2.contentDecoder !== void 0) {
              contentDecoder = options2.contentDecoder;
              contentDecoders.set(contentDecoder.name, contentDecoder);
            }
            if (options2.contentDecoders !== void 0) {
              for (const decoder2 of options2.contentDecoders) {
                contentDecoders.set(decoder2.name, decoder2);
              }
            }
            if (options2.contentTypeDecoder !== void 0) {
              contentTypeDecoder = options2.contentTypeDecoder;
              contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
            }
            if (options2.contentTypeDecoders !== void 0) {
              for (const decoder2 of options2.contentTypeDecoders) {
                contentTypeDecoders.set(decoder2.name, decoder2);
              }
            }
          }
          if (contentTypeDecoder === void 0) {
            contentTypeDecoder = (0, ral_1.default)().applicationJson.decoder;
            contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
          }
          return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders };
        }
        __name(fromOptions, "fromOptions");
        ResolvedMessageReaderOptions2.fromOptions = fromOptions;
      })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {}));
      var ReadableStreamMessageReader = class extends AbstractMessageReader {
        static {
          __name(this, "ReadableStreamMessageReader");
        }
        constructor(readable, options2) {
          super();
          this.readable = readable;
          this.options = ResolvedMessageReaderOptions.fromOptions(options2);
          this.buffer = (0, ral_1.default)().messageBuffer.create(this.options.charset);
          this._partialMessageTimeout = 1e4;
          this.nextMessageLength = -1;
          this.messageToken = 0;
          this.readSemaphore = new semaphore_1.Semaphore(1);
        }
        set partialMessageTimeout(timeout2) {
          this._partialMessageTimeout = timeout2;
        }
        get partialMessageTimeout() {
          return this._partialMessageTimeout;
        }
        listen(callback) {
          this.nextMessageLength = -1;
          this.messageToken = 0;
          this.partialMessageTimer = void 0;
          this.callback = callback;
          const result = this.readable.onData((data5) => {
            this.onData(data5);
          });
          this.readable.onError((error3) => this.fireError(error3));
          this.readable.onClose(() => this.fireClose());
          return result;
        }
        onData(data5) {
          try {
            this.buffer.append(data5);
            while (true) {
              if (this.nextMessageLength === -1) {
                const headers = this.buffer.tryReadHeaders(true);
                if (!headers) {
                  return;
                }
                const contentLength = headers.get("content-length");
                if (!contentLength) {
                  this.fireError(new Error(`Header must provide a Content-Length property.
${JSON.stringify(Object.fromEntries(headers))}`));
                  return;
                }
                const length2 = parseInt(contentLength);
                if (isNaN(length2)) {
                  this.fireError(new Error(`Content-Length value must be a number. Got ${contentLength}`));
                  return;
                }
                this.nextMessageLength = length2;
              }
              const body = this.buffer.tryReadBody(this.nextMessageLength);
              if (body === void 0) {
                this.setPartialMessageTimer();
                return;
              }
              this.clearPartialMessageTimer();
              this.nextMessageLength = -1;
              this.readSemaphore.lock(async () => {
                const bytes = this.options.contentDecoder !== void 0 ? await this.options.contentDecoder.decode(body) : body;
                const message = await this.options.contentTypeDecoder.decode(bytes, this.options);
                this.callback(message);
              }).catch((error3) => {
                this.fireError(error3);
              });
            }
          } catch (error3) {
            this.fireError(error3);
          }
        }
        clearPartialMessageTimer() {
          if (this.partialMessageTimer) {
            this.partialMessageTimer.dispose();
            this.partialMessageTimer = void 0;
          }
        }
        setPartialMessageTimer() {
          this.clearPartialMessageTimer();
          if (this._partialMessageTimeout <= 0) {
            return;
          }
          this.partialMessageTimer = (0, ral_1.default)().timer.setTimeout((token2, timeout2) => {
            this.partialMessageTimer = void 0;
            if (token2 === this.messageToken) {
              this.firePartialMessage({ messageToken: token2, waitingTime: timeout2 });
              this.setPartialMessageTimer();
            }
          }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
        }
      };
      exports2.ReadableStreamMessageReader = ReadableStreamMessageReader;
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageWriter.js
  var require_messageWriter = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = void 0;
      var ral_1 = require_ral();
      var Is2 = require_is();
      var semaphore_1 = require_semaphore();
      var events_1 = require_events();
      var ContentLength = "Content-Length: ";
      var CRLF = "\r\n";
      var MessageWriter;
      (function(MessageWriter2) {
        function is2(value2) {
          let candidate = value2;
          return candidate && Is2.func(candidate.dispose) && Is2.func(candidate.onClose) && Is2.func(candidate.onError) && Is2.func(candidate.write);
        }
        __name(is2, "is");
        MessageWriter2.is = is2;
      })(MessageWriter || (exports2.MessageWriter = MessageWriter = {}));
      var AbstractMessageWriter = class {
        static {
          __name(this, "AbstractMessageWriter");
        }
        constructor() {
          this.errorEmitter = new events_1.Emitter();
          this.closeEmitter = new events_1.Emitter();
        }
        dispose() {
          this.errorEmitter.dispose();
          this.closeEmitter.dispose();
        }
        get onError() {
          return this.errorEmitter.event;
        }
        fireError(error3, message, count2) {
          this.errorEmitter.fire([this.asError(error3), message, count2]);
        }
        get onClose() {
          return this.closeEmitter.event;
        }
        fireClose() {
          this.closeEmitter.fire(void 0);
        }
        asError(error3) {
          if (error3 instanceof Error) {
            return error3;
          } else {
            return new Error(`Writer received error. Reason: ${Is2.string(error3.message) ? error3.message : "unknown"}`);
          }
        }
      };
      exports2.AbstractMessageWriter = AbstractMessageWriter;
      var ResolvedMessageWriterOptions;
      (function(ResolvedMessageWriterOptions2) {
        function fromOptions(options2) {
          if (options2 === void 0 || typeof options2 === "string") {
            return { charset: options2 ?? "utf-8", contentTypeEncoder: (0, ral_1.default)().applicationJson.encoder };
          } else {
            return { charset: options2.charset ?? "utf-8", contentEncoder: options2.contentEncoder, contentTypeEncoder: options2.contentTypeEncoder ?? (0, ral_1.default)().applicationJson.encoder };
          }
        }
        __name(fromOptions, "fromOptions");
        ResolvedMessageWriterOptions2.fromOptions = fromOptions;
      })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {}));
      var WriteableStreamMessageWriter = class extends AbstractMessageWriter {
        static {
          __name(this, "WriteableStreamMessageWriter");
        }
        constructor(writable, options2) {
          super();
          this.writable = writable;
          this.options = ResolvedMessageWriterOptions.fromOptions(options2);
          this.errorCount = 0;
          this.writeSemaphore = new semaphore_1.Semaphore(1);
          this.writable.onError((error3) => this.fireError(error3));
          this.writable.onClose(() => this.fireClose());
        }
        async write(msg) {
          return this.writeSemaphore.lock(async () => {
            const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => {
              if (this.options.contentEncoder !== void 0) {
                return this.options.contentEncoder.encode(buffer);
              } else {
                return buffer;
              }
            });
            return payload.then((buffer) => {
              const headers = [];
              headers.push(ContentLength, buffer.byteLength.toString(), CRLF);
              headers.push(CRLF);
              return this.doWrite(msg, headers, buffer);
            }, (error3) => {
              this.fireError(error3);
              throw error3;
            });
          });
        }
        async doWrite(msg, headers, data5) {
          try {
            await this.writable.write(headers.join(""), "ascii");
            return this.writable.write(data5);
          } catch (error3) {
            this.handleError(error3, msg);
            return Promise.reject(error3);
          }
        }
        handleError(error3, msg) {
          this.errorCount++;
          this.fireError(error3, msg, this.errorCount);
        }
        end() {
          this.writable.end();
        }
      };
      exports2.WriteableStreamMessageWriter = WriteableStreamMessageWriter;
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js
  var require_messageBuffer = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.AbstractMessageBuffer = void 0;
      var CR2 = 13;
      var LF = 10;
      var CRLF = "\r\n";
      var AbstractMessageBuffer = class {
        static {
          __name(this, "AbstractMessageBuffer");
        }
        constructor(encoding = "utf-8") {
          this._encoding = encoding;
          this._chunks = [];
          this._totalLength = 0;
        }
        get encoding() {
          return this._encoding;
        }
        append(chunk) {
          const toAppend = typeof chunk === "string" ? this.fromString(chunk, this._encoding) : chunk;
          this._chunks.push(toAppend);
          this._totalLength += toAppend.byteLength;
        }
        tryReadHeaders(lowerCaseKeys = false) {
          if (this._chunks.length === 0) {
            return void 0;
          }
          let state4 = 0;
          let chunkIndex = 0;
          let offset = 0;
          let chunkBytesRead = 0;
          row: while (chunkIndex < this._chunks.length) {
            const chunk = this._chunks[chunkIndex];
            offset = 0;
            column: while (offset < chunk.length) {
              const value2 = chunk[offset];
              switch (value2) {
                case CR2:
                  switch (state4) {
                    case 0:
                      state4 = 1;
                      break;
                    case 2:
                      state4 = 3;
                      break;
                    default:
                      state4 = 0;
                  }
                  break;
                case LF:
                  switch (state4) {
                    case 1:
                      state4 = 2;
                      break;
                    case 3:
                      state4 = 4;
                      offset++;
                      break row;
                    default:
                      state4 = 0;
                  }
                  break;
                default:
                  state4 = 0;
              }
              offset++;
            }
            chunkBytesRead += chunk.byteLength;
            chunkIndex++;
          }
          if (state4 !== 4) {
            return void 0;
          }
          const buffer = this._read(chunkBytesRead + offset);
          const result = /* @__PURE__ */ new Map();
          const headers = this.toString(buffer, "ascii").split(CRLF);
          if (headers.length < 2) {
            return result;
          }
          for (let i2 = 0; i2 < headers.length - 2; i2++) {
            const header = headers[i2];
            const index = header.indexOf(":");
            if (index === -1) {
              throw new Error(`Message header must separate key and value using ':'
${header}`);
            }
            const key = header.substr(0, index);
            const value2 = header.substr(index + 1).trim();
            result.set(lowerCaseKeys ? key.toLowerCase() : key, value2);
          }
          return result;
        }
        tryReadBody(length2) {
          if (this._totalLength < length2) {
            return void 0;
          }
          return this._read(length2);
        }
        get numberOfBytes() {
          return this._totalLength;
        }
        _read(byteCount) {
          if (byteCount === 0) {
            return this.emptyBuffer();
          }
          if (byteCount > this._totalLength) {
            throw new Error(`Cannot read so many bytes!`);
          }
          if (this._chunks[0].byteLength === byteCount) {
            const chunk = this._chunks[0];
            this._chunks.shift();
            this._totalLength -= byteCount;
            return this.asNative(chunk);
          }
          if (this._chunks[0].byteLength > byteCount) {
            const chunk = this._chunks[0];
            const result2 = this.asNative(chunk, byteCount);
            this._chunks[0] = chunk.slice(byteCount);
            this._totalLength -= byteCount;
            return result2;
          }
          const result = this.allocNative(byteCount);
          let resultOffset = 0;
          let chunkIndex = 0;
          while (byteCount > 0) {
            const chunk = this._chunks[chunkIndex];
            if (chunk.byteLength > byteCount) {
              const chunkPart = chunk.slice(0, byteCount);
              result.set(chunkPart, resultOffset);
              resultOffset += byteCount;
              this._chunks[chunkIndex] = chunk.slice(byteCount);
              this._totalLength -= byteCount;
              byteCount -= byteCount;
            } else {
              result.set(chunk, resultOffset);
              resultOffset += chunk.byteLength;
              this._chunks.shift();
              this._totalLength -= chunk.byteLength;
              byteCount -= chunk.byteLength;
            }
          }
          return result;
        }
      };
      exports2.AbstractMessageBuffer = AbstractMessageBuffer;
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/connection.js
  var require_connection = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/connection.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.createMessageConnection = exports2.ConnectionOptions = exports2.MessageStrategy = exports2.CancellationStrategy = exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.RequestCancellationReceiverStrategy = exports2.IdCancellationReceiverStrategy = exports2.ConnectionStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.TraceValues = exports2.Trace = exports2.NullLogger = exports2.ProgressType = exports2.ProgressToken = void 0;
      var ral_1 = require_ral();
      var Is2 = require_is();
      var messages_1 = require_messages();
      var linkedMap_1 = require_linkedMap();
      var events_1 = require_events();
      var cancellation_1 = require_cancellation();
      var CancelNotification;
      (function(CancelNotification2) {
        CancelNotification2.type = new messages_1.NotificationType("$/cancelRequest");
      })(CancelNotification || (CancelNotification = {}));
      var ProgressToken;
      (function(ProgressToken2) {
        function is2(value2) {
          return typeof value2 === "string" || typeof value2 === "number";
        }
        __name(is2, "is");
        ProgressToken2.is = is2;
      })(ProgressToken || (exports2.ProgressToken = ProgressToken = {}));
      var ProgressNotification;
      (function(ProgressNotification2) {
        ProgressNotification2.type = new messages_1.NotificationType("$/progress");
      })(ProgressNotification || (ProgressNotification = {}));
      var ProgressType = class {
        static {
          __name(this, "ProgressType");
        }
        constructor() {
        }
      };
      exports2.ProgressType = ProgressType;
      var StarRequestHandler;
      (function(StarRequestHandler2) {
        function is2(value2) {
          return Is2.func(value2);
        }
        __name(is2, "is");
        StarRequestHandler2.is = is2;
      })(StarRequestHandler || (StarRequestHandler = {}));
      exports2.NullLogger = Object.freeze({
        error: /* @__PURE__ */ __name(() => {
        }, "error"),
        warn: /* @__PURE__ */ __name(() => {
        }, "warn"),
        info: /* @__PURE__ */ __name(() => {
        }, "info"),
        log: /* @__PURE__ */ __name(() => {
        }, "log")
      });
      var Trace;
      (function(Trace2) {
        Trace2[Trace2["Off"] = 0] = "Off";
        Trace2[Trace2["Messages"] = 1] = "Messages";
        Trace2[Trace2["Compact"] = 2] = "Compact";
        Trace2[Trace2["Verbose"] = 3] = "Verbose";
      })(Trace || (exports2.Trace = Trace = {}));
      var TraceValues;
      (function(TraceValues2) {
        TraceValues2.Off = "off";
        TraceValues2.Messages = "messages";
        TraceValues2.Compact = "compact";
        TraceValues2.Verbose = "verbose";
      })(TraceValues || (exports2.TraceValues = TraceValues = {}));
      (function(Trace2) {
        function fromString(value2) {
          if (!Is2.string(value2)) {
            return Trace2.Off;
          }
          value2 = value2.toLowerCase();
          switch (value2) {
            case "off":
              return Trace2.Off;
            case "messages":
              return Trace2.Messages;
            case "compact":
              return Trace2.Compact;
            case "verbose":
              return Trace2.Verbose;
            default:
              return Trace2.Off;
          }
        }
        __name(fromString, "fromString");
        Trace2.fromString = fromString;
        function toString6(value2) {
          switch (value2) {
            case Trace2.Off:
              return "off";
            case Trace2.Messages:
              return "messages";
            case Trace2.Compact:
              return "compact";
            case Trace2.Verbose:
              return "verbose";
            default:
              return "off";
          }
        }
        __name(toString6, "toString");
        Trace2.toString = toString6;
      })(Trace || (exports2.Trace = Trace = {}));
      var TraceFormat;
      (function(TraceFormat2) {
        TraceFormat2["Text"] = "text";
        TraceFormat2["JSON"] = "json";
      })(TraceFormat || (exports2.TraceFormat = TraceFormat = {}));
      (function(TraceFormat2) {
        function fromString(value2) {
          if (!Is2.string(value2)) {
            return TraceFormat2.Text;
          }
          value2 = value2.toLowerCase();
          if (value2 === "json") {
            return TraceFormat2.JSON;
          } else {
            return TraceFormat2.Text;
          }
        }
        __name(fromString, "fromString");
        TraceFormat2.fromString = fromString;
      })(TraceFormat || (exports2.TraceFormat = TraceFormat = {}));
      var SetTraceNotification;
      (function(SetTraceNotification2) {
        SetTraceNotification2.type = new messages_1.NotificationType("$/setTrace");
      })(SetTraceNotification || (exports2.SetTraceNotification = SetTraceNotification = {}));
      var LogTraceNotification;
      (function(LogTraceNotification2) {
        LogTraceNotification2.type = new messages_1.NotificationType("$/logTrace");
      })(LogTraceNotification || (exports2.LogTraceNotification = LogTraceNotification = {}));
      var ConnectionErrors;
      (function(ConnectionErrors2) {
        ConnectionErrors2[ConnectionErrors2["Closed"] = 1] = "Closed";
        ConnectionErrors2[ConnectionErrors2["Disposed"] = 2] = "Disposed";
        ConnectionErrors2[ConnectionErrors2["AlreadyListening"] = 3] = "AlreadyListening";
      })(ConnectionErrors || (exports2.ConnectionErrors = ConnectionErrors = {}));
      var ConnectionError = class _ConnectionError extends Error {
        static {
          __name(this, "ConnectionError");
        }
        constructor(code, message) {
          super(message);
          this.code = code;
          Object.setPrototypeOf(this, _ConnectionError.prototype);
        }
      };
      exports2.ConnectionError = ConnectionError;
      var ConnectionStrategy;
      (function(ConnectionStrategy2) {
        function is2(value2) {
          const candidate = value2;
          return candidate && Is2.func(candidate.cancelUndispatched);
        }
        __name(is2, "is");
        ConnectionStrategy2.is = is2;
      })(ConnectionStrategy || (exports2.ConnectionStrategy = ConnectionStrategy = {}));
      var IdCancellationReceiverStrategy;
      (function(IdCancellationReceiverStrategy2) {
        function is2(value2) {
          const candidate = value2;
          return candidate && (candidate.kind === void 0 || candidate.kind === "id") && Is2.func(candidate.createCancellationTokenSource) && (candidate.dispose === void 0 || Is2.func(candidate.dispose));
        }
        __name(is2, "is");
        IdCancellationReceiverStrategy2.is = is2;
      })(IdCancellationReceiverStrategy || (exports2.IdCancellationReceiverStrategy = IdCancellationReceiverStrategy = {}));
      var RequestCancellationReceiverStrategy;
      (function(RequestCancellationReceiverStrategy2) {
        function is2(value2) {
          const candidate = value2;
          return candidate && candidate.kind === "request" && Is2.func(candidate.createCancellationTokenSource) && (candidate.dispose === void 0 || Is2.func(candidate.dispose));
        }
        __name(is2, "is");
        RequestCancellationReceiverStrategy2.is = is2;
      })(RequestCancellationReceiverStrategy || (exports2.RequestCancellationReceiverStrategy = RequestCancellationReceiverStrategy = {}));
      var CancellationReceiverStrategy;
      (function(CancellationReceiverStrategy2) {
        CancellationReceiverStrategy2.Message = Object.freeze({
          createCancellationTokenSource(_3) {
            return new cancellation_1.CancellationTokenSource();
          }
        });
        function is2(value2) {
          return IdCancellationReceiverStrategy.is(value2) || RequestCancellationReceiverStrategy.is(value2);
        }
        __name(is2, "is");
        CancellationReceiverStrategy2.is = is2;
      })(CancellationReceiverStrategy || (exports2.CancellationReceiverStrategy = CancellationReceiverStrategy = {}));
      var CancellationSenderStrategy;
      (function(CancellationSenderStrategy2) {
        CancellationSenderStrategy2.Message = Object.freeze({
          sendCancellation(conn, id34) {
            return conn.sendNotification(CancelNotification.type, { id: id34 });
          },
          cleanup(_3) {
          }
        });
        function is2(value2) {
          const candidate = value2;
          return candidate && Is2.func(candidate.sendCancellation) && Is2.func(candidate.cleanup);
        }
        __name(is2, "is");
        CancellationSenderStrategy2.is = is2;
      })(CancellationSenderStrategy || (exports2.CancellationSenderStrategy = CancellationSenderStrategy = {}));
      var CancellationStrategy;
      (function(CancellationStrategy2) {
        CancellationStrategy2.Message = Object.freeze({
          receiver: CancellationReceiverStrategy.Message,
          sender: CancellationSenderStrategy.Message
        });
        function is2(value2) {
          const candidate = value2;
          return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender);
        }
        __name(is2, "is");
        CancellationStrategy2.is = is2;
      })(CancellationStrategy || (exports2.CancellationStrategy = CancellationStrategy = {}));
      var MessageStrategy;
      (function(MessageStrategy2) {
        function is2(value2) {
          const candidate = value2;
          return candidate && Is2.func(candidate.handleMessage);
        }
        __name(is2, "is");
        MessageStrategy2.is = is2;
      })(MessageStrategy || (exports2.MessageStrategy = MessageStrategy = {}));
      var ConnectionOptions;
      (function(ConnectionOptions2) {
        function is2(value2) {
          const candidate = value2;
          return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy) || MessageStrategy.is(candidate.messageStrategy));
        }
        __name(is2, "is");
        ConnectionOptions2.is = is2;
      })(ConnectionOptions || (exports2.ConnectionOptions = ConnectionOptions = {}));
      var ConnectionState;
      (function(ConnectionState2) {
        ConnectionState2[ConnectionState2["New"] = 1] = "New";
        ConnectionState2[ConnectionState2["Listening"] = 2] = "Listening";
        ConnectionState2[ConnectionState2["Closed"] = 3] = "Closed";
        ConnectionState2[ConnectionState2["Disposed"] = 4] = "Disposed";
      })(ConnectionState || (ConnectionState = {}));
      function createMessageConnection(messageReader, messageWriter, _logger, options2) {
        const logger = _logger !== void 0 ? _logger : exports2.NullLogger;
        let sequenceNumber = 0;
        let notificationSequenceNumber = 0;
        let unknownResponseSequenceNumber = 0;
        const version3 = "2.0";
        let starRequestHandler = void 0;
        const requestHandlers = /* @__PURE__ */ new Map();
        let starNotificationHandler = void 0;
        const notificationHandlers = /* @__PURE__ */ new Map();
        const progressHandlers = /* @__PURE__ */ new Map();
        let timer3;
        let messageQueue = new linkedMap_1.LinkedMap();
        let responsePromises = /* @__PURE__ */ new Map();
        let knownCanceledRequests = /* @__PURE__ */ new Set();
        let requestTokens = /* @__PURE__ */ new Map();
        let trace = Trace.Off;
        let traceFormat = TraceFormat.Text;
        let tracer;
        let state4 = ConnectionState.New;
        const errorEmitter = new events_1.Emitter();
        const closeEmitter = new events_1.Emitter();
        const unhandledNotificationEmitter = new events_1.Emitter();
        const unhandledProgressEmitter = new events_1.Emitter();
        const disposeEmitter = new events_1.Emitter();
        const cancellationStrategy = options2 && options2.cancellationStrategy ? options2.cancellationStrategy : CancellationStrategy.Message;
        function createRequestQueueKey(id34) {
          if (id34 === null) {
            throw new Error(`Can't send requests with id null since the response can't be correlated.`);
          }
          return "req-" + id34.toString();
        }
        __name(createRequestQueueKey, "createRequestQueueKey");
        function createResponseQueueKey(id34) {
          if (id34 === null) {
            return "res-unknown-" + (++unknownResponseSequenceNumber).toString();
          } else {
            return "res-" + id34.toString();
          }
        }
        __name(createResponseQueueKey, "createResponseQueueKey");
        function createNotificationQueueKey() {
          return "not-" + (++notificationSequenceNumber).toString();
        }
        __name(createNotificationQueueKey, "createNotificationQueueKey");
        function addMessageToQueue(queue, message) {
          if (messages_1.Message.isRequest(message)) {
            queue.set(createRequestQueueKey(message.id), message);
          } else if (messages_1.Message.isResponse(message)) {
            queue.set(createResponseQueueKey(message.id), message);
          } else {
            queue.set(createNotificationQueueKey(), message);
          }
        }
        __name(addMessageToQueue, "addMessageToQueue");
        function cancelUndispatched(_message) {
          return void 0;
        }
        __name(cancelUndispatched, "cancelUndispatched");
        function isListening() {
          return state4 === ConnectionState.Listening;
        }
        __name(isListening, "isListening");
        function isClosed() {
          return state4 === ConnectionState.Closed;
        }
        __name(isClosed, "isClosed");
        function isDisposed() {
          return state4 === ConnectionState.Disposed;
        }
        __name(isDisposed, "isDisposed");
        function closeHandler() {
          if (state4 === ConnectionState.New || state4 === ConnectionState.Listening) {
            state4 = ConnectionState.Closed;
            closeEmitter.fire(void 0);
          }
        }
        __name(closeHandler, "closeHandler");
        function readErrorHandler(error3) {
          errorEmitter.fire([error3, void 0, void 0]);
        }
        __name(readErrorHandler, "readErrorHandler");
        function writeErrorHandler(data5) {
          errorEmitter.fire(data5);
        }
        __name(writeErrorHandler, "writeErrorHandler");
        messageReader.onClose(closeHandler);
        messageReader.onError(readErrorHandler);
        messageWriter.onClose(closeHandler);
        messageWriter.onError(writeErrorHandler);
        function triggerMessageQueue() {
          if (timer3 || messageQueue.size === 0) {
            return;
          }
          timer3 = (0, ral_1.default)().timer.setImmediate(() => {
            timer3 = void 0;
            processMessageQueue();
          });
        }
        __name(triggerMessageQueue, "triggerMessageQueue");
        function handleMessage(message) {
          if (messages_1.Message.isRequest(message)) {
            handleRequest(message);
          } else if (messages_1.Message.isNotification(message)) {
            handleNotification(message);
          } else if (messages_1.Message.isResponse(message)) {
            handleResponse(message);
          } else {
            handleInvalidMessage(message);
          }
        }
        __name(handleMessage, "handleMessage");
        function processMessageQueue() {
          if (messageQueue.size === 0) {
            return;
          }
          const message = messageQueue.shift();
          try {
            const messageStrategy = options2?.messageStrategy;
            if (MessageStrategy.is(messageStrategy)) {
              messageStrategy.handleMessage(message, handleMessage);
            } else {
              handleMessage(message);
            }
          } finally {
            triggerMessageQueue();
          }
        }
        __name(processMessageQueue, "processMessageQueue");
        const callback = /* @__PURE__ */ __name((message) => {
          try {
            if (messages_1.Message.isNotification(message) && message.method === CancelNotification.type.method) {
              const cancelId = message.params.id;
              const key = createRequestQueueKey(cancelId);
              const toCancel = messageQueue.get(key);
              if (messages_1.Message.isRequest(toCancel)) {
                const strategy = options2?.connectionStrategy;
                const response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);
                if (response && (response.error !== void 0 || response.result !== void 0)) {
                  messageQueue.delete(key);
                  requestTokens.delete(cancelId);
                  response.id = toCancel.id;
                  traceSendingResponse(response, message.method, Date.now());
                  messageWriter.write(response).catch(() => logger.error(`Sending response for canceled message failed.`));
                  return;
                }
              }
              const cancellationToken = requestTokens.get(cancelId);
              if (cancellationToken !== void 0) {
                cancellationToken.cancel();
                traceReceivedNotification(message);
                return;
              } else {
                knownCanceledRequests.add(cancelId);
              }
            }
            addMessageToQueue(messageQueue, message);
          } finally {
            triggerMessageQueue();
          }
        }, "callback");
        function handleRequest(requestMessage) {
          if (isDisposed()) {
            return;
          }
          function reply(resultOrError, method, startTime2) {
            const message = {
              jsonrpc: version3,
              id: requestMessage.id
            };
            if (resultOrError instanceof messages_1.ResponseError) {
              message.error = resultOrError.toJson();
            } else {
              message.result = resultOrError === void 0 ? null : resultOrError;
            }
            traceSendingResponse(message, method, startTime2);
            messageWriter.write(message).catch(() => logger.error(`Sending response failed.`));
          }
          __name(reply, "reply");
          function replyError(error3, method, startTime2) {
            const message = {
              jsonrpc: version3,
              id: requestMessage.id,
              error: error3.toJson()
            };
            traceSendingResponse(message, method, startTime2);
            messageWriter.write(message).catch(() => logger.error(`Sending response failed.`));
          }
          __name(replyError, "replyError");
          function replySuccess(result, method, startTime2) {
            if (result === void 0) {
              result = null;
            }
            const message = {
              jsonrpc: version3,
              id: requestMessage.id,
              result
            };
            traceSendingResponse(message, method, startTime2);
            messageWriter.write(message).catch(() => logger.error(`Sending response failed.`));
          }
          __name(replySuccess, "replySuccess");
          traceReceivedRequest(requestMessage);
          const element3 = requestHandlers.get(requestMessage.method);
          let type3;
          let requestHandler;
          if (element3) {
            type3 = element3.type;
            requestHandler = element3.handler;
          }
          const startTime = Date.now();
          if (requestHandler || starRequestHandler) {
            const tokenKey = requestMessage.id ?? String(Date.now());
            const cancellationSource = IdCancellationReceiverStrategy.is(cancellationStrategy.receiver) ? cancellationStrategy.receiver.createCancellationTokenSource(tokenKey) : cancellationStrategy.receiver.createCancellationTokenSource(requestMessage);
            if (requestMessage.id !== null && knownCanceledRequests.has(requestMessage.id)) {
              cancellationSource.cancel();
            }
            if (requestMessage.id !== null) {
              requestTokens.set(tokenKey, cancellationSource);
            }
            try {
              let handlerResult;
              if (requestHandler) {
                if (requestMessage.params === void 0) {
                  if (type3 !== void 0 && type3.numberOfParams !== 0) {
                    replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type3.numberOfParams} params but received none.`), requestMessage.method, startTime);
                    return;
                  }
                  handlerResult = requestHandler(cancellationSource.token);
                } else if (Array.isArray(requestMessage.params)) {
                  if (type3 !== void 0 && type3.parameterStructures === messages_1.ParameterStructures.byName) {
                    replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime);
                    return;
                  }
                  handlerResult = requestHandler(...requestMessage.params, cancellationSource.token);
                } else {
                  if (type3 !== void 0 && type3.parameterStructures === messages_1.ParameterStructures.byPosition) {
                    replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime);
                    return;
                  }
                  handlerResult = requestHandler(requestMessage.params, cancellationSource.token);
                }
              } else if (starRequestHandler) {
                handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
              }
              const promise4 = handlerResult;
              if (!handlerResult) {
                requestTokens.delete(tokenKey);
                replySuccess(handlerResult, requestMessage.method, startTime);
              } else if (promise4.then) {
                promise4.then((resultOrError) => {
                  requestTokens.delete(tokenKey);
                  reply(resultOrError, requestMessage.method, startTime);
                }, (error3) => {
                  requestTokens.delete(tokenKey);
                  if (error3 instanceof messages_1.ResponseError) {
                    replyError(error3, requestMessage.method, startTime);
                  } else if (error3 && Is2.string(error3.message)) {
                    replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error3.message}`), requestMessage.method, startTime);
                  } else {
                    replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
                  }
                });
              } else {
                requestTokens.delete(tokenKey);
                reply(handlerResult, requestMessage.method, startTime);
              }
            } catch (error3) {
              requestTokens.delete(tokenKey);
              if (error3 instanceof messages_1.ResponseError) {
                reply(error3, requestMessage.method, startTime);
              } else if (error3 && Is2.string(error3.message)) {
                replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error3.message}`), requestMessage.method, startTime);
              } else {
                replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
              }
            }
          } else {
            replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
          }
        }
        __name(handleRequest, "handleRequest");
        function handleResponse(responseMessage) {
          if (isDisposed()) {
            return;
          }
          if (responseMessage.id === null) {
            if (responseMessage.error) {
              logger.error(`Received response message without id: Error is: 
${JSON.stringify(responseMessage.error, void 0, 4)}`);
            } else {
              logger.error(`Received response message without id. No further error information provided.`);
            }
          } else {
            const key = responseMessage.id;
            const responsePromise = responsePromises.get(key);
            traceReceivedResponse(responseMessage, responsePromise);
            if (responsePromise !== void 0) {
              responsePromises.delete(key);
              try {
                if (responseMessage.error) {
                  const error3 = responseMessage.error;
                  responsePromise.reject(new messages_1.ResponseError(error3.code, error3.message, error3.data));
                } else if (responseMessage.result !== void 0) {
                  responsePromise.resolve(responseMessage.result);
                } else {
                  throw new Error("Should never happen.");
                }
              } catch (error3) {
                if (error3.message) {
                  logger.error(`Response handler '${responsePromise.method}' failed with message: ${error3.message}`);
                } else {
                  logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
                }
              }
            }
          }
        }
        __name(handleResponse, "handleResponse");
        function handleNotification(message) {
          if (isDisposed()) {
            return;
          }
          let type3 = void 0;
          let notificationHandler;
          if (message.method === CancelNotification.type.method) {
            const cancelId = message.params.id;
            knownCanceledRequests.delete(cancelId);
            traceReceivedNotification(message);
            return;
          } else {
            const element3 = notificationHandlers.get(message.method);
            if (element3) {
              notificationHandler = element3.handler;
              type3 = element3.type;
            }
          }
          if (notificationHandler || starNotificationHandler) {
            try {
              traceReceivedNotification(message);
              if (notificationHandler) {
                if (message.params === void 0) {
                  if (type3 !== void 0) {
                    if (type3.numberOfParams !== 0 && type3.parameterStructures !== messages_1.ParameterStructures.byName) {
                      logger.error(`Notification ${message.method} defines ${type3.numberOfParams} params but received none.`);
                    }
                  }
                  notificationHandler();
                } else if (Array.isArray(message.params)) {
                  const params = message.params;
                  if (message.method === ProgressNotification.type.method && params.length === 2 && ProgressToken.is(params[0])) {
                    notificationHandler({ token: params[0], value: params[1] });
                  } else {
                    if (type3 !== void 0) {
                      if (type3.parameterStructures === messages_1.ParameterStructures.byName) {
                        logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`);
                      }
                      if (type3.numberOfParams !== message.params.length) {
                        logger.error(`Notification ${message.method} defines ${type3.numberOfParams} params but received ${params.length} arguments`);
                      }
                    }
                    notificationHandler(...params);
                  }
                } else {
                  if (type3 !== void 0 && type3.parameterStructures === messages_1.ParameterStructures.byPosition) {
                    logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`);
                  }
                  notificationHandler(message.params);
                }
              } else if (starNotificationHandler) {
                starNotificationHandler(message.method, message.params);
              }
            } catch (error3) {
              if (error3.message) {
                logger.error(`Notification handler '${message.method}' failed with message: ${error3.message}`);
              } else {
                logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
              }
            }
          } else {
            unhandledNotificationEmitter.fire(message);
          }
        }
        __name(handleNotification, "handleNotification");
        function handleInvalidMessage(message) {
          if (!message) {
            logger.error("Received empty message.");
            return;
          }
          logger.error(`Received message which is neither a response nor a notification message:
${JSON.stringify(message, null, 4)}`);
          const responseMessage = message;
          if (Is2.string(responseMessage.id) || Is2.number(responseMessage.id)) {
            const key = responseMessage.id;
            const responseHandler = responsePromises.get(key);
            if (responseHandler) {
              responseHandler.reject(new Error("The received response has neither a result nor an error property."));
            }
          }
        }
        __name(handleInvalidMessage, "handleInvalidMessage");
        function stringifyTrace(params) {
          if (params === void 0 || params === null) {
            return void 0;
          }
          switch (trace) {
            case Trace.Verbose:
              return JSON.stringify(params, null, 4);
            case Trace.Compact:
              return JSON.stringify(params);
            default:
              return void 0;
          }
        }
        __name(stringifyTrace, "stringifyTrace");
        function traceSendingRequest(message) {
          if (trace === Trace.Off || !tracer) {
            return;
          }
          if (traceFormat === TraceFormat.Text) {
            let data5 = void 0;
            if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) {
              data5 = `Params: ${stringifyTrace(message.params)}

`;
            }
            tracer.log(`Sending request '${message.method} - (${message.id})'.`, data5);
          } else {
            logLSPMessage("send-request", message);
          }
        }
        __name(traceSendingRequest, "traceSendingRequest");
        function traceSendingNotification(message) {
          if (trace === Trace.Off || !tracer) {
            return;
          }
          if (traceFormat === TraceFormat.Text) {
            let data5 = void 0;
            if (trace === Trace.Verbose || trace === Trace.Compact) {
              if (message.params) {
                data5 = `Params: ${stringifyTrace(message.params)}

`;
              } else {
                data5 = "No parameters provided.\n\n";
              }
            }
            tracer.log(`Sending notification '${message.method}'.`, data5);
          } else {
            logLSPMessage("send-notification", message);
          }
        }
        __name(traceSendingNotification, "traceSendingNotification");
        function traceSendingResponse(message, method, startTime) {
          if (trace === Trace.Off || !tracer) {
            return;
          }
          if (traceFormat === TraceFormat.Text) {
            let data5 = void 0;
            if (trace === Trace.Verbose || trace === Trace.Compact) {
              if (message.error && message.error.data) {
                data5 = `Error data: ${stringifyTrace(message.error.data)}

`;
              } else {
                if (message.result) {
                  data5 = `Result: ${stringifyTrace(message.result)}

`;
                } else if (message.error === void 0) {
                  data5 = "No result returned.\n\n";
                }
              }
            }
            tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data5);
          } else {
            logLSPMessage("send-response", message);
          }
        }
        __name(traceSendingResponse, "traceSendingResponse");
        function traceReceivedRequest(message) {
          if (trace === Trace.Off || !tracer) {
            return;
          }
          if (traceFormat === TraceFormat.Text) {
            let data5 = void 0;
            if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) {
              data5 = `Params: ${stringifyTrace(message.params)}

`;
            }
            tracer.log(`Received request '${message.method} - (${message.id})'.`, data5);
          } else {
            logLSPMessage("receive-request", message);
          }
        }
        __name(traceReceivedRequest, "traceReceivedRequest");
        function traceReceivedNotification(message) {
          if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {
            return;
          }
          if (traceFormat === TraceFormat.Text) {
            let data5 = void 0;
            if (trace === Trace.Verbose || trace === Trace.Compact) {
              if (message.params) {
                data5 = `Params: ${stringifyTrace(message.params)}

`;
              } else {
                data5 = "No parameters provided.\n\n";
              }
            }
            tracer.log(`Received notification '${message.method}'.`, data5);
          } else {
            logLSPMessage("receive-notification", message);
          }
        }
        __name(traceReceivedNotification, "traceReceivedNotification");
        function traceReceivedResponse(message, responsePromise) {
          if (trace === Trace.Off || !tracer) {
            return;
          }
          if (traceFormat === TraceFormat.Text) {
            let data5 = void 0;
            if (trace === Trace.Verbose || trace === Trace.Compact) {
              if (message.error && message.error.data) {
                data5 = `Error data: ${stringifyTrace(message.error.data)}

`;
              } else {
                if (message.result) {
                  data5 = `Result: ${stringifyTrace(message.result)}

`;
                } else if (message.error === void 0) {
                  data5 = "No result returned.\n\n";
                }
              }
            }
            if (responsePromise) {
              const error3 = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : "";
              tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error3}`, data5);
            } else {
              tracer.log(`Received response ${message.id} without active response promise.`, data5);
            }
          } else {
            logLSPMessage("receive-response", message);
          }
        }
        __name(traceReceivedResponse, "traceReceivedResponse");
        function logLSPMessage(type3, message) {
          if (!tracer || trace === Trace.Off) {
            return;
          }
          const lspMessage = {
            isLSPMessage: true,
            type: type3,
            message,
            timestamp: Date.now()
          };
          tracer.log(lspMessage);
        }
        __name(logLSPMessage, "logLSPMessage");
        function throwIfClosedOrDisposed() {
          if (isClosed()) {
            throw new ConnectionError(ConnectionErrors.Closed, "Connection is closed.");
          }
          if (isDisposed()) {
            throw new ConnectionError(ConnectionErrors.Disposed, "Connection is disposed.");
          }
        }
        __name(throwIfClosedOrDisposed, "throwIfClosedOrDisposed");
        function throwIfListening() {
          if (isListening()) {
            throw new ConnectionError(ConnectionErrors.AlreadyListening, "Connection is already listening");
          }
        }
        __name(throwIfListening, "throwIfListening");
        function throwIfNotListening() {
          if (!isListening()) {
            throw new Error("Call listen() first.");
          }
        }
        __name(throwIfNotListening, "throwIfNotListening");
        function undefinedToNull(param) {
          if (param === void 0) {
            return null;
          } else {
            return param;
          }
        }
        __name(undefinedToNull, "undefinedToNull");
        function nullToUndefined(param) {
          if (param === null) {
            return void 0;
          } else {
            return param;
          }
        }
        __name(nullToUndefined, "nullToUndefined");
        function isNamedParam(param) {
          return param !== void 0 && param !== null && !Array.isArray(param) && typeof param === "object";
        }
        __name(isNamedParam, "isNamedParam");
        function computeSingleParam(parameterStructures, param) {
          switch (parameterStructures) {
            case messages_1.ParameterStructures.auto:
              if (isNamedParam(param)) {
                return nullToUndefined(param);
              } else {
                return [undefinedToNull(param)];
              }
            case messages_1.ParameterStructures.byName:
              if (!isNamedParam(param)) {
                throw new Error(`Received parameters by name but param is not an object literal.`);
              }
              return nullToUndefined(param);
            case messages_1.ParameterStructures.byPosition:
              return [undefinedToNull(param)];
            default:
              throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`);
          }
        }
        __name(computeSingleParam, "computeSingleParam");
        function computeMessageParams(type3, params) {
          let result;
          const numberOfParams = type3.numberOfParams;
          switch (numberOfParams) {
            case 0:
              result = void 0;
              break;
            case 1:
              result = computeSingleParam(type3.parameterStructures, params[0]);
              break;
            default:
              result = [];
              for (let i2 = 0; i2 < params.length && i2 < numberOfParams; i2++) {
                result.push(undefinedToNull(params[i2]));
              }
              if (params.length < numberOfParams) {
                for (let i2 = params.length; i2 < numberOfParams; i2++) {
                  result.push(null);
                }
              }
              break;
          }
          return result;
        }
        __name(computeMessageParams, "computeMessageParams");
        const connection = {
          sendNotification: /* @__PURE__ */ __name((type3, ...args) => {
            throwIfClosedOrDisposed();
            let method;
            let messageParams;
            if (Is2.string(type3)) {
              method = type3;
              const first3 = args[0];
              let paramStart = 0;
              let parameterStructures = messages_1.ParameterStructures.auto;
              if (messages_1.ParameterStructures.is(first3)) {
                paramStart = 1;
                parameterStructures = first3;
              }
              let paramEnd = args.length;
              const numberOfParams = paramEnd - paramStart;
              switch (numberOfParams) {
                case 0:
                  messageParams = void 0;
                  break;
                case 1:
                  messageParams = computeSingleParam(parameterStructures, args[paramStart]);
                  break;
                default:
                  if (parameterStructures === messages_1.ParameterStructures.byName) {
                    throw new Error(`Received ${numberOfParams} parameters for 'by Name' notification parameter structure.`);
                  }
                  messageParams = args.slice(paramStart, paramEnd).map((value2) => undefinedToNull(value2));
                  break;
              }
            } else {
              const params = args;
              method = type3.method;
              messageParams = computeMessageParams(type3, params);
            }
            const notificationMessage = {
              jsonrpc: version3,
              method,
              params: messageParams
            };
            traceSendingNotification(notificationMessage);
            return messageWriter.write(notificationMessage).catch((error3) => {
              logger.error(`Sending notification failed.`);
              throw error3;
            });
          }, "sendNotification"),
          onNotification: /* @__PURE__ */ __name((type3, handler) => {
            throwIfClosedOrDisposed();
            let method;
            if (Is2.func(type3)) {
              starNotificationHandler = type3;
            } else if (handler) {
              if (Is2.string(type3)) {
                method = type3;
                notificationHandlers.set(type3, { type: void 0, handler });
              } else {
                method = type3.method;
                notificationHandlers.set(type3.method, { type: type3, handler });
              }
            }
            return {
              dispose: /* @__PURE__ */ __name(() => {
                if (method !== void 0) {
                  notificationHandlers.delete(method);
                } else {
                  starNotificationHandler = void 0;
                }
              }, "dispose")
            };
          }, "onNotification"),
          onProgress: /* @__PURE__ */ __name((_type, token2, handler) => {
            if (progressHandlers.has(token2)) {
              throw new Error(`Progress handler for token ${token2} already registered`);
            }
            progressHandlers.set(token2, handler);
            return {
              dispose: /* @__PURE__ */ __name(() => {
                progressHandlers.delete(token2);
              }, "dispose")
            };
          }, "onProgress"),
          sendProgress: /* @__PURE__ */ __name((_type, token2, value2) => {
            return connection.sendNotification(ProgressNotification.type, { token: token2, value: value2 });
          }, "sendProgress"),
          onUnhandledProgress: unhandledProgressEmitter.event,
          sendRequest: /* @__PURE__ */ __name((type3, ...args) => {
            throwIfClosedOrDisposed();
            throwIfNotListening();
            let method;
            let messageParams;
            let token2 = void 0;
            if (Is2.string(type3)) {
              method = type3;
              const first3 = args[0];
              const last3 = args[args.length - 1];
              let paramStart = 0;
              let parameterStructures = messages_1.ParameterStructures.auto;
              if (messages_1.ParameterStructures.is(first3)) {
                paramStart = 1;
                parameterStructures = first3;
              }
              let paramEnd = args.length;
              if (cancellation_1.CancellationToken.is(last3)) {
                paramEnd = paramEnd - 1;
                token2 = last3;
              }
              const numberOfParams = paramEnd - paramStart;
              switch (numberOfParams) {
                case 0:
                  messageParams = void 0;
                  break;
                case 1:
                  messageParams = computeSingleParam(parameterStructures, args[paramStart]);
                  break;
                default:
                  if (parameterStructures === messages_1.ParameterStructures.byName) {
                    throw new Error(`Received ${numberOfParams} parameters for 'by Name' request parameter structure.`);
                  }
                  messageParams = args.slice(paramStart, paramEnd).map((value2) => undefinedToNull(value2));
                  break;
              }
            } else {
              const params = args;
              method = type3.method;
              messageParams = computeMessageParams(type3, params);
              const numberOfParams = type3.numberOfParams;
              token2 = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : void 0;
            }
            const id34 = sequenceNumber++;
            let disposable;
            if (token2) {
              disposable = token2.onCancellationRequested(() => {
                const p3 = cancellationStrategy.sender.sendCancellation(connection, id34);
                if (p3 === void 0) {
                  logger.log(`Received no promise from cancellation strategy when cancelling id ${id34}`);
                  return Promise.resolve();
                } else {
                  return p3.catch(() => {
                    logger.log(`Sending cancellation messages for id ${id34} failed`);
                  });
                }
              });
            }
            const requestMessage = {
              jsonrpc: version3,
              id: id34,
              method,
              params: messageParams
            };
            traceSendingRequest(requestMessage);
            if (typeof cancellationStrategy.sender.enableCancellation === "function") {
              cancellationStrategy.sender.enableCancellation(requestMessage);
            }
            return new Promise(async (resolve2, reject3) => {
              const resolveWithCleanup = /* @__PURE__ */ __name((r2) => {
                resolve2(r2);
                cancellationStrategy.sender.cleanup(id34);
                disposable?.dispose();
              }, "resolveWithCleanup");
              const rejectWithCleanup = /* @__PURE__ */ __name((r2) => {
                reject3(r2);
                cancellationStrategy.sender.cleanup(id34);
                disposable?.dispose();
              }, "rejectWithCleanup");
              const responsePromise = { method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup };
              try {
                await messageWriter.write(requestMessage);
                responsePromises.set(id34, responsePromise);
              } catch (error3) {
                logger.error(`Sending request failed.`);
                responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error3.message ? error3.message : "Unknown reason"));
                throw error3;
              }
            });
          }, "sendRequest"),
          onRequest: /* @__PURE__ */ __name((type3, handler) => {
            throwIfClosedOrDisposed();
            let method = null;
            if (StarRequestHandler.is(type3)) {
              method = void 0;
              starRequestHandler = type3;
            } else if (Is2.string(type3)) {
              method = null;
              if (handler !== void 0) {
                method = type3;
                requestHandlers.set(type3, { handler, type: void 0 });
              }
            } else {
              if (handler !== void 0) {
                method = type3.method;
                requestHandlers.set(type3.method, { type: type3, handler });
              }
            }
            return {
              dispose: /* @__PURE__ */ __name(() => {
                if (method === null) {
                  return;
                }
                if (method !== void 0) {
                  requestHandlers.delete(method);
                } else {
                  starRequestHandler = void 0;
                }
              }, "dispose")
            };
          }, "onRequest"),
          hasPendingResponse: /* @__PURE__ */ __name(() => {
            return responsePromises.size > 0;
          }, "hasPendingResponse"),
          trace: /* @__PURE__ */ __name(async (_value, _tracer, sendNotificationOrTraceOptions) => {
            let _sendNotification = false;
            let _traceFormat = TraceFormat.Text;
            if (sendNotificationOrTraceOptions !== void 0) {
              if (Is2.boolean(sendNotificationOrTraceOptions)) {
                _sendNotification = sendNotificationOrTraceOptions;
              } else {
                _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
                _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
              }
            }
            trace = _value;
            traceFormat = _traceFormat;
            if (trace === Trace.Off) {
              tracer = void 0;
            } else {
              tracer = _tracer;
            }
            if (_sendNotification && !isClosed() && !isDisposed()) {
              await connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });
            }
          }, "trace"),
          onError: errorEmitter.event,
          onClose: closeEmitter.event,
          onUnhandledNotification: unhandledNotificationEmitter.event,
          onDispose: disposeEmitter.event,
          end: /* @__PURE__ */ __name(() => {
            messageWriter.end();
          }, "end"),
          dispose: /* @__PURE__ */ __name(() => {
            if (isDisposed()) {
              return;
            }
            state4 = ConnectionState.Disposed;
            disposeEmitter.fire(void 0);
            const error3 = new messages_1.ResponseError(messages_1.ErrorCodes.PendingResponseRejected, "Pending response rejected since connection got disposed");
            for (const promise4 of responsePromises.values()) {
              promise4.reject(error3);
            }
            responsePromises = /* @__PURE__ */ new Map();
            requestTokens = /* @__PURE__ */ new Map();
            knownCanceledRequests = /* @__PURE__ */ new Set();
            messageQueue = new linkedMap_1.LinkedMap();
            if (Is2.func(messageWriter.dispose)) {
              messageWriter.dispose();
            }
            if (Is2.func(messageReader.dispose)) {
              messageReader.dispose();
            }
          }, "dispose"),
          listen: /* @__PURE__ */ __name(() => {
            throwIfClosedOrDisposed();
            throwIfListening();
            state4 = ConnectionState.Listening;
            messageReader.listen(callback);
          }, "listen"),
          inspect: /* @__PURE__ */ __name(() => {
            (0, ral_1.default)().console.log("inspect");
          }, "inspect")
        };
        connection.onNotification(LogTraceNotification.type, (params) => {
          if (trace === Trace.Off || !tracer) {
            return;
          }
          const verbose = trace === Trace.Verbose || trace === Trace.Compact;
          tracer.log(params.message, verbose ? params.verbose : void 0);
        });
        connection.onNotification(ProgressNotification.type, (params) => {
          const handler = progressHandlers.get(params.token);
          if (handler) {
            handler(params.value);
          } else {
            unhandledProgressEmitter.fire(params);
          }
        });
        return connection;
      }
      __name(createMessageConnection, "createMessageConnection");
      exports2.createMessageConnection = createMessageConnection;
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/api.js
  var require_api = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/api.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.ProgressType = exports2.ProgressToken = exports2.createMessageConnection = exports2.NullLogger = exports2.ConnectionOptions = exports2.ConnectionStrategy = exports2.AbstractMessageBuffer = exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = exports2.SharedArrayReceiverStrategy = exports2.SharedArraySenderStrategy = exports2.CancellationToken = exports2.CancellationTokenSource = exports2.Emitter = exports2.Event = exports2.Disposable = exports2.LRUCache = exports2.Touch = exports2.LinkedMap = exports2.ParameterStructures = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.ErrorCodes = exports2.ResponseError = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType0 = exports2.RequestType = exports2.Message = exports2.RAL = void 0;
      exports2.MessageStrategy = exports2.CancellationStrategy = exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.TraceValues = exports2.Trace = void 0;
      var messages_1 = require_messages();
      Object.defineProperty(exports2, "Message", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.Message;
      }, "get") });
      Object.defineProperty(exports2, "RequestType", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.RequestType;
      }, "get") });
      Object.defineProperty(exports2, "RequestType0", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.RequestType0;
      }, "get") });
      Object.defineProperty(exports2, "RequestType1", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.RequestType1;
      }, "get") });
      Object.defineProperty(exports2, "RequestType2", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.RequestType2;
      }, "get") });
      Object.defineProperty(exports2, "RequestType3", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.RequestType3;
      }, "get") });
      Object.defineProperty(exports2, "RequestType4", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.RequestType4;
      }, "get") });
      Object.defineProperty(exports2, "RequestType5", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.RequestType5;
      }, "get") });
      Object.defineProperty(exports2, "RequestType6", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.RequestType6;
      }, "get") });
      Object.defineProperty(exports2, "RequestType7", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.RequestType7;
      }, "get") });
      Object.defineProperty(exports2, "RequestType8", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.RequestType8;
      }, "get") });
      Object.defineProperty(exports2, "RequestType9", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.RequestType9;
      }, "get") });
      Object.defineProperty(exports2, "ResponseError", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.ResponseError;
      }, "get") });
      Object.defineProperty(exports2, "ErrorCodes", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.ErrorCodes;
      }, "get") });
      Object.defineProperty(exports2, "NotificationType", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.NotificationType;
      }, "get") });
      Object.defineProperty(exports2, "NotificationType0", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.NotificationType0;
      }, "get") });
      Object.defineProperty(exports2, "NotificationType1", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.NotificationType1;
      }, "get") });
      Object.defineProperty(exports2, "NotificationType2", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.NotificationType2;
      }, "get") });
      Object.defineProperty(exports2, "NotificationType3", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.NotificationType3;
      }, "get") });
      Object.defineProperty(exports2, "NotificationType4", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.NotificationType4;
      }, "get") });
      Object.defineProperty(exports2, "NotificationType5", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.NotificationType5;
      }, "get") });
      Object.defineProperty(exports2, "NotificationType6", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.NotificationType6;
      }, "get") });
      Object.defineProperty(exports2, "NotificationType7", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.NotificationType7;
      }, "get") });
      Object.defineProperty(exports2, "NotificationType8", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.NotificationType8;
      }, "get") });
      Object.defineProperty(exports2, "NotificationType9", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.NotificationType9;
      }, "get") });
      Object.defineProperty(exports2, "ParameterStructures", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messages_1.ParameterStructures;
      }, "get") });
      var linkedMap_1 = require_linkedMap();
      Object.defineProperty(exports2, "LinkedMap", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return linkedMap_1.LinkedMap;
      }, "get") });
      Object.defineProperty(exports2, "LRUCache", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return linkedMap_1.LRUCache;
      }, "get") });
      Object.defineProperty(exports2, "Touch", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return linkedMap_1.Touch;
      }, "get") });
      var disposable_1 = require_disposable();
      Object.defineProperty(exports2, "Disposable", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return disposable_1.Disposable;
      }, "get") });
      var events_1 = require_events();
      Object.defineProperty(exports2, "Event", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return events_1.Event;
      }, "get") });
      Object.defineProperty(exports2, "Emitter", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return events_1.Emitter;
      }, "get") });
      var cancellation_1 = require_cancellation();
      Object.defineProperty(exports2, "CancellationTokenSource", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return cancellation_1.CancellationTokenSource;
      }, "get") });
      Object.defineProperty(exports2, "CancellationToken", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return cancellation_1.CancellationToken;
      }, "get") });
      var sharedArrayCancellation_1 = require_sharedArrayCancellation();
      Object.defineProperty(exports2, "SharedArraySenderStrategy", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return sharedArrayCancellation_1.SharedArraySenderStrategy;
      }, "get") });
      Object.defineProperty(exports2, "SharedArrayReceiverStrategy", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return sharedArrayCancellation_1.SharedArrayReceiverStrategy;
      }, "get") });
      var messageReader_1 = require_messageReader();
      Object.defineProperty(exports2, "MessageReader", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messageReader_1.MessageReader;
      }, "get") });
      Object.defineProperty(exports2, "AbstractMessageReader", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messageReader_1.AbstractMessageReader;
      }, "get") });
      Object.defineProperty(exports2, "ReadableStreamMessageReader", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messageReader_1.ReadableStreamMessageReader;
      }, "get") });
      var messageWriter_1 = require_messageWriter();
      Object.defineProperty(exports2, "MessageWriter", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messageWriter_1.MessageWriter;
      }, "get") });
      Object.defineProperty(exports2, "AbstractMessageWriter", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messageWriter_1.AbstractMessageWriter;
      }, "get") });
      Object.defineProperty(exports2, "WriteableStreamMessageWriter", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messageWriter_1.WriteableStreamMessageWriter;
      }, "get") });
      var messageBuffer_1 = require_messageBuffer();
      Object.defineProperty(exports2, "AbstractMessageBuffer", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return messageBuffer_1.AbstractMessageBuffer;
      }, "get") });
      var connection_1 = require_connection();
      Object.defineProperty(exports2, "ConnectionStrategy", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.ConnectionStrategy;
      }, "get") });
      Object.defineProperty(exports2, "ConnectionOptions", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.ConnectionOptions;
      }, "get") });
      Object.defineProperty(exports2, "NullLogger", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.NullLogger;
      }, "get") });
      Object.defineProperty(exports2, "createMessageConnection", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.createMessageConnection;
      }, "get") });
      Object.defineProperty(exports2, "ProgressToken", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.ProgressToken;
      }, "get") });
      Object.defineProperty(exports2, "ProgressType", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.ProgressType;
      }, "get") });
      Object.defineProperty(exports2, "Trace", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.Trace;
      }, "get") });
      Object.defineProperty(exports2, "TraceValues", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.TraceValues;
      }, "get") });
      Object.defineProperty(exports2, "TraceFormat", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.TraceFormat;
      }, "get") });
      Object.defineProperty(exports2, "SetTraceNotification", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.SetTraceNotification;
      }, "get") });
      Object.defineProperty(exports2, "LogTraceNotification", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.LogTraceNotification;
      }, "get") });
      Object.defineProperty(exports2, "ConnectionErrors", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.ConnectionErrors;
      }, "get") });
      Object.defineProperty(exports2, "ConnectionError", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.ConnectionError;
      }, "get") });
      Object.defineProperty(exports2, "CancellationReceiverStrategy", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.CancellationReceiverStrategy;
      }, "get") });
      Object.defineProperty(exports2, "CancellationSenderStrategy", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.CancellationSenderStrategy;
      }, "get") });
      Object.defineProperty(exports2, "CancellationStrategy", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.CancellationStrategy;
      }, "get") });
      Object.defineProperty(exports2, "MessageStrategy", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.MessageStrategy;
      }, "get") });
      var ral_1 = require_ral();
      exports2.RAL = ral_1.default;
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/browser/ril.js
  var require_ril = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/browser/ril.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      var api_1 = require_api();
      var MessageBuffer = class _MessageBuffer extends api_1.AbstractMessageBuffer {
        static {
          __name(this, "MessageBuffer");
        }
        constructor(encoding = "utf-8") {
          super(encoding);
          this.asciiDecoder = new TextDecoder("ascii");
        }
        emptyBuffer() {
          return _MessageBuffer.emptyBuffer;
        }
        fromString(value2, _encoding) {
          return new TextEncoder().encode(value2);
        }
        toString(value2, encoding) {
          if (encoding === "ascii") {
            return this.asciiDecoder.decode(value2);
          } else {
            return new TextDecoder(encoding).decode(value2);
          }
        }
        asNative(buffer, length2) {
          if (length2 === void 0) {
            return buffer;
          } else {
            return buffer.slice(0, length2);
          }
        }
        allocNative(length2) {
          return new Uint8Array(length2);
        }
      };
      MessageBuffer.emptyBuffer = new Uint8Array(0);
      var ReadableStreamWrapper = class {
        static {
          __name(this, "ReadableStreamWrapper");
        }
        constructor(socket) {
          this.socket = socket;
          this._onData = new api_1.Emitter();
          this._messageListener = (event3) => {
            const blob = event3.data;
            blob.arrayBuffer().then((buffer) => {
              this._onData.fire(new Uint8Array(buffer));
            }, () => {
              (0, api_1.RAL)().console.error(`Converting blob to array buffer failed.`);
            });
          };
          this.socket.addEventListener("message", this._messageListener);
        }
        onClose(listener) {
          this.socket.addEventListener("close", listener);
          return api_1.Disposable.create(() => this.socket.removeEventListener("close", listener));
        }
        onError(listener) {
          this.socket.addEventListener("error", listener);
          return api_1.Disposable.create(() => this.socket.removeEventListener("error", listener));
        }
        onEnd(listener) {
          this.socket.addEventListener("end", listener);
          return api_1.Disposable.create(() => this.socket.removeEventListener("end", listener));
        }
        onData(listener) {
          return this._onData.event(listener);
        }
      };
      var WritableStreamWrapper = class {
        static {
          __name(this, "WritableStreamWrapper");
        }
        constructor(socket) {
          this.socket = socket;
        }
        onClose(listener) {
          this.socket.addEventListener("close", listener);
          return api_1.Disposable.create(() => this.socket.removeEventListener("close", listener));
        }
        onError(listener) {
          this.socket.addEventListener("error", listener);
          return api_1.Disposable.create(() => this.socket.removeEventListener("error", listener));
        }
        onEnd(listener) {
          this.socket.addEventListener("end", listener);
          return api_1.Disposable.create(() => this.socket.removeEventListener("end", listener));
        }
        write(data5, encoding) {
          if (typeof data5 === "string") {
            if (encoding !== void 0 && encoding !== "utf-8") {
              throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${encoding}`);
            }
            this.socket.send(data5);
          } else {
            this.socket.send(data5);
          }
          return Promise.resolve();
        }
        end() {
          this.socket.close();
        }
      };
      var _textEncoder = new TextEncoder();
      var _ril = Object.freeze({
        messageBuffer: Object.freeze({
          create: /* @__PURE__ */ __name((encoding) => new MessageBuffer(encoding), "create")
        }),
        applicationJson: Object.freeze({
          encoder: Object.freeze({
            name: "application/json",
            encode: /* @__PURE__ */ __name((msg, options2) => {
              if (options2.charset !== "utf-8") {
                throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${options2.charset}`);
              }
              return Promise.resolve(_textEncoder.encode(JSON.stringify(msg, void 0, 0)));
            }, "encode")
          }),
          decoder: Object.freeze({
            name: "application/json",
            decode: /* @__PURE__ */ __name((buffer, options2) => {
              if (!(buffer instanceof Uint8Array)) {
                throw new Error(`In a Browser environments only Uint8Arrays are supported.`);
              }
              return Promise.resolve(JSON.parse(new TextDecoder(options2.charset).decode(buffer)));
            }, "decode")
          })
        }),
        stream: Object.freeze({
          asReadableStream: /* @__PURE__ */ __name((socket) => new ReadableStreamWrapper(socket), "asReadableStream"),
          asWritableStream: /* @__PURE__ */ __name((socket) => new WritableStreamWrapper(socket), "asWritableStream")
        }),
        console,
        timer: Object.freeze({
          setTimeout(callback, ms3, ...args) {
            const handle = setTimeout(callback, ms3, ...args);
            return { dispose: /* @__PURE__ */ __name(() => clearTimeout(handle), "dispose") };
          },
          setImmediate(callback, ...args) {
            const handle = setTimeout(callback, 0, ...args);
            return { dispose: /* @__PURE__ */ __name(() => clearTimeout(handle), "dispose") };
          },
          setInterval(callback, ms3, ...args) {
            const handle = setInterval(callback, ms3, ...args);
            return { dispose: /* @__PURE__ */ __name(() => clearInterval(handle), "dispose") };
          }
        })
      });
      function RIL() {
        return _ril;
      }
      __name(RIL, "RIL");
      (function(RIL2) {
        function install() {
          api_1.RAL.install(_ril);
        }
        __name(install, "install");
        RIL2.install = install;
      })(RIL || (RIL = {}));
      exports2.default = RIL;
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/browser/main.js
  var require_main = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/browser/main.js"(exports2) {
      "use strict";
      var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o2, m3, k2, k22) {
        if (k22 === void 0) k22 = k2;
        var desc = Object.getOwnPropertyDescriptor(m3, k2);
        if (!desc || ("get" in desc ? !m3.__esModule : desc.writable || desc.configurable)) {
          desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
            return m3[k2];
          }, "get") };
        }
        Object.defineProperty(o2, k22, desc);
      }) : (function(o2, m3, k2, k22) {
        if (k22 === void 0) k22 = k2;
        o2[k22] = m3[k2];
      }));
      var __exportStar = exports2 && exports2.__exportStar || function(m3, exports3) {
        for (var p3 in m3) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p3)) __createBinding(exports3, m3, p3);
      };
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.createMessageConnection = exports2.BrowserMessageWriter = exports2.BrowserMessageReader = void 0;
      var ril_1 = require_ril();
      ril_1.default.install();
      var api_1 = require_api();
      __exportStar(require_api(), exports2);
      var BrowserMessageReader = class extends api_1.AbstractMessageReader {
        static {
          __name(this, "BrowserMessageReader");
        }
        constructor(port) {
          super();
          this._onData = new api_1.Emitter();
          this._messageListener = (event3) => {
            this._onData.fire(event3.data);
          };
          port.addEventListener("error", (event3) => this.fireError(event3));
          port.onmessage = this._messageListener;
        }
        listen(callback) {
          return this._onData.event(callback);
        }
      };
      exports2.BrowserMessageReader = BrowserMessageReader;
      var BrowserMessageWriter = class extends api_1.AbstractMessageWriter {
        static {
          __name(this, "BrowserMessageWriter");
        }
        constructor(port) {
          super();
          this.port = port;
          this.errorCount = 0;
          port.addEventListener("error", (event3) => this.fireError(event3));
        }
        write(msg) {
          try {
            this.port.postMessage(msg);
            return Promise.resolve();
          } catch (error3) {
            this.handleError(error3, msg);
            return Promise.reject(error3);
          }
        }
        handleError(error3, msg) {
          this.errorCount++;
          this.fireError(error3, msg, this.errorCount);
        }
        end() {
        }
      };
      exports2.BrowserMessageWriter = BrowserMessageWriter;
      function createMessageConnection(reader, writer, logger, options2) {
        if (logger === void 0) {
          logger = api_1.NullLogger;
        }
        if (api_1.ConnectionStrategy.is(options2)) {
          options2 = { connectionStrategy: options2 };
        }
        return (0, api_1.createMessageConnection)(reader, writer, logger, options2);
      }
      __name(createMessageConnection, "createMessageConnection");
      exports2.createMessageConnection = createMessageConnection;
    }
  });

  // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/browser.js
  var require_browser = __commonJS({
    "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/browser.js"(exports2, module2) {
      "use strict";
      module2.exports = require_main();
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/messages.js
  var require_messages2 = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/messages.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.ProtocolNotificationType = exports2.ProtocolNotificationType0 = exports2.ProtocolRequestType = exports2.ProtocolRequestType0 = exports2.RegistrationType = exports2.MessageDirection = void 0;
      var vscode_jsonrpc_1 = require_main();
      var MessageDirection;
      (function(MessageDirection2) {
        MessageDirection2["clientToServer"] = "clientToServer";
        MessageDirection2["serverToClient"] = "serverToClient";
        MessageDirection2["both"] = "both";
      })(MessageDirection || (exports2.MessageDirection = MessageDirection = {}));
      var RegistrationType = class {
        static {
          __name(this, "RegistrationType");
        }
        constructor(method) {
          this.method = method;
        }
      };
      exports2.RegistrationType = RegistrationType;
      var ProtocolRequestType0 = class extends vscode_jsonrpc_1.RequestType0 {
        static {
          __name(this, "ProtocolRequestType0");
        }
        constructor(method) {
          super(method);
        }
      };
      exports2.ProtocolRequestType0 = ProtocolRequestType0;
      var ProtocolRequestType = class extends vscode_jsonrpc_1.RequestType {
        static {
          __name(this, "ProtocolRequestType");
        }
        constructor(method) {
          super(method, vscode_jsonrpc_1.ParameterStructures.byName);
        }
      };
      exports2.ProtocolRequestType = ProtocolRequestType;
      var ProtocolNotificationType0 = class extends vscode_jsonrpc_1.NotificationType0 {
        static {
          __name(this, "ProtocolNotificationType0");
        }
        constructor(method) {
          super(method);
        }
      };
      exports2.ProtocolNotificationType0 = ProtocolNotificationType0;
      var ProtocolNotificationType = class extends vscode_jsonrpc_1.NotificationType {
        static {
          __name(this, "ProtocolNotificationType");
        }
        constructor(method) {
          super(method, vscode_jsonrpc_1.ParameterStructures.byName);
        }
      };
      exports2.ProtocolNotificationType = ProtocolNotificationType;
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js
  var require_is2 = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.objectLiteral = exports2.typedArray = exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0;
      function boolean(value2) {
        return value2 === true || value2 === false;
      }
      __name(boolean, "boolean");
      exports2.boolean = boolean;
      function string3(value2) {
        return typeof value2 === "string" || value2 instanceof String;
      }
      __name(string3, "string");
      exports2.string = string3;
      function number7(value2) {
        return typeof value2 === "number" || value2 instanceof Number;
      }
      __name(number7, "number");
      exports2.number = number7;
      function error3(value2) {
        return value2 instanceof Error;
      }
      __name(error3, "error");
      exports2.error = error3;
      function func(value2) {
        return typeof value2 === "function";
      }
      __name(func, "func");
      exports2.func = func;
      function array4(value2) {
        return Array.isArray(value2);
      }
      __name(array4, "array");
      exports2.array = array4;
      function stringArray(value2) {
        return array4(value2) && value2.every((elem) => string3(elem));
      }
      __name(stringArray, "stringArray");
      exports2.stringArray = stringArray;
      function typedArray(value2, check) {
        return Array.isArray(value2) && value2.every(check);
      }
      __name(typedArray, "typedArray");
      exports2.typedArray = typedArray;
      function objectLiteral(value2) {
        return value2 !== null && typeof value2 === "object";
      }
      __name(objectLiteral, "objectLiteral");
      exports2.objectLiteral = objectLiteral;
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js
  var require_protocol_implementation = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.ImplementationRequest = void 0;
      var messages_1 = require_messages2();
      var ImplementationRequest;
      (function(ImplementationRequest2) {
        ImplementationRequest2.method = "textDocument/implementation";
        ImplementationRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        ImplementationRequest2.type = new messages_1.ProtocolRequestType(ImplementationRequest2.method);
      })(ImplementationRequest || (exports2.ImplementationRequest = ImplementationRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js
  var require_protocol_typeDefinition = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.TypeDefinitionRequest = void 0;
      var messages_1 = require_messages2();
      var TypeDefinitionRequest;
      (function(TypeDefinitionRequest2) {
        TypeDefinitionRequest2.method = "textDocument/typeDefinition";
        TypeDefinitionRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        TypeDefinitionRequest2.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest2.method);
      })(TypeDefinitionRequest || (exports2.TypeDefinitionRequest = TypeDefinitionRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js
  var require_protocol_workspaceFolder = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = void 0;
      var messages_1 = require_messages2();
      var WorkspaceFoldersRequest;
      (function(WorkspaceFoldersRequest2) {
        WorkspaceFoldersRequest2.method = "workspace/workspaceFolders";
        WorkspaceFoldersRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        WorkspaceFoldersRequest2.type = new messages_1.ProtocolRequestType0(WorkspaceFoldersRequest2.method);
      })(WorkspaceFoldersRequest || (exports2.WorkspaceFoldersRequest = WorkspaceFoldersRequest = {}));
      var DidChangeWorkspaceFoldersNotification;
      (function(DidChangeWorkspaceFoldersNotification2) {
        DidChangeWorkspaceFoldersNotification2.method = "workspace/didChangeWorkspaceFolders";
        DidChangeWorkspaceFoldersNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidChangeWorkspaceFoldersNotification2.type = new messages_1.ProtocolNotificationType(DidChangeWorkspaceFoldersNotification2.method);
      })(DidChangeWorkspaceFoldersNotification || (exports2.DidChangeWorkspaceFoldersNotification = DidChangeWorkspaceFoldersNotification = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js
  var require_protocol_configuration = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.ConfigurationRequest = void 0;
      var messages_1 = require_messages2();
      var ConfigurationRequest;
      (function(ConfigurationRequest2) {
        ConfigurationRequest2.method = "workspace/configuration";
        ConfigurationRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        ConfigurationRequest2.type = new messages_1.ProtocolRequestType(ConfigurationRequest2.method);
      })(ConfigurationRequest || (exports2.ConfigurationRequest = ConfigurationRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js
  var require_protocol_colorProvider = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.ColorPresentationRequest = exports2.DocumentColorRequest = void 0;
      var messages_1 = require_messages2();
      var DocumentColorRequest;
      (function(DocumentColorRequest2) {
        DocumentColorRequest2.method = "textDocument/documentColor";
        DocumentColorRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        DocumentColorRequest2.type = new messages_1.ProtocolRequestType(DocumentColorRequest2.method);
      })(DocumentColorRequest || (exports2.DocumentColorRequest = DocumentColorRequest = {}));
      var ColorPresentationRequest;
      (function(ColorPresentationRequest2) {
        ColorPresentationRequest2.method = "textDocument/colorPresentation";
        ColorPresentationRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        ColorPresentationRequest2.type = new messages_1.ProtocolRequestType(ColorPresentationRequest2.method);
      })(ColorPresentationRequest || (exports2.ColorPresentationRequest = ColorPresentationRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js
  var require_protocol_foldingRange = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.FoldingRangeRefreshRequest = exports2.FoldingRangeRequest = void 0;
      var messages_1 = require_messages2();
      var FoldingRangeRequest;
      (function(FoldingRangeRequest2) {
        FoldingRangeRequest2.method = "textDocument/foldingRange";
        FoldingRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        FoldingRangeRequest2.type = new messages_1.ProtocolRequestType(FoldingRangeRequest2.method);
      })(FoldingRangeRequest || (exports2.FoldingRangeRequest = FoldingRangeRequest = {}));
      var FoldingRangeRefreshRequest;
      (function(FoldingRangeRefreshRequest2) {
        FoldingRangeRefreshRequest2.method = `workspace/foldingRange/refresh`;
        FoldingRangeRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        FoldingRangeRefreshRequest2.type = new messages_1.ProtocolRequestType0(FoldingRangeRefreshRequest2.method);
      })(FoldingRangeRefreshRequest || (exports2.FoldingRangeRefreshRequest = FoldingRangeRefreshRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js
  var require_protocol_declaration = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.DeclarationRequest = void 0;
      var messages_1 = require_messages2();
      var DeclarationRequest;
      (function(DeclarationRequest2) {
        DeclarationRequest2.method = "textDocument/declaration";
        DeclarationRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        DeclarationRequest2.type = new messages_1.ProtocolRequestType(DeclarationRequest2.method);
      })(DeclarationRequest || (exports2.DeclarationRequest = DeclarationRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js
  var require_protocol_selectionRange = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.SelectionRangeRequest = void 0;
      var messages_1 = require_messages2();
      var SelectionRangeRequest;
      (function(SelectionRangeRequest2) {
        SelectionRangeRequest2.method = "textDocument/selectionRange";
        SelectionRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        SelectionRangeRequest2.type = new messages_1.ProtocolRequestType(SelectionRangeRequest2.method);
      })(SelectionRangeRequest || (exports2.SelectionRangeRequest = SelectionRangeRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js
  var require_protocol_progress = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = void 0;
      var vscode_jsonrpc_1 = require_main();
      var messages_1 = require_messages2();
      var WorkDoneProgress;
      (function(WorkDoneProgress2) {
        WorkDoneProgress2.type = new vscode_jsonrpc_1.ProgressType();
        function is2(value2) {
          return value2 === WorkDoneProgress2.type;
        }
        __name(is2, "is");
        WorkDoneProgress2.is = is2;
      })(WorkDoneProgress || (exports2.WorkDoneProgress = WorkDoneProgress = {}));
      var WorkDoneProgressCreateRequest;
      (function(WorkDoneProgressCreateRequest2) {
        WorkDoneProgressCreateRequest2.method = "window/workDoneProgress/create";
        WorkDoneProgressCreateRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        WorkDoneProgressCreateRequest2.type = new messages_1.ProtocolRequestType(WorkDoneProgressCreateRequest2.method);
      })(WorkDoneProgressCreateRequest || (exports2.WorkDoneProgressCreateRequest = WorkDoneProgressCreateRequest = {}));
      var WorkDoneProgressCancelNotification;
      (function(WorkDoneProgressCancelNotification2) {
        WorkDoneProgressCancelNotification2.method = "window/workDoneProgress/cancel";
        WorkDoneProgressCancelNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        WorkDoneProgressCancelNotification2.type = new messages_1.ProtocolNotificationType(WorkDoneProgressCancelNotification2.method);
      })(WorkDoneProgressCancelNotification || (exports2.WorkDoneProgressCancelNotification = WorkDoneProgressCancelNotification = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js
  var require_protocol_callHierarchy = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.CallHierarchyPrepareRequest = void 0;
      var messages_1 = require_messages2();
      var CallHierarchyPrepareRequest;
      (function(CallHierarchyPrepareRequest2) {
        CallHierarchyPrepareRequest2.method = "textDocument/prepareCallHierarchy";
        CallHierarchyPrepareRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        CallHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest2.method);
      })(CallHierarchyPrepareRequest || (exports2.CallHierarchyPrepareRequest = CallHierarchyPrepareRequest = {}));
      var CallHierarchyIncomingCallsRequest;
      (function(CallHierarchyIncomingCallsRequest2) {
        CallHierarchyIncomingCallsRequest2.method = "callHierarchy/incomingCalls";
        CallHierarchyIncomingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        CallHierarchyIncomingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest2.method);
      })(CallHierarchyIncomingCallsRequest || (exports2.CallHierarchyIncomingCallsRequest = CallHierarchyIncomingCallsRequest = {}));
      var CallHierarchyOutgoingCallsRequest;
      (function(CallHierarchyOutgoingCallsRequest2) {
        CallHierarchyOutgoingCallsRequest2.method = "callHierarchy/outgoingCalls";
        CallHierarchyOutgoingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        CallHierarchyOutgoingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest2.method);
      })(CallHierarchyOutgoingCallsRequest || (exports2.CallHierarchyOutgoingCallsRequest = CallHierarchyOutgoingCallsRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js
  var require_protocol_semanticTokens = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.SemanticTokensRegistrationType = exports2.TokenFormat = void 0;
      var messages_1 = require_messages2();
      var TokenFormat;
      (function(TokenFormat2) {
        TokenFormat2.Relative = "relative";
      })(TokenFormat || (exports2.TokenFormat = TokenFormat = {}));
      var SemanticTokensRegistrationType;
      (function(SemanticTokensRegistrationType2) {
        SemanticTokensRegistrationType2.method = "textDocument/semanticTokens";
        SemanticTokensRegistrationType2.type = new messages_1.RegistrationType(SemanticTokensRegistrationType2.method);
      })(SemanticTokensRegistrationType || (exports2.SemanticTokensRegistrationType = SemanticTokensRegistrationType = {}));
      var SemanticTokensRequest;
      (function(SemanticTokensRequest2) {
        SemanticTokensRequest2.method = "textDocument/semanticTokens/full";
        SemanticTokensRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        SemanticTokensRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRequest2.method);
        SemanticTokensRequest2.registrationMethod = SemanticTokensRegistrationType.method;
      })(SemanticTokensRequest || (exports2.SemanticTokensRequest = SemanticTokensRequest = {}));
      var SemanticTokensDeltaRequest;
      (function(SemanticTokensDeltaRequest2) {
        SemanticTokensDeltaRequest2.method = "textDocument/semanticTokens/full/delta";
        SemanticTokensDeltaRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        SemanticTokensDeltaRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest2.method);
        SemanticTokensDeltaRequest2.registrationMethod = SemanticTokensRegistrationType.method;
      })(SemanticTokensDeltaRequest || (exports2.SemanticTokensDeltaRequest = SemanticTokensDeltaRequest = {}));
      var SemanticTokensRangeRequest;
      (function(SemanticTokensRangeRequest2) {
        SemanticTokensRangeRequest2.method = "textDocument/semanticTokens/range";
        SemanticTokensRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        SemanticTokensRangeRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest2.method);
        SemanticTokensRangeRequest2.registrationMethod = SemanticTokensRegistrationType.method;
      })(SemanticTokensRangeRequest || (exports2.SemanticTokensRangeRequest = SemanticTokensRangeRequest = {}));
      var SemanticTokensRefreshRequest;
      (function(SemanticTokensRefreshRequest2) {
        SemanticTokensRefreshRequest2.method = `workspace/semanticTokens/refresh`;
        SemanticTokensRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        SemanticTokensRefreshRequest2.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest2.method);
      })(SemanticTokensRefreshRequest || (exports2.SemanticTokensRefreshRequest = SemanticTokensRefreshRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js
  var require_protocol_showDocument = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.ShowDocumentRequest = void 0;
      var messages_1 = require_messages2();
      var ShowDocumentRequest;
      (function(ShowDocumentRequest2) {
        ShowDocumentRequest2.method = "window/showDocument";
        ShowDocumentRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        ShowDocumentRequest2.type = new messages_1.ProtocolRequestType(ShowDocumentRequest2.method);
      })(ShowDocumentRequest || (exports2.ShowDocumentRequest = ShowDocumentRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js
  var require_protocol_linkedEditingRange = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.LinkedEditingRangeRequest = void 0;
      var messages_1 = require_messages2();
      var LinkedEditingRangeRequest;
      (function(LinkedEditingRangeRequest2) {
        LinkedEditingRangeRequest2.method = "textDocument/linkedEditingRange";
        LinkedEditingRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        LinkedEditingRangeRequest2.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest2.method);
      })(LinkedEditingRangeRequest || (exports2.LinkedEditingRangeRequest = LinkedEditingRangeRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js
  var require_protocol_fileOperations = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.DidRenameFilesNotification = exports2.WillRenameFilesRequest = exports2.DidCreateFilesNotification = exports2.WillCreateFilesRequest = exports2.FileOperationPatternKind = void 0;
      var messages_1 = require_messages2();
      var FileOperationPatternKind;
      (function(FileOperationPatternKind2) {
        FileOperationPatternKind2.file = "file";
        FileOperationPatternKind2.folder = "folder";
      })(FileOperationPatternKind || (exports2.FileOperationPatternKind = FileOperationPatternKind = {}));
      var WillCreateFilesRequest;
      (function(WillCreateFilesRequest2) {
        WillCreateFilesRequest2.method = "workspace/willCreateFiles";
        WillCreateFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        WillCreateFilesRequest2.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest2.method);
      })(WillCreateFilesRequest || (exports2.WillCreateFilesRequest = WillCreateFilesRequest = {}));
      var DidCreateFilesNotification;
      (function(DidCreateFilesNotification2) {
        DidCreateFilesNotification2.method = "workspace/didCreateFiles";
        DidCreateFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidCreateFilesNotification2.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification2.method);
      })(DidCreateFilesNotification || (exports2.DidCreateFilesNotification = DidCreateFilesNotification = {}));
      var WillRenameFilesRequest;
      (function(WillRenameFilesRequest2) {
        WillRenameFilesRequest2.method = "workspace/willRenameFiles";
        WillRenameFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        WillRenameFilesRequest2.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest2.method);
      })(WillRenameFilesRequest || (exports2.WillRenameFilesRequest = WillRenameFilesRequest = {}));
      var DidRenameFilesNotification;
      (function(DidRenameFilesNotification2) {
        DidRenameFilesNotification2.method = "workspace/didRenameFiles";
        DidRenameFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidRenameFilesNotification2.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification2.method);
      })(DidRenameFilesNotification || (exports2.DidRenameFilesNotification = DidRenameFilesNotification = {}));
      var DidDeleteFilesNotification;
      (function(DidDeleteFilesNotification2) {
        DidDeleteFilesNotification2.method = "workspace/didDeleteFiles";
        DidDeleteFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidDeleteFilesNotification2.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification2.method);
      })(DidDeleteFilesNotification || (exports2.DidDeleteFilesNotification = DidDeleteFilesNotification = {}));
      var WillDeleteFilesRequest;
      (function(WillDeleteFilesRequest2) {
        WillDeleteFilesRequest2.method = "workspace/willDeleteFiles";
        WillDeleteFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        WillDeleteFilesRequest2.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest2.method);
      })(WillDeleteFilesRequest || (exports2.WillDeleteFilesRequest = WillDeleteFilesRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js
  var require_protocol_moniker = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = void 0;
      var messages_1 = require_messages2();
      var UniquenessLevel;
      (function(UniquenessLevel2) {
        UniquenessLevel2.document = "document";
        UniquenessLevel2.project = "project";
        UniquenessLevel2.group = "group";
        UniquenessLevel2.scheme = "scheme";
        UniquenessLevel2.global = "global";
      })(UniquenessLevel || (exports2.UniquenessLevel = UniquenessLevel = {}));
      var MonikerKind;
      (function(MonikerKind2) {
        MonikerKind2.$import = "import";
        MonikerKind2.$export = "export";
        MonikerKind2.local = "local";
      })(MonikerKind || (exports2.MonikerKind = MonikerKind = {}));
      var MonikerRequest;
      (function(MonikerRequest2) {
        MonikerRequest2.method = "textDocument/moniker";
        MonikerRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        MonikerRequest2.type = new messages_1.ProtocolRequestType(MonikerRequest2.method);
      })(MonikerRequest || (exports2.MonikerRequest = MonikerRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js
  var require_protocol_typeHierarchy = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.TypeHierarchySubtypesRequest = exports2.TypeHierarchySupertypesRequest = exports2.TypeHierarchyPrepareRequest = void 0;
      var messages_1 = require_messages2();
      var TypeHierarchyPrepareRequest;
      (function(TypeHierarchyPrepareRequest2) {
        TypeHierarchyPrepareRequest2.method = "textDocument/prepareTypeHierarchy";
        TypeHierarchyPrepareRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        TypeHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchyPrepareRequest2.method);
      })(TypeHierarchyPrepareRequest || (exports2.TypeHierarchyPrepareRequest = TypeHierarchyPrepareRequest = {}));
      var TypeHierarchySupertypesRequest;
      (function(TypeHierarchySupertypesRequest2) {
        TypeHierarchySupertypesRequest2.method = "typeHierarchy/supertypes";
        TypeHierarchySupertypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        TypeHierarchySupertypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySupertypesRequest2.method);
      })(TypeHierarchySupertypesRequest || (exports2.TypeHierarchySupertypesRequest = TypeHierarchySupertypesRequest = {}));
      var TypeHierarchySubtypesRequest;
      (function(TypeHierarchySubtypesRequest2) {
        TypeHierarchySubtypesRequest2.method = "typeHierarchy/subtypes";
        TypeHierarchySubtypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        TypeHierarchySubtypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySubtypesRequest2.method);
      })(TypeHierarchySubtypesRequest || (exports2.TypeHierarchySubtypesRequest = TypeHierarchySubtypesRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js
  var require_protocol_inlineValue = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.InlineValueRefreshRequest = exports2.InlineValueRequest = void 0;
      var messages_1 = require_messages2();
      var InlineValueRequest;
      (function(InlineValueRequest2) {
        InlineValueRequest2.method = "textDocument/inlineValue";
        InlineValueRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        InlineValueRequest2.type = new messages_1.ProtocolRequestType(InlineValueRequest2.method);
      })(InlineValueRequest || (exports2.InlineValueRequest = InlineValueRequest = {}));
      var InlineValueRefreshRequest;
      (function(InlineValueRefreshRequest2) {
        InlineValueRefreshRequest2.method = `workspace/inlineValue/refresh`;
        InlineValueRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        InlineValueRefreshRequest2.type = new messages_1.ProtocolRequestType0(InlineValueRefreshRequest2.method);
      })(InlineValueRefreshRequest || (exports2.InlineValueRefreshRequest = InlineValueRefreshRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js
  var require_protocol_inlayHint = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.InlayHintRefreshRequest = exports2.InlayHintResolveRequest = exports2.InlayHintRequest = void 0;
      var messages_1 = require_messages2();
      var InlayHintRequest;
      (function(InlayHintRequest2) {
        InlayHintRequest2.method = "textDocument/inlayHint";
        InlayHintRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        InlayHintRequest2.type = new messages_1.ProtocolRequestType(InlayHintRequest2.method);
      })(InlayHintRequest || (exports2.InlayHintRequest = InlayHintRequest = {}));
      var InlayHintResolveRequest;
      (function(InlayHintResolveRequest2) {
        InlayHintResolveRequest2.method = "inlayHint/resolve";
        InlayHintResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        InlayHintResolveRequest2.type = new messages_1.ProtocolRequestType(InlayHintResolveRequest2.method);
      })(InlayHintResolveRequest || (exports2.InlayHintResolveRequest = InlayHintResolveRequest = {}));
      var InlayHintRefreshRequest;
      (function(InlayHintRefreshRequest2) {
        InlayHintRefreshRequest2.method = `workspace/inlayHint/refresh`;
        InlayHintRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        InlayHintRefreshRequest2.type = new messages_1.ProtocolRequestType0(InlayHintRefreshRequest2.method);
      })(InlayHintRefreshRequest || (exports2.InlayHintRefreshRequest = InlayHintRefreshRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js
  var require_protocol_diagnostic = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.DiagnosticRefreshRequest = exports2.WorkspaceDiagnosticRequest = exports2.DocumentDiagnosticRequest = exports2.DocumentDiagnosticReportKind = exports2.DiagnosticServerCancellationData = void 0;
      var vscode_jsonrpc_1 = require_main();
      var Is2 = require_is2();
      var messages_1 = require_messages2();
      var DiagnosticServerCancellationData;
      (function(DiagnosticServerCancellationData2) {
        function is2(value2) {
          const candidate = value2;
          return candidate && Is2.boolean(candidate.retriggerRequest);
        }
        __name(is2, "is");
        DiagnosticServerCancellationData2.is = is2;
      })(DiagnosticServerCancellationData || (exports2.DiagnosticServerCancellationData = DiagnosticServerCancellationData = {}));
      var DocumentDiagnosticReportKind;
      (function(DocumentDiagnosticReportKind2) {
        DocumentDiagnosticReportKind2.Full = "full";
        DocumentDiagnosticReportKind2.Unchanged = "unchanged";
      })(DocumentDiagnosticReportKind || (exports2.DocumentDiagnosticReportKind = DocumentDiagnosticReportKind = {}));
      var DocumentDiagnosticRequest;
      (function(DocumentDiagnosticRequest2) {
        DocumentDiagnosticRequest2.method = "textDocument/diagnostic";
        DocumentDiagnosticRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        DocumentDiagnosticRequest2.type = new messages_1.ProtocolRequestType(DocumentDiagnosticRequest2.method);
        DocumentDiagnosticRequest2.partialResult = new vscode_jsonrpc_1.ProgressType();
      })(DocumentDiagnosticRequest || (exports2.DocumentDiagnosticRequest = DocumentDiagnosticRequest = {}));
      var WorkspaceDiagnosticRequest;
      (function(WorkspaceDiagnosticRequest2) {
        WorkspaceDiagnosticRequest2.method = "workspace/diagnostic";
        WorkspaceDiagnosticRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        WorkspaceDiagnosticRequest2.type = new messages_1.ProtocolRequestType(WorkspaceDiagnosticRequest2.method);
        WorkspaceDiagnosticRequest2.partialResult = new vscode_jsonrpc_1.ProgressType();
      })(WorkspaceDiagnosticRequest || (exports2.WorkspaceDiagnosticRequest = WorkspaceDiagnosticRequest = {}));
      var DiagnosticRefreshRequest;
      (function(DiagnosticRefreshRequest2) {
        DiagnosticRefreshRequest2.method = `workspace/diagnostic/refresh`;
        DiagnosticRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        DiagnosticRefreshRequest2.type = new messages_1.ProtocolRequestType0(DiagnosticRefreshRequest2.method);
      })(DiagnosticRefreshRequest || (exports2.DiagnosticRefreshRequest = DiagnosticRefreshRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js
  var require_protocol_notebook = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.DidCloseNotebookDocumentNotification = exports2.DidSaveNotebookDocumentNotification = exports2.DidChangeNotebookDocumentNotification = exports2.NotebookCellArrayChange = exports2.DidOpenNotebookDocumentNotification = exports2.NotebookDocumentSyncRegistrationType = exports2.NotebookDocument = exports2.NotebookCell = exports2.ExecutionSummary = exports2.NotebookCellKind = void 0;
      var vscode_languageserver_types_1 = (init_main(), __toCommonJS(main_exports));
      var Is2 = require_is2();
      var messages_1 = require_messages2();
      var NotebookCellKind;
      (function(NotebookCellKind2) {
        NotebookCellKind2.Markup = 1;
        NotebookCellKind2.Code = 2;
        function is2(value2) {
          return value2 === 1 || value2 === 2;
        }
        __name(is2, "is");
        NotebookCellKind2.is = is2;
      })(NotebookCellKind || (exports2.NotebookCellKind = NotebookCellKind = {}));
      var ExecutionSummary;
      (function(ExecutionSummary2) {
        function create4(executionOrder, success) {
          const result = { executionOrder };
          if (success === true || success === false) {
            result.success = success;
          }
          return result;
        }
        __name(create4, "create");
        ExecutionSummary2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return Is2.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.executionOrder) && (candidate.success === void 0 || Is2.boolean(candidate.success));
        }
        __name(is2, "is");
        ExecutionSummary2.is = is2;
        function equals(one4, other) {
          if (one4 === other) {
            return true;
          }
          if (one4 === null || one4 === void 0 || other === null || other === void 0) {
            return false;
          }
          return one4.executionOrder === other.executionOrder && one4.success === other.success;
        }
        __name(equals, "equals");
        ExecutionSummary2.equals = equals;
      })(ExecutionSummary || (exports2.ExecutionSummary = ExecutionSummary = {}));
      var NotebookCell;
      (function(NotebookCell2) {
        function create4(kind, document2) {
          return { kind, document: document2 };
        }
        __name(create4, "create");
        NotebookCell2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return Is2.objectLiteral(candidate) && NotebookCellKind.is(candidate.kind) && vscode_languageserver_types_1.DocumentUri.is(candidate.document) && (candidate.metadata === void 0 || Is2.objectLiteral(candidate.metadata));
        }
        __name(is2, "is");
        NotebookCell2.is = is2;
        function diff2(one4, two) {
          const result = /* @__PURE__ */ new Set();
          if (one4.document !== two.document) {
            result.add("document");
          }
          if (one4.kind !== two.kind) {
            result.add("kind");
          }
          if (one4.executionSummary !== two.executionSummary) {
            result.add("executionSummary");
          }
          if ((one4.metadata !== void 0 || two.metadata !== void 0) && !equalsMetadata(one4.metadata, two.metadata)) {
            result.add("metadata");
          }
          if ((one4.executionSummary !== void 0 || two.executionSummary !== void 0) && !ExecutionSummary.equals(one4.executionSummary, two.executionSummary)) {
            result.add("executionSummary");
          }
          return result;
        }
        __name(diff2, "diff");
        NotebookCell2.diff = diff2;
        function equalsMetadata(one4, other) {
          if (one4 === other) {
            return true;
          }
          if (one4 === null || one4 === void 0 || other === null || other === void 0) {
            return false;
          }
          if (typeof one4 !== typeof other) {
            return false;
          }
          if (typeof one4 !== "object") {
            return false;
          }
          const oneArray = Array.isArray(one4);
          const otherArray = Array.isArray(other);
          if (oneArray !== otherArray) {
            return false;
          }
          if (oneArray && otherArray) {
            if (one4.length !== other.length) {
              return false;
            }
            for (let i2 = 0; i2 < one4.length; i2++) {
              if (!equalsMetadata(one4[i2], other[i2])) {
                return false;
              }
            }
          }
          if (Is2.objectLiteral(one4) && Is2.objectLiteral(other)) {
            const oneKeys = Object.keys(one4);
            const otherKeys = Object.keys(other);
            if (oneKeys.length !== otherKeys.length) {
              return false;
            }
            oneKeys.sort();
            otherKeys.sort();
            if (!equalsMetadata(oneKeys, otherKeys)) {
              return false;
            }
            for (let i2 = 0; i2 < oneKeys.length; i2++) {
              const prop = oneKeys[i2];
              if (!equalsMetadata(one4[prop], other[prop])) {
                return false;
              }
            }
          }
          return true;
        }
        __name(equalsMetadata, "equalsMetadata");
      })(NotebookCell || (exports2.NotebookCell = NotebookCell = {}));
      var NotebookDocument;
      (function(NotebookDocument2) {
        function create4(uri, notebookType, version3, cells) {
          return { uri, notebookType, version: version3, cells };
        }
        __name(create4, "create");
        NotebookDocument2.create = create4;
        function is2(value2) {
          const candidate = value2;
          return Is2.objectLiteral(candidate) && Is2.string(candidate.uri) && vscode_languageserver_types_1.integer.is(candidate.version) && Is2.typedArray(candidate.cells, NotebookCell.is);
        }
        __name(is2, "is");
        NotebookDocument2.is = is2;
      })(NotebookDocument || (exports2.NotebookDocument = NotebookDocument = {}));
      var NotebookDocumentSyncRegistrationType;
      (function(NotebookDocumentSyncRegistrationType2) {
        NotebookDocumentSyncRegistrationType2.method = "notebookDocument/sync";
        NotebookDocumentSyncRegistrationType2.messageDirection = messages_1.MessageDirection.clientToServer;
        NotebookDocumentSyncRegistrationType2.type = new messages_1.RegistrationType(NotebookDocumentSyncRegistrationType2.method);
      })(NotebookDocumentSyncRegistrationType || (exports2.NotebookDocumentSyncRegistrationType = NotebookDocumentSyncRegistrationType = {}));
      var DidOpenNotebookDocumentNotification;
      (function(DidOpenNotebookDocumentNotification2) {
        DidOpenNotebookDocumentNotification2.method = "notebookDocument/didOpen";
        DidOpenNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidOpenNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenNotebookDocumentNotification2.method);
        DidOpenNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method;
      })(DidOpenNotebookDocumentNotification || (exports2.DidOpenNotebookDocumentNotification = DidOpenNotebookDocumentNotification = {}));
      var NotebookCellArrayChange;
      (function(NotebookCellArrayChange2) {
        function is2(value2) {
          const candidate = value2;
          return Is2.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.start) && vscode_languageserver_types_1.uinteger.is(candidate.deleteCount) && (candidate.cells === void 0 || Is2.typedArray(candidate.cells, NotebookCell.is));
        }
        __name(is2, "is");
        NotebookCellArrayChange2.is = is2;
        function create4(start3, deleteCount, cells) {
          const result = { start: start3, deleteCount };
          if (cells !== void 0) {
            result.cells = cells;
          }
          return result;
        }
        __name(create4, "create");
        NotebookCellArrayChange2.create = create4;
      })(NotebookCellArrayChange || (exports2.NotebookCellArrayChange = NotebookCellArrayChange = {}));
      var DidChangeNotebookDocumentNotification;
      (function(DidChangeNotebookDocumentNotification2) {
        DidChangeNotebookDocumentNotification2.method = "notebookDocument/didChange";
        DidChangeNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidChangeNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeNotebookDocumentNotification2.method);
        DidChangeNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method;
      })(DidChangeNotebookDocumentNotification || (exports2.DidChangeNotebookDocumentNotification = DidChangeNotebookDocumentNotification = {}));
      var DidSaveNotebookDocumentNotification;
      (function(DidSaveNotebookDocumentNotification2) {
        DidSaveNotebookDocumentNotification2.method = "notebookDocument/didSave";
        DidSaveNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidSaveNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveNotebookDocumentNotification2.method);
        DidSaveNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method;
      })(DidSaveNotebookDocumentNotification || (exports2.DidSaveNotebookDocumentNotification = DidSaveNotebookDocumentNotification = {}));
      var DidCloseNotebookDocumentNotification;
      (function(DidCloseNotebookDocumentNotification2) {
        DidCloseNotebookDocumentNotification2.method = "notebookDocument/didClose";
        DidCloseNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidCloseNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseNotebookDocumentNotification2.method);
        DidCloseNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method;
      })(DidCloseNotebookDocumentNotification || (exports2.DidCloseNotebookDocumentNotification = DidCloseNotebookDocumentNotification = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js
  var require_protocol_inlineCompletion = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.InlineCompletionRequest = void 0;
      var messages_1 = require_messages2();
      var InlineCompletionRequest;
      (function(InlineCompletionRequest2) {
        InlineCompletionRequest2.method = "textDocument/inlineCompletion";
        InlineCompletionRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        InlineCompletionRequest2.type = new messages_1.ProtocolRequestType(InlineCompletionRequest2.method);
      })(InlineCompletionRequest || (exports2.InlineCompletionRequest = InlineCompletionRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.js
  var require_protocol = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.WorkspaceSymbolRequest = exports2.CodeActionResolveRequest = exports2.CodeActionRequest = exports2.DocumentSymbolRequest = exports2.DocumentHighlightRequest = exports2.ReferencesRequest = exports2.DefinitionRequest = exports2.SignatureHelpRequest = exports2.SignatureHelpTriggerKind = exports2.HoverRequest = exports2.CompletionResolveRequest = exports2.CompletionRequest = exports2.CompletionTriggerKind = exports2.PublishDiagnosticsNotification = exports2.WatchKind = exports2.RelativePattern = exports2.FileChangeType = exports2.DidChangeWatchedFilesNotification = exports2.WillSaveTextDocumentWaitUntilRequest = exports2.WillSaveTextDocumentNotification = exports2.TextDocumentSaveReason = exports2.DidSaveTextDocumentNotification = exports2.DidCloseTextDocumentNotification = exports2.DidChangeTextDocumentNotification = exports2.TextDocumentContentChangeEvent = exports2.DidOpenTextDocumentNotification = exports2.TextDocumentSyncKind = exports2.TelemetryEventNotification = exports2.LogMessageNotification = exports2.ShowMessageRequest = exports2.ShowMessageNotification = exports2.MessageType = exports2.DidChangeConfigurationNotification = exports2.ExitNotification = exports2.ShutdownRequest = exports2.InitializedNotification = exports2.InitializeErrorCodes = exports2.InitializeRequest = exports2.WorkDoneProgressOptions = exports2.TextDocumentRegistrationOptions = exports2.StaticRegistrationOptions = exports2.PositionEncodingKind = exports2.FailureHandlingKind = exports2.ResourceOperationKind = exports2.UnregistrationRequest = exports2.RegistrationRequest = exports2.DocumentSelector = exports2.NotebookCellTextDocumentFilter = exports2.NotebookDocumentFilter = exports2.TextDocumentFilter = void 0;
      exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.WillRenameFilesRequest = exports2.DidRenameFilesNotification = exports2.WillCreateFilesRequest = exports2.DidCreateFilesNotification = exports2.FileOperationPatternKind = exports2.LinkedEditingRangeRequest = exports2.ShowDocumentRequest = exports2.SemanticTokensRegistrationType = exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.TokenFormat = exports2.CallHierarchyPrepareRequest = exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = exports2.SelectionRangeRequest = exports2.DeclarationRequest = exports2.FoldingRangeRefreshRequest = exports2.FoldingRangeRequest = exports2.ColorPresentationRequest = exports2.DocumentColorRequest = exports2.ConfigurationRequest = exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = exports2.TypeDefinitionRequest = exports2.ImplementationRequest = exports2.ApplyWorkspaceEditRequest = exports2.ExecuteCommandRequest = exports2.PrepareRenameRequest = exports2.RenameRequest = exports2.PrepareSupportDefaultBehavior = exports2.DocumentOnTypeFormattingRequest = exports2.DocumentRangesFormattingRequest = exports2.DocumentRangeFormattingRequest = exports2.DocumentFormattingRequest = exports2.DocumentLinkResolveRequest = exports2.DocumentLinkRequest = exports2.CodeLensRefreshRequest = exports2.CodeLensResolveRequest = exports2.CodeLensRequest = exports2.WorkspaceSymbolResolveRequest = void 0;
      exports2.InlineCompletionRequest = exports2.DidCloseNotebookDocumentNotification = exports2.DidSaveNotebookDocumentNotification = exports2.DidChangeNotebookDocumentNotification = exports2.NotebookCellArrayChange = exports2.DidOpenNotebookDocumentNotification = exports2.NotebookDocumentSyncRegistrationType = exports2.NotebookDocument = exports2.NotebookCell = exports2.ExecutionSummary = exports2.NotebookCellKind = exports2.DiagnosticRefreshRequest = exports2.WorkspaceDiagnosticRequest = exports2.DocumentDiagnosticRequest = exports2.DocumentDiagnosticReportKind = exports2.DiagnosticServerCancellationData = exports2.InlayHintRefreshRequest = exports2.InlayHintResolveRequest = exports2.InlayHintRequest = exports2.InlineValueRefreshRequest = exports2.InlineValueRequest = exports2.TypeHierarchySupertypesRequest = exports2.TypeHierarchySubtypesRequest = exports2.TypeHierarchyPrepareRequest = void 0;
      var messages_1 = require_messages2();
      var vscode_languageserver_types_1 = (init_main(), __toCommonJS(main_exports));
      var Is2 = require_is2();
      var protocol_implementation_1 = require_protocol_implementation();
      Object.defineProperty(exports2, "ImplementationRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_implementation_1.ImplementationRequest;
      }, "get") });
      var protocol_typeDefinition_1 = require_protocol_typeDefinition();
      Object.defineProperty(exports2, "TypeDefinitionRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_typeDefinition_1.TypeDefinitionRequest;
      }, "get") });
      var protocol_workspaceFolder_1 = require_protocol_workspaceFolder();
      Object.defineProperty(exports2, "WorkspaceFoldersRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_workspaceFolder_1.WorkspaceFoldersRequest;
      }, "get") });
      Object.defineProperty(exports2, "DidChangeWorkspaceFoldersNotification", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_workspaceFolder_1.DidChangeWorkspaceFoldersNotification;
      }, "get") });
      var protocol_configuration_1 = require_protocol_configuration();
      Object.defineProperty(exports2, "ConfigurationRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_configuration_1.ConfigurationRequest;
      }, "get") });
      var protocol_colorProvider_1 = require_protocol_colorProvider();
      Object.defineProperty(exports2, "DocumentColorRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_colorProvider_1.DocumentColorRequest;
      }, "get") });
      Object.defineProperty(exports2, "ColorPresentationRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_colorProvider_1.ColorPresentationRequest;
      }, "get") });
      var protocol_foldingRange_1 = require_protocol_foldingRange();
      Object.defineProperty(exports2, "FoldingRangeRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_foldingRange_1.FoldingRangeRequest;
      }, "get") });
      Object.defineProperty(exports2, "FoldingRangeRefreshRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_foldingRange_1.FoldingRangeRefreshRequest;
      }, "get") });
      var protocol_declaration_1 = require_protocol_declaration();
      Object.defineProperty(exports2, "DeclarationRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_declaration_1.DeclarationRequest;
      }, "get") });
      var protocol_selectionRange_1 = require_protocol_selectionRange();
      Object.defineProperty(exports2, "SelectionRangeRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_selectionRange_1.SelectionRangeRequest;
      }, "get") });
      var protocol_progress_1 = require_protocol_progress();
      Object.defineProperty(exports2, "WorkDoneProgress", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_progress_1.WorkDoneProgress;
      }, "get") });
      Object.defineProperty(exports2, "WorkDoneProgressCreateRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_progress_1.WorkDoneProgressCreateRequest;
      }, "get") });
      Object.defineProperty(exports2, "WorkDoneProgressCancelNotification", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_progress_1.WorkDoneProgressCancelNotification;
      }, "get") });
      var protocol_callHierarchy_1 = require_protocol_callHierarchy();
      Object.defineProperty(exports2, "CallHierarchyIncomingCallsRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest;
      }, "get") });
      Object.defineProperty(exports2, "CallHierarchyOutgoingCallsRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest;
      }, "get") });
      Object.defineProperty(exports2, "CallHierarchyPrepareRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_callHierarchy_1.CallHierarchyPrepareRequest;
      }, "get") });
      var protocol_semanticTokens_1 = require_protocol_semanticTokens();
      Object.defineProperty(exports2, "TokenFormat", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_semanticTokens_1.TokenFormat;
      }, "get") });
      Object.defineProperty(exports2, "SemanticTokensRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_semanticTokens_1.SemanticTokensRequest;
      }, "get") });
      Object.defineProperty(exports2, "SemanticTokensDeltaRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_semanticTokens_1.SemanticTokensDeltaRequest;
      }, "get") });
      Object.defineProperty(exports2, "SemanticTokensRangeRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_semanticTokens_1.SemanticTokensRangeRequest;
      }, "get") });
      Object.defineProperty(exports2, "SemanticTokensRefreshRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_semanticTokens_1.SemanticTokensRefreshRequest;
      }, "get") });
      Object.defineProperty(exports2, "SemanticTokensRegistrationType", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_semanticTokens_1.SemanticTokensRegistrationType;
      }, "get") });
      var protocol_showDocument_1 = require_protocol_showDocument();
      Object.defineProperty(exports2, "ShowDocumentRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_showDocument_1.ShowDocumentRequest;
      }, "get") });
      var protocol_linkedEditingRange_1 = require_protocol_linkedEditingRange();
      Object.defineProperty(exports2, "LinkedEditingRangeRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_linkedEditingRange_1.LinkedEditingRangeRequest;
      }, "get") });
      var protocol_fileOperations_1 = require_protocol_fileOperations();
      Object.defineProperty(exports2, "FileOperationPatternKind", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_fileOperations_1.FileOperationPatternKind;
      }, "get") });
      Object.defineProperty(exports2, "DidCreateFilesNotification", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_fileOperations_1.DidCreateFilesNotification;
      }, "get") });
      Object.defineProperty(exports2, "WillCreateFilesRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_fileOperations_1.WillCreateFilesRequest;
      }, "get") });
      Object.defineProperty(exports2, "DidRenameFilesNotification", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_fileOperations_1.DidRenameFilesNotification;
      }, "get") });
      Object.defineProperty(exports2, "WillRenameFilesRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_fileOperations_1.WillRenameFilesRequest;
      }, "get") });
      Object.defineProperty(exports2, "DidDeleteFilesNotification", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_fileOperations_1.DidDeleteFilesNotification;
      }, "get") });
      Object.defineProperty(exports2, "WillDeleteFilesRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_fileOperations_1.WillDeleteFilesRequest;
      }, "get") });
      var protocol_moniker_1 = require_protocol_moniker();
      Object.defineProperty(exports2, "UniquenessLevel", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_moniker_1.UniquenessLevel;
      }, "get") });
      Object.defineProperty(exports2, "MonikerKind", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_moniker_1.MonikerKind;
      }, "get") });
      Object.defineProperty(exports2, "MonikerRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_moniker_1.MonikerRequest;
      }, "get") });
      var protocol_typeHierarchy_1 = require_protocol_typeHierarchy();
      Object.defineProperty(exports2, "TypeHierarchyPrepareRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_typeHierarchy_1.TypeHierarchyPrepareRequest;
      }, "get") });
      Object.defineProperty(exports2, "TypeHierarchySubtypesRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_typeHierarchy_1.TypeHierarchySubtypesRequest;
      }, "get") });
      Object.defineProperty(exports2, "TypeHierarchySupertypesRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_typeHierarchy_1.TypeHierarchySupertypesRequest;
      }, "get") });
      var protocol_inlineValue_1 = require_protocol_inlineValue();
      Object.defineProperty(exports2, "InlineValueRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_inlineValue_1.InlineValueRequest;
      }, "get") });
      Object.defineProperty(exports2, "InlineValueRefreshRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_inlineValue_1.InlineValueRefreshRequest;
      }, "get") });
      var protocol_inlayHint_1 = require_protocol_inlayHint();
      Object.defineProperty(exports2, "InlayHintRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_inlayHint_1.InlayHintRequest;
      }, "get") });
      Object.defineProperty(exports2, "InlayHintResolveRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_inlayHint_1.InlayHintResolveRequest;
      }, "get") });
      Object.defineProperty(exports2, "InlayHintRefreshRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_inlayHint_1.InlayHintRefreshRequest;
      }, "get") });
      var protocol_diagnostic_1 = require_protocol_diagnostic();
      Object.defineProperty(exports2, "DiagnosticServerCancellationData", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_diagnostic_1.DiagnosticServerCancellationData;
      }, "get") });
      Object.defineProperty(exports2, "DocumentDiagnosticReportKind", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_diagnostic_1.DocumentDiagnosticReportKind;
      }, "get") });
      Object.defineProperty(exports2, "DocumentDiagnosticRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_diagnostic_1.DocumentDiagnosticRequest;
      }, "get") });
      Object.defineProperty(exports2, "WorkspaceDiagnosticRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_diagnostic_1.WorkspaceDiagnosticRequest;
      }, "get") });
      Object.defineProperty(exports2, "DiagnosticRefreshRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_diagnostic_1.DiagnosticRefreshRequest;
      }, "get") });
      var protocol_notebook_1 = require_protocol_notebook();
      Object.defineProperty(exports2, "NotebookCellKind", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_notebook_1.NotebookCellKind;
      }, "get") });
      Object.defineProperty(exports2, "ExecutionSummary", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_notebook_1.ExecutionSummary;
      }, "get") });
      Object.defineProperty(exports2, "NotebookCell", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_notebook_1.NotebookCell;
      }, "get") });
      Object.defineProperty(exports2, "NotebookDocument", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_notebook_1.NotebookDocument;
      }, "get") });
      Object.defineProperty(exports2, "NotebookDocumentSyncRegistrationType", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_notebook_1.NotebookDocumentSyncRegistrationType;
      }, "get") });
      Object.defineProperty(exports2, "DidOpenNotebookDocumentNotification", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_notebook_1.DidOpenNotebookDocumentNotification;
      }, "get") });
      Object.defineProperty(exports2, "NotebookCellArrayChange", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_notebook_1.NotebookCellArrayChange;
      }, "get") });
      Object.defineProperty(exports2, "DidChangeNotebookDocumentNotification", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_notebook_1.DidChangeNotebookDocumentNotification;
      }, "get") });
      Object.defineProperty(exports2, "DidSaveNotebookDocumentNotification", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_notebook_1.DidSaveNotebookDocumentNotification;
      }, "get") });
      Object.defineProperty(exports2, "DidCloseNotebookDocumentNotification", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_notebook_1.DidCloseNotebookDocumentNotification;
      }, "get") });
      var protocol_inlineCompletion_1 = require_protocol_inlineCompletion();
      Object.defineProperty(exports2, "InlineCompletionRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return protocol_inlineCompletion_1.InlineCompletionRequest;
      }, "get") });
      var TextDocumentFilter;
      (function(TextDocumentFilter2) {
        function is2(value2) {
          const candidate = value2;
          return Is2.string(candidate) || (Is2.string(candidate.language) || Is2.string(candidate.scheme) || Is2.string(candidate.pattern));
        }
        __name(is2, "is");
        TextDocumentFilter2.is = is2;
      })(TextDocumentFilter || (exports2.TextDocumentFilter = TextDocumentFilter = {}));
      var NotebookDocumentFilter;
      (function(NotebookDocumentFilter2) {
        function is2(value2) {
          const candidate = value2;
          return Is2.objectLiteral(candidate) && (Is2.string(candidate.notebookType) || Is2.string(candidate.scheme) || Is2.string(candidate.pattern));
        }
        __name(is2, "is");
        NotebookDocumentFilter2.is = is2;
      })(NotebookDocumentFilter || (exports2.NotebookDocumentFilter = NotebookDocumentFilter = {}));
      var NotebookCellTextDocumentFilter;
      (function(NotebookCellTextDocumentFilter2) {
        function is2(value2) {
          const candidate = value2;
          return Is2.objectLiteral(candidate) && (Is2.string(candidate.notebook) || NotebookDocumentFilter.is(candidate.notebook)) && (candidate.language === void 0 || Is2.string(candidate.language));
        }
        __name(is2, "is");
        NotebookCellTextDocumentFilter2.is = is2;
      })(NotebookCellTextDocumentFilter || (exports2.NotebookCellTextDocumentFilter = NotebookCellTextDocumentFilter = {}));
      var DocumentSelector;
      (function(DocumentSelector2) {
        function is2(value2) {
          if (!Array.isArray(value2)) {
            return false;
          }
          for (let elem of value2) {
            if (!Is2.string(elem) && !TextDocumentFilter.is(elem) && !NotebookCellTextDocumentFilter.is(elem)) {
              return false;
            }
          }
          return true;
        }
        __name(is2, "is");
        DocumentSelector2.is = is2;
      })(DocumentSelector || (exports2.DocumentSelector = DocumentSelector = {}));
      var RegistrationRequest;
      (function(RegistrationRequest2) {
        RegistrationRequest2.method = "client/registerCapability";
        RegistrationRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        RegistrationRequest2.type = new messages_1.ProtocolRequestType(RegistrationRequest2.method);
      })(RegistrationRequest || (exports2.RegistrationRequest = RegistrationRequest = {}));
      var UnregistrationRequest;
      (function(UnregistrationRequest2) {
        UnregistrationRequest2.method = "client/unregisterCapability";
        UnregistrationRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        UnregistrationRequest2.type = new messages_1.ProtocolRequestType(UnregistrationRequest2.method);
      })(UnregistrationRequest || (exports2.UnregistrationRequest = UnregistrationRequest = {}));
      var ResourceOperationKind;
      (function(ResourceOperationKind2) {
        ResourceOperationKind2.Create = "create";
        ResourceOperationKind2.Rename = "rename";
        ResourceOperationKind2.Delete = "delete";
      })(ResourceOperationKind || (exports2.ResourceOperationKind = ResourceOperationKind = {}));
      var FailureHandlingKind;
      (function(FailureHandlingKind2) {
        FailureHandlingKind2.Abort = "abort";
        FailureHandlingKind2.Transactional = "transactional";
        FailureHandlingKind2.TextOnlyTransactional = "textOnlyTransactional";
        FailureHandlingKind2.Undo = "undo";
      })(FailureHandlingKind || (exports2.FailureHandlingKind = FailureHandlingKind = {}));
      var PositionEncodingKind;
      (function(PositionEncodingKind2) {
        PositionEncodingKind2.UTF8 = "utf-8";
        PositionEncodingKind2.UTF16 = "utf-16";
        PositionEncodingKind2.UTF32 = "utf-32";
      })(PositionEncodingKind || (exports2.PositionEncodingKind = PositionEncodingKind = {}));
      var StaticRegistrationOptions;
      (function(StaticRegistrationOptions2) {
        function hasId(value2) {
          const candidate = value2;
          return candidate && Is2.string(candidate.id) && candidate.id.length > 0;
        }
        __name(hasId, "hasId");
        StaticRegistrationOptions2.hasId = hasId;
      })(StaticRegistrationOptions || (exports2.StaticRegistrationOptions = StaticRegistrationOptions = {}));
      var TextDocumentRegistrationOptions;
      (function(TextDocumentRegistrationOptions2) {
        function is2(value2) {
          const candidate = value2;
          return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));
        }
        __name(is2, "is");
        TextDocumentRegistrationOptions2.is = is2;
      })(TextDocumentRegistrationOptions || (exports2.TextDocumentRegistrationOptions = TextDocumentRegistrationOptions = {}));
      var WorkDoneProgressOptions;
      (function(WorkDoneProgressOptions2) {
        function is2(value2) {
          const candidate = value2;
          return Is2.objectLiteral(candidate) && (candidate.workDoneProgress === void 0 || Is2.boolean(candidate.workDoneProgress));
        }
        __name(is2, "is");
        WorkDoneProgressOptions2.is = is2;
        function hasWorkDoneProgress(value2) {
          const candidate = value2;
          return candidate && Is2.boolean(candidate.workDoneProgress);
        }
        __name(hasWorkDoneProgress, "hasWorkDoneProgress");
        WorkDoneProgressOptions2.hasWorkDoneProgress = hasWorkDoneProgress;
      })(WorkDoneProgressOptions || (exports2.WorkDoneProgressOptions = WorkDoneProgressOptions = {}));
      var InitializeRequest;
      (function(InitializeRequest2) {
        InitializeRequest2.method = "initialize";
        InitializeRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        InitializeRequest2.type = new messages_1.ProtocolRequestType(InitializeRequest2.method);
      })(InitializeRequest || (exports2.InitializeRequest = InitializeRequest = {}));
      var InitializeErrorCodes;
      (function(InitializeErrorCodes2) {
        InitializeErrorCodes2.unknownProtocolVersion = 1;
      })(InitializeErrorCodes || (exports2.InitializeErrorCodes = InitializeErrorCodes = {}));
      var InitializedNotification;
      (function(InitializedNotification2) {
        InitializedNotification2.method = "initialized";
        InitializedNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        InitializedNotification2.type = new messages_1.ProtocolNotificationType(InitializedNotification2.method);
      })(InitializedNotification || (exports2.InitializedNotification = InitializedNotification = {}));
      var ShutdownRequest;
      (function(ShutdownRequest2) {
        ShutdownRequest2.method = "shutdown";
        ShutdownRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        ShutdownRequest2.type = new messages_1.ProtocolRequestType0(ShutdownRequest2.method);
      })(ShutdownRequest || (exports2.ShutdownRequest = ShutdownRequest = {}));
      var ExitNotification;
      (function(ExitNotification2) {
        ExitNotification2.method = "exit";
        ExitNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        ExitNotification2.type = new messages_1.ProtocolNotificationType0(ExitNotification2.method);
      })(ExitNotification || (exports2.ExitNotification = ExitNotification = {}));
      var DidChangeConfigurationNotification;
      (function(DidChangeConfigurationNotification2) {
        DidChangeConfigurationNotification2.method = "workspace/didChangeConfiguration";
        DidChangeConfigurationNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidChangeConfigurationNotification2.type = new messages_1.ProtocolNotificationType(DidChangeConfigurationNotification2.method);
      })(DidChangeConfigurationNotification || (exports2.DidChangeConfigurationNotification = DidChangeConfigurationNotification = {}));
      var MessageType;
      (function(MessageType2) {
        MessageType2.Error = 1;
        MessageType2.Warning = 2;
        MessageType2.Info = 3;
        MessageType2.Log = 4;
        MessageType2.Debug = 5;
      })(MessageType || (exports2.MessageType = MessageType = {}));
      var ShowMessageNotification;
      (function(ShowMessageNotification2) {
        ShowMessageNotification2.method = "window/showMessage";
        ShowMessageNotification2.messageDirection = messages_1.MessageDirection.serverToClient;
        ShowMessageNotification2.type = new messages_1.ProtocolNotificationType(ShowMessageNotification2.method);
      })(ShowMessageNotification || (exports2.ShowMessageNotification = ShowMessageNotification = {}));
      var ShowMessageRequest;
      (function(ShowMessageRequest2) {
        ShowMessageRequest2.method = "window/showMessageRequest";
        ShowMessageRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        ShowMessageRequest2.type = new messages_1.ProtocolRequestType(ShowMessageRequest2.method);
      })(ShowMessageRequest || (exports2.ShowMessageRequest = ShowMessageRequest = {}));
      var LogMessageNotification;
      (function(LogMessageNotification2) {
        LogMessageNotification2.method = "window/logMessage";
        LogMessageNotification2.messageDirection = messages_1.MessageDirection.serverToClient;
        LogMessageNotification2.type = new messages_1.ProtocolNotificationType(LogMessageNotification2.method);
      })(LogMessageNotification || (exports2.LogMessageNotification = LogMessageNotification = {}));
      var TelemetryEventNotification;
      (function(TelemetryEventNotification2) {
        TelemetryEventNotification2.method = "telemetry/event";
        TelemetryEventNotification2.messageDirection = messages_1.MessageDirection.serverToClient;
        TelemetryEventNotification2.type = new messages_1.ProtocolNotificationType(TelemetryEventNotification2.method);
      })(TelemetryEventNotification || (exports2.TelemetryEventNotification = TelemetryEventNotification = {}));
      var TextDocumentSyncKind;
      (function(TextDocumentSyncKind2) {
        TextDocumentSyncKind2.None = 0;
        TextDocumentSyncKind2.Full = 1;
        TextDocumentSyncKind2.Incremental = 2;
      })(TextDocumentSyncKind || (exports2.TextDocumentSyncKind = TextDocumentSyncKind = {}));
      var DidOpenTextDocumentNotification;
      (function(DidOpenTextDocumentNotification2) {
        DidOpenTextDocumentNotification2.method = "textDocument/didOpen";
        DidOpenTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidOpenTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification2.method);
      })(DidOpenTextDocumentNotification || (exports2.DidOpenTextDocumentNotification = DidOpenTextDocumentNotification = {}));
      var TextDocumentContentChangeEvent;
      (function(TextDocumentContentChangeEvent2) {
        function isIncremental(event3) {
          let candidate = event3;
          return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number");
        }
        __name(isIncremental, "isIncremental");
        TextDocumentContentChangeEvent2.isIncremental = isIncremental;
        function isFull(event3) {
          let candidate = event3;
          return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0;
        }
        __name(isFull, "isFull");
        TextDocumentContentChangeEvent2.isFull = isFull;
      })(TextDocumentContentChangeEvent || (exports2.TextDocumentContentChangeEvent = TextDocumentContentChangeEvent = {}));
      var DidChangeTextDocumentNotification;
      (function(DidChangeTextDocumentNotification2) {
        DidChangeTextDocumentNotification2.method = "textDocument/didChange";
        DidChangeTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidChangeTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification2.method);
      })(DidChangeTextDocumentNotification || (exports2.DidChangeTextDocumentNotification = DidChangeTextDocumentNotification = {}));
      var DidCloseTextDocumentNotification;
      (function(DidCloseTextDocumentNotification2) {
        DidCloseTextDocumentNotification2.method = "textDocument/didClose";
        DidCloseTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidCloseTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification2.method);
      })(DidCloseTextDocumentNotification || (exports2.DidCloseTextDocumentNotification = DidCloseTextDocumentNotification = {}));
      var DidSaveTextDocumentNotification;
      (function(DidSaveTextDocumentNotification2) {
        DidSaveTextDocumentNotification2.method = "textDocument/didSave";
        DidSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification2.method);
      })(DidSaveTextDocumentNotification || (exports2.DidSaveTextDocumentNotification = DidSaveTextDocumentNotification = {}));
      var TextDocumentSaveReason;
      (function(TextDocumentSaveReason2) {
        TextDocumentSaveReason2.Manual = 1;
        TextDocumentSaveReason2.AfterDelay = 2;
        TextDocumentSaveReason2.FocusOut = 3;
      })(TextDocumentSaveReason || (exports2.TextDocumentSaveReason = TextDocumentSaveReason = {}));
      var WillSaveTextDocumentNotification;
      (function(WillSaveTextDocumentNotification2) {
        WillSaveTextDocumentNotification2.method = "textDocument/willSave";
        WillSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        WillSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification2.method);
      })(WillSaveTextDocumentNotification || (exports2.WillSaveTextDocumentNotification = WillSaveTextDocumentNotification = {}));
      var WillSaveTextDocumentWaitUntilRequest;
      (function(WillSaveTextDocumentWaitUntilRequest2) {
        WillSaveTextDocumentWaitUntilRequest2.method = "textDocument/willSaveWaitUntil";
        WillSaveTextDocumentWaitUntilRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        WillSaveTextDocumentWaitUntilRequest2.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest2.method);
      })(WillSaveTextDocumentWaitUntilRequest || (exports2.WillSaveTextDocumentWaitUntilRequest = WillSaveTextDocumentWaitUntilRequest = {}));
      var DidChangeWatchedFilesNotification;
      (function(DidChangeWatchedFilesNotification2) {
        DidChangeWatchedFilesNotification2.method = "workspace/didChangeWatchedFiles";
        DidChangeWatchedFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
        DidChangeWatchedFilesNotification2.type = new messages_1.ProtocolNotificationType(DidChangeWatchedFilesNotification2.method);
      })(DidChangeWatchedFilesNotification || (exports2.DidChangeWatchedFilesNotification = DidChangeWatchedFilesNotification = {}));
      var FileChangeType;
      (function(FileChangeType2) {
        FileChangeType2.Created = 1;
        FileChangeType2.Changed = 2;
        FileChangeType2.Deleted = 3;
      })(FileChangeType || (exports2.FileChangeType = FileChangeType = {}));
      var RelativePattern;
      (function(RelativePattern2) {
        function is2(value2) {
          const candidate = value2;
          return Is2.objectLiteral(candidate) && (vscode_languageserver_types_1.URI.is(candidate.baseUri) || vscode_languageserver_types_1.WorkspaceFolder.is(candidate.baseUri)) && Is2.string(candidate.pattern);
        }
        __name(is2, "is");
        RelativePattern2.is = is2;
      })(RelativePattern || (exports2.RelativePattern = RelativePattern = {}));
      var WatchKind;
      (function(WatchKind2) {
        WatchKind2.Create = 1;
        WatchKind2.Change = 2;
        WatchKind2.Delete = 4;
      })(WatchKind || (exports2.WatchKind = WatchKind = {}));
      var PublishDiagnosticsNotification;
      (function(PublishDiagnosticsNotification2) {
        PublishDiagnosticsNotification2.method = "textDocument/publishDiagnostics";
        PublishDiagnosticsNotification2.messageDirection = messages_1.MessageDirection.serverToClient;
        PublishDiagnosticsNotification2.type = new messages_1.ProtocolNotificationType(PublishDiagnosticsNotification2.method);
      })(PublishDiagnosticsNotification || (exports2.PublishDiagnosticsNotification = PublishDiagnosticsNotification = {}));
      var CompletionTriggerKind;
      (function(CompletionTriggerKind2) {
        CompletionTriggerKind2.Invoked = 1;
        CompletionTriggerKind2.TriggerCharacter = 2;
        CompletionTriggerKind2.TriggerForIncompleteCompletions = 3;
      })(CompletionTriggerKind || (exports2.CompletionTriggerKind = CompletionTriggerKind = {}));
      var CompletionRequest;
      (function(CompletionRequest2) {
        CompletionRequest2.method = "textDocument/completion";
        CompletionRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        CompletionRequest2.type = new messages_1.ProtocolRequestType(CompletionRequest2.method);
      })(CompletionRequest || (exports2.CompletionRequest = CompletionRequest = {}));
      var CompletionResolveRequest;
      (function(CompletionResolveRequest2) {
        CompletionResolveRequest2.method = "completionItem/resolve";
        CompletionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        CompletionResolveRequest2.type = new messages_1.ProtocolRequestType(CompletionResolveRequest2.method);
      })(CompletionResolveRequest || (exports2.CompletionResolveRequest = CompletionResolveRequest = {}));
      var HoverRequest;
      (function(HoverRequest2) {
        HoverRequest2.method = "textDocument/hover";
        HoverRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        HoverRequest2.type = new messages_1.ProtocolRequestType(HoverRequest2.method);
      })(HoverRequest || (exports2.HoverRequest = HoverRequest = {}));
      var SignatureHelpTriggerKind;
      (function(SignatureHelpTriggerKind2) {
        SignatureHelpTriggerKind2.Invoked = 1;
        SignatureHelpTriggerKind2.TriggerCharacter = 2;
        SignatureHelpTriggerKind2.ContentChange = 3;
      })(SignatureHelpTriggerKind || (exports2.SignatureHelpTriggerKind = SignatureHelpTriggerKind = {}));
      var SignatureHelpRequest;
      (function(SignatureHelpRequest2) {
        SignatureHelpRequest2.method = "textDocument/signatureHelp";
        SignatureHelpRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        SignatureHelpRequest2.type = new messages_1.ProtocolRequestType(SignatureHelpRequest2.method);
      })(SignatureHelpRequest || (exports2.SignatureHelpRequest = SignatureHelpRequest = {}));
      var DefinitionRequest;
      (function(DefinitionRequest2) {
        DefinitionRequest2.method = "textDocument/definition";
        DefinitionRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        DefinitionRequest2.type = new messages_1.ProtocolRequestType(DefinitionRequest2.method);
      })(DefinitionRequest || (exports2.DefinitionRequest = DefinitionRequest = {}));
      var ReferencesRequest;
      (function(ReferencesRequest2) {
        ReferencesRequest2.method = "textDocument/references";
        ReferencesRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        ReferencesRequest2.type = new messages_1.ProtocolRequestType(ReferencesRequest2.method);
      })(ReferencesRequest || (exports2.ReferencesRequest = ReferencesRequest = {}));
      var DocumentHighlightRequest;
      (function(DocumentHighlightRequest2) {
        DocumentHighlightRequest2.method = "textDocument/documentHighlight";
        DocumentHighlightRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        DocumentHighlightRequest2.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest2.method);
      })(DocumentHighlightRequest || (exports2.DocumentHighlightRequest = DocumentHighlightRequest = {}));
      var DocumentSymbolRequest;
      (function(DocumentSymbolRequest2) {
        DocumentSymbolRequest2.method = "textDocument/documentSymbol";
        DocumentSymbolRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        DocumentSymbolRequest2.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest2.method);
      })(DocumentSymbolRequest || (exports2.DocumentSymbolRequest = DocumentSymbolRequest = {}));
      var CodeActionRequest;
      (function(CodeActionRequest2) {
        CodeActionRequest2.method = "textDocument/codeAction";
        CodeActionRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        CodeActionRequest2.type = new messages_1.ProtocolRequestType(CodeActionRequest2.method);
      })(CodeActionRequest || (exports2.CodeActionRequest = CodeActionRequest = {}));
      var CodeActionResolveRequest;
      (function(CodeActionResolveRequest2) {
        CodeActionResolveRequest2.method = "codeAction/resolve";
        CodeActionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        CodeActionResolveRequest2.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest2.method);
      })(CodeActionResolveRequest || (exports2.CodeActionResolveRequest = CodeActionResolveRequest = {}));
      var WorkspaceSymbolRequest;
      (function(WorkspaceSymbolRequest2) {
        WorkspaceSymbolRequest2.method = "workspace/symbol";
        WorkspaceSymbolRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        WorkspaceSymbolRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest2.method);
      })(WorkspaceSymbolRequest || (exports2.WorkspaceSymbolRequest = WorkspaceSymbolRequest = {}));
      var WorkspaceSymbolResolveRequest;
      (function(WorkspaceSymbolResolveRequest2) {
        WorkspaceSymbolResolveRequest2.method = "workspaceSymbol/resolve";
        WorkspaceSymbolResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        WorkspaceSymbolResolveRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolResolveRequest2.method);
      })(WorkspaceSymbolResolveRequest || (exports2.WorkspaceSymbolResolveRequest = WorkspaceSymbolResolveRequest = {}));
      var CodeLensRequest;
      (function(CodeLensRequest2) {
        CodeLensRequest2.method = "textDocument/codeLens";
        CodeLensRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        CodeLensRequest2.type = new messages_1.ProtocolRequestType(CodeLensRequest2.method);
      })(CodeLensRequest || (exports2.CodeLensRequest = CodeLensRequest = {}));
      var CodeLensResolveRequest;
      (function(CodeLensResolveRequest2) {
        CodeLensResolveRequest2.method = "codeLens/resolve";
        CodeLensResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        CodeLensResolveRequest2.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest2.method);
      })(CodeLensResolveRequest || (exports2.CodeLensResolveRequest = CodeLensResolveRequest = {}));
      var CodeLensRefreshRequest;
      (function(CodeLensRefreshRequest2) {
        CodeLensRefreshRequest2.method = `workspace/codeLens/refresh`;
        CodeLensRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        CodeLensRefreshRequest2.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest2.method);
      })(CodeLensRefreshRequest || (exports2.CodeLensRefreshRequest = CodeLensRefreshRequest = {}));
      var DocumentLinkRequest;
      (function(DocumentLinkRequest2) {
        DocumentLinkRequest2.method = "textDocument/documentLink";
        DocumentLinkRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        DocumentLinkRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkRequest2.method);
      })(DocumentLinkRequest || (exports2.DocumentLinkRequest = DocumentLinkRequest = {}));
      var DocumentLinkResolveRequest;
      (function(DocumentLinkResolveRequest2) {
        DocumentLinkResolveRequest2.method = "documentLink/resolve";
        DocumentLinkResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        DocumentLinkResolveRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest2.method);
      })(DocumentLinkResolveRequest || (exports2.DocumentLinkResolveRequest = DocumentLinkResolveRequest = {}));
      var DocumentFormattingRequest;
      (function(DocumentFormattingRequest2) {
        DocumentFormattingRequest2.method = "textDocument/formatting";
        DocumentFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        DocumentFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest2.method);
      })(DocumentFormattingRequest || (exports2.DocumentFormattingRequest = DocumentFormattingRequest = {}));
      var DocumentRangeFormattingRequest;
      (function(DocumentRangeFormattingRequest2) {
        DocumentRangeFormattingRequest2.method = "textDocument/rangeFormatting";
        DocumentRangeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        DocumentRangeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest2.method);
      })(DocumentRangeFormattingRequest || (exports2.DocumentRangeFormattingRequest = DocumentRangeFormattingRequest = {}));
      var DocumentRangesFormattingRequest;
      (function(DocumentRangesFormattingRequest2) {
        DocumentRangesFormattingRequest2.method = "textDocument/rangesFormatting";
        DocumentRangesFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        DocumentRangesFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangesFormattingRequest2.method);
      })(DocumentRangesFormattingRequest || (exports2.DocumentRangesFormattingRequest = DocumentRangesFormattingRequest = {}));
      var DocumentOnTypeFormattingRequest;
      (function(DocumentOnTypeFormattingRequest2) {
        DocumentOnTypeFormattingRequest2.method = "textDocument/onTypeFormatting";
        DocumentOnTypeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        DocumentOnTypeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest2.method);
      })(DocumentOnTypeFormattingRequest || (exports2.DocumentOnTypeFormattingRequest = DocumentOnTypeFormattingRequest = {}));
      var PrepareSupportDefaultBehavior;
      (function(PrepareSupportDefaultBehavior2) {
        PrepareSupportDefaultBehavior2.Identifier = 1;
      })(PrepareSupportDefaultBehavior || (exports2.PrepareSupportDefaultBehavior = PrepareSupportDefaultBehavior = {}));
      var RenameRequest;
      (function(RenameRequest2) {
        RenameRequest2.method = "textDocument/rename";
        RenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        RenameRequest2.type = new messages_1.ProtocolRequestType(RenameRequest2.method);
      })(RenameRequest || (exports2.RenameRequest = RenameRequest = {}));
      var PrepareRenameRequest;
      (function(PrepareRenameRequest2) {
        PrepareRenameRequest2.method = "textDocument/prepareRename";
        PrepareRenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        PrepareRenameRequest2.type = new messages_1.ProtocolRequestType(PrepareRenameRequest2.method);
      })(PrepareRenameRequest || (exports2.PrepareRenameRequest = PrepareRenameRequest = {}));
      var ExecuteCommandRequest;
      (function(ExecuteCommandRequest2) {
        ExecuteCommandRequest2.method = "workspace/executeCommand";
        ExecuteCommandRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
        ExecuteCommandRequest2.type = new messages_1.ProtocolRequestType(ExecuteCommandRequest2.method);
      })(ExecuteCommandRequest || (exports2.ExecuteCommandRequest = ExecuteCommandRequest = {}));
      var ApplyWorkspaceEditRequest;
      (function(ApplyWorkspaceEditRequest2) {
        ApplyWorkspaceEditRequest2.method = "workspace/applyEdit";
        ApplyWorkspaceEditRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
        ApplyWorkspaceEditRequest2.type = new messages_1.ProtocolRequestType("workspace/applyEdit");
      })(ApplyWorkspaceEditRequest || (exports2.ApplyWorkspaceEditRequest = ApplyWorkspaceEditRequest = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/connection.js
  var require_connection2 = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/connection.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.createProtocolConnection = void 0;
      var vscode_jsonrpc_1 = require_main();
      function createProtocolConnection(input, output2, logger, options2) {
        if (vscode_jsonrpc_1.ConnectionStrategy.is(options2)) {
          options2 = { connectionStrategy: options2 };
        }
        return (0, vscode_jsonrpc_1.createMessageConnection)(input, output2, logger, options2);
      }
      __name(createProtocolConnection, "createProtocolConnection");
      exports2.createProtocolConnection = createProtocolConnection;
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/api.js
  var require_api2 = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/api.js"(exports2) {
      "use strict";
      var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o2, m3, k2, k22) {
        if (k22 === void 0) k22 = k2;
        var desc = Object.getOwnPropertyDescriptor(m3, k2);
        if (!desc || ("get" in desc ? !m3.__esModule : desc.writable || desc.configurable)) {
          desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
            return m3[k2];
          }, "get") };
        }
        Object.defineProperty(o2, k22, desc);
      }) : (function(o2, m3, k2, k22) {
        if (k22 === void 0) k22 = k2;
        o2[k22] = m3[k2];
      }));
      var __exportStar = exports2 && exports2.__exportStar || function(m3, exports3) {
        for (var p3 in m3) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p3)) __createBinding(exports3, m3, p3);
      };
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.LSPErrorCodes = exports2.createProtocolConnection = void 0;
      __exportStar(require_main(), exports2);
      __exportStar((init_main(), __toCommonJS(main_exports)), exports2);
      __exportStar(require_messages2(), exports2);
      __exportStar(require_protocol(), exports2);
      var connection_1 = require_connection2();
      Object.defineProperty(exports2, "createProtocolConnection", { enumerable: true, get: /* @__PURE__ */ __name(function() {
        return connection_1.createProtocolConnection;
      }, "get") });
      var LSPErrorCodes2;
      (function(LSPErrorCodes3) {
        LSPErrorCodes3.lspReservedErrorRangeStart = -32899;
        LSPErrorCodes3.RequestFailed = -32803;
        LSPErrorCodes3.ServerCancelled = -32802;
        LSPErrorCodes3.ContentModified = -32801;
        LSPErrorCodes3.RequestCancelled = -32800;
        LSPErrorCodes3.lspReservedErrorRangeEnd = -32800;
      })(LSPErrorCodes2 || (exports2.LSPErrorCodes = LSPErrorCodes2 = {}));
    }
  });

  // ../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/browser/main.js
  var require_main2 = __commonJS({
    "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/browser/main.js"(exports2) {
      "use strict";
      var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o2, m3, k2, k22) {
        if (k22 === void 0) k22 = k2;
        var desc = Object.getOwnPropertyDescriptor(m3, k2);
        if (!desc || ("get" in desc ? !m3.__esModule : desc.writable || desc.configurable)) {
          desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
            return m3[k2];
          }, "get") };
        }
        Object.defineProperty(o2, k22, desc);
      }) : (function(o2, m3, k2, k22) {
        if (k22 === void 0) k22 = k2;
        o2[k22] = m3[k2];
      }));
      var __exportStar = exports2 && exports2.__exportStar || function(m3, exports3) {
        for (var p3 in m3) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p3)) __createBinding(exports3, m3, p3);
      };
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.createProtocolConnection = void 0;
      var browser_1 = require_browser();
      __exportStar(require_browser(), exports2);
      __exportStar(require_api2(), exports2);
      function createProtocolConnection(reader, writer, logger, options2) {
        return (0, browser_1.createMessageConnection)(reader, writer, logger, options2);
      }
      __name(createProtocolConnection, "createProtocolConnection");
      exports2.createProtocolConnection = createProtocolConnection;
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/disposable.js
  var Disposable;
  var init_disposable = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/disposable.js"() {
      "use strict";
      (function(Disposable2) {
        function create4(callback) {
          return {
            dispose: /* @__PURE__ */ __name(async () => await callback(), "dispose")
          };
        }
        __name(create4, "create");
        Disposable2.create = create4;
      })(Disposable || (Disposable = {}));
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/document-builder.js
  var import_vscode_languageserver_protocol, DefaultDocumentBuilder;
  var init_document_builder = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/document-builder.js"() {
      "use strict";
      import_vscode_languageserver_protocol = __toESM(require_main2(), 1);
      init_cancellation();
      init_disposable();
      init_collections();
      init_promise_utils();
      init_stream();
      init_uri_utils();
      init_documents();
      DefaultDocumentBuilder = class {
        static {
          __name(this, "DefaultDocumentBuilder");
        }
        constructor(services) {
          this.updateBuildOptions = {
            // Default: run only the built-in validation checks and those in the _fast_ category (includes those without category)
            validation: {
              categories: ["built-in", "fast"]
            }
          };
          this.updateListeners = [];
          this.buildPhaseListeners = new MultiMap();
          this.documentPhaseListeners = new MultiMap();
          this.buildState = /* @__PURE__ */ new Map();
          this.documentBuildWaiters = /* @__PURE__ */ new Map();
          this.currentState = DocumentState.Changed;
          this.langiumDocuments = services.workspace.LangiumDocuments;
          this.langiumDocumentFactory = services.workspace.LangiumDocumentFactory;
          this.textDocuments = services.workspace.TextDocuments;
          this.indexManager = services.workspace.IndexManager;
          this.fileSystemProvider = services.workspace.FileSystemProvider;
          this.workspaceManager = () => services.workspace.WorkspaceManager;
          this.serviceRegistry = services.ServiceRegistry;
        }
        async build(documents, options2 = {}, cancelToken = cancellation_exports.CancellationToken.None) {
          for (const document2 of documents) {
            const key = document2.uri.toString();
            if (document2.state === DocumentState.Validated) {
              if (typeof options2.validation === "boolean" && options2.validation) {
                this.resetToState(document2, DocumentState.IndexedReferences);
              } else if (typeof options2.validation === "object") {
                const categories = this.findMissingValidationCategories(document2, options2);
                if (categories.length > 0) {
                  this.buildState.set(key, {
                    completed: false,
                    options: {
                      validation: {
                        categories
                      }
                    },
                    result: this.buildState.get(key)?.result
                  });
                  document2.state = DocumentState.IndexedReferences;
                }
              }
            } else {
              this.buildState.delete(key);
            }
          }
          this.currentState = DocumentState.Changed;
          await this.emitUpdate(documents.map((e3) => e3.uri), []);
          await this.buildDocuments(documents, options2, cancelToken);
        }
        async update(changed, deleted, cancelToken = cancellation_exports.CancellationToken.None) {
          this.currentState = DocumentState.Changed;
          const deletedUris = [];
          for (const deletedUri of deleted) {
            const deletedDocs = this.langiumDocuments.deleteDocuments(deletedUri);
            for (const doc of deletedDocs) {
              deletedUris.push(doc.uri);
              this.cleanUpDeleted(doc);
            }
          }
          const changedUris = (await Promise.all(changed.map((uri) => this.findChangedUris(uri)))).flat();
          for (const changedUri of changedUris) {
            let changedDocument = this.langiumDocuments.getDocument(changedUri);
            if (changedDocument === void 0) {
              changedDocument = this.langiumDocumentFactory.fromModel({ $type: "INVALID" }, changedUri);
              changedDocument.state = DocumentState.Changed;
              this.langiumDocuments.addDocument(changedDocument);
            }
            this.resetToState(changedDocument, DocumentState.Changed);
          }
          const allChangedUris = stream(changedUris).concat(deletedUris).map((uri) => uri.toString()).toSet();
          this.langiumDocuments.all.filter((doc) => !allChangedUris.has(doc.uri.toString()) && this.shouldRelink(doc, allChangedUris)).forEach((doc) => this.resetToState(doc, DocumentState.ComputedScopes));
          await this.emitUpdate(changedUris, deletedUris);
          await interruptAndCheck(cancelToken);
          const rebuildDocuments = this.sortDocuments(this.langiumDocuments.all.filter((doc) => (
            // This includes those that were reported as changed and those that we selected for relinking
            doc.state < DocumentState.Validated || !this.buildState.get(doc.uri.toString())?.completed || this.resultsAreIncomplete(doc, this.updateBuildOptions)
          )).toArray());
          await this.buildDocuments(rebuildDocuments, this.updateBuildOptions, cancelToken);
        }
        resultsAreIncomplete(document2, options2) {
          return this.findMissingValidationCategories(document2, options2).length >= 1;
        }
        findMissingValidationCategories(document2, options2) {
          const state4 = this.buildState.get(document2.uri.toString());
          const allCategories = this.serviceRegistry.getServices(document2.uri).validation.ValidationRegistry.getAllValidationCategories(document2);
          const executedCategories = state4?.result?.validationChecks ? new Set(state4?.result?.validationChecks) : state4?.completed ? allCategories : /* @__PURE__ */ new Set();
          const requestedCategories = options2 === void 0 || options2.validation === true ? allCategories : typeof options2.validation === "object" ? options2.validation.categories ?? allCategories : [];
          return stream(requestedCategories).filter((requested) => !executedCategories.has(requested)).toArray();
        }
        async findChangedUris(changed) {
          const document2 = this.langiumDocuments.getDocument(changed) ?? this.textDocuments?.get(changed);
          if (document2) {
            return [changed];
          }
          try {
            const stat = await this.fileSystemProvider.stat(changed);
            if (stat.isDirectory) {
              const uris = await this.workspaceManager().searchFolder(changed);
              return uris;
            } else if (this.workspaceManager().shouldIncludeEntry(stat)) {
              return [changed];
            }
          } catch {
          }
          return [];
        }
        async emitUpdate(changed, deleted) {
          await Promise.all(this.updateListeners.map((listener) => listener(changed, deleted)));
        }
        /**
         * Sort the given documents by priority. By default, documents with an open text document are prioritized.
         * This is useful to ensure that visible documents show their diagnostics before all other documents.
         *
         * This improves the responsiveness in large workspaces as users usually don't care about diagnostics
         * in files that are currently not opened in the editor.
         */
        sortDocuments(documents) {
          let left3 = 0;
          let right3 = documents.length - 1;
          while (left3 < right3) {
            while (left3 < documents.length && this.hasTextDocument(documents[left3])) {
              left3++;
            }
            while (right3 >= 0 && !this.hasTextDocument(documents[right3])) {
              right3--;
            }
            if (left3 < right3) {
              [documents[left3], documents[right3]] = [documents[right3], documents[left3]];
            }
          }
          return documents;
        }
        hasTextDocument(doc) {
          return Boolean(this.textDocuments?.get(doc.uri));
        }
        /**
         * Check whether the given document should be relinked after changes were found in the given URIs.
         */
        shouldRelink(document2, changedUris) {
          if (document2.references.some((ref) => ref.error !== void 0)) {
            return true;
          }
          return this.indexManager.isAffected(document2, changedUris);
        }
        onUpdate(callback) {
          this.updateListeners.push(callback);
          return Disposable.create(() => {
            const index = this.updateListeners.indexOf(callback);
            if (index >= 0) {
              this.updateListeners.splice(index, 1);
            }
          });
        }
        resetToState(document2, state4) {
          switch (state4) {
            case DocumentState.Changed: {
            }
            case DocumentState.Parsed:
              this.indexManager.removeContent(document2.uri);
            // Fall through
            case DocumentState.IndexedContent:
              document2.localSymbols = void 0;
            // Fall through
            case DocumentState.ComputedScopes: {
              const linker = this.serviceRegistry.getServices(document2.uri).references.Linker;
              linker.unlink(document2);
            }
            case DocumentState.Linked:
              this.indexManager.removeReferences(document2.uri);
            // Fall through
            case DocumentState.IndexedReferences:
              document2.diagnostics = void 0;
              this.buildState.delete(document2.uri.toString());
            // Fall through
            case DocumentState.Validated:
          }
          if (document2.state > state4) {
            document2.state = state4;
          }
        }
        cleanUpDeleted(document2) {
          this.buildState.delete(document2.uri.toString());
          this.indexManager.remove(document2.uri);
          document2.state = DocumentState.Changed;
        }
        /**
         * Build the given documents by stepping through all build phases. If a document's state indicates
         * that a certain build phase is already done, the phase is skipped for that document.
         *
         * @param documents The documents to build.
         * @param options the {@link BuildOptions} to use.
         * @param cancelToken A cancellation token that can be used to cancel the build.
         * @returns A promise that resolves when the build is done.
         */
        async buildDocuments(documents, options2, cancelToken) {
          this.prepareBuild(documents, options2);
          await this.runCancelable(documents, DocumentState.Parsed, cancelToken, (doc) => this.langiumDocumentFactory.update(doc, cancelToken));
          await this.runCancelable(documents, DocumentState.IndexedContent, cancelToken, (doc) => this.indexManager.updateContent(doc, cancelToken));
          await this.runCancelable(documents, DocumentState.ComputedScopes, cancelToken, async (doc) => {
            const scopeComputation = this.serviceRegistry.getServices(doc.uri).references.ScopeComputation;
            doc.localSymbols = await scopeComputation.collectLocalSymbols(doc, cancelToken);
          });
          const toBeLinked = documents.filter((doc) => this.shouldLink(doc));
          await this.runCancelable(toBeLinked, DocumentState.Linked, cancelToken, (doc) => {
            const linker = this.serviceRegistry.getServices(doc.uri).references.Linker;
            return linker.link(doc, cancelToken);
          });
          await this.runCancelable(toBeLinked, DocumentState.IndexedReferences, cancelToken, (doc) => this.indexManager.updateReferences(doc, cancelToken));
          const toBeValidated = documents.filter((doc) => {
            if (this.shouldValidate(doc)) {
              return true;
            } else {
              this.markAsCompleted(doc);
              return false;
            }
          });
          await this.runCancelable(toBeValidated, DocumentState.Validated, cancelToken, async (doc) => {
            await this.validate(doc, cancelToken);
            this.markAsCompleted(doc);
          });
        }
        markAsCompleted(document2) {
          const state4 = this.buildState.get(document2.uri.toString());
          if (state4) {
            state4.completed = true;
          }
        }
        /**
         * Runs prior to beginning the build process to update the {@link DocumentBuildState} for each document
         *
         * @param documents collection of documents to be built
         * @param options the {@link BuildOptions} to use
         */
        prepareBuild(documents, options2) {
          for (const doc of documents) {
            const key = doc.uri.toString();
            const state4 = this.buildState.get(key);
            if (!state4 || state4.completed) {
              this.buildState.set(key, {
                completed: false,
                options: options2,
                result: state4?.result
              });
            } else {
            }
          }
        }
        /**
         * Runs a cancelable operation on a set of documents to bring them to a specified {@link DocumentState}.
         *
         * @param documents The array of documents to process.
         * @param targetState The target {@link DocumentState} to bring the documents to.
         * @param cancelToken A token that can be used to cancel the operation.
         * @param callback A function to be called for each document.
         * @returns A promise that resolves when all documents have been processed or the operation is canceled.
         * @throws Will throw `OperationCancelled` if the operation is canceled via a `CancellationToken`.
         */
        async runCancelable(documents, targetState, cancelToken, callback) {
          for (const document2 of documents) {
            if (document2.state < targetState) {
              await interruptAndCheck(cancelToken);
              await callback(document2);
              document2.state = targetState;
              await this.notifyDocumentPhase(document2, targetState, cancelToken);
            }
          }
          const targetStateDocs = documents.filter((doc) => doc.state === targetState);
          await this.notifyBuildPhase(targetStateDocs, targetState, cancelToken);
          this.currentState = targetState;
        }
        onBuildPhase(targetState, callback) {
          this.buildPhaseListeners.add(targetState, callback);
          return Disposable.create(() => {
            this.buildPhaseListeners.delete(targetState, callback);
          });
        }
        onDocumentPhase(targetState, callback) {
          this.documentPhaseListeners.add(targetState, callback);
          return Disposable.create(() => {
            this.documentPhaseListeners.delete(targetState, callback);
          });
        }
        waitUntil(state4, uriOrToken, cancelToken) {
          let uri = void 0;
          if (uriOrToken && "path" in uriOrToken) {
            uri = uriOrToken;
          } else {
            cancelToken = uriOrToken;
          }
          cancelToken ?? (cancelToken = cancellation_exports.CancellationToken.None);
          if (uri) {
            return this.awaitDocumentState(state4, uri, cancelToken);
          } else {
            return this.awaitBuilderState(state4, cancelToken);
          }
        }
        awaitDocumentState(state4, uri, cancelToken) {
          const document2 = this.langiumDocuments.getDocument(uri);
          if (!document2) {
            return Promise.reject(new import_vscode_languageserver_protocol.ResponseError(import_vscode_languageserver_protocol.LSPErrorCodes.ServerCancelled, `No document found for URI: ${uri.toString()}`));
          } else if (document2.state >= state4) {
            return Promise.resolve(uri);
          } else if (cancelToken.isCancellationRequested) {
            return Promise.reject(OperationCancelled);
          } else if (this.currentState >= state4 && state4 > document2.state) {
            return Promise.reject(new import_vscode_languageserver_protocol.ResponseError(import_vscode_languageserver_protocol.LSPErrorCodes.RequestFailed, `Document state of ${uri.toString()} is ${DocumentState[document2.state]}, requiring ${DocumentState[state4]}, but workspace state is already ${DocumentState[this.currentState]}. Returning undefined.`));
          }
          return new Promise((resolve2, reject3) => {
            const buildDisposable = this.onDocumentPhase(state4, (doc) => {
              if (UriUtils.equals(doc.uri, uri)) {
                buildDisposable.dispose();
                cancelDisposable.dispose();
                resolve2(doc.uri);
              }
            });
            const cancelDisposable = cancelToken.onCancellationRequested(() => {
              buildDisposable.dispose();
              cancelDisposable.dispose();
              reject3(OperationCancelled);
            });
          });
        }
        awaitBuilderState(state4, cancelToken) {
          if (this.currentState >= state4) {
            return Promise.resolve();
          } else if (cancelToken.isCancellationRequested) {
            return Promise.reject(OperationCancelled);
          }
          return new Promise((resolve2, reject3) => {
            const buildDisposable = this.onBuildPhase(state4, () => {
              buildDisposable.dispose();
              cancelDisposable.dispose();
              resolve2();
            });
            const cancelDisposable = cancelToken.onCancellationRequested(() => {
              buildDisposable.dispose();
              cancelDisposable.dispose();
              reject3(OperationCancelled);
            });
          });
        }
        async notifyDocumentPhase(document2, state4, cancelToken) {
          const listeners = this.documentPhaseListeners.get(state4);
          const listenersCopy = listeners.slice();
          for (const listener of listenersCopy) {
            try {
              await interruptAndCheck(cancelToken);
              await listener(document2, cancelToken);
            } catch (err) {
              if (!isOperationCancelled(err)) {
                throw err;
              }
            }
          }
        }
        async notifyBuildPhase(documents, state4, cancelToken) {
          if (documents.length === 0) {
            return;
          }
          const listeners = this.buildPhaseListeners.get(state4);
          const listenersCopy = listeners.slice();
          for (const listener of listenersCopy) {
            await interruptAndCheck(cancelToken);
            await listener(documents, cancelToken);
          }
        }
        /**
         * Determine whether the given document should be linked during a build. The default
         * implementation checks the `eagerLinking` property of the build options. If it's set to `true`
         * or `undefined`, the document is included in the linking phase. This also affects the
         * references indexing phase, which depends on eager linking.
         */
        shouldLink(document2) {
          return this.getBuildOptions(document2).eagerLinking ?? true;
        }
        /**
         * Determine whether the given document should be validated during a build. The default
         * implementation checks the `validation` property of the build options. If it's set to `true`
         * or a `ValidationOptions` object, the document is included in the validation phase.
         */
        shouldValidate(document2) {
          return Boolean(this.getBuildOptions(document2).validation);
        }
        /**
         * Run validation checks on the given document and store the resulting diagnostics in the document.
         * If the document already contains diagnostics, the new ones are added to the list.
         */
        async validate(document2, cancelToken) {
          const validator = this.serviceRegistry.getServices(document2.uri).validation.DocumentValidator;
          const options2 = this.getBuildOptions(document2);
          const validationOptions = typeof options2.validation === "object" ? { ...options2.validation } : {};
          validationOptions.categories = this.findMissingValidationCategories(document2, options2);
          const diagnostics = await validator.validateDocument(document2, validationOptions, cancelToken);
          if (document2.diagnostics) {
            document2.diagnostics.push(...diagnostics);
          } else {
            document2.diagnostics = diagnostics;
          }
          const state4 = this.buildState.get(document2.uri.toString());
          if (state4) {
            state4.result ?? (state4.result = {});
            if (state4.result.validationChecks) {
              state4.result.validationChecks = stream(state4.result.validationChecks).concat(validationOptions.categories).distinct().toArray();
            } else {
              state4.result.validationChecks = [...validationOptions.categories];
            }
          }
        }
        getBuildOptions(document2) {
          return this.buildState.get(document2.uri.toString())?.options ?? {};
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/index-manager.js
  var DefaultIndexManager;
  var init_index_manager = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/index-manager.js"() {
      "use strict";
      init_ast_utils();
      init_caching();
      init_cancellation();
      init_stream();
      init_uri_utils();
      DefaultIndexManager = class {
        static {
          __name(this, "DefaultIndexManager");
        }
        constructor(services) {
          this.symbolIndex = /* @__PURE__ */ new Map();
          this.symbolByTypeIndex = new ContextCache();
          this.referenceIndex = /* @__PURE__ */ new Map();
          this.documents = services.workspace.LangiumDocuments;
          this.serviceRegistry = services.ServiceRegistry;
          this.astReflection = services.AstReflection;
        }
        findAllReferences(targetNode, astNodePath) {
          const targetDocUri = getDocument(targetNode).uri;
          const result = [];
          this.referenceIndex.forEach((docRefs) => {
            docRefs.forEach((refDescr) => {
              if (UriUtils.equals(refDescr.targetUri, targetDocUri) && refDescr.targetPath === astNodePath) {
                result.push(refDescr);
              }
            });
          });
          return stream(result);
        }
        allElements(nodeType3, uris) {
          let documentUris = stream(this.symbolIndex.keys());
          if (uris) {
            documentUris = documentUris.filter((uri) => !uris || uris.has(uri));
          }
          return documentUris.map((uri) => this.getFileDescriptions(uri, nodeType3)).flat();
        }
        getFileDescriptions(uri, nodeType3) {
          if (!nodeType3) {
            return this.symbolIndex.get(uri) ?? [];
          }
          const descriptions = this.symbolByTypeIndex.get(uri, nodeType3, () => {
            const allFileDescriptions = this.symbolIndex.get(uri) ?? [];
            return allFileDescriptions.filter((e3) => this.astReflection.isSubtype(e3.type, nodeType3));
          });
          return descriptions;
        }
        remove(uri) {
          this.removeContent(uri);
          this.removeReferences(uri);
        }
        removeContent(uri) {
          const uriString = uri.toString();
          this.symbolIndex.delete(uriString);
          this.symbolByTypeIndex.clear(uriString);
        }
        removeReferences(uri) {
          const uriString = uri.toString();
          this.referenceIndex.delete(uriString);
        }
        async updateContent(document2, cancelToken = cancellation_exports.CancellationToken.None) {
          const services = this.serviceRegistry.getServices(document2.uri);
          const exports2 = await services.references.ScopeComputation.collectExportedSymbols(document2, cancelToken);
          const uri = document2.uri.toString();
          this.symbolIndex.set(uri, exports2);
          this.symbolByTypeIndex.clear(uri);
        }
        async updateReferences(document2, cancelToken = cancellation_exports.CancellationToken.None) {
          const services = this.serviceRegistry.getServices(document2.uri);
          const indexData = await services.workspace.ReferenceDescriptionProvider.createDescriptions(document2, cancelToken);
          this.referenceIndex.set(document2.uri.toString(), indexData);
        }
        isAffected(document2, changedUris) {
          const references = this.referenceIndex.get(document2.uri.toString());
          if (!references) {
            return false;
          }
          return references.some((ref) => !ref.local && changedUris.has(ref.targetUri.toString()));
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/workspace-manager.js
  var DefaultWorkspaceManager;
  var init_workspace_manager = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/workspace-manager.js"() {
      "use strict";
      init_cancellation();
      init_promise_utils();
      init_uri_utils();
      init_stream();
      DefaultWorkspaceManager = class {
        static {
          __name(this, "DefaultWorkspaceManager");
        }
        constructor(services) {
          this.initialBuildOptions = {};
          this._ready = new Deferred();
          this.serviceRegistry = services.ServiceRegistry;
          this.langiumDocuments = services.workspace.LangiumDocuments;
          this.documentBuilder = services.workspace.DocumentBuilder;
          this.fileSystemProvider = services.workspace.FileSystemProvider;
          this.mutex = services.workspace.WorkspaceLock;
        }
        get ready() {
          return this._ready.promise;
        }
        get workspaceFolders() {
          return this.folders;
        }
        initialize(params) {
          this.folders = params.workspaceFolders ?? void 0;
        }
        initialized(_params) {
          return this.mutex.write((token2) => this.initializeWorkspace(this.folders ?? [], token2));
        }
        async initializeWorkspace(folders, cancelToken = cancellation_exports.CancellationToken.None) {
          const documents = await this.performStartup(folders);
          await interruptAndCheck(cancelToken);
          await this.documentBuilder.build(documents, this.initialBuildOptions, cancelToken);
        }
        /**
         * Performs the uninterruptable startup sequence of the workspace manager.
         * This methods loads all documents in the workspace and other documents and returns them.
         */
        async performStartup(folders) {
          const documents = [];
          const collector = /* @__PURE__ */ __name((document2) => {
            documents.push(document2);
            if (!this.langiumDocuments.hasDocument(document2.uri)) {
              this.langiumDocuments.addDocument(document2);
            }
          }, "collector");
          await this.loadAdditionalDocuments(folders, collector);
          const uris = [];
          await Promise.all(folders.map((wf) => this.getRootFolder(wf)).map(async (entry) => this.traverseFolder(entry, uris)));
          const uniqueUris = stream(uris).distinct((uri) => uri.toString()).filter((uri) => !this.langiumDocuments.hasDocument(uri));
          await this.loadWorkspaceDocuments(uniqueUris, collector);
          this._ready.resolve();
          return documents;
        }
        async loadWorkspaceDocuments(uris, collector) {
          await Promise.all(uris.map(async (uri) => {
            const document2 = await this.langiumDocuments.getOrCreateDocument(uri);
            collector(document2);
          }));
        }
        /**
         * Load all additional documents that shall be visible in the context of the given workspace
         * folders and add them to the collector. This can be used to include built-in libraries of
         * your language, which can be either loaded from provided files or constructed in memory.
         */
        loadAdditionalDocuments(_folders, _collector) {
          return Promise.resolve();
        }
        /**
         * Determine the root folder of the source documents in the given workspace folder.
         * The default implementation returns the URI of the workspace folder, but you can override
         * this to return a subfolder like `src` instead.
         */
        getRootFolder(workspaceFolder) {
          return URI2.parse(workspaceFolder.uri);
        }
        /**
         * Traverse the file system folder identified by the given URI and its subfolders. All
         * contained files that match the file extensions are added to the `uris` array.
         */
        async traverseFolder(folderPath, uris) {
          try {
            const content = await this.fileSystemProvider.readDirectory(folderPath);
            await Promise.all(content.map(async (entry) => {
              if (this.shouldIncludeEntry(entry)) {
                if (entry.isDirectory) {
                  await this.traverseFolder(entry.uri, uris);
                } else if (entry.isFile) {
                  uris.push(entry.uri);
                }
              }
            }));
          } catch (e3) {
            console.error("Failure to read directory content of " + folderPath.toString(true), e3);
          }
        }
        async searchFolder(uri) {
          const uris = [];
          await this.traverseFolder(uri, uris);
          return uris;
        }
        /**
         * Determine whether the given folder entry shall be included while indexing the workspace.
         */
        shouldIncludeEntry(entry) {
          const name = UriUtils.basename(entry.uri);
          if (name.startsWith(".")) {
            return false;
          }
          if (entry.isDirectory) {
            return name !== "node_modules" && name !== "out";
          } else if (entry.isFile) {
            return this.serviceRegistry.hasServices(entry.uri);
          }
          return false;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/lexer.js
  function isTokenTypeArray(tokenVocabulary) {
    return Array.isArray(tokenVocabulary) && (tokenVocabulary.length === 0 || "name" in tokenVocabulary[0]);
  }
  function isIMultiModeLexerDefinition(tokenVocabulary) {
    return tokenVocabulary && "modes" in tokenVocabulary && "defaultMode" in tokenVocabulary;
  }
  function isTokenTypeDictionary(tokenVocabulary) {
    return !isTokenTypeArray(tokenVocabulary) && !isIMultiModeLexerDefinition(tokenVocabulary);
  }
  var DefaultLexerErrorMessageProvider, DEFAULT_TOKENIZE_OPTIONS, DefaultLexer;
  var init_lexer2 = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/lexer.js"() {
      "use strict";
      init_api5();
      DefaultLexerErrorMessageProvider = class {
        static {
          __name(this, "DefaultLexerErrorMessageProvider");
        }
        buildUnexpectedCharactersMessage(fullText, startOffset, length2, line2, column2) {
          return defaultLexerErrorProvider.buildUnexpectedCharactersMessage(fullText, startOffset, length2, line2, column2);
        }
        buildUnableToPopLexerModeMessage(token2) {
          return defaultLexerErrorProvider.buildUnableToPopLexerModeMessage(token2);
        }
      };
      DEFAULT_TOKENIZE_OPTIONS = { mode: "full" };
      DefaultLexer = class {
        static {
          __name(this, "DefaultLexer");
        }
        constructor(services) {
          this.errorMessageProvider = services.parser.LexerErrorMessageProvider;
          this.tokenBuilder = services.parser.TokenBuilder;
          const tokens2 = this.tokenBuilder.buildTokens(services.Grammar, {
            caseInsensitive: services.LanguageMetaData.caseInsensitive
          });
          this.tokenTypes = this.toTokenTypeDictionary(tokens2);
          const lexerTokens = isTokenTypeDictionary(tokens2) ? Object.values(tokens2) : tokens2;
          const production = services.LanguageMetaData.mode === "production";
          this.chevrotainLexer = new Lexer2(lexerTokens, {
            positionTracking: "full",
            skipValidations: production,
            errorMessageProvider: this.errorMessageProvider
          });
        }
        get definition() {
          return this.tokenTypes;
        }
        tokenize(text4, _options = DEFAULT_TOKENIZE_OPTIONS) {
          const chevrotainResult = this.chevrotainLexer.tokenize(text4);
          return {
            tokens: chevrotainResult.tokens,
            errors: chevrotainResult.errors,
            hidden: chevrotainResult.groups.hidden ?? [],
            report: this.tokenBuilder.flushLexingReport?.(text4)
          };
        }
        toTokenTypeDictionary(buildTokens) {
          if (isTokenTypeDictionary(buildTokens))
            return buildTokens;
          const tokens2 = isIMultiModeLexerDefinition(buildTokens) ? Object.values(buildTokens.modes).flat() : buildTokens;
          const res = {};
          tokens2.forEach((token2) => res[token2.name] = token2);
          return res;
        }
      };
      __name(isTokenTypeArray, "isTokenTypeArray");
      __name(isIMultiModeLexerDefinition, "isIMultiModeLexerDefinition");
      __name(isTokenTypeDictionary, "isTokenTypeDictionary");
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/documentation/jsdoc.js
  function parseJSDoc(node2, start3, options2) {
    let opts;
    let position5;
    if (typeof node2 === "string") {
      position5 = start3;
      opts = options2;
    } else {
      position5 = node2.range.start;
      opts = start3;
    }
    if (!position5) {
      position5 = Position.create(0, 0);
    }
    const lines = getLines(node2);
    const normalizedOptions = normalizeOptions(opts);
    const tokens2 = tokenize({
      lines,
      position: position5,
      options: normalizedOptions
    });
    return parseJSDocComment({
      index: 0,
      tokens: tokens2,
      position: position5
    });
  }
  function isJSDoc(node2, options2) {
    const normalizedOptions = normalizeOptions(options2);
    const lines = getLines(node2);
    if (lines.length === 0) {
      return false;
    }
    const first3 = lines[0];
    const last3 = lines[lines.length - 1];
    const firstRegex = normalizedOptions.start;
    const lastRegex = normalizedOptions.end;
    return Boolean(firstRegex?.exec(first3)) && Boolean(lastRegex?.exec(last3));
  }
  function getLines(node2) {
    let content = "";
    if (typeof node2 === "string") {
      content = node2;
    } else {
      content = node2.text;
    }
    const lines = content.split(NEWLINE_REGEXP);
    return lines;
  }
  function tokenize(context) {
    const tokens2 = [];
    let currentLine = context.position.line;
    let currentCharacter = context.position.character;
    for (let i2 = 0; i2 < context.lines.length; i2++) {
      const first3 = i2 === 0;
      const last3 = i2 === context.lines.length - 1;
      let line2 = context.lines[i2];
      let index = 0;
      if (first3 && context.options.start) {
        const match2 = context.options.start?.exec(line2);
        if (match2) {
          index = match2.index + match2[0].length;
        }
      } else {
        const match2 = context.options.line?.exec(line2);
        if (match2) {
          index = match2.index + match2[0].length;
        }
      }
      if (last3) {
        const match2 = context.options.end?.exec(line2);
        if (match2) {
          line2 = line2.substring(0, match2.index);
        }
      }
      line2 = line2.substring(0, lastCharacter(line2));
      const whitespaceEnd = skipWhitespace(line2, index);
      if (whitespaceEnd >= line2.length) {
        if (tokens2.length > 0) {
          const position5 = Position.create(currentLine, currentCharacter);
          tokens2.push({
            type: "break",
            content: "",
            range: Range.create(position5, position5)
          });
        }
      } else {
        tagRegex.lastIndex = index;
        const tagMatch = tagRegex.exec(line2);
        if (tagMatch) {
          const fullMatch = tagMatch[0];
          const value2 = tagMatch[1];
          const start3 = Position.create(currentLine, currentCharacter + index);
          const end2 = Position.create(currentLine, currentCharacter + index + fullMatch.length);
          tokens2.push({
            type: "tag",
            content: value2,
            range: Range.create(start3, end2)
          });
          index += fullMatch.length;
          index = skipWhitespace(line2, index);
        }
        if (index < line2.length) {
          const rest = line2.substring(index);
          const inlineTagMatches = Array.from(rest.matchAll(inlineTagRegex));
          tokens2.push(...buildInlineTokens(inlineTagMatches, rest, currentLine, currentCharacter + index));
        }
      }
      currentLine++;
      currentCharacter = 0;
    }
    if (tokens2.length > 0 && tokens2[tokens2.length - 1].type === "break") {
      return tokens2.slice(0, -1);
    }
    return tokens2;
  }
  function buildInlineTokens(tags2, line2, lineIndex, characterIndex) {
    const tokens2 = [];
    if (tags2.length === 0) {
      const start3 = Position.create(lineIndex, characterIndex);
      const end2 = Position.create(lineIndex, characterIndex + line2.length);
      tokens2.push({
        type: "text",
        content: line2,
        range: Range.create(start3, end2)
      });
    } else {
      let lastIndex = 0;
      for (const match2 of tags2) {
        const matchIndex = match2.index;
        const startContent = line2.substring(lastIndex, matchIndex);
        if (startContent.length > 0) {
          tokens2.push({
            type: "text",
            content: line2.substring(lastIndex, matchIndex),
            range: Range.create(Position.create(lineIndex, lastIndex + characterIndex), Position.create(lineIndex, matchIndex + characterIndex))
          });
        }
        let offset = startContent.length + 1;
        const tagName = match2[1];
        tokens2.push({
          type: "inline-tag",
          content: tagName,
          range: Range.create(Position.create(lineIndex, lastIndex + offset + characterIndex), Position.create(lineIndex, lastIndex + offset + tagName.length + characterIndex))
        });
        offset += tagName.length;
        if (match2.length === 4) {
          offset += match2[2].length;
          const value2 = match2[3];
          tokens2.push({
            type: "text",
            content: value2,
            range: Range.create(Position.create(lineIndex, lastIndex + offset + characterIndex), Position.create(lineIndex, lastIndex + offset + value2.length + characterIndex))
          });
        } else {
          tokens2.push({
            type: "text",
            content: "",
            range: Range.create(Position.create(lineIndex, lastIndex + offset + characterIndex), Position.create(lineIndex, lastIndex + offset + characterIndex))
          });
        }
        lastIndex = matchIndex + match2[0].length;
      }
      const endContent = line2.substring(lastIndex);
      if (endContent.length > 0) {
        tokens2.push({
          type: "text",
          content: endContent,
          range: Range.create(Position.create(lineIndex, lastIndex + characterIndex), Position.create(lineIndex, lastIndex + characterIndex + endContent.length))
        });
      }
    }
    return tokens2;
  }
  function skipWhitespace(line2, index) {
    const match2 = line2.substring(index).match(nonWhitespaceRegex);
    if (match2) {
      return index + match2.index;
    } else {
      return line2.length;
    }
  }
  function lastCharacter(line2) {
    const match2 = line2.match(whitespaceEndRegex);
    if (match2 && typeof match2.index === "number") {
      return match2.index;
    }
    return void 0;
  }
  function parseJSDocComment(context) {
    const startPosition = Position.create(context.position.line, context.position.character);
    if (context.tokens.length === 0) {
      return new JSDocCommentImpl([], Range.create(startPosition, startPosition));
    }
    const elements2 = [];
    while (context.index < context.tokens.length) {
      const element3 = parseJSDocElement(context, elements2[elements2.length - 1]);
      if (element3) {
        elements2.push(element3);
      }
    }
    const start3 = elements2[0]?.range.start ?? startPosition;
    const end2 = elements2[elements2.length - 1]?.range.end ?? startPosition;
    return new JSDocCommentImpl(elements2, Range.create(start3, end2));
  }
  function parseJSDocElement(context, last3) {
    const next3 = context.tokens[context.index];
    if (next3.type === "tag") {
      return parseJSDocTag(context, false);
    } else if (next3.type === "text" || next3.type === "inline-tag") {
      return parseJSDocText(context);
    } else {
      appendEmptyLine(next3, last3);
      context.index++;
      return void 0;
    }
  }
  function appendEmptyLine(token2, element3) {
    if (element3) {
      const line2 = new JSDocLineImpl("", token2.range);
      if ("inlines" in element3) {
        element3.inlines.push(line2);
      } else {
        element3.content.inlines.push(line2);
      }
    }
  }
  function parseJSDocText(context) {
    let token2 = context.tokens[context.index];
    const firstToken = token2;
    let lastToken = token2;
    const lines = [];
    while (token2 && token2.type !== "break" && token2.type !== "tag") {
      lines.push(parseJSDocInline(context));
      lastToken = token2;
      token2 = context.tokens[context.index];
    }
    return new JSDocTextImpl(lines, Range.create(firstToken.range.start, lastToken.range.end));
  }
  function parseJSDocInline(context) {
    const token2 = context.tokens[context.index];
    if (token2.type === "inline-tag") {
      return parseJSDocTag(context, true);
    } else {
      return parseJSDocLine(context);
    }
  }
  function parseJSDocTag(context, inline) {
    const tagToken = context.tokens[context.index++];
    const name = tagToken.content.substring(1);
    const nextToken = context.tokens[context.index];
    if (nextToken?.type === "text") {
      if (inline) {
        const docLine = parseJSDocLine(context);
        return new JSDocTagImpl(name, new JSDocTextImpl([docLine], docLine.range), inline, Range.create(tagToken.range.start, docLine.range.end));
      } else {
        const textDoc = parseJSDocText(context);
        return new JSDocTagImpl(name, textDoc, inline, Range.create(tagToken.range.start, textDoc.range.end));
      }
    } else {
      const range3 = tagToken.range;
      return new JSDocTagImpl(name, new JSDocTextImpl([], range3), inline, range3);
    }
  }
  function parseJSDocLine(context) {
    const token2 = context.tokens[context.index++];
    return new JSDocLineImpl(token2.content, token2.range);
  }
  function normalizeOptions(options2) {
    if (!options2) {
      return normalizeOptions({
        start: "/**",
        end: "*/",
        line: "*"
      });
    }
    const { start: start3, end: end2, line: line2 } = options2;
    return {
      start: normalizeOption(start3, true),
      end: normalizeOption(end2, false),
      line: normalizeOption(line2, true)
    };
  }
  function normalizeOption(option2, start3) {
    if (typeof option2 === "string" || typeof option2 === "object") {
      const escaped = typeof option2 === "string" ? escapeRegExp(option2) : option2.source;
      if (start3) {
        return new RegExp(`^\\s*${escaped}`);
      } else {
        return new RegExp(`\\s*${escaped}\\s*$`);
      }
    } else {
      return option2;
    }
  }
  function renderInlineTag(tag, content, options2) {
    if (tag === "linkplain" || tag === "linkcode" || tag === "link") {
      const index = content.indexOf(" ");
      let display = content;
      if (index > 0) {
        const displayStart = skipWhitespace(content, index);
        display = content.substring(displayStart);
        content = content.substring(0, index);
      }
      if (tag === "linkcode" || tag === "link" && options2.link === "code") {
        display = `\`${display}\``;
      }
      const renderedLink = options2.renderLink?.(content, display) ?? renderLinkDefault(content, display);
      return renderedLink;
    }
    return void 0;
  }
  function renderLinkDefault(content, display) {
    try {
      URI2.parse(content, true);
      return `[${display}](${content})`;
    } catch {
      return content;
    }
  }
  function fillNewlines(text4) {
    if (text4.endsWith("\n")) {
      return "\n";
    } else {
      return "\n\n";
    }
  }
  var tagRegex, inlineTagRegex, nonWhitespaceRegex, whitespaceEndRegex, JSDocCommentImpl, JSDocTagImpl, JSDocTextImpl, JSDocLineImpl;
  var init_jsdoc = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/documentation/jsdoc.js"() {
      "use strict";
      init_main();
      init_regexp_utils();
      init_uri_utils();
      __name(parseJSDoc, "parseJSDoc");
      __name(isJSDoc, "isJSDoc");
      __name(getLines, "getLines");
      tagRegex = /\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy;
      inlineTagRegex = /\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;
      __name(tokenize, "tokenize");
      __name(buildInlineTokens, "buildInlineTokens");
      nonWhitespaceRegex = /\S/;
      whitespaceEndRegex = /\s*$/;
      __name(skipWhitespace, "skipWhitespace");
      __name(lastCharacter, "lastCharacter");
      __name(parseJSDocComment, "parseJSDocComment");
      __name(parseJSDocElement, "parseJSDocElement");
      __name(appendEmptyLine, "appendEmptyLine");
      __name(parseJSDocText, "parseJSDocText");
      __name(parseJSDocInline, "parseJSDocInline");
      __name(parseJSDocTag, "parseJSDocTag");
      __name(parseJSDocLine, "parseJSDocLine");
      __name(normalizeOptions, "normalizeOptions");
      __name(normalizeOption, "normalizeOption");
      JSDocCommentImpl = class {
        static {
          __name(this, "JSDocCommentImpl");
        }
        constructor(elements2, range3) {
          this.elements = elements2;
          this.range = range3;
        }
        getTag(name) {
          return this.getAllTags().find((e3) => e3.name === name);
        }
        getTags(name) {
          return this.getAllTags().filter((e3) => e3.name === name);
        }
        getAllTags() {
          return this.elements.filter((e3) => "name" in e3);
        }
        toString() {
          let value2 = "";
          for (const element3 of this.elements) {
            if (value2.length === 0) {
              value2 = element3.toString();
            } else {
              const text4 = element3.toString();
              value2 += fillNewlines(value2) + text4;
            }
          }
          return value2.trim();
        }
        toMarkdown(options2) {
          let value2 = "";
          for (const element3 of this.elements) {
            if (value2.length === 0) {
              value2 = element3.toMarkdown(options2);
            } else {
              const text4 = element3.toMarkdown(options2);
              value2 += fillNewlines(value2) + text4;
            }
          }
          return value2.trim();
        }
      };
      JSDocTagImpl = class {
        static {
          __name(this, "JSDocTagImpl");
        }
        constructor(name, content, inline, range3) {
          this.name = name;
          this.content = content;
          this.inline = inline;
          this.range = range3;
        }
        toString() {
          let text4 = `@${this.name}`;
          const content = this.content.toString();
          if (this.content.inlines.length === 1) {
            text4 = `${text4} ${content}`;
          } else if (this.content.inlines.length > 1) {
            text4 = `${text4}
${content}`;
          }
          if (this.inline) {
            return `{${text4}}`;
          } else {
            return text4;
          }
        }
        toMarkdown(options2) {
          return options2?.renderTag?.(this) ?? this.toMarkdownDefault(options2);
        }
        toMarkdownDefault(options2) {
          const content = this.content.toMarkdown(options2);
          if (this.inline) {
            const rendered = renderInlineTag(this.name, content, options2 ?? {});
            if (typeof rendered === "string") {
              return rendered;
            }
          }
          let marker = "";
          if (options2?.tag === "italic" || options2?.tag === void 0) {
            marker = "*";
          } else if (options2?.tag === "bold") {
            marker = "**";
          } else if (options2?.tag === "bold-italic") {
            marker = "***";
          }
          let text4 = `${marker}@${this.name}${marker}`;
          if (this.content.inlines.length === 1) {
            text4 = `${text4} \u2014 ${content}`;
          } else if (this.content.inlines.length > 1) {
            text4 = `${text4}
${content}`;
          }
          if (this.inline) {
            return `{${text4}}`;
          } else {
            return text4;
          }
        }
      };
      __name(renderInlineTag, "renderInlineTag");
      __name(renderLinkDefault, "renderLinkDefault");
      JSDocTextImpl = class {
        static {
          __name(this, "JSDocTextImpl");
        }
        constructor(lines, range3) {
          this.inlines = lines;
          this.range = range3;
        }
        toString() {
          let text4 = "";
          for (let i2 = 0; i2 < this.inlines.length; i2++) {
            const inline = this.inlines[i2];
            const next3 = this.inlines[i2 + 1];
            text4 += inline.toString();
            if (next3 && next3.range.start.line > inline.range.start.line) {
              text4 += "\n";
            }
          }
          return text4;
        }
        toMarkdown(options2) {
          let text4 = "";
          for (let i2 = 0; i2 < this.inlines.length; i2++) {
            const inline = this.inlines[i2];
            const next3 = this.inlines[i2 + 1];
            text4 += inline.toMarkdown(options2);
            if (next3 && next3.range.start.line > inline.range.start.line) {
              text4 += "\n";
            }
          }
          return text4;
        }
      };
      JSDocLineImpl = class {
        static {
          __name(this, "JSDocLineImpl");
        }
        constructor(text4, range3) {
          this.text = text4;
          this.range = range3;
        }
        toString() {
          return this.text;
        }
        toMarkdown() {
          return this.text;
        }
      };
      __name(fillNewlines, "fillNewlines");
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/documentation/documentation-provider.js
  var JSDocDocumentationProvider;
  var init_documentation_provider = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/documentation/documentation-provider.js"() {
      "use strict";
      init_ast_utils();
      init_jsdoc();
      JSDocDocumentationProvider = class {
        static {
          __name(this, "JSDocDocumentationProvider");
        }
        constructor(services) {
          this.indexManager = services.shared.workspace.IndexManager;
          this.commentProvider = services.documentation.CommentProvider;
        }
        getDocumentation(node2) {
          const comment2 = this.commentProvider.getComment(node2);
          if (comment2 && isJSDoc(comment2)) {
            const parsedJSDoc = parseJSDoc(comment2);
            return parsedJSDoc.toMarkdown({
              renderLink: /* @__PURE__ */ __name((link2, display) => {
                return this.documentationLinkRenderer(node2, link2, display);
              }, "renderLink"),
              renderTag: /* @__PURE__ */ __name((tag) => {
                return this.documentationTagRenderer(node2, tag);
              }, "renderTag")
            });
          }
          return void 0;
        }
        documentationLinkRenderer(node2, name, display) {
          const description = this.findNameInLocalSymbols(node2, name) ?? this.findNameInGlobalScope(node2, name);
          if (description && description.nameSegment) {
            const line2 = description.nameSegment.range.start.line + 1;
            const character2 = description.nameSegment.range.start.character + 1;
            const uri = description.documentUri.with({ fragment: `L${line2},${character2}` });
            return `[${display}](${uri.toString()})`;
          } else {
            return void 0;
          }
        }
        documentationTagRenderer(_node, _tag) {
          return void 0;
        }
        findNameInLocalSymbols(node2, name) {
          const document2 = getDocument(node2);
          const precomputed = document2.localSymbols;
          if (!precomputed) {
            return void 0;
          }
          let currentNode = node2;
          do {
            const allDescriptions = precomputed.getStream(currentNode);
            const description = allDescriptions.find((e3) => e3.name === name);
            if (description) {
              return description;
            }
            currentNode = currentNode.$container;
          } while (currentNode);
          return void 0;
        }
        findNameInGlobalScope(node2, name) {
          const description = this.indexManager.allElements().find((e3) => e3.name === name);
          return description;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/documentation/comment-provider.js
  var DefaultCommentProvider;
  var init_comment_provider = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/documentation/comment-provider.js"() {
      "use strict";
      init_json_serializer();
      init_cst_utils();
      DefaultCommentProvider = class {
        static {
          __name(this, "DefaultCommentProvider");
        }
        constructor(services) {
          this.grammarConfig = () => services.parser.GrammarConfig;
        }
        getComment(node2) {
          if (isAstNodeWithComment(node2)) {
            return node2.$comment;
          }
          return findCommentNode(node2.$cstNode, this.grammarConfig().multilineCommentRules)?.text;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/async-parser.js
  var DefaultAsyncParser, AbstractThreadedAsyncParser, ParserWorker;
  var init_async_parser = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/async-parser.js"() {
      "use strict";
      init_promise_utils();
      init_event3();
      DefaultAsyncParser = class {
        static {
          __name(this, "DefaultAsyncParser");
        }
        constructor(services) {
          this.syncParser = services.parser.LangiumParser;
        }
        parse(text4, _cancelToken) {
          return Promise.resolve(this.syncParser.parse(text4));
        }
      };
      AbstractThreadedAsyncParser = class {
        static {
          __name(this, "AbstractThreadedAsyncParser");
        }
        constructor(services) {
          this.threadCount = 8;
          this.terminationDelay = 200;
          this.workerPool = [];
          this.queue = [];
          this.hydrator = services.serializer.Hydrator;
        }
        initializeWorkers() {
          while (this.workerPool.length < this.threadCount) {
            const worker = this.createWorker();
            worker.onReady(() => {
              if (this.queue.length > 0) {
                const deferred = this.queue.shift();
                if (deferred) {
                  worker.lock();
                  deferred.resolve(worker);
                }
              }
            });
            this.workerPool.push(worker);
          }
        }
        async parse(text4, cancelToken) {
          const worker = await this.acquireParserWorker(cancelToken);
          const deferred = new Deferred();
          let timeout2;
          const cancellation = cancelToken.onCancellationRequested(() => {
            timeout2 = setTimeout(() => {
              this.terminateWorker(worker);
            }, this.terminationDelay);
          });
          worker.parse(text4).then((result) => {
            const hydrated = this.hydrator.hydrate(result);
            deferred.resolve(hydrated);
          }).catch((err) => {
            deferred.reject(err);
          }).finally(() => {
            cancellation.dispose();
            clearTimeout(timeout2);
          });
          return deferred.promise;
        }
        terminateWorker(worker) {
          worker.terminate();
          const index = this.workerPool.indexOf(worker);
          if (index >= 0) {
            this.workerPool.splice(index, 1);
          }
        }
        async acquireParserWorker(cancelToken) {
          this.initializeWorkers();
          for (const worker of this.workerPool) {
            if (worker.ready) {
              worker.lock();
              return worker;
            }
          }
          const deferred = new Deferred();
          cancelToken.onCancellationRequested(() => {
            const index = this.queue.indexOf(deferred);
            if (index >= 0) {
              this.queue.splice(index, 1);
            }
            deferred.reject(OperationCancelled);
          });
          this.queue.push(deferred);
          return deferred.promise;
        }
      };
      ParserWorker = class {
        static {
          __name(this, "ParserWorker");
        }
        get ready() {
          return this._ready;
        }
        get onReady() {
          return this.onReadyEmitter.event;
        }
        constructor(sendMessage, onMessage, onError, terminate) {
          this.onReadyEmitter = new event_exports.Emitter();
          this.deferred = new Deferred();
          this._ready = true;
          this._parsing = false;
          this.sendMessage = sendMessage;
          this._terminate = terminate;
          onMessage((result) => {
            const parseResult = result;
            this.deferred.resolve(parseResult);
            this.unlock();
          });
          onError((error3) => {
            this.deferred.reject(error3);
            this.unlock();
          });
        }
        terminate() {
          this.deferred.reject(OperationCancelled);
          this._terminate();
        }
        lock() {
          this._ready = false;
        }
        unlock() {
          this._parsing = false;
          this._ready = true;
          this.onReadyEmitter.fire();
        }
        parse(text4) {
          if (this._parsing) {
            throw new Error("Parser worker is busy");
          }
          this._parsing = true;
          this.deferred = new Deferred();
          this.sendMessage(text4);
          return this.deferred.promise;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/workspace-lock.js
  var DefaultWorkspaceLock;
  var init_workspace_lock = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/workspace-lock.js"() {
      "use strict";
      init_cancellation();
      init_promise_utils();
      DefaultWorkspaceLock = class {
        static {
          __name(this, "DefaultWorkspaceLock");
        }
        constructor() {
          this.previousTokenSource = new cancellation_exports.CancellationTokenSource();
          this.writeQueue = [];
          this.readQueue = [];
          this.done = true;
        }
        write(action) {
          this.cancelWrite();
          const tokenSource = startCancelableOperation();
          this.previousTokenSource = tokenSource;
          return this.enqueue(this.writeQueue, action, tokenSource.token);
        }
        read(action) {
          return this.enqueue(this.readQueue, action);
        }
        enqueue(queue, action, cancellationToken = cancellation_exports.CancellationToken.None) {
          const deferred = new Deferred();
          const entry = {
            action,
            deferred,
            cancellationToken
          };
          queue.push(entry);
          this.performNextOperation();
          return deferred.promise;
        }
        async performNextOperation() {
          if (!this.done) {
            return;
          }
          const entries2 = [];
          if (this.writeQueue.length > 0) {
            entries2.push(this.writeQueue.shift());
          } else if (this.readQueue.length > 0) {
            entries2.push(...this.readQueue.splice(0, this.readQueue.length));
          } else {
            return;
          }
          this.done = false;
          await Promise.all(entries2.map(async ({ action, deferred, cancellationToken }) => {
            try {
              const result = await Promise.resolve().then(() => action(cancellationToken));
              deferred.resolve(result);
            } catch (err) {
              if (isOperationCancelled(err)) {
                deferred.resolve(void 0);
              } else {
                deferred.reject(err);
              }
            }
          }));
          this.done = true;
          this.performNextOperation();
        }
        cancelWrite() {
          this.previousTokenSource.cancel();
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/serializer/hydrator.js
  var DefaultHydrator;
  var init_hydrator = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/serializer/hydrator.js"() {
      "use strict";
      init_cst_node_builder();
      init_ast();
      init_syntax_tree();
      init_ast_utils();
      init_collections();
      init_cst_utils();
      DefaultHydrator = class {
        static {
          __name(this, "DefaultHydrator");
        }
        constructor(services) {
          this.grammarElementIdMap = new BiMap();
          this.tokenTypeIdMap = new BiMap();
          this.grammar = services.Grammar;
          this.lexer = services.parser.Lexer;
          this.linker = services.references.Linker;
        }
        dehydrate(result) {
          return {
            lexerErrors: result.lexerErrors,
            lexerReport: result.lexerReport ? this.dehydrateLexerReport(result.lexerReport) : void 0,
            // We need to create shallow copies of the errors
            // The original errors inherit from the `Error` class, which is not transferable across worker threads
            parserErrors: result.parserErrors.map((e3) => ({ ...e3, message: e3.message })),
            value: this.dehydrateAstNode(result.value, this.createDehyrationContext(result.value))
          };
        }
        dehydrateLexerReport(lexerReport) {
          return lexerReport;
        }
        createDehyrationContext(node2) {
          const astNodes = /* @__PURE__ */ new Map();
          const cstNodes = /* @__PURE__ */ new Map();
          for (const astNode of streamAst(node2)) {
            astNodes.set(astNode, {});
          }
          if (node2.$cstNode) {
            for (const cstNode of streamCst(node2.$cstNode)) {
              cstNodes.set(cstNode, {});
            }
          }
          return {
            astNodes,
            cstNodes
          };
        }
        dehydrateAstNode(node2, context) {
          const obj = context.astNodes.get(node2);
          obj.$type = node2.$type;
          obj.$containerIndex = node2.$containerIndex;
          obj.$containerProperty = node2.$containerProperty;
          if (node2.$cstNode !== void 0) {
            obj.$cstNode = this.dehydrateCstNode(node2.$cstNode, context);
          }
          for (const [name, value2] of Object.entries(node2)) {
            if (name.startsWith("$")) {
              continue;
            }
            if (Array.isArray(value2)) {
              const arr = [];
              obj[name] = arr;
              for (const item of value2) {
                if (isAstNode(item)) {
                  arr.push(this.dehydrateAstNode(item, context));
                } else if (isReference(item)) {
                  arr.push(this.dehydrateReference(item, context));
                } else {
                  arr.push(item);
                }
              }
            } else if (isAstNode(value2)) {
              obj[name] = this.dehydrateAstNode(value2, context);
            } else if (isReference(value2)) {
              obj[name] = this.dehydrateReference(value2, context);
            } else if (value2 !== void 0) {
              obj[name] = value2;
            }
          }
          return obj;
        }
        dehydrateReference(reference, context) {
          const obj = {};
          obj.$refText = reference.$refText;
          if (reference.$refNode) {
            obj.$refNode = context.cstNodes.get(reference.$refNode);
          }
          return obj;
        }
        dehydrateCstNode(node2, context) {
          const cstNode = context.cstNodes.get(node2);
          if (isRootCstNode(node2)) {
            cstNode.fullText = node2.fullText;
          } else {
            cstNode.grammarSource = this.getGrammarElementId(node2.grammarSource);
          }
          cstNode.hidden = node2.hidden;
          cstNode.astNode = context.astNodes.get(node2.astNode);
          if (isCompositeCstNode(node2)) {
            cstNode.content = node2.content.map((child) => this.dehydrateCstNode(child, context));
          } else if (isLeafCstNode(node2)) {
            cstNode.tokenType = node2.tokenType.name;
            cstNode.offset = node2.offset;
            cstNode.length = node2.length;
            cstNode.startLine = node2.range.start.line;
            cstNode.startColumn = node2.range.start.character;
            cstNode.endLine = node2.range.end.line;
            cstNode.endColumn = node2.range.end.character;
          }
          return cstNode;
        }
        hydrate(result) {
          const node2 = result.value;
          const context = this.createHydrationContext(node2);
          if ("$cstNode" in node2) {
            this.hydrateCstNode(node2.$cstNode, context);
          }
          return {
            lexerErrors: result.lexerErrors,
            lexerReport: result.lexerReport,
            parserErrors: result.parserErrors,
            value: this.hydrateAstNode(node2, context)
          };
        }
        createHydrationContext(node2) {
          const astNodes = /* @__PURE__ */ new Map();
          const cstNodes = /* @__PURE__ */ new Map();
          for (const astNode of streamAst(node2)) {
            astNodes.set(astNode, {});
          }
          let root3;
          if (node2.$cstNode) {
            for (const cstNode of streamCst(node2.$cstNode)) {
              let cst;
              if ("fullText" in cstNode) {
                cst = new RootCstNodeImpl(cstNode.fullText);
                root3 = cst;
              } else if ("content" in cstNode) {
                cst = new CompositeCstNodeImpl();
              } else if ("tokenType" in cstNode) {
                cst = this.hydrateCstLeafNode(cstNode);
              }
              if (cst) {
                cstNodes.set(cstNode, cst);
                cst.root = root3;
              }
            }
          }
          return {
            astNodes,
            cstNodes
          };
        }
        hydrateAstNode(node2, context) {
          const astNode = context.astNodes.get(node2);
          astNode.$type = node2.$type;
          astNode.$containerIndex = node2.$containerIndex;
          astNode.$containerProperty = node2.$containerProperty;
          if (node2.$cstNode) {
            astNode.$cstNode = context.cstNodes.get(node2.$cstNode);
          }
          for (const [name, value2] of Object.entries(node2)) {
            if (name.startsWith("$")) {
              continue;
            }
            if (Array.isArray(value2)) {
              const arr = [];
              astNode[name] = arr;
              for (const item of value2) {
                if (isAstNode(item)) {
                  arr.push(this.setParent(this.hydrateAstNode(item, context), astNode));
                } else if (isReference(item)) {
                  arr.push(this.hydrateReference(item, astNode, name, context));
                } else {
                  arr.push(item);
                }
              }
            } else if (isAstNode(value2)) {
              astNode[name] = this.setParent(this.hydrateAstNode(value2, context), astNode);
            } else if (isReference(value2)) {
              astNode[name] = this.hydrateReference(value2, astNode, name, context);
            } else if (value2 !== void 0) {
              astNode[name] = value2;
            }
          }
          return astNode;
        }
        setParent(node2, parent4) {
          node2.$container = parent4;
          return node2;
        }
        hydrateReference(reference, node2, name, context) {
          return this.linker.buildReference(node2, name, context.cstNodes.get(reference.$refNode), reference.$refText);
        }
        hydrateCstNode(cstNode, context, num = 0) {
          const cstNodeObj = context.cstNodes.get(cstNode);
          if (typeof cstNode.grammarSource === "number") {
            cstNodeObj.grammarSource = this.getGrammarElement(cstNode.grammarSource);
          }
          cstNodeObj.astNode = context.astNodes.get(cstNode.astNode);
          if (isCompositeCstNode(cstNodeObj)) {
            for (const child of cstNode.content) {
              const hydrated = this.hydrateCstNode(child, context, num++);
              cstNodeObj.content.push(hydrated);
            }
          }
          return cstNodeObj;
        }
        hydrateCstLeafNode(cstNode) {
          const tokenType = this.getTokenType(cstNode.tokenType);
          const offset = cstNode.offset;
          const length2 = cstNode.length;
          const startLine = cstNode.startLine;
          const startColumn = cstNode.startColumn;
          const endLine = cstNode.endLine;
          const endColumn = cstNode.endColumn;
          const hidden = cstNode.hidden;
          const node2 = new LeafCstNodeImpl(offset, length2, {
            start: {
              line: startLine,
              character: startColumn
            },
            end: {
              line: endLine,
              character: endColumn
            }
          }, tokenType, hidden);
          return node2;
        }
        getTokenType(name) {
          return this.lexer.definition[name];
        }
        getGrammarElementId(node2) {
          if (!node2) {
            return void 0;
          }
          if (this.grammarElementIdMap.size === 0) {
            this.createGrammarElementIdMap();
          }
          return this.grammarElementIdMap.get(node2);
        }
        getGrammarElement(id34) {
          if (this.grammarElementIdMap.size === 0) {
            this.createGrammarElementIdMap();
          }
          const element3 = this.grammarElementIdMap.getKey(id34);
          return element3;
        }
        createGrammarElementIdMap() {
          let id34 = 0;
          for (const element3 of streamAst(this.grammar)) {
            if (isAbstractElement(element3)) {
              this.grammarElementIdMap.set(element3, id34++);
            }
          }
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/default-module.js
  function createDefaultCoreModule(context) {
    return {
      documentation: {
        CommentProvider: /* @__PURE__ */ __name((services) => new DefaultCommentProvider(services), "CommentProvider"),
        DocumentationProvider: /* @__PURE__ */ __name((services) => new JSDocDocumentationProvider(services), "DocumentationProvider")
      },
      parser: {
        AsyncParser: /* @__PURE__ */ __name((services) => new DefaultAsyncParser(services), "AsyncParser"),
        GrammarConfig: /* @__PURE__ */ __name((services) => createGrammarConfig(services), "GrammarConfig"),
        LangiumParser: /* @__PURE__ */ __name((services) => createLangiumParser(services), "LangiumParser"),
        CompletionParser: /* @__PURE__ */ __name((services) => createCompletionParser(services), "CompletionParser"),
        ValueConverter: /* @__PURE__ */ __name(() => new DefaultValueConverter(), "ValueConverter"),
        TokenBuilder: /* @__PURE__ */ __name(() => new DefaultTokenBuilder(), "TokenBuilder"),
        Lexer: /* @__PURE__ */ __name((services) => new DefaultLexer(services), "Lexer"),
        ParserErrorMessageProvider: /* @__PURE__ */ __name(() => new LangiumParserErrorMessageProvider(), "ParserErrorMessageProvider"),
        LexerErrorMessageProvider: /* @__PURE__ */ __name(() => new DefaultLexerErrorMessageProvider(), "LexerErrorMessageProvider")
      },
      workspace: {
        AstNodeLocator: /* @__PURE__ */ __name(() => new DefaultAstNodeLocator(), "AstNodeLocator"),
        AstNodeDescriptionProvider: /* @__PURE__ */ __name((services) => new DefaultAstNodeDescriptionProvider(services), "AstNodeDescriptionProvider"),
        ReferenceDescriptionProvider: /* @__PURE__ */ __name((services) => new DefaultReferenceDescriptionProvider(services), "ReferenceDescriptionProvider")
      },
      references: {
        Linker: /* @__PURE__ */ __name((services) => new DefaultLinker(services), "Linker"),
        NameProvider: /* @__PURE__ */ __name(() => new DefaultNameProvider(), "NameProvider"),
        ScopeProvider: /* @__PURE__ */ __name((services) => new DefaultScopeProvider(services), "ScopeProvider"),
        ScopeComputation: /* @__PURE__ */ __name((services) => new DefaultScopeComputation(services), "ScopeComputation"),
        References: /* @__PURE__ */ __name((services) => new DefaultReferences(services), "References")
      },
      serializer: {
        Hydrator: /* @__PURE__ */ __name((services) => new DefaultHydrator(services), "Hydrator"),
        JsonSerializer: /* @__PURE__ */ __name((services) => new DefaultJsonSerializer(services), "JsonSerializer")
      },
      validation: {
        DocumentValidator: /* @__PURE__ */ __name((services) => new DefaultDocumentValidator(services), "DocumentValidator"),
        ValidationRegistry: /* @__PURE__ */ __name((services) => new ValidationRegistry(services), "ValidationRegistry")
      },
      shared: /* @__PURE__ */ __name(() => context.shared, "shared")
    };
  }
  function createDefaultSharedCoreModule(context) {
    return {
      ServiceRegistry: /* @__PURE__ */ __name((services) => new DefaultServiceRegistry(services), "ServiceRegistry"),
      workspace: {
        LangiumDocuments: /* @__PURE__ */ __name((services) => new DefaultLangiumDocuments(services), "LangiumDocuments"),
        LangiumDocumentFactory: /* @__PURE__ */ __name((services) => new DefaultLangiumDocumentFactory(services), "LangiumDocumentFactory"),
        DocumentBuilder: /* @__PURE__ */ __name((services) => new DefaultDocumentBuilder(services), "DocumentBuilder"),
        IndexManager: /* @__PURE__ */ __name((services) => new DefaultIndexManager(services), "IndexManager"),
        WorkspaceManager: /* @__PURE__ */ __name((services) => new DefaultWorkspaceManager(services), "WorkspaceManager"),
        FileSystemProvider: /* @__PURE__ */ __name((services) => context.fileSystemProvider(services), "FileSystemProvider"),
        WorkspaceLock: /* @__PURE__ */ __name(() => new DefaultWorkspaceLock(), "WorkspaceLock"),
        ConfigurationProvider: /* @__PURE__ */ __name((services) => new DefaultConfigurationProvider(services), "ConfigurationProvider")
      },
      profilers: {}
    };
  }
  var init_default_module = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/default-module.js"() {
      "use strict";
      init_grammar_config();
      init_completion_parser_builder();
      init_langium_parser_builder();
      init_token_builder();
      init_value_converter();
      init_linker();
      init_name_provider();
      init_references();
      init_scope_computation();
      init_scope_provider();
      init_json_serializer();
      init_service_registry();
      init_document_validator();
      init_validation_registry();
      init_ast_descriptions();
      init_ast_node_locator();
      init_configuration();
      init_document_builder();
      init_documents();
      init_index_manager();
      init_workspace_manager();
      init_lexer2();
      init_documentation_provider();
      init_comment_provider();
      init_langium_parser();
      init_async_parser();
      init_workspace_lock();
      init_hydrator();
      __name(createDefaultCoreModule, "createDefaultCoreModule");
      __name(createDefaultSharedCoreModule, "createDefaultSharedCoreModule");
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/dependency-injection.js
  function inject(module1, module2, module3, module4, module5, module6, module7, module8, module9) {
    const module10 = [module1, module2, module3, module4, module5, module6, module7, module8, module9].reduce(_merge, {});
    return _inject(module10);
  }
  function eagerLoad(item) {
    if (item && item[isProxy]) {
      for (const value2 of Object.values(item)) {
        eagerLoad(value2);
      }
    }
    return item;
  }
  function _inject(module2, injector) {
    const proxy = new Proxy({}, {
      deleteProperty: /* @__PURE__ */ __name(() => false, "deleteProperty"),
      set: /* @__PURE__ */ __name(() => {
        throw new Error("Cannot set property on injected service container");
      }, "set"),
      get: /* @__PURE__ */ __name((obj, prop) => {
        if (prop === isProxy) {
          return true;
        } else {
          return _resolve2(obj, prop, module2, injector || proxy);
        }
      }, "get"),
      getOwnPropertyDescriptor: /* @__PURE__ */ __name((obj, prop) => (_resolve2(obj, prop, module2, injector || proxy), Object.getOwnPropertyDescriptor(obj, prop)), "getOwnPropertyDescriptor"),
      // used by for..in
      has: /* @__PURE__ */ __name((_3, prop) => prop in module2, "has"),
      // used by ..in..
      ownKeys: /* @__PURE__ */ __name(() => [...Object.getOwnPropertyNames(module2)], "ownKeys")
      // used by for..in
    });
    return proxy;
  }
  function _resolve2(obj, prop, module2, injector) {
    if (prop in obj) {
      if (obj[prop] instanceof Error) {
        throw new Error("Construction failure. Please make sure that your dependencies are constructable. Cause: " + obj[prop]);
      }
      if (obj[prop] === __requested__) {
        throw new Error('Cycle detected. Please make "' + String(prop) + '" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');
      }
      return obj[prop];
    } else if (prop in module2) {
      const value2 = module2[prop];
      obj[prop] = __requested__;
      try {
        obj[prop] = typeof value2 === "function" ? value2(injector) : _inject(value2, injector);
      } catch (error3) {
        obj[prop] = error3 instanceof Error ? error3 : void 0;
        throw error3;
      }
      return obj[prop];
    } else {
      return void 0;
    }
  }
  function _merge(target, source) {
    if (source) {
      for (const [key, sourceValue] of Object.entries(source)) {
        if (sourceValue !== void 0 && sourceValue !== null) {
          if (typeof sourceValue === "object") {
            const targetValue = target[key];
            if (typeof targetValue === "object" && targetValue !== null) {
              target[key] = _merge(targetValue, sourceValue);
            } else {
              target[key] = _merge({}, sourceValue);
            }
          } else {
            target[key] = sourceValue;
          }
        }
      }
    }
    return target;
  }
  var Module, isProxy, __requested__;
  var init_dependency_injection = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/dependency-injection.js"() {
      "use strict";
      (function(Module2) {
        Module2.merge = (m1, m22) => _merge(_merge({}, m1), m22);
      })(Module || (Module = {}));
      __name(inject, "inject");
      isProxy = Symbol("isProxy");
      __name(eagerLoad, "eagerLoad");
      __name(_inject, "_inject");
      __requested__ = Symbol();
      __name(_resolve2, "_resolve");
      __name(_merge, "_merge");
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/services.js
  var init_services = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/services.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/documentation/index.js
  var init_documentation = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/documentation/index.js"() {
      "use strict";
      init_comment_provider();
      init_documentation_provider();
      init_jsdoc();
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/languages/language-meta-data.js
  var init_language_meta_data = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/languages/language-meta-data.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/languages/index.js
  var init_languages = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/languages/index.js"() {
      "use strict";
      init_grammar_config();
      init_language_meta_data();
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/indentation-aware.js
  var indentationBuilderDefaultOptions, LexingMode, IndentationAwareTokenBuilder, IndentationAwareLexer;
  var init_indentation_aware = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/indentation-aware.js"() {
      "use strict";
      init_api5();
      init_token_builder();
      init_lexer2();
      indentationBuilderDefaultOptions = {
        indentTokenName: "INDENT",
        dedentTokenName: "DEDENT",
        whitespaceTokenName: "WS",
        ignoreIndentationDelimiters: []
      };
      (function(LexingMode2) {
        LexingMode2["REGULAR"] = "indentation-sensitive";
        LexingMode2["IGNORE_INDENTATION"] = "ignore-indentation";
      })(LexingMode || (LexingMode = {}));
      IndentationAwareTokenBuilder = class extends DefaultTokenBuilder {
        static {
          __name(this, "IndentationAwareTokenBuilder");
        }
        constructor(options2 = indentationBuilderDefaultOptions) {
          super();
          this.indentationStack = [0];
          this.whitespaceRegExp = /[ \t]+/y;
          this.options = {
            ...indentationBuilderDefaultOptions,
            ...options2
          };
          this.indentTokenType = createToken({
            name: this.options.indentTokenName,
            pattern: this.indentMatcher.bind(this),
            line_breaks: false
          });
          this.dedentTokenType = createToken({
            name: this.options.dedentTokenName,
            pattern: this.dedentMatcher.bind(this),
            line_breaks: false
          });
        }
        buildTokens(grammar, options2) {
          const tokenTypes = super.buildTokens(grammar, options2);
          if (!isTokenTypeArray(tokenTypes)) {
            throw new Error("Invalid tokens built by default builder");
          }
          const { indentTokenName, dedentTokenName, whitespaceTokenName, ignoreIndentationDelimiters } = this.options;
          let dedent2;
          let indent;
          let ws;
          const otherTokens = [];
          for (const tokenType of tokenTypes) {
            for (const [begin, end2] of ignoreIndentationDelimiters) {
              if (tokenType.name === begin) {
                tokenType.PUSH_MODE = LexingMode.IGNORE_INDENTATION;
              } else if (tokenType.name === end2) {
                tokenType.POP_MODE = true;
              }
            }
            if (tokenType.name === dedentTokenName) {
              dedent2 = tokenType;
            } else if (tokenType.name === indentTokenName) {
              indent = tokenType;
            } else if (tokenType.name === whitespaceTokenName) {
              ws = tokenType;
            } else {
              otherTokens.push(tokenType);
            }
          }
          if (!dedent2 || !indent || !ws) {
            throw new Error("Some indentation/whitespace tokens not found!");
          }
          if (ignoreIndentationDelimiters.length > 0) {
            const multiModeLexerDef = {
              modes: {
                [LexingMode.REGULAR]: [dedent2, indent, ...otherTokens, ws],
                [LexingMode.IGNORE_INDENTATION]: [...otherTokens, ws]
              },
              defaultMode: LexingMode.REGULAR
            };
            return multiModeLexerDef;
          } else {
            return [dedent2, indent, ws, ...otherTokens];
          }
        }
        flushLexingReport(text4) {
          const result = super.flushLexingReport(text4);
          return {
            ...result,
            remainingDedents: this.flushRemainingDedents(text4)
          };
        }
        /**
         * Helper function to check if the current position is the start of a new line.
         *
         * @param text The full input string.
         * @param offset The current position at which to check
         * @returns Whether the current position is the start of a new line
         */
        isStartOfLine(text4, offset) {
          return offset === 0 || "\r\n".includes(text4[offset - 1]);
        }
        /**
         * A helper function used in matching both indents and dedents.
         *
         * @param text The full input string.
         * @param offset The current position at which to attempt a match
         * @param tokens Previously scanned tokens
         * @param groups Token Groups
         * @returns The current and previous indentation levels and the matched whitespace
         */
        // eslint-disable-next-line @typescript-eslint/no-unused-vars
        matchWhitespace(text4, offset, tokens2, groups) {
          this.whitespaceRegExp.lastIndex = offset;
          const match2 = this.whitespaceRegExp.exec(text4);
          return {
            currIndentLevel: match2?.[0].length ?? 0,
            prevIndentLevel: this.indentationStack.at(-1),
            match: match2
          };
        }
        /**
         * Helper function to create an instance of an indentation token.
         *
         * @param tokenType Indent or dedent token type
         * @param text Full input string, used to calculate the line number
         * @param image The original image of the token (tabs or spaces)
         * @param offset Current position in the input string
         * @returns The indentation token instance
         */
        createIndentationTokenInstance(tokenType, text4, image, offset) {
          const lineNumber = this.getLineNumber(text4, offset);
          return createTokenInstance(tokenType, image, offset, offset + image.length, lineNumber, lineNumber, 1, image.length);
        }
        /**
         * Helper function to get the line number at a given offset.
         *
         * @param text Full input string, used to calculate the line number
         * @param offset Current position in the input string
         * @returns The line number at the given offset
         */
        getLineNumber(text4, offset) {
          return text4.substring(0, offset).split(/\r\n|\r|\n/).length;
        }
        /**
         * A custom pattern for matching indents
         *
         * @param text The full input string.
         * @param offset The offset at which to attempt a match
         * @param tokens Previously scanned tokens
         * @param groups Token Groups
         */
        indentMatcher(text4, offset, tokens2, groups) {
          if (!this.isStartOfLine(text4, offset)) {
            return null;
          }
          const { currIndentLevel, prevIndentLevel, match: match2 } = this.matchWhitespace(text4, offset, tokens2, groups);
          if (currIndentLevel <= prevIndentLevel) {
            return null;
          }
          this.indentationStack.push(currIndentLevel);
          return match2;
        }
        /**
         * A custom pattern for matching dedents
         *
         * @param text The full input string.
         * @param offset The offset at which to attempt a match
         * @param tokens Previously scanned tokens
         * @param groups Token Groups
         */
        dedentMatcher(text4, offset, tokens2, groups) {
          if (!this.isStartOfLine(text4, offset)) {
            return null;
          }
          const { currIndentLevel, prevIndentLevel, match: match2 } = this.matchWhitespace(text4, offset, tokens2, groups);
          if (currIndentLevel >= prevIndentLevel) {
            return null;
          }
          const matchIndentIndex = this.indentationStack.lastIndexOf(currIndentLevel);
          if (matchIndentIndex === -1) {
            this.diagnostics.push({
              severity: "error",
              message: `Invalid dedent level ${currIndentLevel} at offset: ${offset}. Current indentation stack: ${this.indentationStack}`,
              offset,
              length: match2?.[0]?.length ?? 0,
              line: this.getLineNumber(text4, offset),
              column: 1
            });
            return null;
          }
          const numberOfDedents = this.indentationStack.length - matchIndentIndex - 1;
          const newlinesBeforeDedent = text4.substring(0, offset).match(/[\r\n]+$/)?.[0].length ?? 1;
          for (let i2 = 0; i2 < numberOfDedents; i2++) {
            const token2 = this.createIndentationTokenInstance(
              this.dedentTokenType,
              text4,
              "",
              // Dedents are 0-width tokens
              offset - (newlinesBeforeDedent - 1)
            );
            tokens2.push(token2);
            this.indentationStack.pop();
          }
          return null;
        }
        buildTerminalToken(terminal) {
          const tokenType = super.buildTerminalToken(terminal);
          const { indentTokenName, dedentTokenName, whitespaceTokenName } = this.options;
          if (tokenType.name === indentTokenName) {
            return this.indentTokenType;
          } else if (tokenType.name === dedentTokenName) {
            return this.dedentTokenType;
          } else if (tokenType.name === whitespaceTokenName) {
            return createToken({
              name: whitespaceTokenName,
              pattern: this.whitespaceRegExp,
              group: Lexer2.SKIPPED
            });
          }
          return tokenType;
        }
        /**
         * Resets the indentation stack between different runs of the lexer
         *
         * @param text Full text that was tokenized
         * @returns Remaining dedent tokens to match all previous indents at the end of the file
         */
        flushRemainingDedents(text4) {
          const remainingDedents = [];
          while (this.indentationStack.length > 1) {
            remainingDedents.push(this.createIndentationTokenInstance(this.dedentTokenType, text4, "", text4.length));
            this.indentationStack.pop();
          }
          this.indentationStack = [0];
          return remainingDedents;
        }
      };
      IndentationAwareLexer = class extends DefaultLexer {
        static {
          __name(this, "IndentationAwareLexer");
        }
        constructor(services) {
          super(services);
          if (services.parser.TokenBuilder instanceof IndentationAwareTokenBuilder) {
            this.indentationTokenBuilder = services.parser.TokenBuilder;
          } else {
            throw new Error("IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder");
          }
        }
        tokenize(text4, options2 = DEFAULT_TOKENIZE_OPTIONS) {
          const result = super.tokenize(text4);
          const report = result.report;
          if (options2?.mode === "full") {
            result.tokens.push(...report.remainingDedents);
          }
          report.remainingDedents = [];
          const { indentTokenType, dedentTokenType } = this.indentationTokenBuilder;
          const indentTokenIdx = indentTokenType.tokenTypeIdx;
          const dedentTokenIdx = dedentTokenType.tokenTypeIdx;
          const cleanTokens = [];
          const length2 = result.tokens.length - 1;
          for (let i2 = 0; i2 < length2; i2++) {
            const token2 = result.tokens[i2];
            const nextToken = result.tokens[i2 + 1];
            if (token2.tokenTypeIdx === indentTokenIdx && nextToken.tokenTypeIdx === dedentTokenIdx) {
              i2++;
              continue;
            }
            cleanTokens.push(token2);
          }
          if (length2 >= 0) {
            cleanTokens.push(result.tokens[length2]);
          }
          result.tokens = cleanTokens;
          return result;
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/parser-config.js
  var init_parser_config = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/parser-config.js"() {
      "use strict";
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/index.js
  var init_parser2 = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/parser/index.js"() {
      "use strict";
      init_async_parser();
      init_completion_parser_builder();
      init_cst_node_builder();
      init_indentation_aware();
      init_langium_parser_builder();
      init_langium_parser();
      init_lexer2();
      init_parser_builder_base();
      init_parser_config();
      init_token_builder();
      init_value_converter();
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/index.js
  var init_references2 = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/references/index.js"() {
      "use strict";
      init_linker();
      init_name_provider();
      init_references();
      init_scope();
      init_scope_computation();
      init_scope_provider();
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/serializer/index.js
  var init_serializer = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/serializer/index.js"() {
      "use strict";
      init_hydrator();
      init_json_serializer();
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/file-system-provider.js
  var EmptyFileSystemProvider, EmptyFileSystem;
  var init_file_system_provider = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/file-system-provider.js"() {
      "use strict";
      EmptyFileSystemProvider = class {
        static {
          __name(this, "EmptyFileSystemProvider");
        }
        stat(_uri) {
          throw new Error("No file system is available.");
        }
        statSync(_uri) {
          throw new Error("No file system is available.");
        }
        async exists() {
          return false;
        }
        existsSync() {
          return false;
        }
        readBinary() {
          throw new Error("No file system is available.");
        }
        readBinarySync() {
          throw new Error("No file system is available.");
        }
        readFile() {
          throw new Error("No file system is available.");
        }
        readFileSync() {
          throw new Error("No file system is available.");
        }
        async readDirectory() {
          return [];
        }
        readDirectorySync() {
          return [];
        }
      };
      EmptyFileSystem = {
        fileSystemProvider: /* @__PURE__ */ __name(() => new EmptyFileSystemProvider(), "fileSystemProvider")
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/grammar-loader.js
  function createMinimalGrammarServices() {
    const shared = inject(createDefaultSharedCoreModule(EmptyFileSystem), minimalSharedGrammarModule);
    const grammar = inject(createDefaultCoreModule({ shared }), minimalGrammarModule);
    shared.ServiceRegistry.register(grammar);
    return grammar;
  }
  function loadGrammarFromJson(json3) {
    const services = createMinimalGrammarServices();
    const astNode = services.serializer.JsonSerializer.deserialize(json3);
    services.shared.workspace.LangiumDocumentFactory.fromModel(astNode, URI2.parse(`memory:/${astNode.name ?? "grammar"}.langium`));
    return astNode;
  }
  var minimalGrammarModule, minimalSharedGrammarModule;
  var init_grammar_loader = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/grammar-loader.js"() {
      "use strict";
      init_default_module();
      init_dependency_injection();
      init_ast();
      init_file_system_provider();
      init_uri_utils();
      minimalGrammarModule = {
        Grammar: /* @__PURE__ */ __name(() => void 0, "Grammar"),
        LanguageMetaData: /* @__PURE__ */ __name(() => ({
          caseInsensitive: false,
          fileExtensions: [".langium"],
          languageId: "langium"
        }), "LanguageMetaData")
      };
      minimalSharedGrammarModule = {
        AstReflection: /* @__PURE__ */ __name(() => new LangiumGrammarAstReflection(), "AstReflection")
      };
      __name(createMinimalGrammarServices, "createMinimalGrammarServices");
      __name(loadGrammarFromJson, "loadGrammarFromJson");
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/index.js
  var utils_exports = {};
  __export(utils_exports, {
    AstUtils: () => ast_utils_exports,
    BiMap: () => BiMap,
    Cancellation: () => cancellation_exports,
    ContextCache: () => ContextCache,
    CstUtils: () => cst_utils_exports,
    DONE_RESULT: () => DONE_RESULT,
    Deferred: () => Deferred,
    Disposable: () => Disposable,
    DisposableCache: () => DisposableCache,
    DocumentCache: () => DocumentCache,
    EMPTY_STREAM: () => EMPTY_STREAM,
    ErrorWithLocation: () => ErrorWithLocation,
    GrammarUtils: () => grammar_utils_exports,
    MultiMap: () => MultiMap,
    OperationCancelled: () => OperationCancelled,
    Reduction: () => Reduction,
    RegExpUtils: () => regexp_utils_exports,
    SimpleCache: () => SimpleCache,
    StreamImpl: () => StreamImpl,
    TreeStreamImpl: () => TreeStreamImpl,
    URI: () => URI2,
    UriTrie: () => UriTrie,
    UriUtils: () => UriUtils,
    WorkspaceCache: () => WorkspaceCache,
    assertCondition: () => assertCondition,
    assertUnreachable: () => assertUnreachable,
    delayNextTick: () => delayNextTick,
    interruptAndCheck: () => interruptAndCheck,
    isOperationCancelled: () => isOperationCancelled,
    loadGrammarFromJson: () => loadGrammarFromJson,
    setInterruptionPeriod: () => setInterruptionPeriod,
    startCancelableOperation: () => startCancelableOperation,
    stream: () => stream
  });
  var init_utils4 = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/utils/index.js"() {
      "use strict";
      init_caching();
      init_event3();
      __reExport(utils_exports, event_exports);
      init_collections();
      init_disposable();
      init_errors2();
      init_grammar_loader();
      init_promise_utils();
      init_stream();
      init_uri_utils();
      init_ast_utils();
      init_cancellation();
      init_cst_utils();
      init_grammar_utils();
      init_regexp_utils();
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/validation/index.js
  var init_validation = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/validation/index.js"() {
      "use strict";
      init_document_validator();
      init_validation_registry();
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/profiler.js
  var DefaultLangiumProfiler, ProfilingTask;
  var init_profiler = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/profiler.js"() {
      "use strict";
      init_collections();
      DefaultLangiumProfiler = class {
        static {
          __name(this, "DefaultLangiumProfiler");
        }
        constructor(activeCategories) {
          this.activeCategories = /* @__PURE__ */ new Set();
          this.allCategories = /* @__PURE__ */ new Set(["validating", "parsing", "linking"]);
          this.activeCategories = activeCategories ?? new Set(this.allCategories);
          this.records = new MultiMap();
        }
        isActive(category) {
          return this.activeCategories.has(category);
        }
        start(...categories) {
          if (!categories) {
            this.activeCategories = new Set(this.allCategories);
          } else {
            categories.forEach((category) => this.activeCategories.add(category));
          }
        }
        stop(...categories) {
          if (!categories) {
            this.activeCategories.clear();
          } else {
            categories.forEach((category) => this.activeCategories.delete(category));
          }
        }
        createTask(category, taskId) {
          if (!this.isActive(category)) {
            throw new Error(`Category "${category}" is not active.`);
          }
          console.log(`Creating profiling task for '${category}.${taskId}'.`);
          return new ProfilingTask((record) => this.records.add(category, this.dumpRecord(category, record)), taskId);
        }
        dumpRecord(category, record) {
          console.info(`Task ${category}.${record.identifier} executed in ${record.duration.toFixed(2)}ms and ended at ${record.date.toISOString()}`);
          const result = [];
          for (const key of record.entries.keys()) {
            const values2 = record.entries.get(key);
            const duration = values2.reduce((p3, c3) => p3 + c3);
            result.push({ name: `${record.identifier}.${key}`, count: values2.length, duration });
          }
          const taskInternalDuration = record.duration - result.map((r2) => r2.duration).reduce((a2, b3) => a2 + b3, 0);
          result.push({ name: record.identifier, count: 1, duration: taskInternalDuration });
          result.sort((a2, b3) => b3.duration - a2.duration);
          function Round(value2) {
            return Math.round(100 * value2) / 100;
          }
          __name(Round, "Round");
          console.table(result.map((e3) => {
            return { Element: e3.name, Count: e3.count, "Self %": Round(100 * e3.duration / record.duration), "Time (ms)": Round(e3.duration) };
          }));
          return record;
        }
        getRecords(...categories) {
          if (categories.length === 0) {
            return this.records.values();
          } else {
            return this.records.entries().filter((e3) => categories.some((c3) => c3 === e3[0])).flatMap((e3) => e3[1]);
          }
        }
      };
      ProfilingTask = class {
        static {
          __name(this, "ProfilingTask");
        }
        constructor(addRecord, identifier2) {
          this.stack = [];
          this.entries = new MultiMap();
          this.addRecord = addRecord;
          this.identifier = identifier2;
        }
        start() {
          if (this.startTime !== void 0) {
            throw new Error(`Task "${this.identifier}" is already started.`);
          }
          this.startTime = performance.now();
        }
        stop() {
          if (this.startTime === void 0) {
            throw new Error(`Task "${this.identifier}" was not started.`);
          }
          if (this.stack.length !== 0) {
            throw new Error(`Task "${this.identifier}" cannot be stopped before sub-task(s): ${this.stack.map((s2) => s2.id).join(", ")}.`);
          }
          const record = {
            identifier: this.identifier,
            date: /* @__PURE__ */ new Date(),
            duration: performance.now() - this.startTime,
            entries: this.entries
          };
          this.addRecord(record);
          this.startTime = void 0;
          this.entries.clear();
        }
        startSubTask(subTaskId) {
          this.stack.push({ id: subTaskId, start: performance.now(), content: 0 });
        }
        stopSubTask(subTaskId) {
          const subStack = this.stack.pop();
          if (!subStack) {
            throw new Error(`Task "${this.identifier}.${subTaskId}" was not started.`);
          }
          if (subStack.id !== subTaskId) {
            throw new Error(`Sub-Task "${subStack.id}" is not already stopped.`);
          }
          const duration = performance.now() - subStack.start;
          if (this.stack.at(-1) !== void 0) {
            this.stack[this.stack.length - 1].content += duration;
          }
          const selfDuration = duration - subStack.content;
          this.entries.add(subTaskId, selfDuration);
        }
      };
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/index.js
  var init_workspace = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/workspace/index.js"() {
      "use strict";
      init_ast_descriptions();
      init_ast_node_locator();
      init_configuration();
      init_document_builder();
      init_documents();
      init_file_system_provider();
      init_index_manager();
      init_workspace_lock();
      init_workspace_manager();
      init_profiler();
    }
  });

  // ../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/index.js
  var lib_exports = {};
  __export(lib_exports, {
    AbstractAstReflection: () => AbstractAstReflection,
    AbstractCstNode: () => AbstractCstNode,
    AbstractLangiumParser: () => AbstractLangiumParser,
    AbstractParserErrorMessageProvider: () => AbstractParserErrorMessageProvider,
    AbstractThreadedAsyncParser: () => AbstractThreadedAsyncParser,
    AstUtils: () => ast_utils_exports,
    BiMap: () => BiMap,
    Cancellation: () => cancellation_exports,
    CompositeCstNodeImpl: () => CompositeCstNodeImpl,
    ContextCache: () => ContextCache,
    CstNodeBuilder: () => CstNodeBuilder,
    CstUtils: () => cst_utils_exports,
    DEFAULT_TOKENIZE_OPTIONS: () => DEFAULT_TOKENIZE_OPTIONS,
    DONE_RESULT: () => DONE_RESULT,
    DatatypeSymbol: () => DatatypeSymbol,
    DefaultAstNodeDescriptionProvider: () => DefaultAstNodeDescriptionProvider,
    DefaultAstNodeLocator: () => DefaultAstNodeLocator,
    DefaultAsyncParser: () => DefaultAsyncParser,
    DefaultCommentProvider: () => DefaultCommentProvider,
    DefaultConfigurationProvider: () => DefaultConfigurationProvider,
    DefaultDocumentBuilder: () => DefaultDocumentBuilder,
    DefaultDocumentValidator: () => DefaultDocumentValidator,
    DefaultHydrator: () => DefaultHydrator,
    DefaultIndexManager: () => DefaultIndexManager,
    DefaultJsonSerializer: () => DefaultJsonSerializer,
    DefaultLangiumDocumentFactory: () => DefaultLangiumDocumentFactory,
    DefaultLangiumDocuments: () => DefaultLangiumDocuments,
    DefaultLangiumProfiler: () => DefaultLangiumProfiler,
    DefaultLexer: () => DefaultLexer,
    DefaultLexerErrorMessageProvider: () => DefaultLexerErrorMessageProvider,
    DefaultLinker: () => DefaultLinker,
    DefaultNameProvider: () => DefaultNameProvider,
    DefaultReferenceDescriptionProvider: () => DefaultReferenceDescriptionProvider,
    DefaultReferences: () => DefaultReferences,
    DefaultScopeComputation: () => DefaultScopeComputation,
    DefaultScopeProvider: () => DefaultScopeProvider,
    DefaultServiceRegistry: () => DefaultServiceRegistry,
    DefaultTokenBuilder: () => DefaultTokenBuilder,
    DefaultValueConverter: () => DefaultValueConverter,
    DefaultWorkspaceLock: () => DefaultWorkspaceLock,
    DefaultWorkspaceManager: () => DefaultWorkspaceManager,
    Deferred: () => Deferred,
    Disposable: () => Disposable,
    DisposableCache: () => DisposableCache,
    DocumentCache: () => DocumentCache,
    DocumentState: () => DocumentState,
    DocumentValidator: () => DocumentValidator,
    EMPTY_SCOPE: () => EMPTY_SCOPE,
    EMPTY_STREAM: () => EMPTY_STREAM,
    EmptyFileSystem: () => EmptyFileSystem,
    EmptyFileSystemProvider: () => EmptyFileSystemProvider,
    ErrorWithLocation: () => ErrorWithLocation,
    GrammarAST: () => ast_exports,
    GrammarUtils: () => grammar_utils_exports,
    IndentationAwareLexer: () => IndentationAwareLexer,
    IndentationAwareTokenBuilder: () => IndentationAwareTokenBuilder,
    JSDocDocumentationProvider: () => JSDocDocumentationProvider,
    LangiumCompletionParser: () => LangiumCompletionParser,
    LangiumParser: () => LangiumParser,
    LangiumParserErrorMessageProvider: () => LangiumParserErrorMessageProvider,
    LeafCstNodeImpl: () => LeafCstNodeImpl,
    LexingMode: () => LexingMode,
    MapScope: () => MapScope,
    Module: () => Module,
    MultiMap: () => MultiMap,
    MultiMapScope: () => MultiMapScope,
    OperationCancelled: () => OperationCancelled,
    ParserWorker: () => ParserWorker,
    ProfilingTask: () => ProfilingTask,
    Reduction: () => Reduction,
    RefResolving: () => RefResolving,
    RegExpUtils: () => regexp_utils_exports,
    RootCstNodeImpl: () => RootCstNodeImpl,
    SimpleCache: () => SimpleCache,
    StreamImpl: () => StreamImpl,
    StreamScope: () => StreamScope,
    TextDocument: () => TextDocument2,
    TreeStreamImpl: () => TreeStreamImpl,
    URI: () => URI2,
    UriTrie: () => UriTrie,
    UriUtils: () => UriUtils,
    VALIDATE_EACH_NODE: () => VALIDATE_EACH_NODE,
    ValidationCategory: () => ValidationCategory,
    ValidationRegistry: () => ValidationRegistry,
    ValueConverter: () => ValueConverter,
    WorkspaceCache: () => WorkspaceCache,
    assertCondition: () => assertCondition,
    assertUnreachable: () => assertUnreachable,
    createCompletionParser: () => createCompletionParser,
    createDefaultCoreModule: () => createDefaultCoreModule,
    createDefaultSharedCoreModule: () => createDefaultSharedCoreModule,
    createGrammarConfig: () => createGrammarConfig,
    createLangiumParser: () => createLangiumParser,
    createParser: () => createParser,
    delayNextTick: () => delayNextTick,
    diagnosticData: () => diagnosticData,
    eagerLoad: () => eagerLoad,
    getDiagnosticRange: () => getDiagnosticRange,
    indentationBuilderDefaultOptions: () => indentationBuilderDefaultOptions,
    inject: () => inject,
    interruptAndCheck: () => interruptAndCheck,
    isAstNode: () => isAstNode,
    isAstNodeDescription: () => isAstNodeDescription,
    isAstNodeWithComment: () => isAstNodeWithComment,
    isCompositeCstNode: () => isCompositeCstNode,
    isIMultiModeLexerDefinition: () => isIMultiModeLexerDefinition,
    isJSDoc: () => isJSDoc,
    isLeafCstNode: () => isLeafCstNode,
    isLinkingError: () => isLinkingError,
    isMultiReference: () => isMultiReference,
    isNamed: () => isNamed,
    isOperationCancelled: () => isOperationCancelled,
    isReference: () => isReference,
    isRootCstNode: () => isRootCstNode,
    isTokenTypeArray: () => isTokenTypeArray,
    isTokenTypeDictionary: () => isTokenTypeDictionary,
    loadGrammarFromJson: () => loadGrammarFromJson,
    parseJSDoc: () => parseJSDoc,
    prepareLangiumParser: () => prepareLangiumParser,
    setInterruptionPeriod: () => setInterruptionPeriod,
    startCancelableOperation: () => startCancelableOperation,
    stream: () => stream,
    toDiagnosticData: () => toDiagnosticData,
    toDiagnosticSeverity: () => toDiagnosticSeverity
  });
  var init_lib3 = __esm({
    "../../node_modules/.pnpm/langium@4.2.0/node_modules/langium/lib/index.js"() {
      "use strict";
      init_default_module();
      init_dependency_injection();
      init_service_registry();
      init_services();
      init_syntax_tree();
      init_documentation();
      init_languages();
      init_parser2();
      init_references2();
      init_serializer();
      init_utils4();
      __reExport(lib_exports, utils_exports);
      init_validation();
      init_workspace();
      init_ast();
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/chunk-K5T4RW27.mjs
  function isArchitecture(item) {
    return reflection2.isInstance(item, Architecture.$type);
  }
  function isBranch(item) {
    return reflection2.isInstance(item, Branch.$type);
  }
  function isCommit(item) {
    return reflection2.isInstance(item, Commit.$type);
  }
  function isGitGraph(item) {
    return reflection2.isInstance(item, GitGraph.$type);
  }
  function isInfo(item) {
    return reflection2.isInstance(item, Info.$type);
  }
  function isMerge(item) {
    return reflection2.isInstance(item, Merge.$type);
  }
  function isPacket(item) {
    return reflection2.isInstance(item, Packet.$type);
  }
  function isPacketBlock(item) {
    return reflection2.isInstance(item, PacketBlock.$type);
  }
  function isPie(item) {
    return reflection2.isInstance(item, Pie.$type);
  }
  function isPieSection(item) {
    return reflection2.isInstance(item, PieSection.$type);
  }
  function isTreemap(item) {
    return reflection2.isInstance(item, Treemap.$type);
  }
  function isWardley(item) {
    return reflection2.isInstance(item, Wardley.$type);
  }
  var __defProp2, __name2, ArchitectureGrammar, GitGraphGrammar, InfoGrammar, PacketGrammar, PieGrammar, RadarGrammar, TreemapGrammar, TreeViewGrammar, WardleyGrammar, MermaidTerminals, Accelerator, Anchor2, Annotation, Annotations, Architecture, Axis, Branch, Checkout, CherryPicking, ClassDefStatement, Commit, Component, Curve, Deaccelerator, Decorator, Direction, Edge, Entry, Evolution, EvolutionStage, Evolve, GitGraph, Group2, Info, Item, Junction, Label, Leaf, Link, Merge, Note, Option3, Packet, PacketBlock, Pie, PieSection, Pipeline, PipelineComponent, Radar, Section, Service, Size, Statement, Treemap, TreemapRow, TreeNode, TreeView, Wardley, MermaidAstReflection, reflection2, loadedArchitectureGrammarGrammar, ArchitectureGrammarGrammar, loadedGitGraphGrammarGrammar, GitGraphGrammarGrammar, loadedInfoGrammarGrammar, InfoGrammarGrammar, loadedPacketGrammarGrammar, PacketGrammarGrammar, loadedPieGrammarGrammar, PieGrammarGrammar, loadedRadarGrammarGrammar, RadarGrammarGrammar, loadedTreemapGrammarGrammar, TreemapGrammarGrammar, loadedTreeViewGrammarGrammar, TreeViewGrammarGrammar, loadedWardleyGrammarGrammar, WardleyGrammarGrammar, ArchitectureGrammarLanguageMetaData, GitGraphGrammarLanguageMetaData, InfoGrammarLanguageMetaData, PacketGrammarLanguageMetaData, PieGrammarLanguageMetaData, RadarGrammarLanguageMetaData, TreemapGrammarLanguageMetaData, TreeViewGrammarLanguageMetaData, WardleyGrammarLanguageMetaData, MermaidGeneratedSharedModule, ArchitectureGrammarGeneratedModule, GitGraphGrammarGeneratedModule, InfoGrammarGeneratedModule, PacketGrammarGeneratedModule, PieGrammarGeneratedModule, RadarGrammarGeneratedModule, TreemapGrammarGeneratedModule, TreeViewGrammarGeneratedModule, WardleyGrammarGeneratedModule, accessibilityDescrRegex, accessibilityTitleRegex, titleRegex, rulesRegexes, AbstractMermaidValueConverter, CommonValueConverter, AbstractMermaidTokenBuilder, CommonTokenBuilder;
  var init_chunk_K5T4RW27 = __esm({
    "../parser/dist/chunks/mermaid-parser.core/chunk-K5T4RW27.mjs"() {
      "use strict";
      init_lib3();
      init_lib3();
      init_lib3();
      init_lib3();
      __defProp2 = Object.defineProperty;
      __name2 = /* @__PURE__ */ __name((target, value2) => __defProp2(target, "name", { value: value2, configurable: true }), "__name");
      ((ArchitectureGrammar2) => {
        ArchitectureGrammar2.Terminals = {
          ARROW_DIRECTION: /L|R|T|B/,
          ARROW_GROUP: /\{group\}/,
          ARROW_INTO: /<|>/,
          ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,
          ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,
          TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,
          STRING: /"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,
          ID: /[\w]([-\w]*\w)?/,
          NEWLINE: /\r?\n/,
          WHITESPACE: /[\t ]+/,
          YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,
          DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,
          SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/,
          ARCH_ICON: /\([\w-:]+\)/,
          ARCH_TITLE: /\[(?:"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|[\w ]+)\]/
        };
      })(ArchitectureGrammar || (ArchitectureGrammar = {}));
      ((GitGraphGrammar2) => {
        GitGraphGrammar2.Terminals = {
          ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,
          ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,
          TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,
          INT: /0|[1-9][0-9]*(?!\.)/,
          STRING: /"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,
          NEWLINE: /\r?\n/,
          WHITESPACE: /[\t ]+/,
          YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,
          DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,
          SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/,
          REFERENCE: /\w([-\./\w]*[-\w])?/
        };
      })(GitGraphGrammar || (GitGraphGrammar = {}));
      ((InfoGrammar2) => {
        InfoGrammar2.Terminals = {
          ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,
          ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,
          TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,
          NEWLINE: /\r?\n/,
          WHITESPACE: /[\t ]+/,
          YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,
          DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,
          SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/
        };
      })(InfoGrammar || (InfoGrammar = {}));
      ((PacketGrammar2) => {
        PacketGrammar2.Terminals = {
          ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,
          ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,
          TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,
          INT: /0|[1-9][0-9]*(?!\.)/,
          STRING: /"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,
          NEWLINE: /\r?\n/,
          WHITESPACE: /[\t ]+/,
          YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,
          DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,
          SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/
        };
      })(PacketGrammar || (PacketGrammar = {}));
      ((PieGrammar2) => {
        PieGrammar2.Terminals = {
          NUMBER_PIE: /(?:-?[0-9]+\.[0-9]+(?!\.))|(?:-?(0|[1-9][0-9]*)(?!\.))/,
          ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,
          ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,
          TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,
          STRING: /"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,
          NEWLINE: /\r?\n/,
          WHITESPACE: /[\t ]+/,
          YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,
          DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,
          SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/
        };
      })(PieGrammar || (PieGrammar = {}));
      ((RadarGrammar2) => {
        RadarGrammar2.Terminals = {
          GRATICULE: /circle|polygon/,
          BOOLEAN: /true|false/,
          ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,
          ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,
          TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,
          NUMBER: /(?:[0-9]+\.[0-9]+(?!\.))|(?:0|[1-9][0-9]*(?!\.))/,
          STRING: /"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,
          ID: /[\w]([-\w]*\w)?/,
          NEWLINE: /\r?\n/,
          WHITESPACE: /[\t ]+/,
          YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,
          DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,
          SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/
        };
      })(RadarGrammar || (RadarGrammar = {}));
      ((TreemapGrammar2) => {
        TreemapGrammar2.Terminals = {
          ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,
          ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,
          TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,
          TREEMAP_KEYWORD: /treemap-beta|treemap/,
          CLASS_DEF: /classDef\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\s+([^;\r\n]*))?(?:;)?/,
          STYLE_SEPARATOR: /:::/,
          SEPARATOR: /:/,
          COMMA: /,/,
          INDENTATION: /[ \t]{1,}/,
          WS: /[ \t]+/,
          ML_COMMENT: /\%\%[^\n]*/,
          NL: /\r?\n/,
          ID2: /[a-zA-Z_][a-zA-Z0-9_]*/,
          NUMBER2: /[0-9_\.\,]+/,
          STRING2: /"[^"]*"|'[^']*'/
        };
      })(TreemapGrammar || (TreemapGrammar = {}));
      ((TreeViewGrammar2) => {
        TreeViewGrammar2.Terminals = {
          ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,
          ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,
          TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,
          INDENTATION: /[ \t]{1,}/,
          WS: /[ \t]+/,
          ML_COMMENT: /\%\%[^\n]*/,
          NL: /\r?\n/,
          STRING2: /"[^"]*"|'[^']*'/
        };
      })(TreeViewGrammar || (TreeViewGrammar = {}));
      ((WardleyGrammar2) => {
        WardleyGrammar2.Terminals = {
          WARDLEY_NUMBER: /[0-9]+\.[0-9]+/,
          ARROW: /->/,
          LINK_PORT: /\+<>|\+>|\+</,
          LINK_ARROW: /-->|-\.->|>|\+'[^']*'<>|\+'[^']*'<|\+'[^']*'>/,
          LINK_LABEL: /;[^\n\r]+/,
          STRATEGY: /build|buy|outsource|market/,
          KW_WARDLEY: /wardley-beta/,
          KW_SIZE: /size/,
          KW_EVOLUTION: /evolution/,
          KW_ANCHOR: /anchor/,
          KW_COMPONENT: /component/,
          KW_LABEL: /label/,
          KW_INERTIA: /inertia/,
          KW_EVOLVE: /evolve/,
          KW_PIPELINE: /pipeline/,
          KW_NOTE: /note/,
          KW_ANNOTATIONS: /annotations/,
          KW_ANNOTATION: /annotation/,
          KW_ACCELERATOR: /accelerator/,
          KW_DEACCELERATOR: /deaccelerator/,
          NAME_WITH_SPACES: /(?!title\s|accTitle|accDescr)[A-Za-z][A-Za-z0-9_()&]*(?:[ \t]+[A-Za-z(][A-Za-z0-9_()&]*)*/,
          WS: /[ \t]+/,
          ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,
          ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,
          TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,
          INT: /0|[1-9][0-9]*(?!\.)/,
          STRING: /"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,
          ID: /[\w]([-\w]*\w)?/,
          NEWLINE: /\r?\n/,
          WHITESPACE: /[\t ]+/,
          YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,
          DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,
          SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/
        };
      })(WardleyGrammar || (WardleyGrammar = {}));
      MermaidTerminals = {
        ...ArchitectureGrammar.Terminals,
        ...GitGraphGrammar.Terminals,
        ...InfoGrammar.Terminals,
        ...PacketGrammar.Terminals,
        ...PieGrammar.Terminals,
        ...RadarGrammar.Terminals,
        ...TreeViewGrammar.Terminals,
        ...TreemapGrammar.Terminals,
        ...WardleyGrammar.Terminals
      };
      Accelerator = {
        $type: "Accelerator",
        name: "name",
        x: "x",
        y: "y"
      };
      Anchor2 = {
        $type: "Anchor",
        evolution: "evolution",
        name: "name",
        visibility: "visibility"
      };
      Annotation = {
        $type: "Annotation",
        number: "number",
        text: "text",
        x: "x",
        y: "y"
      };
      Annotations = {
        $type: "Annotations",
        x: "x",
        y: "y"
      };
      Architecture = {
        $type: "Architecture",
        accDescr: "accDescr",
        accTitle: "accTitle",
        edges: "edges",
        groups: "groups",
        junctions: "junctions",
        services: "services",
        title: "title"
      };
      __name(isArchitecture, "isArchitecture");
      __name2(isArchitecture, "isArchitecture");
      Axis = {
        $type: "Axis",
        label: "label",
        name: "name"
      };
      Branch = {
        $type: "Branch",
        name: "name",
        order: "order"
      };
      __name(isBranch, "isBranch");
      __name2(isBranch, "isBranch");
      Checkout = {
        $type: "Checkout",
        branch: "branch"
      };
      CherryPicking = {
        $type: "CherryPicking",
        id: "id",
        parent: "parent",
        tags: "tags"
      };
      ClassDefStatement = {
        $type: "ClassDefStatement",
        className: "className",
        styleText: "styleText"
      };
      Commit = {
        $type: "Commit",
        id: "id",
        message: "message",
        tags: "tags",
        type: "type"
      };
      __name(isCommit, "isCommit");
      __name2(isCommit, "isCommit");
      Component = {
        $type: "Component",
        decorator: "decorator",
        evolution: "evolution",
        inertia: "inertia",
        label: "label",
        name: "name",
        visibility: "visibility"
      };
      Curve = {
        $type: "Curve",
        entries: "entries",
        label: "label",
        name: "name"
      };
      Deaccelerator = {
        $type: "Deaccelerator",
        name: "name",
        x: "x",
        y: "y"
      };
      Decorator = {
        $type: "Decorator",
        strategy: "strategy"
      };
      Direction = {
        $type: "Direction",
        accDescr: "accDescr",
        accTitle: "accTitle",
        dir: "dir",
        statements: "statements",
        title: "title"
      };
      Edge = {
        $type: "Edge",
        lhsDir: "lhsDir",
        lhsGroup: "lhsGroup",
        lhsId: "lhsId",
        lhsInto: "lhsInto",
        rhsDir: "rhsDir",
        rhsGroup: "rhsGroup",
        rhsId: "rhsId",
        rhsInto: "rhsInto",
        title: "title"
      };
      Entry = {
        $type: "Entry",
        axis: "axis",
        value: "value"
      };
      Evolution = {
        $type: "Evolution",
        stages: "stages"
      };
      EvolutionStage = {
        $type: "EvolutionStage",
        boundary: "boundary",
        name: "name",
        secondName: "secondName"
      };
      Evolve = {
        $type: "Evolve",
        component: "component",
        target: "target"
      };
      GitGraph = {
        $type: "GitGraph",
        accDescr: "accDescr",
        accTitle: "accTitle",
        statements: "statements",
        title: "title"
      };
      __name(isGitGraph, "isGitGraph");
      __name2(isGitGraph, "isGitGraph");
      Group2 = {
        $type: "Group",
        icon: "icon",
        id: "id",
        in: "in",
        title: "title"
      };
      Info = {
        $type: "Info",
        accDescr: "accDescr",
        accTitle: "accTitle",
        title: "title"
      };
      __name(isInfo, "isInfo");
      __name2(isInfo, "isInfo");
      Item = {
        $type: "Item",
        classSelector: "classSelector",
        name: "name"
      };
      Junction = {
        $type: "Junction",
        id: "id",
        in: "in"
      };
      Label = {
        $type: "Label",
        negX: "negX",
        negY: "negY",
        offsetX: "offsetX",
        offsetY: "offsetY"
      };
      Leaf = {
        $type: "Leaf",
        classSelector: "classSelector",
        name: "name",
        value: "value"
      };
      Link = {
        $type: "Link",
        arrow: "arrow",
        from: "from",
        fromPort: "fromPort",
        linkLabel: "linkLabel",
        to: "to",
        toPort: "toPort"
      };
      Merge = {
        $type: "Merge",
        branch: "branch",
        id: "id",
        tags: "tags",
        type: "type"
      };
      __name(isMerge, "isMerge");
      __name2(isMerge, "isMerge");
      Note = {
        $type: "Note",
        evolution: "evolution",
        text: "text",
        visibility: "visibility"
      };
      Option3 = {
        $type: "Option",
        name: "name",
        value: "value"
      };
      Packet = {
        $type: "Packet",
        accDescr: "accDescr",
        accTitle: "accTitle",
        blocks: "blocks",
        title: "title"
      };
      __name(isPacket, "isPacket");
      __name2(isPacket, "isPacket");
      PacketBlock = {
        $type: "PacketBlock",
        bits: "bits",
        end: "end",
        label: "label",
        start: "start"
      };
      __name(isPacketBlock, "isPacketBlock");
      __name2(isPacketBlock, "isPacketBlock");
      Pie = {
        $type: "Pie",
        accDescr: "accDescr",
        accTitle: "accTitle",
        sections: "sections",
        showData: "showData",
        title: "title"
      };
      __name(isPie, "isPie");
      __name2(isPie, "isPie");
      PieSection = {
        $type: "PieSection",
        label: "label",
        value: "value"
      };
      __name(isPieSection, "isPieSection");
      __name2(isPieSection, "isPieSection");
      Pipeline = {
        $type: "Pipeline",
        components: "components",
        parent: "parent"
      };
      PipelineComponent = {
        $type: "PipelineComponent",
        evolution: "evolution",
        label: "label",
        name: "name"
      };
      Radar = {
        $type: "Radar",
        accDescr: "accDescr",
        accTitle: "accTitle",
        axes: "axes",
        curves: "curves",
        options: "options",
        title: "title"
      };
      Section = {
        $type: "Section",
        classSelector: "classSelector",
        name: "name"
      };
      Service = {
        $type: "Service",
        icon: "icon",
        iconText: "iconText",
        id: "id",
        in: "in",
        title: "title"
      };
      Size = {
        $type: "Size",
        height: "height",
        width: "width"
      };
      Statement = {
        $type: "Statement"
      };
      Treemap = {
        $type: "Treemap",
        accDescr: "accDescr",
        accTitle: "accTitle",
        title: "title",
        TreemapRows: "TreemapRows"
      };
      __name(isTreemap, "isTreemap");
      __name2(isTreemap, "isTreemap");
      TreemapRow = {
        $type: "TreemapRow",
        indent: "indent",
        item: "item"
      };
      TreeNode = {
        $type: "TreeNode",
        indent: "indent",
        name: "name"
      };
      TreeView = {
        $type: "TreeView",
        accDescr: "accDescr",
        accTitle: "accTitle",
        nodes: "nodes",
        title: "title"
      };
      Wardley = {
        $type: "Wardley",
        accDescr: "accDescr",
        accelerators: "accelerators",
        accTitle: "accTitle",
        anchors: "anchors",
        annotation: "annotation",
        annotations: "annotations",
        components: "components",
        deaccelerators: "deaccelerators",
        evolution: "evolution",
        evolves: "evolves",
        links: "links",
        notes: "notes",
        pipelines: "pipelines",
        size: "size",
        title: "title"
      };
      __name(isWardley, "isWardley");
      __name2(isWardley, "isWardley");
      MermaidAstReflection = class extends AbstractAstReflection {
        static {
          __name(this, "MermaidAstReflection");
        }
        constructor() {
          super(...arguments);
          this.types = {
            Accelerator: {
              name: Accelerator.$type,
              properties: {
                name: {
                  name: Accelerator.name
                },
                x: {
                  name: Accelerator.x
                },
                y: {
                  name: Accelerator.y
                }
              },
              superTypes: []
            },
            Anchor: {
              name: Anchor2.$type,
              properties: {
                evolution: {
                  name: Anchor2.evolution
                },
                name: {
                  name: Anchor2.name
                },
                visibility: {
                  name: Anchor2.visibility
                }
              },
              superTypes: []
            },
            Annotation: {
              name: Annotation.$type,
              properties: {
                number: {
                  name: Annotation.number
                },
                text: {
                  name: Annotation.text
                },
                x: {
                  name: Annotation.x
                },
                y: {
                  name: Annotation.y
                }
              },
              superTypes: []
            },
            Annotations: {
              name: Annotations.$type,
              properties: {
                x: {
                  name: Annotations.x
                },
                y: {
                  name: Annotations.y
                }
              },
              superTypes: []
            },
            Architecture: {
              name: Architecture.$type,
              properties: {
                accDescr: {
                  name: Architecture.accDescr
                },
                accTitle: {
                  name: Architecture.accTitle
                },
                edges: {
                  name: Architecture.edges,
                  defaultValue: []
                },
                groups: {
                  name: Architecture.groups,
                  defaultValue: []
                },
                junctions: {
                  name: Architecture.junctions,
                  defaultValue: []
                },
                services: {
                  name: Architecture.services,
                  defaultValue: []
                },
                title: {
                  name: Architecture.title
                }
              },
              superTypes: []
            },
            Axis: {
              name: Axis.$type,
              properties: {
                label: {
                  name: Axis.label
                },
                name: {
                  name: Axis.name
                }
              },
              superTypes: []
            },
            Branch: {
              name: Branch.$type,
              properties: {
                name: {
                  name: Branch.name
                },
                order: {
                  name: Branch.order
                }
              },
              superTypes: [Statement.$type]
            },
            Checkout: {
              name: Checkout.$type,
              properties: {
                branch: {
                  name: Checkout.branch
                }
              },
              superTypes: [Statement.$type]
            },
            CherryPicking: {
              name: CherryPicking.$type,
              properties: {
                id: {
                  name: CherryPicking.id
                },
                parent: {
                  name: CherryPicking.parent
                },
                tags: {
                  name: CherryPicking.tags,
                  defaultValue: []
                }
              },
              superTypes: [Statement.$type]
            },
            ClassDefStatement: {
              name: ClassDefStatement.$type,
              properties: {
                className: {
                  name: ClassDefStatement.className
                },
                styleText: {
                  name: ClassDefStatement.styleText
                }
              },
              superTypes: []
            },
            Commit: {
              name: Commit.$type,
              properties: {
                id: {
                  name: Commit.id
                },
                message: {
                  name: Commit.message
                },
                tags: {
                  name: Commit.tags,
                  defaultValue: []
                },
                type: {
                  name: Commit.type
                }
              },
              superTypes: [Statement.$type]
            },
            Component: {
              name: Component.$type,
              properties: {
                decorator: {
                  name: Component.decorator
                },
                evolution: {
                  name: Component.evolution
                },
                inertia: {
                  name: Component.inertia,
                  defaultValue: false
                },
                label: {
                  name: Component.label
                },
                name: {
                  name: Component.name
                },
                visibility: {
                  name: Component.visibility
                }
              },
              superTypes: []
            },
            Curve: {
              name: Curve.$type,
              properties: {
                entries: {
                  name: Curve.entries,
                  defaultValue: []
                },
                label: {
                  name: Curve.label
                },
                name: {
                  name: Curve.name
                }
              },
              superTypes: []
            },
            Deaccelerator: {
              name: Deaccelerator.$type,
              properties: {
                name: {
                  name: Deaccelerator.name
                },
                x: {
                  name: Deaccelerator.x
                },
                y: {
                  name: Deaccelerator.y
                }
              },
              superTypes: []
            },
            Decorator: {
              name: Decorator.$type,
              properties: {
                strategy: {
                  name: Decorator.strategy
                }
              },
              superTypes: []
            },
            Direction: {
              name: Direction.$type,
              properties: {
                accDescr: {
                  name: Direction.accDescr
                },
                accTitle: {
                  name: Direction.accTitle
                },
                dir: {
                  name: Direction.dir
                },
                statements: {
                  name: Direction.statements,
                  defaultValue: []
                },
                title: {
                  name: Direction.title
                }
              },
              superTypes: [GitGraph.$type]
            },
            Edge: {
              name: Edge.$type,
              properties: {
                lhsDir: {
                  name: Edge.lhsDir
                },
                lhsGroup: {
                  name: Edge.lhsGroup,
                  defaultValue: false
                },
                lhsId: {
                  name: Edge.lhsId
                },
                lhsInto: {
                  name: Edge.lhsInto,
                  defaultValue: false
                },
                rhsDir: {
                  name: Edge.rhsDir
                },
                rhsGroup: {
                  name: Edge.rhsGroup,
                  defaultValue: false
                },
                rhsId: {
                  name: Edge.rhsId
                },
                rhsInto: {
                  name: Edge.rhsInto,
                  defaultValue: false
                },
                title: {
                  name: Edge.title
                }
              },
              superTypes: []
            },
            Entry: {
              name: Entry.$type,
              properties: {
                axis: {
                  name: Entry.axis,
                  referenceType: Axis.$type
                },
                value: {
                  name: Entry.value
                }
              },
              superTypes: []
            },
            Evolution: {
              name: Evolution.$type,
              properties: {
                stages: {
                  name: Evolution.stages,
                  defaultValue: []
                }
              },
              superTypes: []
            },
            EvolutionStage: {
              name: EvolutionStage.$type,
              properties: {
                boundary: {
                  name: EvolutionStage.boundary
                },
                name: {
                  name: EvolutionStage.name
                },
                secondName: {
                  name: EvolutionStage.secondName
                }
              },
              superTypes: []
            },
            Evolve: {
              name: Evolve.$type,
              properties: {
                component: {
                  name: Evolve.component
                },
                target: {
                  name: Evolve.target
                }
              },
              superTypes: []
            },
            GitGraph: {
              name: GitGraph.$type,
              properties: {
                accDescr: {
                  name: GitGraph.accDescr
                },
                accTitle: {
                  name: GitGraph.accTitle
                },
                statements: {
                  name: GitGraph.statements,
                  defaultValue: []
                },
                title: {
                  name: GitGraph.title
                }
              },
              superTypes: []
            },
            Group: {
              name: Group2.$type,
              properties: {
                icon: {
                  name: Group2.icon
                },
                id: {
                  name: Group2.id
                },
                in: {
                  name: Group2.in
                },
                title: {
                  name: Group2.title
                }
              },
              superTypes: []
            },
            Info: {
              name: Info.$type,
              properties: {
                accDescr: {
                  name: Info.accDescr
                },
                accTitle: {
                  name: Info.accTitle
                },
                title: {
                  name: Info.title
                }
              },
              superTypes: []
            },
            Item: {
              name: Item.$type,
              properties: {
                classSelector: {
                  name: Item.classSelector
                },
                name: {
                  name: Item.name
                }
              },
              superTypes: []
            },
            Junction: {
              name: Junction.$type,
              properties: {
                id: {
                  name: Junction.id
                },
                in: {
                  name: Junction.in
                }
              },
              superTypes: []
            },
            Label: {
              name: Label.$type,
              properties: {
                negX: {
                  name: Label.negX,
                  defaultValue: false
                },
                negY: {
                  name: Label.negY,
                  defaultValue: false
                },
                offsetX: {
                  name: Label.offsetX
                },
                offsetY: {
                  name: Label.offsetY
                }
              },
              superTypes: []
            },
            Leaf: {
              name: Leaf.$type,
              properties: {
                classSelector: {
                  name: Leaf.classSelector
                },
                name: {
                  name: Leaf.name
                },
                value: {
                  name: Leaf.value
                }
              },
              superTypes: [Item.$type]
            },
            Link: {
              name: Link.$type,
              properties: {
                arrow: {
                  name: Link.arrow
                },
                from: {
                  name: Link.from
                },
                fromPort: {
                  name: Link.fromPort
                },
                linkLabel: {
                  name: Link.linkLabel
                },
                to: {
                  name: Link.to
                },
                toPort: {
                  name: Link.toPort
                }
              },
              superTypes: []
            },
            Merge: {
              name: Merge.$type,
              properties: {
                branch: {
                  name: Merge.branch
                },
                id: {
                  name: Merge.id
                },
                tags: {
                  name: Merge.tags,
                  defaultValue: []
                },
                type: {
                  name: Merge.type
                }
              },
              superTypes: [Statement.$type]
            },
            Note: {
              name: Note.$type,
              properties: {
                evolution: {
                  name: Note.evolution
                },
                text: {
                  name: Note.text
                },
                visibility: {
                  name: Note.visibility
                }
              },
              superTypes: []
            },
            Option: {
              name: Option3.$type,
              properties: {
                name: {
                  name: Option3.name
                },
                value: {
                  name: Option3.value,
                  defaultValue: false
                }
              },
              superTypes: []
            },
            Packet: {
              name: Packet.$type,
              properties: {
                accDescr: {
                  name: Packet.accDescr
                },
                accTitle: {
                  name: Packet.accTitle
                },
                blocks: {
                  name: Packet.blocks,
                  defaultValue: []
                },
                title: {
                  name: Packet.title
                }
              },
              superTypes: []
            },
            PacketBlock: {
              name: PacketBlock.$type,
              properties: {
                bits: {
                  name: PacketBlock.bits
                },
                end: {
                  name: PacketBlock.end
                },
                label: {
                  name: PacketBlock.label
                },
                start: {
                  name: PacketBlock.start
                }
              },
              superTypes: []
            },
            Pie: {
              name: Pie.$type,
              properties: {
                accDescr: {
                  name: Pie.accDescr
                },
                accTitle: {
                  name: Pie.accTitle
                },
                sections: {
                  name: Pie.sections,
                  defaultValue: []
                },
                showData: {
                  name: Pie.showData,
                  defaultValue: false
                },
                title: {
                  name: Pie.title
                }
              },
              superTypes: []
            },
            PieSection: {
              name: PieSection.$type,
              properties: {
                label: {
                  name: PieSection.label
                },
                value: {
                  name: PieSection.value
                }
              },
              superTypes: []
            },
            Pipeline: {
              name: Pipeline.$type,
              properties: {
                components: {
                  name: Pipeline.components,
                  defaultValue: []
                },
                parent: {
                  name: Pipeline.parent
                }
              },
              superTypes: []
            },
            PipelineComponent: {
              name: PipelineComponent.$type,
              properties: {
                evolution: {
                  name: PipelineComponent.evolution
                },
                label: {
                  name: PipelineComponent.label
                },
                name: {
                  name: PipelineComponent.name
                }
              },
              superTypes: []
            },
            Radar: {
              name: Radar.$type,
              properties: {
                accDescr: {
                  name: Radar.accDescr
                },
                accTitle: {
                  name: Radar.accTitle
                },
                axes: {
                  name: Radar.axes,
                  defaultValue: []
                },
                curves: {
                  name: Radar.curves,
                  defaultValue: []
                },
                options: {
                  name: Radar.options,
                  defaultValue: []
                },
                title: {
                  name: Radar.title
                }
              },
              superTypes: []
            },
            Section: {
              name: Section.$type,
              properties: {
                classSelector: {
                  name: Section.classSelector
                },
                name: {
                  name: Section.name
                }
              },
              superTypes: [Item.$type]
            },
            Service: {
              name: Service.$type,
              properties: {
                icon: {
                  name: Service.icon
                },
                iconText: {
                  name: Service.iconText
                },
                id: {
                  name: Service.id
                },
                in: {
                  name: Service.in
                },
                title: {
                  name: Service.title
                }
              },
              superTypes: []
            },
            Size: {
              name: Size.$type,
              properties: {
                height: {
                  name: Size.height
                },
                width: {
                  name: Size.width
                }
              },
              superTypes: []
            },
            Statement: {
              name: Statement.$type,
              properties: {},
              superTypes: []
            },
            TreeNode: {
              name: TreeNode.$type,
              properties: {
                indent: {
                  name: TreeNode.indent
                },
                name: {
                  name: TreeNode.name
                }
              },
              superTypes: []
            },
            TreeView: {
              name: TreeView.$type,
              properties: {
                accDescr: {
                  name: TreeView.accDescr
                },
                accTitle: {
                  name: TreeView.accTitle
                },
                nodes: {
                  name: TreeView.nodes,
                  defaultValue: []
                },
                title: {
                  name: TreeView.title
                }
              },
              superTypes: []
            },
            Treemap: {
              name: Treemap.$type,
              properties: {
                accDescr: {
                  name: Treemap.accDescr
                },
                accTitle: {
                  name: Treemap.accTitle
                },
                title: {
                  name: Treemap.title
                },
                TreemapRows: {
                  name: Treemap.TreemapRows,
                  defaultValue: []
                }
              },
              superTypes: []
            },
            TreemapRow: {
              name: TreemapRow.$type,
              properties: {
                indent: {
                  name: TreemapRow.indent
                },
                item: {
                  name: TreemapRow.item
                }
              },
              superTypes: []
            },
            Wardley: {
              name: Wardley.$type,
              properties: {
                accDescr: {
                  name: Wardley.accDescr
                },
                accelerators: {
                  name: Wardley.accelerators,
                  defaultValue: []
                },
                accTitle: {
                  name: Wardley.accTitle
                },
                anchors: {
                  name: Wardley.anchors,
                  defaultValue: []
                },
                annotation: {
                  name: Wardley.annotation,
                  defaultValue: []
                },
                annotations: {
                  name: Wardley.annotations,
                  defaultValue: []
                },
                components: {
                  name: Wardley.components,
                  defaultValue: []
                },
                deaccelerators: {
                  name: Wardley.deaccelerators,
                  defaultValue: []
                },
                evolution: {
                  name: Wardley.evolution
                },
                evolves: {
                  name: Wardley.evolves,
                  defaultValue: []
                },
                links: {
                  name: Wardley.links,
                  defaultValue: []
                },
                notes: {
                  name: Wardley.notes,
                  defaultValue: []
                },
                pipelines: {
                  name: Wardley.pipelines,
                  defaultValue: []
                },
                size: {
                  name: Wardley.size
                },
                title: {
                  name: Wardley.title
                }
              },
              superTypes: []
            }
          };
        }
        static {
          __name2(this, "MermaidAstReflection");
        }
      };
      reflection2 = new MermaidAstReflection();
      ArchitectureGrammarGrammar = /* @__PURE__ */ __name2(() => loadedArchitectureGrammarGrammar ?? (loadedArchitectureGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"ArchitectureGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"LeftPort","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"RightPort","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Arrow","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@18"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@19"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[(?:\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'|[\\\\w ]+)\\\\]/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}`)), "ArchitectureGrammarGrammar");
      GitGraphGrammarGrammar = /* @__PURE__ */ __name2(() => loadedGitGraphGrammarGrammar ?? (loadedGitGraphGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"GitGraphGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@14"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"REFERENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}`)), "GitGraphGrammarGrammar");
      InfoGrammarGrammar = /* @__PURE__ */ __name2(() => loadedInfoGrammarGrammar ?? (loadedInfoGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"InfoGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"?"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@7"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)), "InfoGrammarGrammar");
      PacketGrammarGrammar = /* @__PURE__ */ __name2(() => loadedPacketGrammarGrammar ?? (loadedPacketGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"PacketGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"packet"},{"$type":"Keyword","value":"packet-beta"}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"+"},{"$type":"Assignment","feature":"bits","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@9"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)), "PacketGrammarGrammar");
      PieGrammarGrammar = /* @__PURE__ */ __name2(() => loadedPieGrammarGrammar ?? (loadedPieGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"PieGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"FLOAT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?(0|[1-9][0-9]*)(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@2"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@3"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)), "PieGrammarGrammar");
      RadarGrammarGrammar = /* @__PURE__ */ __name2(() => loadedRadarGrammarGrammar ?? (loadedRadarGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"RadarGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":"radar-beta:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Label","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Axis","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Curve","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":"}"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Entries","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Option","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"showLegend"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"ticks"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"max"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"min"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"graticule"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"GRATICULE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"circle"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"polygon"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@16"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@2"}},"isMulti":false}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"types":[]}`)), "RadarGrammarGrammar");
      TreemapGrammarGrammar = /* @__PURE__ */ __name2(() => loadedTreemapGrammarGrammar ?? (loadedTreemapGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"TreemapGrammar","rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"Treemap","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"TreemapRows","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"TREEMAP_KEYWORD","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap-beta"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"CLASS_DEF","definition":{"$type":"RegexToken","regex":"/classDef\\\\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\\\\s+([^;\\\\r\\\\n]*))?(?:;)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STYLE_SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":::"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"COMMA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":","},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreemapRow","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"item","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"ClassDef","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Item","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Section","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Leaf","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ID2","definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9_]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER2","definition":{"$type":"RegexToken","regex":"/[0-9_\\\\.\\\\,]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"MyNumber","dataType":"number","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"Item","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"classSelector","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Section","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[]},{"$type":"Interface","name":"Leaf","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}]},{"$type":"Interface","name":"ClassDefStatement","attributes":[{"$type":"TypeAttribute","name":"className","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"styleText","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"Treemap","attributes":[{"$type":"TypeAttribute","name":"TreemapRows","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@15"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * Treemap grammar for Langium\\n * Converted from mindmap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treemap declaration.\\n */"}`)), "TreemapGrammarGrammar");
      TreeViewGrammarGrammar = /* @__PURE__ */ __name2(() => loadedTreeViewGrammarGrammar ?? (loadedTreeViewGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"TreeViewGrammar","rules":[{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"TreeView","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"treeView-beta"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"nodes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreeNode","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"TreeView","attributes":[{"$type":"TypeAttribute","name":"nodes","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@9"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * TreeView grammar for Langium\\n * Converted from treemap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treeView declaration.\\n */"}`)), "TreeViewGrammarGrammar");
      WardleyGrammarGrammar = /* @__PURE__ */ __name2(() => loadedWardleyGrammarGrammar ?? (loadedWardleyGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"WardleyGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Wardley","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@42"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"size","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"anchors","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"links","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"evolves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"pipelines","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"notes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"annotations","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Assignment","feature":"annotation","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Assignment","feature":"deaccelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Size","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"width","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"height","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolution","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EvolutionStage","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"@"},{"$type":"Assignment","feature":"boundary","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}}],"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"/"},{"$type":"Assignment","feature":"secondName","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Anchor","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Component","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"decorator","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Keyword","value":")"}]}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Label","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"negX","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetX","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"negY","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetY","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Decorator","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"strategy","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Link","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"fromPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"arrow","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]},"cardinality":"?"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"toPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"linkLabel","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolve","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]},{"$type":"Assignment","feature":"component","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Pipeline","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@33"},"arguments":[]},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"+"},{"$type":"Keyword","value":"}"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PipelineComponent","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Note","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@34"},"arguments":[]},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotations","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotation","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@36"},"arguments":[]},{"$type":"Assignment","feature":"number","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CoordinateValue","dataType":"number","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Accelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Deaccelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@38"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"WARDLEY_NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"->"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_PORT","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<>"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+>"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_ARROW","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"-->"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"-.->"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":">"},"parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+'[^']*'<>/","parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+'[^']*'</","parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+'[^']*'>/","parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_LABEL","definition":{"$type":"RegexToken","regex":"/;[^\\\\n\\\\r]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRATEGY","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"build"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"buy"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"outsource"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"market"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_WARDLEY","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"wardley-beta"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_SIZE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"size"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLUTION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolution"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANCHOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"anchor"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_COMPONENT","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"component"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_LABEL","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"label"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_INERTIA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"inertia"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLVE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolve"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_PIPELINE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"pipeline"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_NOTE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"note"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATIONS","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotations"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotation"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"accelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_DEACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"deaccelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NAME_WITH_SPACES","definition":{"$type":"RegexToken","regex":"/(?!title\\\\s|accTitle|accDescr)[A-Za-z][A-Za-z0-9_()&]*(?:[ \\\\t]+[A-Za-z(][A-Za-z0-9_()&]*)*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@47"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@48"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)), "WardleyGrammarGrammar");
      ArchitectureGrammarLanguageMetaData = {
        languageId: "architecture",
        fileExtensions: [".mmd", ".mermaid"],
        caseInsensitive: false,
        mode: "production"
      };
      GitGraphGrammarLanguageMetaData = {
        languageId: "gitGraph",
        fileExtensions: [".mmd", ".mermaid"],
        caseInsensitive: false,
        mode: "production"
      };
      InfoGrammarLanguageMetaData = {
        languageId: "info",
        fileExtensions: [".mmd", ".mermaid"],
        caseInsensitive: false,
        mode: "production"
      };
      PacketGrammarLanguageMetaData = {
        languageId: "packet",
        fileExtensions: [".mmd", ".mermaid"],
        caseInsensitive: false,
        mode: "production"
      };
      PieGrammarLanguageMetaData = {
        languageId: "pie",
        fileExtensions: [".mmd", ".mermaid"],
        caseInsensitive: false,
        mode: "production"
      };
      RadarGrammarLanguageMetaData = {
        languageId: "radar",
        fileExtensions: [".mmd", ".mermaid"],
        caseInsensitive: false,
        mode: "production"
      };
      TreemapGrammarLanguageMetaData = {
        languageId: "treemap",
        fileExtensions: [".mmd", ".mermaid"],
        caseInsensitive: false,
        mode: "production"
      };
      TreeViewGrammarLanguageMetaData = {
        languageId: "treeView",
        fileExtensions: [".mmd", ".mermaid"],
        caseInsensitive: false,
        mode: "production"
      };
      WardleyGrammarLanguageMetaData = {
        languageId: "wardley",
        fileExtensions: [".mmd", ".mermaid"],
        caseInsensitive: false,
        mode: "production"
      };
      MermaidGeneratedSharedModule = {
        AstReflection: /* @__PURE__ */ __name2(() => new MermaidAstReflection(), "AstReflection")
      };
      ArchitectureGrammarGeneratedModule = {
        Grammar: /* @__PURE__ */ __name2(() => ArchitectureGrammarGrammar(), "Grammar"),
        LanguageMetaData: /* @__PURE__ */ __name2(() => ArchitectureGrammarLanguageMetaData, "LanguageMetaData"),
        parser: {}
      };
      GitGraphGrammarGeneratedModule = {
        Grammar: /* @__PURE__ */ __name2(() => GitGraphGrammarGrammar(), "Grammar"),
        LanguageMetaData: /* @__PURE__ */ __name2(() => GitGraphGrammarLanguageMetaData, "LanguageMetaData"),
        parser: {}
      };
      InfoGrammarGeneratedModule = {
        Grammar: /* @__PURE__ */ __name2(() => InfoGrammarGrammar(), "Grammar"),
        LanguageMetaData: /* @__PURE__ */ __name2(() => InfoGrammarLanguageMetaData, "LanguageMetaData"),
        parser: {}
      };
      PacketGrammarGeneratedModule = {
        Grammar: /* @__PURE__ */ __name2(() => PacketGrammarGrammar(), "Grammar"),
        LanguageMetaData: /* @__PURE__ */ __name2(() => PacketGrammarLanguageMetaData, "LanguageMetaData"),
        parser: {}
      };
      PieGrammarGeneratedModule = {
        Grammar: /* @__PURE__ */ __name2(() => PieGrammarGrammar(), "Grammar"),
        LanguageMetaData: /* @__PURE__ */ __name2(() => PieGrammarLanguageMetaData, "LanguageMetaData"),
        parser: {}
      };
      RadarGrammarGeneratedModule = {
        Grammar: /* @__PURE__ */ __name2(() => RadarGrammarGrammar(), "Grammar"),
        LanguageMetaData: /* @__PURE__ */ __name2(() => RadarGrammarLanguageMetaData, "LanguageMetaData"),
        parser: {}
      };
      TreemapGrammarGeneratedModule = {
        Grammar: /* @__PURE__ */ __name2(() => TreemapGrammarGrammar(), "Grammar"),
        LanguageMetaData: /* @__PURE__ */ __name2(() => TreemapGrammarLanguageMetaData, "LanguageMetaData"),
        parser: {}
      };
      TreeViewGrammarGeneratedModule = {
        Grammar: /* @__PURE__ */ __name2(() => TreeViewGrammarGrammar(), "Grammar"),
        LanguageMetaData: /* @__PURE__ */ __name2(() => TreeViewGrammarLanguageMetaData, "LanguageMetaData"),
        parser: {}
      };
      WardleyGrammarGeneratedModule = {
        Grammar: /* @__PURE__ */ __name2(() => WardleyGrammarGrammar(), "Grammar"),
        LanguageMetaData: /* @__PURE__ */ __name2(() => WardleyGrammarLanguageMetaData, "LanguageMetaData"),
        parser: {}
      };
      accessibilityDescrRegex = /accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/;
      accessibilityTitleRegex = /accTitle[\t ]*:([^\n\r]*)/;
      titleRegex = /title([\t ][^\n\r]*|)/;
      rulesRegexes = {
        ACC_DESCR: accessibilityDescrRegex,
        ACC_TITLE: accessibilityTitleRegex,
        TITLE: titleRegex
      };
      AbstractMermaidValueConverter = class extends DefaultValueConverter {
        static {
          __name(this, "AbstractMermaidValueConverter");
        }
        static {
          __name2(this, "AbstractMermaidValueConverter");
        }
        runConverter(rule, input, cstNode) {
          let value2 = this.runCommonConverter(rule, input, cstNode);
          if (value2 === void 0) {
            value2 = this.runCustomConverter(rule, input, cstNode);
          }
          if (value2 === void 0) {
            return super.runConverter(rule, input, cstNode);
          }
          return value2;
        }
        runCommonConverter(rule, input, _cstNode) {
          const regex2 = rulesRegexes[rule.name];
          if (regex2 === void 0) {
            return void 0;
          }
          const match2 = regex2.exec(input);
          if (match2 === null) {
            return void 0;
          }
          if (match2[1] !== void 0) {
            return match2[1].trim().replace(/[\t ]{2,}/gm, " ");
          }
          if (match2[2] !== void 0) {
            return match2[2].replace(/^\s*/gm, "").replace(/\s+$/gm, "").replace(/[\t ]{2,}/gm, " ").replace(/[\n\r]{2,}/gm, "\n");
          }
          return void 0;
        }
      };
      CommonValueConverter = class extends AbstractMermaidValueConverter {
        static {
          __name(this, "CommonValueConverter");
        }
        static {
          __name2(this, "CommonValueConverter");
        }
        runCustomConverter(_rule, _input, _cstNode) {
          return void 0;
        }
      };
      AbstractMermaidTokenBuilder = class extends DefaultTokenBuilder {
        static {
          __name(this, "AbstractMermaidTokenBuilder");
        }
        static {
          __name2(this, "AbstractMermaidTokenBuilder");
        }
        constructor(keywords) {
          super();
          this.keywords = new Set(keywords);
        }
        buildKeywordTokens(rules, terminalTokens, options2) {
          const tokenTypes = super.buildKeywordTokens(rules, terminalTokens, options2);
          tokenTypes.forEach((tokenType) => {
            if (this.keywords.has(tokenType.name) && tokenType.PATTERN !== void 0) {
              tokenType.PATTERN = new RegExp(tokenType.PATTERN.toString() + "(?:(?=%%)|(?!\\S))");
            }
          });
          return tokenTypes;
        }
      };
      CommonTokenBuilder = class extends AbstractMermaidTokenBuilder {
        static {
          __name(this, "CommonTokenBuilder");
        }
        static {
          __name2(this, "CommonTokenBuilder");
        }
      };
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/chunk-LIHQZDEY.mjs
  function registerValidationChecks(services) {
    const validator = services.validation.TreemapValidator;
    const registry = services.validation.ValidationRegistry;
    if (registry) {
      const checks = {
        Treemap: validator.checkSingleRoot.bind(validator)
        // Remove unused validation for TreemapRow
      };
      registry.register(checks, validator);
    }
  }
  function createTreemapServices(context = EmptyFileSystem) {
    const shared = inject(
      createDefaultSharedCoreModule(context),
      MermaidGeneratedSharedModule
    );
    const Treemap2 = inject(
      createDefaultCoreModule({ shared }),
      TreemapGrammarGeneratedModule,
      TreemapModule
    );
    shared.ServiceRegistry.register(Treemap2);
    registerValidationChecks(Treemap2);
    return { shared, Treemap: Treemap2 };
  }
  var TreemapTokenBuilder, classDefRegex, TreemapValueConverter, TreemapValidator, TreemapModule;
  var init_chunk_LIHQZDEY = __esm({
    "../parser/dist/chunks/mermaid-parser.core/chunk-LIHQZDEY.mjs"() {
      "use strict";
      init_chunk_K5T4RW27();
      init_lib3();
      TreemapTokenBuilder = class extends AbstractMermaidTokenBuilder {
        static {
          __name(this, "TreemapTokenBuilder");
        }
        static {
          __name2(this, "TreemapTokenBuilder");
        }
        constructor() {
          super(["treemap"]);
        }
      };
      classDefRegex = /classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/;
      TreemapValueConverter = class extends AbstractMermaidValueConverter {
        static {
          __name(this, "TreemapValueConverter");
        }
        static {
          __name2(this, "TreemapValueConverter");
        }
        runCustomConverter(rule, input, _cstNode) {
          if (rule.name === "NUMBER2") {
            return parseFloat(input.replace(/,/g, ""));
          } else if (rule.name === "SEPARATOR") {
            return input.substring(1, input.length - 1);
          } else if (rule.name === "STRING2") {
            return input.substring(1, input.length - 1);
          } else if (rule.name === "INDENTATION") {
            return input.length;
          } else if (rule.name === "ClassDef") {
            if (typeof input !== "string") {
              return input;
            }
            const match2 = classDefRegex.exec(input);
            if (match2) {
              return {
                $type: "ClassDefStatement",
                className: match2[1],
                styleText: match2[2] || void 0
              };
            }
          }
          return void 0;
        }
      };
      __name(registerValidationChecks, "registerValidationChecks");
      __name2(registerValidationChecks, "registerValidationChecks");
      TreemapValidator = class {
        static {
          __name(this, "TreemapValidator");
        }
        static {
          __name2(this, "TreemapValidator");
        }
        /**
         * Validates that a treemap has only one root node.
         * A root node is defined as a node that has no indentation.
         */
        checkSingleRoot(doc, accept) {
          let rootNodeIndentation;
          for (const row of doc.TreemapRows) {
            if (!row.item) {
              continue;
            }
            if (rootNodeIndentation === void 0 && // Check if this is a root node (no indentation)
            row.indent === void 0) {
              rootNodeIndentation = 0;
            } else if (row.indent === void 0) {
              accept("error", "Multiple root nodes are not allowed in a treemap.", {
                node: row,
                property: "item"
              });
            } else if (rootNodeIndentation !== void 0 && rootNodeIndentation >= parseInt(row.indent, 10)) {
              accept("error", "Multiple root nodes are not allowed in a treemap.", {
                node: row,
                property: "item"
              });
            }
          }
        }
      };
      TreemapModule = {
        parser: {
          TokenBuilder: /* @__PURE__ */ __name2(() => new TreemapTokenBuilder(), "TokenBuilder"),
          ValueConverter: /* @__PURE__ */ __name2(() => new TreemapValueConverter(), "ValueConverter")
        },
        validation: {
          TreemapValidator: /* @__PURE__ */ __name2(() => new TreemapValidator(), "TreemapValidator")
        }
      };
      __name(createTreemapServices, "createTreemapServices");
      __name2(createTreemapServices, "createTreemapServices");
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/chunk-CIAEETIT.mjs
  function createWardleyServices(context = EmptyFileSystem) {
    const shared = inject(
      createDefaultSharedCoreModule(context),
      MermaidGeneratedSharedModule
    );
    const Wardley2 = inject(
      createDefaultCoreModule({ shared }),
      WardleyGrammarGeneratedModule,
      WardleyModule
    );
    shared.ServiceRegistry.register(Wardley2);
    return { shared, Wardley: Wardley2 };
  }
  var WardleyValueConverter, WardleyModule;
  var init_chunk_CIAEETIT = __esm({
    "../parser/dist/chunks/mermaid-parser.core/chunk-CIAEETIT.mjs"() {
      "use strict";
      init_chunk_K5T4RW27();
      init_lib3();
      WardleyValueConverter = class extends AbstractMermaidValueConverter {
        static {
          __name(this, "WardleyValueConverter");
        }
        static {
          __name2(this, "WardleyValueConverter");
        }
        runCustomConverter(rule, input, _cstNode) {
          switch (rule.name.toUpperCase()) {
            case "LINK_LABEL":
              return input.substring(1).trim();
            default:
              return void 0;
          }
        }
      };
      WardleyModule = {
        parser: {
          ValueConverter: /* @__PURE__ */ __name2(() => new WardleyValueConverter(), "ValueConverter")
        }
      };
      __name(createWardleyServices, "createWardleyServices");
      __name2(createWardleyServices, "createWardleyServices");
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/chunk-67CJDMHE.mjs
  function createGitGraphServices(context = EmptyFileSystem) {
    const shared = inject(
      createDefaultSharedCoreModule(context),
      MermaidGeneratedSharedModule
    );
    const GitGraph2 = inject(
      createDefaultCoreModule({ shared }),
      GitGraphGrammarGeneratedModule,
      GitGraphModule
    );
    shared.ServiceRegistry.register(GitGraph2);
    return { shared, GitGraph: GitGraph2 };
  }
  var GitGraphTokenBuilder, GitGraphModule;
  var init_chunk_67CJDMHE = __esm({
    "../parser/dist/chunks/mermaid-parser.core/chunk-67CJDMHE.mjs"() {
      "use strict";
      init_chunk_K5T4RW27();
      init_lib3();
      GitGraphTokenBuilder = class extends AbstractMermaidTokenBuilder {
        static {
          __name(this, "GitGraphTokenBuilder");
        }
        static {
          __name2(this, "GitGraphTokenBuilder");
        }
        constructor() {
          super(["gitGraph"]);
        }
      };
      GitGraphModule = {
        parser: {
          TokenBuilder: /* @__PURE__ */ __name2(() => new GitGraphTokenBuilder(), "TokenBuilder"),
          ValueConverter: /* @__PURE__ */ __name2(() => new CommonValueConverter(), "ValueConverter")
        }
      };
      __name(createGitGraphServices, "createGitGraphServices");
      __name2(createGitGraphServices, "createGitGraphServices");
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/chunk-KGLVRYIC.mjs
  function createInfoServices(context = EmptyFileSystem) {
    const shared = inject(
      createDefaultSharedCoreModule(context),
      MermaidGeneratedSharedModule
    );
    const Info2 = inject(
      createDefaultCoreModule({ shared }),
      InfoGrammarGeneratedModule,
      InfoModule
    );
    shared.ServiceRegistry.register(Info2);
    return { shared, Info: Info2 };
  }
  var InfoTokenBuilder, InfoModule;
  var init_chunk_KGLVRYIC = __esm({
    "../parser/dist/chunks/mermaid-parser.core/chunk-KGLVRYIC.mjs"() {
      "use strict";
      init_chunk_K5T4RW27();
      init_lib3();
      InfoTokenBuilder = class extends AbstractMermaidTokenBuilder {
        static {
          __name(this, "InfoTokenBuilder");
        }
        static {
          __name2(this, "InfoTokenBuilder");
        }
        constructor() {
          super(["info", "showInfo"]);
        }
      };
      InfoModule = {
        parser: {
          TokenBuilder: /* @__PURE__ */ __name2(() => new InfoTokenBuilder(), "TokenBuilder"),
          ValueConverter: /* @__PURE__ */ __name2(() => new CommonValueConverter(), "ValueConverter")
        }
      };
      __name(createInfoServices, "createInfoServices");
      __name2(createInfoServices, "createInfoServices");
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/chunk-FOC6F5B3.mjs
  function createPacketServices(context = EmptyFileSystem) {
    const shared = inject(
      createDefaultSharedCoreModule(context),
      MermaidGeneratedSharedModule
    );
    const Packet2 = inject(
      createDefaultCoreModule({ shared }),
      PacketGrammarGeneratedModule,
      PacketModule
    );
    shared.ServiceRegistry.register(Packet2);
    return { shared, Packet: Packet2 };
  }
  var PacketTokenBuilder, PacketModule;
  var init_chunk_FOC6F5B3 = __esm({
    "../parser/dist/chunks/mermaid-parser.core/chunk-FOC6F5B3.mjs"() {
      "use strict";
      init_chunk_K5T4RW27();
      init_lib3();
      PacketTokenBuilder = class extends AbstractMermaidTokenBuilder {
        static {
          __name(this, "PacketTokenBuilder");
        }
        static {
          __name2(this, "PacketTokenBuilder");
        }
        constructor() {
          super(["packet"]);
        }
      };
      PacketModule = {
        parser: {
          TokenBuilder: /* @__PURE__ */ __name2(() => new PacketTokenBuilder(), "TokenBuilder"),
          ValueConverter: /* @__PURE__ */ __name2(() => new CommonValueConverter(), "ValueConverter")
        }
      };
      __name(createPacketServices, "createPacketServices");
      __name2(createPacketServices, "createPacketServices");
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/chunk-AA7GKIK3.mjs
  function createPieServices(context = EmptyFileSystem) {
    const shared = inject(
      createDefaultSharedCoreModule(context),
      MermaidGeneratedSharedModule
    );
    const Pie2 = inject(
      createDefaultCoreModule({ shared }),
      PieGrammarGeneratedModule,
      PieModule
    );
    shared.ServiceRegistry.register(Pie2);
    return { shared, Pie: Pie2 };
  }
  var PieTokenBuilder, PieValueConverter, PieModule;
  var init_chunk_AA7GKIK3 = __esm({
    "../parser/dist/chunks/mermaid-parser.core/chunk-AA7GKIK3.mjs"() {
      "use strict";
      init_chunk_K5T4RW27();
      init_lib3();
      PieTokenBuilder = class extends AbstractMermaidTokenBuilder {
        static {
          __name(this, "PieTokenBuilder");
        }
        static {
          __name2(this, "PieTokenBuilder");
        }
        constructor() {
          super(["pie", "showData"]);
        }
      };
      PieValueConverter = class extends AbstractMermaidValueConverter {
        static {
          __name(this, "PieValueConverter");
        }
        static {
          __name2(this, "PieValueConverter");
        }
        runCustomConverter(rule, input, _cstNode) {
          if (rule.name !== "PIE_SECTION_LABEL") {
            return void 0;
          }
          return input.replace(/"/g, "").trim();
        }
      };
      PieModule = {
        parser: {
          TokenBuilder: /* @__PURE__ */ __name2(() => new PieTokenBuilder(), "TokenBuilder"),
          ValueConverter: /* @__PURE__ */ __name2(() => new PieValueConverter(), "ValueConverter")
        }
      };
      __name(createPieServices, "createPieServices");
      __name2(createPieServices, "createPieServices");
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/chunk-ORNJ4GCN.mjs
  function createTreeViewServices(context = EmptyFileSystem) {
    const shared = inject(
      createDefaultSharedCoreModule(context),
      MermaidGeneratedSharedModule
    );
    const TreeView2 = inject(
      createDefaultCoreModule({ shared }),
      TreeViewGrammarGeneratedModule,
      TreeViewModule
    );
    shared.ServiceRegistry.register(TreeView2);
    return { shared, TreeView: TreeView2 };
  }
  var TreeViewValueConverter, TreeViewTokenBuilder, TreeViewModule;
  var init_chunk_ORNJ4GCN = __esm({
    "../parser/dist/chunks/mermaid-parser.core/chunk-ORNJ4GCN.mjs"() {
      "use strict";
      init_chunk_K5T4RW27();
      init_lib3();
      TreeViewValueConverter = class extends AbstractMermaidValueConverter {
        static {
          __name(this, "TreeViewValueConverter");
        }
        static {
          __name2(this, "TreeViewValueConverter");
        }
        runCustomConverter(rule, input, _cstNode) {
          if (rule.name === "INDENTATION") {
            return input?.length || 0;
          } else if (rule.name === "STRING2") {
            return input.substring(1, input.length - 1);
          }
          return void 0;
        }
      };
      TreeViewTokenBuilder = class extends AbstractMermaidTokenBuilder {
        static {
          __name(this, "TreeViewTokenBuilder");
        }
        static {
          __name2(this, "TreeViewTokenBuilder");
        }
        constructor() {
          super(["treeView-beta"]);
        }
      };
      TreeViewModule = {
        parser: {
          TokenBuilder: /* @__PURE__ */ __name2(() => new TreeViewTokenBuilder(), "TokenBuilder"),
          ValueConverter: /* @__PURE__ */ __name2(() => new TreeViewValueConverter(), "ValueConverter")
        }
      };
      __name(createTreeViewServices, "createTreeViewServices");
      __name2(createTreeViewServices, "createTreeViewServices");
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/chunk-7N4EOEYR.mjs
  function createArchitectureServices(context = EmptyFileSystem) {
    const shared = inject(
      createDefaultSharedCoreModule(context),
      MermaidGeneratedSharedModule
    );
    const Architecture2 = inject(
      createDefaultCoreModule({ shared }),
      ArchitectureGrammarGeneratedModule,
      ArchitectureModule
    );
    shared.ServiceRegistry.register(Architecture2);
    return { shared, Architecture: Architecture2 };
  }
  var ArchitectureTokenBuilder, ArchitectureValueConverter, ArchitectureModule;
  var init_chunk_7N4EOEYR = __esm({
    "../parser/dist/chunks/mermaid-parser.core/chunk-7N4EOEYR.mjs"() {
      "use strict";
      init_chunk_K5T4RW27();
      init_lib3();
      ArchitectureTokenBuilder = class extends AbstractMermaidTokenBuilder {
        static {
          __name(this, "ArchitectureTokenBuilder");
        }
        static {
          __name2(this, "ArchitectureTokenBuilder");
        }
        constructor() {
          super(["architecture"]);
        }
      };
      ArchitectureValueConverter = class extends AbstractMermaidValueConverter {
        static {
          __name(this, "ArchitectureValueConverter");
        }
        static {
          __name2(this, "ArchitectureValueConverter");
        }
        runCustomConverter(rule, input, _cstNode) {
          if (rule.name === "ARCH_ICON") {
            return input.replace(/[()]/g, "").trim();
          } else if (rule.name === "ARCH_TEXT_ICON") {
            return input.replace(/["()]/g, "");
          } else if (rule.name === "ARCH_TITLE") {
            let result = input.replace(/^\[|]$/g, "").trim();
            if (result.startsWith('"') && result.endsWith('"') || result.startsWith("'") && result.endsWith("'")) {
              result = result.slice(1, -1);
              result = result.replace(/\\"/g, '"').replace(/\\'/g, "'");
            }
            return result.trim();
          }
          return void 0;
        }
      };
      ArchitectureModule = {
        parser: {
          TokenBuilder: /* @__PURE__ */ __name2(() => new ArchitectureTokenBuilder(), "TokenBuilder"),
          ValueConverter: /* @__PURE__ */ __name2(() => new ArchitectureValueConverter(), "ValueConverter")
        }
      };
      __name(createArchitectureServices, "createArchitectureServices");
      __name2(createArchitectureServices, "createArchitectureServices");
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/chunk-2KRD3SAO.mjs
  function createRadarServices(context = EmptyFileSystem) {
    const shared = inject(
      createDefaultSharedCoreModule(context),
      MermaidGeneratedSharedModule
    );
    const Radar2 = inject(
      createDefaultCoreModule({ shared }),
      RadarGrammarGeneratedModule,
      RadarModule
    );
    shared.ServiceRegistry.register(Radar2);
    return { shared, Radar: Radar2 };
  }
  var RadarTokenBuilder, RadarModule;
  var init_chunk_2KRD3SAO = __esm({
    "../parser/dist/chunks/mermaid-parser.core/chunk-2KRD3SAO.mjs"() {
      "use strict";
      init_chunk_K5T4RW27();
      init_lib3();
      RadarTokenBuilder = class extends AbstractMermaidTokenBuilder {
        static {
          __name(this, "RadarTokenBuilder");
        }
        static {
          __name2(this, "RadarTokenBuilder");
        }
        constructor() {
          super(["radar-beta"]);
        }
      };
      RadarModule = {
        parser: {
          TokenBuilder: /* @__PURE__ */ __name2(() => new RadarTokenBuilder(), "TokenBuilder"),
          ValueConverter: /* @__PURE__ */ __name2(() => new CommonValueConverter(), "ValueConverter")
        }
      };
      __name(createRadarServices, "createRadarServices");
      __name2(createRadarServices, "createRadarServices");
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/info-OMHHGYJF.mjs
  var info_OMHHGYJF_exports = {};
  __export(info_OMHHGYJF_exports, {
    InfoModule: () => InfoModule,
    createInfoServices: () => createInfoServices
  });
  var init_info_OMHHGYJF = __esm({
    "../parser/dist/chunks/mermaid-parser.core/info-OMHHGYJF.mjs"() {
      "use strict";
      init_chunk_KGLVRYIC();
      init_chunk_K5T4RW27();
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/packet-4T2RLAQJ.mjs
  var packet_4T2RLAQJ_exports = {};
  __export(packet_4T2RLAQJ_exports, {
    PacketModule: () => PacketModule,
    createPacketServices: () => createPacketServices
  });
  var init_packet_4T2RLAQJ = __esm({
    "../parser/dist/chunks/mermaid-parser.core/packet-4T2RLAQJ.mjs"() {
      "use strict";
      init_chunk_FOC6F5B3();
      init_chunk_K5T4RW27();
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/pie-ZZUOXDRM.mjs
  var pie_ZZUOXDRM_exports = {};
  __export(pie_ZZUOXDRM_exports, {
    PieModule: () => PieModule,
    createPieServices: () => createPieServices
  });
  var init_pie_ZZUOXDRM = __esm({
    "../parser/dist/chunks/mermaid-parser.core/pie-ZZUOXDRM.mjs"() {
      "use strict";
      init_chunk_AA7GKIK3();
      init_chunk_K5T4RW27();
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/treeView-SZITEDCU.mjs
  var treeView_SZITEDCU_exports = {};
  __export(treeView_SZITEDCU_exports, {
    TreeViewModule: () => TreeViewModule,
    createTreeViewServices: () => createTreeViewServices
  });
  var init_treeView_SZITEDCU = __esm({
    "../parser/dist/chunks/mermaid-parser.core/treeView-SZITEDCU.mjs"() {
      "use strict";
      init_chunk_ORNJ4GCN();
      init_chunk_K5T4RW27();
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/architecture-YZFGNWBL.mjs
  var architecture_YZFGNWBL_exports = {};
  __export(architecture_YZFGNWBL_exports, {
    ArchitectureModule: () => ArchitectureModule,
    createArchitectureServices: () => createArchitectureServices
  });
  var init_architecture_YZFGNWBL = __esm({
    "../parser/dist/chunks/mermaid-parser.core/architecture-YZFGNWBL.mjs"() {
      "use strict";
      init_chunk_7N4EOEYR();
      init_chunk_K5T4RW27();
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/gitGraph-7Q5UKJZL.mjs
  var gitGraph_7Q5UKJZL_exports = {};
  __export(gitGraph_7Q5UKJZL_exports, {
    GitGraphModule: () => GitGraphModule,
    createGitGraphServices: () => createGitGraphServices
  });
  var init_gitGraph_7Q5UKJZL = __esm({
    "../parser/dist/chunks/mermaid-parser.core/gitGraph-7Q5UKJZL.mjs"() {
      "use strict";
      init_chunk_67CJDMHE();
      init_chunk_K5T4RW27();
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/radar-PYXPWWZC.mjs
  var radar_PYXPWWZC_exports = {};
  __export(radar_PYXPWWZC_exports, {
    RadarModule: () => RadarModule,
    createRadarServices: () => createRadarServices
  });
  var init_radar_PYXPWWZC = __esm({
    "../parser/dist/chunks/mermaid-parser.core/radar-PYXPWWZC.mjs"() {
      "use strict";
      init_chunk_2KRD3SAO();
      init_chunk_K5T4RW27();
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/treemap-W4RFUUIX.mjs
  var treemap_W4RFUUIX_exports = {};
  __export(treemap_W4RFUUIX_exports, {
    TreemapModule: () => TreemapModule,
    createTreemapServices: () => createTreemapServices
  });
  var init_treemap_W4RFUUIX = __esm({
    "../parser/dist/chunks/mermaid-parser.core/treemap-W4RFUUIX.mjs"() {
      "use strict";
      init_chunk_LIHQZDEY();
      init_chunk_K5T4RW27();
    }
  });

  // ../parser/dist/chunks/mermaid-parser.core/wardley-RL74JXVD.mjs
  var wardley_RL74JXVD_exports = {};
  __export(wardley_RL74JXVD_exports, {
    WardleyModule: () => WardleyModule,
    createWardleyServices: () => createWardleyServices
  });
  var init_wardley_RL74JXVD = __esm({
    "../parser/dist/chunks/mermaid-parser.core/wardley-RL74JXVD.mjs"() {
      "use strict";
      init_chunk_CIAEETIT();
      init_chunk_K5T4RW27();
    }
  });

  // ../parser/dist/mermaid-parser.core.mjs
  async function parse3(diagramType, text4) {
    const initializer = initializers[diagramType];
    if (!initializer) {
      throw new Error(`Unknown diagram type: ${diagramType}`);
    }
    if (!parsers[diagramType]) {
      await initializer();
    }
    const parser28 = parsers[diagramType];
    const result = parser28.parse(text4);
    if (result.lexerErrors.length > 0 || result.parserErrors.length > 0) {
      throw new MermaidParseError(result);
    }
    return result.value;
  }
  var parsers, initializers, MermaidParseError;
  var init_mermaid_parser_core = __esm({
    "../parser/dist/mermaid-parser.core.mjs"() {
      "use strict";
      init_chunk_LIHQZDEY();
      init_chunk_CIAEETIT();
      init_chunk_67CJDMHE();
      init_chunk_KGLVRYIC();
      init_chunk_FOC6F5B3();
      init_chunk_AA7GKIK3();
      init_chunk_ORNJ4GCN();
      init_chunk_7N4EOEYR();
      init_chunk_2KRD3SAO();
      init_chunk_K5T4RW27();
      parsers = {};
      initializers = {
        info: /* @__PURE__ */ __name2(async () => {
          const { createInfoServices: createInfoServices2 } = await Promise.resolve().then(() => (init_info_OMHHGYJF(), info_OMHHGYJF_exports));
          const parser28 = createInfoServices2().Info.parser.LangiumParser;
          parsers.info = parser28;
        }, "info"),
        packet: /* @__PURE__ */ __name2(async () => {
          const { createPacketServices: createPacketServices2 } = await Promise.resolve().then(() => (init_packet_4T2RLAQJ(), packet_4T2RLAQJ_exports));
          const parser28 = createPacketServices2().Packet.parser.LangiumParser;
          parsers.packet = parser28;
        }, "packet"),
        pie: /* @__PURE__ */ __name2(async () => {
          const { createPieServices: createPieServices2 } = await Promise.resolve().then(() => (init_pie_ZZUOXDRM(), pie_ZZUOXDRM_exports));
          const parser28 = createPieServices2().Pie.parser.LangiumParser;
          parsers.pie = parser28;
        }, "pie"),
        treeView: /* @__PURE__ */ __name2(async () => {
          const { createTreeViewServices: createTreeViewServices2 } = await Promise.resolve().then(() => (init_treeView_SZITEDCU(), treeView_SZITEDCU_exports));
          const parser28 = createTreeViewServices2().TreeView.parser.LangiumParser;
          parsers.treeView = parser28;
        }, "treeView"),
        architecture: /* @__PURE__ */ __name2(async () => {
          const { createArchitectureServices: createArchitectureServices2 } = await Promise.resolve().then(() => (init_architecture_YZFGNWBL(), architecture_YZFGNWBL_exports));
          const parser28 = createArchitectureServices2().Architecture.parser.LangiumParser;
          parsers.architecture = parser28;
        }, "architecture"),
        gitGraph: /* @__PURE__ */ __name2(async () => {
          const { createGitGraphServices: createGitGraphServices2 } = await Promise.resolve().then(() => (init_gitGraph_7Q5UKJZL(), gitGraph_7Q5UKJZL_exports));
          const parser28 = createGitGraphServices2().GitGraph.parser.LangiumParser;
          parsers.gitGraph = parser28;
        }, "gitGraph"),
        radar: /* @__PURE__ */ __name2(async () => {
          const { createRadarServices: createRadarServices2 } = await Promise.resolve().then(() => (init_radar_PYXPWWZC(), radar_PYXPWWZC_exports));
          const parser28 = createRadarServices2().Radar.parser.LangiumParser;
          parsers.radar = parser28;
        }, "radar"),
        treemap: /* @__PURE__ */ __name2(async () => {
          const { createTreemapServices: createTreemapServices2 } = await Promise.resolve().then(() => (init_treemap_W4RFUUIX(), treemap_W4RFUUIX_exports));
          const parser28 = createTreemapServices2().Treemap.parser.LangiumParser;
          parsers.treemap = parser28;
        }, "treemap"),
        wardley: /* @__PURE__ */ __name2(async () => {
          const { createWardleyServices: createWardleyServices2 } = await Promise.resolve().then(() => (init_wardley_RL74JXVD(), wardley_RL74JXVD_exports));
          const parser28 = createWardleyServices2().Wardley.parser.LangiumParser;
          parsers.wardley = parser28;
        }, "wardley")
      };
      __name(parse3, "parse");
      __name2(parse3, "parse");
      MermaidParseError = class extends Error {
        static {
          __name(this, "MermaidParseError");
        }
        constructor(result) {
          const lexerErrors = result.lexerErrors.map((err) => {
            const line2 = err.line !== void 0 && !isNaN(err.line) ? err.line : "?";
            const column2 = err.column !== void 0 && !isNaN(err.column) ? err.column : "?";
            return `Lexer error on line ${line2}, column ${column2}: ${err.message}`;
          }).join("\n");
          const parserErrors = result.parserErrors.map((err) => {
            const line2 = err.token.startLine !== void 0 && !isNaN(err.token.startLine) ? err.token.startLine : "?";
            const column2 = err.token.startColumn !== void 0 && !isNaN(err.token.startColumn) ? err.token.startColumn : "?";
            return `Parse error on line ${line2}, column ${column2}: ${err.message}`;
          }).join("\n");
          super(`Parsing failed: ${lexerErrors} ${parserErrors}`);
          this.result = result;
        }
        static {
          __name2(this, "MermaidParseError");
        }
      };
    }
  });

  // src/diagrams/common/populateCommonDb.ts
  function populateCommonDb(ast, db9) {
    if (ast.accDescr) {
      db9.setAccDescription?.(ast.accDescr);
    }
    if (ast.accTitle) {
      db9.setAccTitle?.(ast.accTitle);
    }
    if (ast.title) {
      db9.setDiagramTitle?.(ast.title);
    }
  }
  var init_populateCommonDb = __esm({
    "src/diagrams/common/populateCommonDb.ts"() {
      "use strict";
      __name(populateCommonDb, "populateCommonDb");
    }
  });

  // src/diagrams/git/gitGraphTypes.ts
  var commitType;
  var init_gitGraphTypes = __esm({
    "src/diagrams/git/gitGraphTypes.ts"() {
      "use strict";
      commitType = {
        NORMAL: 0,
        REVERSE: 1,
        HIGHLIGHT: 2,
        MERGE: 3,
        CHERRY_PICK: 4
      };
    }
  });

  // src/utils/imperativeState.ts
  var ImperativeState;
  var init_imperativeState = __esm({
    "src/utils/imperativeState.ts"() {
      "use strict";
      ImperativeState = class {
        /**
         * @param init - Function that creates the default state.
         */
        constructor(init3) {
          this.init = init3;
          this.records = this.init();
        }
        static {
          __name(this, "ImperativeState");
        }
        reset() {
          this.records = this.init();
        }
      };
    }
  });

  // src/diagrams/git/gitGraphAst.ts
  function getID() {
    return random({ length: 7 });
  }
  function uniqBy2(list, fn3) {
    const recordMap = /* @__PURE__ */ Object.create(null);
    return list.reduce((out, item) => {
      const key = fn3(item);
      if (!recordMap[key]) {
        recordMap[key] = true;
        out.push(item);
      }
      return out;
    }, []);
  }
  function upsert(arr, key, newVal) {
    const index = arr.indexOf(key);
    if (index === -1) {
      arr.push(newVal);
    } else {
      arr.splice(index, 1, newVal);
    }
  }
  function prettyPrintCommitHistory(commitArr) {
    const commit2 = commitArr.reduce((out, commit3) => {
      if (out.seq > commit3.seq) {
        return out;
      }
      return commit3;
    }, commitArr[0]);
    let line2 = "";
    commitArr.forEach(function(c3) {
      if (c3 === commit2) {
        line2 += "	*";
      } else {
        line2 += "	|";
      }
    });
    const label = [line2, commit2.id, commit2.seq];
    for (const branch2 in state2.records.branches) {
      if (state2.records.branches.get(branch2) === commit2.id) {
        label.push(branch2);
      }
    }
    log.debug(label.join(" "));
    if (commit2.parents && commit2.parents.length == 2 && commit2.parents[0] && commit2.parents[1]) {
      const newCommit = state2.records.commits.get(commit2.parents[0]);
      upsert(commitArr, commit2, newCommit);
      if (commit2.parents[1]) {
        commitArr.push(state2.records.commits.get(commit2.parents[1]));
      }
    } else if (commit2.parents.length == 0) {
      return;
    } else {
      if (commit2.parents[0]) {
        const newCommit = state2.records.commits.get(commit2.parents[0]);
        upsert(commitArr, commit2, newCommit);
      }
    }
    commitArr = uniqBy2(commitArr, (c3) => c3.id);
    prettyPrintCommitHistory(commitArr);
  }
  var DEFAULT_GITGRAPH_CONFIG, getConfig3, state2, setDirection, setOptions6, getOptions, commit, branch, merge4, cherryPick, checkout, prettyPrint, clear7, getBranchesAsObjArray, getBranches, getCommits, getCommitsArray, getCurrentBranch, getDirection, getHead, db;
  var init_gitGraphAst = __esm({
    "src/diagrams/git/gitGraphAst.ts"() {
      "use strict";
      init_logger();
      init_utils2();
      init_config();
      init_common();
      init_commonDb();
      init_gitGraphTypes();
      init_imperativeState();
      init_defaultConfig();
      DEFAULT_GITGRAPH_CONFIG = defaultConfig_default.gitGraph;
      getConfig3 = /* @__PURE__ */ __name(() => {
        const config5 = cleanAndMerge({
          ...DEFAULT_GITGRAPH_CONFIG,
          ...getConfig().gitGraph
        });
        return config5;
      }, "getConfig");
      state2 = new ImperativeState(() => {
        const config5 = getConfig3();
        const mainBranchName = config5.mainBranchName;
        const mainBranchOrder = config5.mainBranchOrder;
        return {
          mainBranchName,
          commits: /* @__PURE__ */ new Map(),
          head: null,
          branchConfig: /* @__PURE__ */ new Map([[mainBranchName, { name: mainBranchName, order: mainBranchOrder }]]),
          branches: /* @__PURE__ */ new Map([[mainBranchName, null]]),
          currBranch: mainBranchName,
          direction: "LR",
          seq: 0,
          options: {}
        };
      });
      __name(getID, "getID");
      __name(uniqBy2, "uniqBy");
      setDirection = /* @__PURE__ */ __name(function(dir2) {
        state2.records.direction = dir2;
      }, "setDirection");
      setOptions6 = /* @__PURE__ */ __name(function(rawOptString) {
        log.debug("options str", rawOptString);
        rawOptString = rawOptString?.trim();
        rawOptString = rawOptString || "{}";
        try {
          state2.records.options = JSON.parse(rawOptString);
        } catch (e3) {
          log.error("error while parsing gitGraph options", e3.message);
        }
      }, "setOptions");
      getOptions = /* @__PURE__ */ __name(function() {
        return state2.records.options;
      }, "getOptions");
      commit = /* @__PURE__ */ __name(function(commitDB) {
        let msg = commitDB.msg;
        let id34 = commitDB.id;
        const type3 = commitDB.type;
        let tags2 = commitDB.tags;
        log.info("commit", msg, id34, type3, tags2);
        log.debug("Entering commit:", msg, id34, type3, tags2);
        const config5 = getConfig3();
        id34 = common_default.sanitizeText(id34, config5);
        msg = common_default.sanitizeText(msg, config5);
        tags2 = tags2?.map((tag) => common_default.sanitizeText(tag, config5));
        const newCommit = {
          id: id34 ? id34 : state2.records.seq + "-" + getID(),
          message: msg,
          seq: state2.records.seq++,
          type: type3 ?? commitType.NORMAL,
          tags: tags2 ?? [],
          parents: state2.records.head == null ? [] : [state2.records.head.id],
          branch: state2.records.currBranch
        };
        state2.records.head = newCommit;
        log.info("main branch", config5.mainBranchName);
        if (state2.records.commits.has(newCommit.id)) {
          log.warn(`Commit ID ${newCommit.id} already exists`);
        }
        state2.records.commits.set(newCommit.id, newCommit);
        state2.records.branches.set(state2.records.currBranch, newCommit.id);
        log.debug("in pushCommit " + newCommit.id);
      }, "commit");
      branch = /* @__PURE__ */ __name(function(branchDB) {
        let name = branchDB.name;
        const order2 = branchDB.order;
        name = common_default.sanitizeText(name, getConfig3());
        if (state2.records.branches.has(name)) {
          throw new Error(
            `Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${name}")`
          );
        }
        state2.records.branches.set(name, state2.records.head != null ? state2.records.head.id : null);
        state2.records.branchConfig.set(name, { name, order: order2 });
        checkout(name);
        log.debug("in createBranch");
      }, "branch");
      merge4 = /* @__PURE__ */ __name((mergeDB) => {
        let otherBranch = mergeDB.branch;
        let customId = mergeDB.id;
        const overrideType = mergeDB.type;
        const customTags = mergeDB.tags;
        const config5 = getConfig3();
        otherBranch = common_default.sanitizeText(otherBranch, config5);
        if (customId) {
          customId = common_default.sanitizeText(customId, config5);
        }
        const currentBranchCheck = state2.records.branches.get(state2.records.currBranch);
        const otherBranchCheck = state2.records.branches.get(otherBranch);
        const currentCommit = currentBranchCheck ? state2.records.commits.get(currentBranchCheck) : void 0;
        const otherCommit = otherBranchCheck ? state2.records.commits.get(otherBranchCheck) : void 0;
        if (currentCommit && otherCommit && currentCommit.branch === otherBranch) {
          throw new Error(`Cannot merge branch '${otherBranch}' into itself.`);
        }
        if (state2.records.currBranch === otherBranch) {
          const error3 = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
          error3.hash = {
            text: `merge ${otherBranch}`,
            token: `merge ${otherBranch}`,
            expected: ["branch abc"]
          };
          throw error3;
        }
        if (currentCommit === void 0 || !currentCommit) {
          const error3 = new Error(
            `Incorrect usage of "merge". Current branch (${state2.records.currBranch})has no commits`
          );
          error3.hash = {
            text: `merge ${otherBranch}`,
            token: `merge ${otherBranch}`,
            expected: ["commit"]
          };
          throw error3;
        }
        if (!state2.records.branches.has(otherBranch)) {
          const error3 = new Error(
            'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") does not exist"
          );
          error3.hash = {
            text: `merge ${otherBranch}`,
            token: `merge ${otherBranch}`,
            expected: [`branch ${otherBranch}`]
          };
          throw error3;
        }
        if (otherCommit === void 0 || !otherCommit) {
          const error3 = new Error(
            'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") has no commits"
          );
          error3.hash = {
            text: `merge ${otherBranch}`,
            token: `merge ${otherBranch}`,
            expected: ['"commit"']
          };
          throw error3;
        }
        if (currentCommit === otherCommit) {
          const error3 = new Error('Incorrect usage of "merge". Both branches have same head');
          error3.hash = {
            text: `merge ${otherBranch}`,
            token: `merge ${otherBranch}`,
            expected: ["branch abc"]
          };
          throw error3;
        }
        if (customId && state2.records.commits.has(customId)) {
          const error3 = new Error(
            'Incorrect usage of "merge". Commit with id:' + customId + " already exists, use different custom id"
          );
          error3.hash = {
            text: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(" ")}`,
            token: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(" ")}`,
            expected: [
              `merge ${otherBranch} ${customId}_UNIQUE ${overrideType} ${customTags?.join(" ")}`
            ]
          };
          throw error3;
        }
        const verifiedBranch = otherBranchCheck ? otherBranchCheck : "";
        const commit2 = {
          id: customId || `${state2.records.seq}-${getID()}`,
          message: `merged branch ${otherBranch} into ${state2.records.currBranch}`,
          seq: state2.records.seq++,
          parents: state2.records.head == null ? [] : [state2.records.head.id, verifiedBranch],
          branch: state2.records.currBranch,
          type: commitType.MERGE,
          customType: overrideType,
          customId: customId ? true : false,
          tags: customTags ?? []
        };
        state2.records.head = commit2;
        state2.records.commits.set(commit2.id, commit2);
        state2.records.branches.set(state2.records.currBranch, commit2.id);
        log.debug(state2.records.branches);
        log.debug("in mergeBranch");
      }, "merge");
      cherryPick = /* @__PURE__ */ __name(function(cherryPickDB) {
        let sourceId = cherryPickDB.id;
        let targetId = cherryPickDB.targetId;
        let tags2 = cherryPickDB.tags;
        let parentCommitId = cherryPickDB.parent;
        log.debug("Entering cherryPick:", sourceId, targetId, tags2);
        const config5 = getConfig3();
        sourceId = common_default.sanitizeText(sourceId, config5);
        targetId = common_default.sanitizeText(targetId, config5);
        tags2 = tags2?.map((tag) => common_default.sanitizeText(tag, config5));
        parentCommitId = common_default.sanitizeText(parentCommitId, config5);
        if (!sourceId || !state2.records.commits.has(sourceId)) {
          const error3 = new Error(
            'Incorrect usage of "cherryPick". Source commit id should exist and provided'
          );
          error3.hash = {
            text: `cherryPick ${sourceId} ${targetId}`,
            token: `cherryPick ${sourceId} ${targetId}`,
            expected: ["cherry-pick abc"]
          };
          throw error3;
        }
        const sourceCommit = state2.records.commits.get(sourceId);
        if (sourceCommit === void 0 || !sourceCommit) {
          throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
        }
        if (parentCommitId && !(Array.isArray(sourceCommit.parents) && sourceCommit.parents.includes(parentCommitId))) {
          const error3 = new Error(
            "Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit."
          );
          throw error3;
        }
        const sourceCommitBranch = sourceCommit.branch;
        if (sourceCommit.type === commitType.MERGE && !parentCommitId) {
          const error3 = new Error(
            "Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified."
          );
          throw error3;
        }
        if (!targetId || !state2.records.commits.has(targetId)) {
          if (sourceCommitBranch === state2.records.currBranch) {
            const error3 = new Error(
              'Incorrect usage of "cherryPick". Source commit is already on current branch'
            );
            error3.hash = {
              text: `cherryPick ${sourceId} ${targetId}`,
              token: `cherryPick ${sourceId} ${targetId}`,
              expected: ["cherry-pick abc"]
            };
            throw error3;
          }
          const currentCommitId = state2.records.branches.get(state2.records.currBranch);
          if (currentCommitId === void 0 || !currentCommitId) {
            const error3 = new Error(
              `Incorrect usage of "cherry-pick". Current branch (${state2.records.currBranch})has no commits`
            );
            error3.hash = {
              text: `cherryPick ${sourceId} ${targetId}`,
              token: `cherryPick ${sourceId} ${targetId}`,
              expected: ["cherry-pick abc"]
            };
            throw error3;
          }
          const currentCommit = state2.records.commits.get(currentCommitId);
          if (currentCommit === void 0 || !currentCommit) {
            const error3 = new Error(
              `Incorrect usage of "cherry-pick". Current branch (${state2.records.currBranch})has no commits`
            );
            error3.hash = {
              text: `cherryPick ${sourceId} ${targetId}`,
              token: `cherryPick ${sourceId} ${targetId}`,
              expected: ["cherry-pick abc"]
            };
            throw error3;
          }
          const commit2 = {
            id: state2.records.seq + "-" + getID(),
            message: `cherry-picked ${sourceCommit?.message} into ${state2.records.currBranch}`,
            seq: state2.records.seq++,
            parents: state2.records.head == null ? [] : [state2.records.head.id, sourceCommit.id],
            branch: state2.records.currBranch,
            type: commitType.CHERRY_PICK,
            tags: tags2 ? tags2.filter(Boolean) : [
              `cherry-pick:${sourceCommit.id}${sourceCommit.type === commitType.MERGE ? `|parent:${parentCommitId}` : ""}`
            ]
          };
          state2.records.head = commit2;
          state2.records.commits.set(commit2.id, commit2);
          state2.records.branches.set(state2.records.currBranch, commit2.id);
          log.debug(state2.records.branches);
          log.debug("in cherryPick");
        }
      }, "cherryPick");
      checkout = /* @__PURE__ */ __name(function(branch2) {
        branch2 = common_default.sanitizeText(branch2, getConfig3());
        if (!state2.records.branches.has(branch2)) {
          const error3 = new Error(
            `Trying to checkout branch which is not yet created. (Help try using "branch ${branch2}")`
          );
          error3.hash = {
            text: `checkout ${branch2}`,
            token: `checkout ${branch2}`,
            expected: [`branch ${branch2}`]
          };
          throw error3;
        } else {
          state2.records.currBranch = branch2;
          const id34 = state2.records.branches.get(state2.records.currBranch);
          if (id34 === void 0 || !id34) {
            state2.records.head = null;
          } else {
            state2.records.head = state2.records.commits.get(id34) ?? null;
          }
        }
      }, "checkout");
      __name(upsert, "upsert");
      __name(prettyPrintCommitHistory, "prettyPrintCommitHistory");
      prettyPrint = /* @__PURE__ */ __name(function() {
        log.debug(state2.records.commits);
        const node2 = getCommitsArray()[0];
        prettyPrintCommitHistory([node2]);
      }, "prettyPrint");
      clear7 = /* @__PURE__ */ __name(function() {
        state2.reset();
        clear();
      }, "clear");
      getBranchesAsObjArray = /* @__PURE__ */ __name(function() {
        const branchesArray = [...state2.records.branchConfig.values()].map((branchConfig, i2) => {
          if (branchConfig.order !== null && branchConfig.order !== void 0) {
            return branchConfig;
          }
          return {
            ...branchConfig,
            order: parseFloat(`0.${i2}`)
          };
        }).sort((a2, b3) => (a2.order ?? 0) - (b3.order ?? 0)).map(({ name }) => ({ name }));
        return branchesArray;
      }, "getBranchesAsObjArray");
      getBranches = /* @__PURE__ */ __name(function() {
        return state2.records.branches;
      }, "getBranches");
      getCommits = /* @__PURE__ */ __name(function() {
        return state2.records.commits;
      }, "getCommits");
      getCommitsArray = /* @__PURE__ */ __name(function() {
        const commitArr = [...state2.records.commits.values()];
        commitArr.forEach(function(o2) {
          log.debug(o2.id);
        });
        commitArr.sort((a2, b3) => a2.seq - b3.seq);
        return commitArr;
      }, "getCommitsArray");
      getCurrentBranch = /* @__PURE__ */ __name(function() {
        return state2.records.currBranch;
      }, "getCurrentBranch");
      getDirection = /* @__PURE__ */ __name(function() {
        return state2.records.direction;
      }, "getDirection");
      getHead = /* @__PURE__ */ __name(function() {
        return state2.records.head;
      }, "getHead");
      db = {
        commitType,
        getConfig: getConfig3,
        setDirection,
        setOptions: setOptions6,
        getOptions,
        commit,
        branch,
        merge: merge4,
        cherryPick,
        checkout,
        //reset,
        prettyPrint,
        clear: clear7,
        getBranchesAsObjArray,
        getBranches,
        getCommits,
        getCommitsArray,
        getCurrentBranch,
        getDirection,
        getHead,
        setAccTitle,
        getAccTitle,
        getAccDescription,
        setAccDescription,
        setDiagramTitle,
        getDiagramTitle
      };
    }
  });

  // src/diagrams/git/gitGraphParser.ts
  var populate15, parseStatement, parseCommit, parseBranch, parseMerge, parseCheckout, parseCherryPicking, parser4;
  var init_gitGraphParser = __esm({
    "src/diagrams/git/gitGraphParser.ts"() {
      "use strict";
      init_mermaid_parser_core();
      init_logger();
      init_populateCommonDb();
      init_gitGraphAst();
      init_gitGraphTypes();
      populate15 = /* @__PURE__ */ __name((ast, db9) => {
        populateCommonDb(ast, db9);
        if (ast.dir) {
          db9.setDirection(ast.dir);
        }
        for (const statement of ast.statements) {
          parseStatement(statement, db9);
        }
      }, "populate");
      parseStatement = /* @__PURE__ */ __name((statement, db9) => {
        const parsers2 = {
          Commit: /* @__PURE__ */ __name((stmt) => db9.commit(parseCommit(stmt)), "Commit"),
          Branch: /* @__PURE__ */ __name((stmt) => db9.branch(parseBranch(stmt)), "Branch"),
          Merge: /* @__PURE__ */ __name((stmt) => db9.merge(parseMerge(stmt)), "Merge"),
          Checkout: /* @__PURE__ */ __name((stmt) => db9.checkout(parseCheckout(stmt)), "Checkout"),
          CherryPicking: /* @__PURE__ */ __name((stmt) => db9.cherryPick(parseCherryPicking(stmt)), "CherryPicking")
        };
        const parser28 = parsers2[statement.$type];
        if (parser28) {
          parser28(statement);
        } else {
          log.error(`Unknown statement type: ${statement.$type}`);
        }
      }, "parseStatement");
      parseCommit = /* @__PURE__ */ __name((commit2) => {
        const commitDB = {
          id: commit2.id,
          msg: commit2.message ?? "",
          type: commit2.type !== void 0 ? commitType[commit2.type] : commitType.NORMAL,
          tags: commit2.tags ?? void 0
        };
        return commitDB;
      }, "parseCommit");
      parseBranch = /* @__PURE__ */ __name((branch2) => {
        const branchDB = {
          name: branch2.name,
          order: branch2.order ?? 0
        };
        return branchDB;
      }, "parseBranch");
      parseMerge = /* @__PURE__ */ __name((merge5) => {
        const mergeDB = {
          branch: merge5.branch,
          id: merge5.id ?? "",
          type: merge5.type !== void 0 ? commitType[merge5.type] : void 0,
          tags: merge5.tags ?? void 0
        };
        return mergeDB;
      }, "parseMerge");
      parseCheckout = /* @__PURE__ */ __name((checkout2) => {
        const branch2 = checkout2.branch;
        return branch2;
      }, "parseCheckout");
      parseCherryPicking = /* @__PURE__ */ __name((cherryPicking) => {
        const cherryPickDB = {
          id: cherryPicking.id,
          targetId: "",
          tags: cherryPicking.tags?.length === 0 ? void 0 : cherryPicking.tags,
          parent: cherryPicking.parent
        };
        return cherryPickDB;
      }, "parseCherryPicking");
      parser4 = {
        parse: /* @__PURE__ */ __name(async (input) => {
          const ast = await parse3("gitGraph", input);
          log.debug(ast);
          populate15(ast, db);
        }, "parse")
      };
      if (void 0) {
        const { it, expect, describe } = void 0;
        const mockDB = {
          commitType,
          setDirection: vi.fn(),
          commit: vi.fn(),
          branch: vi.fn(),
          merge: vi.fn(),
          cherryPick: vi.fn(),
          checkout: vi.fn()
        };
        describe("GitGraph Parser", () => {
          it("should parse a commit statement", () => {
            const commit2 = {
              $type: "Commit",
              id: "1",
              message: "test",
              tags: ["tag1", "tag2"],
              type: "NORMAL"
            };
            parseStatement(commit2, mockDB);
            expect(mockDB.commit).toHaveBeenCalledWith({
              id: "1",
              msg: "test",
              tags: ["tag1", "tag2"],
              type: 0
            });
          });
          it("should parse a branch statement", () => {
            const branch2 = {
              $type: "Branch",
              name: "newBranch",
              order: 1
            };
            parseStatement(branch2, mockDB);
            expect(mockDB.branch).toHaveBeenCalledWith({ name: "newBranch", order: 1 });
          });
          it("should parse a checkout statement", () => {
            const checkout2 = {
              $type: "Checkout",
              branch: "newBranch"
            };
            parseStatement(checkout2, mockDB);
            expect(mockDB.checkout).toHaveBeenCalledWith("newBranch");
          });
          it("should parse a merge statement", () => {
            const merge5 = {
              $type: "Merge",
              branch: "newBranch",
              id: "1",
              tags: ["tag1", "tag2"],
              type: "NORMAL"
            };
            parseStatement(merge5, mockDB);
            expect(mockDB.merge).toHaveBeenCalledWith({
              branch: "newBranch",
              id: "1",
              tags: ["tag1", "tag2"],
              type: 0
            });
          });
          it("should parse a cherry picking statement", () => {
            const cherryPick2 = {
              $type: "CherryPicking",
              id: "1",
              tags: ["tag1", "tag2"],
              parent: "2"
            };
            parseStatement(cherryPick2, mockDB);
            expect(mockDB.cherryPick).toHaveBeenCalledWith({
              id: "1",
              targetId: "",
              parent: "2",
              tags: ["tag1", "tag2"]
            });
          });
          it("should parse a langium generated gitGraph ast", () => {
            const dummy = {
              $type: "GitGraph",
              statements: [],
              accDescr: "",
              accTitle: "",
              title: ""
            };
            const gitGraphAst = {
              $type: "GitGraph",
              statements: [
                {
                  $container: dummy,
                  $type: "Commit",
                  id: "1",
                  message: "test",
                  tags: ["tag1", "tag2"],
                  type: "NORMAL"
                },
                {
                  $container: dummy,
                  $type: "Branch",
                  name: "newBranch",
                  order: 1
                },
                {
                  $container: dummy,
                  $type: "Merge",
                  branch: "newBranch",
                  id: "1",
                  tags: ["tag1", "tag2"],
                  type: "NORMAL"
                },
                {
                  $container: dummy,
                  $type: "Checkout",
                  branch: "newBranch"
                },
                {
                  $container: dummy,
                  $type: "CherryPicking",
                  id: "1",
                  tags: ["tag1", "tag2"],
                  parent: "2"
                }
              ],
              accDescr: "",
              accTitle: "",
              title: ""
            };
            populate15(gitGraphAst, mockDB);
            expect(mockDB.commit).toHaveBeenCalledWith({
              id: "1",
              msg: "test",
              tags: ["tag1", "tag2"],
              type: 0
            });
            expect(mockDB.branch).toHaveBeenCalledWith({ name: "newBranch", order: 1 });
            expect(mockDB.merge).toHaveBeenCalledWith({
              branch: "newBranch",
              id: "1",
              tags: ["tag1", "tag2"],
              type: 0
            });
            expect(mockDB.checkout).toHaveBeenCalledWith("newBranch");
          });
        });
      }
    }
  });

  // src/diagrams/git/gitGraphRenderer.ts
  var LAYOUT_OFFSET, COMMIT_STEP, PX, PY, THEME_COLOR_LIMIT, REDUX_GEOMETRY_THEMES, REDUX_BRANCH_LABEL_PADDING_Y, COLOR_THEMES3, DARK_THEMES, calcColorIndex, branchPos, commitPos, defaultPos, allCommitsDict, lanes, maxPos, dir, clear8, drawText2, findClosestParent, findClosestParentBT, setParallelBTPos, findClosestParentPos, calculateCommitPosition, setCommitPosition, setRootPosition, drawCommitBullet, drawCommitLabel, drawCommitTags, getCommitClassType, calculatePosition, getCommitPosition, drawCommits, shouldRerouteArrow, findLane, drawArrow, drawArrows, drawBranches, setBranchPosition, draw4, gitGraphRenderer_default;
  var init_gitGraphRenderer = __esm({
    "src/diagrams/git/gitGraphRenderer.ts"() {
      "use strict";
      init_src32();
      init_diagramAPI();
      init_logger();
      init_utils2();
      init_gitGraphTypes();
      LAYOUT_OFFSET = 10;
      COMMIT_STEP = 40;
      PX = 4;
      PY = 2;
      THEME_COLOR_LIMIT = 8;
      REDUX_GEOMETRY_THEMES = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]);
      REDUX_BRANCH_LABEL_PADDING_Y = 12;
      COLOR_THEMES3 = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]);
      DARK_THEMES = /* @__PURE__ */ new Set(["dark", "redux-dark", "redux-dark-color", "neo-dark"]);
      calcColorIndex = /* @__PURE__ */ __name((rawIndex, limit2, avoidDefaultColor = false) => {
        if (avoidDefaultColor && rawIndex > 0) {
          return (rawIndex - 1) % (limit2 - 1) + 1;
        }
        return rawIndex % limit2;
      }, "calcColorIndex");
      branchPos = /* @__PURE__ */ new Map();
      commitPos = /* @__PURE__ */ new Map();
      defaultPos = 30;
      allCommitsDict = /* @__PURE__ */ new Map();
      lanes = [];
      maxPos = 0;
      dir = "LR";
      clear8 = /* @__PURE__ */ __name(() => {
        branchPos.clear();
        commitPos.clear();
        allCommitsDict.clear();
        maxPos = 0;
        lanes = [];
        dir = "LR";
      }, "clear");
      drawText2 = /* @__PURE__ */ __name((txt) => {
        const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text");
        const rows = typeof txt === "string" ? txt.split(/\\n|\n|<br\s*\/?>/gi) : txt;
        rows.forEach((row) => {
          const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
          tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
          tspan.setAttribute("dy", "1em");
          tspan.setAttribute("x", "0");
          tspan.setAttribute("class", "row");
          tspan.textContent = row.trim();
          svgLabel.appendChild(tspan);
        });
        return svgLabel;
      }, "drawText");
      findClosestParent = /* @__PURE__ */ __name((parents3) => {
        let closestParent;
        let comparisonFunc;
        let targetPosition;
        if (dir === "BT") {
          comparisonFunc = /* @__PURE__ */ __name((a2, b3) => a2 <= b3, "comparisonFunc");
          targetPosition = Infinity;
        } else {
          comparisonFunc = /* @__PURE__ */ __name((a2, b3) => a2 >= b3, "comparisonFunc");
          targetPosition = 0;
        }
        parents3.forEach((parent4) => {
          const parentPosition = dir === "TB" || dir == "BT" ? commitPos.get(parent4)?.y : commitPos.get(parent4)?.x;
          if (parentPosition !== void 0 && comparisonFunc(parentPosition, targetPosition)) {
            closestParent = parent4;
            targetPosition = parentPosition;
          }
        });
        return closestParent;
      }, "findClosestParent");
      findClosestParentBT = /* @__PURE__ */ __name((parents3) => {
        let closestParent = "";
        let maxPosition = Infinity;
        parents3.forEach((parent4) => {
          const parentPosition = commitPos.get(parent4).y;
          if (parentPosition <= maxPosition) {
            closestParent = parent4;
            maxPosition = parentPosition;
          }
        });
        return closestParent || void 0;
      }, "findClosestParentBT");
      setParallelBTPos = /* @__PURE__ */ __name((sortedKeys, commits, defaultPos2) => {
        let curPos = defaultPos2;
        let maxPosition = defaultPos2;
        const roots = [];
        sortedKeys.forEach((key) => {
          const commit2 = commits.get(key);
          if (!commit2) {
            throw new Error(`Commit not found for key ${key}`);
          }
          if (commit2.parents.length) {
            curPos = calculateCommitPosition(commit2);
            maxPosition = Math.max(curPos, maxPosition);
          } else {
            roots.push(commit2);
          }
          setCommitPosition(commit2, curPos);
        });
        curPos = maxPosition;
        roots.forEach((commit2) => {
          setRootPosition(commit2, curPos, defaultPos2);
        });
        sortedKeys.forEach((key) => {
          const commit2 = commits.get(key);
          if (commit2?.parents.length) {
            const closestParent = findClosestParentBT(commit2.parents);
            curPos = commitPos.get(closestParent).y - COMMIT_STEP;
            if (curPos <= maxPosition) {
              maxPosition = curPos;
            }
            const x5 = branchPos.get(commit2.branch).pos;
            const y6 = curPos - LAYOUT_OFFSET;
            commitPos.set(commit2.id, { x: x5, y: y6 });
          }
        });
      }, "setParallelBTPos");
      findClosestParentPos = /* @__PURE__ */ __name((commit2) => {
        const closestParent = findClosestParent(commit2.parents.filter((p3) => p3 !== null));
        if (!closestParent) {
          throw new Error(`Closest parent not found for commit ${commit2.id}`);
        }
        const closestParentPos = commitPos.get(closestParent)?.y;
        if (closestParentPos === void 0) {
          throw new Error(`Closest parent position not found for commit ${commit2.id}`);
        }
        return closestParentPos;
      }, "findClosestParentPos");
      calculateCommitPosition = /* @__PURE__ */ __name((commit2) => {
        const closestParentPos = findClosestParentPos(commit2);
        return closestParentPos + COMMIT_STEP;
      }, "calculateCommitPosition");
      setCommitPosition = /* @__PURE__ */ __name((commit2, curPos) => {
        const branch2 = branchPos.get(commit2.branch);
        if (!branch2) {
          throw new Error(`Branch not found for commit ${commit2.id}`);
        }
        const x5 = branch2.pos;
        const y6 = curPos + LAYOUT_OFFSET;
        commitPos.set(commit2.id, { x: x5, y: y6 });
        return { x: x5, y: y6 };
      }, "setCommitPosition");
      setRootPosition = /* @__PURE__ */ __name((commit2, curPos, defaultPos2) => {
        const branch2 = branchPos.get(commit2.branch);
        if (!branch2) {
          throw new Error(`Branch not found for commit ${commit2.id}`);
        }
        const y6 = curPos + defaultPos2;
        const x5 = branch2.pos;
        commitPos.set(commit2.id, { x: x5, y: y6 });
      }, "setRootPosition");
      drawCommitBullet = /* @__PURE__ */ __name((gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType) => {
        const { theme } = getConfig2();
        const useReduxGeometry = REDUX_GEOMETRY_THEMES.has(theme ?? "");
        const useColorTheme = COLOR_THEMES3.has(theme ?? "");
        const isDark2 = DARK_THEMES.has(theme ?? "");
        if (commitSymbolType === commitType.HIGHLIGHT) {
          gBullets.append("rect").attr("x", commitPosition.x - 10 + (useReduxGeometry ? 3 : 0)).attr("y", commitPosition.y - 10 + (useReduxGeometry ? 3 : 0)).attr("width", useReduxGeometry ? 14 : 20).attr("height", useReduxGeometry ? 14 : 20).attr(
            "class",
            `commit ${commit2.id} commit-highlight${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)} ${typeClass}-outer`
          );
          gBullets.append("rect").attr("x", commitPosition.x - 6 + (useReduxGeometry ? 2 : 0)).attr("y", commitPosition.y - 6 + (useReduxGeometry ? 2 : 0)).attr("width", useReduxGeometry ? 8 : 12).attr("height", useReduxGeometry ? 8 : 12).attr(
            "class",
            `commit ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)} ${typeClass}-inner`
          );
        } else if (commitSymbolType === commitType.CHERRY_PICK) {
          gBullets.append("circle").attr("cx", commitPosition.x).attr("cy", commitPosition.y).attr("r", useReduxGeometry ? 7 : 10).attr("class", `commit ${commit2.id} ${typeClass}`);
          gBullets.append("circle").attr("cx", commitPosition.x - 3).attr("cy", commitPosition.y + 2).attr("r", useReduxGeometry ? 2.5 : 2.75).attr("fill", isDark2 ? "#000000" : "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
          gBullets.append("circle").attr("cx", commitPosition.x + 3).attr("cy", commitPosition.y + 2).attr("r", useReduxGeometry ? 2.5 : 2.75).attr("fill", isDark2 ? "#000000" : "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
          gBullets.append("line").attr("x1", commitPosition.x + 3).attr("y1", commitPosition.y + 1).attr("x2", commitPosition.x).attr("y2", commitPosition.y - 5).attr("stroke", isDark2 ? "#000000" : "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
          gBullets.append("line").attr("x1", commitPosition.x - 3).attr("y1", commitPosition.y + 1).attr("x2", commitPosition.x).attr("y2", commitPosition.y - 5).attr("stroke", isDark2 ? "#000000" : "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
        } else {
          const circle6 = gBullets.append("circle");
          circle6.attr("cx", commitPosition.x);
          circle6.attr("cy", commitPosition.y);
          circle6.attr("r", useReduxGeometry ? 7 : 10);
          circle6.attr(
            "class",
            `commit ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)}`
          );
          if (commitSymbolType === commitType.MERGE) {
            const circle22 = gBullets.append("circle");
            circle22.attr("cx", commitPosition.x);
            circle22.attr("cy", commitPosition.y);
            circle22.attr("r", useReduxGeometry ? 5 : 6);
            circle22.attr(
              "class",
              `commit ${typeClass} ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)}`
            );
          }
          if (commitSymbolType === commitType.REVERSE) {
            const cross3 = gBullets.append("path");
            const constValue = useReduxGeometry ? 4 : 5;
            cross3.attr(
              "d",
              `M ${commitPosition.x - constValue},${commitPosition.y - constValue}L${commitPosition.x + constValue},${commitPosition.y + constValue}M${commitPosition.x - constValue},${commitPosition.y + constValue}L${commitPosition.x + constValue},${commitPosition.y - constValue}`
            ).attr(
              "class",
              `commit ${typeClass} ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)}`
            );
          }
        }
      }, "drawCommitBullet");
      drawCommitLabel = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos, gitGraphConfig) => {
        if (commit2.type !== commitType.CHERRY_PICK && (commit2.customId && commit2.type === commitType.MERGE || commit2.type !== commitType.MERGE) && gitGraphConfig.showCommitLabel) {
          const wrapper = gLabels.append("g");
          const labelBkg = wrapper.insert("rect").attr("class", "commit-label-bkg");
          const text4 = wrapper.append("text").attr("x", pos).attr("y", commitPosition.y + 25).attr("class", "commit-label").text(commit2.id);
          const bbox = text4.node()?.getBBox();
          if (bbox) {
            labelBkg.attr("x", commitPosition.posWithOffset - bbox.width / 2 - PY).attr("y", commitPosition.y + 13.5).attr("width", bbox.width + 2 * PY).attr("height", bbox.height + 2 * PY);
            if (dir === "TB" || dir === "BT") {
              labelBkg.attr("x", commitPosition.x - (bbox.width + 4 * PX + 5)).attr("y", commitPosition.y - 12);
              text4.attr("x", commitPosition.x - (bbox.width + 4 * PX)).attr("y", commitPosition.y + bbox.height - 12);
            } else {
              text4.attr("x", commitPosition.posWithOffset - bbox.width / 2);
            }
            if (gitGraphConfig.rotateCommitLabel) {
              if (dir === "TB" || dir === "BT") {
                text4.attr(
                  "transform",
                  "rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")"
                );
                labelBkg.attr(
                  "transform",
                  "rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")"
                );
              } else {
                const r_x = -7.5 - (bbox.width + 10) / 25 * 9.5;
                const r_y = 10 + bbox.width / 25 * 8.5;
                wrapper.attr(
                  "transform",
                  "translate(" + r_x + ", " + r_y + ") rotate(-45, " + pos + ", " + commitPosition.y + ")"
                );
              }
            }
          }
        }
      }, "drawCommitLabel");
      drawCommitTags = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos) => {
        if (commit2.tags.length > 0) {
          let yOffset = 0;
          let maxTagBboxWidth = 0;
          let maxTagBboxHeight = 0;
          const tagElements = [];
          for (const tagValue of commit2.tags.reverse()) {
            const rect3 = gLabels.insert("polygon");
            const hole = gLabels.append("circle");
            const tag = gLabels.append("text").attr("y", commitPosition.y - 16 - yOffset).attr("class", "tag-label").text(tagValue);
            const tagBbox = tag.node()?.getBBox();
            if (!tagBbox) {
              throw new Error("Tag bbox not found");
            }
            maxTagBboxWidth = Math.max(maxTagBboxWidth, tagBbox.width);
            maxTagBboxHeight = Math.max(maxTagBboxHeight, tagBbox.height);
            tag.attr("x", commitPosition.posWithOffset - tagBbox.width / 2);
            tagElements.push({
              tag,
              hole,
              rect: rect3,
              yOffset
            });
            yOffset += 20;
          }
          for (const { tag, hole, rect: rect3, yOffset: yOffset2 } of tagElements) {
            const h22 = maxTagBboxHeight / 2;
            const ly = commitPosition.y - 19.2 - yOffset2;
            rect3.attr("class", "tag-label-bkg").attr(
              "points",
              `
      ${pos - maxTagBboxWidth / 2 - PX / 2},${ly + PY}  
      ${pos - maxTagBboxWidth / 2 - PX / 2},${ly - PY}
      ${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly - h22 - PY}
      ${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly - h22 - PY}
      ${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly + h22 + PY}
      ${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly + h22 + PY}`
            );
            hole.attr("cy", ly).attr("cx", pos - maxTagBboxWidth / 2 + PX / 2).attr("r", 1.5).attr("class", "tag-hole");
            if (dir === "TB" || dir === "BT") {
              const yOrigin = pos + yOffset2;
              rect3.attr("class", "tag-label-bkg").attr(
                "points",
                `
        ${commitPosition.x},${yOrigin + 2}
        ${commitPosition.x},${yOrigin - 2}
        ${commitPosition.x + LAYOUT_OFFSET},${yOrigin - h22 - 2}
        ${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin - h22 - 2}
        ${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin + h22 + 2}
        ${commitPosition.x + LAYOUT_OFFSET},${yOrigin + h22 + 2}`
              ).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")");
              hole.attr("cx", commitPosition.x + PX / 2).attr("cy", yOrigin).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")");
              tag.attr("x", commitPosition.x + 5).attr("y", yOrigin + 3).attr("transform", "translate(14,14) rotate(45, " + commitPosition.x + "," + pos + ")");
            }
          }
        }
      }, "drawCommitTags");
      getCommitClassType = /* @__PURE__ */ __name((commit2) => {
        const commitSymbolType = commit2.customType ?? commit2.type;
        switch (commitSymbolType) {
          case commitType.NORMAL:
            return "commit-normal";
          case commitType.REVERSE:
            return "commit-reverse";
          case commitType.HIGHLIGHT:
            return "commit-highlight";
          case commitType.MERGE:
            return "commit-merge";
          case commitType.CHERRY_PICK:
            return "commit-cherry-pick";
          default:
            return "commit-normal";
        }
      }, "getCommitClassType");
      calculatePosition = /* @__PURE__ */ __name((commit2, dir2, pos, commitPos2) => {
        const defaultCommitPosition = { x: 0, y: 0 };
        if (commit2.parents.length > 0) {
          const closestParent = findClosestParent(commit2.parents);
          if (closestParent) {
            const parentPosition = commitPos2.get(closestParent) ?? defaultCommitPosition;
            if (dir2 === "TB") {
              return parentPosition.y + COMMIT_STEP;
            } else if (dir2 === "BT") {
              const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition;
              return currentPosition.y - COMMIT_STEP;
            } else {
              return parentPosition.x + COMMIT_STEP;
            }
          }
        } else {
          if (dir2 === "TB") {
            return defaultPos;
          } else if (dir2 === "BT") {
            const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition;
            return currentPosition.y - COMMIT_STEP;
          } else {
            return 0;
          }
        }
        return 0;
      }, "calculatePosition");
      getCommitPosition = /* @__PURE__ */ __name((commit2, pos, isParallelCommits) => {
        const posWithOffset = dir === "BT" && isParallelCommits ? pos : pos + LAYOUT_OFFSET;
        const branchY = branchPos.get(commit2.branch)?.pos;
        const x5 = dir === "TB" || dir === "BT" ? branchPos.get(commit2.branch)?.pos : posWithOffset;
        if (x5 === void 0 || branchY === void 0) {
          throw new Error(`Position were undefined for commit ${commit2.id}`);
        }
        const useReduxGeometry = REDUX_GEOMETRY_THEMES.has(getConfig2().theme ?? "");
        const y6 = dir === "TB" || dir === "BT" ? posWithOffset : branchY + (useReduxGeometry ? REDUX_BRANCH_LABEL_PADDING_Y / 2 + 1 : -2);
        return { x: x5, y: y6, posWithOffset };
      }, "getCommitPosition");
      drawCommits = /* @__PURE__ */ __name((svg2, commits, modifyGraph, gitGraphConfig) => {
        const gBullets = svg2.append("g").attr("class", "commit-bullets");
        const gLabels = svg2.append("g").attr("class", "commit-labels");
        let pos = dir === "TB" || dir === "BT" ? defaultPos : 0;
        const keys2 = [...commits.keys()];
        const isParallelCommits = gitGraphConfig.parallelCommits ?? false;
        const sortKeys = /* @__PURE__ */ __name((a2, b3) => {
          const seqA = commits.get(a2)?.seq;
          const seqB = commits.get(b3)?.seq;
          return seqA !== void 0 && seqB !== void 0 ? seqA - seqB : 0;
        }, "sortKeys");
        let sortedKeys = keys2.sort(sortKeys);
        if (dir === "BT") {
          if (isParallelCommits) {
            setParallelBTPos(sortedKeys, commits, pos);
          }
          sortedKeys = sortedKeys.reverse();
        }
        sortedKeys.forEach((key) => {
          const commit2 = commits.get(key);
          if (!commit2) {
            throw new Error(`Commit not found for key ${key}`);
          }
          if (isParallelCommits) {
            pos = calculatePosition(commit2, dir, pos, commitPos);
          }
          const commitPosition = getCommitPosition(commit2, pos, isParallelCommits);
          if (modifyGraph) {
            const typeClass = getCommitClassType(commit2);
            const commitSymbolType = commit2.customType ?? commit2.type;
            const branchIndex = branchPos.get(commit2.branch)?.index ?? 0;
            drawCommitBullet(gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType);
            drawCommitLabel(gLabels, commit2, commitPosition, pos, gitGraphConfig);
            drawCommitTags(gLabels, commit2, commitPosition, pos);
          }
          if (dir === "TB" || dir === "BT") {
            commitPos.set(commit2.id, { x: commitPosition.x, y: commitPosition.posWithOffset });
          } else {
            commitPos.set(commit2.id, { x: commitPosition.posWithOffset, y: commitPosition.y });
          }
          pos = dir === "BT" && isParallelCommits ? pos + COMMIT_STEP : pos + COMMIT_STEP + LAYOUT_OFFSET;
          if (pos > maxPos) {
            maxPos = pos;
          }
        });
      }, "drawCommits");
      shouldRerouteArrow = /* @__PURE__ */ __name((commitA, commitB, p1, p22, allCommits) => {
        const commitBIsFurthest = dir === "TB" || dir === "BT" ? p1.x < p22.x : p1.y < p22.y;
        const branchToGetCurve = commitBIsFurthest ? commitB.branch : commitA.branch;
        const isOnBranchToGetCurve = /* @__PURE__ */ __name((x5) => x5.branch === branchToGetCurve, "isOnBranchToGetCurve");
        const isBetweenCommits = /* @__PURE__ */ __name((x5) => x5.seq > commitA.seq && x5.seq < commitB.seq, "isBetweenCommits");
        return [...allCommits.values()].some((commitX) => {
          return isBetweenCommits(commitX) && isOnBranchToGetCurve(commitX);
        });
      }, "shouldRerouteArrow");
      findLane = /* @__PURE__ */ __name((y1, y22, depth = 0) => {
        const candidate = y1 + Math.abs(y1 - y22) / 2;
        if (depth > 5) {
          return candidate;
        }
        const ok = lanes.every((lane) => Math.abs(lane - candidate) >= 10);
        if (ok) {
          lanes.push(candidate);
          return candidate;
        }
        const diff2 = Math.abs(y1 - y22);
        return findLane(y1, y22 - diff2 / 5, depth + 1);
      }, "findLane");
      drawArrow = /* @__PURE__ */ __name((svg2, commitA, commitB, allCommits) => {
        const { theme: arrowTheme } = getConfig2();
        const useColorTheme = COLOR_THEMES3.has(arrowTheme ?? "");
        const p1 = commitPos.get(commitA.id);
        const p22 = commitPos.get(commitB.id);
        if (p1 === void 0 || p22 === void 0) {
          throw new Error(`Commit positions not found for commits ${commitA.id} and ${commitB.id}`);
        }
        const arrowNeedsRerouting = shouldRerouteArrow(commitA, commitB, p1, p22, allCommits);
        let arc = "";
        let arc2 = "";
        let radius2 = 0;
        let offset = 0;
        let colorClassNum = branchPos.get(commitB.branch)?.index;
        if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
          colorClassNum = branchPos.get(commitA.branch)?.index;
        }
        let lineDef;
        if (arrowNeedsRerouting) {
          arc = "A 10 10, 0, 0, 0,";
          arc2 = "A 10 10, 0, 0, 1,";
          radius2 = 10;
          offset = 10;
          const lineY = p1.y < p22.y ? findLane(p1.y, p22.y) : findLane(p22.y, p1.y);
          const lineX = p1.x < p22.x ? findLane(p1.x, p22.x) : findLane(p22.x, p1.x);
          if (dir === "TB") {
            if (p1.x < p22.x) {
              lineDef = `M ${p1.x} ${p1.y} L ${lineX - radius2} ${p1.y} ${arc2} ${lineX} ${p1.y + offset} L ${lineX} ${p22.y - radius2} ${arc} ${lineX + offset} ${p22.y} L ${p22.x} ${p22.y}`;
            } else {
              colorClassNum = branchPos.get(commitA.branch)?.index;
              lineDef = `M ${p1.x} ${p1.y} L ${lineX + radius2} ${p1.y} ${arc} ${lineX} ${p1.y + offset} L ${lineX} ${p22.y - radius2} ${arc2} ${lineX - offset} ${p22.y} L ${p22.x} ${p22.y}`;
            }
          } else if (dir === "BT") {
            if (p1.x < p22.x) {
              lineDef = `M ${p1.x} ${p1.y} L ${lineX - radius2} ${p1.y} ${arc} ${lineX} ${p1.y - offset} L ${lineX} ${p22.y + radius2} ${arc2} ${lineX + offset} ${p22.y} L ${p22.x} ${p22.y}`;
            } else {
              colorClassNum = branchPos.get(commitA.branch)?.index;
              lineDef = `M ${p1.x} ${p1.y} L ${lineX + radius2} ${p1.y} ${arc2} ${lineX} ${p1.y - offset} L ${lineX} ${p22.y + radius2} ${arc} ${lineX - offset} ${p22.y} L ${p22.x} ${p22.y}`;
            }
          } else {
            if (p1.y < p22.y) {
              lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY - radius2} ${arc} ${p1.x + offset} ${lineY} L ${p22.x - radius2} ${lineY} ${arc2} ${p22.x} ${lineY + offset} L ${p22.x} ${p22.y}`;
            } else {
              colorClassNum = branchPos.get(commitA.branch)?.index;
              lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY + radius2} ${arc2} ${p1.x + offset} ${lineY} L ${p22.x - radius2} ${lineY} ${arc} ${p22.x} ${lineY - offset} L ${p22.x} ${p22.y}`;
            }
          }
        } else {
          arc = "A 20 20, 0, 0, 0,";
          arc2 = "A 20 20, 0, 0, 1,";
          radius2 = 20;
          offset = 20;
          if (dir === "TB") {
            if (p1.x < p22.x) {
              if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
                lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p22.y - radius2} ${arc} ${p1.x + offset} ${p22.y} L ${p22.x} ${p22.y}`;
              } else {
                lineDef = `M ${p1.x} ${p1.y} L ${p22.x - radius2} ${p1.y} ${arc2} ${p22.x} ${p1.y + offset} L ${p22.x} ${p22.y}`;
              }
            }
            if (p1.x > p22.x) {
              arc = "A 20 20, 0, 0, 0,";
              arc2 = "A 20 20, 0, 0, 1,";
              radius2 = 20;
              offset = 20;
              if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
                lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p22.y - radius2} ${arc2} ${p1.x - offset} ${p22.y} L ${p22.x} ${p22.y}`;
              } else {
                lineDef = `M ${p1.x} ${p1.y} L ${p22.x + radius2} ${p1.y} ${arc} ${p22.x} ${p1.y + offset} L ${p22.x} ${p22.y}`;
              }
            }
            if (p1.x === p22.x) {
              lineDef = `M ${p1.x} ${p1.y} L ${p22.x} ${p22.y}`;
            }
          } else if (dir === "BT") {
            if (p1.x < p22.x) {
              if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
                lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p22.y + radius2} ${arc2} ${p1.x + offset} ${p22.y} L ${p22.x} ${p22.y}`;
              } else {
                lineDef = `M ${p1.x} ${p1.y} L ${p22.x - radius2} ${p1.y} ${arc} ${p22.x} ${p1.y - offset} L ${p22.x} ${p22.y}`;
              }
            }
            if (p1.x > p22.x) {
              arc = "A 20 20, 0, 0, 0,";
              arc2 = "A 20 20, 0, 0, 1,";
              radius2 = 20;
              offset = 20;
              if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
                lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p22.y + radius2} ${arc} ${p1.x - offset} ${p22.y} L ${p22.x} ${p22.y}`;
              } else {
                lineDef = `M ${p1.x} ${p1.y} L ${p22.x + radius2} ${p1.y} ${arc2} ${p22.x} ${p1.y - offset} L ${p22.x} ${p22.y}`;
              }
            }
            if (p1.x === p22.x) {
              lineDef = `M ${p1.x} ${p1.y} L ${p22.x} ${p22.y}`;
            }
          } else {
            if (p1.y < p22.y) {
              if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
                lineDef = `M ${p1.x} ${p1.y} L ${p22.x - radius2} ${p1.y} ${arc2} ${p22.x} ${p1.y + offset} L ${p22.x} ${p22.y}`;
              } else {
                lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p22.y - radius2} ${arc} ${p1.x + offset} ${p22.y} L ${p22.x} ${p22.y}`;
              }
            }
            if (p1.y > p22.y) {
              if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
                lineDef = `M ${p1.x} ${p1.y} L ${p22.x - radius2} ${p1.y} ${arc} ${p22.x} ${p1.y - offset} L ${p22.x} ${p22.y}`;
              } else {
                lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p22.y + radius2} ${arc2} ${p1.x + offset} ${p22.y} L ${p22.x} ${p22.y}`;
              }
            }
            if (p1.y === p22.y) {
              lineDef = `M ${p1.x} ${p1.y} L ${p22.x} ${p22.y}`;
            }
          }
        }
        if (lineDef === void 0) {
          throw new Error("Line definition not found");
        }
        svg2.append("path").attr("d", lineDef).attr(
          "class",
          "arrow arrow" + calcColorIndex(colorClassNum, THEME_COLOR_LIMIT, useColorTheme)
        );
      }, "drawArrow");
      drawArrows = /* @__PURE__ */ __name((svg2, commits) => {
        const gArrows = svg2.append("g").attr("class", "commit-arrows");
        [...commits.keys()].forEach((key) => {
          const commit2 = commits.get(key);
          if (commit2.parents && commit2.parents.length > 0) {
            commit2.parents.forEach((parent4) => {
              drawArrow(gArrows, commits.get(parent4), commit2, commits);
            });
          }
        });
      }, "drawArrows");
      drawBranches = /* @__PURE__ */ __name((svg2, branches, gitGraphConfig, id34) => {
        const { look, theme, themeVariables } = getConfig2();
        const { dropShadow, THEME_COLOR_LIMIT: themeColorLimit } = themeVariables;
        const useReduxGeometry = REDUX_GEOMETRY_THEMES.has(theme ?? "");
        const useColorTheme = COLOR_THEMES3.has(theme ?? "");
        const g2 = svg2.append("g");
        branches.forEach((branch2, index) => {
          const adjustIndexForTheme = calcColorIndex(
            index,
            useReduxGeometry ? themeColorLimit : THEME_COLOR_LIMIT,
            useColorTheme
          );
          const pos = branchPos.get(branch2.name)?.pos;
          if (pos === void 0) {
            throw new Error(`Position not found for branch ${branch2.name}`);
          }
          const spineY = dir === "TB" || dir === "BT" ? pos : useReduxGeometry ? pos + REDUX_BRANCH_LABEL_PADDING_Y / 2 + 1 : pos - 2;
          const line2 = g2.append("line");
          line2.attr("x1", 0);
          line2.attr("y1", spineY);
          line2.attr("x2", maxPos);
          line2.attr("y2", spineY);
          line2.attr("class", "branch branch" + adjustIndexForTheme);
          if (dir === "TB") {
            line2.attr("y1", defaultPos);
            line2.attr("x1", pos);
            line2.attr("y2", maxPos);
            line2.attr("x2", pos);
          } else if (dir === "BT") {
            line2.attr("y1", maxPos);
            line2.attr("x1", pos);
            line2.attr("y2", defaultPos);
            line2.attr("x2", pos);
          }
          lanes.push(spineY);
          const name = branch2.name;
          const labelElement = drawText2(name);
          const bkg = g2.insert("rect");
          const branchLabel = g2.insert("g").attr("class", "branchLabel");
          const label = branchLabel.insert("g").attr("class", "label branch-label" + adjustIndexForTheme);
          label.node().appendChild(labelElement);
          const bbox = labelElement.getBBox();
          const borderRadius = useReduxGeometry ? 0 : 4;
          const labelPaddingX = useReduxGeometry ? 16 : 0;
          const labelPaddingY = useReduxGeometry ? REDUX_BRANCH_LABEL_PADDING_Y : 0;
          if (look === "neo") {
            bkg.attr("data-look", `neo`);
          }
          bkg.attr("class", "branchLabelBkg label" + adjustIndexForTheme).attr(
            "style",
            look === "neo" ? `filter:${useReduxGeometry ? `url(#${id34}-drop-shadow)` : dropShadow}` : ""
          ).attr("rx", borderRadius).attr("ry", borderRadius).attr("x", -bbox.width - 4 - (gitGraphConfig.rotateCommitLabel === true ? 30 : 0)).attr("y", -bbox.height / 2 + 10).attr("width", bbox.width + 18 + labelPaddingX).attr("height", bbox.height + 4 + labelPaddingY);
          label.attr(
            "transform",
            "translate(" + (-bbox.width - 14 - (gitGraphConfig.rotateCommitLabel === true ? 30 : 0) + labelPaddingX / 2) + ", " + (spineY - bbox.height / 2 - 2) + ")"
          );
          if (dir === "TB") {
            bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", 0);
            label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", 0)");
            if (useReduxGeometry) {
              bkg.attr("transform", `translate(${-labelPaddingX / 2 - 3}, ${-labelPaddingY - 10})`);
              label.attr(
                "transform",
                "translate(" + (pos - bbox.width / 2 - 5) + ", " + (-labelPaddingY * 2 + 7) + ")"
              );
            }
          } else if (dir === "BT") {
            bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", maxPos);
            label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", " + maxPos + ")");
            if (useReduxGeometry) {
              bkg.attr("transform", `translate(${-labelPaddingX / 2 - 3}, ${labelPaddingY + 10})`);
              label.attr(
                "transform",
                "translate(" + (pos - bbox.width / 2 - 5) + ", " + (maxPos + labelPaddingY * 2 + 4) + ")"
              );
            }
          } else {
            bkg.attr("transform", "translate(-19, " + (spineY - 12 - labelPaddingY / 2) + ")");
          }
        });
      }, "drawBranches");
      setBranchPosition = /* @__PURE__ */ __name(function(name, pos, index, bbox, rotateCommitLabel) {
        branchPos.set(name, { pos, index });
        pos += 50 + (rotateCommitLabel ? 40 : 0) + (dir === "TB" || dir === "BT" ? bbox.width / 2 : 0);
        return pos;
      }, "setBranchPosition");
      draw4 = /* @__PURE__ */ __name(function(txt, id34, ver, diagObj) {
        clear8();
        log.debug("in gitgraph renderer", txt + "\n", "id:", id34, ver);
        const db9 = diagObj.db;
        if (!db9.getConfig) {
          log.error("getConfig method is not available on db");
          return;
        }
        const gitGraphConfig = db9.getConfig();
        const rotateCommitLabel = gitGraphConfig.rotateCommitLabel ?? false;
        allCommitsDict = db9.getCommits();
        const branches = db9.getBranchesAsObjArray();
        dir = db9.getDirection();
        const diagram31 = select_default2(`[id="${id34}"]`);
        const { look, theme, themeVariables } = getConfig2();
        const { useGradient, gradientStart, gradientStop, filterColor } = themeVariables;
        if (useGradient) {
          const gradient = diagram31.append("defs").append("linearGradient").attr("id", id34 + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
          gradient.append("stop").attr("offset", "0%").attr("stop-color", gradientStart).attr("stop-opacity", 1);
          gradient.append("stop").attr("offset", "100%").attr("stop-color", gradientStop).attr("stop-opacity", 1);
        }
        if (look === "neo" && REDUX_GEOMETRY_THEMES.has(theme ?? "")) {
          diagram31.append("defs").append("filter").attr("id", id34 + "-drop-shadow").attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", filterColor);
        }
        let pos = 0;
        branches.forEach((branch2, index) => {
          const labelElement = drawText2(branch2.name);
          const g2 = diagram31.append("g");
          const branchLabel = g2.insert("g").attr("class", "branchLabel");
          const label = branchLabel.insert("g").attr("class", "label branch-label");
          label.node()?.appendChild(labelElement);
          const bbox = labelElement.getBBox();
          pos = setBranchPosition(branch2.name, pos, index, bbox, rotateCommitLabel);
          label.remove();
          branchLabel.remove();
          g2.remove();
        });
        drawCommits(diagram31, allCommitsDict, false, gitGraphConfig);
        if (gitGraphConfig.showBranches) {
          drawBranches(diagram31, branches, gitGraphConfig, id34);
        }
        drawArrows(diagram31, allCommitsDict);
        drawCommits(diagram31, allCommitsDict, true, gitGraphConfig);
        utils_default2.insertTitle(
          diagram31,
          "gitTitleText",
          gitGraphConfig.titleTopMargin ?? 0,
          db9.getDiagramTitle()
        );
        setupGraphViewbox2(void 0, diagram31, gitGraphConfig.diagramPadding, gitGraphConfig.useMaxWidth);
      }, "draw");
      gitGraphRenderer_default = {
        draw: draw4
      };
      if (void 0) {
        const { it, expect, describe } = void 0;
        describe("drawText", () => {
          it("should drawText", () => {
            const svgLabel = drawText2("main");
            expect(svgLabel).toBeDefined();
            expect(svgLabel.children[0].innerHTML).toBe("main");
          });
        });
        describe("branchPosition", () => {
          const bbox = {
            x: 0,
            y: 0,
            width: 10,
            height: 10,
            top: 0,
            right: 0,
            bottom: 0,
            left: 0,
            toJSON: /* @__PURE__ */ __name(() => "", "toJSON")
          };
          it("should setBranchPositions LR with two branches", () => {
            dir = "LR";
            const pos = setBranchPosition("main", 0, 0, bbox, true);
            expect(pos).toBe(90);
            expect(branchPos.get("main")).toEqual({ pos: 0, index: 0 });
            const posNext = setBranchPosition("develop", pos, 1, bbox, true);
            expect(posNext).toBe(180);
            expect(branchPos.get("develop")).toEqual({ pos, index: 1 });
          });
          it("should setBranchPositions TB with two branches", () => {
            dir = "TB";
            bbox.width = 34.9921875;
            const pos = setBranchPosition("main", 0, 0, bbox, true);
            expect(pos).toBe(107.49609375);
            expect(branchPos.get("main")).toEqual({ pos: 0, index: 0 });
            bbox.width = 56.421875;
            const posNext = setBranchPosition("develop", pos, 1, bbox, true);
            expect(posNext).toBe(225.70703125);
            expect(branchPos.get("develop")).toEqual({ pos, index: 1 });
          });
        });
        describe("commitPosition", () => {
          const commits = /* @__PURE__ */ new Map([
            [
              "commitZero",
              {
                id: "ZERO",
                message: "",
                seq: 0,
                type: commitType.NORMAL,
                tags: [],
                parents: [],
                branch: "main"
              }
            ],
            [
              "commitA",
              {
                id: "A",
                message: "",
                seq: 1,
                type: commitType.NORMAL,
                tags: [],
                parents: ["ZERO"],
                branch: "feature"
              }
            ],
            [
              "commitB",
              {
                id: "B",
                message: "",
                seq: 2,
                type: commitType.NORMAL,
                tags: [],
                parents: ["A"],
                branch: "feature"
              }
            ],
            [
              "commitM",
              {
                id: "M",
                message: "merged branch feature into main",
                seq: 3,
                type: commitType.MERGE,
                tags: [],
                parents: ["ZERO", "B"],
                branch: "main",
                customId: true
              }
            ],
            [
              "commitC",
              {
                id: "C",
                message: "",
                seq: 4,
                type: commitType.NORMAL,
                tags: [],
                parents: ["ZERO"],
                branch: "release"
              }
            ],
            [
              "commit5_8928ea0",
              {
                id: "5-8928ea0",
                message: "cherry-picked [object Object] into release",
                seq: 5,
                type: commitType.CHERRY_PICK,
                tags: [],
                parents: ["C", "M"],
                branch: "release"
              }
            ],
            [
              "commitD",
              {
                id: "D",
                message: "",
                seq: 6,
                type: commitType.NORMAL,
                tags: [],
                parents: ["5-8928ea0"],
                branch: "release"
              }
            ],
            [
              "commit7_ed848ba",
              {
                id: "7-ed848ba",
                message: "cherry-picked [object Object] into release",
                seq: 7,
                type: commitType.CHERRY_PICK,
                tags: [],
                parents: ["D", "M"],
                branch: "release"
              }
            ]
          ]);
          let pos = 0;
          branchPos.set("main", { pos: 0, index: 0 });
          branchPos.set("feature", { pos: 107.49609375, index: 1 });
          branchPos.set("release", { pos: 224.03515625, index: 2 });
          describe("TB", () => {
            pos = 30;
            dir = "TB";
            const expectedCommitPositionTB = /* @__PURE__ */ new Map([
              ["commitZero", { x: 0, y: 40, posWithOffset: 40 }],
              ["commitA", { x: 107.49609375, y: 90, posWithOffset: 90 }],
              ["commitB", { x: 107.49609375, y: 140, posWithOffset: 140 }],
              ["commitM", { x: 0, y: 190, posWithOffset: 190 }],
              ["commitC", { x: 224.03515625, y: 240, posWithOffset: 240 }],
              ["commit5_8928ea0", { x: 224.03515625, y: 290, posWithOffset: 290 }],
              ["commitD", { x: 224.03515625, y: 340, posWithOffset: 340 }],
              ["commit7_ed848ba", { x: 224.03515625, y: 390, posWithOffset: 390 }]
            ]);
            commits.forEach((commit2, key) => {
              it(`should give the correct position for commit ${key}`, () => {
                const position5 = getCommitPosition(commit2, pos, false);
                expect(position5).toEqual(expectedCommitPositionTB.get(key));
                pos += 50;
              });
            });
          });
          describe("LR", () => {
            let pos2 = 30;
            dir = "LR";
            const expectedCommitPositionLR = /* @__PURE__ */ new Map([
              ["commitZero", { x: 0, y: 40, posWithOffset: 40 }],
              ["commitA", { x: 107.49609375, y: 90, posWithOffset: 90 }],
              ["commitB", { x: 107.49609375, y: 140, posWithOffset: 140 }],
              ["commitM", { x: 0, y: 190, posWithOffset: 190 }],
              ["commitC", { x: 224.03515625, y: 240, posWithOffset: 240 }],
              ["commit5_8928ea0", { x: 224.03515625, y: 290, posWithOffset: 290 }],
              ["commitD", { x: 224.03515625, y: 340, posWithOffset: 340 }],
              ["commit7_ed848ba", { x: 224.03515625, y: 390, posWithOffset: 390 }]
            ]);
            commits.forEach((commit2, key) => {
              it(`should give the correct position for commit ${key}`, () => {
                const position5 = getCommitPosition(commit2, pos2, false);
                expect(position5).toEqual(expectedCommitPositionLR.get(key));
                pos2 += 50;
              });
            });
          });
          describe("getCommitClassType", () => {
            const expectedCommitClassType = /* @__PURE__ */ new Map([
              ["commitZero", "commit-normal"],
              ["commitA", "commit-normal"],
              ["commitB", "commit-normal"],
              ["commitM", "commit-merge"],
              ["commitC", "commit-normal"],
              ["commit5_8928ea0", "commit-cherry-pick"],
              ["commitD", "commit-normal"],
              ["commit7_ed848ba", "commit-cherry-pick"]
            ]);
            commits.forEach((commit2, key) => {
              it(`should give the correct class type for commit ${key}`, () => {
                const classType = getCommitClassType(commit2);
                expect(classType).toBe(expectedCommitClassType.get(key));
              });
            });
          });
        });
        describe("building BT parallel commit diagram", () => {
          const commits = /* @__PURE__ */ new Map([
            [
              "1-abcdefg",
              {
                id: "1-abcdefg",
                message: "",
                seq: 0,
                type: 0,
                tags: [],
                parents: [],
                branch: "main"
              }
            ],
            [
              "2-abcdefg",
              {
                id: "2-abcdefg",
                message: "",
                seq: 1,
                type: 0,
                tags: [],
                parents: ["1-abcdefg"],
                branch: "main"
              }
            ],
            [
              "3-abcdefg",
              {
                id: "3-abcdefg",
                message: "",
                seq: 2,
                type: 0,
                tags: [],
                parents: ["2-abcdefg"],
                branch: "develop"
              }
            ],
            [
              "4-abcdefg",
              {
                id: "4-abcdefg",
                message: "",
                seq: 3,
                type: 0,
                tags: [],
                parents: ["3-abcdefg"],
                branch: "develop"
              }
            ],
            [
              "5-abcdefg",
              {
                id: "5-abcdefg",
                message: "",
                seq: 4,
                type: 0,
                tags: [],
                parents: ["2-abcdefg"],
                branch: "feature"
              }
            ],
            [
              "6-abcdefg",
              {
                id: "6-abcdefg",
                message: "",
                seq: 5,
                type: 0,
                tags: [],
                parents: ["5-abcdefg"],
                branch: "feature"
              }
            ],
            [
              "7-abcdefg",
              {
                id: "7-abcdefg",
                message: "",
                seq: 6,
                type: 0,
                tags: [],
                parents: ["2-abcdefg"],
                branch: "main"
              }
            ],
            [
              "8-abcdefg",
              {
                id: "8-abcdefg",
                message: "",
                seq: 7,
                type: 0,
                tags: [],
                parents: ["7-abcdefg"],
                branch: "main"
              }
            ]
          ]);
          const expectedCommitPosition = /* @__PURE__ */ new Map([
            ["1-abcdefg", { x: 0, y: 40 }],
            ["2-abcdefg", { x: 0, y: 90 }],
            ["3-abcdefg", { x: 107.49609375, y: 140 }],
            ["4-abcdefg", { x: 107.49609375, y: 190 }],
            ["5-abcdefg", { x: 225.70703125, y: 140 }],
            ["6-abcdefg", { x: 225.70703125, y: 190 }],
            ["7-abcdefg", { x: 0, y: 140 }],
            ["8-abcdefg", { x: 0, y: 190 }]
          ]);
          const expectedCommitPositionAfterParallel = /* @__PURE__ */ new Map([
            ["1-abcdefg", { x: 0, y: 210 }],
            ["2-abcdefg", { x: 0, y: 160 }],
            ["3-abcdefg", { x: 107.49609375, y: 110 }],
            ["4-abcdefg", { x: 107.49609375, y: 60 }],
            ["5-abcdefg", { x: 225.70703125, y: 110 }],
            ["6-abcdefg", { x: 225.70703125, y: 60 }],
            ["7-abcdefg", { x: 0, y: 110 }],
            ["8-abcdefg", { x: 0, y: 60 }]
          ]);
          const expectedCommitCurrentPosition = /* @__PURE__ */ new Map([
            ["1-abcdefg", 30],
            ["2-abcdefg", 80],
            ["3-abcdefg", 130],
            ["4-abcdefg", 180],
            ["5-abcdefg", 130],
            ["6-abcdefg", 180],
            ["7-abcdefg", 130],
            ["8-abcdefg", 180]
          ]);
          const sortedKeys = [...expectedCommitPosition.keys()];
          it("should get the correct commit position and current position", () => {
            dir = "BT";
            let curPos = 30;
            commitPos.clear();
            branchPos.clear();
            branchPos.set("main", { pos: 0, index: 0 });
            branchPos.set("develop", { pos: 107.49609375, index: 1 });
            branchPos.set("feature", { pos: 225.70703125, index: 2 });
            commits.forEach((commit2, key) => {
              if (commit2.parents.length > 0) {
                curPos = calculateCommitPosition(commit2);
              }
              const position5 = setCommitPosition(commit2, curPos);
              expect(position5).toEqual(expectedCommitPosition.get(key));
              expect(curPos).toEqual(expectedCommitCurrentPosition.get(key));
            });
          });
          it("should get the correct commit position after parallel commits", () => {
            commitPos.clear();
            branchPos.clear();
            dir = "BT";
            const curPos = 30;
            commitPos.clear();
            branchPos.clear();
            branchPos.set("main", { pos: 0, index: 0 });
            branchPos.set("develop", { pos: 107.49609375, index: 1 });
            branchPos.set("feature", { pos: 225.70703125, index: 2 });
            setParallelBTPos(sortedKeys, commits, curPos);
            sortedKeys.forEach((commit2) => {
              const position5 = commitPos.get(commit2);
              expect(position5).toEqual(expectedCommitPositionAfterParallel.get(commit2));
            });
          });
        });
        it("add", () => {
          commitPos.set("parent1", { x: 1, y: 1 });
          commitPos.set("parent2", { x: 2, y: 2 });
          commitPos.set("parent3", { x: 3, y: 3 });
          dir = "LR";
          const parents3 = ["parent1", "parent2", "parent3"];
          const closestParent = findClosestParent(parents3);
          expect(closestParent).toBe("parent3");
          commitPos.clear();
        });
      }
    }
  });

  // src/diagrams/git/styles.js
  var GIT_NAMED_COLOR_COUNT, REDUX_GEOMETRY_THEMES2, COLOR_THEMES4, NEO_THEMES, DARK_THEMES2, NEO_COLOR_GEN_THEMES, genGitGraphGradient, genColor2, normalTheme, getStyles5, styles_default5;
  var init_styles5 = __esm({
    "src/diagrams/git/styles.js"() {
      "use strict";
      init_config();
      GIT_NAMED_COLOR_COUNT = 8;
      REDUX_GEOMETRY_THEMES2 = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]);
      COLOR_THEMES4 = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]);
      NEO_THEMES = /* @__PURE__ */ new Set(["neo", "neo-dark"]);
      DARK_THEMES2 = /* @__PURE__ */ new Set(["dark", "redux-dark", "redux-dark-color", "neo-dark"]);
      NEO_COLOR_GEN_THEMES = /* @__PURE__ */ new Set([
        "redux",
        "redux-dark",
        "redux-color",
        "redux-dark-color",
        "neo",
        "neo-dark"
      ]);
      genGitGraphGradient = /* @__PURE__ */ __name((options2) => {
        const { svgId } = options2;
        let sections6 = "";
        if (options2.useGradient && svgId) {
          for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
            sections6 += `
      .label${i2}  { fill: ${options2.mainBkg}; stroke: url(${svgId}-gradient); stroke-width: ${options2.strokeWidth};}
             `;
          }
        }
        return sections6;
      }, "genGitGraphGradient");
      genColor2 = /* @__PURE__ */ __name((options2) => {
        const config5 = getConfig();
        const { theme, themeVariables } = config5;
        const { borderColorArray } = themeVariables;
        const useReduxGeometry = REDUX_GEOMETRY_THEMES2.has(theme);
        if (NEO_THEMES.has(theme)) {
          let sections6 = "";
          for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
            if (i2 === 0) {
              sections6 += `
        .branch-label${i2} { fill: ${options2.nodeBorder};}
        .commit${i2} { stroke: ${options2.nodeBorder};   }
        .commit-highlight${i2} { stroke: ${options2.nodeBorder}; fill: ${options2.nodeBorder}; }
        .arrow${i2} { stroke: ${options2.nodeBorder}; }
        .commit-bullets { fill: ${options2.nodeBorder}; }
        .commit-cherry-pick${i2} { stroke: ${options2.nodeBorder}; }
        ${genGitGraphGradient(options2)}`;
            } else {
              const ci = i2 % GIT_NAMED_COLOR_COUNT;
              sections6 += `
        .branch-label${i2} { fill: ${options2["gitBranchLabel" + ci]}; }
        .commit${i2} { stroke: ${options2["git" + ci]}; fill: ${options2["git" + ci]}; }
        .commit-highlight${i2} { stroke: ${options2["gitInv" + ci]}; fill: ${options2["gitInv" + ci]}; }
        .arrow${i2} { stroke: ${options2["git" + ci]}; }
        `;
            }
          }
          return sections6;
        } else if (!COLOR_THEMES4.has(theme)) {
          let sections6 = "";
          for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
            sections6 += `
        .branch-label${i2} { fill: ${options2.nodeBorder}; ${useReduxGeometry ? `font-weight:${options2.noteFontWeight}` : ""} }
        .commit${i2} { stroke: ${options2.nodeBorder};   }
        .commit-highlight${i2} { stroke: ${options2.nodeBorder}; fill: ${options2.nodeBorder}; }
        .label${i2}  { fill: ${options2.mainBkg}; stroke: ${options2.nodeBorder}; stroke-width: ${options2.strokeWidth}; ${useReduxGeometry ? `font-weight:${options2.noteFontWeight}` : ""}}
        .arrow${i2} { stroke: ${options2.nodeBorder}; }
        .commit-bullets { fill: ${options2.nodeBorder}; }
        .commit-cherry-pick${i2} { stroke: ${options2.nodeBorder}; }
        `;
          }
          return sections6;
        } else {
          let sections6 = "";
          for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
            if (i2 === 0) {
              sections6 += `
        .branch-label${i2} { fill: ${options2.nodeBorder}; ${useReduxGeometry ? `font-weight:${options2.noteFontWeight}` : ""} }
        .commit${i2} { stroke: ${options2.nodeBorder}; }
        .commit-highlight${i2} { stroke: ${options2.nodeBorder}; fill: ${options2.mainBkg}; }
        .label${i2}  { fill: ${options2.mainBkg}; stroke: ${options2.nodeBorder}; stroke-width: ${options2.strokeWidth}; ${useReduxGeometry ? `font-weight:${options2.noteFontWeight}` : ""} }
        .arrow${i2} { stroke: ${options2.nodeBorder}; }
        .commit-bullets { fill: ${options2.nodeBorder}; }
        `;
            } else {
              const colorIndex = i2 % borderColorArray.length;
              sections6 += `
        .branch-label${i2} { fill: ${options2.nodeBorder}; ${useReduxGeometry ? `font-weight:${options2.noteFontWeight}` : ""} }
        .commit${i2} { stroke: ${borderColorArray[colorIndex]}; fill: ${borderColorArray[colorIndex]}; }
        .commit-highlight${i2} { stroke: ${borderColorArray[colorIndex]}; fill: ${borderColorArray[colorIndex]}; }
        .label${i2}  { fill: ${DARK_THEMES2.has(theme) ? options2.mainBkg : borderColorArray[colorIndex]}; stroke: ${borderColorArray[colorIndex]};  stroke-width: ${options2.strokeWidth}; }
        .arrow${i2} { stroke: ${borderColorArray[colorIndex]}; }
        `;
            }
          }
          return sections6;
        }
      }, "genColor");
      normalTheme = /* @__PURE__ */ __name((options2) => {
        return `${Array.from({ length: options2.THEME_COLOR_LIMIT }, (_3, i2) => i2).map((i2) => {
          const ci = i2 % GIT_NAMED_COLOR_COUNT;
          return `
        .branch-label${i2} { fill: ${options2["gitBranchLabel" + ci]}; }
        .commit${i2} { stroke: ${options2["git" + ci]}; fill: ${options2["git" + ci]}; }
        .commit-highlight${i2} { stroke: ${options2["gitInv" + ci]}; fill: ${options2["gitInv" + ci]}; }
        .label${i2}  { fill: ${options2["git" + ci]}; }
        .arrow${i2} { stroke: ${options2["git" + ci]}; }
        `;
        }).join("\n")}`;
      }, "normalTheme");
      getStyles5 = /* @__PURE__ */ __name((options2) => {
        const config5 = getConfig();
        const { theme } = config5;
        const useNeoColorGen = NEO_COLOR_GEN_THEMES.has(theme);
        return `
  .commit-id,
  .commit-msg,
  .branch-label {
    fill: lightgrey;
    color: lightgrey;
    font-family: 'trebuchet ms', verdana, arial, sans-serif;
    font-family: var(--mermaid-font-family);
  }
  
  ${useNeoColorGen ? genColor2(options2) : normalTheme(options2)}

  .branch {
    stroke-width: ${options2.strokeWidth};
    stroke: ${options2.commitLineColor ?? options2.lineColor};
    stroke-dasharray:  ${useNeoColorGen ? "4 2" : "2"};
  }
  .commit-label { font-size: ${options2.commitLabelFontSize}; fill: ${useNeoColorGen ? options2.nodeBorder : options2.commitLabelColor}; ${useNeoColorGen ? `font-weight:${options2.noteFontWeight};` : ""}}
  .commit-label-bkg { font-size: ${options2.commitLabelFontSize}; fill: ${useNeoColorGen ? "transparent" : options2.commitLabelBackground}; opacity: ${useNeoColorGen ? "" : 0.5};  }
  .tag-label { font-size: ${options2.tagLabelFontSize}; fill: ${options2.tagLabelColor};}
  .tag-label-bkg { fill: ${useNeoColorGen ? options2.mainBkg : options2.tagLabelBackground}; stroke: ${useNeoColorGen ? options2.nodeBorder : options2.tagLabelBorder}; ${useNeoColorGen ? `filter:${options2.dropShadow}` : ""}  }
  .tag-hole { fill: ${options2.textColor}; }

  .commit-merge {
    stroke: ${useNeoColorGen ? options2.mainBkg : options2.primaryColor};
    fill: ${useNeoColorGen ? options2.mainBkg : options2.primaryColor};
  }
  .commit-reverse {
    stroke: ${useNeoColorGen ? options2.mainBkg : options2.primaryColor};
    fill: ${useNeoColorGen ? options2.mainBkg : options2.primaryColor};
    stroke-width: ${useNeoColorGen ? options2.strokeWidth : 3};
  }
  .commit-highlight-outer {
  }
  .commit-highlight-inner {
    stroke: ${useNeoColorGen ? options2.mainBkg : options2.primaryColor};
    fill: ${useNeoColorGen ? options2.mainBkg : options2.primaryColor};
  }

  .arrow {
    /* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */
    stroke-width: ${REDUX_GEOMETRY_THEMES2.has(theme) ? options2.strokeWidth : 8};
    stroke-linecap: round;
    fill: none
  }
  .gitTitleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${options2.textColor};
  }
`;
      }, "getStyles");
      styles_default5 = getStyles5;
    }
  });

  // src/diagrams/git/gitGraphDiagram.ts
  var gitGraphDiagram_exports = {};
  __export(gitGraphDiagram_exports, {
    diagram: () => diagram4
  });
  var diagram4;
  var init_gitGraphDiagram = __esm({
    "src/diagrams/git/gitGraphDiagram.ts"() {
      "use strict";
      init_gitGraphParser();
      init_gitGraphAst();
      init_gitGraphRenderer();
      init_styles5();
      diagram4 = {
        parser: parser4,
        db,
        renderer: gitGraphRenderer_default,
        styles: styles_default5
      };
    }
  });

  // src/diagrams/gantt/parser/gantt.jison
  var parser5, gantt_default;
  var init_gantt = __esm({
    "src/diagrams/gantt/parser/gantt.jison"() {
      "use strict";
      parser5 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [6, 8, 10, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 36, 38, 40], $V1 = [1, 26], $V2 = [1, 27], $V3 = [1, 28], $V4 = [1, 29], $V5 = [1, 30], $V6 = [1, 31], $V7 = [1, 32], $V8 = [1, 33], $V9 = [1, 34], $Va = [1, 9], $Vb = [1, 10], $Vc = [1, 11], $Vd = [1, 12], $Ve = [1, 13], $Vf = [1, 14], $Vg = [1, 15], $Vh = [1, 16], $Vi = [1, 19], $Vj = [1, 20], $Vk = [1, 21], $Vl = [1, 22], $Vm = [1, 23], $Vn = [1, 25], $Vo = [1, 35];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "gantt": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NL": 10, "weekday": 11, "weekday_monday": 12, "weekday_tuesday": 13, "weekday_wednesday": 14, "weekday_thursday": 15, "weekday_friday": 16, "weekday_saturday": 17, "weekday_sunday": 18, "weekend": 19, "weekend_friday": 20, "weekend_saturday": 21, "dateFormat": 22, "inclusiveEndDates": 23, "topAxis": 24, "axisFormat": 25, "tickInterval": 26, "excludes": 27, "includes": 28, "todayMarker": 29, "title": 30, "acc_title": 31, "acc_title_value": 32, "acc_descr": 33, "acc_descr_value": 34, "acc_descr_multiline_value": 35, "section": 36, "clickStatement": 37, "taskTxt": 38, "taskData": 39, "click": 40, "callbackname": 41, "callbackargs": 42, "href": 43, "clickStatementDebug": 44, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 4: "gantt", 6: "EOF", 8: "SPACE", 10: "NL", 12: "weekday_monday", 13: "weekday_tuesday", 14: "weekday_wednesday", 15: "weekday_thursday", 16: "weekday_friday", 17: "weekday_saturday", 18: "weekday_sunday", 20: "weekend_friday", 21: "weekend_saturday", 22: "dateFormat", 23: "inclusiveEndDates", 24: "topAxis", 25: "axisFormat", 26: "tickInterval", 27: "excludes", 28: "includes", 29: "todayMarker", 30: "title", 31: "acc_title", 32: "acc_title_value", 33: "acc_descr", 34: "acc_descr_value", 35: "acc_descr_multiline_value", 36: "section", 38: "taskTxt", 39: "taskData", 40: "click", 41: "callbackname", 42: "callbackargs", 43: "href" },
          productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [19, 1], [19, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 1], [9, 2], [37, 2], [37, 3], [37, 3], [37, 4], [37, 3], [37, 4], [37, 2], [44, 2], [44, 3], [44, 3], [44, 4], [44, 3], [44, 4], [44, 2]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 1:
                return $$[$0 - 1];
                break;
              case 2:
                this.$ = [];
                break;
              case 3:
                $$[$0 - 1].push($$[$0]);
                this.$ = $$[$0 - 1];
                break;
              case 4:
              case 5:
                this.$ = $$[$0];
                break;
              case 6:
              case 7:
                this.$ = [];
                break;
              case 8:
                yy.setWeekday("monday");
                break;
              case 9:
                yy.setWeekday("tuesday");
                break;
              case 10:
                yy.setWeekday("wednesday");
                break;
              case 11:
                yy.setWeekday("thursday");
                break;
              case 12:
                yy.setWeekday("friday");
                break;
              case 13:
                yy.setWeekday("saturday");
                break;
              case 14:
                yy.setWeekday("sunday");
                break;
              case 15:
                yy.setWeekend("friday");
                break;
              case 16:
                yy.setWeekend("saturday");
                break;
              case 17:
                yy.setDateFormat($$[$0].substr(11));
                this.$ = $$[$0].substr(11);
                break;
              case 18:
                yy.enableInclusiveEndDates();
                this.$ = $$[$0].substr(18);
                break;
              case 19:
                yy.TopAxis();
                this.$ = $$[$0].substr(8);
                break;
              case 20:
                yy.setAxisFormat($$[$0].substr(11));
                this.$ = $$[$0].substr(11);
                break;
              case 21:
                yy.setTickInterval($$[$0].substr(13));
                this.$ = $$[$0].substr(13);
                break;
              case 22:
                yy.setExcludes($$[$0].substr(9));
                this.$ = $$[$0].substr(9);
                break;
              case 23:
                yy.setIncludes($$[$0].substr(9));
                this.$ = $$[$0].substr(9);
                break;
              case 24:
                yy.setTodayMarker($$[$0].substr(12));
                this.$ = $$[$0].substr(12);
                break;
              case 27:
                yy.setDiagramTitle($$[$0].substr(6));
                this.$ = $$[$0].substr(6);
                break;
              case 28:
                this.$ = $$[$0].trim();
                yy.setAccTitle(this.$);
                break;
              case 29:
              case 30:
                this.$ = $$[$0].trim();
                yy.setAccDescription(this.$);
                break;
              case 31:
                yy.addSection($$[$0].substr(8));
                this.$ = $$[$0].substr(8);
                break;
              case 33:
                yy.addTask($$[$0 - 1], $$[$0]);
                this.$ = "task";
                break;
              case 34:
                this.$ = $$[$0 - 1];
                yy.setClickEvent($$[$0 - 1], $$[$0], null);
                break;
              case 35:
                this.$ = $$[$0 - 2];
                yy.setClickEvent($$[$0 - 2], $$[$0 - 1], $$[$0]);
                break;
              case 36:
                this.$ = $$[$0 - 2];
                yy.setClickEvent($$[$0 - 2], $$[$0 - 1], null);
                yy.setLink($$[$0 - 2], $$[$0]);
                break;
              case 37:
                this.$ = $$[$0 - 3];
                yy.setClickEvent($$[$0 - 3], $$[$0 - 2], $$[$0 - 1]);
                yy.setLink($$[$0 - 3], $$[$0]);
                break;
              case 38:
                this.$ = $$[$0 - 2];
                yy.setClickEvent($$[$0 - 2], $$[$0], null);
                yy.setLink($$[$0 - 2], $$[$0 - 1]);
                break;
              case 39:
                this.$ = $$[$0 - 3];
                yy.setClickEvent($$[$0 - 3], $$[$0 - 1], $$[$0]);
                yy.setLink($$[$0 - 3], $$[$0 - 2]);
                break;
              case 40:
                this.$ = $$[$0 - 1];
                yy.setLink($$[$0 - 1], $$[$0]);
                break;
              case 41:
              case 47:
                this.$ = $$[$0 - 1] + " " + $$[$0];
                break;
              case 42:
              case 43:
              case 45:
                this.$ = $$[$0 - 2] + " " + $$[$0 - 1] + " " + $$[$0];
                break;
              case 44:
              case 46:
                this.$ = $$[$0 - 3] + " " + $$[$0 - 2] + " " + $$[$0 - 1] + " " + $$[$0];
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o2($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 17, 12: $V1, 13: $V2, 14: $V3, 15: $V4, 16: $V5, 17: $V6, 18: $V7, 19: 18, 20: $V8, 21: $V9, 22: $Va, 23: $Vb, 24: $Vc, 25: $Vd, 26: $Ve, 27: $Vf, 28: $Vg, 29: $Vh, 30: $Vi, 31: $Vj, 33: $Vk, 35: $Vl, 36: $Vm, 37: 24, 38: $Vn, 40: $Vo }, o2($V0, [2, 7], { 1: [2, 1] }), o2($V0, [2, 3]), { 9: 36, 11: 17, 12: $V1, 13: $V2, 14: $V3, 15: $V4, 16: $V5, 17: $V6, 18: $V7, 19: 18, 20: $V8, 21: $V9, 22: $Va, 23: $Vb, 24: $Vc, 25: $Vd, 26: $Ve, 27: $Vf, 28: $Vg, 29: $Vh, 30: $Vi, 31: $Vj, 33: $Vk, 35: $Vl, 36: $Vm, 37: 24, 38: $Vn, 40: $Vo }, o2($V0, [2, 5]), o2($V0, [2, 6]), o2($V0, [2, 17]), o2($V0, [2, 18]), o2($V0, [2, 19]), o2($V0, [2, 20]), o2($V0, [2, 21]), o2($V0, [2, 22]), o2($V0, [2, 23]), o2($V0, [2, 24]), o2($V0, [2, 25]), o2($V0, [2, 26]), o2($V0, [2, 27]), { 32: [1, 37] }, { 34: [1, 38] }, o2($V0, [2, 30]), o2($V0, [2, 31]), o2($V0, [2, 32]), { 39: [1, 39] }, o2($V0, [2, 8]), o2($V0, [2, 9]), o2($V0, [2, 10]), o2($V0, [2, 11]), o2($V0, [2, 12]), o2($V0, [2, 13]), o2($V0, [2, 14]), o2($V0, [2, 15]), o2($V0, [2, 16]), { 41: [1, 40], 43: [1, 41] }, o2($V0, [2, 4]), o2($V0, [2, 28]), o2($V0, [2, 29]), o2($V0, [2, 33]), o2($V0, [2, 34], { 42: [1, 42], 43: [1, 43] }), o2($V0, [2, 40], { 41: [1, 44] }), o2($V0, [2, 35], { 43: [1, 45] }), o2($V0, [2, 36]), o2($V0, [2, 38], { 42: [1, 46] }), o2($V0, [2, 37]), o2($V0, [2, 39])],
          defaultActions: {},
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  this.begin("open_directive");
                  return "open_directive";
                  break;
                case 1:
                  this.begin("acc_title");
                  return 31;
                  break;
                case 2:
                  this.popState();
                  return "acc_title_value";
                  break;
                case 3:
                  this.begin("acc_descr");
                  return 33;
                  break;
                case 4:
                  this.popState();
                  return "acc_descr_value";
                  break;
                case 5:
                  this.begin("acc_descr_multiline");
                  break;
                case 6:
                  this.popState();
                  break;
                case 7:
                  return "acc_descr_multiline_value";
                  break;
                case 8:
                  break;
                case 9:
                  break;
                case 10:
                  break;
                case 11:
                  return 10;
                  break;
                case 12:
                  break;
                case 13:
                  break;
                case 14:
                  this.begin("href");
                  break;
                case 15:
                  this.popState();
                  break;
                case 16:
                  return 43;
                  break;
                case 17:
                  this.begin("callbackname");
                  break;
                case 18:
                  this.popState();
                  break;
                case 19:
                  this.popState();
                  this.begin("callbackargs");
                  break;
                case 20:
                  return 41;
                  break;
                case 21:
                  this.popState();
                  break;
                case 22:
                  return 42;
                  break;
                case 23:
                  this.begin("click");
                  break;
                case 24:
                  this.popState();
                  break;
                case 25:
                  return 40;
                  break;
                case 26:
                  return 4;
                  break;
                case 27:
                  return 22;
                  break;
                case 28:
                  return 23;
                  break;
                case 29:
                  return 24;
                  break;
                case 30:
                  return 25;
                  break;
                case 31:
                  return 26;
                  break;
                case 32:
                  return 28;
                  break;
                case 33:
                  return 27;
                  break;
                case 34:
                  return 29;
                  break;
                case 35:
                  return 12;
                  break;
                case 36:
                  return 13;
                  break;
                case 37:
                  return 14;
                  break;
                case 38:
                  return 15;
                  break;
                case 39:
                  return 16;
                  break;
                case 40:
                  return 17;
                  break;
                case 41:
                  return 18;
                  break;
                case 42:
                  return 20;
                  break;
                case 43:
                  return 21;
                  break;
                case 44:
                  return "date";
                  break;
                case 45:
                  return 30;
                  break;
                case 46:
                  return "accDescription";
                  break;
                case 47:
                  return 36;
                  break;
                case 48:
                  return 38;
                  break;
                case 49:
                  return 39;
                  break;
                case 50:
                  return ":";
                  break;
                case 51:
                  return 6;
                  break;
                case 52:
                  return "INVALID";
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:%%\{)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:%%(?!\{)*[^\n]*)/i, /^(?:[^\}]%%*[^\n]*)/i, /^(?:%%*[^\n]*[\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:%[^\n]*)/i, /^(?:href[\s]+["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:call[\s]+)/i, /^(?:\([\s]*\))/i, /^(?:\()/i, /^(?:[^(]*)/i, /^(?:\))/i, /^(?:[^)]*)/i, /^(?:click[\s]+)/i, /^(?:[\s\n])/i, /^(?:[^\s\n]*)/i, /^(?:gantt\b)/i, /^(?:dateFormat\s[^#\n;]+)/i, /^(?:inclusiveEndDates\b)/i, /^(?:topAxis\b)/i, /^(?:axisFormat\s[^#\n;]+)/i, /^(?:tickInterval\s[^#\n;]+)/i, /^(?:includes\s[^#\n;]+)/i, /^(?:excludes\s[^#\n;]+)/i, /^(?:todayMarker\s[^\n;]+)/i, /^(?:weekday\s+monday\b)/i, /^(?:weekday\s+tuesday\b)/i, /^(?:weekday\s+wednesday\b)/i, /^(?:weekday\s+thursday\b)/i, /^(?:weekday\s+friday\b)/i, /^(?:weekday\s+saturday\b)/i, /^(?:weekday\s+sunday\b)/i, /^(?:weekend\s+friday\b)/i, /^(?:weekend\s+saturday\b)/i, /^(?:\d\d\d\d-\d\d-\d\d\b)/i, /^(?:title\s[^\n]+)/i, /^(?:accDescription\s[^#\n;]+)/i, /^(?:section\s[^\n]+)/i, /^(?:[^:\n]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i],
            conditions: { "acc_descr_multiline": { "rules": [6, 7], "inclusive": false }, "acc_descr": { "rules": [4], "inclusive": false }, "acc_title": { "rules": [2], "inclusive": false }, "callbackargs": { "rules": [21, 22], "inclusive": false }, "callbackname": { "rules": [18, 19, 20], "inclusive": false }, "href": { "rules": [15, 16], "inclusive": false }, "click": { "rules": [24, 25], "inclusive": false }, "INITIAL": { "rules": [0, 1, 3, 5, 8, 9, 10, 11, 12, 13, 14, 17, 23, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser5.parser = parser5;
      gantt_default = parser5;
    }
  });

  // ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isoWeek.js
  var require_isoWeek = __commonJS({
    "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isoWeek.js"(exports2, module2) {
      "use strict";
      !(function(e3, t4) {
        "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = t4() : "function" == typeof define && define.amd ? define(t4) : (e3 = "undefined" != typeof globalThis ? globalThis : e3 || self).dayjs_plugin_isoWeek = t4();
      })(exports2, (function() {
        "use strict";
        var e3 = "day";
        return function(t4, i2, s2) {
          var a2 = /* @__PURE__ */ __name(function(t5) {
            return t5.add(4 - t5.isoWeekday(), e3);
          }, "a"), d3 = i2.prototype;
          d3.isoWeekYear = function() {
            return a2(this).year();
          }, d3.isoWeek = function(t5) {
            if (!this.$utils().u(t5)) return this.add(7 * (t5 - this.isoWeek()), e3);
            var i3, d4, n3, o2, r2 = a2(this), u2 = (i3 = this.isoWeekYear(), d4 = this.$u, n3 = (d4 ? s2.utc : s2)().year(i3).startOf("year"), o2 = 4 - n3.isoWeekday(), n3.isoWeekday() > 4 && (o2 += 7), n3.add(o2, e3));
            return r2.diff(u2, "week") + 1;
          }, d3.isoWeekday = function(e4) {
            return this.$utils().u(e4) ? this.day() || 7 : this.day(this.day() % 7 ? e4 : e4 - 7);
          };
          var n2 = d3.startOf;
          d3.startOf = function(e4, t5) {
            var i3 = this.$utils(), s3 = !!i3.u(t5) || t5;
            return "isoweek" === i3.p(e4) ? s3 ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : n2.bind(this)(e4, t5);
          };
        };
      }));
    }
  });

  // ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/customParseFormat.js
  var require_customParseFormat = __commonJS({
    "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/customParseFormat.js"(exports2, module2) {
      "use strict";
      !(function(e3, t4) {
        "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = t4() : "function" == typeof define && define.amd ? define(t4) : (e3 = "undefined" != typeof globalThis ? globalThis : e3 || self).dayjs_plugin_customParseFormat = t4();
      })(exports2, (function() {
        "use strict";
        var e3 = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t4 = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n2 = /\d/, r2 = /\d\d/, i2 = /\d\d?/, o2 = /\d*[^-_:/,()\s\d]+/, s2 = {}, a2 = /* @__PURE__ */ __name(function(e4) {
          return (e4 = +e4) + (e4 > 68 ? 1900 : 2e3);
        }, "a");
        var f2 = /* @__PURE__ */ __name(function(e4) {
          return function(t5) {
            this[e4] = +t5;
          };
        }, "f"), h3 = [/[+-]\d\d:?(\d\d)?|Z/, function(e4) {
          (this.zone || (this.zone = {})).offset = (function(e6) {
            if (!e6) return 0;
            if ("Z" === e6) return 0;
            var t5 = e6.match(/([+-]|\d\d)/g), n3 = 60 * t5[1] + (+t5[2] || 0);
            return 0 === n3 ? 0 : "+" === t5[0] ? -n3 : n3;
          })(e4);
        }], u2 = /* @__PURE__ */ __name(function(e4) {
          var t5 = s2[e4];
          return t5 && (t5.indexOf ? t5 : t5.s.concat(t5.f));
        }, "u"), d3 = /* @__PURE__ */ __name(function(e4, t5) {
          var n3, r3 = s2.meridiem;
          if (r3) {
            for (var i3 = 1; i3 <= 24; i3 += 1) if (e4.indexOf(r3(i3, 0, t5)) > -1) {
              n3 = i3 > 12;
              break;
            }
          } else n3 = e4 === (t5 ? "pm" : "PM");
          return n3;
        }, "d"), c3 = { A: [o2, function(e4) {
          this.afternoon = d3(e4, false);
        }], a: [o2, function(e4) {
          this.afternoon = d3(e4, true);
        }], Q: [n2, function(e4) {
          this.month = 3 * (e4 - 1) + 1;
        }], S: [n2, function(e4) {
          this.milliseconds = 100 * +e4;
        }], SS: [r2, function(e4) {
          this.milliseconds = 10 * +e4;
        }], SSS: [/\d{3}/, function(e4) {
          this.milliseconds = +e4;
        }], s: [i2, f2("seconds")], ss: [i2, f2("seconds")], m: [i2, f2("minutes")], mm: [i2, f2("minutes")], H: [i2, f2("hours")], h: [i2, f2("hours")], HH: [i2, f2("hours")], hh: [i2, f2("hours")], D: [i2, f2("day")], DD: [r2, f2("day")], Do: [o2, function(e4) {
          var t5 = s2.ordinal, n3 = e4.match(/\d+/);
          if (this.day = n3[0], t5) for (var r3 = 1; r3 <= 31; r3 += 1) t5(r3).replace(/\[|\]/g, "") === e4 && (this.day = r3);
        }], w: [i2, f2("week")], ww: [r2, f2("week")], M: [i2, f2("month")], MM: [r2, f2("month")], MMM: [o2, function(e4) {
          var t5 = u2("months"), n3 = (u2("monthsShort") || t5.map((function(e6) {
            return e6.slice(0, 3);
          }))).indexOf(e4) + 1;
          if (n3 < 1) throw new Error();
          this.month = n3 % 12 || n3;
        }], MMMM: [o2, function(e4) {
          var t5 = u2("months").indexOf(e4) + 1;
          if (t5 < 1) throw new Error();
          this.month = t5 % 12 || t5;
        }], Y: [/[+-]?\d+/, f2("year")], YY: [r2, function(e4) {
          this.year = a2(e4);
        }], YYYY: [/\d{4}/, f2("year")], Z: h3, ZZ: h3 };
        function l4(n3) {
          var r3, i3;
          r3 = n3, i3 = s2 && s2.formats;
          for (var o3 = (n3 = r3.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(t5, n4, r4) {
            var o4 = r4 && r4.toUpperCase();
            return n4 || i3[r4] || e3[r4] || i3[o4].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(e4, t6, n5) {
              return t6 || n5.slice(1);
            }));
          }))).match(t4), a3 = o3.length, f3 = 0; f3 < a3; f3 += 1) {
            var h4 = o3[f3], u3 = c3[h4], d4 = u3 && u3[0], l5 = u3 && u3[1];
            o3[f3] = l5 ? { regex: d4, parser: l5 } : h4.replace(/^\[|\]$/g, "");
          }
          return function(e4) {
            for (var t5 = {}, n4 = 0, r4 = 0; n4 < a3; n4 += 1) {
              var i4 = o3[n4];
              if ("string" == typeof i4) r4 += i4.length;
              else {
                var s3 = i4.regex, f4 = i4.parser, h5 = e4.slice(r4), u4 = s3.exec(h5)[0];
                f4.call(t5, u4), e4 = e4.replace(u4, "");
              }
            }
            return (function(e6) {
              var t6 = e6.afternoon;
              if (void 0 !== t6) {
                var n5 = e6.hours;
                t6 ? n5 < 12 && (e6.hours += 12) : 12 === n5 && (e6.hours = 0), delete e6.afternoon;
              }
            })(t5), t5;
          };
        }
        __name(l4, "l");
        return function(e4, t5, n3) {
          n3.p.customParseFormat = true, e4 && e4.parseTwoDigitYear && (a2 = e4.parseTwoDigitYear);
          var r3 = t5.prototype, i3 = r3.parse;
          r3.parse = function(e6) {
            var t6 = e6.date, r4 = e6.utc, o3 = e6.args;
            this.$u = r4;
            var a3 = o3[1];
            if ("string" == typeof a3) {
              var f3 = true === o3[2], h4 = true === o3[3], u3 = f3 || h4, d4 = o3[2];
              h4 && (d4 = o3[2]), s2 = this.$locale(), !f3 && d4 && (s2 = n3.Ls[d4]), this.$d = (function(e7, t7, n4, r5) {
                try {
                  if (["x", "X"].indexOf(t7) > -1) return new Date(("X" === t7 ? 1e3 : 1) * e7);
                  var i4 = l4(t7)(e7), o4 = i4.year, s3 = i4.month, a4 = i4.day, f4 = i4.hours, h5 = i4.minutes, u4 = i4.seconds, d5 = i4.milliseconds, c5 = i4.zone, m4 = i4.week, M4 = /* @__PURE__ */ new Date(), Y3 = a4 || (o4 || s3 ? 1 : M4.getDate()), p3 = o4 || M4.getFullYear(), v3 = 0;
                  o4 && !s3 || (v3 = s3 > 0 ? s3 - 1 : M4.getMonth());
                  var D4, w4 = f4 || 0, g2 = h5 || 0, y6 = u4 || 0, L3 = d5 || 0;
                  return c5 ? new Date(Date.UTC(p3, v3, Y3, w4, g2, y6, L3 + 60 * c5.offset * 1e3)) : n4 ? new Date(Date.UTC(p3, v3, Y3, w4, g2, y6, L3)) : (D4 = new Date(p3, v3, Y3, w4, g2, y6, L3), m4 && (D4 = r5(D4).week(m4).toDate()), D4);
                } catch (e8) {
                  return /* @__PURE__ */ new Date("");
                }
              })(t6, a3, r4, n3), this.init(), d4 && true !== d4 && (this.$L = this.locale(d4).$L), u3 && t6 != this.format(a3) && (this.$d = /* @__PURE__ */ new Date("")), s2 = {};
            } else if (a3 instanceof Array) for (var c4 = a3.length, m3 = 1; m3 <= c4; m3 += 1) {
              o3[1] = a3[m3 - 1];
              var M3 = n3.apply(this, o3);
              if (M3.isValid()) {
                this.$d = M3.$d, this.$L = M3.$L, this.init();
                break;
              }
              m3 === c4 && (this.$d = /* @__PURE__ */ new Date(""));
            }
            else i3.call(this, e6);
          };
        };
      }));
    }
  });

  // ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/advancedFormat.js
  var require_advancedFormat = __commonJS({
    "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/advancedFormat.js"(exports2, module2) {
      "use strict";
      !(function(e3, t4) {
        "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = t4() : "function" == typeof define && define.amd ? define(t4) : (e3 = "undefined" != typeof globalThis ? globalThis : e3 || self).dayjs_plugin_advancedFormat = t4();
      })(exports2, (function() {
        "use strict";
        return function(e3, t4) {
          var r2 = t4.prototype, n2 = r2.format;
          r2.format = function(e4) {
            var t5 = this, r3 = this.$locale();
            if (!this.isValid()) return n2.bind(this)(e4);
            var s2 = this.$utils(), a2 = (e4 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, (function(e6) {
              switch (e6) {
                case "Q":
                  return Math.ceil((t5.$M + 1) / 3);
                case "Do":
                  return r3.ordinal(t5.$D);
                case "gggg":
                  return t5.weekYear();
                case "GGGG":
                  return t5.isoWeekYear();
                case "wo":
                  return r3.ordinal(t5.week(), "W");
                case "w":
                case "ww":
                  return s2.s(t5.week(), "w" === e6 ? 1 : 2, "0");
                case "W":
                case "WW":
                  return s2.s(t5.isoWeek(), "W" === e6 ? 1 : 2, "0");
                case "k":
                case "kk":
                  return s2.s(String(0 === t5.$H ? 24 : t5.$H), "k" === e6 ? 1 : 2, "0");
                case "X":
                  return Math.floor(t5.$d.getTime() / 1e3);
                case "x":
                  return t5.$d.getTime();
                case "z":
                  return "[" + t5.offsetName() + "]";
                case "zzz":
                  return "[" + t5.offsetName("long") + "]";
                default:
                  return e6;
              }
            }));
            return n2.bind(this)(a2);
          };
        };
      }));
    }
  });

  // src/diagrams/gantt/ganttDb.js
  function getTaskTags(data5, task, tags2) {
    let matchFound = true;
    while (matchFound) {
      matchFound = false;
      tags2.forEach(function(t4) {
        const pattern = "^\\s*" + t4 + "\\s*$";
        const regex2 = new RegExp(pattern);
        if (data5[0].match(regex2)) {
          task[t4] = true;
          data5.shift(1);
          matchFound = true;
        }
      });
    }
  }
  var import_sanitize_url4, import_dayjs2, import_isoWeek, import_customParseFormat, import_advancedFormat, WEEKEND_START_DAY, dateFormat, axisFormat, tickInterval, todayMarker, includes2, excludes, links, sections, tasks, currentSection, displayMode, tags, funs, diagramId, inclusiveEndDates, topAxis, weekday, weekend, lastOrder, clear9, setDiagramId, setAxisFormat, getAxisFormat, setTickInterval, getTickInterval, setTodayMarker, getTodayMarker, setDateFormat, enableInclusiveEndDates, endDatesAreInclusive, enableTopAxis, topAxisEnabled, setDisplayMode, getDisplayMode, getDateFormat, setIncludes, getIncludes, setExcludes, getExcludes, getLinks, addSection, getSections, getTasks, isInvalidDate, setWeekday, getWeekday, setWeekend, checkTaskDates, fixTaskDates, getStartDate, parseDuration, getEndDate, taskCnt, parseId, compileData, parseData, lastTask, lastTaskID, rawTasks, taskDb, addTask, findTaskById, addTaskOrg, compileTasks, setLink, setClass, setClickFun, pushFun, setClickEvent, bindFunctions, ganttDb_default;
  var init_ganttDb = __esm({
    "src/diagrams/gantt/ganttDb.js"() {
      "use strict";
      import_sanitize_url4 = __toESM(require_dist(), 1);
      import_dayjs2 = __toESM(require_dayjs_min(), 1);
      import_isoWeek = __toESM(require_isoWeek(), 1);
      import_customParseFormat = __toESM(require_customParseFormat(), 1);
      import_advancedFormat = __toESM(require_advancedFormat(), 1);
      init_logger();
      init_diagramAPI();
      init_utils2();
      init_commonDb();
      import_dayjs2.default.extend(import_isoWeek.default);
      import_dayjs2.default.extend(import_customParseFormat.default);
      import_dayjs2.default.extend(import_advancedFormat.default);
      WEEKEND_START_DAY = { friday: 5, saturday: 6 };
      dateFormat = "";
      axisFormat = "";
      tickInterval = void 0;
      todayMarker = "";
      includes2 = [];
      excludes = [];
      links = /* @__PURE__ */ new Map();
      sections = [];
      tasks = [];
      currentSection = "";
      displayMode = "";
      tags = ["active", "done", "crit", "milestone", "vert"];
      funs = [];
      diagramId = "";
      inclusiveEndDates = false;
      topAxis = false;
      weekday = "sunday";
      weekend = "saturday";
      lastOrder = 0;
      clear9 = /* @__PURE__ */ __name(function() {
        sections = [];
        tasks = [];
        currentSection = "";
        funs = [];
        taskCnt = 0;
        lastTask = void 0;
        lastTaskID = void 0;
        rawTasks = [];
        dateFormat = "";
        axisFormat = "";
        displayMode = "";
        tickInterval = void 0;
        todayMarker = "";
        includes2 = [];
        excludes = [];
        inclusiveEndDates = false;
        topAxis = false;
        lastOrder = 0;
        links = /* @__PURE__ */ new Map();
        diagramId = "";
        clear();
        weekday = "sunday";
        weekend = "saturday";
      }, "clear");
      setDiagramId = /* @__PURE__ */ __name(function(id34) {
        diagramId = id34;
      }, "setDiagramId");
      setAxisFormat = /* @__PURE__ */ __name(function(txt) {
        axisFormat = txt;
      }, "setAxisFormat");
      getAxisFormat = /* @__PURE__ */ __name(function() {
        return axisFormat;
      }, "getAxisFormat");
      setTickInterval = /* @__PURE__ */ __name(function(txt) {
        tickInterval = txt;
      }, "setTickInterval");
      getTickInterval = /* @__PURE__ */ __name(function() {
        return tickInterval;
      }, "getTickInterval");
      setTodayMarker = /* @__PURE__ */ __name(function(txt) {
        todayMarker = txt;
      }, "setTodayMarker");
      getTodayMarker = /* @__PURE__ */ __name(function() {
        return todayMarker;
      }, "getTodayMarker");
      setDateFormat = /* @__PURE__ */ __name(function(txt) {
        dateFormat = txt;
      }, "setDateFormat");
      enableInclusiveEndDates = /* @__PURE__ */ __name(function() {
        inclusiveEndDates = true;
      }, "enableInclusiveEndDates");
      endDatesAreInclusive = /* @__PURE__ */ __name(function() {
        return inclusiveEndDates;
      }, "endDatesAreInclusive");
      enableTopAxis = /* @__PURE__ */ __name(function() {
        topAxis = true;
      }, "enableTopAxis");
      topAxisEnabled = /* @__PURE__ */ __name(function() {
        return topAxis;
      }, "topAxisEnabled");
      setDisplayMode = /* @__PURE__ */ __name(function(txt) {
        displayMode = txt;
      }, "setDisplayMode");
      getDisplayMode = /* @__PURE__ */ __name(function() {
        return displayMode;
      }, "getDisplayMode");
      getDateFormat = /* @__PURE__ */ __name(function() {
        return dateFormat;
      }, "getDateFormat");
      setIncludes = /* @__PURE__ */ __name(function(txt) {
        includes2 = txt.toLowerCase().split(/[\s,]+/);
      }, "setIncludes");
      getIncludes = /* @__PURE__ */ __name(function() {
        return includes2;
      }, "getIncludes");
      setExcludes = /* @__PURE__ */ __name(function(txt) {
        excludes = txt.toLowerCase().split(/[\s,]+/);
      }, "setExcludes");
      getExcludes = /* @__PURE__ */ __name(function() {
        return excludes;
      }, "getExcludes");
      getLinks = /* @__PURE__ */ __name(function() {
        return links;
      }, "getLinks");
      addSection = /* @__PURE__ */ __name(function(txt) {
        currentSection = txt;
        sections.push(txt);
      }, "addSection");
      getSections = /* @__PURE__ */ __name(function() {
        return sections;
      }, "getSections");
      getTasks = /* @__PURE__ */ __name(function() {
        let allItemsProcessed = compileTasks();
        const maxDepth = 10;
        let iterationCount = 0;
        while (!allItemsProcessed && iterationCount < maxDepth) {
          allItemsProcessed = compileTasks();
          iterationCount++;
        }
        tasks = rawTasks;
        return tasks;
      }, "getTasks");
      isInvalidDate = /* @__PURE__ */ __name(function(date2, dateFormat2, excludes2, includes3) {
        const formattedDate = date2.format(dateFormat2.trim());
        const dateOnly = date2.format("YYYY-MM-DD");
        if (includes3.includes(formattedDate) || includes3.includes(dateOnly)) {
          return false;
        }
        if (excludes2.includes("weekends") && (date2.isoWeekday() === WEEKEND_START_DAY[weekend] || date2.isoWeekday() === WEEKEND_START_DAY[weekend] + 1)) {
          return true;
        }
        if (excludes2.includes(date2.format("dddd").toLowerCase())) {
          return true;
        }
        return excludes2.includes(formattedDate) || excludes2.includes(dateOnly);
      }, "isInvalidDate");
      setWeekday = /* @__PURE__ */ __name(function(txt) {
        weekday = txt;
      }, "setWeekday");
      getWeekday = /* @__PURE__ */ __name(function() {
        return weekday;
      }, "getWeekday");
      setWeekend = /* @__PURE__ */ __name(function(startDay) {
        weekend = startDay;
      }, "setWeekend");
      checkTaskDates = /* @__PURE__ */ __name(function(task, dateFormat2, excludes2, includes3) {
        if (!excludes2.length || task.manualEndTime) {
          return;
        }
        let startTime;
        if (task.startTime instanceof Date) {
          startTime = (0, import_dayjs2.default)(task.startTime);
        } else {
          startTime = (0, import_dayjs2.default)(task.startTime, dateFormat2, true);
        }
        startTime = startTime.add(1, "d");
        let originalEndTime;
        if (task.endTime instanceof Date) {
          originalEndTime = (0, import_dayjs2.default)(task.endTime);
        } else {
          originalEndTime = (0, import_dayjs2.default)(task.endTime, dateFormat2, true);
        }
        const [fixedEndTime, renderEndTime] = fixTaskDates(
          startTime,
          originalEndTime,
          dateFormat2,
          excludes2,
          includes3
        );
        task.endTime = fixedEndTime.toDate();
        task.renderEndTime = renderEndTime;
      }, "checkTaskDates");
      fixTaskDates = /* @__PURE__ */ __name(function(startTime, endTime, dateFormat2, excludes2, includes3) {
        let invalid = false;
        let renderEndTime = null;
        while (startTime <= endTime) {
          if (!invalid) {
            renderEndTime = endTime.toDate();
          }
          invalid = isInvalidDate(startTime, dateFormat2, excludes2, includes3);
          if (invalid) {
            endTime = endTime.add(1, "d");
          }
          startTime = startTime.add(1, "d");
        }
        return [endTime, renderEndTime];
      }, "fixTaskDates");
      getStartDate = /* @__PURE__ */ __name(function(prevTime, dateFormat2, str2) {
        str2 = str2.trim();
        const isTimestampFormat = /* @__PURE__ */ __name((format3) => {
          const trimmedFormat = format3.trim();
          return trimmedFormat === "x" || trimmedFormat === "X";
        }, "isTimestampFormat");
        if (isTimestampFormat(dateFormat2) && /^\d+$/.test(str2)) {
          return new Date(Number(str2));
        }
        const afterRePattern = /^after\s+(?<ids>[\d\w- ]+)/;
        const afterStatement = afterRePattern.exec(str2);
        if (afterStatement !== null) {
          let latestTask = null;
          for (const id34 of afterStatement.groups.ids.split(" ")) {
            let task = findTaskById(id34);
            if (task !== void 0 && (!latestTask || task.endTime > latestTask.endTime)) {
              latestTask = task;
            }
          }
          if (latestTask) {
            return latestTask.endTime;
          }
          const today = /* @__PURE__ */ new Date();
          today.setHours(0, 0, 0, 0);
          return today;
        }
        let mDate = (0, import_dayjs2.default)(str2, dateFormat2.trim(), true);
        if (mDate.isValid()) {
          return mDate.toDate();
        } else {
          log.debug("Invalid date:" + str2);
          log.debug("With date format:" + dateFormat2.trim());
          const d3 = new Date(str2);
          if (d3 === void 0 || isNaN(d3.getTime()) || // WebKit browsers can mis-parse invalid dates to be ridiculously
          // huge numbers, e.g. new Date('202304') gets parsed as January 1, 202304.
          // This can cause virtually infinite loops while rendering, so for the
          // purposes of Gantt charts we'll just treat any date beyond 10,000 AD/BC as
          // invalid.
          d3.getFullYear() < -1e4 || d3.getFullYear() > 1e4) {
            throw new Error("Invalid date:" + str2);
          }
          return d3;
        }
      }, "getStartDate");
      parseDuration = /* @__PURE__ */ __name(function(str2) {
        const statement = /^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(str2.trim());
        if (statement !== null) {
          return [Number.parseFloat(statement[1]), statement[2]];
        }
        return [NaN, "ms"];
      }, "parseDuration");
      getEndDate = /* @__PURE__ */ __name(function(prevTime, dateFormat2, str2, inclusive = false) {
        str2 = str2.trim();
        const untilRePattern = /^until\s+(?<ids>[\d\w- ]+)/;
        const untilStatement = untilRePattern.exec(str2);
        if (untilStatement !== null) {
          let earliestTask = null;
          for (const id34 of untilStatement.groups.ids.split(" ")) {
            let task = findTaskById(id34);
            if (task !== void 0 && (!earliestTask || task.startTime < earliestTask.startTime)) {
              earliestTask = task;
            }
          }
          if (earliestTask) {
            return earliestTask.startTime;
          }
          const today = /* @__PURE__ */ new Date();
          today.setHours(0, 0, 0, 0);
          return today;
        }
        let parsedDate = (0, import_dayjs2.default)(str2, dateFormat2.trim(), true);
        if (parsedDate.isValid()) {
          if (inclusive) {
            parsedDate = parsedDate.add(1, "d");
          }
          return parsedDate.toDate();
        }
        let endTime = (0, import_dayjs2.default)(prevTime);
        const [durationValue, durationUnit] = parseDuration(str2);
        if (!Number.isNaN(durationValue)) {
          const newEndTime = endTime.add(durationValue, durationUnit);
          if (newEndTime.isValid()) {
            endTime = newEndTime;
          }
        }
        return endTime.toDate();
      }, "getEndDate");
      taskCnt = 0;
      parseId = /* @__PURE__ */ __name(function(idStr) {
        if (idStr === void 0) {
          taskCnt = taskCnt + 1;
          return "task" + taskCnt;
        }
        return idStr;
      }, "parseId");
      compileData = /* @__PURE__ */ __name(function(prevTask, dataStr) {
        let ds;
        if (dataStr.substr(0, 1) === ":") {
          ds = dataStr.substr(1, dataStr.length);
        } else {
          ds = dataStr;
        }
        const data5 = ds.split(",");
        const task = {};
        getTaskTags(data5, task, tags);
        for (let i2 = 0; i2 < data5.length; i2++) {
          data5[i2] = data5[i2].trim();
        }
        let endTimeData = "";
        switch (data5.length) {
          case 1:
            task.id = parseId();
            task.startTime = prevTask.endTime;
            endTimeData = data5[0];
            break;
          case 2:
            task.id = parseId();
            task.startTime = getStartDate(void 0, dateFormat, data5[0]);
            endTimeData = data5[1];
            break;
          case 3:
            task.id = parseId(data5[0]);
            task.startTime = getStartDate(void 0, dateFormat, data5[1]);
            endTimeData = data5[2];
            break;
          default:
        }
        if (endTimeData) {
          task.endTime = getEndDate(task.startTime, dateFormat, endTimeData, inclusiveEndDates);
          task.manualEndTime = (0, import_dayjs2.default)(endTimeData, "YYYY-MM-DD", true).isValid();
          checkTaskDates(task, dateFormat, excludes, includes2);
        }
        return task;
      }, "compileData");
      parseData = /* @__PURE__ */ __name(function(prevTaskId, dataStr) {
        let ds;
        if (dataStr.substr(0, 1) === ":") {
          ds = dataStr.substr(1, dataStr.length);
        } else {
          ds = dataStr;
        }
        const data5 = ds.split(",");
        const task = {};
        getTaskTags(data5, task, tags);
        for (let i2 = 0; i2 < data5.length; i2++) {
          data5[i2] = data5[i2].trim();
        }
        switch (data5.length) {
          case 1:
            task.id = parseId();
            task.startTime = {
              type: "prevTaskEnd",
              id: prevTaskId
            };
            task.endTime = {
              data: data5[0]
            };
            break;
          case 2:
            task.id = parseId();
            task.startTime = {
              type: "getStartDate",
              startData: data5[0]
            };
            task.endTime = {
              data: data5[1]
            };
            break;
          case 3:
            task.id = parseId(data5[0]);
            task.startTime = {
              type: "getStartDate",
              startData: data5[1]
            };
            task.endTime = {
              data: data5[2]
            };
            break;
          default:
        }
        return task;
      }, "parseData");
      rawTasks = [];
      taskDb = {};
      addTask = /* @__PURE__ */ __name(function(descr, data5) {
        const rawTask = {
          section: currentSection,
          type: currentSection,
          processed: false,
          manualEndTime: false,
          renderEndTime: null,
          raw: { data: data5 },
          task: descr,
          classes: []
        };
        const taskInfo = parseData(lastTaskID, data5);
        rawTask.raw.startTime = taskInfo.startTime;
        rawTask.raw.endTime = taskInfo.endTime;
        rawTask.id = taskInfo.id;
        rawTask.prevTaskId = lastTaskID;
        rawTask.active = taskInfo.active;
        rawTask.done = taskInfo.done;
        rawTask.crit = taskInfo.crit;
        rawTask.milestone = taskInfo.milestone;
        rawTask.vert = taskInfo.vert;
        rawTask.order = lastOrder;
        lastOrder++;
        const pos = rawTasks.push(rawTask);
        lastTaskID = rawTask.id;
        taskDb[rawTask.id] = pos - 1;
      }, "addTask");
      findTaskById = /* @__PURE__ */ __name(function(id34) {
        const pos = taskDb[id34];
        return rawTasks[pos];
      }, "findTaskById");
      addTaskOrg = /* @__PURE__ */ __name(function(descr, data5) {
        const newTask = {
          section: currentSection,
          type: currentSection,
          description: descr,
          task: descr,
          classes: []
        };
        const taskInfo = compileData(lastTask, data5);
        newTask.startTime = taskInfo.startTime;
        newTask.endTime = taskInfo.endTime;
        newTask.id = taskInfo.id;
        newTask.active = taskInfo.active;
        newTask.done = taskInfo.done;
        newTask.crit = taskInfo.crit;
        newTask.milestone = taskInfo.milestone;
        newTask.vert = taskInfo.vert;
        lastTask = newTask;
        tasks.push(newTask);
      }, "addTaskOrg");
      compileTasks = /* @__PURE__ */ __name(function() {
        const compileTask = /* @__PURE__ */ __name(function(pos) {
          const task = rawTasks[pos];
          let startTime = "";
          switch (rawTasks[pos].raw.startTime.type) {
            case "prevTaskEnd": {
              const prevTask = findTaskById(task.prevTaskId);
              task.startTime = prevTask.endTime;
              break;
            }
            case "getStartDate":
              startTime = getStartDate(void 0, dateFormat, rawTasks[pos].raw.startTime.startData);
              if (startTime) {
                rawTasks[pos].startTime = startTime;
              }
              break;
          }
          if (rawTasks[pos].startTime) {
            rawTasks[pos].endTime = getEndDate(
              rawTasks[pos].startTime,
              dateFormat,
              rawTasks[pos].raw.endTime.data,
              inclusiveEndDates
            );
            if (rawTasks[pos].endTime) {
              rawTasks[pos].processed = true;
              rawTasks[pos].manualEndTime = (0, import_dayjs2.default)(
                rawTasks[pos].raw.endTime.data,
                "YYYY-MM-DD",
                true
              ).isValid();
              checkTaskDates(rawTasks[pos], dateFormat, excludes, includes2);
            }
          }
          return rawTasks[pos].processed;
        }, "compileTask");
        let allProcessed = true;
        for (const [i2, rawTask] of rawTasks.entries()) {
          compileTask(i2);
          allProcessed = allProcessed && rawTask.processed;
        }
        return allProcessed;
      }, "compileTasks");
      setLink = /* @__PURE__ */ __name(function(ids, _linkStr) {
        let linkStr = _linkStr;
        if (getConfig2().securityLevel !== "loose") {
          linkStr = (0, import_sanitize_url4.sanitizeUrl)(_linkStr);
        }
        ids.split(",").forEach(function(id34) {
          let rawTask = findTaskById(id34);
          if (rawTask !== void 0) {
            pushFun(id34, () => {
              window.open(linkStr, "_self");
            });
            links.set(id34, linkStr);
          }
        });
        setClass(ids, "clickable");
      }, "setLink");
      setClass = /* @__PURE__ */ __name(function(ids, className) {
        ids.split(",").forEach(function(id34) {
          let rawTask = findTaskById(id34);
          if (rawTask !== void 0) {
            rawTask.classes.push(className);
          }
        });
      }, "setClass");
      setClickFun = /* @__PURE__ */ __name(function(id34, functionName, functionArgs) {
        if (getConfig2().securityLevel !== "loose") {
          return;
        }
        if (functionName === void 0) {
          return;
        }
        let argList = [];
        if (typeof functionArgs === "string") {
          argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
          for (let i2 = 0; i2 < argList.length; i2++) {
            let item = argList[i2].trim();
            if (item.startsWith('"') && item.endsWith('"')) {
              item = item.substr(1, item.length - 2);
            }
            argList[i2] = item;
          }
        }
        if (argList.length === 0) {
          argList.push(id34);
        }
        let rawTask = findTaskById(id34);
        if (rawTask !== void 0) {
          pushFun(id34, () => {
            utils_default2.runFunc(functionName, ...argList);
          });
        }
      }, "setClickFun");
      pushFun = /* @__PURE__ */ __name(function(id34, callbackFunction) {
        funs.push(
          function() {
            const prefixedId = diagramId ? `${diagramId}-${id34}` : id34;
            const elem = document.querySelector(`[id="${prefixedId}"]`);
            if (elem !== null) {
              elem.addEventListener("click", function() {
                callbackFunction();
              });
            }
          },
          function() {
            const prefixedId = diagramId ? `${diagramId}-${id34}` : id34;
            const elem = document.querySelector(`[id="${prefixedId}-text"]`);
            if (elem !== null) {
              elem.addEventListener("click", function() {
                callbackFunction();
              });
            }
          }
        );
      }, "pushFun");
      setClickEvent = /* @__PURE__ */ __name(function(ids, functionName, functionArgs) {
        ids.split(",").forEach(function(id34) {
          setClickFun(id34, functionName, functionArgs);
        });
        setClass(ids, "clickable");
      }, "setClickEvent");
      bindFunctions = /* @__PURE__ */ __name(function(element3) {
        funs.forEach(function(fun) {
          fun(element3);
        });
      }, "bindFunctions");
      ganttDb_default = {
        getConfig: /* @__PURE__ */ __name(() => getConfig2().gantt, "getConfig"),
        clear: clear9,
        setDateFormat,
        getDateFormat,
        enableInclusiveEndDates,
        endDatesAreInclusive,
        enableTopAxis,
        topAxisEnabled,
        setAxisFormat,
        getAxisFormat,
        setTickInterval,
        getTickInterval,
        setTodayMarker,
        getTodayMarker,
        setAccTitle,
        getAccTitle,
        setDiagramTitle,
        getDiagramTitle,
        setDiagramId,
        setDisplayMode,
        getDisplayMode,
        setAccDescription,
        getAccDescription,
        addSection,
        getSections,
        getTasks,
        addTask,
        findTaskById,
        addTaskOrg,
        setIncludes,
        getIncludes,
        setExcludes,
        getExcludes,
        setClickEvent,
        setLink,
        getLinks,
        bindFunctions,
        parseDuration,
        isInvalidDate,
        setWeekday,
        getWeekday,
        setWeekend
      };
      __name(getTaskTags, "getTaskTags");
    }
  });

  // ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/duration.js
  var require_duration = __commonJS({
    "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/duration.js"(exports2, module2) {
      "use strict";
      !(function(t4, s2) {
        "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = s2() : "function" == typeof define && define.amd ? define(s2) : (t4 = "undefined" != typeof globalThis ? globalThis : t4 || self).dayjs_plugin_duration = s2();
      })(exports2, (function() {
        "use strict";
        var t4, s2, n2 = 1e3, i2 = 6e4, e3 = 36e5, r2 = 864e5, o2 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, u2 = 31536e6, d3 = 2628e6, a2 = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, h3 = { years: u2, months: d3, days: r2, hours: e3, minutes: i2, seconds: n2, milliseconds: 1, weeks: 6048e5 }, c3 = /* @__PURE__ */ __name(function(t5) {
          return t5 instanceof g2;
        }, "c"), f2 = /* @__PURE__ */ __name(function(t5, s3, n3) {
          return new g2(t5, n3, s3.$l);
        }, "f"), m3 = /* @__PURE__ */ __name(function(t5) {
          return s2.p(t5) + "s";
        }, "m"), l4 = /* @__PURE__ */ __name(function(t5) {
          return t5 < 0;
        }, "l"), $4 = /* @__PURE__ */ __name(function(t5) {
          return l4(t5) ? Math.ceil(t5) : Math.floor(t5);
        }, "$"), y6 = /* @__PURE__ */ __name(function(t5) {
          return Math.abs(t5);
        }, "y"), v3 = /* @__PURE__ */ __name(function(t5, s3) {
          return t5 ? l4(t5) ? { negative: true, format: "" + y6(t5) + s3 } : { negative: false, format: "" + t5 + s3 } : { negative: false, format: "" };
        }, "v"), g2 = (function() {
          function l5(t5, s3, n3) {
            var i3 = this;
            if (this.$d = {}, this.$l = n3, void 0 === t5 && (this.$ms = 0, this.parseFromMilliseconds()), s3) return f2(t5 * h3[m3(s3)], this);
            if ("number" == typeof t5) return this.$ms = t5, this.parseFromMilliseconds(), this;
            if ("object" == typeof t5) return Object.keys(t5).forEach((function(s4) {
              i3.$d[m3(s4)] = t5[s4];
            })), this.calMilliseconds(), this;
            if ("string" == typeof t5) {
              var e4 = t5.match(a2);
              if (e4) {
                var r3 = e4.slice(2).map((function(t6) {
                  return null != t6 ? Number(t6) : 0;
                }));
                return this.$d.years = r3[0], this.$d.months = r3[1], this.$d.weeks = r3[2], this.$d.days = r3[3], this.$d.hours = r3[4], this.$d.minutes = r3[5], this.$d.seconds = r3[6], this.calMilliseconds(), this;
              }
            }
            return this;
          }
          __name(l5, "l");
          var y7 = l5.prototype;
          return y7.calMilliseconds = function() {
            var t5 = this;
            this.$ms = Object.keys(this.$d).reduce((function(s3, n3) {
              return s3 + (t5.$d[n3] || 0) * h3[n3];
            }), 0);
          }, y7.parseFromMilliseconds = function() {
            var t5 = this.$ms;
            this.$d.years = $4(t5 / u2), t5 %= u2, this.$d.months = $4(t5 / d3), t5 %= d3, this.$d.days = $4(t5 / r2), t5 %= r2, this.$d.hours = $4(t5 / e3), t5 %= e3, this.$d.minutes = $4(t5 / i2), t5 %= i2, this.$d.seconds = $4(t5 / n2), t5 %= n2, this.$d.milliseconds = t5;
          }, y7.toISOString = function() {
            var t5 = v3(this.$d.years, "Y"), s3 = v3(this.$d.months, "M"), n3 = +this.$d.days || 0;
            this.$d.weeks && (n3 += 7 * this.$d.weeks);
            var i3 = v3(n3, "D"), e4 = v3(this.$d.hours, "H"), r3 = v3(this.$d.minutes, "M"), o3 = this.$d.seconds || 0;
            this.$d.milliseconds && (o3 += this.$d.milliseconds / 1e3, o3 = Math.round(1e3 * o3) / 1e3);
            var u3 = v3(o3, "S"), d4 = t5.negative || s3.negative || i3.negative || e4.negative || r3.negative || u3.negative, a3 = e4.format || r3.format || u3.format ? "T" : "", h4 = (d4 ? "-" : "") + "P" + t5.format + s3.format + i3.format + a3 + e4.format + r3.format + u3.format;
            return "P" === h4 || "-P" === h4 ? "P0D" : h4;
          }, y7.toJSON = function() {
            return this.toISOString();
          }, y7.format = function(t5) {
            var n3 = t5 || "YYYY-MM-DDTHH:mm:ss", i3 = { Y: this.$d.years, YY: s2.s(this.$d.years, 2, "0"), YYYY: s2.s(this.$d.years, 4, "0"), M: this.$d.months, MM: s2.s(this.$d.months, 2, "0"), D: this.$d.days, DD: s2.s(this.$d.days, 2, "0"), H: this.$d.hours, HH: s2.s(this.$d.hours, 2, "0"), m: this.$d.minutes, mm: s2.s(this.$d.minutes, 2, "0"), s: this.$d.seconds, ss: s2.s(this.$d.seconds, 2, "0"), SSS: s2.s(this.$d.milliseconds, 3, "0") };
            return n3.replace(o2, (function(t6, s3) {
              return s3 || String(i3[t6]);
            }));
          }, y7.as = function(t5) {
            return this.$ms / h3[m3(t5)];
          }, y7.get = function(t5) {
            var s3 = this.$ms, n3 = m3(t5);
            return "milliseconds" === n3 ? s3 %= 1e3 : s3 = "weeks" === n3 ? $4(s3 / h3[n3]) : this.$d[n3], s3 || 0;
          }, y7.add = function(t5, s3, n3) {
            var i3;
            return i3 = s3 ? t5 * h3[m3(s3)] : c3(t5) ? t5.$ms : f2(t5, this).$ms, f2(this.$ms + i3 * (n3 ? -1 : 1), this);
          }, y7.subtract = function(t5, s3) {
            return this.add(t5, s3, true);
          }, y7.locale = function(t5) {
            var s3 = this.clone();
            return s3.$l = t5, s3;
          }, y7.clone = function() {
            return f2(this.$ms, this);
          }, y7.humanize = function(s3) {
            return t4().add(this.$ms, "ms").locale(this.$l).fromNow(!s3);
          }, y7.valueOf = function() {
            return this.asMilliseconds();
          }, y7.milliseconds = function() {
            return this.get("milliseconds");
          }, y7.asMilliseconds = function() {
            return this.as("milliseconds");
          }, y7.seconds = function() {
            return this.get("seconds");
          }, y7.asSeconds = function() {
            return this.as("seconds");
          }, y7.minutes = function() {
            return this.get("minutes");
          }, y7.asMinutes = function() {
            return this.as("minutes");
          }, y7.hours = function() {
            return this.get("hours");
          }, y7.asHours = function() {
            return this.as("hours");
          }, y7.days = function() {
            return this.get("days");
          }, y7.asDays = function() {
            return this.as("days");
          }, y7.weeks = function() {
            return this.get("weeks");
          }, y7.asWeeks = function() {
            return this.as("weeks");
          }, y7.months = function() {
            return this.get("months");
          }, y7.asMonths = function() {
            return this.as("months");
          }, y7.years = function() {
            return this.get("years");
          }, y7.asYears = function() {
            return this.as("years");
          }, l5;
        })(), p3 = /* @__PURE__ */ __name(function(t5, s3, n3) {
          return t5.add(s3.years() * n3, "y").add(s3.months() * n3, "M").add(s3.days() * n3, "d").add(s3.hours() * n3, "h").add(s3.minutes() * n3, "m").add(s3.seconds() * n3, "s").add(s3.milliseconds() * n3, "ms");
        }, "p");
        return function(n3, i3, e4) {
          t4 = e4, s2 = e4().$utils(), e4.duration = function(t5, s3) {
            var n4 = e4.locale();
            return f2(t5, { $l: n4 }, s3);
          }, e4.isDuration = c3;
          var r3 = i3.prototype.add, o3 = i3.prototype.subtract;
          i3.prototype.add = function(t5, s3) {
            return c3(t5) ? p3(this, t5, 1) : r3.bind(this)(t5, s3);
          }, i3.prototype.subtract = function(t5, s3) {
            return c3(t5) ? p3(this, t5, -1) : o3.bind(this)(t5, s3);
          };
        };
      }));
    }
  });

  // src/diagrams/gantt/ganttRenderer.js
  var import_dayjs3, import_duration8, setConf2, mapWeekdayToTimeFunction, getMaxIntersections, w3, MAX_TICK_COUNT, draw5, ganttRenderer_default;
  var init_ganttRenderer = __esm({
    "src/diagrams/gantt/ganttRenderer.js"() {
      "use strict";
      import_dayjs3 = __toESM(require_dayjs_min(), 1);
      import_duration8 = __toESM(require_duration(), 1);
      init_logger();
      init_src32();
      init_common();
      init_diagramAPI();
      init_setupGraphViewbox();
      import_dayjs3.default.extend(import_duration8.default);
      setConf2 = /* @__PURE__ */ __name(function() {
        log.debug("Something is calling, setConf, remove the call");
      }, "setConf");
      mapWeekdayToTimeFunction = {
        monday: timeMonday,
        tuesday: timeTuesday,
        wednesday: timeWednesday,
        thursday: timeThursday,
        friday: timeFriday,
        saturday: timeSaturday,
        sunday: timeSunday
      };
      getMaxIntersections = /* @__PURE__ */ __name((tasks4, orderOffset) => {
        let timeline = [...tasks4].map(() => -Infinity);
        let sorted = [...tasks4].sort((a2, b3) => a2.startTime - b3.startTime || a2.order - b3.order);
        let maxIntersections = 0;
        for (const element3 of sorted) {
          for (let j3 = 0; j3 < timeline.length; j3++) {
            if (element3.startTime >= timeline[j3]) {
              timeline[j3] = element3.endTime;
              element3.order = j3 + orderOffset;
              if (j3 > maxIntersections) {
                maxIntersections = j3;
              }
              break;
            }
          }
        }
        return maxIntersections;
      }, "getMaxIntersections");
      MAX_TICK_COUNT = 1e4;
      draw5 = /* @__PURE__ */ __name(function(text4, id34, version3, diagObj) {
        const conf5 = getConfig2().gantt;
        diagObj.db.setDiagramId(id34);
        const securityLevel = getConfig2().securityLevel;
        let sandboxElement;
        if (securityLevel === "sandbox") {
          sandboxElement = select_default2("#i" + id34);
        }
        const root3 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body");
        const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
        const elem = doc.getElementById(id34);
        w3 = elem.parentElement.offsetWidth;
        if (w3 === void 0) {
          w3 = 1200;
        }
        if (conf5.useWidth !== void 0) {
          w3 = conf5.useWidth;
        }
        const taskArray = diagObj.db.getTasks();
        let categories = [];
        for (const element3 of taskArray) {
          categories.push(element3.type);
        }
        categories = checkUnique(categories);
        const categoryHeights = {};
        let h3 = 2 * conf5.topPadding;
        if (diagObj.db.getDisplayMode() === "compact" || conf5.displayMode === "compact") {
          const categoryElements = {};
          for (const element3 of taskArray) {
            if (categoryElements[element3.section] === void 0) {
              categoryElements[element3.section] = [element3];
            } else {
              categoryElements[element3.section].push(element3);
            }
          }
          let intersections = 0;
          for (const category of Object.keys(categoryElements)) {
            const categoryHeight = getMaxIntersections(categoryElements[category], intersections) + 1;
            intersections += categoryHeight;
            h3 += categoryHeight * (conf5.barHeight + conf5.barGap);
            categoryHeights[category] = categoryHeight;
          }
        } else {
          h3 += taskArray.length * (conf5.barHeight + conf5.barGap);
          for (const category of categories) {
            categoryHeights[category] = taskArray.filter((task) => task.type === category).length;
          }
        }
        elem.setAttribute("viewBox", "0 0 " + w3 + " " + h3);
        const svg2 = root3.select(`[id="${id34}"]`);
        const timeScale = time().domain([
          min(taskArray, function(d3) {
            return d3.startTime;
          }),
          max(taskArray, function(d3) {
            return d3.endTime;
          })
        ]).rangeRound([0, w3 - conf5.leftPadding - conf5.rightPadding]);
        function taskCompare(a2, b3) {
          const taskA = a2.startTime;
          const taskB = b3.startTime;
          let result = 0;
          if (taskA > taskB) {
            result = 1;
          } else if (taskA < taskB) {
            result = -1;
          }
          return result;
        }
        __name(taskCompare, "taskCompare");
        taskArray.sort(taskCompare);
        makeGantt(taskArray, w3, h3);
        configureSvgSize(svg2, h3, w3, conf5.useMaxWidth);
        svg2.append("text").text(diagObj.db.getDiagramTitle()).attr("x", w3 / 2).attr("y", conf5.titleTopMargin).attr("class", "titleText");
        function makeGantt(tasks4, pageWidth, pageHeight) {
          const barHeight = conf5.barHeight;
          const gap = barHeight + conf5.barGap;
          const topPadding = conf5.topPadding;
          const leftPadding = conf5.leftPadding;
          const colorScale = linear2().domain([0, categories.length]).range(["#00B9FA", "#F95002"]).interpolate(hcl_default);
          drawExcludeDays(
            gap,
            topPadding,
            leftPadding,
            pageWidth,
            pageHeight,
            tasks4,
            diagObj.db.getExcludes(),
            diagObj.db.getIncludes()
          );
          makeGrid(leftPadding, topPadding, pageWidth, pageHeight);
          drawRects(tasks4, gap, topPadding, leftPadding, barHeight, colorScale, pageWidth, pageHeight);
          vertLabels(gap, topPadding, leftPadding, barHeight, colorScale);
          drawToday(leftPadding, topPadding, pageWidth, pageHeight);
        }
        __name(makeGantt, "makeGantt");
        function drawRects(theArray, theGap, theTopPad, theSidePad, theBarHeight, theColorScale, w4) {
          theArray.sort((a2, b3) => a2.vert === b3.vert ? 0 : a2.vert ? 1 : -1);
          const uniqueTaskOrderIds = [...new Set(theArray.map((item) => item.order))];
          const uniqueTasks = uniqueTaskOrderIds.map((id35) => theArray.find((item) => item.order === id35));
          svg2.append("g").selectAll("rect").data(uniqueTasks).enter().append("rect").attr("x", 0).attr("y", function(d3, i2) {
            i2 = d3.order;
            return i2 * theGap + theTopPad - 2;
          }).attr("width", function() {
            return w4 - conf5.rightPadding / 2;
          }).attr("height", theGap).attr("class", function(d3) {
            for (const [i2, category] of categories.entries()) {
              if (d3.type === category) {
                return "section section" + i2 % conf5.numberSectionStyles;
              }
            }
            return "section section0";
          }).enter();
          const rectangles = svg2.append("g").selectAll("rect").data(theArray).enter();
          const links3 = diagObj.db.getLinks();
          rectangles.append("rect").attr("id", function(d3) {
            return id34 + "-" + d3.id;
          }).attr("rx", 3).attr("ry", 3).attr("x", function(d3) {
            if (d3.milestone) {
              return timeScale(d3.startTime) + theSidePad + 0.5 * (timeScale(d3.endTime) - timeScale(d3.startTime)) - 0.5 * theBarHeight;
            }
            return timeScale(d3.startTime) + theSidePad;
          }).attr("y", function(d3, i2) {
            i2 = d3.order;
            if (d3.vert) {
              return conf5.gridLineStartPadding;
            }
            return i2 * theGap + theTopPad;
          }).attr("width", function(d3) {
            if (d3.milestone) {
              return theBarHeight;
            }
            if (d3.vert) {
              return 0.08 * theBarHeight;
            }
            return timeScale(d3.renderEndTime || d3.endTime) - timeScale(d3.startTime);
          }).attr("height", function(d3) {
            if (d3.vert) {
              return taskArray.length * (conf5.barHeight + conf5.barGap) + conf5.barHeight * 2;
            }
            return theBarHeight;
          }).attr("transform-origin", function(d3, i2) {
            i2 = d3.order;
            return (timeScale(d3.startTime) + theSidePad + 0.5 * (timeScale(d3.endTime) - timeScale(d3.startTime))).toString() + "px " + (i2 * theGap + theTopPad + 0.5 * theBarHeight).toString() + "px";
          }).attr("class", function(d3) {
            const res = "task";
            let classStr = "";
            if (d3.classes.length > 0) {
              classStr = d3.classes.join(" ");
            }
            let secNum = 0;
            for (const [i2, category] of categories.entries()) {
              if (d3.type === category) {
                secNum = i2 % conf5.numberSectionStyles;
              }
            }
            let taskClass = "";
            if (d3.active) {
              if (d3.crit) {
                taskClass += " activeCrit";
              } else {
                taskClass = " active";
              }
            } else if (d3.done) {
              if (d3.crit) {
                taskClass = " doneCrit";
              } else {
                taskClass = " done";
              }
            } else {
              if (d3.crit) {
                taskClass += " crit";
              }
            }
            if (taskClass.length === 0) {
              taskClass = " task";
            }
            if (d3.milestone) {
              taskClass = " milestone " + taskClass;
            }
            if (d3.vert) {
              taskClass = " vert " + taskClass;
            }
            taskClass += secNum;
            taskClass += " " + classStr;
            return res + taskClass;
          });
          rectangles.append("text").attr("id", function(d3) {
            return id34 + "-" + d3.id + "-text";
          }).text(function(d3) {
            return d3.task;
          }).attr("font-size", conf5.fontSize).attr("x", function(d3) {
            let startX2 = timeScale(d3.startTime);
            let endX = timeScale(d3.renderEndTime || d3.endTime);
            if (d3.milestone) {
              startX2 += 0.5 * (timeScale(d3.endTime) - timeScale(d3.startTime)) - 0.5 * theBarHeight;
              endX = startX2 + theBarHeight;
            }
            if (d3.vert) {
              return timeScale(d3.startTime) + theSidePad;
            }
            const textWidth = this.getBBox().width;
            if (textWidth > endX - startX2) {
              if (endX + textWidth + 1.5 * conf5.leftPadding > w4) {
                return startX2 + theSidePad - 5;
              } else {
                return endX + theSidePad + 5;
              }
            } else {
              return (endX - startX2) / 2 + startX2 + theSidePad;
            }
          }).attr("y", function(d3, i2) {
            if (d3.vert) {
              return conf5.gridLineStartPadding + taskArray.length * (conf5.barHeight + conf5.barGap) + 60;
            }
            i2 = d3.order;
            return i2 * theGap + conf5.barHeight / 2 + (conf5.fontSize / 2 - 2) + theTopPad;
          }).attr("text-height", theBarHeight).attr("class", function(d3) {
            const startX2 = timeScale(d3.startTime);
            let endX = timeScale(d3.endTime);
            if (d3.milestone) {
              endX = startX2 + theBarHeight;
            }
            const textWidth = this.getBBox().width;
            let classStr = "";
            if (d3.classes.length > 0) {
              classStr = d3.classes.join(" ");
            }
            let secNum = 0;
            for (const [i2, category] of categories.entries()) {
              if (d3.type === category) {
                secNum = i2 % conf5.numberSectionStyles;
              }
            }
            let taskType = "";
            if (d3.active) {
              if (d3.crit) {
                taskType = "activeCritText" + secNum;
              } else {
                taskType = "activeText" + secNum;
              }
            }
            if (d3.done) {
              if (d3.crit) {
                taskType = taskType + " doneCritText" + secNum;
              } else {
                taskType = taskType + " doneText" + secNum;
              }
            } else {
              if (d3.crit) {
                taskType = taskType + " critText" + secNum;
              }
            }
            if (d3.milestone) {
              taskType += " milestoneText";
            }
            if (d3.vert) {
              taskType += " vertText";
            }
            if (textWidth > endX - startX2) {
              if (endX + textWidth + 1.5 * conf5.leftPadding > w4) {
                return classStr + " taskTextOutsideLeft taskTextOutside" + secNum + " " + taskType;
              } else {
                return classStr + " taskTextOutsideRight taskTextOutside" + secNum + " " + taskType + " width-" + textWidth;
              }
            } else {
              return classStr + " taskText taskText" + secNum + " " + taskType + " width-" + textWidth;
            }
          });
          const securityLevel2 = getConfig2().securityLevel;
          if (securityLevel2 === "sandbox") {
            let sandboxElement2;
            sandboxElement2 = select_default2("#i" + id34);
            const doc2 = sandboxElement2.nodes()[0].contentDocument;
            rectangles.filter(function(d3) {
              return links3.has(d3.id);
            }).each(function(o2) {
              var taskRect = doc2.querySelector("#" + CSS.escape(id34 + "-" + o2.id));
              var taskText = doc2.querySelector("#" + CSS.escape(id34 + "-" + o2.id + "-text"));
              const oldParent = taskRect.parentNode;
              var Link2 = doc2.createElement("a");
              Link2.setAttribute("xlink:href", links3.get(o2.id));
              Link2.setAttribute("target", "_top");
              oldParent.appendChild(Link2);
              Link2.appendChild(taskRect);
              Link2.appendChild(taskText);
            });
          }
        }
        __name(drawRects, "drawRects");
        function drawExcludeDays(theGap, theTopPad, theSidePad, w4, h4, tasks4, excludes2, includes3) {
          if (excludes2.length === 0 && includes3.length === 0) {
            return;
          }
          let minTime;
          let maxTime;
          for (const { startTime, endTime } of tasks4) {
            if (minTime === void 0 || startTime < minTime) {
              minTime = startTime;
            }
            if (maxTime === void 0 || endTime > maxTime) {
              maxTime = endTime;
            }
          }
          if (!minTime || !maxTime) {
            return;
          }
          if ((0, import_dayjs3.default)(maxTime).diff((0, import_dayjs3.default)(minTime), "year") > 5) {
            log.warn(
              "The difference between the min and max time is more than 5 years. This will cause performance issues. Skipping drawing exclude days."
            );
            return;
          }
          const dateFormat2 = diagObj.db.getDateFormat();
          const excludeRanges = [];
          let range3 = null;
          let d3 = (0, import_dayjs3.default)(minTime);
          while (d3.valueOf() <= maxTime) {
            if (diagObj.db.isInvalidDate(d3, dateFormat2, excludes2, includes3)) {
              if (!range3) {
                range3 = {
                  start: d3,
                  end: d3
                };
              } else {
                range3.end = d3;
              }
            } else {
              if (range3) {
                excludeRanges.push(range3);
                range3 = null;
              }
            }
            d3 = d3.add(1, "d");
          }
          const rectangles = svg2.append("g").selectAll("rect").data(excludeRanges).enter();
          rectangles.append("rect").attr("id", (d4) => id34 + "-exclude-" + d4.start.format("YYYY-MM-DD")).attr("x", (d4) => timeScale(d4.start.startOf("day")) + theSidePad).attr("y", conf5.gridLineStartPadding).attr("width", (d4) => timeScale(d4.end.endOf("day")) - timeScale(d4.start.startOf("day"))).attr("height", h4 - theTopPad - conf5.gridLineStartPadding).attr("transform-origin", function(d4, i2) {
            return (timeScale(d4.start) + theSidePad + 0.5 * (timeScale(d4.end) - timeScale(d4.start))).toString() + "px " + (i2 * theGap + 0.5 * h4).toString() + "px";
          }).attr("class", "exclude-range");
        }
        __name(drawExcludeDays, "drawExcludeDays");
        function getEstimatedTickCount(minTime, maxTime, every3, interval2) {
          if (every3 <= 0 || minTime > maxTime) {
            return Infinity;
          }
          const timeDiffMs = maxTime - minTime;
          const intervalMs = import_dayjs3.default.duration({ [interval2 ?? "day"]: every3 }).asMilliseconds();
          if (intervalMs <= 0) {
            return Infinity;
          }
          return Math.ceil(timeDiffMs / intervalMs);
        }
        __name(getEstimatedTickCount, "getEstimatedTickCount");
        function makeGrid(theSidePad, theTopPad, w4, h4) {
          const dateFormat2 = diagObj.db.getDateFormat();
          const userAxisFormat = diagObj.db.getAxisFormat();
          let axisFormat2;
          if (userAxisFormat) {
            axisFormat2 = userAxisFormat;
          } else if (dateFormat2 === "D") {
            axisFormat2 = "%d";
          } else {
            axisFormat2 = conf5.axisFormat ?? "%Y-%m-%d";
          }
          let bottomXAxis = axisBottom(timeScale).tickSize(-h4 + theTopPad + conf5.gridLineStartPadding).tickFormat(timeFormat(axisFormat2));
          const reTickInterval = /^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/;
          const resultTickInterval = reTickInterval.exec(
            diagObj.db.getTickInterval() || conf5.tickInterval
          );
          if (resultTickInterval !== null) {
            const every3 = parseInt(resultTickInterval[1], 10);
            if (isNaN(every3) || every3 <= 0) {
              log.warn(
                `Invalid tick interval value: "${resultTickInterval[1]}". Skipping custom tick interval.`
              );
            } else {
              const interval2 = resultTickInterval[2];
              const weekday2 = diagObj.db.getWeekday() || conf5.weekday;
              const domain = timeScale.domain();
              const minTime = domain[0];
              const maxTime = domain[1];
              const estimatedTicks = getEstimatedTickCount(minTime, maxTime, every3, interval2);
              if (estimatedTicks > MAX_TICK_COUNT) {
                log.warn(
                  `The tick interval "${every3}${interval2}" would generate ${estimatedTicks} ticks, which exceeds the maximum allowed (${MAX_TICK_COUNT}). This may indicate an invalid date or time range. Skipping custom tick interval.`
                );
              } else {
                switch (interval2) {
                  case "millisecond":
                    bottomXAxis.ticks(millisecond.every(every3));
                    break;
                  case "second":
                    bottomXAxis.ticks(second.every(every3));
                    break;
                  case "minute":
                    bottomXAxis.ticks(timeMinute.every(every3));
                    break;
                  case "hour":
                    bottomXAxis.ticks(timeHour.every(every3));
                    break;
                  case "day":
                    bottomXAxis.ticks(timeDay.every(every3));
                    break;
                  case "week":
                    bottomXAxis.ticks(mapWeekdayToTimeFunction[weekday2].every(every3));
                    break;
                  case "month":
                    bottomXAxis.ticks(timeMonth.every(every3));
                    break;
                }
              }
            }
          }
          svg2.append("g").attr("class", "grid").attr("transform", "translate(" + theSidePad + ", " + (h4 - 50) + ")").call(bottomXAxis).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10).attr("dy", "1em");
          if (diagObj.db.topAxisEnabled() || conf5.topAxis) {
            let topXAxis = axisTop(timeScale).tickSize(-h4 + theTopPad + conf5.gridLineStartPadding).tickFormat(timeFormat(axisFormat2));
            if (resultTickInterval !== null) {
              const every3 = parseInt(resultTickInterval[1], 10);
              if (isNaN(every3) || every3 <= 0) {
                log.warn(
                  `Invalid tick interval value: "${resultTickInterval[1]}". Skipping custom tick interval.`
                );
              } else {
                const interval2 = resultTickInterval[2];
                const weekday2 = diagObj.db.getWeekday() || conf5.weekday;
                const domain = timeScale.domain();
                const minTime = domain[0];
                const maxTime = domain[1];
                const estimatedTicks = getEstimatedTickCount(minTime, maxTime, every3, interval2);
                if (estimatedTicks <= MAX_TICK_COUNT) {
                  switch (interval2) {
                    case "millisecond":
                      topXAxis.ticks(millisecond.every(every3));
                      break;
                    case "second":
                      topXAxis.ticks(second.every(every3));
                      break;
                    case "minute":
                      topXAxis.ticks(timeMinute.every(every3));
                      break;
                    case "hour":
                      topXAxis.ticks(timeHour.every(every3));
                      break;
                    case "day":
                      topXAxis.ticks(timeDay.every(every3));
                      break;
                    case "week":
                      topXAxis.ticks(mapWeekdayToTimeFunction[weekday2].every(every3));
                      break;
                    case "month":
                      topXAxis.ticks(timeMonth.every(every3));
                      break;
                  }
                }
              }
            }
            svg2.append("g").attr("class", "grid").attr("transform", "translate(" + theSidePad + ", " + theTopPad + ")").call(topXAxis).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10);
          }
        }
        __name(makeGrid, "makeGrid");
        function vertLabels(theGap, theTopPad) {
          let prevGap = 0;
          const numOccurrences = Object.keys(categoryHeights).map((d3) => [d3, categoryHeights[d3]]);
          svg2.append("g").selectAll("text").data(numOccurrences).enter().append(function(d3) {
            const rows = d3[0].split(common_default.lineBreakRegex);
            const dy = -(rows.length - 1) / 2;
            const svgLabel = doc.createElementNS("http://www.w3.org/2000/svg", "text");
            svgLabel.setAttribute("dy", dy + "em");
            for (const [j3, row] of rows.entries()) {
              const tspan = doc.createElementNS("http://www.w3.org/2000/svg", "tspan");
              tspan.setAttribute("alignment-baseline", "central");
              tspan.setAttribute("x", "10");
              if (j3 > 0) {
                tspan.setAttribute("dy", "1em");
              }
              tspan.textContent = row;
              svgLabel.appendChild(tspan);
            }
            return svgLabel;
          }).attr("x", 10).attr("y", function(d3, i2) {
            if (i2 > 0) {
              for (let j3 = 0; j3 < i2; j3++) {
                prevGap += numOccurrences[i2 - 1][1];
                return d3[1] * theGap / 2 + prevGap * theGap + theTopPad;
              }
            } else {
              return d3[1] * theGap / 2 + theTopPad;
            }
          }).attr("font-size", conf5.sectionFontSize).attr("class", function(d3) {
            for (const [i2, category] of categories.entries()) {
              if (d3[0] === category) {
                return "sectionTitle sectionTitle" + i2 % conf5.numberSectionStyles;
              }
            }
            return "sectionTitle";
          });
        }
        __name(vertLabels, "vertLabels");
        function drawToday(theSidePad, theTopPad, w4, h4) {
          const todayMarker2 = diagObj.db.getTodayMarker();
          if (todayMarker2 === "off") {
            return;
          }
          const todayG = svg2.append("g").attr("class", "today");
          const today = /* @__PURE__ */ new Date();
          const todayLine = todayG.append("line");
          todayLine.attr("x1", timeScale(today) + theSidePad).attr("x2", timeScale(today) + theSidePad).attr("y1", conf5.titleTopMargin).attr("y2", h4 - conf5.titleTopMargin).attr("class", "today");
          if (todayMarker2 !== "") {
            todayLine.attr("style", todayMarker2.replace(/,/g, ";"));
          }
        }
        __name(drawToday, "drawToday");
        function checkUnique(arr) {
          const hash = {};
          const result = [];
          for (let i2 = 0, l4 = arr.length; i2 < l4; ++i2) {
            if (!Object.prototype.hasOwnProperty.call(hash, arr[i2])) {
              hash[arr[i2]] = true;
              result.push(arr[i2]);
            }
          }
          return result;
        }
        __name(checkUnique, "checkUnique");
      }, "draw");
      ganttRenderer_default = {
        setConf: setConf2,
        draw: draw5
      };
    }
  });

  // src/diagrams/gantt/styles.js
  var getStyles6, styles_default6;
  var init_styles6 = __esm({
    "src/diagrams/gantt/styles.js"() {
      "use strict";
      getStyles6 = /* @__PURE__ */ __name((options2) => `
  .mermaid-main-font {
        font-family: ${options2.fontFamily};
  }

  .exclude-range {
    fill: ${options2.excludeBkgColor};
  }

  .section {
    stroke: none;
    opacity: 0.2;
  }

  .section0 {
    fill: ${options2.sectionBkgColor};
  }

  .section2 {
    fill: ${options2.sectionBkgColor2};
  }

  .section1,
  .section3 {
    fill: ${options2.altSectionBkgColor};
    opacity: 0.2;
  }

  .sectionTitle0 {
    fill: ${options2.titleColor};
  }

  .sectionTitle1 {
    fill: ${options2.titleColor};
  }

  .sectionTitle2 {
    fill: ${options2.titleColor};
  }

  .sectionTitle3 {
    fill: ${options2.titleColor};
  }

  .sectionTitle {
    text-anchor: start;
    font-family: ${options2.fontFamily};
  }


  /* Grid and axis */

  .grid .tick {
    stroke: ${options2.gridColor};
    opacity: 0.8;
    shape-rendering: crispEdges;
  }

  .grid .tick text {
    font-family: ${options2.fontFamily};
    fill: ${options2.textColor};
  }

  .grid path {
    stroke-width: 0;
  }


  /* Today line */

  .today {
    fill: none;
    stroke: ${options2.todayLineColor};
    stroke-width: 2px;
  }


  /* Task styling */

  /* Default task */

  .task {
    stroke-width: 2;
  }

  .taskText {
    text-anchor: middle;
    font-family: ${options2.fontFamily};
  }

  .taskTextOutsideRight {
    fill: ${options2.taskTextDarkColor};
    text-anchor: start;
    font-family: ${options2.fontFamily};
  }

  .taskTextOutsideLeft {
    fill: ${options2.taskTextDarkColor};
    text-anchor: end;
  }


  /* Special case clickable */

  .task.clickable {
    cursor: pointer;
  }

  .taskText.clickable {
    cursor: pointer;
    fill: ${options2.taskTextClickableColor} !important;
    font-weight: bold;
  }

  .taskTextOutsideLeft.clickable {
    cursor: pointer;
    fill: ${options2.taskTextClickableColor} !important;
    font-weight: bold;
  }

  .taskTextOutsideRight.clickable {
    cursor: pointer;
    fill: ${options2.taskTextClickableColor} !important;
    font-weight: bold;
  }


  /* Specific task settings for the sections*/

  .taskText0,
  .taskText1,
  .taskText2,
  .taskText3 {
    fill: ${options2.taskTextColor};
  }

  .task0,
  .task1,
  .task2,
  .task3 {
    fill: ${options2.taskBkgColor};
    stroke: ${options2.taskBorderColor};
  }

  .taskTextOutside0,
  .taskTextOutside2
  {
    fill: ${options2.taskTextOutsideColor};
  }

  .taskTextOutside1,
  .taskTextOutside3 {
    fill: ${options2.taskTextOutsideColor};
  }


  /* Active task */

  .active0,
  .active1,
  .active2,
  .active3 {
    fill: ${options2.activeTaskBkgColor};
    stroke: ${options2.activeTaskBorderColor};
  }

  .activeText0,
  .activeText1,
  .activeText2,
  .activeText3 {
    fill: ${options2.taskTextDarkColor} !important;
  }


  /* Completed task */

  .done0,
  .done1,
  .done2,
  .done3 {
    stroke: ${options2.doneTaskBorderColor};
    fill: ${options2.doneTaskBkgColor};
    stroke-width: 2;
  }

  .doneText0,
  .doneText1,
  .doneText2,
  .doneText3 {
    fill: ${options2.taskTextDarkColor} !important;
  }

  /* Done task text displayed outside the bar sits against the diagram background,
     not against the done-task bar, so it must use the outside/contrast color. */
  .doneText0.taskTextOutsideLeft,
  .doneText0.taskTextOutsideRight,
  .doneText1.taskTextOutsideLeft,
  .doneText1.taskTextOutsideRight,
  .doneText2.taskTextOutsideLeft,
  .doneText2.taskTextOutsideRight,
  .doneText3.taskTextOutsideLeft,
  .doneText3.taskTextOutsideRight {
    fill: ${options2.taskTextOutsideColor} !important;
  }


  /* Tasks on the critical line */

  .crit0,
  .crit1,
  .crit2,
  .crit3 {
    stroke: ${options2.critBorderColor};
    fill: ${options2.critBkgColor};
    stroke-width: 2;
  }

  .activeCrit0,
  .activeCrit1,
  .activeCrit2,
  .activeCrit3 {
    stroke: ${options2.critBorderColor};
    fill: ${options2.activeTaskBkgColor};
    stroke-width: 2;
  }

  .doneCrit0,
  .doneCrit1,
  .doneCrit2,
  .doneCrit3 {
    stroke: ${options2.critBorderColor};
    fill: ${options2.doneTaskBkgColor};
    stroke-width: 2;
    cursor: pointer;
    shape-rendering: crispEdges;
  }

  .milestone {
    transform: rotate(45deg) scale(0.8,0.8);
  }

  .milestoneText {
    font-style: italic;
  }
  .doneCritText0,
  .doneCritText1,
  .doneCritText2,
  .doneCritText3 {
    fill: ${options2.taskTextDarkColor} !important;
  }

  /* Done-crit task text outside the bar \u2014 same reasoning as doneText above. */
  .doneCritText0.taskTextOutsideLeft,
  .doneCritText0.taskTextOutsideRight,
  .doneCritText1.taskTextOutsideLeft,
  .doneCritText1.taskTextOutsideRight,
  .doneCritText2.taskTextOutsideLeft,
  .doneCritText2.taskTextOutsideRight,
  .doneCritText3.taskTextOutsideLeft,
  .doneCritText3.taskTextOutsideRight {
    fill: ${options2.taskTextOutsideColor} !important;
  }

  .vert {
    stroke: ${options2.vertLineColor};
  }

  .vertText {
    font-size: 15px;
    text-anchor: middle;
    fill: ${options2.vertLineColor} !important;
  }

  .activeCritText0,
  .activeCritText1,
  .activeCritText2,
  .activeCritText3 {
    fill: ${options2.taskTextDarkColor} !important;
  }

  .titleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${options2.titleColor || options2.textColor};
    font-family: ${options2.fontFamily};
  }
`, "getStyles");
      styles_default6 = getStyles6;
    }
  });

  // src/diagrams/gantt/ganttDiagram.ts
  var ganttDiagram_exports = {};
  __export(ganttDiagram_exports, {
    diagram: () => diagram5
  });
  var diagram5;
  var init_ganttDiagram = __esm({
    "src/diagrams/gantt/ganttDiagram.ts"() {
      "use strict";
      init_gantt();
      init_ganttDb();
      init_ganttRenderer();
      init_styles6();
      diagram5 = {
        parser: gantt_default,
        db: ganttDb_default,
        renderer: ganttRenderer_default,
        styles: styles_default6
      };
    }
  });

  // src/diagrams/info/infoParser.ts
  var parser6;
  var init_infoParser = __esm({
    "src/diagrams/info/infoParser.ts"() {
      "use strict";
      init_mermaid_parser_core();
      init_logger();
      parser6 = {
        parse: /* @__PURE__ */ __name(async (input) => {
          const ast = await parse3("info", input);
          log.debug(ast);
        }, "parse")
      };
    }
  });

  // src/diagrams/info/infoDb.ts
  var DEFAULT_INFO_DB, getVersion, db2;
  var init_infoDb = __esm({
    "src/diagrams/info/infoDb.ts"() {
      "use strict";
      DEFAULT_INFO_DB = {
        version: "11.14.0" + (true ? "" : "-tiny")
      };
      getVersion = /* @__PURE__ */ __name(() => DEFAULT_INFO_DB.version, "getVersion");
      db2 = {
        getVersion
      };
    }
  });

  // src/rendering-util/selectSvgElement.ts
  var selectSvgElement;
  var init_selectSvgElement = __esm({
    "src/rendering-util/selectSvgElement.ts"() {
      "use strict";
      init_src32();
      init_diagramAPI();
      selectSvgElement = /* @__PURE__ */ __name((id34) => {
        const { securityLevel } = getConfig2();
        let root3 = select_default2("body");
        if (securityLevel === "sandbox") {
          const sandboxElement = select_default2(`#i${id34}`);
          const doc = sandboxElement.node()?.contentDocument ?? document;
          root3 = select_default2(doc.body);
        }
        const svg2 = root3.select(`#${id34}`);
        return svg2;
      }, "selectSvgElement");
    }
  });

  // src/diagrams/info/infoRenderer.ts
  var draw6, renderer3;
  var init_infoRenderer = __esm({
    "src/diagrams/info/infoRenderer.ts"() {
      "use strict";
      init_logger();
      init_selectSvgElement();
      init_setupGraphViewbox();
      draw6 = /* @__PURE__ */ __name((text4, id34, version3) => {
        log.debug("rendering info diagram\n" + text4);
        const svg2 = selectSvgElement(id34);
        configureSvgSize(svg2, 100, 400, true);
        const group2 = svg2.append("g");
        group2.append("text").attr("x", 100).attr("y", 40).attr("class", "version").attr("font-size", 32).style("text-anchor", "middle").text(`v${version3}`);
      }, "draw");
      renderer3 = { draw: draw6 };
    }
  });

  // src/diagrams/info/infoDiagram.ts
  var infoDiagram_exports = {};
  __export(infoDiagram_exports, {
    diagram: () => diagram6
  });
  var diagram6;
  var init_infoDiagram = __esm({
    "src/diagrams/info/infoDiagram.ts"() {
      "use strict";
      init_infoParser();
      init_infoDb();
      init_infoRenderer();
      diagram6 = {
        parser: parser6,
        db: db2,
        renderer: renderer3
      };
    }
  });

  // src/diagrams/pie/pieDb.ts
  var DEFAULT_PIE_CONFIG, DEFAULT_PIE_DB, sections2, showData, config2, getConfig4, clear10, addSection2, getSections2, setShowData, getShowData, db3;
  var init_pieDb = __esm({
    "src/diagrams/pie/pieDb.ts"() {
      "use strict";
      init_logger();
      init_commonDb();
      init_defaultConfig();
      DEFAULT_PIE_CONFIG = defaultConfig_default.pie;
      DEFAULT_PIE_DB = {
        sections: /* @__PURE__ */ new Map(),
        showData: false,
        config: DEFAULT_PIE_CONFIG
      };
      sections2 = DEFAULT_PIE_DB.sections;
      showData = DEFAULT_PIE_DB.showData;
      config2 = structuredClone(DEFAULT_PIE_CONFIG);
      getConfig4 = /* @__PURE__ */ __name(() => structuredClone(config2), "getConfig");
      clear10 = /* @__PURE__ */ __name(() => {
        sections2 = /* @__PURE__ */ new Map();
        showData = DEFAULT_PIE_DB.showData;
        clear();
      }, "clear");
      addSection2 = /* @__PURE__ */ __name(({ label, value: value2 }) => {
        if (value2 < 0) {
          throw new Error(
            `"${label}" has invalid value: ${value2}. Negative values are not allowed in pie charts. All slice values must be >= 0.`
          );
        }
        if (!sections2.has(label)) {
          sections2.set(label, value2);
          log.debug(`added new section: ${label}, with value: ${value2}`);
        }
      }, "addSection");
      getSections2 = /* @__PURE__ */ __name(() => sections2, "getSections");
      setShowData = /* @__PURE__ */ __name((toggle) => {
        showData = toggle;
      }, "setShowData");
      getShowData = /* @__PURE__ */ __name(() => showData, "getShowData");
      db3 = {
        getConfig: getConfig4,
        clear: clear10,
        setDiagramTitle,
        getDiagramTitle,
        setAccTitle,
        getAccTitle,
        setAccDescription,
        getAccDescription,
        addSection: addSection2,
        getSections: getSections2,
        setShowData,
        getShowData
      };
    }
  });

  // src/diagrams/pie/pieParser.ts
  var populateDb, parser7;
  var init_pieParser = __esm({
    "src/diagrams/pie/pieParser.ts"() {
      "use strict";
      init_mermaid_parser_core();
      init_logger();
      init_populateCommonDb();
      init_pieDb();
      populateDb = /* @__PURE__ */ __name((ast, db9) => {
        populateCommonDb(ast, db9);
        db9.setShowData(ast.showData);
        ast.sections.map(db9.addSection);
      }, "populateDb");
      parser7 = {
        parse: /* @__PURE__ */ __name(async (input) => {
          const ast = await parse3("pie", input);
          log.debug(ast);
          populateDb(ast, db3);
        }, "parse")
      };
    }
  });

  // src/diagrams/pie/pieStyles.ts
  var getStyles7, pieStyles_default;
  var init_pieStyles = __esm({
    "src/diagrams/pie/pieStyles.ts"() {
      "use strict";
      getStyles7 = /* @__PURE__ */ __name((options2) => `
  .pieCircle{
    stroke: ${options2.pieStrokeColor};
    stroke-width : ${options2.pieStrokeWidth};
    opacity : ${options2.pieOpacity};
  }
  .pieOuterCircle{
    stroke: ${options2.pieOuterStrokeColor};
    stroke-width: ${options2.pieOuterStrokeWidth};
    fill: none;
  }
  .pieTitleText {
    text-anchor: middle;
    font-size: ${options2.pieTitleTextSize};
    fill: ${options2.pieTitleTextColor};
    font-family: ${options2.fontFamily};
  }
  .slice {
    font-family: ${options2.fontFamily};
    fill: ${options2.pieSectionTextColor};
    font-size:${options2.pieSectionTextSize};
    // fill: white;
  }
  .legend text {
    fill: ${options2.pieLegendTextColor};
    font-family: ${options2.fontFamily};
    font-size: ${options2.pieLegendTextSize};
  }
`, "getStyles");
      pieStyles_default = getStyles7;
    }
  });

  // src/diagrams/pie/pieRenderer.ts
  var createPieArcs, draw7, renderer4;
  var init_pieRenderer = __esm({
    "src/diagrams/pie/pieRenderer.ts"() {
      "use strict";
      init_src32();
      init_diagramAPI();
      init_logger();
      init_selectSvgElement();
      init_setupGraphViewbox();
      init_utils2();
      createPieArcs = /* @__PURE__ */ __name((sections6) => {
        const sum2 = [...sections6.values()].reduce((acc, val) => acc + val, 0);
        const pieData = [...sections6.entries()].map(([label, value2]) => ({ label, value: value2 })).filter((d3) => d3.value / sum2 * 100 >= 1);
        const pie2 = pie_default().value((d3) => d3.value).sort(null);
        return pie2(pieData);
      }, "createPieArcs");
      draw7 = /* @__PURE__ */ __name((text4, id34, _version, diagObj) => {
        log.debug("rendering pie chart\n" + text4);
        const db9 = diagObj.db;
        const globalConfig = getConfig2();
        const pieConfig = cleanAndMerge(db9.getConfig(), globalConfig.pie);
        const MARGIN = 40;
        const LEGEND_RECT_SIZE = 18;
        const LEGEND_SPACING = 4;
        const height2 = 450;
        const pieWidth = height2;
        const svg2 = selectSvgElement(id34);
        const group2 = svg2.append("g");
        group2.attr("transform", "translate(" + pieWidth / 2 + "," + height2 / 2 + ")");
        const { themeVariables } = globalConfig;
        let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth);
        outerStrokeWidth ??= 2;
        const textPosition = pieConfig.textPosition;
        const radius2 = Math.min(pieWidth, height2) / 2 - MARGIN;
        const arcGenerator = arc_default().innerRadius(0).outerRadius(radius2);
        const labelArcGenerator = arc_default().innerRadius(radius2 * textPosition).outerRadius(radius2 * textPosition);
        group2.append("circle").attr("cx", 0).attr("cy", 0).attr("r", radius2 + outerStrokeWidth / 2).attr("class", "pieOuterCircle");
        const sections6 = db9.getSections();
        const arcs = createPieArcs(sections6);
        const myGeneratedColors = [
          themeVariables.pie1,
          themeVariables.pie2,
          themeVariables.pie3,
          themeVariables.pie4,
          themeVariables.pie5,
          themeVariables.pie6,
          themeVariables.pie7,
          themeVariables.pie8,
          themeVariables.pie9,
          themeVariables.pie10,
          themeVariables.pie11,
          themeVariables.pie12
        ];
        let sum2 = 0;
        sections6.forEach((section) => {
          sum2 += section;
        });
        const filteredArcs = arcs.filter((datum2) => (datum2.data.value / sum2 * 100).toFixed(0) !== "0");
        const color2 = ordinal(myGeneratedColors).domain([
          ...sections6.keys()
        ]);
        group2.selectAll("mySlices").data(filteredArcs).enter().append("path").attr("d", arcGenerator).attr("fill", (datum2) => {
          return color2(datum2.data.label);
        }).attr("class", "pieCircle");
        group2.selectAll("mySlices").data(filteredArcs).enter().append("text").text((datum2) => {
          return (datum2.data.value / sum2 * 100).toFixed(0) + "%";
        }).attr("transform", (datum2) => {
          return "translate(" + labelArcGenerator.centroid(datum2) + ")";
        }).style("text-anchor", "middle").attr("class", "slice");
        const titleText = group2.append("text").text(db9.getDiagramTitle()).attr("x", 0).attr("y", -(height2 - 50) / 2).attr("class", "pieTitleText");
        const allSectionData = [...sections6.entries()].map(([label, value2]) => ({
          label,
          value: value2
        }));
        const legend = group2.selectAll(".legend").data(allSectionData).enter().append("g").attr("class", "legend").attr("transform", (_datum, index) => {
          const height3 = LEGEND_RECT_SIZE + LEGEND_SPACING;
          const offset = height3 * allSectionData.length / 2;
          const horizontal = 12 * LEGEND_RECT_SIZE;
          const vertical = index * height3 - offset;
          return "translate(" + horizontal + "," + vertical + ")";
        });
        legend.append("rect").attr("width", LEGEND_RECT_SIZE).attr("height", LEGEND_RECT_SIZE).style("fill", (d3) => color2(d3.label)).style("stroke", (d3) => color2(d3.label));
        legend.append("text").attr("x", LEGEND_RECT_SIZE + LEGEND_SPACING).attr("y", LEGEND_RECT_SIZE - LEGEND_SPACING).text((d3) => {
          if (db9.getShowData()) {
            return `${d3.label} [${d3.value}]`;
          }
          return d3.label;
        });
        const longestTextWidth = Math.max(
          ...legend.selectAll("text").nodes().map((node2) => node2?.getBoundingClientRect().width ?? 0)
        );
        const chartAndLegendWidth = pieWidth + MARGIN + LEGEND_RECT_SIZE + LEGEND_SPACING + longestTextWidth;
        const titleWidth = titleText.node()?.getBoundingClientRect().width ?? 0;
        const titleLeft = pieWidth / 2 - titleWidth / 2;
        const titleRight = pieWidth / 2 + titleWidth / 2;
        const viewBoxX = Math.min(0, titleLeft);
        const viewBoxRight = Math.max(chartAndLegendWidth, titleRight);
        const totalWidth = viewBoxRight - viewBoxX;
        svg2.attr("viewBox", `${viewBoxX} 0 ${totalWidth} ${height2}`);
        configureSvgSize(svg2, height2, totalWidth, pieConfig.useMaxWidth);
      }, "draw");
      renderer4 = { draw: draw7 };
    }
  });

  // src/diagrams/pie/pieDiagram.ts
  var pieDiagram_exports = {};
  __export(pieDiagram_exports, {
    diagram: () => diagram7
  });
  var diagram7;
  var init_pieDiagram = __esm({
    "src/diagrams/pie/pieDiagram.ts"() {
      "use strict";
      init_pieParser();
      init_pieDb();
      init_pieStyles();
      init_pieRenderer();
      diagram7 = {
        parser: parser7,
        db: db3,
        renderer: renderer4,
        styles: pieStyles_default
      };
    }
  });

  // src/diagrams/quadrant-chart/parser/quadrant.jison
  var parser8, quadrant_default;
  var init_quadrant = __esm({
    "src/diagrams/quadrant-chart/parser/quadrant.jison"() {
      "use strict";
      parser8 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [1, 3], $V1 = [1, 4], $V2 = [1, 5], $V3 = [1, 6], $V4 = [1, 7], $V5 = [1, 4, 5, 10, 12, 13, 14, 18, 25, 35, 37, 39, 41, 42, 48, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 63, 64, 65, 66, 67], $V6 = [1, 4, 5, 10, 12, 13, 14, 18, 25, 28, 35, 37, 39, 41, 42, 48, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 63, 64, 65, 66, 67], $V7 = [55, 56, 57], $V8 = [2, 36], $V9 = [1, 37], $Va = [1, 36], $Vb = [1, 38], $Vc = [1, 35], $Vd = [1, 43], $Ve = [1, 41], $Vf = [1, 14], $Vg = [1, 23], $Vh = [1, 18], $Vi = [1, 19], $Vj = [1, 20], $Vk = [1, 21], $Vl = [1, 22], $Vm = [1, 24], $Vn = [1, 25], $Vo = [1, 26], $Vp = [1, 27], $Vq = [1, 28], $Vr = [1, 29], $Vs = [1, 32], $Vt = [1, 33], $Vu = [1, 34], $Vv = [1, 39], $Vw = [1, 40], $Vx = [1, 42], $Vy = [1, 44], $Vz = [1, 62], $VA = [1, 61], $VB = [4, 5, 8, 10, 12, 13, 14, 18, 44, 47, 49, 55, 56, 57, 63, 64, 65, 66, 67], $VC = [1, 65], $VD = [1, 66], $VE = [1, 67], $VF = [1, 68], $VG = [1, 69], $VH = [1, 70], $VI = [1, 71], $VJ = [1, 72], $VK = [1, 73], $VL = [1, 74], $VM = [1, 75], $VN = [1, 76], $VO = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18], $VP = [1, 90], $VQ = [1, 91], $VR = [1, 92], $VS = [1, 99], $VT = [1, 93], $VU = [1, 96], $VV = [1, 94], $VW = [1, 95], $VX = [1, 97], $VY = [1, 98], $VZ = [1, 102], $V_ = [10, 55, 56, 57], $V$ = [4, 5, 6, 8, 10, 11, 13, 17, 18, 19, 20, 55, 56, 57];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "idStringToken": 3, "ALPHA": 4, "NUM": 5, "NODE_STRING": 6, "DOWN": 7, "MINUS": 8, "DEFAULT": 9, "COMMA": 10, "COLON": 11, "AMP": 12, "BRKT": 13, "MULT": 14, "UNICODE_TEXT": 15, "styleComponent": 16, "UNIT": 17, "SPACE": 18, "STYLE": 19, "PCT": 20, "idString": 21, "style": 22, "stylesOpt": 23, "classDefStatement": 24, "CLASSDEF": 25, "start": 26, "eol": 27, "QUADRANT": 28, "document": 29, "line": 30, "statement": 31, "axisDetails": 32, "quadrantDetails": 33, "points": 34, "title": 35, "title_value": 36, "acc_title": 37, "acc_title_value": 38, "acc_descr": 39, "acc_descr_value": 40, "acc_descr_multiline_value": 41, "section": 42, "text": 43, "point_start": 44, "point_x": 45, "point_y": 46, "class_name": 47, "X-AXIS": 48, "AXIS-TEXT-DELIMITER": 49, "Y-AXIS": 50, "QUADRANT_1": 51, "QUADRANT_2": 52, "QUADRANT_3": 53, "QUADRANT_4": 54, "NEWLINE": 55, "SEMI": 56, "EOF": 57, "alphaNumToken": 58, "textNoTagsToken": 59, "STR": 60, "MD_STR": 61, "alphaNum": 62, "PUNCTUATION": 63, "PLUS": 64, "EQUALS": 65, "DOT": 66, "UNDERSCORE": 67, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 4: "ALPHA", 5: "NUM", 6: "NODE_STRING", 7: "DOWN", 8: "MINUS", 9: "DEFAULT", 10: "COMMA", 11: "COLON", 12: "AMP", 13: "BRKT", 14: "MULT", 15: "UNICODE_TEXT", 17: "UNIT", 18: "SPACE", 19: "STYLE", 20: "PCT", 25: "CLASSDEF", 28: "QUADRANT", 35: "title", 36: "title_value", 37: "acc_title", 38: "acc_title_value", 39: "acc_descr", 40: "acc_descr_value", 41: "acc_descr_multiline_value", 42: "section", 44: "point_start", 45: "point_x", 46: "point_y", 47: "class_name", 48: "X-AXIS", 49: "AXIS-TEXT-DELIMITER", 50: "Y-AXIS", 51: "QUADRANT_1", 52: "QUADRANT_2", 53: "QUADRANT_3", 54: "QUADRANT_4", 55: "NEWLINE", 56: "SEMI", 57: "EOF", 60: "STR", 61: "MD_STR", 63: "PUNCTUATION", 64: "PLUS", 65: "EQUALS", 66: "DOT", 67: "UNDERSCORE" },
          productions_: [0, [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [21, 1], [21, 2], [22, 1], [22, 2], [23, 1], [23, 3], [24, 5], [26, 2], [26, 2], [26, 2], [29, 0], [29, 2], [30, 2], [31, 0], [31, 1], [31, 2], [31, 1], [31, 1], [31, 1], [31, 2], [31, 2], [31, 2], [31, 1], [31, 1], [34, 4], [34, 5], [34, 5], [34, 6], [32, 4], [32, 3], [32, 2], [32, 4], [32, 3], [32, 2], [33, 2], [33, 2], [33, 2], [33, 2], [27, 1], [27, 1], [27, 1], [43, 1], [43, 2], [43, 1], [43, 1], [62, 1], [62, 2], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [59, 1], [59, 1], [59, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 23:
                this.$ = $$[$0];
                break;
              case 24:
                this.$ = $$[$0 - 1] + "" + $$[$0];
                break;
              case 26:
                this.$ = $$[$0 - 1] + $$[$0];
                break;
              case 27:
                this.$ = [$$[$0].trim()];
                break;
              case 28:
                $$[$0 - 2].push($$[$0].trim());
                this.$ = $$[$0 - 2];
                break;
              case 29:
                this.$ = $$[$0 - 4];
                yy.addClass($$[$0 - 2], $$[$0]);
                break;
              case 37:
                this.$ = [];
                break;
              case 42:
                this.$ = $$[$0].trim();
                yy.setDiagramTitle(this.$);
                break;
              case 43:
                this.$ = $$[$0].trim();
                yy.setAccTitle(this.$);
                break;
              case 44:
              case 45:
                this.$ = $$[$0].trim();
                yy.setAccDescription(this.$);
                break;
              case 46:
                yy.addSection($$[$0].substr(8));
                this.$ = $$[$0].substr(8);
                break;
              case 47:
                yy.addPoint($$[$0 - 3], "", $$[$0 - 1], $$[$0], []);
                break;
              case 48:
                yy.addPoint($$[$0 - 4], $$[$0 - 3], $$[$0 - 1], $$[$0], []);
                break;
              case 49:
                yy.addPoint($$[$0 - 4], "", $$[$0 - 2], $$[$0 - 1], $$[$0]);
                break;
              case 50:
                yy.addPoint($$[$0 - 5], $$[$0 - 4], $$[$0 - 2], $$[$0 - 1], $$[$0]);
                break;
              case 51:
                yy.setXAxisLeftText($$[$0 - 2]);
                yy.setXAxisRightText($$[$0]);
                break;
              case 52:
                $$[$0 - 1].text += " \u27F6 ";
                yy.setXAxisLeftText($$[$0 - 1]);
                break;
              case 53:
                yy.setXAxisLeftText($$[$0]);
                break;
              case 54:
                yy.setYAxisBottomText($$[$0 - 2]);
                yy.setYAxisTopText($$[$0]);
                break;
              case 55:
                $$[$0 - 1].text += " \u27F6 ";
                yy.setYAxisBottomText($$[$0 - 1]);
                break;
              case 56:
                yy.setYAxisBottomText($$[$0]);
                break;
              case 57:
                yy.setQuadrant1Text($$[$0]);
                break;
              case 58:
                yy.setQuadrant2Text($$[$0]);
                break;
              case 59:
                yy.setQuadrant3Text($$[$0]);
                break;
              case 60:
                yy.setQuadrant4Text($$[$0]);
                break;
              case 64:
                this.$ = { text: $$[$0], type: "text" };
                break;
              case 65:
                this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type };
                break;
              case 66:
                this.$ = { text: $$[$0], type: "text" };
                break;
              case 67:
                this.$ = { text: $$[$0], type: "markdown" };
                break;
              case 68:
                this.$ = $$[$0];
                break;
              case 69:
                this.$ = $$[$0 - 1] + "" + $$[$0];
                break;
            }
          }, "anonymous"),
          table: [{ 18: $V0, 26: 1, 27: 2, 28: $V1, 55: $V2, 56: $V3, 57: $V4 }, { 1: [3] }, { 18: $V0, 26: 8, 27: 2, 28: $V1, 55: $V2, 56: $V3, 57: $V4 }, { 18: $V0, 26: 9, 27: 2, 28: $V1, 55: $V2, 56: $V3, 57: $V4 }, o2($V5, [2, 33], { 29: 10 }), o2($V6, [2, 61]), o2($V6, [2, 62]), o2($V6, [2, 63]), { 1: [2, 30] }, { 1: [2, 31] }, o2($V7, $V8, { 30: 11, 31: 12, 24: 13, 32: 15, 33: 16, 34: 17, 43: 30, 58: 31, 1: [2, 32], 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 18: $Vf, 25: $Vg, 35: $Vh, 37: $Vi, 39: $Vj, 41: $Vk, 42: $Vl, 48: $Vm, 50: $Vn, 51: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 60: $Vs, 61: $Vt, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }), o2($V5, [2, 34]), { 27: 45, 55: $V2, 56: $V3, 57: $V4 }, o2($V7, [2, 37]), o2($V7, $V8, { 24: 13, 32: 15, 33: 16, 34: 17, 43: 30, 58: 31, 31: 46, 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 18: $Vf, 25: $Vg, 35: $Vh, 37: $Vi, 39: $Vj, 41: $Vk, 42: $Vl, 48: $Vm, 50: $Vn, 51: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 60: $Vs, 61: $Vt, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }), o2($V7, [2, 39]), o2($V7, [2, 40]), o2($V7, [2, 41]), { 36: [1, 47] }, { 38: [1, 48] }, { 40: [1, 49] }, o2($V7, [2, 45]), o2($V7, [2, 46]), { 18: [1, 50] }, { 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 43: 51, 58: 31, 60: $Vs, 61: $Vt, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }, { 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 43: 52, 58: 31, 60: $Vs, 61: $Vt, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }, { 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 43: 53, 58: 31, 60: $Vs, 61: $Vt, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }, { 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 43: 54, 58: 31, 60: $Vs, 61: $Vt, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }, { 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 43: 55, 58: 31, 60: $Vs, 61: $Vt, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }, { 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 43: 56, 58: 31, 60: $Vs, 61: $Vt, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }, { 4: $V9, 5: $Va, 8: $Vz, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 18: $VA, 44: [1, 57], 47: [1, 58], 58: 60, 59: 59, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }, o2($VB, [2, 64]), o2($VB, [2, 66]), o2($VB, [2, 67]), o2($VB, [2, 70]), o2($VB, [2, 71]), o2($VB, [2, 72]), o2($VB, [2, 73]), o2($VB, [2, 74]), o2($VB, [2, 75]), o2($VB, [2, 76]), o2($VB, [2, 77]), o2($VB, [2, 78]), o2($VB, [2, 79]), o2($VB, [2, 80]), o2($V5, [2, 35]), o2($V7, [2, 38]), o2($V7, [2, 42]), o2($V7, [2, 43]), o2($V7, [2, 44]), { 3: 64, 4: $VC, 5: $VD, 6: $VE, 7: $VF, 8: $VG, 9: $VH, 10: $VI, 11: $VJ, 12: $VK, 13: $VL, 14: $VM, 15: $VN, 21: 63 }, o2($V7, [2, 53], { 59: 59, 58: 60, 4: $V9, 5: $Va, 8: $Vz, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 18: $VA, 49: [1, 77], 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }), o2($V7, [2, 56], { 59: 59, 58: 60, 4: $V9, 5: $Va, 8: $Vz, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 18: $VA, 49: [1, 78], 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }), o2($V7, [2, 57], { 59: 59, 58: 60, 4: $V9, 5: $Va, 8: $Vz, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 18: $VA, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }), o2($V7, [2, 58], { 59: 59, 58: 60, 4: $V9, 5: $Va, 8: $Vz, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 18: $VA, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }), o2($V7, [2, 59], { 59: 59, 58: 60, 4: $V9, 5: $Va, 8: $Vz, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 18: $VA, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }), o2($V7, [2, 60], { 59: 59, 58: 60, 4: $V9, 5: $Va, 8: $Vz, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 18: $VA, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }), { 45: [1, 79] }, { 44: [1, 80] }, o2($VB, [2, 65]), o2($VB, [2, 81]), o2($VB, [2, 82]), o2($VB, [2, 83]), { 3: 82, 4: $VC, 5: $VD, 6: $VE, 7: $VF, 8: $VG, 9: $VH, 10: $VI, 11: $VJ, 12: $VK, 13: $VL, 14: $VM, 15: $VN, 18: [1, 81] }, o2($VO, [2, 23]), o2($VO, [2, 1]), o2($VO, [2, 2]), o2($VO, [2, 3]), o2($VO, [2, 4]), o2($VO, [2, 5]), o2($VO, [2, 6]), o2($VO, [2, 7]), o2($VO, [2, 8]), o2($VO, [2, 9]), o2($VO, [2, 10]), o2($VO, [2, 11]), o2($VO, [2, 12]), o2($V7, [2, 52], { 58: 31, 43: 83, 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 60: $Vs, 61: $Vt, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }), o2($V7, [2, 55], { 58: 31, 43: 84, 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 60: $Vs, 61: $Vt, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }), { 46: [1, 85] }, { 45: [1, 86] }, { 4: $VP, 5: $VQ, 6: $VR, 8: $VS, 11: $VT, 13: $VU, 16: 89, 17: $VV, 18: $VW, 19: $VX, 20: $VY, 22: 88, 23: 87 }, o2($VO, [2, 24]), o2($V7, [2, 51], { 59: 59, 58: 60, 4: $V9, 5: $Va, 8: $Vz, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 18: $VA, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }), o2($V7, [2, 54], { 59: 59, 58: 60, 4: $V9, 5: $Va, 8: $Vz, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 18: $VA, 63: $Vu, 64: $Vv, 65: $Vw, 66: $Vx, 67: $Vy }), o2($V7, [2, 47], { 22: 88, 16: 89, 23: 100, 4: $VP, 5: $VQ, 6: $VR, 8: $VS, 11: $VT, 13: $VU, 17: $VV, 18: $VW, 19: $VX, 20: $VY }), { 46: [1, 101] }, o2($V7, [2, 29], { 10: $VZ }), o2($V_, [2, 27], { 16: 103, 4: $VP, 5: $VQ, 6: $VR, 8: $VS, 11: $VT, 13: $VU, 17: $VV, 18: $VW, 19: $VX, 20: $VY }), o2($V$, [2, 25]), o2($V$, [2, 13]), o2($V$, [2, 14]), o2($V$, [2, 15]), o2($V$, [2, 16]), o2($V$, [2, 17]), o2($V$, [2, 18]), o2($V$, [2, 19]), o2($V$, [2, 20]), o2($V$, [2, 21]), o2($V$, [2, 22]), o2($V7, [2, 49], { 10: $VZ }), o2($V7, [2, 48], { 22: 88, 16: 89, 23: 104, 4: $VP, 5: $VQ, 6: $VR, 8: $VS, 11: $VT, 13: $VU, 17: $VV, 18: $VW, 19: $VX, 20: $VY }), { 4: $VP, 5: $VQ, 6: $VR, 8: $VS, 11: $VT, 13: $VU, 16: 89, 17: $VV, 18: $VW, 19: $VX, 20: $VY, 22: 105 }, o2($V$, [2, 26]), o2($V7, [2, 50], { 10: $VZ }), o2($V_, [2, 28], { 16: 103, 4: $VP, 5: $VQ, 6: $VR, 8: $VS, 11: $VT, 13: $VU, 17: $VV, 18: $VW, 19: $VX, 20: $VY })],
          defaultActions: { 8: [2, 30], 9: [2, 31] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  break;
                case 1:
                  break;
                case 2:
                  return 55;
                  break;
                case 3:
                  break;
                case 4:
                  this.begin("title");
                  return 35;
                  break;
                case 5:
                  this.popState();
                  return "title_value";
                  break;
                case 6:
                  this.begin("acc_title");
                  return 37;
                  break;
                case 7:
                  this.popState();
                  return "acc_title_value";
                  break;
                case 8:
                  this.begin("acc_descr");
                  return 39;
                  break;
                case 9:
                  this.popState();
                  return "acc_descr_value";
                  break;
                case 10:
                  this.begin("acc_descr_multiline");
                  break;
                case 11:
                  this.popState();
                  break;
                case 12:
                  return "acc_descr_multiline_value";
                  break;
                case 13:
                  return 48;
                  break;
                case 14:
                  return 50;
                  break;
                case 15:
                  return 49;
                  break;
                case 16:
                  return 51;
                  break;
                case 17:
                  return 52;
                  break;
                case 18:
                  return 53;
                  break;
                case 19:
                  return 54;
                  break;
                case 20:
                  return 25;
                  break;
                case 21:
                  this.begin("md_string");
                  break;
                case 22:
                  return "MD_STR";
                  break;
                case 23:
                  this.popState();
                  break;
                case 24:
                  this.begin("string");
                  break;
                case 25:
                  this.popState();
                  break;
                case 26:
                  return "STR";
                  break;
                case 27:
                  this.begin("class_name");
                  break;
                case 28:
                  this.popState();
                  return 47;
                  break;
                case 29:
                  this.begin("point_start");
                  return 44;
                  break;
                case 30:
                  this.begin("point_x");
                  return 45;
                  break;
                case 31:
                  this.popState();
                  break;
                case 32:
                  this.popState();
                  this.begin("point_y");
                  break;
                case 33:
                  this.popState();
                  return 46;
                  break;
                case 34:
                  return 28;
                  break;
                case 35:
                  return 4;
                  break;
                case 36:
                  return 11;
                  break;
                case 37:
                  return 64;
                  break;
                case 38:
                  return 10;
                  break;
                case 39:
                  return 65;
                  break;
                case 40:
                  return 65;
                  break;
                case 41:
                  return 14;
                  break;
                case 42:
                  return 13;
                  break;
                case 43:
                  return 67;
                  break;
                case 44:
                  return 66;
                  break;
                case 45:
                  return 12;
                  break;
                case 46:
                  return 8;
                  break;
                case 47:
                  return 5;
                  break;
                case 48:
                  return 18;
                  break;
                case 49:
                  return 56;
                  break;
                case 50:
                  return 63;
                  break;
                case 51:
                  return 57;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?: *x-axis *)/i, /^(?: *y-axis *)/i, /^(?: *--+> *)/i, /^(?: *quadrant-1 *)/i, /^(?: *quadrant-2 *)/i, /^(?: *quadrant-3 *)/i, /^(?: *quadrant-4 *)/i, /^(?:classDef\b)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?::::)/i, /^(?:^\w+)/i, /^(?:\s*:\s*\[\s*)/i, /^(?:(1)|(0(.\d+)?))/i, /^(?:\s*\] *)/i, /^(?:\s*,\s*)/i, /^(?:(1)|(0(.\d+)?))/i, /^(?: *quadrantChart *)/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s)/i, /^(?:;)/i, /^(?:[!"#$%&'*+,-.`?\\_/])/i, /^(?:$)/i],
            conditions: { "class_name": { "rules": [28], "inclusive": false }, "point_y": { "rules": [33], "inclusive": false }, "point_x": { "rules": [32], "inclusive": false }, "point_start": { "rules": [30, 31], "inclusive": false }, "acc_descr_multiline": { "rules": [11, 12], "inclusive": false }, "acc_descr": { "rules": [9], "inclusive": false }, "acc_title": { "rules": [7], "inclusive": false }, "title": { "rules": [5], "inclusive": false }, "md_string": { "rules": [22, 23], "inclusive": false }, "string": { "rules": [25, 26], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 27, 29, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser8.parser = parser8;
      quadrant_default = parser8;
    }
  });

  // src/diagrams/quadrant-chart/quadrantBuilder.ts
  var defaultThemeVariables, QuadrantBuilder;
  var init_quadrantBuilder = __esm({
    "src/diagrams/quadrant-chart/quadrantBuilder.ts"() {
      "use strict";
      init_src32();
      init_defaultConfig();
      init_logger();
      init_theme_default();
      defaultThemeVariables = getThemeVariables3();
      QuadrantBuilder = class {
        constructor() {
          this.classes = /* @__PURE__ */ new Map();
          this.config = this.getDefaultConfig();
          this.themeConfig = this.getDefaultThemeConfig();
          this.data = this.getDefaultData();
        }
        static {
          __name(this, "QuadrantBuilder");
        }
        getDefaultData() {
          return {
            titleText: "",
            quadrant1Text: "",
            quadrant2Text: "",
            quadrant3Text: "",
            quadrant4Text: "",
            xAxisLeftText: "",
            xAxisRightText: "",
            yAxisBottomText: "",
            yAxisTopText: "",
            points: []
          };
        }
        getDefaultConfig() {
          return {
            showXAxis: true,
            showYAxis: true,
            showTitle: true,
            chartHeight: defaultConfig_default.quadrantChart?.chartWidth || 500,
            chartWidth: defaultConfig_default.quadrantChart?.chartHeight || 500,
            titlePadding: defaultConfig_default.quadrantChart?.titlePadding || 10,
            titleFontSize: defaultConfig_default.quadrantChart?.titleFontSize || 20,
            quadrantPadding: defaultConfig_default.quadrantChart?.quadrantPadding || 5,
            xAxisLabelPadding: defaultConfig_default.quadrantChart?.xAxisLabelPadding || 5,
            yAxisLabelPadding: defaultConfig_default.quadrantChart?.yAxisLabelPadding || 5,
            xAxisLabelFontSize: defaultConfig_default.quadrantChart?.xAxisLabelFontSize || 16,
            yAxisLabelFontSize: defaultConfig_default.quadrantChart?.yAxisLabelFontSize || 16,
            quadrantLabelFontSize: defaultConfig_default.quadrantChart?.quadrantLabelFontSize || 16,
            quadrantTextTopPadding: defaultConfig_default.quadrantChart?.quadrantTextTopPadding || 5,
            pointTextPadding: defaultConfig_default.quadrantChart?.pointTextPadding || 5,
            pointLabelFontSize: defaultConfig_default.quadrantChart?.pointLabelFontSize || 12,
            pointRadius: defaultConfig_default.quadrantChart?.pointRadius || 5,
            xAxisPosition: defaultConfig_default.quadrantChart?.xAxisPosition || "top",
            yAxisPosition: defaultConfig_default.quadrantChart?.yAxisPosition || "left",
            quadrantInternalBorderStrokeWidth: defaultConfig_default.quadrantChart?.quadrantInternalBorderStrokeWidth || 1,
            quadrantExternalBorderStrokeWidth: defaultConfig_default.quadrantChart?.quadrantExternalBorderStrokeWidth || 2
          };
        }
        getDefaultThemeConfig() {
          return {
            quadrant1Fill: defaultThemeVariables.quadrant1Fill,
            quadrant2Fill: defaultThemeVariables.quadrant2Fill,
            quadrant3Fill: defaultThemeVariables.quadrant3Fill,
            quadrant4Fill: defaultThemeVariables.quadrant4Fill,
            quadrant1TextFill: defaultThemeVariables.quadrant1TextFill,
            quadrant2TextFill: defaultThemeVariables.quadrant2TextFill,
            quadrant3TextFill: defaultThemeVariables.quadrant3TextFill,
            quadrant4TextFill: defaultThemeVariables.quadrant4TextFill,
            quadrantPointFill: defaultThemeVariables.quadrantPointFill,
            quadrantPointTextFill: defaultThemeVariables.quadrantPointTextFill,
            quadrantXAxisTextFill: defaultThemeVariables.quadrantXAxisTextFill,
            quadrantYAxisTextFill: defaultThemeVariables.quadrantYAxisTextFill,
            quadrantTitleFill: defaultThemeVariables.quadrantTitleFill,
            quadrantInternalBorderStrokeFill: defaultThemeVariables.quadrantInternalBorderStrokeFill,
            quadrantExternalBorderStrokeFill: defaultThemeVariables.quadrantExternalBorderStrokeFill
          };
        }
        clear() {
          this.config = this.getDefaultConfig();
          this.themeConfig = this.getDefaultThemeConfig();
          this.data = this.getDefaultData();
          this.classes = /* @__PURE__ */ new Map();
          log.info("clear called");
        }
        setData(data5) {
          this.data = { ...this.data, ...data5 };
        }
        addPoints(points) {
          this.data.points = [...points, ...this.data.points];
        }
        addClass(className, styles5) {
          this.classes.set(className, styles5);
        }
        setConfig(config5) {
          log.trace("setConfig called with: ", config5);
          this.config = { ...this.config, ...config5 };
        }
        setThemeConfig(themeConfig) {
          log.trace("setThemeConfig called with: ", themeConfig);
          this.themeConfig = { ...this.themeConfig, ...themeConfig };
        }
        calculateSpace(xAxisPosition, showXAxis, showYAxis, showTitle) {
          const xAxisSpaceCalculation = this.config.xAxisLabelPadding * 2 + this.config.xAxisLabelFontSize;
          const xAxisSpace = {
            top: xAxisPosition === "top" && showXAxis ? xAxisSpaceCalculation : 0,
            bottom: xAxisPosition === "bottom" && showXAxis ? xAxisSpaceCalculation : 0
          };
          const yAxisSpaceCalculation = this.config.yAxisLabelPadding * 2 + this.config.yAxisLabelFontSize;
          const yAxisSpace = {
            left: this.config.yAxisPosition === "left" && showYAxis ? yAxisSpaceCalculation : 0,
            right: this.config.yAxisPosition === "right" && showYAxis ? yAxisSpaceCalculation : 0
          };
          const titleSpaceCalculation = this.config.titleFontSize + this.config.titlePadding * 2;
          const titleSpace = {
            top: showTitle ? titleSpaceCalculation : 0
          };
          const quadrantLeft = this.config.quadrantPadding + yAxisSpace.left;
          const quadrantTop = this.config.quadrantPadding + xAxisSpace.top + titleSpace.top;
          const quadrantWidth = this.config.chartWidth - this.config.quadrantPadding * 2 - yAxisSpace.left - yAxisSpace.right;
          const quadrantHeight = this.config.chartHeight - this.config.quadrantPadding * 2 - xAxisSpace.top - xAxisSpace.bottom - titleSpace.top;
          const quadrantHalfWidth = quadrantWidth / 2;
          const quadrantHalfHeight = quadrantHeight / 2;
          const quadrantSpace = {
            quadrantLeft,
            quadrantTop,
            quadrantWidth,
            quadrantHalfWidth,
            quadrantHeight,
            quadrantHalfHeight
          };
          return {
            xAxisSpace,
            yAxisSpace,
            titleSpace,
            quadrantSpace
          };
        }
        getAxisLabels(xAxisPosition, showXAxis, showYAxis, spaceData) {
          const { quadrantSpace, titleSpace } = spaceData;
          const {
            quadrantHalfHeight,
            quadrantHeight,
            quadrantLeft,
            quadrantHalfWidth,
            quadrantTop,
            quadrantWidth
          } = quadrantSpace;
          const drawXAxisLabelsInMiddle = Boolean(this.data.xAxisRightText);
          const drawYAxisLabelsInMiddle = Boolean(this.data.yAxisTopText);
          const axisLabels = [];
          if (this.data.xAxisLeftText && showXAxis) {
            axisLabels.push({
              text: this.data.xAxisLeftText,
              fill: this.themeConfig.quadrantXAxisTextFill,
              x: quadrantLeft + (drawXAxisLabelsInMiddle ? quadrantHalfWidth / 2 : 0),
              y: xAxisPosition === "top" ? this.config.xAxisLabelPadding + titleSpace.top : this.config.xAxisLabelPadding + quadrantTop + quadrantHeight + this.config.quadrantPadding,
              fontSize: this.config.xAxisLabelFontSize,
              verticalPos: drawXAxisLabelsInMiddle ? "center" : "left",
              horizontalPos: "top",
              rotation: 0
            });
          }
          if (this.data.xAxisRightText && showXAxis) {
            axisLabels.push({
              text: this.data.xAxisRightText,
              fill: this.themeConfig.quadrantXAxisTextFill,
              x: quadrantLeft + quadrantHalfWidth + (drawXAxisLabelsInMiddle ? quadrantHalfWidth / 2 : 0),
              y: xAxisPosition === "top" ? this.config.xAxisLabelPadding + titleSpace.top : this.config.xAxisLabelPadding + quadrantTop + quadrantHeight + this.config.quadrantPadding,
              fontSize: this.config.xAxisLabelFontSize,
              verticalPos: drawXAxisLabelsInMiddle ? "center" : "left",
              horizontalPos: "top",
              rotation: 0
            });
          }
          if (this.data.yAxisBottomText && showYAxis) {
            axisLabels.push({
              text: this.data.yAxisBottomText,
              fill: this.themeConfig.quadrantYAxisTextFill,
              x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + quadrantLeft + quadrantWidth + this.config.quadrantPadding,
              y: quadrantTop + quadrantHeight - (drawYAxisLabelsInMiddle ? quadrantHalfHeight / 2 : 0),
              fontSize: this.config.yAxisLabelFontSize,
              verticalPos: drawYAxisLabelsInMiddle ? "center" : "left",
              horizontalPos: "top",
              rotation: -90
            });
          }
          if (this.data.yAxisTopText && showYAxis) {
            axisLabels.push({
              text: this.data.yAxisTopText,
              fill: this.themeConfig.quadrantYAxisTextFill,
              x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + quadrantLeft + quadrantWidth + this.config.quadrantPadding,
              y: quadrantTop + quadrantHalfHeight - (drawYAxisLabelsInMiddle ? quadrantHalfHeight / 2 : 0),
              fontSize: this.config.yAxisLabelFontSize,
              verticalPos: drawYAxisLabelsInMiddle ? "center" : "left",
              horizontalPos: "top",
              rotation: -90
            });
          }
          return axisLabels;
        }
        getQuadrants(spaceData) {
          const { quadrantSpace } = spaceData;
          const { quadrantHalfHeight, quadrantLeft, quadrantHalfWidth, quadrantTop } = quadrantSpace;
          const quadrants = [
            {
              text: {
                text: this.data.quadrant1Text,
                fill: this.themeConfig.quadrant1TextFill,
                x: 0,
                y: 0,
                fontSize: this.config.quadrantLabelFontSize,
                verticalPos: "center",
                horizontalPos: "middle",
                rotation: 0
              },
              x: quadrantLeft + quadrantHalfWidth,
              y: quadrantTop,
              width: quadrantHalfWidth,
              height: quadrantHalfHeight,
              fill: this.themeConfig.quadrant1Fill
            },
            {
              text: {
                text: this.data.quadrant2Text,
                fill: this.themeConfig.quadrant2TextFill,
                x: 0,
                y: 0,
                fontSize: this.config.quadrantLabelFontSize,
                verticalPos: "center",
                horizontalPos: "middle",
                rotation: 0
              },
              x: quadrantLeft,
              y: quadrantTop,
              width: quadrantHalfWidth,
              height: quadrantHalfHeight,
              fill: this.themeConfig.quadrant2Fill
            },
            {
              text: {
                text: this.data.quadrant3Text,
                fill: this.themeConfig.quadrant3TextFill,
                x: 0,
                y: 0,
                fontSize: this.config.quadrantLabelFontSize,
                verticalPos: "center",
                horizontalPos: "middle",
                rotation: 0
              },
              x: quadrantLeft,
              y: quadrantTop + quadrantHalfHeight,
              width: quadrantHalfWidth,
              height: quadrantHalfHeight,
              fill: this.themeConfig.quadrant3Fill
            },
            {
              text: {
                text: this.data.quadrant4Text,
                fill: this.themeConfig.quadrant4TextFill,
                x: 0,
                y: 0,
                fontSize: this.config.quadrantLabelFontSize,
                verticalPos: "center",
                horizontalPos: "middle",
                rotation: 0
              },
              x: quadrantLeft + quadrantHalfWidth,
              y: quadrantTop + quadrantHalfHeight,
              width: quadrantHalfWidth,
              height: quadrantHalfHeight,
              fill: this.themeConfig.quadrant4Fill
            }
          ];
          for (const quadrant of quadrants) {
            quadrant.text.x = quadrant.x + quadrant.width / 2;
            if (this.data.points.length === 0) {
              quadrant.text.y = quadrant.y + quadrant.height / 2;
              quadrant.text.horizontalPos = "middle";
            } else {
              quadrant.text.y = quadrant.y + this.config.quadrantTextTopPadding;
              quadrant.text.horizontalPos = "top";
            }
          }
          return quadrants;
        }
        getQuadrantPoints(spaceData) {
          const { quadrantSpace } = spaceData;
          const { quadrantHeight, quadrantLeft, quadrantTop, quadrantWidth } = quadrantSpace;
          const xAxis = linear2().domain([0, 1]).range([quadrantLeft, quadrantWidth + quadrantLeft]);
          const yAxis = linear2().domain([0, 1]).range([quadrantHeight + quadrantTop, quadrantTop]);
          const points = this.data.points.map((point8) => {
            const classStyles = this.classes.get(point8.className);
            if (classStyles) {
              point8 = { ...classStyles, ...point8 };
            }
            const props = {
              x: xAxis(point8.x),
              y: yAxis(point8.y),
              fill: point8.color ?? this.themeConfig.quadrantPointFill,
              radius: point8.radius ?? this.config.pointRadius,
              text: {
                text: point8.text,
                fill: this.themeConfig.quadrantPointTextFill,
                x: xAxis(point8.x),
                y: yAxis(point8.y) + this.config.pointTextPadding,
                verticalPos: "center",
                horizontalPos: "top",
                fontSize: this.config.pointLabelFontSize,
                rotation: 0
              },
              strokeColor: point8.strokeColor ?? this.themeConfig.quadrantPointFill,
              strokeWidth: point8.strokeWidth ?? "0px"
            };
            return props;
          });
          return points;
        }
        getBorders(spaceData) {
          const halfExternalBorderWidth = this.config.quadrantExternalBorderStrokeWidth / 2;
          const { quadrantSpace } = spaceData;
          const {
            quadrantHalfHeight,
            quadrantHeight,
            quadrantLeft,
            quadrantHalfWidth,
            quadrantTop,
            quadrantWidth
          } = quadrantSpace;
          const borderLines = [
            // top border
            {
              strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
              strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
              x1: quadrantLeft - halfExternalBorderWidth,
              y1: quadrantTop,
              x2: quadrantLeft + quadrantWidth + halfExternalBorderWidth,
              y2: quadrantTop
            },
            // right border
            {
              strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
              strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
              x1: quadrantLeft + quadrantWidth,
              y1: quadrantTop + halfExternalBorderWidth,
              x2: quadrantLeft + quadrantWidth,
              y2: quadrantTop + quadrantHeight - halfExternalBorderWidth
            },
            // bottom border
            {
              strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
              strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
              x1: quadrantLeft - halfExternalBorderWidth,
              y1: quadrantTop + quadrantHeight,
              x2: quadrantLeft + quadrantWidth + halfExternalBorderWidth,
              y2: quadrantTop + quadrantHeight
            },
            // left border
            {
              strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
              strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
              x1: quadrantLeft,
              y1: quadrantTop + halfExternalBorderWidth,
              x2: quadrantLeft,
              y2: quadrantTop + quadrantHeight - halfExternalBorderWidth
            },
            // vertical inner border
            {
              strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
              strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
              x1: quadrantLeft + quadrantHalfWidth,
              y1: quadrantTop + halfExternalBorderWidth,
              x2: quadrantLeft + quadrantHalfWidth,
              y2: quadrantTop + quadrantHeight - halfExternalBorderWidth
            },
            // horizontal inner border
            {
              strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
              strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
              x1: quadrantLeft + halfExternalBorderWidth,
              y1: quadrantTop + quadrantHalfHeight,
              x2: quadrantLeft + quadrantWidth - halfExternalBorderWidth,
              y2: quadrantTop + quadrantHalfHeight
            }
          ];
          return borderLines;
        }
        getTitle(showTitle) {
          if (showTitle) {
            return {
              text: this.data.titleText,
              fill: this.themeConfig.quadrantTitleFill,
              fontSize: this.config.titleFontSize,
              horizontalPos: "top",
              verticalPos: "center",
              rotation: 0,
              y: this.config.titlePadding,
              x: this.config.chartWidth / 2
            };
          }
          return;
        }
        build() {
          const showXAxis = this.config.showXAxis && !!(this.data.xAxisLeftText || this.data.xAxisRightText);
          const showYAxis = this.config.showYAxis && !!(this.data.yAxisTopText || this.data.yAxisBottomText);
          const showTitle = this.config.showTitle && !!this.data.titleText;
          const xAxisPosition = this.data.points.length > 0 ? "bottom" : this.config.xAxisPosition;
          const calculatedSpace = this.calculateSpace(xAxisPosition, showXAxis, showYAxis, showTitle);
          return {
            points: this.getQuadrantPoints(calculatedSpace),
            quadrants: this.getQuadrants(calculatedSpace),
            axisLabels: this.getAxisLabels(xAxisPosition, showXAxis, showYAxis, calculatedSpace),
            borderLines: this.getBorders(calculatedSpace),
            title: this.getTitle(showTitle)
          };
        }
      };
    }
  });

  // src/diagrams/quadrant-chart/utils.ts
  function validateHexCode(value2) {
    return !/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(value2);
  }
  function validateNumber(value2) {
    return !/^\d+$/.test(value2);
  }
  function validateSizeInPixels(value2) {
    return !/^\d+px$/.test(value2);
  }
  var InvalidStyleError;
  var init_utils5 = __esm({
    "src/diagrams/quadrant-chart/utils.ts"() {
      "use strict";
      InvalidStyleError = class extends Error {
        static {
          __name(this, "InvalidStyleError");
        }
        constructor(style3, value2, type3) {
          super(`value for ${style3} ${value2} is invalid, please use a valid ${type3}`);
          this.name = "InvalidStyleError";
        }
      };
      __name(validateHexCode, "validateHexCode");
      __name(validateNumber, "validateNumber");
      __name(validateSizeInPixels, "validateSizeInPixels");
    }
  });

  // src/diagrams/quadrant-chart/quadrantDb.ts
  function textSanitizer(text4) {
    return sanitizeText(text4.trim(), config3);
  }
  function setQuadrant1Text(textObj) {
    quadrantBuilder.setData({ quadrant1Text: textSanitizer(textObj.text) });
  }
  function setQuadrant2Text(textObj) {
    quadrantBuilder.setData({ quadrant2Text: textSanitizer(textObj.text) });
  }
  function setQuadrant3Text(textObj) {
    quadrantBuilder.setData({ quadrant3Text: textSanitizer(textObj.text) });
  }
  function setQuadrant4Text(textObj) {
    quadrantBuilder.setData({ quadrant4Text: textSanitizer(textObj.text) });
  }
  function setXAxisLeftText(textObj) {
    quadrantBuilder.setData({ xAxisLeftText: textSanitizer(textObj.text) });
  }
  function setXAxisRightText(textObj) {
    quadrantBuilder.setData({ xAxisRightText: textSanitizer(textObj.text) });
  }
  function setYAxisTopText(textObj) {
    quadrantBuilder.setData({ yAxisTopText: textSanitizer(textObj.text) });
  }
  function setYAxisBottomText(textObj) {
    quadrantBuilder.setData({ yAxisBottomText: textSanitizer(textObj.text) });
  }
  function parseStyles(styles5) {
    const stylesObject = {};
    for (const style3 of styles5) {
      const [key, value2] = style3.trim().split(/\s*:\s*/);
      if (key === "radius") {
        if (validateNumber(value2)) {
          throw new InvalidStyleError(key, value2, "number");
        }
        stylesObject.radius = parseInt(value2);
      } else if (key === "color") {
        if (validateHexCode(value2)) {
          throw new InvalidStyleError(key, value2, "hex code");
        }
        stylesObject.color = value2;
      } else if (key === "stroke-color") {
        if (validateHexCode(value2)) {
          throw new InvalidStyleError(key, value2, "hex code");
        }
        stylesObject.strokeColor = value2;
      } else if (key === "stroke-width") {
        if (validateSizeInPixels(value2)) {
          throw new InvalidStyleError(key, value2, "number of pixels (eg. 10px)");
        }
        stylesObject.strokeWidth = value2;
      } else {
        throw new Error(`style named ${key} is not supported.`);
      }
    }
    return stylesObject;
  }
  function addPoint(textObj, className, x5, y6, styles5) {
    const stylesObject = parseStyles(styles5);
    quadrantBuilder.addPoints([
      {
        x: x5,
        y: y6,
        text: textSanitizer(textObj.text),
        className,
        ...stylesObject
      }
    ]);
  }
  function addClass2(className, styles5) {
    quadrantBuilder.addClass(className, parseStyles(styles5));
  }
  function setWidth(width3) {
    quadrantBuilder.setConfig({ chartWidth: width3 });
  }
  function setHeight(height2) {
    quadrantBuilder.setConfig({ chartHeight: height2 });
  }
  function getQuadrantData() {
    const config5 = getConfig2();
    const { themeVariables, quadrantChart: quadrantChartConfig } = config5;
    if (quadrantChartConfig) {
      quadrantBuilder.setConfig(quadrantChartConfig);
    }
    quadrantBuilder.setThemeConfig({
      quadrant1Fill: themeVariables.quadrant1Fill,
      quadrant2Fill: themeVariables.quadrant2Fill,
      quadrant3Fill: themeVariables.quadrant3Fill,
      quadrant4Fill: themeVariables.quadrant4Fill,
      quadrant1TextFill: themeVariables.quadrant1TextFill,
      quadrant2TextFill: themeVariables.quadrant2TextFill,
      quadrant3TextFill: themeVariables.quadrant3TextFill,
      quadrant4TextFill: themeVariables.quadrant4TextFill,
      quadrantPointFill: themeVariables.quadrantPointFill,
      quadrantPointTextFill: themeVariables.quadrantPointTextFill,
      quadrantXAxisTextFill: themeVariables.quadrantXAxisTextFill,
      quadrantYAxisTextFill: themeVariables.quadrantYAxisTextFill,
      quadrantExternalBorderStrokeFill: themeVariables.quadrantExternalBorderStrokeFill,
      quadrantInternalBorderStrokeFill: themeVariables.quadrantInternalBorderStrokeFill,
      quadrantTitleFill: themeVariables.quadrantTitleFill
    });
    quadrantBuilder.setData({ titleText: getDiagramTitle() });
    return quadrantBuilder.build();
  }
  var config3, quadrantBuilder, clear11, quadrantDb_default;
  var init_quadrantDb = __esm({
    "src/diagrams/quadrant-chart/quadrantDb.ts"() {
      "use strict";
      init_diagramAPI();
      init_common();
      init_commonDb();
      init_quadrantBuilder();
      init_utils5();
      config3 = getConfig2();
      __name(textSanitizer, "textSanitizer");
      quadrantBuilder = new QuadrantBuilder();
      __name(setQuadrant1Text, "setQuadrant1Text");
      __name(setQuadrant2Text, "setQuadrant2Text");
      __name(setQuadrant3Text, "setQuadrant3Text");
      __name(setQuadrant4Text, "setQuadrant4Text");
      __name(setXAxisLeftText, "setXAxisLeftText");
      __name(setXAxisRightText, "setXAxisRightText");
      __name(setYAxisTopText, "setYAxisTopText");
      __name(setYAxisBottomText, "setYAxisBottomText");
      __name(parseStyles, "parseStyles");
      __name(addPoint, "addPoint");
      __name(addClass2, "addClass");
      __name(setWidth, "setWidth");
      __name(setHeight, "setHeight");
      __name(getQuadrantData, "getQuadrantData");
      clear11 = /* @__PURE__ */ __name(function() {
        quadrantBuilder.clear();
        clear();
      }, "clear");
      quadrantDb_default = {
        setWidth,
        setHeight,
        setQuadrant1Text,
        setQuadrant2Text,
        setQuadrant3Text,
        setQuadrant4Text,
        setXAxisLeftText,
        setXAxisRightText,
        setYAxisTopText,
        setYAxisBottomText,
        parseStyles,
        addPoint,
        addClass: addClass2,
        getQuadrantData,
        clear: clear11,
        setAccTitle,
        getAccTitle,
        setDiagramTitle,
        getDiagramTitle,
        getAccDescription,
        setAccDescription
      };
    }
  });

  // src/diagrams/quadrant-chart/quadrantRenderer.ts
  var draw8, quadrantRenderer_default;
  var init_quadrantRenderer = __esm({
    "src/diagrams/quadrant-chart/quadrantRenderer.ts"() {
      "use strict";
      init_src32();
      init_diagramAPI();
      init_logger();
      init_setupGraphViewbox();
      draw8 = /* @__PURE__ */ __name((txt, id34, _version, diagObj) => {
        function getDominantBaseLine(horizontalPos) {
          return horizontalPos === "top" ? "hanging" : "middle";
        }
        __name(getDominantBaseLine, "getDominantBaseLine");
        function getTextAnchor(verticalPos) {
          return verticalPos === "left" ? "start" : "middle";
        }
        __name(getTextAnchor, "getTextAnchor");
        function getTransformation(data5) {
          return `translate(${data5.x}, ${data5.y}) rotate(${data5.rotation || 0})`;
        }
        __name(getTransformation, "getTransformation");
        const conf5 = getConfig2();
        log.debug("Rendering quadrant chart\n" + txt);
        const securityLevel = conf5.securityLevel;
        let sandboxElement;
        if (securityLevel === "sandbox") {
          sandboxElement = select_default2("#i" + id34);
        }
        const root3 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body");
        const svg2 = root3.select(`[id="${id34}"]`);
        const group2 = svg2.append("g").attr("class", "main");
        const width3 = conf5.quadrantChart?.chartWidth ?? 500;
        const height2 = conf5.quadrantChart?.chartHeight ?? 500;
        configureSvgSize(svg2, height2, width3, conf5.quadrantChart?.useMaxWidth ?? true);
        svg2.attr("viewBox", "0 0 " + width3 + " " + height2);
        diagObj.db.setHeight(height2);
        diagObj.db.setWidth(width3);
        const quadrantData = diagObj.db.getQuadrantData();
        const quadrantsGroup = group2.append("g").attr("class", "quadrants");
        const borderGroup = group2.append("g").attr("class", "border");
        const dataPointGroup = group2.append("g").attr("class", "data-points");
        const labelGroup = group2.append("g").attr("class", "labels");
        const titleGroup = group2.append("g").attr("class", "title");
        if (quadrantData.title) {
          titleGroup.append("text").attr("x", 0).attr("y", 0).attr("fill", quadrantData.title.fill).attr("font-size", quadrantData.title.fontSize).attr("dominant-baseline", getDominantBaseLine(quadrantData.title.horizontalPos)).attr("text-anchor", getTextAnchor(quadrantData.title.verticalPos)).attr("transform", getTransformation(quadrantData.title)).text(quadrantData.title.text);
        }
        if (quadrantData.borderLines) {
          borderGroup.selectAll("line").data(quadrantData.borderLines).enter().append("line").attr("x1", (data5) => data5.x1).attr("y1", (data5) => data5.y1).attr("x2", (data5) => data5.x2).attr("y2", (data5) => data5.y2).style("stroke", (data5) => data5.strokeFill).style("stroke-width", (data5) => data5.strokeWidth);
        }
        const quadrants = quadrantsGroup.selectAll("g.quadrant").data(quadrantData.quadrants).enter().append("g").attr("class", "quadrant");
        quadrants.append("rect").attr("x", (data5) => data5.x).attr("y", (data5) => data5.y).attr("width", (data5) => data5.width).attr("height", (data5) => data5.height).attr("fill", (data5) => data5.fill);
        quadrants.append("text").attr("x", 0).attr("y", 0).attr("fill", (data5) => data5.text.fill).attr("font-size", (data5) => data5.text.fontSize).attr(
          "dominant-baseline",
          (data5) => getDominantBaseLine(data5.text.horizontalPos)
        ).attr("text-anchor", (data5) => getTextAnchor(data5.text.verticalPos)).attr("transform", (data5) => getTransformation(data5.text)).text((data5) => data5.text.text);
        const labels = labelGroup.selectAll("g.label").data(quadrantData.axisLabels).enter().append("g").attr("class", "label");
        labels.append("text").attr("x", 0).attr("y", 0).text((data5) => data5.text).attr("fill", (data5) => data5.fill).attr("font-size", (data5) => data5.fontSize).attr("dominant-baseline", (data5) => getDominantBaseLine(data5.horizontalPos)).attr("text-anchor", (data5) => getTextAnchor(data5.verticalPos)).attr("transform", (data5) => getTransformation(data5));
        const dataPoints = dataPointGroup.selectAll("g.data-point").data(quadrantData.points).enter().append("g").attr("class", "data-point");
        dataPoints.append("circle").attr("cx", (data5) => data5.x).attr("cy", (data5) => data5.y).attr("r", (data5) => data5.radius).attr("fill", (data5) => data5.fill).attr("stroke", (data5) => data5.strokeColor).attr("stroke-width", (data5) => data5.strokeWidth);
        dataPoints.append("text").attr("x", 0).attr("y", 0).text((data5) => data5.text.text).attr("fill", (data5) => data5.text.fill).attr("font-size", (data5) => data5.text.fontSize).attr(
          "dominant-baseline",
          (data5) => getDominantBaseLine(data5.text.horizontalPos)
        ).attr("text-anchor", (data5) => getTextAnchor(data5.text.verticalPos)).attr("transform", (data5) => getTransformation(data5.text));
      }, "draw");
      quadrantRenderer_default = {
        draw: draw8
      };
    }
  });

  // src/diagrams/quadrant-chart/quadrantDiagram.ts
  var quadrantDiagram_exports = {};
  __export(quadrantDiagram_exports, {
    diagram: () => diagram8
  });
  var diagram8;
  var init_quadrantDiagram = __esm({
    "src/diagrams/quadrant-chart/quadrantDiagram.ts"() {
      "use strict";
      init_quadrant();
      init_quadrantDb();
      init_quadrantRenderer();
      diagram8 = {
        parser: quadrant_default,
        db: quadrantDb_default,
        renderer: quadrantRenderer_default,
        styles: /* @__PURE__ */ __name(() => "", "styles")
      };
    }
  });

  // src/diagrams/xychart/parser/xychart.jison
  var parser9, xychart_default;
  var init_xychart = __esm({
    "src/diagrams/xychart/parser/xychart.jison"() {
      "use strict";
      parser9 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [1, 10, 12, 14, 16, 18, 19, 21, 23], $V1 = [2, 6], $V2 = [1, 3], $V3 = [1, 5], $V4 = [1, 6], $V5 = [1, 7], $V6 = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $V7 = [1, 25], $V8 = [1, 26], $V9 = [1, 28], $Va = [1, 29], $Vb = [1, 30], $Vc = [1, 31], $Vd = [1, 32], $Ve = [1, 33], $Vf = [1, 34], $Vg = [1, 35], $Vh = [1, 36], $Vi = [1, 37], $Vj = [1, 43], $Vk = [1, 42], $Vl = [1, 47], $Vm = [1, 50], $Vn = [1, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $Vo = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36], $Vp = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], $Vq = [1, 64];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "eol": 4, "XYCHART": 5, "chartConfig": 6, "document": 7, "CHART_ORIENTATION": 8, "statement": 9, "title": 10, "text": 11, "X_AXIS": 12, "parseXAxis": 13, "Y_AXIS": 14, "parseYAxis": 15, "LINE": 16, "plotData": 17, "BAR": 18, "acc_title": 19, "acc_title_value": 20, "acc_descr": 21, "acc_descr_value": 22, "acc_descr_multiline_value": 23, "SQUARE_BRACES_START": 24, "commaSeparatedNumbers": 25, "SQUARE_BRACES_END": 26, "NUMBER_WITH_DECIMAL": 27, "COMMA": 28, "xAxisData": 29, "bandData": 30, "ARROW_DELIMITER": 31, "commaSeparatedTexts": 32, "yAxisData": 33, "NEWLINE": 34, "SEMI": 35, "EOF": 36, "alphaNum": 37, "STR": 38, "MD_STR": 39, "alphaNumToken": 40, "AMP": 41, "NUM": 42, "ALPHA": 43, "PLUS": 44, "EQUALS": 45, "MULT": 46, "DOT": 47, "BRKT": 48, "MINUS": 49, "UNDERSCORE": 50, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 5: "XYCHART", 8: "CHART_ORIENTATION", 10: "title", 12: "X_AXIS", 14: "Y_AXIS", 16: "LINE", 18: "BAR", 19: "acc_title", 20: "acc_title_value", 21: "acc_descr", 22: "acc_descr_value", 23: "acc_descr_multiline_value", 24: "SQUARE_BRACES_START", 26: "SQUARE_BRACES_END", 27: "NUMBER_WITH_DECIMAL", 28: "COMMA", 31: "ARROW_DELIMITER", 34: "NEWLINE", 35: "SEMI", 36: "EOF", 38: "STR", 39: "MD_STR", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "PLUS", 45: "EQUALS", 46: "MULT", 47: "DOT", 48: "BRKT", 49: "MINUS", 50: "UNDERSCORE" },
          productions_: [0, [3, 2], [3, 3], [3, 2], [3, 1], [6, 1], [7, 0], [7, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 3], [9, 2], [9, 3], [9, 2], [9, 2], [9, 1], [17, 3], [25, 3], [25, 1], [13, 1], [13, 2], [13, 1], [29, 1], [29, 3], [30, 3], [32, 3], [32, 1], [15, 1], [15, 2], [15, 1], [33, 3], [4, 1], [4, 1], [4, 1], [11, 1], [11, 1], [11, 1], [37, 1], [37, 2], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 5:
                yy.setOrientation($$[$0]);
                break;
              case 9:
                yy.setDiagramTitle($$[$0].text.trim());
                break;
              case 12:
                yy.setLineData({ text: "", type: "text" }, $$[$0]);
                break;
              case 13:
                yy.setLineData($$[$0 - 1], $$[$0]);
                break;
              case 14:
                yy.setBarData({ text: "", type: "text" }, $$[$0]);
                break;
              case 15:
                yy.setBarData($$[$0 - 1], $$[$0]);
                break;
              case 16:
                this.$ = $$[$0].trim();
                yy.setAccTitle(this.$);
                break;
              case 17:
              case 18:
                this.$ = $$[$0].trim();
                yy.setAccDescription(this.$);
                break;
              case 19:
                this.$ = $$[$0 - 1];
                break;
              case 20:
                this.$ = [Number($$[$0 - 2]), ...$$[$0]];
                break;
              case 21:
                this.$ = [Number($$[$0])];
                break;
              case 22:
                yy.setXAxisTitle($$[$0]);
                break;
              case 23:
                yy.setXAxisTitle($$[$0 - 1]);
                break;
              case 24:
                yy.setXAxisTitle({ type: "text", text: "" });
                break;
              case 25:
                yy.setXAxisBand($$[$0]);
                break;
              case 26:
                yy.setXAxisRangeData(Number($$[$0 - 2]), Number($$[$0]));
                break;
              case 27:
                this.$ = $$[$0 - 1];
                break;
              case 28:
                this.$ = [$$[$0 - 2], ...$$[$0]];
                break;
              case 29:
                this.$ = [$$[$0]];
                break;
              case 30:
                yy.setYAxisTitle($$[$0]);
                break;
              case 31:
                yy.setYAxisTitle($$[$0 - 1]);
                break;
              case 32:
                yy.setYAxisTitle({ type: "text", text: "" });
                break;
              case 33:
                yy.setYAxisRangeData(Number($$[$0 - 2]), Number($$[$0]));
                break;
              case 37:
                this.$ = { text: $$[$0], type: "text" };
                break;
              case 38:
                this.$ = { text: $$[$0], type: "text" };
                break;
              case 39:
                this.$ = { text: $$[$0], type: "markdown" };
                break;
              case 40:
                this.$ = $$[$0];
                break;
              case 41:
                this.$ = $$[$0 - 1] + "" + $$[$0];
                break;
            }
          }, "anonymous"),
          table: [o2($V0, $V1, { 3: 1, 4: 2, 7: 4, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [3] }, o2($V0, $V1, { 4: 2, 7: 4, 3: 8, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), o2($V0, $V1, { 4: 2, 7: 4, 6: 9, 3: 10, 5: $V2, 8: [1, 11], 34: $V3, 35: $V4, 36: $V5 }), { 1: [2, 4], 9: 12, 10: [1, 13], 12: [1, 14], 14: [1, 15], 16: [1, 16], 18: [1, 17], 19: [1, 18], 21: [1, 19], 23: [1, 20] }, o2($V6, [2, 34]), o2($V6, [2, 35]), o2($V6, [2, 36]), { 1: [2, 1] }, o2($V0, $V1, { 4: 2, 7: 4, 3: 21, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [2, 3] }, o2($V6, [2, 5]), o2($V0, [2, 7], { 4: 22, 34: $V3, 35: $V4, 36: $V5 }), { 11: 23, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 39, 13: 38, 24: $Vj, 27: $Vk, 29: 40, 30: 41, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 45, 15: 44, 27: $Vl, 33: 46, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 49, 17: 48, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 52, 17: 51, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 20: [1, 53] }, { 22: [1, 54] }, o2($Vn, [2, 18]), { 1: [2, 2] }, o2($Vn, [2, 8]), o2($Vn, [2, 9]), o2($Vo, [2, 37], { 40: 55, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }), o2($Vo, [2, 38]), o2($Vo, [2, 39]), o2($Vp, [2, 40]), o2($Vp, [2, 42]), o2($Vp, [2, 43]), o2($Vp, [2, 44]), o2($Vp, [2, 45]), o2($Vp, [2, 46]), o2($Vp, [2, 47]), o2($Vp, [2, 48]), o2($Vp, [2, 49]), o2($Vp, [2, 50]), o2($Vp, [2, 51]), o2($Vn, [2, 10]), o2($Vn, [2, 22], { 30: 41, 29: 56, 24: $Vj, 27: $Vk }), o2($Vn, [2, 24]), o2($Vn, [2, 25]), { 31: [1, 57] }, { 11: 59, 32: 58, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o2($Vn, [2, 11]), o2($Vn, [2, 30], { 33: 60, 27: $Vl }), o2($Vn, [2, 32]), { 31: [1, 61] }, o2($Vn, [2, 12]), { 17: 62, 24: $Vm }, { 25: 63, 27: $Vq }, o2($Vn, [2, 14]), { 17: 65, 24: $Vm }, o2($Vn, [2, 16]), o2($Vn, [2, 17]), o2($Vp, [2, 41]), o2($Vn, [2, 23]), { 27: [1, 66] }, { 26: [1, 67] }, { 26: [2, 29], 28: [1, 68] }, o2($Vn, [2, 31]), { 27: [1, 69] }, o2($Vn, [2, 13]), { 26: [1, 70] }, { 26: [2, 21], 28: [1, 71] }, o2($Vn, [2, 15]), o2($Vn, [2, 26]), o2($Vn, [2, 27]), { 11: 59, 32: 72, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o2($Vn, [2, 33]), o2($Vn, [2, 19]), { 25: 73, 27: $Vq }, { 26: [2, 28] }, { 26: [2, 20] }],
          defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 72: [2, 28], 73: [2, 20] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  break;
                case 1:
                  break;
                case 2:
                  this.popState();
                  return 34;
                  break;
                case 3:
                  this.popState();
                  return 34;
                  break;
                case 4:
                  return 34;
                  break;
                case 5:
                  break;
                case 6:
                  return 10;
                  break;
                case 7:
                  this.pushState("acc_title");
                  return 19;
                  break;
                case 8:
                  this.popState();
                  return "acc_title_value";
                  break;
                case 9:
                  this.pushState("acc_descr");
                  return 21;
                  break;
                case 10:
                  this.popState();
                  return "acc_descr_value";
                  break;
                case 11:
                  this.pushState("acc_descr_multiline");
                  break;
                case 12:
                  this.popState();
                  break;
                case 13:
                  return "acc_descr_multiline_value";
                  break;
                case 14:
                  return 5;
                  break;
                case 15:
                  return 5;
                  break;
                case 16:
                  return 8;
                  break;
                case 17:
                  this.pushState("axis_data");
                  return "X_AXIS";
                  break;
                case 18:
                  this.pushState("axis_data");
                  return "Y_AXIS";
                  break;
                case 19:
                  this.pushState("axis_band_data");
                  return 24;
                  break;
                case 20:
                  return 31;
                  break;
                case 21:
                  this.pushState("data");
                  return 16;
                  break;
                case 22:
                  this.pushState("data");
                  return 18;
                  break;
                case 23:
                  this.pushState("data_inner");
                  return 24;
                  break;
                case 24:
                  return 27;
                  break;
                case 25:
                  this.popState();
                  return 26;
                  break;
                case 26:
                  this.popState();
                  break;
                case 27:
                  this.pushState("string");
                  break;
                case 28:
                  this.popState();
                  break;
                case 29:
                  return "STR";
                  break;
                case 30:
                  return 24;
                  break;
                case 31:
                  return 26;
                  break;
                case 32:
                  return 43;
                  break;
                case 33:
                  return "COLON";
                  break;
                case 34:
                  return 44;
                  break;
                case 35:
                  return 28;
                  break;
                case 36:
                  return 45;
                  break;
                case 37:
                  return 46;
                  break;
                case 38:
                  return 48;
                  break;
                case 39:
                  return 50;
                  break;
                case 40:
                  return 47;
                  break;
                case 41:
                  return 41;
                  break;
                case 42:
                  return 49;
                  break;
                case 43:
                  return 42;
                  break;
                case 44:
                  break;
                case 45:
                  return 35;
                  break;
                case 46:
                  return 36;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:(\r?\n))/i, /^(?:(\r?\n))/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:\})/i, /^(?:[^\}]*)/i, /^(?:xychart-beta\b)/i, /^(?:xychart\b)/i, /^(?:(?:vertical|horizontal))/i, /^(?:x-axis\b)/i, /^(?:y-axis\b)/i, /^(?:\[)/i, /^(?:-->)/i, /^(?:line\b)/i, /^(?:bar\b)/i, /^(?:\[)/i, /^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i, /^(?:\])/i, /^(?:(?:`\)                                    \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+                  \{ return MD_STR; \}\n<md_string>\(\?:`))/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s+)/i, /^(?:;)/i, /^(?:$)/i],
            conditions: { "data_inner": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], "inclusive": true }, "data": { "rules": [0, 1, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 23, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], "inclusive": true }, "axis_band_data": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], "inclusive": true }, "axis_data": { "rules": [0, 1, 2, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], "inclusive": true }, "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "title": { "rules": [], "inclusive": false }, "md_string": { "rules": [], "inclusive": false }, "string": { "rules": [28, 29], "inclusive": false }, "INITIAL": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser9.parser = parser9;
      xychart_default = parser9;
    }
  });

  // src/diagrams/xychart/chartBuilder/interfaces.ts
  function isBarPlot(data5) {
    return data5.type === "bar";
  }
  function isBandAxisData(data5) {
    return data5.type === "band";
  }
  function isLinearAxisData(data5) {
    return data5.type === "linear";
  }
  var init_interfaces = __esm({
    "src/diagrams/xychart/chartBuilder/interfaces.ts"() {
      "use strict";
      __name(isBarPlot, "isBarPlot");
      __name(isBandAxisData, "isBandAxisData");
      __name(isLinearAxisData, "isLinearAxisData");
    }
  });

  // src/diagrams/xychart/chartBuilder/textDimensionCalculator.ts
  var TextDimensionCalculatorWithFont;
  var init_textDimensionCalculator = __esm({
    "src/diagrams/xychart/chartBuilder/textDimensionCalculator.ts"() {
      "use strict";
      init_createText();
      TextDimensionCalculatorWithFont = class {
        constructor(parentGroup) {
          this.parentGroup = parentGroup;
        }
        static {
          __name(this, "TextDimensionCalculatorWithFont");
        }
        getMaxDimension(texts, fontSize) {
          if (!this.parentGroup) {
            return {
              width: texts.reduce((acc, cur) => Math.max(cur.length, acc), 0) * fontSize,
              height: fontSize
            };
          }
          const dimension = {
            width: 0,
            height: 0
          };
          const elem = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", fontSize);
          for (const t4 of texts) {
            const bbox = computeDimensionOfText(elem, 1, t4);
            const width3 = bbox ? bbox.width : t4.length * fontSize;
            const height2 = bbox ? bbox.height : fontSize;
            dimension.width = Math.max(dimension.width, width3);
            dimension.height = Math.max(dimension.height, height2);
          }
          elem.remove();
          return dimension;
        }
      };
    }
  });

  // src/diagrams/xychart/chartBuilder/components/axis/baseAxis.ts
  var BAR_WIDTH_TO_TICK_WIDTH_RATIO, MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL, BaseAxis;
  var init_baseAxis = __esm({
    "src/diagrams/xychart/chartBuilder/components/axis/baseAxis.ts"() {
      "use strict";
      BAR_WIDTH_TO_TICK_WIDTH_RATIO = 0.7;
      MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL = 0.2;
      BaseAxis = class {
        constructor(axisConfig, title2, textDimensionCalculator, axisThemeConfig) {
          this.axisConfig = axisConfig;
          this.title = title2;
          this.textDimensionCalculator = textDimensionCalculator;
          this.axisThemeConfig = axisThemeConfig;
          this.boundingRect = { x: 0, y: 0, width: 0, height: 0 };
          this.axisPosition = "left";
          this.showTitle = false;
          this.showLabel = false;
          this.showTick = false;
          this.showAxisLine = false;
          this.outerPadding = 0;
          this.titleTextHeight = 0;
          this.labelTextHeight = 0;
          this.range = [0, 10];
          this.boundingRect = { x: 0, y: 0, width: 0, height: 0 };
          this.axisPosition = "left";
        }
        static {
          __name(this, "BaseAxis");
        }
        setRange(range3) {
          this.range = range3;
          if (this.axisPosition === "left" || this.axisPosition === "right") {
            this.boundingRect.height = range3[1] - range3[0];
          } else {
            this.boundingRect.width = range3[1] - range3[0];
          }
          this.recalculateScale();
        }
        getRange() {
          return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
        }
        setAxisPosition(axisPosition) {
          this.axisPosition = axisPosition;
          this.setRange(this.range);
        }
        getTickDistance() {
          const range3 = this.getRange();
          return Math.abs(range3[0] - range3[1]) / this.getTickValues().length;
        }
        getAxisOuterPadding() {
          return this.outerPadding;
        }
        getLabelDimension() {
          return this.textDimensionCalculator.getMaxDimension(
            this.getTickValues().map((tick) => tick.toString()),
            this.axisConfig.labelFontSize
          );
        }
        recalculateOuterPaddingToDrawBar() {
          if (BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() > this.outerPadding * 2) {
            this.outerPadding = Math.floor(BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() / 2);
          }
          this.recalculateScale();
        }
        calculateSpaceIfDrawnHorizontally(availableSpace) {
          let availableHeight = availableSpace.height;
          if (this.axisConfig.showAxisLine && availableHeight > this.axisConfig.axisLineWidth) {
            availableHeight -= this.axisConfig.axisLineWidth;
            this.showAxisLine = true;
          }
          if (this.axisConfig.showLabel) {
            const spaceRequired = this.getLabelDimension();
            const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.width;
            this.outerPadding = Math.min(spaceRequired.width / 2, maxPadding);
            const heightRequired = spaceRequired.height + this.axisConfig.labelPadding * 2;
            this.labelTextHeight = spaceRequired.height;
            if (heightRequired <= availableHeight) {
              availableHeight -= heightRequired;
              this.showLabel = true;
            }
          }
          if (this.axisConfig.showTick && availableHeight >= this.axisConfig.tickLength) {
            this.showTick = true;
            availableHeight -= this.axisConfig.tickLength;
          }
          if (this.axisConfig.showTitle && this.title) {
            const spaceRequired = this.textDimensionCalculator.getMaxDimension(
              [this.title],
              this.axisConfig.titleFontSize
            );
            const heightRequired = spaceRequired.height + this.axisConfig.titlePadding * 2;
            this.titleTextHeight = spaceRequired.height;
            if (heightRequired <= availableHeight) {
              availableHeight -= heightRequired;
              this.showTitle = true;
            }
          }
          this.boundingRect.width = availableSpace.width;
          this.boundingRect.height = availableSpace.height - availableHeight;
        }
        calculateSpaceIfDrawnVertical(availableSpace) {
          let availableWidth = availableSpace.width;
          if (this.axisConfig.showAxisLine && availableWidth > this.axisConfig.axisLineWidth) {
            availableWidth -= this.axisConfig.axisLineWidth;
            this.showAxisLine = true;
          }
          if (this.axisConfig.showLabel) {
            const spaceRequired = this.getLabelDimension();
            const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.height;
            this.outerPadding = Math.min(spaceRequired.height / 2, maxPadding);
            const widthRequired = spaceRequired.width + this.axisConfig.labelPadding * 2;
            if (widthRequired <= availableWidth) {
              availableWidth -= widthRequired;
              this.showLabel = true;
            }
          }
          if (this.axisConfig.showTick && availableWidth >= this.axisConfig.tickLength) {
            this.showTick = true;
            availableWidth -= this.axisConfig.tickLength;
          }
          if (this.axisConfig.showTitle && this.title) {
            const spaceRequired = this.textDimensionCalculator.getMaxDimension(
              [this.title],
              this.axisConfig.titleFontSize
            );
            const widthRequired = spaceRequired.height + this.axisConfig.titlePadding * 2;
            this.titleTextHeight = spaceRequired.height;
            if (widthRequired <= availableWidth) {
              availableWidth -= widthRequired;
              this.showTitle = true;
            }
          }
          this.boundingRect.width = availableSpace.width - availableWidth;
          this.boundingRect.height = availableSpace.height;
        }
        calculateSpace(availableSpace) {
          if (this.axisPosition === "left" || this.axisPosition === "right") {
            this.calculateSpaceIfDrawnVertical(availableSpace);
          } else {
            this.calculateSpaceIfDrawnHorizontally(availableSpace);
          }
          this.recalculateScale();
          return {
            width: this.boundingRect.width,
            height: this.boundingRect.height
          };
        }
        setBoundingBoxXY(point8) {
          this.boundingRect.x = point8.x;
          this.boundingRect.y = point8.y;
        }
        getDrawableElementsForLeftAxis() {
          const drawableElement = [];
          if (this.showAxisLine) {
            const x5 = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
            drawableElement.push({
              type: "path",
              groupTexts: ["left-axis", "axisl-line"],
              data: [
                {
                  path: `M ${x5},${this.boundingRect.y} L ${x5},${this.boundingRect.y + this.boundingRect.height} `,
                  strokeFill: this.axisThemeConfig.axisLineColor,
                  strokeWidth: this.axisConfig.axisLineWidth
                }
              ]
            });
          }
          if (this.showLabel) {
            drawableElement.push({
              type: "text",
              groupTexts: ["left-axis", "label"],
              data: this.getTickValues().map((tick) => ({
                text: tick.toString(),
                x: this.boundingRect.x + this.boundingRect.width - (this.showLabel ? this.axisConfig.labelPadding : 0) - (this.showTick ? this.axisConfig.tickLength : 0) - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
                y: this.getScaleValue(tick),
                fill: this.axisThemeConfig.labelColor,
                fontSize: this.axisConfig.labelFontSize,
                rotation: 0,
                verticalPos: "middle",
                horizontalPos: "right"
              }))
            });
          }
          if (this.showTick) {
            const x5 = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
            drawableElement.push({
              type: "path",
              groupTexts: ["left-axis", "ticks"],
              data: this.getTickValues().map((tick) => ({
                path: `M ${x5},${this.getScaleValue(tick)} L ${x5 - this.axisConfig.tickLength},${this.getScaleValue(tick)}`,
                strokeFill: this.axisThemeConfig.tickColor,
                strokeWidth: this.axisConfig.tickWidth
              }))
            });
          }
          if (this.showTitle) {
            drawableElement.push({
              type: "text",
              groupTexts: ["left-axis", "title"],
              data: [
                {
                  text: this.title,
                  x: this.boundingRect.x + this.axisConfig.titlePadding,
                  y: this.boundingRect.y + this.boundingRect.height / 2,
                  fill: this.axisThemeConfig.titleColor,
                  fontSize: this.axisConfig.titleFontSize,
                  rotation: 270,
                  verticalPos: "top",
                  horizontalPos: "center"
                }
              ]
            });
          }
          return drawableElement;
        }
        getDrawableElementsForBottomAxis() {
          const drawableElement = [];
          if (this.showAxisLine) {
            const y6 = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
            drawableElement.push({
              type: "path",
              groupTexts: ["bottom-axis", "axis-line"],
              data: [
                {
                  path: `M ${this.boundingRect.x},${y6} L ${this.boundingRect.x + this.boundingRect.width},${y6}`,
                  strokeFill: this.axisThemeConfig.axisLineColor,
                  strokeWidth: this.axisConfig.axisLineWidth
                }
              ]
            });
          }
          if (this.showLabel) {
            drawableElement.push({
              type: "text",
              groupTexts: ["bottom-axis", "label"],
              data: this.getTickValues().map((tick) => ({
                text: tick.toString(),
                x: this.getScaleValue(tick),
                y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
                fill: this.axisThemeConfig.labelColor,
                fontSize: this.axisConfig.labelFontSize,
                rotation: 0,
                verticalPos: "top",
                horizontalPos: "center"
              }))
            });
          }
          if (this.showTick) {
            const y6 = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
            drawableElement.push({
              type: "path",
              groupTexts: ["bottom-axis", "ticks"],
              data: this.getTickValues().map((tick) => ({
                path: `M ${this.getScaleValue(tick)},${y6} L ${this.getScaleValue(tick)},${y6 + this.axisConfig.tickLength}`,
                strokeFill: this.axisThemeConfig.tickColor,
                strokeWidth: this.axisConfig.tickWidth
              }))
            });
          }
          if (this.showTitle) {
            drawableElement.push({
              type: "text",
              groupTexts: ["bottom-axis", "title"],
              data: [
                {
                  text: this.title,
                  x: this.range[0] + (this.range[1] - this.range[0]) / 2,
                  y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
                  fill: this.axisThemeConfig.titleColor,
                  fontSize: this.axisConfig.titleFontSize,
                  rotation: 0,
                  verticalPos: "top",
                  horizontalPos: "center"
                }
              ]
            });
          }
          return drawableElement;
        }
        getDrawableElementsForTopAxis() {
          const drawableElement = [];
          if (this.showAxisLine) {
            const y6 = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
            drawableElement.push({
              type: "path",
              groupTexts: ["top-axis", "axis-line"],
              data: [
                {
                  path: `M ${this.boundingRect.x},${y6} L ${this.boundingRect.x + this.boundingRect.width},${y6}`,
                  strokeFill: this.axisThemeConfig.axisLineColor,
                  strokeWidth: this.axisConfig.axisLineWidth
                }
              ]
            });
          }
          if (this.showLabel) {
            drawableElement.push({
              type: "text",
              groupTexts: ["top-axis", "label"],
              data: this.getTickValues().map((tick) => ({
                text: tick.toString(),
                x: this.getScaleValue(tick),
                y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
                fill: this.axisThemeConfig.labelColor,
                fontSize: this.axisConfig.labelFontSize,
                rotation: 0,
                verticalPos: "top",
                horizontalPos: "center"
              }))
            });
          }
          if (this.showTick) {
            const y6 = this.boundingRect.y;
            drawableElement.push({
              type: "path",
              groupTexts: ["top-axis", "ticks"],
              data: this.getTickValues().map((tick) => ({
                path: `M ${this.getScaleValue(tick)},${y6 + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(tick)},${y6 + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`,
                strokeFill: this.axisThemeConfig.tickColor,
                strokeWidth: this.axisConfig.tickWidth
              }))
            });
          }
          if (this.showTitle) {
            drawableElement.push({
              type: "text",
              groupTexts: ["top-axis", "title"],
              data: [
                {
                  text: this.title,
                  x: this.boundingRect.x + this.boundingRect.width / 2,
                  y: this.boundingRect.y + this.axisConfig.titlePadding,
                  fill: this.axisThemeConfig.titleColor,
                  fontSize: this.axisConfig.titleFontSize,
                  rotation: 0,
                  verticalPos: "top",
                  horizontalPos: "center"
                }
              ]
            });
          }
          return drawableElement;
        }
        getDrawableElements() {
          if (this.axisPosition === "left") {
            return this.getDrawableElementsForLeftAxis();
          }
          if (this.axisPosition === "right") {
            throw Error("Drawing of right axis is not implemented");
          }
          if (this.axisPosition === "bottom") {
            return this.getDrawableElementsForBottomAxis();
          }
          if (this.axisPosition === "top") {
            return this.getDrawableElementsForTopAxis();
          }
          return [];
        }
      };
    }
  });

  // src/diagrams/xychart/chartBuilder/components/axis/bandAxis.ts
  var BandAxis;
  var init_bandAxis = __esm({
    "src/diagrams/xychart/chartBuilder/components/axis/bandAxis.ts"() {
      "use strict";
      init_src32();
      init_logger();
      init_baseAxis();
      BandAxis = class extends BaseAxis {
        static {
          __name(this, "BandAxis");
        }
        constructor(axisConfig, axisThemeConfig, categories, title2, textDimensionCalculator) {
          super(axisConfig, title2, textDimensionCalculator, axisThemeConfig);
          this.categories = categories;
          this.scale = band().domain(this.categories).range(this.getRange());
        }
        setRange(range3) {
          super.setRange(range3);
        }
        recalculateScale() {
          this.scale = band().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5);
          log.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
        }
        getTickValues() {
          return this.categories;
        }
        getScaleValue(value2) {
          return this.scale(value2) ?? this.getRange()[0];
        }
      };
    }
  });

  // src/diagrams/xychart/chartBuilder/components/axis/linearAxis.ts
  var LinearAxis;
  var init_linearAxis = __esm({
    "src/diagrams/xychart/chartBuilder/components/axis/linearAxis.ts"() {
      "use strict";
      init_src32();
      init_baseAxis();
      LinearAxis = class extends BaseAxis {
        static {
          __name(this, "LinearAxis");
        }
        constructor(axisConfig, axisThemeConfig, domain, title2, textDimensionCalculator) {
          super(axisConfig, title2, textDimensionCalculator, axisThemeConfig);
          this.domain = domain;
          this.scale = linear2().domain(this.domain).range(this.getRange());
        }
        getTickValues() {
          return this.scale.ticks();
        }
        recalculateScale() {
          const domain = [...this.domain];
          if (this.axisPosition === "left") {
            domain.reverse();
          }
          this.scale = linear2().domain(domain).range(this.getRange());
        }
        getScaleValue(value2) {
          return this.scale(value2);
        }
      };
    }
  });

  // src/diagrams/xychart/chartBuilder/components/axis/index.ts
  function getAxis(data5, axisConfig, axisThemeConfig, tmpSVGGroup2) {
    const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2);
    if (isBandAxisData(data5)) {
      return new BandAxis(
        axisConfig,
        axisThemeConfig,
        data5.categories,
        data5.title,
        textDimensionCalculator
      );
    }
    return new LinearAxis(
      axisConfig,
      axisThemeConfig,
      [data5.min, data5.max],
      data5.title,
      textDimensionCalculator
    );
  }
  var init_axis2 = __esm({
    "src/diagrams/xychart/chartBuilder/components/axis/index.ts"() {
      "use strict";
      init_interfaces();
      init_textDimensionCalculator();
      init_bandAxis();
      init_linearAxis();
      __name(getAxis, "getAxis");
    }
  });

  // src/diagrams/xychart/chartBuilder/components/chartTitle.ts
  function getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) {
    const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2);
    return new ChartTitle(textDimensionCalculator, chartConfig, chartData, chartThemeConfig);
  }
  var ChartTitle;
  var init_chartTitle = __esm({
    "src/diagrams/xychart/chartBuilder/components/chartTitle.ts"() {
      "use strict";
      init_textDimensionCalculator();
      ChartTitle = class {
        constructor(textDimensionCalculator, chartConfig, chartData, chartThemeConfig) {
          this.textDimensionCalculator = textDimensionCalculator;
          this.chartConfig = chartConfig;
          this.chartData = chartData;
          this.chartThemeConfig = chartThemeConfig;
          this.boundingRect = {
            x: 0,
            y: 0,
            width: 0,
            height: 0
          };
          this.showChartTitle = false;
        }
        static {
          __name(this, "ChartTitle");
        }
        setBoundingBoxXY(point8) {
          this.boundingRect.x = point8.x;
          this.boundingRect.y = point8.y;
        }
        calculateSpace(availableSpace) {
          const titleDimension = this.textDimensionCalculator.getMaxDimension(
            [this.chartData.title],
            this.chartConfig.titleFontSize
          );
          const widthRequired = Math.max(titleDimension.width, availableSpace.width);
          const heightRequired = titleDimension.height + 2 * this.chartConfig.titlePadding;
          if (titleDimension.width <= widthRequired && titleDimension.height <= heightRequired && this.chartConfig.showTitle && this.chartData.title) {
            this.boundingRect.width = widthRequired;
            this.boundingRect.height = heightRequired;
            this.showChartTitle = true;
          }
          return {
            width: this.boundingRect.width,
            height: this.boundingRect.height
          };
        }
        getDrawableElements() {
          const drawableElem = [];
          if (this.showChartTitle) {
            drawableElem.push({
              groupTexts: ["chart-title"],
              type: "text",
              data: [
                {
                  fontSize: this.chartConfig.titleFontSize,
                  text: this.chartData.title,
                  verticalPos: "middle",
                  horizontalPos: "center",
                  x: this.boundingRect.x + this.boundingRect.width / 2,
                  y: this.boundingRect.y + this.boundingRect.height / 2,
                  fill: this.chartThemeConfig.titleColor,
                  rotation: 0
                }
              ]
            });
          }
          return drawableElem;
        }
      };
      __name(getChartTitleComponent, "getChartTitleComponent");
    }
  });

  // src/diagrams/xychart/chartBuilder/components/plot/linePlot.ts
  var LinePlot;
  var init_linePlot = __esm({
    "src/diagrams/xychart/chartBuilder/components/plot/linePlot.ts"() {
      "use strict";
      init_src32();
      LinePlot = class {
        constructor(plotData, xAxis, yAxis, orientation, plotIndex2) {
          this.plotData = plotData;
          this.xAxis = xAxis;
          this.yAxis = yAxis;
          this.orientation = orientation;
          this.plotIndex = plotIndex2;
        }
        static {
          __name(this, "LinePlot");
        }
        getDrawableElement() {
          const finalData = this.plotData.data.map((d3) => [
            this.xAxis.getScaleValue(d3[0]),
            this.yAxis.getScaleValue(d3[1])
          ]);
          let path4;
          if (this.orientation === "horizontal") {
            path4 = line_default().y((d3) => d3[0]).x((d3) => d3[1])(finalData);
          } else {
            path4 = line_default().x((d3) => d3[0]).y((d3) => d3[1])(finalData);
          }
          if (!path4) {
            return [];
          }
          return [
            {
              groupTexts: ["plot", `line-plot-${this.plotIndex}`],
              type: "path",
              data: [
                {
                  path: path4,
                  strokeFill: this.plotData.strokeFill,
                  strokeWidth: this.plotData.strokeWidth
                }
              ]
            }
          ];
        }
      };
    }
  });

  // src/diagrams/xychart/chartBuilder/components/plot/barPlot.ts
  var BarPlot;
  var init_barPlot = __esm({
    "src/diagrams/xychart/chartBuilder/components/plot/barPlot.ts"() {
      "use strict";
      BarPlot = class {
        constructor(barData, boundingRect, xAxis, yAxis, orientation, plotIndex2) {
          this.barData = barData;
          this.boundingRect = boundingRect;
          this.xAxis = xAxis;
          this.yAxis = yAxis;
          this.orientation = orientation;
          this.plotIndex = plotIndex2;
        }
        static {
          __name(this, "BarPlot");
        }
        getDrawableElement() {
          const finalData = this.barData.data.map((d3) => [
            this.xAxis.getScaleValue(d3[0]),
            this.yAxis.getScaleValue(d3[1])
          ]);
          const barPaddingPercent = 0.05;
          const barWidth = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - barPaddingPercent);
          const barWidthHalf = barWidth / 2;
          if (this.orientation === "horizontal") {
            return [
              {
                groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
                type: "rect",
                data: finalData.map((data5) => ({
                  x: this.boundingRect.x,
                  y: data5[0] - barWidthHalf,
                  height: barWidth,
                  width: data5[1] - this.boundingRect.x,
                  fill: this.barData.fill,
                  strokeWidth: 0,
                  strokeFill: this.barData.fill
                }))
              }
            ];
          }
          return [
            {
              groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
              type: "rect",
              data: finalData.map((data5) => ({
                x: data5[0] - barWidthHalf,
                y: data5[1],
                width: barWidth,
                height: this.boundingRect.y + this.boundingRect.height - data5[1],
                fill: this.barData.fill,
                strokeWidth: 0,
                strokeFill: this.barData.fill
              }))
            }
          ];
        }
      };
    }
  });

  // src/diagrams/xychart/chartBuilder/components/plot/index.ts
  function getPlotComponent(chartConfig, chartData, chartThemeConfig) {
    return new BasePlot(chartConfig, chartData, chartThemeConfig);
  }
  var BasePlot;
  var init_plot = __esm({
    "src/diagrams/xychart/chartBuilder/components/plot/index.ts"() {
      "use strict";
      init_linePlot();
      init_barPlot();
      BasePlot = class {
        constructor(chartConfig, chartData, chartThemeConfig) {
          this.chartConfig = chartConfig;
          this.chartData = chartData;
          this.chartThemeConfig = chartThemeConfig;
          this.boundingRect = {
            x: 0,
            y: 0,
            width: 0,
            height: 0
          };
        }
        static {
          __name(this, "BasePlot");
        }
        setAxes(xAxis, yAxis) {
          this.xAxis = xAxis;
          this.yAxis = yAxis;
        }
        setBoundingBoxXY(point8) {
          this.boundingRect.x = point8.x;
          this.boundingRect.y = point8.y;
        }
        calculateSpace(availableSpace) {
          this.boundingRect.width = availableSpace.width;
          this.boundingRect.height = availableSpace.height;
          return {
            width: this.boundingRect.width,
            height: this.boundingRect.height
          };
        }
        getDrawableElements() {
          if (!(this.xAxis && this.yAxis)) {
            throw Error("Axes must be passed to render Plots");
          }
          const drawableElem = [];
          for (const [i2, plot] of this.chartData.plots.entries()) {
            switch (plot.type) {
              case "line":
                {
                  const linePlot = new LinePlot(
                    plot,
                    this.xAxis,
                    this.yAxis,
                    this.chartConfig.chartOrientation,
                    i2
                  );
                  drawableElem.push(...linePlot.getDrawableElement());
                }
                break;
              case "bar":
                {
                  const barPlot = new BarPlot(
                    plot,
                    this.boundingRect,
                    this.xAxis,
                    this.yAxis,
                    this.chartConfig.chartOrientation,
                    i2
                  );
                  drawableElem.push(...barPlot.getDrawableElement());
                }
                break;
            }
          }
          return drawableElem;
        }
      };
      __name(getPlotComponent, "getPlotComponent");
    }
  });

  // src/diagrams/xychart/chartBuilder/orchestrator.ts
  var Orchestrator;
  var init_orchestrator = __esm({
    "src/diagrams/xychart/chartBuilder/orchestrator.ts"() {
      "use strict";
      init_axis2();
      init_chartTitle();
      init_plot();
      init_interfaces();
      Orchestrator = class {
        constructor(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) {
          this.chartConfig = chartConfig;
          this.chartData = chartData;
          this.componentStore = {
            title: getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2),
            plot: getPlotComponent(chartConfig, chartData, chartThemeConfig),
            xAxis: getAxis(
              chartData.xAxis,
              chartConfig.xAxis,
              {
                titleColor: chartThemeConfig.xAxisTitleColor,
                labelColor: chartThemeConfig.xAxisLabelColor,
                tickColor: chartThemeConfig.xAxisTickColor,
                axisLineColor: chartThemeConfig.xAxisLineColor
              },
              tmpSVGGroup2
            ),
            yAxis: getAxis(
              chartData.yAxis,
              chartConfig.yAxis,
              {
                titleColor: chartThemeConfig.yAxisTitleColor,
                labelColor: chartThemeConfig.yAxisLabelColor,
                tickColor: chartThemeConfig.yAxisTickColor,
                axisLineColor: chartThemeConfig.yAxisLineColor
              },
              tmpSVGGroup2
            )
          };
        }
        static {
          __name(this, "Orchestrator");
        }
        calculateVerticalSpace() {
          let availableWidth = this.chartConfig.width;
          let availableHeight = this.chartConfig.height;
          let plotX = 0;
          let plotY = 0;
          let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100);
          let chartHeight = Math.floor(
            availableHeight * this.chartConfig.plotReservedSpacePercent / 100
          );
          let spaceUsed = this.componentStore.plot.calculateSpace({
            width: chartWidth,
            height: chartHeight
          });
          availableWidth -= spaceUsed.width;
          availableHeight -= spaceUsed.height;
          spaceUsed = this.componentStore.title.calculateSpace({
            width: this.chartConfig.width,
            height: availableHeight
          });
          plotY = spaceUsed.height;
          availableHeight -= spaceUsed.height;
          this.componentStore.xAxis.setAxisPosition("bottom");
          spaceUsed = this.componentStore.xAxis.calculateSpace({
            width: availableWidth,
            height: availableHeight
          });
          availableHeight -= spaceUsed.height;
          this.componentStore.yAxis.setAxisPosition("left");
          spaceUsed = this.componentStore.yAxis.calculateSpace({
            width: availableWidth,
            height: availableHeight
          });
          plotX = spaceUsed.width;
          availableWidth -= spaceUsed.width;
          if (availableWidth > 0) {
            chartWidth += availableWidth;
            availableWidth = 0;
          }
          if (availableHeight > 0) {
            chartHeight += availableHeight;
            availableHeight = 0;
          }
          this.componentStore.plot.calculateSpace({
            width: chartWidth,
            height: chartHeight
          });
          this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY });
          this.componentStore.xAxis.setRange([plotX, plotX + chartWidth]);
          this.componentStore.xAxis.setBoundingBoxXY({ x: plotX, y: plotY + chartHeight });
          this.componentStore.yAxis.setRange([plotY, plotY + chartHeight]);
          this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: plotY });
          if (this.chartData.plots.some((p3) => isBarPlot(p3))) {
            this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
          }
        }
        calculateHorizontalSpace() {
          let availableWidth = this.chartConfig.width;
          let availableHeight = this.chartConfig.height;
          let titleYEnd = 0;
          let plotX = 0;
          let plotY = 0;
          let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100);
          let chartHeight = Math.floor(
            availableHeight * this.chartConfig.plotReservedSpacePercent / 100
          );
          let spaceUsed = this.componentStore.plot.calculateSpace({
            width: chartWidth,
            height: chartHeight
          });
          availableWidth -= spaceUsed.width;
          availableHeight -= spaceUsed.height;
          spaceUsed = this.componentStore.title.calculateSpace({
            width: this.chartConfig.width,
            height: availableHeight
          });
          titleYEnd = spaceUsed.height;
          availableHeight -= spaceUsed.height;
          this.componentStore.xAxis.setAxisPosition("left");
          spaceUsed = this.componentStore.xAxis.calculateSpace({
            width: availableWidth,
            height: availableHeight
          });
          availableWidth -= spaceUsed.width;
          plotX = spaceUsed.width;
          this.componentStore.yAxis.setAxisPosition("top");
          spaceUsed = this.componentStore.yAxis.calculateSpace({
            width: availableWidth,
            height: availableHeight
          });
          availableHeight -= spaceUsed.height;
          plotY = titleYEnd + spaceUsed.height;
          if (availableWidth > 0) {
            chartWidth += availableWidth;
            availableWidth = 0;
          }
          if (availableHeight > 0) {
            chartHeight += availableHeight;
            availableHeight = 0;
          }
          this.componentStore.plot.calculateSpace({
            width: chartWidth,
            height: chartHeight
          });
          this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY });
          this.componentStore.yAxis.setRange([plotX, plotX + chartWidth]);
          this.componentStore.yAxis.setBoundingBoxXY({ x: plotX, y: titleYEnd });
          this.componentStore.xAxis.setRange([plotY, plotY + chartHeight]);
          this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: plotY });
          if (this.chartData.plots.some((p3) => isBarPlot(p3))) {
            this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
          }
        }
        calculateSpace() {
          if (this.chartConfig.chartOrientation === "horizontal") {
            this.calculateHorizontalSpace();
          } else {
            this.calculateVerticalSpace();
          }
        }
        getDrawableElement() {
          this.calculateSpace();
          const drawableElem = [];
          this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
          for (const component2 of Object.values(this.componentStore)) {
            drawableElem.push(...component2.getDrawableElements());
          }
          return drawableElem;
        }
      };
    }
  });

  // src/diagrams/xychart/chartBuilder/index.ts
  var XYChartBuilder;
  var init_chartBuilder = __esm({
    "src/diagrams/xychart/chartBuilder/index.ts"() {
      "use strict";
      init_orchestrator();
      XYChartBuilder = class {
        static {
          __name(this, "XYChartBuilder");
        }
        static build(config5, chartData, chartThemeConfig, tmpSVGGroup2) {
          const orchestrator = new Orchestrator(config5, chartData, chartThemeConfig, tmpSVGGroup2);
          return orchestrator.getDrawableElement();
        }
      };
    }
  });

  // src/diagrams/xychart/xychartDb.ts
  function getChartDefaultThemeConfig() {
    const defaultThemeVariables2 = getThemeVariables3();
    const config5 = getConfig();
    return cleanAndMerge(defaultThemeVariables2.xyChart, config5.themeVariables.xyChart);
  }
  function getChartDefaultConfig() {
    const config5 = getConfig();
    return cleanAndMerge(
      defaultConfig_default.xyChart,
      config5.xyChart
    );
  }
  function getChartDefaultData() {
    return {
      yAxis: {
        type: "linear",
        title: "",
        min: Infinity,
        max: -Infinity
      },
      xAxis: {
        type: "band",
        title: "",
        categories: []
      },
      title: "",
      plots: []
    };
  }
  function textSanitizer2(text4) {
    const config5 = getConfig();
    return sanitizeText(text4.trim(), config5);
  }
  function setTmpSVGG(SVGG) {
    tmpSVGGroup = SVGG;
  }
  function setOrientation(orientation) {
    if (orientation === "horizontal") {
      xyChartConfig.chartOrientation = "horizontal";
    } else {
      xyChartConfig.chartOrientation = "vertical";
    }
  }
  function setXAxisTitle(title2) {
    xyChartData.xAxis.title = textSanitizer2(title2.text);
  }
  function setXAxisRangeData(min9, max10) {
    xyChartData.xAxis = { type: "linear", title: xyChartData.xAxis.title, min: min9, max: max10 };
    hasSetXAxis = true;
  }
  function setXAxisBand(categories) {
    xyChartData.xAxis = {
      type: "band",
      title: xyChartData.xAxis.title,
      categories: categories.map((c3) => textSanitizer2(c3.text))
    };
    hasSetXAxis = true;
  }
  function setYAxisTitle(title2) {
    xyChartData.yAxis.title = textSanitizer2(title2.text);
  }
  function setYAxisRangeData(min9, max10) {
    xyChartData.yAxis = { type: "linear", title: xyChartData.yAxis.title, min: min9, max: max10 };
    hasSetYAxis = true;
  }
  function setYAxisRangeFromPlotData(data5) {
    const minValue = Math.min(...data5);
    const maxValue = Math.max(...data5);
    const prevMinValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.min : Infinity;
    const prevMaxValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.max : -Infinity;
    xyChartData.yAxis = {
      type: "linear",
      title: xyChartData.yAxis.title,
      min: Math.min(prevMinValue, minValue),
      max: Math.max(prevMaxValue, maxValue)
    };
  }
  function transformDataWithoutCategory(data5) {
    let retData = [];
    if (data5.length === 0) {
      return retData;
    }
    if (!hasSetXAxis) {
      const prevMinValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.min : Infinity;
      const prevMaxValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.max : -Infinity;
      setXAxisRangeData(Math.min(prevMinValue, 1), Math.max(prevMaxValue, data5.length));
    }
    if (!hasSetYAxis) {
      setYAxisRangeFromPlotData(data5);
    }
    if (isBandAxisData(xyChartData.xAxis)) {
      retData = xyChartData.xAxis.categories.map((c3, i2) => [c3, data5[i2]]);
    }
    if (isLinearAxisData(xyChartData.xAxis)) {
      const min9 = xyChartData.xAxis.min;
      const max10 = xyChartData.xAxis.max;
      const step3 = (max10 - min9) / (data5.length - 1);
      const categories = [];
      for (let i2 = min9; i2 <= max10; i2 += step3) {
        categories.push(`${i2}`);
      }
      retData = categories.map((c3, i2) => [c3, data5[i2]]);
    }
    return retData;
  }
  function getPlotColorFromPalette(plotIndex2) {
    return plotColorPalette[plotIndex2 === 0 ? 0 : plotIndex2 % plotColorPalette.length];
  }
  function setLineData(title2, data5) {
    const plotData = transformDataWithoutCategory(data5);
    xyChartData.plots.push({
      type: "line",
      strokeFill: getPlotColorFromPalette(plotIndex),
      strokeWidth: 2,
      data: plotData
    });
    plotIndex++;
  }
  function setBarData(title2, data5) {
    const plotData = transformDataWithoutCategory(data5);
    xyChartData.plots.push({
      type: "bar",
      fill: getPlotColorFromPalette(plotIndex),
      data: plotData
    });
    plotIndex++;
  }
  function getDrawableElem() {
    if (xyChartData.plots.length === 0) {
      throw Error("No Plot to render, please provide a plot with some data");
    }
    xyChartData.title = getDiagramTitle();
    return XYChartBuilder.build(xyChartConfig, xyChartData, xyChartThemeConfig, tmpSVGGroup);
  }
  function getChartThemeConfig() {
    return xyChartThemeConfig;
  }
  function getChartConfig() {
    return xyChartConfig;
  }
  function getXYChartData() {
    return xyChartData;
  }
  var plotIndex, tmpSVGGroup, xyChartConfig, xyChartThemeConfig, xyChartData, plotColorPalette, hasSetXAxis, hasSetYAxis, clear12, xychartDb_default;
  var init_xychartDb = __esm({
    "src/diagrams/xychart/xychartDb.ts"() {
      "use strict";
      init_config();
      init_defaultConfig();
      init_theme_default();
      init_utils2();
      init_common();
      init_commonDb();
      init_chartBuilder();
      init_interfaces();
      plotIndex = 0;
      xyChartConfig = getChartDefaultConfig();
      xyChartThemeConfig = getChartDefaultThemeConfig();
      xyChartData = getChartDefaultData();
      plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color2) => color2.trim());
      hasSetXAxis = false;
      hasSetYAxis = false;
      __name(getChartDefaultThemeConfig, "getChartDefaultThemeConfig");
      __name(getChartDefaultConfig, "getChartDefaultConfig");
      __name(getChartDefaultData, "getChartDefaultData");
      __name(textSanitizer2, "textSanitizer");
      __name(setTmpSVGG, "setTmpSVGG");
      __name(setOrientation, "setOrientation");
      __name(setXAxisTitle, "setXAxisTitle");
      __name(setXAxisRangeData, "setXAxisRangeData");
      __name(setXAxisBand, "setXAxisBand");
      __name(setYAxisTitle, "setYAxisTitle");
      __name(setYAxisRangeData, "setYAxisRangeData");
      __name(setYAxisRangeFromPlotData, "setYAxisRangeFromPlotData");
      __name(transformDataWithoutCategory, "transformDataWithoutCategory");
      __name(getPlotColorFromPalette, "getPlotColorFromPalette");
      __name(setLineData, "setLineData");
      __name(setBarData, "setBarData");
      __name(getDrawableElem, "getDrawableElem");
      __name(getChartThemeConfig, "getChartThemeConfig");
      __name(getChartConfig, "getChartConfig");
      __name(getXYChartData, "getXYChartData");
      clear12 = /* @__PURE__ */ __name(function() {
        clear();
        plotIndex = 0;
        xyChartConfig = getChartDefaultConfig();
        xyChartData = getChartDefaultData();
        xyChartThemeConfig = getChartDefaultThemeConfig();
        plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color2) => color2.trim());
        hasSetXAxis = false;
        hasSetYAxis = false;
      }, "clear");
      xychartDb_default = {
        getDrawableElem,
        clear: clear12,
        setAccTitle,
        getAccTitle,
        setDiagramTitle,
        getDiagramTitle,
        getAccDescription,
        setAccDescription,
        setOrientation,
        setXAxisTitle,
        setXAxisRangeData,
        setXAxisBand,
        setYAxisTitle,
        setYAxisRangeData,
        setLineData,
        setBarData,
        setTmpSVGG,
        getChartThemeConfig,
        getChartConfig,
        getXYChartData
      };
    }
  });

  // src/diagrams/xychart/xychartRenderer.ts
  var draw9, xychartRenderer_default;
  var init_xychartRenderer = __esm({
    "src/diagrams/xychart/xychartRenderer.ts"() {
      "use strict";
      init_logger();
      init_selectSvgElement();
      init_setupGraphViewbox();
      draw9 = /* @__PURE__ */ __name((txt, id34, _version, diagObj) => {
        const db9 = diagObj.db;
        const themeConfig = db9.getChartThemeConfig();
        const chartConfig = db9.getChartConfig();
        const labelData = db9.getXYChartData().plots[0].data.map((data5) => data5[1]);
        function getDominantBaseLine(horizontalPos) {
          return horizontalPos === "top" ? "text-before-edge" : "middle";
        }
        __name(getDominantBaseLine, "getDominantBaseLine");
        function getTextAnchor(verticalPos) {
          return verticalPos === "left" ? "start" : verticalPos === "right" ? "end" : "middle";
        }
        __name(getTextAnchor, "getTextAnchor");
        function getTextTransformation(data5) {
          return `translate(${data5.x}, ${data5.y}) rotate(${data5.rotation || 0})`;
        }
        __name(getTextTransformation, "getTextTransformation");
        log.debug("Rendering xychart chart\n" + txt);
        const svg2 = selectSvgElement(id34);
        const group2 = svg2.append("g").attr("class", "main");
        const background = group2.append("rect").attr("width", chartConfig.width).attr("height", chartConfig.height).attr("class", "background");
        configureSvgSize(svg2, chartConfig.height, chartConfig.width, true);
        svg2.attr("viewBox", `0 0 ${chartConfig.width} ${chartConfig.height}`);
        background.attr("fill", themeConfig.backgroundColor);
        db9.setTmpSVGG(svg2.append("g").attr("class", "mermaid-tmp-group"));
        const shapes4 = db9.getDrawableElem();
        const groups = {};
        function getGroup(gList) {
          let elem = group2;
          let prefix = "";
          for (const [i2] of gList.entries()) {
            let parent4 = group2;
            if (i2 > 0 && groups[prefix]) {
              parent4 = groups[prefix];
            }
            prefix += gList[i2];
            elem = groups[prefix];
            if (!elem) {
              elem = groups[prefix] = parent4.append("g").attr("class", gList[i2]);
            }
          }
          return elem;
        }
        __name(getGroup, "getGroup");
        for (const shape of shapes4) {
          if (shape.data.length === 0) {
            continue;
          }
          const shapeGroup = getGroup(shape.groupTexts);
          switch (shape.type) {
            case "rect":
              shapeGroup.selectAll("rect").data(shape.data).enter().append("rect").attr("x", (data5) => data5.x).attr("y", (data5) => data5.y).attr("width", (data5) => data5.width).attr("height", (data5) => data5.height).attr("fill", (data5) => data5.fill).attr("stroke", (data5) => data5.strokeFill).attr("stroke-width", (data5) => data5.strokeWidth);
              if (chartConfig.showDataLabel) {
                const showDataLabelOutsideBar = chartConfig.showDataLabelOutsideBar;
                if (chartConfig.chartOrientation === "horizontal") {
                  let fitsHorizontally2 = function(item, fontSize) {
                    const { data: data5, label } = item;
                    const textWidth = fontSize * label.length * charWidthFactor;
                    return textWidth <= data5.width - rightMargin;
                  };
                  var fitsHorizontally = fitsHorizontally2;
                  __name(fitsHorizontally2, "fitsHorizontally");
                  const charWidthFactor = 0.7;
                  const rightMargin = 10;
                  const validItems = shape.data.map((d3, i2) => ({ data: d3, label: labelData[i2].toString() })).filter((item) => item.data.width > 0 && item.data.height > 0);
                  const candidateFontSizes = validItems.map((item) => {
                    const { data: data5 } = item;
                    let fontSize = data5.height * 0.7;
                    while (!fitsHorizontally2(item, fontSize) && fontSize > 0) {
                      fontSize -= 1;
                    }
                    return fontSize;
                  });
                  const uniformFontSize = Math.floor(Math.min(...candidateFontSizes));
                  const determineLabelXPosition = /* @__PURE__ */ __name((item) => {
                    if (showDataLabelOutsideBar) {
                      return item.data.x + item.data.width + rightMargin;
                    } else {
                      return item.data.x + item.data.width - rightMargin;
                    }
                  }, "determineLabelXPosition");
                  shapeGroup.selectAll("text").data(validItems).enter().append("text").attr("x", determineLabelXPosition).attr("y", (item) => item.data.y + item.data.height / 2).attr("text-anchor", showDataLabelOutsideBar ? "start" : "end").attr("dominant-baseline", "middle").attr("fill", themeConfig.dataLabelColor).attr("font-size", `${uniformFontSize}px`).text((item) => item.label);
                } else {
                  let fitsInBar2 = function(item, fontSize, yOffset2) {
                    const { data: data5, label } = item;
                    const charWidthFactor = 0.7;
                    const textWidth = fontSize * label.length * charWidthFactor;
                    const centerX = data5.x + data5.width / 2;
                    const leftEdge = centerX - textWidth / 2;
                    const rightEdge = centerX + textWidth / 2;
                    const horizontalFits = leftEdge >= data5.x && rightEdge <= data5.x + data5.width;
                    const verticalFits = data5.y + yOffset2 + fontSize <= data5.y + data5.height;
                    return horizontalFits && verticalFits;
                  };
                  var fitsInBar = fitsInBar2;
                  __name(fitsInBar2, "fitsInBar");
                  const yOffset = 10;
                  const validItems = shape.data.map((d3, i2) => ({ data: d3, label: labelData[i2].toString() })).filter((item) => item.data.width > 0 && item.data.height > 0);
                  const candidateFontSizes = validItems.map((item) => {
                    const { data: data5, label } = item;
                    let fontSize = data5.width / (label.length * 0.7);
                    while (!fitsInBar2(item, fontSize, yOffset) && fontSize > 0) {
                      fontSize -= 1;
                    }
                    return fontSize;
                  });
                  const uniformFontSize = Math.floor(Math.min(...candidateFontSizes));
                  const determineLabelYPosition = /* @__PURE__ */ __name((item) => {
                    if (showDataLabelOutsideBar) {
                      return item.data.y - yOffset;
                    } else {
                      return item.data.y + yOffset;
                    }
                  }, "determineLabelYPosition");
                  shapeGroup.selectAll("text").data(validItems).enter().append("text").attr("x", (item) => item.data.x + item.data.width / 2).attr("y", determineLabelYPosition).attr("text-anchor", "middle").attr("dominant-baseline", showDataLabelOutsideBar ? "auto" : "hanging").attr("fill", themeConfig.dataLabelColor).attr("font-size", `${uniformFontSize}px`).text((item) => item.label);
                }
              }
              break;
            case "text":
              shapeGroup.selectAll("text").data(shape.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (data5) => data5.fill).attr("font-size", (data5) => data5.fontSize).attr("dominant-baseline", (data5) => getDominantBaseLine(data5.verticalPos)).attr("text-anchor", (data5) => getTextAnchor(data5.horizontalPos)).attr("transform", (data5) => getTextTransformation(data5)).text((data5) => data5.text);
              break;
            case "path":
              shapeGroup.selectAll("path").data(shape.data).enter().append("path").attr("d", (data5) => data5.path).attr("fill", (data5) => data5.fill ? data5.fill : "none").attr("stroke", (data5) => data5.strokeFill).attr("stroke-width", (data5) => data5.strokeWidth);
              break;
          }
        }
      }, "draw");
      xychartRenderer_default = {
        draw: draw9
      };
    }
  });

  // src/diagrams/xychart/xychartDiagram.ts
  var xychartDiagram_exports = {};
  __export(xychartDiagram_exports, {
    diagram: () => diagram9
  });
  var diagram9;
  var init_xychartDiagram = __esm({
    "src/diagrams/xychart/xychartDiagram.ts"() {
      "use strict";
      init_xychart();
      init_xychartDb();
      init_xychartRenderer();
      diagram9 = {
        parser: xychart_default,
        db: xychartDb_default,
        renderer: xychartRenderer_default
      };
    }
  });

  // src/diagrams/requirement/parser/requirementDiagram.jison
  var parser10, requirementDiagram_default;
  var init_requirementDiagram = __esm({
    "src/diagrams/requirement/parser/requirementDiagram.jison"() {
      "use strict";
      parser10 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [1, 3], $V1 = [1, 4], $V2 = [1, 5], $V3 = [1, 6], $V4 = [5, 6, 8, 9, 11, 13, 21, 22, 23, 24, 41, 42, 43, 44, 45, 46, 54, 72, 74, 77, 89, 90], $V5 = [1, 22], $V6 = [2, 7], $V7 = [1, 26], $V8 = [1, 27], $V9 = [1, 28], $Va = [1, 29], $Vb = [1, 33], $Vc = [1, 34], $Vd = [1, 35], $Ve = [1, 36], $Vf = [1, 37], $Vg = [1, 38], $Vh = [1, 24], $Vi = [1, 31], $Vj = [1, 32], $Vk = [1, 30], $Vl = [1, 39], $Vm = [1, 40], $Vn = [5, 8, 9, 11, 13, 21, 22, 23, 24, 41, 42, 43, 44, 45, 46, 54, 72, 74, 77, 89, 90], $Vo = [1, 61], $Vp = [89, 90], $Vq = [5, 8, 9, 11, 13, 21, 22, 23, 24, 27, 29, 41, 42, 43, 44, 45, 46, 54, 61, 63, 72, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90], $Vr = [27, 29], $Vs = [1, 70], $Vt = [1, 71], $Vu = [1, 72], $Vv = [1, 73], $Vw = [1, 74], $Vx = [1, 75], $Vy = [1, 76], $Vz = [1, 83], $VA = [1, 80], $VB = [1, 84], $VC = [1, 85], $VD = [1, 86], $VE = [1, 87], $VF = [1, 88], $VG = [1, 89], $VH = [1, 90], $VI = [1, 91], $VJ = [1, 92], $VK = [5, 8, 9, 11, 13, 21, 22, 23, 24, 27, 41, 42, 43, 44, 45, 46, 54, 72, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90], $VL = [63, 64], $VM = [1, 101], $VN = [5, 8, 9, 11, 13, 21, 22, 23, 24, 41, 42, 43, 44, 45, 46, 54, 72, 74, 76, 77, 89, 90], $VO = [5, 8, 9, 11, 13, 21, 22, 23, 24, 41, 42, 43, 44, 45, 46, 54, 72, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90], $VP = [1, 110], $VQ = [1, 106], $VR = [1, 107], $VS = [1, 108], $VT = [1, 109], $VU = [1, 111], $VV = [1, 116], $VW = [1, 117], $VX = [1, 114], $VY = [1, 115];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "directive": 4, "NEWLINE": 5, "RD": 6, "diagram": 7, "EOF": 8, "acc_title": 9, "acc_title_value": 10, "acc_descr": 11, "acc_descr_value": 12, "acc_descr_multiline_value": 13, "requirementDef": 14, "elementDef": 15, "relationshipDef": 16, "direction": 17, "styleStatement": 18, "classDefStatement": 19, "classStatement": 20, "direction_tb": 21, "direction_bt": 22, "direction_rl": 23, "direction_lr": 24, "requirementType": 25, "requirementName": 26, "STRUCT_START": 27, "requirementBody": 28, "STYLE_SEPARATOR": 29, "idList": 30, "ID": 31, "COLONSEP": 32, "id": 33, "TEXT": 34, "text": 35, "RISK": 36, "riskLevel": 37, "VERIFYMTHD": 38, "verifyType": 39, "STRUCT_STOP": 40, "REQUIREMENT": 41, "FUNCTIONAL_REQUIREMENT": 42, "INTERFACE_REQUIREMENT": 43, "PERFORMANCE_REQUIREMENT": 44, "PHYSICAL_REQUIREMENT": 45, "DESIGN_CONSTRAINT": 46, "LOW_RISK": 47, "MED_RISK": 48, "HIGH_RISK": 49, "VERIFY_ANALYSIS": 50, "VERIFY_DEMONSTRATION": 51, "VERIFY_INSPECTION": 52, "VERIFY_TEST": 53, "ELEMENT": 54, "elementName": 55, "elementBody": 56, "TYPE": 57, "type": 58, "DOCREF": 59, "ref": 60, "END_ARROW_L": 61, "relationship": 62, "LINE": 63, "END_ARROW_R": 64, "CONTAINS": 65, "COPIES": 66, "DERIVES": 67, "SATISFIES": 68, "VERIFIES": 69, "REFINES": 70, "TRACES": 71, "CLASSDEF": 72, "stylesOpt": 73, "CLASS": 74, "ALPHA": 75, "COMMA": 76, "STYLE": 77, "style": 78, "styleComponent": 79, "NUM": 80, "COLON": 81, "UNIT": 82, "SPACE": 83, "BRKT": 84, "PCT": 85, "MINUS": 86, "LABEL": 87, "SEMICOLON": 88, "unqString": 89, "qString": 90, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 5: "NEWLINE", 6: "RD", 8: "EOF", 9: "acc_title", 10: "acc_title_value", 11: "acc_descr", 12: "acc_descr_value", 13: "acc_descr_multiline_value", 21: "direction_tb", 22: "direction_bt", 23: "direction_rl", 24: "direction_lr", 27: "STRUCT_START", 29: "STYLE_SEPARATOR", 31: "ID", 32: "COLONSEP", 34: "TEXT", 36: "RISK", 38: "VERIFYMTHD", 40: "STRUCT_STOP", 41: "REQUIREMENT", 42: "FUNCTIONAL_REQUIREMENT", 43: "INTERFACE_REQUIREMENT", 44: "PERFORMANCE_REQUIREMENT", 45: "PHYSICAL_REQUIREMENT", 46: "DESIGN_CONSTRAINT", 47: "LOW_RISK", 48: "MED_RISK", 49: "HIGH_RISK", 50: "VERIFY_ANALYSIS", 51: "VERIFY_DEMONSTRATION", 52: "VERIFY_INSPECTION", 53: "VERIFY_TEST", 54: "ELEMENT", 57: "TYPE", 59: "DOCREF", 61: "END_ARROW_L", 63: "LINE", 64: "END_ARROW_R", 65: "CONTAINS", 66: "COPIES", 67: "DERIVES", 68: "SATISFIES", 69: "VERIFIES", 70: "REFINES", 71: "TRACES", 72: "CLASSDEF", 74: "CLASS", 75: "ALPHA", 76: "COMMA", 77: "STYLE", 80: "NUM", 81: "COLON", 82: "UNIT", 83: "SPACE", 84: "BRKT", 85: "PCT", 86: "MINUS", 87: "LABEL", 88: "SEMICOLON", 89: "unqString", 90: "qString" },
          productions_: [0, [3, 3], [3, 2], [3, 4], [4, 2], [4, 2], [4, 1], [7, 0], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [17, 1], [17, 1], [17, 1], [17, 1], [14, 5], [14, 7], [28, 5], [28, 5], [28, 5], [28, 5], [28, 2], [28, 1], [25, 1], [25, 1], [25, 1], [25, 1], [25, 1], [25, 1], [37, 1], [37, 1], [37, 1], [39, 1], [39, 1], [39, 1], [39, 1], [15, 5], [15, 7], [56, 5], [56, 5], [56, 2], [56, 1], [16, 5], [16, 5], [62, 1], [62, 1], [62, 1], [62, 1], [62, 1], [62, 1], [62, 1], [19, 3], [20, 3], [20, 3], [30, 1], [30, 3], [30, 1], [30, 3], [18, 3], [73, 1], [73, 3], [78, 1], [78, 2], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [26, 1], [26, 1], [33, 1], [33, 1], [35, 1], [35, 1], [55, 1], [55, 1], [58, 1], [58, 1], [60, 1], [60, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 4:
                this.$ = $$[$0].trim();
                yy.setAccTitle(this.$);
                break;
              case 5:
              case 6:
                this.$ = $$[$0].trim();
                yy.setAccDescription(this.$);
                break;
              case 7:
                this.$ = [];
                break;
              case 17:
                yy.setDirection("TB");
                break;
              case 18:
                yy.setDirection("BT");
                break;
              case 19:
                yy.setDirection("RL");
                break;
              case 20:
                yy.setDirection("LR");
                break;
              case 21:
                yy.addRequirement($$[$0 - 3], $$[$0 - 4]);
                break;
              case 22:
                yy.addRequirement($$[$0 - 5], $$[$0 - 6]);
                yy.setClass([$$[$0 - 5]], $$[$0 - 3]);
                break;
              case 23:
                yy.setNewReqId($$[$0 - 2]);
                break;
              case 24:
                yy.setNewReqText($$[$0 - 2]);
                break;
              case 25:
                yy.setNewReqRisk($$[$0 - 2]);
                break;
              case 26:
                yy.setNewReqVerifyMethod($$[$0 - 2]);
                break;
              case 29:
                this.$ = yy.RequirementType.REQUIREMENT;
                break;
              case 30:
                this.$ = yy.RequirementType.FUNCTIONAL_REQUIREMENT;
                break;
              case 31:
                this.$ = yy.RequirementType.INTERFACE_REQUIREMENT;
                break;
              case 32:
                this.$ = yy.RequirementType.PERFORMANCE_REQUIREMENT;
                break;
              case 33:
                this.$ = yy.RequirementType.PHYSICAL_REQUIREMENT;
                break;
              case 34:
                this.$ = yy.RequirementType.DESIGN_CONSTRAINT;
                break;
              case 35:
                this.$ = yy.RiskLevel.LOW_RISK;
                break;
              case 36:
                this.$ = yy.RiskLevel.MED_RISK;
                break;
              case 37:
                this.$ = yy.RiskLevel.HIGH_RISK;
                break;
              case 38:
                this.$ = yy.VerifyType.VERIFY_ANALYSIS;
                break;
              case 39:
                this.$ = yy.VerifyType.VERIFY_DEMONSTRATION;
                break;
              case 40:
                this.$ = yy.VerifyType.VERIFY_INSPECTION;
                break;
              case 41:
                this.$ = yy.VerifyType.VERIFY_TEST;
                break;
              case 42:
                yy.addElement($$[$0 - 3]);
                break;
              case 43:
                yy.addElement($$[$0 - 5]);
                yy.setClass([$$[$0 - 5]], $$[$0 - 3]);
                break;
              case 44:
                yy.setNewElementType($$[$0 - 2]);
                break;
              case 45:
                yy.setNewElementDocRef($$[$0 - 2]);
                break;
              case 48:
                yy.addRelationship($$[$0 - 2], $$[$0], $$[$0 - 4]);
                break;
              case 49:
                yy.addRelationship($$[$0 - 2], $$[$0 - 4], $$[$0]);
                break;
              case 50:
                this.$ = yy.Relationships.CONTAINS;
                break;
              case 51:
                this.$ = yy.Relationships.COPIES;
                break;
              case 52:
                this.$ = yy.Relationships.DERIVES;
                break;
              case 53:
                this.$ = yy.Relationships.SATISFIES;
                break;
              case 54:
                this.$ = yy.Relationships.VERIFIES;
                break;
              case 55:
                this.$ = yy.Relationships.REFINES;
                break;
              case 56:
                this.$ = yy.Relationships.TRACES;
                break;
              case 57:
                this.$ = $$[$0 - 2];
                yy.defineClass($$[$0 - 1], $$[$0]);
                break;
              case 58:
                yy.setClass($$[$0 - 1], $$[$0]);
                break;
              case 59:
                yy.setClass([$$[$0 - 2]], $$[$0]);
                break;
              case 60:
              case 62:
                this.$ = [$$[$0]];
                break;
              case 61:
              case 63:
                this.$ = $$[$0 - 2].concat([$$[$0]]);
                break;
              case 64:
                this.$ = $$[$0 - 2];
                yy.setCssStyle($$[$0 - 1], $$[$0]);
                break;
              case 65:
                this.$ = [$$[$0]];
                break;
              case 66:
                $$[$0 - 2].push($$[$0]);
                this.$ = $$[$0 - 2];
                break;
              case 68:
                this.$ = $$[$0 - 1] + $$[$0];
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: 2, 6: $V0, 9: $V1, 11: $V2, 13: $V3 }, { 1: [3] }, { 3: 8, 4: 2, 5: [1, 7], 6: $V0, 9: $V1, 11: $V2, 13: $V3 }, { 5: [1, 9] }, { 10: [1, 10] }, { 12: [1, 11] }, o2($V4, [2, 6]), { 3: 12, 4: 2, 6: $V0, 9: $V1, 11: $V2, 13: $V3 }, { 1: [2, 2] }, { 4: 17, 5: $V5, 7: 13, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, o2($V4, [2, 4]), o2($V4, [2, 5]), { 1: [2, 1] }, { 8: [1, 41] }, { 4: 17, 5: $V5, 7: 42, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 43, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 44, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 45, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 46, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 47, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 48, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 49, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 50, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 26: 51, 89: [1, 52], 90: [1, 53] }, { 55: 54, 89: [1, 55], 90: [1, 56] }, { 29: [1, 59], 61: [1, 57], 63: [1, 58] }, o2($Vn, [2, 17]), o2($Vn, [2, 18]), o2($Vn, [2, 19]), o2($Vn, [2, 20]), { 30: 60, 33: 62, 75: $Vo, 89: $Vl, 90: $Vm }, { 30: 63, 33: 62, 75: $Vo, 89: $Vl, 90: $Vm }, { 30: 64, 33: 62, 75: $Vo, 89: $Vl, 90: $Vm }, o2($Vp, [2, 29]), o2($Vp, [2, 30]), o2($Vp, [2, 31]), o2($Vp, [2, 32]), o2($Vp, [2, 33]), o2($Vp, [2, 34]), o2($Vq, [2, 81]), o2($Vq, [2, 82]), { 1: [2, 3] }, { 8: [2, 8] }, { 8: [2, 9] }, { 8: [2, 10] }, { 8: [2, 11] }, { 8: [2, 12] }, { 8: [2, 13] }, { 8: [2, 14] }, { 8: [2, 15] }, { 8: [2, 16] }, { 27: [1, 65], 29: [1, 66] }, o2($Vr, [2, 79]), o2($Vr, [2, 80]), { 27: [1, 67], 29: [1, 68] }, o2($Vr, [2, 85]), o2($Vr, [2, 86]), { 62: 69, 65: $Vs, 66: $Vt, 67: $Vu, 68: $Vv, 69: $Vw, 70: $Vx, 71: $Vy }, { 62: 77, 65: $Vs, 66: $Vt, 67: $Vu, 68: $Vv, 69: $Vw, 70: $Vx, 71: $Vy }, { 30: 78, 33: 62, 75: $Vo, 89: $Vl, 90: $Vm }, { 73: 79, 75: $Vz, 76: $VA, 78: 81, 79: 82, 80: $VB, 81: $VC, 82: $VD, 83: $VE, 84: $VF, 85: $VG, 86: $VH, 87: $VI, 88: $VJ }, o2($VK, [2, 60]), o2($VK, [2, 62]), { 73: 93, 75: $Vz, 76: $VA, 78: 81, 79: 82, 80: $VB, 81: $VC, 82: $VD, 83: $VE, 84: $VF, 85: $VG, 86: $VH, 87: $VI, 88: $VJ }, { 30: 94, 33: 62, 75: $Vo, 76: $VA, 89: $Vl, 90: $Vm }, { 5: [1, 95] }, { 30: 96, 33: 62, 75: $Vo, 89: $Vl, 90: $Vm }, { 5: [1, 97] }, { 30: 98, 33: 62, 75: $Vo, 89: $Vl, 90: $Vm }, { 63: [1, 99] }, o2($VL, [2, 50]), o2($VL, [2, 51]), o2($VL, [2, 52]), o2($VL, [2, 53]), o2($VL, [2, 54]), o2($VL, [2, 55]), o2($VL, [2, 56]), { 64: [1, 100] }, o2($Vn, [2, 59], { 76: $VA }), o2($Vn, [2, 64], { 76: $VM }), { 33: 103, 75: [1, 102], 89: $Vl, 90: $Vm }, o2($VN, [2, 65], { 79: 104, 75: $Vz, 80: $VB, 81: $VC, 82: $VD, 83: $VE, 84: $VF, 85: $VG, 86: $VH, 87: $VI, 88: $VJ }), o2($VO, [2, 67]), o2($VO, [2, 69]), o2($VO, [2, 70]), o2($VO, [2, 71]), o2($VO, [2, 72]), o2($VO, [2, 73]), o2($VO, [2, 74]), o2($VO, [2, 75]), o2($VO, [2, 76]), o2($VO, [2, 77]), o2($VO, [2, 78]), o2($Vn, [2, 57], { 76: $VM }), o2($Vn, [2, 58], { 76: $VA }), { 5: $VP, 28: 105, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, { 27: [1, 112], 76: $VA }, { 5: $VV, 40: $VW, 56: 113, 57: $VX, 59: $VY }, { 27: [1, 118], 76: $VA }, { 33: 119, 89: $Vl, 90: $Vm }, { 33: 120, 89: $Vl, 90: $Vm }, { 75: $Vz, 78: 121, 79: 82, 80: $VB, 81: $VC, 82: $VD, 83: $VE, 84: $VF, 85: $VG, 86: $VH, 87: $VI, 88: $VJ }, o2($VK, [2, 61]), o2($VK, [2, 63]), o2($VO, [2, 68]), o2($Vn, [2, 21]), { 32: [1, 122] }, { 32: [1, 123] }, { 32: [1, 124] }, { 32: [1, 125] }, { 5: $VP, 28: 126, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, o2($Vn, [2, 28]), { 5: [1, 127] }, o2($Vn, [2, 42]), { 32: [1, 128] }, { 32: [1, 129] }, { 5: $VV, 40: $VW, 56: 130, 57: $VX, 59: $VY }, o2($Vn, [2, 47]), { 5: [1, 131] }, o2($Vn, [2, 48]), o2($Vn, [2, 49]), o2($VN, [2, 66], { 79: 104, 75: $Vz, 80: $VB, 81: $VC, 82: $VD, 83: $VE, 84: $VF, 85: $VG, 86: $VH, 87: $VI, 88: $VJ }), { 33: 132, 89: $Vl, 90: $Vm }, { 35: 133, 89: [1, 134], 90: [1, 135] }, { 37: 136, 47: [1, 137], 48: [1, 138], 49: [1, 139] }, { 39: 140, 50: [1, 141], 51: [1, 142], 52: [1, 143], 53: [1, 144] }, o2($Vn, [2, 27]), { 5: $VP, 28: 145, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, { 58: 146, 89: [1, 147], 90: [1, 148] }, { 60: 149, 89: [1, 150], 90: [1, 151] }, o2($Vn, [2, 46]), { 5: $VV, 40: $VW, 56: 152, 57: $VX, 59: $VY }, { 5: [1, 153] }, { 5: [1, 154] }, { 5: [2, 83] }, { 5: [2, 84] }, { 5: [1, 155] }, { 5: [2, 35] }, { 5: [2, 36] }, { 5: [2, 37] }, { 5: [1, 156] }, { 5: [2, 38] }, { 5: [2, 39] }, { 5: [2, 40] }, { 5: [2, 41] }, o2($Vn, [2, 22]), { 5: [1, 157] }, { 5: [2, 87] }, { 5: [2, 88] }, { 5: [1, 158] }, { 5: [2, 89] }, { 5: [2, 90] }, o2($Vn, [2, 43]), { 5: $VP, 28: 159, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, { 5: $VP, 28: 160, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, { 5: $VP, 28: 161, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, { 5: $VP, 28: 162, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, { 5: $VV, 40: $VW, 56: 163, 57: $VX, 59: $VY }, { 5: $VV, 40: $VW, 56: 164, 57: $VX, 59: $VY }, o2($Vn, [2, 23]), o2($Vn, [2, 24]), o2($Vn, [2, 25]), o2($Vn, [2, 26]), o2($Vn, [2, 44]), o2($Vn, [2, 45])],
          defaultActions: { 8: [2, 2], 12: [2, 1], 41: [2, 3], 42: [2, 8], 43: [2, 9], 44: [2, 10], 45: [2, 11], 46: [2, 12], 47: [2, 13], 48: [2, 14], 49: [2, 15], 50: [2, 16], 134: [2, 83], 135: [2, 84], 137: [2, 35], 138: [2, 36], 139: [2, 37], 141: [2, 38], 142: [2, 39], 143: [2, 40], 144: [2, 41], 147: [2, 87], 148: [2, 88], 150: [2, 89], 151: [2, 90] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  return "title";
                  break;
                case 1:
                  this.begin("acc_title");
                  return 9;
                  break;
                case 2:
                  this.popState();
                  return "acc_title_value";
                  break;
                case 3:
                  this.begin("acc_descr");
                  return 11;
                  break;
                case 4:
                  this.popState();
                  return "acc_descr_value";
                  break;
                case 5:
                  this.begin("acc_descr_multiline");
                  break;
                case 6:
                  this.popState();
                  break;
                case 7:
                  return "acc_descr_multiline_value";
                  break;
                case 8:
                  return 21;
                  break;
                case 9:
                  return 22;
                  break;
                case 10:
                  return 23;
                  break;
                case 11:
                  return 24;
                  break;
                case 12:
                  return 5;
                  break;
                case 13:
                  break;
                case 14:
                  break;
                case 15:
                  break;
                case 16:
                  return 8;
                  break;
                case 17:
                  return 6;
                  break;
                case 18:
                  return 27;
                  break;
                case 19:
                  return 40;
                  break;
                case 20:
                  return 29;
                  break;
                case 21:
                  return 32;
                  break;
                case 22:
                  return 31;
                  break;
                case 23:
                  return 34;
                  break;
                case 24:
                  return 36;
                  break;
                case 25:
                  return 38;
                  break;
                case 26:
                  return 41;
                  break;
                case 27:
                  return 42;
                  break;
                case 28:
                  return 43;
                  break;
                case 29:
                  return 44;
                  break;
                case 30:
                  return 45;
                  break;
                case 31:
                  return 46;
                  break;
                case 32:
                  return 47;
                  break;
                case 33:
                  return 48;
                  break;
                case 34:
                  return 49;
                  break;
                case 35:
                  return 50;
                  break;
                case 36:
                  return 51;
                  break;
                case 37:
                  return 52;
                  break;
                case 38:
                  return 53;
                  break;
                case 39:
                  return 54;
                  break;
                case 40:
                  return 65;
                  break;
                case 41:
                  return 66;
                  break;
                case 42:
                  return 67;
                  break;
                case 43:
                  return 68;
                  break;
                case 44:
                  return 69;
                  break;
                case 45:
                  return 70;
                  break;
                case 46:
                  return 71;
                  break;
                case 47:
                  return 57;
                  break;
                case 48:
                  return 59;
                  break;
                case 49:
                  this.begin("style");
                  return 77;
                  break;
                case 50:
                  return 75;
                  break;
                case 51:
                  return 81;
                  break;
                case 52:
                  return 88;
                  break;
                case 53:
                  return "PERCENT";
                  break;
                case 54:
                  return 86;
                  break;
                case 55:
                  return 84;
                  break;
                case 56:
                  break;
                case 57:
                  this.begin("string");
                  break;
                case 58:
                  this.popState();
                  break;
                case 59:
                  this.begin("style");
                  return 72;
                  break;
                case 60:
                  this.begin("style");
                  return 74;
                  break;
                case 61:
                  return 61;
                  break;
                case 62:
                  return 64;
                  break;
                case 63:
                  return 63;
                  break;
                case 64:
                  this.begin("string");
                  break;
                case 65:
                  this.popState();
                  break;
                case 66:
                  return "qString";
                  break;
                case 67:
                  yy_.yytext = yy_.yytext.trim();
                  return 89;
                  break;
                case 68:
                  return 75;
                  break;
                case 69:
                  return 80;
                  break;
                case 70:
                  return 76;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:(\r?\n)+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:$)/i, /^(?:requirementDiagram\b)/i, /^(?:\{)/i, /^(?:\})/i, /^(?::{3})/i, /^(?::)/i, /^(?:id\b)/i, /^(?:text\b)/i, /^(?:risk\b)/i, /^(?:verifyMethod\b)/i, /^(?:requirement\b)/i, /^(?:functionalRequirement\b)/i, /^(?:interfaceRequirement\b)/i, /^(?:performanceRequirement\b)/i, /^(?:physicalRequirement\b)/i, /^(?:designConstraint\b)/i, /^(?:low\b)/i, /^(?:medium\b)/i, /^(?:high\b)/i, /^(?:analysis\b)/i, /^(?:demonstration\b)/i, /^(?:inspection\b)/i, /^(?:test\b)/i, /^(?:element\b)/i, /^(?:contains\b)/i, /^(?:copies\b)/i, /^(?:derives\b)/i, /^(?:satisfies\b)/i, /^(?:verifies\b)/i, /^(?:refines\b)/i, /^(?:traces\b)/i, /^(?:type\b)/i, /^(?:docref\b)/i, /^(?:style\b)/i, /^(?:\w+)/i, /^(?::)/i, /^(?:;)/i, /^(?:%)/i, /^(?:-)/i, /^(?:#)/i, /^(?: )/i, /^(?:["])/i, /^(?:\n)/i, /^(?:classDef\b)/i, /^(?:class\b)/i, /^(?:<-)/i, /^(?:->)/i, /^(?:-)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[\w][^:,\r\n\{\<\>\-\=]*)/i, /^(?:\w+)/i, /^(?:[0-9]+)/i, /^(?:,)/i],
            conditions: { "acc_descr_multiline": { "rules": [6, 7, 68, 69, 70], "inclusive": false }, "acc_descr": { "rules": [4, 68, 69, 70], "inclusive": false }, "acc_title": { "rules": [2, 68, 69, 70], "inclusive": false }, "style": { "rules": [50, 51, 52, 53, 54, 55, 56, 57, 58, 68, 69, 70], "inclusive": false }, "unqString": { "rules": [68, 69, 70], "inclusive": false }, "token": { "rules": [68, 69, 70], "inclusive": false }, "string": { "rules": [65, 66, 68, 69, 70], "inclusive": false }, "INITIAL": { "rules": [0, 1, 3, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 59, 60, 61, 62, 63, 64, 67, 68, 69, 70], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser10.parser = parser10;
      requirementDiagram_default = parser10;
    }
  });

  // src/diagrams/requirement/requirementDb.ts
  var RequirementDB;
  var init_requirementDb = __esm({
    "src/diagrams/requirement/requirementDb.ts"() {
      "use strict";
      init_diagramAPI();
      init_logger();
      init_commonDb();
      RequirementDB = class {
        constructor() {
          this.relations = [];
          this.latestRequirement = this.getInitialRequirement();
          this.requirements = /* @__PURE__ */ new Map();
          this.latestElement = this.getInitialElement();
          this.elements = /* @__PURE__ */ new Map();
          this.classes = /* @__PURE__ */ new Map();
          this.direction = "TB";
          this.RequirementType = {
            REQUIREMENT: "Requirement",
            FUNCTIONAL_REQUIREMENT: "Functional Requirement",
            INTERFACE_REQUIREMENT: "Interface Requirement",
            PERFORMANCE_REQUIREMENT: "Performance Requirement",
            PHYSICAL_REQUIREMENT: "Physical Requirement",
            DESIGN_CONSTRAINT: "Design Constraint"
          };
          this.RiskLevel = {
            LOW_RISK: "Low",
            MED_RISK: "Medium",
            HIGH_RISK: "High"
          };
          this.VerifyType = {
            VERIFY_ANALYSIS: "Analysis",
            VERIFY_DEMONSTRATION: "Demonstration",
            VERIFY_INSPECTION: "Inspection",
            VERIFY_TEST: "Test"
          };
          this.Relationships = {
            CONTAINS: "contains",
            COPIES: "copies",
            DERIVES: "derives",
            SATISFIES: "satisfies",
            VERIFIES: "verifies",
            REFINES: "refines",
            TRACES: "traces"
          };
          this.setAccTitle = setAccTitle;
          this.getAccTitle = getAccTitle;
          this.setAccDescription = setAccDescription;
          this.getAccDescription = getAccDescription;
          this.setDiagramTitle = setDiagramTitle;
          this.getDiagramTitle = getDiagramTitle;
          this.getConfig = /* @__PURE__ */ __name(() => getConfig2().requirement, "getConfig");
          this.clear();
          this.setDirection = this.setDirection.bind(this);
          this.addRequirement = this.addRequirement.bind(this);
          this.setNewReqId = this.setNewReqId.bind(this);
          this.setNewReqRisk = this.setNewReqRisk.bind(this);
          this.setNewReqText = this.setNewReqText.bind(this);
          this.setNewReqVerifyMethod = this.setNewReqVerifyMethod.bind(this);
          this.addElement = this.addElement.bind(this);
          this.setNewElementType = this.setNewElementType.bind(this);
          this.setNewElementDocRef = this.setNewElementDocRef.bind(this);
          this.addRelationship = this.addRelationship.bind(this);
          this.setCssStyle = this.setCssStyle.bind(this);
          this.setClass = this.setClass.bind(this);
          this.defineClass = this.defineClass.bind(this);
          this.setAccTitle = this.setAccTitle.bind(this);
          this.setAccDescription = this.setAccDescription.bind(this);
        }
        static {
          __name(this, "RequirementDB");
        }
        getDirection() {
          return this.direction;
        }
        setDirection(dir2) {
          this.direction = dir2;
        }
        resetLatestRequirement() {
          this.latestRequirement = this.getInitialRequirement();
        }
        resetLatestElement() {
          this.latestElement = this.getInitialElement();
        }
        getInitialRequirement() {
          return {
            requirementId: "",
            text: "",
            risk: "",
            verifyMethod: "",
            name: "",
            type: "",
            cssStyles: [],
            classes: ["default"]
          };
        }
        getInitialElement() {
          return {
            name: "",
            type: "",
            docRef: "",
            cssStyles: [],
            classes: ["default"]
          };
        }
        addRequirement(name, type3) {
          if (!this.requirements.has(name)) {
            this.requirements.set(name, {
              name,
              type: type3,
              requirementId: this.latestRequirement.requirementId,
              text: this.latestRequirement.text,
              risk: this.latestRequirement.risk,
              verifyMethod: this.latestRequirement.verifyMethod,
              cssStyles: [],
              classes: ["default"]
            });
          }
          this.resetLatestRequirement();
          return this.requirements.get(name);
        }
        getRequirements() {
          return this.requirements;
        }
        setNewReqId(id34) {
          if (this.latestRequirement !== void 0) {
            this.latestRequirement.requirementId = id34;
          }
        }
        setNewReqText(text4) {
          if (this.latestRequirement !== void 0) {
            this.latestRequirement.text = text4;
          }
        }
        setNewReqRisk(risk) {
          if (this.latestRequirement !== void 0) {
            this.latestRequirement.risk = risk;
          }
        }
        setNewReqVerifyMethod(verifyMethod) {
          if (this.latestRequirement !== void 0) {
            this.latestRequirement.verifyMethod = verifyMethod;
          }
        }
        addElement(name) {
          if (!this.elements.has(name)) {
            this.elements.set(name, {
              name,
              type: this.latestElement.type,
              docRef: this.latestElement.docRef,
              cssStyles: [],
              classes: ["default"]
            });
            log.info("Added new element: ", name);
          }
          this.resetLatestElement();
          return this.elements.get(name);
        }
        getElements() {
          return this.elements;
        }
        setNewElementType(type3) {
          if (this.latestElement !== void 0) {
            this.latestElement.type = type3;
          }
        }
        setNewElementDocRef(docRef) {
          if (this.latestElement !== void 0) {
            this.latestElement.docRef = docRef;
          }
        }
        addRelationship(type3, src, dst) {
          this.relations.push({
            type: type3,
            src,
            dst
          });
        }
        getRelationships() {
          return this.relations;
        }
        clear() {
          this.relations = [];
          this.resetLatestRequirement();
          this.requirements = /* @__PURE__ */ new Map();
          this.resetLatestElement();
          this.elements = /* @__PURE__ */ new Map();
          this.classes = /* @__PURE__ */ new Map();
          clear();
        }
        setCssStyle(ids, styles5) {
          for (const id34 of ids) {
            const node2 = this.requirements.get(id34) ?? this.elements.get(id34);
            if (!styles5 || !node2) {
              return;
            }
            for (const s2 of styles5) {
              if (s2.includes(",")) {
                node2.cssStyles.push(...s2.split(","));
              } else {
                node2.cssStyles.push(s2);
              }
            }
          }
        }
        setClass(ids, classNames) {
          for (const id34 of ids) {
            const node2 = this.requirements.get(id34) ?? this.elements.get(id34);
            if (node2) {
              for (const _class2 of classNames) {
                node2.classes.push(_class2);
                const styles5 = this.classes.get(_class2)?.styles;
                if (styles5) {
                  node2.cssStyles.push(...styles5);
                }
              }
            }
          }
        }
        defineClass(ids, style3) {
          for (const id34 of ids) {
            let styleClass = this.classes.get(id34);
            if (styleClass === void 0) {
              styleClass = { id: id34, styles: [], textStyles: [] };
              this.classes.set(id34, styleClass);
            }
            if (style3) {
              style3.forEach(function(s2) {
                if (/color/.exec(s2)) {
                  const newStyle = s2.replace("fill", "bgFill");
                  styleClass.textStyles.push(newStyle);
                }
                styleClass.styles.push(s2);
              });
            }
            this.requirements.forEach((value2) => {
              if (value2.classes.includes(id34)) {
                value2.cssStyles.push(...style3.flatMap((s2) => s2.split(",")));
              }
            });
            this.elements.forEach((value2) => {
              if (value2.classes.includes(id34)) {
                value2.cssStyles.push(...style3.flatMap((s2) => s2.split(",")));
              }
            });
          }
        }
        getClasses() {
          return this.classes;
        }
        getData() {
          const config5 = getConfig2();
          const nodes5 = [];
          const edges3 = [];
          for (const requirement of this.requirements.values()) {
            const node2 = requirement;
            node2.id = requirement.name;
            node2.cssStyles = requirement.cssStyles;
            node2.cssClasses = requirement.classes.join(" ");
            node2.shape = "requirementBox";
            node2.look = config5.look;
            node2.colorIndex = nodes5.length;
            nodes5.push(node2);
          }
          for (const element3 of this.elements.values()) {
            const node2 = element3;
            node2.shape = "requirementBox";
            node2.look = config5.look;
            node2.id = element3.name;
            node2.cssStyles = element3.cssStyles;
            node2.cssClasses = element3.classes.join(" ");
            node2.colorIndex = nodes5.length;
            nodes5.push(node2);
          }
          for (const relation of this.relations) {
            let counter2 = 0;
            const isContains = relation.type === this.Relationships.CONTAINS;
            const edge = {
              id: `${relation.src}-${relation.dst}-${counter2}`,
              start: this.requirements.get(relation.src)?.name ?? this.elements.get(relation.src)?.name,
              end: this.requirements.get(relation.dst)?.name ?? this.elements.get(relation.dst)?.name,
              label: `&lt;&lt;${relation.type}&gt;&gt;`,
              classes: "relationshipLine",
              style: ["fill:none", isContains ? "" : "stroke-dasharray: 10,7"],
              labelpos: "c",
              thickness: "normal",
              type: "normal",
              pattern: isContains ? "normal" : "dashed",
              arrowTypeStart: isContains ? "requirement_contains" : "",
              arrowTypeEnd: isContains ? "" : "requirement_arrow",
              look: config5.look,
              labelType: "markdown"
            };
            edges3.push(edge);
            counter2++;
          }
          return { nodes: nodes5, edges: edges3, other: {}, config: config5, direction: this.getDirection() };
        }
      };
    }
  });

  // src/diagrams/requirement/styles.js
  var genColor3, getStyles8, styles_default7;
  var init_styles7 = __esm({
    "src/diagrams/requirement/styles.js"() {
      "use strict";
      init_config();
      genColor3 = /* @__PURE__ */ __name((options2) => {
        const config5 = getConfig();
        const { themeVariables, look } = config5;
        const { bkgColorArray, borderColorArray } = themeVariables;
        if (!borderColorArray?.length) {
          return "";
        }
        let sections6 = "";
        for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
          sections6 += `

    [data-look="${look}"][data-color-id="color-${i2}"].node path {
    stroke: ${borderColorArray[i2]};
    fill: ${bkgColorArray?.length ? bkgColorArray[i2] : ""};
    }

    [data-look="${look}"][data-color-id="color-${i2}"].node  rect {
    stroke: ${borderColorArray[i2]};
    fill: ${bkgColorArray?.length ? bkgColorArray[i2] : ""};
     }
    `;
        }
        return sections6;
      }, "genColor");
      getStyles8 = /* @__PURE__ */ __name((options2) => {
        const config5 = getConfig();
        const { look, themeVariables } = config5;
        const { requirementEdgeLabelBackground } = themeVariables;
        return `
  ${genColor3(options2)}
  marker {
    fill: ${options2.relationColor};
    stroke: ${options2.relationColor};
  }

  marker.cross {
    stroke: ${options2.lineColor};
  }

  svg {
    font-family: ${options2.fontFamily};
    font-size: ${options2.fontSize};
  }

  .reqBox {
    fill: ${options2.requirementBackground};
    fill-opacity: 1.0;
    stroke: ${options2.requirementBorderColor};
    stroke-width: ${options2.requirementBorderSize};
  }
  
  .reqTitle, .reqLabel{
    fill:  ${options2.requirementTextColor};
  }
  .reqLabelBox {
    fill: ${options2.relationLabelBackground};
    fill-opacity: 1.0;
  }

  .req-title-line {
    stroke: ${options2.requirementBorderColor};
    stroke-width: ${options2.requirementBorderSize};
  }
  .relationshipLine {
    stroke: ${options2.relationColor};
    stroke-width: ${look === "neo" ? options2.strokeWidth : "1px"};
  }
  .relationshipLabel {
    fill: ${options2.relationLabelColor};
  }
    .edgeLabel {
    background-color: ${options2.edgeLabelBackground};
  }
  .edgeLabel .label rect {
    fill: ${options2.edgeLabelBackground};
  }
  .edgeLabel .label text {
    fill: ${options2.relationLabelColor};
  }
  .divider {
    stroke: ${options2.nodeBorder};
    stroke-width: 1;
  }
  .label {
    font-family: ${options2.fontFamily};
    color: ${options2.nodeTextColor || options2.textColor};
  }
  .label text,span {
    fill: ${options2.nodeTextColor || options2.textColor};
    color: ${options2.nodeTextColor || options2.textColor};
  }
  .labelBkg {
    background-color: ${requirementEdgeLabelBackground ?? options2.edgeLabelBackground};
  }

`;
      }, "getStyles");
      styles_default7 = getStyles8;
    }
  });

  // src/diagrams/requirement/requirementRenderer.ts
  var requirementRenderer_exports = {};
  __export(requirementRenderer_exports, {
    draw: () => draw10
  });
  var draw10;
  var init_requirementRenderer = __esm({
    "src/diagrams/requirement/requirementRenderer.ts"() {
      "use strict";
      init_diagramAPI();
      init_logger();
      init_insertElementsForSize();
      init_render2();
      init_setupViewPortForSVG();
      init_utils2();
      draw10 = /* @__PURE__ */ __name(async function(text4, id34, _version, diag) {
        log.info("REF0:");
        log.info("Drawing requirement diagram (unified)", id34);
        const { securityLevel, state: conf5, layout: layout7, look } = getConfig2();
        const data4Layout = diag.db.getData();
        const svg2 = getDiagramElement(id34, securityLevel);
        data4Layout.type = diag.type;
        data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(layout7);
        data4Layout.nodeSpacing = conf5?.nodeSpacing ?? 50;
        data4Layout.rankSpacing = conf5?.rankSpacing ?? 50;
        data4Layout.markers = look === "neo" ? ["requirement_contains_neo", "requirement_arrow_neo"] : ["requirement_contains", "requirement_arrow"];
        data4Layout.diagramId = id34;
        await render6(data4Layout, svg2);
        const padding2 = 8;
        utils_default2.insertTitle(
          svg2,
          "requirementDiagramTitleText",
          conf5?.titleTopMargin ?? 25,
          diag.db.getDiagramTitle()
        );
        setupViewPortForSVG(svg2, padding2, "requirementDiagram", conf5?.useMaxWidth ?? true);
      }, "draw");
    }
  });

  // src/diagrams/requirement/requirementDiagram.ts
  var requirementDiagram_exports = {};
  __export(requirementDiagram_exports, {
    diagram: () => diagram10
  });
  var diagram10;
  var init_requirementDiagram2 = __esm({
    "src/diagrams/requirement/requirementDiagram.ts"() {
      "use strict";
      init_requirementDiagram();
      init_requirementDb();
      init_styles7();
      init_requirementRenderer();
      diagram10 = {
        parser: requirementDiagram_default,
        get db() {
          return new RequirementDB();
        },
        renderer: requirementRenderer_exports,
        styles: styles_default7
      };
    }
  });

  // src/diagrams/sequence/parser/sequenceDiagram.jison
  var parser11, sequenceDiagram_default;
  var init_sequenceDiagram = __esm({
    "src/diagrams/sequence/parser/sequenceDiagram.jison"() {
      "use strict";
      parser11 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 12], $V7 = [1, 14], $V8 = [1, 15], $V9 = [1, 17], $Va = [1, 18], $Vb = [1, 19], $Vc = [1, 25], $Vd = [1, 26], $Ve = [1, 27], $Vf = [1, 28], $Vg = [1, 29], $Vh = [1, 30], $Vi = [1, 31], $Vj = [1, 32], $Vk = [1, 33], $Vl = [1, 34], $Vm = [1, 35], $Vn = [1, 36], $Vo = [1, 37], $Vp = [1, 38], $Vq = [1, 39], $Vr = [1, 40], $Vs = [1, 42], $Vt = [1, 43], $Vu = [1, 44], $Vv = [1, 45], $Vw = [1, 46], $Vx = [1, 47], $Vy = [1, 4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 48, 49, 50, 51, 53, 54, 56, 61, 62, 63, 64, 73], $Vz = [1, 74], $VA = [1, 80], $VB = [1, 81], $VC = [1, 82], $VD = [1, 83], $VE = [1, 84], $VF = [1, 85], $VG = [1, 86], $VH = [1, 87], $VI = [1, 88], $VJ = [1, 89], $VK = [1, 90], $VL = [1, 91], $VM = [1, 92], $VN = [1, 93], $VO = [1, 94], $VP = [1, 95], $VQ = [1, 96], $VR = [1, 97], $VS = [1, 98], $VT = [1, 99], $VU = [1, 100], $VV = [1, 101], $VW = [1, 102], $VX = [1, 103], $VY = [1, 104], $VZ = [1, 105], $V_ = [2, 78], $V$ = [4, 5, 17, 51, 53, 54], $V01 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V11 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 50, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V21 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 49, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V31 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 48, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V41 = [5, 52], $V51 = [70, 71, 72, 73], $V61 = [1, 151];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "SPACE": 4, "NEWLINE": 5, "SD": 6, "document": 7, "line": 8, "statement": 9, "INVALID": 10, "box_section": 11, "box_line": 12, "participant_statement": 13, "create": 14, "box": 15, "restOfLine": 16, "end": 17, "signal": 18, "autonumber": 19, "NUM": 20, "off": 21, "activate": 22, "actor": 23, "deactivate": 24, "note_statement": 25, "links_statement": 26, "link_statement": 27, "properties_statement": 28, "details_statement": 29, "title": 30, "legacy_title": 31, "acc_title": 32, "acc_title_value": 33, "acc_descr": 34, "acc_descr_value": 35, "acc_descr_multiline_value": 36, "loop": 37, "rect": 38, "opt": 39, "alt": 40, "else_sections": 41, "par": 42, "par_sections": 43, "par_over": 44, "critical": 45, "option_sections": 46, "break": 47, "option": 48, "and": 49, "else": 50, "participant": 51, "AS": 52, "participant_actor": 53, "destroy": 54, "actor_with_config": 55, "note": 56, "placement": 57, "text2": 58, "over": 59, "actor_pair": 60, "links": 61, "link": 62, "properties": 63, "details": 64, "spaceList": 65, ",": 66, "left_of": 67, "right_of": 68, "signaltype": 69, "+": 70, "-": 71, "()": 72, "ACTOR": 73, "config_object": 74, "CONFIG_START": 75, "CONFIG_CONTENT": 76, "CONFIG_END": 77, "SOLID_OPEN_ARROW": 78, "DOTTED_OPEN_ARROW": 79, "SOLID_ARROW": 80, "SOLID_ARROW_TOP": 81, "SOLID_ARROW_BOTTOM": 82, "STICK_ARROW_TOP": 83, "STICK_ARROW_BOTTOM": 84, "SOLID_ARROW_TOP_DOTTED": 85, "SOLID_ARROW_BOTTOM_DOTTED": 86, "STICK_ARROW_TOP_DOTTED": 87, "STICK_ARROW_BOTTOM_DOTTED": 88, "SOLID_ARROW_TOP_REVERSE": 89, "SOLID_ARROW_BOTTOM_REVERSE": 90, "STICK_ARROW_TOP_REVERSE": 91, "STICK_ARROW_BOTTOM_REVERSE": 92, "SOLID_ARROW_TOP_REVERSE_DOTTED": 93, "SOLID_ARROW_BOTTOM_REVERSE_DOTTED": 94, "STICK_ARROW_TOP_REVERSE_DOTTED": 95, "STICK_ARROW_BOTTOM_REVERSE_DOTTED": 96, "BIDIRECTIONAL_SOLID_ARROW": 97, "DOTTED_ARROW": 98, "BIDIRECTIONAL_DOTTED_ARROW": 99, "SOLID_CROSS": 100, "DOTTED_CROSS": 101, "SOLID_POINT": 102, "DOTTED_POINT": 103, "TXT": 104, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 4: "SPACE", 5: "NEWLINE", 6: "SD", 10: "INVALID", 14: "create", 15: "box", 16: "restOfLine", 17: "end", 19: "autonumber", 20: "NUM", 21: "off", 22: "activate", 24: "deactivate", 30: "title", 31: "legacy_title", 32: "acc_title", 33: "acc_title_value", 34: "acc_descr", 35: "acc_descr_value", 36: "acc_descr_multiline_value", 37: "loop", 38: "rect", 39: "opt", 40: "alt", 42: "par", 44: "par_over", 45: "critical", 47: "break", 48: "option", 49: "and", 50: "else", 51: "participant", 52: "AS", 53: "participant_actor", 54: "destroy", 56: "note", 59: "over", 61: "links", 62: "link", 63: "properties", 64: "details", 66: ",", 67: "left_of", 68: "right_of", 70: "+", 71: "-", 72: "()", 73: "ACTOR", 75: "CONFIG_START", 76: "CONFIG_CONTENT", 77: "CONFIG_END", 78: "SOLID_OPEN_ARROW", 79: "DOTTED_OPEN_ARROW", 80: "SOLID_ARROW", 81: "SOLID_ARROW_TOP", 82: "SOLID_ARROW_BOTTOM", 83: "STICK_ARROW_TOP", 84: "STICK_ARROW_BOTTOM", 85: "SOLID_ARROW_TOP_DOTTED", 86: "SOLID_ARROW_BOTTOM_DOTTED", 87: "STICK_ARROW_TOP_DOTTED", 88: "STICK_ARROW_BOTTOM_DOTTED", 89: "SOLID_ARROW_TOP_REVERSE", 90: "SOLID_ARROW_BOTTOM_REVERSE", 91: "STICK_ARROW_TOP_REVERSE", 92: "STICK_ARROW_BOTTOM_REVERSE", 93: "SOLID_ARROW_TOP_REVERSE_DOTTED", 94: "SOLID_ARROW_BOTTOM_REVERSE_DOTTED", 95: "STICK_ARROW_TOP_REVERSE_DOTTED", 96: "STICK_ARROW_BOTTOM_REVERSE_DOTTED", 97: "BIDIRECTIONAL_SOLID_ARROW", 98: "DOTTED_ARROW", 99: "BIDIRECTIONAL_DOTTED_ARROW", 100: "SOLID_CROSS", 101: "DOTTED_CROSS", 102: "SOLID_POINT", 103: "DOTTED_POINT", 104: "TXT" },
          productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [8, 1], [11, 0], [11, 2], [12, 2], [12, 1], [12, 1], [9, 1], [9, 2], [9, 4], [9, 2], [9, 4], [9, 3], [9, 3], [9, 2], [9, 3], [9, 3], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [46, 1], [46, 4], [43, 1], [43, 4], [41, 1], [41, 4], [13, 5], [13, 3], [13, 5], [13, 3], [13, 3], [13, 5], [13, 3], [13, 5], [13, 3], [25, 4], [25, 4], [26, 3], [27, 3], [28, 3], [29, 3], [65, 2], [65, 1], [60, 3], [60, 1], [57, 1], [57, 1], [18, 5], [18, 5], [18, 5], [18, 5], [18, 6], [18, 4], [55, 2], [74, 3], [23, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [58, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 3:
                yy.apply($$[$0]);
                return $$[$0];
                break;
              case 4:
              case 10:
                this.$ = [];
                break;
              case 5:
              case 11:
                $$[$0 - 1].push($$[$0]);
                this.$ = $$[$0 - 1];
                break;
              case 6:
              case 7:
              case 12:
              case 13:
                this.$ = $$[$0];
                break;
              case 8:
              case 9:
              case 14:
                this.$ = [];
                break;
              case 16:
                $$[$0].type = "createParticipant";
                this.$ = $$[$0];
                break;
              case 17:
                $$[$0 - 1].unshift({ type: "boxStart", boxData: yy.parseBoxData($$[$0 - 2]) });
                $$[$0 - 1].push({ type: "boxEnd", boxText: $$[$0 - 2] });
                this.$ = $$[$0 - 1];
                break;
              case 19:
                this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 2]), sequenceIndexStep: Number($$[$0 - 1]), sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
                break;
              case 20:
                this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 1]), sequenceIndexStep: 1, sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
                break;
              case 21:
                this.$ = { type: "sequenceIndex", sequenceVisible: false, signalType: yy.LINETYPE.AUTONUMBER };
                break;
              case 22:
                this.$ = { type: "sequenceIndex", sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
                break;
              case 23:
                this.$ = { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor };
                break;
              case 24:
                this.$ = { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 1].actor };
                break;
              case 30:
                yy.setDiagramTitle($$[$0].substring(6));
                this.$ = $$[$0].substring(6);
                break;
              case 31:
                yy.setDiagramTitle($$[$0].substring(7));
                this.$ = $$[$0].substring(7);
                break;
              case 32:
                this.$ = $$[$0].trim();
                yy.setAccTitle(this.$);
                break;
              case 33:
              case 34:
                this.$ = $$[$0].trim();
                yy.setAccDescription(this.$);
                break;
              case 35:
                $$[$0 - 1].unshift({ type: "loopStart", loopText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.LOOP_START });
                $$[$0 - 1].push({ type: "loopEnd", loopText: $$[$0 - 2], signalType: yy.LINETYPE.LOOP_END });
                this.$ = $$[$0 - 1];
                break;
              case 36:
                $$[$0 - 1].unshift({ type: "rectStart", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_START });
                $$[$0 - 1].push({ type: "rectEnd", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_END });
                this.$ = $$[$0 - 1];
                break;
              case 37:
                $$[$0 - 1].unshift({ type: "optStart", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_START });
                $$[$0 - 1].push({ type: "optEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_END });
                this.$ = $$[$0 - 1];
                break;
              case 38:
                $$[$0 - 1].unshift({ type: "altStart", altText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.ALT_START });
                $$[$0 - 1].push({ type: "altEnd", signalType: yy.LINETYPE.ALT_END });
                this.$ = $$[$0 - 1];
                break;
              case 39:
                $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_START });
                $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
                this.$ = $$[$0 - 1];
                break;
              case 40:
                $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_OVER_START });
                $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
                this.$ = $$[$0 - 1];
                break;
              case 41:
                $$[$0 - 1].unshift({ type: "criticalStart", criticalText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.CRITICAL_START });
                $$[$0 - 1].push({ type: "criticalEnd", signalType: yy.LINETYPE.CRITICAL_END });
                this.$ = $$[$0 - 1];
                break;
              case 42:
                $$[$0 - 1].unshift({ type: "breakStart", breakText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_START });
                $$[$0 - 1].push({ type: "breakEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_END });
                this.$ = $$[$0 - 1];
                break;
              case 44:
                this.$ = $$[$0 - 3].concat([{ type: "option", optionText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.CRITICAL_OPTION }, $$[$0]]);
                break;
              case 46:
                this.$ = $$[$0 - 3].concat([{ type: "and", parText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.PAR_AND }, $$[$0]]);
                break;
              case 48:
                this.$ = $$[$0 - 3].concat([{ type: "else", altText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.ALT_ELSE }, $$[$0]]);
                break;
              case 49:
                $$[$0 - 3].draw = "participant";
                $$[$0 - 3].type = "addParticipant";
                $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
                this.$ = $$[$0 - 3];
                break;
              case 50:
                $$[$0 - 1].draw = "participant";
                $$[$0 - 1].type = "addParticipant";
                this.$ = $$[$0 - 1];
                break;
              case 51:
                $$[$0 - 3].draw = "actor";
                $$[$0 - 3].type = "addParticipant";
                $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
                this.$ = $$[$0 - 3];
                break;
              case 52:
              case 57:
                $$[$0 - 1].draw = "actor";
                $$[$0 - 1].type = "addParticipant";
                this.$ = $$[$0 - 1];
                break;
              case 53:
                $$[$0 - 1].type = "destroyParticipant";
                this.$ = $$[$0 - 1];
                break;
              case 54:
                $$[$0 - 3].draw = "participant";
                $$[$0 - 3].type = "addParticipant";
                $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
                this.$ = $$[$0 - 3];
                break;
              case 55:
                $$[$0 - 1].draw = "participant";
                $$[$0 - 1].type = "addParticipant";
                this.$ = $$[$0 - 1];
                break;
              case 56:
                $$[$0 - 3].draw = "actor";
                $$[$0 - 3].type = "addParticipant";
                $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
                this.$ = $$[$0 - 3];
                break;
              case 58:
                this.$ = [$$[$0 - 1], { type: "addNote", placement: $$[$0 - 2], actor: $$[$0 - 1].actor, text: $$[$0] }];
                break;
              case 59:
                $$[$0 - 2] = [].concat($$[$0 - 1], $$[$0 - 1]).slice(0, 2);
                $$[$0 - 2][0] = $$[$0 - 2][0].actor;
                $$[$0 - 2][1] = $$[$0 - 2][1].actor;
                this.$ = [$$[$0 - 1], { type: "addNote", placement: yy.PLACEMENT.OVER, actor: $$[$0 - 2].slice(0, 2), text: $$[$0] }];
                break;
              case 60:
                this.$ = [$$[$0 - 1], { type: "addLinks", actor: $$[$0 - 1].actor, text: $$[$0] }];
                break;
              case 61:
                this.$ = [$$[$0 - 1], { type: "addALink", actor: $$[$0 - 1].actor, text: $$[$0] }];
                break;
              case 62:
                this.$ = [$$[$0 - 1], { type: "addProperties", actor: $$[$0 - 1].actor, text: $$[$0] }];
                break;
              case 63:
                this.$ = [$$[$0 - 1], { type: "addDetails", actor: $$[$0 - 1].actor, text: $$[$0] }];
                break;
              case 66:
                this.$ = [$$[$0 - 2], $$[$0]];
                break;
              case 67:
                this.$ = $$[$0];
                break;
              case 68:
                this.$ = yy.PLACEMENT.LEFTOF;
                break;
              case 69:
                this.$ = yy.PLACEMENT.RIGHTOF;
                break;
              case 70:
                this.$ = [
                  $$[$0 - 4],
                  $$[$0 - 1],
                  { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true },
                  { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor }
                ];
                break;
              case 71:
                this.$ = [
                  $$[$0 - 4],
                  $$[$0 - 1],
                  { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0] },
                  { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 4].actor }
                ];
                break;
              case 72:
                this.$ = [
                  $$[$0 - 4],
                  $$[$0 - 1],
                  { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION },
                  { type: "centralConnection", signalType: yy.LINETYPE.CENTRAL_CONNECTION, actor: $$[$0 - 1].actor }
                ];
                break;
              case 73:
                this.$ = [
                  $$[$0 - 4],
                  $$[$0 - 1],
                  { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0], activate: false, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE },
                  { type: "centralConnectionReverse", signalType: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE, actor: $$[$0 - 4].actor }
                ];
                break;
              case 74:
                this.$ = [
                  $$[$0 - 5],
                  $$[$0 - 1],
                  { type: "addMessage", from: $$[$0 - 5].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION_DUAL },
                  { type: "centralConnection", signalType: yy.LINETYPE.CENTRAL_CONNECTION, actor: $$[$0 - 1].actor },
                  { type: "centralConnectionReverse", signalType: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE, actor: $$[$0 - 5].actor }
                ];
                break;
              case 75:
                this.$ = [$$[$0 - 3], $$[$0 - 1], { type: "addMessage", from: $$[$0 - 3].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0] }];
                break;
              case 76:
                this.$ = {
                  type: "addParticipant",
                  actor: $$[$0 - 1],
                  config: $$[$0]
                };
                break;
              case 77:
                this.$ = $$[$0 - 1].trim();
                break;
              case 78:
                this.$ = { type: "addParticipant", actor: $$[$0] };
                break;
              case 79:
                this.$ = yy.LINETYPE.SOLID_OPEN;
                break;
              case 80:
                this.$ = yy.LINETYPE.DOTTED_OPEN;
                break;
              case 81:
                this.$ = yy.LINETYPE.SOLID;
                break;
              case 82:
                this.$ = yy.LINETYPE.SOLID_TOP;
                break;
              case 83:
                this.$ = yy.LINETYPE.SOLID_BOTTOM;
                break;
              case 84:
                this.$ = yy.LINETYPE.STICK_TOP;
                break;
              case 85:
                this.$ = yy.LINETYPE.STICK_BOTTOM;
                break;
              case 86:
                this.$ = yy.LINETYPE.SOLID_TOP_DOTTED;
                break;
              case 87:
                this.$ = yy.LINETYPE.SOLID_BOTTOM_DOTTED;
                break;
              case 88:
                this.$ = yy.LINETYPE.STICK_TOP_DOTTED;
                break;
              case 89:
                this.$ = yy.LINETYPE.STICK_BOTTOM_DOTTED;
                break;
              case 90:
                this.$ = yy.LINETYPE.SOLID_ARROW_TOP_REVERSE;
                break;
              case 91:
                this.$ = yy.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;
                break;
              case 92:
                this.$ = yy.LINETYPE.STICK_ARROW_TOP_REVERSE;
                break;
              case 93:
                this.$ = yy.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;
                break;
              case 94:
                this.$ = yy.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;
                break;
              case 95:
                this.$ = yy.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;
                break;
              case 96:
                this.$ = yy.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;
                break;
              case 97:
                this.$ = yy.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;
                break;
              case 98:
                this.$ = yy.LINETYPE.BIDIRECTIONAL_SOLID;
                break;
              case 99:
                this.$ = yy.LINETYPE.DOTTED;
                break;
              case 100:
                this.$ = yy.LINETYPE.BIDIRECTIONAL_DOTTED;
                break;
              case 101:
                this.$ = yy.LINETYPE.SOLID_CROSS;
                break;
              case 102:
                this.$ = yy.LINETYPE.DOTTED_CROSS;
                break;
              case 103:
                this.$ = yy.LINETYPE.SOLID_POINT;
                break;
              case 104:
                this.$ = yy.LINETYPE.DOTTED_POINT;
                break;
              case 105:
                this.$ = yy.parseMessage($$[$0].trim().substring(1));
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: $V0, 5: $V1, 6: $V2 }, { 1: [3] }, { 3: 5, 4: $V0, 5: $V1, 6: $V2 }, { 3: 6, 4: $V0, 5: $V1, 6: $V2 }, o2([1, 4, 5, 10, 14, 15, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, o2($Vy, [2, 5]), { 9: 48, 13: 13, 14: $V7, 15: $V8, 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, o2($Vy, [2, 7]), o2($Vy, [2, 8]), o2($Vy, [2, 9]), o2($Vy, [2, 15]), { 13: 49, 51: $Vp, 53: $Vq, 54: $Vr }, { 16: [1, 50] }, { 5: [1, 51] }, { 5: [1, 54], 20: [1, 52], 21: [1, 53] }, { 23: 55, 73: $Vx }, { 23: 56, 73: $Vx }, { 5: [1, 57] }, { 5: [1, 58] }, { 5: [1, 59] }, { 5: [1, 60] }, { 5: [1, 61] }, o2($Vy, [2, 30]), o2($Vy, [2, 31]), { 33: [1, 62] }, { 35: [1, 63] }, o2($Vy, [2, 34]), { 16: [1, 64] }, { 16: [1, 65] }, { 16: [1, 66] }, { 16: [1, 67] }, { 16: [1, 68] }, { 16: [1, 69] }, { 16: [1, 70] }, { 16: [1, 71] }, { 23: 72, 55: 73, 73: $Vz }, { 23: 75, 55: 76, 73: $Vz }, { 23: 77, 73: $Vx }, { 69: 78, 72: [1, 79], 78: $VA, 79: $VB, 80: $VC, 81: $VD, 82: $VE, 83: $VF, 84: $VG, 85: $VH, 86: $VI, 87: $VJ, 88: $VK, 89: $VL, 90: $VM, 91: $VN, 92: $VO, 93: $VP, 94: $VQ, 95: $VR, 96: $VS, 97: $VT, 98: $VU, 99: $VV, 100: $VW, 101: $VX, 102: $VY, 103: $VZ }, { 57: 106, 59: [1, 107], 67: [1, 108], 68: [1, 109] }, { 23: 110, 73: $Vx }, { 23: 111, 73: $Vx }, { 23: 112, 73: $Vx }, { 23: 113, 73: $Vx }, o2([5, 66, 72, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104], $V_), o2($Vy, [2, 6]), o2($Vy, [2, 16]), o2($V$, [2, 10], { 11: 114 }), o2($Vy, [2, 18]), { 5: [1, 116], 20: [1, 115] }, { 5: [1, 117] }, o2($Vy, [2, 22]), { 5: [1, 118] }, { 5: [1, 119] }, o2($Vy, [2, 25]), o2($Vy, [2, 26]), o2($Vy, [2, 27]), o2($Vy, [2, 28]), o2($Vy, [2, 29]), o2($Vy, [2, 32]), o2($Vy, [2, 33]), o2($V01, $V3, { 7: 120 }), o2($V01, $V3, { 7: 121 }), o2($V01, $V3, { 7: 122 }), o2($V11, $V3, { 41: 123, 7: 124 }), o2($V21, $V3, { 43: 125, 7: 126 }), o2($V21, $V3, { 7: 126, 43: 127 }), o2($V31, $V3, { 46: 128, 7: 129 }), o2($V01, $V3, { 7: 130 }), { 5: [1, 132], 52: [1, 131] }, { 5: [1, 134], 52: [1, 133] }, o2($V41, $V_, { 74: 135, 75: [1, 136] }), { 5: [1, 138], 52: [1, 137] }, { 5: [1, 140], 52: [1, 139] }, { 5: [1, 141] }, { 23: 145, 70: [1, 142], 71: [1, 143], 72: [1, 144], 73: $Vx }, { 69: 146, 78: $VA, 79: $VB, 80: $VC, 81: $VD, 82: $VE, 83: $VF, 84: $VG, 85: $VH, 86: $VI, 87: $VJ, 88: $VK, 89: $VL, 90: $VM, 91: $VN, 92: $VO, 93: $VP, 94: $VQ, 95: $VR, 96: $VS, 97: $VT, 98: $VU, 99: $VV, 100: $VW, 101: $VX, 102: $VY, 103: $VZ }, o2($V51, [2, 79]), o2($V51, [2, 80]), o2($V51, [2, 81]), o2($V51, [2, 82]), o2($V51, [2, 83]), o2($V51, [2, 84]), o2($V51, [2, 85]), o2($V51, [2, 86]), o2($V51, [2, 87]), o2($V51, [2, 88]), o2($V51, [2, 89]), o2($V51, [2, 90]), o2($V51, [2, 91]), o2($V51, [2, 92]), o2($V51, [2, 93]), o2($V51, [2, 94]), o2($V51, [2, 95]), o2($V51, [2, 96]), o2($V51, [2, 97]), o2($V51, [2, 98]), o2($V51, [2, 99]), o2($V51, [2, 100]), o2($V51, [2, 101]), o2($V51, [2, 102]), o2($V51, [2, 103]), o2($V51, [2, 104]), { 23: 147, 73: $Vx }, { 23: 149, 60: 148, 73: $Vx }, { 73: [2, 68] }, { 73: [2, 69] }, { 58: 150, 104: $V61 }, { 58: 152, 104: $V61 }, { 58: 153, 104: $V61 }, { 58: 154, 104: $V61 }, { 4: [1, 157], 5: [1, 159], 12: 156, 13: 158, 17: [1, 155], 51: $Vp, 53: $Vq, 54: $Vr }, { 5: [1, 160] }, o2($Vy, [2, 20]), o2($Vy, [2, 21]), o2($Vy, [2, 23]), o2($Vy, [2, 24]), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 161], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 162], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 163], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 164] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 47], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 50: [1, 165], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 166] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 45], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 49: [1, 167], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 168] }, { 17: [1, 169] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 43], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 48: [1, 170], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 171], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 16: [1, 172] }, o2($Vy, [2, 50]), { 16: [1, 173] }, o2($Vy, [2, 55]), o2($V41, [2, 76]), { 76: [1, 174] }, { 16: [1, 175] }, o2($Vy, [2, 52]), { 16: [1, 176] }, o2($Vy, [2, 57]), o2($Vy, [2, 53]), { 23: 177, 73: $Vx }, { 23: 178, 73: $Vx }, { 23: 179, 73: $Vx }, { 58: 180, 104: $V61 }, { 23: 181, 72: [1, 182], 73: $Vx }, { 58: 183, 104: $V61 }, { 58: 184, 104: $V61 }, { 66: [1, 185], 104: [2, 67] }, { 5: [2, 60] }, { 5: [2, 105] }, { 5: [2, 61] }, { 5: [2, 62] }, { 5: [2, 63] }, o2($Vy, [2, 17]), o2($V$, [2, 11]), { 13: 186, 51: $Vp, 53: $Vq, 54: $Vr }, o2($V$, [2, 13]), o2($V$, [2, 14]), o2($Vy, [2, 19]), o2($Vy, [2, 35]), o2($Vy, [2, 36]), o2($Vy, [2, 37]), o2($Vy, [2, 38]), { 16: [1, 187] }, o2($Vy, [2, 39]), { 16: [1, 188] }, o2($Vy, [2, 40]), o2($Vy, [2, 41]), { 16: [1, 189] }, o2($Vy, [2, 42]), { 5: [1, 190] }, { 5: [1, 191] }, { 77: [1, 192] }, { 5: [1, 193] }, { 5: [1, 194] }, { 58: 195, 104: $V61 }, { 58: 196, 104: $V61 }, { 58: 197, 104: $V61 }, { 5: [2, 75] }, { 58: 198, 104: $V61 }, { 23: 199, 73: $Vx }, { 5: [2, 58] }, { 5: [2, 59] }, { 23: 200, 73: $Vx }, o2($V$, [2, 12]), o2($V11, $V3, { 7: 124, 41: 201 }), o2($V21, $V3, { 7: 126, 43: 202 }), o2($V31, $V3, { 7: 129, 46: 203 }), o2($Vy, [2, 49]), o2($Vy, [2, 54]), o2($V41, [2, 77]), o2($Vy, [2, 51]), o2($Vy, [2, 56]), { 5: [2, 70] }, { 5: [2, 71] }, { 5: [2, 72] }, { 5: [2, 73] }, { 58: 204, 104: $V61 }, { 104: [2, 66] }, { 17: [2, 48] }, { 17: [2, 46] }, { 17: [2, 44] }, { 5: [2, 74] }],
          defaultActions: { 5: [2, 1], 6: [2, 2], 108: [2, 68], 109: [2, 69], 150: [2, 60], 151: [2, 105], 152: [2, 61], 153: [2, 62], 154: [2, 63], 180: [2, 75], 183: [2, 58], 184: [2, 59], 195: [2, 70], 196: [2, 71], 197: [2, 72], 198: [2, 73], 200: [2, 66], 201: [2, 48], 202: [2, 46], 203: [2, 44], 204: [2, 74] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  return 5;
                  break;
                case 1:
                  break;
                case 2:
                  break;
                case 3:
                  break;
                case 4:
                  break;
                case 5:
                  break;
                case 6:
                  return 20;
                  break;
                case 7:
                  this.begin("CONFIG");
                  return 75;
                  break;
                case 8:
                  return 76;
                  break;
                case 9:
                  this.popState();
                  this.begin("ALIAS");
                  return 77;
                  break;
                case 10:
                  this.popState();
                  this.popState();
                  return 77;
                  break;
                case 11:
                  yy_.yytext = yy_.yytext.trim();
                  return 73;
                  break;
                case 12:
                  yy_.yytext = yy_.yytext.trim();
                  this.begin("ALIAS");
                  return 73;
                  break;
                case 13:
                  yy_.yytext = yy_.yytext.trim();
                  this.popState();
                  return 73;
                  break;
                case 14:
                  this.popState();
                  return 10;
                  break;
                case 15:
                  yy_.yytext = yy_.yytext.trim();
                  this.popState();
                  return 10;
                  break;
                case 16:
                  this.begin("LINE");
                  return 15;
                  break;
                case 17:
                  this.begin("ID");
                  return 51;
                  break;
                case 18:
                  this.begin("ID");
                  return 53;
                  break;
                case 19:
                  return 14;
                  break;
                case 20:
                  this.begin("ID");
                  return 54;
                  break;
                case 21:
                  this.popState();
                  this.popState();
                  this.begin("LINE");
                  return 52;
                  break;
                case 22:
                  this.popState();
                  this.popState();
                  return 5;
                  break;
                case 23:
                  this.begin("LINE");
                  return 37;
                  break;
                case 24:
                  this.begin("LINE");
                  return 38;
                  break;
                case 25:
                  this.begin("LINE");
                  return 39;
                  break;
                case 26:
                  this.begin("LINE");
                  return 40;
                  break;
                case 27:
                  this.begin("LINE");
                  return 50;
                  break;
                case 28:
                  this.begin("LINE");
                  return 42;
                  break;
                case 29:
                  this.begin("LINE");
                  return 44;
                  break;
                case 30:
                  this.begin("LINE");
                  return 49;
                  break;
                case 31:
                  this.begin("LINE");
                  return 45;
                  break;
                case 32:
                  this.begin("LINE");
                  return 48;
                  break;
                case 33:
                  this.begin("LINE");
                  return 47;
                  break;
                case 34:
                  this.popState();
                  return 16;
                  break;
                case 35:
                  return 17;
                  break;
                case 36:
                  return 67;
                  break;
                case 37:
                  return 68;
                  break;
                case 38:
                  return 61;
                  break;
                case 39:
                  return 62;
                  break;
                case 40:
                  return 63;
                  break;
                case 41:
                  return 64;
                  break;
                case 42:
                  return 59;
                  break;
                case 43:
                  return 56;
                  break;
                case 44:
                  this.begin("ID");
                  return 22;
                  break;
                case 45:
                  this.begin("ID");
                  return 24;
                  break;
                case 46:
                  return 30;
                  break;
                case 47:
                  return 31;
                  break;
                case 48:
                  this.begin("acc_title");
                  return 32;
                  break;
                case 49:
                  this.popState();
                  return "acc_title_value";
                  break;
                case 50:
                  this.begin("acc_descr");
                  return 34;
                  break;
                case 51:
                  this.popState();
                  return "acc_descr_value";
                  break;
                case 52:
                  this.begin("acc_descr_multiline");
                  break;
                case 53:
                  this.popState();
                  break;
                case 54:
                  return "acc_descr_multiline_value";
                  break;
                case 55:
                  return 6;
                  break;
                case 56:
                  return 19;
                  break;
                case 57:
                  return 21;
                  break;
                case 58:
                  return 66;
                  break;
                case 59:
                  return 5;
                  break;
                case 60:
                  yy_.yytext = yy_.yytext.trim();
                  return 73;
                  break;
                case 61:
                  return 80;
                  break;
                case 62:
                  return 97;
                  break;
                case 63:
                  return 98;
                  break;
                case 64:
                  return 99;
                  break;
                case 65:
                  return 78;
                  break;
                case 66:
                  return 79;
                  break;
                case 67:
                  return 100;
                  break;
                case 68:
                  return 101;
                  break;
                case 69:
                  return 102;
                  break;
                case 70:
                  return 103;
                  break;
                case 71:
                  return 85;
                  break;
                case 72:
                  return 86;
                  break;
                case 73:
                  return 87;
                  break;
                case 74:
                  return 88;
                  break;
                case 75:
                  return 93;
                  break;
                case 76:
                  return 94;
                  break;
                case 77:
                  return 95;
                  break;
                case 78:
                  return 96;
                  break;
                case 79:
                  return 81;
                  break;
                case 80:
                  return 82;
                  break;
                case 81:
                  return 83;
                  break;
                case 82:
                  return 84;
                  break;
                case 83:
                  return 89;
                  break;
                case 84:
                  return 90;
                  break;
                case 85:
                  return 91;
                  break;
                case 86:
                  return 92;
                  break;
                case 87:
                  return 104;
                  break;
                case 88:
                  return 104;
                  break;
                case 89:
                  return 70;
                  break;
                case 90:
                  return 71;
                  break;
                case 91:
                  return 72;
                  break;
                case 92:
                  return 5;
                  break;
                case 93:
                  return 10;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[0-9]+(?=[ \n]+))/i, /^(?:@\{)/i, /^(?:[^\}]+)/i, /^(?:\}(?=\s+as\s))/i, /^(?:\})/i, /^(?:[^\<->\->:\n,;@\s]+(?=@\{))/i, /^(?:[^<>:\n,;@\s]+(?=\s+as\s))/i, /^(?:[^<>:\n,;@]+(?=\s*[\n;#]|$))/i, /^(?:[^<>:\n,;@]*<[^\n]*)/i, /^(?:[^\n]+)/i, /^(?:box\b)/i, /^(?:participant\b)/i, /^(?:actor\b)/i, /^(?:create\b)/i, /^(?:destroy\b)/i, /^(?:as\b)/i, /^(?:(?:))/i, /^(?:loop\b)/i, /^(?:rect\b)/i, /^(?:opt\b)/i, /^(?:alt\b)/i, /^(?:else\b)/i, /^(?:par\b)/i, /^(?:par_over\b)/i, /^(?:and\b)/i, /^(?:critical\b)/i, /^(?:option\b)/i, /^(?:break\b)/i, /^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i, /^(?:end\b)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:links\b)/i, /^(?:link\b)/i, /^(?:properties\b)/i, /^(?:details\b)/i, /^(?:over\b)/i, /^(?:note\b)/i, /^(?:activate\b)/i, /^(?:deactivate\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:title:\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:sequenceDiagram\b)/i, /^(?:autonumber\b)/i, /^(?:off\b)/i, /^(?:,)/i, /^(?:;)/i, /^(?:[^\/\\\+\()\+<\->\->:\n,;]+((?!(-x|--x|-\)|--\)|-\|\\|-\\|-\/|-\/\/|-\|\/|\/\|-|\\\|-|\/\/-|\\\\-|\/\|-|--\|\\|--|\(\)))[\-]*[^\+<\->\->:\n,;]+)*)/i, /^(?:->>)/i, /^(?:<<->>)/i, /^(?:-->>)/i, /^(?:<<-->>)/i, /^(?:->)/i, /^(?:-->)/i, /^(?:-[x])/i, /^(?:--[x])/i, /^(?:-[\)])/i, /^(?:--[\)])/i, /^(?:--\|\\)/i, /^(?:--\|\/)/i, /^(?:--\\\\)/i, /^(?:--\/\/)/i, /^(?:\/\|--)/i, /^(?:\\\|--)/i, /^(?:\/\/--)/i, /^(?:\\\\--)/i, /^(?:-\|\\)/i, /^(?:-\|\/)/i, /^(?:-\\\\)/i, /^(?:-\/\/)/i, /^(?:\/\|-)/i, /^(?:\\\|-)/i, /^(?:\/\/-)/i, /^(?:\\\\-)/i, /^(?::(?:(?:no)?wrap)?[^#\n;]*)/i, /^(?::)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:\(\))/i, /^(?:$)/i, /^(?:.)/i],
            conditions: { "acc_descr_multiline": { "rules": [53, 54], "inclusive": false }, "acc_descr": { "rules": [51], "inclusive": false }, "acc_title": { "rules": [49], "inclusive": false }, "ID": { "rules": [2, 3, 7, 11, 12, 13, 14, 15], "inclusive": false }, "ALIAS": { "rules": [2, 3, 21, 22], "inclusive": false }, "LINE": { "rules": [2, 3, 34], "inclusive": false }, "CONFIG": { "rules": [8, 9, 10], "inclusive": false }, "CONFIG_DATA": { "rules": [], "inclusive": false }, "INITIAL": { "rules": [0, 1, 3, 4, 5, 6, 16, 17, 18, 19, 20, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser11.parser = parser11;
      sequenceDiagram_default = parser11;
    }
  });

  // src/diagrams/sequence/sequenceDb.ts
  var LINETYPE2, ARROWTYPE2, PLACEMENT2, PARTICIPANT_TYPE, SequenceDB;
  var init_sequenceDb = __esm({
    "src/diagrams/sequence/sequenceDb.ts"() {
      "use strict";
      init_diagramAPI();
      init_js_yaml();
      init_logger();
      init_imperativeState();
      init_common();
      init_commonDb();
      LINETYPE2 = {
        SOLID: 0,
        DOTTED: 1,
        NOTE: 2,
        SOLID_CROSS: 3,
        DOTTED_CROSS: 4,
        SOLID_OPEN: 5,
        DOTTED_OPEN: 6,
        LOOP_START: 10,
        LOOP_END: 11,
        ALT_START: 12,
        ALT_ELSE: 13,
        ALT_END: 14,
        OPT_START: 15,
        OPT_END: 16,
        ACTIVE_START: 17,
        ACTIVE_END: 18,
        PAR_START: 19,
        PAR_AND: 20,
        PAR_END: 21,
        RECT_START: 22,
        RECT_END: 23,
        SOLID_POINT: 24,
        DOTTED_POINT: 25,
        AUTONUMBER: 26,
        CRITICAL_START: 27,
        CRITICAL_OPTION: 28,
        CRITICAL_END: 29,
        BREAK_START: 30,
        BREAK_END: 31,
        PAR_OVER_START: 32,
        BIDIRECTIONAL_SOLID: 33,
        BIDIRECTIONAL_DOTTED: 34,
        SOLID_TOP: 41,
        SOLID_BOTTOM: 42,
        STICK_TOP: 43,
        STICK_BOTTOM: 44,
        SOLID_ARROW_TOP_REVERSE: 45,
        SOLID_ARROW_BOTTOM_REVERSE: 46,
        STICK_ARROW_TOP_REVERSE: 47,
        STICK_ARROW_BOTTOM_REVERSE: 48,
        SOLID_TOP_DOTTED: 51,
        SOLID_BOTTOM_DOTTED: 52,
        STICK_TOP_DOTTED: 53,
        STICK_BOTTOM_DOTTED: 54,
        SOLID_ARROW_TOP_REVERSE_DOTTED: 55,
        SOLID_ARROW_BOTTOM_REVERSE_DOTTED: 56,
        STICK_ARROW_TOP_REVERSE_DOTTED: 57,
        STICK_ARROW_BOTTOM_REVERSE_DOTTED: 58,
        CENTRAL_CONNECTION: 59,
        CENTRAL_CONNECTION_REVERSE: 60,
        CENTRAL_CONNECTION_DUAL: 61
      };
      ARROWTYPE2 = {
        FILLED: 0,
        OPEN: 1
      };
      PLACEMENT2 = {
        LEFTOF: 0,
        RIGHTOF: 1,
        OVER: 2
      };
      PARTICIPANT_TYPE = {
        ACTOR: "actor",
        BOUNDARY: "boundary",
        COLLECTIONS: "collections",
        CONTROL: "control",
        DATABASE: "database",
        ENTITY: "entity",
        PARTICIPANT: "participant",
        QUEUE: "queue"
      };
      SequenceDB = class {
        constructor() {
          this.state = new ImperativeState(() => ({
            prevActor: void 0,
            actors: /* @__PURE__ */ new Map(),
            createdActors: /* @__PURE__ */ new Map(),
            destroyedActors: /* @__PURE__ */ new Map(),
            boxes: [],
            messages: [],
            notes: [],
            sequenceNumbersEnabled: false,
            wrapEnabled: void 0,
            currentBox: void 0,
            lastCreated: void 0,
            lastDestroyed: void 0
          }));
          this.setAccTitle = setAccTitle;
          this.setAccDescription = setAccDescription;
          this.setDiagramTitle = setDiagramTitle;
          this.getAccTitle = getAccTitle;
          this.getAccDescription = getAccDescription;
          this.getDiagramTitle = getDiagramTitle;
          this.apply = this.apply.bind(this);
          this.parseBoxData = this.parseBoxData.bind(this);
          this.parseMessage = this.parseMessage.bind(this);
          this.clear();
          this.setWrap(getConfig2().wrap);
          this.LINETYPE = LINETYPE2;
          this.ARROWTYPE = ARROWTYPE2;
          this.PLACEMENT = PLACEMENT2;
        }
        static {
          __name(this, "SequenceDB");
        }
        addBox(data5) {
          this.state.records.boxes.push({
            name: data5.text,
            wrap: data5.wrap ?? this.autoWrap(),
            fill: data5.color,
            actorKeys: []
          });
          this.state.records.currentBox = this.state.records.boxes.slice(-1)[0];
        }
        addActor(id34, name, description, type3, metadata) {
          let assignedBox = this.state.records.currentBox;
          let doc;
          if (metadata !== void 0) {
            let yamlData;
            if (!metadata.includes("\n")) {
              yamlData = "{\n" + metadata + "\n}";
            } else {
              yamlData = metadata + "\n";
            }
            doc = load(yamlData, { schema: JSON_SCHEMA });
          }
          type3 = doc?.type ?? type3;
          if (doc?.alias && (!description || description.text === name)) {
            description = { text: doc.alias, wrap: description?.wrap, type: type3 };
          }
          const old = this.state.records.actors.get(id34);
          if (old) {
            if (this.state.records.currentBox && old.box && this.state.records.currentBox !== old.box) {
              throw new Error(
                `A same participant should only be defined in one Box: ${old.name} can't be in '${old.box.name}' and in '${this.state.records.currentBox.name}' at the same time.`
              );
            }
            assignedBox = old.box ? old.box : this.state.records.currentBox;
            old.box = assignedBox;
            if (old && name === old.name && description == null) {
              return;
            }
          }
          if (description?.text == null) {
            description = { text: name, type: type3 };
          }
          if (type3 == null || description.text == null) {
            description = { text: name, type: type3 };
          }
          this.state.records.actors.set(id34, {
            box: assignedBox,
            name,
            description: description.text,
            wrap: description.wrap ?? this.autoWrap(),
            prevActor: this.state.records.prevActor,
            links: {},
            properties: {},
            actorCnt: null,
            rectData: null,
            type: type3 ?? "participant"
          });
          if (this.state.records.prevActor) {
            const prevActorInRecords = this.state.records.actors.get(this.state.records.prevActor);
            if (prevActorInRecords) {
              prevActorInRecords.nextActor = id34;
            }
          }
          if (this.state.records.currentBox) {
            this.state.records.currentBox.actorKeys.push(id34);
          }
          this.state.records.prevActor = id34;
        }
        activationCount(part) {
          let i2;
          let count2 = 0;
          if (!part) {
            return 0;
          }
          for (i2 = 0; i2 < this.state.records.messages.length; i2++) {
            if (this.state.records.messages[i2].type === this.LINETYPE.ACTIVE_START && this.state.records.messages[i2].from === part) {
              count2++;
            }
            if (this.state.records.messages[i2].type === this.LINETYPE.ACTIVE_END && this.state.records.messages[i2].from === part) {
              count2--;
            }
          }
          return count2;
        }
        addMessage(idFrom, idTo, message, answer) {
          this.state.records.messages.push({
            id: this.state.records.messages.length.toString(),
            from: idFrom,
            to: idTo,
            message: message.text,
            wrap: message.wrap ?? this.autoWrap(),
            answer
          });
        }
        addSignal(idFrom, idTo, message, messageType, activate = false, centralConnection) {
          if (messageType === this.LINETYPE.ACTIVE_END) {
            const cnt4 = this.activationCount(idFrom ?? "");
            if (cnt4 < 1) {
              const error3 = new Error("Trying to inactivate an inactive participant (" + idFrom + ")");
              error3.hash = {
                text: "->>-",
                token: "->>-",
                line: "1",
                loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
                expected: ["'ACTIVE_PARTICIPANT'"]
              };
              throw error3;
            }
          }
          this.state.records.messages.push({
            id: this.state.records.messages.length.toString(),
            from: idFrom,
            to: idTo,
            message: message?.text ?? "",
            wrap: message?.wrap ?? this.autoWrap(),
            type: messageType,
            activate,
            centralConnection: centralConnection ?? 0
          });
          return true;
        }
        hasAtLeastOneBox() {
          return this.state.records.boxes.length > 0;
        }
        hasAtLeastOneBoxWithTitle() {
          return this.state.records.boxes.some((b3) => b3.name);
        }
        getMessages() {
          return this.state.records.messages;
        }
        getBoxes() {
          return this.state.records.boxes;
        }
        getActors() {
          return this.state.records.actors;
        }
        getCreatedActors() {
          return this.state.records.createdActors;
        }
        getDestroyedActors() {
          return this.state.records.destroyedActors;
        }
        getActor(id34) {
          return this.state.records.actors.get(id34);
        }
        getActorKeys() {
          return [...this.state.records.actors.keys()];
        }
        enableSequenceNumbers() {
          this.state.records.sequenceNumbersEnabled = true;
        }
        disableSequenceNumbers() {
          this.state.records.sequenceNumbersEnabled = false;
        }
        showSequenceNumbers() {
          return this.state.records.sequenceNumbersEnabled;
        }
        setWrap(wrapSetting) {
          this.state.records.wrapEnabled = wrapSetting;
        }
        extractWrap(text4) {
          if (text4 === void 0) {
            return {};
          }
          text4 = text4.trim();
          const wrap3 = /^:?wrap:/.exec(text4) !== null ? true : /^:?nowrap:/.exec(text4) !== null ? false : void 0;
          const cleanedText = (wrap3 === void 0 ? text4 : text4.replace(/^:?(?:no)?wrap:/, "")).trim();
          return { cleanedText, wrap: wrap3 };
        }
        autoWrap() {
          if (this.state.records.wrapEnabled !== void 0) {
            return this.state.records.wrapEnabled;
          }
          return getConfig2().sequence?.wrap ?? false;
        }
        clear() {
          this.state.reset();
          clear();
        }
        parseMessage(str2) {
          const trimmedStr = str2.trim();
          const { wrap: wrap3, cleanedText } = this.extractWrap(trimmedStr);
          const message = {
            text: cleanedText,
            wrap: wrap3
          };
          log.debug(`parseMessage: ${JSON.stringify(message)}`);
          return message;
        }
        // We expect the box statement to be color first then description
        // The color can be rgb,rgba,hsl,hsla, or css code names  #hex codes are not supported for now because of the way the char # is handled
        // We extract first segment as color, the rest of the line is considered as text
        parseBoxData(str2) {
          const match2 = /^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(str2);
          let color2 = match2?.[1] ? match2[1].trim() : "transparent";
          let title2 = match2?.[2] ? match2[2].trim() : void 0;
          if (window?.CSS) {
            if (!window.CSS.supports("color", color2)) {
              color2 = "transparent";
              title2 = str2.trim();
            }
          } else {
            const style3 = new Option().style;
            style3.color = color2;
            if (style3.color !== color2) {
              color2 = "transparent";
              title2 = str2.trim();
            }
          }
          const { wrap: wrap3, cleanedText } = this.extractWrap(title2);
          return {
            text: cleanedText ? sanitizeText(cleanedText, getConfig2()) : void 0,
            color: color2,
            wrap: wrap3
          };
        }
        addNote(actor, placement, message) {
          const note3 = {
            actor,
            placement,
            message: message.text,
            wrap: message.wrap ?? this.autoWrap()
          };
          const actors2 = [].concat(actor, actor);
          this.state.records.notes.push(note3);
          this.state.records.messages.push({
            id: this.state.records.messages.length.toString(),
            from: actors2[0],
            to: actors2[1],
            message: message.text,
            wrap: message.wrap ?? this.autoWrap(),
            type: this.LINETYPE.NOTE,
            placement
          });
        }
        addLinks(actorId, text4) {
          const actor = this.getActor(actorId);
          try {
            let sanitizedText = sanitizeText(text4.text, getConfig2());
            sanitizedText = sanitizedText.replace(/&equals;/g, "=");
            sanitizedText = sanitizedText.replace(/&amp;/g, "&");
            const links3 = JSON.parse(sanitizedText);
            this.insertLinks(actor, links3);
          } catch (e3) {
            log.error("error while parsing actor link text", e3);
          }
        }
        addALink(actorId, text4) {
          const actor = this.getActor(actorId);
          try {
            const links3 = {};
            let sanitizedText = sanitizeText(text4.text, getConfig2());
            const sep2 = sanitizedText.indexOf("@");
            sanitizedText = sanitizedText.replace(/&equals;/g, "=");
            sanitizedText = sanitizedText.replace(/&amp;/g, "&");
            const label = sanitizedText.slice(0, sep2 - 1).trim();
            const link2 = sanitizedText.slice(sep2 + 1).trim();
            links3[label] = link2;
            this.insertLinks(actor, links3);
          } catch (e3) {
            log.error("error while parsing actor link text", e3);
          }
        }
        insertLinks(actor, links3) {
          if (actor.links == null) {
            actor.links = links3;
          } else {
            for (const key in links3) {
              actor.links[key] = links3[key];
            }
          }
        }
        addProperties(actorId, text4) {
          const actor = this.getActor(actorId);
          try {
            const sanitizedText = sanitizeText(text4.text, getConfig2());
            const properties = JSON.parse(sanitizedText);
            this.insertProperties(actor, properties);
          } catch (e3) {
            log.error("error while parsing actor properties text", e3);
          }
        }
        insertProperties(actor, properties) {
          if (actor.properties == null) {
            actor.properties = properties;
          } else {
            for (const key in properties) {
              actor.properties[key] = properties[key];
            }
          }
        }
        boxEnd() {
          this.state.records.currentBox = void 0;
        }
        addDetails(actorId, text4) {
          const actor = this.getActor(actorId);
          const elem = document.getElementById(text4.text);
          try {
            const text5 = elem.innerHTML;
            const details = JSON.parse(text5);
            if (details.properties) {
              this.insertProperties(actor, details.properties);
            }
            if (details.links) {
              this.insertLinks(actor, details.links);
            }
          } catch (e3) {
            log.error("error while parsing actor details text", e3);
          }
        }
        getActorProperty(actor, key) {
          if (actor?.properties !== void 0) {
            return actor.properties[key];
          }
          return void 0;
        }
        // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-redundant-type-constituents
        apply(param) {
          if (Array.isArray(param)) {
            param.forEach((item) => {
              this.apply(item);
            });
          } else {
            switch (param.type) {
              case "sequenceIndex":
                this.state.records.messages.push({
                  id: this.state.records.messages.length.toString(),
                  from: void 0,
                  to: void 0,
                  message: {
                    start: param.sequenceIndex,
                    step: param.sequenceIndexStep,
                    visible: param.sequenceVisible
                  },
                  wrap: false,
                  type: param.signalType
                });
                break;
              case "addParticipant":
                this.addActor(param.actor, param.actor, param.description, param.draw, param.config);
                break;
              case "createParticipant":
                if (this.state.records.actors.has(param.actor)) {
                  throw new Error(
                    "It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior"
                  );
                }
                this.state.records.lastCreated = param.actor;
                this.addActor(param.actor, param.actor, param.description, param.draw, param.config);
                this.state.records.createdActors.set(param.actor, this.state.records.messages.length);
                break;
              case "destroyParticipant":
                this.state.records.lastDestroyed = param.actor;
                this.state.records.destroyedActors.set(param.actor, this.state.records.messages.length);
                break;
              case "activeStart":
                this.addSignal(param.actor, void 0, void 0, param.signalType);
                break;
              case "centralConnection":
                this.addSignal(param.actor, void 0, void 0, param.signalType);
                break;
              case "centralConnectionReverse":
                this.addSignal(param.actor, void 0, void 0, param.signalType);
                break;
              case "activeEnd":
                this.addSignal(param.actor, void 0, void 0, param.signalType);
                break;
              case "addNote":
                this.addNote(param.actor, param.placement, param.text);
                break;
              case "addLinks":
                this.addLinks(param.actor, param.text);
                break;
              case "addALink":
                this.addALink(param.actor, param.text);
                break;
              case "addProperties":
                this.addProperties(param.actor, param.text);
                break;
              case "addDetails":
                this.addDetails(param.actor, param.text);
                break;
              case "addMessage":
                if (this.state.records.lastCreated) {
                  if (param.to !== this.state.records.lastCreated) {
                    throw new Error(
                      "The created participant " + this.state.records.lastCreated.name + " does not have an associated creating message after its declaration. Please check the sequence diagram."
                    );
                  } else {
                    this.state.records.lastCreated = void 0;
                  }
                } else if (this.state.records.lastDestroyed) {
                  if (param.to !== this.state.records.lastDestroyed && param.from !== this.state.records.lastDestroyed) {
                    throw new Error(
                      "The destroyed participant " + this.state.records.lastDestroyed.name + " does not have an associated destroying message after its declaration. Please check the sequence diagram."
                    );
                  } else {
                    this.state.records.lastDestroyed = void 0;
                  }
                }
                this.addSignal(
                  param.from,
                  param.to,
                  param.msg,
                  param.signalType,
                  param.activate,
                  param.centralConnection
                );
                break;
              case "boxStart":
                this.addBox(param.boxData);
                break;
              case "boxEnd":
                this.boxEnd();
                break;
              case "loopStart":
                this.addSignal(void 0, void 0, param.loopText, param.signalType);
                break;
              case "loopEnd":
                this.addSignal(void 0, void 0, void 0, param.signalType);
                break;
              case "rectStart":
                this.addSignal(void 0, void 0, param.color, param.signalType);
                break;
              case "rectEnd":
                this.addSignal(void 0, void 0, void 0, param.signalType);
                break;
              case "optStart":
                this.addSignal(void 0, void 0, param.optText, param.signalType);
                break;
              case "optEnd":
                this.addSignal(void 0, void 0, void 0, param.signalType);
                break;
              case "altStart":
                this.addSignal(void 0, void 0, param.altText, param.signalType);
                break;
              case "else":
                this.addSignal(void 0, void 0, param.altText, param.signalType);
                break;
              case "altEnd":
                this.addSignal(void 0, void 0, void 0, param.signalType);
                break;
              case "setAccTitle":
                setAccTitle(param.text);
                break;
              case "parStart":
                this.addSignal(void 0, void 0, param.parText, param.signalType);
                break;
              case "and":
                this.addSignal(void 0, void 0, param.parText, param.signalType);
                break;
              case "parEnd":
                this.addSignal(void 0, void 0, void 0, param.signalType);
                break;
              case "criticalStart":
                this.addSignal(void 0, void 0, param.criticalText, param.signalType);
                break;
              case "option":
                this.addSignal(void 0, void 0, param.optionText, param.signalType);
                break;
              case "criticalEnd":
                this.addSignal(void 0, void 0, void 0, param.signalType);
                break;
              case "breakStart":
                this.addSignal(void 0, void 0, param.breakText, param.signalType);
                break;
              case "breakEnd":
                this.addSignal(void 0, void 0, void 0, param.signalType);
                break;
            }
          }
        }
        getConfig() {
          return getConfig2().sequence;
        }
      };
    }
  });

  // src/diagrams/sequence/styles.js
  var getStyles9, styles_default8;
  var init_styles8 = __esm({
    "src/diagrams/sequence/styles.js"() {
      "use strict";
      init_diagramAPI();
      getStyles9 = /* @__PURE__ */ __name((options2) => {
        const dropShadow = options2.dropShadow ?? "none";
        const { look } = getConfig2();
        return `.actor {
    stroke: ${options2.actorBorder};
    fill: ${options2.actorBkg};
    stroke-width: ${options2.strokeWidth ?? 1};
  }

  rect.actor.outer-path[data-look="neo"] {
      filter: ${dropShadow};
  }

  rect.note[data-look="neo"] {
      stroke:${options2.noteBorderColor};
      fill:${options2.noteBkgColor};
      filter: ${dropShadow};
  }

  text.actor > tspan {
    fill: ${options2.actorTextColor};
    stroke: none;
  }

  .actor-line {
    stroke: ${options2.actorLineColor};
  }

  .innerArc {
    stroke-width: 1.5;
    stroke-dasharray: none;
  }

  .messageLine0 {
    stroke-width: 1.5;
    stroke-dasharray: none;
    stroke: ${options2.signalColor};
  }

  .messageLine1 {
    stroke-width: 1.5;
    stroke-dasharray: 2, 2;
    stroke: ${options2.signalColor};
  }

  [id$="-arrowhead"] path {
    fill: ${options2.signalColor};
    stroke: ${options2.signalColor};
  }

  .sequenceNumber {
    fill: ${options2.sequenceNumberColor};
  }

  [id$="-sequencenumber"] {
    fill: ${options2.signalColor};
  }

  [id$="-crosshead"] path {
    fill: ${options2.signalColor};
    stroke: ${options2.signalColor};
  }

  .messageText {
    fill: ${options2.signalTextColor};
    stroke: none;
  }

  .labelBox {
    stroke: ${options2.labelBoxBorderColor};
    fill: ${options2.labelBoxBkgColor};
    filter: ${look === "neo" ? dropShadow : "none"};
  }

  .labelText, .labelText > tspan {
    fill: ${options2.labelTextColor};
    stroke: none;
  }

  .loopText, .loopText > tspan {
    fill: ${options2.loopTextColor};
    stroke: none;
  }

  .loopLine {
    stroke-width: 2px;
    stroke-dasharray: 2, 2;
    stroke: ${options2.labelBoxBorderColor};
    fill: ${options2.labelBoxBorderColor};
  }

  .note {
    //stroke: #decc93;
    stroke: ${options2.noteBorderColor};
    fill: ${options2.noteBkgColor};
  }

  .noteText, .noteText > tspan {
    fill: ${options2.noteTextColor};
    stroke: none;
    ${options2.noteFontWeight ? `font-weight: ${options2.noteFontWeight};` : ""}
  }

  .activation0 {
    fill: ${options2.activationBkgColor};
    stroke: ${options2.activationBorderColor};
  }

  .activation1 {
    fill: ${options2.activationBkgColor};
    stroke: ${options2.activationBorderColor};
  }

  .activation2 {
    fill: ${options2.activationBkgColor};
    stroke: ${options2.activationBorderColor};
  }

  .actorPopupMenu {
    position: absolute;
  }

  .actorPopupMenuPanel {
    position: absolute;
    fill: ${options2.actorBkg};
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));
}
  .actor-man circle, line {
    fill: ${options2.actorBkg};
    stroke-width: 2px;
  }

  g rect.rect {
    filter: ${dropShadow};
    stroke: ${options2.nodeBorder};
  }
`;
      }, "getStyles");
      styles_default8 = getStyles9;
    }
  });

  // src/diagrams/sequence/svgDraw.js
  var import_sanitize_url5, ACTOR_TYPE_WIDTH, TOP_ACTOR_CLASS, BOTTOM_ACTOR_CLASS, ACTOR_BOX_CLASS, ACTOR_MAN_FIGURE_CLASS, COLOR_THEMES5, drawRect4, drawPopup, popupMenuToggle, drawKatex, drawText3, drawLabel, actorCnt, fixLifeLineHeights, drawActorTypeParticipant, drawActorTypeCollections, drawActorTypeQueue, drawActorTypeControl, drawActorTypeEntity, drawActorTypeDatabase, drawActorTypeBoundary, drawActorTypeActor, drawActor, drawBox, anchorElement, drawActivation, drawLoop, drawBackgroundRect2, insertDatabaseIcon2, insertComputerIcon2, insertClockIcon2, insertArrowHead2, insertArrowFilledHead2, insertSequenceNumber, insertArrowCrossHead2, insertDropShadow, getTextObj3, getNoteRect2, _drawTextCandidateFunc2, _drawMenuItemTextCandidateFunc, insertSolidTopArrowHead, insertSolidBottomArrowHead, insertStickTopArrowHead, insertStickBottomArrowHead, svgDraw_default2;
  var init_svgDraw2 = __esm({
    "src/diagrams/sequence/svgDraw.js"() {
      "use strict";
      import_sanitize_url5 = __toESM(require_dist(), 1);
      init_config();
      init_utils2();
      init_common();
      init_svgDrawCommon();
      ACTOR_TYPE_WIDTH = 18 * 2;
      TOP_ACTOR_CLASS = "actor-top";
      BOTTOM_ACTOR_CLASS = "actor-bottom";
      ACTOR_BOX_CLASS = "actor-box";
      ACTOR_MAN_FIGURE_CLASS = "actor-man";
      COLOR_THEMES5 = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]);
      drawRect4 = /* @__PURE__ */ __name(function(elem, rectData) {
        const rectElement = drawRect(elem, rectData);
        if (getConfig().look === "neo") {
          rectElement.attr("data-look", "neo");
        }
        return rectElement;
      }, "drawRect");
      drawPopup = /* @__PURE__ */ __name(function(elem, actor, minMenuWidth, textAttrs, forceMenus) {
        if (actor.links === void 0 || actor.links === null || Object.keys(actor.links).length === 0) {
          return { height: 0, width: 0 };
        }
        const links3 = actor.links;
        const actorCnt2 = actor.actorCnt;
        const rectData = actor.rectData;
        var displayValue = "none";
        if (forceMenus) {
          displayValue = "block !important";
        }
        const g2 = elem.append("g");
        g2.attr("id", "actor" + actorCnt2 + "_popup");
        g2.attr("class", "actorPopupMenu");
        g2.attr("display", displayValue);
        var actorClass = "";
        if (rectData.class !== void 0) {
          actorClass = " " + rectData.class;
        }
        let menuWidth = rectData.width > minMenuWidth ? rectData.width : minMenuWidth;
        const rectElem = g2.append("rect");
        rectElem.attr("class", "actorPopupMenuPanel" + actorClass);
        rectElem.attr("x", rectData.x);
        rectElem.attr("y", rectData.height);
        rectElem.attr("fill", rectData.fill);
        rectElem.attr("stroke", rectData.stroke);
        rectElem.attr("width", menuWidth);
        rectElem.attr("height", rectData.height);
        rectElem.attr("rx", rectData.rx);
        rectElem.attr("ry", rectData.ry);
        if (links3 != null) {
          var linkY = 20;
          for (let key in links3) {
            var linkElem = g2.append("a");
            var sanitizedLink = (0, import_sanitize_url5.sanitizeUrl)(links3[key]);
            linkElem.attr("xlink:href", sanitizedLink);
            linkElem.attr("target", "_blank");
            _drawMenuItemTextCandidateFunc(textAttrs)(
              key,
              linkElem,
              rectData.x + 10,
              rectData.height + linkY,
              menuWidth,
              20,
              { class: "actor" },
              textAttrs
            );
            linkY += 30;
          }
        }
        rectElem.attr("height", linkY);
        return { height: rectData.height + linkY, width: menuWidth };
      }, "drawPopup");
      popupMenuToggle = /* @__PURE__ */ __name(function(popId) {
        return "var pu = document.getElementById('" + popId + "'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }";
      }, "popupMenuToggle");
      drawKatex = /* @__PURE__ */ __name(async function(elem, textData, msgModel = null) {
        let textElem = elem.append("foreignObject");
        const linesSanitized = await renderKatexSanitized(textData.text, getConfig());
        const divElem = textElem.append("xhtml:div").attr("style", "width: fit-content;").attr("xmlns", "http://www.w3.org/1999/xhtml").html(linesSanitized);
        const dim = divElem.node().getBoundingClientRect();
        textElem.attr("height", Math.round(dim.height)).attr("width", Math.round(dim.width));
        if (textData.class === "noteText") {
          const rectElem = elem.node().firstChild;
          rectElem.setAttribute("height", dim.height + 2 * textData.textMargin);
          const rectDim = rectElem.getBBox();
          textElem.attr("x", Math.round(rectDim.x + rectDim.width / 2 - dim.width / 2)).attr("y", Math.round(rectDim.y + rectDim.height / 2 - dim.height / 2));
        } else if (msgModel) {
          let { startx, stopx, starty } = msgModel;
          if (startx > stopx) {
            const temp = startx;
            startx = stopx;
            stopx = temp;
          }
          textElem.attr("x", Math.round(startx + Math.abs(startx - stopx) / 2 - dim.width / 2));
          if (textData.class === "loopText") {
            textElem.attr("y", Math.round(starty));
          } else {
            textElem.attr("y", Math.round(starty - dim.height));
          }
        }
        return [textElem];
      }, "drawKatex");
      drawText3 = /* @__PURE__ */ __name(function(elem, textData) {
        let prevTextHeight = 0;
        let textHeight = 0;
        const lines = textData.text.split(common_default.lineBreakRegex);
        const [_textFontSize, _textFontSizePx] = parseFontSize(textData.fontSize);
        let textElems = [];
        let dy = 0;
        let yfunc = /* @__PURE__ */ __name(() => textData.y, "yfunc");
        if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
          switch (textData.valign) {
            case "top":
            case "start":
              yfunc = /* @__PURE__ */ __name(() => Math.round(textData.y + textData.textMargin), "yfunc");
              break;
            case "middle":
            case "center":
              yfunc = /* @__PURE__ */ __name(() => Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2), "yfunc");
              break;
            case "bottom":
            case "end":
              yfunc = /* @__PURE__ */ __name(() => Math.round(
                textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin
              ), "yfunc");
              break;
          }
        }
        if (textData.anchor !== void 0 && textData.textMargin !== void 0 && textData.width !== void 0) {
          switch (textData.anchor) {
            case "left":
            case "start":
              textData.x = Math.round(textData.x + textData.textMargin);
              textData.anchor = "start";
              textData.dominantBaseline = "middle";
              textData.alignmentBaseline = "middle";
              break;
            case "middle":
            case "center":
              textData.x = Math.round(textData.x + textData.width / 2);
              textData.anchor = "middle";
              textData.dominantBaseline = "middle";
              textData.alignmentBaseline = "middle";
              break;
            case "right":
            case "end":
              textData.x = Math.round(textData.x + textData.width - textData.textMargin);
              textData.anchor = "end";
              textData.dominantBaseline = "middle";
              textData.alignmentBaseline = "middle";
              break;
          }
        }
        for (let [i2, line2] of lines.entries()) {
          if (textData.textMargin !== void 0 && textData.textMargin === 0 && _textFontSize !== void 0) {
            dy = i2 * _textFontSize;
          }
          const textElem = elem.append("text");
          textElem.attr("x", textData.x);
          textElem.attr("y", yfunc());
          if (textData.anchor !== void 0) {
            textElem.attr("text-anchor", textData.anchor).attr("dominant-baseline", textData.dominantBaseline).attr("alignment-baseline", textData.alignmentBaseline);
          }
          if (textData.fontFamily !== void 0) {
            textElem.style("font-family", textData.fontFamily);
          }
          if (_textFontSizePx !== void 0) {
            textElem.style("font-size", _textFontSizePx);
          }
          if (textData.fontWeight !== void 0) {
            textElem.style("font-weight", textData.fontWeight);
          }
          if (textData.fill !== void 0) {
            textElem.attr("fill", textData.fill);
          }
          if (textData.class !== void 0) {
            textElem.attr("class", textData.class);
          }
          if (textData.dy !== void 0) {
            textElem.attr("dy", textData.dy);
          } else if (dy !== 0) {
            textElem.attr("dy", dy);
          }
          const text4 = line2 || ZERO_WIDTH_SPACE;
          if (textData.tspan) {
            const span = textElem.append("tspan");
            span.attr("x", textData.x);
            if (textData.fill !== void 0) {
              span.attr("fill", textData.fill);
            }
            span.text(text4);
          } else {
            textElem.text(text4);
          }
          if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
            textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
            prevTextHeight = textHeight;
          }
          textElems.push(textElem);
        }
        return textElems;
      }, "drawText");
      drawLabel = /* @__PURE__ */ __name(function(elem, txtObject) {
        function genPoints(x5, y6, width3, height2, cut) {
          return x5 + "," + y6 + " " + (x5 + width3) + "," + y6 + " " + (x5 + width3) + "," + (y6 + height2 - cut) + " " + (x5 + width3 - cut * 1.2) + "," + (y6 + height2) + " " + x5 + "," + (y6 + height2);
        }
        __name(genPoints, "genPoints");
        const polygon2 = elem.append("polygon");
        polygon2.attr("points", genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
        polygon2.attr("class", "labelBox");
        txtObject.y = txtObject.y + txtObject.height / 2;
        drawText3(elem, txtObject);
        return polygon2;
      }, "drawLabel");
      actorCnt = -1;
      fixLifeLineHeights = /* @__PURE__ */ __name((diagram31, actors2, actorKeys, conf5) => {
        if (!diagram31.select) {
          return;
        }
        actorKeys.forEach((actorKey) => {
          const actor = actors2.get(actorKey);
          const actorDOM = diagram31.select("#actor" + actor.actorCnt);
          if (!conf5.mirrorActors && actor.stopy) {
            actorDOM.attr("y2", actor.stopy + actor.height / 2);
          } else if (conf5.mirrorActors) {
            actorDOM.attr("y2", actor.stopy);
          }
        });
      }, "fixLifeLineHeights");
      drawActorTypeParticipant = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) {
        const actorY = isFooter ? actor.stopy : actor.starty;
        const center4 = actor.x + actor.width / 2;
        const centerY = actorY + actor.height;
        const { look, theme, themeVariables } = conf5;
        const { bkgColorArray, borderColorArray } = themeVariables;
        const boxplusLineGroup = elem.append("g").lower();
        var g2 = boxplusLineGroup;
        if (!isFooter) {
          actorCnt++;
          if (Object.keys(actor.links || {}).length && !conf5.forceMenus) {
            g2.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
          }
          g2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
          g2 = boxplusLineGroup.append("g");
          actor.actorCnt = actorCnt;
          if (actor.links != null) {
            g2.attr("id", "root-" + actorCnt);
          }
          if (look === "neo") {
            g2.attr("data-look", "neo");
          }
        }
        const rect3 = getNoteRect();
        var cssclass = "actor";
        if (actor.properties?.class) {
          cssclass = actor.properties.class;
        } else {
          rect3.fill = "#eaeaea";
        }
        if (isFooter) {
          cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
        } else {
          cssclass += ` ${TOP_ACTOR_CLASS}`;
        }
        rect3.x = actor.x;
        rect3.y = actorY;
        rect3.width = actor.width;
        rect3.height = actor.height;
        rect3.class = cssclass;
        rect3.rx = 3;
        rect3.ry = 3;
        rect3.name = actor.name;
        if (look === "neo") {
          rect3.rx = 6;
          rect3.ry = 6;
        }
        const rectElem = drawRect4(g2, rect3);
        const actorCount = actorIndexMap.get(actor.name) ?? 0;
        if (COLOR_THEMES5.has(theme)) {
          rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
          rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
        }
        if (look === "neo") {
          rectElem.attr("filter", "url(#drop-shadow)");
        }
        actor.rectData = rect3;
        if (actor.properties?.icon) {
          const iconSrc = actor.properties.icon.trim();
          if (iconSrc.charAt(0) === "@") {
            drawEmbeddedImage(g2, rect3.x + rect3.width - 20, rect3.y + 10, iconSrc.substr(1));
          } else {
            drawImage(g2, rect3.x + rect3.width - 20, rect3.y + 10, iconSrc);
          }
        }
        if (!isFooter) {
          g2.attr("data-et", "participant");
          g2.attr("data-type", "participant");
          g2.attr("data-id", actor.name);
        }
        _drawTextCandidateFunc2(conf5, hasKatex(actor.description))(
          actor.description,
          g2,
          rect3.x,
          rect3.y,
          rect3.width,
          rect3.height,
          { class: `actor ${ACTOR_BOX_CLASS}` },
          conf5
        );
        let height2 = actor.height;
        if (rectElem.node) {
          const bounds4 = rectElem.node().getBBox();
          actor.height = bounds4.height;
          height2 = bounds4.height;
        }
        return height2;
      }, "drawActorTypeParticipant");
      drawActorTypeCollections = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) {
        const actorY = isFooter ? actor.stopy : actor.starty;
        const center4 = actor.x + actor.width / 2;
        const centerY = actorY + actor.height;
        const { look, theme, themeVariables } = conf5;
        const { bkgColorArray, borderColorArray } = themeVariables;
        const boxplusLineGroup = elem.append("g").lower();
        var g2 = boxplusLineGroup;
        if (!isFooter) {
          actorCnt++;
          if (Object.keys(actor.links || {}).length && !conf5.forceMenus) {
            g2.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
          }
          g2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
          g2 = boxplusLineGroup.append("g");
          actor.actorCnt = actorCnt;
          if (actor.links != null) {
            g2.attr("id", "root-" + actorCnt);
          }
          if (look === "neo") {
            g2.attr("data-look", "neo");
          }
        }
        const rect3 = getNoteRect();
        var cssclass = "actor";
        if (actor.properties?.class) {
          cssclass = actor.properties.class;
        } else {
          rect3.fill = "#eaeaea";
        }
        if (isFooter) {
          cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
        } else {
          cssclass += ` ${TOP_ACTOR_CLASS}`;
        }
        rect3.x = actor.x;
        rect3.y = actorY;
        rect3.width = actor.width;
        rect3.height = actor.height;
        rect3.class = cssclass;
        rect3.name = actor.name;
        const offset = 6;
        const shadowRect = {
          ...rect3,
          x: rect3.x + (isFooter ? -offset : -offset),
          y: rect3.y + (isFooter ? +offset : +offset),
          class: "actor"
        };
        const rectElem = drawRect4(g2, rect3);
        const stackedRect = drawRect4(g2, shadowRect);
        actor.rectData = rect3;
        if (look === "neo") {
          g2.attr("filter", "url(#drop-shadow)");
        }
        const actorCount = actorIndexMap.get(actor.name) ?? 0;
        if (COLOR_THEMES5.has(theme)) {
          rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
          rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
          stackedRect.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
          stackedRect.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
        }
        if (actor.properties?.icon) {
          const iconSrc = actor.properties.icon.trim();
          if (iconSrc.charAt(0) === "@") {
            drawEmbeddedImage(g2, rect3.x + rect3.width - 20, rect3.y + 10, iconSrc.substr(1));
          } else {
            drawImage(g2, rect3.x + rect3.width - 20, rect3.y + 10, iconSrc);
          }
        }
        _drawTextCandidateFunc2(conf5, hasKatex(actor.description))(
          actor.description,
          g2,
          rect3.x - offset,
          rect3.y + offset,
          rect3.width,
          rect3.height,
          { class: `actor ${ACTOR_BOX_CLASS}` },
          conf5
        );
        let height2 = actor.height;
        if (rectElem.node) {
          const bounds4 = rectElem.node().getBBox();
          actor.height = bounds4.height;
          height2 = bounds4.height;
        }
        if (!isFooter) {
          g2.attr("data-et", "participant");
          g2.attr("data-type", "collections");
          g2.attr("data-id", actor.name);
        }
        return height2;
      }, "drawActorTypeCollections");
      drawActorTypeQueue = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) {
        const actorY = isFooter ? actor.stopy : actor.starty;
        const center4 = actor.x + actor.width / 2;
        const centerY = actorY + actor.height;
        const { look, theme, themeVariables } = conf5;
        const { bkgColorArray, borderColorArray } = themeVariables;
        const boxplusLineGroup = elem.append("g").lower();
        let g2 = boxplusLineGroup;
        if (!isFooter) {
          actorCnt++;
          if (Object.keys(actor.links || {}).length && !conf5.forceMenus) {
            g2.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
          }
          g2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
          g2 = boxplusLineGroup.append("g");
          actor.actorCnt = actorCnt;
          if (actor.links != null) {
            g2.attr("id", "root-" + actorCnt);
          }
          if (look === "neo") {
            g2.attr("data-look", "neo");
          }
        }
        const rect3 = getNoteRect();
        let cssclass = "actor";
        if (actor.properties?.class) {
          cssclass = actor.properties.class;
        } else {
          rect3.fill = "#eaeaea";
        }
        if (isFooter) {
          cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
        } else {
          cssclass += ` ${TOP_ACTOR_CLASS}`;
        }
        g2.attr("class", cssclass);
        rect3.x = actor.x;
        rect3.y = actorY;
        rect3.width = actor.width;
        rect3.height = actor.height;
        rect3.name = actor.name;
        const ry = rect3.height / 2;
        const rx = ry / (2.5 + rect3.height / 50);
        const cylinderGroup = g2.append("g");
        const cylinderArc = g2.append("g");
        const cylinderPath = `M ${rect3.x},${rect3.y + ry}
    a ${rx},${ry} 0 0 0 0,${rect3.height}
    h ${rect3.width - 2 * rx}
    a ${rx},${ry} 0 0 0 0,-${rect3.height}
    Z
  `;
        cylinderGroup.append("path").attr("d", cylinderPath);
        cylinderArc.append("path").attr(
          "d",
          `M ${rect3.x},${rect3.y + ry}
      a ${rx},${ry} 0 0 0 0,${rect3.height}`
        );
        cylinderGroup.attr("transform", `translate(${rx}, ${-(rect3.height / 2)})`);
        cylinderArc.attr("transform", `translate(${rect3.width - rx}, ${-rect3.height / 2})`);
        actor.rectData = rect3;
        if (look === "neo") {
          cylinderGroup.attr("filter", "url(#drop-shadow)");
        }
        const actorCount = actorIndexMap.get(actor.name) ?? 0;
        if (COLOR_THEMES5.has(theme)) {
          cylinderGroup.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
          cylinderGroup.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
          cylinderArc.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
          cylinderArc.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
        }
        if (actor.properties?.icon) {
          const iconSrc = actor.properties.icon.trim();
          const iconX = rect3.x + rect3.width - 20;
          const iconY = rect3.y + 10;
          if (iconSrc.charAt(0) === "@") {
            drawEmbeddedImage(g2, iconX, iconY, iconSrc.substr(1));
          } else {
            drawImage(g2, iconX, iconY, iconSrc);
          }
        }
        _drawTextCandidateFunc2(conf5, hasKatex(actor.description))(
          actor.description,
          g2,
          rect3.x,
          rect3.y,
          rect3.width,
          rect3.height,
          { class: `actor ${ACTOR_BOX_CLASS}` },
          conf5
        );
        let height2 = actor.height;
        const lastPath = cylinderGroup.select("path:last-child");
        if (lastPath.node()) {
          const bounds4 = lastPath.node().getBBox();
          actor.height = bounds4.height;
          height2 = bounds4.height;
        }
        if (!isFooter) {
          g2.attr("data-et", "participant");
          g2.attr("data-type", "queue");
          g2.attr("data-id", actor.name);
        }
        return height2;
      }, "drawActorTypeQueue");
      drawActorTypeControl = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, diagramId3, actorIndexMap) {
        const actorY = isFooter ? actor.stopy : actor.starty;
        const center4 = actor.x + actor.width / 2;
        const centerY = actorY + 75;
        const { look, theme, themeVariables } = conf5;
        const { bkgColorArray, borderColorArray, actorBorder, actorBkg } = themeVariables;
        const line2 = elem.append("g").lower();
        if (!isFooter) {
          actorCnt++;
          line2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
          actor.actorCnt = actorCnt;
        }
        const actElem = elem.append("g");
        let cssClass = ACTOR_MAN_FIGURE_CLASS;
        if (isFooter) {
          cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
        } else {
          cssClass += ` ${TOP_ACTOR_CLASS}`;
        }
        actElem.attr("class", cssClass);
        actElem.attr("name", actor.name);
        const rect3 = getNoteRect();
        rect3.x = actor.x;
        rect3.y = actorY;
        rect3.fill = "#eaeaea";
        rect3.width = actor.width;
        rect3.height = actor.height;
        rect3.class = "actor";
        const cx = actor.x + actor.width / 2;
        const cy = actorY + 32;
        const r2 = 22;
        actElem.append("defs").append("marker").attr("id", diagramId3 + "-filled-head-control").attr("refX", 11).attr("refY", 5.8).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "172.5").attr("stroke-width", 1.2).append("path").attr("d", "M 14.4 5.6 L 7.2 10.4 L 8.8 5.6 L 7.2 0.8 Z");
        actElem.append("circle").attr("cx", cx).attr("cy", cy).attr("r", r2).attr("filter", `${look === "neo" ? "url(#drop-shadow)" : ""}`);
        actElem.append("line").attr("marker-end", "url(#" + diagramId3 + "-filled-head-control)").attr("transform", `translate(${cx}, ${cy - r2})`);
        const actorCount = actorIndexMap.get(actor.name) ?? 0;
        if (COLOR_THEMES5.has(theme)) {
          actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
          actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
        } else {
          actElem.style("stroke", actorBorder);
          actElem.style("fill", actorBkg);
        }
        const bounds4 = actElem.node().getBBox();
        actor.height = bounds4.height + 2 * (conf5?.sequence?.labelBoxHeight ?? 0);
        _drawTextCandidateFunc2(conf5, hasKatex(actor.description))(
          actor.description,
          actElem,
          rect3.x,
          rect3.y + r2 + (!isFooter ? 12 : 5),
          rect3.width,
          rect3.height,
          { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
          conf5
        );
        if (!isFooter) {
          actElem.attr("data-et", "participant");
          actElem.attr("data-type", "control");
          actElem.attr("data-id", actor.name);
        }
        return actor.height;
      }, "drawActorTypeControl");
      drawActorTypeEntity = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) {
        const actorY = isFooter ? actor.stopy : actor.starty;
        const center4 = actor.x + actor.width / 2;
        const centerY = actorY + 75;
        const { look, theme, themeVariables } = conf5;
        const { bkgColorArray, borderColorArray } = themeVariables;
        const line2 = elem.append("g").lower();
        const actElem = elem.append("g");
        let cssClass = "actor";
        if (isFooter) {
          cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
        } else {
          cssClass += ` ${TOP_ACTOR_CLASS}`;
        }
        actElem.attr("class", cssClass);
        actElem.attr("name", actor.name);
        const rect3 = getNoteRect();
        rect3.x = actor.x;
        rect3.y = actorY;
        rect3.fill = "#eaeaea";
        rect3.width = actor.width;
        rect3.height = actor.height;
        rect3.class = "actor";
        const cx = actor.x + actor.width / 2;
        const cy = actorY + (!isFooter ? 25 : 10);
        const r2 = 22;
        actElem.append("circle").attr("cx", cx).attr("cy", cy).attr("r", r2).attr("width", actor.width).attr("height", actor.height);
        actElem.append("line").attr("x1", cx - r2).attr("x2", cx + r2).attr("y1", cy + r2).attr("y2", cy + r2).attr("stroke-width", 2);
        if (look === "neo") {
          actElem.attr("filter", "url(#drop-shadow)");
        }
        const actorCount = actorIndexMap.get(actor.name) ?? 0;
        if (COLOR_THEMES5.has(theme)) {
          actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
          actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
        }
        const bounds4 = actElem.node().getBBox();
        actor.height = bounds4.height + (conf5?.sequence?.labelBoxHeight ?? 0);
        if (!isFooter) {
          actorCnt++;
          line2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
          actor.actorCnt = actorCnt;
        }
        _drawTextCandidateFunc2(conf5, hasKatex(actor.description))(
          actor.description,
          actElem,
          rect3.x,
          rect3.y + (!isFooter ? 30 : 15),
          rect3.width,
          rect3.height,
          { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
          conf5
        );
        if (!isFooter) {
          actElem.attr("transform", `translate(${0}, ${r2 / 2 - 5})`);
          actElem.attr("data-et", "participant");
          actElem.attr("data-type", "entity");
          actElem.attr("data-id", actor.name);
        } else {
          actElem.attr("transform", `translate(${0}, ${r2})`);
        }
        return actor.height;
      }, "drawActorTypeEntity");
      drawActorTypeDatabase = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) {
        const actorY = isFooter ? actor.stopy : actor.starty;
        const center4 = actor.x + actor.width / 2;
        const centerY = actorY + actor.height + 2 * conf5.boxTextMargin;
        const { theme, themeVariables, look } = conf5;
        const { bkgColorArray, borderColorArray, actorBorder } = themeVariables;
        const boxplusLineGroup = elem.append("g").lower();
        let g2 = boxplusLineGroup;
        if (!isFooter) {
          actorCnt++;
          if (Object.keys(actor.links || {}).length && !conf5.forceMenus) {
            g2.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
          }
          g2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
          g2 = boxplusLineGroup.append("g");
          actor.actorCnt = actorCnt;
          if (actor.links != null) {
            g2.attr("id", "root-" + actorCnt);
          }
          if (look === "neo") {
            g2.attr("data-look", "neo");
          }
        }
        const rect3 = getNoteRect();
        let cssclass = "actor";
        if (actor.properties?.class) {
          cssclass = actor.properties.class;
        } else {
          rect3.fill = "#eaeaea";
        }
        if (isFooter) {
          cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
        } else {
          cssclass += ` ${TOP_ACTOR_CLASS}`;
        }
        rect3.x = actor.x;
        rect3.y = actorY;
        rect3.width = actor.width;
        rect3.height = actor.height;
        rect3.class = cssclass;
        rect3.name = actor.name;
        rect3.x = actor.x;
        rect3.y = actorY;
        const w4 = rect3.width / 3;
        const h3 = rect3.width / 3;
        const rx = w4 / 2;
        const ry = rx / (2.5 + w4 / 50);
        const cylinderGroup = g2.append("g");
        cylinderGroup.attr("class", cssclass);
        const d3 = `
  M ${rect3.x},${rect3.y + ry}
  a ${rx},${ry} 0 0 0 ${w4},0
  a ${rx},${ry} 0 0 0 -${w4},0
  l 0,${h3 - 2 * ry}
  a ${rx},${ry} 0 0 0 ${w4},0
  l 0,-${h3 - 2 * ry}
`;
        cylinderGroup.append("path").attr("d", d3);
        if (look === "neo") {
          cylinderGroup.attr("filter", "url(#drop-shadow)");
        }
        const actorCount = actorIndexMap.get(actor.name) ?? 0;
        if (COLOR_THEMES5.has(theme)) {
          cylinderGroup.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
          cylinderGroup.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
        } else {
          cylinderGroup.style("stroke", actorBorder);
        }
        cylinderGroup.attr("transform", `translate(${w4}, ${ry})`);
        actor.rectData = rect3;
        _drawTextCandidateFunc2(conf5, hasKatex(actor.description))(
          actor.description,
          g2,
          rect3.x,
          rect3.y + 35,
          rect3.width,
          rect3.height,
          { class: `actor ${ACTOR_BOX_CLASS}` },
          conf5
        );
        const lastPath = cylinderGroup.select("path:last-child");
        if (lastPath.node()) {
          const bounds4 = lastPath.node().getBBox();
          actor.height = bounds4.height + (conf5.sequence.labelBoxHeight ?? 0);
        }
        if (!isFooter) {
          g2.attr("data-et", "participant");
          g2.attr("data-type", "database");
          g2.attr("data-id", actor.name);
        }
        return actor.height;
      }, "drawActorTypeDatabase");
      drawActorTypeBoundary = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) {
        const actorY = isFooter ? actor.stopy : actor.starty;
        const center4 = actor.x + actor.width / 2;
        const centerY = actorY + 80;
        const radius2 = 22;
        const line2 = elem.append("g").lower();
        const { look, theme, themeVariables } = conf5;
        const { bkgColorArray, borderColorArray, actorBorder } = themeVariables;
        if (!isFooter) {
          actorCnt++;
          line2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
          actor.actorCnt = actorCnt;
        }
        const actElem = elem.append("g");
        let cssClass = ACTOR_MAN_FIGURE_CLASS;
        if (isFooter) {
          cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
        } else {
          cssClass += ` ${TOP_ACTOR_CLASS}`;
        }
        actElem.attr("class", cssClass);
        actElem.attr("name", actor.name);
        const rect3 = getNoteRect();
        rect3.x = actor.x;
        rect3.y = actorY;
        rect3.fill = "#eaeaea";
        rect3.width = actor.width;
        rect3.height = actor.height;
        rect3.class = "actor";
        actElem.append("line").attr("id", "actor-man-torso" + actorCnt).attr("x1", actor.x + actor.width / 2 - radius2 * 2.5).attr("y1", actorY + 12).attr("x2", actor.x + actor.width / 2 - 15).attr("y2", actorY + 12);
        actElem.append("line").attr("id", "actor-man-arms" + actorCnt).attr("x1", actor.x + actor.width / 2 - radius2 * 2.5).attr("y1", actorY + 2).attr("x2", actor.x + actor.width / 2 - radius2 * 2.5).attr("y2", actorY + 22);
        actElem.append("circle").attr("cx", actor.x + actor.width / 2).attr("cy", actorY + 12).attr("r", radius2);
        if (look === "neo") {
          actElem.attr("filter", "url(#drop-shadow)");
        }
        const actorCount = actorIndexMap.get(actor.name) ?? 0;
        if (COLOR_THEMES5.has(theme)) {
          actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
          actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
        } else {
          actElem.style("stroke", actorBorder);
        }
        const bounds4 = actElem.node().getBBox();
        actor.height = bounds4.height + (conf5.sequence.labelBoxHeight ?? 0);
        _drawTextCandidateFunc2(conf5, hasKatex(actor.description))(
          actor.description,
          actElem,
          rect3.x,
          rect3.y + 15,
          rect3.width,
          rect3.height,
          { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
          conf5
        );
        actElem.attr("transform", `translate(0,${radius2 / 2 + 10})`);
        if (!isFooter) {
          actElem.attr("data-et", "participant");
          actElem.attr("data-type", "boundary");
          actElem.attr("data-id", actor.name);
        }
        return actor.height;
      }, "drawActorTypeBoundary");
      drawActorTypeActor = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) {
        const actorY = isFooter ? actor.stopy : actor.starty;
        const center4 = actor.x + actor.width / 2;
        const centerY = actorY + 80;
        const { look, theme, themeVariables } = conf5;
        const { bkgColorArray, borderColorArray, actorBorder } = themeVariables;
        const line2 = elem.append("g").lower();
        if (!isFooter) {
          actorCnt++;
          line2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
          actor.actorCnt = actorCnt;
        }
        const actElem = elem.append("g");
        let cssClass = ACTOR_MAN_FIGURE_CLASS;
        if (isFooter) {
          cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
        } else {
          cssClass += ` ${TOP_ACTOR_CLASS}`;
        }
        actElem.attr("class", cssClass);
        actElem.attr("name", actor.name);
        if (!isFooter) {
          actElem.attr("data-et", "participant").attr("data-type", "actor").attr("data-id", actor.name);
        }
        const scale3 = look === "neo" ? 0.5 : 1;
        const adjustedActorY = look === "neo" ? actorY + (1 - scale3) * 30 : actorY;
        actElem.append("line").attr("id", "actor-man-torso" + actorCnt).attr("x1", center4).attr("y1", adjustedActorY + 25 * scale3).attr("x2", center4).attr("y2", adjustedActorY + 45 * scale3);
        actElem.append("line").attr("id", "actor-man-arms" + actorCnt).attr("x1", center4 - ACTOR_TYPE_WIDTH / 2 * scale3).attr("y1", adjustedActorY + 33 * scale3).attr("x2", center4 + ACTOR_TYPE_WIDTH / 2 * scale3).attr("y2", adjustedActorY + 33 * scale3);
        actElem.append("line").attr("x1", center4 - ACTOR_TYPE_WIDTH / 2 * scale3).attr("y1", adjustedActorY + 60 * scale3).attr("x2", center4).attr("y2", adjustedActorY + 45 * scale3);
        actElem.append("line").attr("x1", center4).attr("y1", adjustedActorY + 45 * scale3).attr("x2", center4 + (ACTOR_TYPE_WIDTH / 2 - 2) * scale3).attr("y2", adjustedActorY + 60 * scale3);
        const circle6 = actElem.append("circle");
        circle6.attr("cx", actor.x + actor.width / 2);
        circle6.attr("cy", adjustedActorY + 10 * scale3);
        circle6.attr("r", 15 * scale3);
        circle6.attr("width", actor.width * scale3);
        circle6.attr("height", actor.height * scale3);
        const bounds4 = actElem.node().getBBox();
        actor.height = bounds4.height;
        const rect3 = getNoteRect();
        rect3.x = actor.x;
        rect3.y = adjustedActorY;
        rect3.fill = "#eaeaea";
        rect3.width = actor.width;
        rect3.height = actor.height / scale3;
        rect3.class = "actor";
        rect3.rx = 3;
        rect3.ry = 3;
        const actorCount = actorIndexMap.get(actor.name) ?? 0;
        if (COLOR_THEMES5.has(theme)) {
          actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
          actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
        } else {
          actElem.style("stroke", actorBorder);
        }
        _drawTextCandidateFunc2(conf5, hasKatex(actor.description))(
          actor.description,
          actElem,
          rect3.x,
          adjustedActorY + 35 * scale3 - (look === "neo" ? 10 : 0),
          rect3.width,
          rect3.height,
          { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
          conf5
        );
        return actor.height;
      }, "drawActorTypeActor");
      drawActor = /* @__PURE__ */ __name(async function(elem, actor, conf5, isFooter, diagramId3, diagObj, actorIndexMap) {
        const resolvedActorIndexMap = actorIndexMap ?? new Map(
          [...diagObj.db.getActors().values()].map((participant, index) => [participant.name, index])
        );
        switch (actor.type) {
          case "actor":
            return await drawActorTypeActor(elem, actor, conf5, isFooter, resolvedActorIndexMap);
          case "participant":
            return await drawActorTypeParticipant(elem, actor, conf5, isFooter, resolvedActorIndexMap);
          case "boundary":
            return await drawActorTypeBoundary(elem, actor, conf5, isFooter, resolvedActorIndexMap);
          case "control":
            return await drawActorTypeControl(
              elem,
              actor,
              conf5,
              isFooter,
              diagramId3,
              resolvedActorIndexMap
            );
          case "entity":
            return await drawActorTypeEntity(elem, actor, conf5, isFooter, resolvedActorIndexMap);
          case "database":
            return await drawActorTypeDatabase(elem, actor, conf5, isFooter, resolvedActorIndexMap);
          case "collections":
            return await drawActorTypeCollections(elem, actor, conf5, isFooter, resolvedActorIndexMap);
          case "queue":
            return await drawActorTypeQueue(elem, actor, conf5, isFooter, resolvedActorIndexMap);
        }
      }, "drawActor");
      drawBox = /* @__PURE__ */ __name(function(elem, box, conf5) {
        const boxplusTextGroup = elem.append("g");
        const g2 = boxplusTextGroup;
        drawBackgroundRect2(g2, box);
        if (box.name) {
          _drawTextCandidateFunc2(conf5)(
            box.name,
            g2,
            box.x,
            box.y + conf5.boxTextMargin + (box.textMaxHeight || 0) / 2,
            box.width,
            0,
            { class: "text" },
            conf5
          );
        }
        g2.lower();
      }, "drawBox");
      anchorElement = /* @__PURE__ */ __name(function(elem) {
        return elem.append("g");
      }, "anchorElement");
      drawActivation = /* @__PURE__ */ __name(function(_elem, bounds4, verticalPos, conf5, actorActivations2, diagObj, actorIndexMap) {
        const { theme, themeVariables } = conf5;
        const { bkgColorArray, borderColorArray, mainBkg } = themeVariables;
        const rect3 = getNoteRect();
        const g2 = bounds4.anchored;
        const actor = bounds4.actor;
        rect3.x = bounds4.startx;
        rect3.y = bounds4.starty;
        rect3.class = "activation" + actorActivations2 % 3;
        rect3.width = bounds4.stopx - bounds4.startx;
        rect3.height = verticalPos - bounds4.starty;
        const rectElem = drawRect4(g2, rect3);
        const resolvedActorIndexMap = actorIndexMap ?? new Map(
          [...diagObj.db.getActors().values()].map((participant, index) => [participant.name, index])
        );
        const actorCount = resolvedActorIndexMap.get(actor) ?? 0;
        if (COLOR_THEMES5.has(theme)) {
          rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
          rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length] ?? mainBkg);
        }
      }, "drawActivation");
      drawLoop = /* @__PURE__ */ __name(async function(elem, loopModel, labelText, conf5, msg) {
        const {
          boxMargin,
          boxTextMargin,
          labelBoxHeight,
          labelBoxWidth,
          messageFontFamily: fontFamily,
          messageFontSize: fontSize,
          messageFontWeight: fontWeight
        } = conf5;
        const g2 = elem.append("g").attr("data-et", "control-structure").attr("data-id", "i" + msg.id);
        const drawLoopLine = /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
          return g2.append("line").attr("x1", startx).attr("y1", starty).attr("x2", stopx).attr("y2", stopy).attr("class", "loopLine");
        }, "drawLoopLine");
        drawLoopLine(loopModel.startx, loopModel.starty, loopModel.stopx, loopModel.starty);
        drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy);
        drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
        drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
        if (loopModel.sections !== void 0) {
          loopModel.sections.forEach(function(item) {
            drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style(
              "stroke-dasharray",
              "3, 3"
            );
          });
        }
        let txt = getTextObj();
        txt.text = labelText;
        txt.x = loopModel.startx;
        txt.y = loopModel.starty;
        txt.fontFamily = fontFamily;
        txt.fontSize = fontSize;
        txt.fontWeight = fontWeight;
        txt.anchor = "middle";
        txt.valign = "middle";
        txt.tspan = false;
        txt.width = Math.max(labelBoxWidth ?? 0, 50);
        txt.height = labelBoxHeight + (conf5.look === "neo" ? 15 : 0) || 20;
        txt.textMargin = boxTextMargin;
        txt.class = "labelText";
        drawLabel(g2, txt);
        txt = getTextObj3();
        txt.text = loopModel.title;
        txt.x = loopModel.startx + labelBoxWidth / 2 + (loopModel.stopx - loopModel.startx) / 2;
        txt.y = loopModel.starty + boxMargin + boxTextMargin;
        txt.anchor = "middle";
        txt.valign = "middle";
        txt.textMargin = boxTextMargin;
        txt.class = "loopText";
        txt.fontFamily = fontFamily;
        txt.fontSize = fontSize;
        txt.fontWeight = fontWeight;
        txt.wrap = true;
        let textElem = hasKatex(txt.text) ? await drawKatex(g2, txt, loopModel) : drawText3(g2, txt);
        if (loopModel.sectionTitles !== void 0) {
          for (const [idx, item] of Object.entries(loopModel.sectionTitles)) {
            if (item.message) {
              txt.text = item.message;
              txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2;
              txt.y = loopModel.sections[idx].y + boxMargin + boxTextMargin;
              txt.class = "loopText";
              txt.anchor = "middle";
              txt.valign = "middle";
              txt.tspan = false;
              txt.fontFamily = fontFamily;
              txt.fontSize = fontSize;
              txt.fontWeight = fontWeight;
              txt.wrap = loopModel.wrap;
              if (hasKatex(txt.text)) {
                loopModel.starty = loopModel.sections[idx].y;
                await drawKatex(g2, txt, loopModel);
              } else {
                drawText3(g2, txt);
              }
              let sectionHeight = Math.round(
                textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
              );
              loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin);
            }
          }
        }
        loopModel.height = Math.round(loopModel.stopy - loopModel.starty);
        return g2;
      }, "drawLoop");
      drawBackgroundRect2 = /* @__PURE__ */ __name(function(elem, bounds4) {
        drawBackgroundRect(elem, bounds4);
      }, "drawBackgroundRect");
      insertDatabaseIcon2 = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("symbol").attr("id", id34 + "-database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
          "d",
          "M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z"
        );
      }, "insertDatabaseIcon");
      insertComputerIcon2 = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("symbol").attr("id", id34 + "-computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
          "d",
          "M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z"
        );
      }, "insertComputerIcon");
      insertClockIcon2 = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("symbol").attr("id", id34 + "-clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
          "d",
          "M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z"
        );
      }, "insertClockIcon");
      insertArrowHead2 = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("marker").attr("id", id34 + "-arrowhead").attr("refX", 7.9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M -1 0 L 10 5 L 0 10 z");
      }, "insertArrowHead");
      insertArrowFilledHead2 = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("marker").attr("id", id34 + "-filled-head").attr("refX", 15.5).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
      }, "insertArrowFilledHead");
      insertSequenceNumber = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("marker").attr("id", id34 + "-sequencenumber").attr("refX", 15).attr("refY", 15).attr("markerWidth", 60).attr("markerHeight", 40).attr("orient", "auto").append("circle").attr("cx", 15).attr("cy", 15).attr("r", 6);
      }, "insertSequenceNumber");
      insertArrowCrossHead2 = /* @__PURE__ */ __name(function(elem, id34) {
        const defs2 = elem.append("defs");
        const marker = defs2.append("marker").attr("id", id34 + "-crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 4).attr("refY", 4.5);
        marker.append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1pt").attr("d", "M 1,2 L 6,7 M 6,2 L 1,7");
      }, "insertArrowCrossHead");
      insertDropShadow = /* @__PURE__ */ __name(function(elem, conf5) {
        const { theme } = conf5;
        elem.append("defs").append("filter").attr("id", "drop-shadow").attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", `${theme === "redux" || theme === "redux-color" ? "#000000" : "#FFFFFF"}`);
      }, "insertDropShadow");
      getTextObj3 = /* @__PURE__ */ __name(function() {
        return {
          x: 0,
          y: 0,
          fill: void 0,
          anchor: void 0,
          style: "#666",
          width: void 0,
          height: void 0,
          textMargin: 0,
          rx: 0,
          ry: 0,
          tspan: true,
          valign: void 0
        };
      }, "getTextObj");
      getNoteRect2 = /* @__PURE__ */ __name(function() {
        return {
          x: 0,
          y: 0,
          fill: "#EDF2AE",
          stroke: "#666",
          width: 100,
          anchor: "start",
          height: 100,
          rx: 0,
          ry: 0
        };
      }, "getNoteRect");
      _drawTextCandidateFunc2 = /* @__PURE__ */ (function() {
        function byText(content, g2, x5, y6, width3, height2, textAttrs) {
          const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6 + height2 / 2 + 5).style("text-anchor", "middle").text(content);
          _setTextAttrs(text4, textAttrs);
        }
        __name(byText, "byText");
        function byTspan(content, g2, x5, y6, width3, height2, textAttrs, conf5) {
          const { actorFontSize, actorFontFamily, actorFontWeight } = conf5;
          const [_actorFontSize, _actorFontSizePx] = parseFontSize(actorFontSize);
          const lines = content.split(common_default.lineBreakRegex);
          for (let i2 = 0; i2 < lines.length; i2++) {
            const dy = i2 * _actorFontSize - _actorFontSize * (lines.length - 1) / 2;
            const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6).style("text-anchor", "middle").style("font-size", _actorFontSizePx).style("font-weight", actorFontWeight).style("font-family", actorFontFamily);
            text4.append("tspan").attr("x", x5 + width3 / 2).attr("dy", dy).text(lines[i2]);
            text4.attr("y", y6 + height2 / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
            _setTextAttrs(text4, textAttrs);
          }
        }
        __name(byTspan, "byTspan");
        function byFo(content, g2, x5, y6, width3, height2, textAttrs, conf5) {
          const s2 = g2.append("switch");
          const f2 = s2.append("foreignObject").attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2);
          const text4 = f2.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
          text4.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
          byTspan(content, s2, x5, y6, width3, height2, textAttrs, conf5);
          _setTextAttrs(text4, textAttrs);
        }
        __name(byFo, "byFo");
        async function byKatex(content, g2, x5, y6, width3, height2, textAttrs, conf5) {
          const dim = await calculateMathMLDimensions(content, getConfig());
          const s2 = g2.append("switch");
          const f2 = s2.append("foreignObject").attr("x", x5 + width3 / 2 - dim.width / 2).attr("y", y6 + height2 / 2 - dim.height / 2).attr("width", dim.width).attr("height", dim.height);
          const text4 = f2.append("xhtml:div").style("height", "100%").style("width", "100%");
          text4.append("div").style("text-align", "center").style("vertical-align", "middle").html(await renderKatexSanitized(content, getConfig()));
          byTspan(content, s2, x5, y6, width3, height2, textAttrs, conf5);
          _setTextAttrs(text4, textAttrs);
        }
        __name(byKatex, "byKatex");
        function _setTextAttrs(toText, fromTextAttrsDict) {
          for (const key in fromTextAttrsDict) {
            if (fromTextAttrsDict.hasOwnProperty(key)) {
              toText.attr(key, fromTextAttrsDict[key]);
            }
          }
        }
        __name(_setTextAttrs, "_setTextAttrs");
        return function(conf5, hasKatex2 = false) {
          if (hasKatex2) {
            return byKatex;
          }
          return conf5.textPlacement === "fo" ? byFo : conf5.textPlacement === "old" ? byText : byTspan;
        };
      })();
      _drawMenuItemTextCandidateFunc = /* @__PURE__ */ (function() {
        function byText(content, g2, x5, y6, width3, height2, textAttrs) {
          const text4 = g2.append("text").attr("x", x5).attr("y", y6).style("text-anchor", "start").text(content);
          _setTextAttrs(text4, textAttrs);
        }
        __name(byText, "byText");
        function byTspan(content, g2, x5, y6, width3, height2, textAttrs, conf5) {
          const { actorFontSize, actorFontFamily, actorFontWeight } = conf5;
          const lines = content.split(common_default.lineBreakRegex);
          for (let i2 = 0; i2 < lines.length; i2++) {
            const dy = i2 * actorFontSize - actorFontSize * (lines.length - 1) / 2;
            const text4 = g2.append("text").attr("x", x5).attr("y", y6).style("text-anchor", "start").style("font-size", actorFontSize).style("font-weight", actorFontWeight).style("font-family", actorFontFamily);
            text4.append("tspan").attr("x", x5).attr("dy", dy).text(lines[i2]);
            text4.attr("y", y6 + height2 / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
            _setTextAttrs(text4, textAttrs);
          }
        }
        __name(byTspan, "byTspan");
        function byFo(content, g2, x5, y6, width3, height2, textAttrs, conf5) {
          const s2 = g2.append("switch");
          const f2 = s2.append("foreignObject").attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2);
          const text4 = f2.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
          text4.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
          byTspan(content, s2, x5, y6, width3, height2, textAttrs, conf5);
          _setTextAttrs(text4, textAttrs);
        }
        __name(byFo, "byFo");
        function _setTextAttrs(toText, fromTextAttrsDict) {
          for (const key in fromTextAttrsDict) {
            if (fromTextAttrsDict.hasOwnProperty(key)) {
              toText.attr(key, fromTextAttrsDict[key]);
            }
          }
        }
        __name(_setTextAttrs, "_setTextAttrs");
        return function(conf5) {
          return conf5.textPlacement === "fo" ? byFo : conf5.textPlacement === "old" ? byText : byTspan;
        };
      })();
      insertSolidTopArrowHead = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("marker").attr("id", id34 + "-solidTopArrowHead").attr("refX", 7.9).attr("refY", 7.25).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 8 L 0 8 z");
      }, "insertSolidTopArrowHead");
      insertSolidBottomArrowHead = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("marker").attr("id", id34 + "-solidBottomArrowHead").attr("refX", 7.9).attr("refY", 0.75).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 0 L 0 8 z");
      }, "insertSolidBottomArrowHead");
      insertStickTopArrowHead = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("marker").attr("id", id34 + "-stickTopArrowHead").attr("refX", 7.5).attr("refY", 7).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 7 7").attr("stroke", "black").attr("stroke-width", 1.5).attr("fill", "none");
      }, "insertStickTopArrowHead");
      insertStickBottomArrowHead = /* @__PURE__ */ __name(function(elem, id34) {
        elem.append("defs").append("marker").attr("id", id34 + "-stickBottomArrowHead").attr("refX", 7.5).attr("refY", 0).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 7 L 7 0").attr("stroke", "black").attr("stroke-width", 1.5).attr("fill", "none");
      }, "insertStickBottomArrowHead");
      svgDraw_default2 = {
        drawRect: drawRect4,
        drawText: drawText3,
        drawLabel,
        drawActor,
        drawBox,
        drawPopup,
        anchorElement,
        drawActivation,
        drawLoop,
        drawBackgroundRect: drawBackgroundRect2,
        insertArrowHead: insertArrowHead2,
        insertArrowFilledHead: insertArrowFilledHead2,
        insertSequenceNumber,
        insertArrowCrossHead: insertArrowCrossHead2,
        insertDatabaseIcon: insertDatabaseIcon2,
        insertComputerIcon: insertComputerIcon2,
        insertClockIcon: insertClockIcon2,
        getTextObj: getTextObj3,
        getNoteRect: getNoteRect2,
        fixLifeLineHeights,
        sanitizeUrl: import_sanitize_url5.sanitizeUrl,
        insertDropShadow,
        insertSolidTopArrowHead,
        insertSolidBottomArrowHead,
        insertStickTopArrowHead,
        insertStickBottomArrowHead
      };
    }
  });

  // src/diagrams/sequence/sequenceRenderer.ts
  async function boundMessage(_diagram, msgModel) {
    bounds2.bumpVerticalPos(10);
    const { startx, stopx, message } = msgModel;
    const lines = common_default.splitBreaks(message).length;
    const isKatexMsg = hasKatex(message);
    const textDims = isKatexMsg ? await calculateMathMLDimensions(message, getConfig2()) : utils_default2.calculateTextDimensions(message, messageFont2(conf2));
    if (!isKatexMsg) {
      const lineHeight = textDims.height / lines;
      msgModel.height += lineHeight;
      bounds2.bumpVerticalPos(lineHeight);
    }
    let lineStartY;
    let totalOffset = textDims.height - 10;
    const textWidth = textDims.width;
    if (startx === stopx) {
      lineStartY = bounds2.getVerticalPos() + totalOffset;
      if (!conf2.rightAngles) {
        totalOffset += conf2.boxMargin;
        lineStartY = bounds2.getVerticalPos() + totalOffset;
      }
      totalOffset += 30;
      const dx = common_default.getMax(textWidth / 2, conf2.width / 2);
      bounds2.insert(
        startx - dx,
        bounds2.getVerticalPos() - 10 + totalOffset,
        stopx + dx,
        bounds2.getVerticalPos() + 30 + totalOffset
      );
    } else {
      totalOffset += conf2.boxMargin;
      lineStartY = bounds2.getVerticalPos() + totalOffset;
      bounds2.insert(startx, lineStartY - 10, stopx, lineStartY);
    }
    bounds2.bumpVerticalPos(totalOffset);
    msgModel.height += totalOffset;
    msgModel.stopy = msgModel.starty + msgModel.height;
    bounds2.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
    return lineStartY;
  }
  function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) {
    bounds2.bumpVerticalPos(preMargin);
    let heightAdjust = postMargin;
    if (msg.id && msg.message && loopWidths[msg.id]) {
      const loopWidth = loopWidths[msg.id].width;
      const textConf = messageFont2(conf2);
      msg.message = utils_default2.wrapLabel(`[${msg.message}]`, loopWidth - 2 * conf2.wrapPadding, textConf);
      msg.width = loopWidth;
      msg.wrap = true;
      const textDims = utils_default2.calculateTextDimensions(msg.message, textConf);
      const totalOffset = common_default.getMax(textDims.height, conf2.labelBoxHeight);
      heightAdjust = postMargin + totalOffset;
      log.debug(`${totalOffset} - ${msg.message}`);
    }
    addLoopFn(msg);
    bounds2.bumpVerticalPos(heightAdjust);
  }
  function adjustCreatedDestroyedData(msg, msgModel, lineStartY, index, actors2, createdActors, destroyedActors) {
    function receiverAdjustment(actor, adjustment) {
      if (actor.x < actors2.get(msg.from).x) {
        bounds2.insert(
          msgModel.stopx - adjustment,
          msgModel.starty,
          msgModel.startx,
          msgModel.stopy + actor.height / 2 + conf2.noteMargin
        );
        msgModel.stopx = msgModel.stopx + adjustment;
      } else {
        bounds2.insert(
          msgModel.startx,
          msgModel.starty,
          msgModel.stopx + adjustment,
          msgModel.stopy + actor.height / 2 + conf2.noteMargin
        );
        msgModel.stopx = msgModel.stopx - adjustment;
      }
    }
    __name(receiverAdjustment, "receiverAdjustment");
    function senderAdjustment(actor, adjustment) {
      if (actor.x < actors2.get(msg.to).x) {
        bounds2.insert(
          msgModel.startx - adjustment,
          msgModel.starty,
          msgModel.stopx,
          msgModel.stopy + actor.height / 2 + conf2.noteMargin
        );
        msgModel.startx = msgModel.startx + adjustment;
      } else {
        bounds2.insert(
          msgModel.stopx,
          msgModel.starty,
          msgModel.startx + adjustment,
          msgModel.stopy + actor.height / 2 + conf2.noteMargin
        );
        msgModel.startx = msgModel.startx - adjustment;
      }
    }
    __name(senderAdjustment, "senderAdjustment");
    const actorArray = [
      PARTICIPANT_TYPE.ACTOR,
      PARTICIPANT_TYPE.CONTROL,
      PARTICIPANT_TYPE.ENTITY,
      PARTICIPANT_TYPE.DATABASE
    ];
    if (createdActors.get(msg.to) == index) {
      const actor = actors2.get(msg.to);
      const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
      receiverAdjustment(actor, adjustment);
      actor.starty = lineStartY - actor.height / 2;
      bounds2.bumpVerticalPos(actor.height / 2);
    } else if (destroyedActors.get(msg.from) == index) {
      const actor = actors2.get(msg.from);
      if (conf2.mirrorActors) {
        const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 : actor.width / 2;
        senderAdjustment(actor, adjustment);
      }
      actor.stopy = lineStartY - actor.height / 2;
      bounds2.bumpVerticalPos(actor.height / 2);
    } else if (destroyedActors.get(msg.to) == index) {
      const actor = actors2.get(msg.to);
      if (conf2.mirrorActors) {
        const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
        receiverAdjustment(actor, adjustment);
      }
      actor.stopy = lineStartY - actor.height / 2;
      bounds2.bumpVerticalPos(actor.height / 2);
    }
  }
  async function getMaxMessageWidthPerActor(actors2, messages, diagObj) {
    const maxMessageWidthPerActor = {};
    for (const msg of messages) {
      if (actors2.get(msg.to) && actors2.get(msg.from)) {
        const actor = actors2.get(msg.to);
        if (msg.placement === diagObj.db.PLACEMENT.LEFTOF && !actor.prevActor) {
          continue;
        }
        if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF && !actor.nextActor) {
          continue;
        }
        const isNote = msg.placement !== void 0;
        const isMessage = !isNote;
        const textFont = isNote ? noteFont(conf2) : messageFont2(conf2);
        const wrappedMessage = msg.wrap ? utils_default2.wrapLabel(msg.message, conf2.width - 2 * conf2.wrapPadding, textFont) : msg.message;
        const messageDimensions = hasKatex(wrappedMessage) ? await calculateMathMLDimensions(msg.message, getConfig2()) : utils_default2.calculateTextDimensions(wrappedMessage, textFont);
        const messageWidth = messageDimensions.width + 2 * conf2.wrapPadding;
        if (isMessage && msg.from === actor.nextActor) {
          maxMessageWidthPerActor[msg.to] = common_default.getMax(
            maxMessageWidthPerActor[msg.to] || 0,
            messageWidth
          );
        } else if (isMessage && msg.from === actor.prevActor) {
          maxMessageWidthPerActor[msg.from] = common_default.getMax(
            maxMessageWidthPerActor[msg.from] || 0,
            messageWidth
          );
        } else if (isMessage && msg.from === msg.to) {
          maxMessageWidthPerActor[msg.from] = common_default.getMax(
            maxMessageWidthPerActor[msg.from] || 0,
            messageWidth / 2
          );
          maxMessageWidthPerActor[msg.to] = common_default.getMax(
            maxMessageWidthPerActor[msg.to] || 0,
            messageWidth / 2
          );
        } else if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
          maxMessageWidthPerActor[msg.from] = common_default.getMax(
            maxMessageWidthPerActor[msg.from] || 0,
            messageWidth
          );
        } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
          maxMessageWidthPerActor[actor.prevActor] = common_default.getMax(
            maxMessageWidthPerActor[actor.prevActor] || 0,
            messageWidth
          );
        } else if (msg.placement === diagObj.db.PLACEMENT.OVER) {
          if (actor.prevActor) {
            maxMessageWidthPerActor[actor.prevActor] = common_default.getMax(
              maxMessageWidthPerActor[actor.prevActor] || 0,
              messageWidth / 2
            );
          }
          if (actor.nextActor) {
            maxMessageWidthPerActor[msg.from] = common_default.getMax(
              maxMessageWidthPerActor[msg.from] || 0,
              messageWidth / 2
            );
          }
        }
      }
    }
    log.debug("maxMessageWidthPerActor:", maxMessageWidthPerActor);
    return maxMessageWidthPerActor;
  }
  async function calculateActorMargins(actors2, actorToMessageWidth, boxes) {
    let maxHeight = 0;
    for (const prop of actors2.keys()) {
      const actor = actors2.get(prop);
      if (actor.wrap) {
        actor.description = utils_default2.wrapLabel(
          actor.description,
          conf2.width - 2 * conf2.wrapPadding,
          actorFont(conf2)
        );
      }
      const actDims = hasKatex(actor.description) ? await calculateMathMLDimensions(actor.description, getConfig2()) : utils_default2.calculateTextDimensions(actor.description, actorFont(conf2));
      actor.width = actor.wrap ? conf2.width : common_default.getMax(conf2.width, actDims.width + 2 * conf2.wrapPadding);
      actor.height = actor.wrap ? common_default.getMax(actDims.height, conf2.height) : conf2.height;
      maxHeight = common_default.getMax(maxHeight, actor.height);
    }
    for (const actorKey in actorToMessageWidth) {
      const actor = actors2.get(actorKey);
      if (!actor) {
        continue;
      }
      const nextActor = actors2.get(actor.nextActor);
      if (!nextActor) {
        const messageWidth2 = actorToMessageWidth[actorKey];
        const actorWidth2 = messageWidth2 + conf2.actorMargin - actor.width / 2;
        actor.margin = common_default.getMax(actorWidth2, conf2.actorMargin);
        continue;
      }
      const messageWidth = actorToMessageWidth[actorKey];
      const actorWidth = messageWidth + conf2.actorMargin - actor.width / 2 - nextActor.width / 2;
      actor.margin = common_default.getMax(actorWidth, conf2.actorMargin);
    }
    let maxBoxHeight = 0;
    boxes.forEach((box) => {
      const textFont = messageFont2(conf2);
      let totalWidth = box.actorKeys.reduce((total, aKey) => {
        return total += actors2.get(aKey).width + (actors2.get(aKey).margin || 0);
      }, 0);
      const standardBoxPadding = conf2.boxMargin * 8;
      totalWidth += standardBoxPadding;
      totalWidth -= 2 * conf2.boxTextMargin;
      if (box.wrap) {
        box.name = utils_default2.wrapLabel(box.name, totalWidth - 2 * conf2.wrapPadding, textFont);
      }
      const boxMsgDimensions = utils_default2.calculateTextDimensions(box.name, textFont);
      maxBoxHeight = common_default.getMax(boxMsgDimensions.height, maxBoxHeight);
      const minWidth = common_default.getMax(totalWidth, boxMsgDimensions.width + 2 * conf2.wrapPadding);
      box.margin = conf2.boxTextMargin;
      if (totalWidth < minWidth) {
        const missing = (minWidth - totalWidth) / 2;
        box.margin += missing;
      }
    });
    boxes.forEach((box) => box.textMaxHeight = maxBoxHeight);
    return common_default.getMax(maxHeight, conf2.height);
  }
  var conf2, bounds2, drawNote, drawCentralConnection, messageFont2, noteFont, actorFont, drawMessage, addActorRenderingData, drawActors, drawActorsPopup, setConf3, actorActivations, activationBounds, draw11, getRequiredPopupWidth, buildNoteModel, CENTRAL_CONNECTION_BASE_OFFSET, CENTRAL_CONNECTION_BIDIRECTIONAL_OFFSET, hasCentralConnection, calculateCentralConnectionOffset, isReverseArrowType, isBidirectionalArrowType, buildMessageModel, calculateLoopBounds, sequenceRenderer_default;
  var init_sequenceRenderer = __esm({
    "src/diagrams/sequence/sequenceRenderer.ts"() {
      "use strict";
      init_src32();
      init_svgDraw2();
      init_logger();
      init_common();
      init_common();
      init_svgDrawCommon();
      init_diagramAPI();
      init_assignWithDepth();
      init_utils2();
      init_setupGraphViewbox();
      init_sequenceDb();
      conf2 = {};
      bounds2 = {
        data: {
          startx: void 0,
          stopx: void 0,
          starty: void 0,
          stopy: void 0
        },
        verticalPos: 0,
        sequenceItems: [],
        activations: [],
        models: {
          getHeight: /* @__PURE__ */ __name(function() {
            return Math.max.apply(
              null,
              this.actors.length === 0 ? [0] : this.actors.map((actor) => actor.height || 0)
            ) + (this.loops.length === 0 ? 0 : this.loops.map((it) => it.height || 0).reduce((acc, h3) => acc + h3)) + (this.messages.length === 0 ? 0 : this.messages.map((it) => it.height || 0).reduce((acc, h3) => acc + h3)) + (this.notes.length === 0 ? 0 : this.notes.map((it) => it.height || 0).reduce((acc, h3) => acc + h3));
          }, "getHeight"),
          clear: /* @__PURE__ */ __name(function() {
            this.actors = [];
            this.boxes = [];
            this.loops = [];
            this.messages = [];
            this.notes = [];
          }, "clear"),
          addBox: /* @__PURE__ */ __name(function(boxModel) {
            this.boxes.push(boxModel);
          }, "addBox"),
          addActor: /* @__PURE__ */ __name(function(actorModel) {
            this.actors.push(actorModel);
          }, "addActor"),
          addLoop: /* @__PURE__ */ __name(function(loopModel) {
            this.loops.push(loopModel);
          }, "addLoop"),
          addMessage: /* @__PURE__ */ __name(function(msgModel) {
            this.messages.push(msgModel);
          }, "addMessage"),
          addNote: /* @__PURE__ */ __name(function(noteModel) {
            this.notes.push(noteModel);
          }, "addNote"),
          lastActor: /* @__PURE__ */ __name(function() {
            return this.actors[this.actors.length - 1];
          }, "lastActor"),
          lastLoop: /* @__PURE__ */ __name(function() {
            return this.loops[this.loops.length - 1];
          }, "lastLoop"),
          lastMessage: /* @__PURE__ */ __name(function() {
            return this.messages[this.messages.length - 1];
          }, "lastMessage"),
          lastNote: /* @__PURE__ */ __name(function() {
            return this.notes[this.notes.length - 1];
          }, "lastNote"),
          actors: [],
          boxes: [],
          loops: [],
          messages: [],
          notes: []
        },
        init: /* @__PURE__ */ __name(function() {
          this.sequenceItems = [];
          this.activations = [];
          this.models.clear();
          this.data = {
            startx: void 0,
            stopx: void 0,
            starty: void 0,
            stopy: void 0
          };
          this.verticalPos = 0;
          setConf3(getConfig2());
        }, "init"),
        updateVal: /* @__PURE__ */ __name(function(obj, key, val, fun) {
          if (obj[key] === void 0) {
            obj[key] = val;
          } else {
            obj[key] = fun(val, obj[key]);
          }
        }, "updateVal"),
        updateBounds: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
          const _self = this;
          let cnt4 = 0;
          function updateFn(type3) {
            return /* @__PURE__ */ __name(function updateItemBounds(item) {
              cnt4++;
              const n2 = _self.sequenceItems.length - cnt4 + 1;
              _self.updateVal(item, "starty", starty - n2 * conf2.boxMargin, Math.min);
              _self.updateVal(item, "stopy", stopy + n2 * conf2.boxMargin, Math.max);
              _self.updateVal(bounds2.data, "startx", startx - n2 * conf2.boxMargin, Math.min);
              _self.updateVal(bounds2.data, "stopx", stopx + n2 * conf2.boxMargin, Math.max);
              if (!(type3 === "activation")) {
                _self.updateVal(item, "startx", startx - n2 * conf2.boxMargin, Math.min);
                _self.updateVal(item, "stopx", stopx + n2 * conf2.boxMargin, Math.max);
                _self.updateVal(bounds2.data, "starty", starty - n2 * conf2.boxMargin, Math.min);
                _self.updateVal(bounds2.data, "stopy", stopy + n2 * conf2.boxMargin, Math.max);
              }
            }, "updateItemBounds");
          }
          __name(updateFn, "updateFn");
          this.sequenceItems.forEach(updateFn());
          this.activations.forEach(updateFn("activation"));
        }, "updateBounds"),
        insert: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
          const _startx = common_default.getMin(startx, stopx);
          const _stopx = common_default.getMax(startx, stopx);
          const _starty = common_default.getMin(starty, stopy);
          const _stopy = common_default.getMax(starty, stopy);
          this.updateVal(bounds2.data, "startx", _startx, Math.min);
          this.updateVal(bounds2.data, "starty", _starty, Math.min);
          this.updateVal(bounds2.data, "stopx", _stopx, Math.max);
          this.updateVal(bounds2.data, "stopy", _stopy, Math.max);
          this.updateBounds(_startx, _starty, _stopx, _stopy);
        }, "insert"),
        newActivation: /* @__PURE__ */ __name(function(message, diagram31, actors2) {
          const actorRect = actors2.get(message.from);
          const stackedSize = actorActivations(message.from).length || 0;
          const x5 = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf2.activationWidth / 2;
          this.activations.push({
            startx: x5,
            starty: this.verticalPos + 2,
            stopx: x5 + conf2.activationWidth,
            stopy: void 0,
            actor: message.from,
            anchored: svgDraw_default2.anchorElement(diagram31)
          });
        }, "newActivation"),
        endActivation: /* @__PURE__ */ __name(function(message) {
          const lastActorActivationIdx = this.activations.map(function(activation) {
            return activation.actor;
          }).lastIndexOf(message.from);
          return this.activations.splice(lastActorActivationIdx, 1)[0];
        }, "endActivation"),
        createLoop: /* @__PURE__ */ __name(function(title2 = { message: void 0, wrap: false, width: void 0 }, fill) {
          return {
            startx: void 0,
            starty: this.verticalPos,
            stopx: void 0,
            stopy: void 0,
            title: title2.message,
            wrap: title2.wrap,
            width: title2.width,
            height: 0,
            fill
          };
        }, "createLoop"),
        newLoop: /* @__PURE__ */ __name(function(title2 = { message: void 0, wrap: false, width: void 0 }, fill) {
          this.sequenceItems.push(this.createLoop(title2, fill));
        }, "newLoop"),
        endLoop: /* @__PURE__ */ __name(function() {
          return this.sequenceItems.pop();
        }, "endLoop"),
        isLoopOverlap: /* @__PURE__ */ __name(function() {
          return this.sequenceItems.length ? this.sequenceItems[this.sequenceItems.length - 1].overlap : false;
        }, "isLoopOverlap"),
        addSectionToLoop: /* @__PURE__ */ __name(function(message) {
          const loop = this.sequenceItems.pop();
          loop.sections = loop.sections || [];
          loop.sectionTitles = loop.sectionTitles || [];
          loop.sections.push({ y: bounds2.getVerticalPos(), height: 0 });
          loop.sectionTitles.push(message);
          this.sequenceItems.push(loop);
        }, "addSectionToLoop"),
        saveVerticalPos: /* @__PURE__ */ __name(function() {
          if (this.isLoopOverlap()) {
            this.savedVerticalPos = this.verticalPos;
          }
        }, "saveVerticalPos"),
        resetVerticalPos: /* @__PURE__ */ __name(function() {
          if (this.isLoopOverlap()) {
            this.verticalPos = this.savedVerticalPos;
          }
        }, "resetVerticalPos"),
        bumpVerticalPos: /* @__PURE__ */ __name(function(bump) {
          this.verticalPos = this.verticalPos + bump;
          this.data.stopy = common_default.getMax(this.data.stopy, this.verticalPos);
        }, "bumpVerticalPos"),
        getVerticalPos: /* @__PURE__ */ __name(function() {
          return this.verticalPos;
        }, "getVerticalPos"),
        getBounds: /* @__PURE__ */ __name(function() {
          return { bounds: this.data, models: this.models };
        }, "getBounds")
      };
      drawNote = /* @__PURE__ */ __name(async function(elem, noteModel, id34) {
        bounds2.bumpVerticalPos(conf2.boxMargin);
        noteModel.height = conf2.boxMargin;
        noteModel.starty = bounds2.getVerticalPos();
        const rect3 = getNoteRect();
        rect3.x = noteModel.startx;
        rect3.y = noteModel.starty;
        rect3.width = noteModel.width || conf2.width;
        rect3.class = "note";
        const g2 = elem.append("g");
        g2.attr("data-et", "note");
        g2.attr("data-id", "i" + id34);
        const rectElem = svgDraw_default2.drawRect(g2, rect3);
        const textObj = getTextObj();
        textObj.x = noteModel.startx;
        textObj.y = noteModel.starty;
        textObj.width = rect3.width;
        textObj.dy = "1em";
        textObj.text = noteModel.message;
        textObj.class = "noteText";
        textObj.fontFamily = conf2.noteFontFamily;
        textObj.fontSize = conf2.noteFontSize;
        textObj.fontWeight = conf2.noteFontWeight;
        textObj.anchor = conf2.noteAlign;
        textObj.textMargin = conf2.noteMargin;
        textObj.valign = "center";
        const textElem = hasKatex(textObj.text) ? await drawKatex(g2, textObj) : drawText3(g2, textObj);
        const textHeight = Math.round(
          textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
        );
        rectElem.attr("height", textHeight + 2 * conf2.noteMargin);
        noteModel.height += textHeight + 2 * conf2.noteMargin;
        bounds2.bumpVerticalPos(textHeight + 2 * conf2.noteMargin);
        noteModel.stopy = noteModel.starty + textHeight + 2 * conf2.noteMargin;
        noteModel.stopx = noteModel.startx + rect3.width;
        bounds2.insert(noteModel.startx, noteModel.starty, noteModel.stopx, noteModel.stopy);
        bounds2.models.addNote(noteModel);
      }, "drawNote");
      drawCentralConnection = /* @__PURE__ */ __name(function(elem, msg, msgModel, diagObj, startx, stopx, lineStartY) {
        const actors2 = diagObj.db.getActors();
        const fromActor = actors2.get(msg.from);
        const toActor = actors2.get(msg.to);
        const isAutoNumberOn = msgModel.sequenceVisible;
        let fromCenter = fromActor.x + fromActor.width / 2;
        let toCenter = toActor.x + toActor.width / 2;
        const isLeftToRight = fromCenter <= toCenter;
        const isReverse = isReverseArrowType(msg, diagObj);
        const g2 = elem.append("g");
        const CENTRAL_CONNECTION_CIRCLE_OFFSET = 16.5;
        const getCircleOffset = /* @__PURE__ */ __name((isLeftToRight2, isReverse2) => {
          const baseOffset = isLeftToRight2 ? CENTRAL_CONNECTION_CIRCLE_OFFSET : -CENTRAL_CONNECTION_CIRCLE_OFFSET;
          return isReverse2 ? -baseOffset : baseOffset;
        }, "getCircleOffset");
        const drawCircle3 = /* @__PURE__ */ __name((cx) => {
          g2.append("circle").attr("cx", cx).attr("cy", lineStartY).attr("r", 5).attr("width", 10).attr("height", 10);
        }, "drawCircle");
        const { CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL } = diagObj.db.LINETYPE;
        if (isAutoNumberOn) {
          switch (msg.centralConnection) {
            case CENTRAL_CONNECTION:
              if (isReverse) {
                toCenter += getCircleOffset(isLeftToRight, true);
              }
              break;
            case CENTRAL_CONNECTION_REVERSE:
              if (!isReverse) {
                fromCenter += getCircleOffset(isLeftToRight, false);
              }
              break;
            case CENTRAL_CONNECTION_DUAL:
              if (isReverse) {
                toCenter += getCircleOffset(isLeftToRight, true);
              } else {
                fromCenter += getCircleOffset(isLeftToRight, false);
              }
              break;
          }
        }
        switch (msg.centralConnection) {
          case CENTRAL_CONNECTION:
            drawCircle3(toCenter);
            break;
          case CENTRAL_CONNECTION_REVERSE:
            drawCircle3(fromCenter);
            break;
          case CENTRAL_CONNECTION_DUAL:
            drawCircle3(fromCenter);
            drawCircle3(toCenter);
            break;
        }
      }, "drawCentralConnection");
      messageFont2 = /* @__PURE__ */ __name((cnf) => {
        return {
          fontFamily: cnf.messageFontFamily,
          fontSize: cnf.messageFontSize,
          fontWeight: cnf.messageFontWeight
        };
      }, "messageFont");
      noteFont = /* @__PURE__ */ __name((cnf) => {
        return {
          fontFamily: cnf.noteFontFamily,
          fontSize: cnf.noteFontSize,
          fontWeight: cnf.noteFontWeight
        };
      }, "noteFont");
      actorFont = /* @__PURE__ */ __name((cnf) => {
        return {
          fontFamily: cnf.actorFontFamily,
          fontSize: cnf.actorFontSize,
          fontWeight: cnf.actorFontWeight
        };
      }, "actorFont");
      __name(boundMessage, "boundMessage");
      drawMessage = /* @__PURE__ */ __name(async function(diagram31, msgModel, lineStartY, diagObj, msg, diagramId3) {
        const { startx, stopx, starty, message, type: type3, sequenceIndex, sequenceVisible } = msgModel;
        const textDims = utils_default2.calculateTextDimensions(message, messageFont2(conf2));
        const textObj = getTextObj();
        textObj.x = startx;
        textObj.y = starty + 10;
        textObj.width = stopx - startx;
        textObj.class = "messageText";
        textObj.dy = "1em";
        textObj.text = message;
        textObj.fontFamily = conf2.messageFontFamily;
        textObj.fontSize = conf2.messageFontSize;
        textObj.fontWeight = conf2.messageFontWeight;
        textObj.anchor = conf2.messageAlign;
        textObj.valign = "center";
        textObj.textMargin = conf2.wrapPadding;
        textObj.tspan = false;
        if (hasKatex(textObj.text)) {
          await drawKatex(diagram31, textObj, { startx, stopx, starty: lineStartY });
        } else {
          drawText3(diagram31, textObj);
        }
        const textWidth = textDims.width;
        let line2;
        if (startx === stopx) {
          const isAutoNumberOn = sequenceVisible || conf2.showSequenceNumbers;
          const isReverse = isReverseArrowType(msg, diagObj);
          const isBidirectional = isBidirectionalArrowType(msg, diagObj);
          const lineStartX = startx + (isAutoNumberOn && (isReverse || isBidirectional) ? 10 : 0);
          if (conf2.rightAngles) {
            line2 = diagram31.append("path").attr(
              "d",
              `M  ${lineStartX},${lineStartY} H ${startx + common_default.getMax(conf2.width / 2, textWidth / 2)} V ${lineStartY + 25} H ${startx}`
            );
          } else {
            line2 = diagram31.append("path").attr(
              "d",
              "M " + lineStartX + "," + lineStartY + " C " + (lineStartX + 60) + "," + (lineStartY - 10) + " " + (startx + 60) + "," + (lineStartY + 30) + " " + startx + "," + (lineStartY + 20)
            );
          }
          if (hasCentralConnection(msg, diagObj)) {
            drawCentralConnection(diagram31, msg, msgModel, diagObj, startx, stopx, lineStartY);
          }
        } else {
          line2 = diagram31.append("line");
          line2.attr("x1", startx);
          line2.attr("y1", lineStartY);
          line2.attr("x2", stopx);
          line2.attr("y2", lineStartY);
          if (hasCentralConnection(msg, diagObj)) {
            drawCentralConnection(diagram31, msg, msgModel, diagObj, startx, stopx, lineStartY);
          }
        }
        if (type3 === diagObj.db.LINETYPE.DOTTED || type3 === diagObj.db.LINETYPE.DOTTED_CROSS || type3 === diagObj.db.LINETYPE.DOTTED_POINT || type3 === diagObj.db.LINETYPE.DOTTED_OPEN || type3 === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED || type3 === diagObj.db.LINETYPE.SOLID_TOP_DOTTED || type3 === diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED || type3 === diagObj.db.LINETYPE.STICK_TOP_DOTTED || type3 === diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED || type3 === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED || type3 === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED || type3 === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED || type3 === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED) {
          line2.style("stroke-dasharray", "3, 3");
          line2.attr("class", "messageLine1");
        } else {
          line2.attr("class", "messageLine0");
        }
        line2.attr("data-et", "message");
        line2.attr("data-id", "i" + msgModel.id);
        line2.attr("data-from", msgModel.from);
        line2.attr("data-to", msgModel.to);
        let url = "";
        if (conf2.arrowMarkerAbsolute) {
          url = getUrl(true);
        }
        line2.attr("stroke-width", 2);
        line2.attr("stroke", "none");
        line2.style("fill", "none");
        if (type3 === diagObj.db.LINETYPE.SOLID_TOP || type3 === diagObj.db.LINETYPE.SOLID_TOP_DOTTED) {
          line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-solidTopArrowHead)");
        }
        if (type3 === diagObj.db.LINETYPE.SOLID_BOTTOM || type3 === diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED) {
          line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-solidBottomArrowHead)");
        }
        if (type3 === diagObj.db.LINETYPE.STICK_TOP || type3 === diagObj.db.LINETYPE.STICK_TOP_DOTTED) {
          line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-stickTopArrowHead)");
        }
        if (type3 === diagObj.db.LINETYPE.STICK_BOTTOM || type3 === diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED) {
          line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-stickBottomArrowHead)");
        }
        if (type3 === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE || type3 === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED) {
          line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-solidBottomArrowHead)");
        }
        if (type3 === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE || type3 === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED) {
          line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-solidTopArrowHead)");
        }
        if (type3 === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE || type3 === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED) {
          line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-stickBottomArrowHead)");
        }
        if (type3 === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE || type3 === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED) {
          line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-stickTopArrowHead)");
        }
        if (type3 === diagObj.db.LINETYPE.SOLID || type3 === diagObj.db.LINETYPE.DOTTED) {
          line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-arrowhead)");
        }
        if (type3 === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || type3 === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED) {
          line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-arrowhead)");
          line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-arrowhead)");
        }
        if (type3 === diagObj.db.LINETYPE.SOLID_POINT || type3 === diagObj.db.LINETYPE.DOTTED_POINT) {
          line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-filled-head)");
        }
        if (type3 === diagObj.db.LINETYPE.SOLID_CROSS || type3 === diagObj.db.LINETYPE.DOTTED_CROSS) {
          line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-crosshead)");
        }
        if (sequenceVisible || conf2.showSequenceNumbers) {
          const isBidirectional = type3 === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || type3 === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED;
          const isReverseArrowType2 = type3 === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE || type3 === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED || type3 === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE || type3 === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED || type3 === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE || type3 === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED || type3 === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE || type3 === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;
          const SEQUENCE_NUMBER_RADIUS = 6;
          const hasCentralConn = hasCentralConnection(msg, diagObj);
          let lineStartX = startx;
          let lineStopX = stopx;
          if (isBidirectional) {
            if (startx < stopx) {
              lineStartX = startx + SEQUENCE_NUMBER_RADIUS * 2;
            } else {
              lineStartX = startx - SEQUENCE_NUMBER_RADIUS + (hasCentralConn ? -5 : 0);
              lineStartX += msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_DUAL || msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE ? -7.5 : 0;
            }
            line2.attr("x1", lineStartX);
          } else if (isReverseArrowType2) {
            if (stopx > startx) {
              lineStopX = stopx - 2 * SEQUENCE_NUMBER_RADIUS;
            } else {
              lineStopX = stopx - SEQUENCE_NUMBER_RADIUS;
              lineStartX += msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_DUAL || msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE ? -7.5 : 0;
            }
            lineStopX += hasCentralConn ? 15 : 0;
            line2.attr("x2", lineStopX);
            line2.attr("x1", lineStartX);
          } else {
            line2.attr("x1", startx + SEQUENCE_NUMBER_RADIUS);
          }
          let autonumberX = 0;
          const isSelfMessage = startx === stopx;
          const isLeftToRight = startx <= stopx;
          if (isSelfMessage) {
            autonumberX = msgModel.fromBounds + 1;
          } else if (isReverseArrowType2) {
            autonumberX = isLeftToRight ? msgModel.toBounds - 1 : msgModel.fromBounds + 1;
          } else {
            autonumberX = isLeftToRight ? msgModel.fromBounds + 1 : msgModel.toBounds - 1;
          }
          diagram31.append("line").attr("x1", autonumberX).attr("y1", lineStartY).attr("x2", autonumberX).attr("y2", lineStartY).attr("stroke-width", 0).attr("marker-start", "url(" + url + "#" + diagramId3 + "-sequencenumber)");
          diagram31.append("text").attr("x", autonumberX).attr("y", lineStartY + 4).attr("font-family", "sans-serif").attr("font-size", "12px").attr("text-anchor", "middle").attr("class", "sequenceNumber").text(sequenceIndex);
        }
      }, "drawMessage");
      addActorRenderingData = /* @__PURE__ */ __name(function(diagram31, actors2, createdActors, actorKeys, verticalPos, messages, isFooter) {
        let prevWidth = 0;
        let prevMargin = 0;
        let prevBox = void 0;
        let maxHeight = 0;
        for (const actorKey of actorKeys) {
          const actor = actors2.get(actorKey);
          const box = actor.box;
          if (prevBox && prevBox != box) {
            if (!isFooter) {
              bounds2.models.addBox(prevBox);
            }
            prevMargin += conf2.boxMargin + prevBox.margin;
          }
          if (box && box != prevBox) {
            if (!isFooter) {
              box.x = prevWidth + prevMargin;
              box.y = verticalPos;
            }
            prevMargin += box.margin;
          }
          actor.width = common_default.getMax(actor.width || conf2.width, conf2.width);
          actor.height = common_default.getMax(actor.height || conf2.height, conf2.height);
          actor.margin = actor.margin || conf2.actorMargin;
          maxHeight = common_default.getMax(maxHeight, actor.height);
          if (createdActors.get(actor.name)) {
            prevMargin += actor.width / 2;
          }
          actor.x = prevWidth + prevMargin;
          actor.starty = bounds2.getVerticalPos();
          bounds2.insert(actor.x, verticalPos, actor.x + actor.width, actor.height);
          prevWidth += actor.width + prevMargin;
          if (actor.box) {
            actor.box.width = prevWidth + box.margin - actor.box.x;
          }
          prevMargin = actor.margin;
          prevBox = actor.box;
          bounds2.models.addActor(actor);
        }
        if (prevBox && !isFooter) {
          bounds2.models.addBox(prevBox);
        }
        bounds2.bumpVerticalPos(maxHeight);
      }, "addActorRenderingData");
      drawActors = /* @__PURE__ */ __name(async function(diagram31, actors2, actorKeys, isFooter, diagramId3, diagObj, actorIndexMap) {
        if (!isFooter) {
          for (const actorKey of actorKeys) {
            const actor = actors2.get(actorKey);
            await svgDraw_default2.drawActor(diagram31, actor, conf2, false, diagramId3, diagObj, actorIndexMap);
          }
        } else {
          let maxHeight = 0;
          bounds2.bumpVerticalPos(conf2.boxMargin * 2);
          for (const actorKey of actorKeys) {
            const actor = actors2.get(actorKey);
            if (!actor.stopy) {
              actor.stopy = bounds2.getVerticalPos();
            }
            const height2 = await svgDraw_default2.drawActor(
              diagram31,
              actor,
              conf2,
              true,
              diagramId3,
              diagObj,
              actorIndexMap
            );
            maxHeight = common_default.getMax(maxHeight, height2);
          }
          bounds2.bumpVerticalPos(maxHeight + conf2.boxMargin);
        }
      }, "drawActors");
      drawActorsPopup = /* @__PURE__ */ __name(function(diagram31, actors2, actorKeys, doc) {
        let maxHeight = 0;
        let maxWidth2 = 0;
        for (const actorKey of actorKeys) {
          const actor = actors2.get(actorKey);
          const minMenuWidth = getRequiredPopupWidth(actor);
          const menuDimensions = svgDraw_default2.drawPopup(
            diagram31,
            actor,
            minMenuWidth,
            conf2,
            conf2.forceMenus,
            doc
          );
          if (menuDimensions.height > maxHeight) {
            maxHeight = menuDimensions.height;
          }
          if (menuDimensions.width + actor.x > maxWidth2) {
            maxWidth2 = menuDimensions.width + actor.x;
          }
        }
        return { maxHeight, maxWidth: maxWidth2 };
      }, "drawActorsPopup");
      setConf3 = /* @__PURE__ */ __name(function(cnf) {
        assignWithDepth_default(conf2, cnf);
        if (cnf.fontFamily) {
          conf2.actorFontFamily = conf2.noteFontFamily = conf2.messageFontFamily = cnf.fontFamily;
        }
        if (cnf.fontSize) {
          conf2.actorFontSize = conf2.noteFontSize = conf2.messageFontSize = cnf.fontSize;
        }
        if (cnf.fontWeight) {
          conf2.actorFontWeight = conf2.noteFontWeight = conf2.messageFontWeight = cnf.fontWeight;
        }
      }, "setConf");
      actorActivations = /* @__PURE__ */ __name(function(actor) {
        return bounds2.activations.filter(function(activation) {
          return activation.actor === actor;
        });
      }, "actorActivations");
      activationBounds = /* @__PURE__ */ __name(function(actor, actors2) {
        const actorObj = actors2.get(actor);
        const activations = actorActivations(actor);
        const left3 = activations.reduce(
          function(acc, activation) {
            return common_default.getMin(acc, activation.startx);
          },
          actorObj.x + actorObj.width / 2 - 1
        );
        const right3 = activations.reduce(
          function(acc, activation) {
            return common_default.getMax(acc, activation.stopx);
          },
          actorObj.x + actorObj.width / 2 + 1
        );
        return [left3, right3];
      }, "activationBounds");
      __name(adjustLoopHeightForWrap, "adjustLoopHeightForWrap");
      __name(adjustCreatedDestroyedData, "adjustCreatedDestroyedData");
      draw11 = /* @__PURE__ */ __name(async function(_text, id34, _version, diagObj) {
        const { securityLevel, sequence, look } = getConfig2();
        conf2 = sequence;
        let sandboxElement;
        if (securityLevel === "sandbox") {
          sandboxElement = select_default2("#i" + id34);
        }
        const root3 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body");
        const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
        bounds2.init();
        log.debug(diagObj.db);
        const diagram31 = securityLevel === "sandbox" ? root3.select(`[id="${id34}"]`) : select_default2(`[id="${id34}"]`);
        const actors2 = diagObj.db.getActors();
        const createdActors = diagObj.db.getCreatedActors();
        const destroyedActors = diagObj.db.getDestroyedActors();
        const boxes = diagObj.db.getBoxes();
        let actorKeys = diagObj.db.getActorKeys();
        const messages = diagObj.db.getMessages();
        const title2 = diagObj.db.getDiagramTitle();
        const hasBoxes = diagObj.db.hasAtLeastOneBox();
        const hasBoxTitles = diagObj.db.hasAtLeastOneBoxWithTitle();
        const maxMessageWidthPerActor = await getMaxMessageWidthPerActor(actors2, messages, diagObj);
        conf2.height = await calculateActorMargins(actors2, maxMessageWidthPerActor, boxes);
        svgDraw_default2.insertComputerIcon(diagram31, id34);
        svgDraw_default2.insertDatabaseIcon(diagram31, id34);
        svgDraw_default2.insertClockIcon(diagram31, id34);
        if (hasBoxes) {
          bounds2.bumpVerticalPos(conf2.boxMargin);
          if (hasBoxTitles) {
            bounds2.bumpVerticalPos(boxes[0].textMaxHeight);
          }
        }
        if (conf2.hideUnusedParticipants === true) {
          const newActors = /* @__PURE__ */ new Set();
          messages.forEach((message) => {
            newActors.add(message.from);
            newActors.add(message.to);
          });
          actorKeys = actorKeys.filter((actorKey) => newActors.has(actorKey));
        }
        const actorIndexMap = new Map(
          actorKeys.map((actorKey, index2) => [actors2.get(actorKey)?.name ?? actorKey, index2])
        );
        addActorRenderingData(diagram31, actors2, createdActors, actorKeys, 0, messages, false);
        const loopWidths = await calculateLoopBounds(messages, actors2, maxMessageWidthPerActor, diagObj);
        svgDraw_default2.insertArrowHead(diagram31, id34);
        svgDraw_default2.insertArrowCrossHead(diagram31, id34);
        svgDraw_default2.insertArrowFilledHead(diagram31, id34);
        svgDraw_default2.insertSequenceNumber(diagram31, id34);
        svgDraw_default2.insertSolidTopArrowHead(diagram31, id34);
        svgDraw_default2.insertSolidBottomArrowHead(diagram31, id34);
        svgDraw_default2.insertStickTopArrowHead(diagram31, id34);
        svgDraw_default2.insertStickBottomArrowHead(diagram31, id34);
        if (look === "neo") {
          svgDraw_default2.insertDropShadow(diagram31, conf2);
        }
        function activeEnd(msg, verticalPos) {
          const activationData = bounds2.endActivation(msg);
          if (activationData.starty + 18 > verticalPos) {
            activationData.starty = verticalPos - 6;
            verticalPos += 12;
          }
          svgDraw_default2.drawActivation(
            diagram31,
            activationData,
            verticalPos,
            conf2,
            actorActivations(msg.from).length,
            diagObj,
            actorIndexMap
          );
          bounds2.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos);
        }
        __name(activeEnd, "activeEnd");
        let sequenceIndex = 1;
        let sequenceIndexStep = 1;
        const messagesToDraw = [];
        const backgrounds = [];
        let index = 0;
        for (const msg of messages) {
          let loopModel, noteModel, msgModel;
          switch (msg.type) {
            case diagObj.db.LINETYPE.NOTE:
              bounds2.resetVerticalPos();
              noteModel = msg.noteModel;
              await drawNote(diagram31, noteModel, msg.id);
              break;
            case diagObj.db.LINETYPE.ACTIVE_START:
              bounds2.newActivation(msg, diagram31, actors2);
              break;
            case diagObj.db.LINETYPE.CENTRAL_CONNECTION:
              bounds2.newActivation(msg, diagram31, actors2);
              break;
            case diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE:
              bounds2.newActivation(msg, diagram31, actors2);
              break;
            case diagObj.db.LINETYPE.ACTIVE_END:
              activeEnd(msg, bounds2.getVerticalPos());
              break;
            case diagObj.db.LINETYPE.LOOP_START:
              adjustLoopHeightForWrap(
                loopWidths,
                msg,
                conf2.boxMargin,
                conf2.boxMargin + conf2.boxTextMargin,
                (message) => bounds2.newLoop(message)
              );
              break;
            case diagObj.db.LINETYPE.LOOP_END:
              loopModel = bounds2.endLoop();
              await svgDraw_default2.drawLoop(diagram31, loopModel, "loop", conf2, msg);
              bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos());
              bounds2.models.addLoop(loopModel);
              break;
            case diagObj.db.LINETYPE.RECT_START:
              adjustLoopHeightForWrap(
                loopWidths,
                msg,
                conf2.boxMargin,
                conf2.boxMargin,
                (message) => bounds2.newLoop(void 0, message.message)
              );
              break;
            case diagObj.db.LINETYPE.RECT_END:
              loopModel = bounds2.endLoop();
              backgrounds.push(loopModel);
              bounds2.models.addLoop(loopModel);
              bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos());
              break;
            case diagObj.db.LINETYPE.OPT_START:
              adjustLoopHeightForWrap(
                loopWidths,
                msg,
                conf2.boxMargin,
                conf2.boxMargin + conf2.boxTextMargin,
                (message) => bounds2.newLoop(message)
              );
              break;
            case diagObj.db.LINETYPE.OPT_END:
              loopModel = bounds2.endLoop();
              await svgDraw_default2.drawLoop(diagram31, loopModel, "opt", conf2, msg);
              bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos());
              bounds2.models.addLoop(loopModel);
              break;
            case diagObj.db.LINETYPE.ALT_START:
              adjustLoopHeightForWrap(
                loopWidths,
                msg,
                conf2.boxMargin,
                conf2.boxMargin + conf2.boxTextMargin,
                (message) => bounds2.newLoop(message)
              );
              break;
            case diagObj.db.LINETYPE.ALT_ELSE:
              adjustLoopHeightForWrap(
                loopWidths,
                msg,
                conf2.boxMargin + conf2.boxTextMargin,
                conf2.boxMargin,
                (message) => bounds2.addSectionToLoop(message)
              );
              break;
            case diagObj.db.LINETYPE.ALT_END:
              loopModel = bounds2.endLoop();
              await svgDraw_default2.drawLoop(diagram31, loopModel, "alt", conf2, msg);
              bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos());
              bounds2.models.addLoop(loopModel);
              break;
            case diagObj.db.LINETYPE.PAR_START:
            case diagObj.db.LINETYPE.PAR_OVER_START:
              adjustLoopHeightForWrap(
                loopWidths,
                msg,
                conf2.boxMargin,
                conf2.boxMargin + conf2.boxTextMargin,
                (message) => bounds2.newLoop(message)
              );
              bounds2.saveVerticalPos();
              break;
            case diagObj.db.LINETYPE.PAR_AND:
              adjustLoopHeightForWrap(
                loopWidths,
                msg,
                conf2.boxMargin + conf2.boxTextMargin,
                conf2.boxMargin,
                (message) => bounds2.addSectionToLoop(message)
              );
              break;
            case diagObj.db.LINETYPE.PAR_END:
              loopModel = bounds2.endLoop();
              await svgDraw_default2.drawLoop(diagram31, loopModel, "par", conf2, msg);
              bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos());
              bounds2.models.addLoop(loopModel);
              break;
            case diagObj.db.LINETYPE.AUTONUMBER:
              sequenceIndex = msg.message.start || sequenceIndex;
              sequenceIndexStep = msg.message.step || sequenceIndexStep;
              if (msg.message.visible) {
                diagObj.db.enableSequenceNumbers();
              } else {
                diagObj.db.disableSequenceNumbers();
              }
              break;
            case diagObj.db.LINETYPE.CRITICAL_START:
              adjustLoopHeightForWrap(
                loopWidths,
                msg,
                conf2.boxMargin,
                conf2.boxMargin + conf2.boxTextMargin,
                (message) => bounds2.newLoop(message)
              );
              break;
            case diagObj.db.LINETYPE.CRITICAL_OPTION:
              adjustLoopHeightForWrap(
                loopWidths,
                msg,
                conf2.boxMargin + conf2.boxTextMargin,
                conf2.boxMargin,
                (message) => bounds2.addSectionToLoop(message)
              );
              break;
            case diagObj.db.LINETYPE.CRITICAL_END:
              loopModel = bounds2.endLoop();
              await svgDraw_default2.drawLoop(diagram31, loopModel, "critical", conf2, msg);
              bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos());
              bounds2.models.addLoop(loopModel);
              break;
            case diagObj.db.LINETYPE.BREAK_START:
              adjustLoopHeightForWrap(
                loopWidths,
                msg,
                conf2.boxMargin,
                conf2.boxMargin + conf2.boxTextMargin,
                (message) => bounds2.newLoop(message)
              );
              break;
            case diagObj.db.LINETYPE.BREAK_END:
              loopModel = bounds2.endLoop();
              await svgDraw_default2.drawLoop(diagram31, loopModel, "break", conf2, msg);
              bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos());
              bounds2.models.addLoop(loopModel);
              break;
            default:
              try {
                msgModel = msg.msgModel;
                msgModel.starty = bounds2.getVerticalPos();
                msgModel.sequenceIndex = sequenceIndex;
                msgModel.sequenceVisible = diagObj.db.showSequenceNumbers();
                msgModel.id = msg.id;
                msgModel.from = msg.from;
                msgModel.to = msg.to;
                const lineStartY = await boundMessage(diagram31, msgModel);
                adjustCreatedDestroyedData(
                  msg,
                  msgModel,
                  lineStartY,
                  index,
                  actors2,
                  createdActors,
                  destroyedActors
                );
                messagesToDraw.push({ messageModel: msgModel, lineStartY, msg });
                bounds2.models.addMessage(msgModel);
              } catch (e3) {
                log.error("error while drawing message", e3);
              }
          }
          if ([
            diagObj.db.LINETYPE.SOLID_OPEN,
            diagObj.db.LINETYPE.DOTTED_OPEN,
            diagObj.db.LINETYPE.SOLID,
            diagObj.db.LINETYPE.SOLID_TOP,
            diagObj.db.LINETYPE.SOLID_BOTTOM,
            diagObj.db.LINETYPE.STICK_TOP,
            diagObj.db.LINETYPE.STICK_BOTTOM,
            diagObj.db.LINETYPE.SOLID_TOP_DOTTED,
            diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED,
            diagObj.db.LINETYPE.STICK_TOP_DOTTED,
            diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED,
            diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
            diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE,
            diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE,
            diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,
            diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
            diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
            diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,
            diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,
            diagObj.db.LINETYPE.DOTTED,
            diagObj.db.LINETYPE.SOLID_CROSS,
            diagObj.db.LINETYPE.DOTTED_CROSS,
            diagObj.db.LINETYPE.SOLID_POINT,
            diagObj.db.LINETYPE.DOTTED_POINT,
            diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
            diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED
          ].includes(msg.type)) {
            sequenceIndex = sequenceIndex + sequenceIndexStep;
          }
          index++;
        }
        log.debug("createdActors", createdActors);
        log.debug("destroyedActors", destroyedActors);
        await drawActors(diagram31, actors2, actorKeys, false, id34, diagObj, actorIndexMap);
        for (const e3 of messagesToDraw) {
          await drawMessage(diagram31, e3.messageModel, e3.lineStartY, diagObj, e3.msg, id34);
        }
        if (conf2.mirrorActors) {
          await drawActors(diagram31, actors2, actorKeys, true, id34, diagObj, actorIndexMap);
        }
        backgrounds.forEach((e3) => svgDraw_default2.drawBackgroundRect(diagram31, e3));
        fixLifeLineHeights(diagram31, actors2, actorKeys, conf2);
        for (const box2 of bounds2.models.boxes) {
          box2.height = bounds2.getVerticalPos() - box2.y;
          bounds2.insert(box2.x, box2.y, box2.x + box2.width, box2.height);
          const boxPadding = conf2.boxMargin * 2;
          box2.startx = box2.x - boxPadding;
          box2.starty = box2.y - boxPadding * 0.25;
          box2.stopx = box2.startx + box2.width + 2 * boxPadding;
          box2.stopy = box2.starty + box2.height + boxPadding * 0.75;
          box2.stroke = "rgb(0,0,0, 0.5)";
          svgDraw_default2.drawBox(diagram31, box2, conf2);
        }
        if (hasBoxes) {
          bounds2.bumpVerticalPos(conf2.boxMargin);
        }
        const requiredBoxSize = drawActorsPopup(diagram31, actors2, actorKeys, doc);
        const { bounds: box } = bounds2.getBounds();
        if (box.startx === void 0) {
          box.startx = 0;
        }
        if (box.starty === void 0) {
          box.starty = 0;
        }
        if (box.stopx === void 0) {
          box.stopx = 0;
        }
        if (box.stopy === void 0) {
          box.stopy = 0;
        }
        let boxHeight = box.stopy - box.starty;
        if (boxHeight < requiredBoxSize.maxHeight) {
          boxHeight = requiredBoxSize.maxHeight;
        }
        let height2 = boxHeight + 2 * conf2.diagramMarginY;
        if (conf2.mirrorActors) {
          height2 = height2 - conf2.boxMargin + conf2.bottomMarginAdj;
        }
        let boxWidth = box.stopx - box.startx;
        if (boxWidth < requiredBoxSize.maxWidth) {
          boxWidth = requiredBoxSize.maxWidth;
        }
        const width3 = boxWidth + 2 * conf2.diagramMarginX;
        if (title2) {
          diagram31.append("text").text(title2).attr("x", (box.stopx - box.startx) / 2 - 2 * conf2.diagramMarginX).attr("y", -25);
        }
        configureSvgSize(diagram31, height2, width3, conf2.useMaxWidth);
        const extraVertForTitle = title2 ? 40 : 0;
        const extraHeightForNeoActors = actors2.size && look === "neo" ? 30 : 0;
        diagram31.attr(
          "viewBox",
          box.startx - conf2.diagramMarginX + " -" + (conf2.diagramMarginY + extraVertForTitle) + " " + width3 + " " + (height2 + extraVertForTitle + extraHeightForNeoActors)
        );
        log.debug(`models:`, bounds2.models);
      }, "draw");
      __name(getMaxMessageWidthPerActor, "getMaxMessageWidthPerActor");
      getRequiredPopupWidth = /* @__PURE__ */ __name(function(actor) {
        let requiredPopupWidth = 0;
        const textFont = actorFont(conf2);
        for (const key in actor.links) {
          const labelDimensions = utils_default2.calculateTextDimensions(key, textFont);
          const labelWidth = labelDimensions.width + 2 * conf2.wrapPadding + 2 * conf2.boxMargin;
          if (requiredPopupWidth < labelWidth) {
            requiredPopupWidth = labelWidth;
          }
        }
        return requiredPopupWidth;
      }, "getRequiredPopupWidth");
      __name(calculateActorMargins, "calculateActorMargins");
      buildNoteModel = /* @__PURE__ */ __name(async function(msg, actors2, diagObj) {
        const fromActor = actors2.get(msg.from);
        const toActor = actors2.get(msg.to);
        const startx = fromActor.x;
        const stopx = toActor.x;
        const shouldWrap = msg.wrap && msg.message;
        let textDimensions = hasKatex(msg.message) ? await calculateMathMLDimensions(msg.message, getConfig2()) : utils_default2.calculateTextDimensions(
          shouldWrap ? utils_default2.wrapLabel(msg.message, conf2.width, noteFont(conf2)) : msg.message,
          noteFont(conf2)
        );
        const noteModel = {
          width: shouldWrap ? conf2.width : common_default.getMax(conf2.width, textDimensions.width + 2 * conf2.noteMargin),
          height: 0,
          startx: fromActor.x,
          stopx: 0,
          starty: 0,
          stopy: 0,
          message: msg.message
        };
        if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
          noteModel.width = shouldWrap ? common_default.getMax(conf2.width, textDimensions.width) : common_default.getMax(
            fromActor.width / 2 + toActor.width / 2,
            textDimensions.width + 2 * conf2.noteMargin
          );
          noteModel.startx = startx + (fromActor.width + conf2.actorMargin) / 2;
        } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
          noteModel.width = shouldWrap ? common_default.getMax(conf2.width, textDimensions.width + 2 * conf2.noteMargin) : common_default.getMax(
            fromActor.width / 2 + toActor.width / 2,
            textDimensions.width + 2 * conf2.noteMargin
          );
          noteModel.startx = startx - noteModel.width + (fromActor.width - conf2.actorMargin) / 2;
        } else if (msg.to === msg.from) {
          textDimensions = utils_default2.calculateTextDimensions(
            shouldWrap ? utils_default2.wrapLabel(msg.message, common_default.getMax(conf2.width, fromActor.width), noteFont(conf2)) : msg.message,
            noteFont(conf2)
          );
          noteModel.width = shouldWrap ? common_default.getMax(conf2.width, fromActor.width) : common_default.getMax(fromActor.width, conf2.width, textDimensions.width + 2 * conf2.noteMargin);
          noteModel.startx = startx + (fromActor.width - noteModel.width) / 2;
        } else {
          noteModel.width = Math.abs(startx + fromActor.width / 2 - (stopx + toActor.width / 2)) + conf2.actorMargin;
          noteModel.startx = startx < stopx ? startx + fromActor.width / 2 - conf2.actorMargin / 2 : stopx + toActor.width / 2 - conf2.actorMargin / 2;
        }
        if (shouldWrap) {
          noteModel.message = utils_default2.wrapLabel(
            msg.message,
            noteModel.width - 2 * conf2.wrapPadding,
            noteFont(conf2)
          );
        }
        log.debug(
          `NM:[${noteModel.startx},${noteModel.stopx},${noteModel.starty},${noteModel.stopy}:${noteModel.width},${noteModel.height}=${msg.message}]`
        );
        return noteModel;
      }, "buildNoteModel");
      CENTRAL_CONNECTION_BASE_OFFSET = 4;
      CENTRAL_CONNECTION_BIDIRECTIONAL_OFFSET = 6;
      hasCentralConnection = /* @__PURE__ */ __name(function(msg, diagObj) {
        const { CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL } = diagObj.db.LINETYPE;
        return [CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL].includes(
          msg.centralConnection
        );
      }, "hasCentralConnection");
      calculateCentralConnectionOffset = /* @__PURE__ */ __name(function(msg, diagObj, isArrowToRight) {
        const {
          CENTRAL_CONNECTION_REVERSE,
          CENTRAL_CONNECTION_DUAL,
          BIDIRECTIONAL_SOLID,
          BIDIRECTIONAL_DOTTED
        } = diagObj.db.LINETYPE;
        let offset = 0;
        if (msg.centralConnection === CENTRAL_CONNECTION_REVERSE || msg.centralConnection === CENTRAL_CONNECTION_DUAL) {
          offset += CENTRAL_CONNECTION_BASE_OFFSET;
        }
        if ((msg.centralConnection === CENTRAL_CONNECTION_REVERSE || msg.centralConnection === CENTRAL_CONNECTION_DUAL) && (msg.type === BIDIRECTIONAL_SOLID || msg.type === BIDIRECTIONAL_DOTTED)) {
          offset += isArrowToRight ? 0 : -CENTRAL_CONNECTION_BIDIRECTIONAL_OFFSET;
        }
        return offset;
      }, "calculateCentralConnectionOffset");
      isReverseArrowType = /* @__PURE__ */ __name(function(msg, diagObj) {
        const {
          SOLID_ARROW_TOP_REVERSE,
          SOLID_ARROW_TOP_REVERSE_DOTTED,
          SOLID_ARROW_BOTTOM_REVERSE,
          SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
          STICK_ARROW_TOP_REVERSE,
          STICK_ARROW_TOP_REVERSE_DOTTED,
          STICK_ARROW_BOTTOM_REVERSE,
          STICK_ARROW_BOTTOM_REVERSE_DOTTED
        } = diagObj.db.LINETYPE;
        return [
          SOLID_ARROW_TOP_REVERSE,
          SOLID_ARROW_TOP_REVERSE_DOTTED,
          SOLID_ARROW_BOTTOM_REVERSE,
          SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
          STICK_ARROW_TOP_REVERSE,
          STICK_ARROW_TOP_REVERSE_DOTTED,
          STICK_ARROW_BOTTOM_REVERSE,
          STICK_ARROW_BOTTOM_REVERSE_DOTTED
        ].includes(msg.type);
      }, "isReverseArrowType");
      isBidirectionalArrowType = /* @__PURE__ */ __name(function(msg, diagObj) {
        const { BIDIRECTIONAL_SOLID, BIDIRECTIONAL_DOTTED } = diagObj.db.LINETYPE;
        return [BIDIRECTIONAL_SOLID, BIDIRECTIONAL_DOTTED].includes(msg.type);
      }, "isBidirectionalArrowType");
      buildMessageModel = /* @__PURE__ */ __name(function(msg, actors2, diagObj) {
        const { look } = getConfig2();
        if (![
          diagObj.db.LINETYPE.SOLID_OPEN,
          diagObj.db.LINETYPE.DOTTED_OPEN,
          diagObj.db.LINETYPE.SOLID,
          diagObj.db.LINETYPE.SOLID_TOP,
          diagObj.db.LINETYPE.SOLID_BOTTOM,
          diagObj.db.LINETYPE.STICK_TOP,
          diagObj.db.LINETYPE.STICK_BOTTOM,
          diagObj.db.LINETYPE.SOLID_TOP_DOTTED,
          diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED,
          diagObj.db.LINETYPE.STICK_TOP_DOTTED,
          diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED,
          diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
          diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE,
          diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE,
          diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,
          diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
          diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
          diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,
          diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,
          diagObj.db.LINETYPE.DOTTED,
          diagObj.db.LINETYPE.SOLID_CROSS,
          diagObj.db.LINETYPE.DOTTED_CROSS,
          diagObj.db.LINETYPE.SOLID_POINT,
          diagObj.db.LINETYPE.DOTTED_POINT,
          diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
          diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED
        ].includes(msg.type)) {
          return {};
        }
        const [fromLeft, fromRight] = activationBounds(msg.from, actors2);
        const [toLeft, toRight] = activationBounds(msg.to, actors2);
        const isArrowToRight = fromLeft <= toLeft;
        let startx = isArrowToRight ? fromRight : fromLeft;
        let stopx = isArrowToRight ? toLeft : toRight;
        if (look === "neo") {
          const offset = 3;
          if (msg.type !== diagObj.db.LINETYPE.SOLID_OPEN) {
            stopx += isArrowToRight ? -offset : offset;
          }
          if (msg.type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || msg.type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED) {
            startx += isArrowToRight ? offset : -offset;
          }
        }
        startx += calculateCentralConnectionOffset(msg, diagObj, isArrowToRight);
        const isArrowToActivation = Math.abs(toLeft - toRight) > 2;
        const adjustValue = /* @__PURE__ */ __name((value2) => {
          return isArrowToRight ? -value2 : value2;
        }, "adjustValue");
        if (msg.from === msg.to) {
          stopx = startx;
        } else {
          if (msg.activate && !isArrowToActivation) {
            stopx += adjustValue(conf2.activationWidth / 2 - 1);
          }
          if (![
            diagObj.db.LINETYPE.SOLID_OPEN,
            diagObj.db.LINETYPE.DOTTED_OPEN,
            diagObj.db.LINETYPE.STICK_TOP,
            diagObj.db.LINETYPE.STICK_BOTTOM,
            diagObj.db.LINETYPE.STICK_TOP_DOTTED,
            diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED,
            diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
            diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
            diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE,
            diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,
            diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,
            diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,
            diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
            diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE
          ].includes(msg.type)) {
            stopx += adjustValue(3);
          }
          if ([
            diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
            diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED,
            diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
            diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
            diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
            diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE
          ].includes(msg.type)) {
            startx -= adjustValue(3);
          }
        }
        const allBounds = [fromLeft, fromRight, toLeft, toRight];
        const boundedWidth = Math.abs(startx - stopx);
        if (msg.wrap && msg.message) {
          msg.message = utils_default2.wrapLabel(
            msg.message,
            common_default.getMax(boundedWidth + 2 * conf2.wrapPadding, conf2.width),
            messageFont2(conf2)
          );
        }
        const msgDims = utils_default2.calculateTextDimensions(msg.message, messageFont2(conf2));
        return {
          width: common_default.getMax(
            msg.wrap ? 0 : msgDims.width + 2 * conf2.wrapPadding,
            boundedWidth + 2 * conf2.wrapPadding,
            conf2.width
          ),
          height: 0,
          startx,
          stopx,
          starty: 0,
          stopy: 0,
          message: msg.message,
          type: msg.type,
          wrap: msg.wrap,
          fromBounds: Math.min.apply(null, allBounds),
          toBounds: Math.max.apply(null, allBounds)
        };
      }, "buildMessageModel");
      calculateLoopBounds = /* @__PURE__ */ __name(async function(messages, actors2, _maxWidthPerActor, diagObj) {
        const loops = {};
        const stack = [];
        let current, noteModel, msgModel;
        for (const msg of messages) {
          switch (msg.type) {
            case diagObj.db.LINETYPE.LOOP_START:
            case diagObj.db.LINETYPE.ALT_START:
            case diagObj.db.LINETYPE.OPT_START:
            case diagObj.db.LINETYPE.PAR_START:
            case diagObj.db.LINETYPE.PAR_OVER_START:
            case diagObj.db.LINETYPE.CRITICAL_START:
            case diagObj.db.LINETYPE.BREAK_START:
              stack.push({
                id: msg.id,
                msg: msg.message,
                from: Number.MAX_SAFE_INTEGER,
                to: Number.MIN_SAFE_INTEGER,
                width: 0
              });
              break;
            case diagObj.db.LINETYPE.ALT_ELSE:
            case diagObj.db.LINETYPE.PAR_AND:
            case diagObj.db.LINETYPE.CRITICAL_OPTION:
              if (msg.message) {
                current = stack.pop();
                loops[current.id] = current;
                loops[msg.id] = current;
                stack.push(current);
              }
              break;
            case diagObj.db.LINETYPE.LOOP_END:
            case diagObj.db.LINETYPE.ALT_END:
            case diagObj.db.LINETYPE.OPT_END:
            case diagObj.db.LINETYPE.PAR_END:
            case diagObj.db.LINETYPE.CRITICAL_END:
            case diagObj.db.LINETYPE.BREAK_END:
              current = stack.pop();
              loops[current.id] = current;
              break;
            case diagObj.db.LINETYPE.ACTIVE_START:
              {
                const actorRect = actors2.get(msg.from ? msg.from : msg.to.actor);
                const stackedSize = actorActivations(msg.from ? msg.from : msg.to.actor).length;
                const x5 = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf2.activationWidth / 2;
                const toAdd = {
                  startx: x5,
                  stopx: x5 + conf2.activationWidth,
                  actor: msg.from,
                  enabled: true
                };
                bounds2.activations.push(toAdd);
              }
              break;
            case diagObj.db.LINETYPE.ACTIVE_END:
              {
                const lastActorActivationIdx = bounds2.activations.map((a2) => a2.actor).lastIndexOf(msg.from);
                bounds2.activations.splice(lastActorActivationIdx, 1).splice(0, 1);
              }
              break;
          }
          const isNote = msg.placement !== void 0;
          if (isNote) {
            noteModel = await buildNoteModel(msg, actors2, diagObj);
            msg.noteModel = noteModel;
            stack.forEach((stk) => {
              current = stk;
              current.from = common_default.getMin(current.from, noteModel.startx);
              current.to = common_default.getMax(current.to, noteModel.startx + noteModel.width);
              current.width = common_default.getMax(current.width, Math.abs(current.from - current.to)) - conf2.labelBoxWidth;
            });
          } else {
            msgModel = buildMessageModel(msg, actors2, diagObj);
            msg.msgModel = msgModel;
            if (msgModel.startx && msgModel.stopx && stack.length > 0) {
              stack.forEach((stk) => {
                current = stk;
                if (msgModel.startx === msgModel.stopx) {
                  const from2 = actors2.get(msg.from);
                  const to = actors2.get(msg.to);
                  current.from = common_default.getMin(
                    from2.x - msgModel.width / 2,
                    from2.x - from2.width / 2,
                    current.from
                  );
                  current.to = common_default.getMax(
                    to.x + msgModel.width / 2,
                    to.x + from2.width / 2,
                    current.to
                  );
                  current.width = common_default.getMax(current.width, Math.abs(current.to - current.from)) - conf2.labelBoxWidth;
                } else {
                  current.from = common_default.getMin(msgModel.startx, current.from);
                  current.to = common_default.getMax(msgModel.stopx, current.to);
                  current.width = common_default.getMax(current.width, msgModel.width) - conf2.labelBoxWidth;
                }
              });
            }
          }
        }
        bounds2.activations = [];
        log.debug("Loop type widths:", loops);
        return loops;
      }, "calculateLoopBounds");
      sequenceRenderer_default = {
        bounds: bounds2,
        drawActors,
        drawActorsPopup,
        setConf: setConf3,
        draw: draw11
      };
    }
  });

  // src/diagrams/sequence/sequenceDiagram.ts
  var sequenceDiagram_exports = {};
  __export(sequenceDiagram_exports, {
    diagram: () => diagram11
  });
  var diagram11;
  var init_sequenceDiagram2 = __esm({
    "src/diagrams/sequence/sequenceDiagram.ts"() {
      "use strict";
      init_sequenceDiagram();
      init_sequenceDb();
      init_styles8();
      init_diagramAPI();
      init_sequenceRenderer();
      diagram11 = {
        parser: sequenceDiagram_default,
        get db() {
          return new SequenceDB();
        },
        renderer: sequenceRenderer_default,
        styles: styles_default8,
        init: /* @__PURE__ */ __name((cnf) => {
          if (!cnf.sequence) {
            cnf.sequence = {};
          }
          if (cnf.wrap) {
            cnf.sequence.wrap = cnf.wrap;
            setConfig2({ sequence: { wrap: cnf.wrap } });
          }
        }, "init")
      };
    }
  });

  // src/diagrams/class/parser/classDiagram.jison
  var parser12, classDiagram_default;
  var init_classDiagram = __esm({
    "src/diagrams/class/parser/classDiagram.jison"() {
      "use strict";
      parser12 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [1, 18], $V1 = [1, 19], $V2 = [1, 20], $V3 = [1, 41], $V4 = [1, 26], $V5 = [1, 42], $V6 = [1, 24], $V7 = [1, 25], $V8 = [1, 32], $V9 = [1, 33], $Va = [1, 34], $Vb = [1, 45], $Vc = [1, 35], $Vd = [1, 36], $Ve = [1, 37], $Vf = [1, 38], $Vg = [1, 27], $Vh = [1, 28], $Vi = [1, 29], $Vj = [1, 30], $Vk = [1, 31], $Vl = [1, 44], $Vm = [1, 46], $Vn = [1, 43], $Vo = [1, 47], $Vp = [1, 9], $Vq = [1, 8, 9], $Vr = [1, 58], $Vs = [1, 59], $Vt = [1, 60], $Vu = [1, 61], $Vv = [1, 62], $Vw = [1, 63], $Vx = [1, 64], $Vy = [1, 8, 9, 41], $Vz = [1, 77], $VA = [1, 8, 9, 12, 13, 22, 39, 41, 44, 46, 68, 69, 70, 71, 72, 73, 74, 79, 81], $VB = [1, 8, 9, 12, 13, 18, 20, 22, 39, 41, 44, 46, 47, 60, 68, 69, 70, 71, 72, 73, 74, 79, 81, 86, 100, 102, 103], $VC = [13, 60, 86, 100, 102, 103], $VD = [13, 60, 73, 74, 86, 100, 102, 103], $VE = [13, 60, 68, 69, 70, 71, 72, 86, 100, 102, 103], $VF = [1, 102], $VG = [1, 120], $VH = [1, 116], $VI = [1, 112], $VJ = [1, 118], $VK = [1, 113], $VL = [1, 114], $VM = [1, 115], $VN = [1, 117], $VO = [1, 119], $VP = [22, 50, 60, 61, 82, 86, 87, 88, 89, 90], $VQ = [1, 8, 9, 39, 41, 44, 46], $VR = [1, 8, 9, 22], $VS = [1, 150], $VT = [1, 8, 9, 61], $VU = [1, 8, 9, 22, 50, 60, 61, 82, 86, 87, 88, 89, 90];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "mermaidDoc": 4, "statements": 5, "graphConfig": 6, "CLASS_DIAGRAM": 7, "NEWLINE": 8, "EOF": 9, "statement": 10, "classLabel": 11, "SQS": 12, "STR": 13, "SQE": 14, "namespaceName": 15, "alphaNumToken": 16, "classLiteralName": 17, "DOT": 18, "className": 19, "GENERICTYPE": 20, "relationStatement": 21, "LABEL": 22, "namespaceStatement": 23, "classStatement": 24, "memberStatement": 25, "annotationStatement": 26, "clickStatement": 27, "styleStatement": 28, "cssClassStatement": 29, "noteStatement": 30, "classDefStatement": 31, "direction": 32, "acc_title": 33, "acc_title_value": 34, "acc_descr": 35, "acc_descr_value": 36, "acc_descr_multiline_value": 37, "namespaceIdentifier": 38, "STRUCT_START": 39, "classStatements": 40, "STRUCT_STOP": 41, "NAMESPACE": 42, "classIdentifier": 43, "STYLE_SEPARATOR": 44, "members": 45, "ANNOTATION_START": 46, "ANNOTATION_END": 47, "CLASS": 48, "emptyBody": 49, "SPACE": 50, "MEMBER": 51, "SEPARATOR": 52, "relation": 53, "NOTE_FOR": 54, "noteText": 55, "NOTE": 56, "CLASSDEF": 57, "classList": 58, "stylesOpt": 59, "ALPHA": 60, "COMMA": 61, "direction_tb": 62, "direction_bt": 63, "direction_rl": 64, "direction_lr": 65, "relationType": 66, "lineType": 67, "AGGREGATION": 68, "EXTENSION": 69, "COMPOSITION": 70, "DEPENDENCY": 71, "LOLLIPOP": 72, "LINE": 73, "DOTTED_LINE": 74, "CALLBACK": 75, "LINK": 76, "LINK_TARGET": 77, "CLICK": 78, "CALLBACK_NAME": 79, "CALLBACK_ARGS": 80, "HREF": 81, "STYLE": 82, "CSSCLASS": 83, "style": 84, "styleComponent": 85, "NUM": 86, "COLON": 87, "UNIT": 88, "BRKT": 89, "PCT": 90, "commentToken": 91, "textToken": 92, "graphCodeTokens": 93, "textNoTagsToken": 94, "TAGSTART": 95, "TAGEND": 96, "==": 97, "--": 98, "DEFAULT": 99, "MINUS": 100, "keywords": 101, "UNICODE_TEXT": 102, "BQUOTE_STR": 103, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 7: "CLASS_DIAGRAM", 8: "NEWLINE", 9: "EOF", 12: "SQS", 13: "STR", 14: "SQE", 18: "DOT", 20: "GENERICTYPE", 22: "LABEL", 33: "acc_title", 34: "acc_title_value", 35: "acc_descr", 36: "acc_descr_value", 37: "acc_descr_multiline_value", 39: "STRUCT_START", 41: "STRUCT_STOP", 42: "NAMESPACE", 44: "STYLE_SEPARATOR", 46: "ANNOTATION_START", 47: "ANNOTATION_END", 48: "CLASS", 50: "SPACE", 51: "MEMBER", 52: "SEPARATOR", 54: "NOTE_FOR", 56: "NOTE", 57: "CLASSDEF", 60: "ALPHA", 61: "COMMA", 62: "direction_tb", 63: "direction_bt", 64: "direction_rl", 65: "direction_lr", 68: "AGGREGATION", 69: "EXTENSION", 70: "COMPOSITION", 71: "DEPENDENCY", 72: "LOLLIPOP", 73: "LINE", 74: "DOTTED_LINE", 75: "CALLBACK", 76: "LINK", 77: "LINK_TARGET", 78: "CLICK", 79: "CALLBACK_NAME", 80: "CALLBACK_ARGS", 81: "HREF", 82: "STYLE", 83: "CSSCLASS", 86: "NUM", 87: "COLON", 88: "UNIT", 89: "BRKT", 90: "PCT", 93: "graphCodeTokens", 95: "TAGSTART", 96: "TAGEND", 97: "==", 98: "--", 99: "DEFAULT", 100: "MINUS", 101: "keywords", 102: "UNICODE_TEXT", 103: "BQUOTE_STR" },
          productions_: [0, [3, 1], [3, 1], [4, 1], [6, 4], [5, 1], [5, 2], [5, 3], [11, 3], [15, 1], [15, 1], [15, 3], [15, 2], [19, 1], [19, 3], [19, 1], [19, 2], [19, 2], [19, 2], [10, 1], [10, 2], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [10, 1], [23, 4], [23, 5], [38, 2], [40, 1], [40, 2], [40, 3], [40, 1], [40, 2], [40, 3], [24, 1], [24, 3], [24, 4], [24, 3], [24, 6], [24, 4], [24, 7], [24, 6], [43, 2], [43, 3], [49, 0], [49, 2], [49, 2], [26, 4], [45, 1], [45, 2], [25, 1], [25, 2], [25, 1], [25, 1], [21, 3], [21, 4], [21, 4], [21, 5], [30, 3], [30, 2], [31, 3], [58, 1], [58, 3], [32, 1], [32, 1], [32, 1], [32, 1], [53, 3], [53, 2], [53, 2], [53, 1], [66, 1], [66, 1], [66, 1], [66, 1], [66, 1], [67, 1], [67, 1], [27, 3], [27, 4], [27, 3], [27, 4], [27, 4], [27, 5], [27, 3], [27, 4], [27, 4], [27, 5], [27, 4], [27, 5], [27, 5], [27, 6], [28, 3], [29, 3], [59, 1], [59, 3], [84, 1], [84, 2], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [91, 1], [91, 1], [92, 1], [92, 1], [92, 1], [92, 1], [92, 1], [92, 1], [92, 1], [94, 1], [94, 1], [94, 1], [94, 1], [16, 1], [16, 1], [16, 1], [16, 1], [17, 1], [55, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 8:
                this.$ = $$[$0 - 1];
                break;
              case 9:
              case 10:
              case 13:
              case 15:
                this.$ = $$[$0];
                break;
              case 11:
              case 14:
                this.$ = $$[$0 - 2] + "." + $$[$0];
                break;
              case 12:
              case 16:
                this.$ = $$[$0 - 1] + $$[$0];
                break;
              case 17:
              case 18:
                this.$ = $$[$0 - 1] + "~" + $$[$0] + "~";
                break;
              case 19:
                yy.addRelation($$[$0]);
                break;
              case 20:
                $$[$0 - 1].title = yy.cleanupLabel($$[$0]);
                yy.addRelation($$[$0 - 1]);
                break;
              case 31:
                this.$ = $$[$0].trim();
                yy.setAccTitle(this.$);
                break;
              case 32:
              case 33:
                this.$ = $$[$0].trim();
                yy.setAccDescription(this.$);
                break;
              case 34:
                yy.addClassesToNamespace($$[$0 - 3], $$[$0 - 1][0], $$[$0 - 1][1]);
                break;
              case 35:
                yy.addClassesToNamespace($$[$0 - 4], $$[$0 - 1][0], $$[$0 - 1][1]);
                break;
              case 36:
                this.$ = $$[$0];
                yy.addNamespace($$[$0]);
                break;
              case 37:
                this.$ = [[$$[$0]], []];
                break;
              case 38:
                this.$ = [[$$[$0 - 1]], []];
                break;
              case 39:
                $$[$0][0].unshift($$[$0 - 2]);
                this.$ = $$[$0];
                break;
              case 40:
                this.$ = [[], [$$[$0]]];
                break;
              case 41:
                this.$ = [[], [$$[$0 - 1]]];
                break;
              case 42:
                $$[$0][1].unshift($$[$0 - 2]);
                this.$ = $$[$0];
                break;
              case 44:
                yy.setCssClass($$[$0 - 2], $$[$0]);
                break;
              case 45:
                yy.addMembers($$[$0 - 3], $$[$0 - 1]);
                break;
              case 47:
                yy.setCssClass($$[$0 - 5], $$[$0 - 3]);
                yy.addMembers($$[$0 - 5], $$[$0 - 1]);
                break;
              case 48:
                yy.addAnnotation($$[$0 - 3], $$[$0 - 1]);
                break;
              case 49:
                yy.addAnnotation($$[$0 - 6], $$[$0 - 4]);
                yy.addMembers($$[$0 - 6], $$[$0 - 1]);
                break;
              case 50:
                yy.addAnnotation($$[$0 - 5], $$[$0 - 3]);
                break;
              case 51:
                this.$ = $$[$0];
                yy.addClass($$[$0]);
                break;
              case 52:
                this.$ = $$[$0 - 1];
                yy.addClass($$[$0 - 1]);
                yy.setClassLabel($$[$0 - 1], $$[$0]);
                break;
              case 56:
                yy.addAnnotation($$[$0], $$[$0 - 2]);
                break;
              case 57:
              case 70:
                this.$ = [$$[$0]];
                break;
              case 58:
                $$[$0].push($$[$0 - 1]);
                this.$ = $$[$0];
                break;
              case 59:
                break;
              case 60:
                yy.addMember($$[$0 - 1], yy.cleanupLabel($$[$0]));
                break;
              case 61:
                break;
              case 62:
                break;
              case 63:
                this.$ = { "id1": $$[$0 - 2], "id2": $$[$0], relation: $$[$0 - 1], relationTitle1: "none", relationTitle2: "none" };
                break;
              case 64:
                this.$ = { id1: $$[$0 - 3], id2: $$[$0], relation: $$[$0 - 1], relationTitle1: $$[$0 - 2], relationTitle2: "none" };
                break;
              case 65:
                this.$ = { id1: $$[$0 - 3], id2: $$[$0], relation: $$[$0 - 2], relationTitle1: "none", relationTitle2: $$[$0 - 1] };
                break;
              case 66:
                this.$ = { id1: $$[$0 - 4], id2: $$[$0], relation: $$[$0 - 2], relationTitle1: $$[$0 - 3], relationTitle2: $$[$0 - 1] };
                break;
              case 67:
                this.$ = yy.addNote($$[$0], $$[$0 - 1]);
                break;
              case 68:
                this.$ = yy.addNote($$[$0]);
                break;
              case 69:
                this.$ = $$[$0 - 2];
                yy.defineClass($$[$0 - 1], $$[$0]);
                break;
              case 71:
                this.$ = $$[$0 - 2].concat([$$[$0]]);
                break;
              case 72:
                yy.setDirection("TB");
                break;
              case 73:
                yy.setDirection("BT");
                break;
              case 74:
                yy.setDirection("RL");
                break;
              case 75:
                yy.setDirection("LR");
                break;
              case 76:
                this.$ = { type1: $$[$0 - 2], type2: $$[$0], lineType: $$[$0 - 1] };
                break;
              case 77:
                this.$ = { type1: "none", type2: $$[$0], lineType: $$[$0 - 1] };
                break;
              case 78:
                this.$ = { type1: $$[$0 - 1], type2: "none", lineType: $$[$0] };
                break;
              case 79:
                this.$ = { type1: "none", type2: "none", lineType: $$[$0] };
                break;
              case 80:
                this.$ = yy.relationType.AGGREGATION;
                break;
              case 81:
                this.$ = yy.relationType.EXTENSION;
                break;
              case 82:
                this.$ = yy.relationType.COMPOSITION;
                break;
              case 83:
                this.$ = yy.relationType.DEPENDENCY;
                break;
              case 84:
                this.$ = yy.relationType.LOLLIPOP;
                break;
              case 85:
                this.$ = yy.lineType.LINE;
                break;
              case 86:
                this.$ = yy.lineType.DOTTED_LINE;
                break;
              case 87:
              case 93:
                this.$ = $$[$0 - 2];
                yy.setClickEvent($$[$0 - 1], $$[$0]);
                break;
              case 88:
              case 94:
                this.$ = $$[$0 - 3];
                yy.setClickEvent($$[$0 - 2], $$[$0 - 1]);
                yy.setTooltip($$[$0 - 2], $$[$0]);
                break;
              case 89:
                this.$ = $$[$0 - 2];
                yy.setLink($$[$0 - 1], $$[$0]);
                break;
              case 90:
                this.$ = $$[$0 - 3];
                yy.setLink($$[$0 - 2], $$[$0 - 1], $$[$0]);
                break;
              case 91:
                this.$ = $$[$0 - 3];
                yy.setLink($$[$0 - 2], $$[$0 - 1]);
                yy.setTooltip($$[$0 - 2], $$[$0]);
                break;
              case 92:
                this.$ = $$[$0 - 4];
                yy.setLink($$[$0 - 3], $$[$0 - 2], $$[$0]);
                yy.setTooltip($$[$0 - 3], $$[$0 - 1]);
                break;
              case 95:
                this.$ = $$[$0 - 3];
                yy.setClickEvent($$[$0 - 2], $$[$0 - 1], $$[$0]);
                break;
              case 96:
                this.$ = $$[$0 - 4];
                yy.setClickEvent($$[$0 - 3], $$[$0 - 2], $$[$0 - 1]);
                yy.setTooltip($$[$0 - 3], $$[$0]);
                break;
              case 97:
                this.$ = $$[$0 - 3];
                yy.setLink($$[$0 - 2], $$[$0]);
                break;
              case 98:
                this.$ = $$[$0 - 4];
                yy.setLink($$[$0 - 3], $$[$0 - 1], $$[$0]);
                break;
              case 99:
                this.$ = $$[$0 - 4];
                yy.setLink($$[$0 - 3], $$[$0 - 1]);
                yy.setTooltip($$[$0 - 3], $$[$0]);
                break;
              case 100:
                this.$ = $$[$0 - 5];
                yy.setLink($$[$0 - 4], $$[$0 - 2], $$[$0]);
                yy.setTooltip($$[$0 - 4], $$[$0 - 1]);
                break;
              case 101:
                this.$ = $$[$0 - 2];
                yy.setCssStyle($$[$0 - 1], $$[$0]);
                break;
              case 102:
                yy.setCssClass($$[$0 - 1], $$[$0]);
                break;
              case 103:
                this.$ = [$$[$0]];
                break;
              case 104:
                $$[$0 - 2].push($$[$0]);
                this.$ = $$[$0 - 2];
                break;
              case 106:
                this.$ = $$[$0 - 1] + $$[$0];
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: 2, 5: 3, 6: 4, 7: [1, 6], 10: 5, 16: 39, 17: 40, 19: 21, 21: 7, 23: 8, 24: 9, 25: 10, 26: 11, 27: 12, 28: 13, 29: 14, 30: 15, 31: 16, 32: 17, 33: $V0, 35: $V1, 37: $V2, 38: 22, 42: $V3, 43: 23, 46: $V4, 48: $V5, 51: $V6, 52: $V7, 54: $V8, 56: $V9, 57: $Va, 60: $Vb, 62: $Vc, 63: $Vd, 64: $Ve, 65: $Vf, 75: $Vg, 76: $Vh, 78: $Vi, 82: $Vj, 83: $Vk, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3] }, o2($Vp, [2, 5], { 8: [1, 48] }), { 8: [1, 49] }, o2($Vq, [2, 19], { 22: [1, 50] }), o2($Vq, [2, 21]), o2($Vq, [2, 22]), o2($Vq, [2, 23]), o2($Vq, [2, 24]), o2($Vq, [2, 25]), o2($Vq, [2, 26]), o2($Vq, [2, 27]), o2($Vq, [2, 28]), o2($Vq, [2, 29]), o2($Vq, [2, 30]), { 34: [1, 51] }, { 36: [1, 52] }, o2($Vq, [2, 33]), o2($Vq, [2, 59], { 53: 53, 66: 56, 67: 57, 13: [1, 54], 22: [1, 55], 68: $Vr, 69: $Vs, 70: $Vt, 71: $Vu, 72: $Vv, 73: $Vw, 74: $Vx }), { 39: [1, 65] }, o2($Vy, [2, 43], { 39: [1, 67], 44: [1, 66], 46: [1, 68] }), o2($Vq, [2, 61]), o2($Vq, [2, 62]), { 16: 69, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn }, { 16: 39, 17: 40, 19: 70, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 16: 39, 17: 40, 19: 71, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 16: 39, 17: 40, 19: 72, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 60: [1, 73] }, { 13: [1, 74] }, { 16: 39, 17: 40, 19: 75, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 13: $Vz, 55: 76 }, { 58: 78, 60: [1, 79] }, o2($Vq, [2, 72]), o2($Vq, [2, 73]), o2($Vq, [2, 74]), o2($Vq, [2, 75]), o2($VA, [2, 13], { 16: 39, 17: 40, 19: 81, 18: [1, 80], 20: [1, 82], 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }), o2($VA, [2, 15], { 20: [1, 83] }), { 15: 84, 16: 85, 17: 86, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 16: 39, 17: 40, 19: 87, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, o2($VB, [2, 129]), o2($VB, [2, 130]), o2($VB, [2, 131]), o2($VB, [2, 132]), o2([1, 8, 9, 12, 13, 20, 22, 39, 41, 44, 46, 68, 69, 70, 71, 72, 73, 74, 79, 81], [2, 133]), o2($Vp, [2, 6], { 10: 5, 21: 7, 23: 8, 24: 9, 25: 10, 26: 11, 27: 12, 28: 13, 29: 14, 30: 15, 31: 16, 32: 17, 19: 21, 38: 22, 43: 23, 16: 39, 17: 40, 5: 88, 33: $V0, 35: $V1, 37: $V2, 42: $V3, 46: $V4, 48: $V5, 51: $V6, 52: $V7, 54: $V8, 56: $V9, 57: $Va, 60: $Vb, 62: $Vc, 63: $Vd, 64: $Ve, 65: $Vf, 75: $Vg, 76: $Vh, 78: $Vi, 82: $Vj, 83: $Vk, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }), { 5: 89, 10: 5, 16: 39, 17: 40, 19: 21, 21: 7, 23: 8, 24: 9, 25: 10, 26: 11, 27: 12, 28: 13, 29: 14, 30: 15, 31: 16, 32: 17, 33: $V0, 35: $V1, 37: $V2, 38: 22, 42: $V3, 43: 23, 46: $V4, 48: $V5, 51: $V6, 52: $V7, 54: $V8, 56: $V9, 57: $Va, 60: $Vb, 62: $Vc, 63: $Vd, 64: $Ve, 65: $Vf, 75: $Vg, 76: $Vh, 78: $Vi, 82: $Vj, 83: $Vk, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, o2($Vq, [2, 20]), o2($Vq, [2, 31]), o2($Vq, [2, 32]), { 13: [1, 91], 16: 39, 17: 40, 19: 90, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 53: 92, 66: 56, 67: 57, 68: $Vr, 69: $Vs, 70: $Vt, 71: $Vu, 72: $Vv, 73: $Vw, 74: $Vx }, o2($Vq, [2, 60]), { 67: 93, 73: $Vw, 74: $Vx }, o2($VC, [2, 79], { 66: 94, 68: $Vr, 69: $Vs, 70: $Vt, 71: $Vu, 72: $Vv }), o2($VD, [2, 80]), o2($VD, [2, 81]), o2($VD, [2, 82]), o2($VD, [2, 83]), o2($VD, [2, 84]), o2($VE, [2, 85]), o2($VE, [2, 86]), { 8: [1, 96], 24: 97, 30: 98, 40: 95, 43: 23, 48: $V5, 54: $V8, 56: $V9 }, { 16: 99, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn }, { 41: [1, 101], 45: 100, 51: $VF }, { 16: 103, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn }, { 47: [1, 104] }, { 13: [1, 105] }, { 13: [1, 106] }, { 79: [1, 107], 81: [1, 108] }, { 22: $VG, 50: $VH, 59: 109, 60: $VI, 82: $VJ, 84: 110, 85: 111, 86: $VK, 87: $VL, 88: $VM, 89: $VN, 90: $VO }, { 60: [1, 121] }, { 13: $Vz, 55: 122 }, o2($Vy, [2, 68]), o2($Vy, [2, 134]), { 22: $VG, 50: $VH, 59: 123, 60: $VI, 61: [1, 124], 82: $VJ, 84: 110, 85: 111, 86: $VK, 87: $VL, 88: $VM, 89: $VN, 90: $VO }, o2($VP, [2, 70]), { 16: 39, 17: 40, 19: 125, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, o2($VA, [2, 16]), o2($VA, [2, 17]), o2($VA, [2, 18]), { 39: [2, 36] }, { 15: 127, 16: 85, 17: 86, 18: [1, 126], 39: [2, 9], 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 39: [2, 10] }, o2($VQ, [2, 51], { 11: 128, 12: [1, 129] }), o2($Vp, [2, 7]), { 9: [1, 130] }, o2($VR, [2, 63]), { 16: 39, 17: 40, 19: 131, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 13: [1, 133], 16: 39, 17: 40, 19: 132, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, o2($VC, [2, 78], { 66: 134, 68: $Vr, 69: $Vs, 70: $Vt, 71: $Vu, 72: $Vv }), o2($VC, [2, 77]), { 41: [1, 135] }, { 24: 97, 30: 98, 40: 136, 43: 23, 48: $V5, 54: $V8, 56: $V9 }, { 8: [1, 137], 41: [2, 37] }, { 8: [1, 138], 41: [2, 40] }, o2($Vy, [2, 44], { 39: [1, 139] }), { 41: [1, 140] }, o2($Vy, [2, 46]), { 41: [2, 57], 45: 141, 51: $VF }, { 47: [1, 142] }, { 16: 39, 17: 40, 19: 143, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, o2($Vq, [2, 87], { 13: [1, 144] }), o2($Vq, [2, 89], { 13: [1, 146], 77: [1, 145] }), o2($Vq, [2, 93], { 13: [1, 147], 80: [1, 148] }), { 13: [1, 149] }, o2($Vq, [2, 101], { 61: $VS }), o2($VT, [2, 103], { 85: 151, 22: $VG, 50: $VH, 60: $VI, 82: $VJ, 86: $VK, 87: $VL, 88: $VM, 89: $VN, 90: $VO }), o2($VU, [2, 105]), o2($VU, [2, 107]), o2($VU, [2, 108]), o2($VU, [2, 109]), o2($VU, [2, 110]), o2($VU, [2, 111]), o2($VU, [2, 112]), o2($VU, [2, 113]), o2($VU, [2, 114]), o2($VU, [2, 115]), o2($Vq, [2, 102]), o2($Vy, [2, 67]), o2($Vq, [2, 69], { 61: $VS }), { 60: [1, 152] }, o2($VA, [2, 14]), { 15: 153, 16: 85, 17: 86, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 39: [2, 12] }, o2($VQ, [2, 52]), { 13: [1, 154] }, { 1: [2, 4] }, o2($VR, [2, 65]), o2($VR, [2, 64]), { 16: 39, 17: 40, 19: 155, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, o2($VC, [2, 76]), o2($Vq, [2, 34]), { 41: [1, 156] }, { 24: 97, 30: 98, 40: 157, 41: [2, 38], 43: 23, 48: $V5, 54: $V8, 56: $V9 }, { 24: 97, 30: 98, 40: 158, 41: [2, 41], 43: 23, 48: $V5, 54: $V8, 56: $V9 }, { 45: 159, 51: $VF }, o2($Vy, [2, 45]), { 41: [2, 58] }, o2($Vy, [2, 48], { 39: [1, 160] }), o2($Vq, [2, 56]), o2($Vq, [2, 88]), o2($Vq, [2, 90]), o2($Vq, [2, 91], { 77: [1, 161] }), o2($Vq, [2, 94]), o2($Vq, [2, 95], { 13: [1, 162] }), o2($Vq, [2, 97], { 13: [1, 164], 77: [1, 163] }), { 22: $VG, 50: $VH, 60: $VI, 82: $VJ, 84: 165, 85: 111, 86: $VK, 87: $VL, 88: $VM, 89: $VN, 90: $VO }, o2($VU, [2, 106]), o2($VP, [2, 71]), { 39: [2, 11] }, { 14: [1, 166] }, o2($VR, [2, 66]), o2($Vq, [2, 35]), { 41: [2, 39] }, { 41: [2, 42] }, { 41: [1, 167] }, { 41: [1, 169], 45: 168, 51: $VF }, o2($Vq, [2, 92]), o2($Vq, [2, 96]), o2($Vq, [2, 98]), o2($Vq, [2, 99], { 77: [1, 170] }), o2($VT, [2, 104], { 85: 151, 22: $VG, 50: $VH, 60: $VI, 82: $VJ, 86: $VK, 87: $VL, 88: $VM, 89: $VN, 90: $VO }), o2($VQ, [2, 8]), o2($Vy, [2, 47]), { 41: [1, 171] }, o2($Vy, [2, 50]), o2($Vq, [2, 100]), o2($Vy, [2, 49])],
          defaultActions: { 2: [2, 1], 3: [2, 2], 4: [2, 3], 84: [2, 36], 86: [2, 10], 127: [2, 12], 130: [2, 4], 141: [2, 58], 153: [2, 11], 157: [2, 39], 158: [2, 42] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: {},
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  return 62;
                  break;
                case 1:
                  return 63;
                  break;
                case 2:
                  return 64;
                  break;
                case 3:
                  return 65;
                  break;
                case 4:
                  break;
                case 5:
                  break;
                case 6:
                  this.begin("acc_title");
                  return 33;
                  break;
                case 7:
                  this.popState();
                  return "acc_title_value";
                  break;
                case 8:
                  this.begin("acc_descr");
                  return 35;
                  break;
                case 9:
                  this.popState();
                  return "acc_descr_value";
                  break;
                case 10:
                  this.begin("acc_descr_multiline");
                  break;
                case 11:
                  this.popState();
                  break;
                case 12:
                  return "acc_descr_multiline_value";
                  break;
                case 13:
                  return 8;
                  break;
                case 14:
                  break;
                case 15:
                  return 7;
                  break;
                case 16:
                  return 7;
                  break;
                case 17:
                  return "EDGE_STATE";
                  break;
                case 18:
                  this.begin("callback_name");
                  break;
                case 19:
                  this.popState();
                  break;
                case 20:
                  this.popState();
                  this.begin("callback_args");
                  break;
                case 21:
                  return 79;
                  break;
                case 22:
                  this.popState();
                  break;
                case 23:
                  return 80;
                  break;
                case 24:
                  this.popState();
                  break;
                case 25:
                  return "STR";
                  break;
                case 26:
                  this.begin("string");
                  break;
                case 27:
                  return 82;
                  break;
                case 28:
                  return 57;
                  break;
                case 29:
                  this.begin("namespace");
                  return 42;
                  break;
                case 30:
                  this.popState();
                  return 8;
                  break;
                case 31:
                  break;
                case 32:
                  this.begin("namespace-body");
                  return 39;
                  break;
                case 33:
                  this.popState();
                  return 41;
                  break;
                case 34:
                  return "EOF_IN_STRUCT";
                  break;
                case 35:
                  return 8;
                  break;
                case 36:
                  break;
                case 37:
                  return "EDGE_STATE";
                  break;
                case 38:
                  this.begin("class");
                  return 48;
                  break;
                case 39:
                  this.popState();
                  return 8;
                  break;
                case 40:
                  break;
                case 41:
                  this.popState();
                  this.popState();
                  return 41;
                  break;
                case 42:
                  this.begin("class-body");
                  return 39;
                  break;
                case 43:
                  this.popState();
                  return 41;
                  break;
                case 44:
                  return "EOF_IN_STRUCT";
                  break;
                case 45:
                  return "EDGE_STATE";
                  break;
                case 46:
                  return "OPEN_IN_STRUCT";
                  break;
                case 47:
                  break;
                case 48:
                  return "MEMBER";
                  break;
                case 49:
                  return 83;
                  break;
                case 50:
                  return 75;
                  break;
                case 51:
                  return 76;
                  break;
                case 52:
                  return 78;
                  break;
                case 53:
                  return 54;
                  break;
                case 54:
                  return 56;
                  break;
                case 55:
                  return 46;
                  break;
                case 56:
                  return 47;
                  break;
                case 57:
                  return 81;
                  break;
                case 58:
                  this.popState();
                  break;
                case 59:
                  return "GENERICTYPE";
                  break;
                case 60:
                  this.begin("generic");
                  break;
                case 61:
                  this.popState();
                  break;
                case 62:
                  return "BQUOTE_STR";
                  break;
                case 63:
                  this.begin("bqstring");
                  break;
                case 64:
                  return 77;
                  break;
                case 65:
                  return 77;
                  break;
                case 66:
                  return 77;
                  break;
                case 67:
                  return 77;
                  break;
                case 68:
                  return 69;
                  break;
                case 69:
                  return 69;
                  break;
                case 70:
                  return 71;
                  break;
                case 71:
                  return 71;
                  break;
                case 72:
                  return 70;
                  break;
                case 73:
                  return 68;
                  break;
                case 74:
                  return 72;
                  break;
                case 75:
                  return 73;
                  break;
                case 76:
                  return 74;
                  break;
                case 77:
                  return 22;
                  break;
                case 78:
                  return 44;
                  break;
                case 79:
                  return 100;
                  break;
                case 80:
                  return 18;
                  break;
                case 81:
                  return "PLUS";
                  break;
                case 82:
                  return 87;
                  break;
                case 83:
                  return 61;
                  break;
                case 84:
                  return 89;
                  break;
                case 85:
                  return 89;
                  break;
                case 86:
                  return 90;
                  break;
                case 87:
                  return "EQUALS";
                  break;
                case 88:
                  return "EQUALS";
                  break;
                case 89:
                  return 60;
                  break;
                case 90:
                  return 12;
                  break;
                case 91:
                  return 14;
                  break;
                case 92:
                  return "PUNCTUATION";
                  break;
                case 93:
                  return 86;
                  break;
                case 94:
                  return 102;
                  break;
                case 95:
                  return 50;
                  break;
                case 96:
                  return 50;
                  break;
                case 97:
                  return 9;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/, /^(?:%%[^\n]*(\r?\n)*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:classDiagram-v2\b)/, /^(?:classDiagram\b)/, /^(?:\[\*\])/, /^(?:call[\s]+)/, /^(?:\([\s]*\))/, /^(?:\()/, /^(?:[^(]*)/, /^(?:\))/, /^(?:[^)]*)/, /^(?:["])/, /^(?:[^"]*)/, /^(?:["])/, /^(?:style\b)/, /^(?:classDef\b)/, /^(?:namespace\b)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:[{])/, /^(?:[}])/, /^(?:$)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:\[\*\])/, /^(?:class\b)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:[}])/, /^(?:[{])/, /^(?:[}])/, /^(?:$)/, /^(?:\[\*\])/, /^(?:[{])/, /^(?:[\n])/, /^(?:[^{}\n]*)/, /^(?:cssClass\b)/, /^(?:callback\b)/, /^(?:link\b)/, /^(?:click\b)/, /^(?:note for\b)/, /^(?:note\b)/, /^(?:<<)/, /^(?:>>)/, /^(?:href\b)/, /^(?:[~])/, /^(?:[^~]*)/, /^(?:~)/, /^(?:[`])/, /^(?:[^`]+)/, /^(?:[`])/, /^(?:_self\b)/, /^(?:_blank\b)/, /^(?:_parent\b)/, /^(?:_top\b)/, /^(?:\s*<\|)/, /^(?:\s*\|>)/, /^(?:\s*>)/, /^(?:\s*<)/, /^(?:\s*\*)/, /^(?:\s*o\b)/, /^(?:\s*\(\))/, /^(?:--)/, /^(?:\.\.)/, /^(?::{1}[^:\n;]+)/, /^(?::{3})/, /^(?:-)/, /^(?:\.)/, /^(?:\+)/, /^(?::)/, /^(?:,)/, /^(?:#)/, /^(?:#)/, /^(?:%)/, /^(?:=)/, /^(?:=)/, /^(?:\w+)/, /^(?:\[)/, /^(?:\])/, /^(?:[!"#$%&'*+,-.`?\\/])/, /^(?:[0-9]+)/, /^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/, /^(?:\s)/, /^(?:\s)/, /^(?:$)/],
            conditions: { "namespace-body": { "rules": [26, 33, 34, 35, 36, 37, 38, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "namespace": { "rules": [26, 29, 30, 31, 32, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "class-body": { "rules": [26, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "class": { "rules": [26, 39, 40, 41, 42, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "acc_descr_multiline": { "rules": [11, 12, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "acc_descr": { "rules": [9, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "acc_title": { "rules": [7, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "callback_args": { "rules": [22, 23, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "callback_name": { "rules": [19, 20, 21, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "href": { "rules": [26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "struct": { "rules": [26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "generic": { "rules": [26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "bqstring": { "rules": [26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "string": { "rules": [24, 25, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 26, 27, 28, 29, 38, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser12.parser = parser12;
      classDiagram_default = parser12;
    }
  });

  // src/diagrams/class/classTypes.ts
  var visibilityValues, ClassMember;
  var init_classTypes = __esm({
    "src/diagrams/class/classTypes.ts"() {
      "use strict";
      init_diagramAPI();
      init_common();
      visibilityValues = ["#", "+", "~", "-", ""];
      ClassMember = class {
        static {
          __name(this, "ClassMember");
        }
        constructor(input, memberType) {
          this.memberType = memberType;
          this.visibility = "";
          this.classifier = "";
          this.text = "";
          const sanitizedInput = sanitizeText(input, getConfig2());
          this.parseMember(sanitizedInput);
        }
        getDisplayDetails() {
          let displayText = this.visibility + parseGenericTypes(this.id);
          if (this.memberType === "method") {
            displayText += `(${parseGenericTypes(this.parameters.trim())})`;
            if (this.returnType) {
              displayText += " : " + parseGenericTypes(this.returnType);
            }
          }
          displayText = displayText.trim();
          const cssStyle = this.parseClassifier();
          return {
            displayText,
            cssStyle
          };
        }
        parseMember(input) {
          let potentialClassifier = "";
          if (this.memberType === "method") {
            const methodRegEx = /([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/;
            const match2 = methodRegEx.exec(input);
            if (match2) {
              const detectedVisibility = match2[1] ? match2[1].trim() : "";
              if (visibilityValues.includes(detectedVisibility)) {
                this.visibility = detectedVisibility;
              }
              this.id = match2[2];
              this.parameters = match2[3] ? match2[3].trim() : "";
              potentialClassifier = match2[4] ? match2[4].trim() : "";
              this.returnType = match2[5] ? match2[5].trim() : "";
              if (potentialClassifier === "") {
                const lastChar = this.returnType.substring(this.returnType.length - 1);
                if (/[$*]/.exec(lastChar)) {
                  potentialClassifier = lastChar;
                  this.returnType = this.returnType.substring(0, this.returnType.length - 1);
                }
              }
            }
          } else {
            const length2 = input.length;
            const firstChar = input.substring(0, 1);
            const lastChar = input.substring(length2 - 1);
            if (visibilityValues.includes(firstChar)) {
              this.visibility = firstChar;
            }
            if (/[$*]/.exec(lastChar)) {
              potentialClassifier = lastChar;
            }
            this.id = input.substring(
              this.visibility === "" ? 0 : 1,
              potentialClassifier === "" ? length2 : length2 - 1
            );
          }
          this.classifier = potentialClassifier;
          this.id = this.id.startsWith(" ") ? " " + this.id.trim() : this.id.trim();
          const combinedText = `${this.visibility ? "\\" + this.visibility : ""}${parseGenericTypes(this.id)}${this.memberType === "method" ? `(${parseGenericTypes(this.parameters)})${this.returnType ? " : " + parseGenericTypes(this.returnType) : ""}` : ""}`;
          this.text = combinedText.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
          if (this.text.startsWith("\\&lt;")) {
            this.text = this.text.replace("\\&lt;", "~");
          }
        }
        parseClassifier() {
          switch (this.classifier) {
            case "*":
              return "font-style:italic;";
            case "$":
              return "text-decoration:underline;";
            default:
              return "";
          }
        }
      };
    }
  });

  // src/diagrams/class/classDb.ts
  var MERMAID_DOM_ID_PREFIX2, classCounter, sanitizeText4, ClassDB;
  var init_classDb = __esm({
    "src/diagrams/class/classDb.ts"() {
      "use strict";
      init_src32();
      init_logger();
      init_diagramAPI();
      init_common();
      init_utils2();
      init_commonDb();
      init_svgDrawCommon();
      init_classTypes();
      init_purify_es();
      MERMAID_DOM_ID_PREFIX2 = "classId-";
      classCounter = 0;
      sanitizeText4 = /* @__PURE__ */ __name((txt) => common_default.sanitizeText(txt, getConfig2()), "sanitizeText");
      ClassDB = class {
        constructor() {
          this.relations = [];
          this.classes = /* @__PURE__ */ new Map();
          this.styleClasses = /* @__PURE__ */ new Map();
          this.notes = /* @__PURE__ */ new Map();
          this.interfaces = [];
          // private static classCounter = 0;
          this.namespaces = /* @__PURE__ */ new Map();
          this.namespaceCounter = 0;
          this.diagramId = "";
          // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
          this.functions = [];
          this.lineType = {
            LINE: 0,
            DOTTED_LINE: 1
          };
          this.relationType = {
            AGGREGATION: 0,
            EXTENSION: 1,
            COMPOSITION: 2,
            DEPENDENCY: 3,
            LOLLIPOP: 4
          };
          this.setupToolTips = /* @__PURE__ */ __name((element3) => {
            const tooltipElem = createTooltip();
            const svg2 = select_default2(element3).select("svg");
            const nodes5 = svg2.selectAll("g").filter(function() {
              return select_default2(this).attr("title") !== null;
            });
            nodes5.on("mouseover", (event3) => {
              const el = select_default2(event3.currentTarget);
              const title2 = el.attr("title");
              if (!title2) {
                return;
              }
              const rect3 = event3.currentTarget.getBoundingClientRect();
              tooltipElem.transition().duration(200).style("opacity", ".9");
              tooltipElem.html(purify.sanitize(title2)).style("left", `${window.scrollX + rect3.left + rect3.width / 2}px`).style("top", `${window.scrollY + rect3.bottom + 4}px`);
              el.classed("hover", true);
            }).on("mouseout", (event3) => {
              tooltipElem.transition().duration(500).style("opacity", 0);
              select_default2(event3.currentTarget).classed("hover", false);
            });
          }, "setupToolTips");
          this.direction = "TB";
          this.setAccTitle = setAccTitle;
          this.getAccTitle = getAccTitle;
          this.setAccDescription = setAccDescription;
          this.getAccDescription = getAccDescription;
          this.setDiagramTitle = setDiagramTitle;
          this.getDiagramTitle = getDiagramTitle;
          this.getConfig = /* @__PURE__ */ __name(() => getConfig2().class, "getConfig");
          this.functions.push(this.setupToolTips.bind(this));
          this.clear();
          this.addRelation = this.addRelation.bind(this);
          this.addClassesToNamespace = this.addClassesToNamespace.bind(this);
          this.addNamespace = this.addNamespace.bind(this);
          this.setCssClass = this.setCssClass.bind(this);
          this.addMembers = this.addMembers.bind(this);
          this.addClass = this.addClass.bind(this);
          this.setClassLabel = this.setClassLabel.bind(this);
          this.addAnnotation = this.addAnnotation.bind(this);
          this.addMember = this.addMember.bind(this);
          this.cleanupLabel = this.cleanupLabel.bind(this);
          this.addNote = this.addNote.bind(this);
          this.defineClass = this.defineClass.bind(this);
          this.setDirection = this.setDirection.bind(this);
          this.setLink = this.setLink.bind(this);
          this.bindFunctions = this.bindFunctions.bind(this);
          this.clear = this.clear.bind(this);
          this.setTooltip = this.setTooltip.bind(this);
          this.setClickEvent = this.setClickEvent.bind(this);
          this.setCssStyle = this.setCssStyle.bind(this);
        }
        static {
          __name(this, "ClassDB");
        }
        splitClassNameAndType(_id) {
          const id34 = common_default.sanitizeText(_id, getConfig2());
          let genericType = "";
          let className = id34;
          if (id34.indexOf("~") > 0) {
            const split = id34.split("~");
            className = sanitizeText4(split[0]);
            genericType = sanitizeText4(split[1]);
          }
          return { className, type: genericType };
        }
        setClassLabel(_id, label) {
          const id34 = common_default.sanitizeText(_id, getConfig2());
          if (label) {
            label = sanitizeText4(label);
          }
          const { className } = this.splitClassNameAndType(id34);
          this.classes.get(className).label = label;
          this.classes.get(className).text = `${label}${this.classes.get(className).type ? `<${this.classes.get(className).type}>` : ""}`;
        }
        /**
         * Function called by parser when a node definition has been found.
         *
         * @param id - ID of the class to add
         * @public
         */
        addClass(_id) {
          const id34 = common_default.sanitizeText(_id, getConfig2());
          const { className, type: type3 } = this.splitClassNameAndType(id34);
          if (this.classes.has(className)) {
            return;
          }
          const name = common_default.sanitizeText(className, getConfig2());
          this.classes.set(name, {
            id: name,
            type: type3,
            label: name,
            text: `${name}${type3 ? `&lt;${type3}&gt;` : ""}`,
            shape: "classBox",
            cssClasses: "default",
            methods: [],
            members: [],
            annotations: [],
            styles: [],
            domId: MERMAID_DOM_ID_PREFIX2 + name + "-" + classCounter
          });
          classCounter++;
        }
        addInterface(label, classId) {
          const classInterface = {
            id: `interface${this.interfaces.length}`,
            label,
            classId
          };
          this.interfaces.push(classInterface);
        }
        /**
         * Sets the diagram's SVG element ID, used to prefix domIds for uniqueness
         * across multiple diagrams on the same page.
         */
        setDiagramId(svgElementId) {
          this.diagramId = svgElementId;
        }
        /**
         * Function to lookup domId from id in the graph definition.
         * When diagramId is set, returns the prefixed version for DOM uniqueness.
         *
         * @param id - class ID to lookup
         * @public
         */
        lookUpDomId(_id) {
          const id34 = common_default.sanitizeText(_id, getConfig2());
          if (this.classes.has(id34)) {
            const domId = this.classes.get(id34).domId;
            return this.diagramId ? `${this.diagramId}-${domId}` : domId;
          }
          throw new Error("Class not found: " + id34);
        }
        clear() {
          this.relations = [];
          this.classes = /* @__PURE__ */ new Map();
          this.notes = /* @__PURE__ */ new Map();
          this.interfaces = [];
          this.functions = [];
          this.functions.push(this.setupToolTips.bind(this));
          this.namespaces = /* @__PURE__ */ new Map();
          this.namespaceCounter = 0;
          this.diagramId = "";
          this.direction = "TB";
          clear();
        }
        getClass(id34) {
          return this.classes.get(id34);
        }
        getClasses() {
          return this.classes;
        }
        getRelations() {
          return this.relations;
        }
        getNote(id34) {
          const key = typeof id34 === "number" ? `note${id34}` : id34;
          return this.notes.get(key);
        }
        getNotes() {
          return this.notes;
        }
        addRelation(classRelation) {
          log.debug("Adding relation: " + JSON.stringify(classRelation));
          const invalidTypes = [
            this.relationType.LOLLIPOP,
            this.relationType.AGGREGATION,
            this.relationType.COMPOSITION,
            this.relationType.DEPENDENCY,
            this.relationType.EXTENSION
          ];
          if (classRelation.relation.type1 === this.relationType.LOLLIPOP && !invalidTypes.includes(classRelation.relation.type2)) {
            this.addClass(classRelation.id2);
            this.addInterface(classRelation.id1, classRelation.id2);
            classRelation.id1 = `interface${this.interfaces.length - 1}`;
          } else if (classRelation.relation.type2 === this.relationType.LOLLIPOP && !invalidTypes.includes(classRelation.relation.type1)) {
            this.addClass(classRelation.id1);
            this.addInterface(classRelation.id2, classRelation.id1);
            classRelation.id2 = `interface${this.interfaces.length - 1}`;
          } else {
            this.addClass(classRelation.id1);
            this.addClass(classRelation.id2);
          }
          classRelation.id1 = this.splitClassNameAndType(classRelation.id1).className;
          classRelation.id2 = this.splitClassNameAndType(classRelation.id2).className;
          classRelation.relationTitle1 = common_default.sanitizeText(
            classRelation.relationTitle1.trim(),
            getConfig2()
          );
          classRelation.relationTitle2 = common_default.sanitizeText(
            classRelation.relationTitle2.trim(),
            getConfig2()
          );
          this.relations.push(classRelation);
        }
        /**
         * Adds an annotation to the specified class Annotations mark special properties of the given type
         * (like 'interface' or 'service')
         *
         * @param className - The class name
         * @param annotation - The name of the annotation without any brackets
         * @public
         */
        addAnnotation(className, annotation) {
          const validatedClassName = this.splitClassNameAndType(className).className;
          this.classes.get(validatedClassName).annotations.push(annotation);
        }
        /**
         * Adds a member to the specified class
         *
         * @param className - The class name
         * @param member - The full name of the member. If the member is enclosed in `<<brackets>>` it is
         *   treated as an annotation If the member is ending with a closing bracket ) it is treated as a
         *   method Otherwise the member will be treated as a normal property
         * @public
         */
        addMember(className, member) {
          this.addClass(className);
          const validatedClassName = this.splitClassNameAndType(className).className;
          const theClass = this.classes.get(validatedClassName);
          if (typeof member === "string") {
            const memberString = member.trim();
            if (memberString.startsWith("<<") && memberString.endsWith(">>")) {
              theClass.annotations.push(sanitizeText4(memberString.substring(2, memberString.length - 2)));
            } else if (memberString.indexOf(")") > 0) {
              theClass.methods.push(new ClassMember(memberString, "method"));
            } else if (memberString) {
              theClass.members.push(new ClassMember(memberString, "attribute"));
            }
          }
        }
        addMembers(className, members) {
          if (Array.isArray(members)) {
            members.reverse();
            members.forEach((member) => this.addMember(className, member));
          }
        }
        addNote(text4, className) {
          const index = this.notes.size;
          const note3 = {
            id: `note${index}`,
            class: className,
            text: text4,
            index
          };
          this.notes.set(note3.id, note3);
          return note3.id;
        }
        cleanupLabel(label) {
          if (label.startsWith(":")) {
            label = label.substring(1);
          }
          return sanitizeText4(label.trim());
        }
        /**
         * Called by parser when assigning cssClass to a class
         *
         * @param ids - Comma separated list of ids
         * @param className - Class to add
         */
        setCssClass(ids, className) {
          ids.split(",").forEach((_id) => {
            let id34 = _id;
            if (/\d/.exec(_id[0])) {
              id34 = MERMAID_DOM_ID_PREFIX2 + id34;
            }
            const classNode = this.classes.get(id34);
            if (classNode) {
              classNode.cssClasses += " " + className;
            }
          });
        }
        defineClass(ids, style3) {
          for (const id34 of ids) {
            let styleClass = this.styleClasses.get(id34);
            if (styleClass === void 0) {
              styleClass = { id: id34, styles: [], textStyles: [] };
              this.styleClasses.set(id34, styleClass);
            }
            if (style3) {
              style3.forEach((s2) => {
                if (/color/.exec(s2)) {
                  const newStyle = s2.replace("fill", "bgFill");
                  styleClass.textStyles.push(newStyle);
                }
                styleClass.styles.push(s2);
              });
            }
            this.classes.forEach((value2) => {
              if (value2.cssClasses.includes(id34)) {
                value2.styles.push(...style3.flatMap((s2) => s2.split(",")));
              }
            });
          }
        }
        /**
         * Called by parser when a tooltip is found, e.g. a clickable element.
         *
         * @param ids - Comma separated list of ids
         * @param tooltip - Tooltip to add
         */
        setTooltip(ids, tooltip) {
          ids.split(",").forEach((id34) => {
            if (tooltip !== void 0) {
              this.classes.get(id34).tooltip = sanitizeText4(tooltip);
            }
          });
        }
        getTooltip(id34, namespace) {
          if (namespace && this.namespaces.has(namespace)) {
            return this.namespaces.get(namespace).classes.get(id34).tooltip;
          }
          return this.classes.get(id34).tooltip;
        }
        /**
         * Called by parser when a link is found. Adds the URL to the vertex data.
         *
         * @param ids - Comma separated list of ids
         * @param linkStr - URL to create a link for
         * @param target - Target of the link, _blank by default as originally defined in the svgDraw.js file
         */
        setLink(ids, linkStr, target) {
          const config5 = getConfig2();
          ids.split(",").forEach((_id) => {
            let id34 = _id;
            if (/\d/.exec(_id[0])) {
              id34 = MERMAID_DOM_ID_PREFIX2 + id34;
            }
            const theClass = this.classes.get(id34);
            if (theClass) {
              theClass.link = utils_default2.formatUrl(linkStr, config5);
              if (config5.securityLevel === "sandbox") {
                theClass.linkTarget = "_top";
              } else if (typeof target === "string") {
                theClass.linkTarget = sanitizeText4(target);
              } else {
                theClass.linkTarget = "_blank";
              }
            }
          });
          this.setCssClass(ids, "clickable");
        }
        /**
         * Called by parser when a click definition is found. Registers an event handler.
         *
         * @param ids - Comma separated list of ids
         * @param functionName - Function to be called on click
         * @param functionArgs - Function args the function should be called with
         */
        setClickEvent(ids, functionName, functionArgs) {
          ids.split(",").forEach((id34) => {
            this.setClickFunc(id34, functionName, functionArgs);
            this.classes.get(id34).haveCallback = true;
          });
          this.setCssClass(ids, "clickable");
        }
        setClickFunc(_domId, functionName, functionArgs) {
          const domId = common_default.sanitizeText(_domId, getConfig2());
          const config5 = getConfig2();
          if (config5.securityLevel !== "loose") {
            return;
          }
          if (functionName === void 0) {
            return;
          }
          const id34 = domId;
          if (this.classes.has(id34)) {
            let argList = [];
            if (typeof functionArgs === "string") {
              argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
              for (let i2 = 0; i2 < argList.length; i2++) {
                let item = argList[i2].trim();
                if (item.startsWith('"') && item.endsWith('"')) {
                  item = item.substr(1, item.length - 2);
                }
                argList[i2] = item;
              }
            }
            if (argList.length === 0) {
              argList.push(id34);
            }
            this.functions.push(() => {
              const elemId = this.lookUpDomId(id34);
              const elem = document.querySelector(`[id="${elemId}"]`);
              if (elem !== null) {
                elem.addEventListener(
                  "click",
                  () => {
                    utils_default2.runFunc(functionName, ...argList);
                  },
                  false
                );
              }
            });
          }
        }
        bindFunctions(element3) {
          this.functions.forEach((fun) => {
            fun(element3);
          });
        }
        // Utility function to escape HTML meta-characters
        escapeHtml(str2) {
          return str2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
        }
        getDirection() {
          return this.direction;
        }
        setDirection(dir2) {
          this.direction = dir2;
        }
        /**
         * Function called by parser when a namespace definition has been found.
         *
         * @param id - ID of the namespace to add
         * @public
         */
        addNamespace(id34) {
          if (this.namespaces.has(id34)) {
            return;
          }
          this.namespaces.set(id34, {
            id: id34,
            classes: /* @__PURE__ */ new Map(),
            notes: /* @__PURE__ */ new Map(),
            children: /* @__PURE__ */ new Map(),
            domId: MERMAID_DOM_ID_PREFIX2 + id34 + "-" + this.namespaceCounter
          });
          this.namespaceCounter++;
        }
        getNamespace(name) {
          return this.namespaces.get(name);
        }
        getNamespaces() {
          return this.namespaces;
        }
        /**
         * Function called by parser when a namespace definition has been found.
         *
         * @param id - ID of the namespace to add
         * @param classNames - IDs of the class to add
         * @param noteNames - IDs of the notes to add
         * @public
         */
        addClassesToNamespace(id34, classNames, noteNames) {
          if (!this.namespaces.has(id34)) {
            return;
          }
          for (const name of classNames) {
            const { className } = this.splitClassNameAndType(name);
            const classNode = this.getClass(className);
            classNode.parent = id34;
            this.namespaces.get(id34).classes.set(className, classNode);
          }
          for (const noteName of noteNames) {
            const noteNode = this.getNote(noteName);
            noteNode.parent = id34;
            this.namespaces.get(id34).notes.set(noteName, noteNode);
          }
        }
        setCssStyle(id34, styles5) {
          const thisClass = this.classes.get(id34);
          if (!styles5 || !thisClass) {
            return;
          }
          for (const s2 of styles5) {
            if (s2.includes(",")) {
              thisClass.styles.push(...s2.split(","));
            } else {
              thisClass.styles.push(s2);
            }
          }
        }
        /**
         * Gets the arrow marker for a type index
         *
         * @param type - The type to look for
         * @returns The arrow marker
         */
        getArrowMarker(type3) {
          let marker;
          switch (type3) {
            case 0:
              marker = "aggregation";
              break;
            case 1:
              marker = "extension";
              break;
            case 2:
              marker = "composition";
              break;
            case 3:
              marker = "dependency";
              break;
            case 4:
              marker = "lollipop";
              break;
            default:
              marker = "none";
          }
          return marker;
        }
        getData() {
          const nodes5 = [];
          const edges3 = [];
          const config5 = getConfig2();
          for (const namespace of this.namespaces.values()) {
            const node2 = {
              id: namespace.id,
              label: namespace.id,
              isGroup: true,
              padding: config5.class.padding ?? 16,
              // parent node must be one of [rect, roundedWithTitle, noteGroup, divider]
              shape: "rect",
              cssStyles: [],
              look: config5.look
            };
            nodes5.push(node2);
          }
          for (const classNode of this.classes.values()) {
            const node2 = {
              ...classNode,
              type: void 0,
              isGroup: false,
              parentId: classNode.parent,
              look: config5.look
            };
            nodes5.push(node2);
          }
          for (const note3 of this.notes.values()) {
            const noteNode = {
              id: note3.id,
              label: note3.text,
              isGroup: false,
              shape: "note",
              padding: config5.class.padding ?? 6,
              cssStyles: [
                "text-align: left",
                "white-space: nowrap",
                `fill: ${config5.themeVariables.noteBkgColor}`,
                `stroke: ${config5.themeVariables.noteBorderColor}`
              ],
              look: config5.look,
              parentId: note3.parent,
              labelType: "markdown"
            };
            nodes5.push(noteNode);
            const noteClassId = this.classes.get(note3.class)?.id;
            if (noteClassId) {
              const edge = {
                id: `edgeNote${note3.index}`,
                start: note3.id,
                end: noteClassId,
                type: "normal",
                thickness: "normal",
                classes: "relation",
                arrowTypeStart: "none",
                arrowTypeEnd: "none",
                arrowheadStyle: "",
                labelStyle: [""],
                style: ["fill: none"],
                pattern: "dotted",
                look: config5.look
              };
              edges3.push(edge);
            }
          }
          for (const _interface of this.interfaces) {
            const interfaceNode = {
              id: _interface.id,
              label: _interface.label,
              isGroup: false,
              shape: "rect",
              cssStyles: ["opacity: 0;"],
              look: config5.look
            };
            nodes5.push(interfaceNode);
          }
          let cnt4 = 0;
          for (const classRelation of this.relations) {
            cnt4++;
            const edge = {
              id: getEdgeId(classRelation.id1, classRelation.id2, {
                prefix: "id",
                counter: cnt4
              }),
              start: classRelation.id1,
              end: classRelation.id2,
              type: "normal",
              label: classRelation.title,
              labelpos: "c",
              thickness: "normal",
              classes: "relation",
              arrowTypeStart: this.getArrowMarker(classRelation.relation.type1),
              arrowTypeEnd: this.getArrowMarker(classRelation.relation.type2),
              startLabelRight: classRelation.relationTitle1 === "none" ? "" : classRelation.relationTitle1,
              endLabelLeft: classRelation.relationTitle2 === "none" ? "" : classRelation.relationTitle2,
              arrowheadStyle: "",
              labelStyle: ["display: inline-block"],
              style: classRelation.style || "",
              pattern: classRelation.relation.lineType == 1 ? "dashed" : "solid",
              look: config5.look,
              labelType: "markdown"
            };
            edges3.push(edge);
          }
          return { nodes: nodes5, edges: edges3, other: {}, config: config5, direction: this.getDirection() };
        }
      };
    }
  });

  // src/diagrams/class/styles.js
  var getStyles10, styles_default9;
  var init_styles9 = __esm({
    "src/diagrams/class/styles.js"() {
      "use strict";
      init_globalStyles();
      getStyles10 = /* @__PURE__ */ __name((options2) => `g.classGroup text {
  fill: ${options2.nodeBorder || options2.classText};
  stroke: none;
  font-family: ${options2.fontFamily};
  font-size: 10px;

  .title {
    font-weight: bolder;
  }

}

  .cluster-label text {
    fill: ${options2.titleColor};
  }
  .cluster-label span {
    color: ${options2.titleColor};
  }
  .cluster-label span p {
    background-color: transparent;
  }

  .cluster rect {
    fill: ${options2.clusterBkg};
    stroke: ${options2.clusterBorder};
    stroke-width: 1px;
  }

  .cluster text {
    fill: ${options2.titleColor};
  }

  .cluster span {
    color: ${options2.titleColor};
  }

.nodeLabel, .edgeLabel {
  color: ${options2.classText};
}

.noteLabel .nodeLabel, .noteLabel .edgeLabel {
  color: ${options2.noteTextColor};
}
.edgeLabel .label rect {
  fill: ${options2.mainBkg};
}
.label text {
  fill: ${options2.classText};
}

.labelBkg {
  background: ${options2.mainBkg};
}
.edgeLabel .label span {
  background: ${options2.mainBkg};
}

.classTitle {
  font-weight: bolder;
}
.node rect,
  .node circle,
  .node ellipse,
  .node polygon,
  .node path {
    fill: ${options2.mainBkg};
    stroke: ${options2.nodeBorder};
    stroke-width: ${options2.strokeWidth};
  }


.divider {
  stroke: ${options2.nodeBorder};
  stroke-width: 1;
}

g.clickable {
  cursor: pointer;
}

g.classGroup rect {
  fill: ${options2.mainBkg};
  stroke: ${options2.nodeBorder};
}

g.classGroup line {
  stroke: ${options2.nodeBorder};
  stroke-width: 1;
}

.classLabel .box {
  stroke: none;
  stroke-width: 0;
  fill: ${options2.mainBkg};
  opacity: 0.5;
}

.classLabel .label {
  fill: ${options2.nodeBorder};
  font-size: 10px;
}

.relation {
  stroke: ${options2.lineColor};
  stroke-width: ${options2.strokeWidth};
  fill: none;
}

.dashed-line{
  stroke-dasharray: 3;
}

.dotted-line{
  stroke-dasharray: 1 2;
}

[id$="-compositionStart"], .composition {
  fill: ${options2.lineColor} !important;
  stroke: ${options2.lineColor} !important;
  stroke-width: 1;
}

[id$="-compositionEnd"], .composition {
  fill: ${options2.lineColor} !important;
  stroke: ${options2.lineColor} !important;
  stroke-width: 1;
}

[id$="-dependencyStart"], .dependency {
  fill: ${options2.lineColor} !important;
  stroke: ${options2.lineColor} !important;
  stroke-width: 1;
}

[id$="-dependencyEnd"], .dependency {
  fill: ${options2.lineColor} !important;
  stroke: ${options2.lineColor} !important;
  stroke-width: 1;
}

[id$="-extensionStart"], .extension {
  fill: transparent !important;
  stroke: ${options2.lineColor} !important;
  stroke-width: 1;
}

[id$="-extensionEnd"], .extension {
  fill: transparent !important;
  stroke: ${options2.lineColor} !important;
  stroke-width: 1;
}

[id$="-aggregationStart"], .aggregation {
  fill: transparent !important;
  stroke: ${options2.lineColor} !important;
  stroke-width: 1;
}

[id$="-aggregationEnd"], .aggregation {
  fill: transparent !important;
  stroke: ${options2.lineColor} !important;
  stroke-width: 1;
}

[id$="-lollipopStart"], .lollipop {
  fill: ${options2.mainBkg} !important;
  stroke: ${options2.lineColor} !important;
  stroke-width: 1;
}

[id$="-lollipopEnd"], .lollipop {
  fill: ${options2.mainBkg} !important;
  stroke: ${options2.lineColor} !important;
  stroke-width: 1;
}

.edgeTerminals {
  font-size: 11px;
  line-height: initial;
}

.classTitleText {
  text-anchor: middle;
  font-size: 18px;
  fill: ${options2.textColor};
}

.edgeLabel[data-look="neo"] {
  background-color: ${options2.edgeLabelBackground};
  p {
    background-color: ${options2.edgeLabelBackground};
  }
  rect {
    opacity: 0.5;
    background-color: ${options2.edgeLabelBackground};
    fill: ${options2.edgeLabelBackground};
  }
  text-align: center;
}
  ${getIconStyles()}
`, "getStyles");
      styles_default9 = getStyles10;
    }
  });

  // src/diagrams/class/classRenderer-v3-unified.ts
  var getDir, getClasses2, draw12, classRenderer_v3_unified_default;
  var init_classRenderer_v3_unified = __esm({
    "src/diagrams/class/classRenderer-v3-unified.ts"() {
      "use strict";
      init_diagramAPI();
      init_logger();
      init_insertElementsForSize();
      init_render2();
      init_setupViewPortForSVG();
      init_utils2();
      getDir = /* @__PURE__ */ __name((parsedItem, defaultDir = "TB") => {
        if (!parsedItem.doc) {
          return defaultDir;
        }
        let dir2 = defaultDir;
        for (const parsedItemDoc of parsedItem.doc) {
          if (parsedItemDoc.stmt === "dir") {
            dir2 = parsedItemDoc.value;
          }
        }
        return dir2;
      }, "getDir");
      getClasses2 = /* @__PURE__ */ __name(function(text4, diagramObj) {
        return diagramObj.db.getClasses();
      }, "getClasses");
      draw12 = /* @__PURE__ */ __name(async function(text4, id34, _version, diag) {
        log.info("REF0:");
        log.info("Drawing class diagram (v3)", id34);
        const { securityLevel, state: conf5, layout: layout7 } = getConfig2();
        diag.db.setDiagramId(id34);
        const data4Layout = diag.db.getData();
        const svg2 = getDiagramElement(id34, securityLevel);
        data4Layout.type = diag.type;
        data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(layout7);
        data4Layout.nodeSpacing = conf5?.nodeSpacing || 50;
        data4Layout.rankSpacing = conf5?.rankSpacing || 50;
        data4Layout.markers = ["aggregation", "extension", "composition", "dependency", "lollipop"];
        data4Layout.diagramId = id34;
        await render6(data4Layout, svg2);
        const padding2 = 8;
        utils_default2.insertTitle(
          svg2,
          "classDiagramTitleText",
          conf5?.titleTopMargin ?? 25,
          diag.db.getDiagramTitle()
        );
        setupViewPortForSVG(svg2, padding2, "classDiagram", conf5?.useMaxWidth ?? true);
      }, "draw");
      classRenderer_v3_unified_default = {
        getClasses: getClasses2,
        draw: draw12,
        getDir
      };
    }
  });

  // src/diagrams/class/classDiagram.ts
  var classDiagram_exports = {};
  __export(classDiagram_exports, {
    diagram: () => diagram12
  });
  var diagram12;
  var init_classDiagram2 = __esm({
    "src/diagrams/class/classDiagram.ts"() {
      "use strict";
      init_classDiagram();
      init_classDb();
      init_styles9();
      init_classRenderer_v3_unified();
      diagram12 = {
        parser: classDiagram_default,
        get db() {
          return new ClassDB();
        },
        renderer: classRenderer_v3_unified_default,
        styles: styles_default9,
        init: /* @__PURE__ */ __name((cnf) => {
          if (!cnf.class) {
            cnf.class = {};
          }
          cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
        }, "init")
      };
    }
  });

  // src/diagrams/class/classDiagram-v2.ts
  var classDiagram_v2_exports = {};
  __export(classDiagram_v2_exports, {
    diagram: () => diagram13
  });
  var diagram13;
  var init_classDiagram_v2 = __esm({
    "src/diagrams/class/classDiagram-v2.ts"() {
      "use strict";
      init_classDiagram();
      init_classDb();
      init_styles9();
      init_classRenderer_v3_unified();
      diagram13 = {
        parser: classDiagram_default,
        get db() {
          return new ClassDB();
        },
        renderer: classRenderer_v3_unified_default,
        styles: styles_default9,
        init: /* @__PURE__ */ __name((cnf) => {
          if (!cnf.class) {
            cnf.class = {};
          }
          cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
        }, "init")
      };
    }
  });

  // src/diagrams/state/parser/stateDiagram.jison
  var parser13, stateDiagram_default;
  var init_stateDiagram = __esm({
    "src/diagrams/state/parser/stateDiagram.jison"() {
      "use strict";
      parser13 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 16], $V7 = [1, 17], $V8 = [1, 18], $V9 = [1, 19], $Va = [1, 33], $Vb = [1, 20], $Vc = [1, 21], $Vd = [1, 22], $Ve = [1, 23], $Vf = [1, 24], $Vg = [1, 26], $Vh = [1, 27], $Vi = [1, 28], $Vj = [1, 29], $Vk = [1, 30], $Vl = [1, 31], $Vm = [1, 32], $Vn = [1, 35], $Vo = [1, 36], $Vp = [1, 37], $Vq = [1, 38], $Vr = [1, 34], $Vs = [1, 4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], $Vt = [1, 4, 5, 14, 15, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 39, 40, 41, 45, 48, 51, 52, 53, 54, 57], $Vu = [4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "SPACE": 4, "NL": 5, "SD": 6, "document": 7, "line": 8, "statement": 9, "classDefStatement": 10, "styleStatement": 11, "cssClassStatement": 12, "idStatement": 13, "DESCR": 14, "-->": 15, "HIDE_EMPTY": 16, "scale": 17, "WIDTH": 18, "COMPOSIT_STATE": 19, "STRUCT_START": 20, "STRUCT_STOP": 21, "STATE_DESCR": 22, "AS": 23, "ID": 24, "FORK": 25, "JOIN": 26, "CHOICE": 27, "CONCURRENT": 28, "note": 29, "notePosition": 30, "NOTE_TEXT": 31, "direction": 32, "acc_title": 33, "acc_title_value": 34, "acc_descr": 35, "acc_descr_value": 36, "acc_descr_multiline_value": 37, "CLICK": 38, "STRING": 39, "HREF": 40, "classDef": 41, "CLASSDEF_ID": 42, "CLASSDEF_STYLEOPTS": 43, "DEFAULT": 44, "style": 45, "STYLE_IDS": 46, "STYLEDEF_STYLEOPTS": 47, "class": 48, "CLASSENTITY_IDS": 49, "STYLECLASS": 50, "direction_tb": 51, "direction_bt": 52, "direction_rl": 53, "direction_lr": 54, "eol": 55, ";": 56, "EDGE_STATE": 57, "STYLE_SEPARATOR": 58, "left_of": 59, "right_of": 60, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 4: "SPACE", 5: "NL", 6: "SD", 14: "DESCR", 15: "-->", 16: "HIDE_EMPTY", 17: "scale", 18: "WIDTH", 19: "COMPOSIT_STATE", 20: "STRUCT_START", 21: "STRUCT_STOP", 22: "STATE_DESCR", 23: "AS", 24: "ID", 25: "FORK", 26: "JOIN", 27: "CHOICE", 28: "CONCURRENT", 29: "note", 31: "NOTE_TEXT", 33: "acc_title", 34: "acc_title_value", 35: "acc_descr", 36: "acc_descr_value", 37: "acc_descr_multiline_value", 38: "CLICK", 39: "STRING", 40: "HREF", 41: "classDef", 42: "CLASSDEF_ID", 43: "CLASSDEF_STYLEOPTS", 44: "DEFAULT", 45: "style", 46: "STYLE_IDS", 47: "STYLEDEF_STYLEOPTS", 48: "class", 49: "CLASSENTITY_IDS", 50: "STYLECLASS", 51: "direction_tb", 52: "direction_bt", 53: "direction_rl", 54: "direction_lr", 56: ";", 57: "EDGE_STATE", 58: "STYLE_SEPARATOR", 59: "left_of", 60: "right_of" },
          productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 3], [9, 4], [9, 1], [9, 2], [9, 1], [9, 4], [9, 3], [9, 6], [9, 1], [9, 1], [9, 1], [9, 1], [9, 4], [9, 4], [9, 1], [9, 2], [9, 2], [9, 1], [9, 5], [9, 5], [10, 3], [10, 3], [11, 3], [12, 3], [32, 1], [32, 1], [32, 1], [32, 1], [55, 1], [55, 1], [13, 1], [13, 1], [13, 3], [13, 3], [30, 1], [30, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 3:
                yy.setRootDoc($$[$0]);
                return $$[$0];
                break;
              case 4:
                this.$ = [];
                break;
              case 5:
                if ($$[$0] != "nl") {
                  $$[$0 - 1].push($$[$0]);
                  this.$ = $$[$0 - 1];
                }
                break;
              case 6:
              case 7:
                this.$ = $$[$0];
                break;
              case 8:
                this.$ = "nl";
                break;
              case 12:
                this.$ = $$[$0];
                break;
              case 13:
                const stateStmt = $$[$0 - 1];
                stateStmt.description = yy.trimColon($$[$0]);
                this.$ = stateStmt;
                break;
              case 14:
                this.$ = { stmt: "relation", state1: $$[$0 - 2], state2: $$[$0] };
                break;
              case 15:
                const relDescription = yy.trimColon($$[$0]);
                this.$ = { stmt: "relation", state1: $$[$0 - 3], state2: $$[$0 - 1], description: relDescription };
                break;
              case 19:
                this.$ = { stmt: "state", id: $$[$0 - 3], type: "default", description: "", doc: $$[$0 - 1] };
                break;
              case 20:
                var id34 = $$[$0];
                var description = $$[$0 - 2].trim();
                if ($$[$0].match(":")) {
                  var parts = $$[$0].split(":");
                  id34 = parts[0];
                  description = [description, parts[1]];
                }
                this.$ = { stmt: "state", id: id34, type: "default", description };
                break;
              case 21:
                this.$ = { stmt: "state", id: $$[$0 - 3], type: "default", description: $$[$0 - 5], doc: $$[$0 - 1] };
                break;
              case 22:
                this.$ = { stmt: "state", id: $$[$0], type: "fork" };
                break;
              case 23:
                this.$ = { stmt: "state", id: $$[$0], type: "join" };
                break;
              case 24:
                this.$ = { stmt: "state", id: $$[$0], type: "choice" };
                break;
              case 25:
                this.$ = { stmt: "state", id: yy.getDividerId(), type: "divider" };
                break;
              case 26:
                this.$ = { stmt: "state", id: $$[$0 - 1].trim(), note: { position: $$[$0 - 2].trim(), text: $$[$0].trim() } };
                break;
              case 29:
                this.$ = $$[$0].trim();
                yy.setAccTitle(this.$);
                break;
              case 30:
              case 31:
                this.$ = $$[$0].trim();
                yy.setAccDescription(this.$);
                break;
              case 32:
                this.$ = {
                  stmt: "click",
                  id: $$[$0 - 3],
                  url: $$[$0 - 2],
                  tooltip: $$[$0 - 1]
                };
                break;
              case 33:
                this.$ = {
                  stmt: "click",
                  id: $$[$0 - 3],
                  url: $$[$0 - 1],
                  tooltip: ""
                };
                break;
              case 34:
              case 35:
                this.$ = { stmt: "classDef", id: $$[$0 - 1].trim(), classes: $$[$0].trim() };
                break;
              case 36:
                this.$ = { stmt: "style", id: $$[$0 - 1].trim(), styleClass: $$[$0].trim() };
                break;
              case 37:
                this.$ = { stmt: "applyClass", id: $$[$0 - 1].trim(), styleClass: $$[$0].trim() };
                break;
              case 38:
                yy.setDirection("TB");
                this.$ = { stmt: "dir", value: "TB" };
                break;
              case 39:
                yy.setDirection("BT");
                this.$ = { stmt: "dir", value: "BT" };
                break;
              case 40:
                yy.setDirection("RL");
                this.$ = { stmt: "dir", value: "RL" };
                break;
              case 41:
                yy.setDirection("LR");
                this.$ = { stmt: "dir", value: "LR" };
                break;
              case 44:
              case 45:
                this.$ = { stmt: "state", id: $$[$0].trim(), type: "default", description: "" };
                break;
              case 46:
                this.$ = { stmt: "state", id: $$[$0 - 2].trim(), classes: [$$[$0].trim()], type: "default", description: "" };
                break;
              case 47:
                this.$ = { stmt: "state", id: $$[$0 - 2].trim(), classes: [$$[$0].trim()], type: "default", description: "" };
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: $V0, 5: $V1, 6: $V2 }, { 1: [3] }, { 3: 5, 4: $V0, 5: $V1, 6: $V2 }, { 3: 6, 4: $V0, 5: $V1, 6: $V2 }, o2([1, 4, 5, 16, 17, 19, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 41: $Vk, 45: $Vl, 48: $Vm, 51: $Vn, 52: $Vo, 53: $Vp, 54: $Vq, 57: $Vr }, o2($Vs, [2, 5]), { 9: 39, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 41: $Vk, 45: $Vl, 48: $Vm, 51: $Vn, 52: $Vo, 53: $Vp, 54: $Vq, 57: $Vr }, o2($Vs, [2, 7]), o2($Vs, [2, 8]), o2($Vs, [2, 9]), o2($Vs, [2, 10]), o2($Vs, [2, 11]), o2($Vs, [2, 12], { 14: [1, 40], 15: [1, 41] }), o2($Vs, [2, 16]), { 18: [1, 42] }, o2($Vs, [2, 18], { 20: [1, 43] }), { 23: [1, 44] }, o2($Vs, [2, 22]), o2($Vs, [2, 23]), o2($Vs, [2, 24]), o2($Vs, [2, 25]), { 30: 45, 31: [1, 46], 59: [1, 47], 60: [1, 48] }, o2($Vs, [2, 28]), { 34: [1, 49] }, { 36: [1, 50] }, o2($Vs, [2, 31]), { 13: 51, 24: $Va, 57: $Vr }, { 42: [1, 52], 44: [1, 53] }, { 46: [1, 54] }, { 49: [1, 55] }, o2($Vt, [2, 44], { 58: [1, 56] }), o2($Vt, [2, 45], { 58: [1, 57] }), o2($Vs, [2, 38]), o2($Vs, [2, 39]), o2($Vs, [2, 40]), o2($Vs, [2, 41]), o2($Vs, [2, 6]), o2($Vs, [2, 13]), { 13: 58, 24: $Va, 57: $Vr }, o2($Vs, [2, 17]), o2($Vu, $V3, { 7: 59 }), { 24: [1, 60] }, { 24: [1, 61] }, { 23: [1, 62] }, { 24: [2, 48] }, { 24: [2, 49] }, o2($Vs, [2, 29]), o2($Vs, [2, 30]), { 39: [1, 63], 40: [1, 64] }, { 43: [1, 65] }, { 43: [1, 66] }, { 47: [1, 67] }, { 50: [1, 68] }, { 24: [1, 69] }, { 24: [1, 70] }, o2($Vs, [2, 14], { 14: [1, 71] }), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 21: [1, 72], 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 41: $Vk, 45: $Vl, 48: $Vm, 51: $Vn, 52: $Vo, 53: $Vp, 54: $Vq, 57: $Vr }, o2($Vs, [2, 20], { 20: [1, 73] }), { 31: [1, 74] }, { 24: [1, 75] }, { 39: [1, 76] }, { 39: [1, 77] }, o2($Vs, [2, 34]), o2($Vs, [2, 35]), o2($Vs, [2, 36]), o2($Vs, [2, 37]), o2($Vt, [2, 46]), o2($Vt, [2, 47]), o2($Vs, [2, 15]), o2($Vs, [2, 19]), o2($Vu, $V3, { 7: 78 }), o2($Vs, [2, 26]), o2($Vs, [2, 27]), { 5: [1, 79] }, { 5: [1, 80] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 21: [1, 81], 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 41: $Vk, 45: $Vl, 48: $Vm, 51: $Vn, 52: $Vo, 53: $Vp, 54: $Vq, 57: $Vr }, o2($Vs, [2, 32]), o2($Vs, [2, 33]), o2($Vs, [2, 21])],
          defaultActions: { 5: [2, 1], 6: [2, 2], 47: [2, 48], 48: [2, 49] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  return 38;
                  break;
                case 1:
                  return 40;
                  break;
                case 2:
                  return 39;
                  break;
                case 3:
                  return 44;
                  break;
                case 4:
                  return 51;
                  break;
                case 5:
                  return 52;
                  break;
                case 6:
                  return 53;
                  break;
                case 7:
                  return 54;
                  break;
                case 8:
                  break;
                case 9:
                  {
                  }
                  break;
                case 10:
                  return 5;
                  break;
                case 11:
                  break;
                case 12:
                  break;
                case 13:
                  break;
                case 14:
                  break;
                case 15:
                  this.pushState("SCALE");
                  return 17;
                  break;
                case 16:
                  return 18;
                  break;
                case 17:
                  this.popState();
                  break;
                case 18:
                  this.begin("acc_title");
                  return 33;
                  break;
                case 19:
                  this.popState();
                  return "acc_title_value";
                  break;
                case 20:
                  this.begin("acc_descr");
                  return 35;
                  break;
                case 21:
                  this.popState();
                  return "acc_descr_value";
                  break;
                case 22:
                  this.begin("acc_descr_multiline");
                  break;
                case 23:
                  this.popState();
                  break;
                case 24:
                  return "acc_descr_multiline_value";
                  break;
                case 25:
                  this.pushState("CLASSDEF");
                  return 41;
                  break;
                case 26:
                  this.popState();
                  this.pushState("CLASSDEFID");
                  return "DEFAULT_CLASSDEF_ID";
                  break;
                case 27:
                  this.popState();
                  this.pushState("CLASSDEFID");
                  return 42;
                  break;
                case 28:
                  this.popState();
                  return 43;
                  break;
                case 29:
                  this.pushState("CLASS");
                  return 48;
                  break;
                case 30:
                  this.popState();
                  this.pushState("CLASS_STYLE");
                  return 49;
                  break;
                case 31:
                  this.popState();
                  return 50;
                  break;
                case 32:
                  this.pushState("STYLE");
                  return 45;
                  break;
                case 33:
                  this.popState();
                  this.pushState("STYLEDEF_STYLES");
                  return 46;
                  break;
                case 34:
                  this.popState();
                  return 47;
                  break;
                case 35:
                  this.pushState("SCALE");
                  return 17;
                  break;
                case 36:
                  return 18;
                  break;
                case 37:
                  this.popState();
                  break;
                case 38:
                  this.pushState("STATE");
                  break;
                case 39:
                  this.popState();
                  yy_.yytext = yy_.yytext.slice(0, -8).trim();
                  return 25;
                  break;
                case 40:
                  this.popState();
                  yy_.yytext = yy_.yytext.slice(0, -8).trim();
                  return 26;
                  break;
                case 41:
                  this.popState();
                  yy_.yytext = yy_.yytext.slice(0, -10).trim();
                  return 27;
                  break;
                case 42:
                  this.popState();
                  yy_.yytext = yy_.yytext.slice(0, -8).trim();
                  return 25;
                  break;
                case 43:
                  this.popState();
                  yy_.yytext = yy_.yytext.slice(0, -8).trim();
                  return 26;
                  break;
                case 44:
                  this.popState();
                  yy_.yytext = yy_.yytext.slice(0, -10).trim();
                  return 27;
                  break;
                case 45:
                  return 51;
                  break;
                case 46:
                  return 52;
                  break;
                case 47:
                  return 53;
                  break;
                case 48:
                  return 54;
                  break;
                case 49:
                  this.pushState("STATE_STRING");
                  break;
                case 50:
                  this.pushState("STATE_ID");
                  return "AS";
                  break;
                case 51:
                  this.popState();
                  return "ID";
                  break;
                case 52:
                  this.popState();
                  break;
                case 53:
                  return "STATE_DESCR";
                  break;
                case 54:
                  return 19;
                  break;
                case 55:
                  this.popState();
                  break;
                case 56:
                  this.popState();
                  this.pushState("struct");
                  return 20;
                  break;
                case 57:
                  break;
                case 58:
                  this.popState();
                  return 21;
                  break;
                case 59:
                  break;
                case 60:
                  this.begin("NOTE");
                  return 29;
                  break;
                case 61:
                  this.popState();
                  this.pushState("NOTE_ID");
                  return 59;
                  break;
                case 62:
                  this.popState();
                  this.pushState("NOTE_ID");
                  return 60;
                  break;
                case 63:
                  this.popState();
                  this.pushState("FLOATING_NOTE");
                  break;
                case 64:
                  this.popState();
                  this.pushState("FLOATING_NOTE_ID");
                  return "AS";
                  break;
                case 65:
                  break;
                case 66:
                  return "NOTE_TEXT";
                  break;
                case 67:
                  this.popState();
                  return "ID";
                  break;
                case 68:
                  this.popState();
                  this.pushState("NOTE_TEXT");
                  return 24;
                  break;
                case 69:
                  this.popState();
                  yy_.yytext = yy_.yytext.substr(2).trim();
                  return 31;
                  break;
                case 70:
                  this.popState();
                  yy_.yytext = yy_.yytext.slice(0, -8).trim();
                  return 31;
                  break;
                case 71:
                  return 6;
                  break;
                case 72:
                  return 6;
                  break;
                case 73:
                  return 16;
                  break;
                case 74:
                  return 57;
                  break;
                case 75:
                  return 24;
                  break;
                case 76:
                  yy_.yytext = yy_.yytext.trim();
                  return 14;
                  break;
                case 77:
                  return 15;
                  break;
                case 78:
                  return 28;
                  break;
                case 79:
                  return 58;
                  break;
                case 80:
                  return 5;
                  break;
                case 81:
                  return "INVALID";
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:click\b)/i, /^(?:href\b)/i, /^(?:"[^"]*")/i, /^(?:default\b)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:[\s]+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:classDef\s+)/i, /^(?:DEFAULT\s+)/i, /^(?:\w+\s+)/i, /^(?:[^\n]*)/i, /^(?:class\s+)/i, /^(?:(\w+)+((,\s*\w+)*))/i, /^(?:[^\n]*)/i, /^(?:style\s+)/i, /^(?:[\w,]+\s+)/i, /^(?:[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:state\s+)/i, /^(?:.*<<fork>>)/i, /^(?:.*<<join>>)/i, /^(?:.*<<choice>>)/i, /^(?:.*\[\[fork\]\])/i, /^(?:.*\[\[join\]\])/i, /^(?:.*\[\[choice\]\])/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:["])/i, /^(?:\s*as\s+)/i, /^(?:[^\n\{]*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n\s\{]+)/i, /^(?:\n)/i, /^(?:\{)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:\})/i, /^(?:[\n])/i, /^(?:note\s+)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:")/i, /^(?:\s*as\s*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n]*)/i, /^(?:\s*[^:\n\s\-]+)/i, /^(?:\s*:[^:\n;]+)/i, /^(?:[\s\S]*?end note\b)/i, /^(?:stateDiagram\s+)/i, /^(?:stateDiagram-v2\s+)/i, /^(?:hide empty description\b)/i, /^(?:\[\*\])/i, /^(?:[^:\n\s\-\{]+)/i, /^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i, /^(?:-->)/i, /^(?:--)/i, /^(?::::)/i, /^(?:$)/i, /^(?:.)/i],
            conditions: { "LINE": { "rules": [12, 13], "inclusive": false }, "struct": { "rules": [12, 13, 25, 29, 32, 38, 45, 46, 47, 48, 57, 58, 59, 60, 74, 75, 76, 77, 78, 79], "inclusive": false }, "FLOATING_NOTE_ID": { "rules": [67], "inclusive": false }, "FLOATING_NOTE": { "rules": [64, 65, 66], "inclusive": false }, "NOTE_TEXT": { "rules": [69, 70], "inclusive": false }, "NOTE_ID": { "rules": [68], "inclusive": false }, "NOTE": { "rules": [61, 62, 63], "inclusive": false }, "STYLEDEF_STYLEOPTS": { "rules": [], "inclusive": false }, "STYLEDEF_STYLES": { "rules": [34], "inclusive": false }, "STYLE_IDS": { "rules": [], "inclusive": false }, "STYLE": { "rules": [33], "inclusive": false }, "CLASS_STYLE": { "rules": [31], "inclusive": false }, "CLASS": { "rules": [30], "inclusive": false }, "CLASSDEFID": { "rules": [28], "inclusive": false }, "CLASSDEF": { "rules": [26, 27], "inclusive": false }, "acc_descr_multiline": { "rules": [23, 24], "inclusive": false }, "acc_descr": { "rules": [21], "inclusive": false }, "acc_title": { "rules": [19], "inclusive": false }, "SCALE": { "rules": [16, 17, 36, 37], "inclusive": false }, "ALIAS": { "rules": [], "inclusive": false }, "STATE_ID": { "rules": [51], "inclusive": false }, "STATE_STRING": { "rules": [52, 53], "inclusive": false }, "FORK_STATE": { "rules": [], "inclusive": false }, "STATE": { "rules": [12, 13, 39, 40, 41, 42, 43, 44, 49, 50, 54, 55, 56], "inclusive": false }, "ID": { "rules": [12, 13], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 18, 20, 22, 25, 29, 32, 35, 38, 56, 60, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser13.parser = parser13;
      stateDiagram_default = parser13;
    }
  });

  // src/diagrams/state/stateCommon.ts
  var DEFAULT_DIAGRAM_DIRECTION, DEFAULT_NESTED_DOC_DIR, STMT_DIRECTION, STMT_STATE, STMT_ROOT, STMT_RELATION, STMT_CLASSDEF, STMT_STYLEDEF, STMT_APPLYCLASS, DEFAULT_STATE_TYPE, DIVIDER_TYPE, G_EDGE_STYLE, G_EDGE_ARROWHEADSTYLE, G_EDGE_LABELPOS, G_EDGE_LABELTYPE, G_EDGE_THICKNESS, SHAPE_STATE, SHAPE_STATE_WITH_DESC, SHAPE_START, SHAPE_END, SHAPE_DIVIDER, SHAPE_GROUP, SHAPE_NOTE, SHAPE_NOTEGROUP, CSS_DIAGRAM, CSS_STATE, CSS_DIAGRAM_STATE, CSS_EDGE, CSS_NOTE, CSS_NOTE_EDGE, CSS_EDGE_NOTE_EDGE, CSS_DIAGRAM_NOTE, CSS_CLUSTER, CSS_DIAGRAM_CLUSTER, CSS_CLUSTER_ALT, CSS_DIAGRAM_CLUSTER_ALT, PARENT2, NOTE, DOMID_STATE, DOMID_TYPE_SPACER, NOTE_ID, PARENT_ID;
  var init_stateCommon = __esm({
    "src/diagrams/state/stateCommon.ts"() {
      "use strict";
      DEFAULT_DIAGRAM_DIRECTION = "TB";
      DEFAULT_NESTED_DOC_DIR = "TB";
      STMT_DIRECTION = "dir";
      STMT_STATE = "state";
      STMT_ROOT = "root";
      STMT_RELATION = "relation";
      STMT_CLASSDEF = "classDef";
      STMT_STYLEDEF = "style";
      STMT_APPLYCLASS = "applyClass";
      DEFAULT_STATE_TYPE = "default";
      DIVIDER_TYPE = "divider";
      G_EDGE_STYLE = "fill:none";
      G_EDGE_ARROWHEADSTYLE = "fill: #333";
      G_EDGE_LABELPOS = "c";
      G_EDGE_LABELTYPE = "markdown";
      G_EDGE_THICKNESS = "normal";
      SHAPE_STATE = "rect";
      SHAPE_STATE_WITH_DESC = "rectWithTitle";
      SHAPE_START = "stateStart";
      SHAPE_END = "stateEnd";
      SHAPE_DIVIDER = "divider";
      SHAPE_GROUP = "roundedWithTitle";
      SHAPE_NOTE = "note";
      SHAPE_NOTEGROUP = "noteGroup";
      CSS_DIAGRAM = "statediagram";
      CSS_STATE = "state";
      CSS_DIAGRAM_STATE = `${CSS_DIAGRAM}-${CSS_STATE}`;
      CSS_EDGE = "transition";
      CSS_NOTE = "note";
      CSS_NOTE_EDGE = "note-edge";
      CSS_EDGE_NOTE_EDGE = `${CSS_EDGE} ${CSS_NOTE_EDGE}`;
      CSS_DIAGRAM_NOTE = `${CSS_DIAGRAM}-${CSS_NOTE}`;
      CSS_CLUSTER = "cluster";
      CSS_DIAGRAM_CLUSTER = `${CSS_DIAGRAM}-${CSS_CLUSTER}`;
      CSS_CLUSTER_ALT = "cluster-alt";
      CSS_DIAGRAM_CLUSTER_ALT = `${CSS_DIAGRAM}-${CSS_CLUSTER_ALT}`;
      PARENT2 = "parent";
      NOTE = "note";
      DOMID_STATE = "state";
      DOMID_TYPE_SPACER = "----";
      NOTE_ID = `${DOMID_TYPE_SPACER}${NOTE}`;
      PARENT_ID = `${DOMID_TYPE_SPACER}${PARENT2}`;
    }
  });

  // src/diagrams/state/dataFetcher.ts
  function stateDomId(itemId = "", counter2 = 0, type3 = "", typeSpacer = DOMID_TYPE_SPACER) {
    const typeStr = type3 !== null && type3.length > 0 ? `${typeSpacer}${type3}` : "";
    return `${DOMID_STATE}-${itemId}${typeStr}-${counter2}`;
  }
  function insertOrUpdateNode(nodes5, nodeData2, classes3) {
    if (!nodeData2.id || nodeData2.id === "</join></fork>" || nodeData2.id === "</choice>") {
      return;
    }
    if (nodeData2.cssClasses) {
      if (!Array.isArray(nodeData2.cssCompiledStyles)) {
        nodeData2.cssCompiledStyles = [];
      }
      nodeData2.cssClasses.split(" ").forEach((cssClass) => {
        const classDef = classes3.get(cssClass);
        if (classDef) {
          nodeData2.cssCompiledStyles = [...nodeData2.cssCompiledStyles ?? [], ...classDef.styles];
        }
      });
    }
    const existingNodeData = nodes5.find((node2) => node2.id === nodeData2.id);
    if (existingNodeData) {
      Object.assign(existingNodeData, nodeData2);
    } else {
      nodes5.push(nodeData2);
    }
  }
  function getClassesFromDbInfo(dbInfoItem) {
    return dbInfoItem?.classes?.join(" ") ?? "";
  }
  function getStylesFromDbInfo(dbInfoItem) {
    return dbInfoItem?.styles ?? [];
  }
  var nodeDb, graphItemCount, setupDoc, getDir2, dataFetcher, reset3;
  var init_dataFetcher = __esm({
    "src/diagrams/state/dataFetcher.ts"() {
      "use strict";
      init_diagramAPI();
      init_logger();
      init_common();
      init_stateCommon();
      nodeDb = /* @__PURE__ */ new Map();
      graphItemCount = 0;
      __name(stateDomId, "stateDomId");
      setupDoc = /* @__PURE__ */ __name((parentParsedItem, doc, diagramStates, nodes5, edges3, altFlag, look, classes3) => {
        log.trace("items", doc);
        doc.forEach((item) => {
          switch (item.stmt) {
            case STMT_STATE:
              dataFetcher(parentParsedItem, item, diagramStates, nodes5, edges3, altFlag, look, classes3);
              break;
            case DEFAULT_STATE_TYPE:
              dataFetcher(parentParsedItem, item, diagramStates, nodes5, edges3, altFlag, look, classes3);
              break;
            case STMT_RELATION:
              {
                dataFetcher(
                  parentParsedItem,
                  item.state1,
                  diagramStates,
                  nodes5,
                  edges3,
                  altFlag,
                  look,
                  classes3
                );
                dataFetcher(
                  parentParsedItem,
                  item.state2,
                  diagramStates,
                  nodes5,
                  edges3,
                  altFlag,
                  look,
                  classes3
                );
                const isNeo = look === "neo";
                const edgeData2 = {
                  id: "edge" + graphItemCount,
                  start: item.state1.id,
                  end: item.state2.id,
                  arrowhead: "normal",
                  arrowTypeEnd: isNeo ? "arrow_barb_neo" : "arrow_barb",
                  style: G_EDGE_STYLE,
                  labelStyle: "",
                  label: common_default.sanitizeText(item.description ?? "", getConfig2()),
                  arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
                  labelpos: G_EDGE_LABELPOS,
                  labelType: G_EDGE_LABELTYPE,
                  thickness: G_EDGE_THICKNESS,
                  classes: CSS_EDGE,
                  look
                };
                edges3.push(edgeData2);
                graphItemCount++;
              }
              break;
          }
        });
      }, "setupDoc");
      getDir2 = /* @__PURE__ */ __name((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
        let dir2 = defaultDir;
        if (parsedItem.doc) {
          for (const parsedItemDoc of parsedItem.doc) {
            if (parsedItemDoc.stmt === "dir") {
              dir2 = parsedItemDoc.value;
            }
          }
        }
        return dir2;
      }, "getDir");
      __name(insertOrUpdateNode, "insertOrUpdateNode");
      __name(getClassesFromDbInfo, "getClassesFromDbInfo");
      __name(getStylesFromDbInfo, "getStylesFromDbInfo");
      dataFetcher = /* @__PURE__ */ __name((parent4, parsedItem, diagramStates, nodes5, edges3, altFlag, look, classes3) => {
        const itemId = parsedItem.id;
        const dbState = diagramStates.get(itemId);
        const classStr = getClassesFromDbInfo(dbState);
        const style3 = getStylesFromDbInfo(dbState);
        const config5 = getConfig2();
        log.info("dataFetcher parsedItem", parsedItem, dbState, style3);
        if (itemId !== "root") {
          let shape = SHAPE_STATE;
          if (parsedItem.start === true) {
            shape = SHAPE_START;
          } else if (parsedItem.start === false) {
            shape = SHAPE_END;
          }
          if (parsedItem.type !== DEFAULT_STATE_TYPE) {
            shape = parsedItem.type;
          }
          if (!nodeDb.get(itemId)) {
            nodeDb.set(itemId, {
              id: itemId,
              shape,
              description: common_default.sanitizeText(itemId, config5),
              cssClasses: `${classStr} ${CSS_DIAGRAM_STATE}`,
              cssStyles: style3
            });
          }
          const newNode = nodeDb.get(itemId);
          if (parsedItem.description) {
            if (Array.isArray(newNode.description)) {
              newNode.shape = SHAPE_STATE_WITH_DESC;
              newNode.description.push(parsedItem.description);
            } else {
              if (newNode.description?.length && newNode.description.length > 0) {
                newNode.shape = SHAPE_STATE_WITH_DESC;
                if (newNode.description === itemId) {
                  newNode.description = [parsedItem.description];
                } else {
                  newNode.description = [newNode.description, parsedItem.description];
                }
              } else {
                newNode.shape = SHAPE_STATE;
                newNode.description = parsedItem.description;
              }
            }
            newNode.description = common_default.sanitizeTextOrArray(newNode.description, config5);
          }
          if (newNode.description?.length === 1 && newNode.shape === SHAPE_STATE_WITH_DESC) {
            if (newNode.type === "group") {
              newNode.shape = SHAPE_GROUP;
            } else {
              newNode.shape = SHAPE_STATE;
            }
          }
          if (!newNode.type && parsedItem.doc) {
            log.info("Setting cluster for XCX", itemId, getDir2(parsedItem));
            newNode.type = "group";
            newNode.isGroup = true;
            newNode.dir = getDir2(parsedItem);
            newNode.shape = parsedItem.type === DIVIDER_TYPE ? SHAPE_DIVIDER : SHAPE_GROUP;
            newNode.cssClasses = `${newNode.cssClasses} ${CSS_DIAGRAM_CLUSTER} ${altFlag ? CSS_DIAGRAM_CLUSTER_ALT : ""}`;
          }
          const nodeData2 = {
            labelStyle: "",
            shape: newNode.shape,
            label: newNode.description,
            cssClasses: newNode.cssClasses,
            cssCompiledStyles: [],
            cssStyles: newNode.cssStyles,
            id: itemId,
            dir: newNode.dir,
            domId: stateDomId(itemId, graphItemCount),
            type: newNode.type,
            isGroup: newNode.type === "group",
            padding: 8,
            rx: 10,
            ry: 10,
            look,
            labelType: "markdown"
          };
          if (nodeData2.shape === SHAPE_DIVIDER) {
            nodeData2.label = "";
          }
          if (parent4 && parent4.id !== "root") {
            log.trace("Setting node ", itemId, " to be child of its parent ", parent4.id);
            nodeData2.parentId = parent4.id;
          }
          nodeData2.centerLabel = true;
          if (parsedItem.note) {
            const noteData = {
              labelStyle: "",
              shape: SHAPE_NOTE,
              label: parsedItem.note.text,
              labelType: "markdown",
              cssClasses: CSS_DIAGRAM_NOTE,
              // useHtmlLabels: false,
              cssStyles: [],
              cssCompiledStyles: [],
              id: itemId + NOTE_ID + "-" + graphItemCount,
              domId: stateDomId(itemId, graphItemCount, NOTE),
              type: newNode.type,
              isGroup: newNode.type === "group",
              padding: config5.flowchart?.padding,
              look,
              position: parsedItem.note.position
            };
            const parentNodeId = itemId + PARENT_ID;
            const groupData = {
              labelStyle: "",
              shape: SHAPE_NOTEGROUP,
              label: parsedItem.note.text,
              cssClasses: newNode.cssClasses,
              cssStyles: [],
              id: itemId + PARENT_ID,
              domId: stateDomId(itemId, graphItemCount, PARENT2),
              type: "group",
              isGroup: true,
              padding: 16,
              //getConfig().flowchart.padding
              look,
              position: parsedItem.note.position
            };
            graphItemCount++;
            groupData.id = parentNodeId;
            noteData.parentId = parentNodeId;
            insertOrUpdateNode(nodes5, groupData, classes3);
            insertOrUpdateNode(nodes5, noteData, classes3);
            insertOrUpdateNode(nodes5, nodeData2, classes3);
            let from2 = itemId;
            let to = noteData.id;
            if (parsedItem.note.position === "left of") {
              from2 = noteData.id;
              to = itemId;
            }
            edges3.push({
              id: from2 + "-" + to,
              start: from2,
              end: to,
              arrowhead: "none",
              arrowTypeEnd: "",
              style: G_EDGE_STYLE,
              labelStyle: "",
              classes: CSS_EDGE_NOTE_EDGE,
              arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
              labelpos: G_EDGE_LABELPOS,
              labelType: G_EDGE_LABELTYPE,
              thickness: G_EDGE_THICKNESS,
              look
            });
          } else {
            insertOrUpdateNode(nodes5, nodeData2, classes3);
          }
        }
        if (parsedItem.doc) {
          log.trace("Adding nodes children ");
          setupDoc(parsedItem, parsedItem.doc, diagramStates, nodes5, edges3, !altFlag, look, classes3);
        }
      }, "dataFetcher");
      reset3 = /* @__PURE__ */ __name(() => {
        nodeDb.clear();
        graphItemCount = 0;
      }, "reset");
    }
  });

  // src/diagrams/state/stateRenderer-v3-unified.ts
  var getDir3, getClasses3, draw13, stateRenderer_v3_unified_default;
  var init_stateRenderer_v3_unified = __esm({
    "src/diagrams/state/stateRenderer-v3-unified.ts"() {
      "use strict";
      init_diagramAPI();
      init_logger();
      init_insertElementsForSize();
      init_render2();
      init_setupViewPortForSVG();
      init_utils2();
      init_stateCommon();
      getDir3 = /* @__PURE__ */ __name((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
        if (!parsedItem.doc) {
          return defaultDir;
        }
        let dir2 = defaultDir;
        for (const parsedItemDoc of parsedItem.doc) {
          if (parsedItemDoc.stmt === "dir") {
            dir2 = parsedItemDoc.value;
          }
        }
        return dir2;
      }, "getDir");
      getClasses3 = /* @__PURE__ */ __name(function(text4, diagramObj) {
        return diagramObj.db.getClasses();
      }, "getClasses");
      draw13 = /* @__PURE__ */ __name(async function(text4, id34, _version, diag) {
        log.info("REF0:");
        log.info("Drawing state diagram (v2)", id34);
        const { securityLevel, state: conf5, layout: layout7 } = getConfig2();
        diag.db.extract(diag.db.getRootDocV2());
        const data4Layout = diag.db.getData();
        const svg2 = getDiagramElement(id34, securityLevel);
        data4Layout.type = diag.type;
        data4Layout.layoutAlgorithm = layout7;
        data4Layout.nodeSpacing = conf5?.nodeSpacing || 50;
        data4Layout.rankSpacing = conf5?.rankSpacing || 50;
        const config5 = getConfig2();
        if (config5.look === "neo") {
          data4Layout.markers = ["barbNeo"];
        } else {
          data4Layout.markers = ["barb"];
        }
        data4Layout.diagramId = id34;
        await render6(data4Layout, svg2);
        const padding2 = 8;
        try {
          const links3 = typeof diag.db.getLinks === "function" ? diag.db.getLinks() : /* @__PURE__ */ new Map();
          links3.forEach((linkInfo, key) => {
            const stateId = typeof key === "string" ? key : typeof key?.id === "string" ? key.id : "";
            if (!stateId) {
              log.warn("\u26A0\uFE0F Invalid or missing stateId from key:", JSON.stringify(key));
              return;
            }
            const allNodes = svg2.node()?.querySelectorAll("g");
            let matchedElem;
            allNodes?.forEach((g2) => {
              const text5 = g2.textContent?.trim();
              if (text5 === stateId) {
                matchedElem = g2;
              }
            });
            if (!matchedElem) {
              log.warn("\u26A0\uFE0F Could not find node matching text:", stateId);
              return;
            }
            const parent4 = matchedElem.parentNode;
            if (!parent4) {
              log.warn("\u26A0\uFE0F Node has no parent, cannot wrap:", stateId);
              return;
            }
            const a2 = document.createElementNS("http://www.w3.org/2000/svg", "a");
            const cleanedUrl = linkInfo.url.replace(/^"+|"+$/g, "");
            a2.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", cleanedUrl);
            a2.setAttribute("target", "_blank");
            if (linkInfo.tooltip) {
              const tooltip = linkInfo.tooltip.replace(/^"+|"+$/g, "");
              a2.setAttribute("title", tooltip);
            }
            parent4.replaceChild(a2, matchedElem);
            a2.appendChild(matchedElem);
            log.info("\u{1F517} Wrapped node in <a> tag for:", stateId, linkInfo.url);
          });
        } catch (err) {
          log.error("\u274C Error injecting clickable links:", err);
        }
        utils_default2.insertTitle(
          svg2,
          "statediagramTitleText",
          conf5?.titleTopMargin ?? 25,
          diag.db.getDiagramTitle()
        );
        setupViewPortForSVG(svg2, padding2, CSS_DIAGRAM, conf5?.useMaxWidth ?? true);
      }, "draw");
      stateRenderer_v3_unified_default = {
        getClasses: getClasses3,
        draw: draw13,
        getDir: getDir3
      };
    }
  });

  // src/diagrams/state/stateDb.ts
  var CONSTANTS, newClassesList, newDoc, clone5, StateDB;
  var init_stateDb = __esm({
    "src/diagrams/state/stateDb.ts"() {
      "use strict";
      init_diagramAPI();
      init_logger();
      init_utils2();
      init_common();
      init_commonDb();
      init_dataFetcher();
      init_stateRenderer_v3_unified();
      init_stateCommon();
      CONSTANTS = {
        START_NODE: "[*]",
        START_TYPE: "start",
        END_NODE: "[*]",
        END_TYPE: "end",
        COLOR_KEYWORD: "color",
        FILL_KEYWORD: "fill",
        BG_FILL: "bgFill",
        STYLECLASS_SEP: ","
      };
      newClassesList = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Map(), "newClassesList");
      newDoc = /* @__PURE__ */ __name(() => ({
        relations: [],
        states: /* @__PURE__ */ new Map(),
        documents: {}
      }), "newDoc");
      clone5 = /* @__PURE__ */ __name((o2) => JSON.parse(JSON.stringify(o2)), "clone");
      StateDB = class {
        constructor(version3) {
          this.version = version3;
          this.nodes = [];
          this.edges = [];
          this.rootDoc = [];
          this.classes = newClassesList();
          this.documents = { root: newDoc() };
          this.currentDocument = this.documents.root;
          this.startEndCount = 0;
          this.dividerCnt = 0;
          this.links = /* @__PURE__ */ new Map();
          this.getAccTitle = getAccTitle;
          this.setAccTitle = setAccTitle;
          this.getAccDescription = getAccDescription;
          this.setAccDescription = setAccDescription;
          this.setDiagramTitle = setDiagramTitle;
          this.getDiagramTitle = getDiagramTitle;
          this.clear();
          this.setRootDoc = this.setRootDoc.bind(this);
          this.getDividerId = this.getDividerId.bind(this);
          this.setDirection = this.setDirection.bind(this);
          this.trimColon = this.trimColon.bind(this);
        }
        static {
          __name(this, "StateDB");
        }
        static {
          this.relationType = {
            AGGREGATION: 0,
            EXTENSION: 1,
            COMPOSITION: 2,
            DEPENDENCY: 3
          };
        }
        /**
         * Convert all of the statements (stmts) that were parsed into states and relationships.
         * This is done because a state diagram may have nested sections,
         * where each section is a 'document' and has its own set of statements.
         * Ex: the section within a fork has its own statements, and incoming and outgoing statements
         * refer to the fork as a whole (document).
         * See the parser grammar:  the definition of a document is a document then a 'line', where a line can be a statement.
         * This will push the statement into the list of statements for the current document.
         */
        extract(statements) {
          this.clear(true);
          for (const item of Array.isArray(statements) ? statements : statements.doc) {
            switch (item.stmt) {
              case STMT_STATE:
                this.addState(item.id.trim(), item.type, item.doc, item.description, item.note);
                break;
              case STMT_RELATION:
                this.addRelation(item.state1, item.state2, item.description);
                break;
              case STMT_CLASSDEF:
                this.addStyleClass(item.id.trim(), item.classes);
                break;
              case STMT_STYLEDEF:
                this.handleStyleDef(item);
                break;
              case STMT_APPLYCLASS:
                this.setCssClass(item.id.trim(), item.styleClass);
                break;
              case "click":
                this.addLink(item.id, item.url, item.tooltip);
                break;
            }
          }
          const diagramStates = this.getStates();
          const config5 = getConfig2();
          reset3();
          dataFetcher(
            void 0,
            this.getRootDocV2(),
            diagramStates,
            this.nodes,
            this.edges,
            true,
            config5.look,
            this.classes
          );
          for (const node2 of this.nodes) {
            if (!Array.isArray(node2.label)) {
              continue;
            }
            node2.description = node2.label.slice(1);
            if (node2.isGroup && node2.description.length > 0) {
              throw new Error(
                `Group nodes can only have label. Remove the additional description for node [${node2.id}]`
              );
            }
            node2.label = node2.label[0];
          }
        }
        handleStyleDef(item) {
          const ids = item.id.trim().split(",");
          const styles5 = item.styleClass.split(",");
          for (const id34 of ids) {
            let state4 = this.getState(id34);
            if (!state4) {
              const trimmedId = id34.trim();
              this.addState(trimmedId);
              state4 = this.getState(trimmedId);
            }
            if (state4) {
              state4.styles = styles5.map((s2) => s2.replace(/;/g, "")?.trim());
            }
          }
        }
        setRootDoc(o2) {
          log.info("Setting root doc", o2);
          this.rootDoc = o2;
          if (this.version === 1) {
            this.extract(o2);
          } else {
            this.extract(this.getRootDocV2());
          }
        }
        docTranslator(parent4, node2, first3) {
          if (node2.stmt === STMT_RELATION) {
            this.docTranslator(parent4, node2.state1, true);
            this.docTranslator(parent4, node2.state2, false);
            return;
          }
          if (node2.stmt === STMT_STATE) {
            if (node2.id === CONSTANTS.START_NODE) {
              node2.id = parent4.id + (first3 ? "_start" : "_end");
              node2.start = first3;
            } else {
              node2.id = node2.id.trim();
            }
          }
          if (node2.stmt !== STMT_ROOT && node2.stmt !== STMT_STATE || !node2.doc) {
            return;
          }
          const doc = [];
          let currentDoc = [];
          for (const stmt of node2.doc) {
            if (stmt.type === DIVIDER_TYPE) {
              const newNode = clone5(stmt);
              newNode.doc = clone5(currentDoc);
              doc.push(newNode);
              currentDoc = [];
            } else {
              currentDoc.push(stmt);
            }
          }
          if (doc.length > 0 && currentDoc.length > 0) {
            const newNode = {
              stmt: STMT_STATE,
              id: generateId(),
              type: "divider",
              doc: clone5(currentDoc)
            };
            doc.push(clone5(newNode));
            node2.doc = doc;
          }
          node2.doc.forEach((docNode) => this.docTranslator(node2, docNode, true));
        }
        getRootDocV2() {
          this.docTranslator(
            { id: STMT_ROOT, stmt: STMT_ROOT },
            { id: STMT_ROOT, stmt: STMT_ROOT, doc: this.rootDoc },
            true
          );
          return { id: STMT_ROOT, doc: this.rootDoc };
        }
        /**
         * Function called by parser when a node definition has been found.
         *
         * @param descr - description for the state. Can be a string or a list or strings
         * @param classes - class styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 class, convert it to an array of that 1 class.
         * @param styles - styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 style, convert it to an array of that 1 style.
         * @param textStyles - text styles to apply to this state. Can be a string (1 text test) or an array of text styles. If it's just 1 text style, convert it to an array of that 1 text style.
         */
        addState(id34, type3 = DEFAULT_STATE_TYPE, doc = void 0, descr = void 0, note3 = void 0, classes3 = void 0, styles5 = void 0, textStyles = void 0) {
          const trimmedId = id34?.trim();
          if (!this.currentDocument.states.has(trimmedId)) {
            log.info("Adding state ", trimmedId, descr);
            this.currentDocument.states.set(trimmedId, {
              stmt: STMT_STATE,
              id: trimmedId,
              descriptions: [],
              type: type3,
              doc,
              note: note3,
              classes: [],
              styles: [],
              textStyles: []
            });
          } else {
            const state4 = this.currentDocument.states.get(trimmedId);
            if (!state4) {
              throw new Error(`State not found: ${trimmedId}`);
            }
            if (!state4.doc) {
              state4.doc = doc;
            }
            if (!state4.type) {
              state4.type = type3;
            }
          }
          if (descr) {
            log.info("Setting state description", trimmedId, descr);
            const descriptions = Array.isArray(descr) ? descr : [descr];
            descriptions.forEach((des) => this.addDescription(trimmedId, des.trim()));
          }
          if (note3) {
            const doc2 = this.currentDocument.states.get(trimmedId);
            if (!doc2) {
              throw new Error(`State not found: ${trimmedId}`);
            }
            doc2.note = note3;
            doc2.note.text = common_default.sanitizeText(doc2.note.text, getConfig2());
          }
          if (classes3) {
            log.info("Setting state classes", trimmedId, classes3);
            const classesList = Array.isArray(classes3) ? classes3 : [classes3];
            classesList.forEach((cssClass) => this.setCssClass(trimmedId, cssClass.trim()));
          }
          if (styles5) {
            log.info("Setting state styles", trimmedId, styles5);
            const stylesList = Array.isArray(styles5) ? styles5 : [styles5];
            stylesList.forEach((style3) => this.setStyle(trimmedId, style3.trim()));
          }
          if (textStyles) {
            log.info("Setting state styles", trimmedId, styles5);
            const textStylesList = Array.isArray(textStyles) ? textStyles : [textStyles];
            textStylesList.forEach((textStyle) => this.setTextStyle(trimmedId, textStyle.trim()));
          }
        }
        clear(saveCommon) {
          this.nodes = [];
          this.edges = [];
          this.documents = { root: newDoc() };
          this.currentDocument = this.documents.root;
          this.startEndCount = 0;
          this.classes = newClassesList();
          if (!saveCommon) {
            this.links = /* @__PURE__ */ new Map();
            clear();
          }
        }
        getState(id34) {
          return this.currentDocument.states.get(id34);
        }
        getStates() {
          return this.currentDocument.states;
        }
        logDocuments() {
          log.info("Documents = ", this.documents);
        }
        getRelations() {
          return this.currentDocument.relations;
        }
        /**
         * Adds a clickable link to a state.
         */
        addLink(stateId, url, tooltip) {
          this.links.set(stateId, { url, tooltip });
          log.warn("Adding link", stateId, url, tooltip);
        }
        /**
         * Get all registered links.
         */
        getLinks() {
          return this.links;
        }
        /**
         * If the id is a start node ( [*] ), then return a new id constructed from
         * the start node name and the current start node count.
         * else return the given id
         */
        startIdIfNeeded(id34 = "") {
          if (id34 === CONSTANTS.START_NODE) {
            this.startEndCount++;
            return `${CONSTANTS.START_TYPE}${this.startEndCount}`;
          }
          return id34;
        }
        /**
         * If the id is a start node ( [*] ), then return the start type ('start')
         * else return the given type
         */
        startTypeIfNeeded(id34 = "", type3 = DEFAULT_STATE_TYPE) {
          return id34 === CONSTANTS.START_NODE ? CONSTANTS.START_TYPE : type3;
        }
        /**
         * If the id is an end node ( [*] ), then return a new id constructed from
         * the end node name and the current start_end node count.
         * else return the given id
         */
        endIdIfNeeded(id34 = "") {
          if (id34 === CONSTANTS.END_NODE) {
            this.startEndCount++;
            return `${CONSTANTS.END_TYPE}${this.startEndCount}`;
          }
          return id34;
        }
        /**
         * If the id is an end node ( [*] ), then return the end type
         * else return the given type
         *
         */
        endTypeIfNeeded(id34 = "", type3 = DEFAULT_STATE_TYPE) {
          return id34 === CONSTANTS.END_NODE ? CONSTANTS.END_TYPE : type3;
        }
        addRelationObjs(item1, item2, relationTitle = "") {
          const id1 = this.startIdIfNeeded(item1.id.trim());
          const type1 = this.startTypeIfNeeded(item1.id.trim(), item1.type);
          const id210 = this.startIdIfNeeded(item2.id.trim());
          const type22 = this.startTypeIfNeeded(item2.id.trim(), item2.type);
          this.addState(
            id1,
            type1,
            item1.doc,
            item1.description,
            item1.note,
            item1.classes,
            item1.styles,
            item1.textStyles
          );
          this.addState(
            id210,
            type22,
            item2.doc,
            item2.description,
            item2.note,
            item2.classes,
            item2.styles,
            item2.textStyles
          );
          this.currentDocument.relations.push({
            id1,
            id2: id210,
            relationTitle: common_default.sanitizeText(relationTitle, getConfig2())
          });
        }
        /**
         * Add a relation between two items.  The items may be full objects or just the string id of a state.
         */
        addRelation(item1, item2, title2) {
          if (typeof item1 === "object" && typeof item2 === "object") {
            this.addRelationObjs(item1, item2, title2);
          } else if (typeof item1 === "string" && typeof item2 === "string") {
            const id1 = this.startIdIfNeeded(item1.trim());
            const type1 = this.startTypeIfNeeded(item1);
            const id210 = this.endIdIfNeeded(item2.trim());
            const type22 = this.endTypeIfNeeded(item2);
            this.addState(id1, type1);
            this.addState(id210, type22);
            this.currentDocument.relations.push({
              id1,
              id2: id210,
              relationTitle: title2 ? common_default.sanitizeText(title2, getConfig2()) : void 0
            });
          }
        }
        addDescription(id34, descr) {
          const theState = this.currentDocument.states.get(id34);
          const _descr = descr.startsWith(":") ? descr.replace(":", "").trim() : descr;
          theState?.descriptions?.push(common_default.sanitizeText(_descr, getConfig2()));
        }
        cleanupLabel(label) {
          return label.startsWith(":") ? label.slice(2).trim() : label.trim();
        }
        getDividerId() {
          this.dividerCnt++;
          return `divider-id-${this.dividerCnt}`;
        }
        /**
         * Called when the parser comes across a (style) class definition
         * @example classDef my-style fill:#f96;
         *
         * @param id - the id of this (style) class
         * @param styleAttributes - the string with 1 or more style attributes (each separated by a comma)
         */
        addStyleClass(id34, styleAttributes = "") {
          if (!this.classes.has(id34)) {
            this.classes.set(id34, { id: id34, styles: [], textStyles: [] });
          }
          const foundClass = this.classes.get(id34);
          if (styleAttributes && foundClass) {
            styleAttributes.split(CONSTANTS.STYLECLASS_SEP).forEach((attrib) => {
              const fixedAttrib = attrib.replace(/([^;]*);/, "$1").trim();
              if (RegExp(CONSTANTS.COLOR_KEYWORD).exec(attrib)) {
                const newStyle1 = fixedAttrib.replace(CONSTANTS.FILL_KEYWORD, CONSTANTS.BG_FILL);
                const newStyle2 = newStyle1.replace(CONSTANTS.COLOR_KEYWORD, CONSTANTS.FILL_KEYWORD);
                foundClass.textStyles.push(newStyle2);
              }
              foundClass.styles.push(fixedAttrib);
            });
          }
        }
        getClasses() {
          return this.classes;
        }
        /**
         * Add a (style) class or css class to a state with the given id.
         * If the state isn't already in the list of known states, add it.
         * Might be called by parser when a style class or CSS class should be applied to a state
         *
         * @param itemIds - The id or a list of ids of the item(s) to apply the css class to
         * @param cssClassName - CSS class name
         */
        setCssClass(itemIds, cssClassName) {
          itemIds.split(",").forEach((id34) => {
            let foundState = this.getState(id34);
            if (!foundState) {
              const trimmedId = id34.trim();
              this.addState(trimmedId);
              foundState = this.getState(trimmedId);
            }
            foundState?.classes?.push(cssClassName);
          });
        }
        /**
         * Add a style to a state with the given id.
         * @example style stateId fill:#f9f,stroke:#333,stroke-width:4px
         *   where 'style' is the keyword
         *   stateId is the id of a state
         *   the rest of the string is the styleText (all of the attributes to be applied to the state)
         *
         * @param itemId - The id of item to apply the style to
         * @param styleText - the text of the attributes for the style
         */
        setStyle(itemId, styleText) {
          this.getState(itemId)?.styles?.push(styleText);
        }
        /**
         * Add a text style to a state with the given id
         *
         * @param itemId - The id of item to apply the css class to
         * @param cssClassName - CSS class name
         */
        setTextStyle(itemId, cssClassName) {
          this.getState(itemId)?.textStyles?.push(cssClassName);
        }
        /**
         * Finds the direction statement in the root document.
         * @returns the direction statement if present
         */
        getDirectionStatement() {
          return this.rootDoc.find((doc) => doc.stmt === STMT_DIRECTION);
        }
        getDirection() {
          return this.getDirectionStatement()?.value ?? DEFAULT_DIAGRAM_DIRECTION;
        }
        setDirection(dir2) {
          const doc = this.getDirectionStatement();
          if (doc) {
            doc.value = dir2;
          } else {
            this.rootDoc.unshift({ stmt: STMT_DIRECTION, value: dir2 });
          }
        }
        trimColon(str2) {
          return str2.startsWith(":") ? str2.slice(1).trim() : str2.trim();
        }
        getData() {
          const config5 = getConfig2();
          return {
            nodes: this.nodes,
            edges: this.edges,
            other: {},
            config: config5,
            direction: getDir3(this.getRootDocV2())
          };
        }
        getConfig() {
          return getConfig2().state;
        }
      };
    }
  });

  // src/diagrams/state/styles.js
  var getStyles11, styles_default10;
  var init_styles10 = __esm({
    "src/diagrams/state/styles.js"() {
      "use strict";
      getStyles11 = /* @__PURE__ */ __name((options2) => `
defs [id$="-barbEnd"] {
    fill: ${options2.transitionColor};
    stroke: ${options2.transitionColor};
  }
g.stateGroup text {
  fill: ${options2.nodeBorder};
  stroke: none;
  font-size: 10px;
}
g.stateGroup text {
  fill: ${options2.textColor};
  stroke: none;
  font-size: 10px;

}
g.stateGroup .state-title {
  font-weight: bolder;
  fill: ${options2.stateLabelColor};
}

g.stateGroup rect {
  fill: ${options2.mainBkg};
  stroke: ${options2.nodeBorder};
}

g.stateGroup line {
  stroke: ${options2.lineColor};
  stroke-width: ${options2.strokeWidth || 1};
}

.transition {
  stroke: ${options2.transitionColor};
  stroke-width: ${options2.strokeWidth || 1};
  fill: none;
}

.stateGroup .composit {
  fill: ${options2.background};
  border-bottom: 1px
}

.stateGroup .alt-composit {
  fill: #e0e0e0;
  border-bottom: 1px
}

.state-note {
  stroke: ${options2.noteBorderColor};
  fill: ${options2.noteBkgColor};

  text {
    fill: ${options2.noteTextColor};
    stroke: none;
    font-size: 10px;
  }
}

.stateLabel .box {
  stroke: none;
  stroke-width: 0;
  fill: ${options2.mainBkg};
  opacity: 0.5;
}

.edgeLabel .label rect {
  fill: ${options2.labelBackgroundColor};
  opacity: 0.5;
}
.edgeLabel {
  background-color: ${options2.edgeLabelBackground};
  p {
    background-color: ${options2.edgeLabelBackground};
  }
  rect {
    opacity: 0.5;
    background-color: ${options2.edgeLabelBackground};
    fill: ${options2.edgeLabelBackground};
  }
  text-align: center;
}
.edgeLabel .label text {
  fill: ${options2.transitionLabelColor || options2.tertiaryTextColor};
}
.label div .edgeLabel {
  color: ${options2.transitionLabelColor || options2.tertiaryTextColor};
}

.stateLabel text {
  fill: ${options2.stateLabelColor};
  font-size: 10px;
  font-weight: bold;
}

.node circle.state-start {
  fill: ${options2.specialStateColor};
  stroke: ${options2.specialStateColor};
}

.node .fork-join {
  fill: ${options2.specialStateColor};
  stroke: ${options2.specialStateColor};
}

.node circle.state-end {
  fill: ${options2.innerEndBackground};
  stroke: ${options2.background};
  stroke-width: 1.5
}
.end-state-inner {
  fill: ${options2.compositeBackground || options2.background};
  // stroke: ${options2.background};
  stroke-width: 1.5
}

.node rect {
  fill: ${options2.stateBkg || options2.mainBkg};
  stroke: ${options2.stateBorder || options2.nodeBorder};
  stroke-width: ${options2.strokeWidth || 1}px;
}
.node polygon {
  fill: ${options2.mainBkg};
  stroke: ${options2.stateBorder || options2.nodeBorder};;
  stroke-width: ${options2.strokeWidth || 1}px;
}
[id$="-barbEnd"] {
  fill: ${options2.lineColor};
}

.statediagram-cluster rect {
  fill: ${options2.compositeTitleBackground};
  stroke: ${options2.stateBorder || options2.nodeBorder};
  stroke-width: ${options2.strokeWidth || 1}px;
}

.cluster-label, .nodeLabel {
  color: ${options2.stateLabelColor};
  // line-height: 1;
}

.statediagram-cluster rect.outer {
  rx: 5px;
  ry: 5px;
}
.statediagram-state .divider {
  stroke: ${options2.stateBorder || options2.nodeBorder};
}

.statediagram-state .title-state {
  rx: 5px;
  ry: 5px;
}
.statediagram-cluster.statediagram-cluster .inner {
  fill: ${options2.compositeBackground || options2.background};
}
.statediagram-cluster.statediagram-cluster-alt .inner {
  fill: ${options2.altBackground ? options2.altBackground : "#efefef"};
}

.statediagram-cluster .inner {
  rx:0;
  ry:0;
}

.statediagram-state rect.basic {
  rx: 5px;
  ry: 5px;
}
.statediagram-state rect.divider {
  stroke-dasharray: 10,10;
  fill: ${options2.altBackground ? options2.altBackground : "#efefef"};
}

.note-edge {
  stroke-dasharray: 5;
}

.statediagram-note rect {
  fill: ${options2.noteBkgColor};
  stroke: ${options2.noteBorderColor};
  stroke-width: 1px;
  rx: 0;
  ry: 0;
}
.statediagram-note rect {
  fill: ${options2.noteBkgColor};
  stroke: ${options2.noteBorderColor};
  stroke-width: 1px;
  rx: 0;
  ry: 0;
}

.statediagram-note text {
  fill: ${options2.noteTextColor};
}

.statediagram-note .nodeLabel {
  color: ${options2.noteTextColor};
}
.statediagram .edgeLabel {
  color: red; // ${options2.noteTextColor};
}

[id$="-dependencyStart"], [id$="-dependencyEnd"] {
  fill: ${options2.lineColor};
  stroke: ${options2.lineColor};
  stroke-width: ${options2.strokeWidth || 1};
}

.statediagramTitleText {
  text-anchor: middle;
  font-size: 18px;
  fill: ${options2.textColor};
}

[data-look="neo"].statediagram-cluster rect {
  fill: ${options2.mainBkg};
  stroke: ${options2.useGradient ? "url(" + options2.svgId + "-gradient)" : options2.stateBorder || options2.nodeBorder};
  stroke-width: ${options2.strokeWidth ?? 1};
}
[data-look="neo"].statediagram-cluster rect.outer {
  rx: ${options2.radius}px;
  ry: ${options2.radius}px;
  filter: ${options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${options2.svgId}-drop-shadow)`) : "none"}
}
`, "getStyles");
      styles_default10 = getStyles11;
    }
  });

  // src/diagrams/state/shapes.js
  var drawStartState, drawDivider, drawSimpleState, drawDescrState, addTitleAndBox, drawEndState, drawForkJoinState, _drawLongText, drawNote2, drawState, edgeCount, drawEdge;
  var init_shapes2 = __esm({
    "src/diagrams/state/shapes.js"() {
      "use strict";
      init_src32();
      init_stateDb();
      init_utils2();
      init_common();
      init_diagramAPI();
      init_logger();
      drawStartState = /* @__PURE__ */ __name((g2) => g2.append("circle").attr("class", "start-state").attr("r", getConfig2().state.sizeUnit).attr("cx", getConfig2().state.padding + getConfig2().state.sizeUnit).attr("cy", getConfig2().state.padding + getConfig2().state.sizeUnit), "drawStartState");
      drawDivider = /* @__PURE__ */ __name((g2) => g2.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", getConfig2().state.textHeight).attr("class", "divider").attr("x2", getConfig2().state.textHeight * 2).attr("y1", 0).attr("y2", 0), "drawDivider");
      drawSimpleState = /* @__PURE__ */ __name((g2, stateDef) => {
        const state4 = g2.append("text").attr("x", 2 * getConfig2().state.padding).attr("y", getConfig2().state.textHeight + 2 * getConfig2().state.padding).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.id);
        const classBox2 = state4.node().getBBox();
        g2.insert("rect", ":first-child").attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding).attr("width", classBox2.width + 2 * getConfig2().state.padding).attr("height", classBox2.height + 2 * getConfig2().state.padding).attr("rx", getConfig2().state.radius);
        return state4;
      }, "drawSimpleState");
      drawDescrState = /* @__PURE__ */ __name((g2, stateDef) => {
        const addTspan = /* @__PURE__ */ __name(function(textEl, txt, isFirst2) {
          const tSpan = textEl.append("tspan").attr("x", 2 * getConfig2().state.padding).text(txt);
          if (!isFirst2) {
            tSpan.attr("dy", getConfig2().state.textHeight);
          }
        }, "addTspan");
        const title2 = g2.append("text").attr("x", 2 * getConfig2().state.padding).attr("y", getConfig2().state.textHeight + 1.3 * getConfig2().state.padding).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.descriptions[0]);
        const titleBox = title2.node().getBBox();
        const titleHeight = titleBox.height;
        const description = g2.append("text").attr("x", getConfig2().state.padding).attr(
          "y",
          titleHeight + getConfig2().state.padding * 0.4 + getConfig2().state.dividerMargin + getConfig2().state.textHeight
        ).attr("class", "state-description");
        let isFirst = true;
        let isSecond = true;
        stateDef.descriptions.forEach(function(descr) {
          if (!isFirst) {
            addTspan(description, descr, isSecond);
            isSecond = false;
          }
          isFirst = false;
        });
        const descrLine = g2.append("line").attr("x1", getConfig2().state.padding).attr("y1", getConfig2().state.padding + titleHeight + getConfig2().state.dividerMargin / 2).attr("y2", getConfig2().state.padding + titleHeight + getConfig2().state.dividerMargin / 2).attr("class", "descr-divider");
        const descrBox = description.node().getBBox();
        const width3 = Math.max(descrBox.width, titleBox.width);
        descrLine.attr("x2", width3 + 3 * getConfig2().state.padding);
        g2.insert("rect", ":first-child").attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding).attr("width", width3 + 2 * getConfig2().state.padding).attr("height", descrBox.height + titleHeight + 2 * getConfig2().state.padding).attr("rx", getConfig2().state.radius);
        return g2;
      }, "drawDescrState");
      addTitleAndBox = /* @__PURE__ */ __name((g2, stateDef, altBkg) => {
        const pad3 = getConfig2().state.padding;
        const dblPad = 2 * getConfig2().state.padding;
        const orgBox = g2.node().getBBox();
        const orgWidth = orgBox.width;
        const orgX = orgBox.x;
        const title2 = g2.append("text").attr("x", 0).attr("y", getConfig2().state.titleShift).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.id);
        const titleBox = title2.node().getBBox();
        const titleWidth = titleBox.width + dblPad;
        let width3 = Math.max(titleWidth, orgWidth);
        if (width3 === orgWidth) {
          width3 = width3 + dblPad;
        }
        let startX2;
        const graphBox = g2.node().getBBox();
        if (stateDef.doc) {
        }
        startX2 = orgX - pad3;
        if (titleWidth > orgWidth) {
          startX2 = (orgWidth - width3) / 2 + pad3;
        }
        if (Math.abs(orgX - graphBox.x) < pad3 && titleWidth > orgWidth) {
          startX2 = orgX - (titleWidth - orgWidth) / 2;
        }
        const lineY = 1 - getConfig2().state.textHeight;
        g2.insert("rect", ":first-child").attr("x", startX2).attr("y", lineY).attr("class", altBkg ? "alt-composit" : "composit").attr("width", width3).attr(
          "height",
          graphBox.height + getConfig2().state.textHeight + getConfig2().state.titleShift + 1
        ).attr("rx", "0");
        title2.attr("x", startX2 + pad3);
        if (titleWidth <= orgWidth) {
          title2.attr("x", orgX + (width3 - dblPad) / 2 - titleWidth / 2 + pad3);
        }
        g2.insert("rect", ":first-child").attr("x", startX2).attr(
          "y",
          getConfig2().state.titleShift - getConfig2().state.textHeight - getConfig2().state.padding
        ).attr("width", width3).attr("height", getConfig2().state.textHeight * 3).attr("rx", getConfig2().state.radius);
        g2.insert("rect", ":first-child").attr("x", startX2).attr(
          "y",
          getConfig2().state.titleShift - getConfig2().state.textHeight - getConfig2().state.padding
        ).attr("width", width3).attr("height", graphBox.height + 3 + 2 * getConfig2().state.textHeight).attr("rx", getConfig2().state.radius);
        return g2;
      }, "addTitleAndBox");
      drawEndState = /* @__PURE__ */ __name((g2) => {
        g2.append("circle").attr("class", "end-state-outer").attr("r", getConfig2().state.sizeUnit + getConfig2().state.miniPadding).attr(
          "cx",
          getConfig2().state.padding + getConfig2().state.sizeUnit + getConfig2().state.miniPadding
        ).attr(
          "cy",
          getConfig2().state.padding + getConfig2().state.sizeUnit + getConfig2().state.miniPadding
        );
        return g2.append("circle").attr("class", "end-state-inner").attr("r", getConfig2().state.sizeUnit).attr("cx", getConfig2().state.padding + getConfig2().state.sizeUnit + 2).attr("cy", getConfig2().state.padding + getConfig2().state.sizeUnit + 2);
      }, "drawEndState");
      drawForkJoinState = /* @__PURE__ */ __name((g2, stateDef) => {
        let width3 = getConfig2().state.forkWidth;
        let height2 = getConfig2().state.forkHeight;
        if (stateDef.parentId) {
          let tmp = width3;
          width3 = height2;
          height2 = tmp;
        }
        return g2.append("rect").style("stroke", "black").style("fill", "black").attr("width", width3).attr("height", height2).attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding);
      }, "drawForkJoinState");
      _drawLongText = /* @__PURE__ */ __name((_text, x5, y6, g2) => {
        let textHeight = 0;
        const textElem = g2.append("text");
        textElem.style("text-anchor", "start");
        textElem.attr("class", "noteText");
        let text4 = _text.replace(/\r\n/g, "<br/>");
        text4 = text4.replace(/\n/g, "<br/>");
        const lines = text4.split(common_default.lineBreakRegex);
        let tHeight = 1.25 * getConfig2().state.noteMargin;
        for (const line2 of lines) {
          const txt = line2.trim();
          if (txt.length > 0) {
            const span = textElem.append("tspan");
            span.text(txt);
            if (tHeight === 0) {
              const textBounds = span.node().getBBox();
              tHeight += textBounds.height;
            }
            textHeight += tHeight;
            span.attr("x", x5 + getConfig2().state.noteMargin);
            span.attr("y", y6 + textHeight + 1.25 * getConfig2().state.noteMargin);
          }
        }
        return { textWidth: textElem.node().getBBox().width, textHeight };
      }, "_drawLongText");
      drawNote2 = /* @__PURE__ */ __name((text4, g2) => {
        g2.attr("class", "state-note");
        const note3 = g2.append("rect").attr("x", 0).attr("y", getConfig2().state.padding);
        const rectElem = g2.append("g");
        const { textWidth, textHeight } = _drawLongText(text4, 0, 0, rectElem);
        note3.attr("height", textHeight + 2 * getConfig2().state.noteMargin);
        note3.attr("width", textWidth + getConfig2().state.noteMargin * 2);
        return note3;
      }, "drawNote");
      drawState = /* @__PURE__ */ __name(function(elem, stateDef) {
        const id34 = stateDef.id;
        const stateInfo = {
          id: id34,
          label: stateDef.id,
          width: 0,
          height: 0
        };
        const g2 = elem.append("g").attr("id", id34).attr("class", "stateGroup");
        if (stateDef.type === "start") {
          drawStartState(g2);
        }
        if (stateDef.type === "end") {
          drawEndState(g2);
        }
        if (stateDef.type === "fork" || stateDef.type === "join") {
          drawForkJoinState(g2, stateDef);
        }
        if (stateDef.type === "note") {
          drawNote2(stateDef.note.text, g2);
        }
        if (stateDef.type === "divider") {
          drawDivider(g2);
        }
        if (stateDef.type === "default" && stateDef.descriptions.length === 0) {
          drawSimpleState(g2, stateDef);
        }
        if (stateDef.type === "default" && stateDef.descriptions.length > 0) {
          drawDescrState(g2, stateDef);
        }
        const stateBox = g2.node().getBBox();
        stateInfo.width = stateBox.width + 2 * getConfig2().state.padding;
        stateInfo.height = stateBox.height + 2 * getConfig2().state.padding;
        return stateInfo;
      }, "drawState");
      edgeCount = 0;
      drawEdge = /* @__PURE__ */ __name(function(elem, path4, relation) {
        const getRelationType = /* @__PURE__ */ __name(function(type3) {
          switch (type3) {
            case StateDB.relationType.AGGREGATION:
              return "aggregation";
            case StateDB.relationType.EXTENSION:
              return "extension";
            case StateDB.relationType.COMPOSITION:
              return "composition";
            case StateDB.relationType.DEPENDENCY:
              return "dependency";
          }
        }, "getRelationType");
        path4.points = path4.points.filter((p3) => !Number.isNaN(p3.y));
        const lineData = path4.points;
        const lineFunction = line_default().x(function(d3) {
          return d3.x;
        }).y(function(d3) {
          return d3.y;
        }).curve(basis_default2);
        const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "transition");
        let url = "";
        if (getConfig2().state.arrowMarkerAbsolute) {
          url = getUrl(true);
        }
        svgPath.attr(
          "marker-end",
          "url(" + url + "#" + getRelationType(StateDB.relationType.DEPENDENCY) + "End)"
        );
        if (relation.title !== void 0) {
          const label = elem.append("g").attr("class", "stateLabel");
          const { x: x5, y: y6 } = utils_default2.calcLabelPosition(path4.points);
          const rows = common_default.getRows(relation.title);
          let titleHeight = 0;
          const titleRows = [];
          let maxWidth2 = 0;
          let minX = 0;
          for (let i2 = 0; i2 <= rows.length; i2++) {
            const title2 = label.append("text").attr("text-anchor", "middle").text(rows[i2]).attr("x", x5).attr("y", y6 + titleHeight);
            const boundsTmp = title2.node().getBBox();
            maxWidth2 = Math.max(maxWidth2, boundsTmp.width);
            minX = Math.min(minX, boundsTmp.x);
            log.info(boundsTmp.x, x5, y6 + titleHeight);
            if (titleHeight === 0) {
              const titleBox = title2.node().getBBox();
              titleHeight = titleBox.height;
              log.info("Title height", titleHeight, y6);
            }
            titleRows.push(title2);
          }
          let boxHeight = titleHeight * rows.length;
          if (rows.length > 1) {
            const heightAdj = (rows.length - 1) * titleHeight * 0.5;
            titleRows.forEach((title2, i2) => title2.attr("y", y6 + i2 * titleHeight - heightAdj));
            boxHeight = titleHeight * rows.length;
          }
          const bounds4 = label.node().getBBox();
          label.insert("rect", ":first-child").attr("class", "box").attr("x", x5 - maxWidth2 / 2 - getConfig2().state.padding / 2).attr("y", y6 - boxHeight / 2 - getConfig2().state.padding / 2 - 3.5).attr("width", maxWidth2 + getConfig2().state.padding).attr("height", boxHeight + getConfig2().state.padding);
          log.info(bounds4);
        }
        edgeCount++;
      }, "drawEdge");
    }
  });

  // src/diagrams/state/stateRenderer.js
  var conf3, transformationLog, setConf4, insertMarkers2, draw14, getLabelWidth, renderDoc, stateRenderer_default;
  var init_stateRenderer = __esm({
    "src/diagrams/state/stateRenderer.js"() {
      "use strict";
      init_src32();
      init_dagre();
      init_graphlib();
      init_logger();
      init_common();
      init_shapes2();
      init_diagramAPI();
      init_setupGraphViewbox();
      transformationLog = {};
      setConf4 = /* @__PURE__ */ __name(function() {
      }, "setConf");
      insertMarkers2 = /* @__PURE__ */ __name(function(elem) {
        elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
      }, "insertMarkers");
      draw14 = /* @__PURE__ */ __name(function(text4, id34, _version, diagObj) {
        conf3 = getConfig2().state;
        const securityLevel = getConfig2().securityLevel;
        let sandboxElement;
        if (securityLevel === "sandbox") {
          sandboxElement = select_default2("#i" + id34);
        }
        const root3 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body");
        const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
        log.debug("Rendering diagram " + text4);
        const diagram31 = root3.select(`[id='${id34}']`);
        insertMarkers2(diagram31);
        const rootDoc = diagObj.db.getRootDoc();
        const rootG = diagram31.append("g").attr("id", id34 + "-root");
        renderDoc(rootDoc, rootG, void 0, false, root3, doc, diagObj);
        const padding2 = conf3.padding;
        const bounds4 = diagram31.node().getBBox();
        const width3 = bounds4.width + padding2 * 2;
        const height2 = bounds4.height + padding2 * 2;
        const svgWidth = width3 * 1.75;
        configureSvgSize(diagram31, height2, svgWidth, conf3.useMaxWidth);
        diagram31.attr(
          "viewBox",
          `${bounds4.x - conf3.padding}  ${bounds4.y - conf3.padding} ` + width3 + " " + height2
        );
      }, "draw");
      getLabelWidth = /* @__PURE__ */ __name((text4) => {
        return text4 ? text4.length * conf3.fontSizeFactor : 1;
      }, "getLabelWidth");
      renderDoc = /* @__PURE__ */ __name((doc, diagram31, parentId, altBkg, root3, domDocument, diagObj) => {
        const graph = new Graph({
          compound: true,
          multigraph: true
        });
        let i2;
        let edgeFreeDoc = true;
        for (i2 = 0; i2 < doc.length; i2++) {
          if (doc[i2].stmt === "relation") {
            edgeFreeDoc = false;
            break;
          }
        }
        if (parentId) {
          graph.setGraph({
            rankdir: "LR",
            multigraph: true,
            compound: true,
            // acyclicer: 'greedy',
            ranker: "tight-tree",
            ranksep: edgeFreeDoc ? 1 : conf3.edgeLengthFactor,
            nodeSep: edgeFreeDoc ? 1 : 50,
            isMultiGraph: true
            // ranksep: 5,
            // nodesep: 1
          });
        } else {
          graph.setGraph({
            rankdir: "TB",
            multigraph: true,
            compound: true,
            // isCompound: true,
            // acyclicer: 'greedy',
            // ranker: 'longest-path'
            ranksep: edgeFreeDoc ? 1 : conf3.edgeLengthFactor,
            nodeSep: edgeFreeDoc ? 1 : 50,
            ranker: "tight-tree",
            // ranker: 'network-simplex'
            isMultiGraph: true
          });
        }
        graph.setDefaultEdgeLabel(function() {
          return {};
        });
        const states = diagObj.db.getStates();
        const relations = diagObj.db.getRelations();
        const keys2 = Object.keys(states);
        let first3 = true;
        for (const key of keys2) {
          const stateDef = states[key];
          if (parentId) {
            stateDef.parentId = parentId;
          }
          let node2;
          if (stateDef.doc) {
            let sub2 = diagram31.append("g").attr("id", stateDef.id).attr("class", "stateGroup");
            node2 = renderDoc(stateDef.doc, sub2, stateDef.id, !altBkg, root3, domDocument, diagObj);
            if (first3) {
              sub2 = addTitleAndBox(sub2, stateDef, altBkg);
              let boxBounds = sub2.node().getBBox();
              node2.width = boxBounds.width;
              node2.height = boxBounds.height + conf3.padding / 2;
              transformationLog[stateDef.id] = { y: conf3.compositTitleSize };
            } else {
              let boxBounds = sub2.node().getBBox();
              node2.width = boxBounds.width;
              node2.height = boxBounds.height;
            }
          } else {
            node2 = drawState(diagram31, stateDef, graph);
          }
          if (stateDef.note) {
            const noteDef = {
              descriptions: [],
              id: stateDef.id + "-note",
              note: stateDef.note,
              type: "note"
            };
            const note3 = drawState(diagram31, noteDef, graph);
            if (stateDef.note.position === "left of") {
              graph.setNode(node2.id + "-note", note3);
              graph.setNode(node2.id, node2);
            } else {
              graph.setNode(node2.id, node2);
              graph.setNode(node2.id + "-note", note3);
            }
            graph.setParent(node2.id, node2.id + "-group");
            graph.setParent(node2.id + "-note", node2.id + "-group");
          } else {
            graph.setNode(node2.id, node2);
          }
        }
        log.debug("Count=", graph.nodeCount(), graph);
        let cnt4 = 0;
        relations.forEach(function(relation) {
          cnt4++;
          log.debug("Setting edge", relation);
          graph.setEdge(
            relation.id1,
            relation.id2,
            {
              relation,
              width: getLabelWidth(relation.title),
              height: conf3.labelHeight * common_default.getRows(relation.title).length,
              labelpos: "c"
            },
            "id" + cnt4
          );
        });
        layout(graph);
        log.debug("Graph after layout", graph.nodes());
        const svgElem = diagram31.node();
        graph.nodes().forEach(function(v3) {
          if (v3 !== void 0 && graph.node(v3) !== void 0) {
            log.warn("Node " + v3 + ": " + JSON.stringify(graph.node(v3)));
            root3.select("#" + svgElem.id + " #" + v3).attr(
              "transform",
              "translate(" + (graph.node(v3).x - graph.node(v3).width / 2) + "," + (graph.node(v3).y + (transformationLog[v3] ? transformationLog[v3].y : 0) - graph.node(v3).height / 2) + " )"
            );
            root3.select("#" + svgElem.id + " #" + v3).attr("data-x-shift", graph.node(v3).x - graph.node(v3).width / 2);
            const dividers = domDocument.querySelectorAll("#" + svgElem.id + " #" + v3 + " .divider");
            dividers.forEach((divider2) => {
              const parent4 = divider2.parentElement;
              let pWidth = 0;
              let pShift = 0;
              if (parent4) {
                if (parent4.parentElement) {
                  pWidth = parent4.parentElement.getBBox().width;
                }
                pShift = parseInt(parent4.getAttribute("data-x-shift"), 10);
                if (Number.isNaN(pShift)) {
                  pShift = 0;
                }
              }
              divider2.setAttribute("x1", 0 - pShift + 8);
              divider2.setAttribute("x2", pWidth - pShift - 8);
            });
          } else {
            log.debug("No Node " + v3 + ": " + JSON.stringify(graph.node(v3)));
          }
        });
        let stateBox = svgElem.getBBox();
        graph.edges().forEach(function(e3) {
          if (e3 !== void 0 && graph.edge(e3) !== void 0) {
            log.debug("Edge " + e3.v + " -> " + e3.w + ": " + JSON.stringify(graph.edge(e3)));
            drawEdge(diagram31, graph.edge(e3), graph.edge(e3).relation);
          }
        });
        stateBox = svgElem.getBBox();
        const stateInfo = {
          id: parentId ? parentId : "root",
          label: parentId ? parentId : "root",
          width: 0,
          height: 0
        };
        stateInfo.width = stateBox.width + 2 * conf3.padding;
        stateInfo.height = stateBox.height + 2 * conf3.padding;
        log.debug("Doc rendered", stateInfo, graph);
        return stateInfo;
      }, "renderDoc");
      stateRenderer_default = {
        setConf: setConf4,
        draw: draw14
      };
    }
  });

  // src/diagrams/state/stateDiagram.ts
  var stateDiagram_exports = {};
  __export(stateDiagram_exports, {
    diagram: () => diagram14
  });
  var diagram14;
  var init_stateDiagram2 = __esm({
    "src/diagrams/state/stateDiagram.ts"() {
      "use strict";
      init_stateDiagram();
      init_stateDb();
      init_styles10();
      init_stateRenderer();
      diagram14 = {
        parser: stateDiagram_default,
        get db() {
          return new StateDB(1);
        },
        renderer: stateRenderer_default,
        styles: styles_default10,
        init: /* @__PURE__ */ __name((cnf) => {
          if (!cnf.state) {
            cnf.state = {};
          }
          cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
        }, "init")
      };
    }
  });

  // src/diagrams/state/stateDiagram-v2.ts
  var stateDiagram_v2_exports = {};
  __export(stateDiagram_v2_exports, {
    diagram: () => diagram15
  });
  var diagram15;
  var init_stateDiagram_v2 = __esm({
    "src/diagrams/state/stateDiagram-v2.ts"() {
      "use strict";
      init_stateDiagram();
      init_stateDb();
      init_styles10();
      init_stateRenderer_v3_unified();
      diagram15 = {
        parser: stateDiagram_default,
        get db() {
          return new StateDB(2);
        },
        renderer: stateRenderer_v3_unified_default,
        styles: styles_default10,
        init: /* @__PURE__ */ __name((cnf) => {
          if (!cnf.state) {
            cnf.state = {};
          }
          cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
        }, "init")
      };
    }
  });

  // src/diagrams/user-journey/parser/journey.jison
  var parser14, journey_default;
  var init_journey = __esm({
    "src/diagrams/user-journey/parser/journey.jison"() {
      "use strict";
      parser14 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [6, 8, 10, 11, 12, 14, 16, 17, 18], $V1 = [1, 9], $V2 = [1, 10], $V3 = [1, 11], $V4 = [1, 12], $V5 = [1, 13], $V6 = [1, 14];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "journey": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NEWLINE": 10, "title": 11, "acc_title": 12, "acc_title_value": 13, "acc_descr": 14, "acc_descr_value": 15, "acc_descr_multiline_value": 16, "section": 17, "taskName": 18, "taskData": 19, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 4: "journey", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 11: "title", 12: "acc_title", 13: "acc_title_value", 14: "acc_descr", 15: "acc_descr_value", 16: "acc_descr_multiline_value", 17: "section", 18: "taskName", 19: "taskData" },
          productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 1:
                return $$[$0 - 1];
                break;
              case 2:
                this.$ = [];
                break;
              case 3:
                $$[$0 - 1].push($$[$0]);
                this.$ = $$[$0 - 1];
                break;
              case 4:
              case 5:
                this.$ = $$[$0];
                break;
              case 6:
              case 7:
                this.$ = [];
                break;
              case 8:
                yy.setDiagramTitle($$[$0].substr(6));
                this.$ = $$[$0].substr(6);
                break;
              case 9:
                this.$ = $$[$0].trim();
                yy.setAccTitle(this.$);
                break;
              case 10:
              case 11:
                this.$ = $$[$0].trim();
                yy.setAccDescription(this.$);
                break;
              case 12:
                yy.addSection($$[$0].substr(8));
                this.$ = $$[$0].substr(8);
                break;
              case 13:
                yy.addTask($$[$0 - 1], $$[$0]);
                this.$ = "task";
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o2($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o2($V0, [2, 7], { 1: [2, 1] }), o2($V0, [2, 3]), { 9: 15, 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o2($V0, [2, 5]), o2($V0, [2, 6]), o2($V0, [2, 8]), { 13: [1, 16] }, { 15: [1, 17] }, o2($V0, [2, 11]), o2($V0, [2, 12]), { 19: [1, 18] }, o2($V0, [2, 4]), o2($V0, [2, 9]), o2($V0, [2, 10]), o2($V0, [2, 13])],
          defaultActions: {},
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  break;
                case 1:
                  break;
                case 2:
                  return 10;
                  break;
                case 3:
                  break;
                case 4:
                  break;
                case 5:
                  return 4;
                  break;
                case 6:
                  return 11;
                  break;
                case 7:
                  this.begin("acc_title");
                  return 12;
                  break;
                case 8:
                  this.popState();
                  return "acc_title_value";
                  break;
                case 9:
                  this.begin("acc_descr");
                  return 14;
                  break;
                case 10:
                  this.popState();
                  return "acc_descr_value";
                  break;
                case 11:
                  this.begin("acc_descr_multiline");
                  break;
                case 12:
                  this.popState();
                  break;
                case 13:
                  return "acc_descr_multiline_value";
                  break;
                case 14:
                  return 17;
                  break;
                case 15:
                  return 18;
                  break;
                case 16:
                  return 19;
                  break;
                case 17:
                  return ":";
                  break;
                case 18:
                  return 6;
                  break;
                case 19:
                  return "INVALID";
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:journey\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i],
            conditions: { "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser14.parser = parser14;
      journey_default = parser14;
    }
  });

  // src/diagrams/user-journey/journeyDb.js
  var currentSection2, sections3, tasks2, rawTasks2, clear13, addSection3, getSections3, getTasks2, updateActors, addTask2, addTaskOrg2, compileTasks2, getActors, journeyDb_default;
  var init_journeyDb = __esm({
    "src/diagrams/user-journey/journeyDb.js"() {
      "use strict";
      init_diagramAPI();
      init_commonDb();
      currentSection2 = "";
      sections3 = [];
      tasks2 = [];
      rawTasks2 = [];
      clear13 = /* @__PURE__ */ __name(function() {
        sections3.length = 0;
        tasks2.length = 0;
        currentSection2 = "";
        rawTasks2.length = 0;
        clear();
      }, "clear");
      addSection3 = /* @__PURE__ */ __name(function(txt) {
        currentSection2 = txt;
        sections3.push(txt);
      }, "addSection");
      getSections3 = /* @__PURE__ */ __name(function() {
        return sections3;
      }, "getSections");
      getTasks2 = /* @__PURE__ */ __name(function() {
        let allItemsProcessed = compileTasks2();
        const maxDepth = 100;
        let iterationCount = 0;
        while (!allItemsProcessed && iterationCount < maxDepth) {
          allItemsProcessed = compileTasks2();
          iterationCount++;
        }
        tasks2.push(...rawTasks2);
        return tasks2;
      }, "getTasks");
      updateActors = /* @__PURE__ */ __name(function() {
        const tempActors = [];
        tasks2.forEach((task) => {
          if (task.people) {
            tempActors.push(...task.people);
          }
        });
        const unique = new Set(tempActors);
        return [...unique].sort();
      }, "updateActors");
      addTask2 = /* @__PURE__ */ __name(function(descr, taskData) {
        const pieces = taskData.substr(1).split(":");
        let score = 0;
        let peeps = [];
        if (pieces.length === 1) {
          score = Number(pieces[0]);
          peeps = [];
        } else {
          score = Number(pieces[0]);
          peeps = pieces[1].split(",");
        }
        const peopleList = peeps.map((s2) => s2.trim());
        const rawTask = {
          section: currentSection2,
          type: currentSection2,
          people: peopleList,
          task: descr,
          score
        };
        rawTasks2.push(rawTask);
      }, "addTask");
      addTaskOrg2 = /* @__PURE__ */ __name(function(descr) {
        const newTask = {
          section: currentSection2,
          type: currentSection2,
          description: descr,
          task: descr,
          classes: []
        };
        tasks2.push(newTask);
      }, "addTaskOrg");
      compileTasks2 = /* @__PURE__ */ __name(function() {
        const compileTask = /* @__PURE__ */ __name(function(pos) {
          return rawTasks2[pos].processed;
        }, "compileTask");
        let allProcessed = true;
        for (const [i2, rawTask] of rawTasks2.entries()) {
          compileTask(i2);
          allProcessed = allProcessed && rawTask.processed;
        }
        return allProcessed;
      }, "compileTasks");
      getActors = /* @__PURE__ */ __name(function() {
        return updateActors();
      }, "getActors");
      journeyDb_default = {
        getConfig: /* @__PURE__ */ __name(() => getConfig2().journey, "getConfig"),
        clear: clear13,
        setDiagramTitle,
        getDiagramTitle,
        setAccTitle,
        getAccTitle,
        setAccDescription,
        getAccDescription,
        addSection: addSection3,
        getSections: getSections3,
        getTasks: getTasks2,
        addTask: addTask2,
        addTaskOrg: addTaskOrg2,
        getActors
      };
    }
  });

  // src/diagrams/user-journey/styles.js
  var getStyles12, styles_default11;
  var init_styles11 = __esm({
    "src/diagrams/user-journey/styles.js"() {
      "use strict";
      init_globalStyles();
      getStyles12 = /* @__PURE__ */ __name((options2) => `.label {
    font-family: ${options2.fontFamily};
    color: ${options2.textColor};
  }
  .mouth {
    stroke: #666;
  }

  line {
    stroke: ${options2.textColor}
  }

  .legend {
    fill: ${options2.textColor};
    font-family: ${options2.fontFamily};
  }

  .label text {
    fill: #333;
  }
  .label {
    color: ${options2.textColor}
  }

  .face {
    ${options2.faceColor ? `fill: ${options2.faceColor}` : "fill: #FFF8DC"};
    stroke: #999;
  }

  .node rect,
  .node circle,
  .node ellipse,
  .node polygon,
  .node path {
    fill: ${options2.mainBkg};
    stroke: ${options2.nodeBorder};
    stroke-width: 1px;
  }

  .node .label {
    text-align: center;
  }
  .node.clickable {
    cursor: pointer;
  }

  .arrowheadPath {
    fill: ${options2.arrowheadColor};
  }

  .edgePath .path {
    stroke: ${options2.lineColor};
    stroke-width: 1.5px;
  }

  .flowchart-link {
    stroke: ${options2.lineColor};
    fill: none;
  }

  .edgeLabel {
    background-color: ${options2.edgeLabelBackground};
    rect {
      opacity: 0.5;
    }
    text-align: center;
  }

  .cluster rect {
  }

  .cluster text {
    fill: ${options2.titleColor};
  }

  div.mermaidTooltip {
    position: absolute;
    text-align: center;
    max-width: 200px;
    padding: 2px;
    font-family: ${options2.fontFamily};
    font-size: 12px;
    background: ${options2.tertiaryColor};
    border: 1px solid ${options2.border2};
    border-radius: 2px;
    pointer-events: none;
    z-index: 100;
  }

  .task-type-0, .section-type-0  {
    ${options2.fillType0 ? `fill: ${options2.fillType0}` : ""};
  }
  .task-type-1, .section-type-1  {
    ${options2.fillType0 ? `fill: ${options2.fillType1}` : ""};
  }
  .task-type-2, .section-type-2  {
    ${options2.fillType0 ? `fill: ${options2.fillType2}` : ""};
  }
  .task-type-3, .section-type-3  {
    ${options2.fillType0 ? `fill: ${options2.fillType3}` : ""};
  }
  .task-type-4, .section-type-4  {
    ${options2.fillType0 ? `fill: ${options2.fillType4}` : ""};
  }
  .task-type-5, .section-type-5  {
    ${options2.fillType0 ? `fill: ${options2.fillType5}` : ""};
  }
  .task-type-6, .section-type-6  {
    ${options2.fillType0 ? `fill: ${options2.fillType6}` : ""};
  }
  .task-type-7, .section-type-7  {
    ${options2.fillType0 ? `fill: ${options2.fillType7}` : ""};
  }

  .actor-0 {
    ${options2.actor0 ? `fill: ${options2.actor0}` : ""};
  }
  .actor-1 {
    ${options2.actor1 ? `fill: ${options2.actor1}` : ""};
  }
  .actor-2 {
    ${options2.actor2 ? `fill: ${options2.actor2}` : ""};
  }
  .actor-3 {
    ${options2.actor3 ? `fill: ${options2.actor3}` : ""};
  }
  .actor-4 {
    ${options2.actor4 ? `fill: ${options2.actor4}` : ""};
  }
  .actor-5 {
    ${options2.actor5 ? `fill: ${options2.actor5}` : ""};
  }
  ${getIconStyles()}
`, "getStyles");
      styles_default11 = getStyles12;
    }
  });

  // src/diagrams/user-journey/svgDraw.js
  var drawRect5, drawFace, drawCircle, drawText4, drawLabel2, drawSection, taskCount, drawTask, drawBackgroundRect3, _drawTextCandidateFunc3, initGraphics, svgDraw_default3;
  var init_svgDraw3 = __esm({
    "src/diagrams/user-journey/svgDraw.js"() {
      "use strict";
      init_src32();
      init_svgDrawCommon();
      drawRect5 = /* @__PURE__ */ __name(function(elem, rectData) {
        return drawRect(elem, rectData);
      }, "drawRect");
      drawFace = /* @__PURE__ */ __name(function(element3, faceData) {
        const radius2 = 15;
        const circleElement = element3.append("circle").attr("cx", faceData.cx).attr("cy", faceData.cy).attr("class", "face").attr("r", radius2).attr("stroke-width", 2).attr("overflow", "visible");
        const face = element3.append("g");
        face.append("circle").attr("cx", faceData.cx - radius2 / 3).attr("cy", faceData.cy - radius2 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
        face.append("circle").attr("cx", faceData.cx + radius2 / 3).attr("cy", faceData.cy - radius2 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
        function smile(face2) {
          const arc = arc_default().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius2 / 2).outerRadius(radius2 / 2.2);
          face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")");
        }
        __name(smile, "smile");
        function sad(face2) {
          const arc = arc_default().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius2 / 2).outerRadius(radius2 / 2.2);
          face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")");
        }
        __name(sad, "sad");
        function ambivalent(face2) {
          face2.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", faceData.cx - 5).attr("y1", faceData.cy + 7).attr("x2", faceData.cx + 5).attr("y2", faceData.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
        }
        __name(ambivalent, "ambivalent");
        if (faceData.score > 3) {
          smile(face);
        } else if (faceData.score < 3) {
          sad(face);
        } else {
          ambivalent(face);
        }
        return circleElement;
      }, "drawFace");
      drawCircle = /* @__PURE__ */ __name(function(element3, circleData) {
        const circleElement = element3.append("circle");
        circleElement.attr("cx", circleData.cx);
        circleElement.attr("cy", circleData.cy);
        circleElement.attr("class", "actor-" + circleData.pos);
        circleElement.attr("fill", circleData.fill);
        circleElement.attr("stroke", circleData.stroke);
        circleElement.attr("r", circleData.r);
        if (circleElement.class !== void 0) {
          circleElement.attr("class", circleElement.class);
        }
        if (circleData.title !== void 0) {
          circleElement.append("title").text(circleData.title);
        }
        return circleElement;
      }, "drawCircle");
      drawText4 = /* @__PURE__ */ __name(function(elem, textData) {
        return drawText(elem, textData);
      }, "drawText");
      drawLabel2 = /* @__PURE__ */ __name(function(elem, txtObject) {
        function genPoints(x5, y6, width3, height2, cut) {
          return x5 + "," + y6 + " " + (x5 + width3) + "," + y6 + " " + (x5 + width3) + "," + (y6 + height2 - cut) + " " + (x5 + width3 - cut * 1.2) + "," + (y6 + height2) + " " + x5 + "," + (y6 + height2);
        }
        __name(genPoints, "genPoints");
        const polygon2 = elem.append("polygon");
        polygon2.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7));
        polygon2.attr("class", "labelBox");
        txtObject.y = txtObject.y + txtObject.labelMargin;
        txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
        drawText4(elem, txtObject);
      }, "drawLabel");
      drawSection = /* @__PURE__ */ __name(function(elem, section, conf5) {
        const g2 = elem.append("g");
        const rect3 = getNoteRect();
        rect3.x = section.x;
        rect3.y = section.y;
        rect3.fill = section.fill;
        rect3.width = conf5.width * section.taskCount + // width of the tasks
        conf5.diagramMarginX * (section.taskCount - 1);
        rect3.height = conf5.height;
        rect3.class = "journey-section section-type-" + section.num;
        rect3.rx = 3;
        rect3.ry = 3;
        drawRect5(g2, rect3);
        _drawTextCandidateFunc3(conf5)(
          section.text,
          g2,
          rect3.x,
          rect3.y,
          rect3.width,
          rect3.height,
          { class: "journey-section section-type-" + section.num },
          conf5,
          section.colour
        );
      }, "drawSection");
      taskCount = -1;
      drawTask = /* @__PURE__ */ __name(function(elem, task, conf5, diagramId3) {
        const center4 = task.x + conf5.width / 2;
        const g2 = elem.append("g");
        taskCount++;
        const maxHeight = 300 + 5 * 30;
        g2.append("line").attr("id", diagramId3 + "-task" + taskCount).attr("x1", center4).attr("y1", task.y).attr("x2", center4).attr("y2", maxHeight).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666");
        drawFace(g2, {
          cx: center4,
          cy: 300 + (5 - task.score) * 30,
          score: task.score
        });
        const rect3 = getNoteRect();
        rect3.x = task.x;
        rect3.y = task.y;
        rect3.fill = task.fill;
        rect3.width = conf5.width;
        rect3.height = conf5.height;
        rect3.class = "task task-type-" + task.num;
        rect3.rx = 3;
        rect3.ry = 3;
        drawRect5(g2, rect3);
        let xPos = task.x + 14;
        task.people.forEach((person) => {
          const colour = task.actors[person].color;
          const circle6 = {
            cx: xPos,
            cy: task.y,
            r: 7,
            fill: colour,
            stroke: "#000",
            title: person,
            pos: task.actors[person].position
          };
          drawCircle(g2, circle6);
          xPos += 10;
        });
        _drawTextCandidateFunc3(conf5)(
          task.task,
          g2,
          rect3.x,
          rect3.y,
          rect3.width,
          rect3.height,
          { class: "task" },
          conf5,
          task.colour
        );
      }, "drawTask");
      drawBackgroundRect3 = /* @__PURE__ */ __name(function(elem, bounds4) {
        drawBackgroundRect(elem, bounds4);
      }, "drawBackgroundRect");
      _drawTextCandidateFunc3 = /* @__PURE__ */ (function() {
        function byText(content, g2, x5, y6, width3, height2, textAttrs, colour) {
          const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6 + height2 / 2 + 5).style("font-color", colour).style("text-anchor", "middle").text(content);
          _setTextAttrs(text4, textAttrs);
        }
        __name(byText, "byText");
        function byTspan(content, g2, x5, y6, width3, height2, textAttrs, conf5, colour) {
          const { taskFontSize, taskFontFamily } = conf5;
          const lines = content.split(/<br\s*\/?>/gi);
          for (let i2 = 0; i2 < lines.length; i2++) {
            const dy = i2 * taskFontSize - taskFontSize * (lines.length - 1) / 2;
            const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6).attr("fill", colour).style("text-anchor", "middle").style("font-size", taskFontSize).style("font-family", taskFontFamily);
            text4.append("tspan").attr("x", x5 + width3 / 2).attr("dy", dy).text(lines[i2]);
            text4.attr("y", y6 + height2 / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
            _setTextAttrs(text4, textAttrs);
          }
        }
        __name(byTspan, "byTspan");
        function byFo(content, g2, x5, y6, width3, height2, textAttrs, conf5) {
          const body = g2.append("switch");
          const f2 = body.append("foreignObject").attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2).attr("position", "fixed");
          const text4 = f2.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
          text4.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
          byTspan(content, body, x5, y6, width3, height2, textAttrs, conf5);
          _setTextAttrs(text4, textAttrs);
        }
        __name(byFo, "byFo");
        function _setTextAttrs(toText, fromTextAttrsDict) {
          for (const key in fromTextAttrsDict) {
            if (key in fromTextAttrsDict) {
              toText.attr(key, fromTextAttrsDict[key]);
            }
          }
        }
        __name(_setTextAttrs, "_setTextAttrs");
        return function(conf5) {
          return conf5.textPlacement === "fo" ? byFo : conf5.textPlacement === "old" ? byText : byTspan;
        };
      })();
      initGraphics = /* @__PURE__ */ __name(function(graphics, id34) {
        taskCount = -1;
        graphics.append("defs").append("marker").attr("id", id34 + "-arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
      }, "initGraphics");
      svgDraw_default3 = {
        drawRect: drawRect5,
        drawCircle,
        drawSection,
        drawText: drawText4,
        drawLabel: drawLabel2,
        drawTask,
        drawBackgroundRect: drawBackgroundRect3,
        initGraphics
      };
    }
  });

  // src/diagrams/user-journey/journeyRenderer.ts
  function drawActorLegend(diagram31) {
    const conf5 = getConfig2().journey;
    const maxLabelWidth = conf5.maxLabelWidth;
    maxWidth = 0;
    let yPos = 60;
    Object.keys(actors).forEach((person) => {
      const colour = actors[person].color;
      const circleData = {
        cx: 20,
        cy: yPos,
        r: 7,
        fill: colour,
        stroke: "#000",
        pos: actors[person].position
      };
      svgDraw_default3.drawCircle(diagram31, circleData);
      let measureText = diagram31.append("text").attr("visibility", "hidden").text(person);
      const fullTextWidth = measureText.node().getBoundingClientRect().width;
      measureText.remove();
      let lines = [];
      if (fullTextWidth <= maxLabelWidth) {
        lines = [person];
      } else {
        const words = person.split(" ");
        let currentLine = "";
        measureText = diagram31.append("text").attr("visibility", "hidden");
        words.forEach((word) => {
          const testLine = currentLine ? `${currentLine} ${word}` : word;
          measureText.text(testLine);
          const textWidth = measureText.node().getBoundingClientRect().width;
          if (textWidth > maxLabelWidth) {
            if (currentLine) {
              lines.push(currentLine);
            }
            currentLine = word;
            measureText.text(word);
            if (measureText.node().getBoundingClientRect().width > maxLabelWidth) {
              let brokenWord = "";
              for (const char2 of word) {
                brokenWord += char2;
                measureText.text(brokenWord + "-");
                if (measureText.node().getBoundingClientRect().width > maxLabelWidth) {
                  lines.push(brokenWord.slice(0, -1) + "-");
                  brokenWord = char2;
                }
              }
              currentLine = brokenWord;
            }
          } else {
            currentLine = testLine;
          }
        });
        if (currentLine) {
          lines.push(currentLine);
        }
        measureText.remove();
      }
      lines.forEach((line2, index) => {
        const labelData = {
          x: 40,
          y: yPos + 7 + index * 20,
          fill: "#666",
          text: line2,
          textMargin: conf5.boxTextMargin ?? 5
        };
        const textElement = svgDraw_default3.drawText(diagram31, labelData);
        const lineWidth = textElement.node().getBoundingClientRect().width;
        if (lineWidth > maxWidth && lineWidth > conf5.leftMargin - lineWidth) {
          maxWidth = lineWidth;
        }
      });
      yPos += Math.max(20, lines.length * 20);
    });
  }
  var setConf5, actors, maxWidth, conf4, leftMargin, draw15, bounds3, fills, textColours, drawTasks, journeyRenderer_default;
  var init_journeyRenderer = __esm({
    "src/diagrams/user-journey/journeyRenderer.ts"() {
      "use strict";
      init_src32();
      init_svgDraw3();
      init_diagramAPI();
      init_setupGraphViewbox();
      setConf5 = /* @__PURE__ */ __name(function(cnf) {
        const keys2 = Object.keys(cnf);
        keys2.forEach(function(key) {
          conf4[key] = cnf[key];
        });
      }, "setConf");
      actors = {};
      maxWidth = 0;
      __name(drawActorLegend, "drawActorLegend");
      conf4 = getConfig2().journey;
      leftMargin = 0;
      draw15 = /* @__PURE__ */ __name(function(text4, id34, version3, diagObj) {
        const configObject = getConfig2();
        const titleColor = configObject.journey.titleColor;
        const titleFontSize = configObject.journey.titleFontSize;
        const titleFontFamily = configObject.journey.titleFontFamily;
        const securityLevel = configObject.securityLevel;
        let sandboxElement;
        if (securityLevel === "sandbox") {
          sandboxElement = select_default2("#i" + id34);
        }
        const root3 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body");
        bounds3.init();
        const diagram31 = root3.select("#" + id34);
        svgDraw_default3.initGraphics(diagram31, id34);
        const tasks4 = diagObj.db.getTasks();
        const title2 = diagObj.db.getDiagramTitle();
        const actorNames = diagObj.db.getActors();
        for (const member in actors) {
          delete actors[member];
        }
        let actorPos = 0;
        actorNames.forEach((actorName) => {
          actors[actorName] = {
            color: conf4.actorColours[actorPos % conf4.actorColours.length],
            position: actorPos
          };
          actorPos++;
        });
        drawActorLegend(diagram31);
        leftMargin = conf4.leftMargin + maxWidth;
        bounds3.insert(0, 0, leftMargin, Object.keys(actors).length * 50);
        drawTasks(diagram31, tasks4, 0, id34);
        const box = bounds3.getBounds();
        if (title2) {
          diagram31.append("text").text(title2).attr("x", leftMargin).attr("font-size", titleFontSize).attr("font-weight", "bold").attr("y", 25).attr("fill", titleColor).attr("font-family", titleFontFamily);
        }
        const height2 = box.stopy - box.starty + 2 * conf4.diagramMarginY;
        const width3 = leftMargin + box.stopx + 2 * conf4.diagramMarginX;
        configureSvgSize(diagram31, height2, width3, conf4.useMaxWidth);
        diagram31.append("line").attr("x1", leftMargin).attr("y1", conf4.height * 4).attr("x2", width3 - leftMargin - 4).attr("y2", conf4.height * 4).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#" + id34 + "-arrowhead)");
        const extraVertForTitle = title2 ? 70 : 0;
        diagram31.attr("viewBox", `${box.startx} -25 ${width3} ${height2 + extraVertForTitle}`);
        diagram31.attr("preserveAspectRatio", "xMinYMin meet");
        diagram31.attr("height", height2 + extraVertForTitle + 25);
      }, "draw");
      bounds3 = {
        data: {
          startx: void 0,
          stopx: void 0,
          starty: void 0,
          stopy: void 0
        },
        verticalPos: 0,
        sequenceItems: [],
        init: /* @__PURE__ */ __name(function() {
          this.sequenceItems = [];
          this.data = {
            startx: void 0,
            stopx: void 0,
            starty: void 0,
            stopy: void 0
          };
          this.verticalPos = 0;
        }, "init"),
        updateVal: /* @__PURE__ */ __name(function(obj, key, val, fun) {
          if (obj[key] === void 0) {
            obj[key] = val;
          } else {
            obj[key] = fun(val, obj[key]);
          }
        }, "updateVal"),
        updateBounds: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
          const conf5 = getConfig2().journey;
          const _self = this;
          let cnt4 = 0;
          function updateFn(type3) {
            return /* @__PURE__ */ __name(function updateItemBounds(item) {
              cnt4++;
              const n2 = _self.sequenceItems.length - cnt4 + 1;
              _self.updateVal(item, "starty", starty - n2 * conf5.boxMargin, Math.min);
              _self.updateVal(item, "stopy", stopy + n2 * conf5.boxMargin, Math.max);
              _self.updateVal(bounds3.data, "startx", startx - n2 * conf5.boxMargin, Math.min);
              _self.updateVal(bounds3.data, "stopx", stopx + n2 * conf5.boxMargin, Math.max);
              if (!(type3 === "activation")) {
                _self.updateVal(item, "startx", startx - n2 * conf5.boxMargin, Math.min);
                _self.updateVal(item, "stopx", stopx + n2 * conf5.boxMargin, Math.max);
                _self.updateVal(bounds3.data, "starty", starty - n2 * conf5.boxMargin, Math.min);
                _self.updateVal(bounds3.data, "stopy", stopy + n2 * conf5.boxMargin, Math.max);
              }
            }, "updateItemBounds");
          }
          __name(updateFn, "updateFn");
          this.sequenceItems.forEach(updateFn());
        }, "updateBounds"),
        insert: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
          const _startx = Math.min(startx, stopx);
          const _stopx = Math.max(startx, stopx);
          const _starty = Math.min(starty, stopy);
          const _stopy = Math.max(starty, stopy);
          this.updateVal(bounds3.data, "startx", _startx, Math.min);
          this.updateVal(bounds3.data, "starty", _starty, Math.min);
          this.updateVal(bounds3.data, "stopx", _stopx, Math.max);
          this.updateVal(bounds3.data, "stopy", _stopy, Math.max);
          this.updateBounds(_startx, _starty, _stopx, _stopy);
        }, "insert"),
        bumpVerticalPos: /* @__PURE__ */ __name(function(bump) {
          this.verticalPos = this.verticalPos + bump;
          this.data.stopy = this.verticalPos;
        }, "bumpVerticalPos"),
        getVerticalPos: /* @__PURE__ */ __name(function() {
          return this.verticalPos;
        }, "getVerticalPos"),
        getBounds: /* @__PURE__ */ __name(function() {
          return this.data;
        }, "getBounds")
      };
      fills = conf4.sectionFills;
      textColours = conf4.sectionColours;
      drawTasks = /* @__PURE__ */ __name(function(diagram31, tasks4, verticalPos, diagramId3) {
        const conf5 = getConfig2().journey;
        let lastSection = "";
        const sectionVHeight = conf5.height * 2 + conf5.diagramMarginY;
        const taskPos = verticalPos + sectionVHeight;
        let sectionNumber = 0;
        let fill = "#CCC";
        let colour = "black";
        let num = 0;
        for (const [i2, task] of tasks4.entries()) {
          if (lastSection !== task.section) {
            fill = fills[sectionNumber % fills.length];
            num = sectionNumber % fills.length;
            colour = textColours[sectionNumber % textColours.length];
            let taskInSectionCount = 0;
            const currentSection4 = task.section;
            for (let taskIndex = i2; taskIndex < tasks4.length; taskIndex++) {
              if (tasks4[taskIndex].section == currentSection4) {
                taskInSectionCount = taskInSectionCount + 1;
              } else {
                break;
              }
            }
            const section = {
              x: i2 * conf5.taskMargin + i2 * conf5.width + leftMargin,
              y: 50,
              text: task.section,
              fill,
              num,
              colour,
              taskCount: taskInSectionCount
            };
            svgDraw_default3.drawSection(diagram31, section, conf5);
            lastSection = task.section;
            sectionNumber++;
          }
          const taskActors = task.people.reduce((acc, actorName) => {
            if (actors[actorName]) {
              acc[actorName] = actors[actorName];
            }
            return acc;
          }, {});
          task.x = i2 * conf5.taskMargin + i2 * conf5.width + leftMargin;
          task.y = taskPos;
          task.width = conf5.diagramMarginX;
          task.height = conf5.diagramMarginY;
          task.colour = colour;
          task.fill = fill;
          task.num = num;
          task.actors = taskActors;
          svgDraw_default3.drawTask(diagram31, task, conf5, diagramId3);
          bounds3.insert(task.x, task.y, task.x + task.width + conf5.taskMargin, 300 + 5 * 30);
        }
      }, "drawTasks");
      journeyRenderer_default = {
        setConf: setConf5,
        draw: draw15
      };
    }
  });

  // src/diagrams/user-journey/journeyDiagram.ts
  var journeyDiagram_exports = {};
  __export(journeyDiagram_exports, {
    diagram: () => diagram16
  });
  var diagram16;
  var init_journeyDiagram = __esm({
    "src/diagrams/user-journey/journeyDiagram.ts"() {
      "use strict";
      init_journey();
      init_journeyDb();
      init_styles11();
      init_journeyRenderer();
      diagram16 = {
        parser: journey_default,
        db: journeyDb_default,
        renderer: journeyRenderer_default,
        styles: styles_default11,
        init: /* @__PURE__ */ __name((cnf) => {
          journeyRenderer_default.setConf(cnf.journey);
          journeyDb_default.clear();
        }, "init")
      };
    }
  });

  // src/diagrams/timeline/parser/timeline.jison
  var parser15, timeline_default;
  var init_timeline = __esm({
    "src/diagrams/timeline/parser/timeline.jison"() {
      "use strict";
      parser15 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [6, 11, 13, 14, 15, 17, 19, 20, 23, 24], $V1 = [1, 12], $V2 = [1, 13], $V3 = [1, 14], $V4 = [1, 15], $V5 = [1, 16], $V6 = [1, 19], $V7 = [1, 20];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "timeline_header": 4, "document": 5, "EOF": 6, "timeline": 7, "timeline_lr": 8, "timeline_td": 9, "line": 10, "SPACE": 11, "statement": 12, "NEWLINE": 13, "title": 14, "acc_title": 15, "acc_title_value": 16, "acc_descr": 17, "acc_descr_value": 18, "acc_descr_multiline_value": 19, "section": 20, "period_statement": 21, "event_statement": 22, "period": 23, "event": 24, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 6: "EOF", 7: "timeline", 8: "timeline_lr", 9: "timeline_td", 11: "SPACE", 13: "NEWLINE", 14: "title", 15: "acc_title", 16: "acc_title_value", 17: "acc_descr", 18: "acc_descr_value", 19: "acc_descr_multiline_value", 20: "section", 23: "period", 24: "event" },
          productions_: [0, [3, 3], [4, 1], [4, 1], [4, 1], [5, 0], [5, 2], [10, 2], [10, 1], [10, 1], [10, 1], [12, 1], [12, 2], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [21, 1], [22, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 1:
                return $$[$0 - 1];
                break;
              case 3:
                yy.setDirection("LR");
                break;
              case 4:
                yy.setDirection("TD");
                break;
              case 5:
                this.$ = [];
                break;
              case 6:
                $$[$0 - 1].push($$[$0]);
                this.$ = $$[$0 - 1];
                break;
              case 7:
              case 8:
                this.$ = $$[$0];
                break;
              case 9:
              case 10:
                this.$ = [];
                break;
              case 11:
                yy.getCommonDb().setDiagramTitle($$[$0].substr(6));
                this.$ = $$[$0].substr(6);
                break;
              case 12:
                this.$ = $$[$0].trim();
                yy.getCommonDb().setAccTitle(this.$);
                break;
              case 13:
              case 14:
                this.$ = $$[$0].trim();
                yy.getCommonDb().setAccDescription(this.$);
                break;
              case 15:
                yy.addSection($$[$0].substr(8));
                this.$ = $$[$0].substr(8);
                break;
              case 18:
                yy.addTask($$[$0], 0, "");
                this.$ = $$[$0];
                break;
              case 19:
                yy.addEvent($$[$0].substr(2));
                this.$ = $$[$0];
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: 2, 7: [1, 3], 8: [1, 4], 9: [1, 5] }, { 1: [3] }, o2($V0, [2, 5], { 5: 6 }), o2($V0, [2, 2]), o2($V0, [2, 3]), o2($V0, [2, 4]), { 6: [1, 7], 10: 8, 11: [1, 9], 12: 10, 13: [1, 11], 14: $V1, 15: $V2, 17: $V3, 19: $V4, 20: $V5, 21: 17, 22: 18, 23: $V6, 24: $V7 }, o2($V0, [2, 10], { 1: [2, 1] }), o2($V0, [2, 6]), { 12: 21, 14: $V1, 15: $V2, 17: $V3, 19: $V4, 20: $V5, 21: 17, 22: 18, 23: $V6, 24: $V7 }, o2($V0, [2, 8]), o2($V0, [2, 9]), o2($V0, [2, 11]), { 16: [1, 22] }, { 18: [1, 23] }, o2($V0, [2, 14]), o2($V0, [2, 15]), o2($V0, [2, 16]), o2($V0, [2, 17]), o2($V0, [2, 18]), o2($V0, [2, 19]), o2($V0, [2, 7]), o2($V0, [2, 12]), o2($V0, [2, 13])],
          defaultActions: {},
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  break;
                case 1:
                  break;
                case 2:
                  return 13;
                  break;
                case 3:
                  break;
                case 4:
                  break;
                case 5:
                  return 8;
                  break;
                case 6:
                  return 9;
                  break;
                case 7:
                  return 7;
                  break;
                case 8:
                  return 14;
                  break;
                case 9:
                  this.begin("acc_title");
                  return 15;
                  break;
                case 10:
                  this.popState();
                  return "acc_title_value";
                  break;
                case 11:
                  this.begin("acc_descr");
                  return 17;
                  break;
                case 12:
                  this.popState();
                  return "acc_descr_value";
                  break;
                case 13:
                  this.begin("acc_descr_multiline");
                  break;
                case 14:
                  this.popState();
                  break;
                case 15:
                  return "acc_descr_multiline_value";
                  break;
                case 16:
                  return 20;
                  break;
                case 17:
                  return 24;
                  break;
                case 18:
                  return 23;
                  break;
                case 19:
                  return 6;
                  break;
                case 20:
                  return "INVALID";
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:timeline[ \t]+LR\b)/i, /^(?:timeline[ \t]+TD\b)/i, /^(?:timeline\b)/i, /^(?:title\s[^\n]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^:\n]+)/i, /^(?::\s(?:[^:\n]|:(?!\s))+)/i, /^(?:[^#:\n]+)/i, /^(?:$)/i, /^(?:.)/i],
            conditions: { "acc_descr_multiline": { "rules": [14, 15], "inclusive": false }, "acc_descr": { "rules": [12], "inclusive": false }, "acc_title": { "rules": [10], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 16, 17, 18, 19, 20], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser15.parser = parser15;
      timeline_default = parser15;
    }
  });

  // src/diagrams/timeline/timelineDb.js
  var timelineDb_exports = {};
  __export(timelineDb_exports, {
    addEvent: () => addEvent,
    addSection: () => addSection4,
    addTask: () => addTask3,
    addTaskOrg: () => addTaskOrg3,
    clear: () => clear14,
    default: () => timelineDb_default,
    getCommonDb: () => getCommonDb2,
    getDirection: () => getDirection2,
    getSections: () => getSections4,
    getTasks: () => getTasks3,
    setDirection: () => setDirection2
  });
  var currentSection3, currentTaskId, direction, sections4, tasks3, rawTasks3, getCommonDb2, clear14, setDirection2, getDirection2, addSection4, getSections4, getTasks3, addTask3, addEvent, addTaskOrg3, compileTasks3, timelineDb_default;
  var init_timelineDb = __esm({
    "src/diagrams/timeline/timelineDb.js"() {
      "use strict";
      init_commonDb();
      currentSection3 = "";
      currentTaskId = 0;
      direction = "LR";
      sections4 = [];
      tasks3 = [];
      rawTasks3 = [];
      getCommonDb2 = /* @__PURE__ */ __name(() => commonDb_exports, "getCommonDb");
      clear14 = /* @__PURE__ */ __name(function() {
        sections4.length = 0;
        tasks3.length = 0;
        currentSection3 = "";
        rawTasks3.length = 0;
        direction = "LR";
        clear();
      }, "clear");
      setDirection2 = /* @__PURE__ */ __name(function(dir2) {
        direction = dir2;
      }, "setDirection");
      getDirection2 = /* @__PURE__ */ __name(function() {
        return direction;
      }, "getDirection");
      addSection4 = /* @__PURE__ */ __name(function(txt) {
        currentSection3 = txt;
        sections4.push(txt);
      }, "addSection");
      getSections4 = /* @__PURE__ */ __name(function() {
        return sections4;
      }, "getSections");
      getTasks3 = /* @__PURE__ */ __name(function() {
        let allItemsProcessed = compileTasks3();
        const maxDepth = 100;
        let iterationCount = 0;
        while (!allItemsProcessed && iterationCount < maxDepth) {
          allItemsProcessed = compileTasks3();
          iterationCount++;
        }
        tasks3.push(...rawTasks3);
        return tasks3;
      }, "getTasks");
      addTask3 = /* @__PURE__ */ __name(function(period, length2, event3) {
        const rawTask = {
          id: currentTaskId++,
          section: currentSection3,
          type: currentSection3,
          task: period,
          score: length2 ? length2 : 0,
          //if event is defined, then add it the events array
          events: event3 ? [event3] : []
        };
        rawTasks3.push(rawTask);
      }, "addTask");
      addEvent = /* @__PURE__ */ __name(function(event3) {
        const currentTask = rawTasks3.find((task) => task.id === currentTaskId - 1);
        currentTask.events.push(event3);
      }, "addEvent");
      addTaskOrg3 = /* @__PURE__ */ __name(function(descr) {
        const newTask = {
          section: currentSection3,
          type: currentSection3,
          description: descr,
          task: descr,
          classes: []
        };
        tasks3.push(newTask);
      }, "addTaskOrg");
      compileTasks3 = /* @__PURE__ */ __name(function() {
        const compileTask = /* @__PURE__ */ __name(function(pos) {
          return rawTasks3[pos].processed;
        }, "compileTask");
        let allProcessed = true;
        for (const [i2, rawTask] of rawTasks3.entries()) {
          compileTask(i2);
          allProcessed = allProcessed && rawTask.processed;
        }
        return allProcessed;
      }, "compileTasks");
      timelineDb_default = {
        clear: clear14,
        getCommonDb: getCommonDb2,
        getDirection: getDirection2,
        setDirection: setDirection2,
        addSection: addSection4,
        getSections: getSections4,
        getTasks: getTasks3,
        addTask: addTask3,
        addTaskOrg: addTaskOrg3,
        addEvent
      };
    }
  });

  // src/diagrams/timeline/svgDraw.js
  function wrap2(text4, width3) {
    text4.each(function() {
      var text5 = select_default2(this), words = text5.text().split(/(\s+|<br>)/).reverse(), word, line2 = [], lineHeight = 1.1, y6 = text5.attr("y"), dy = parseFloat(text5.attr("dy")), tspan = text5.text(null).append("tspan").attr("x", 0).attr("y", y6).attr("dy", dy + "em");
      for (let j3 = 0; j3 < words.length; j3++) {
        word = words[words.length - 1 - j3];
        line2.push(word);
        tspan.text(line2.join(" ").trim());
        if (tspan.node().getComputedTextLength() > width3 || word === "<br>") {
          line2.pop();
          tspan.text(line2.join(" ").trim());
          if (word === "<br>") {
            line2 = [""];
          } else {
            line2 = [word];
          }
          tspan = text5.append("tspan").attr("x", 0).attr("y", y6).attr("dy", lineHeight + "em").text(word);
        }
      }
    });
  }
  var nodeCount, drawRect6, drawFace2, drawCircle2, drawText5, drawLabel3, drawSection2, taskCount2, drawTask2, drawBackgroundRect4, getTextObj4, getNoteRect3, _drawTextCandidateFunc4, initGraphics2, drawNode, getVirtualNodeHeight, defaultBkg, svgDraw_default4;
  var init_svgDraw4 = __esm({
    "src/diagrams/timeline/svgDraw.js"() {
      "use strict";
      init_src32();
      nodeCount = 0;
      drawRect6 = /* @__PURE__ */ __name(function(elem, rectData) {
        const rectElem = elem.append("rect");
        rectElem.attr("x", rectData.x);
        rectElem.attr("y", rectData.y);
        rectElem.attr("fill", rectData.fill);
        rectElem.attr("stroke", rectData.stroke);
        rectElem.attr("width", rectData.width);
        rectElem.attr("height", rectData.height);
        rectElem.attr("rx", rectData.rx);
        rectElem.attr("ry", rectData.ry);
        if (rectData.class !== void 0) {
          rectElem.attr("class", rectData.class);
        }
        return rectElem;
      }, "drawRect");
      drawFace2 = /* @__PURE__ */ __name(function(element3, faceData) {
        const radius2 = 15;
        const circleElement = element3.append("circle").attr("cx", faceData.cx).attr("cy", faceData.cy).attr("class", "face").attr("r", radius2).attr("stroke-width", 2).attr("overflow", "visible");
        const face = element3.append("g");
        face.append("circle").attr("cx", faceData.cx - radius2 / 3).attr("cy", faceData.cy - radius2 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
        face.append("circle").attr("cx", faceData.cx + radius2 / 3).attr("cy", faceData.cy - radius2 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
        function smile(face2) {
          const arc = arc_default().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius2 / 2).outerRadius(radius2 / 2.2);
          face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")");
        }
        __name(smile, "smile");
        function sad(face2) {
          const arc = arc_default().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius2 / 2).outerRadius(radius2 / 2.2);
          face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")");
        }
        __name(sad, "sad");
        function ambivalent(face2) {
          face2.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", faceData.cx - 5).attr("y1", faceData.cy + 7).attr("x2", faceData.cx + 5).attr("y2", faceData.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
        }
        __name(ambivalent, "ambivalent");
        if (faceData.score > 3) {
          smile(face);
        } else if (faceData.score < 3) {
          sad(face);
        } else {
          ambivalent(face);
        }
        return circleElement;
      }, "drawFace");
      drawCircle2 = /* @__PURE__ */ __name(function(element3, circleData) {
        const circleElement = element3.append("circle");
        circleElement.attr("cx", circleData.cx);
        circleElement.attr("cy", circleData.cy);
        circleElement.attr("class", "actor-" + circleData.pos);
        circleElement.attr("fill", circleData.fill);
        circleElement.attr("stroke", circleData.stroke);
        circleElement.attr("r", circleData.r);
        if (circleElement.class !== void 0) {
          circleElement.attr("class", circleElement.class);
        }
        if (circleData.title !== void 0) {
          circleElement.append("title").text(circleData.title);
        }
        return circleElement;
      }, "drawCircle");
      drawText5 = /* @__PURE__ */ __name(function(elem, textData) {
        const nText = textData.text.replace(/<br\s*\/?>/gi, " ");
        const textElem = elem.append("text");
        textElem.attr("x", textData.x);
        textElem.attr("y", textData.y);
        textElem.attr("class", "legend");
        textElem.style("text-anchor", textData.anchor);
        if (textData.class !== void 0) {
          textElem.attr("class", textData.class);
        }
        const span = textElem.append("tspan");
        span.attr("x", textData.x + textData.textMargin * 2);
        span.text(nText);
        return textElem;
      }, "drawText");
      drawLabel3 = /* @__PURE__ */ __name(function(elem, txtObject) {
        function genPoints(x5, y6, width3, height2, cut) {
          return x5 + "," + y6 + " " + (x5 + width3) + "," + y6 + " " + (x5 + width3) + "," + (y6 + height2 - cut) + " " + (x5 + width3 - cut * 1.2) + "," + (y6 + height2) + " " + x5 + "," + (y6 + height2);
        }
        __name(genPoints, "genPoints");
        const polygon2 = elem.append("polygon");
        polygon2.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7));
        polygon2.attr("class", "labelBox");
        txtObject.y = txtObject.y + txtObject.labelMargin;
        txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
        drawText5(elem, txtObject);
      }, "drawLabel");
      drawSection2 = /* @__PURE__ */ __name(function(elem, section, conf5) {
        const g2 = elem.append("g");
        const rect3 = getNoteRect3();
        rect3.x = section.x;
        rect3.y = section.y;
        rect3.fill = section.fill;
        rect3.width = conf5.width;
        rect3.height = conf5.height;
        rect3.class = "journey-section section-type-" + section.num;
        rect3.rx = 3;
        rect3.ry = 3;
        drawRect6(g2, rect3);
        _drawTextCandidateFunc4(conf5)(
          section.text,
          g2,
          rect3.x,
          rect3.y,
          rect3.width,
          rect3.height,
          { class: "journey-section section-type-" + section.num },
          conf5,
          section.colour
        );
      }, "drawSection");
      taskCount2 = -1;
      drawTask2 = /* @__PURE__ */ __name(function(elem, task, conf5, diagramId3) {
        const center4 = task.x + conf5.width / 2;
        const g2 = elem.append("g");
        taskCount2++;
        const maxHeight = 300 + 5 * 30;
        g2.append("line").attr("id", diagramId3 + "-task" + taskCount2).attr("x1", center4).attr("y1", task.y).attr("x2", center4).attr("y2", maxHeight).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666");
        drawFace2(g2, {
          cx: center4,
          cy: 300 + (5 - task.score) * 30,
          score: task.score
        });
        const rect3 = getNoteRect3();
        rect3.x = task.x;
        rect3.y = task.y;
        rect3.fill = task.fill;
        rect3.width = conf5.width;
        rect3.height = conf5.height;
        rect3.class = "task task-type-" + task.num;
        rect3.rx = 3;
        rect3.ry = 3;
        drawRect6(g2, rect3);
        _drawTextCandidateFunc4(conf5)(
          task.task,
          g2,
          rect3.x,
          rect3.y,
          rect3.width,
          rect3.height,
          { class: "task" },
          conf5,
          task.colour
        );
      }, "drawTask");
      drawBackgroundRect4 = /* @__PURE__ */ __name(function(elem, bounds4) {
        const rectElem = drawRect6(elem, {
          x: bounds4.startx,
          y: bounds4.starty,
          width: bounds4.stopx - bounds4.startx,
          height: bounds4.stopy - bounds4.starty,
          fill: bounds4.fill,
          class: "rect"
        });
        rectElem.lower();
      }, "drawBackgroundRect");
      getTextObj4 = /* @__PURE__ */ __name(function() {
        return {
          x: 0,
          y: 0,
          fill: void 0,
          "text-anchor": "start",
          width: 100,
          height: 100,
          textMargin: 0,
          rx: 0,
          ry: 0
        };
      }, "getTextObj");
      getNoteRect3 = /* @__PURE__ */ __name(function() {
        return {
          x: 0,
          y: 0,
          width: 100,
          anchor: "start",
          height: 100,
          rx: 0,
          ry: 0
        };
      }, "getNoteRect");
      _drawTextCandidateFunc4 = /* @__PURE__ */ (function() {
        function byText(content, g2, x5, y6, width3, height2, textAttrs, colour) {
          const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6 + height2 / 2 + 5).style("font-color", colour).style("text-anchor", "middle").text(content);
          _setTextAttrs(text4, textAttrs);
        }
        __name(byText, "byText");
        function byTspan(content, g2, x5, y6, width3, height2, textAttrs, conf5, colour) {
          const { taskFontSize, taskFontFamily } = conf5;
          const lines = content.split(/<br\s*\/?>/gi);
          for (let i2 = 0; i2 < lines.length; i2++) {
            const dy = i2 * taskFontSize - taskFontSize * (lines.length - 1) / 2;
            const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6).attr("fill", colour).style("text-anchor", "middle").style("font-size", taskFontSize).style("font-family", taskFontFamily);
            text4.append("tspan").attr("x", x5 + width3 / 2).attr("dy", dy).text(lines[i2]);
            text4.attr("y", y6 + height2 / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
            _setTextAttrs(text4, textAttrs);
          }
        }
        __name(byTspan, "byTspan");
        function byFo(content, g2, x5, y6, width3, height2, textAttrs, conf5) {
          const body = g2.append("switch");
          const f2 = body.append("foreignObject").attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2).attr("position", "fixed");
          const text4 = f2.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
          text4.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
          byTspan(content, body, x5, y6, width3, height2, textAttrs, conf5);
          _setTextAttrs(text4, textAttrs);
        }
        __name(byFo, "byFo");
        function _setTextAttrs(toText, fromTextAttrsDict) {
          for (const key in fromTextAttrsDict) {
            if (key in fromTextAttrsDict) {
              toText.attr(key, fromTextAttrsDict[key]);
            }
          }
        }
        __name(_setTextAttrs, "_setTextAttrs");
        return function(conf5) {
          return conf5.textPlacement === "fo" ? byFo : conf5.textPlacement === "old" ? byText : byTspan;
        };
      })();
      initGraphics2 = /* @__PURE__ */ __name(function(graphics, id34) {
        nodeCount = 0;
        taskCount2 = -1;
        graphics.append("defs").append("marker").attr("id", id34 + "-arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
      }, "initGraphics");
      __name(wrap2, "wrap");
      drawNode = /* @__PURE__ */ __name(function(elem, node2, fullSection, conf5, diagramId3, isEvent = false) {
        const { theme, look } = conf5;
        const isReduxTheme = theme?.includes("redux");
        const maxSections = conf5?.themeVariables?.THEME_COLOR_LIMIT ?? 12;
        const section = fullSection % maxSections - 1;
        const nodeElem = elem.append("g");
        node2.section = section;
        nodeElem.attr(
          "class",
          (node2.class ? node2.class + " " : "") + "timeline-node " + ("section-" + section)
        );
        const bkgElem = nodeElem.append("g");
        const textElem = nodeElem.append("g");
        const txt = textElem.append("text").text(node2.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap2, node2.width);
        const bbox = txt.node().getBBox();
        const fontSize = conf5.fontSize?.replace ? conf5.fontSize.replace("px", "") : conf5.fontSize;
        node2.height = bbox.height + fontSize * 1.1 * 0.5 + node2.padding;
        node2.height = Math.max(node2.height, node2.maxHeight);
        node2.width = node2.width + 2 * node2.padding;
        textElem.attr("transform", "translate(" + node2.width / 2 + ", " + node2.padding / 2 + ")");
        if (isReduxTheme) {
          textElem.attr(
            "transform",
            `translate(${node2.width / 2}, ${isEvent ? node2.padding / 2 + 3 : node2.padding})`
          );
        }
        defaultBkg(bkgElem, node2, section, diagramId3, conf5);
        if (look === "neo") {
          nodeElem.attr("data-look", `neo`);
          if (isReduxTheme) {
            const isDark2 = theme.includes("dark");
            const rootSvgNode = elem.node()?.ownerSVGElement ?? elem.node();
            const rootSvg = select_default2(rootSvgNode);
            const svgId = rootSvg.attr("id") ?? "";
            const dropShadowId = svgId ? `${svgId}-drop-shadow` : "drop-shadow";
            if (rootSvg.select(`#${dropShadowId}`).empty()) {
              const existingDefs = rootSvg.select("defs");
              const defsEl = existingDefs.empty() ? rootSvg.append("defs") : existingDefs;
              defsEl.append("filter").attr("id", dropShadowId).attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", isDark2 ? "0.2" : "0.06").attr("flood-color", isDark2 ? "#FFFFFF" : "#000000");
            }
          }
        }
        return node2;
      }, "drawNode");
      getVirtualNodeHeight = /* @__PURE__ */ __name(function(elem, node2, conf5) {
        const textElem = elem.append("g");
        const txt = textElem.append("text").text(node2.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap2, node2.width);
        const bbox = txt.node().getBBox();
        const fontSize = conf5.fontSize?.replace ? conf5.fontSize.replace("px", "") : conf5.fontSize;
        textElem.remove();
        return bbox.height + fontSize * 1.1 * 0.5 + node2.padding;
      }, "getVirtualNodeHeight");
      defaultBkg = /* @__PURE__ */ __name(function(elem, node2, section, diagramId3, config5) {
        const { theme } = config5;
        const r2 = theme?.includes("redux") ? 0 : 5;
        const rd = 5;
        const d3 = r2 > 0 ? `M0 ${node2.height - rd} v${-node2.height + 2 * rd} q0,-${r2},${r2},-${r2} h${node2.width - 2 * rd} q${r2},0,${r2},${r2} v${node2.height - rd} H0 Z` : `M0 ${node2.height - rd} v${-(node2.height - rd)} h${node2.width} v${node2.height} H0 Z`;
        elem.append("path").attr("id", diagramId3 + "-node-" + nodeCount++).attr("class", "node-bkg node-" + node2.type).attr("d", d3);
        if (!theme?.includes("redux")) {
          elem.append("line").attr("class", "node-line-" + section).attr("x1", 0).attr("y1", node2.height).attr("x2", node2.width).attr("y2", node2.height);
        }
      }, "defaultBkg");
      svgDraw_default4 = {
        drawRect: drawRect6,
        drawCircle: drawCircle2,
        drawSection: drawSection2,
        drawText: drawText5,
        drawLabel: drawLabel3,
        drawTask: drawTask2,
        drawBackgroundRect: drawBackgroundRect4,
        getTextObj: getTextObj4,
        getNoteRect: getNoteRect3,
        initGraphics: initGraphics2,
        drawNode,
        getVirtualNodeHeight
      };
    }
  });

  // src/diagrams/timeline/timelineRenderer.ts
  var draw17, drawTasks2, drawEvents, timelineRenderer_default;
  var init_timelineRenderer = __esm({
    "src/diagrams/timeline/timelineRenderer.ts"() {
      "use strict";
      init_src32();
      init_svgDraw4();
      init_logger();
      init_diagramAPI();
      init_setupGraphViewbox();
      draw17 = /* @__PURE__ */ __name(function(text4, id34, version3, diagObj) {
        const conf5 = getConfig2();
        const { look, theme, themeVariables } = conf5;
        const { useGradient, gradientStart, gradientStop } = themeVariables;
        const LEFT_MARGIN = conf5.timeline?.leftMargin ?? 50;
        log.debug("timeline", diagObj.db);
        const securityLevel = conf5.securityLevel;
        let sandboxElement;
        if (securityLevel === "sandbox") {
          sandboxElement = select_default2("#i" + id34);
        }
        const root3 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body");
        const svg2 = root3.select("#" + id34);
        svg2.append("g");
        const tasks4 = diagObj.db.getTasks();
        const title2 = diagObj.db.getCommonDb().getDiagramTitle();
        log.debug("task", tasks4);
        svgDraw_default4.initGraphics(svg2, id34);
        const sections6 = diagObj.db.getSections();
        log.debug("sections", sections6);
        let maxSectionHeight = 0;
        let maxTaskHeight = 0;
        let depthY = 0;
        let sectionBeginY = 0;
        let masterX = 50 + LEFT_MARGIN;
        let masterY = 50;
        sectionBeginY = 50;
        let sectionNumber = 0;
        let hasSections = true;
        sections6.forEach(function(section) {
          const sectionNode = {
            number: sectionNumber,
            descr: section,
            section: sectionNumber,
            width: 150,
            padding: 20,
            maxHeight: maxSectionHeight
          };
          const sectionHeight = svgDraw_default4.getVirtualNodeHeight(svg2, sectionNode, conf5);
          log.debug("sectionHeight before draw", sectionHeight);
          maxSectionHeight = Math.max(maxSectionHeight, sectionHeight + 20);
        });
        let maxEventCount = 0;
        let maxEventLineLength = 0;
        log.debug("tasks.length", tasks4.length);
        for (const [i2, task] of tasks4.entries()) {
          const taskNode = {
            number: i2,
            descr: task,
            section: task.section,
            width: 150,
            padding: 20,
            maxHeight: maxTaskHeight
          };
          const taskHeight = svgDraw_default4.getVirtualNodeHeight(svg2, taskNode, conf5);
          log.debug("taskHeight before draw", taskHeight);
          maxTaskHeight = Math.max(maxTaskHeight, taskHeight + 20);
          maxEventCount = Math.max(maxEventCount, task.events.length);
          let maxEventLineLengthTemp = 0;
          for (const event3 of task.events) {
            const eventNode = {
              descr: event3,
              section: task.section,
              number: task.section,
              width: 150,
              padding: 20,
              maxHeight: 50
            };
            maxEventLineLengthTemp += svgDraw_default4.getVirtualNodeHeight(svg2, eventNode, conf5);
          }
          if (task.events.length > 0) {
            maxEventLineLengthTemp += (task.events.length - 1) * 10;
          }
          maxEventLineLength = Math.max(maxEventLineLength, maxEventLineLengthTemp);
        }
        log.debug("maxSectionHeight before draw", maxSectionHeight);
        log.debug("maxTaskHeight before draw", maxTaskHeight);
        if (sections6 && sections6.length > 0) {
          sections6.forEach((section) => {
            const tasksForSection = tasks4.filter((task) => task.section === section);
            const sectionNode = {
              number: sectionNumber,
              descr: section,
              section: sectionNumber,
              width: 200 * Math.max(tasksForSection.length, 1) - 50,
              padding: 20,
              maxHeight: maxSectionHeight
            };
            log.debug("sectionNode", sectionNode);
            const sectionNodeWrapper = svg2.append("g");
            const node2 = svgDraw_default4.drawNode(sectionNodeWrapper, sectionNode, sectionNumber, conf5, id34);
            log.debug("sectionNode output", node2);
            sectionNodeWrapper.attr("transform", `translate(${masterX}, ${sectionBeginY})`);
            masterY += maxSectionHeight + 50;
            if (tasksForSection.length > 0) {
              drawTasks2(
                svg2,
                tasksForSection,
                sectionNumber,
                masterX,
                masterY,
                maxTaskHeight,
                conf5,
                maxEventCount,
                maxEventLineLength,
                maxSectionHeight,
                false,
                id34
              );
            }
            masterX += 200 * Math.max(tasksForSection.length, 1);
            masterY = sectionBeginY;
            sectionNumber++;
          });
        } else {
          hasSections = false;
          drawTasks2(
            svg2,
            tasks4,
            sectionNumber,
            masterX,
            masterY,
            maxTaskHeight,
            conf5,
            maxEventCount,
            maxEventLineLength,
            maxSectionHeight,
            true,
            id34
          );
        }
        const box = svg2.node().getBBox();
        log.debug("bounds", box);
        if (title2) {
          svg2.append("text").text(title2).attr("x", look === "neo" ? box.x * 2 + LEFT_MARGIN : box.width / 2 - LEFT_MARGIN).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20);
        }
        depthY = hasSections ? maxSectionHeight + maxTaskHeight + 150 : maxTaskHeight + 100;
        const lineWrapper = svg2.append("g").attr("class", "lineWrapper");
        lineWrapper.append("line").attr("x1", LEFT_MARGIN).attr("y1", depthY).attr("x2", box.width + 3 * LEFT_MARGIN).attr("y2", depthY).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", `url(#${id34}-arrowhead)`);
        if (look === "neo" && useGradient && theme !== "neutral") {
          const existingDefs = svg2.select("defs");
          const defsEl = existingDefs.empty() ? svg2.append("defs") : existingDefs;
          const gradient = defsEl.append("linearGradient").attr("id", svg2.attr("id") + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
          gradient.append("stop").attr("offset", "0%").attr("stop-color", gradientStart).attr("stop-opacity", 1);
          gradient.append("stop").attr("offset", "100%").attr("stop-color", gradientStop).attr("stop-opacity", 1);
        }
        setupGraphViewbox(
          void 0,
          svg2,
          conf5.timeline?.padding ?? 50,
          conf5.timeline?.useMaxWidth ?? false
        );
      }, "draw");
      drawTasks2 = /* @__PURE__ */ __name(function(diagram31, tasks4, sectionColor, masterX, masterY, maxTaskHeight, conf5, maxEventCount, maxEventLineLength, maxSectionHeight, isWithoutSections, diagramId3) {
        for (const task of tasks4) {
          const taskNode = {
            descr: task.task,
            section: sectionColor,
            number: sectionColor,
            width: 150,
            padding: 20,
            maxHeight: maxTaskHeight
          };
          log.debug("taskNode", taskNode);
          const taskWrapper = diagram31.append("g").attr("class", "taskWrapper");
          const node2 = svgDraw_default4.drawNode(taskWrapper, taskNode, sectionColor, conf5, diagramId3);
          const taskHeight = node2.height;
          log.debug("taskHeight after draw", taskHeight);
          taskWrapper.attr("transform", `translate(${masterX}, ${masterY})`);
          maxTaskHeight = Math.max(maxTaskHeight, taskHeight);
          if (task.events) {
            const lineWrapper = diagram31.append("g").attr("class", "lineWrapper");
            let lineLength = maxTaskHeight;
            masterY += 100;
            lineLength = lineLength + drawEvents(diagram31, task.events, sectionColor, masterX, masterY, conf5, diagramId3);
            masterY -= 100;
            lineWrapper.append("line").attr("x1", masterX + 190 / 2).attr("y1", masterY + maxTaskHeight).attr("x2", masterX + 190 / 2).attr("y2", masterY + maxTaskHeight + 100 + maxEventLineLength + 100).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", `url(#${diagramId3}-arrowhead)`).attr("stroke-dasharray", "5,5");
          }
          masterX = masterX + 200;
          if (isWithoutSections && !conf5.timeline?.disableMulticolor) {
            sectionColor++;
          }
        }
        masterY = masterY - 10;
      }, "drawTasks");
      drawEvents = /* @__PURE__ */ __name(function(diagram31, events, sectionColor, masterX, masterY, conf5, diagramId3) {
        let maxEventHeight = 0;
        const eventBeginY = masterY;
        masterY = masterY + 100;
        for (const event3 of events) {
          const eventNode = {
            descr: event3,
            section: sectionColor,
            number: sectionColor,
            width: 150,
            padding: 20,
            maxHeight: 50
          };
          log.debug("eventNode", eventNode);
          const eventWrapper = diagram31.append("g").attr("class", "eventWrapper");
          const node2 = svgDraw_default4.drawNode(eventWrapper, eventNode, sectionColor, conf5, diagramId3, true);
          const eventHeight = node2.height;
          maxEventHeight = maxEventHeight + eventHeight;
          eventWrapper.attr("transform", `translate(${masterX}, ${masterY})`);
          masterY = masterY + 10 + eventHeight;
        }
        masterY = eventBeginY;
        return maxEventHeight;
      }, "drawEvents");
      timelineRenderer_default = {
        setConf: /* @__PURE__ */ __name(() => {
        }, "setConf"),
        draw: draw17
      };
    }
  });

  // src/diagrams/timeline/timelineRendererVertical.ts
  var NODE_WIDTH, NODE_PADDING, NODE_TOTAL_WIDTH, EVENT_WIDTH, EVENT_TOTAL_WIDTH, EVENT_SPACING, EVENT_VERTICAL_GAP, SECTION_TASK_GAP, TASK_AXIS_GAP, TASK_VERTICAL_GAP, EVENT_AXIS_GAP, draw18, drawTasks3, drawEvents2, timelineRendererVertical_default;
  var init_timelineRendererVertical = __esm({
    "src/diagrams/timeline/timelineRendererVertical.ts"() {
      "use strict";
      init_svgDraw4();
      init_logger();
      init_diagramAPI();
      init_setupGraphViewbox();
      init_selectSvgElement();
      init_utils2();
      NODE_WIDTH = 200;
      NODE_PADDING = 5;
      NODE_TOTAL_WIDTH = NODE_WIDTH + NODE_PADDING * 2;
      EVENT_WIDTH = NODE_WIDTH + 100;
      EVENT_TOTAL_WIDTH = EVENT_WIDTH + NODE_PADDING * 2;
      EVENT_SPACING = 10;
      EVENT_VERTICAL_GAP = 0;
      SECTION_TASK_GAP = 20;
      TASK_AXIS_GAP = 20;
      TASK_VERTICAL_GAP = 30;
      EVENT_AXIS_GAP = 50;
      draw18 = /* @__PURE__ */ __name(function(text4, id34, version3, diagObj) {
        const conf5 = getConfig2();
        const LEFT_MARGIN = conf5.timeline?.leftMargin ?? 50;
        log.debug("timeline", diagObj.db);
        const svg2 = selectSvgElement(id34);
        svg2.append("g");
        const tasks4 = diagObj.db.getTasks();
        const title2 = diagObj.db.getCommonDb().getDiagramTitle();
        log.debug("task", tasks4);
        svgDraw_default4.initGraphics(svg2);
        const sections6 = diagObj.db.getSections();
        log.debug("sections", sections6);
        let maxSectionHeight = 0;
        let maxTaskHeight = 0;
        const masterX = 50 + LEFT_MARGIN;
        let masterY = 50;
        const contentTopY = masterY;
        const sectionBeginX = masterX;
        const leftWidth = NODE_TOTAL_WIDTH + TASK_AXIS_GAP;
        const rightWidth = EVENT_TOTAL_WIDTH + EVENT_AXIS_GAP;
        const axisX = sectionBeginX + leftWidth;
        let sectionNumber = 0;
        const hasSections = sections6 && sections6.length > 0;
        const timelineX = hasSections ? axisX : masterX + leftWidth;
        const sectionWidth = Math.max(50, leftWidth + rightWidth - NODE_PADDING * 2);
        sections6.forEach(function(section) {
          const sectionNode = {
            number: sectionNumber,
            descr: section,
            section: sectionNumber,
            width: sectionWidth,
            padding: NODE_PADDING,
            maxHeight: maxSectionHeight
          };
          const sectionHeight = svgDraw_default4.getVirtualNodeHeight(svg2, sectionNode, conf5);
          log.debug("sectionHeight before draw", sectionHeight);
          maxSectionHeight = Math.max(maxSectionHeight, sectionHeight);
        });
        let maxEventStackHeight = 0;
        log.debug("tasks.length", tasks4.length);
        for (const [i2, task] of tasks4.entries()) {
          const taskNode = {
            number: i2,
            descr: task,
            section: task.section,
            width: NODE_WIDTH,
            padding: NODE_PADDING,
            maxHeight: maxTaskHeight
          };
          const taskHeight = svgDraw_default4.getVirtualNodeHeight(svg2, taskNode, conf5);
          log.debug("taskHeight before draw", taskHeight);
          maxTaskHeight = Math.max(maxTaskHeight, taskHeight);
          let maxEventStackHeightTemp = 0;
          for (const event3 of task.events) {
            const eventNode = {
              descr: event3,
              section: task.section,
              number: task.section,
              width: EVENT_WIDTH,
              padding: NODE_PADDING,
              maxHeight: 50
            };
            maxEventStackHeightTemp += svgDraw_default4.getVirtualNodeHeight(svg2, eventNode, conf5);
          }
          if (task.events.length > 0) {
            maxEventStackHeightTemp += (task.events.length - 1) * EVENT_SPACING;
          }
          maxEventStackHeight = Math.max(maxEventStackHeight, maxEventStackHeightTemp) + EVENT_VERTICAL_GAP;
        }
        log.debug("maxSectionHeight before draw", maxSectionHeight);
        log.debug("maxTaskHeight before draw", maxTaskHeight);
        const taskBlockHeight = Math.max(maxTaskHeight, maxEventStackHeight);
        const taskSpacing = taskBlockHeight + TASK_VERTICAL_GAP;
        if (hasSections) {
          sections6.forEach((section) => {
            const tasksForSection = tasks4.filter((task) => task.section === section);
            const sectionNode = {
              number: sectionNumber,
              descr: section,
              section: sectionNumber,
              width: sectionWidth,
              padding: NODE_PADDING,
              maxHeight: maxSectionHeight
            };
            log.debug("sectionNode", sectionNode);
            const sectionNodeWrapper = svg2.append("g");
            const node2 = svgDraw_default4.drawNode(sectionNodeWrapper, sectionNode, sectionNumber, conf5);
            log.debug("sectionNode output", node2);
            const sectionX = timelineX - leftWidth;
            sectionNodeWrapper.attr("transform", `translate(${sectionX}, ${masterY})`);
            const taskStartY = masterY + node2.height + SECTION_TASK_GAP;
            if (tasksForSection.length > 0) {
              drawTasks3(
                svg2,
                tasksForSection,
                sectionNumber,
                timelineX,
                taskStartY,
                maxTaskHeight,
                conf5,
                taskSpacing,
                false
              );
            }
            const taskCount3 = tasksForSection.length;
            const sectionHeight = node2.height + SECTION_TASK_GAP + taskSpacing * Math.max(taskCount3, 1) - (taskCount3 > 0 ? TASK_VERTICAL_GAP * 2 : 0);
            masterY += sectionHeight;
            sectionNumber++;
          });
        } else {
          drawTasks3(
            svg2,
            tasks4,
            sectionNumber,
            timelineX,
            masterY,
            maxTaskHeight,
            conf5,
            taskSpacing,
            true
          );
        }
        let box = svg2.node()?.getBBox();
        if (!box) {
          throw new Error("bbox not found");
        }
        log.debug("bounds", box);
        if (title2) {
          svg2.append("text").text(title2).attr("x", box.width / 2 - LEFT_MARGIN).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20);
          box = svg2.node()?.getBBox();
          if (!box) {
            throw new Error("bbox not found");
          }
          log.debug("bounds after title", box);
        }
        const [fontSize] = parseFontSize(conf5.fontSize);
        const arrowTopOffset = (fontSize ?? 16) * 2;
        const arrowBottomPadding = (fontSize ?? 16) * 0.5 + 20;
        const lineWrapper = svg2.append("g").attr("class", "lineWrapper");
        lineWrapper.append("line").attr("x1", timelineX).attr("y1", contentTopY - arrowTopOffset).attr("x2", timelineX).attr("y2", box.y + box.height + arrowBottomPadding).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)");
        lineWrapper.lower();
        setupGraphViewbox(
          void 0,
          svg2,
          conf5.timeline?.padding ?? 50,
          conf5.timeline?.useMaxWidth ?? false
        );
      }, "draw");
      drawTasks3 = /* @__PURE__ */ __name(function(diagram31, tasks4, sectionColor, timelineX, masterY, maxTaskHeight, conf5, taskSpacing, isWithoutSections) {
        for (const task of tasks4) {
          const taskNode = {
            descr: task.task,
            section: sectionColor,
            number: sectionColor,
            width: NODE_WIDTH,
            padding: NODE_PADDING,
            maxHeight: maxTaskHeight
          };
          log.debug("taskNode", taskNode);
          const taskWrapper = diagram31.append("g").attr("class", "taskWrapper");
          const node2 = svgDraw_default4.drawNode(taskWrapper, taskNode, sectionColor, conf5);
          const taskHeight = node2.height;
          log.debug("taskHeight after draw", taskHeight);
          const taskX = timelineX - TASK_AXIS_GAP - node2.width;
          taskWrapper.attr("transform", `translate(${taskX}, ${masterY})`);
          maxTaskHeight = Math.max(maxTaskHeight, taskHeight);
          if (task.events && task.events.length > 0) {
            const eventsStartY = masterY;
            const eventsX = timelineX + EVENT_AXIS_GAP;
            drawEvents2(diagram31, task.events, sectionColor, timelineX, eventsX, eventsStartY, conf5);
          }
          masterY = masterY + taskSpacing;
          if (isWithoutSections && !conf5.timeline?.disableMulticolor) {
            sectionColor++;
          }
        }
      }, "drawTasks");
      drawEvents2 = /* @__PURE__ */ __name(function(diagram31, events, sectionColor, axisX, eventsX, startY2, conf5) {
        let currentY = startY2;
        for (const event3 of events) {
          const eventNode = {
            descr: event3,
            section: sectionColor,
            number: sectionColor,
            width: EVENT_WIDTH,
            padding: NODE_PADDING,
            maxHeight: 0
          };
          log.debug("eventNode", eventNode);
          const eventWrapper = diagram31.append("g").attr("class", "eventWrapper");
          const node2 = svgDraw_default4.drawNode(eventWrapper, eventNode, sectionColor, conf5);
          const eventHeight = node2.height;
          eventWrapper.attr("transform", `translate(${eventsX}, ${currentY})`);
          const lineWrapper = diagram31.append("g").attr("class", "lineWrapper");
          const lineY = currentY + eventHeight / 2;
          lineWrapper.append("line").attr("x1", axisX).attr("y1", lineY).attr("x2", eventsX).attr("y2", lineY).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", "url(#arrowhead)").attr("stroke-dasharray", "5,5");
          currentY = currentY + eventHeight + EVENT_SPACING;
        }
        return currentY - startY2;
      }, "drawEvents");
      timelineRendererVertical_default = {
        setConf: /* @__PURE__ */ __name(() => {
        }, "setConf"),
        draw: draw18
      };
    }
  });

  // src/diagrams/timeline/styles.js
  var genReduxSections, genSections, getStyles13, styles_default12;
  var init_styles12 = __esm({
    "src/diagrams/timeline/styles.js"() {
      "use strict";
      init_dist();
      init_config();
      genReduxSections = /* @__PURE__ */ __name((options2) => {
        const { theme } = getConfig();
        const isDarkTheme = theme?.includes("dark");
        const isColorTheme = theme?.includes("color");
        const rawSvgId = options2.svgId?.replace(/^#/, "") ?? "";
        const scopedDropShadow = rawSvgId ? `url(#${rawSvgId}-drop-shadow)` : options2.dropShadow ?? "none";
        let sections6 = "";
        for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
          const sw = `${17 - 3 * i2}`;
          const color2 = isColorTheme ? options2.borderColorArray[i2] : options2.mainBkg;
          const stroke = isColorTheme ? options2.borderColorArray[i2] : options2.nodeBorder;
          sections6 += `
    .section-${i2 - 1} rect,
    .section-${i2 - 1} path,
    .section-${i2 - 1} circle {
      fill: ${isDarkTheme && isColorTheme ? options2.mainBkg : color2};
      stroke: ${stroke};
      stroke-width: ${options2.strokeWidth};
      filter: ${scopedDropShadow};
    }

    .section-${i2 - 1} text {
      fill: ${options2.nodeBorder};
      font-weight: ${options2.fontWeight}
    }

    .node-icon-${i2 - 1} {
      font-size: 40px;
      color: ${options2["cScaleLabel" + i2]};
    }

    .section-edge-${i2 - 1} {
      stroke: ${options2["cScale" + i2]};
    }

    .edge-depth-${i2 - 1} {
      stroke-width: ${sw};
    }

    .section-${i2 - 1} line {
      stroke: ${options2["cScaleInv" + i2]};
      stroke-width: 3;
    }

    .lineWrapper line {
      stroke: ${options2.nodeBorder};
      stroke-width:${options2.strokeWidth}
    }

    .disabled,
    .disabled circle,
    .disabled text {
      fill: ${options2.tertiaryColor ?? "lightgray"};
    }

    .disabled text {
      fill: ${options2.clusterBorder ?? "#efefef"};
    }
    `;
        }
        return sections6;
      }, "genReduxSections");
      genSections = /* @__PURE__ */ __name((options2) => {
        let sections6 = "";
        for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
          options2["lineColor" + i2] = options2["lineColor" + i2] || options2["cScaleInv" + i2];
          if (is_dark_default(options2["lineColor" + i2])) {
            options2["lineColor" + i2] = lighten_default(options2["lineColor" + i2], 20);
          } else {
            options2["lineColor" + i2] = darken_default(options2["lineColor" + i2], 20);
          }
        }
        for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
          const sw = "" + (17 - 3 * i2);
          sections6 += `
    .section-${i2 - 1} rect, .section-${i2 - 1} path, .section-${i2 - 1} circle, .section-${i2 - 1} path  {
      fill: ${options2["cScale" + i2]};
    }
    .section-${i2 - 1} text {
     fill: ${options2["cScaleLabel" + i2]};
    }
    .node-icon-${i2 - 1} {
      font-size: 40px;
      color: ${options2["cScaleLabel" + i2]};
    }
    .section-edge-${i2 - 1}{
      stroke: ${options2["cScale" + i2]};
    }
    .edge-depth-${i2 - 1}{
      stroke-width: ${sw};
    }
    .section-${i2 - 1} line {
      stroke: ${options2["cScaleInv" + i2]} ;
      stroke-width: 3;
    }

    .lineWrapper line{
      stroke: ${options2["cScaleLabel" + i2]} ;
    }

    .disabled, .disabled circle, .disabled text {
      fill: ${options2.tertiaryColor ?? "lightgray"};
    }
    .disabled text {
      fill: ${options2.clusterBorder ?? "#efefef"};
    }
    `;
        }
        return sections6;
      }, "genSections");
      getStyles13 = /* @__PURE__ */ __name((options2) => {
        const { theme } = getConfig();
        const isReduxTheme = theme?.includes("redux");
        const isNeutralTheme = theme === "neutral";
        const rawSvgId = options2.svgId?.replace(/^#/, "") ?? "";
        let gradientSections = "";
        if (options2.useGradient && rawSvgId && options2.THEME_COLOR_LIMIT && !isNeutralTheme) {
          for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
            gradientSections += `
      .section-${i2 - 1}[data-look="neo"] rect,
      .section-${i2 - 1}[data-look="neo"] path,
      .section-${i2 - 1}[data-look="neo"] circle {
        fill: ${options2.mainBkg};
        stroke: url(#${rawSvgId}-gradient);
        stroke-width: 2;
      }
      .section-${i2 - 1}[data-look="neo"] line {
        stroke: url(#${rawSvgId}-gradient);
        stroke-width: 2;
      }`;
          }
        }
        return `
  .edge {
    stroke-width: 3;
  }
  ${isReduxTheme ? genReduxSections(options2) : genSections(options2)}
  ${gradientSections}
  .section-root rect, .section-root path, .section-root circle  {
    fill: ${options2.git0};
  }
  .section-root text {
    fill: ${options2.gitBranchLabel0};
  }
  .icon-container {
    height:100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .edge {
    fill: none;
  }
  .eventWrapper  {
   filter: brightness(120%);
  }
`;
      }, "getStyles");
      styles_default12 = getStyles13;
    }
  });

  // src/diagrams/timeline/timeline-definition.ts
  var timeline_definition_exports = {};
  __export(timeline_definition_exports, {
    diagram: () => diagram18
  });
  var rendererSelector, diagram18;
  var init_timeline_definition = __esm({
    "src/diagrams/timeline/timeline-definition.ts"() {
      "use strict";
      init_timeline();
      init_timelineDb();
      init_timelineRenderer();
      init_timelineRendererVertical();
      init_styles12();
      rendererSelector = {
        setConf: /* @__PURE__ */ __name(() => {
        }, "setConf"),
        draw: /* @__PURE__ */ __name((text4, id34, version3, diagObj) => {
          const direction2 = diagObj?.db?.getDirection?.() ?? "LR";
          if (direction2 === "TD") {
            return timelineRendererVertical_default.draw(text4, id34, version3, diagObj);
          }
          return timelineRenderer_default.draw(text4, id34, version3, diagObj);
        }, "draw")
      };
      diagram18 = {
        db: timelineDb_exports,
        renderer: rendererSelector,
        parser: timeline_default,
        styles: styles_default12
      };
    }
  });

  // src/diagrams/mindmap/parser/mindmap.jison
  var parser16, mindmap_default;
  var init_mindmap = __esm({
    "src/diagrams/mindmap/parser/mindmap.jison"() {
      "use strict";
      parser16 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [1, 4], $V1 = [1, 13], $V2 = [1, 12], $V3 = [1, 15], $V4 = [1, 16], $V5 = [1, 20], $V6 = [1, 19], $V7 = [6, 7, 8], $V8 = [1, 26], $V9 = [1, 24], $Va = [1, 25], $Vb = [6, 7, 11], $Vc = [1, 6, 13, 15, 16, 19, 22], $Vd = [1, 33], $Ve = [1, 34], $Vf = [1, 6, 7, 11, 13, 15, 16, 19, 22];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "mindMap": 4, "spaceLines": 5, "SPACELINE": 6, "NL": 7, "MINDMAP": 8, "document": 9, "stop": 10, "EOF": 11, "statement": 12, "SPACELIST": 13, "node": 14, "ICON": 15, "CLASS": 16, "nodeWithId": 17, "nodeWithoutId": 18, "NODE_DSTART": 19, "NODE_DESCR": 20, "NODE_DEND": 21, "NODE_ID": 22, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "MINDMAP", 11: "EOF", 13: "SPACELIST", 15: "ICON", 16: "CLASS", 19: "NODE_DSTART", 20: "NODE_DESCR", 21: "NODE_DEND", 22: "NODE_ID" },
          productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 2], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [12, 1], [14, 1], [14, 1], [18, 3], [17, 1], [17, 4]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 6:
              case 7:
                return yy;
                break;
              case 8:
                yy.getLogger().trace("Stop NL ");
                break;
              case 9:
                yy.getLogger().trace("Stop EOF ");
                break;
              case 11:
                yy.getLogger().trace("Stop NL2 ");
                break;
              case 12:
                yy.getLogger().trace("Stop EOF2 ");
                break;
              case 15:
                yy.getLogger().info("Node: ", $$[$0].id);
                yy.addNode($$[$0 - 1].length, $$[$0].id, $$[$0].descr, $$[$0].type);
                break;
              case 16:
                yy.getLogger().trace("Icon: ", $$[$0]);
                yy.decorateNode({ icon: $$[$0] });
                break;
              case 17:
              case 21:
                yy.decorateNode({ class: $$[$0] });
                break;
              case 18:
                yy.getLogger().trace("SPACELIST");
                break;
              case 19:
                yy.getLogger().trace("Node: ", $$[$0].id);
                yy.addNode(0, $$[$0].id, $$[$0].descr, $$[$0].type);
                break;
              case 20:
                yy.decorateNode({ icon: $$[$0] });
                break;
              case 25:
                yy.getLogger().trace("node found ..", $$[$0 - 2]);
                this.$ = { id: $$[$0 - 1], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) };
                break;
              case 26:
                this.$ = { id: $$[$0], descr: $$[$0], type: yy.nodeType.DEFAULT };
                break;
              case 27:
                yy.getLogger().trace("node found ..", $$[$0 - 3]);
                this.$ = { id: $$[$0 - 3], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) };
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: $V0 }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: $V0 }, { 6: $V1, 7: [1, 10], 9: 9, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o2($V7, [2, 3]), { 1: [2, 2] }, o2($V7, [2, 4]), o2($V7, [2, 5]), { 1: [2, 6], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V1, 9: 22, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V8, 7: $V9, 10: 23, 11: $Va }, o2($Vb, [2, 22], { 17: 17, 18: 18, 14: 27, 15: [1, 28], 16: [1, 29], 19: $V5, 22: $V6 }), o2($Vb, [2, 18]), o2($Vb, [2, 19]), o2($Vb, [2, 20]), o2($Vb, [2, 21]), o2($Vb, [2, 23]), o2($Vb, [2, 24]), o2($Vb, [2, 26], { 19: [1, 30] }), { 20: [1, 31] }, { 6: $V8, 7: $V9, 10: 32, 11: $Va }, { 1: [2, 7], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o2($Vc, [2, 14], { 7: $Vd, 11: $Ve }), o2($Vf, [2, 8]), o2($Vf, [2, 9]), o2($Vf, [2, 10]), o2($Vb, [2, 15]), o2($Vb, [2, 16]), o2($Vb, [2, 17]), { 20: [1, 35] }, { 21: [1, 36] }, o2($Vc, [2, 13], { 7: $Vd, 11: $Ve }), o2($Vf, [2, 11]), o2($Vf, [2, 12]), { 21: [1, 37] }, o2($Vb, [2, 25]), o2($Vb, [2, 27])],
          defaultActions: { 2: [2, 1], 6: [2, 2] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  yy.getLogger().trace("Found comment", yy_.yytext);
                  return 6;
                  break;
                case 1:
                  return 8;
                  break;
                case 2:
                  this.begin("CLASS");
                  break;
                case 3:
                  this.popState();
                  return 16;
                  break;
                case 4:
                  this.popState();
                  break;
                case 5:
                  yy.getLogger().trace("Begin icon");
                  this.begin("ICON");
                  break;
                case 6:
                  yy.getLogger().trace("SPACELINE");
                  return 6;
                  break;
                case 7:
                  return 7;
                  break;
                case 8:
                  return 15;
                  break;
                case 9:
                  yy.getLogger().trace("end icon");
                  this.popState();
                  break;
                case 10:
                  yy.getLogger().trace("Exploding node");
                  this.begin("NODE");
                  return 19;
                  break;
                case 11:
                  yy.getLogger().trace("Cloud");
                  this.begin("NODE");
                  return 19;
                  break;
                case 12:
                  yy.getLogger().trace("Explosion Bang");
                  this.begin("NODE");
                  return 19;
                  break;
                case 13:
                  yy.getLogger().trace("Cloud Bang");
                  this.begin("NODE");
                  return 19;
                  break;
                case 14:
                  this.begin("NODE");
                  return 19;
                  break;
                case 15:
                  this.begin("NODE");
                  return 19;
                  break;
                case 16:
                  this.begin("NODE");
                  return 19;
                  break;
                case 17:
                  this.begin("NODE");
                  return 19;
                  break;
                case 18:
                  return 13;
                  break;
                case 19:
                  return 22;
                  break;
                case 20:
                  return 11;
                  break;
                case 21:
                  this.begin("NSTR2");
                  break;
                case 22:
                  return "NODE_DESCR";
                  break;
                case 23:
                  this.popState();
                  break;
                case 24:
                  yy.getLogger().trace("Starting NSTR");
                  this.begin("NSTR");
                  break;
                case 25:
                  yy.getLogger().trace("description:", yy_.yytext);
                  return "NODE_DESCR";
                  break;
                case 26:
                  this.popState();
                  break;
                case 27:
                  this.popState();
                  yy.getLogger().trace("node end ))");
                  return "NODE_DEND";
                  break;
                case 28:
                  this.popState();
                  yy.getLogger().trace("node end )");
                  return "NODE_DEND";
                  break;
                case 29:
                  this.popState();
                  yy.getLogger().trace("node end ...", yy_.yytext);
                  return "NODE_DEND";
                  break;
                case 30:
                  this.popState();
                  yy.getLogger().trace("node end ((");
                  return "NODE_DEND";
                  break;
                case 31:
                  this.popState();
                  yy.getLogger().trace("node end (-");
                  return "NODE_DEND";
                  break;
                case 32:
                  this.popState();
                  yy.getLogger().trace("node end (-");
                  return "NODE_DEND";
                  break;
                case 33:
                  this.popState();
                  yy.getLogger().trace("node end ((");
                  return "NODE_DEND";
                  break;
                case 34:
                  this.popState();
                  yy.getLogger().trace("node end ((");
                  return "NODE_DEND";
                  break;
                case 35:
                  yy.getLogger().trace("Long description:", yy_.yytext);
                  return 20;
                  break;
                case 36:
                  yy.getLogger().trace("Long description:", yy_.yytext);
                  return 20;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:\s*%%.*)/i, /^(?:mindmap\b)/i, /^(?::::)/i, /^(?:.+)/i, /^(?:\n)/i, /^(?:::icon\()/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[^\)]+)/i, /^(?:\))/i, /^(?:-\))/i, /^(?:\(-)/i, /^(?:\)\))/i, /^(?:\))/i, /^(?:\(\()/i, /^(?:\{\{)/i, /^(?:\()/i, /^(?:\[)/i, /^(?:[\s]+)/i, /^(?:[^\(\[\n\)\{\}]+)/i, /^(?:$)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:[^"]+)/i, /^(?:["])/i, /^(?:[\)]\))/i, /^(?:[\)])/i, /^(?:[\]])/i, /^(?:\}\})/i, /^(?:\(-)/i, /^(?:-\))/i, /^(?:\(\()/i, /^(?:\()/i, /^(?:[^\)\]\(\}]+)/i, /^(?:.+(?!\(\())/i],
            conditions: { "CLASS": { "rules": [3, 4], "inclusive": false }, "ICON": { "rules": [8, 9], "inclusive": false }, "NSTR2": { "rules": [22, 23], "inclusive": false }, "NSTR": { "rules": [25, 26], "inclusive": false }, "NODE": { "rules": [21, 24, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser16.parser = parser16;
      mindmap_default = parser16;
    }
  });

  // ../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/stringify.js
  function unsafeStringify(arr, offset = 0) {
    return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
  }
  var byteToHex;
  var init_stringify = __esm({
    "../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/stringify.js"() {
      "use strict";
      byteToHex = [];
      for (let i2 = 0; i2 < 256; ++i2) {
        byteToHex.push((i2 + 256).toString(16).slice(1));
      }
      __name(unsafeStringify, "unsafeStringify");
    }
  });

  // ../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/rng.js
  function rng() {
    if (!getRandomValues) {
      if (typeof crypto === "undefined" || !crypto.getRandomValues) {
        throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
      }
      getRandomValues = crypto.getRandomValues.bind(crypto);
    }
    return getRandomValues(rnds8);
  }
  var getRandomValues, rnds8;
  var init_rng = __esm({
    "../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/rng.js"() {
      "use strict";
      rnds8 = new Uint8Array(16);
      __name(rng, "rng");
    }
  });

  // ../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/native.js
  var randomUUID, native_default;
  var init_native = __esm({
    "../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/native.js"() {
      "use strict";
      randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
      native_default = { randomUUID };
    }
  });

  // ../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js
  function v4(options2, buf, offset) {
    if (native_default.randomUUID && !buf && !options2) {
      return native_default.randomUUID();
    }
    options2 = options2 || {};
    const rnds = options2.random ?? options2.rng?.() ?? rng();
    if (rnds.length < 16) {
      throw new Error("Random bytes length must be >= 16");
    }
    rnds[6] = rnds[6] & 15 | 64;
    rnds[8] = rnds[8] & 63 | 128;
    if (buf) {
      offset = offset || 0;
      if (offset < 0 || offset + 16 > buf.length) {
        throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
      }
      for (let i2 = 0; i2 < 16; ++i2) {
        buf[offset + i2] = rnds[i2];
      }
      return buf;
    }
    return unsafeStringify(rnds);
  }
  var v4_default;
  var init_v4 = __esm({
    "../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js"() {
      "use strict";
      init_native();
      init_rng();
      init_stringify();
      __name(v4, "v4");
      v4_default = v4;
    }
  });

  // ../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/index.js
  var init_esm_browser = __esm({
    "../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/index.js"() {
      "use strict";
      init_v4();
    }
  });

  // src/diagrams/mindmap/svgDraw.ts
  var MAX_SECTIONS;
  var init_svgDraw5 = __esm({
    "src/diagrams/mindmap/svgDraw.ts"() {
      "use strict";
      init_createText();
      init_utils2();
      MAX_SECTIONS = 12;
    }
  });

  // src/diagrams/mindmap/mindmapDb.ts
  var nodeType, MindmapDB;
  var init_mindmapDb = __esm({
    "src/diagrams/mindmap/mindmapDb.ts"() {
      "use strict";
      init_diagramAPI();
      init_esm_browser();
      init_common();
      init_logger();
      init_defaultConfig();
      init_config();
      init_svgDraw5();
      nodeType = {
        DEFAULT: 0,
        NO_BORDER: 0,
        ROUNDED_RECT: 1,
        RECT: 2,
        CIRCLE: 3,
        CLOUD: 4,
        BANG: 5,
        HEXAGON: 6
      };
      MindmapDB = class {
        constructor() {
          this.nodes = [];
          this.count = 0;
          this.elements = {};
          this.getLogger = this.getLogger.bind(this);
          this.nodeType = nodeType;
          this.clear();
          this.getType = this.getType.bind(this);
          this.getElementById = this.getElementById.bind(this);
          this.getParent = this.getParent.bind(this);
          this.getMindmap = this.getMindmap.bind(this);
          this.addNode = this.addNode.bind(this);
          this.decorateNode = this.decorateNode.bind(this);
        }
        static {
          __name(this, "MindmapDB");
        }
        clear() {
          this.nodes = [];
          this.count = 0;
          this.elements = {};
          this.baseLevel = void 0;
        }
        getParent(level) {
          for (let i2 = this.nodes.length - 1; i2 >= 0; i2--) {
            if (this.nodes[i2].level < level) {
              return this.nodes[i2];
            }
          }
          return null;
        }
        getMindmap() {
          return this.nodes.length > 0 ? this.nodes[0] : null;
        }
        addNode(level, id34, descr, type3) {
          log.info("addNode", level, id34, descr, type3);
          let isRoot = false;
          if (this.nodes.length === 0) {
            this.baseLevel = level;
            level = 0;
            isRoot = true;
          } else if (this.baseLevel !== void 0) {
            level = level - this.baseLevel;
            isRoot = false;
          }
          const conf5 = getConfig2();
          let padding2 = conf5.mindmap?.padding ?? defaultConfig_default.mindmap.padding;
          switch (type3) {
            case this.nodeType.ROUNDED_RECT:
            case this.nodeType.RECT:
            case this.nodeType.HEXAGON:
              padding2 *= 2;
              break;
          }
          const node2 = {
            id: this.count++,
            nodeId: sanitizeText(id34, conf5),
            level,
            descr: sanitizeText(descr, conf5),
            type: type3,
            children: [],
            width: conf5.mindmap?.maxNodeWidth ?? defaultConfig_default.mindmap.maxNodeWidth,
            padding: padding2,
            isRoot
          };
          const parent4 = this.getParent(level);
          if (parent4) {
            parent4.children.push(node2);
            this.nodes.push(node2);
          } else {
            if (isRoot) {
              this.nodes.push(node2);
            } else {
              throw new Error(
                `There can be only one root. No parent could be found for ("${node2.descr}")`
              );
            }
          }
        }
        getType(startStr, endStr) {
          log.debug("In get type", startStr, endStr);
          switch (startStr) {
            case "[":
              return this.nodeType.RECT;
            case "(":
              return endStr === ")" ? this.nodeType.ROUNDED_RECT : this.nodeType.CLOUD;
            case "((":
              return this.nodeType.CIRCLE;
            case ")":
              return this.nodeType.CLOUD;
            case "))":
              return this.nodeType.BANG;
            case "{{":
              return this.nodeType.HEXAGON;
            default:
              return this.nodeType.DEFAULT;
          }
        }
        setElementForId(id34, element3) {
          this.elements[id34] = element3;
        }
        getElementById(id34) {
          return this.elements[id34];
        }
        decorateNode(decoration) {
          if (!decoration) {
            return;
          }
          const config5 = getConfig2();
          const node2 = this.nodes[this.nodes.length - 1];
          if (decoration.icon) {
            node2.icon = sanitizeText(decoration.icon, config5);
          }
          if (decoration.class) {
            node2.class = sanitizeText(decoration.class, config5);
          }
        }
        type2Str(type3) {
          switch (type3) {
            case this.nodeType.DEFAULT:
              return "no-border";
            case this.nodeType.RECT:
              return "rect";
            case this.nodeType.ROUNDED_RECT:
              return "rounded-rect";
            case this.nodeType.CIRCLE:
              return "circle";
            case this.nodeType.CLOUD:
              return "cloud";
            case this.nodeType.BANG:
              return "bang";
            case this.nodeType.HEXAGON:
              return "hexgon";
            // cspell: disable-line
            default:
              return "no-border";
          }
        }
        /**
         * Assign section numbers to nodes based on their position relative to root
         * @param node - The mindmap node to process
         * @param sectionNumber - The section number to assign (undefined for root)
         */
        assignSections(node2, sectionNumber) {
          if (node2.level === 0) {
            node2.section = void 0;
          } else {
            node2.section = sectionNumber;
          }
          if (node2.children) {
            for (const [index, child] of node2.children.entries()) {
              const childSectionNumber = node2.level === 0 ? index % (MAX_SECTIONS - 1) : sectionNumber;
              this.assignSections(child, childSectionNumber);
            }
          }
        }
        /**
         * Convert mindmap tree structure to flat array of nodes
         * @param node - The mindmap node to process
         * @param processedNodes - Array to collect processed nodes
         */
        flattenNodes(node2, processedNodes) {
          const conf5 = getConfig2();
          const cssClasses = ["mindmap-node"];
          if (node2.isRoot === true) {
            cssClasses.push("section-root", "section--1");
          } else if (node2.section !== void 0) {
            cssClasses.push(`section-${node2.section}`);
          }
          if (node2.class) {
            cssClasses.push(node2.class);
          }
          const classes3 = cssClasses.join(" ");
          const getShapeFromType = /* @__PURE__ */ __name((type3) => {
            const theme = conf5.theme?.toLowerCase() ?? "";
            const isReduxTheme = theme.includes("redux");
            switch (type3) {
              case nodeType.CIRCLE:
                return "mindmapCircle";
              case nodeType.RECT:
                return "rect";
              case nodeType.ROUNDED_RECT:
                return "rounded";
              case nodeType.CLOUD:
                return "cloud";
              case nodeType.BANG:
                return "bang";
              case nodeType.HEXAGON:
                return "hexagon";
              case nodeType.DEFAULT:
                return isReduxTheme ? "rounded" : "defaultMindmapNode";
              case nodeType.NO_BORDER:
              default:
                return "rect";
            }
          }, "getShapeFromType");
          const processedNode = {
            id: node2.id.toString(),
            domId: "node_" + node2.id.toString(),
            label: node2.descr,
            labelType: "markdown",
            isGroup: false,
            shape: getShapeFromType(node2.type),
            width: node2.width,
            height: node2.height ?? 0,
            padding: node2.padding,
            cssClasses: classes3,
            cssStyles: [],
            look: conf5.look,
            icon: node2.icon,
            x: node2.x,
            y: node2.y,
            // Mindmap-specific properties
            level: node2.level,
            nodeId: node2.nodeId,
            type: node2.type,
            section: node2.section
          };
          processedNodes.push(processedNode);
          if (node2.children) {
            for (const child of node2.children) {
              this.flattenNodes(child, processedNodes);
            }
          }
        }
        /**
         * Generate edges from parent-child relationships in mindmap tree
         * @param node - The mindmap node to process
         * @param edges - Array to collect edges
         */
        generateEdges(node2, edges3) {
          if (!node2.children) {
            return;
          }
          const conf5 = getConfig2();
          for (const child of node2.children) {
            let edgeClasses = "edge";
            if (child.section !== void 0) {
              edgeClasses += ` section-edge-${child.section}`;
            }
            const edgeDepth = node2.level + 1;
            edgeClasses += ` edge-depth-${edgeDepth}`;
            const edge = {
              id: `edge_${node2.id}_${child.id}`,
              start: node2.id.toString(),
              end: child.id.toString(),
              type: "normal",
              curve: "basis",
              thickness: "normal",
              look: conf5.look,
              classes: edgeClasses,
              // Store mindmap-specific data
              depth: node2.level,
              section: child.section
            };
            edges3.push(edge);
            this.generateEdges(child, edges3);
          }
        }
        /**
         * Get structured data for layout algorithms
         * Following the pattern established by ER diagrams
         * @returns Structured data containing nodes, edges, and config
         */
        getData() {
          const mindmapRoot = this.getMindmap();
          const config5 = getConfig2();
          const userDefinedConfig = getUserDefinedConfig();
          const hasUserDefinedLayout = userDefinedConfig.layout !== void 0;
          const finalConfig = config5;
          if (!hasUserDefinedLayout) {
            finalConfig.layout = "cose-bilkent";
          }
          if (!mindmapRoot) {
            return {
              nodes: [],
              edges: [],
              config: finalConfig
            };
          }
          log.debug("getData: mindmapRoot", mindmapRoot, config5);
          this.assignSections(mindmapRoot);
          const processedNodes = [];
          const processedEdges = [];
          this.flattenNodes(mindmapRoot, processedNodes);
          this.generateEdges(mindmapRoot, processedEdges);
          log.debug(
            `getData: processed ${processedNodes.length} nodes and ${processedEdges.length} edges`
          );
          const shapes4 = /* @__PURE__ */ new Map();
          for (const node2 of processedNodes) {
            shapes4.set(node2.id, {
              shape: node2.shape,
              width: node2.width,
              height: node2.height,
              padding: node2.padding
            });
          }
          return {
            nodes: processedNodes,
            edges: processedEdges,
            config: finalConfig,
            // Store the root node for mindmap-specific layout algorithms
            rootNode: mindmapRoot,
            // Properties required by dagre layout algorithm
            markers: ["point"],
            // Mindmaps don't use markers
            direction: "TB",
            // Top-to-bottom direction for mindmaps
            nodeSpacing: 50,
            // Default spacing between nodes
            rankSpacing: 50,
            // Default spacing between ranks
            // Add shapes for ELK compatibility
            shapes: Object.fromEntries(shapes4),
            // Additional properties that layout algorithms might expect
            type: "mindmap",
            diagramId: "mindmap-" + v4_default()
          };
        }
        // Expose logger to grammar
        getLogger() {
          return log;
        }
      };
    }
  });

  // src/diagrams/mindmap/mindmapRenderer.ts
  var draw19, mindmapRenderer_default;
  var init_mindmapRenderer = __esm({
    "src/diagrams/mindmap/mindmapRenderer.ts"() {
      "use strict";
      init_logger();
      init_insertElementsForSize();
      init_render2();
      init_setupViewPortForSVG();
      init_defaultConfig();
      init_config();
      draw19 = /* @__PURE__ */ __name(async (text4, id34, _version, diagObj) => {
        log.debug("Rendering mindmap diagram\n" + text4);
        const db9 = diagObj.db;
        const data4Layout = db9.getData();
        const svg2 = getDiagramElement(id34, data4Layout.config.securityLevel);
        data4Layout.type = diagObj.type;
        data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(data4Layout.config.layout, {
          fallback: "cose-bilkent"
        });
        data4Layout.diagramId = id34;
        const mm = db9.getMindmap();
        if (!mm) {
          return;
        }
        data4Layout.nodes.forEach((node2) => {
          if (node2.shape === "rounded") {
            node2.radius = 15;
            node2.taper = 15;
            node2.stroke = "none";
            node2.width = 0;
            node2.padding = 15;
          } else if (node2.shape === "circle") {
            node2.padding = 10;
          } else if (node2.shape === "rect") {
            node2.width = 0;
            node2.padding = 10;
          } else if (node2.shape === "hexagon") {
            node2.width = 0;
            node2.height = 0;
          }
        });
        await render6(data4Layout, svg2);
        const { themeVariables } = getConfig();
        const { useGradient, gradientStart, gradientStop } = themeVariables;
        if (useGradient && gradientStart && gradientStop) {
          const svgId = svg2.attr("id");
          const gradient = svg2.append("defs").append("linearGradient").attr("id", `${svgId}-gradient`).attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
          gradient.append("stop").attr("offset", "0%").attr("stop-color", gradientStart).attr("stop-opacity", 1);
          gradient.append("stop").attr("offset", "100%").attr("stop-color", gradientStop).attr("stop-opacity", 1);
        }
        setupViewPortForSVG(
          svg2,
          data4Layout.config.mindmap?.padding ?? defaultConfig_default.mindmap.padding,
          "mindmapDiagram",
          data4Layout.config.mindmap?.useMaxWidth ?? defaultConfig_default.mindmap.useMaxWidth
        );
      }, "draw");
      mindmapRenderer_default = {
        draw: draw19
      };
    }
  });

  // src/diagrams/mindmap/styles.ts
  var genSections2, genGradient, getStyles14, styles_default13;
  var init_styles13 = __esm({
    "src/diagrams/mindmap/styles.ts"() {
      "use strict";
      init_dist();
      genSections2 = /* @__PURE__ */ __name((options2) => {
        const { theme, look } = options2;
        let sections6 = "";
        for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
          options2["lineColor" + i2] = options2["lineColor" + i2] || options2["cScaleInv" + i2];
          if (is_dark_default(options2["lineColor" + i2])) {
            options2["lineColor" + i2] = lighten_default(options2["lineColor" + i2], 20);
          } else {
            options2["lineColor" + i2] = darken_default(options2["lineColor" + i2], 20);
          }
        }
        for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
          const sw = "" + (look === "neo" ? Math.max(10 - (i2 - 1) * 2, 2) : 17 - 3 * i2);
          sections6 += `
    .section-${i2 - 1} rect, .section-${i2 - 1} path, .section-${i2 - 1} circle, .section-${i2 - 1} polygon, .section-${i2 - 1} path  {
      fill: ${options2["cScale" + i2]};
    }
    .section-${i2 - 1} text {
     fill: ${options2["cScaleLabel" + i2]};
    }
     .section-${i2 - 1} span {
     color: ${options2["cScaleLabel" + i2]};
    }
    .node-icon-${i2 - 1} {
      font-size: 40px;
      color: ${options2["cScaleLabel" + i2]};
    }
    .section-edge-${i2 - 1}{
      stroke: ${options2["cScale" + i2]};
    }
    .edge-depth-${i2 - 1}{
      stroke-width: ${sw};
    }
    .section-${i2 - 1} line {
      stroke: ${options2["cScaleInv" + i2]} ;
      stroke-width: 3;
    }

    .disabled, .disabled circle, .disabled text {
      fill: lightgray;
    }
    .disabled text {
      fill: #efefef;
    }
    [data-look="neo"].mindmap-node.section-${i2 - 1} rect, [data-look="neo"].mindmap-node.section-${i2 - 1} path, [data-look="neo"].mindmap-node.section-${i2 - 1} circle, [data-look="neo"].mindmap-node.section-${i2 - 1} polygon {
      fill: ${theme === "redux" || theme === "redux-dark" || theme === "neutral" ? options2.mainBkg : options2["cScale" + i2]};
      stroke: ${theme === "redux" || theme === "redux-dark" ? options2.nodeBorder : options2["cScale" + i2]};
      stroke-width: ${options2.strokeWidth ?? 2}px;
    }
    [data-look="neo"].section-edge-${i2 - 1}{
      stroke: ${theme?.includes("redux") || theme === "neo-dark" ? options2.nodeBorder : options2["cScale" + i2]};
    }
    [data-look="neo"].mindmap-node.section-${i2 - 1} text {
     fill: ${theme === "redux" || theme === "redux-dark" ? options2.nodeBorder : options2["cScaleLabel" + (theme === "neutral" ? 1 : i2)]};
    }
    `;
        }
        return sections6;
      }, "genSections");
      genGradient = /* @__PURE__ */ __name((THEME_COLOR_LIMIT2, svgId, mainBkg) => {
        let sections6 = "";
        for (let i2 = 0; i2 < THEME_COLOR_LIMIT2; i2++) {
          sections6 += `
    [data-look="neo"].mindmap-node.section-${i2 - 1} rect, [data-look="neo"].mindmap-node.section-${i2 - 1} path, [data-look="neo"].mindmap-node.section-${i2 - 1} circle, [data-look="neo"].mindmap-node.section-${i2 - 1} polygon {
      stroke: url(${svgId}-gradient);
      fill: ${mainBkg};
    }
    .section-${i2 - 1} line {
      stroke-width: 0;
    }`;
        }
        return sections6;
      }, "genGradient");
      getStyles14 = /* @__PURE__ */ __name((options2) => {
        const { theme } = options2;
        const svgId = options2.svgId;
        const scopedDropShadow = options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none";
        return `
  .edge {
    stroke-width: 3;
  }
  ${genSections2(options2)}
  .section-root rect, .section-root path, .section-root circle, .section-root polygon  {
    fill: ${options2.git0};
  }
  .section-root text {
    fill: ${options2.gitBranchLabel0};
  }
  .section-root span {
    color: ${theme?.includes("redux") ? options2.nodeBorder : options2.gitBranchLabel0};
  }
  .icon-container {
    height:100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .edge {
    fill: none;
  }
  .mindmap-node-label {
    dy: 1em;
    alignment-baseline: middle;
    text-anchor: middle;
    dominant-baseline: middle;
    text-align: center;
  }
  [data-look="neo"].mindmap-node  {
    filter: ${scopedDropShadow};
  }
  [data-look="neo"].mindmap-node.section-root rect, [data-look="neo"].mindmap-node.section-root path, [data-look="neo"].mindmap-node.section-root circle, [data-look="neo"].mindmap-node.section-root polygon  {
    fill: ${theme?.includes("redux") ? options2.mainBkg : options2.git0};
  }
  [data-look="neo"].mindmap-node.section-root .text-inner-tspan {
    fill:  ${theme?.includes("redux") ? options2.nodeBorder : options2["cScaleLabel" + (theme === "neutral" ? 1 : 0)]};
  }
  ${options2.useGradient && svgId && options2.mainBkg ? genGradient(options2.THEME_COLOR_LIMIT, svgId, options2.mainBkg) : ""}
`;
      }, "getStyles");
      styles_default13 = getStyles14;
    }
  });

  // src/diagrams/mindmap/mindmap-definition.ts
  var mindmap_definition_exports = {};
  __export(mindmap_definition_exports, {
    diagram: () => diagram19
  });
  var diagram19;
  var init_mindmap_definition = __esm({
    "src/diagrams/mindmap/mindmap-definition.ts"() {
      "use strict";
      init_mindmap();
      init_mindmapDb();
      init_mindmapRenderer();
      init_styles13();
      diagram19 = {
        get db() {
          return new MindmapDB();
        },
        renderer: mindmapRenderer_default,
        parser: mindmap_default,
        styles: styles_default13
      };
    }
  });

  // src/diagrams/kanban/parser/kanban.jison
  var parser17, kanban_default;
  var init_kanban = __esm({
    "src/diagrams/kanban/parser/kanban.jison"() {
      "use strict";
      parser17 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [1, 4], $V1 = [1, 13], $V2 = [1, 12], $V3 = [1, 15], $V4 = [1, 16], $V5 = [1, 20], $V6 = [1, 19], $V7 = [6, 7, 8], $V8 = [1, 26], $V9 = [1, 24], $Va = [1, 25], $Vb = [6, 7, 11], $Vc = [1, 31], $Vd = [6, 7, 11, 24], $Ve = [1, 6, 13, 16, 17, 20, 23], $Vf = [1, 35], $Vg = [1, 36], $Vh = [1, 6, 7, 11, 13, 16, 17, 20, 23], $Vi = [1, 38];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "mindMap": 4, "spaceLines": 5, "SPACELINE": 6, "NL": 7, "KANBAN": 8, "document": 9, "stop": 10, "EOF": 11, "statement": 12, "SPACELIST": 13, "node": 14, "shapeData": 15, "ICON": 16, "CLASS": 17, "nodeWithId": 18, "nodeWithoutId": 19, "NODE_DSTART": 20, "NODE_DESCR": 21, "NODE_DEND": 22, "NODE_ID": 23, "SHAPE_DATA": 24, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "KANBAN", 11: "EOF", 13: "SPACELIST", 16: "ICON", 17: "CLASS", 20: "NODE_DSTART", 21: "NODE_DESCR", 22: "NODE_DEND", 23: "NODE_ID", 24: "SHAPE_DATA" },
          productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 3], [12, 2], [12, 2], [12, 2], [12, 1], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [14, 1], [14, 1], [19, 3], [18, 1], [18, 4], [15, 2], [15, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 6:
              case 7:
                return yy;
                break;
              case 8:
                yy.getLogger().trace("Stop NL ");
                break;
              case 9:
                yy.getLogger().trace("Stop EOF ");
                break;
              case 11:
                yy.getLogger().trace("Stop NL2 ");
                break;
              case 12:
                yy.getLogger().trace("Stop EOF2 ");
                break;
              case 15:
                yy.getLogger().info("Node: ", $$[$0 - 1].id);
                yy.addNode($$[$0 - 2].length, $$[$0 - 1].id, $$[$0 - 1].descr, $$[$0 - 1].type, $$[$0]);
                break;
              case 16:
                yy.getLogger().info("Node: ", $$[$0].id);
                yy.addNode($$[$0 - 1].length, $$[$0].id, $$[$0].descr, $$[$0].type);
                break;
              case 17:
                yy.getLogger().trace("Icon: ", $$[$0]);
                yy.decorateNode({ icon: $$[$0] });
                break;
              case 18:
              case 23:
                yy.decorateNode({ class: $$[$0] });
                break;
              case 19:
                yy.getLogger().trace("SPACELIST");
                break;
              case 20:
                yy.getLogger().trace("Node: ", $$[$0 - 1].id);
                yy.addNode(0, $$[$0 - 1].id, $$[$0 - 1].descr, $$[$0 - 1].type, $$[$0]);
                break;
              case 21:
                yy.getLogger().trace("Node: ", $$[$0].id);
                yy.addNode(0, $$[$0].id, $$[$0].descr, $$[$0].type);
                break;
              case 22:
                yy.decorateNode({ icon: $$[$0] });
                break;
              case 27:
                yy.getLogger().trace("node found ..", $$[$0 - 2]);
                this.$ = { id: $$[$0 - 1], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) };
                break;
              case 28:
                this.$ = { id: $$[$0], descr: $$[$0], type: 0 };
                break;
              case 29:
                yy.getLogger().trace("node found ..", $$[$0 - 3]);
                this.$ = { id: $$[$0 - 3], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) };
                break;
              case 30:
                this.$ = $$[$0 - 1] + $$[$0];
                break;
              case 31:
                this.$ = $$[$0];
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: $V0 }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: $V0 }, { 6: $V1, 7: [1, 10], 9: 9, 12: 11, 13: $V2, 14: 14, 16: $V3, 17: $V4, 18: 17, 19: 18, 20: $V5, 23: $V6 }, o2($V7, [2, 3]), { 1: [2, 2] }, o2($V7, [2, 4]), o2($V7, [2, 5]), { 1: [2, 6], 6: $V1, 12: 21, 13: $V2, 14: 14, 16: $V3, 17: $V4, 18: 17, 19: 18, 20: $V5, 23: $V6 }, { 6: $V1, 9: 22, 12: 11, 13: $V2, 14: 14, 16: $V3, 17: $V4, 18: 17, 19: 18, 20: $V5, 23: $V6 }, { 6: $V8, 7: $V9, 10: 23, 11: $Va }, o2($Vb, [2, 24], { 18: 17, 19: 18, 14: 27, 16: [1, 28], 17: [1, 29], 20: $V5, 23: $V6 }), o2($Vb, [2, 19]), o2($Vb, [2, 21], { 15: 30, 24: $Vc }), o2($Vb, [2, 22]), o2($Vb, [2, 23]), o2($Vd, [2, 25]), o2($Vd, [2, 26]), o2($Vd, [2, 28], { 20: [1, 32] }), { 21: [1, 33] }, { 6: $V8, 7: $V9, 10: 34, 11: $Va }, { 1: [2, 7], 6: $V1, 12: 21, 13: $V2, 14: 14, 16: $V3, 17: $V4, 18: 17, 19: 18, 20: $V5, 23: $V6 }, o2($Ve, [2, 14], { 7: $Vf, 11: $Vg }), o2($Vh, [2, 8]), o2($Vh, [2, 9]), o2($Vh, [2, 10]), o2($Vb, [2, 16], { 15: 37, 24: $Vc }), o2($Vb, [2, 17]), o2($Vb, [2, 18]), o2($Vb, [2, 20], { 24: $Vi }), o2($Vd, [2, 31]), { 21: [1, 39] }, { 22: [1, 40] }, o2($Ve, [2, 13], { 7: $Vf, 11: $Vg }), o2($Vh, [2, 11]), o2($Vh, [2, 12]), o2($Vb, [2, 15], { 24: $Vi }), o2($Vd, [2, 30]), { 22: [1, 41] }, o2($Vd, [2, 27]), o2($Vd, [2, 29])],
          defaultActions: { 2: [2, 1], 6: [2, 2] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  this.pushState("shapeData");
                  yy_.yytext = "";
                  return 24;
                  break;
                case 1:
                  this.pushState("shapeDataStr");
                  return 24;
                  break;
                case 2:
                  this.popState();
                  return 24;
                  break;
                case 3:
                  const re3 = /\n\s*/g;
                  yy_.yytext = yy_.yytext.replace(re3, "<br/>");
                  return 24;
                  break;
                case 4:
                  return 24;
                  break;
                case 5:
                  this.popState();
                  break;
                case 6:
                  yy.getLogger().trace("Found comment", yy_.yytext);
                  return 6;
                  break;
                case 7:
                  return 8;
                  break;
                case 8:
                  this.begin("CLASS");
                  break;
                case 9:
                  this.popState();
                  return 17;
                  break;
                case 10:
                  this.popState();
                  break;
                case 11:
                  yy.getLogger().trace("Begin icon");
                  this.begin("ICON");
                  break;
                case 12:
                  yy.getLogger().trace("SPACELINE");
                  return 6;
                  break;
                case 13:
                  return 7;
                  break;
                case 14:
                  return 16;
                  break;
                case 15:
                  yy.getLogger().trace("end icon");
                  this.popState();
                  break;
                case 16:
                  yy.getLogger().trace("Exploding node");
                  this.begin("NODE");
                  return 20;
                  break;
                case 17:
                  yy.getLogger().trace("Cloud");
                  this.begin("NODE");
                  return 20;
                  break;
                case 18:
                  yy.getLogger().trace("Explosion Bang");
                  this.begin("NODE");
                  return 20;
                  break;
                case 19:
                  yy.getLogger().trace("Cloud Bang");
                  this.begin("NODE");
                  return 20;
                  break;
                case 20:
                  this.begin("NODE");
                  return 20;
                  break;
                case 21:
                  this.begin("NODE");
                  return 20;
                  break;
                case 22:
                  this.begin("NODE");
                  return 20;
                  break;
                case 23:
                  this.begin("NODE");
                  return 20;
                  break;
                case 24:
                  return 13;
                  break;
                case 25:
                  return 23;
                  break;
                case 26:
                  return 11;
                  break;
                case 27:
                  this.begin("NSTR2");
                  break;
                case 28:
                  return "NODE_DESCR";
                  break;
                case 29:
                  this.popState();
                  break;
                case 30:
                  yy.getLogger().trace("Starting NSTR");
                  this.begin("NSTR");
                  break;
                case 31:
                  yy.getLogger().trace("description:", yy_.yytext);
                  return "NODE_DESCR";
                  break;
                case 32:
                  this.popState();
                  break;
                case 33:
                  this.popState();
                  yy.getLogger().trace("node end ))");
                  return "NODE_DEND";
                  break;
                case 34:
                  this.popState();
                  yy.getLogger().trace("node end )");
                  return "NODE_DEND";
                  break;
                case 35:
                  this.popState();
                  yy.getLogger().trace("node end ...", yy_.yytext);
                  return "NODE_DEND";
                  break;
                case 36:
                  this.popState();
                  yy.getLogger().trace("node end ((");
                  return "NODE_DEND";
                  break;
                case 37:
                  this.popState();
                  yy.getLogger().trace("node end (-");
                  return "NODE_DEND";
                  break;
                case 38:
                  this.popState();
                  yy.getLogger().trace("node end (-");
                  return "NODE_DEND";
                  break;
                case 39:
                  this.popState();
                  yy.getLogger().trace("node end ((");
                  return "NODE_DEND";
                  break;
                case 40:
                  this.popState();
                  yy.getLogger().trace("node end ((");
                  return "NODE_DEND";
                  break;
                case 41:
                  yy.getLogger().trace("Long description:", yy_.yytext);
                  return 21;
                  break;
                case 42:
                  yy.getLogger().trace("Long description:", yy_.yytext);
                  return 21;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:@\{)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^\"]+)/i, /^(?:[^}^"]+)/i, /^(?:\})/i, /^(?:\s*%%.*)/i, /^(?:kanban\b)/i, /^(?::::)/i, /^(?:.+)/i, /^(?:\n)/i, /^(?:::icon\()/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[^\)]+)/i, /^(?:\))/i, /^(?:-\))/i, /^(?:\(-)/i, /^(?:\)\))/i, /^(?:\))/i, /^(?:\(\()/i, /^(?:\{\{)/i, /^(?:\()/i, /^(?:\[)/i, /^(?:[\s]+)/i, /^(?:[^\(\[\n\)\{\}@]+)/i, /^(?:$)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:[^"]+)/i, /^(?:["])/i, /^(?:[\)]\))/i, /^(?:[\)])/i, /^(?:[\]])/i, /^(?:\}\})/i, /^(?:\(-)/i, /^(?:-\))/i, /^(?:\(\()/i, /^(?:\()/i, /^(?:[^\)\]\(\}]+)/i, /^(?:.+(?!\(\())/i],
            conditions: { "shapeDataEndBracket": { "rules": [], "inclusive": false }, "shapeDataStr": { "rules": [2, 3], "inclusive": false }, "shapeData": { "rules": [1, 4, 5], "inclusive": false }, "CLASS": { "rules": [9, 10], "inclusive": false }, "ICON": { "rules": [14, 15], "inclusive": false }, "NSTR2": { "rules": [28, 29], "inclusive": false }, "NSTR": { "rules": [31, 32], "inclusive": false }, "NODE": { "rules": [27, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42], "inclusive": false }, "INITIAL": { "rules": [0, 6, 7, 8, 11, 12, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser17.parser = parser17;
      kanban_default = parser17;
    }
  });

  // src/diagrams/kanban/kanbanDb.ts
  var nodes3, sections5, cnt2, elements, clear15, getSection, getSections5, getData, addNode, nodeType2, getType, setElementForId, decorateNode, type2Str, getLogger, getElementById2, db4, kanbanDb_default;
  var init_kanbanDb = __esm({
    "src/diagrams/kanban/kanbanDb.ts"() {
      "use strict";
      init_diagramAPI();
      init_common();
      init_logger();
      init_defaultConfig();
      init_js_yaml();
      nodes3 = [];
      sections5 = [];
      cnt2 = 0;
      elements = {};
      clear15 = /* @__PURE__ */ __name(() => {
        nodes3 = [];
        sections5 = [];
        cnt2 = 0;
        elements = {};
      }, "clear");
      getSection = /* @__PURE__ */ __name((level) => {
        if (nodes3.length === 0) {
          return null;
        }
        const sectionLevel = nodes3[0].level;
        let lastSection = null;
        for (let i2 = nodes3.length - 1; i2 >= 0; i2--) {
          if (nodes3[i2].level === sectionLevel && !lastSection) {
            lastSection = nodes3[i2];
          }
          if (nodes3[i2].level < sectionLevel) {
            throw new Error('Items without section detected, found section ("' + nodes3[i2].label + '")');
          }
        }
        if (level === lastSection?.level) {
          return null;
        }
        return lastSection;
      }, "getSection");
      getSections5 = /* @__PURE__ */ __name(function() {
        return sections5;
      }, "getSections");
      getData = /* @__PURE__ */ __name(function() {
        const edges3 = [];
        const _nodes = [];
        const sections6 = getSections5();
        const conf5 = getConfig2();
        for (const section of sections6) {
          const node2 = {
            id: section.id,
            label: sanitizeText(section.label ?? "", conf5),
            labelType: "markdown",
            isGroup: true,
            ticket: section.ticket,
            shape: "kanbanSection",
            level: section.level,
            look: conf5.look
          };
          _nodes.push(node2);
          const children2 = nodes3.filter((n2) => n2.parentId === section.id);
          for (const item of children2) {
            const childNode = {
              id: item.id,
              parentId: section.id,
              label: sanitizeText(item.label ?? "", conf5),
              labelType: "markdown",
              isGroup: false,
              ticket: item?.ticket,
              priority: item?.priority,
              assigned: item?.assigned,
              icon: item?.icon,
              shape: "kanbanItem",
              level: item.level,
              rx: 5,
              ry: 5,
              cssStyles: ["text-align: left"]
            };
            _nodes.push(childNode);
          }
        }
        return { nodes: _nodes, edges: edges3, other: {}, config: getConfig2() };
      }, "getData");
      addNode = /* @__PURE__ */ __name((level, id34, descr, type3, shapeData) => {
        const conf5 = getConfig2();
        let padding2 = conf5.mindmap?.padding ?? defaultConfig_default.mindmap.padding;
        switch (type3) {
          case nodeType2.ROUNDED_RECT:
          case nodeType2.RECT:
          case nodeType2.HEXAGON:
            padding2 *= 2;
        }
        const node2 = {
          id: sanitizeText(id34, conf5) || "kbn" + cnt2++,
          level,
          label: sanitizeText(descr, conf5),
          width: conf5.mindmap?.maxNodeWidth ?? defaultConfig_default.mindmap.maxNodeWidth,
          padding: padding2,
          isGroup: false
        };
        if (shapeData !== void 0) {
          let yamlData;
          if (!shapeData.includes("\n")) {
            yamlData = "{\n" + shapeData + "\n}";
          } else {
            yamlData = shapeData + "\n";
          }
          const doc = load(yamlData, { schema: JSON_SCHEMA });
          if (doc.shape && (doc.shape !== doc.shape.toLowerCase() || doc.shape.includes("_"))) {
            throw new Error(`No such shape: ${doc.shape}. Shape names should be lowercase.`);
          }
          if (doc?.shape && doc.shape === "kanbanItem") {
            node2.shape = doc?.shape;
          }
          if (doc?.label) {
            node2.label = doc?.label;
          }
          if (doc?.icon) {
            node2.icon = doc?.icon.toString();
          }
          if (doc?.assigned) {
            node2.assigned = doc?.assigned.toString();
          }
          if (doc?.ticket) {
            node2.ticket = doc?.ticket.toString();
          }
          if (doc?.priority) {
            node2.priority = doc?.priority;
          }
        }
        const section = getSection(level);
        if (section) {
          node2.parentId = section.id || "kbn" + cnt2++;
        } else {
          sections5.push(node2);
        }
        nodes3.push(node2);
      }, "addNode");
      nodeType2 = {
        DEFAULT: 0,
        NO_BORDER: 0,
        ROUNDED_RECT: 1,
        RECT: 2,
        CIRCLE: 3,
        CLOUD: 4,
        BANG: 5,
        HEXAGON: 6
      };
      getType = /* @__PURE__ */ __name((startStr, endStr) => {
        log.debug("In get type", startStr, endStr);
        switch (startStr) {
          case "[":
            return nodeType2.RECT;
          case "(":
            return endStr === ")" ? nodeType2.ROUNDED_RECT : nodeType2.CLOUD;
          case "((":
            return nodeType2.CIRCLE;
          case ")":
            return nodeType2.CLOUD;
          case "))":
            return nodeType2.BANG;
          case "{{":
            return nodeType2.HEXAGON;
          default:
            return nodeType2.DEFAULT;
        }
      }, "getType");
      setElementForId = /* @__PURE__ */ __name((id34, element3) => {
        elements[id34] = element3;
      }, "setElementForId");
      decorateNode = /* @__PURE__ */ __name((decoration) => {
        if (!decoration) {
          return;
        }
        const config5 = getConfig2();
        const node2 = nodes3[nodes3.length - 1];
        if (decoration.icon) {
          node2.icon = sanitizeText(decoration.icon, config5);
        }
        if (decoration.class) {
          node2.cssClasses = sanitizeText(decoration.class, config5);
        }
      }, "decorateNode");
      type2Str = /* @__PURE__ */ __name((type3) => {
        switch (type3) {
          case nodeType2.DEFAULT:
            return "no-border";
          case nodeType2.RECT:
            return "rect";
          case nodeType2.ROUNDED_RECT:
            return "rounded-rect";
          case nodeType2.CIRCLE:
            return "circle";
          case nodeType2.CLOUD:
            return "cloud";
          case nodeType2.BANG:
            return "bang";
          case nodeType2.HEXAGON:
            return "hexgon";
          // cspell: disable-line
          default:
            return "no-border";
        }
      }, "type2Str");
      getLogger = /* @__PURE__ */ __name(() => log, "getLogger");
      getElementById2 = /* @__PURE__ */ __name((id34) => elements[id34], "getElementById");
      db4 = {
        clear: clear15,
        addNode,
        getSections: getSections5,
        getData,
        nodeType: nodeType2,
        getType,
        setElementForId,
        decorateNode,
        type2Str,
        getLogger,
        getElementById: getElementById2
      };
      kanbanDb_default = db4;
    }
  });

  // src/diagrams/kanban/kanbanRenderer.ts
  var draw20, kanbanRenderer_default;
  var init_kanbanRenderer = __esm({
    "src/diagrams/kanban/kanbanRenderer.ts"() {
      "use strict";
      init_diagramAPI();
      init_logger();
      init_selectSvgElement();
      init_setupGraphViewbox();
      init_defaultConfig();
      init_clusters();
      init_nodes2();
      draw20 = /* @__PURE__ */ __name(async (text4, id34, _version, diagObj) => {
        log.debug("Rendering kanban diagram\n" + text4);
        const db9 = diagObj.db;
        const data4Layout = db9.getData();
        const conf5 = getConfig2();
        conf5.htmlLabels = false;
        const svg2 = selectSvgElement(id34);
        for (const node2 of data4Layout.nodes) {
          node2.domId = `${id34}-${node2.id}`;
        }
        const sectionsElem = svg2.append("g");
        sectionsElem.attr("class", "sections");
        const nodesElem = svg2.append("g");
        nodesElem.attr("class", "items");
        const sections6 = data4Layout.nodes.filter(
          // TODO: TypeScript 5.5 will infer this predicate automatically
          (node2) => node2.isGroup
        );
        let cnt4 = 0;
        const padding2 = 10;
        const sectionObjects = [];
        let maxLabelHeight = 25;
        for (const section of sections6) {
          const WIDTH = conf5?.kanban?.sectionWidth || 200;
          cnt4 = cnt4 + 1;
          section.x = WIDTH * cnt4 + (cnt4 - 1) * padding2 / 2;
          section.width = WIDTH;
          section.y = 0;
          section.height = WIDTH * 3;
          section.rx = 5;
          section.ry = 5;
          section.cssClasses = section.cssClasses + " section-" + cnt4;
          const sectionObj = await insertCluster(sectionsElem, section);
          maxLabelHeight = Math.max(maxLabelHeight, sectionObj?.labelBBox?.height);
          sectionObjects.push(sectionObj);
        }
        let i2 = 0;
        for (const section of sections6) {
          const sectionObj = sectionObjects[i2];
          i2 = i2 + 1;
          const WIDTH = conf5?.kanban?.sectionWidth || 200;
          const top2 = -WIDTH * 3 / 2 + maxLabelHeight;
          let y6 = top2;
          const sectionItems = data4Layout.nodes.filter((node2) => node2.parentId === section.id);
          for (const item of sectionItems) {
            if (item.isGroup) {
              throw new Error("Groups within groups are not allowed in Kanban diagrams");
            }
            item.x = section.x;
            item.width = WIDTH - 1.5 * padding2;
            const nodeEl = await insertNode(nodesElem, item, { config: conf5 });
            const bbox = nodeEl.node().getBBox();
            item.y = y6 + bbox.height / 2;
            await positionNode(item);
            y6 = item.y + bbox.height / 2 + padding2 / 2;
          }
          const rect3 = sectionObj.cluster.select("rect");
          const height2 = Math.max(y6 - top2 + 3 * padding2, 50) + (maxLabelHeight - 25);
          rect3.attr("height", height2);
        }
        setupGraphViewbox(
          void 0,
          svg2,
          conf5.mindmap?.padding ?? defaultConfig_default.kanban.padding,
          conf5.mindmap?.useMaxWidth ?? defaultConfig_default.kanban.useMaxWidth
        );
      }, "draw");
      kanbanRenderer_default = {
        draw: draw20
      };
    }
  });

  // src/diagrams/kanban/styles.ts
  var genSections3, getStyles15, styles_default14;
  var init_styles14 = __esm({
    "src/diagrams/kanban/styles.ts"() {
      "use strict";
      init_dist();
      init_globalStyles();
      genSections3 = /* @__PURE__ */ __name((options2) => {
        let sections6 = "";
        for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
          options2["lineColor" + i2] = options2["lineColor" + i2] || options2["cScaleInv" + i2];
          if (is_dark_default(options2["lineColor" + i2])) {
            options2["lineColor" + i2] = lighten_default(options2["lineColor" + i2], 20);
          } else {
            options2["lineColor" + i2] = darken_default(options2["lineColor" + i2], 20);
          }
        }
        const adjuster = /* @__PURE__ */ __name((color2, level) => options2.darkMode ? darken_default(color2, level) : lighten_default(color2, level), "adjuster");
        for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) {
          const sw = "" + (17 - 3 * i2);
          sections6 += `
    .section-${i2 - 1} rect, .section-${i2 - 1} path, .section-${i2 - 1} circle, .section-${i2 - 1} polygon, .section-${i2 - 1} path  {
      fill: ${adjuster(options2["cScale" + i2], 10)};
      stroke: ${adjuster(options2["cScale" + i2], 10)};

    }
    .section-${i2 - 1} text {
     fill: ${options2["cScaleLabel" + i2]};
    }
    .node-icon-${i2 - 1} {
      font-size: 40px;
      color: ${options2["cScaleLabel" + i2]};
    }
    .section-edge-${i2 - 1}{
      stroke: ${options2["cScale" + i2]};
    }
    .edge-depth-${i2 - 1}{
      stroke-width: ${sw};
    }
    .section-${i2 - 1} line {
      stroke: ${options2["cScaleInv" + i2]} ;
      stroke-width: 3;
    }

    .disabled, .disabled circle, .disabled text {
      fill: lightgray;
    }
    .disabled text {
      fill: #efefef;
    }

  .node rect,
  .node circle,
  .node ellipse,
  .node polygon,
  .node path {
    fill: ${options2.background};
    stroke: ${options2.nodeBorder};
    stroke-width: 1px;
  }

  .kanban-ticket-link {
    fill: ${options2.background};
    stroke: ${options2.nodeBorder};
    text-decoration: underline;
  }
    `;
        }
        return sections6;
      }, "genSections");
      getStyles15 = /* @__PURE__ */ __name((options2) => `
  .edge {
    stroke-width: 3;
  }
  ${genSections3(options2)}
  .section-root rect, .section-root path, .section-root circle, .section-root polygon  {
    fill: ${options2.git0};
  }
  .section-root text {
    fill: ${options2.gitBranchLabel0};
  }
  .icon-container {
    height:100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .edge {
    fill: none;
  }
  .cluster-label, .label {
    color: ${options2.textColor};
    fill: ${options2.textColor};
    }
  .kanban-label {
    dy: 1em;
    alignment-baseline: middle;
    text-anchor: middle;
    dominant-baseline: middle;
    text-align: center;
  }
    ${getIconStyles()}
`, "getStyles");
      styles_default14 = getStyles15;
    }
  });

  // src/diagrams/kanban/kanban-definition.ts
  var kanban_definition_exports = {};
  __export(kanban_definition_exports, {
    diagram: () => diagram20
  });
  var diagram20;
  var init_kanban_definition = __esm({
    "src/diagrams/kanban/kanban-definition.ts"() {
      "use strict";
      init_kanban();
      init_kanbanDb();
      init_kanbanRenderer();
      init_styles14();
      diagram20 = {
        db: kanbanDb_default,
        renderer: kanbanRenderer_default,
        parser: kanban_default,
        styles: styles_default14
      };
    }
  });

  // src/diagrams/sankey/parser/sankey.jison
  var parser18, sankey_default;
  var init_sankey = __esm({
    "src/diagrams/sankey/parser/sankey.jison"() {
      "use strict";
      parser18 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [1, 9], $V1 = [1, 10], $V2 = [1, 5, 10, 12];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "SANKEY": 4, "NEWLINE": 5, "csv": 6, "opt_eof": 7, "record": 8, "csv_tail": 9, "EOF": 10, "field[source]": 11, "COMMA": 12, "field[target]": 13, "field[value]": 14, "field": 15, "escaped": 16, "non_escaped": 17, "DQUOTE": 18, "ESCAPED_TEXT": 19, "NON_ESCAPED_TEXT": 20, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 4: "SANKEY", 5: "NEWLINE", 10: "EOF", 11: "field[source]", 12: "COMMA", 13: "field[target]", 14: "field[value]", 18: "DQUOTE", 19: "ESCAPED_TEXT", 20: "NON_ESCAPED_TEXT" },
          productions_: [0, [3, 4], [6, 2], [9, 2], [9, 0], [7, 1], [7, 0], [8, 5], [15, 1], [15, 1], [16, 3], [17, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 7:
                const source = yy.findOrCreateNode($$[$0 - 4].trim().replaceAll('""', '"'));
                const target = yy.findOrCreateNode($$[$0 - 2].trim().replaceAll('""', '"'));
                const value2 = parseFloat($$[$0].trim());
                yy.addLink(source, target, value2);
                break;
              case 8:
              case 9:
              case 11:
                this.$ = $$[$0];
                break;
              case 10:
                this.$ = $$[$0 - 1];
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, { 5: [1, 3] }, { 6: 4, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 1: [2, 6], 7: 11, 10: [1, 12] }, o2($V1, [2, 4], { 9: 13, 5: [1, 14] }), { 12: [1, 15] }, o2($V2, [2, 8]), o2($V2, [2, 9]), { 19: [1, 16] }, o2($V2, [2, 11]), { 1: [2, 1] }, { 1: [2, 5] }, o2($V1, [2, 2]), { 6: 17, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 15: 18, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 18: [1, 19] }, o2($V1, [2, 3]), { 12: [1, 20] }, o2($V2, [2, 10]), { 15: 21, 16: 7, 17: 8, 18: $V0, 20: $V1 }, o2([1, 5, 10], [2, 7])],
          defaultActions: { 11: [2, 1], 12: [2, 5] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  this.pushState("csv");
                  return 4;
                  break;
                case 1:
                  this.pushState("csv");
                  return 4;
                  break;
                case 2:
                  return 10;
                  break;
                case 3:
                  return 5;
                  break;
                case 4:
                  return 12;
                  break;
                case 5:
                  this.pushState("escaped_text");
                  return 18;
                  break;
                case 6:
                  return 20;
                  break;
                case 7:
                  this.popState("escaped_text");
                  return 18;
                  break;
                case 8:
                  return 19;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:sankey-beta\b)/i, /^(?:sankey\b)/i, /^(?:$)/i, /^(?:((\u000D\u000A)|(\u000A)))/i, /^(?:(\u002C))/i, /^(?:(\u0022))/i, /^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i, /^(?:(\u0022)(?!(\u0022)))/i, /^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],
            conditions: { "csv": { "rules": [2, 3, 4, 5, 6, 7, 8], "inclusive": false }, "escaped_text": { "rules": [7, 8], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser18.parser = parser18;
      sankey_default = parser18;
    }
  });

  // src/diagrams/sankey/sankeyDB.ts
  var links2, nodes4, nodesMap, clear16, SankeyLink, addLink, SankeyNode, findOrCreateNode, getNodes, getLinks2, getGraph, sankeyDB_default;
  var init_sankeyDB = __esm({
    "src/diagrams/sankey/sankeyDB.ts"() {
      "use strict";
      init_diagramAPI();
      init_common();
      init_commonDb();
      links2 = [];
      nodes4 = [];
      nodesMap = /* @__PURE__ */ new Map();
      clear16 = /* @__PURE__ */ __name(() => {
        links2 = [];
        nodes4 = [];
        nodesMap = /* @__PURE__ */ new Map();
        clear();
      }, "clear");
      SankeyLink = class {
        constructor(source, target, value2 = 0) {
          this.source = source;
          this.target = target;
          this.value = value2;
        }
        static {
          __name(this, "SankeyLink");
        }
      };
      addLink = /* @__PURE__ */ __name((source, target, value2) => {
        links2.push(new SankeyLink(source, target, value2));
      }, "addLink");
      SankeyNode = class {
        constructor(ID) {
          this.ID = ID;
        }
        static {
          __name(this, "SankeyNode");
        }
      };
      findOrCreateNode = /* @__PURE__ */ __name((ID) => {
        ID = common_default.sanitizeText(ID, getConfig2());
        let node2 = nodesMap.get(ID);
        if (node2 === void 0) {
          node2 = new SankeyNode(ID);
          nodesMap.set(ID, node2);
          nodes4.push(node2);
        }
        return node2;
      }, "findOrCreateNode");
      getNodes = /* @__PURE__ */ __name(() => nodes4, "getNodes");
      getLinks2 = /* @__PURE__ */ __name(() => links2, "getLinks");
      getGraph = /* @__PURE__ */ __name(() => ({
        nodes: nodes4.map((node2) => ({ id: node2.ID })),
        links: links2.map((link2) => ({
          source: link2.source.ID,
          target: link2.target.ID,
          value: link2.value
        }))
      }), "getGraph");
      sankeyDB_default = {
        nodesMap,
        getConfig: /* @__PURE__ */ __name(() => getConfig2().sankey, "getConfig"),
        getNodes,
        getLinks: getLinks2,
        getGraph,
        addLink,
        findOrCreateNode,
        getAccTitle,
        setAccTitle,
        getAccDescription,
        setAccDescription,
        getDiagramTitle,
        setDiagramTitle,
        clear: clear16
      };
    }
  });

  // ../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/max.js
  function max9(values2, valueof) {
    let max10;
    if (valueof === void 0) {
      for (const value2 of values2) {
        if (value2 != null && (max10 < value2 || max10 === void 0 && value2 >= value2)) {
          max10 = value2;
        }
      }
    } else {
      let index = -1;
      for (let value2 of values2) {
        if ((value2 = valueof(value2, ++index, values2)) != null && (max10 < value2 || max10 === void 0 && value2 >= value2)) {
          max10 = value2;
        }
      }
    }
    return max10;
  }
  var init_max3 = __esm({
    "../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/max.js"() {
      "use strict";
      __name(max9, "max");
    }
  });

  // ../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/min.js
  function min8(values2, valueof) {
    let min9;
    if (valueof === void 0) {
      for (const value2 of values2) {
        if (value2 != null && (min9 > value2 || min9 === void 0 && value2 >= value2)) {
          min9 = value2;
        }
      }
    } else {
      let index = -1;
      for (let value2 of values2) {
        if ((value2 = valueof(value2, ++index, values2)) != null && (min9 > value2 || min9 === void 0 && value2 >= value2)) {
          min9 = value2;
        }
      }
    }
    return min9;
  }
  var init_min3 = __esm({
    "../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/min.js"() {
      "use strict";
      __name(min8, "min");
    }
  });

  // ../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/sum.js
  function sum(values2, valueof) {
    let sum2 = 0;
    if (valueof === void 0) {
      for (let value2 of values2) {
        if (value2 = +value2) {
          sum2 += value2;
        }
      }
    } else {
      let index = -1;
      for (let value2 of values2) {
        if (value2 = +valueof(value2, ++index, values2)) {
          sum2 += value2;
        }
      }
    }
    return sum2;
  }
  var init_sum2 = __esm({
    "../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/sum.js"() {
      "use strict";
      __name(sum, "sum");
    }
  });

  // ../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/index.js
  var init_src33 = __esm({
    "../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/index.js"() {
      "use strict";
      init_max3();
      init_min3();
      init_sum2();
    }
  });

  // ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/align.js
  function targetDepth(d3) {
    return d3.target.depth;
  }
  function left2(node2) {
    return node2.depth;
  }
  function right2(node2, n2) {
    return n2 - 1 - node2.height;
  }
  function justify(node2, n2) {
    return node2.sourceLinks.length ? node2.depth : n2 - 1;
  }
  function center3(node2) {
    return node2.targetLinks.length ? node2.depth : node2.sourceLinks.length ? min8(node2.sourceLinks, targetDepth) - 1 : 0;
  }
  var init_align = __esm({
    "../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/align.js"() {
      "use strict";
      init_src33();
      __name(targetDepth, "targetDepth");
      __name(left2, "left");
      __name(right2, "right");
      __name(justify, "justify");
      __name(center3, "center");
    }
  });

  // ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/constant.js
  function constant2(x5) {
    return function() {
      return x5;
    };
  }
  var init_constant9 = __esm({
    "../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/constant.js"() {
      "use strict";
      __name(constant2, "constant");
    }
  });

  // ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/sankey.js
  function ascendingSourceBreadth(a2, b3) {
    return ascendingBreadth(a2.source, b3.source) || a2.index - b3.index;
  }
  function ascendingTargetBreadth(a2, b3) {
    return ascendingBreadth(a2.target, b3.target) || a2.index - b3.index;
  }
  function ascendingBreadth(a2, b3) {
    return a2.y0 - b3.y0;
  }
  function value(d3) {
    return d3.value;
  }
  function defaultId(d3) {
    return d3.index;
  }
  function defaultNodes(graph) {
    return graph.nodes;
  }
  function defaultLinks(graph) {
    return graph.links;
  }
  function find3(nodeById, id34) {
    const node2 = nodeById.get(id34);
    if (!node2) throw new Error("missing: " + id34);
    return node2;
  }
  function computeLinkBreadths({ nodes: nodes5 }) {
    for (const node2 of nodes5) {
      let y0 = node2.y0;
      let y1 = y0;
      for (const link2 of node2.sourceLinks) {
        link2.y0 = y0 + link2.width / 2;
        y0 += link2.width;
      }
      for (const link2 of node2.targetLinks) {
        link2.y1 = y1 + link2.width / 2;
        y1 += link2.width;
      }
    }
  }
  function Sankey() {
    let x0 = 0, y0 = 0, x1 = 1, y1 = 1;
    let dx = 24;
    let dy = 8, py;
    let id34 = defaultId;
    let align = justify;
    let sort3;
    let linkSort;
    let nodes5 = defaultNodes;
    let links3 = defaultLinks;
    let iterations = 6;
    function sankey() {
      const graph = { nodes: nodes5.apply(null, arguments), links: links3.apply(null, arguments) };
      computeNodeLinks(graph);
      computeNodeValues(graph);
      computeNodeDepths(graph);
      computeNodeHeights(graph);
      computeNodeBreadths(graph);
      computeLinkBreadths(graph);
      return graph;
    }
    __name(sankey, "sankey");
    sankey.update = function(graph) {
      computeLinkBreadths(graph);
      return graph;
    };
    sankey.nodeId = function(_3) {
      return arguments.length ? (id34 = typeof _3 === "function" ? _3 : constant2(_3), sankey) : id34;
    };
    sankey.nodeAlign = function(_3) {
      return arguments.length ? (align = typeof _3 === "function" ? _3 : constant2(_3), sankey) : align;
    };
    sankey.nodeSort = function(_3) {
      return arguments.length ? (sort3 = _3, sankey) : sort3;
    };
    sankey.nodeWidth = function(_3) {
      return arguments.length ? (dx = +_3, sankey) : dx;
    };
    sankey.nodePadding = function(_3) {
      return arguments.length ? (dy = py = +_3, sankey) : dy;
    };
    sankey.nodes = function(_3) {
      return arguments.length ? (nodes5 = typeof _3 === "function" ? _3 : constant2(_3), sankey) : nodes5;
    };
    sankey.links = function(_3) {
      return arguments.length ? (links3 = typeof _3 === "function" ? _3 : constant2(_3), sankey) : links3;
    };
    sankey.linkSort = function(_3) {
      return arguments.length ? (linkSort = _3, sankey) : linkSort;
    };
    sankey.size = function(_3) {
      return arguments.length ? (x0 = y0 = 0, x1 = +_3[0], y1 = +_3[1], sankey) : [x1 - x0, y1 - y0];
    };
    sankey.extent = function(_3) {
      return arguments.length ? (x0 = +_3[0][0], x1 = +_3[1][0], y0 = +_3[0][1], y1 = +_3[1][1], sankey) : [[x0, y0], [x1, y1]];
    };
    sankey.iterations = function(_3) {
      return arguments.length ? (iterations = +_3, sankey) : iterations;
    };
    function computeNodeLinks({ nodes: nodes6, links: links4 }) {
      for (const [i2, node2] of nodes6.entries()) {
        node2.index = i2;
        node2.sourceLinks = [];
        node2.targetLinks = [];
      }
      const nodeById = new Map(nodes6.map((d3, i2) => [id34(d3, i2, nodes6), d3]));
      for (const [i2, link2] of links4.entries()) {
        link2.index = i2;
        let { source, target } = link2;
        if (typeof source !== "object") source = link2.source = find3(nodeById, source);
        if (typeof target !== "object") target = link2.target = find3(nodeById, target);
        source.sourceLinks.push(link2);
        target.targetLinks.push(link2);
      }
      if (linkSort != null) {
        for (const { sourceLinks, targetLinks } of nodes6) {
          sourceLinks.sort(linkSort);
          targetLinks.sort(linkSort);
        }
      }
    }
    __name(computeNodeLinks, "computeNodeLinks");
    function computeNodeValues({ nodes: nodes6 }) {
      for (const node2 of nodes6) {
        node2.value = node2.fixedValue === void 0 ? Math.max(sum(node2.sourceLinks, value), sum(node2.targetLinks, value)) : node2.fixedValue;
      }
    }
    __name(computeNodeValues, "computeNodeValues");
    function computeNodeDepths({ nodes: nodes6 }) {
      const n2 = nodes6.length;
      let current = new Set(nodes6);
      let next3 = /* @__PURE__ */ new Set();
      let x5 = 0;
      while (current.size) {
        for (const node2 of current) {
          node2.depth = x5;
          for (const { target } of node2.sourceLinks) {
            next3.add(target);
          }
        }
        if (++x5 > n2) throw new Error("circular link");
        current = next3;
        next3 = /* @__PURE__ */ new Set();
      }
    }
    __name(computeNodeDepths, "computeNodeDepths");
    function computeNodeHeights({ nodes: nodes6 }) {
      const n2 = nodes6.length;
      let current = new Set(nodes6);
      let next3 = /* @__PURE__ */ new Set();
      let x5 = 0;
      while (current.size) {
        for (const node2 of current) {
          node2.height = x5;
          for (const { source } of node2.targetLinks) {
            next3.add(source);
          }
        }
        if (++x5 > n2) throw new Error("circular link");
        current = next3;
        next3 = /* @__PURE__ */ new Set();
      }
    }
    __name(computeNodeHeights, "computeNodeHeights");
    function computeNodeLayers({ nodes: nodes6 }) {
      const x5 = max9(nodes6, (d3) => d3.depth) + 1;
      const kx = (x1 - x0 - dx) / (x5 - 1);
      const columns = new Array(x5);
      for (const node2 of nodes6) {
        const i2 = Math.max(0, Math.min(x5 - 1, Math.floor(align.call(null, node2, x5))));
        node2.layer = i2;
        node2.x0 = x0 + i2 * kx;
        node2.x1 = node2.x0 + dx;
        if (columns[i2]) columns[i2].push(node2);
        else columns[i2] = [node2];
      }
      if (sort3) for (const column2 of columns) {
        column2.sort(sort3);
      }
      return columns;
    }
    __name(computeNodeLayers, "computeNodeLayers");
    function initializeNodeBreadths(columns) {
      const ky = min8(columns, (c3) => (y1 - y0 - (c3.length - 1) * py) / sum(c3, value));
      for (const nodes6 of columns) {
        let y6 = y0;
        for (const node2 of nodes6) {
          node2.y0 = y6;
          node2.y1 = y6 + node2.value * ky;
          y6 = node2.y1 + py;
          for (const link2 of node2.sourceLinks) {
            link2.width = link2.value * ky;
          }
        }
        y6 = (y1 - y6 + py) / (nodes6.length + 1);
        for (let i2 = 0; i2 < nodes6.length; ++i2) {
          const node2 = nodes6[i2];
          node2.y0 += y6 * (i2 + 1);
          node2.y1 += y6 * (i2 + 1);
        }
        reorderLinks(nodes6);
      }
    }
    __name(initializeNodeBreadths, "initializeNodeBreadths");
    function computeNodeBreadths(graph) {
      const columns = computeNodeLayers(graph);
      py = Math.min(dy, (y1 - y0) / (max9(columns, (c3) => c3.length) - 1));
      initializeNodeBreadths(columns);
      for (let i2 = 0; i2 < iterations; ++i2) {
        const alpha = Math.pow(0.99, i2);
        const beta = Math.max(1 - alpha, (i2 + 1) / iterations);
        relaxRightToLeft(columns, alpha, beta);
        relaxLeftToRight(columns, alpha, beta);
      }
    }
    __name(computeNodeBreadths, "computeNodeBreadths");
    function relaxLeftToRight(columns, alpha, beta) {
      for (let i2 = 1, n2 = columns.length; i2 < n2; ++i2) {
        const column2 = columns[i2];
        for (const target of column2) {
          let y6 = 0;
          let w4 = 0;
          for (const { source, value: value2 } of target.targetLinks) {
            let v3 = value2 * (target.layer - source.layer);
            y6 += targetTop(source, target) * v3;
            w4 += v3;
          }
          if (!(w4 > 0)) continue;
          let dy2 = (y6 / w4 - target.y0) * alpha;
          target.y0 += dy2;
          target.y1 += dy2;
          reorderNodeLinks(target);
        }
        if (sort3 === void 0) column2.sort(ascendingBreadth);
        resolveCollisions(column2, beta);
      }
    }
    __name(relaxLeftToRight, "relaxLeftToRight");
    function relaxRightToLeft(columns, alpha, beta) {
      for (let n2 = columns.length, i2 = n2 - 2; i2 >= 0; --i2) {
        const column2 = columns[i2];
        for (const source of column2) {
          let y6 = 0;
          let w4 = 0;
          for (const { target, value: value2 } of source.sourceLinks) {
            let v3 = value2 * (target.layer - source.layer);
            y6 += sourceTop(source, target) * v3;
            w4 += v3;
          }
          if (!(w4 > 0)) continue;
          let dy2 = (y6 / w4 - source.y0) * alpha;
          source.y0 += dy2;
          source.y1 += dy2;
          reorderNodeLinks(source);
        }
        if (sort3 === void 0) column2.sort(ascendingBreadth);
        resolveCollisions(column2, beta);
      }
    }
    __name(relaxRightToLeft, "relaxRightToLeft");
    function resolveCollisions(nodes6, alpha) {
      const i2 = nodes6.length >> 1;
      const subject = nodes6[i2];
      resolveCollisionsBottomToTop(nodes6, subject.y0 - py, i2 - 1, alpha);
      resolveCollisionsTopToBottom(nodes6, subject.y1 + py, i2 + 1, alpha);
      resolveCollisionsBottomToTop(nodes6, y1, nodes6.length - 1, alpha);
      resolveCollisionsTopToBottom(nodes6, y0, 0, alpha);
    }
    __name(resolveCollisions, "resolveCollisions");
    function resolveCollisionsTopToBottom(nodes6, y6, i2, alpha) {
      for (; i2 < nodes6.length; ++i2) {
        const node2 = nodes6[i2];
        const dy2 = (y6 - node2.y0) * alpha;
        if (dy2 > 1e-6) node2.y0 += dy2, node2.y1 += dy2;
        y6 = node2.y1 + py;
      }
    }
    __name(resolveCollisionsTopToBottom, "resolveCollisionsTopToBottom");
    function resolveCollisionsBottomToTop(nodes6, y6, i2, alpha) {
      for (; i2 >= 0; --i2) {
        const node2 = nodes6[i2];
        const dy2 = (node2.y1 - y6) * alpha;
        if (dy2 > 1e-6) node2.y0 -= dy2, node2.y1 -= dy2;
        y6 = node2.y0 - py;
      }
    }
    __name(resolveCollisionsBottomToTop, "resolveCollisionsBottomToTop");
    function reorderNodeLinks({ sourceLinks, targetLinks }) {
      if (linkSort === void 0) {
        for (const { source: { sourceLinks: sourceLinks2 } } of targetLinks) {
          sourceLinks2.sort(ascendingTargetBreadth);
        }
        for (const { target: { targetLinks: targetLinks2 } } of sourceLinks) {
          targetLinks2.sort(ascendingSourceBreadth);
        }
      }
    }
    __name(reorderNodeLinks, "reorderNodeLinks");
    function reorderLinks(nodes6) {
      if (linkSort === void 0) {
        for (const { sourceLinks, targetLinks } of nodes6) {
          sourceLinks.sort(ascendingTargetBreadth);
          targetLinks.sort(ascendingSourceBreadth);
        }
      }
    }
    __name(reorderLinks, "reorderLinks");
    function targetTop(source, target) {
      let y6 = source.y0 - (source.sourceLinks.length - 1) * py / 2;
      for (const { target: node2, width: width3 } of source.sourceLinks) {
        if (node2 === target) break;
        y6 += width3 + py;
      }
      for (const { source: node2, width: width3 } of target.targetLinks) {
        if (node2 === source) break;
        y6 -= width3;
      }
      return y6;
    }
    __name(targetTop, "targetTop");
    function sourceTop(source, target) {
      let y6 = target.y0 - (target.targetLinks.length - 1) * py / 2;
      for (const { source: node2, width: width3 } of target.targetLinks) {
        if (node2 === source) break;
        y6 += width3 + py;
      }
      for (const { target: node2, width: width3 } of source.sourceLinks) {
        if (node2 === target) break;
        y6 -= width3;
      }
      return y6;
    }
    __name(sourceTop, "sourceTop");
    return sankey;
  }
  var init_sankey2 = __esm({
    "../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/sankey.js"() {
      "use strict";
      init_src33();
      init_align();
      init_constant9();
      __name(ascendingSourceBreadth, "ascendingSourceBreadth");
      __name(ascendingTargetBreadth, "ascendingTargetBreadth");
      __name(ascendingBreadth, "ascendingBreadth");
      __name(value, "value");
      __name(defaultId, "defaultId");
      __name(defaultNodes, "defaultNodes");
      __name(defaultLinks, "defaultLinks");
      __name(find3, "find");
      __name(computeLinkBreadths, "computeLinkBreadths");
      __name(Sankey, "Sankey");
    }
  });

  // ../../node_modules/.pnpm/d3-path@1.0.9/node_modules/d3-path/src/path.js
  function Path2() {
    this._x0 = this._y0 = // start of current subpath
    this._x1 = this._y1 = null;
    this._ = "";
  }
  function path3() {
    return new Path2();
  }
  var pi3, tau3, epsilon5, tauEpsilon2, path_default2;
  var init_path4 = __esm({
    "../../node_modules/.pnpm/d3-path@1.0.9/node_modules/d3-path/src/path.js"() {
      "use strict";
      pi3 = Math.PI;
      tau3 = 2 * pi3;
      epsilon5 = 1e-6;
      tauEpsilon2 = tau3 - epsilon5;
      __name(Path2, "Path");
      __name(path3, "path");
      Path2.prototype = path3.prototype = {
        constructor: Path2,
        moveTo: /* @__PURE__ */ __name(function(x5, y6) {
          this._ += "M" + (this._x0 = this._x1 = +x5) + "," + (this._y0 = this._y1 = +y6);
        }, "moveTo"),
        closePath: /* @__PURE__ */ __name(function() {
          if (this._x1 !== null) {
            this._x1 = this._x0, this._y1 = this._y0;
            this._ += "Z";
          }
        }, "closePath"),
        lineTo: /* @__PURE__ */ __name(function(x5, y6) {
          this._ += "L" + (this._x1 = +x5) + "," + (this._y1 = +y6);
        }, "lineTo"),
        quadraticCurveTo: /* @__PURE__ */ __name(function(x1, y1, x5, y6) {
          this._ += "Q" + +x1 + "," + +y1 + "," + (this._x1 = +x5) + "," + (this._y1 = +y6);
        }, "quadraticCurveTo"),
        bezierCurveTo: /* @__PURE__ */ __name(function(x1, y1, x22, y22, x5, y6) {
          this._ += "C" + +x1 + "," + +y1 + "," + +x22 + "," + +y22 + "," + (this._x1 = +x5) + "," + (this._y1 = +y6);
        }, "bezierCurveTo"),
        arcTo: /* @__PURE__ */ __name(function(x1, y1, x22, y22, r2) {
          x1 = +x1, y1 = +y1, x22 = +x22, y22 = +y22, r2 = +r2;
          var x0 = this._x1, y0 = this._y1, x21 = x22 - x1, y21 = y22 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
          if (r2 < 0) throw new Error("negative radius: " + r2);
          if (this._x1 === null) {
            this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
          } else if (!(l01_2 > epsilon5)) ;
          else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon5) || !r2) {
            this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
          } else {
            var x20 = x22 - x0, y20 = y22 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l4 = r2 * Math.tan((pi3 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l4 / l01, t21 = l4 / l21;
            if (Math.abs(t01 - 1) > epsilon5) {
              this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
            }
            this._ += "A" + r2 + "," + r2 + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
          }
        }, "arcTo"),
        arc: /* @__PURE__ */ __name(function(x5, y6, r2, a0, a1, ccw) {
          x5 = +x5, y6 = +y6, r2 = +r2, ccw = !!ccw;
          var dx = r2 * Math.cos(a0), dy = r2 * Math.sin(a0), x0 = x5 + dx, y0 = y6 + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
          if (r2 < 0) throw new Error("negative radius: " + r2);
          if (this._x1 === null) {
            this._ += "M" + x0 + "," + y0;
          } else if (Math.abs(this._x1 - x0) > epsilon5 || Math.abs(this._y1 - y0) > epsilon5) {
            this._ += "L" + x0 + "," + y0;
          }
          if (!r2) return;
          if (da < 0) da = da % tau3 + tau3;
          if (da > tauEpsilon2) {
            this._ += "A" + r2 + "," + r2 + ",0,1," + cw + "," + (x5 - dx) + "," + (y6 - dy) + "A" + r2 + "," + r2 + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
          } else if (da > epsilon5) {
            this._ += "A" + r2 + "," + r2 + ",0," + +(da >= pi3) + "," + cw + "," + (this._x1 = x5 + r2 * Math.cos(a1)) + "," + (this._y1 = y6 + r2 * Math.sin(a1));
          }
        }, "arc"),
        rect: /* @__PURE__ */ __name(function(x5, y6, w4, h3) {
          this._ += "M" + (this._x0 = this._x1 = +x5) + "," + (this._y0 = this._y1 = +y6) + "h" + +w4 + "v" + +h3 + "h" + -w4 + "Z";
        }, "rect"),
        toString: /* @__PURE__ */ __name(function() {
          return this._;
        }, "toString")
      };
      path_default2 = path3;
    }
  });

  // ../../node_modules/.pnpm/d3-path@1.0.9/node_modules/d3-path/src/index.js
  var init_src34 = __esm({
    "../../node_modules/.pnpm/d3-path@1.0.9/node_modules/d3-path/src/index.js"() {
      "use strict";
      init_path4();
    }
  });

  // ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/constant.js
  function constant_default8(x5) {
    return /* @__PURE__ */ __name(function constant3() {
      return x5;
    }, "constant");
  }
  var init_constant10 = __esm({
    "../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/constant.js"() {
      "use strict";
      __name(constant_default8, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/point.js
  function x4(p3) {
    return p3[0];
  }
  function y5(p3) {
    return p3[1];
  }
  var init_point2 = __esm({
    "../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/point.js"() {
      "use strict";
      __name(x4, "x");
      __name(y5, "y");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/array.js
  var slice3;
  var init_array4 = __esm({
    "../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/array.js"() {
      "use strict";
      slice3 = Array.prototype.slice;
    }
  });

  // ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/link/index.js
  function linkSource(d3) {
    return d3.source;
  }
  function linkTarget(d3) {
    return d3.target;
  }
  function link(curve) {
    var source = linkSource, target = linkTarget, x5 = x4, y6 = y5, context = null;
    function link2() {
      var buffer, argv = slice3.call(arguments), s2 = source.apply(this, argv), t4 = target.apply(this, argv);
      if (!context) context = buffer = path_default2();
      curve(context, +x5.apply(this, (argv[0] = s2, argv)), +y6.apply(this, argv), +x5.apply(this, (argv[0] = t4, argv)), +y6.apply(this, argv));
      if (buffer) return context = null, buffer + "" || null;
    }
    __name(link2, "link");
    link2.source = function(_3) {
      return arguments.length ? (source = _3, link2) : source;
    };
    link2.target = function(_3) {
      return arguments.length ? (target = _3, link2) : target;
    };
    link2.x = function(_3) {
      return arguments.length ? (x5 = typeof _3 === "function" ? _3 : constant_default8(+_3), link2) : x5;
    };
    link2.y = function(_3) {
      return arguments.length ? (y6 = typeof _3 === "function" ? _3 : constant_default8(+_3), link2) : y6;
    };
    link2.context = function(_3) {
      return arguments.length ? (context = _3 == null ? null : _3, link2) : context;
    };
    return link2;
  }
  function curveHorizontal(context, x0, y0, x1, y1) {
    context.moveTo(x0, y0);
    context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);
  }
  function linkHorizontal() {
    return link(curveHorizontal);
  }
  var init_link = __esm({
    "../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/link/index.js"() {
      "use strict";
      init_src34();
      init_array4();
      init_constant10();
      init_point2();
      __name(linkSource, "linkSource");
      __name(linkTarget, "linkTarget");
      __name(link, "link");
      __name(curveHorizontal, "curveHorizontal");
      __name(linkHorizontal, "linkHorizontal");
    }
  });

  // ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/index.js
  var init_src35 = __esm({
    "../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/index.js"() {
      "use strict";
      init_link();
    }
  });

  // ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/sankeyLinkHorizontal.js
  function horizontalSource(d3) {
    return [d3.source.x1, d3.y0];
  }
  function horizontalTarget(d3) {
    return [d3.target.x0, d3.y1];
  }
  function sankeyLinkHorizontal_default() {
    return linkHorizontal().source(horizontalSource).target(horizontalTarget);
  }
  var init_sankeyLinkHorizontal = __esm({
    "../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/sankeyLinkHorizontal.js"() {
      "use strict";
      init_src35();
      __name(horizontalSource, "horizontalSource");
      __name(horizontalTarget, "horizontalTarget");
      __name(sankeyLinkHorizontal_default, "default");
    }
  });

  // ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/index.js
  var init_src36 = __esm({
    "../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/index.js"() {
      "use strict";
      init_sankey2();
      init_align();
      init_sankeyLinkHorizontal();
    }
  });

  // src/rendering-util/uid.ts
  var Uid;
  var init_uid = __esm({
    "src/rendering-util/uid.ts"() {
      "use strict";
      Uid = class _Uid {
        static {
          __name(this, "Uid");
        }
        static {
          this.count = 0;
        }
        static next(name) {
          return new _Uid(name + ++_Uid.count);
        }
        constructor(id34) {
          this.id = id34;
          this.href = `#${id34}`;
        }
        toString() {
          return "url(" + this.href + ")";
        }
      };
    }
  });

  // src/diagrams/sankey/sankeyRenderer.ts
  var alignmentsMap, draw21, sankeyRenderer_default;
  var init_sankeyRenderer = __esm({
    "src/diagrams/sankey/sankeyRenderer.ts"() {
      "use strict";
      init_diagramAPI();
      init_src32();
      init_src36();
      init_setupGraphViewbox();
      init_uid();
      alignmentsMap = {
        left: left2,
        right: right2,
        center: center3,
        justify
      };
      draw21 = /* @__PURE__ */ __name(function(text4, id34, _version, diagObj) {
        const { securityLevel, sankey: conf5 } = getConfig2();
        const defaultSankeyConfig = defaultConfig2.sankey;
        let sandboxElement;
        if (securityLevel === "sandbox") {
          sandboxElement = select_default2("#i" + id34);
        }
        const root3 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body");
        const svg2 = securityLevel === "sandbox" ? root3.select(`[id="${id34}"]`) : select_default2(`[id="${id34}"]`);
        const width3 = conf5?.width ?? defaultSankeyConfig.width;
        const height2 = conf5?.height ?? defaultSankeyConfig.width;
        const useMaxWidth = conf5?.useMaxWidth ?? defaultSankeyConfig.useMaxWidth;
        const nodeAlignment = conf5?.nodeAlignment ?? defaultSankeyConfig.nodeAlignment;
        const prefix = conf5?.prefix ?? defaultSankeyConfig.prefix;
        const suffix = conf5?.suffix ?? defaultSankeyConfig.suffix;
        const showValues = conf5?.showValues ?? defaultSankeyConfig.showValues;
        const graph = diagObj.db.getGraph();
        const nodeAlign = alignmentsMap[nodeAlignment];
        const nodeWidth = 10;
        const sankey = Sankey().nodeId((d3) => d3.id).nodeWidth(nodeWidth).nodePadding(10 + (showValues ? 15 : 0)).nodeAlign(nodeAlign).extent([
          [0, 0],
          [width3, height2]
        ]);
        sankey(graph);
        const colorScheme = ordinal(Tableau10_default);
        svg2.append("g").attr("class", "nodes").selectAll(".node").data(graph.nodes).join("g").attr("class", "node").attr("id", (d3) => (d3.uid = Uid.next("node-")).id).attr("transform", function(d3) {
          return "translate(" + d3.x0 + "," + d3.y0 + ")";
        }).attr("x", (d3) => d3.x0).attr("y", (d3) => d3.y0).append("rect").attr("height", (d3) => {
          return d3.y1 - d3.y0;
        }).attr("width", (d3) => d3.x1 - d3.x0).attr("fill", (d3) => colorScheme(d3.id));
        const getText = /* @__PURE__ */ __name(({ id: id35, value: value2 }) => {
          if (!showValues) {
            return id35;
          }
          return `${id35}
${prefix}${Math.round(value2 * 100) / 100}${suffix}`;
        }, "getText");
        svg2.append("g").attr("class", "node-labels").attr("font-size", 14).selectAll("text").data(graph.nodes).join("text").attr("x", (d3) => d3.x0 < width3 / 2 ? d3.x1 + 6 : d3.x0 - 6).attr("y", (d3) => (d3.y1 + d3.y0) / 2).attr("dy", `${showValues ? "0" : "0.35"}em`).attr("text-anchor", (d3) => d3.x0 < width3 / 2 ? "start" : "end").text(getText);
        const link2 = svg2.append("g").attr("class", "links").attr("fill", "none").attr("stroke-opacity", 0.5).selectAll(".link").data(graph.links).join("g").attr("class", "link").style("mix-blend-mode", "multiply");
        const linkColor = conf5?.linkColor ?? "gradient";
        if (linkColor === "gradient") {
          const gradient = link2.append("linearGradient").attr("id", (d3) => (d3.uid = Uid.next("linearGradient-")).id).attr("gradientUnits", "userSpaceOnUse").attr("x1", (d3) => d3.source.x1).attr("x2", (d3) => d3.target.x0);
          gradient.append("stop").attr("offset", "0%").attr("stop-color", (d3) => colorScheme(d3.source.id));
          gradient.append("stop").attr("offset", "100%").attr("stop-color", (d3) => colorScheme(d3.target.id));
        }
        let coloring;
        switch (linkColor) {
          case "gradient":
            coloring = /* @__PURE__ */ __name((d3) => d3.uid, "coloring");
            break;
          case "source":
            coloring = /* @__PURE__ */ __name((d3) => colorScheme(d3.source.id), "coloring");
            break;
          case "target":
            coloring = /* @__PURE__ */ __name((d3) => colorScheme(d3.target.id), "coloring");
            break;
          default:
            coloring = linkColor;
        }
        link2.append("path").attr("d", sankeyLinkHorizontal_default()).attr("stroke", coloring).attr("stroke-width", (d3) => Math.max(1, d3.width));
        setupGraphViewbox(void 0, svg2, 0, useMaxWidth);
      }, "draw");
      sankeyRenderer_default = {
        draw: draw21
      };
    }
  });

  // src/diagrams/sankey/sankeyUtils.ts
  var prepareTextForParsing;
  var init_sankeyUtils = __esm({
    "src/diagrams/sankey/sankeyUtils.ts"() {
      "use strict";
      prepareTextForParsing = /* @__PURE__ */ __name((text4) => {
        const textToParse = text4.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, "\n").trim();
        return textToParse;
      }, "prepareTextForParsing");
    }
  });

  // src/diagrams/sankey/styles.js
  var getStyles16, styles_default15;
  var init_styles15 = __esm({
    "src/diagrams/sankey/styles.js"() {
      "use strict";
      getStyles16 = /* @__PURE__ */ __name((options2) => `.label {
      font-family: ${options2.fontFamily};
    }`, "getStyles");
      styles_default15 = getStyles16;
    }
  });

  // src/diagrams/sankey/sankeyDiagram.ts
  var sankeyDiagram_exports = {};
  __export(sankeyDiagram_exports, {
    diagram: () => diagram21
  });
  var originalParse, diagram21;
  var init_sankeyDiagram = __esm({
    "src/diagrams/sankey/sankeyDiagram.ts"() {
      "use strict";
      init_sankey();
      init_sankeyDB();
      init_sankeyRenderer();
      init_sankeyUtils();
      init_styles15();
      originalParse = sankey_default.parse.bind(sankey_default);
      sankey_default.parse = (text4) => originalParse(prepareTextForParsing(text4));
      diagram21 = {
        styles: styles_default15,
        parser: sankey_default,
        db: sankeyDB_default,
        renderer: sankeyRenderer_default
      };
    }
  });

  // src/diagrams/packet/db.ts
  var DEFAULT_PACKET_CONFIG, PacketDB;
  var init_db = __esm({
    "src/diagrams/packet/db.ts"() {
      "use strict";
      init_config();
      init_defaultConfig();
      init_utils2();
      init_commonDb();
      DEFAULT_PACKET_CONFIG = defaultConfig_default.packet;
      PacketDB = class {
        constructor() {
          this.packet = [];
          this.setAccTitle = setAccTitle;
          this.getAccTitle = getAccTitle;
          this.setDiagramTitle = setDiagramTitle;
          this.getDiagramTitle = getDiagramTitle;
          this.getAccDescription = getAccDescription;
          this.setAccDescription = setAccDescription;
        }
        static {
          __name(this, "PacketDB");
        }
        getConfig() {
          const config5 = cleanAndMerge({
            ...DEFAULT_PACKET_CONFIG,
            ...getConfig().packet
          });
          if (config5.showBits) {
            config5.paddingY += 10;
          }
          return config5;
        }
        getPacket() {
          return this.packet;
        }
        pushWord(word) {
          if (word.length > 0) {
            this.packet.push(word);
          }
        }
        clear() {
          clear();
          this.packet = [];
        }
      };
    }
  });

  // src/diagrams/packet/parser.ts
  var maxPacketSize, populate16, getNextFittingBlock, parser19;
  var init_parser3 = __esm({
    "src/diagrams/packet/parser.ts"() {
      "use strict";
      init_mermaid_parser_core();
      init_logger();
      init_populateCommonDb();
      init_db();
      maxPacketSize = 1e4;
      populate16 = /* @__PURE__ */ __name((ast, db9) => {
        populateCommonDb(ast, db9);
        let lastBit = -1;
        let word = [];
        let row = 1;
        const { bitsPerRow } = db9.getConfig();
        for (let { start: start3, end: end2, bits, label } of ast.blocks) {
          if (start3 !== void 0 && end2 !== void 0 && end2 < start3) {
            throw new Error(`Packet block ${start3} - ${end2} is invalid. End must be greater than start.`);
          }
          start3 ??= lastBit + 1;
          if (start3 !== lastBit + 1) {
            throw new Error(
              `Packet block ${start3} - ${end2 ?? start3} is not contiguous. It should start from ${lastBit + 1}.`
            );
          }
          if (bits === 0) {
            throw new Error(`Packet block ${start3} is invalid. Cannot have a zero bit field.`);
          }
          end2 ??= start3 + (bits ?? 1) - 1;
          bits ??= end2 - start3 + 1;
          lastBit = end2;
          log.debug(`Packet block ${start3} - ${lastBit} with label ${label}`);
          while (word.length <= bitsPerRow + 1 && db9.getPacket().length < maxPacketSize) {
            const [block2, nextBlock] = getNextFittingBlock({ start: start3, end: end2, bits, label }, row, bitsPerRow);
            word.push(block2);
            if (block2.end + 1 === row * bitsPerRow) {
              db9.pushWord(word);
              word = [];
              row++;
            }
            if (!nextBlock) {
              break;
            }
            ({ start: start3, end: end2, bits, label } = nextBlock);
          }
        }
        db9.pushWord(word);
      }, "populate");
      getNextFittingBlock = /* @__PURE__ */ __name((block2, row, bitsPerRow) => {
        if (block2.start === void 0) {
          throw new Error("start should have been set during first phase");
        }
        if (block2.end === void 0) {
          throw new Error("end should have been set during first phase");
        }
        if (block2.start > block2.end) {
          throw new Error(`Block start ${block2.start} is greater than block end ${block2.end}.`);
        }
        if (block2.end + 1 <= row * bitsPerRow) {
          return [block2, void 0];
        }
        const rowEnd = row * bitsPerRow - 1;
        const rowStart = row * bitsPerRow;
        return [
          {
            start: block2.start,
            end: rowEnd,
            label: block2.label,
            bits: rowEnd - block2.start
          },
          {
            start: rowStart,
            end: block2.end,
            label: block2.label,
            bits: block2.end - rowStart
          }
        ];
      }, "getNextFittingBlock");
      parser19 = {
        // @ts-expect-error - PacketDB is not assignable to DiagramDB
        parser: { yy: void 0 },
        parse: /* @__PURE__ */ __name(async (input) => {
          const ast = await parse3("packet", input);
          const db9 = parser19.parser?.yy;
          if (!(db9 instanceof PacketDB)) {
            throw new Error(
              "parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
            );
          }
          log.debug(ast);
          populate16(ast, db9);
        }, "parse")
      };
    }
  });

  // src/diagrams/packet/renderer.ts
  var draw22, drawWord, renderer6;
  var init_renderer = __esm({
    "src/diagrams/packet/renderer.ts"() {
      "use strict";
      init_selectSvgElement();
      init_setupGraphViewbox();
      draw22 = /* @__PURE__ */ __name((_text, id34, _version, diagram31) => {
        const db9 = diagram31.db;
        const config5 = db9.getConfig();
        const { rowHeight, paddingY, bitWidth, bitsPerRow } = config5;
        const words = db9.getPacket();
        const title2 = db9.getDiagramTitle();
        const totalRowHeight = rowHeight + paddingY;
        const svgHeight = totalRowHeight * (words.length + 1) - (title2 ? 0 : rowHeight);
        const svgWidth = bitWidth * bitsPerRow + 2;
        const svg2 = selectSvgElement(id34);
        svg2.attr("viewBox", `0 0 ${svgWidth} ${svgHeight}`);
        configureSvgSize(svg2, svgHeight, svgWidth, config5.useMaxWidth);
        for (const [word, packet2] of words.entries()) {
          drawWord(svg2, packet2, word, config5);
        }
        svg2.append("text").text(title2).attr("x", svgWidth / 2).attr("y", svgHeight - totalRowHeight / 2).attr("dominant-baseline", "middle").attr("text-anchor", "middle").attr("class", "packetTitle");
      }, "draw");
      drawWord = /* @__PURE__ */ __name((svg2, word, rowNumber, { rowHeight, paddingX, paddingY, bitWidth, bitsPerRow, showBits }) => {
        const group2 = svg2.append("g");
        const wordY = rowNumber * (rowHeight + paddingY) + paddingY;
        for (const block2 of word) {
          const blockX = block2.start % bitsPerRow * bitWidth + 1;
          const width3 = (block2.end - block2.start + 1) * bitWidth - paddingX;
          group2.append("rect").attr("x", blockX).attr("y", wordY).attr("width", width3).attr("height", rowHeight).attr("class", "packetBlock");
          group2.append("text").attr("x", blockX + width3 / 2).attr("y", wordY + rowHeight / 2).attr("class", "packetLabel").attr("dominant-baseline", "middle").attr("text-anchor", "middle").text(block2.label);
          if (!showBits) {
            continue;
          }
          const isSingleBlock = block2.end === block2.start;
          const bitNumberY = wordY - 2;
          group2.append("text").attr("x", blockX + (isSingleBlock ? width3 / 2 : 0)).attr("y", bitNumberY).attr("class", "packetByte start").attr("dominant-baseline", "auto").attr("text-anchor", isSingleBlock ? "middle" : "start").text(block2.start);
          if (!isSingleBlock) {
            group2.append("text").attr("x", blockX + width3).attr("y", bitNumberY).attr("class", "packetByte end").attr("dominant-baseline", "auto").attr("text-anchor", "end").text(block2.end);
          }
        }
      }, "drawWord");
      renderer6 = { draw: draw22 };
    }
  });

  // src/diagrams/packet/styles.ts
  var defaultPacketStyleOptions, styles2;
  var init_styles16 = __esm({
    "src/diagrams/packet/styles.ts"() {
      "use strict";
      init_utils2();
      defaultPacketStyleOptions = {
        byteFontSize: "10px",
        startByteColor: "black",
        endByteColor: "black",
        labelColor: "black",
        labelFontSize: "12px",
        titleColor: "black",
        titleFontSize: "14px",
        blockStrokeColor: "black",
        blockStrokeWidth: "1",
        blockFillColor: "#efefef"
      };
      styles2 = /* @__PURE__ */ __name(({ packet: packet2 } = {}) => {
        const options2 = cleanAndMerge(defaultPacketStyleOptions, packet2);
        return `
	.packetByte {
		font-size: ${options2.byteFontSize};
	}
	.packetByte.start {
		fill: ${options2.startByteColor};
	}
	.packetByte.end {
		fill: ${options2.endByteColor};
	}
	.packetLabel {
		fill: ${options2.labelColor};
		font-size: ${options2.labelFontSize};
	}
	.packetTitle {
		fill: ${options2.titleColor};
		font-size: ${options2.titleFontSize};
	}
	.packetBlock {
		stroke: ${options2.blockStrokeColor};
		stroke-width: ${options2.blockStrokeWidth};
		fill: ${options2.blockFillColor};
	}
	`;
      }, "styles");
    }
  });

  // src/diagrams/packet/diagram.ts
  var diagram_exports = {};
  __export(diagram_exports, {
    diagram: () => diagram22
  });
  var diagram22;
  var init_diagram = __esm({
    "src/diagrams/packet/diagram.ts"() {
      "use strict";
      init_db();
      init_parser3();
      init_renderer();
      init_styles16();
      diagram22 = {
        parser: parser19,
        get db() {
          return new PacketDB();
        },
        renderer: renderer6,
        styles: styles2
      };
    }
  });

  // src/diagrams/radar/db.ts
  var defaultOptions, defaultRadarData, data4, DEFAULT_RADAR_CONFIG, getConfig5, getAxes, getCurves, getOptions2, setAxes, setCurves, computeCurveEntries, setOptions7, clear17, db5;
  var init_db2 = __esm({
    "src/diagrams/radar/db.ts"() {
      "use strict";
      init_config();
      init_defaultConfig();
      init_utils2();
      init_commonDb();
      defaultOptions = {
        showLegend: true,
        ticks: 5,
        max: null,
        min: 0,
        graticule: "circle"
      };
      defaultRadarData = {
        axes: [],
        curves: [],
        options: defaultOptions
      };
      data4 = structuredClone(defaultRadarData);
      DEFAULT_RADAR_CONFIG = defaultConfig_default.radar;
      getConfig5 = /* @__PURE__ */ __name(() => {
        const config5 = cleanAndMerge({
          ...DEFAULT_RADAR_CONFIG,
          ...getConfig().radar
        });
        return config5;
      }, "getConfig");
      getAxes = /* @__PURE__ */ __name(() => data4.axes, "getAxes");
      getCurves = /* @__PURE__ */ __name(() => data4.curves, "getCurves");
      getOptions2 = /* @__PURE__ */ __name(() => data4.options, "getOptions");
      setAxes = /* @__PURE__ */ __name((axes) => {
        data4.axes = axes.map((axis2) => {
          return {
            name: axis2.name,
            label: axis2.label ?? axis2.name
          };
        });
      }, "setAxes");
      setCurves = /* @__PURE__ */ __name((curves) => {
        data4.curves = curves.map((curve) => {
          return {
            name: curve.name,
            label: curve.label ?? curve.name,
            entries: computeCurveEntries(curve.entries)
          };
        });
      }, "setCurves");
      computeCurveEntries = /* @__PURE__ */ __name((entries2) => {
        if (entries2[0].axis == void 0) {
          return entries2.map((entry) => entry.value);
        }
        const axes = getAxes();
        if (axes.length === 0) {
          throw new Error("Axes must be populated before curves for reference entries");
        }
        return axes.map((axis2) => {
          const entry = entries2.find((entry2) => entry2.axis?.$refText === axis2.name);
          if (entry === void 0) {
            throw new Error("Missing entry for axis " + axis2.label);
          }
          return entry.value;
        });
      }, "computeCurveEntries");
      setOptions7 = /* @__PURE__ */ __name((options2) => {
        const optionMap = options2.reduce(
          (acc, option2) => {
            acc[option2.name] = option2;
            return acc;
          },
          {}
        );
        data4.options = {
          showLegend: optionMap.showLegend?.value ?? defaultOptions.showLegend,
          ticks: optionMap.ticks?.value ?? defaultOptions.ticks,
          max: optionMap.max?.value ?? defaultOptions.max,
          min: optionMap.min?.value ?? defaultOptions.min,
          graticule: optionMap.graticule?.value ?? defaultOptions.graticule
        };
      }, "setOptions");
      clear17 = /* @__PURE__ */ __name(() => {
        clear();
        data4 = structuredClone(defaultRadarData);
      }, "clear");
      db5 = {
        getAxes,
        getCurves,
        getOptions: getOptions2,
        setAxes,
        setCurves,
        setOptions: setOptions7,
        getConfig: getConfig5,
        clear: clear17,
        setAccTitle,
        getAccTitle,
        setDiagramTitle,
        getDiagramTitle,
        getAccDescription,
        setAccDescription
      };
    }
  });

  // src/diagrams/radar/parser.ts
  var populate17, parser20;
  var init_parser4 = __esm({
    "src/diagrams/radar/parser.ts"() {
      "use strict";
      init_mermaid_parser_core();
      init_logger();
      init_populateCommonDb();
      init_db2();
      populate17 = /* @__PURE__ */ __name((ast) => {
        populateCommonDb(ast, db5);
        const { axes, curves, options: options2 } = ast;
        db5.setAxes(axes);
        db5.setCurves(curves);
        db5.setOptions(options2);
      }, "populate");
      parser20 = {
        parse: /* @__PURE__ */ __name(async (input) => {
          const ast = await parse3("radar", input);
          log.debug(ast);
          populate17(ast);
        }, "parse")
      };
    }
  });

  // src/diagrams/radar/renderer.ts
  function drawCurves(g2, axes, curves, minValue, maxValue, graticule, config5) {
    const numAxes = axes.length;
    const radius2 = Math.min(config5.width, config5.height) / 2;
    curves.forEach((curve, index) => {
      if (curve.entries.length !== numAxes) {
        return;
      }
      const points = curve.entries.map((entry, i2) => {
        const angle2 = 2 * Math.PI * i2 / numAxes - Math.PI / 2;
        const r2 = relativeRadius(entry, minValue, maxValue, radius2);
        const x5 = r2 * Math.cos(angle2);
        const y6 = r2 * Math.sin(angle2);
        return { x: x5, y: y6 };
      });
      if (graticule === "circle") {
        g2.append("path").attr("d", closedRoundCurve(points, config5.curveTension)).attr("class", `radarCurve-${index}`);
      } else if (graticule === "polygon") {
        g2.append("polygon").attr("points", points.map((p3) => `${p3.x},${p3.y}`).join(" ")).attr("class", `radarCurve-${index}`);
      }
    });
  }
  function relativeRadius(value2, minValue, maxValue, radius2) {
    const clippedValue = Math.min(Math.max(value2, minValue), maxValue);
    return radius2 * (clippedValue - minValue) / (maxValue - minValue);
  }
  function closedRoundCurve(points, tension) {
    const numPoints = points.length;
    let d3 = `M${points[0].x},${points[0].y}`;
    for (let i2 = 0; i2 < numPoints; i2++) {
      const p0 = points[(i2 - 1 + numPoints) % numPoints];
      const p1 = points[i2];
      const p22 = points[(i2 + 1) % numPoints];
      const p3 = points[(i2 + 2) % numPoints];
      const cp1 = {
        x: p1.x + (p22.x - p0.x) * tension,
        y: p1.y + (p22.y - p0.y) * tension
      };
      const cp2 = {
        x: p22.x - (p3.x - p1.x) * tension,
        y: p22.y - (p3.y - p1.y) * tension
      };
      d3 += ` C${cp1.x},${cp1.y} ${cp2.x},${cp2.y} ${p22.x},${p22.y}`;
    }
    return `${d3} Z`;
  }
  function drawLegend(g2, curves, showLegend, config5) {
    if (!showLegend) {
      return;
    }
    const legendX = (config5.width / 2 + config5.marginRight) * 3 / 4;
    const legendY = -(config5.height / 2 + config5.marginTop) * 3 / 4;
    const lineHeight = 20;
    curves.forEach((curve, index) => {
      const itemGroup = g2.append("g").attr("transform", `translate(${legendX}, ${legendY + index * lineHeight})`);
      itemGroup.append("rect").attr("width", 12).attr("height", 12).attr("class", `radarLegendBox-${index}`);
      itemGroup.append("text").attr("x", 16).attr("y", 0).attr("class", "radarLegendText").text(curve.label);
    });
  }
  var draw23, drawFrame, drawGraticule, drawAxes2, renderer7;
  var init_renderer2 = __esm({
    "src/diagrams/radar/renderer.ts"() {
      "use strict";
      init_selectSvgElement();
      init_setupGraphViewbox();
      draw23 = /* @__PURE__ */ __name((_text, id34, _version, diagram31) => {
        const db9 = diagram31.db;
        const axes = db9.getAxes();
        const curves = db9.getCurves();
        const options2 = db9.getOptions();
        const config5 = db9.getConfig();
        const title2 = db9.getDiagramTitle();
        const svg2 = selectSvgElement(id34);
        const g2 = drawFrame(svg2, config5);
        const maxValue = options2.max ?? Math.max(...curves.map((curve) => Math.max(...curve.entries)));
        const minValue = options2.min;
        const radius2 = Math.min(config5.width, config5.height) / 2;
        drawGraticule(g2, axes, radius2, options2.ticks, options2.graticule);
        drawAxes2(g2, axes, radius2, config5);
        drawCurves(g2, axes, curves, minValue, maxValue, options2.graticule, config5);
        drawLegend(g2, curves, options2.showLegend, config5);
        g2.append("text").attr("class", "radarTitle").text(title2).attr("x", 0).attr("y", -config5.height / 2 - config5.marginTop);
      }, "draw");
      drawFrame = /* @__PURE__ */ __name((svg2, config5) => {
        const totalWidth = config5.width + config5.marginLeft + config5.marginRight;
        const totalHeight = config5.height + config5.marginTop + config5.marginBottom;
        const center4 = {
          x: config5.marginLeft + config5.width / 2,
          y: config5.marginTop + config5.height / 2
        };
        configureSvgSize(svg2, totalHeight, totalWidth, config5.useMaxWidth ?? true);
        svg2.attr("viewBox", `0 0 ${totalWidth} ${totalHeight}`);
        return svg2.append("g").attr("transform", `translate(${center4.x}, ${center4.y})`);
      }, "drawFrame");
      drawGraticule = /* @__PURE__ */ __name((g2, axes, radius2, ticks2, graticule) => {
        if (graticule === "circle") {
          for (let i2 = 0; i2 < ticks2; i2++) {
            const r2 = radius2 * (i2 + 1) / ticks2;
            g2.append("circle").attr("r", r2).attr("class", "radarGraticule");
          }
        } else if (graticule === "polygon") {
          const numAxes = axes.length;
          for (let i2 = 0; i2 < ticks2; i2++) {
            const r2 = radius2 * (i2 + 1) / ticks2;
            const points = axes.map((_3, j3) => {
              const angle2 = 2 * j3 * Math.PI / numAxes - Math.PI / 2;
              const x5 = r2 * Math.cos(angle2);
              const y6 = r2 * Math.sin(angle2);
              return `${x5},${y6}`;
            }).join(" ");
            g2.append("polygon").attr("points", points).attr("class", "radarGraticule");
          }
        }
      }, "drawGraticule");
      drawAxes2 = /* @__PURE__ */ __name((g2, axes, radius2, config5) => {
        const numAxes = axes.length;
        for (let i2 = 0; i2 < numAxes; i2++) {
          const label = axes[i2].label;
          const angle2 = 2 * i2 * Math.PI / numAxes - Math.PI / 2;
          g2.append("line").attr("x1", 0).attr("y1", 0).attr("x2", radius2 * config5.axisScaleFactor * Math.cos(angle2)).attr("y2", radius2 * config5.axisScaleFactor * Math.sin(angle2)).attr("class", "radarAxisLine");
          g2.append("text").text(label).attr("x", radius2 * config5.axisLabelFactor * Math.cos(angle2)).attr("y", radius2 * config5.axisLabelFactor * Math.sin(angle2)).attr("class", "radarAxisLabel");
        }
      }, "drawAxes");
      __name(drawCurves, "drawCurves");
      __name(relativeRadius, "relativeRadius");
      __name(closedRoundCurve, "closedRoundCurve");
      __name(drawLegend, "drawLegend");
      renderer7 = { draw: draw23 };
    }
  });

  // src/diagrams/radar/styles.ts
  var genIndexStyles, buildRadarStyleOptions, styles3;
  var init_styles17 = __esm({
    "src/diagrams/radar/styles.ts"() {
      "use strict";
      init_utils2();
      init_theme_default();
      init_config();
      genIndexStyles = /* @__PURE__ */ __name((themeVariables, radarOptions) => {
        let sections6 = "";
        for (let i2 = 0; i2 < themeVariables.THEME_COLOR_LIMIT; i2++) {
          const indexColor = themeVariables[`cScale${i2}`];
          sections6 += `
		.radarCurve-${i2} {
			color: ${indexColor};
			fill: ${indexColor};
			fill-opacity: ${radarOptions.curveOpacity};
			stroke: ${indexColor};
			stroke-width: ${radarOptions.curveStrokeWidth};
		}
		.radarLegendBox-${i2} {
			fill: ${indexColor};
			fill-opacity: ${radarOptions.curveOpacity};
			stroke: ${indexColor};
		}
		`;
        }
        return sections6;
      }, "genIndexStyles");
      buildRadarStyleOptions = /* @__PURE__ */ __name((radar2) => {
        const defaultThemeVariables2 = getThemeVariables3();
        const currentConfig2 = getConfig();
        const themeVariables = cleanAndMerge(defaultThemeVariables2, currentConfig2.themeVariables);
        const radarOptions = cleanAndMerge(themeVariables.radar, radar2);
        return { themeVariables, radarOptions };
      }, "buildRadarStyleOptions");
      styles3 = /* @__PURE__ */ __name(({ radar: radar2 } = {}) => {
        const { themeVariables, radarOptions } = buildRadarStyleOptions(radar2);
        return `
	.radarTitle {
		font-size: ${themeVariables.fontSize};
		color: ${themeVariables.titleColor};
		dominant-baseline: hanging;
		text-anchor: middle;
	}
	.radarAxisLine {
		stroke: ${radarOptions.axisColor};
		stroke-width: ${radarOptions.axisStrokeWidth};
	}
	.radarAxisLabel {
		dominant-baseline: middle;
		text-anchor: middle;
		font-size: ${radarOptions.axisLabelFontSize}px;
		color: ${radarOptions.axisColor};
	}
	.radarGraticule {
		fill: ${radarOptions.graticuleColor};
		fill-opacity: ${radarOptions.graticuleOpacity};
		stroke: ${radarOptions.graticuleColor};
		stroke-width: ${radarOptions.graticuleStrokeWidth};
	}
	.radarLegendText {
		text-anchor: start;
		font-size: ${radarOptions.legendFontSize}px;
		dominant-baseline: hanging;
	}
	${genIndexStyles(themeVariables, radarOptions)}
	`;
      }, "styles");
    }
  });

  // src/diagrams/radar/diagram.ts
  var diagram_exports2 = {};
  __export(diagram_exports2, {
    diagram: () => diagram23
  });
  var diagram23;
  var init_diagram2 = __esm({
    "src/diagrams/radar/diagram.ts"() {
      "use strict";
      init_db2();
      init_parser4();
      init_renderer2();
      init_styles17();
      diagram23 = {
        parser: parser20,
        db: db5,
        renderer: renderer7,
        styles: styles3
      };
    }
  });

  // src/diagrams/block/parser/block.jison
  var parser21, block_default;
  var init_block = __esm({
    "src/diagrams/block/parser/block.jison"() {
      "use strict";
      parser21 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [1, 15], $V1 = [1, 7], $V2 = [1, 13], $V3 = [1, 14], $V4 = [1, 19], $V5 = [1, 16], $V6 = [1, 17], $V7 = [1, 18], $V8 = [8, 30], $V9 = [8, 10, 21, 28, 29, 30, 31, 39, 43, 46], $Va = [1, 23], $Vb = [1, 24], $Vc = [8, 10, 15, 16, 21, 28, 29, 30, 31, 39, 43, 46], $Vd = [8, 10, 15, 16, 21, 27, 28, 29, 30, 31, 39, 43, 46], $Ve = [1, 49];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "spaceLines": 3, "SPACELINE": 4, "NL": 5, "separator": 6, "SPACE": 7, "EOF": 8, "start": 9, "BLOCK_DIAGRAM_KEY": 10, "document": 11, "stop": 12, "statement": 13, "link": 14, "LINK": 15, "START_LINK": 16, "LINK_LABEL": 17, "STR": 18, "nodeStatement": 19, "columnsStatement": 20, "SPACE_BLOCK": 21, "blockStatement": 22, "classDefStatement": 23, "cssClassStatement": 24, "styleStatement": 25, "node": 26, "SIZE": 27, "COLUMNS": 28, "id-block": 29, "end": 30, "NODE_ID": 31, "nodeShapeNLabel": 32, "dirList": 33, "DIR": 34, "NODE_DSTART": 35, "NODE_DEND": 36, "BLOCK_ARROW_START": 37, "BLOCK_ARROW_END": 38, "classDef": 39, "CLASSDEF_ID": 40, "CLASSDEF_STYLEOPTS": 41, "DEFAULT": 42, "class": 43, "CLASSENTITY_IDS": 44, "STYLECLASS": 45, "style": 46, "STYLE_ENTITY_IDS": 47, "STYLE_DEFINITION_DATA": 48, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 4: "SPACELINE", 5: "NL", 7: "SPACE", 8: "EOF", 10: "BLOCK_DIAGRAM_KEY", 15: "LINK", 16: "START_LINK", 17: "LINK_LABEL", 18: "STR", 21: "SPACE_BLOCK", 27: "SIZE", 28: "COLUMNS", 29: "id-block", 30: "end", 31: "NODE_ID", 34: "DIR", 35: "NODE_DSTART", 36: "NODE_DEND", 37: "BLOCK_ARROW_START", 38: "BLOCK_ARROW_END", 39: "classDef", 40: "CLASSDEF_ID", 41: "CLASSDEF_STYLEOPTS", 42: "DEFAULT", 43: "class", 44: "CLASSENTITY_IDS", 45: "STYLECLASS", 46: "style", 47: "STYLE_ENTITY_IDS", 48: "STYLE_DEFINITION_DATA" },
          productions_: [0, [3, 1], [3, 2], [3, 2], [6, 1], [6, 1], [6, 1], [9, 3], [12, 1], [12, 1], [12, 2], [12, 2], [11, 1], [11, 2], [14, 1], [14, 4], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [19, 3], [19, 2], [19, 1], [20, 1], [22, 4], [22, 3], [26, 1], [26, 2], [33, 1], [33, 2], [32, 3], [32, 4], [23, 3], [23, 3], [24, 3], [25, 3]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 4:
                yy.getLogger().debug("Rule: separator (NL) ");
                break;
              case 5:
                yy.getLogger().debug("Rule: separator (Space) ");
                break;
              case 6:
                yy.getLogger().debug("Rule: separator (EOF) ");
                break;
              case 7:
                yy.getLogger().debug("Rule: hierarchy: ", $$[$0 - 1]);
                yy.setHierarchy($$[$0 - 1]);
                break;
              case 8:
                yy.getLogger().debug("Stop NL ");
                break;
              case 9:
                yy.getLogger().debug("Stop EOF ");
                break;
              case 10:
                yy.getLogger().debug("Stop NL2 ");
                break;
              case 11:
                yy.getLogger().debug("Stop EOF2 ");
                break;
              case 12:
                yy.getLogger().debug("Rule: statement: ", $$[$0]);
                typeof $$[$0].length === "number" ? this.$ = $$[$0] : this.$ = [$$[$0]];
                break;
              case 13:
                yy.getLogger().debug("Rule: statement #2: ", $$[$0 - 1]);
                this.$ = [$$[$0 - 1]].concat($$[$0]);
                break;
              case 14:
                yy.getLogger().debug("Rule: link: ", $$[$0], yytext);
                this.$ = { edgeTypeStr: $$[$0], label: "" };
                break;
              case 15:
                yy.getLogger().debug("Rule: LABEL link: ", $$[$0 - 3], $$[$0 - 1], $$[$0]);
                this.$ = { edgeTypeStr: $$[$0], label: $$[$0 - 1] };
                break;
              case 18:
                const num = parseInt($$[$0]);
                const spaceId = yy.generateId();
                this.$ = { id: spaceId, type: "space", label: "", width: num, children: [] };
                break;
              case 23:
                yy.getLogger().debug("Rule: (nodeStatement link node) ", $$[$0 - 2], $$[$0 - 1], $$[$0], " typestr: ", $$[$0 - 1].edgeTypeStr);
                const edgeData2 = yy.edgeStrToEdgeData($$[$0 - 1].edgeTypeStr);
                this.$ = [
                  { id: $$[$0 - 2].id, label: $$[$0 - 2].label, type: $$[$0 - 2].type, directions: $$[$0 - 2].directions },
                  { id: $$[$0 - 2].id + "-" + $$[$0].id, start: $$[$0 - 2].id, end: $$[$0].id, label: $$[$0 - 1].label, type: "edge", directions: $$[$0].directions, arrowTypeEnd: edgeData2, arrowTypeStart: "arrow_open" },
                  { id: $$[$0].id, label: $$[$0].label, type: yy.typeStr2Type($$[$0].typeStr), directions: $$[$0].directions }
                ];
                break;
              case 24:
                yy.getLogger().debug("Rule: nodeStatement (abc88 node size) ", $$[$0 - 1], $$[$0]);
                this.$ = { id: $$[$0 - 1].id, label: $$[$0 - 1].label, type: yy.typeStr2Type($$[$0 - 1].typeStr), directions: $$[$0 - 1].directions, widthInColumns: parseInt($$[$0], 10) };
                break;
              case 25:
                yy.getLogger().debug("Rule: nodeStatement (node) ", $$[$0]);
                this.$ = { id: $$[$0].id, label: $$[$0].label, type: yy.typeStr2Type($$[$0].typeStr), directions: $$[$0].directions, widthInColumns: 1 };
                break;
              case 26:
                yy.getLogger().debug("APA123", this ? this : "na");
                yy.getLogger().debug("COLUMNS: ", $$[$0]);
                this.$ = { type: "column-setting", columns: $$[$0] === "auto" ? -1 : parseInt($$[$0]) };
                break;
              case 27:
                yy.getLogger().debug("Rule: id-block statement : ", $$[$0 - 2], $$[$0 - 1]);
                const id210 = yy.generateId();
                this.$ = { ...$$[$0 - 2], type: "composite", children: $$[$0 - 1] };
                break;
              case 28:
                yy.getLogger().debug("Rule: blockStatement : ", $$[$0 - 2], $$[$0 - 1], $$[$0]);
                const id34 = yy.generateId();
                this.$ = { id: id34, type: "composite", label: "", children: $$[$0 - 1] };
                break;
              case 29:
                yy.getLogger().debug("Rule: node (NODE_ID separator): ", $$[$0]);
                this.$ = { id: $$[$0] };
                break;
              case 30:
                yy.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", $$[$0 - 1], $$[$0]);
                this.$ = { id: $$[$0 - 1], label: $$[$0].label, typeStr: $$[$0].typeStr, directions: $$[$0].directions };
                break;
              case 31:
                yy.getLogger().debug("Rule: dirList: ", $$[$0]);
                this.$ = [$$[$0]];
                break;
              case 32:
                yy.getLogger().debug("Rule: dirList: ", $$[$0 - 1], $$[$0]);
                this.$ = [$$[$0 - 1]].concat($$[$0]);
                break;
              case 33:
                yy.getLogger().debug("Rule: nodeShapeNLabel: ", $$[$0 - 2], $$[$0 - 1], $$[$0]);
                this.$ = { typeStr: $$[$0 - 2] + $$[$0], label: $$[$0 - 1] };
                break;
              case 34:
                yy.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", $$[$0 - 3], $$[$0 - 2], " #3:", $$[$0 - 1], $$[$0]);
                this.$ = { typeStr: $$[$0 - 3] + $$[$0], label: $$[$0 - 2], directions: $$[$0 - 1] };
                break;
              case 35:
              case 36:
                this.$ = { type: "classDef", id: $$[$0 - 1].trim(), css: $$[$0].trim() };
                break;
              case 37:
                this.$ = { type: "applyClass", id: $$[$0 - 1].trim(), styleClass: $$[$0].trim() };
                break;
              case 38:
                this.$ = { type: "applyStyles", id: $$[$0 - 1].trim(), stylesStr: $$[$0].trim() };
                break;
            }
          }, "anonymous"),
          table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 10: $V0, 11: 3, 13: 4, 19: 5, 20: 6, 21: $V1, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: $V2, 29: $V3, 31: $V4, 39: $V5, 43: $V6, 46: $V7 }, { 8: [1, 20] }, o2($V8, [2, 12], { 13: 4, 19: 5, 20: 6, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 11: 21, 10: $V0, 21: $V1, 28: $V2, 29: $V3, 31: $V4, 39: $V5, 43: $V6, 46: $V7 }), o2($V9, [2, 16], { 14: 22, 15: $Va, 16: $Vb }), o2($V9, [2, 17]), o2($V9, [2, 18]), o2($V9, [2, 19]), o2($V9, [2, 20]), o2($V9, [2, 21]), o2($V9, [2, 22]), o2($Vc, [2, 25], { 27: [1, 25] }), o2($V9, [2, 26]), { 19: 26, 26: 12, 31: $V4 }, { 10: $V0, 11: 27, 13: 4, 19: 5, 20: 6, 21: $V1, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: $V2, 29: $V3, 31: $V4, 39: $V5, 43: $V6, 46: $V7 }, { 40: [1, 28], 42: [1, 29] }, { 44: [1, 30] }, { 47: [1, 31] }, o2($Vd, [2, 29], { 32: 32, 35: [1, 33], 37: [1, 34] }), { 1: [2, 7] }, o2($V8, [2, 13]), { 26: 35, 31: $V4 }, { 31: [2, 14] }, { 17: [1, 36] }, o2($Vc, [2, 24]), { 10: $V0, 11: 37, 13: 4, 14: 22, 15: $Va, 16: $Vb, 19: 5, 20: 6, 21: $V1, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: $V2, 29: $V3, 31: $V4, 39: $V5, 43: $V6, 46: $V7 }, { 30: [1, 38] }, { 41: [1, 39] }, { 41: [1, 40] }, { 45: [1, 41] }, { 48: [1, 42] }, o2($Vd, [2, 30]), { 18: [1, 43] }, { 18: [1, 44] }, o2($Vc, [2, 23]), { 18: [1, 45] }, { 30: [1, 46] }, o2($V9, [2, 28]), o2($V9, [2, 35]), o2($V9, [2, 36]), o2($V9, [2, 37]), o2($V9, [2, 38]), { 36: [1, 47] }, { 33: 48, 34: $Ve }, { 15: [1, 50] }, o2($V9, [2, 27]), o2($Vd, [2, 33]), { 38: [1, 51] }, { 33: 52, 34: $Ve, 38: [2, 31] }, { 31: [2, 15] }, o2($Vd, [2, 34]), { 38: [2, 32] }],
          defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: {},
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  yy.getLogger().debug("Found block-beta");
                  return 10;
                  break;
                case 1:
                  yy.getLogger().debug("Found id-block");
                  return 29;
                  break;
                case 2:
                  yy.getLogger().debug("Found block");
                  return 10;
                  break;
                case 3:
                  yy.getLogger().debug(".", yy_.yytext);
                  break;
                case 4:
                  yy.getLogger().debug("_", yy_.yytext);
                  break;
                case 5:
                  return 5;
                  break;
                case 6:
                  yy_.yytext = -1;
                  return 28;
                  break;
                case 7:
                  yy_.yytext = yy_.yytext.replace(/columns\s+/, "");
                  yy.getLogger().debug("COLUMNS (LEX)", yy_.yytext);
                  return 28;
                  break;
                case 8:
                  this.pushState("md_string");
                  break;
                case 9:
                  return "MD_STR";
                  break;
                case 10:
                  this.popState();
                  break;
                case 11:
                  this.pushState("string");
                  break;
                case 12:
                  yy.getLogger().debug("LEX: POPPING STR:", yy_.yytext);
                  this.popState();
                  break;
                case 13:
                  yy.getLogger().debug("LEX: STR end:", yy_.yytext);
                  return "STR";
                  break;
                case 14:
                  yy_.yytext = yy_.yytext.replace(/space\:/, "");
                  yy.getLogger().debug("SPACE NUM (LEX)", yy_.yytext);
                  return 21;
                  break;
                case 15:
                  yy_.yytext = "1";
                  yy.getLogger().debug("COLUMNS (LEX)", yy_.yytext);
                  return 21;
                  break;
                case 16:
                  return 42;
                  break;
                case 17:
                  return "LINKSTYLE";
                  break;
                case 18:
                  return "INTERPOLATE";
                  break;
                case 19:
                  this.pushState("CLASSDEF");
                  return 39;
                  break;
                case 20:
                  this.popState();
                  this.pushState("CLASSDEFID");
                  return "DEFAULT_CLASSDEF_ID";
                  break;
                case 21:
                  this.popState();
                  this.pushState("CLASSDEFID");
                  return 40;
                  break;
                case 22:
                  this.popState();
                  return 41;
                  break;
                case 23:
                  this.pushState("CLASS");
                  return 43;
                  break;
                case 24:
                  this.popState();
                  this.pushState("CLASS_STYLE");
                  return 44;
                  break;
                case 25:
                  this.popState();
                  return 45;
                  break;
                case 26:
                  this.pushState("STYLE_STMNT");
                  return 46;
                  break;
                case 27:
                  this.popState();
                  this.pushState("STYLE_DEFINITION");
                  return 47;
                  break;
                case 28:
                  this.popState();
                  return 48;
                  break;
                case 29:
                  this.pushState("acc_title");
                  return "acc_title";
                  break;
                case 30:
                  this.popState();
                  return "acc_title_value";
                  break;
                case 31:
                  this.pushState("acc_descr");
                  return "acc_descr";
                  break;
                case 32:
                  this.popState();
                  return "acc_descr_value";
                  break;
                case 33:
                  this.pushState("acc_descr_multiline");
                  break;
                case 34:
                  this.popState();
                  break;
                case 35:
                  return "acc_descr_multiline_value";
                  break;
                case 36:
                  return 30;
                  break;
                case 37:
                  this.popState();
                  yy.getLogger().debug("Lex: ((");
                  return "NODE_DEND";
                  break;
                case 38:
                  this.popState();
                  yy.getLogger().debug("Lex: ((");
                  return "NODE_DEND";
                  break;
                case 39:
                  this.popState();
                  yy.getLogger().debug("Lex: ))");
                  return "NODE_DEND";
                  break;
                case 40:
                  this.popState();
                  yy.getLogger().debug("Lex: ((");
                  return "NODE_DEND";
                  break;
                case 41:
                  this.popState();
                  yy.getLogger().debug("Lex: ((");
                  return "NODE_DEND";
                  break;
                case 42:
                  this.popState();
                  yy.getLogger().debug("Lex: (-");
                  return "NODE_DEND";
                  break;
                case 43:
                  this.popState();
                  yy.getLogger().debug("Lex: -)");
                  return "NODE_DEND";
                  break;
                case 44:
                  this.popState();
                  yy.getLogger().debug("Lex: ((");
                  return "NODE_DEND";
                  break;
                case 45:
                  this.popState();
                  yy.getLogger().debug("Lex: ]]");
                  return "NODE_DEND";
                  break;
                case 46:
                  this.popState();
                  yy.getLogger().debug("Lex: (");
                  return "NODE_DEND";
                  break;
                case 47:
                  this.popState();
                  yy.getLogger().debug("Lex: ])");
                  return "NODE_DEND";
                  break;
                case 48:
                  this.popState();
                  yy.getLogger().debug("Lex: /]");
                  return "NODE_DEND";
                  break;
                case 49:
                  this.popState();
                  yy.getLogger().debug("Lex: /]");
                  return "NODE_DEND";
                  break;
                case 50:
                  this.popState();
                  yy.getLogger().debug("Lex: )]");
                  return "NODE_DEND";
                  break;
                case 51:
                  this.popState();
                  yy.getLogger().debug("Lex: )");
                  return "NODE_DEND";
                  break;
                case 52:
                  this.popState();
                  yy.getLogger().debug("Lex: ]>");
                  return "NODE_DEND";
                  break;
                case 53:
                  this.popState();
                  yy.getLogger().debug("Lex: ]");
                  return "NODE_DEND";
                  break;
                case 54:
                  yy.getLogger().debug("Lexa: -)");
                  this.pushState("NODE");
                  return 35;
                  break;
                case 55:
                  yy.getLogger().debug("Lexa: (-");
                  this.pushState("NODE");
                  return 35;
                  break;
                case 56:
                  yy.getLogger().debug("Lexa: ))");
                  this.pushState("NODE");
                  return 35;
                  break;
                case 57:
                  yy.getLogger().debug("Lexa: )");
                  this.pushState("NODE");
                  return 35;
                  break;
                case 58:
                  yy.getLogger().debug("Lex: (((");
                  this.pushState("NODE");
                  return 35;
                  break;
                case 59:
                  yy.getLogger().debug("Lexa: )");
                  this.pushState("NODE");
                  return 35;
                  break;
                case 60:
                  yy.getLogger().debug("Lexa: )");
                  this.pushState("NODE");
                  return 35;
                  break;
                case 61:
                  yy.getLogger().debug("Lexa: )");
                  this.pushState("NODE");
                  return 35;
                  break;
                case 62:
                  yy.getLogger().debug("Lexc: >");
                  this.pushState("NODE");
                  return 35;
                  break;
                case 63:
                  yy.getLogger().debug("Lexa: ([");
                  this.pushState("NODE");
                  return 35;
                  break;
                case 64:
                  yy.getLogger().debug("Lexa: )");
                  this.pushState("NODE");
                  return 35;
                  break;
                case 65:
                  this.pushState("NODE");
                  return 35;
                  break;
                case 66:
                  this.pushState("NODE");
                  return 35;
                  break;
                case 67:
                  this.pushState("NODE");
                  return 35;
                  break;
                case 68:
                  this.pushState("NODE");
                  return 35;
                  break;
                case 69:
                  this.pushState("NODE");
                  return 35;
                  break;
                case 70:
                  this.pushState("NODE");
                  return 35;
                  break;
                case 71:
                  this.pushState("NODE");
                  return 35;
                  break;
                case 72:
                  yy.getLogger().debug("Lexa: [");
                  this.pushState("NODE");
                  return 35;
                  break;
                case 73:
                  this.pushState("BLOCK_ARROW");
                  yy.getLogger().debug("LEX ARR START");
                  return 37;
                  break;
                case 74:
                  yy.getLogger().debug("Lex: NODE_ID", yy_.yytext);
                  return 31;
                  break;
                case 75:
                  yy.getLogger().debug("Lex: EOF", yy_.yytext);
                  return 8;
                  break;
                case 76:
                  this.pushState("md_string");
                  break;
                case 77:
                  this.pushState("md_string");
                  break;
                case 78:
                  return "NODE_DESCR";
                  break;
                case 79:
                  this.popState();
                  break;
                case 80:
                  yy.getLogger().debug("Lex: Starting string");
                  this.pushState("string");
                  break;
                case 81:
                  yy.getLogger().debug("LEX ARR: Starting string");
                  this.pushState("string");
                  break;
                case 82:
                  yy.getLogger().debug("LEX: NODE_DESCR:", yy_.yytext);
                  return "NODE_DESCR";
                  break;
                case 83:
                  yy.getLogger().debug("LEX POPPING");
                  this.popState();
                  break;
                case 84:
                  yy.getLogger().debug("Lex: =>BAE");
                  this.pushState("ARROW_DIR");
                  break;
                case 85:
                  yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
                  yy.getLogger().debug("Lex (right): dir:", yy_.yytext);
                  return "DIR";
                  break;
                case 86:
                  yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
                  yy.getLogger().debug("Lex (left):", yy_.yytext);
                  return "DIR";
                  break;
                case 87:
                  yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
                  yy.getLogger().debug("Lex (x):", yy_.yytext);
                  return "DIR";
                  break;
                case 88:
                  yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
                  yy.getLogger().debug("Lex (y):", yy_.yytext);
                  return "DIR";
                  break;
                case 89:
                  yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
                  yy.getLogger().debug("Lex (up):", yy_.yytext);
                  return "DIR";
                  break;
                case 90:
                  yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
                  yy.getLogger().debug("Lex (down):", yy_.yytext);
                  return "DIR";
                  break;
                case 91:
                  yy_.yytext = "]>";
                  yy.getLogger().debug("Lex (ARROW_DIR end):", yy_.yytext);
                  this.popState();
                  this.popState();
                  return "BLOCK_ARROW_END";
                  break;
                case 92:
                  yy.getLogger().debug("Lex: LINK", "#" + yy_.yytext + "#");
                  return 15;
                  break;
                case 93:
                  yy.getLogger().debug("Lex: LINK", yy_.yytext);
                  return 15;
                  break;
                case 94:
                  yy.getLogger().debug("Lex: LINK", yy_.yytext);
                  return 15;
                  break;
                case 95:
                  yy.getLogger().debug("Lex: LINK", yy_.yytext);
                  return 15;
                  break;
                case 96:
                  yy.getLogger().debug("Lex: START_LINK", yy_.yytext);
                  this.pushState("LLABEL");
                  return 16;
                  break;
                case 97:
                  yy.getLogger().debug("Lex: START_LINK", yy_.yytext);
                  this.pushState("LLABEL");
                  return 16;
                  break;
                case 98:
                  yy.getLogger().debug("Lex: START_LINK", yy_.yytext);
                  this.pushState("LLABEL");
                  return 16;
                  break;
                case 99:
                  this.pushState("md_string");
                  break;
                case 100:
                  yy.getLogger().debug("Lex: Starting string");
                  this.pushState("string");
                  return "LINK_LABEL";
                  break;
                case 101:
                  this.popState();
                  yy.getLogger().debug("Lex: LINK", "#" + yy_.yytext + "#");
                  return 15;
                  break;
                case 102:
                  this.popState();
                  yy.getLogger().debug("Lex: LINK", yy_.yytext);
                  return 15;
                  break;
                case 103:
                  this.popState();
                  yy.getLogger().debug("Lex: LINK", yy_.yytext);
                  return 15;
                  break;
                case 104:
                  yy.getLogger().debug("Lex: COLON", yy_.yytext);
                  yy_.yytext = yy_.yytext.slice(1);
                  return 27;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:block-beta\b)/, /^(?:block:)/, /^(?:block\b)/, /^(?:[\s]+)/, /^(?:[\n]+)/, /^(?:((\u000D\u000A)|(\u000A)))/, /^(?:columns\s+auto\b)/, /^(?:columns\s+[\d]+)/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:space[:]\d+)/, /^(?:space\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\s+)/, /^(?:DEFAULT\s+)/, /^(?:\w+\s+)/, /^(?:[^\n]*)/, /^(?:class\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:style\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:end\b\s*)/, /^(?:\(\(\()/, /^(?:\)\)\))/, /^(?:[\)]\))/, /^(?:\}\})/, /^(?:\})/, /^(?:\(-)/, /^(?:-\))/, /^(?:\(\()/, /^(?:\]\])/, /^(?:\()/, /^(?:\]\))/, /^(?:\\\])/, /^(?:\/\])/, /^(?:\)\])/, /^(?:[\)])/, /^(?:\]>)/, /^(?:[\]])/, /^(?:-\))/, /^(?:\(-)/, /^(?:\)\))/, /^(?:\))/, /^(?:\(\(\()/, /^(?:\(\()/, /^(?:\{\{)/, /^(?:\{)/, /^(?:>)/, /^(?:\(\[)/, /^(?:\()/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\[\\)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:\[)/, /^(?:<\[)/, /^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/, /^(?:$)/, /^(?:["][`])/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:\]>\s*\()/, /^(?:,?\s*right\s*)/, /^(?:,?\s*left\s*)/, /^(?:,?\s*x\s*)/, /^(?:,?\s*y\s*)/, /^(?:,?\s*up\s*)/, /^(?:,?\s*down\s*)/, /^(?:\)\s*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*~~[\~]+\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:["][`])/, /^(?:["])/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?::\d+)/],
            conditions: { "STYLE_DEFINITION": { "rules": [28], "inclusive": false }, "STYLE_STMNT": { "rules": [27], "inclusive": false }, "CLASSDEFID": { "rules": [22], "inclusive": false }, "CLASSDEF": { "rules": [20, 21], "inclusive": false }, "CLASS_STYLE": { "rules": [25], "inclusive": false }, "CLASS": { "rules": [24], "inclusive": false }, "LLABEL": { "rules": [99, 100, 101, 102, 103], "inclusive": false }, "ARROW_DIR": { "rules": [85, 86, 87, 88, 89, 90, 91], "inclusive": false }, "BLOCK_ARROW": { "rules": [76, 81, 84], "inclusive": false }, "NODE": { "rules": [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 77, 80], "inclusive": false }, "md_string": { "rules": [9, 10, 78, 79], "inclusive": false }, "space": { "rules": [], "inclusive": false }, "string": { "rules": [12, 13, 82, 83], "inclusive": false }, "acc_descr_multiline": { "rules": [34, 35], "inclusive": false }, "acc_descr": { "rules": [32], "inclusive": false }, "acc_title": { "rules": [30], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 14, 15, 16, 17, 18, 19, 23, 26, 29, 31, 33, 36, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 92, 93, 94, 95, 96, 97, 98, 104], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser21.parser = parser21;
      block_default = parser21;
    }
  });

  // src/diagrams/block/blockDB.ts
  function typeStr2Type(typeStr) {
    log.debug("typeStr2Type", typeStr);
    switch (typeStr) {
      case "[]":
        return "square";
      case "()":
        log.debug("we have a round");
        return "round";
      case "(())":
        return "circle";
      case ">]":
        return "rect_left_inv_arrow";
      case "{}":
        return "diamond";
      case "{{}}":
        return "hexagon";
      case "([])":
        return "stadium";
      case "[[]]":
        return "subroutine";
      case "[()]":
        return "cylinder";
      case "((()))":
        return "doublecircle";
      case "[//]":
        return "lean_right";
      case "[\\\\]":
        return "lean_left";
      case "[/\\]":
        return "trapezoid";
      case "[\\/]":
        return "inv_trapezoid";
      case "<[]>":
        return "block_arrow";
      default:
        return "na";
    }
  }
  function edgeTypeStr2Type(typeStr) {
    log.debug("typeStr2Type", typeStr);
    switch (typeStr) {
      case "==":
        return "thick";
      default:
        return "normal";
    }
  }
  function edgeStrToEdgeData(typeStr) {
    switch (typeStr.replace(/^[\s-]+|[\s-]+$/g, "")) {
      case "x":
        return "arrow_cross";
      case "o":
        return "arrow_circle";
      case ">":
        return "arrow_point";
      default:
        return "";
    }
  }
  var blockDatabase, edgeList, edgeCount2, COLOR_KEYWORD, FILL_KEYWORD, BG_FILL, STYLECLASS_SEP, config4, classes2, diagramId2, sanitizeText5, addStyleClass, addStyle2Node, setCssClass, populateBlockDatabase, blocks, rootBlock, clear18, cnt3, generateId2, setHierarchy, getColumns, getBlocksFlat, getBlocks, getEdges, getBlock, setBlock, setDiagramId2, getDiagramId, getLogger2, getClasses4, db6, blockDB_default;
  var init_blockDB = __esm({
    "src/diagrams/block/blockDB.ts"() {
      "use strict";
      init_clone2();
      init_config();
      init_diagramAPI();
      init_logger();
      init_common();
      init_commonDb();
      blockDatabase = /* @__PURE__ */ new Map();
      edgeList = [];
      edgeCount2 = /* @__PURE__ */ new Map();
      COLOR_KEYWORD = "color";
      FILL_KEYWORD = "fill";
      BG_FILL = "bgFill";
      STYLECLASS_SEP = ",";
      config4 = getConfig2();
      classes2 = /* @__PURE__ */ new Map();
      diagramId2 = "";
      sanitizeText5 = /* @__PURE__ */ __name((txt) => common_default.sanitizeText(txt, config4), "sanitizeText");
      addStyleClass = /* @__PURE__ */ __name(function(id34, styleAttributes = "") {
        let foundClass = classes2.get(id34);
        if (!foundClass) {
          foundClass = { id: id34, styles: [], textStyles: [] };
          classes2.set(id34, foundClass);
        }
        if (styleAttributes !== void 0 && styleAttributes !== null) {
          styleAttributes.split(STYLECLASS_SEP).forEach((attrib) => {
            const fixedAttrib = attrib.replace(/([^;]*);/, "$1").trim();
            if (RegExp(COLOR_KEYWORD).exec(attrib)) {
              const newStyle1 = fixedAttrib.replace(FILL_KEYWORD, BG_FILL);
              const newStyle2 = newStyle1.replace(COLOR_KEYWORD, FILL_KEYWORD);
              foundClass.textStyles.push(newStyle2);
            }
            foundClass.styles.push(fixedAttrib);
          });
        }
      }, "addStyleClass");
      addStyle2Node = /* @__PURE__ */ __name(function(id34, styles5 = "") {
        const foundBlock = blockDatabase.get(id34);
        if (styles5 !== void 0 && styles5 !== null) {
          foundBlock.styles = styles5.split(STYLECLASS_SEP);
        }
      }, "addStyle2Node");
      setCssClass = /* @__PURE__ */ __name(function(itemIds, cssClassName) {
        itemIds.split(",").forEach(function(id34) {
          let foundBlock = blockDatabase.get(id34);
          if (foundBlock === void 0) {
            const trimmedId = id34.trim();
            foundBlock = { id: trimmedId, type: "na", children: [] };
            blockDatabase.set(trimmedId, foundBlock);
          }
          if (!foundBlock.classes) {
            foundBlock.classes = [];
          }
          foundBlock.classes.push(cssClassName);
        });
      }, "setCssClass");
      populateBlockDatabase = /* @__PURE__ */ __name((_blockList, parent4) => {
        const blockList = _blockList.flat();
        const children2 = [];
        const columnSettingBlock = blockList.find((b3) => b3?.type === "column-setting");
        const column2 = columnSettingBlock?.columns ?? -1;
        for (const block2 of blockList) {
          if (typeof column2 === "number" && column2 > 0 && block2.type !== "column-setting" && typeof block2.widthInColumns === "number" && block2.widthInColumns > column2) {
            log.warn(
              `Block ${block2.id} width ${block2.widthInColumns} exceeds configured column width ${column2}`
            );
          }
          if (block2.label) {
            block2.label = sanitizeText5(block2.label);
          }
          if (block2.type === "classDef") {
            addStyleClass(block2.id, block2.css);
            continue;
          }
          if (block2.type === "applyClass") {
            setCssClass(block2.id, block2?.styleClass ?? "");
            continue;
          }
          if (block2.type === "applyStyles") {
            if (block2?.stylesStr) {
              addStyle2Node(block2.id, block2?.stylesStr);
            }
            continue;
          }
          if (block2.type === "column-setting") {
            parent4.columns = block2.columns ?? -1;
          } else if (block2.type === "edge") {
            const count2 = (edgeCount2.get(block2.id) ?? 0) + 1;
            edgeCount2.set(block2.id, count2);
            block2.id = count2 + "-" + block2.id;
            edgeList.push(block2);
          } else {
            if (!block2.label) {
              if (block2.type === "composite") {
                block2.label = "";
              } else {
                block2.label = block2.id;
              }
            }
            const existingBlock = blockDatabase.get(block2.id);
            if (existingBlock === void 0) {
              blockDatabase.set(block2.id, block2);
            } else {
              if (block2.type !== "na") {
                existingBlock.type = block2.type;
              }
              if (block2.label !== block2.id) {
                existingBlock.label = block2.label;
              }
            }
            if (block2.children) {
              populateBlockDatabase(block2.children, block2);
            }
            if (block2.type === "space") {
              const w4 = block2.width ?? 1;
              for (let j3 = 0; j3 < w4; j3++) {
                const newBlock = clone_default2(block2);
                newBlock.id = newBlock.id + "-" + j3;
                blockDatabase.set(newBlock.id, newBlock);
                children2.push(newBlock);
              }
            } else if (existingBlock === void 0) {
              children2.push(block2);
            }
          }
        }
        parent4.children = children2;
      }, "populateBlockDatabase");
      blocks = [];
      rootBlock = { id: "root", type: "composite", children: [], columns: -1 };
      clear18 = /* @__PURE__ */ __name(() => {
        log.debug("Clear called");
        clear();
        rootBlock = { id: "root", type: "composite", children: [], columns: -1 };
        blockDatabase = /* @__PURE__ */ new Map([["root", rootBlock]]);
        blocks = [];
        classes2 = /* @__PURE__ */ new Map();
        edgeList = [];
        edgeCount2 = /* @__PURE__ */ new Map();
        diagramId2 = "";
      }, "clear");
      __name(typeStr2Type, "typeStr2Type");
      __name(edgeTypeStr2Type, "edgeTypeStr2Type");
      __name(edgeStrToEdgeData, "edgeStrToEdgeData");
      cnt3 = 0;
      generateId2 = /* @__PURE__ */ __name(() => {
        cnt3++;
        return "id-" + Math.random().toString(36).substr(2, 12) + "-" + cnt3;
      }, "generateId");
      setHierarchy = /* @__PURE__ */ __name((block2) => {
        rootBlock.children = block2;
        populateBlockDatabase(block2, rootBlock);
        blocks = rootBlock.children;
      }, "setHierarchy");
      getColumns = /* @__PURE__ */ __name((blockId) => {
        const block2 = blockDatabase.get(blockId);
        if (!block2) {
          return -1;
        }
        if (block2.columns) {
          return block2.columns;
        }
        if (!block2.children) {
          return -1;
        }
        return block2.children.length;
      }, "getColumns");
      getBlocksFlat = /* @__PURE__ */ __name(() => {
        return [...blockDatabase.values()];
      }, "getBlocksFlat");
      getBlocks = /* @__PURE__ */ __name(() => {
        return blocks || [];
      }, "getBlocks");
      getEdges = /* @__PURE__ */ __name(() => {
        return edgeList;
      }, "getEdges");
      getBlock = /* @__PURE__ */ __name((id34) => {
        return blockDatabase.get(id34);
      }, "getBlock");
      setBlock = /* @__PURE__ */ __name((block2) => {
        blockDatabase.set(block2.id, block2);
      }, "setBlock");
      setDiagramId2 = /* @__PURE__ */ __name((id34) => {
        diagramId2 = id34;
      }, "setDiagramId");
      getDiagramId = /* @__PURE__ */ __name(() => diagramId2, "getDiagramId");
      getLogger2 = /* @__PURE__ */ __name(() => log, "getLogger");
      getClasses4 = /* @__PURE__ */ __name(function() {
        return classes2;
      }, "getClasses");
      db6 = {
        getConfig: /* @__PURE__ */ __name(() => getConfig().block, "getConfig"),
        typeStr2Type,
        edgeTypeStr2Type,
        edgeStrToEdgeData,
        getLogger: getLogger2,
        getBlocksFlat,
        getBlocks,
        getEdges,
        setHierarchy,
        getBlock,
        setBlock,
        getColumns,
        getClasses: getClasses4,
        clear: clear18,
        generateId: generateId2,
        setDiagramId: setDiagramId2,
        getDiagramId
      };
      blockDB_default = db6;
    }
  });

  // src/diagrams/block/styles.ts
  var fade3, getStyles17, styles_default16;
  var init_styles18 = __esm({
    "src/diagrams/block/styles.ts"() {
      "use strict";
      init_dist();
      init_globalStyles();
      fade3 = /* @__PURE__ */ __name((color2, opacity) => {
        const channel2 = channel_default2;
        const r2 = channel2(color2, "r");
        const g2 = channel2(color2, "g");
        const b3 = channel2(color2, "b");
        return rgba_default(r2, g2, b3, opacity);
      }, "fade");
      getStyles17 = /* @__PURE__ */ __name((options2) => `.label {
    font-family: ${options2.fontFamily};
    color: ${options2.nodeTextColor || options2.textColor};
  }
  .cluster-label text {
    fill: ${options2.titleColor};
  }
  .cluster-label span,p {
    color: ${options2.titleColor};
  }



  .label text,span,p {
    fill: ${options2.nodeTextColor || options2.textColor};
    color: ${options2.nodeTextColor || options2.textColor};
  }

  .node rect,
  .node circle,
  .node ellipse,
  .node polygon,
  .node path {
    fill: ${options2.mainBkg};
    stroke: ${options2.nodeBorder};
    stroke-width: 1px;
  }
  .flowchart-label text {
    text-anchor: middle;
  }
  // .flowchart-label .text-outer-tspan {
  //   text-anchor: middle;
  // }
  // .flowchart-label .text-inner-tspan {
  //   text-anchor: start;
  // }

  .node .label {
    text-align: center;
  }
  .node.clickable {
    cursor: pointer;
  }

  .arrowheadPath {
    fill: ${options2.arrowheadColor};
  }

  .edgePath .path {
    stroke: ${options2.lineColor};
    stroke-width: 2.0px;
  }

  .flowchart-link {
    stroke: ${options2.lineColor};
    fill: none;
  }

  .edgeLabel {
    background-color: ${options2.edgeLabelBackground};
    /*
     * This is for backward compatibility with existing code that didn't
     * add a \`<p>\` around edge labels.
     *
     * TODO: We should probably remove this in a future release.
     */
    p {
      margin: 0;
      padding: 0;
      display: inline;
    }
    rect {
      opacity: 0.5;
      background-color: ${options2.edgeLabelBackground};
      fill: ${options2.edgeLabelBackground};
    }
    text-align: center;
  }

  /* For html labels only */
  .labelBkg {
    background-color: ${options2.edgeLabelBackground};
  }

  .node .cluster {
    // fill: ${fade3(options2.mainBkg, 0.5)};
    fill: ${fade3(options2.clusterBkg, 0.5)};
    stroke: ${fade3(options2.clusterBorder, 0.2)};
    box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
    stroke-width: 1px;
  }

  .cluster text {
    fill: ${options2.titleColor};
  }

  .cluster span,p {
    color: ${options2.titleColor};
  }
  /* .cluster div {
    color: ${options2.titleColor};
  } */

  div.mermaidTooltip {
    position: absolute;
    text-align: center;
    max-width: 200px;
    padding: 2px;
    font-family: ${options2.fontFamily};
    font-size: 12px;
    background: ${options2.tertiaryColor};
    border: 1px solid ${options2.border2};
    border-radius: 2px;
    pointer-events: none;
    z-index: 100;
  }

  .flowchartTitleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${options2.textColor};
  }
  ${getIconStyles()}
`, "getStyles");
      styles_default16 = getStyles17;
    }
  });

  // src/dagre-wrapper/markers.js
  var insertMarkers3, extension4, composition2, aggregation2, dependency2, lollipop2, point7, circle4, cross2, barb2, markers2, markers_default2;
  var init_markers2 = __esm({
    "src/dagre-wrapper/markers.js"() {
      "use strict";
      init_logger();
      insertMarkers3 = /* @__PURE__ */ __name((elem, markerArray, type3, id34) => {
        markerArray.forEach((markerName) => {
          markers2[markerName](elem, type3, id34);
        });
      }, "insertMarkers");
      extension4 = /* @__PURE__ */ __name((elem, type3, id34) => {
        log.trace("Making markers for ", id34);
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-extensionStart").attr("class", "marker extension " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-extensionEnd").attr("class", "marker extension " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
      }, "extension");
      composition2 = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-compositionStart").attr("class", "marker composition " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-compositionEnd").attr("class", "marker composition " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
      }, "composition");
      aggregation2 = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-aggregationStart").attr("class", "marker aggregation " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-aggregationEnd").attr("class", "marker aggregation " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
      }, "aggregation");
      dependency2 = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-dependencyStart").attr("class", "marker dependency " + type3).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-dependencyEnd").attr("class", "marker dependency " + type3).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
      }, "dependency");
      lollipop2 = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-lollipopStart").attr("class", "marker lollipop " + type3).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-lollipopEnd").attr("class", "marker lollipop " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
      }, "lollipop");
      point7 = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("marker").attr("id", id34 + "_" + type3 + "-pointEnd").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", 6).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
        elem.append("marker").attr("id", id34 + "_" + type3 + "-pointStart").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
      }, "point");
      circle4 = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("marker").attr("id", id34 + "_" + type3 + "-circleEnd").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
        elem.append("marker").attr("id", id34 + "_" + type3 + "-circleStart").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
      }, "circle");
      cross2 = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("marker").attr("id", id34 + "_" + type3 + "-crossEnd").attr("class", "marker cross " + type3).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
        elem.append("marker").attr("id", id34 + "_" + type3 + "-crossStart").attr("class", "marker cross " + type3).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
      }, "cross");
      barb2 = /* @__PURE__ */ __name((elem, type3, id34) => {
        elem.append("defs").append("marker").attr("id", id34 + "_" + type3 + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
      }, "barb");
      markers2 = {
        extension: extension4,
        composition: composition2,
        aggregation: aggregation2,
        dependency: dependency2,
        lollipop: lollipop2,
        point: point7,
        circle: circle4,
        cross: cross2,
        barb: barb2
      };
      markers_default2 = insertMarkers3;
    }
  });

  // src/diagrams/block/layout.ts
  function calculateBlockPosition(columns, position5) {
    if (columns === 0 || !Number.isInteger(columns)) {
      throw new Error("Columns must be an integer !== 0.");
    }
    if (position5 < 0 || !Number.isInteger(position5)) {
      throw new Error("Position must be a non-negative integer." + position5);
    }
    if (columns < 0) {
      return { px: position5, py: 0 };
    }
    if (columns === 1) {
      return { px: 0, py: position5 };
    }
    const px = position5 % columns;
    const py = Math.floor(position5 / columns);
    return { px, py };
  }
  function setBlockSizes(block2, db9, siblingWidth = 0, siblingHeight = 0) {
    log.debug(
      "setBlockSizes abc95 (start)",
      block2.id,
      block2?.size?.x,
      "block width =",
      block2?.size,
      "siblingWidth",
      siblingWidth
    );
    if (!block2?.size?.width) {
      block2.size = {
        width: siblingWidth,
        height: siblingHeight,
        x: 0,
        y: 0
      };
    }
    let maxWidth2 = 0;
    let maxHeight = 0;
    if (block2.children?.length > 0) {
      for (const child of block2.children) {
        setBlockSizes(child, db9);
      }
      const childSize = getMaxChildSize(block2);
      maxWidth2 = childSize.width;
      maxHeight = childSize.height;
      log.debug("setBlockSizes abc95 maxWidth of", block2.id, ":s children is ", maxWidth2, maxHeight);
      for (const child of block2.children) {
        if (child.size) {
          log.debug(
            `abc95 Setting size of children of ${block2.id} id=${child.id} ${maxWidth2} ${maxHeight} ${JSON.stringify(child.size)}`
          );
          child.size.width = maxWidth2 * (child.widthInColumns ?? 1) + padding * ((child.widthInColumns ?? 1) - 1);
          child.size.height = maxHeight;
          child.size.x = 0;
          child.size.y = 0;
          log.debug(
            `abc95 updating size of ${block2.id} children child:${child.id} maxWidth:${maxWidth2} maxHeight:${maxHeight}`
          );
        }
      }
      for (const child of block2.children) {
        setBlockSizes(child, db9, maxWidth2, maxHeight);
      }
      const columns = block2.columns ?? -1;
      let numItems = 0;
      for (const child of block2.children) {
        numItems += child.widthInColumns ?? 1;
      }
      let xSize = block2.children.length;
      if (columns > 0 && columns < numItems) {
        xSize = columns;
      }
      const ySize = Math.ceil(numItems / xSize);
      let width3 = xSize * (maxWidth2 + padding) + padding;
      let height2 = ySize * (maxHeight + padding) + padding;
      if (width3 < siblingWidth) {
        log.debug(
          `Detected to small sibling: abc95 ${block2.id} siblingWidth ${siblingWidth} siblingHeight ${siblingHeight} width ${width3}`
        );
        width3 = siblingWidth;
        height2 = siblingHeight;
        const childWidth = (siblingWidth - xSize * padding - padding) / xSize;
        const childHeight = (siblingHeight - ySize * padding - padding) / ySize;
        log.debug("Size indata abc88", block2.id, "childWidth", childWidth, "maxWidth", maxWidth2);
        log.debug("Size indata abc88", block2.id, "childHeight", childHeight, "maxHeight", maxHeight);
        log.debug("Size indata abc88 xSize", xSize, "padding", padding);
        for (const child of block2.children) {
          if (child.size) {
            child.size.width = childWidth;
            child.size.height = childHeight;
            child.size.x = 0;
            child.size.y = 0;
          }
        }
      }
      log.debug(
        `abc95 (finale calc) ${block2.id} xSize ${xSize} ySize ${ySize} columns ${columns}${block2.children.length} width=${Math.max(width3, block2.size?.width || 0)}`
      );
      if (width3 < (block2?.size?.width || 0)) {
        width3 = block2?.size?.width || 0;
        const num = columns > 0 ? Math.min(block2.children.length, columns) : block2.children.length;
        if (num > 0) {
          const childWidth = (width3 - num * padding - padding) / num;
          log.debug("abc95 (growing to fit) width", block2.id, width3, block2.size?.width, childWidth);
          for (const child of block2.children) {
            if (child.size) {
              child.size.width = childWidth;
            }
          }
        }
      }
      block2.size = {
        width: width3,
        height: height2,
        x: 0,
        y: 0
      };
    }
    log.debug(
      "setBlockSizes abc94 (done)",
      block2.id,
      block2?.size?.x,
      block2?.size?.width,
      block2?.size?.y,
      block2?.size?.height
    );
  }
  function layoutBlocks(block2, db9) {
    log.debug(
      `abc85 layout blocks (=>layoutBlocks) ${block2.id} x: ${block2?.size?.x} y: ${block2?.size?.y} width: ${block2?.size?.width}`
    );
    const columns = block2.columns ?? -1;
    log.debug("layoutBlocks columns abc95", block2.id, "=>", columns, block2);
    if (block2.children && // find max width of children
    block2.children.length > 0) {
      const width3 = block2?.children[0]?.size?.width ?? 0;
      const widthOfChildren = block2.children.length * width3 + (block2.children.length - 1) * padding;
      log.debug("widthOfChildren 88", widthOfChildren, "posX");
      const rowHeights = /* @__PURE__ */ new Map();
      {
        let colPos = 0;
        for (const child of block2.children) {
          if (!child.size) {
            continue;
          }
          const { py } = calculateBlockPosition(columns, colPos);
          const currentMax = rowHeights.get(py) ?? 0;
          if (child.size.height > currentMax) {
            rowHeights.set(py, child.size.height);
          }
          let filled = child?.widthInColumns ?? 1;
          if (columns > 0) {
            filled = Math.min(filled, columns - colPos % columns);
          }
          colPos += filled;
        }
      }
      const rowYOffsets = /* @__PURE__ */ new Map();
      {
        let offset = 0;
        const rows = [...rowHeights.keys()].sort((a2, b3) => a2 - b3);
        for (const row of rows) {
          rowYOffsets.set(row, offset);
          offset += (rowHeights.get(row) ?? 0) + padding;
        }
      }
      let columnPos = 0;
      log.debug("abc91 block?.size?.x", block2.id, block2?.size?.x);
      let startingPosX = block2?.size?.x ? block2?.size?.x + (-block2?.size?.width / 2 || 0) : -padding;
      let rowPos = 0;
      for (const child of block2.children) {
        const parent4 = block2;
        if (!child.size) {
          continue;
        }
        const { width: width4, height: height2 } = child.size;
        const { px, py } = calculateBlockPosition(columns, columnPos);
        if (py != rowPos) {
          rowPos = py;
          startingPosX = block2?.size?.x ? block2?.size?.x + (-block2?.size?.width / 2 || 0) : -padding;
          log.debug("New row in layout for block", block2.id, " and child ", child.id, rowPos);
        }
        log.debug(
          `abc89 layout blocks (child) id: ${child.id} Pos: ${columnPos} (px, py) ${px},${py} (${parent4?.size?.x},${parent4?.size?.y}) parent: ${parent4.id} width: ${width4}${padding}`
        );
        if (parent4.size) {
          const halfWidth = width4 / 2;
          child.size.x = startingPosX + padding + halfWidth;
          log.debug(
            `abc91 layout blocks (calc) px, pyid:${child.id} startingPos=X${startingPosX} new startingPosX${child.size.x} ${halfWidth} padding=${padding} width=${width4} halfWidth=${halfWidth} => x:${child.size.x} y:${child.size.y} ${child.widthInColumns} (width * (child?.w || 1)) / 2 ${width4 * (child?.widthInColumns ?? 1) / 2}`
          );
          startingPosX = child.size.x + halfWidth;
          const rowYOffset = rowYOffsets.get(py) ?? 0;
          const rowHeight = rowHeights.get(py) ?? height2;
          child.size.y = parent4.size.y - parent4.size.height / 2 + rowYOffset + rowHeight / 2 + padding;
          log.debug(
            `abc88 layout blocks (calc) px, pyid:${child.id}startingPosX${startingPosX}${padding}${halfWidth}=>x:${child.size.x}y:${child.size.y}${child.widthInColumns}(width * (child?.w || 1)) / 2${width4 * (child?.widthInColumns ?? 1) / 2}`
          );
        }
        if (child.children) {
          layoutBlocks(child, db9);
        }
        let columnsFilled = child?.widthInColumns ?? 1;
        if (columns > 0) {
          columnsFilled = Math.min(columnsFilled, columns - columnPos % columns);
        }
        columnPos += columnsFilled;
        log.debug("abc88 columnsPos", child, columnPos);
      }
    }
    log.debug(
      `layout blocks (<==layoutBlocks) ${block2.id} x: ${block2?.size?.x} y: ${block2?.size?.y} width: ${block2?.size?.width}`
    );
  }
  function findBounds(block2, { minX, minY, maxX, maxY } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) {
    if (block2.size && block2.id !== "root") {
      const { x: x5, y: y6, width: width3, height: height2 } = block2.size;
      if (x5 - width3 / 2 < minX) {
        minX = x5 - width3 / 2;
      }
      if (y6 - height2 / 2 < minY) {
        minY = y6 - height2 / 2;
      }
      if (x5 + width3 / 2 > maxX) {
        maxX = x5 + width3 / 2;
      }
      if (y6 + height2 / 2 > maxY) {
        maxY = y6 + height2 / 2;
      }
    }
    if (block2.children) {
      for (const child of block2.children) {
        ({ minX, minY, maxX, maxY } = findBounds(child, { minX, minY, maxX, maxY }));
      }
    }
    return { minX, minY, maxX, maxY };
  }
  function layout5(db9) {
    const root3 = db9.getBlock("root");
    if (!root3) {
      return;
    }
    setBlockSizes(root3, db9, 0, 0);
    layoutBlocks(root3, db9);
    log.debug("getBlocks", JSON.stringify(root3, null, 2));
    const { minX, minY, maxX, maxY } = findBounds(root3);
    const height2 = maxY - minY;
    const width3 = maxX - minX;
    return { x: minX, y: minY, width: width3, height: height2 };
  }
  var padding, getMaxChildSize;
  var init_layout3 = __esm({
    "src/diagrams/block/layout.ts"() {
      "use strict";
      init_logger();
      init_diagramAPI();
      padding = getConfig2()?.block?.padding ?? 8;
      __name(calculateBlockPosition, "calculateBlockPosition");
      getMaxChildSize = /* @__PURE__ */ __name((block2) => {
        let maxWidth2 = 0;
        let maxHeight = 0;
        for (const child of block2.children) {
          const { width: width3, height: height2, x: x5, y: y6 } = child.size ?? { width: 0, height: 0, x: 0, y: 0 };
          log.debug(
            "getMaxChildSize abc95 child:",
            child.id,
            "width:",
            width3,
            "height:",
            height2,
            "x:",
            x5,
            "y:",
            y6,
            child.type
          );
          if (child.type === "space") {
            continue;
          }
          if (width3 > maxWidth2) {
            maxWidth2 = width3 / (child.widthInColumns ?? 1);
          }
          if (height2 > maxHeight) {
            maxHeight = height2;
          }
        }
        return { width: maxWidth2, height: maxHeight };
      }, "getMaxChildSize");
      __name(setBlockSizes, "setBlockSizes");
      __name(layoutBlocks, "layoutBlocks");
      __name(findBounds, "findBounds");
      __name(layout5, "layout");
    }
  });

  // src/dagre-wrapper/createLabel.js
  var createLabel2, createLabel_default2;
  var init_createLabel2 = __esm({
    "src/dagre-wrapper/createLabel.js"() {
      "use strict";
      init_config();
      init_diagramAPI();
      init_createText();
      createLabel2 = /* @__PURE__ */ __name(async (element3, _vertexText, style3, isTitle = false, isNode2 = false) => {
        let vertexText = _vertexText || "";
        if (typeof vertexText === "object") {
          vertexText = vertexText[0];
        }
        const config5 = getConfig2();
        const useHtmlLabels = getEffectiveHtmlLabels(config5);
        return await createText(
          element3,
          vertexText,
          {
            style: style3,
            isTitle,
            useHtmlLabels,
            markdown: false,
            isNode: isNode2,
            width: Number.POSITIVE_INFINITY
          },
          config5
        );
      }, "createLabel");
      createLabel_default2 = createLabel2;
    }
  });

  // src/dagre-wrapper/edgeMarker.ts
  var addEdgeMarkers2, arrowTypesMap2, addEdgeMarker2;
  var init_edgeMarker2 = __esm({
    "src/dagre-wrapper/edgeMarker.ts"() {
      "use strict";
      init_logger();
      addEdgeMarkers2 = /* @__PURE__ */ __name((svgPath, edge, url, id34, diagramType) => {
        if (edge.arrowTypeStart) {
          addEdgeMarker2(svgPath, "start", edge.arrowTypeStart, url, id34, diagramType);
        }
        if (edge.arrowTypeEnd) {
          addEdgeMarker2(svgPath, "end", edge.arrowTypeEnd, url, id34, diagramType);
        }
      }, "addEdgeMarkers");
      arrowTypesMap2 = {
        arrow_cross: "cross",
        arrow_point: "point",
        arrow_barb: "barb",
        arrow_circle: "circle",
        aggregation: "aggregation",
        extension: "extension",
        composition: "composition",
        dependency: "dependency",
        lollipop: "lollipop"
      };
      addEdgeMarker2 = /* @__PURE__ */ __name((svgPath, position5, arrowType, url, id34, diagramType) => {
        const endMarkerType = arrowTypesMap2[arrowType];
        if (!endMarkerType) {
          log.warn(`Unknown arrow type: ${arrowType}`);
          return;
        }
        const suffix = position5 === "start" ? "Start" : "End";
        svgPath.attr(`marker-${position5}`, `url(${url}#${id34}_${diagramType}-${endMarkerType}${suffix})`);
      }, "addEdgeMarker");
    }
  });

  // src/dagre-wrapper/edges.js
  function setTerminalWidth2(fo, value2) {
    if (getEffectiveHtmlLabels(getConfig2()) && fo) {
      fo.style.width = value2.length * 9 + "px";
      fo.style.height = "12px";
    }
  }
  var edgeLabels2, terminalLabels2, insertEdgeLabel2, positionEdgeLabel2, outsideNode2, intersection3, cutPathAtIntersect2, insertEdge2;
  var init_edges2 = __esm({
    "src/dagre-wrapper/edges.js"() {
      "use strict";
      init_logger();
      init_createLabel2();
      init_createText();
      init_labelTransform();
      init_src32();
      init_diagramAPI();
      init_config();
      init_utils2();
      init_common();
      init_lineWithOffset();
      init_subGraphTitleMargins();
      init_edgeMarker2();
      edgeLabels2 = {};
      terminalLabels2 = {};
      insertEdgeLabel2 = /* @__PURE__ */ __name(async (elem, edge) => {
        const config5 = getConfig2();
        const useHtmlLabels = getEffectiveHtmlLabels(config5);
        const edgeLabel = elem.insert("g").attr("class", "edgeLabel");
        const label = edgeLabel.insert("g").attr("class", "label");
        const isMarkdown = edge.labelType === "markdown";
        const labelElement = await createText(
          elem,
          edge.label,
          {
            style: edge.labelStyle,
            useHtmlLabels,
            // TODO: The old code only set addSvgBackground when using markdown, but
            // this function is only used by block diagrams which never use markdown.
            addSvgBackground: isMarkdown,
            isNode: false,
            markdown: isMarkdown,
            // If using markdown, wrap using default width
            width: isMarkdown ? void 0 : Number.POSITIVE_INFINITY
          },
          config5
        );
        label.node().appendChild(labelElement);
        let bbox = labelElement.getBBox();
        let transformBbox = bbox;
        if (useHtmlLabels) {
          const div = labelElement.children[0];
          const dv = select_default2(labelElement);
          bbox = div.getBoundingClientRect();
          transformBbox = bbox;
          dv.attr("width", bbox.width);
          dv.attr("height", bbox.height);
        } else {
          const textEl = select_default2(labelElement).select("text").node();
          if (textEl && typeof textEl.getBBox === "function") {
            transformBbox = textEl.getBBox();
          }
        }
        label.attr("transform", computeLabelTransform(transformBbox, useHtmlLabels));
        edgeLabels2[edge.id] = edgeLabel;
        edge.width = bbox.width;
        edge.height = bbox.height;
        let fo;
        if (edge.startLabelLeft) {
          const startEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
          const inner2 = startEdgeLabelLeft.insert("g").attr("class", "inner");
          const startLabelElement = await createLabel_default2(inner2, edge.startLabelLeft, edge.labelStyle);
          fo = startLabelElement;
          let slBox = startLabelElement.getBBox();
          if (useHtmlLabels) {
            const div = startLabelElement.children[0];
            const dv = select_default2(startLabelElement);
            slBox = div.getBoundingClientRect();
            dv.attr("width", slBox.width);
            dv.attr("height", slBox.height);
          }
          inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels));
          if (!terminalLabels2[edge.id]) {
            terminalLabels2[edge.id] = {};
          }
          terminalLabels2[edge.id].startLeft = startEdgeLabelLeft;
          setTerminalWidth2(fo, edge.startLabelLeft);
        }
        if (edge.startLabelRight) {
          const startEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
          const inner2 = startEdgeLabelRight.insert("g").attr("class", "inner");
          const startLabelElement = await createLabel_default2(
            startEdgeLabelRight,
            edge.startLabelRight,
            edge.labelStyle
          );
          fo = startLabelElement;
          inner2.node().appendChild(startLabelElement);
          let slBox = startLabelElement.getBBox();
          if (useHtmlLabels) {
            const div = startLabelElement.children[0];
            const dv = select_default2(startLabelElement);
            slBox = div.getBoundingClientRect();
            dv.attr("width", slBox.width);
            dv.attr("height", slBox.height);
          }
          inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels));
          if (!terminalLabels2[edge.id]) {
            terminalLabels2[edge.id] = {};
          }
          terminalLabels2[edge.id].startRight = startEdgeLabelRight;
          setTerminalWidth2(fo, edge.startLabelRight);
        }
        if (edge.endLabelLeft) {
          const endEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
          const inner2 = endEdgeLabelLeft.insert("g").attr("class", "inner");
          const endLabelElement = await createLabel_default2(inner2, edge.endLabelLeft, edge.labelStyle);
          fo = endLabelElement;
          let slBox = endLabelElement.getBBox();
          if (useHtmlLabels) {
            const div = endLabelElement.children[0];
            const dv = select_default2(endLabelElement);
            slBox = div.getBoundingClientRect();
            dv.attr("width", slBox.width);
            dv.attr("height", slBox.height);
          }
          inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels));
          endEdgeLabelLeft.node().appendChild(endLabelElement);
          if (!terminalLabels2[edge.id]) {
            terminalLabels2[edge.id] = {};
          }
          terminalLabels2[edge.id].endLeft = endEdgeLabelLeft;
          setTerminalWidth2(fo, edge.endLabelLeft);
        }
        if (edge.endLabelRight) {
          const endEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
          const inner2 = endEdgeLabelRight.insert("g").attr("class", "inner");
          const endLabelElement = await createLabel_default2(inner2, edge.endLabelRight, edge.labelStyle);
          fo = endLabelElement;
          let slBox = endLabelElement.getBBox();
          if (useHtmlLabels) {
            const div = endLabelElement.children[0];
            const dv = select_default2(endLabelElement);
            slBox = div.getBoundingClientRect();
            dv.attr("width", slBox.width);
            dv.attr("height", slBox.height);
          }
          inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels));
          endEdgeLabelRight.node().appendChild(endLabelElement);
          if (!terminalLabels2[edge.id]) {
            terminalLabels2[edge.id] = {};
          }
          terminalLabels2[edge.id].endRight = endEdgeLabelRight;
          setTerminalWidth2(fo, edge.endLabelRight);
        }
        return labelElement;
      }, "insertEdgeLabel");
      __name(setTerminalWidth2, "setTerminalWidth");
      positionEdgeLabel2 = /* @__PURE__ */ __name((edge, paths) => {
        log.debug("Moving label abc88 ", edge.id, edge.label, edgeLabels2[edge.id], paths);
        let path4 = paths.updatedPath ? paths.updatedPath : paths.originalPath;
        const siteConfig2 = getConfig2();
        const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig2);
        if (edge.label) {
          const el = edgeLabels2[edge.id];
          let x5 = edge.x;
          let y6 = edge.y;
          if (path4) {
            const pos = utils_default2.calcLabelPosition(path4);
            log.debug(
              "Moving label " + edge.label + " from (",
              x5,
              ",",
              y6,
              ") to (",
              pos.x,
              ",",
              pos.y,
              ") abc88"
            );
            if (paths.updatedPath) {
              x5 = pos.x;
              y6 = pos.y;
            }
          }
          el.attr("transform", `translate(${x5}, ${y6 + subGraphTitleTotalMargin / 2})`);
        }
        if (edge.startLabelLeft) {
          const el = terminalLabels2[edge.id].startLeft;
          let x5 = edge.x;
          let y6 = edge.y;
          if (path4) {
            const pos = utils_default2.calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, "start_left", path4);
            x5 = pos.x;
            y6 = pos.y;
          }
          el.attr("transform", `translate(${x5}, ${y6})`);
        }
        if (edge.startLabelRight) {
          const el = terminalLabels2[edge.id].startRight;
          let x5 = edge.x;
          let y6 = edge.y;
          if (path4) {
            const pos = utils_default2.calcTerminalLabelPosition(
              edge.arrowTypeStart ? 10 : 0,
              "start_right",
              path4
            );
            x5 = pos.x;
            y6 = pos.y;
          }
          el.attr("transform", `translate(${x5}, ${y6})`);
        }
        if (edge.endLabelLeft) {
          const el = terminalLabels2[edge.id].endLeft;
          let x5 = edge.x;
          let y6 = edge.y;
          if (path4) {
            const pos = utils_default2.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_left", path4);
            x5 = pos.x;
            y6 = pos.y;
          }
          el.attr("transform", `translate(${x5}, ${y6})`);
        }
        if (edge.endLabelRight) {
          const el = terminalLabels2[edge.id].endRight;
          let x5 = edge.x;
          let y6 = edge.y;
          if (path4) {
            const pos = utils_default2.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_right", path4);
            x5 = pos.x;
            y6 = pos.y;
          }
          el.attr("transform", `translate(${x5}, ${y6})`);
        }
      }, "positionEdgeLabel");
      outsideNode2 = /* @__PURE__ */ __name((node2, point8) => {
        const x5 = node2.x;
        const y6 = node2.y;
        const dx = Math.abs(point8.x - x5);
        const dy = Math.abs(point8.y - y6);
        const w4 = node2.width / 2;
        const h3 = node2.height / 2;
        if (dx >= w4 || dy >= h3) {
          return true;
        }
        return false;
      }, "outsideNode");
      intersection3 = /* @__PURE__ */ __name((node2, outsidePoint, insidePoint) => {
        log.debug(`intersection calc abc89:
  outsidePoint: ${JSON.stringify(outsidePoint)}
  insidePoint : ${JSON.stringify(insidePoint)}
  node        : x:${node2.x} y:${node2.y} w:${node2.width} h:${node2.height}`);
        const x5 = node2.x;
        const y6 = node2.y;
        const dx = Math.abs(x5 - insidePoint.x);
        const w4 = node2.width / 2;
        let r2 = insidePoint.x < outsidePoint.x ? w4 - dx : w4 + dx;
        const h3 = node2.height / 2;
        const Q3 = Math.abs(outsidePoint.y - insidePoint.y);
        const R3 = Math.abs(outsidePoint.x - insidePoint.x);
        if (Math.abs(y6 - outsidePoint.y) * w4 > Math.abs(x5 - outsidePoint.x) * h3) {
          let q3 = insidePoint.y < outsidePoint.y ? outsidePoint.y - h3 - y6 : y6 - h3 - outsidePoint.y;
          r2 = R3 * q3 / Q3;
          const res = {
            x: insidePoint.x < outsidePoint.x ? insidePoint.x + r2 : insidePoint.x - R3 + r2,
            y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q3 - q3 : insidePoint.y - Q3 + q3
          };
          if (r2 === 0) {
            res.x = outsidePoint.x;
            res.y = outsidePoint.y;
          }
          if (R3 === 0) {
            res.x = outsidePoint.x;
          }
          if (Q3 === 0) {
            res.y = outsidePoint.y;
          }
          log.debug(`abc89 topp/bott calc, Q ${Q3}, q ${q3}, R ${R3}, r ${r2}`, res);
          return res;
        } else {
          if (insidePoint.x < outsidePoint.x) {
            r2 = outsidePoint.x - w4 - x5;
          } else {
            r2 = x5 - w4 - outsidePoint.x;
          }
          let q3 = Q3 * r2 / R3;
          let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R3 - r2 : insidePoint.x - R3 + r2;
          let _y = insidePoint.y < outsidePoint.y ? insidePoint.y + q3 : insidePoint.y - q3;
          log.debug(`sides calc abc89, Q ${Q3}, q ${q3}, R ${R3}, r ${r2}`, { _x, _y });
          if (r2 === 0) {
            _x = outsidePoint.x;
            _y = outsidePoint.y;
          }
          if (R3 === 0) {
            _x = outsidePoint.x;
          }
          if (Q3 === 0) {
            _y = outsidePoint.y;
          }
          return { x: _x, y: _y };
        }
      }, "intersection");
      cutPathAtIntersect2 = /* @__PURE__ */ __name((_points, boundaryNode) => {
        log.debug("abc88 cutPathAtIntersect", _points, boundaryNode);
        let points = [];
        let lastPointOutside = _points[0];
        let isInside = false;
        _points.forEach((point8) => {
          if (!outsideNode2(boundaryNode, point8) && !isInside) {
            const inter = intersection3(boundaryNode, lastPointOutside, point8);
            let pointPresent = false;
            points.forEach((p3) => {
              pointPresent = pointPresent || p3.x === inter.x && p3.y === inter.y;
            });
            if (!points.some((e3) => e3.x === inter.x && e3.y === inter.y)) {
              points.push(inter);
            }
            isInside = true;
          } else {
            lastPointOutside = point8;
            if (!isInside) {
              points.push(point8);
            }
          }
        });
        return points;
      }, "cutPathAtIntersect");
      insertEdge2 = /* @__PURE__ */ __name(function(elem, e3, edge, clusterDb2, diagramType, graph, id34) {
        let points = edge.points;
        log.debug("abc88 InsertEdge: edge=", edge, "e=", e3);
        let pointsHasChanged = false;
        const tail = graph.node(e3.v);
        var head2 = graph.node(e3.w);
        if (head2?.intersect && tail?.intersect) {
          points = points.slice(1, edge.points.length - 1);
          points.unshift(tail.intersect(points[0]));
          points.push(head2.intersect(points[points.length - 1]));
        }
        if (edge.toCluster) {
          log.debug("to cluster abc88", clusterDb2[edge.toCluster]);
          points = cutPathAtIntersect2(edge.points, clusterDb2[edge.toCluster].node);
          pointsHasChanged = true;
        }
        if (edge.fromCluster) {
          log.debug("from cluster abc88", clusterDb2[edge.fromCluster]);
          points = cutPathAtIntersect2(points.reverse(), clusterDb2[edge.fromCluster].node).reverse();
          pointsHasChanged = true;
        }
        const lineData = points.filter((p3) => !Number.isNaN(p3.y));
        let curve = basis_default2;
        if (edge.curve && (diagramType === "graph" || diagramType === "flowchart")) {
          curve = edge.curve;
        }
        const { x: x5, y: y6 } = getLineFunctionsWithOffset(edge);
        const lineFunction = line_default().x(x5).y(y6).curve(curve);
        let strokeClasses;
        switch (edge.thickness) {
          case "normal":
            strokeClasses = "edge-thickness-normal";
            break;
          case "thick":
            strokeClasses = "edge-thickness-thick";
            break;
          case "invisible":
            strokeClasses = "edge-thickness-thick";
            break;
          default:
            strokeClasses = "";
        }
        switch (edge.pattern) {
          case "solid":
            strokeClasses += " edge-pattern-solid";
            break;
          case "dotted":
            strokeClasses += " edge-pattern-dotted";
            break;
          case "dashed":
            strokeClasses += " edge-pattern-dashed";
            break;
        }
        const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", edge.id).attr("class", " " + strokeClasses + (edge.classes ? " " + edge.classes : "")).attr("style", edge.style);
        let url = "";
        if (getConfig2().flowchart.arrowMarkerAbsolute || getConfig2().state.arrowMarkerAbsolute) {
          url = getUrl(true);
        }
        addEdgeMarkers2(svgPath, edge, url, id34, diagramType);
        let paths = {};
        if (pointsHasChanged) {
          paths.updatedPath = points;
        }
        paths.originalPath = edge.points;
        return paths;
      }, "insertEdge");
    }
  });

  // src/dagre-wrapper/blockArrowHelper.ts
  var expandAndDeduplicateDirections, getArrowPoints;
  var init_blockArrowHelper = __esm({
    "src/dagre-wrapper/blockArrowHelper.ts"() {
      "use strict";
      expandAndDeduplicateDirections = /* @__PURE__ */ __name((directions) => {
        const uniqueDirections = /* @__PURE__ */ new Set();
        for (const direction2 of directions) {
          switch (direction2) {
            case "x":
              uniqueDirections.add("right");
              uniqueDirections.add("left");
              break;
            case "y":
              uniqueDirections.add("up");
              uniqueDirections.add("down");
              break;
            default:
              uniqueDirections.add(direction2);
              break;
          }
        }
        return uniqueDirections;
      }, "expandAndDeduplicateDirections");
      getArrowPoints = /* @__PURE__ */ __name((duplicatedDirections, bbox, node2) => {
        const directions = expandAndDeduplicateDirections(duplicatedDirections);
        const f2 = 2;
        const height2 = bbox.height + 2 * node2.padding;
        const midpoint3 = height2 / f2;
        const width3 = bbox.width + 2 * midpoint3 + node2.padding;
        const padding2 = node2.padding / 2;
        if (directions.has("right") && directions.has("left") && directions.has("up") && directions.has("down")) {
          return [
            // Bottom
            { x: 0, y: 0 },
            { x: midpoint3, y: 0 },
            { x: width3 / 2, y: 2 * padding2 },
            { x: width3 - midpoint3, y: 0 },
            { x: width3, y: 0 },
            // Right
            { x: width3, y: -height2 / 3 },
            { x: width3 + 2 * padding2, y: -height2 / 2 },
            { x: width3, y: -2 * height2 / 3 },
            { x: width3, y: -height2 },
            // Top
            { x: width3 - midpoint3, y: -height2 },
            { x: width3 / 2, y: -height2 - 2 * padding2 },
            { x: midpoint3, y: -height2 },
            // Left
            { x: 0, y: -height2 },
            { x: 0, y: -2 * height2 / 3 },
            { x: -2 * padding2, y: -height2 / 2 },
            { x: 0, y: -height2 / 3 }
          ];
        }
        if (directions.has("right") && directions.has("left") && directions.has("up")) {
          return [
            { x: midpoint3, y: 0 },
            { x: width3 - midpoint3, y: 0 },
            { x: width3, y: -height2 / 2 },
            { x: width3 - midpoint3, y: -height2 },
            { x: midpoint3, y: -height2 },
            { x: 0, y: -height2 / 2 }
          ];
        }
        if (directions.has("right") && directions.has("left") && directions.has("down")) {
          return [
            { x: 0, y: 0 },
            { x: midpoint3, y: -height2 },
            { x: width3 - midpoint3, y: -height2 },
            { x: width3, y: 0 }
          ];
        }
        if (directions.has("right") && directions.has("up") && directions.has("down")) {
          return [
            { x: 0, y: 0 },
            { x: width3, y: -midpoint3 },
            { x: width3, y: -height2 + midpoint3 },
            { x: 0, y: -height2 }
          ];
        }
        if (directions.has("left") && directions.has("up") && directions.has("down")) {
          return [
            { x: width3, y: 0 },
            { x: 0, y: -midpoint3 },
            { x: 0, y: -height2 + midpoint3 },
            { x: width3, y: -height2 }
          ];
        }
        if (directions.has("right") && directions.has("left")) {
          return [
            { x: midpoint3, y: 0 },
            { x: midpoint3, y: -padding2 },
            { x: width3 - midpoint3, y: -padding2 },
            { x: width3 - midpoint3, y: 0 },
            { x: width3, y: -height2 / 2 },
            { x: width3 - midpoint3, y: -height2 },
            { x: width3 - midpoint3, y: -height2 + padding2 },
            { x: midpoint3, y: -height2 + padding2 },
            { x: midpoint3, y: -height2 },
            { x: 0, y: -height2 / 2 }
          ];
        }
        if (directions.has("up") && directions.has("down")) {
          return [
            // Bottom center
            { x: width3 / 2, y: 0 },
            // Left pont of bottom arrow
            { x: 0, y: -padding2 },
            { x: midpoint3, y: -padding2 },
            // Left top over vertical section
            { x: midpoint3, y: -height2 + padding2 },
            { x: 0, y: -height2 + padding2 },
            // Top of arrow
            { x: width3 / 2, y: -height2 },
            { x: width3, y: -height2 + padding2 },
            // Top of right vertical bar
            { x: width3 - midpoint3, y: -height2 + padding2 },
            { x: width3 - midpoint3, y: -padding2 },
            { x: width3, y: -padding2 }
          ];
        }
        if (directions.has("right") && directions.has("up")) {
          return [
            { x: 0, y: 0 },
            { x: width3, y: -midpoint3 },
            { x: 0, y: -height2 }
          ];
        }
        if (directions.has("right") && directions.has("down")) {
          return [
            { x: 0, y: 0 },
            { x: width3, y: 0 },
            { x: 0, y: -height2 }
          ];
        }
        if (directions.has("left") && directions.has("up")) {
          return [
            { x: width3, y: 0 },
            { x: 0, y: -midpoint3 },
            { x: width3, y: -height2 }
          ];
        }
        if (directions.has("left") && directions.has("down")) {
          return [
            { x: width3, y: 0 },
            { x: 0, y: 0 },
            { x: width3, y: -height2 }
          ];
        }
        if (directions.has("right")) {
          return [
            { x: midpoint3, y: -padding2 },
            { x: midpoint3, y: -padding2 },
            { x: width3 - midpoint3, y: -padding2 },
            { x: width3 - midpoint3, y: 0 },
            { x: width3, y: -height2 / 2 },
            { x: width3 - midpoint3, y: -height2 },
            { x: width3 - midpoint3, y: -height2 + padding2 },
            // top left corner of arrow
            { x: midpoint3, y: -height2 + padding2 },
            { x: midpoint3, y: -height2 + padding2 }
          ];
        }
        if (directions.has("left")) {
          return [
            { x: midpoint3, y: 0 },
            { x: midpoint3, y: -padding2 },
            // Two points, the right corners
            { x: width3 - midpoint3, y: -padding2 },
            { x: width3 - midpoint3, y: -height2 + padding2 },
            { x: midpoint3, y: -height2 + padding2 },
            { x: midpoint3, y: -height2 },
            { x: 0, y: -height2 / 2 }
          ];
        }
        if (directions.has("up")) {
          return [
            // Bottom center
            { x: midpoint3, y: -padding2 },
            // Left top over vertical section
            { x: midpoint3, y: -height2 + padding2 },
            { x: 0, y: -height2 + padding2 },
            // Top of arrow
            { x: width3 / 2, y: -height2 },
            { x: width3, y: -height2 + padding2 },
            // Top of right vertical bar
            { x: width3 - midpoint3, y: -height2 + padding2 },
            { x: width3 - midpoint3, y: -padding2 }
          ];
        }
        if (directions.has("down")) {
          return [
            // Bottom center
            { x: width3 / 2, y: 0 },
            // Left pont of bottom arrow
            { x: 0, y: -padding2 },
            { x: midpoint3, y: -padding2 },
            // Left top over vertical section
            { x: midpoint3, y: -height2 + padding2 },
            { x: width3 - midpoint3, y: -height2 + padding2 },
            { x: width3 - midpoint3, y: -padding2 },
            { x: width3, y: -padding2 }
          ];
        }
        return [{ x: 0, y: 0 }];
      }, "getArrowPoints");
    }
  });

  // src/dagre-wrapper/intersect/intersect-node.js
  function intersectNode2(node2, point8) {
    return node2.intersect(point8);
  }
  var intersect_node_default2;
  var init_intersect_node2 = __esm({
    "src/dagre-wrapper/intersect/intersect-node.js"() {
      "use strict";
      __name(intersectNode2, "intersectNode");
      intersect_node_default2 = intersectNode2;
    }
  });

  // src/dagre-wrapper/intersect/intersect-ellipse.js
  function intersectEllipse2(node2, rx, ry, point8) {
    var cx = node2.x;
    var cy = node2.y;
    var px = cx - point8.x;
    var py = cy - point8.y;
    var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
    var dx = Math.abs(rx * ry * px / det);
    if (point8.x < cx) {
      dx = -dx;
    }
    var dy = Math.abs(rx * ry * py / det);
    if (point8.y < cy) {
      dy = -dy;
    }
    return { x: cx + dx, y: cy + dy };
  }
  var intersect_ellipse_default2;
  var init_intersect_ellipse2 = __esm({
    "src/dagre-wrapper/intersect/intersect-ellipse.js"() {
      "use strict";
      __name(intersectEllipse2, "intersectEllipse");
      intersect_ellipse_default2 = intersectEllipse2;
    }
  });

  // src/dagre-wrapper/intersect/intersect-circle.js
  function intersectCircle2(node2, rx, point8) {
    return intersect_ellipse_default2(node2, rx, rx, point8);
  }
  var intersect_circle_default2;
  var init_intersect_circle2 = __esm({
    "src/dagre-wrapper/intersect/intersect-circle.js"() {
      "use strict";
      init_intersect_ellipse2();
      __name(intersectCircle2, "intersectCircle");
      intersect_circle_default2 = intersectCircle2;
    }
  });

  // src/dagre-wrapper/intersect/intersect-line.js
  function intersectLine2(p1, p22, q1, q22) {
    var a1, a2, b1, b22, c1, c22;
    var r1, r2, r3, r4;
    var denom, offset, num;
    var x5, y6;
    a1 = p22.y - p1.y;
    b1 = p1.x - p22.x;
    c1 = p22.x * p1.y - p1.x * p22.y;
    r3 = a1 * q1.x + b1 * q1.y + c1;
    r4 = a1 * q22.x + b1 * q22.y + c1;
    if (r3 !== 0 && r4 !== 0 && sameSign2(r3, r4)) {
      return;
    }
    a2 = q22.y - q1.y;
    b22 = q1.x - q22.x;
    c22 = q22.x * q1.y - q1.x * q22.y;
    r1 = a2 * p1.x + b22 * p1.y + c22;
    r2 = a2 * p22.x + b22 * p22.y + c22;
    if (r1 !== 0 && r2 !== 0 && sameSign2(r1, r2)) {
      return;
    }
    denom = a1 * b22 - a2 * b1;
    if (denom === 0) {
      return;
    }
    offset = Math.abs(denom / 2);
    num = b1 * c22 - b22 * c1;
    x5 = num < 0 ? (num - offset) / denom : (num + offset) / denom;
    num = a2 * c1 - a1 * c22;
    y6 = num < 0 ? (num - offset) / denom : (num + offset) / denom;
    return { x: x5, y: y6 };
  }
  function sameSign2(r1, r2) {
    return r1 * r2 > 0;
  }
  var intersect_line_default2;
  var init_intersect_line2 = __esm({
    "src/dagre-wrapper/intersect/intersect-line.js"() {
      "use strict";
      __name(intersectLine2, "intersectLine");
      __name(sameSign2, "sameSign");
      intersect_line_default2 = intersectLine2;
    }
  });

  // src/dagre-wrapper/intersect/intersect-polygon.js
  function intersectPolygon2(node2, polyPoints, point8) {
    var x1 = node2.x;
    var y1 = node2.y;
    var intersections = [];
    var minX = Number.POSITIVE_INFINITY;
    var minY = Number.POSITIVE_INFINITY;
    if (typeof polyPoints.forEach === "function") {
      polyPoints.forEach(function(entry) {
        minX = Math.min(minX, entry.x);
        minY = Math.min(minY, entry.y);
      });
    } else {
      minX = Math.min(minX, polyPoints.x);
      minY = Math.min(minY, polyPoints.y);
    }
    var left3 = x1 - node2.width / 2 - minX;
    var top2 = y1 - node2.height / 2 - minY;
    for (var i2 = 0; i2 < polyPoints.length; i2++) {
      var p1 = polyPoints[i2];
      var p22 = polyPoints[i2 < polyPoints.length - 1 ? i2 + 1 : 0];
      var intersect3 = intersect_line_default2(
        node2,
        point8,
        { x: left3 + p1.x, y: top2 + p1.y },
        { x: left3 + p22.x, y: top2 + p22.y }
      );
      if (intersect3) {
        intersections.push(intersect3);
      }
    }
    if (!intersections.length) {
      return node2;
    }
    if (intersections.length > 1) {
      intersections.sort(function(p3, q3) {
        var pdx = p3.x - point8.x;
        var pdy = p3.y - point8.y;
        var distp = Math.sqrt(pdx * pdx + pdy * pdy);
        var qdx = q3.x - point8.x;
        var qdy = q3.y - point8.y;
        var distq = Math.sqrt(qdx * qdx + qdy * qdy);
        return distp < distq ? -1 : distp === distq ? 0 : 1;
      });
    }
    return intersections[0];
  }
  var intersect_polygon_default2;
  var init_intersect_polygon2 = __esm({
    "src/dagre-wrapper/intersect/intersect-polygon.js"() {
      "use strict";
      init_intersect_line2();
      intersect_polygon_default2 = intersectPolygon2;
      __name(intersectPolygon2, "intersectPolygon");
    }
  });

  // src/dagre-wrapper/intersect/intersect-rect.js
  var intersectRect3, intersect_rect_default2;
  var init_intersect_rect2 = __esm({
    "src/dagre-wrapper/intersect/intersect-rect.js"() {
      "use strict";
      intersectRect3 = /* @__PURE__ */ __name((node2, point8) => {
        var x5 = node2.x;
        var y6 = node2.y;
        var dx = point8.x - x5;
        var dy = point8.y - y6;
        var w4 = node2.width / 2;
        var h3 = node2.height / 2;
        var sx, sy;
        if (Math.abs(dy) * w4 > Math.abs(dx) * h3) {
          if (dy < 0) {
            h3 = -h3;
          }
          sx = dy === 0 ? 0 : h3 * dx / dy;
          sy = h3;
        } else {
          if (dx < 0) {
            w4 = -w4;
          }
          sx = w4;
          sy = dx === 0 ? 0 : w4 * dy / dx;
        }
        return { x: x5 + sx, y: y6 + sy };
      }, "intersectRect");
      intersect_rect_default2 = intersectRect3;
    }
  });

  // src/dagre-wrapper/intersect/index.js
  var intersect_default2;
  var init_intersect2 = __esm({
    "src/dagre-wrapper/intersect/index.js"() {
      "use strict";
      init_intersect_node2();
      init_intersect_circle2();
      init_intersect_ellipse2();
      init_intersect_polygon2();
      init_intersect_rect2();
      intersect_default2 = {
        node: intersect_node_default2,
        circle: intersect_circle_default2,
        ellipse: intersect_ellipse_default2,
        polygon: intersect_polygon_default2,
        rect: intersect_rect_default2
      };
    }
  });

  // src/dagre-wrapper/shapes/util.js
  function insertPolygonShape2(parent4, w4, h3, points) {
    return parent4.insert("polygon", ":first-child").attr(
      "points",
      points.map(function(d3) {
        return d3.x + "," + d3.y;
      }).join(" ")
    ).attr("class", "label-container").attr("transform", "translate(" + -w4 / 2 + "," + h3 / 2 + ")");
  }
  var labelHelper2, updateNodeBounds2;
  var init_util4 = __esm({
    "src/dagre-wrapper/shapes/util.js"() {
      "use strict";
      init_createLabel2();
      init_createText();
      init_diagramAPI();
      init_config();
      init_src32();
      init_common();
      init_utils2();
      init_labelImageUtils();
      labelHelper2 = /* @__PURE__ */ __name(async (parent4, node2, _classes, isNode2) => {
        const config5 = getConfig2();
        let classes3;
        const useHtmlLabels = node2.useHtmlLabels || getEffectiveHtmlLabels(config5);
        if (!_classes) {
          classes3 = "node default";
        } else {
          classes3 = _classes;
        }
        const shapeSvg = parent4.insert("g").attr("class", classes3).attr("id", node2.domId || node2.id);
        const label = shapeSvg.insert("g").attr("class", "label").attr("style", node2.labelStyle);
        let labelText;
        if (node2.labelText === void 0) {
          labelText = "";
        } else {
          labelText = typeof node2.labelText === "string" ? node2.labelText : node2.labelText[0];
        }
        let text4;
        if (node2.labelType === "markdown") {
          text4 = createText(
            label,
            sanitizeText(decodeEntities(labelText), config5),
            {
              useHtmlLabels,
              width: node2.width || config5.flowchart.wrappingWidth,
              classes: "markdown-node-label"
            },
            config5
          );
        } else {
          text4 = await createLabel_default2(
            label,
            sanitizeText(decodeEntities(labelText), config5),
            node2.labelStyle,
            false,
            isNode2
          );
        }
        let bbox = text4.getBBox();
        const halfPadding = node2.padding / 2;
        if (getEffectiveHtmlLabels(config5)) {
          const div = text4.children[0];
          const dv = select_default2(text4);
          await configureLabelImages(div, labelText);
          bbox = div.getBoundingClientRect();
          dv.attr("width", bbox.width);
          dv.attr("height", bbox.height);
        }
        if (useHtmlLabels) {
          label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
        } else {
          label.attr("transform", "translate(0, " + -bbox.height / 2 + ")");
        }
        if (node2.centerLabel) {
          label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
        }
        label.insert("rect", ":first-child");
        return { shapeSvg, bbox, halfPadding, label };
      }, "labelHelper");
      updateNodeBounds2 = /* @__PURE__ */ __name((node2, element3) => {
        const bbox = element3.node().getBBox();
        node2.width = bbox.width;
        node2.height = bbox.height;
      }, "updateNodeBounds");
      __name(insertPolygonShape2, "insertPolygonShape");
    }
  });

  // src/dagre-wrapper/shapes/note.js
  var note2, note_default;
  var init_note2 = __esm({
    "src/dagre-wrapper/shapes/note.js"() {
      "use strict";
      init_util4();
      init_logger();
      init_diagramAPI();
      init_config();
      init_intersect2();
      note2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const useHtmlLabels = node2.useHtmlLabels || getEffectiveHtmlLabels(getConfig2());
        if (!useHtmlLabels) {
          node2.centerLabel = true;
        }
        const { shapeSvg, bbox, halfPadding } = await labelHelper2(
          parent4,
          node2,
          "node " + node2.classes,
          true
        );
        log.info("Classes = ", node2.classes);
        const rect3 = shapeSvg.insert("rect", ":first-child");
        rect3.attr("rx", node2.rx).attr("ry", node2.ry).attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node2.padding).attr("height", bbox.height + node2.padding);
        updateNodeBounds2(node2, rect3);
        node2.intersect = function(point8) {
          return intersect_default2.rect(node2, point8);
        };
        return shapeSvg;
      }, "note");
      note_default = note2;
    }
  });

  // src/dagre-wrapper/nodes.js
  function applyNodePropertyBorders(rect3, borders, totalWidth, totalHeight) {
    const strokeDashArray = [];
    const addBorder = /* @__PURE__ */ __name((length2) => {
      strokeDashArray.push(length2, 0);
    }, "addBorder");
    const skipBorder = /* @__PURE__ */ __name((length2) => {
      strokeDashArray.push(0, length2);
    }, "skipBorder");
    if (borders.includes("t")) {
      log.debug("add top border");
      addBorder(totalWidth);
    } else {
      skipBorder(totalWidth);
    }
    if (borders.includes("r")) {
      log.debug("add right border");
      addBorder(totalHeight);
    } else {
      skipBorder(totalHeight);
    }
    if (borders.includes("b")) {
      log.debug("add bottom border");
      addBorder(totalWidth);
    } else {
      skipBorder(totalWidth);
    }
    if (borders.includes("l")) {
      log.debug("add left border");
      addBorder(totalHeight);
    } else {
      skipBorder(totalHeight);
    }
    rect3.attr("stroke-dasharray", strokeDashArray.join(" "));
  }
  var formatClass, getClassesFromNode, question2, choice2, hexagon2, block_arrow, rect_left_inv_arrow2, lean_right2, lean_left2, trapezoid2, inv_trapezoid2, rect_right_inv_arrow, cylinder2, rect2, composite, labelRect2, rectWithTitle2, stadium2, circle5, doublecircle2, subroutine2, start2, forkJoin2, end, class_box, shapes3, nodeElems2, insertNode2, positionNode2;
  var init_nodes3 = __esm({
    "src/dagre-wrapper/nodes.js"() {
      "use strict";
      init_src32();
      init_diagramAPI();
      init_config();
      init_logger();
      init_blockArrowHelper();
      init_createLabel2();
      init_intersect2();
      init_note2();
      init_util4();
      formatClass = /* @__PURE__ */ __name((str2) => {
        if (str2) {
          return " " + str2;
        }
        return "";
      }, "formatClass");
      getClassesFromNode = /* @__PURE__ */ __name((node2, otherClasses) => {
        return `${otherClasses ? otherClasses : "node default"}${formatClass(node2.classes)} ${formatClass(
          node2.class
        )}`;
      }, "getClassesFromNode");
      question2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox } = await labelHelper2(
          parent4,
          node2,
          getClassesFromNode(node2, void 0),
          true
        );
        const w4 = bbox.width + node2.padding;
        const h3 = bbox.height + node2.padding;
        const s2 = w4 + h3;
        const points = [
          { x: s2 / 2, y: 0 },
          { x: s2, y: -s2 / 2 },
          { x: s2 / 2, y: -s2 },
          { x: 0, y: -s2 / 2 }
        ];
        log.info("Question main (Circle)");
        const questionElem = insertPolygonShape2(shapeSvg, s2, s2, points);
        questionElem.attr("style", node2.style);
        updateNodeBounds2(node2, questionElem);
        node2.intersect = function(point8) {
          log.warn("Intersect called");
          return intersect_default2.polygon(node2, points, point8);
        };
        return shapeSvg;
      }, "question");
      choice2 = /* @__PURE__ */ __name((parent4, node2) => {
        const shapeSvg = parent4.insert("g").attr("class", "node default").attr("id", node2.domId || node2.id);
        const s2 = 28;
        const points = [
          { x: 0, y: s2 / 2 },
          { x: s2 / 2, y: 0 },
          { x: 0, y: -s2 / 2 },
          { x: -s2 / 2, y: 0 }
        ];
        const choice3 = shapeSvg.insert("polygon", ":first-child").attr(
          "points",
          points.map(function(d3) {
            return d3.x + "," + d3.y;
          }).join(" ")
        );
        choice3.attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28);
        node2.width = 28;
        node2.height = 28;
        node2.intersect = function(point8) {
          return intersect_default2.circle(node2, 14, point8);
        };
        return shapeSvg;
      }, "choice");
      hexagon2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox } = await labelHelper2(
          parent4,
          node2,
          getClassesFromNode(node2, void 0),
          true
        );
        const f2 = 4;
        const h3 = bbox.height + node2.padding;
        const m3 = h3 / f2;
        const w4 = bbox.width + 2 * m3 + node2.padding;
        const points = [
          { x: m3, y: 0 },
          { x: w4 - m3, y: 0 },
          { x: w4, y: -h3 / 2 },
          { x: w4 - m3, y: -h3 },
          { x: m3, y: -h3 },
          { x: 0, y: -h3 / 2 }
        ];
        const hex2 = insertPolygonShape2(shapeSvg, w4, h3, points);
        hex2.attr("style", node2.style);
        updateNodeBounds2(node2, hex2);
        node2.intersect = function(point8) {
          return intersect_default2.polygon(node2, points, point8);
        };
        return shapeSvg;
      }, "hexagon");
      block_arrow = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox } = await labelHelper2(parent4, node2, void 0, true);
        const f2 = 2;
        const h3 = bbox.height + 2 * node2.padding;
        const m3 = h3 / f2;
        const w4 = bbox.width + 2 * m3 + node2.padding;
        const points = getArrowPoints(node2.directions, bbox, node2);
        const blockArrow = insertPolygonShape2(shapeSvg, w4, h3, points);
        blockArrow.attr("style", node2.style);
        updateNodeBounds2(node2, blockArrow);
        node2.intersect = function(point8) {
          return intersect_default2.polygon(node2, points, point8);
        };
        return shapeSvg;
      }, "block_arrow");
      rect_left_inv_arrow2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox } = await labelHelper2(
          parent4,
          node2,
          getClassesFromNode(node2, void 0),
          true
        );
        const w4 = bbox.width + node2.padding;
        const h3 = bbox.height + node2.padding;
        const points = [
          { x: -h3 / 2, y: 0 },
          { x: w4, y: 0 },
          { x: w4, y: -h3 },
          { x: -h3 / 2, y: -h3 },
          { x: 0, y: -h3 / 2 }
        ];
        const el = insertPolygonShape2(shapeSvg, w4, h3, points);
        el.attr("style", node2.style);
        node2.width = w4 + h3;
        node2.height = h3;
        node2.intersect = function(point8) {
          return intersect_default2.polygon(node2, points, point8);
        };
        return shapeSvg;
      }, "rect_left_inv_arrow");
      lean_right2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox } = await labelHelper2(parent4, node2, getClassesFromNode(node2), true);
        const w4 = bbox.width + node2.padding;
        const h3 = bbox.height + node2.padding;
        const points = [
          { x: -2 * h3 / 6, y: 0 },
          { x: w4 - h3 / 6, y: 0 },
          { x: w4 + 2 * h3 / 6, y: -h3 },
          { x: h3 / 6, y: -h3 }
        ];
        const el = insertPolygonShape2(shapeSvg, w4, h3, points);
        el.attr("style", node2.style);
        updateNodeBounds2(node2, el);
        node2.intersect = function(point8) {
          return intersect_default2.polygon(node2, points, point8);
        };
        return shapeSvg;
      }, "lean_right");
      lean_left2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox } = await labelHelper2(
          parent4,
          node2,
          getClassesFromNode(node2, void 0),
          true
        );
        const w4 = bbox.width + node2.padding;
        const h3 = bbox.height + node2.padding;
        const points = [
          { x: 2 * h3 / 6, y: 0 },
          { x: w4 + h3 / 6, y: 0 },
          { x: w4 - 2 * h3 / 6, y: -h3 },
          { x: -h3 / 6, y: -h3 }
        ];
        const el = insertPolygonShape2(shapeSvg, w4, h3, points);
        el.attr("style", node2.style);
        updateNodeBounds2(node2, el);
        node2.intersect = function(point8) {
          return intersect_default2.polygon(node2, points, point8);
        };
        return shapeSvg;
      }, "lean_left");
      trapezoid2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox } = await labelHelper2(
          parent4,
          node2,
          getClassesFromNode(node2, void 0),
          true
        );
        const w4 = bbox.width + node2.padding;
        const h3 = bbox.height + node2.padding;
        const points = [
          { x: -2 * h3 / 6, y: 0 },
          { x: w4 + 2 * h3 / 6, y: 0 },
          { x: w4 - h3 / 6, y: -h3 },
          { x: h3 / 6, y: -h3 }
        ];
        const el = insertPolygonShape2(shapeSvg, w4, h3, points);
        el.attr("style", node2.style);
        updateNodeBounds2(node2, el);
        node2.intersect = function(point8) {
          return intersect_default2.polygon(node2, points, point8);
        };
        return shapeSvg;
      }, "trapezoid");
      inv_trapezoid2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox } = await labelHelper2(
          parent4,
          node2,
          getClassesFromNode(node2, void 0),
          true
        );
        const w4 = bbox.width + node2.padding;
        const h3 = bbox.height + node2.padding;
        const points = [
          { x: h3 / 6, y: 0 },
          { x: w4 - h3 / 6, y: 0 },
          { x: w4 + 2 * h3 / 6, y: -h3 },
          { x: -2 * h3 / 6, y: -h3 }
        ];
        const el = insertPolygonShape2(shapeSvg, w4, h3, points);
        el.attr("style", node2.style);
        updateNodeBounds2(node2, el);
        node2.intersect = function(point8) {
          return intersect_default2.polygon(node2, points, point8);
        };
        return shapeSvg;
      }, "inv_trapezoid");
      rect_right_inv_arrow = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox } = await labelHelper2(
          parent4,
          node2,
          getClassesFromNode(node2, void 0),
          true
        );
        const w4 = bbox.width + node2.padding;
        const h3 = bbox.height + node2.padding;
        const points = [
          { x: 0, y: 0 },
          { x: w4 + h3 / 2, y: 0 },
          { x: w4, y: -h3 / 2 },
          { x: w4 + h3 / 2, y: -h3 },
          { x: 0, y: -h3 }
        ];
        const el = insertPolygonShape2(shapeSvg, w4, h3, points);
        el.attr("style", node2.style);
        updateNodeBounds2(node2, el);
        node2.intersect = function(point8) {
          return intersect_default2.polygon(node2, points, point8);
        };
        return shapeSvg;
      }, "rect_right_inv_arrow");
      cylinder2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox } = await labelHelper2(
          parent4,
          node2,
          getClassesFromNode(node2, void 0),
          true
        );
        const w4 = bbox.width + node2.padding;
        const rx = w4 / 2;
        const ry = rx / (2.5 + w4 / 50);
        const h3 = bbox.height + ry + node2.padding;
        const shape = "M 0," + ry + " a " + rx + "," + ry + " 0,0,0 " + w4 + " 0 a " + rx + "," + ry + " 0,0,0 " + -w4 + " 0 l 0," + h3 + " a " + rx + "," + ry + " 0,0,0 " + w4 + " 0 l 0," + -h3;
        const el = shapeSvg.attr("label-offset-y", ry).insert("path", ":first-child").attr("style", node2.style).attr("d", shape).attr("transform", "translate(" + -w4 / 2 + "," + -(h3 / 2 + ry) + ")");
        updateNodeBounds2(node2, el);
        node2.intersect = function(point8) {
          const pos = intersect_default2.rect(node2, point8);
          const x5 = pos.x - node2.x;
          if (rx != 0 && (Math.abs(x5) < node2.width / 2 || Math.abs(x5) == node2.width / 2 && Math.abs(pos.y - node2.y) > node2.height / 2 - ry)) {
            let y6 = ry * ry * (1 - x5 * x5 / (rx * rx));
            if (y6 != 0) {
              y6 = Math.sqrt(y6);
            }
            y6 = ry - y6;
            if (point8.y - node2.y > 0) {
              y6 = -y6;
            }
            pos.y += y6;
          }
          return pos;
        };
        return shapeSvg;
      }, "cylinder");
      rect2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox, halfPadding } = await labelHelper2(
          parent4,
          node2,
          "node " + node2.classes + " " + node2.class,
          true
        );
        const rect3 = shapeSvg.insert("rect", ":first-child");
        const totalWidth = node2.positioned ? node2.width : bbox.width + node2.padding;
        const totalHeight = node2.positioned ? node2.height : bbox.height + node2.padding;
        const x5 = node2.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;
        const y6 = node2.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;
        rect3.attr("class", "basic label-container").attr("style", node2.style).attr("rx", node2.rx).attr("ry", node2.ry).attr("x", x5).attr("y", y6).attr("width", totalWidth).attr("height", totalHeight);
        if (node2.props) {
          const propKeys = new Set(Object.keys(node2.props));
          if (node2.props.borders) {
            applyNodePropertyBorders(rect3, node2.props.borders, totalWidth, totalHeight);
            propKeys.delete("borders");
          }
          propKeys.forEach((propKey) => {
            log.warn(`Unknown node property ${propKey}`);
          });
        }
        updateNodeBounds2(node2, rect3);
        node2.intersect = function(point8) {
          return intersect_default2.rect(node2, point8);
        };
        return shapeSvg;
      }, "rect");
      composite = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox, halfPadding } = await labelHelper2(
          parent4,
          node2,
          "node " + node2.classes,
          true
        );
        const rect3 = shapeSvg.insert("rect", ":first-child");
        const totalWidth = node2.positioned ? node2.width : bbox.width + node2.padding;
        const totalHeight = node2.positioned ? node2.height : bbox.height + node2.padding;
        const x5 = node2.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;
        const y6 = node2.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;
        rect3.attr("class", "basic cluster composite label-container").attr("style", node2.style).attr("rx", node2.rx).attr("ry", node2.ry).attr("x", x5).attr("y", y6).attr("width", totalWidth).attr("height", totalHeight);
        if (node2.props) {
          const propKeys = new Set(Object.keys(node2.props));
          if (node2.props.borders) {
            applyNodePropertyBorders(rect3, node2.props.borders, totalWidth, totalHeight);
            propKeys.delete("borders");
          }
          propKeys.forEach((propKey) => {
            log.warn(`Unknown node property ${propKey}`);
          });
        }
        updateNodeBounds2(node2, rect3);
        node2.intersect = function(point8) {
          return intersect_default2.rect(node2, point8);
        };
        return shapeSvg;
      }, "composite");
      labelRect2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg } = await labelHelper2(parent4, node2, "label", true);
        log.trace("Classes = ", node2.class);
        const rect3 = shapeSvg.insert("rect", ":first-child");
        const totalWidth = 0;
        const totalHeight = 0;
        rect3.attr("width", totalWidth).attr("height", totalHeight);
        shapeSvg.attr("class", "label edgeLabel");
        if (node2.props) {
          const propKeys = new Set(Object.keys(node2.props));
          if (node2.props.borders) {
            applyNodePropertyBorders(rect3, node2.props.borders, totalWidth, totalHeight);
            propKeys.delete("borders");
          }
          propKeys.forEach((propKey) => {
            log.warn(`Unknown node property ${propKey}`);
          });
        }
        updateNodeBounds2(node2, rect3);
        node2.intersect = function(point8) {
          return intersect_default2.rect(node2, point8);
        };
        return shapeSvg;
      }, "labelRect");
      __name(applyNodePropertyBorders, "applyNodePropertyBorders");
      rectWithTitle2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        let classes3;
        if (!node2.classes) {
          classes3 = "node default";
        } else {
          classes3 = "node " + node2.classes;
        }
        const shapeSvg = parent4.insert("g").attr("class", classes3).attr("id", node2.domId || node2.id);
        const rect3 = shapeSvg.insert("rect", ":first-child");
        const innerLine = shapeSvg.insert("line");
        const label = shapeSvg.insert("g").attr("class", "label");
        const text22 = node2.labelText.flat ? node2.labelText.flat() : node2.labelText;
        let title2 = "";
        if (typeof text22 === "object") {
          title2 = text22[0];
        } else {
          title2 = text22;
        }
        log.info("Label text abc79", title2, text22, typeof text22 === "object");
        const text4 = await createLabel_default2(label, title2, node2.labelStyle, true, true);
        let bbox = { width: 0, height: 0 };
        if (getEffectiveHtmlLabels(getConfig2())) {
          const div = text4.children[0];
          const dv = select_default2(text4);
          bbox = div.getBoundingClientRect();
          dv.attr("width", bbox.width);
          dv.attr("height", bbox.height);
        }
        log.info("Text 2", text22);
        const textRows = text22.slice(1, text22.length);
        let titleBox = text4.getBBox();
        const descr = await createLabel_default2(
          label,
          textRows.join ? textRows.join("<br/>") : textRows,
          node2.labelStyle,
          true,
          true
        );
        if (getEffectiveHtmlLabels(getConfig2())) {
          const div = descr.children[0];
          const dv = select_default2(descr);
          bbox = div.getBoundingClientRect();
          dv.attr("width", bbox.width);
          dv.attr("height", bbox.height);
        }
        const halfPadding = node2.padding / 2;
        select_default2(descr).attr(
          "transform",
          "translate( " + // (titleBox.width - bbox.width) / 2 +
          (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ", " + (titleBox.height + halfPadding + 5) + ")"
        );
        select_default2(text4).attr(
          "transform",
          "translate( " + // (titleBox.width - bbox.width) / 2 +
          (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ", 0)"
        );
        bbox = label.node().getBBox();
        label.attr(
          "transform",
          "translate(" + -bbox.width / 2 + ", " + (-bbox.height / 2 - halfPadding + 3) + ")"
        );
        rect3.attr("class", "outer title-state").attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node2.padding).attr("height", bbox.height + node2.padding);
        innerLine.attr("class", "divider").attr("x1", -bbox.width / 2 - halfPadding).attr("x2", bbox.width / 2 + halfPadding).attr("y1", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding).attr("y2", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
        updateNodeBounds2(node2, rect3);
        node2.intersect = function(point8) {
          return intersect_default2.rect(node2, point8);
        };
        return shapeSvg;
      }, "rectWithTitle");
      stadium2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox } = await labelHelper2(
          parent4,
          node2,
          getClassesFromNode(node2, void 0),
          true
        );
        const h3 = bbox.height + node2.padding;
        const w4 = bbox.width + h3 / 4 + node2.padding;
        const rect3 = shapeSvg.insert("rect", ":first-child").attr("style", node2.style).attr("rx", h3 / 2).attr("ry", h3 / 2).attr("x", -w4 / 2).attr("y", -h3 / 2).attr("width", w4).attr("height", h3);
        updateNodeBounds2(node2, rect3);
        node2.intersect = function(point8) {
          return intersect_default2.rect(node2, point8);
        };
        return shapeSvg;
      }, "stadium");
      circle5 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox, halfPadding } = await labelHelper2(
          parent4,
          node2,
          getClassesFromNode(node2, void 0),
          true
        );
        const circle6 = shapeSvg.insert("circle", ":first-child");
        circle6.attr("style", node2.style).attr("rx", node2.rx).attr("ry", node2.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node2.padding).attr("height", bbox.height + node2.padding);
        log.info("Circle main");
        updateNodeBounds2(node2, circle6);
        node2.intersect = function(point8) {
          log.info("Circle intersect", node2, bbox.width / 2 + halfPadding, point8);
          return intersect_default2.circle(node2, bbox.width / 2 + halfPadding, point8);
        };
        return shapeSvg;
      }, "circle");
      doublecircle2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox, halfPadding } = await labelHelper2(
          parent4,
          node2,
          getClassesFromNode(node2, void 0),
          true
        );
        const gap = 5;
        const circleGroup = shapeSvg.insert("g", ":first-child");
        const outerCircle = circleGroup.insert("circle");
        const innerCircle = circleGroup.insert("circle");
        circleGroup.attr("class", node2.class);
        outerCircle.attr("style", node2.style).attr("rx", node2.rx).attr("ry", node2.ry).attr("r", bbox.width / 2 + halfPadding + gap).attr("width", bbox.width + node2.padding + gap * 2).attr("height", bbox.height + node2.padding + gap * 2);
        innerCircle.attr("style", node2.style).attr("rx", node2.rx).attr("ry", node2.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node2.padding).attr("height", bbox.height + node2.padding);
        log.info("DoubleCircle main");
        updateNodeBounds2(node2, outerCircle);
        node2.intersect = function(point8) {
          log.info("DoubleCircle intersect", node2, bbox.width / 2 + halfPadding + gap, point8);
          return intersect_default2.circle(node2, bbox.width / 2 + halfPadding + gap, point8);
        };
        return shapeSvg;
      }, "doublecircle");
      subroutine2 = /* @__PURE__ */ __name(async (parent4, node2) => {
        const { shapeSvg, bbox } = await labelHelper2(
          parent4,
          node2,
          getClassesFromNode(node2, void 0),
          true
        );
        const w4 = bbox.width + node2.padding;
        const h3 = bbox.height + node2.padding;
        const points = [
          { x: 0, y: 0 },
          { x: w4, y: 0 },
          { x: w4, y: -h3 },
          { x: 0, y: -h3 },
          { x: 0, y: 0 },
          { x: -8, y: 0 },
          { x: w4 + 8, y: 0 },
          { x: w4 + 8, y: -h3 },
          { x: -8, y: -h3 },
          { x: -8, y: 0 }
        ];
        const el = insertPolygonShape2(shapeSvg, w4, h3, points);
        el.attr("style", node2.style);
        updateNodeBounds2(node2, el);
        node2.intersect = function(point8) {
          return intersect_default2.polygon(node2, points, point8);
        };
        return shapeSvg;
      }, "subroutine");
      start2 = /* @__PURE__ */ __name((parent4, node2) => {
        const shapeSvg = parent4.insert("g").attr("class", "node default").attr("id", node2.domId || node2.id);
        const circle6 = shapeSvg.insert("circle", ":first-child");
        circle6.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
        updateNodeBounds2(node2, circle6);
        node2.intersect = function(point8) {
          return intersect_default2.circle(node2, 7, point8);
        };
        return shapeSvg;
      }, "start");
      forkJoin2 = /* @__PURE__ */ __name((parent4, node2, dir2) => {
        const shapeSvg = parent4.insert("g").attr("class", "node default").attr("id", node2.domId || node2.id);
        let width3 = 70;
        let height2 = 10;
        if (dir2 === "LR") {
          width3 = 10;
          height2 = 70;
        }
        const shape = shapeSvg.append("rect").attr("x", -1 * width3 / 2).attr("y", -1 * height2 / 2).attr("width", width3).attr("height", height2).attr("class", "fork-join");
        updateNodeBounds2(node2, shape);
        node2.height = node2.height + node2.padding / 2;
        node2.width = node2.width + node2.padding / 2;
        node2.intersect = function(point8) {
          return intersect_default2.rect(node2, point8);
        };
        return shapeSvg;
      }, "forkJoin");
      end = /* @__PURE__ */ __name((parent4, node2) => {
        const shapeSvg = parent4.insert("g").attr("class", "node default").attr("id", node2.domId || node2.id);
        const innerCircle = shapeSvg.insert("circle", ":first-child");
        const circle6 = shapeSvg.insert("circle", ":first-child");
        circle6.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
        innerCircle.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10);
        updateNodeBounds2(node2, circle6);
        node2.intersect = function(point8) {
          return intersect_default2.circle(node2, 7, point8);
        };
        return shapeSvg;
      }, "end");
      class_box = /* @__PURE__ */ __name(async (parent4, node2) => {
        const halfPadding = node2.padding / 2;
        const rowPadding = 4;
        const lineHeight = 8;
        let classes3;
        if (!node2.classes) {
          classes3 = "node default";
        } else {
          classes3 = "node " + node2.classes;
        }
        const shapeSvg = parent4.insert("g").attr("class", classes3).attr("id", node2.domId || node2.id);
        const rect3 = shapeSvg.insert("rect", ":first-child");
        const topLine = shapeSvg.insert("line");
        const bottomLine = shapeSvg.insert("line");
        let maxWidth2 = 0;
        let maxHeight = rowPadding;
        const labelContainer = shapeSvg.insert("g").attr("class", "label");
        let verticalPos = 0;
        const hasInterface = node2.classData.annotations?.[0];
        const interfaceLabelText = node2.classData.annotations[0] ? "\xAB" + node2.classData.annotations[0] + "\xBB" : "";
        const interfaceLabel = await createLabel_default2(
          labelContainer,
          interfaceLabelText,
          node2.labelStyle,
          true,
          true
        );
        let interfaceBBox = interfaceLabel.getBBox();
        if (getEffectiveHtmlLabels(getConfig2())) {
          const div = interfaceLabel.children[0];
          const dv = select_default2(interfaceLabel);
          interfaceBBox = div.getBoundingClientRect();
          dv.attr("width", interfaceBBox.width);
          dv.attr("height", interfaceBBox.height);
        }
        if (node2.classData.annotations[0]) {
          maxHeight += interfaceBBox.height + rowPadding;
          maxWidth2 += interfaceBBox.width;
        }
        let classTitleString = node2.classData.label;
        if (node2.classData.type !== void 0 && node2.classData.type !== "") {
          if (getEffectiveHtmlLabels(getConfig2())) {
            classTitleString += "&lt;" + node2.classData.type + "&gt;";
          } else {
            classTitleString += "<" + node2.classData.type + ">";
          }
        }
        const classTitleLabel = await createLabel_default2(
          labelContainer,
          classTitleString,
          node2.labelStyle,
          true,
          true
        );
        select_default2(classTitleLabel).attr("class", "classTitle");
        let classTitleBBox = classTitleLabel.getBBox();
        if (getEffectiveHtmlLabels(getConfig2())) {
          const div = classTitleLabel.children[0];
          const dv = select_default2(classTitleLabel);
          classTitleBBox = div.getBoundingClientRect();
          dv.attr("width", classTitleBBox.width);
          dv.attr("height", classTitleBBox.height);
        }
        maxHeight += classTitleBBox.height + rowPadding;
        if (classTitleBBox.width > maxWidth2) {
          maxWidth2 = classTitleBBox.width;
        }
        const classAttributes = [];
        node2.classData.members.forEach(async (member) => {
          const parsedInfo = member.getDisplayDetails();
          let parsedText = parsedInfo.displayText;
          if (getEffectiveHtmlLabels(getConfig2())) {
            parsedText = parsedText.replace(/</g, "&lt;").replace(/>/g, "&gt;");
          }
          const lbl = await createLabel_default2(
            labelContainer,
            parsedText,
            parsedInfo.cssStyle ? parsedInfo.cssStyle : node2.labelStyle,
            true,
            true
          );
          let bbox = lbl.getBBox();
          if (getEffectiveHtmlLabels(getConfig2())) {
            const div = lbl.children[0];
            const dv = select_default2(lbl);
            bbox = div.getBoundingClientRect();
            dv.attr("width", bbox.width);
            dv.attr("height", bbox.height);
          }
          if (bbox.width > maxWidth2) {
            maxWidth2 = bbox.width;
          }
          maxHeight += bbox.height + rowPadding;
          classAttributes.push(lbl);
        });
        maxHeight += lineHeight;
        const classMethods = [];
        node2.classData.methods.forEach(async (member) => {
          const parsedInfo = member.getDisplayDetails();
          let displayText = parsedInfo.displayText;
          if (getEffectiveHtmlLabels(getConfig2())) {
            displayText = displayText.replace(/</g, "&lt;").replace(/>/g, "&gt;");
          }
          const lbl = await createLabel_default2(
            labelContainer,
            displayText,
            parsedInfo.cssStyle ? parsedInfo.cssStyle : node2.labelStyle,
            true,
            true
          );
          let bbox = lbl.getBBox();
          if (getEffectiveHtmlLabels(getConfig2())) {
            const div = lbl.children[0];
            const dv = select_default2(lbl);
            bbox = div.getBoundingClientRect();
            dv.attr("width", bbox.width);
            dv.attr("height", bbox.height);
          }
          if (bbox.width > maxWidth2) {
            maxWidth2 = bbox.width;
          }
          maxHeight += bbox.height + rowPadding;
          classMethods.push(lbl);
        });
        maxHeight += lineHeight;
        if (hasInterface) {
          let diffX2 = (maxWidth2 - interfaceBBox.width) / 2;
          select_default2(interfaceLabel).attr(
            "transform",
            "translate( " + (-1 * maxWidth2 / 2 + diffX2) + ", " + -1 * maxHeight / 2 + ")"
          );
          verticalPos = interfaceBBox.height + rowPadding;
        }
        let diffX = (maxWidth2 - classTitleBBox.width) / 2;
        select_default2(classTitleLabel).attr(
          "transform",
          "translate( " + (-1 * maxWidth2 / 2 + diffX) + ", " + (-1 * maxHeight / 2 + verticalPos) + ")"
        );
        verticalPos += classTitleBBox.height + rowPadding;
        topLine.attr("class", "divider").attr("x1", -maxWidth2 / 2 - halfPadding).attr("x2", maxWidth2 / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
        verticalPos += lineHeight;
        classAttributes.forEach((lbl) => {
          select_default2(lbl).attr(
            "transform",
            "translate( " + -maxWidth2 / 2 + ", " + (-1 * maxHeight / 2 + verticalPos + lineHeight / 2) + ")"
          );
          const memberBBox = lbl?.getBBox();
          verticalPos += (memberBBox?.height ?? 0) + rowPadding;
        });
        verticalPos += lineHeight;
        bottomLine.attr("class", "divider").attr("x1", -maxWidth2 / 2 - halfPadding).attr("x2", maxWidth2 / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
        verticalPos += lineHeight;
        classMethods.forEach((lbl) => {
          select_default2(lbl).attr(
            "transform",
            "translate( " + -maxWidth2 / 2 + ", " + (-1 * maxHeight / 2 + verticalPos) + ")"
          );
          const memberBBox = lbl?.getBBox();
          verticalPos += (memberBBox?.height ?? 0) + rowPadding;
        });
        rect3.attr("style", node2.style).attr("class", "outer title-state").attr("x", -maxWidth2 / 2 - halfPadding).attr("y", -(maxHeight / 2) - halfPadding).attr("width", maxWidth2 + node2.padding).attr("height", maxHeight + node2.padding);
        updateNodeBounds2(node2, rect3);
        node2.intersect = function(point8) {
          return intersect_default2.rect(node2, point8);
        };
        return shapeSvg;
      }, "class_box");
      shapes3 = {
        rhombus: question2,
        composite,
        question: question2,
        rect: rect2,
        labelRect: labelRect2,
        rectWithTitle: rectWithTitle2,
        choice: choice2,
        circle: circle5,
        doublecircle: doublecircle2,
        stadium: stadium2,
        hexagon: hexagon2,
        block_arrow,
        rect_left_inv_arrow: rect_left_inv_arrow2,
        lean_right: lean_right2,
        lean_left: lean_left2,
        trapezoid: trapezoid2,
        inv_trapezoid: inv_trapezoid2,
        rect_right_inv_arrow,
        cylinder: cylinder2,
        start: start2,
        end,
        note: note_default,
        subroutine: subroutine2,
        fork: forkJoin2,
        join: forkJoin2,
        class_box
      };
      nodeElems2 = {};
      insertNode2 = /* @__PURE__ */ __name(async (elem, node2, renderOptions) => {
        let newEl;
        let el;
        if (node2.link) {
          let target;
          if (getConfig2().securityLevel === "sandbox") {
            target = "_top";
          } else if (node2.linkTarget) {
            target = node2.linkTarget || "_blank";
          }
          newEl = elem.insert("svg:a").attr("xlink:href", node2.link).attr("target", target);
          el = await shapes3[node2.shape](newEl, node2, renderOptions);
        } else {
          el = await shapes3[node2.shape](elem, node2, renderOptions);
          newEl = el;
        }
        if (node2.tooltip) {
          el.attr("title", node2.tooltip);
        }
        if (node2.class) {
          el.attr("class", "node default " + node2.class);
        }
        nodeElems2[node2.id] = newEl;
        if (node2.haveCallback) {
          nodeElems2[node2.id].attr("class", nodeElems2[node2.id].attr("class") + " clickable");
        }
        return newEl;
      }, "insertNode");
      positionNode2 = /* @__PURE__ */ __name((node2) => {
        const el = nodeElems2[node2.id];
        log.trace(
          "Transforming node",
          node2.diff,
          node2,
          "translate(" + (node2.x - node2.width / 2 - 5) + ", " + node2.width / 2 + ")"
        );
        const padding2 = 8;
        const diff2 = node2.diff || 0;
        if (node2.clusterNode) {
          el.attr(
            "transform",
            "translate(" + (node2.x + diff2 - node2.width / 2) + ", " + (node2.y - node2.height / 2 - padding2) + ")"
          );
        } else {
          el.attr("transform", "translate(" + node2.x + ", " + node2.y + ")");
        }
        return diff2;
      }, "positionNode");
    }
  });

  // src/diagrams/block/renderHelpers.ts
  function getNodeFromBlock(block2, db9, positioned = false) {
    const vertex = block2;
    let classStr = "default";
    if ((vertex?.classes?.length || 0) > 0) {
      classStr = (vertex?.classes ?? []).join(" ");
    }
    classStr = classStr + " flowchart-label";
    let radius2 = 0;
    let shape = "";
    let padding2;
    switch (vertex.type) {
      case "round":
        radius2 = 5;
        shape = "rect";
        break;
      case "composite":
        radius2 = 0;
        shape = "composite";
        padding2 = 0;
        break;
      case "square":
        shape = "rect";
        break;
      case "diamond":
        shape = "question";
        break;
      case "hexagon":
        shape = "hexagon";
        break;
      case "block_arrow":
        shape = "block_arrow";
        break;
      case "odd":
        shape = "rect_left_inv_arrow";
        break;
      case "lean_right":
        shape = "lean_right";
        break;
      case "lean_left":
        shape = "lean_left";
        break;
      case "trapezoid":
        shape = "trapezoid";
        break;
      case "inv_trapezoid":
        shape = "inv_trapezoid";
        break;
      case "rect_left_inv_arrow":
        shape = "rect_left_inv_arrow";
        break;
      case "circle":
        shape = "circle";
        break;
      case "ellipse":
        shape = "ellipse";
        break;
      case "stadium":
        shape = "stadium";
        break;
      case "subroutine":
        shape = "subroutine";
        break;
      case "cylinder":
        shape = "cylinder";
        break;
      case "group":
        shape = "rect";
        break;
      case "doublecircle":
        shape = "doublecircle";
        break;
      default:
        shape = "rect";
    }
    const styles5 = getStylesFromArray(vertex?.styles ?? []);
    const vertexText = vertex.label;
    const bounds4 = vertex.size ?? { width: 0, height: 0, x: 0, y: 0 };
    const dbDiagramId = db9.getDiagramId();
    const node2 = {
      labelStyle: styles5.labelStyle,
      shape,
      labelText: vertexText,
      rx: radius2,
      ry: radius2,
      class: classStr,
      style: styles5.style,
      id: vertex.id,
      domId: dbDiagramId ? `${dbDiagramId}-${vertex.id}` : vertex.id,
      directions: vertex.directions,
      width: bounds4.width,
      height: bounds4.height,
      x: bounds4.x,
      y: bounds4.y,
      positioned,
      intersect: void 0,
      type: vertex.type,
      padding: padding2 ?? getConfig()?.block?.padding ?? 0
    };
    return node2;
  }
  async function calculateBlockSize(elem, block2, db9) {
    const node2 = getNodeFromBlock(block2, db9, false);
    if (node2.type === "group") {
      return;
    }
    const config5 = getConfig();
    const nodeEl = await insertNode2(elem, node2, { config: config5 });
    const boundingBox3 = nodeEl.node().getBBox();
    const obj = db9.getBlock(node2.id);
    obj.size = { width: boundingBox3.width, height: boundingBox3.height, x: 0, y: 0, node: nodeEl };
    db9.setBlock(obj);
    nodeEl.remove();
  }
  async function insertBlockPositioned(elem, block2, db9) {
    const node2 = getNodeFromBlock(block2, db9, true);
    const obj = db9.getBlock(node2.id);
    if (obj.type !== "space") {
      const config5 = getConfig();
      await insertNode2(elem, node2, { config: config5 });
      block2.intersect = node2?.intersect;
      positionNode2(node2);
    }
  }
  async function performOperations(elem, blocks2, db9, operation) {
    for (const block2 of blocks2) {
      await operation(elem, block2, db9);
      if (block2.children) {
        await performOperations(elem, block2.children, db9, operation);
      }
    }
  }
  async function calculateBlockSizes(elem, blocks2, db9) {
    await performOperations(elem, blocks2, db9, calculateBlockSize);
  }
  async function insertBlocks(elem, blocks2, db9) {
    await performOperations(elem, blocks2, db9, insertBlockPositioned);
  }
  async function insertEdges(elem, edges3, blocks2, db9, id34) {
    const g2 = new Graph({
      multigraph: true,
      compound: true
    });
    g2.setGraph({
      rankdir: "TB",
      nodesep: 10,
      ranksep: 10,
      marginx: 8,
      marginy: 8
    });
    for (const block2 of blocks2) {
      if (block2.size) {
        g2.setNode(block2.id, {
          width: block2.size.width,
          height: block2.size.height,
          intersect: block2.intersect
        });
      }
    }
    for (const edge of edges3) {
      if (edge.start && edge.end) {
        const startBlock = db9.getBlock(edge.start);
        const endBlock = db9.getBlock(edge.end);
        if (startBlock?.size && endBlock?.size) {
          const start3 = startBlock.size;
          const end2 = endBlock.size;
          const points = [
            { x: start3.x, y: start3.y },
            { x: start3.x + (end2.x - start3.x) / 2, y: start3.y + (end2.y - start3.y) / 2 },
            { x: end2.x, y: end2.y }
          ];
          const prefixedEdgeId = id34 ? `${id34}-${edge.id}` : edge.id;
          insertEdge2(
            elem,
            { v: edge.start, w: edge.end, name: prefixedEdgeId },
            {
              ...edge,
              id: prefixedEdgeId,
              arrowTypeEnd: edge.arrowTypeEnd,
              arrowTypeStart: edge.arrowTypeStart,
              points,
              classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
            },
            void 0,
            "block",
            g2,
            id34
          );
          if (edge.label) {
            await insertEdgeLabel2(elem, {
              ...edge,
              label: edge.label,
              labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;",
              arrowTypeEnd: edge.arrowTypeEnd,
              arrowTypeStart: edge.arrowTypeStart,
              points,
              classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
            });
            positionEdgeLabel2(
              { ...edge, x: points[1].x, y: points[1].y },
              {
                originalPath: points
              }
            );
          }
        }
      }
    }
  }
  var init_renderHelpers = __esm({
    "src/diagrams/block/renderHelpers.ts"() {
      "use strict";
      init_graphlib();
      init_config();
      init_edges2();
      init_nodes3();
      init_utils2();
      __name(getNodeFromBlock, "getNodeFromBlock");
      __name(calculateBlockSize, "calculateBlockSize");
      __name(insertBlockPositioned, "insertBlockPositioned");
      __name(performOperations, "performOperations");
      __name(calculateBlockSizes, "calculateBlockSizes");
      __name(insertBlocks, "insertBlocks");
      __name(insertEdges, "insertEdges");
    }
  });

  // src/diagrams/block/blockRenderer.ts
  var getClasses5, draw24, blockRenderer_default;
  var init_blockRenderer = __esm({
    "src/diagrams/block/blockRenderer.ts"() {
      "use strict";
      init_src32();
      init_config();
      init_markers2();
      init_logger();
      init_setupGraphViewbox();
      init_layout3();
      init_renderHelpers();
      getClasses5 = /* @__PURE__ */ __name(function(text4, diagObj) {
        return diagObj.db.getClasses();
      }, "getClasses");
      draw24 = /* @__PURE__ */ __name(async function(text4, id34, _version, diagObj) {
        const { securityLevel, block: conf5 } = getConfig();
        const db9 = diagObj.db;
        db9.setDiagramId(id34);
        let sandboxElement;
        if (securityLevel === "sandbox") {
          sandboxElement = select_default2("#i" + id34);
        }
        const root3 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body");
        const svg2 = securityLevel === "sandbox" ? root3.select(`[id="${id34}"]`) : select_default2(`[id="${id34}"]`);
        const markers3 = ["point", "circle", "cross"];
        markers_default2(svg2, markers3, diagObj.type, id34);
        const bl = db9.getBlocks();
        const blArr = db9.getBlocksFlat();
        const edges3 = db9.getEdges();
        const nodes5 = svg2.insert("g").attr("class", "block");
        await calculateBlockSizes(nodes5, bl, db9);
        const bounds4 = layout5(db9);
        await insertBlocks(nodes5, bl, db9);
        await insertEdges(nodes5, edges3, blArr, db9, id34);
        if (bounds4) {
          const bounds22 = bounds4;
          const magicFactor = Math.max(1, Math.round(0.125 * (bounds22.width / bounds22.height)));
          const height2 = bounds22.height + magicFactor + 10;
          const width3 = bounds22.width + 10;
          const { useMaxWidth } = conf5;
          configureSvgSize(svg2, height2, width3, !!useMaxWidth);
          log.debug("Here Bounds", bounds4, bounds22);
          svg2.attr(
            "viewBox",
            `${bounds22.x - 5} ${bounds22.y - 5} ${bounds22.width + 10} ${bounds22.height + 10}`
          );
        }
      }, "draw");
      blockRenderer_default = {
        draw: draw24,
        getClasses: getClasses5
      };
    }
  });

  // src/diagrams/block/blockDiagram.ts
  var blockDiagram_exports = {};
  __export(blockDiagram_exports, {
    diagram: () => diagram24
  });
  var diagram24;
  var init_blockDiagram = __esm({
    "src/diagrams/block/blockDiagram.ts"() {
      "use strict";
      init_block();
      init_blockDB();
      init_styles18();
      init_blockRenderer();
      diagram24 = {
        parser: block_default,
        db: blockDB_default,
        renderer: blockRenderer_default,
        styles: styles_default16
      };
    }
  });

  // src/diagrams/treeView/db.ts
  var state3, clear19, getRoot, getCount, defaultConfig4, getConfig6, addNode2, db7, db_default;
  var init_db3 = __esm({
    "src/diagrams/treeView/db.ts"() {
      "use strict";
      init_config();
      init_defaultConfig();
      init_commonDb();
      init_utils2();
      init_imperativeState();
      state3 = new ImperativeState(() => ({
        cnt: 1,
        stack: [
          {
            id: 0,
            level: -1,
            name: "/",
            children: []
          }
        ]
      }));
      clear19 = /* @__PURE__ */ __name(() => {
        state3.reset();
        clear();
      }, "clear");
      getRoot = /* @__PURE__ */ __name(() => {
        return state3.records.stack[0];
      }, "getRoot");
      getCount = /* @__PURE__ */ __name(() => state3.records.cnt, "getCount");
      defaultConfig4 = defaultConfig_default.treeView;
      getConfig6 = /* @__PURE__ */ __name(() => {
        return cleanAndMerge(defaultConfig4, getConfig().treeView);
      }, "getConfig");
      addNode2 = /* @__PURE__ */ __name((level, name) => {
        while (level <= state3.records.stack[state3.records.stack.length - 1].level) {
          state3.records.stack.pop();
        }
        const node2 = {
          id: state3.records.cnt++,
          level,
          name,
          children: []
        };
        state3.records.stack[state3.records.stack.length - 1].children.push(node2);
        state3.records.stack.push(node2);
      }, "addNode");
      db7 = {
        clear: clear19,
        addNode: addNode2,
        getRoot,
        getCount,
        getConfig: getConfig6,
        getAccTitle,
        getAccDescription,
        getDiagramTitle,
        setAccDescription,
        setAccTitle,
        setDiagramTitle
      };
      db_default = db7;
    }
  });

  // src/diagrams/treeView/parser.ts
  var populate18, parser22;
  var init_parser5 = __esm({
    "src/diagrams/treeView/parser.ts"() {
      "use strict";
      init_logger();
      init_populateCommonDb();
      init_db3();
      init_mermaid_parser_core();
      populate18 = /* @__PURE__ */ __name((ast) => {
        populateCommonDb(ast, db_default);
        ast.nodes.map((node2) => db_default.addNode(node2.indent ? parseInt(node2.indent) : 0, node2.name));
      }, "populate");
      parser22 = {
        parse: /* @__PURE__ */ __name(async (input) => {
          const ast = await parse3("treeView", input);
          log.debug(ast);
          populate18(ast);
        }, "parse")
      };
    }
  });

  // src/diagrams/treeView/renderer.ts
  var positionLabel, positionLine, drawTree, draw25, renderer8, renderer_default;
  var init_renderer3 = __esm({
    "src/diagrams/treeView/renderer.ts"() {
      "use strict";
      init_logger();
      init_selectSvgElement();
      init_setupGraphViewbox();
      positionLabel = /* @__PURE__ */ __name((x5, y6, node2, domElem, config5) => {
        const label = domElem.append("text").text(node2.name).attr("dominant-baseline", "middle").attr("class", "treeView-node-label");
        const { height: labelHeight, width: labelWidth } = label.node().getBBox();
        const height2 = labelHeight + config5.paddingY * 2;
        const width3 = labelWidth + config5.paddingX * 2;
        label.attr("x", x5 + config5.paddingX);
        label.attr("y", y6 + height2 / 2);
        node2.BBox = {
          x: x5,
          y: y6,
          width: width3,
          height: height2
        };
      }, "positionLabel");
      positionLine = /* @__PURE__ */ __name((domElem, x1, y1, x22, y22, lineThickness) => {
        return domElem.append("line").attr("x1", x1).attr("y1", y1).attr("x2", x22).attr("y2", y22).attr("stroke-width", lineThickness).attr("class", "treeView-node-line");
      }, "positionLine");
      drawTree = /* @__PURE__ */ __name((elem, root3, config5) => {
        let totalHeight = 0;
        let totalWidth = 0;
        const drawNode2 = /* @__PURE__ */ __name((elem2, node2, config6, depth) => {
          const indent = depth * (config6.rowIndent + config6.paddingX);
          positionLabel(indent, totalHeight, node2, elem2, config6);
          const { height: height2, width: width3 } = node2.BBox;
          positionLine(
            elem2,
            indent - config6.rowIndent,
            totalHeight + height2 / 2,
            indent,
            totalHeight + height2 / 2,
            config6.lineThickness
          );
          totalWidth = Math.max(totalWidth, indent + width3);
          totalHeight += height2;
        }, "drawNode");
        const processNode = /* @__PURE__ */ __name((node2, depth = 0) => {
          drawNode2(elem, node2, config5, depth);
          node2.children.forEach((child) => {
            processNode(child, depth + 1);
          });
          const { x: x5, y: y6, height: height2 } = node2.BBox;
          if (node2.children.length) {
            const { y: endY, height: endHeight } = node2.children[node2.children.length - 1].BBox;
            positionLine(
              elem,
              x5 + config5.paddingX,
              y6 + height2,
              x5 + config5.paddingX,
              endY + endHeight / 2 + config5.lineThickness / 2,
              config5.lineThickness
            );
          }
        }, "processNode");
        processNode(root3);
        return { totalHeight, totalWidth };
      }, "drawTree");
      draw25 = /* @__PURE__ */ __name((text4, id34, _ver, diagObj) => {
        log.debug("Rendering treeView diagram\n" + text4);
        const db9 = diagObj.db;
        const root3 = db9.getRoot();
        const config5 = db9.getConfig();
        const svg2 = selectSvgElement(id34);
        const treeElem = svg2.append("g");
        treeElem.attr("class", "tree-view");
        const { totalHeight, totalWidth } = drawTree(treeElem, root3, config5);
        svg2.attr("viewBox", `-${config5.lineThickness / 2} 0 ${totalWidth} ${totalHeight}`);
        configureSvgSize(svg2, totalHeight, totalWidth, config5.useMaxWidth);
      }, "draw");
      renderer8 = {
        draw: draw25
      };
      renderer_default = renderer8;
    }
  });

  // src/diagrams/treeView/styles.ts
  var defaultTreeViewDiagramStyles, styles4, styles_default17;
  var init_styles19 = __esm({
    "src/diagrams/treeView/styles.ts"() {
      "use strict";
      init_utils2();
      defaultTreeViewDiagramStyles = {
        labelFontSize: "16px",
        labelColor: "black",
        lineColor: "black"
      };
      styles4 = /* @__PURE__ */ __name(({
        treeView
      }) => {
        const { labelFontSize, labelColor, lineColor } = cleanAndMerge(
          defaultTreeViewDiagramStyles,
          treeView
        );
        return `
    .treeView-node-label {
        font-size: ${labelFontSize};
        fill: ${labelColor};
    }
    .treeView-node-line {
        stroke: ${lineColor};
    }
    `;
      }, "styles");
      styles_default17 = styles4;
    }
  });

  // src/diagrams/treeView/diagram.ts
  var diagram_exports3 = {};
  __export(diagram_exports3, {
    diagram: () => diagram25
  });
  var diagram25;
  var init_diagram3 = __esm({
    "src/diagrams/treeView/diagram.ts"() {
      "use strict";
      init_parser5();
      init_db3();
      init_renderer3();
      init_styles19();
      diagram25 = {
        db: db_default,
        renderer: renderer_default,
        parser: parser22,
        styles: styles_default17
      };
    }
  });

  // src/diagrams/architecture/architectureTypes.ts
  var ArchitectureDirectionName, ArchitectureDirectionArrow, ArchitectureDirectionArrowShift, getOppositeArchitectureDirection, isArchitectureDirection, isArchitectureDirectionX, isArchitectureDirectionY, isArchitectureDirectionXY, isArchitecturePairXY, isValidArchitectureDirectionPair, getArchitectureDirectionPair, shiftPositionByArchitectureDirectionPair, getArchitectureDirectionXYFactors, getArchitectureDirectionAlignment, isArchitectureService, isArchitectureJunction, edgeData, nodeData;
  var init_architectureTypes = __esm({
    "src/diagrams/architecture/architectureTypes.ts"() {
      "use strict";
      ArchitectureDirectionName = {
        L: "left",
        R: "right",
        T: "top",
        B: "bottom"
      };
      ArchitectureDirectionArrow = {
        L: /* @__PURE__ */ __name((scale3) => `${scale3},${scale3 / 2} 0,${scale3} 0,0`, "L"),
        R: /* @__PURE__ */ __name((scale3) => `0,${scale3 / 2} ${scale3},0 ${scale3},${scale3}`, "R"),
        T: /* @__PURE__ */ __name((scale3) => `0,0 ${scale3},0 ${scale3 / 2},${scale3}`, "T"),
        B: /* @__PURE__ */ __name((scale3) => `${scale3 / 2},0 ${scale3},${scale3} 0,${scale3}`, "B")
      };
      ArchitectureDirectionArrowShift = {
        L: /* @__PURE__ */ __name((orig, arrowSize) => orig - arrowSize + 2, "L"),
        R: /* @__PURE__ */ __name((orig, _arrowSize) => orig - 2, "R"),
        T: /* @__PURE__ */ __name((orig, arrowSize) => orig - arrowSize + 2, "T"),
        B: /* @__PURE__ */ __name((orig, _arrowSize) => orig - 2, "B")
      };
      getOppositeArchitectureDirection = /* @__PURE__ */ __name(function(x5) {
        if (isArchitectureDirectionX(x5)) {
          return x5 === "L" ? "R" : "L";
        } else {
          return x5 === "T" ? "B" : "T";
        }
      }, "getOppositeArchitectureDirection");
      isArchitectureDirection = /* @__PURE__ */ __name(function(x5) {
        const temp = x5;
        return temp === "L" || temp === "R" || temp === "T" || temp === "B";
      }, "isArchitectureDirection");
      isArchitectureDirectionX = /* @__PURE__ */ __name(function(x5) {
        const temp = x5;
        return temp === "L" || temp === "R";
      }, "isArchitectureDirectionX");
      isArchitectureDirectionY = /* @__PURE__ */ __name(function(x5) {
        const temp = x5;
        return temp === "T" || temp === "B";
      }, "isArchitectureDirectionY");
      isArchitectureDirectionXY = /* @__PURE__ */ __name(function(a2, b3) {
        const aX_bY = isArchitectureDirectionX(a2) && isArchitectureDirectionY(b3);
        const aY_bX = isArchitectureDirectionY(a2) && isArchitectureDirectionX(b3);
        return aX_bY || aY_bX;
      }, "isArchitectureDirectionXY");
      isArchitecturePairXY = /* @__PURE__ */ __name(function(pair) {
        const lhs = pair[0];
        const rhs = pair[1];
        const aX_bY = isArchitectureDirectionX(lhs) && isArchitectureDirectionY(rhs);
        const aY_bX = isArchitectureDirectionY(lhs) && isArchitectureDirectionX(rhs);
        return aX_bY || aY_bX;
      }, "isArchitecturePairXY");
      isValidArchitectureDirectionPair = /* @__PURE__ */ __name(function(x5) {
        return x5 !== "LL" && x5 !== "RR" && x5 !== "TT" && x5 !== "BB";
      }, "isValidArchitectureDirectionPair");
      getArchitectureDirectionPair = /* @__PURE__ */ __name(function(sourceDir, targetDir) {
        const pair = `${sourceDir}${targetDir}`;
        return isValidArchitectureDirectionPair(pair) ? pair : void 0;
      }, "getArchitectureDirectionPair");
      shiftPositionByArchitectureDirectionPair = /* @__PURE__ */ __name(function([x5, y6], pair) {
        const lhs = pair[0];
        const rhs = pair[1];
        if (isArchitectureDirectionX(lhs)) {
          if (isArchitectureDirectionY(rhs)) {
            return [x5 + (lhs === "L" ? -1 : 1), y6 + (rhs === "T" ? 1 : -1)];
          } else {
            return [x5 + (lhs === "L" ? -1 : 1), y6];
          }
        } else {
          if (isArchitectureDirectionX(rhs)) {
            return [x5 + (rhs === "L" ? 1 : -1), y6 + (lhs === "T" ? 1 : -1)];
          } else {
            return [x5, y6 + (lhs === "T" ? 1 : -1)];
          }
        }
      }, "shiftPositionByArchitectureDirectionPair");
      getArchitectureDirectionXYFactors = /* @__PURE__ */ __name(function(pair) {
        if (pair === "LT" || pair === "TL") {
          return [1, 1];
        } else if (pair === "BL" || pair === "LB") {
          return [1, -1];
        } else if (pair === "BR" || pair === "RB") {
          return [-1, -1];
        } else {
          return [-1, 1];
        }
      }, "getArchitectureDirectionXYFactors");
      getArchitectureDirectionAlignment = /* @__PURE__ */ __name(function(a2, b3) {
        if (isArchitectureDirectionXY(a2, b3)) {
          return "bend";
        } else if (isArchitectureDirectionX(a2)) {
          return "horizontal";
        }
        return "vertical";
      }, "getArchitectureDirectionAlignment");
      isArchitectureService = /* @__PURE__ */ __name(function(x5) {
        const temp = x5;
        return temp.type === "service";
      }, "isArchitectureService");
      isArchitectureJunction = /* @__PURE__ */ __name(function(x5) {
        const temp = x5;
        return temp.type === "junction";
      }, "isArchitectureJunction");
      edgeData = /* @__PURE__ */ __name((edge) => {
        return edge.data();
      }, "edgeData");
      nodeData = /* @__PURE__ */ __name((node2) => {
        return node2.data();
      }, "nodeData");
    }
  });

  // src/diagrams/architecture/architectureDb.ts
  var DEFAULT_ARCHITECTURE_CONFIG, ArchitectureDB;
  var init_architectureDb = __esm({
    "src/diagrams/architecture/architectureDb.ts"() {
      "use strict";
      init_config();
      init_defaultConfig();
      init_utils2();
      init_commonDb();
      init_architectureTypes();
      DEFAULT_ARCHITECTURE_CONFIG = defaultConfig_default.architecture;
      ArchitectureDB = class {
        constructor() {
          this.nodes = {};
          this.groups = {};
          this.edges = [];
          this.registeredIds = {};
          this.elements = {};
          this.diagramId = "";
          this.setAccTitle = setAccTitle;
          this.getAccTitle = getAccTitle;
          this.setDiagramTitle = setDiagramTitle;
          this.getDiagramTitle = getDiagramTitle;
          this.getAccDescription = getAccDescription;
          this.setAccDescription = setAccDescription;
          this.clear();
        }
        static {
          __name(this, "ArchitectureDB");
        }
        setDiagramId(id34) {
          this.diagramId = id34;
        }
        getDiagramId() {
          return this.diagramId;
        }
        clear() {
          this.nodes = {};
          this.groups = {};
          this.edges = [];
          this.registeredIds = {};
          this.dataStructures = void 0;
          this.elements = {};
          this.diagramId = "";
          clear();
        }
        addService({
          id: id34,
          icon: icon2,
          in: parent4,
          title: title2,
          iconText
        }) {
          if (this.registeredIds[id34] !== void 0) {
            throw new Error(
              `The service id [${id34}] is already in use by another ${this.registeredIds[id34]}`
            );
          }
          if (parent4 !== void 0) {
            if (id34 === parent4) {
              throw new Error(`The service [${id34}] cannot be placed within itself`);
            }
            if (this.registeredIds[parent4] === void 0) {
              throw new Error(
                `The service [${id34}]'s parent does not exist. Please make sure the parent is created before this service`
              );
            }
            if (this.registeredIds[parent4] === "node") {
              throw new Error(`The service [${id34}]'s parent is not a group`);
            }
          }
          this.registeredIds[id34] = "node";
          this.nodes[id34] = {
            id: id34,
            type: "service",
            icon: icon2,
            iconText,
            title: title2,
            edges: [],
            in: parent4
          };
        }
        getServices() {
          return Object.values(this.nodes).filter(isArchitectureService);
        }
        addJunction({ id: id34, in: parent4 }) {
          if (this.registeredIds[id34] !== void 0) {
            throw new Error(
              `The junction id [${id34}] is already in use by another ${this.registeredIds[id34]}`
            );
          }
          if (parent4 !== void 0) {
            if (id34 === parent4) {
              throw new Error(`The junction [${id34}] cannot be placed within itself`);
            }
            if (this.registeredIds[parent4] === void 0) {
              throw new Error(
                `The junction [${id34}]'s parent does not exist. Please make sure the parent is created before this junction`
              );
            }
            if (this.registeredIds[parent4] === "node") {
              throw new Error(`The junction [${id34}]'s parent is not a group`);
            }
          }
          this.registeredIds[id34] = "node";
          this.nodes[id34] = {
            id: id34,
            type: "junction",
            edges: [],
            in: parent4
          };
        }
        getJunctions() {
          return Object.values(this.nodes).filter(isArchitectureJunction);
        }
        getNodes() {
          return Object.values(this.nodes);
        }
        getNode(id34) {
          return this.nodes[id34] ?? null;
        }
        addGroup({ id: id34, icon: icon2, in: parent4, title: title2 }) {
          if (this.registeredIds?.[id34] !== void 0) {
            throw new Error(
              `The group id [${id34}] is already in use by another ${this.registeredIds[id34]}`
            );
          }
          if (parent4 !== void 0) {
            if (id34 === parent4) {
              throw new Error(`The group [${id34}] cannot be placed within itself`);
            }
            if (this.registeredIds?.[parent4] === void 0) {
              throw new Error(
                `The group [${id34}]'s parent does not exist. Please make sure the parent is created before this group`
              );
            }
            if (this.registeredIds?.[parent4] === "node") {
              throw new Error(`The group [${id34}]'s parent is not a group`);
            }
          }
          this.registeredIds[id34] = "group";
          this.groups[id34] = {
            id: id34,
            icon: icon2,
            title: title2,
            in: parent4
          };
        }
        getGroups() {
          return Object.values(this.groups);
        }
        addEdge({
          lhsId,
          rhsId,
          lhsDir,
          rhsDir,
          lhsInto,
          rhsInto,
          lhsGroup,
          rhsGroup,
          title: title2
        }) {
          if (!isArchitectureDirection(lhsDir)) {
            throw new Error(
              `Invalid direction given for left hand side of edge ${lhsId}--${rhsId}. Expected (L,R,T,B) got ${String(lhsDir)}`
            );
          }
          if (!isArchitectureDirection(rhsDir)) {
            throw new Error(
              `Invalid direction given for right hand side of edge ${lhsId}--${rhsId}. Expected (L,R,T,B) got ${String(rhsDir)}`
            );
          }
          if (this.nodes[lhsId] === void 0 && this.groups[lhsId] === void 0) {
            throw new Error(
              `The left-hand id [${lhsId}] does not yet exist. Please create the service/group before declaring an edge to it.`
            );
          }
          if (this.nodes[rhsId] === void 0 && this.groups[rhsId] === void 0) {
            throw new Error(
              `The right-hand id [${rhsId}] does not yet exist. Please create the service/group before declaring an edge to it.`
            );
          }
          const lhsGroupId = this.nodes[lhsId].in;
          const rhsGroupId = this.nodes[rhsId].in;
          if (lhsGroup && lhsGroupId && rhsGroupId && lhsGroupId == rhsGroupId) {
            throw new Error(
              `The left-hand id [${lhsId}] is modified to traverse the group boundary, but the edge does not pass through two groups.`
            );
          }
          if (rhsGroup && lhsGroupId && rhsGroupId && lhsGroupId == rhsGroupId) {
            throw new Error(
              `The right-hand id [${rhsId}] is modified to traverse the group boundary, but the edge does not pass through two groups.`
            );
          }
          const edge = {
            lhsId,
            lhsDir,
            lhsInto,
            lhsGroup,
            rhsId,
            rhsDir,
            rhsInto,
            rhsGroup,
            title: title2
          };
          this.edges.push(edge);
          if (this.nodes[lhsId] && this.nodes[rhsId]) {
            this.nodes[lhsId].edges.push(this.edges[this.edges.length - 1]);
            this.nodes[rhsId].edges.push(this.edges[this.edges.length - 1]);
          }
        }
        getEdges() {
          return this.edges;
        }
        /**
         * Returns the current diagram's adjacency list, spatial map, & group alignments.
         * If they have not been created, run the algorithms to generate them.
         * @returns
         */
        getDataStructures() {
          if (this.dataStructures === void 0) {
            const groupAlignments = {};
            const adjList = Object.entries(this.nodes).reduce((prevOuter, [id34, service]) => {
              prevOuter[id34] = service.edges.reduce((prevInner, edge) => {
                const lhsGroupId = this.getNode(edge.lhsId)?.in;
                const rhsGroupId = this.getNode(edge.rhsId)?.in;
                if (lhsGroupId && rhsGroupId && lhsGroupId !== rhsGroupId) {
                  const alignment = getArchitectureDirectionAlignment(edge.lhsDir, edge.rhsDir);
                  if (alignment !== "bend") {
                    groupAlignments[lhsGroupId] ??= {};
                    groupAlignments[lhsGroupId][rhsGroupId] = alignment;
                    groupAlignments[rhsGroupId] ??= {};
                    groupAlignments[rhsGroupId][lhsGroupId] = alignment;
                  }
                }
                if (edge.lhsId === id34) {
                  const pair = getArchitectureDirectionPair(edge.lhsDir, edge.rhsDir);
                  if (pair) {
                    prevInner[pair] = edge.rhsId;
                  }
                } else {
                  const pair = getArchitectureDirectionPair(edge.rhsDir, edge.lhsDir);
                  if (pair) {
                    prevInner[pair] = edge.lhsId;
                  }
                }
                return prevInner;
              }, {});
              return prevOuter;
            }, {});
            const firstId = Object.keys(adjList)[0];
            const visited = { [firstId]: 1 };
            const notVisited = Object.keys(adjList).reduce(
              (prev2, id34) => id34 === firstId ? prev2 : { ...prev2, [id34]: 1 },
              {}
            );
            const BFS = /* @__PURE__ */ __name((startingId) => {
              const spatialMap = { [startingId]: [0, 0] };
              const queue = [startingId];
              while (queue.length > 0) {
                const id34 = queue.shift();
                if (id34) {
                  visited[id34] = 1;
                  delete notVisited[id34];
                  const adj = adjList[id34];
                  const [posX, posY] = spatialMap[id34];
                  Object.entries(adj).forEach(([dir2, rhsId]) => {
                    if (!visited[rhsId]) {
                      spatialMap[rhsId] = shiftPositionByArchitectureDirectionPair(
                        [posX, posY],
                        dir2
                      );
                      queue.push(rhsId);
                    }
                  });
                }
              }
              return spatialMap;
            }, "BFS");
            const spatialMaps = [BFS(firstId)];
            while (Object.keys(notVisited).length > 0) {
              spatialMaps.push(BFS(Object.keys(notVisited)[0]));
            }
            this.dataStructures = {
              adjList,
              spatialMaps,
              groupAlignments
            };
          }
          return this.dataStructures;
        }
        setElementForId(id34, element3) {
          this.elements[id34] = element3;
        }
        getElementById(id34) {
          return this.elements[id34];
        }
        getConfig() {
          return cleanAndMerge({
            ...DEFAULT_ARCHITECTURE_CONFIG,
            ...getConfig().architecture
          });
        }
        getConfigField(field) {
          return this.getConfig()[field];
        }
      };
    }
  });

  // src/diagrams/architecture/architectureParser.ts
  var populateDb2, parser23;
  var init_architectureParser = __esm({
    "src/diagrams/architecture/architectureParser.ts"() {
      "use strict";
      init_mermaid_parser_core();
      init_logger();
      init_populateCommonDb();
      init_architectureDb();
      populateDb2 = /* @__PURE__ */ __name((ast, db9) => {
        populateCommonDb(ast, db9);
        ast.groups.map((group2) => db9.addGroup(group2));
        ast.services.map((service) => db9.addService({ ...service, type: "service" }));
        ast.junctions.map((service) => db9.addJunction({ ...service, type: "junction" }));
        ast.edges.map((edge) => db9.addEdge(edge));
      }, "populateDb");
      parser23 = {
        parser: {
          // @ts-expect-error - ArchitectureDB is not assignable to DiagramDB
          yy: void 0
        },
        parse: /* @__PURE__ */ __name(async (input) => {
          const ast = await parse3("architecture", input);
          log.debug(ast);
          const db9 = parser23.parser?.yy;
          if (!(db9 instanceof ArchitectureDB)) {
            throw new Error(
              "parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
            );
          }
          populateDb2(ast, db9);
        }, "parse")
      };
    }
  });

  // src/diagrams/architecture/architectureStyles.ts
  var getStyles18, architectureStyles_default;
  var init_architectureStyles = __esm({
    "src/diagrams/architecture/architectureStyles.ts"() {
      "use strict";
      getStyles18 = /* @__PURE__ */ __name((options2) => `
  .edge {
    stroke-width: ${options2.archEdgeWidth};
    stroke: ${options2.archEdgeColor};
    fill: none;
  }

  .arrow {
    fill: ${options2.archEdgeArrowColor};
  }

  .node-bkg {
    fill: none;
    stroke: ${options2.archGroupBorderColor};
    stroke-width: ${options2.archGroupBorderWidth};
    stroke-dasharray: 8;
  }
  .node-icon-text {
    display: flex; 
    align-items: center;
  }
  
  .node-icon-text > div {
    color: #fff;
    margin: 1px;
    height: fit-content;
    text-align: center;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }
`, "getStyles");
      architectureStyles_default = getStyles18;
    }
  });

  // ../../node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.js
  var require_layout_base2 = __commonJS({
    "../../node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.js"(exports2, module2) {
      "use strict";
      (/* @__PURE__ */ __name((function webpackUniversalModuleDefinition(root3, factory) {
        if (typeof exports2 === "object" && typeof module2 === "object")
          module2.exports = factory();
        else if (typeof define === "function" && define.amd)
          define([], factory);
        else if (typeof exports2 === "object")
          exports2["layoutBase"] = factory();
        else
          root3["layoutBase"] = factory();
      }), "webpackUniversalModuleDefinition"))(exports2, function() {
        return (
          /******/
          (function(modules2) {
            var installedModules = {};
            function __webpack_require__(moduleId) {
              if (installedModules[moduleId]) {
                return installedModules[moduleId].exports;
              }
              var module3 = installedModules[moduleId] = {
                /******/
                i: moduleId,
                /******/
                l: false,
                /******/
                exports: {}
                /******/
              };
              modules2[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__);
              module3.l = true;
              return module3.exports;
            }
            __name(__webpack_require__, "__webpack_require__");
            __webpack_require__.m = modules2;
            __webpack_require__.c = installedModules;
            __webpack_require__.i = function(value2) {
              return value2;
            };
            __webpack_require__.d = function(exports3, name, getter) {
              if (!__webpack_require__.o(exports3, name)) {
                Object.defineProperty(exports3, name, {
                  /******/
                  configurable: false,
                  /******/
                  enumerable: true,
                  /******/
                  get: getter
                  /******/
                });
              }
            };
            __webpack_require__.n = function(module3) {
              var getter = module3 && module3.__esModule ? (
                /******/
                /* @__PURE__ */ __name(function getDefault() {
                  return module3["default"];
                }, "getDefault")
              ) : (
                /******/
                /* @__PURE__ */ __name(function getModuleExports() {
                  return module3;
                }, "getModuleExports")
              );
              __webpack_require__.d(getter, "a", getter);
              return getter;
            };
            __webpack_require__.o = function(object3, property2) {
              return Object.prototype.hasOwnProperty.call(object3, property2);
            };
            __webpack_require__.p = "";
            return __webpack_require__(__webpack_require__.s = 28);
          })([
            /* 0 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function LayoutConstants() {
              }
              __name(LayoutConstants, "LayoutConstants");
              LayoutConstants.QUALITY = 1;
              LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED = false;
              LayoutConstants.DEFAULT_INCREMENTAL = false;
              LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT = true;
              LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT = false;
              LayoutConstants.DEFAULT_ANIMATION_PERIOD = 50;
              LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES = false;
              LayoutConstants.DEFAULT_GRAPH_MARGIN = 15;
              LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = false;
              LayoutConstants.SIMPLE_NODE_SIZE = 40;
              LayoutConstants.SIMPLE_NODE_HALF_SIZE = LayoutConstants.SIMPLE_NODE_SIZE / 2;
              LayoutConstants.EMPTY_COMPOUND_NODE_SIZE = 40;
              LayoutConstants.MIN_EDGE_LENGTH = 1;
              LayoutConstants.WORLD_BOUNDARY = 1e6;
              LayoutConstants.INITIAL_WORLD_BOUNDARY = LayoutConstants.WORLD_BOUNDARY / 1e3;
              LayoutConstants.WORLD_CENTER_X = 1200;
              LayoutConstants.WORLD_CENTER_Y = 900;
              module3.exports = LayoutConstants;
            }),
            /* 1 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LGraphObject = __webpack_require__(2);
              var IGeometry = __webpack_require__(8);
              var IMath = __webpack_require__(9);
              function LEdge(source, target, vEdge) {
                LGraphObject.call(this, vEdge);
                this.isOverlapingSourceAndTarget = false;
                this.vGraphObject = vEdge;
                this.bendpoints = [];
                this.source = source;
                this.target = target;
              }
              __name(LEdge, "LEdge");
              LEdge.prototype = Object.create(LGraphObject.prototype);
              for (var prop in LGraphObject) {
                LEdge[prop] = LGraphObject[prop];
              }
              LEdge.prototype.getSource = function() {
                return this.source;
              };
              LEdge.prototype.getTarget = function() {
                return this.target;
              };
              LEdge.prototype.isInterGraph = function() {
                return this.isInterGraph;
              };
              LEdge.prototype.getLength = function() {
                return this.length;
              };
              LEdge.prototype.isOverlapingSourceAndTarget = function() {
                return this.isOverlapingSourceAndTarget;
              };
              LEdge.prototype.getBendpoints = function() {
                return this.bendpoints;
              };
              LEdge.prototype.getLca = function() {
                return this.lca;
              };
              LEdge.prototype.getSourceInLca = function() {
                return this.sourceInLca;
              };
              LEdge.prototype.getTargetInLca = function() {
                return this.targetInLca;
              };
              LEdge.prototype.getOtherEnd = function(node2) {
                if (this.source === node2) {
                  return this.target;
                } else if (this.target === node2) {
                  return this.source;
                } else {
                  throw "Node is not incident with this edge";
                }
              };
              LEdge.prototype.getOtherEndInGraph = function(node2, graph) {
                var otherEnd = this.getOtherEnd(node2);
                var root3 = graph.getGraphManager().getRoot();
                while (true) {
                  if (otherEnd.getOwner() == graph) {
                    return otherEnd;
                  }
                  if (otherEnd.getOwner() == root3) {
                    break;
                  }
                  otherEnd = otherEnd.getOwner().getParent();
                }
                return null;
              };
              LEdge.prototype.updateLength = function() {
                var clipPointCoordinates = new Array(4);
                this.isOverlapingSourceAndTarget = IGeometry.getIntersection(this.target.getRect(), this.source.getRect(), clipPointCoordinates);
                if (!this.isOverlapingSourceAndTarget) {
                  this.lengthX = clipPointCoordinates[0] - clipPointCoordinates[2];
                  this.lengthY = clipPointCoordinates[1] - clipPointCoordinates[3];
                  if (Math.abs(this.lengthX) < 1) {
                    this.lengthX = IMath.sign(this.lengthX);
                  }
                  if (Math.abs(this.lengthY) < 1) {
                    this.lengthY = IMath.sign(this.lengthY);
                  }
                  this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY);
                }
              };
              LEdge.prototype.updateLengthSimple = function() {
                this.lengthX = this.target.getCenterX() - this.source.getCenterX();
                this.lengthY = this.target.getCenterY() - this.source.getCenterY();
                if (Math.abs(this.lengthX) < 1) {
                  this.lengthX = IMath.sign(this.lengthX);
                }
                if (Math.abs(this.lengthY) < 1) {
                  this.lengthY = IMath.sign(this.lengthY);
                }
                this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY);
              };
              module3.exports = LEdge;
            }),
            /* 2 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function LGraphObject(vGraphObject) {
                this.vGraphObject = vGraphObject;
              }
              __name(LGraphObject, "LGraphObject");
              module3.exports = LGraphObject;
            }),
            /* 3 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LGraphObject = __webpack_require__(2);
              var Integer = __webpack_require__(10);
              var RectangleD = __webpack_require__(13);
              var LayoutConstants = __webpack_require__(0);
              var RandomSeed = __webpack_require__(16);
              var PointD = __webpack_require__(5);
              function LNode(gm, loc, size4, vNode) {
                if (size4 == null && vNode == null) {
                  vNode = loc;
                }
                LGraphObject.call(this, vNode);
                if (gm.graphManager != null) gm = gm.graphManager;
                this.estimatedSize = Integer.MIN_VALUE;
                this.inclusionTreeDepth = Integer.MAX_VALUE;
                this.vGraphObject = vNode;
                this.edges = [];
                this.graphManager = gm;
                if (size4 != null && loc != null) this.rect = new RectangleD(loc.x, loc.y, size4.width, size4.height);
                else this.rect = new RectangleD();
              }
              __name(LNode, "LNode");
              LNode.prototype = Object.create(LGraphObject.prototype);
              for (var prop in LGraphObject) {
                LNode[prop] = LGraphObject[prop];
              }
              LNode.prototype.getEdges = function() {
                return this.edges;
              };
              LNode.prototype.getChild = function() {
                return this.child;
              };
              LNode.prototype.getOwner = function() {
                return this.owner;
              };
              LNode.prototype.getWidth = function() {
                return this.rect.width;
              };
              LNode.prototype.setWidth = function(width3) {
                this.rect.width = width3;
              };
              LNode.prototype.getHeight = function() {
                return this.rect.height;
              };
              LNode.prototype.setHeight = function(height2) {
                this.rect.height = height2;
              };
              LNode.prototype.getCenterX = function() {
                return this.rect.x + this.rect.width / 2;
              };
              LNode.prototype.getCenterY = function() {
                return this.rect.y + this.rect.height / 2;
              };
              LNode.prototype.getCenter = function() {
                return new PointD(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2);
              };
              LNode.prototype.getLocation = function() {
                return new PointD(this.rect.x, this.rect.y);
              };
              LNode.prototype.getRect = function() {
                return this.rect;
              };
              LNode.prototype.getDiagonal = function() {
                return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height);
              };
              LNode.prototype.getHalfTheDiagonal = function() {
                return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2;
              };
              LNode.prototype.setRect = function(upperLeft, dimension) {
                this.rect.x = upperLeft.x;
                this.rect.y = upperLeft.y;
                this.rect.width = dimension.width;
                this.rect.height = dimension.height;
              };
              LNode.prototype.setCenter = function(cx, cy) {
                this.rect.x = cx - this.rect.width / 2;
                this.rect.y = cy - this.rect.height / 2;
              };
              LNode.prototype.setLocation = function(x5, y6) {
                this.rect.x = x5;
                this.rect.y = y6;
              };
              LNode.prototype.moveBy = function(dx, dy) {
                this.rect.x += dx;
                this.rect.y += dy;
              };
              LNode.prototype.getEdgeListToNode = function(to) {
                var edgeList2 = [];
                var edge;
                var self2 = this;
                self2.edges.forEach(function(edge2) {
                  if (edge2.target == to) {
                    if (edge2.source != self2) throw "Incorrect edge source!";
                    edgeList2.push(edge2);
                  }
                });
                return edgeList2;
              };
              LNode.prototype.getEdgesBetween = function(other) {
                var edgeList2 = [];
                var edge;
                var self2 = this;
                self2.edges.forEach(function(edge2) {
                  if (!(edge2.source == self2 || edge2.target == self2)) throw "Incorrect edge source and/or target";
                  if (edge2.target == other || edge2.source == other) {
                    edgeList2.push(edge2);
                  }
                });
                return edgeList2;
              };
              LNode.prototype.getNeighborsList = function() {
                var neighbors = /* @__PURE__ */ new Set();
                var self2 = this;
                self2.edges.forEach(function(edge) {
                  if (edge.source == self2) {
                    neighbors.add(edge.target);
                  } else {
                    if (edge.target != self2) {
                      throw "Incorrect incidency!";
                    }
                    neighbors.add(edge.source);
                  }
                });
                return neighbors;
              };
              LNode.prototype.withChildren = function() {
                var withNeighborsList = /* @__PURE__ */ new Set();
                var childNode;
                var children2;
                withNeighborsList.add(this);
                if (this.child != null) {
                  var nodes5 = this.child.getNodes();
                  for (var i2 = 0; i2 < nodes5.length; i2++) {
                    childNode = nodes5[i2];
                    children2 = childNode.withChildren();
                    children2.forEach(function(node2) {
                      withNeighborsList.add(node2);
                    });
                  }
                }
                return withNeighborsList;
              };
              LNode.prototype.getNoOfChildren = function() {
                var noOfChildren = 0;
                var childNode;
                if (this.child == null) {
                  noOfChildren = 1;
                } else {
                  var nodes5 = this.child.getNodes();
                  for (var i2 = 0; i2 < nodes5.length; i2++) {
                    childNode = nodes5[i2];
                    noOfChildren += childNode.getNoOfChildren();
                  }
                }
                if (noOfChildren == 0) {
                  noOfChildren = 1;
                }
                return noOfChildren;
              };
              LNode.prototype.getEstimatedSize = function() {
                if (this.estimatedSize == Integer.MIN_VALUE) {
                  throw "assert failed";
                }
                return this.estimatedSize;
              };
              LNode.prototype.calcEstimatedSize = function() {
                if (this.child == null) {
                  return this.estimatedSize = (this.rect.width + this.rect.height) / 2;
                } else {
                  this.estimatedSize = this.child.calcEstimatedSize();
                  this.rect.width = this.estimatedSize;
                  this.rect.height = this.estimatedSize;
                  return this.estimatedSize;
                }
              };
              LNode.prototype.scatter = function() {
                var randomCenterX;
                var randomCenterY;
                var minX = -LayoutConstants.INITIAL_WORLD_BOUNDARY;
                var maxX = LayoutConstants.INITIAL_WORLD_BOUNDARY;
                randomCenterX = LayoutConstants.WORLD_CENTER_X + RandomSeed.nextDouble() * (maxX - minX) + minX;
                var minY = -LayoutConstants.INITIAL_WORLD_BOUNDARY;
                var maxY = LayoutConstants.INITIAL_WORLD_BOUNDARY;
                randomCenterY = LayoutConstants.WORLD_CENTER_Y + RandomSeed.nextDouble() * (maxY - minY) + minY;
                this.rect.x = randomCenterX;
                this.rect.y = randomCenterY;
              };
              LNode.prototype.updateBounds = function() {
                if (this.getChild() == null) {
                  throw "assert failed";
                }
                if (this.getChild().getNodes().length != 0) {
                  var childGraph = this.getChild();
                  childGraph.updateBounds(true);
                  this.rect.x = childGraph.getLeft();
                  this.rect.y = childGraph.getTop();
                  this.setWidth(childGraph.getRight() - childGraph.getLeft());
                  this.setHeight(childGraph.getBottom() - childGraph.getTop());
                  if (LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS) {
                    var width3 = childGraph.getRight() - childGraph.getLeft();
                    var height2 = childGraph.getBottom() - childGraph.getTop();
                    if (this.labelWidth) {
                      if (this.labelPosHorizontal == "left") {
                        this.rect.x -= this.labelWidth;
                        this.setWidth(width3 + this.labelWidth);
                      } else if (this.labelPosHorizontal == "center" && this.labelWidth > width3) {
                        this.rect.x -= (this.labelWidth - width3) / 2;
                        this.setWidth(this.labelWidth);
                      } else if (this.labelPosHorizontal == "right") {
                        this.setWidth(width3 + this.labelWidth);
                      }
                    }
                    if (this.labelHeight) {
                      if (this.labelPosVertical == "top") {
                        this.rect.y -= this.labelHeight;
                        this.setHeight(height2 + this.labelHeight);
                      } else if (this.labelPosVertical == "center" && this.labelHeight > height2) {
                        this.rect.y -= (this.labelHeight - height2) / 2;
                        this.setHeight(this.labelHeight);
                      } else if (this.labelPosVertical == "bottom") {
                        this.setHeight(height2 + this.labelHeight);
                      }
                    }
                  }
                }
              };
              LNode.prototype.getInclusionTreeDepth = function() {
                if (this.inclusionTreeDepth == Integer.MAX_VALUE) {
                  throw "assert failed";
                }
                return this.inclusionTreeDepth;
              };
              LNode.prototype.transform = function(trans) {
                var left3 = this.rect.x;
                if (left3 > LayoutConstants.WORLD_BOUNDARY) {
                  left3 = LayoutConstants.WORLD_BOUNDARY;
                } else if (left3 < -LayoutConstants.WORLD_BOUNDARY) {
                  left3 = -LayoutConstants.WORLD_BOUNDARY;
                }
                var top2 = this.rect.y;
                if (top2 > LayoutConstants.WORLD_BOUNDARY) {
                  top2 = LayoutConstants.WORLD_BOUNDARY;
                } else if (top2 < -LayoutConstants.WORLD_BOUNDARY) {
                  top2 = -LayoutConstants.WORLD_BOUNDARY;
                }
                var leftTop = new PointD(left3, top2);
                var vLeftTop = trans.inverseTransformPoint(leftTop);
                this.setLocation(vLeftTop.x, vLeftTop.y);
              };
              LNode.prototype.getLeft = function() {
                return this.rect.x;
              };
              LNode.prototype.getRight = function() {
                return this.rect.x + this.rect.width;
              };
              LNode.prototype.getTop = function() {
                return this.rect.y;
              };
              LNode.prototype.getBottom = function() {
                return this.rect.y + this.rect.height;
              };
              LNode.prototype.getParent = function() {
                if (this.owner == null) {
                  return null;
                }
                return this.owner.getParent();
              };
              module3.exports = LNode;
            }),
            /* 4 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LayoutConstants = __webpack_require__(0);
              function FDLayoutConstants() {
              }
              __name(FDLayoutConstants, "FDLayoutConstants");
              for (var prop in LayoutConstants) {
                FDLayoutConstants[prop] = LayoutConstants[prop];
              }
              FDLayoutConstants.MAX_ITERATIONS = 2500;
              FDLayoutConstants.DEFAULT_EDGE_LENGTH = 50;
              FDLayoutConstants.DEFAULT_SPRING_STRENGTH = 0.45;
              FDLayoutConstants.DEFAULT_REPULSION_STRENGTH = 4500;
              FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = 0.4;
              FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1;
              FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8;
              FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5;
              FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = true;
              FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = true;
              FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = 0.3;
              FDLayoutConstants.COOLING_ADAPTATION_FACTOR = 0.33;
              FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT = 1e3;
              FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT = 5e3;
              FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100;
              FDLayoutConstants.MAX_NODE_DISPLACEMENT = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3;
              FDLayoutConstants.MIN_REPULSION_DIST = FDLayoutConstants.DEFAULT_EDGE_LENGTH / 10;
              FDLayoutConstants.CONVERGENCE_CHECK_PERIOD = 100;
              FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = 0.1;
              FDLayoutConstants.MIN_EDGE_LENGTH = 1;
              FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD = 10;
              module3.exports = FDLayoutConstants;
            }),
            /* 5 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function PointD(x5, y6) {
                if (x5 == null && y6 == null) {
                  this.x = 0;
                  this.y = 0;
                } else {
                  this.x = x5;
                  this.y = y6;
                }
              }
              __name(PointD, "PointD");
              PointD.prototype.getX = function() {
                return this.x;
              };
              PointD.prototype.getY = function() {
                return this.y;
              };
              PointD.prototype.setX = function(x5) {
                this.x = x5;
              };
              PointD.prototype.setY = function(y6) {
                this.y = y6;
              };
              PointD.prototype.getDifference = function(pt) {
                return new DimensionD(this.x - pt.x, this.y - pt.y);
              };
              PointD.prototype.getCopy = function() {
                return new PointD(this.x, this.y);
              };
              PointD.prototype.translate = function(dim) {
                this.x += dim.width;
                this.y += dim.height;
                return this;
              };
              module3.exports = PointD;
            }),
            /* 6 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LGraphObject = __webpack_require__(2);
              var Integer = __webpack_require__(10);
              var LayoutConstants = __webpack_require__(0);
              var LGraphManager = __webpack_require__(7);
              var LNode = __webpack_require__(3);
              var LEdge = __webpack_require__(1);
              var RectangleD = __webpack_require__(13);
              var Point3 = __webpack_require__(12);
              var LinkedList = __webpack_require__(11);
              function LGraph(parent4, obj2, vGraph) {
                LGraphObject.call(this, vGraph);
                this.estimatedSize = Integer.MIN_VALUE;
                this.margin = LayoutConstants.DEFAULT_GRAPH_MARGIN;
                this.edges = [];
                this.nodes = [];
                this.isConnected = false;
                this.parent = parent4;
                if (obj2 != null && obj2 instanceof LGraphManager) {
                  this.graphManager = obj2;
                } else if (obj2 != null && obj2 instanceof Layout) {
                  this.graphManager = obj2.graphManager;
                }
              }
              __name(LGraph, "LGraph");
              LGraph.prototype = Object.create(LGraphObject.prototype);
              for (var prop in LGraphObject) {
                LGraph[prop] = LGraphObject[prop];
              }
              LGraph.prototype.getNodes = function() {
                return this.nodes;
              };
              LGraph.prototype.getEdges = function() {
                return this.edges;
              };
              LGraph.prototype.getGraphManager = function() {
                return this.graphManager;
              };
              LGraph.prototype.getParent = function() {
                return this.parent;
              };
              LGraph.prototype.getLeft = function() {
                return this.left;
              };
              LGraph.prototype.getRight = function() {
                return this.right;
              };
              LGraph.prototype.getTop = function() {
                return this.top;
              };
              LGraph.prototype.getBottom = function() {
                return this.bottom;
              };
              LGraph.prototype.isConnected = function() {
                return this.isConnected;
              };
              LGraph.prototype.add = function(obj1, sourceNode, targetNode) {
                if (sourceNode == null && targetNode == null) {
                  var newNode = obj1;
                  if (this.graphManager == null) {
                    throw "Graph has no graph mgr!";
                  }
                  if (this.getNodes().indexOf(newNode) > -1) {
                    throw "Node already in graph!";
                  }
                  newNode.owner = this;
                  this.getNodes().push(newNode);
                  return newNode;
                } else {
                  var newEdge = obj1;
                  if (!(this.getNodes().indexOf(sourceNode) > -1 && this.getNodes().indexOf(targetNode) > -1)) {
                    throw "Source or target not in graph!";
                  }
                  if (!(sourceNode.owner == targetNode.owner && sourceNode.owner == this)) {
                    throw "Both owners must be this graph!";
                  }
                  if (sourceNode.owner != targetNode.owner) {
                    return null;
                  }
                  newEdge.source = sourceNode;
                  newEdge.target = targetNode;
                  newEdge.isInterGraph = false;
                  this.getEdges().push(newEdge);
                  sourceNode.edges.push(newEdge);
                  if (targetNode != sourceNode) {
                    targetNode.edges.push(newEdge);
                  }
                  return newEdge;
                }
              };
              LGraph.prototype.remove = function(obj) {
                var node2 = obj;
                if (obj instanceof LNode) {
                  if (node2 == null) {
                    throw "Node is null!";
                  }
                  if (!(node2.owner != null && node2.owner == this)) {
                    throw "Owner graph is invalid!";
                  }
                  if (this.graphManager == null) {
                    throw "Owner graph manager is invalid!";
                  }
                  var edgesToBeRemoved = node2.edges.slice();
                  var edge;
                  var s2 = edgesToBeRemoved.length;
                  for (var i2 = 0; i2 < s2; i2++) {
                    edge = edgesToBeRemoved[i2];
                    if (edge.isInterGraph) {
                      this.graphManager.remove(edge);
                    } else {
                      edge.source.owner.remove(edge);
                    }
                  }
                  var index = this.nodes.indexOf(node2);
                  if (index == -1) {
                    throw "Node not in owner node list!";
                  }
                  this.nodes.splice(index, 1);
                } else if (obj instanceof LEdge) {
                  var edge = obj;
                  if (edge == null) {
                    throw "Edge is null!";
                  }
                  if (!(edge.source != null && edge.target != null)) {
                    throw "Source and/or target is null!";
                  }
                  if (!(edge.source.owner != null && edge.target.owner != null && edge.source.owner == this && edge.target.owner == this)) {
                    throw "Source and/or target owner is invalid!";
                  }
                  var sourceIndex = edge.source.edges.indexOf(edge);
                  var targetIndex = edge.target.edges.indexOf(edge);
                  if (!(sourceIndex > -1 && targetIndex > -1)) {
                    throw "Source and/or target doesn't know this edge!";
                  }
                  edge.source.edges.splice(sourceIndex, 1);
                  if (edge.target != edge.source) {
                    edge.target.edges.splice(targetIndex, 1);
                  }
                  var index = edge.source.owner.getEdges().indexOf(edge);
                  if (index == -1) {
                    throw "Not in owner's edge list!";
                  }
                  edge.source.owner.getEdges().splice(index, 1);
                }
              };
              LGraph.prototype.updateLeftTop = function() {
                var top2 = Integer.MAX_VALUE;
                var left3 = Integer.MAX_VALUE;
                var nodeTop;
                var nodeLeft;
                var margin;
                var nodes5 = this.getNodes();
                var s2 = nodes5.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  var lNode = nodes5[i2];
                  nodeTop = lNode.getTop();
                  nodeLeft = lNode.getLeft();
                  if (top2 > nodeTop) {
                    top2 = nodeTop;
                  }
                  if (left3 > nodeLeft) {
                    left3 = nodeLeft;
                  }
                }
                if (top2 == Integer.MAX_VALUE) {
                  return null;
                }
                if (nodes5[0].getParent().paddingLeft != void 0) {
                  margin = nodes5[0].getParent().paddingLeft;
                } else {
                  margin = this.margin;
                }
                this.left = left3 - margin;
                this.top = top2 - margin;
                return new Point3(this.left, this.top);
              };
              LGraph.prototype.updateBounds = function(recursive) {
                var left3 = Integer.MAX_VALUE;
                var right3 = -Integer.MAX_VALUE;
                var top2 = Integer.MAX_VALUE;
                var bottom2 = -Integer.MAX_VALUE;
                var nodeLeft;
                var nodeRight;
                var nodeTop;
                var nodeBottom;
                var margin;
                var nodes5 = this.nodes;
                var s2 = nodes5.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  var lNode = nodes5[i2];
                  if (recursive && lNode.child != null) {
                    lNode.updateBounds();
                  }
                  nodeLeft = lNode.getLeft();
                  nodeRight = lNode.getRight();
                  nodeTop = lNode.getTop();
                  nodeBottom = lNode.getBottom();
                  if (left3 > nodeLeft) {
                    left3 = nodeLeft;
                  }
                  if (right3 < nodeRight) {
                    right3 = nodeRight;
                  }
                  if (top2 > nodeTop) {
                    top2 = nodeTop;
                  }
                  if (bottom2 < nodeBottom) {
                    bottom2 = nodeBottom;
                  }
                }
                var boundingRect = new RectangleD(left3, top2, right3 - left3, bottom2 - top2);
                if (left3 == Integer.MAX_VALUE) {
                  this.left = this.parent.getLeft();
                  this.right = this.parent.getRight();
                  this.top = this.parent.getTop();
                  this.bottom = this.parent.getBottom();
                }
                if (nodes5[0].getParent().paddingLeft != void 0) {
                  margin = nodes5[0].getParent().paddingLeft;
                } else {
                  margin = this.margin;
                }
                this.left = boundingRect.x - margin;
                this.right = boundingRect.x + boundingRect.width + margin;
                this.top = boundingRect.y - margin;
                this.bottom = boundingRect.y + boundingRect.height + margin;
              };
              LGraph.calculateBounds = function(nodes5) {
                var left3 = Integer.MAX_VALUE;
                var right3 = -Integer.MAX_VALUE;
                var top2 = Integer.MAX_VALUE;
                var bottom2 = -Integer.MAX_VALUE;
                var nodeLeft;
                var nodeRight;
                var nodeTop;
                var nodeBottom;
                var s2 = nodes5.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  var lNode = nodes5[i2];
                  nodeLeft = lNode.getLeft();
                  nodeRight = lNode.getRight();
                  nodeTop = lNode.getTop();
                  nodeBottom = lNode.getBottom();
                  if (left3 > nodeLeft) {
                    left3 = nodeLeft;
                  }
                  if (right3 < nodeRight) {
                    right3 = nodeRight;
                  }
                  if (top2 > nodeTop) {
                    top2 = nodeTop;
                  }
                  if (bottom2 < nodeBottom) {
                    bottom2 = nodeBottom;
                  }
                }
                var boundingRect = new RectangleD(left3, top2, right3 - left3, bottom2 - top2);
                return boundingRect;
              };
              LGraph.prototype.getInclusionTreeDepth = function() {
                if (this == this.graphManager.getRoot()) {
                  return 1;
                } else {
                  return this.parent.getInclusionTreeDepth();
                }
              };
              LGraph.prototype.getEstimatedSize = function() {
                if (this.estimatedSize == Integer.MIN_VALUE) {
                  throw "assert failed";
                }
                return this.estimatedSize;
              };
              LGraph.prototype.calcEstimatedSize = function() {
                var size4 = 0;
                var nodes5 = this.nodes;
                var s2 = nodes5.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  var lNode = nodes5[i2];
                  size4 += lNode.calcEstimatedSize();
                }
                if (size4 == 0) {
                  this.estimatedSize = LayoutConstants.EMPTY_COMPOUND_NODE_SIZE;
                } else {
                  this.estimatedSize = size4 / Math.sqrt(this.nodes.length);
                }
                return this.estimatedSize;
              };
              LGraph.prototype.updateConnected = function() {
                var self2 = this;
                if (this.nodes.length == 0) {
                  this.isConnected = true;
                  return;
                }
                var queue = new LinkedList();
                var visited = /* @__PURE__ */ new Set();
                var currentNode = this.nodes[0];
                var neighborEdges;
                var currentNeighbor;
                var childrenOfNode = currentNode.withChildren();
                childrenOfNode.forEach(function(node2) {
                  queue.push(node2);
                  visited.add(node2);
                });
                while (queue.length !== 0) {
                  currentNode = queue.shift();
                  neighborEdges = currentNode.getEdges();
                  var size4 = neighborEdges.length;
                  for (var i2 = 0; i2 < size4; i2++) {
                    var neighborEdge = neighborEdges[i2];
                    currentNeighbor = neighborEdge.getOtherEndInGraph(currentNode, this);
                    if (currentNeighbor != null && !visited.has(currentNeighbor)) {
                      var childrenOfNeighbor = currentNeighbor.withChildren();
                      childrenOfNeighbor.forEach(function(node2) {
                        queue.push(node2);
                        visited.add(node2);
                      });
                    }
                  }
                }
                this.isConnected = false;
                if (visited.size >= this.nodes.length) {
                  var noOfVisitedInThisGraph = 0;
                  visited.forEach(function(visitedNode) {
                    if (visitedNode.owner == self2) {
                      noOfVisitedInThisGraph++;
                    }
                  });
                  if (noOfVisitedInThisGraph == this.nodes.length) {
                    this.isConnected = true;
                  }
                }
              };
              module3.exports = LGraph;
            }),
            /* 7 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LGraph;
              var LEdge = __webpack_require__(1);
              function LGraphManager(layout7) {
                LGraph = __webpack_require__(6);
                this.layout = layout7;
                this.graphs = [];
                this.edges = [];
              }
              __name(LGraphManager, "LGraphManager");
              LGraphManager.prototype.addRoot = function() {
                var ngraph = this.layout.newGraph();
                var nnode = this.layout.newNode(null);
                var root3 = this.add(ngraph, nnode);
                this.setRootGraph(root3);
                return this.rootGraph;
              };
              LGraphManager.prototype.add = function(newGraph, parentNode, newEdge, sourceNode, targetNode) {
                if (newEdge == null && sourceNode == null && targetNode == null) {
                  if (newGraph == null) {
                    throw "Graph is null!";
                  }
                  if (parentNode == null) {
                    throw "Parent node is null!";
                  }
                  if (this.graphs.indexOf(newGraph) > -1) {
                    throw "Graph already in this graph mgr!";
                  }
                  this.graphs.push(newGraph);
                  if (newGraph.parent != null) {
                    throw "Already has a parent!";
                  }
                  if (parentNode.child != null) {
                    throw "Already has a child!";
                  }
                  newGraph.parent = parentNode;
                  parentNode.child = newGraph;
                  return newGraph;
                } else {
                  targetNode = newEdge;
                  sourceNode = parentNode;
                  newEdge = newGraph;
                  var sourceGraph = sourceNode.getOwner();
                  var targetGraph = targetNode.getOwner();
                  if (!(sourceGraph != null && sourceGraph.getGraphManager() == this)) {
                    throw "Source not in this graph mgr!";
                  }
                  if (!(targetGraph != null && targetGraph.getGraphManager() == this)) {
                    throw "Target not in this graph mgr!";
                  }
                  if (sourceGraph == targetGraph) {
                    newEdge.isInterGraph = false;
                    return sourceGraph.add(newEdge, sourceNode, targetNode);
                  } else {
                    newEdge.isInterGraph = true;
                    newEdge.source = sourceNode;
                    newEdge.target = targetNode;
                    if (this.edges.indexOf(newEdge) > -1) {
                      throw "Edge already in inter-graph edge list!";
                    }
                    this.edges.push(newEdge);
                    if (!(newEdge.source != null && newEdge.target != null)) {
                      throw "Edge source and/or target is null!";
                    }
                    if (!(newEdge.source.edges.indexOf(newEdge) == -1 && newEdge.target.edges.indexOf(newEdge) == -1)) {
                      throw "Edge already in source and/or target incidency list!";
                    }
                    newEdge.source.edges.push(newEdge);
                    newEdge.target.edges.push(newEdge);
                    return newEdge;
                  }
                }
              };
              LGraphManager.prototype.remove = function(lObj) {
                if (lObj instanceof LGraph) {
                  var graph = lObj;
                  if (graph.getGraphManager() != this) {
                    throw "Graph not in this graph mgr";
                  }
                  if (!(graph == this.rootGraph || graph.parent != null && graph.parent.graphManager == this)) {
                    throw "Invalid parent node!";
                  }
                  var edgesToBeRemoved = [];
                  edgesToBeRemoved = edgesToBeRemoved.concat(graph.getEdges());
                  var edge;
                  var s2 = edgesToBeRemoved.length;
                  for (var i2 = 0; i2 < s2; i2++) {
                    edge = edgesToBeRemoved[i2];
                    graph.remove(edge);
                  }
                  var nodesToBeRemoved = [];
                  nodesToBeRemoved = nodesToBeRemoved.concat(graph.getNodes());
                  var node2;
                  s2 = nodesToBeRemoved.length;
                  for (var i2 = 0; i2 < s2; i2++) {
                    node2 = nodesToBeRemoved[i2];
                    graph.remove(node2);
                  }
                  if (graph == this.rootGraph) {
                    this.setRootGraph(null);
                  }
                  var index = this.graphs.indexOf(graph);
                  this.graphs.splice(index, 1);
                  graph.parent = null;
                } else if (lObj instanceof LEdge) {
                  edge = lObj;
                  if (edge == null) {
                    throw "Edge is null!";
                  }
                  if (!edge.isInterGraph) {
                    throw "Not an inter-graph edge!";
                  }
                  if (!(edge.source != null && edge.target != null)) {
                    throw "Source and/or target is null!";
                  }
                  if (!(edge.source.edges.indexOf(edge) != -1 && edge.target.edges.indexOf(edge) != -1)) {
                    throw "Source and/or target doesn't know this edge!";
                  }
                  var index = edge.source.edges.indexOf(edge);
                  edge.source.edges.splice(index, 1);
                  index = edge.target.edges.indexOf(edge);
                  edge.target.edges.splice(index, 1);
                  if (!(edge.source.owner != null && edge.source.owner.getGraphManager() != null)) {
                    throw "Edge owner graph or owner graph manager is null!";
                  }
                  if (edge.source.owner.getGraphManager().edges.indexOf(edge) == -1) {
                    throw "Not in owner graph manager's edge list!";
                  }
                  var index = edge.source.owner.getGraphManager().edges.indexOf(edge);
                  edge.source.owner.getGraphManager().edges.splice(index, 1);
                }
              };
              LGraphManager.prototype.updateBounds = function() {
                this.rootGraph.updateBounds(true);
              };
              LGraphManager.prototype.getGraphs = function() {
                return this.graphs;
              };
              LGraphManager.prototype.getAllNodes = function() {
                if (this.allNodes == null) {
                  var nodeList = [];
                  var graphs = this.getGraphs();
                  var s2 = graphs.length;
                  for (var i2 = 0; i2 < s2; i2++) {
                    nodeList = nodeList.concat(graphs[i2].getNodes());
                  }
                  this.allNodes = nodeList;
                }
                return this.allNodes;
              };
              LGraphManager.prototype.resetAllNodes = function() {
                this.allNodes = null;
              };
              LGraphManager.prototype.resetAllEdges = function() {
                this.allEdges = null;
              };
              LGraphManager.prototype.resetAllNodesToApplyGravitation = function() {
                this.allNodesToApplyGravitation = null;
              };
              LGraphManager.prototype.getAllEdges = function() {
                if (this.allEdges == null) {
                  var edgeList2 = [];
                  var graphs = this.getGraphs();
                  var s2 = graphs.length;
                  for (var i2 = 0; i2 < graphs.length; i2++) {
                    edgeList2 = edgeList2.concat(graphs[i2].getEdges());
                  }
                  edgeList2 = edgeList2.concat(this.edges);
                  this.allEdges = edgeList2;
                }
                return this.allEdges;
              };
              LGraphManager.prototype.getAllNodesToApplyGravitation = function() {
                return this.allNodesToApplyGravitation;
              };
              LGraphManager.prototype.setAllNodesToApplyGravitation = function(nodeList) {
                if (this.allNodesToApplyGravitation != null) {
                  throw "assert failed";
                }
                this.allNodesToApplyGravitation = nodeList;
              };
              LGraphManager.prototype.getRoot = function() {
                return this.rootGraph;
              };
              LGraphManager.prototype.setRootGraph = function(graph) {
                if (graph.getGraphManager() != this) {
                  throw "Root not in this graph mgr!";
                }
                this.rootGraph = graph;
                if (graph.parent == null) {
                  graph.parent = this.layout.newNode("Root node");
                }
              };
              LGraphManager.prototype.getLayout = function() {
                return this.layout;
              };
              LGraphManager.prototype.isOneAncestorOfOther = function(firstNode, secondNode) {
                if (!(firstNode != null && secondNode != null)) {
                  throw "assert failed";
                }
                if (firstNode == secondNode) {
                  return true;
                }
                var ownerGraph = firstNode.getOwner();
                var parentNode;
                do {
                  parentNode = ownerGraph.getParent();
                  if (parentNode == null) {
                    break;
                  }
                  if (parentNode == secondNode) {
                    return true;
                  }
                  ownerGraph = parentNode.getOwner();
                  if (ownerGraph == null) {
                    break;
                  }
                } while (true);
                ownerGraph = secondNode.getOwner();
                do {
                  parentNode = ownerGraph.getParent();
                  if (parentNode == null) {
                    break;
                  }
                  if (parentNode == firstNode) {
                    return true;
                  }
                  ownerGraph = parentNode.getOwner();
                  if (ownerGraph == null) {
                    break;
                  }
                } while (true);
                return false;
              };
              LGraphManager.prototype.calcLowestCommonAncestors = function() {
                var edge;
                var sourceNode;
                var targetNode;
                var sourceAncestorGraph;
                var targetAncestorGraph;
                var edges3 = this.getAllEdges();
                var s2 = edges3.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  edge = edges3[i2];
                  sourceNode = edge.source;
                  targetNode = edge.target;
                  edge.lca = null;
                  edge.sourceInLca = sourceNode;
                  edge.targetInLca = targetNode;
                  if (sourceNode == targetNode) {
                    edge.lca = sourceNode.getOwner();
                    continue;
                  }
                  sourceAncestorGraph = sourceNode.getOwner();
                  while (edge.lca == null) {
                    edge.targetInLca = targetNode;
                    targetAncestorGraph = targetNode.getOwner();
                    while (edge.lca == null) {
                      if (targetAncestorGraph == sourceAncestorGraph) {
                        edge.lca = targetAncestorGraph;
                        break;
                      }
                      if (targetAncestorGraph == this.rootGraph) {
                        break;
                      }
                      if (edge.lca != null) {
                        throw "assert failed";
                      }
                      edge.targetInLca = targetAncestorGraph.getParent();
                      targetAncestorGraph = edge.targetInLca.getOwner();
                    }
                    if (sourceAncestorGraph == this.rootGraph) {
                      break;
                    }
                    if (edge.lca == null) {
                      edge.sourceInLca = sourceAncestorGraph.getParent();
                      sourceAncestorGraph = edge.sourceInLca.getOwner();
                    }
                  }
                  if (edge.lca == null) {
                    throw "assert failed";
                  }
                }
              };
              LGraphManager.prototype.calcLowestCommonAncestor = function(firstNode, secondNode) {
                if (firstNode == secondNode) {
                  return firstNode.getOwner();
                }
                var firstOwnerGraph = firstNode.getOwner();
                do {
                  if (firstOwnerGraph == null) {
                    break;
                  }
                  var secondOwnerGraph = secondNode.getOwner();
                  do {
                    if (secondOwnerGraph == null) {
                      break;
                    }
                    if (secondOwnerGraph == firstOwnerGraph) {
                      return secondOwnerGraph;
                    }
                    secondOwnerGraph = secondOwnerGraph.getParent().getOwner();
                  } while (true);
                  firstOwnerGraph = firstOwnerGraph.getParent().getOwner();
                } while (true);
                return firstOwnerGraph;
              };
              LGraphManager.prototype.calcInclusionTreeDepths = function(graph, depth) {
                if (graph == null && depth == null) {
                  graph = this.rootGraph;
                  depth = 1;
                }
                var node2;
                var nodes5 = graph.getNodes();
                var s2 = nodes5.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  node2 = nodes5[i2];
                  node2.inclusionTreeDepth = depth;
                  if (node2.child != null) {
                    this.calcInclusionTreeDepths(node2.child, depth + 1);
                  }
                }
              };
              LGraphManager.prototype.includesInvalidEdge = function() {
                var edge;
                var edgesToRemove = [];
                var s2 = this.edges.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  edge = this.edges[i2];
                  if (this.isOneAncestorOfOther(edge.source, edge.target)) {
                    edgesToRemove.push(edge);
                  }
                }
                for (var i2 = 0; i2 < edgesToRemove.length; i2++) {
                  this.remove(edgesToRemove[i2]);
                }
                return false;
              };
              module3.exports = LGraphManager;
            }),
            /* 8 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var Point3 = __webpack_require__(12);
              function IGeometry() {
              }
              __name(IGeometry, "IGeometry");
              IGeometry.calcSeparationAmount = function(rectA, rectB, overlapAmount, separationBuffer) {
                if (!rectA.intersects(rectB)) {
                  throw "assert failed";
                }
                var directions = new Array(2);
                this.decideDirectionsForOverlappingNodes(rectA, rectB, directions);
                overlapAmount[0] = Math.min(rectA.getRight(), rectB.getRight()) - Math.max(rectA.x, rectB.x);
                overlapAmount[1] = Math.min(rectA.getBottom(), rectB.getBottom()) - Math.max(rectA.y, rectB.y);
                if (rectA.getX() <= rectB.getX() && rectA.getRight() >= rectB.getRight()) {
                  overlapAmount[0] += Math.min(rectB.getX() - rectA.getX(), rectA.getRight() - rectB.getRight());
                } else if (rectB.getX() <= rectA.getX() && rectB.getRight() >= rectA.getRight()) {
                  overlapAmount[0] += Math.min(rectA.getX() - rectB.getX(), rectB.getRight() - rectA.getRight());
                }
                if (rectA.getY() <= rectB.getY() && rectA.getBottom() >= rectB.getBottom()) {
                  overlapAmount[1] += Math.min(rectB.getY() - rectA.getY(), rectA.getBottom() - rectB.getBottom());
                } else if (rectB.getY() <= rectA.getY() && rectB.getBottom() >= rectA.getBottom()) {
                  overlapAmount[1] += Math.min(rectA.getY() - rectB.getY(), rectB.getBottom() - rectA.getBottom());
                }
                var slope = Math.abs((rectB.getCenterY() - rectA.getCenterY()) / (rectB.getCenterX() - rectA.getCenterX()));
                if (rectB.getCenterY() === rectA.getCenterY() && rectB.getCenterX() === rectA.getCenterX()) {
                  slope = 1;
                }
                var moveByY = slope * overlapAmount[0];
                var moveByX = overlapAmount[1] / slope;
                if (overlapAmount[0] < moveByX) {
                  moveByX = overlapAmount[0];
                } else {
                  moveByY = overlapAmount[1];
                }
                overlapAmount[0] = -1 * directions[0] * (moveByX / 2 + separationBuffer);
                overlapAmount[1] = -1 * directions[1] * (moveByY / 2 + separationBuffer);
              };
              IGeometry.decideDirectionsForOverlappingNodes = function(rectA, rectB, directions) {
                if (rectA.getCenterX() < rectB.getCenterX()) {
                  directions[0] = -1;
                } else {
                  directions[0] = 1;
                }
                if (rectA.getCenterY() < rectB.getCenterY()) {
                  directions[1] = -1;
                } else {
                  directions[1] = 1;
                }
              };
              IGeometry.getIntersection2 = function(rectA, rectB, result) {
                var p1x = rectA.getCenterX();
                var p1y = rectA.getCenterY();
                var p2x = rectB.getCenterX();
                var p2y = rectB.getCenterY();
                if (rectA.intersects(rectB)) {
                  result[0] = p1x;
                  result[1] = p1y;
                  result[2] = p2x;
                  result[3] = p2y;
                  return true;
                }
                var topLeftAx = rectA.getX();
                var topLeftAy = rectA.getY();
                var topRightAx = rectA.getRight();
                var bottomLeftAx = rectA.getX();
                var bottomLeftAy = rectA.getBottom();
                var bottomRightAx = rectA.getRight();
                var halfWidthA = rectA.getWidthHalf();
                var halfHeightA = rectA.getHeightHalf();
                var topLeftBx = rectB.getX();
                var topLeftBy = rectB.getY();
                var topRightBx = rectB.getRight();
                var bottomLeftBx = rectB.getX();
                var bottomLeftBy = rectB.getBottom();
                var bottomRightBx = rectB.getRight();
                var halfWidthB = rectB.getWidthHalf();
                var halfHeightB = rectB.getHeightHalf();
                var clipPointAFound = false;
                var clipPointBFound = false;
                if (p1x === p2x) {
                  if (p1y > p2y) {
                    result[0] = p1x;
                    result[1] = topLeftAy;
                    result[2] = p2x;
                    result[3] = bottomLeftBy;
                    return false;
                  } else if (p1y < p2y) {
                    result[0] = p1x;
                    result[1] = bottomLeftAy;
                    result[2] = p2x;
                    result[3] = topLeftBy;
                    return false;
                  } else {
                  }
                } else if (p1y === p2y) {
                  if (p1x > p2x) {
                    result[0] = topLeftAx;
                    result[1] = p1y;
                    result[2] = topRightBx;
                    result[3] = p2y;
                    return false;
                  } else if (p1x < p2x) {
                    result[0] = topRightAx;
                    result[1] = p1y;
                    result[2] = topLeftBx;
                    result[3] = p2y;
                    return false;
                  } else {
                  }
                } else {
                  var slopeA = rectA.height / rectA.width;
                  var slopeB = rectB.height / rectB.width;
                  var slopePrime = (p2y - p1y) / (p2x - p1x);
                  var cardinalDirectionA = void 0;
                  var cardinalDirectionB = void 0;
                  var tempPointAx = void 0;
                  var tempPointAy = void 0;
                  var tempPointBx = void 0;
                  var tempPointBy = void 0;
                  if (-slopeA === slopePrime) {
                    if (p1x > p2x) {
                      result[0] = bottomLeftAx;
                      result[1] = bottomLeftAy;
                      clipPointAFound = true;
                    } else {
                      result[0] = topRightAx;
                      result[1] = topLeftAy;
                      clipPointAFound = true;
                    }
                  } else if (slopeA === slopePrime) {
                    if (p1x > p2x) {
                      result[0] = topLeftAx;
                      result[1] = topLeftAy;
                      clipPointAFound = true;
                    } else {
                      result[0] = bottomRightAx;
                      result[1] = bottomLeftAy;
                      clipPointAFound = true;
                    }
                  }
                  if (-slopeB === slopePrime) {
                    if (p2x > p1x) {
                      result[2] = bottomLeftBx;
                      result[3] = bottomLeftBy;
                      clipPointBFound = true;
                    } else {
                      result[2] = topRightBx;
                      result[3] = topLeftBy;
                      clipPointBFound = true;
                    }
                  } else if (slopeB === slopePrime) {
                    if (p2x > p1x) {
                      result[2] = topLeftBx;
                      result[3] = topLeftBy;
                      clipPointBFound = true;
                    } else {
                      result[2] = bottomRightBx;
                      result[3] = bottomLeftBy;
                      clipPointBFound = true;
                    }
                  }
                  if (clipPointAFound && clipPointBFound) {
                    return false;
                  }
                  if (p1x > p2x) {
                    if (p1y > p2y) {
                      cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 4);
                      cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 2);
                    } else {
                      cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 3);
                      cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 1);
                    }
                  } else {
                    if (p1y > p2y) {
                      cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 1);
                      cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 3);
                    } else {
                      cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 2);
                      cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 4);
                    }
                  }
                  if (!clipPointAFound) {
                    switch (cardinalDirectionA) {
                      case 1:
                        tempPointAy = topLeftAy;
                        tempPointAx = p1x + -halfHeightA / slopePrime;
                        result[0] = tempPointAx;
                        result[1] = tempPointAy;
                        break;
                      case 2:
                        tempPointAx = bottomRightAx;
                        tempPointAy = p1y + halfWidthA * slopePrime;
                        result[0] = tempPointAx;
                        result[1] = tempPointAy;
                        break;
                      case 3:
                        tempPointAy = bottomLeftAy;
                        tempPointAx = p1x + halfHeightA / slopePrime;
                        result[0] = tempPointAx;
                        result[1] = tempPointAy;
                        break;
                      case 4:
                        tempPointAx = bottomLeftAx;
                        tempPointAy = p1y + -halfWidthA * slopePrime;
                        result[0] = tempPointAx;
                        result[1] = tempPointAy;
                        break;
                    }
                  }
                  if (!clipPointBFound) {
                    switch (cardinalDirectionB) {
                      case 1:
                        tempPointBy = topLeftBy;
                        tempPointBx = p2x + -halfHeightB / slopePrime;
                        result[2] = tempPointBx;
                        result[3] = tempPointBy;
                        break;
                      case 2:
                        tempPointBx = bottomRightBx;
                        tempPointBy = p2y + halfWidthB * slopePrime;
                        result[2] = tempPointBx;
                        result[3] = tempPointBy;
                        break;
                      case 3:
                        tempPointBy = bottomLeftBy;
                        tempPointBx = p2x + halfHeightB / slopePrime;
                        result[2] = tempPointBx;
                        result[3] = tempPointBy;
                        break;
                      case 4:
                        tempPointBx = bottomLeftBx;
                        tempPointBy = p2y + -halfWidthB * slopePrime;
                        result[2] = tempPointBx;
                        result[3] = tempPointBy;
                        break;
                    }
                  }
                }
                return false;
              };
              IGeometry.getCardinalDirection = function(slope, slopePrime, line2) {
                if (slope > slopePrime) {
                  return line2;
                } else {
                  return 1 + line2 % 4;
                }
              };
              IGeometry.getIntersection = function(s1, s2, f1, f2) {
                if (f2 == null) {
                  return this.getIntersection2(s1, s2, f1);
                }
                var x1 = s1.x;
                var y1 = s1.y;
                var x22 = s2.x;
                var y22 = s2.y;
                var x32 = f1.x;
                var y32 = f1.y;
                var x42 = f2.x;
                var y42 = f2.y;
                var x5 = void 0, y6 = void 0;
                var a1 = void 0, a2 = void 0, b1 = void 0, b22 = void 0, c1 = void 0, c22 = void 0;
                var denom = void 0;
                a1 = y22 - y1;
                b1 = x1 - x22;
                c1 = x22 * y1 - x1 * y22;
                a2 = y42 - y32;
                b22 = x32 - x42;
                c22 = x42 * y32 - x32 * y42;
                denom = a1 * b22 - a2 * b1;
                if (denom === 0) {
                  return null;
                }
                x5 = (b1 * c22 - b22 * c1) / denom;
                y6 = (a2 * c1 - a1 * c22) / denom;
                return new Point3(x5, y6);
              };
              IGeometry.angleOfVector = function(Cx, Cy, Nx, Ny) {
                var C_angle = void 0;
                if (Cx !== Nx) {
                  C_angle = Math.atan((Ny - Cy) / (Nx - Cx));
                  if (Nx < Cx) {
                    C_angle += Math.PI;
                  } else if (Ny < Cy) {
                    C_angle += this.TWO_PI;
                  }
                } else if (Ny < Cy) {
                  C_angle = this.ONE_AND_HALF_PI;
                } else {
                  C_angle = this.HALF_PI;
                }
                return C_angle;
              };
              IGeometry.doIntersect = function(p1, p22, p3, p4) {
                var a2 = p1.x;
                var b3 = p1.y;
                var c3 = p22.x;
                var d3 = p22.y;
                var p5 = p3.x;
                var q3 = p3.y;
                var r2 = p4.x;
                var s2 = p4.y;
                var det = (c3 - a2) * (s2 - q3) - (r2 - p5) * (d3 - b3);
                if (det === 0) {
                  return false;
                } else {
                  var lambda = ((s2 - q3) * (r2 - a2) + (p5 - r2) * (s2 - b3)) / det;
                  var gamma2 = ((b3 - d3) * (r2 - a2) + (c3 - a2) * (s2 - b3)) / det;
                  return 0 < lambda && lambda < 1 && 0 < gamma2 && gamma2 < 1;
                }
              };
              IGeometry.findCircleLineIntersections = function(Ex, Ey, Lx, Ly, Cx, Cy, r2) {
                var a2 = (Lx - Ex) * (Lx - Ex) + (Ly - Ey) * (Ly - Ey);
                var b3 = 2 * ((Ex - Cx) * (Lx - Ex) + (Ey - Cy) * (Ly - Ey));
                var c3 = (Ex - Cx) * (Ex - Cx) + (Ey - Cy) * (Ey - Cy) - r2 * r2;
                var disc = b3 * b3 - 4 * a2 * c3;
                if (disc >= 0) {
                  var t13 = (-b3 + Math.sqrt(b3 * b3 - 4 * a2 * c3)) / (2 * a2);
                  var t22 = (-b3 - Math.sqrt(b3 * b3 - 4 * a2 * c3)) / (2 * a2);
                  var intersections = null;
                  if (t13 >= 0 && t13 <= 1) {
                    return [t13];
                  }
                  if (t22 >= 0 && t22 <= 1) {
                    return [t22];
                  }
                  return intersections;
                } else return null;
              };
              IGeometry.HALF_PI = 0.5 * Math.PI;
              IGeometry.ONE_AND_HALF_PI = 1.5 * Math.PI;
              IGeometry.TWO_PI = 2 * Math.PI;
              IGeometry.THREE_PI = 3 * Math.PI;
              module3.exports = IGeometry;
            }),
            /* 9 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function IMath() {
              }
              __name(IMath, "IMath");
              IMath.sign = function(value2) {
                if (value2 > 0) {
                  return 1;
                } else if (value2 < 0) {
                  return -1;
                } else {
                  return 0;
                }
              };
              IMath.floor = function(value2) {
                return value2 < 0 ? Math.ceil(value2) : Math.floor(value2);
              };
              IMath.ceil = function(value2) {
                return value2 < 0 ? Math.floor(value2) : Math.ceil(value2);
              };
              module3.exports = IMath;
            }),
            /* 10 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function Integer() {
              }
              __name(Integer, "Integer");
              Integer.MAX_VALUE = 2147483647;
              Integer.MIN_VALUE = -2147483648;
              module3.exports = Integer;
            }),
            /* 11 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var _createClass2 = /* @__PURE__ */ (function() {
                function defineProperties(target, props) {
                  for (var i2 = 0; i2 < props.length; i2++) {
                    var descriptor = props[i2];
                    descriptor.enumerable = descriptor.enumerable || false;
                    descriptor.configurable = true;
                    if ("value" in descriptor) descriptor.writable = true;
                    Object.defineProperty(target, descriptor.key, descriptor);
                  }
                }
                __name(defineProperties, "defineProperties");
                return function(Constructor, protoProps, staticProps) {
                  if (protoProps) defineProperties(Constructor.prototype, protoProps);
                  if (staticProps) defineProperties(Constructor, staticProps);
                  return Constructor;
                };
              })();
              function _classCallCheck2(instance2, Constructor) {
                if (!(instance2 instanceof Constructor)) {
                  throw new TypeError("Cannot call a class as a function");
                }
              }
              __name(_classCallCheck2, "_classCallCheck");
              var nodeFrom = /* @__PURE__ */ __name(function nodeFrom2(value2) {
                return { value: value2, next: null, prev: null };
              }, "nodeFrom");
              var add3 = /* @__PURE__ */ __name(function add4(prev2, node2, next3, list) {
                if (prev2 !== null) {
                  prev2.next = node2;
                } else {
                  list.head = node2;
                }
                if (next3 !== null) {
                  next3.prev = node2;
                } else {
                  list.tail = node2;
                }
                node2.prev = prev2;
                node2.next = next3;
                list.length++;
                return node2;
              }, "add");
              var _remove = /* @__PURE__ */ __name(function _remove2(node2, list) {
                var prev2 = node2.prev, next3 = node2.next;
                if (prev2 !== null) {
                  prev2.next = next3;
                } else {
                  list.head = next3;
                }
                if (next3 !== null) {
                  next3.prev = prev2;
                } else {
                  list.tail = prev2;
                }
                node2.prev = node2.next = null;
                list.length--;
                return node2;
              }, "_remove");
              var LinkedList = (function() {
                function LinkedList2(vals) {
                  var _this = this;
                  _classCallCheck2(this, LinkedList2);
                  this.length = 0;
                  this.head = null;
                  this.tail = null;
                  if (vals != null) {
                    vals.forEach(function(v3) {
                      return _this.push(v3);
                    });
                  }
                }
                __name(LinkedList2, "LinkedList");
                _createClass2(LinkedList2, [{
                  key: "size",
                  value: /* @__PURE__ */ __name(function size4() {
                    return this.length;
                  }, "size")
                }, {
                  key: "insertBefore",
                  value: /* @__PURE__ */ __name(function insertBefore(val, otherNode) {
                    return add3(otherNode.prev, nodeFrom(val), otherNode, this);
                  }, "insertBefore")
                }, {
                  key: "insertAfter",
                  value: /* @__PURE__ */ __name(function insertAfter(val, otherNode) {
                    return add3(otherNode, nodeFrom(val), otherNode.next, this);
                  }, "insertAfter")
                }, {
                  key: "insertNodeBefore",
                  value: /* @__PURE__ */ __name(function insertNodeBefore(newNode, otherNode) {
                    return add3(otherNode.prev, newNode, otherNode, this);
                  }, "insertNodeBefore")
                }, {
                  key: "insertNodeAfter",
                  value: /* @__PURE__ */ __name(function insertNodeAfter(newNode, otherNode) {
                    return add3(otherNode, newNode, otherNode.next, this);
                  }, "insertNodeAfter")
                }, {
                  key: "push",
                  value: /* @__PURE__ */ __name(function push3(val) {
                    return add3(this.tail, nodeFrom(val), null, this);
                  }, "push")
                }, {
                  key: "unshift",
                  value: /* @__PURE__ */ __name(function unshift(val) {
                    return add3(null, nodeFrom(val), this.head, this);
                  }, "unshift")
                }, {
                  key: "remove",
                  value: /* @__PURE__ */ __name(function remove3(node2) {
                    return _remove(node2, this);
                  }, "remove")
                }, {
                  key: "pop",
                  value: /* @__PURE__ */ __name(function pop() {
                    return _remove(this.tail, this).value;
                  }, "pop")
                }, {
                  key: "popNode",
                  value: /* @__PURE__ */ __name(function popNode() {
                    return _remove(this.tail, this);
                  }, "popNode")
                }, {
                  key: "shift",
                  value: /* @__PURE__ */ __name(function shift2() {
                    return _remove(this.head, this).value;
                  }, "shift")
                }, {
                  key: "shiftNode",
                  value: /* @__PURE__ */ __name(function shiftNode() {
                    return _remove(this.head, this);
                  }, "shiftNode")
                }, {
                  key: "get_object_at",
                  value: /* @__PURE__ */ __name(function get_object_at(index) {
                    if (index <= this.length()) {
                      var i2 = 1;
                      var current = this.head;
                      while (i2 < index) {
                        current = current.next;
                        i2++;
                      }
                      return current.value;
                    }
                  }, "get_object_at")
                }, {
                  key: "set_object_at",
                  value: /* @__PURE__ */ __name(function set_object_at(index, value2) {
                    if (index <= this.length()) {
                      var i2 = 1;
                      var current = this.head;
                      while (i2 < index) {
                        current = current.next;
                        i2++;
                      }
                      current.value = value2;
                    }
                  }, "set_object_at")
                }]);
                return LinkedList2;
              })();
              module3.exports = LinkedList;
            }),
            /* 12 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function Point3(x5, y6, p3) {
                this.x = null;
                this.y = null;
                if (x5 == null && y6 == null && p3 == null) {
                  this.x = 0;
                  this.y = 0;
                } else if (typeof x5 == "number" && typeof y6 == "number" && p3 == null) {
                  this.x = x5;
                  this.y = y6;
                } else if (x5.constructor.name == "Point" && y6 == null && p3 == null) {
                  p3 = x5;
                  this.x = p3.x;
                  this.y = p3.y;
                }
              }
              __name(Point3, "Point");
              Point3.prototype.getX = function() {
                return this.x;
              };
              Point3.prototype.getY = function() {
                return this.y;
              };
              Point3.prototype.getLocation = function() {
                return new Point3(this.x, this.y);
              };
              Point3.prototype.setLocation = function(x5, y6, p3) {
                if (x5.constructor.name == "Point" && y6 == null && p3 == null) {
                  p3 = x5;
                  this.setLocation(p3.x, p3.y);
                } else if (typeof x5 == "number" && typeof y6 == "number" && p3 == null) {
                  if (parseInt(x5) == x5 && parseInt(y6) == y6) {
                    this.move(x5, y6);
                  } else {
                    this.x = Math.floor(x5 + 0.5);
                    this.y = Math.floor(y6 + 0.5);
                  }
                }
              };
              Point3.prototype.move = function(x5, y6) {
                this.x = x5;
                this.y = y6;
              };
              Point3.prototype.translate = function(dx, dy) {
                this.x += dx;
                this.y += dy;
              };
              Point3.prototype.equals = function(obj) {
                if (obj.constructor.name == "Point") {
                  var pt = obj;
                  return this.x == pt.x && this.y == pt.y;
                }
                return this == obj;
              };
              Point3.prototype.toString = function() {
                return new Point3().constructor.name + "[x=" + this.x + ",y=" + this.y + "]";
              };
              module3.exports = Point3;
            }),
            /* 13 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function RectangleD(x5, y6, width3, height2) {
                this.x = 0;
                this.y = 0;
                this.width = 0;
                this.height = 0;
                if (x5 != null && y6 != null && width3 != null && height2 != null) {
                  this.x = x5;
                  this.y = y6;
                  this.width = width3;
                  this.height = height2;
                }
              }
              __name(RectangleD, "RectangleD");
              RectangleD.prototype.getX = function() {
                return this.x;
              };
              RectangleD.prototype.setX = function(x5) {
                this.x = x5;
              };
              RectangleD.prototype.getY = function() {
                return this.y;
              };
              RectangleD.prototype.setY = function(y6) {
                this.y = y6;
              };
              RectangleD.prototype.getWidth = function() {
                return this.width;
              };
              RectangleD.prototype.setWidth = function(width3) {
                this.width = width3;
              };
              RectangleD.prototype.getHeight = function() {
                return this.height;
              };
              RectangleD.prototype.setHeight = function(height2) {
                this.height = height2;
              };
              RectangleD.prototype.getRight = function() {
                return this.x + this.width;
              };
              RectangleD.prototype.getBottom = function() {
                return this.y + this.height;
              };
              RectangleD.prototype.intersects = function(a2) {
                if (this.getRight() < a2.x) {
                  return false;
                }
                if (this.getBottom() < a2.y) {
                  return false;
                }
                if (a2.getRight() < this.x) {
                  return false;
                }
                if (a2.getBottom() < this.y) {
                  return false;
                }
                return true;
              };
              RectangleD.prototype.getCenterX = function() {
                return this.x + this.width / 2;
              };
              RectangleD.prototype.getMinX = function() {
                return this.getX();
              };
              RectangleD.prototype.getMaxX = function() {
                return this.getX() + this.width;
              };
              RectangleD.prototype.getCenterY = function() {
                return this.y + this.height / 2;
              };
              RectangleD.prototype.getMinY = function() {
                return this.getY();
              };
              RectangleD.prototype.getMaxY = function() {
                return this.getY() + this.height;
              };
              RectangleD.prototype.getWidthHalf = function() {
                return this.width / 2;
              };
              RectangleD.prototype.getHeightHalf = function() {
                return this.height / 2;
              };
              module3.exports = RectangleD;
            }),
            /* 14 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
                return typeof obj;
              } : function(obj) {
                return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
              };
              function UniqueIDGeneretor() {
              }
              __name(UniqueIDGeneretor, "UniqueIDGeneretor");
              UniqueIDGeneretor.lastID = 0;
              UniqueIDGeneretor.createID = function(obj) {
                if (UniqueIDGeneretor.isPrimitive(obj)) {
                  return obj;
                }
                if (obj.uniqueID != null) {
                  return obj.uniqueID;
                }
                obj.uniqueID = UniqueIDGeneretor.getString();
                UniqueIDGeneretor.lastID++;
                return obj.uniqueID;
              };
              UniqueIDGeneretor.getString = function(id34) {
                if (id34 == null) id34 = UniqueIDGeneretor.lastID;
                return "Object#" + id34;
              };
              UniqueIDGeneretor.isPrimitive = function(arg) {
                var type3 = typeof arg === "undefined" ? "undefined" : _typeof2(arg);
                return arg == null || type3 != "object" && type3 != "function";
              };
              module3.exports = UniqueIDGeneretor;
            }),
            /* 15 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function _toConsumableArray2(arr) {
                if (Array.isArray(arr)) {
                  for (var i2 = 0, arr2 = Array(arr.length); i2 < arr.length; i2++) {
                    arr2[i2] = arr[i2];
                  }
                  return arr2;
                } else {
                  return Array.from(arr);
                }
              }
              __name(_toConsumableArray2, "_toConsumableArray");
              var LayoutConstants = __webpack_require__(0);
              var LGraphManager = __webpack_require__(7);
              var LNode = __webpack_require__(3);
              var LEdge = __webpack_require__(1);
              var LGraph = __webpack_require__(6);
              var PointD = __webpack_require__(5);
              var Transform2 = __webpack_require__(17);
              var Emitter4 = __webpack_require__(29);
              function Layout2(isRemoteUse) {
                Emitter4.call(this);
                this.layoutQuality = LayoutConstants.QUALITY;
                this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED;
                this.incremental = LayoutConstants.DEFAULT_INCREMENTAL;
                this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT;
                this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT;
                this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD;
                this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES;
                this.edgeToDummyNodes = /* @__PURE__ */ new Map();
                this.graphManager = new LGraphManager(this);
                this.isLayoutFinished = false;
                this.isSubLayout = false;
                this.isRemoteUse = false;
                if (isRemoteUse != null) {
                  this.isRemoteUse = isRemoteUse;
                }
              }
              __name(Layout2, "Layout");
              Layout2.RANDOM_SEED = 1;
              Layout2.prototype = Object.create(Emitter4.prototype);
              Layout2.prototype.getGraphManager = function() {
                return this.graphManager;
              };
              Layout2.prototype.getAllNodes = function() {
                return this.graphManager.getAllNodes();
              };
              Layout2.prototype.getAllEdges = function() {
                return this.graphManager.getAllEdges();
              };
              Layout2.prototype.getAllNodesToApplyGravitation = function() {
                return this.graphManager.getAllNodesToApplyGravitation();
              };
              Layout2.prototype.newGraphManager = function() {
                var gm = new LGraphManager(this);
                this.graphManager = gm;
                return gm;
              };
              Layout2.prototype.newGraph = function(vGraph) {
                return new LGraph(null, this.graphManager, vGraph);
              };
              Layout2.prototype.newNode = function(vNode) {
                return new LNode(this.graphManager, vNode);
              };
              Layout2.prototype.newEdge = function(vEdge) {
                return new LEdge(null, null, vEdge);
              };
              Layout2.prototype.checkLayoutSuccess = function() {
                return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge();
              };
              Layout2.prototype.runLayout = function() {
                this.isLayoutFinished = false;
                if (this.tilingPreLayout) {
                  this.tilingPreLayout();
                }
                this.initParameters();
                var isLayoutSuccessfull;
                if (this.checkLayoutSuccess()) {
                  isLayoutSuccessfull = false;
                } else {
                  isLayoutSuccessfull = this.layout();
                }
                if (LayoutConstants.ANIMATE === "during") {
                  return false;
                }
                if (isLayoutSuccessfull) {
                  if (!this.isSubLayout) {
                    this.doPostLayout();
                  }
                }
                if (this.tilingPostLayout) {
                  this.tilingPostLayout();
                }
                this.isLayoutFinished = true;
                return isLayoutSuccessfull;
              };
              Layout2.prototype.doPostLayout = function() {
                if (!this.incremental) {
                  this.transform();
                }
                this.update();
              };
              Layout2.prototype.update2 = function() {
                if (this.createBendsAsNeeded) {
                  this.createBendpointsFromDummyNodes();
                  this.graphManager.resetAllEdges();
                }
                if (!this.isRemoteUse) {
                  var edge;
                  var allEdges = this.graphManager.getAllEdges();
                  for (var i2 = 0; i2 < allEdges.length; i2++) {
                    edge = allEdges[i2];
                  }
                  var node2;
                  var nodes5 = this.graphManager.getRoot().getNodes();
                  for (var i2 = 0; i2 < nodes5.length; i2++) {
                    node2 = nodes5[i2];
                  }
                  this.update(this.graphManager.getRoot());
                }
              };
              Layout2.prototype.update = function(obj) {
                if (obj == null) {
                  this.update2();
                } else if (obj instanceof LNode) {
                  var node2 = obj;
                  if (node2.getChild() != null) {
                    var nodes5 = node2.getChild().getNodes();
                    for (var i2 = 0; i2 < nodes5.length; i2++) {
                      update(nodes5[i2]);
                    }
                  }
                  if (node2.vGraphObject != null) {
                    var vNode = node2.vGraphObject;
                    vNode.update(node2);
                  }
                } else if (obj instanceof LEdge) {
                  var edge = obj;
                  if (edge.vGraphObject != null) {
                    var vEdge = edge.vGraphObject;
                    vEdge.update(edge);
                  }
                } else if (obj instanceof LGraph) {
                  var graph = obj;
                  if (graph.vGraphObject != null) {
                    var vGraph = graph.vGraphObject;
                    vGraph.update(graph);
                  }
                }
              };
              Layout2.prototype.initParameters = function() {
                if (!this.isSubLayout) {
                  this.layoutQuality = LayoutConstants.QUALITY;
                  this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT;
                  this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD;
                  this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT;
                  this.incremental = LayoutConstants.DEFAULT_INCREMENTAL;
                  this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED;
                  this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES;
                }
                if (this.animationDuringLayout) {
                  this.animationOnLayout = false;
                }
              };
              Layout2.prototype.transform = function(newLeftTop) {
                if (newLeftTop == void 0) {
                  this.transform(new PointD(0, 0));
                } else {
                  var trans = new Transform2();
                  var leftTop = this.graphManager.getRoot().updateLeftTop();
                  if (leftTop != null) {
                    trans.setWorldOrgX(newLeftTop.x);
                    trans.setWorldOrgY(newLeftTop.y);
                    trans.setDeviceOrgX(leftTop.x);
                    trans.setDeviceOrgY(leftTop.y);
                    var nodes5 = this.getAllNodes();
                    var node2;
                    for (var i2 = 0; i2 < nodes5.length; i2++) {
                      node2 = nodes5[i2];
                      node2.transform(trans);
                    }
                  }
                }
              };
              Layout2.prototype.positionNodesRandomly = function(graph) {
                if (graph == void 0) {
                  this.positionNodesRandomly(this.getGraphManager().getRoot());
                  this.getGraphManager().getRoot().updateBounds(true);
                } else {
                  var lNode;
                  var childGraph;
                  var nodes5 = graph.getNodes();
                  for (var i2 = 0; i2 < nodes5.length; i2++) {
                    lNode = nodes5[i2];
                    childGraph = lNode.getChild();
                    if (childGraph == null) {
                      lNode.scatter();
                    } else if (childGraph.getNodes().length == 0) {
                      lNode.scatter();
                    } else {
                      this.positionNodesRandomly(childGraph);
                      lNode.updateBounds();
                    }
                  }
                }
              };
              Layout2.prototype.getFlatForest = function() {
                var flatForest = [];
                var isForest = true;
                var allNodes = this.graphManager.getRoot().getNodes();
                var isFlat = true;
                for (var i2 = 0; i2 < allNodes.length; i2++) {
                  if (allNodes[i2].getChild() != null) {
                    isFlat = false;
                  }
                }
                if (!isFlat) {
                  return flatForest;
                }
                var visited = /* @__PURE__ */ new Set();
                var toBeVisited = [];
                var parents3 = /* @__PURE__ */ new Map();
                var unProcessedNodes = [];
                unProcessedNodes = unProcessedNodes.concat(allNodes);
                while (unProcessedNodes.length > 0 && isForest) {
                  toBeVisited.push(unProcessedNodes[0]);
                  while (toBeVisited.length > 0 && isForest) {
                    var currentNode = toBeVisited[0];
                    toBeVisited.splice(0, 1);
                    visited.add(currentNode);
                    var neighborEdges = currentNode.getEdges();
                    for (var i2 = 0; i2 < neighborEdges.length; i2++) {
                      var currentNeighbor = neighborEdges[i2].getOtherEnd(currentNode);
                      if (parents3.get(currentNode) != currentNeighbor) {
                        if (!visited.has(currentNeighbor)) {
                          toBeVisited.push(currentNeighbor);
                          parents3.set(currentNeighbor, currentNode);
                        } else {
                          isForest = false;
                          break;
                        }
                      }
                    }
                  }
                  if (!isForest) {
                    flatForest = [];
                  } else {
                    var temp = [].concat(_toConsumableArray2(visited));
                    flatForest.push(temp);
                    for (var i2 = 0; i2 < temp.length; i2++) {
                      var value2 = temp[i2];
                      var index = unProcessedNodes.indexOf(value2);
                      if (index > -1) {
                        unProcessedNodes.splice(index, 1);
                      }
                    }
                    visited = /* @__PURE__ */ new Set();
                    parents3 = /* @__PURE__ */ new Map();
                  }
                }
                return flatForest;
              };
              Layout2.prototype.createDummyNodesForBendpoints = function(edge) {
                var dummyNodes = [];
                var prev2 = edge.source;
                var graph = this.graphManager.calcLowestCommonAncestor(edge.source, edge.target);
                for (var i2 = 0; i2 < edge.bendpoints.length; i2++) {
                  var dummyNode = this.newNode(null);
                  dummyNode.setRect(new Point(0, 0), new Dimension(1, 1));
                  graph.add(dummyNode);
                  var dummyEdge = this.newEdge(null);
                  this.graphManager.add(dummyEdge, prev2, dummyNode);
                  dummyNodes.add(dummyNode);
                  prev2 = dummyNode;
                }
                var dummyEdge = this.newEdge(null);
                this.graphManager.add(dummyEdge, prev2, edge.target);
                this.edgeToDummyNodes.set(edge, dummyNodes);
                if (edge.isInterGraph()) {
                  this.graphManager.remove(edge);
                } else {
                  graph.remove(edge);
                }
                return dummyNodes;
              };
              Layout2.prototype.createBendpointsFromDummyNodes = function() {
                var edges3 = [];
                edges3 = edges3.concat(this.graphManager.getAllEdges());
                edges3 = [].concat(_toConsumableArray2(this.edgeToDummyNodes.keys())).concat(edges3);
                for (var k2 = 0; k2 < edges3.length; k2++) {
                  var lEdge = edges3[k2];
                  if (lEdge.bendpoints.length > 0) {
                    var path4 = this.edgeToDummyNodes.get(lEdge);
                    for (var i2 = 0; i2 < path4.length; i2++) {
                      var dummyNode = path4[i2];
                      var p3 = new PointD(dummyNode.getCenterX(), dummyNode.getCenterY());
                      var ebp = lEdge.bendpoints.get(i2);
                      ebp.x = p3.x;
                      ebp.y = p3.y;
                      dummyNode.getOwner().remove(dummyNode);
                    }
                    this.graphManager.add(lEdge, lEdge.source, lEdge.target);
                  }
                }
              };
              Layout2.transform = function(sliderValue, defaultValue, minDiv, maxMul) {
                if (minDiv != void 0 && maxMul != void 0) {
                  var value2 = defaultValue;
                  if (sliderValue <= 50) {
                    var minValue = defaultValue / minDiv;
                    value2 -= (defaultValue - minValue) / 50 * (50 - sliderValue);
                  } else {
                    var maxValue = defaultValue * maxMul;
                    value2 += (maxValue - defaultValue) / 50 * (sliderValue - 50);
                  }
                  return value2;
                } else {
                  var a2, b3;
                  if (sliderValue <= 50) {
                    a2 = 9 * defaultValue / 500;
                    b3 = defaultValue / 10;
                  } else {
                    a2 = 9 * defaultValue / 50;
                    b3 = -8 * defaultValue;
                  }
                  return a2 * sliderValue + b3;
                }
              };
              Layout2.findCenterOfTree = function(nodes5) {
                var list = [];
                list = list.concat(nodes5);
                var removedNodes = [];
                var remainingDegrees = /* @__PURE__ */ new Map();
                var foundCenter = false;
                var centerNode = null;
                if (list.length == 1 || list.length == 2) {
                  foundCenter = true;
                  centerNode = list[0];
                }
                for (var i2 = 0; i2 < list.length; i2++) {
                  var node2 = list[i2];
                  var degree = node2.getNeighborsList().size;
                  remainingDegrees.set(node2, node2.getNeighborsList().size);
                  if (degree == 1) {
                    removedNodes.push(node2);
                  }
                }
                var tempList = [];
                tempList = tempList.concat(removedNodes);
                while (!foundCenter) {
                  var tempList2 = [];
                  tempList2 = tempList2.concat(tempList);
                  tempList = [];
                  for (var i2 = 0; i2 < list.length; i2++) {
                    var node2 = list[i2];
                    var index = list.indexOf(node2);
                    if (index >= 0) {
                      list.splice(index, 1);
                    }
                    var neighbours = node2.getNeighborsList();
                    neighbours.forEach(function(neighbour) {
                      if (removedNodes.indexOf(neighbour) < 0) {
                        var otherDegree = remainingDegrees.get(neighbour);
                        var newDegree = otherDegree - 1;
                        if (newDegree == 1) {
                          tempList.push(neighbour);
                        }
                        remainingDegrees.set(neighbour, newDegree);
                      }
                    });
                  }
                  removedNodes = removedNodes.concat(tempList);
                  if (list.length == 1 || list.length == 2) {
                    foundCenter = true;
                    centerNode = list[0];
                  }
                }
                return centerNode;
              };
              Layout2.prototype.setGraphManager = function(gm) {
                this.graphManager = gm;
              };
              module3.exports = Layout2;
            }),
            /* 16 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function RandomSeed() {
              }
              __name(RandomSeed, "RandomSeed");
              RandomSeed.seed = 1;
              RandomSeed.x = 0;
              RandomSeed.nextDouble = function() {
                RandomSeed.x = Math.sin(RandomSeed.seed++) * 1e4;
                return RandomSeed.x - Math.floor(RandomSeed.x);
              };
              module3.exports = RandomSeed;
            }),
            /* 17 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var PointD = __webpack_require__(5);
              function Transform2(x5, y6) {
                this.lworldOrgX = 0;
                this.lworldOrgY = 0;
                this.ldeviceOrgX = 0;
                this.ldeviceOrgY = 0;
                this.lworldExtX = 1;
                this.lworldExtY = 1;
                this.ldeviceExtX = 1;
                this.ldeviceExtY = 1;
              }
              __name(Transform2, "Transform");
              Transform2.prototype.getWorldOrgX = function() {
                return this.lworldOrgX;
              };
              Transform2.prototype.setWorldOrgX = function(wox) {
                this.lworldOrgX = wox;
              };
              Transform2.prototype.getWorldOrgY = function() {
                return this.lworldOrgY;
              };
              Transform2.prototype.setWorldOrgY = function(woy) {
                this.lworldOrgY = woy;
              };
              Transform2.prototype.getWorldExtX = function() {
                return this.lworldExtX;
              };
              Transform2.prototype.setWorldExtX = function(wex) {
                this.lworldExtX = wex;
              };
              Transform2.prototype.getWorldExtY = function() {
                return this.lworldExtY;
              };
              Transform2.prototype.setWorldExtY = function(wey) {
                this.lworldExtY = wey;
              };
              Transform2.prototype.getDeviceOrgX = function() {
                return this.ldeviceOrgX;
              };
              Transform2.prototype.setDeviceOrgX = function(dox) {
                this.ldeviceOrgX = dox;
              };
              Transform2.prototype.getDeviceOrgY = function() {
                return this.ldeviceOrgY;
              };
              Transform2.prototype.setDeviceOrgY = function(doy) {
                this.ldeviceOrgY = doy;
              };
              Transform2.prototype.getDeviceExtX = function() {
                return this.ldeviceExtX;
              };
              Transform2.prototype.setDeviceExtX = function(dex) {
                this.ldeviceExtX = dex;
              };
              Transform2.prototype.getDeviceExtY = function() {
                return this.ldeviceExtY;
              };
              Transform2.prototype.setDeviceExtY = function(dey) {
                this.ldeviceExtY = dey;
              };
              Transform2.prototype.transformX = function(x5) {
                var xDevice = 0;
                var worldExtX = this.lworldExtX;
                if (worldExtX != 0) {
                  xDevice = this.ldeviceOrgX + (x5 - this.lworldOrgX) * this.ldeviceExtX / worldExtX;
                }
                return xDevice;
              };
              Transform2.prototype.transformY = function(y6) {
                var yDevice = 0;
                var worldExtY = this.lworldExtY;
                if (worldExtY != 0) {
                  yDevice = this.ldeviceOrgY + (y6 - this.lworldOrgY) * this.ldeviceExtY / worldExtY;
                }
                return yDevice;
              };
              Transform2.prototype.inverseTransformX = function(x5) {
                var xWorld = 0;
                var deviceExtX = this.ldeviceExtX;
                if (deviceExtX != 0) {
                  xWorld = this.lworldOrgX + (x5 - this.ldeviceOrgX) * this.lworldExtX / deviceExtX;
                }
                return xWorld;
              };
              Transform2.prototype.inverseTransformY = function(y6) {
                var yWorld = 0;
                var deviceExtY = this.ldeviceExtY;
                if (deviceExtY != 0) {
                  yWorld = this.lworldOrgY + (y6 - this.ldeviceOrgY) * this.lworldExtY / deviceExtY;
                }
                return yWorld;
              };
              Transform2.prototype.inverseTransformPoint = function(inPoint) {
                var outPoint = new PointD(this.inverseTransformX(inPoint.x), this.inverseTransformY(inPoint.y));
                return outPoint;
              };
              module3.exports = Transform2;
            }),
            /* 18 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function _toConsumableArray2(arr) {
                if (Array.isArray(arr)) {
                  for (var i2 = 0, arr2 = Array(arr.length); i2 < arr.length; i2++) {
                    arr2[i2] = arr[i2];
                  }
                  return arr2;
                } else {
                  return Array.from(arr);
                }
              }
              __name(_toConsumableArray2, "_toConsumableArray");
              var Layout2 = __webpack_require__(15);
              var FDLayoutConstants = __webpack_require__(4);
              var LayoutConstants = __webpack_require__(0);
              var IGeometry = __webpack_require__(8);
              var IMath = __webpack_require__(9);
              function FDLayout() {
                Layout2.call(this);
                this.useSmartIdealEdgeLengthCalculation = FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION;
                this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH;
                this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH;
                this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR;
                this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR;
                this.displacementThresholdPerNode = 3 * FDLayoutConstants.DEFAULT_EDGE_LENGTH / 100;
                this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL;
                this.initialCoolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL;
                this.totalDisplacement = 0;
                this.oldTotalDisplacement = 0;
                this.maxIterations = FDLayoutConstants.MAX_ITERATIONS;
              }
              __name(FDLayout, "FDLayout");
              FDLayout.prototype = Object.create(Layout2.prototype);
              for (var prop in Layout2) {
                FDLayout[prop] = Layout2[prop];
              }
              FDLayout.prototype.initParameters = function() {
                Layout2.prototype.initParameters.call(this, arguments);
                this.totalIterations = 0;
                this.notAnimatedIterations = 0;
                this.useFRGridVariant = FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION;
                this.grid = [];
              };
              FDLayout.prototype.calcIdealEdgeLengths = function() {
                var edge;
                var originalIdealLength;
                var lcaDepth;
                var source;
                var target;
                var sizeOfSourceInLca;
                var sizeOfTargetInLca;
                var allEdges = this.getGraphManager().getAllEdges();
                for (var i2 = 0; i2 < allEdges.length; i2++) {
                  edge = allEdges[i2];
                  originalIdealLength = edge.idealLength;
                  if (edge.isInterGraph) {
                    source = edge.getSource();
                    target = edge.getTarget();
                    sizeOfSourceInLca = edge.getSourceInLca().getEstimatedSize();
                    sizeOfTargetInLca = edge.getTargetInLca().getEstimatedSize();
                    if (this.useSmartIdealEdgeLengthCalculation) {
                      edge.idealLength += sizeOfSourceInLca + sizeOfTargetInLca - 2 * LayoutConstants.SIMPLE_NODE_SIZE;
                    }
                    lcaDepth = edge.getLca().getInclusionTreeDepth();
                    edge.idealLength += originalIdealLength * FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (source.getInclusionTreeDepth() + target.getInclusionTreeDepth() - 2 * lcaDepth);
                  }
                }
              };
              FDLayout.prototype.initSpringEmbedder = function() {
                var s2 = this.getAllNodes().length;
                if (this.incremental) {
                  if (s2 > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) {
                    this.coolingFactor = Math.max(this.coolingFactor * FDLayoutConstants.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (s2 - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * this.coolingFactor * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR));
                  }
                  this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL;
                } else {
                  if (s2 > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) {
                    this.coolingFactor = Math.max(FDLayoutConstants.COOLING_ADAPTATION_FACTOR, 1 - (s2 - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR));
                  } else {
                    this.coolingFactor = 1;
                  }
                  this.initialCoolingFactor = this.coolingFactor;
                  this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT;
                }
                this.maxIterations = Math.max(this.getAllNodes().length * 5, this.maxIterations);
                this.displacementThresholdPerNode = 3 * FDLayoutConstants.DEFAULT_EDGE_LENGTH / 100;
                this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length;
                this.repulsionRange = this.calcRepulsionRange();
              };
              FDLayout.prototype.calcSpringForces = function() {
                var lEdges = this.getAllEdges();
                var edge;
                for (var i2 = 0; i2 < lEdges.length; i2++) {
                  edge = lEdges[i2];
                  this.calcSpringForce(edge, edge.idealLength);
                }
              };
              FDLayout.prototype.calcRepulsionForces = function() {
                var gridUpdateAllowed = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
                var forceToNodeSurroundingUpdate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
                var i2, j3;
                var nodeA, nodeB;
                var lNodes = this.getAllNodes();
                var processedNodeSet;
                if (this.useFRGridVariant) {
                  if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed) {
                    this.updateGrid();
                  }
                  processedNodeSet = /* @__PURE__ */ new Set();
                  for (i2 = 0; i2 < lNodes.length; i2++) {
                    nodeA = lNodes[i2];
                    this.calculateRepulsionForceOfANode(nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate);
                    processedNodeSet.add(nodeA);
                  }
                } else {
                  for (i2 = 0; i2 < lNodes.length; i2++) {
                    nodeA = lNodes[i2];
                    for (j3 = i2 + 1; j3 < lNodes.length; j3++) {
                      nodeB = lNodes[j3];
                      if (nodeA.getOwner() != nodeB.getOwner()) {
                        continue;
                      }
                      this.calcRepulsionForce(nodeA, nodeB);
                    }
                  }
                }
              };
              FDLayout.prototype.calcGravitationalForces = function() {
                var node2;
                var lNodes = this.getAllNodesToApplyGravitation();
                for (var i2 = 0; i2 < lNodes.length; i2++) {
                  node2 = lNodes[i2];
                  this.calcGravitationalForce(node2);
                }
              };
              FDLayout.prototype.moveNodes = function() {
                var lNodes = this.getAllNodes();
                var node2;
                for (var i2 = 0; i2 < lNodes.length; i2++) {
                  node2 = lNodes[i2];
                  node2.move();
                }
              };
              FDLayout.prototype.calcSpringForce = function(edge, idealLength) {
                var sourceNode = edge.getSource();
                var targetNode = edge.getTarget();
                var length2;
                var springForce;
                var springForceX;
                var springForceY;
                if (this.uniformLeafNodeSizes && sourceNode.getChild() == null && targetNode.getChild() == null) {
                  edge.updateLengthSimple();
                } else {
                  edge.updateLength();
                  if (edge.isOverlapingSourceAndTarget) {
                    return;
                  }
                }
                length2 = edge.getLength();
                if (length2 == 0) return;
                springForce = edge.edgeElasticity * (length2 - idealLength);
                springForceX = springForce * (edge.lengthX / length2);
                springForceY = springForce * (edge.lengthY / length2);
                sourceNode.springForceX += springForceX;
                sourceNode.springForceY += springForceY;
                targetNode.springForceX -= springForceX;
                targetNode.springForceY -= springForceY;
              };
              FDLayout.prototype.calcRepulsionForce = function(nodeA, nodeB) {
                var rectA = nodeA.getRect();
                var rectB = nodeB.getRect();
                var overlapAmount = new Array(2);
                var clipPoints = new Array(4);
                var distanceX;
                var distanceY;
                var distanceSquared;
                var distance3;
                var repulsionForce;
                var repulsionForceX;
                var repulsionForceY;
                if (rectA.intersects(rectB)) {
                  IGeometry.calcSeparationAmount(rectA, rectB, overlapAmount, FDLayoutConstants.DEFAULT_EDGE_LENGTH / 2);
                  repulsionForceX = 2 * overlapAmount[0];
                  repulsionForceY = 2 * overlapAmount[1];
                  var childrenConstant = nodeA.noOfChildren * nodeB.noOfChildren / (nodeA.noOfChildren + nodeB.noOfChildren);
                  nodeA.repulsionForceX -= childrenConstant * repulsionForceX;
                  nodeA.repulsionForceY -= childrenConstant * repulsionForceY;
                  nodeB.repulsionForceX += childrenConstant * repulsionForceX;
                  nodeB.repulsionForceY += childrenConstant * repulsionForceY;
                } else {
                  if (this.uniformLeafNodeSizes && nodeA.getChild() == null && nodeB.getChild() == null) {
                    distanceX = rectB.getCenterX() - rectA.getCenterX();
                    distanceY = rectB.getCenterY() - rectA.getCenterY();
                  } else {
                    IGeometry.getIntersection(rectA, rectB, clipPoints);
                    distanceX = clipPoints[2] - clipPoints[0];
                    distanceY = clipPoints[3] - clipPoints[1];
                  }
                  if (Math.abs(distanceX) < FDLayoutConstants.MIN_REPULSION_DIST) {
                    distanceX = IMath.sign(distanceX) * FDLayoutConstants.MIN_REPULSION_DIST;
                  }
                  if (Math.abs(distanceY) < FDLayoutConstants.MIN_REPULSION_DIST) {
                    distanceY = IMath.sign(distanceY) * FDLayoutConstants.MIN_REPULSION_DIST;
                  }
                  distanceSquared = distanceX * distanceX + distanceY * distanceY;
                  distance3 = Math.sqrt(distanceSquared);
                  repulsionForce = (nodeA.nodeRepulsion / 2 + nodeB.nodeRepulsion / 2) * nodeA.noOfChildren * nodeB.noOfChildren / distanceSquared;
                  repulsionForceX = repulsionForce * distanceX / distance3;
                  repulsionForceY = repulsionForce * distanceY / distance3;
                  nodeA.repulsionForceX -= repulsionForceX;
                  nodeA.repulsionForceY -= repulsionForceY;
                  nodeB.repulsionForceX += repulsionForceX;
                  nodeB.repulsionForceY += repulsionForceY;
                }
              };
              FDLayout.prototype.calcGravitationalForce = function(node2) {
                var ownerGraph;
                var ownerCenterX;
                var ownerCenterY;
                var distanceX;
                var distanceY;
                var absDistanceX;
                var absDistanceY;
                var estimatedSize;
                ownerGraph = node2.getOwner();
                ownerCenterX = (ownerGraph.getRight() + ownerGraph.getLeft()) / 2;
                ownerCenterY = (ownerGraph.getTop() + ownerGraph.getBottom()) / 2;
                distanceX = node2.getCenterX() - ownerCenterX;
                distanceY = node2.getCenterY() - ownerCenterY;
                absDistanceX = Math.abs(distanceX) + node2.getWidth() / 2;
                absDistanceY = Math.abs(distanceY) + node2.getHeight() / 2;
                if (node2.getOwner() == this.graphManager.getRoot()) {
                  estimatedSize = ownerGraph.getEstimatedSize() * this.gravityRangeFactor;
                  if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) {
                    node2.gravitationForceX = -this.gravityConstant * distanceX;
                    node2.gravitationForceY = -this.gravityConstant * distanceY;
                  }
                } else {
                  estimatedSize = ownerGraph.getEstimatedSize() * this.compoundGravityRangeFactor;
                  if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) {
                    node2.gravitationForceX = -this.gravityConstant * distanceX * this.compoundGravityConstant;
                    node2.gravitationForceY = -this.gravityConstant * distanceY * this.compoundGravityConstant;
                  }
                }
              };
              FDLayout.prototype.isConverged = function() {
                var converged;
                var oscilating = false;
                if (this.totalIterations > this.maxIterations / 3) {
                  oscilating = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2;
                }
                converged = this.totalDisplacement < this.totalDisplacementThreshold;
                this.oldTotalDisplacement = this.totalDisplacement;
                return converged || oscilating;
              };
              FDLayout.prototype.animate = function() {
                if (this.animationDuringLayout && !this.isSubLayout) {
                  if (this.notAnimatedIterations == this.animationPeriod) {
                    this.update();
                    this.notAnimatedIterations = 0;
                  } else {
                    this.notAnimatedIterations++;
                  }
                }
              };
              FDLayout.prototype.calcNoOfChildrenForAllNodes = function() {
                var node2;
                var allNodes = this.graphManager.getAllNodes();
                for (var i2 = 0; i2 < allNodes.length; i2++) {
                  node2 = allNodes[i2];
                  node2.noOfChildren = node2.getNoOfChildren();
                }
              };
              FDLayout.prototype.calcGrid = function(graph) {
                var sizeX = 0;
                var sizeY = 0;
                sizeX = parseInt(Math.ceil((graph.getRight() - graph.getLeft()) / this.repulsionRange));
                sizeY = parseInt(Math.ceil((graph.getBottom() - graph.getTop()) / this.repulsionRange));
                var grid = new Array(sizeX);
                for (var i2 = 0; i2 < sizeX; i2++) {
                  grid[i2] = new Array(sizeY);
                }
                for (var i2 = 0; i2 < sizeX; i2++) {
                  for (var j3 = 0; j3 < sizeY; j3++) {
                    grid[i2][j3] = new Array();
                  }
                }
                return grid;
              };
              FDLayout.prototype.addNodeToGrid = function(v3, left3, top2) {
                var startX2 = 0;
                var finishX = 0;
                var startY2 = 0;
                var finishY = 0;
                startX2 = parseInt(Math.floor((v3.getRect().x - left3) / this.repulsionRange));
                finishX = parseInt(Math.floor((v3.getRect().width + v3.getRect().x - left3) / this.repulsionRange));
                startY2 = parseInt(Math.floor((v3.getRect().y - top2) / this.repulsionRange));
                finishY = parseInt(Math.floor((v3.getRect().height + v3.getRect().y - top2) / this.repulsionRange));
                for (var i2 = startX2; i2 <= finishX; i2++) {
                  for (var j3 = startY2; j3 <= finishY; j3++) {
                    this.grid[i2][j3].push(v3);
                    v3.setGridCoordinates(startX2, finishX, startY2, finishY);
                  }
                }
              };
              FDLayout.prototype.updateGrid = function() {
                var i2;
                var nodeA;
                var lNodes = this.getAllNodes();
                this.grid = this.calcGrid(this.graphManager.getRoot());
                for (i2 = 0; i2 < lNodes.length; i2++) {
                  nodeA = lNodes[i2];
                  this.addNodeToGrid(nodeA, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop());
                }
              };
              FDLayout.prototype.calculateRepulsionForceOfANode = function(nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate) {
                if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed || forceToNodeSurroundingUpdate) {
                  var surrounding = /* @__PURE__ */ new Set();
                  nodeA.surrounding = new Array();
                  var nodeB;
                  var grid = this.grid;
                  for (var i2 = nodeA.startX - 1; i2 < nodeA.finishX + 2; i2++) {
                    for (var j3 = nodeA.startY - 1; j3 < nodeA.finishY + 2; j3++) {
                      if (!(i2 < 0 || j3 < 0 || i2 >= grid.length || j3 >= grid[0].length)) {
                        for (var k2 = 0; k2 < grid[i2][j3].length; k2++) {
                          nodeB = grid[i2][j3][k2];
                          if (nodeA.getOwner() != nodeB.getOwner() || nodeA == nodeB) {
                            continue;
                          }
                          if (!processedNodeSet.has(nodeB) && !surrounding.has(nodeB)) {
                            var distanceX = Math.abs(nodeA.getCenterX() - nodeB.getCenterX()) - (nodeA.getWidth() / 2 + nodeB.getWidth() / 2);
                            var distanceY = Math.abs(nodeA.getCenterY() - nodeB.getCenterY()) - (nodeA.getHeight() / 2 + nodeB.getHeight() / 2);
                            if (distanceX <= this.repulsionRange && distanceY <= this.repulsionRange) {
                              surrounding.add(nodeB);
                            }
                          }
                        }
                      }
                    }
                  }
                  nodeA.surrounding = [].concat(_toConsumableArray2(surrounding));
                }
                for (i2 = 0; i2 < nodeA.surrounding.length; i2++) {
                  this.calcRepulsionForce(nodeA, nodeA.surrounding[i2]);
                }
              };
              FDLayout.prototype.calcRepulsionRange = function() {
                return 0;
              };
              module3.exports = FDLayout;
            }),
            /* 19 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LEdge = __webpack_require__(1);
              var FDLayoutConstants = __webpack_require__(4);
              function FDLayoutEdge(source, target, vEdge) {
                LEdge.call(this, source, target, vEdge);
                this.idealLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH;
                this.edgeElasticity = FDLayoutConstants.DEFAULT_SPRING_STRENGTH;
              }
              __name(FDLayoutEdge, "FDLayoutEdge");
              FDLayoutEdge.prototype = Object.create(LEdge.prototype);
              for (var prop in LEdge) {
                FDLayoutEdge[prop] = LEdge[prop];
              }
              module3.exports = FDLayoutEdge;
            }),
            /* 20 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var LNode = __webpack_require__(3);
              var FDLayoutConstants = __webpack_require__(4);
              function FDLayoutNode(gm, loc, size4, vNode) {
                LNode.call(this, gm, loc, size4, vNode);
                this.nodeRepulsion = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH;
                this.springForceX = 0;
                this.springForceY = 0;
                this.repulsionForceX = 0;
                this.repulsionForceY = 0;
                this.gravitationForceX = 0;
                this.gravitationForceY = 0;
                this.displacementX = 0;
                this.displacementY = 0;
                this.startX = 0;
                this.finishX = 0;
                this.startY = 0;
                this.finishY = 0;
                this.surrounding = [];
              }
              __name(FDLayoutNode, "FDLayoutNode");
              FDLayoutNode.prototype = Object.create(LNode.prototype);
              for (var prop in LNode) {
                FDLayoutNode[prop] = LNode[prop];
              }
              FDLayoutNode.prototype.setGridCoordinates = function(_startX, _finishX, _startY, _finishY) {
                this.startX = _startX;
                this.finishX = _finishX;
                this.startY = _startY;
                this.finishY = _finishY;
              };
              module3.exports = FDLayoutNode;
            }),
            /* 21 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function DimensionD2(width3, height2) {
                this.width = 0;
                this.height = 0;
                if (width3 !== null && height2 !== null) {
                  this.height = height2;
                  this.width = width3;
                }
              }
              __name(DimensionD2, "DimensionD");
              DimensionD2.prototype.getWidth = function() {
                return this.width;
              };
              DimensionD2.prototype.setWidth = function(width3) {
                this.width = width3;
              };
              DimensionD2.prototype.getHeight = function() {
                return this.height;
              };
              DimensionD2.prototype.setHeight = function(height2) {
                this.height = height2;
              };
              module3.exports = DimensionD2;
            }),
            /* 22 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var UniqueIDGeneretor = __webpack_require__(14);
              function HashMap() {
                this.map = {};
                this.keys = [];
              }
              __name(HashMap, "HashMap");
              HashMap.prototype.put = function(key, value2) {
                var theId = UniqueIDGeneretor.createID(key);
                if (!this.contains(theId)) {
                  this.map[theId] = value2;
                  this.keys.push(key);
                }
              };
              HashMap.prototype.contains = function(key) {
                var theId = UniqueIDGeneretor.createID(key);
                return this.map[key] != null;
              };
              HashMap.prototype.get = function(key) {
                var theId = UniqueIDGeneretor.createID(key);
                return this.map[theId];
              };
              HashMap.prototype.keySet = function() {
                return this.keys;
              };
              module3.exports = HashMap;
            }),
            /* 23 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var UniqueIDGeneretor = __webpack_require__(14);
              function HashSet() {
                this.set = {};
              }
              __name(HashSet, "HashSet");
              ;
              HashSet.prototype.add = function(obj) {
                var theId = UniqueIDGeneretor.createID(obj);
                if (!this.contains(theId)) this.set[theId] = obj;
              };
              HashSet.prototype.remove = function(obj) {
                delete this.set[UniqueIDGeneretor.createID(obj)];
              };
              HashSet.prototype.clear = function() {
                this.set = {};
              };
              HashSet.prototype.contains = function(obj) {
                return this.set[UniqueIDGeneretor.createID(obj)] == obj;
              };
              HashSet.prototype.isEmpty = function() {
                return this.size() === 0;
              };
              HashSet.prototype.size = function() {
                return Object.keys(this.set).length;
              };
              HashSet.prototype.addAllTo = function(list) {
                var keys2 = Object.keys(this.set);
                var length2 = keys2.length;
                for (var i2 = 0; i2 < length2; i2++) {
                  list.push(this.set[keys2[i2]]);
                }
              };
              HashSet.prototype.size = function() {
                return Object.keys(this.set).length;
              };
              HashSet.prototype.addAll = function(list) {
                var s2 = list.length;
                for (var i2 = 0; i2 < s2; i2++) {
                  var v3 = list[i2];
                  this.add(v3);
                }
              };
              module3.exports = HashSet;
            }),
            /* 24 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function Matrix() {
              }
              __name(Matrix, "Matrix");
              Matrix.multMat = function(array1, array22) {
                var result = [];
                for (var i2 = 0; i2 < array1.length; i2++) {
                  result[i2] = [];
                  for (var j3 = 0; j3 < array22[0].length; j3++) {
                    result[i2][j3] = 0;
                    for (var k2 = 0; k2 < array1[0].length; k2++) {
                      result[i2][j3] += array1[i2][k2] * array22[k2][j3];
                    }
                  }
                }
                return result;
              };
              Matrix.transpose = function(array4) {
                var result = [];
                for (var i2 = 0; i2 < array4[0].length; i2++) {
                  result[i2] = [];
                  for (var j3 = 0; j3 < array4.length; j3++) {
                    result[i2][j3] = array4[j3][i2];
                  }
                }
                return result;
              };
              Matrix.multCons = function(array4, constant3) {
                var result = [];
                for (var i2 = 0; i2 < array4.length; i2++) {
                  result[i2] = array4[i2] * constant3;
                }
                return result;
              };
              Matrix.minusOp = function(array1, array22) {
                var result = [];
                for (var i2 = 0; i2 < array1.length; i2++) {
                  result[i2] = array1[i2] - array22[i2];
                }
                return result;
              };
              Matrix.dotProduct = function(array1, array22) {
                var product = 0;
                for (var i2 = 0; i2 < array1.length; i2++) {
                  product += array1[i2] * array22[i2];
                }
                return product;
              };
              Matrix.mag = function(array4) {
                return Math.sqrt(this.dotProduct(array4, array4));
              };
              Matrix.normalize = function(array4) {
                var result = [];
                var magnitude = this.mag(array4);
                for (var i2 = 0; i2 < array4.length; i2++) {
                  result[i2] = array4[i2] / magnitude;
                }
                return result;
              };
              Matrix.multGamma = function(array4) {
                var result = [];
                var sum2 = 0;
                for (var i2 = 0; i2 < array4.length; i2++) {
                  sum2 += array4[i2];
                }
                sum2 *= -1 / array4.length;
                for (var _i = 0; _i < array4.length; _i++) {
                  result[_i] = sum2 + array4[_i];
                }
                return result;
              };
              Matrix.multL = function(array4, C3, INV) {
                var result = [];
                var temp1 = [];
                var temp2 = [];
                for (var i2 = 0; i2 < C3[0].length; i2++) {
                  var sum2 = 0;
                  for (var j3 = 0; j3 < C3.length; j3++) {
                    sum2 += -0.5 * C3[j3][i2] * array4[j3];
                  }
                  temp1[i2] = sum2;
                }
                for (var _i2 = 0; _i2 < INV.length; _i2++) {
                  var _sum = 0;
                  for (var _j = 0; _j < INV.length; _j++) {
                    _sum += INV[_i2][_j] * temp1[_j];
                  }
                  temp2[_i2] = _sum;
                }
                for (var _i3 = 0; _i3 < C3.length; _i3++) {
                  var _sum2 = 0;
                  for (var _j2 = 0; _j2 < C3[0].length; _j2++) {
                    _sum2 += C3[_i3][_j2] * temp2[_j2];
                  }
                  result[_i3] = _sum2;
                }
                return result;
              };
              module3.exports = Matrix;
            }),
            /* 25 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var _createClass2 = /* @__PURE__ */ (function() {
                function defineProperties(target, props) {
                  for (var i2 = 0; i2 < props.length; i2++) {
                    var descriptor = props[i2];
                    descriptor.enumerable = descriptor.enumerable || false;
                    descriptor.configurable = true;
                    if ("value" in descriptor) descriptor.writable = true;
                    Object.defineProperty(target, descriptor.key, descriptor);
                  }
                }
                __name(defineProperties, "defineProperties");
                return function(Constructor, protoProps, staticProps) {
                  if (protoProps) defineProperties(Constructor.prototype, protoProps);
                  if (staticProps) defineProperties(Constructor, staticProps);
                  return Constructor;
                };
              })();
              function _classCallCheck2(instance2, Constructor) {
                if (!(instance2 instanceof Constructor)) {
                  throw new TypeError("Cannot call a class as a function");
                }
              }
              __name(_classCallCheck2, "_classCallCheck");
              var LinkedList = __webpack_require__(11);
              var Quicksort = (function() {
                function Quicksort2(A2, compareFunction) {
                  _classCallCheck2(this, Quicksort2);
                  if (compareFunction !== null || compareFunction !== void 0) this.compareFunction = this._defaultCompareFunction;
                  var length2 = void 0;
                  if (A2 instanceof LinkedList) length2 = A2.size();
                  else length2 = A2.length;
                  this._quicksort(A2, 0, length2 - 1);
                }
                __name(Quicksort2, "Quicksort");
                _createClass2(Quicksort2, [{
                  key: "_quicksort",
                  value: /* @__PURE__ */ __name(function _quicksort(A2, p3, r2) {
                    if (p3 < r2) {
                      var q3 = this._partition(A2, p3, r2);
                      this._quicksort(A2, p3, q3);
                      this._quicksort(A2, q3 + 1, r2);
                    }
                  }, "_quicksort")
                }, {
                  key: "_partition",
                  value: /* @__PURE__ */ __name(function _partition(A2, p3, r2) {
                    var x5 = this._get(A2, p3);
                    var i2 = p3;
                    var j3 = r2;
                    while (true) {
                      while (this.compareFunction(x5, this._get(A2, j3))) {
                        j3--;
                      }
                      while (this.compareFunction(this._get(A2, i2), x5)) {
                        i2++;
                      }
                      if (i2 < j3) {
                        this._swap(A2, i2, j3);
                        i2++;
                        j3--;
                      } else return j3;
                    }
                  }, "_partition")
                }, {
                  key: "_get",
                  value: /* @__PURE__ */ __name(function _get(object3, index) {
                    if (object3 instanceof LinkedList) return object3.get_object_at(index);
                    else return object3[index];
                  }, "_get")
                }, {
                  key: "_set",
                  value: /* @__PURE__ */ __name(function _set(object3, index, value2) {
                    if (object3 instanceof LinkedList) object3.set_object_at(index, value2);
                    else object3[index] = value2;
                  }, "_set")
                }, {
                  key: "_swap",
                  value: /* @__PURE__ */ __name(function _swap(A2, i2, j3) {
                    var temp = this._get(A2, i2);
                    this._set(A2, i2, this._get(A2, j3));
                    this._set(A2, j3, temp);
                  }, "_swap")
                }, {
                  key: "_defaultCompareFunction",
                  value: /* @__PURE__ */ __name(function _defaultCompareFunction(a2, b3) {
                    return b3 > a2;
                  }, "_defaultCompareFunction")
                }]);
                return Quicksort2;
              })();
              module3.exports = Quicksort;
            }),
            /* 26 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function SVD() {
              }
              __name(SVD, "SVD");
              ;
              SVD.svd = function(A2) {
                this.U = null;
                this.V = null;
                this.s = null;
                this.m = 0;
                this.n = 0;
                this.m = A2.length;
                this.n = A2[0].length;
                var nu = Math.min(this.m, this.n);
                this.s = (function(s2) {
                  var a2 = [];
                  while (s2-- > 0) {
                    a2.push(0);
                  }
                  return a2;
                })(Math.min(this.m + 1, this.n));
                this.U = (function(dims) {
                  var allocate = /* @__PURE__ */ __name(function allocate2(dims2) {
                    if (dims2.length == 0) {
                      return 0;
                    } else {
                      var array4 = [];
                      for (var i3 = 0; i3 < dims2[0]; i3++) {
                        array4.push(allocate2(dims2.slice(1)));
                      }
                      return array4;
                    }
                  }, "allocate");
                  return allocate(dims);
                })([this.m, nu]);
                this.V = (function(dims) {
                  var allocate = /* @__PURE__ */ __name(function allocate2(dims2) {
                    if (dims2.length == 0) {
                      return 0;
                    } else {
                      var array4 = [];
                      for (var i3 = 0; i3 < dims2[0]; i3++) {
                        array4.push(allocate2(dims2.slice(1)));
                      }
                      return array4;
                    }
                  }, "allocate");
                  return allocate(dims);
                })([this.n, this.n]);
                var e3 = (function(s2) {
                  var a2 = [];
                  while (s2-- > 0) {
                    a2.push(0);
                  }
                  return a2;
                })(this.n);
                var work = (function(s2) {
                  var a2 = [];
                  while (s2-- > 0) {
                    a2.push(0);
                  }
                  return a2;
                })(this.m);
                var wantu = true;
                var wantv = true;
                var nct = Math.min(this.m - 1, this.n);
                var nrt = Math.max(0, Math.min(this.n - 2, this.m));
                for (var k2 = 0; k2 < Math.max(nct, nrt); k2++) {
                  if (k2 < nct) {
                    this.s[k2] = 0;
                    for (var i2 = k2; i2 < this.m; i2++) {
                      this.s[k2] = SVD.hypot(this.s[k2], A2[i2][k2]);
                    }
                    ;
                    if (this.s[k2] !== 0) {
                      if (A2[k2][k2] < 0) {
                        this.s[k2] = -this.s[k2];
                      }
                      for (var _i = k2; _i < this.m; _i++) {
                        A2[_i][k2] /= this.s[k2];
                      }
                      ;
                      A2[k2][k2] += 1;
                    }
                    this.s[k2] = -this.s[k2];
                  }
                  for (var j3 = k2 + 1; j3 < this.n; j3++) {
                    if (/* @__PURE__ */ (function(lhs, rhs) {
                      return lhs && rhs;
                    })(k2 < nct, this.s[k2] !== 0)) {
                      var t4 = 0;
                      for (var _i2 = k2; _i2 < this.m; _i2++) {
                        t4 += A2[_i2][k2] * A2[_i2][j3];
                      }
                      ;
                      t4 = -t4 / A2[k2][k2];
                      for (var _i3 = k2; _i3 < this.m; _i3++) {
                        A2[_i3][j3] += t4 * A2[_i3][k2];
                      }
                      ;
                    }
                    e3[j3] = A2[k2][j3];
                  }
                  ;
                  if (/* @__PURE__ */ (function(lhs, rhs) {
                    return lhs && rhs;
                  })(wantu, k2 < nct)) {
                    for (var _i4 = k2; _i4 < this.m; _i4++) {
                      this.U[_i4][k2] = A2[_i4][k2];
                    }
                    ;
                  }
                  if (k2 < nrt) {
                    e3[k2] = 0;
                    for (var _i5 = k2 + 1; _i5 < this.n; _i5++) {
                      e3[k2] = SVD.hypot(e3[k2], e3[_i5]);
                    }
                    ;
                    if (e3[k2] !== 0) {
                      if (e3[k2 + 1] < 0) {
                        e3[k2] = -e3[k2];
                      }
                      for (var _i6 = k2 + 1; _i6 < this.n; _i6++) {
                        e3[_i6] /= e3[k2];
                      }
                      ;
                      e3[k2 + 1] += 1;
                    }
                    e3[k2] = -e3[k2];
                    if (/* @__PURE__ */ (function(lhs, rhs) {
                      return lhs && rhs;
                    })(k2 + 1 < this.m, e3[k2] !== 0)) {
                      for (var _i7 = k2 + 1; _i7 < this.m; _i7++) {
                        work[_i7] = 0;
                      }
                      ;
                      for (var _j = k2 + 1; _j < this.n; _j++) {
                        for (var _i8 = k2 + 1; _i8 < this.m; _i8++) {
                          work[_i8] += e3[_j] * A2[_i8][_j];
                        }
                        ;
                      }
                      ;
                      for (var _j2 = k2 + 1; _j2 < this.n; _j2++) {
                        var _t = -e3[_j2] / e3[k2 + 1];
                        for (var _i9 = k2 + 1; _i9 < this.m; _i9++) {
                          A2[_i9][_j2] += _t * work[_i9];
                        }
                        ;
                      }
                      ;
                    }
                    if (wantv) {
                      for (var _i10 = k2 + 1; _i10 < this.n; _i10++) {
                        this.V[_i10][k2] = e3[_i10];
                      }
                      ;
                    }
                  }
                }
                ;
                var p3 = Math.min(this.n, this.m + 1);
                if (nct < this.n) {
                  this.s[nct] = A2[nct][nct];
                }
                if (this.m < p3) {
                  this.s[p3 - 1] = 0;
                }
                if (nrt + 1 < p3) {
                  e3[nrt] = A2[nrt][p3 - 1];
                }
                e3[p3 - 1] = 0;
                if (wantu) {
                  for (var _j3 = nct; _j3 < nu; _j3++) {
                    for (var _i11 = 0; _i11 < this.m; _i11++) {
                      this.U[_i11][_j3] = 0;
                    }
                    ;
                    this.U[_j3][_j3] = 1;
                  }
                  ;
                  for (var _k = nct - 1; _k >= 0; _k--) {
                    if (this.s[_k] !== 0) {
                      for (var _j4 = _k + 1; _j4 < nu; _j4++) {
                        var _t2 = 0;
                        for (var _i12 = _k; _i12 < this.m; _i12++) {
                          _t2 += this.U[_i12][_k] * this.U[_i12][_j4];
                        }
                        ;
                        _t2 = -_t2 / this.U[_k][_k];
                        for (var _i13 = _k; _i13 < this.m; _i13++) {
                          this.U[_i13][_j4] += _t2 * this.U[_i13][_k];
                        }
                        ;
                      }
                      ;
                      for (var _i14 = _k; _i14 < this.m; _i14++) {
                        this.U[_i14][_k] = -this.U[_i14][_k];
                      }
                      ;
                      this.U[_k][_k] = 1 + this.U[_k][_k];
                      for (var _i15 = 0; _i15 < _k - 1; _i15++) {
                        this.U[_i15][_k] = 0;
                      }
                      ;
                    } else {
                      for (var _i16 = 0; _i16 < this.m; _i16++) {
                        this.U[_i16][_k] = 0;
                      }
                      ;
                      this.U[_k][_k] = 1;
                    }
                  }
                  ;
                }
                if (wantv) {
                  for (var _k2 = this.n - 1; _k2 >= 0; _k2--) {
                    if (/* @__PURE__ */ (function(lhs, rhs) {
                      return lhs && rhs;
                    })(_k2 < nrt, e3[_k2] !== 0)) {
                      for (var _j5 = _k2 + 1; _j5 < nu; _j5++) {
                        var _t3 = 0;
                        for (var _i17 = _k2 + 1; _i17 < this.n; _i17++) {
                          _t3 += this.V[_i17][_k2] * this.V[_i17][_j5];
                        }
                        ;
                        _t3 = -_t3 / this.V[_k2 + 1][_k2];
                        for (var _i18 = _k2 + 1; _i18 < this.n; _i18++) {
                          this.V[_i18][_j5] += _t3 * this.V[_i18][_k2];
                        }
                        ;
                      }
                      ;
                    }
                    for (var _i19 = 0; _i19 < this.n; _i19++) {
                      this.V[_i19][_k2] = 0;
                    }
                    ;
                    this.V[_k2][_k2] = 1;
                  }
                  ;
                }
                var pp = p3 - 1;
                var iter = 0;
                var eps = Math.pow(2, -52);
                var tiny = Math.pow(2, -966);
                while (p3 > 0) {
                  var _k3 = void 0;
                  var kase = void 0;
                  for (_k3 = p3 - 2; _k3 >= -1; _k3--) {
                    if (_k3 === -1) {
                      break;
                    }
                    if (Math.abs(e3[_k3]) <= tiny + eps * (Math.abs(this.s[_k3]) + Math.abs(this.s[_k3 + 1]))) {
                      e3[_k3] = 0;
                      break;
                    }
                  }
                  ;
                  if (_k3 === p3 - 2) {
                    kase = 4;
                  } else {
                    var ks = void 0;
                    for (ks = p3 - 1; ks >= _k3; ks--) {
                      if (ks === _k3) {
                        break;
                      }
                      var _t4 = (ks !== p3 ? Math.abs(e3[ks]) : 0) + (ks !== _k3 + 1 ? Math.abs(e3[ks - 1]) : 0);
                      if (Math.abs(this.s[ks]) <= tiny + eps * _t4) {
                        this.s[ks] = 0;
                        break;
                      }
                    }
                    ;
                    if (ks === _k3) {
                      kase = 3;
                    } else if (ks === p3 - 1) {
                      kase = 1;
                    } else {
                      kase = 2;
                      _k3 = ks;
                    }
                  }
                  _k3++;
                  switch (kase) {
                    case 1:
                      {
                        var f2 = e3[p3 - 2];
                        e3[p3 - 2] = 0;
                        for (var _j6 = p3 - 2; _j6 >= _k3; _j6--) {
                          var _t5 = SVD.hypot(this.s[_j6], f2);
                          var cs = this.s[_j6] / _t5;
                          var sn = f2 / _t5;
                          this.s[_j6] = _t5;
                          if (_j6 !== _k3) {
                            f2 = -sn * e3[_j6 - 1];
                            e3[_j6 - 1] = cs * e3[_j6 - 1];
                          }
                          if (wantv) {
                            for (var _i20 = 0; _i20 < this.n; _i20++) {
                              _t5 = cs * this.V[_i20][_j6] + sn * this.V[_i20][p3 - 1];
                              this.V[_i20][p3 - 1] = -sn * this.V[_i20][_j6] + cs * this.V[_i20][p3 - 1];
                              this.V[_i20][_j6] = _t5;
                            }
                            ;
                          }
                        }
                        ;
                      }
                      ;
                      break;
                    case 2:
                      {
                        var _f = e3[_k3 - 1];
                        e3[_k3 - 1] = 0;
                        for (var _j7 = _k3; _j7 < p3; _j7++) {
                          var _t6 = SVD.hypot(this.s[_j7], _f);
                          var _cs = this.s[_j7] / _t6;
                          var _sn = _f / _t6;
                          this.s[_j7] = _t6;
                          _f = -_sn * e3[_j7];
                          e3[_j7] = _cs * e3[_j7];
                          if (wantu) {
                            for (var _i21 = 0; _i21 < this.m; _i21++) {
                              _t6 = _cs * this.U[_i21][_j7] + _sn * this.U[_i21][_k3 - 1];
                              this.U[_i21][_k3 - 1] = -_sn * this.U[_i21][_j7] + _cs * this.U[_i21][_k3 - 1];
                              this.U[_i21][_j7] = _t6;
                            }
                            ;
                          }
                        }
                        ;
                      }
                      ;
                      break;
                    case 3:
                      {
                        var scale3 = Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[p3 - 1]), Math.abs(this.s[p3 - 2])), Math.abs(e3[p3 - 2])), Math.abs(this.s[_k3])), Math.abs(e3[_k3]));
                        var sp = this.s[p3 - 1] / scale3;
                        var spm1 = this.s[p3 - 2] / scale3;
                        var epm1 = e3[p3 - 2] / scale3;
                        var sk = this.s[_k3] / scale3;
                        var ek = e3[_k3] / scale3;
                        var b3 = ((spm1 + sp) * (spm1 - sp) + epm1 * epm1) / 2;
                        var c3 = sp * epm1 * (sp * epm1);
                        var shift2 = 0;
                        if (/* @__PURE__ */ (function(lhs, rhs) {
                          return lhs || rhs;
                        })(b3 !== 0, c3 !== 0)) {
                          shift2 = Math.sqrt(b3 * b3 + c3);
                          if (b3 < 0) {
                            shift2 = -shift2;
                          }
                          shift2 = c3 / (b3 + shift2);
                        }
                        var _f2 = (sk + sp) * (sk - sp) + shift2;
                        var g2 = sk * ek;
                        for (var _j8 = _k3; _j8 < p3 - 1; _j8++) {
                          var _t7 = SVD.hypot(_f2, g2);
                          var _cs2 = _f2 / _t7;
                          var _sn2 = g2 / _t7;
                          if (_j8 !== _k3) {
                            e3[_j8 - 1] = _t7;
                          }
                          _f2 = _cs2 * this.s[_j8] + _sn2 * e3[_j8];
                          e3[_j8] = _cs2 * e3[_j8] - _sn2 * this.s[_j8];
                          g2 = _sn2 * this.s[_j8 + 1];
                          this.s[_j8 + 1] = _cs2 * this.s[_j8 + 1];
                          if (wantv) {
                            for (var _i22 = 0; _i22 < this.n; _i22++) {
                              _t7 = _cs2 * this.V[_i22][_j8] + _sn2 * this.V[_i22][_j8 + 1];
                              this.V[_i22][_j8 + 1] = -_sn2 * this.V[_i22][_j8] + _cs2 * this.V[_i22][_j8 + 1];
                              this.V[_i22][_j8] = _t7;
                            }
                            ;
                          }
                          _t7 = SVD.hypot(_f2, g2);
                          _cs2 = _f2 / _t7;
                          _sn2 = g2 / _t7;
                          this.s[_j8] = _t7;
                          _f2 = _cs2 * e3[_j8] + _sn2 * this.s[_j8 + 1];
                          this.s[_j8 + 1] = -_sn2 * e3[_j8] + _cs2 * this.s[_j8 + 1];
                          g2 = _sn2 * e3[_j8 + 1];
                          e3[_j8 + 1] = _cs2 * e3[_j8 + 1];
                          if (wantu && _j8 < this.m - 1) {
                            for (var _i23 = 0; _i23 < this.m; _i23++) {
                              _t7 = _cs2 * this.U[_i23][_j8] + _sn2 * this.U[_i23][_j8 + 1];
                              this.U[_i23][_j8 + 1] = -_sn2 * this.U[_i23][_j8] + _cs2 * this.U[_i23][_j8 + 1];
                              this.U[_i23][_j8] = _t7;
                            }
                            ;
                          }
                        }
                        ;
                        e3[p3 - 2] = _f2;
                        iter = iter + 1;
                      }
                      ;
                      break;
                    case 4:
                      {
                        if (this.s[_k3] <= 0) {
                          this.s[_k3] = this.s[_k3] < 0 ? -this.s[_k3] : 0;
                          if (wantv) {
                            for (var _i24 = 0; _i24 <= pp; _i24++) {
                              this.V[_i24][_k3] = -this.V[_i24][_k3];
                            }
                            ;
                          }
                        }
                        while (_k3 < pp) {
                          if (this.s[_k3] >= this.s[_k3 + 1]) {
                            break;
                          }
                          var _t8 = this.s[_k3];
                          this.s[_k3] = this.s[_k3 + 1];
                          this.s[_k3 + 1] = _t8;
                          if (wantv && _k3 < this.n - 1) {
                            for (var _i25 = 0; _i25 < this.n; _i25++) {
                              _t8 = this.V[_i25][_k3 + 1];
                              this.V[_i25][_k3 + 1] = this.V[_i25][_k3];
                              this.V[_i25][_k3] = _t8;
                            }
                            ;
                          }
                          if (wantu && _k3 < this.m - 1) {
                            for (var _i26 = 0; _i26 < this.m; _i26++) {
                              _t8 = this.U[_i26][_k3 + 1];
                              this.U[_i26][_k3 + 1] = this.U[_i26][_k3];
                              this.U[_i26][_k3] = _t8;
                            }
                            ;
                          }
                          _k3++;
                        }
                        ;
                        iter = 0;
                        p3--;
                      }
                      ;
                      break;
                  }
                }
                ;
                var result = { U: this.U, V: this.V, S: this.s };
                return result;
              };
              SVD.hypot = function(a2, b3) {
                var r2 = void 0;
                if (Math.abs(a2) > Math.abs(b3)) {
                  r2 = b3 / a2;
                  r2 = Math.abs(a2) * Math.sqrt(1 + r2 * r2);
                } else if (b3 != 0) {
                  r2 = a2 / b3;
                  r2 = Math.abs(b3) * Math.sqrt(1 + r2 * r2);
                } else {
                  r2 = 0;
                }
                return r2;
              };
              module3.exports = SVD;
            }),
            /* 27 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var _createClass2 = /* @__PURE__ */ (function() {
                function defineProperties(target, props) {
                  for (var i2 = 0; i2 < props.length; i2++) {
                    var descriptor = props[i2];
                    descriptor.enumerable = descriptor.enumerable || false;
                    descriptor.configurable = true;
                    if ("value" in descriptor) descriptor.writable = true;
                    Object.defineProperty(target, descriptor.key, descriptor);
                  }
                }
                __name(defineProperties, "defineProperties");
                return function(Constructor, protoProps, staticProps) {
                  if (protoProps) defineProperties(Constructor.prototype, protoProps);
                  if (staticProps) defineProperties(Constructor, staticProps);
                  return Constructor;
                };
              })();
              function _classCallCheck2(instance2, Constructor) {
                if (!(instance2 instanceof Constructor)) {
                  throw new TypeError("Cannot call a class as a function");
                }
              }
              __name(_classCallCheck2, "_classCallCheck");
              var NeedlemanWunsch = (function() {
                function NeedlemanWunsch2(sequence1, sequence2) {
                  var match_score = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
                  var mismatch_penalty = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : -1;
                  var gap_penalty = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : -1;
                  _classCallCheck2(this, NeedlemanWunsch2);
                  this.sequence1 = sequence1;
                  this.sequence2 = sequence2;
                  this.match_score = match_score;
                  this.mismatch_penalty = mismatch_penalty;
                  this.gap_penalty = gap_penalty;
                  this.iMax = sequence1.length + 1;
                  this.jMax = sequence2.length + 1;
                  this.grid = new Array(this.iMax);
                  for (var i2 = 0; i2 < this.iMax; i2++) {
                    this.grid[i2] = new Array(this.jMax);
                    for (var j3 = 0; j3 < this.jMax; j3++) {
                      this.grid[i2][j3] = 0;
                    }
                  }
                  this.tracebackGrid = new Array(this.iMax);
                  for (var _i = 0; _i < this.iMax; _i++) {
                    this.tracebackGrid[_i] = new Array(this.jMax);
                    for (var _j = 0; _j < this.jMax; _j++) {
                      this.tracebackGrid[_i][_j] = [null, null, null];
                    }
                  }
                  this.alignments = [];
                  this.score = -1;
                  this.computeGrids();
                }
                __name(NeedlemanWunsch2, "NeedlemanWunsch");
                _createClass2(NeedlemanWunsch2, [{
                  key: "getScore",
                  value: /* @__PURE__ */ __name(function getScore() {
                    return this.score;
                  }, "getScore")
                }, {
                  key: "getAlignments",
                  value: /* @__PURE__ */ __name(function getAlignments2() {
                    return this.alignments;
                  }, "getAlignments")
                  // Main dynamic programming procedure
                }, {
                  key: "computeGrids",
                  value: /* @__PURE__ */ __name(function computeGrids() {
                    for (var j3 = 1; j3 < this.jMax; j3++) {
                      this.grid[0][j3] = this.grid[0][j3 - 1] + this.gap_penalty;
                      this.tracebackGrid[0][j3] = [false, false, true];
                    }
                    for (var i2 = 1; i2 < this.iMax; i2++) {
                      this.grid[i2][0] = this.grid[i2 - 1][0] + this.gap_penalty;
                      this.tracebackGrid[i2][0] = [false, true, false];
                    }
                    for (var _i2 = 1; _i2 < this.iMax; _i2++) {
                      for (var _j2 = 1; _j2 < this.jMax; _j2++) {
                        var diag = void 0;
                        if (this.sequence1[_i2 - 1] === this.sequence2[_j2 - 1]) diag = this.grid[_i2 - 1][_j2 - 1] + this.match_score;
                        else diag = this.grid[_i2 - 1][_j2 - 1] + this.mismatch_penalty;
                        var up = this.grid[_i2 - 1][_j2] + this.gap_penalty;
                        var left3 = this.grid[_i2][_j2 - 1] + this.gap_penalty;
                        var maxOf = [diag, up, left3];
                        var indices = this.arrayAllMaxIndexes(maxOf);
                        this.grid[_i2][_j2] = maxOf[indices[0]];
                        this.tracebackGrid[_i2][_j2] = [indices.includes(0), indices.includes(1), indices.includes(2)];
                      }
                    }
                    this.score = this.grid[this.iMax - 1][this.jMax - 1];
                  }, "computeGrids")
                  // Gets all possible valid sequence combinations
                }, {
                  key: "alignmentTraceback",
                  value: /* @__PURE__ */ __name(function alignmentTraceback() {
                    var inProcessAlignments = [];
                    inProcessAlignments.push({
                      pos: [this.sequence1.length, this.sequence2.length],
                      seq1: "",
                      seq2: ""
                    });
                    while (inProcessAlignments[0]) {
                      var current = inProcessAlignments[0];
                      var directions = this.tracebackGrid[current.pos[0]][current.pos[1]];
                      if (directions[0]) {
                        inProcessAlignments.push({
                          pos: [current.pos[0] - 1, current.pos[1] - 1],
                          seq1: this.sequence1[current.pos[0] - 1] + current.seq1,
                          seq2: this.sequence2[current.pos[1] - 1] + current.seq2
                        });
                      }
                      if (directions[1]) {
                        inProcessAlignments.push({
                          pos: [current.pos[0] - 1, current.pos[1]],
                          seq1: this.sequence1[current.pos[0] - 1] + current.seq1,
                          seq2: "-" + current.seq2
                        });
                      }
                      if (directions[2]) {
                        inProcessAlignments.push({
                          pos: [current.pos[0], current.pos[1] - 1],
                          seq1: "-" + current.seq1,
                          seq2: this.sequence2[current.pos[1] - 1] + current.seq2
                        });
                      }
                      if (current.pos[0] === 0 && current.pos[1] === 0) this.alignments.push({
                        sequence1: current.seq1,
                        sequence2: current.seq2
                      });
                      inProcessAlignments.shift();
                    }
                    return this.alignments;
                  }, "alignmentTraceback")
                  // Helper Functions
                }, {
                  key: "getAllIndexes",
                  value: /* @__PURE__ */ __name(function getAllIndexes(arr, val) {
                    var indexes = [], i2 = -1;
                    while ((i2 = arr.indexOf(val, i2 + 1)) !== -1) {
                      indexes.push(i2);
                    }
                    return indexes;
                  }, "getAllIndexes")
                }, {
                  key: "arrayAllMaxIndexes",
                  value: /* @__PURE__ */ __name(function arrayAllMaxIndexes(array4) {
                    return this.getAllIndexes(array4, Math.max.apply(null, array4));
                  }, "arrayAllMaxIndexes")
                }]);
                return NeedlemanWunsch2;
              })();
              module3.exports = NeedlemanWunsch;
            }),
            /* 28 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              var layoutBase = /* @__PURE__ */ __name(function layoutBase2() {
                return;
              }, "layoutBase");
              layoutBase.FDLayout = __webpack_require__(18);
              layoutBase.FDLayoutConstants = __webpack_require__(4);
              layoutBase.FDLayoutEdge = __webpack_require__(19);
              layoutBase.FDLayoutNode = __webpack_require__(20);
              layoutBase.DimensionD = __webpack_require__(21);
              layoutBase.HashMap = __webpack_require__(22);
              layoutBase.HashSet = __webpack_require__(23);
              layoutBase.IGeometry = __webpack_require__(8);
              layoutBase.IMath = __webpack_require__(9);
              layoutBase.Integer = __webpack_require__(10);
              layoutBase.Point = __webpack_require__(12);
              layoutBase.PointD = __webpack_require__(5);
              layoutBase.RandomSeed = __webpack_require__(16);
              layoutBase.RectangleD = __webpack_require__(13);
              layoutBase.Transform = __webpack_require__(17);
              layoutBase.UniqueIDGeneretor = __webpack_require__(14);
              layoutBase.Quicksort = __webpack_require__(25);
              layoutBase.LinkedList = __webpack_require__(11);
              layoutBase.LGraphObject = __webpack_require__(2);
              layoutBase.LGraph = __webpack_require__(6);
              layoutBase.LEdge = __webpack_require__(1);
              layoutBase.LGraphManager = __webpack_require__(7);
              layoutBase.LNode = __webpack_require__(3);
              layoutBase.Layout = __webpack_require__(15);
              layoutBase.LayoutConstants = __webpack_require__(0);
              layoutBase.NeedlemanWunsch = __webpack_require__(27);
              layoutBase.Matrix = __webpack_require__(24);
              layoutBase.SVD = __webpack_require__(26);
              module3.exports = layoutBase;
            }),
            /* 29 */
            /***/
            (function(module3, exports3, __webpack_require__) {
              "use strict";
              function Emitter4() {
                this.listeners = [];
              }
              __name(Emitter4, "Emitter");
              var p3 = Emitter4.prototype;
              p3.addListener = function(event3, callback) {
                this.listeners.push({
                  event: event3,
                  callback
                });
              };
              p3.removeListener = function(event3, callback) {
                for (var i2 = this.listeners.length; i2 >= 0; i2--) {
                  var l4 = this.listeners[i2];
                  if (l4.event === event3 && l4.callback === callback) {
                    this.listeners.splice(i2, 1);
                  }
                }
              };
              p3.emit = function(event3, data5) {
                for (var i2 = 0; i2 < this.listeners.length; i2++) {
                  var l4 = this.listeners[i2];
                  if (event3 === l4.event) {
                    l4.callback(data5);
                  }
                }
              };
              module3.exports = Emitter4;
            })
            /******/
          ])
        );
      });
    }
  });

  // ../../node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.js
  var require_cose_base2 = __commonJS({
    "../../node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.js"(exports2, module2) {
      "use strict";
      (/* @__PURE__ */ __name((function webpackUniversalModuleDefinition(root3, factory) {
        if (typeof exports2 === "object" && typeof module2 === "object")
          module2.exports = factory(require_layout_base2());
        else if (typeof define === "function" && define.amd)
          define(["layout-base"], factory);
        else if (typeof exports2 === "object")
          exports2["coseBase"] = factory(require_layout_base2());
        else
          root3["coseBase"] = factory(root3["layoutBase"]);
      }), "webpackUniversalModuleDefinition"))(exports2, function(__WEBPACK_EXTERNAL_MODULE__551__) {
        return (
          /******/
          (() => {
            "use strict";
            var __webpack_modules__ = {
              /***/
              45: (
                /***/
                ((module3, __unused_webpack_exports, __webpack_require__2) => {
                  var coseBase = {};
                  coseBase.layoutBase = __webpack_require__2(551);
                  coseBase.CoSEConstants = __webpack_require__2(806);
                  coseBase.CoSEEdge = __webpack_require__2(767);
                  coseBase.CoSEGraph = __webpack_require__2(880);
                  coseBase.CoSEGraphManager = __webpack_require__2(578);
                  coseBase.CoSELayout = __webpack_require__2(765);
                  coseBase.CoSENode = __webpack_require__2(991);
                  coseBase.ConstraintHandler = __webpack_require__2(902);
                  module3.exports = coseBase;
                })
              ),
              /***/
              806: (
                /***/
                ((module3, __unused_webpack_exports, __webpack_require__2) => {
                  var FDLayoutConstants = __webpack_require__2(551).FDLayoutConstants;
                  function CoSEConstants() {
                  }
                  __name(CoSEConstants, "CoSEConstants");
                  for (var prop in FDLayoutConstants) {
                    CoSEConstants[prop] = FDLayoutConstants[prop];
                  }
                  CoSEConstants.DEFAULT_USE_MULTI_LEVEL_SCALING = false;
                  CoSEConstants.DEFAULT_RADIAL_SEPARATION = FDLayoutConstants.DEFAULT_EDGE_LENGTH;
                  CoSEConstants.DEFAULT_COMPONENT_SEPERATION = 60;
                  CoSEConstants.TILE = true;
                  CoSEConstants.TILING_PADDING_VERTICAL = 10;
                  CoSEConstants.TILING_PADDING_HORIZONTAL = 10;
                  CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = true;
                  CoSEConstants.ENFORCE_CONSTRAINTS = true;
                  CoSEConstants.APPLY_LAYOUT = true;
                  CoSEConstants.RELAX_MOVEMENT_ON_CONSTRAINTS = true;
                  CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = true;
                  CoSEConstants.PURE_INCREMENTAL = CoSEConstants.DEFAULT_INCREMENTAL;
                  module3.exports = CoSEConstants;
                })
              ),
              /***/
              767: (
                /***/
                ((module3, __unused_webpack_exports, __webpack_require__2) => {
                  var FDLayoutEdge = __webpack_require__2(551).FDLayoutEdge;
                  function CoSEEdge(source, target, vEdge) {
                    FDLayoutEdge.call(this, source, target, vEdge);
                  }
                  __name(CoSEEdge, "CoSEEdge");
                  CoSEEdge.prototype = Object.create(FDLayoutEdge.prototype);
                  for (var prop in FDLayoutEdge) {
                    CoSEEdge[prop] = FDLayoutEdge[prop];
                  }
                  module3.exports = CoSEEdge;
                })
              ),
              /***/
              880: (
                /***/
                ((module3, __unused_webpack_exports, __webpack_require__2) => {
                  var LGraph = __webpack_require__2(551).LGraph;
                  function CoSEGraph(parent4, graphMgr, vGraph) {
                    LGraph.call(this, parent4, graphMgr, vGraph);
                  }
                  __name(CoSEGraph, "CoSEGraph");
                  CoSEGraph.prototype = Object.create(LGraph.prototype);
                  for (var prop in LGraph) {
                    CoSEGraph[prop] = LGraph[prop];
                  }
                  module3.exports = CoSEGraph;
                })
              ),
              /***/
              578: (
                /***/
                ((module3, __unused_webpack_exports, __webpack_require__2) => {
                  var LGraphManager = __webpack_require__2(551).LGraphManager;
                  function CoSEGraphManager(layout7) {
                    LGraphManager.call(this, layout7);
                  }
                  __name(CoSEGraphManager, "CoSEGraphManager");
                  CoSEGraphManager.prototype = Object.create(LGraphManager.prototype);
                  for (var prop in LGraphManager) {
                    CoSEGraphManager[prop] = LGraphManager[prop];
                  }
                  module3.exports = CoSEGraphManager;
                })
              ),
              /***/
              765: (
                /***/
                ((module3, __unused_webpack_exports, __webpack_require__2) => {
                  var FDLayout = __webpack_require__2(551).FDLayout;
                  var CoSEGraphManager = __webpack_require__2(578);
                  var CoSEGraph = __webpack_require__2(880);
                  var CoSENode = __webpack_require__2(991);
                  var CoSEEdge = __webpack_require__2(767);
                  var CoSEConstants = __webpack_require__2(806);
                  var ConstraintHandler = __webpack_require__2(902);
                  var FDLayoutConstants = __webpack_require__2(551).FDLayoutConstants;
                  var LayoutConstants = __webpack_require__2(551).LayoutConstants;
                  var Point3 = __webpack_require__2(551).Point;
                  var PointD = __webpack_require__2(551).PointD;
                  var DimensionD2 = __webpack_require__2(551).DimensionD;
                  var Layout2 = __webpack_require__2(551).Layout;
                  var Integer = __webpack_require__2(551).Integer;
                  var IGeometry = __webpack_require__2(551).IGeometry;
                  var LGraph = __webpack_require__2(551).LGraph;
                  var Transform2 = __webpack_require__2(551).Transform;
                  var LinkedList = __webpack_require__2(551).LinkedList;
                  function CoSELayout() {
                    FDLayout.call(this);
                    this.toBeTiled = {};
                    this.constraints = {};
                  }
                  __name(CoSELayout, "CoSELayout");
                  CoSELayout.prototype = Object.create(FDLayout.prototype);
                  for (var prop in FDLayout) {
                    CoSELayout[prop] = FDLayout[prop];
                  }
                  CoSELayout.prototype.newGraphManager = function() {
                    var gm = new CoSEGraphManager(this);
                    this.graphManager = gm;
                    return gm;
                  };
                  CoSELayout.prototype.newGraph = function(vGraph) {
                    return new CoSEGraph(null, this.graphManager, vGraph);
                  };
                  CoSELayout.prototype.newNode = function(vNode) {
                    return new CoSENode(this.graphManager, vNode);
                  };
                  CoSELayout.prototype.newEdge = function(vEdge) {
                    return new CoSEEdge(null, null, vEdge);
                  };
                  CoSELayout.prototype.initParameters = function() {
                    FDLayout.prototype.initParameters.call(this, arguments);
                    if (!this.isSubLayout) {
                      if (CoSEConstants.DEFAULT_EDGE_LENGTH < 10) {
                        this.idealEdgeLength = 10;
                      } else {
                        this.idealEdgeLength = CoSEConstants.DEFAULT_EDGE_LENGTH;
                      }
                      this.useSmartIdealEdgeLengthCalculation = CoSEConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION;
                      this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH;
                      this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH;
                      this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR;
                      this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR;
                      this.prunedNodesAll = [];
                      this.growTreeIterations = 0;
                      this.afterGrowthIterations = 0;
                      this.isTreeGrowing = false;
                      this.isGrowthFinished = false;
                    }
                  };
                  CoSELayout.prototype.initSpringEmbedder = function() {
                    FDLayout.prototype.initSpringEmbedder.call(this);
                    this.coolingCycle = 0;
                    this.maxCoolingCycle = this.maxIterations / FDLayoutConstants.CONVERGENCE_CHECK_PERIOD;
                    this.finalTemperature = 0.04;
                    this.coolingAdjuster = 1;
                  };
                  CoSELayout.prototype.layout = function() {
                    var createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED;
                    if (createBendsAsNeeded) {
                      this.createBendpoints();
                      this.graphManager.resetAllEdges();
                    }
                    this.level = 0;
                    return this.classicLayout();
                  };
                  CoSELayout.prototype.classicLayout = function() {
                    this.nodesWithGravity = this.calculateNodesToApplyGravitationTo();
                    this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity);
                    this.calcNoOfChildrenForAllNodes();
                    this.graphManager.calcLowestCommonAncestors();
                    this.graphManager.calcInclusionTreeDepths();
                    this.graphManager.getRoot().calcEstimatedSize();
                    this.calcIdealEdgeLengths();
                    if (!this.incremental) {
                      var forest = this.getFlatForest();
                      if (forest.length > 0) {
                        this.positionNodesRadially(forest);
                      } else {
                        this.reduceTrees();
                        this.graphManager.resetAllNodesToApplyGravitation();
                        var allNodes = new Set(this.getAllNodes());
                        var intersection4 = this.nodesWithGravity.filter(function(x5) {
                          return allNodes.has(x5);
                        });
                        this.graphManager.setAllNodesToApplyGravitation(intersection4);
                        this.positionNodesRandomly();
                      }
                    } else {
                      if (CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL) {
                        this.reduceTrees();
                        this.graphManager.resetAllNodesToApplyGravitation();
                        var allNodes = new Set(this.getAllNodes());
                        var intersection4 = this.nodesWithGravity.filter(function(x5) {
                          return allNodes.has(x5);
                        });
                        this.graphManager.setAllNodesToApplyGravitation(intersection4);
                      }
                    }
                    if (Object.keys(this.constraints).length > 0) {
                      ConstraintHandler.handleConstraints(this);
                      this.initConstraintVariables();
                    }
                    this.initSpringEmbedder();
                    if (CoSEConstants.APPLY_LAYOUT) {
                      this.runSpringEmbedder();
                    }
                    return true;
                  };
                  CoSELayout.prototype.tick = function() {
                    this.totalIterations++;
                    if (this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished) {
                      if (this.prunedNodesAll.length > 0) {
                        this.isTreeGrowing = true;
                      } else {
                        return true;
                      }
                    }
                    if (this.totalIterations % FDLayoutConstants.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) {
                      if (this.isConverged()) {
                        if (this.prunedNodesAll.length > 0) {
                          this.isTreeGrowing = true;
                        } else {
                          return true;
                        }
                      }
                      this.coolingCycle++;
                      if (this.layoutQuality == 0) {
                        this.coolingAdjuster = this.coolingCycle;
                      } else if (this.layoutQuality == 1) {
                        this.coolingAdjuster = this.coolingCycle / 3;
                      }
                      this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature);
                      this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor));
                    }
                    if (this.isTreeGrowing) {
                      if (this.growTreeIterations % 10 == 0) {
                        if (this.prunedNodesAll.length > 0) {
                          this.graphManager.updateBounds();
                          this.updateGrid();
                          this.growTree(this.prunedNodesAll);
                          this.graphManager.resetAllNodesToApplyGravitation();
                          var allNodes = new Set(this.getAllNodes());
                          var intersection4 = this.nodesWithGravity.filter(function(x5) {
                            return allNodes.has(x5);
                          });
                          this.graphManager.setAllNodesToApplyGravitation(intersection4);
                          this.graphManager.updateBounds();
                          this.updateGrid();
                          if (CoSEConstants.PURE_INCREMENTAL) this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2;
                          else this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL;
                        } else {
                          this.isTreeGrowing = false;
                          this.isGrowthFinished = true;
                        }
                      }
                      this.growTreeIterations++;
                    }
                    if (this.isGrowthFinished) {
                      if (this.isConverged()) {
                        return true;
                      }
                      if (this.afterGrowthIterations % 10 == 0) {
                        this.graphManager.updateBounds();
                        this.updateGrid();
                      }
                      if (CoSEConstants.PURE_INCREMENTAL) this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2 * ((100 - this.afterGrowthIterations) / 100);
                      else this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100);
                      this.afterGrowthIterations++;
                    }
                    var gridUpdateAllowed = !this.isTreeGrowing && !this.isGrowthFinished;
                    var forceToNodeSurroundingUpdate = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished;
                    this.totalDisplacement = 0;
                    this.graphManager.updateBounds();
                    this.calcSpringForces();
                    this.calcRepulsionForces(gridUpdateAllowed, forceToNodeSurroundingUpdate);
                    this.calcGravitationalForces();
                    this.moveNodes();
                    this.animate();
                    return false;
                  };
                  CoSELayout.prototype.getPositionsData = function() {
                    var allNodes = this.graphManager.getAllNodes();
                    var pData = {};
                    for (var i2 = 0; i2 < allNodes.length; i2++) {
                      var rect3 = allNodes[i2].rect;
                      var id34 = allNodes[i2].id;
                      pData[id34] = {
                        id: id34,
                        x: rect3.getCenterX(),
                        y: rect3.getCenterY(),
                        w: rect3.width,
                        h: rect3.height
                      };
                    }
                    return pData;
                  };
                  CoSELayout.prototype.runSpringEmbedder = function() {
                    this.initialAnimationPeriod = 25;
                    this.animationPeriod = this.initialAnimationPeriod;
                    var layoutEnded = false;
                    if (FDLayoutConstants.ANIMATE === "during") {
                      this.emit("layoutstarted");
                    } else {
                      while (!layoutEnded) {
                        layoutEnded = this.tick();
                      }
                      this.graphManager.updateBounds();
                    }
                  };
                  CoSELayout.prototype.moveNodes = function() {
                    var lNodes = this.getAllNodes();
                    var node2;
                    for (var i2 = 0; i2 < lNodes.length; i2++) {
                      node2 = lNodes[i2];
                      node2.calculateDisplacement();
                    }
                    if (Object.keys(this.constraints).length > 0) {
                      this.updateDisplacements();
                    }
                    for (var i2 = 0; i2 < lNodes.length; i2++) {
                      node2 = lNodes[i2];
                      node2.move();
                    }
                  };
                  CoSELayout.prototype.initConstraintVariables = function() {
                    var self2 = this;
                    this.idToNodeMap = /* @__PURE__ */ new Map();
                    this.fixedNodeSet = /* @__PURE__ */ new Set();
                    var allNodes = this.graphManager.getAllNodes();
                    for (var i2 = 0; i2 < allNodes.length; i2++) {
                      var node2 = allNodes[i2];
                      this.idToNodeMap.set(node2.id, node2);
                    }
                    var calculateCompoundWeight = /* @__PURE__ */ __name(function calculateCompoundWeight2(compoundNode) {
                      var nodes5 = compoundNode.getChild().getNodes();
                      var node3;
                      var fixedNodeWeight2 = 0;
                      for (var i3 = 0; i3 < nodes5.length; i3++) {
                        node3 = nodes5[i3];
                        if (node3.getChild() == null) {
                          if (self2.fixedNodeSet.has(node3.id)) {
                            fixedNodeWeight2 += 100;
                          }
                        } else {
                          fixedNodeWeight2 += calculateCompoundWeight2(node3);
                        }
                      }
                      return fixedNodeWeight2;
                    }, "calculateCompoundWeight");
                    if (this.constraints.fixedNodeConstraint) {
                      this.constraints.fixedNodeConstraint.forEach(function(nodeData2) {
                        self2.fixedNodeSet.add(nodeData2.nodeId);
                      });
                      var allNodes = this.graphManager.getAllNodes();
                      var node2;
                      for (var i2 = 0; i2 < allNodes.length; i2++) {
                        node2 = allNodes[i2];
                        if (node2.getChild() != null) {
                          var fixedNodeWeight = calculateCompoundWeight(node2);
                          if (fixedNodeWeight > 0) {
                            node2.fixedNodeWeight = fixedNodeWeight;
                          }
                        }
                      }
                    }
                    if (this.constraints.relativePlacementConstraint) {
                      var nodeToDummyForVerticalAlignment = /* @__PURE__ */ new Map();
                      var nodeToDummyForHorizontalAlignment = /* @__PURE__ */ new Map();
                      this.dummyToNodeForVerticalAlignment = /* @__PURE__ */ new Map();
                      this.dummyToNodeForHorizontalAlignment = /* @__PURE__ */ new Map();
                      this.fixedNodesOnHorizontal = /* @__PURE__ */ new Set();
                      this.fixedNodesOnVertical = /* @__PURE__ */ new Set();
                      this.fixedNodeSet.forEach(function(nodeId) {
                        self2.fixedNodesOnHorizontal.add(nodeId);
                        self2.fixedNodesOnVertical.add(nodeId);
                      });
                      if (this.constraints.alignmentConstraint) {
                        if (this.constraints.alignmentConstraint.vertical) {
                          var verticalAlignment2 = this.constraints.alignmentConstraint.vertical;
                          for (var i2 = 0; i2 < verticalAlignment2.length; i2++) {
                            this.dummyToNodeForVerticalAlignment.set("dummy" + i2, []);
                            verticalAlignment2[i2].forEach(function(nodeId) {
                              nodeToDummyForVerticalAlignment.set(nodeId, "dummy" + i2);
                              self2.dummyToNodeForVerticalAlignment.get("dummy" + i2).push(nodeId);
                              if (self2.fixedNodeSet.has(nodeId)) {
                                self2.fixedNodesOnHorizontal.add("dummy" + i2);
                              }
                            });
                          }
                        }
                        if (this.constraints.alignmentConstraint.horizontal) {
                          var horizontalAlignment = this.constraints.alignmentConstraint.horizontal;
                          for (var i2 = 0; i2 < horizontalAlignment.length; i2++) {
                            this.dummyToNodeForHorizontalAlignment.set("dummy" + i2, []);
                            horizontalAlignment[i2].forEach(function(nodeId) {
                              nodeToDummyForHorizontalAlignment.set(nodeId, "dummy" + i2);
                              self2.dummyToNodeForHorizontalAlignment.get("dummy" + i2).push(nodeId);
                              if (self2.fixedNodeSet.has(nodeId)) {
                                self2.fixedNodesOnVertical.add("dummy" + i2);
                              }
                            });
                          }
                        }
                      }
                      if (CoSEConstants.RELAX_MOVEMENT_ON_CONSTRAINTS) {
                        this.shuffle = function(array4) {
                          var j3, x5, i3;
                          for (i3 = array4.length - 1; i3 >= 2 * array4.length / 3; i3--) {
                            j3 = Math.floor(Math.random() * (i3 + 1));
                            x5 = array4[i3];
                            array4[i3] = array4[j3];
                            array4[j3] = x5;
                          }
                          return array4;
                        };
                        this.nodesInRelativeHorizontal = [];
                        this.nodesInRelativeVertical = [];
                        this.nodeToRelativeConstraintMapHorizontal = /* @__PURE__ */ new Map();
                        this.nodeToRelativeConstraintMapVertical = /* @__PURE__ */ new Map();
                        this.nodeToTempPositionMapHorizontal = /* @__PURE__ */ new Map();
                        this.nodeToTempPositionMapVertical = /* @__PURE__ */ new Map();
                        this.constraints.relativePlacementConstraint.forEach(function(constraint) {
                          if (constraint.left) {
                            var nodeIdLeft = nodeToDummyForVerticalAlignment.has(constraint.left) ? nodeToDummyForVerticalAlignment.get(constraint.left) : constraint.left;
                            var nodeIdRight = nodeToDummyForVerticalAlignment.has(constraint.right) ? nodeToDummyForVerticalAlignment.get(constraint.right) : constraint.right;
                            if (!self2.nodesInRelativeHorizontal.includes(nodeIdLeft)) {
                              self2.nodesInRelativeHorizontal.push(nodeIdLeft);
                              self2.nodeToRelativeConstraintMapHorizontal.set(nodeIdLeft, []);
                              if (self2.dummyToNodeForVerticalAlignment.has(nodeIdLeft)) {
                                self2.nodeToTempPositionMapHorizontal.set(nodeIdLeft, self2.idToNodeMap.get(self2.dummyToNodeForVerticalAlignment.get(nodeIdLeft)[0]).getCenterX());
                              } else {
                                self2.nodeToTempPositionMapHorizontal.set(nodeIdLeft, self2.idToNodeMap.get(nodeIdLeft).getCenterX());
                              }
                            }
                            if (!self2.nodesInRelativeHorizontal.includes(nodeIdRight)) {
                              self2.nodesInRelativeHorizontal.push(nodeIdRight);
                              self2.nodeToRelativeConstraintMapHorizontal.set(nodeIdRight, []);
                              if (self2.dummyToNodeForVerticalAlignment.has(nodeIdRight)) {
                                self2.nodeToTempPositionMapHorizontal.set(nodeIdRight, self2.idToNodeMap.get(self2.dummyToNodeForVerticalAlignment.get(nodeIdRight)[0]).getCenterX());
                              } else {
                                self2.nodeToTempPositionMapHorizontal.set(nodeIdRight, self2.idToNodeMap.get(nodeIdRight).getCenterX());
                              }
                            }
                            self2.nodeToRelativeConstraintMapHorizontal.get(nodeIdLeft).push({ right: nodeIdRight, gap: constraint.gap });
                            self2.nodeToRelativeConstraintMapHorizontal.get(nodeIdRight).push({ left: nodeIdLeft, gap: constraint.gap });
                          } else {
                            var nodeIdTop = nodeToDummyForHorizontalAlignment.has(constraint.top) ? nodeToDummyForHorizontalAlignment.get(constraint.top) : constraint.top;
                            var nodeIdBottom = nodeToDummyForHorizontalAlignment.has(constraint.bottom) ? nodeToDummyForHorizontalAlignment.get(constraint.bottom) : constraint.bottom;
                            if (!self2.nodesInRelativeVertical.includes(nodeIdTop)) {
                              self2.nodesInRelativeVertical.push(nodeIdTop);
                              self2.nodeToRelativeConstraintMapVertical.set(nodeIdTop, []);
                              if (self2.dummyToNodeForHorizontalAlignment.has(nodeIdTop)) {
                                self2.nodeToTempPositionMapVertical.set(nodeIdTop, self2.idToNodeMap.get(self2.dummyToNodeForHorizontalAlignment.get(nodeIdTop)[0]).getCenterY());
                              } else {
                                self2.nodeToTempPositionMapVertical.set(nodeIdTop, self2.idToNodeMap.get(nodeIdTop).getCenterY());
                              }
                            }
                            if (!self2.nodesInRelativeVertical.includes(nodeIdBottom)) {
                              self2.nodesInRelativeVertical.push(nodeIdBottom);
                              self2.nodeToRelativeConstraintMapVertical.set(nodeIdBottom, []);
                              if (self2.dummyToNodeForHorizontalAlignment.has(nodeIdBottom)) {
                                self2.nodeToTempPositionMapVertical.set(nodeIdBottom, self2.idToNodeMap.get(self2.dummyToNodeForHorizontalAlignment.get(nodeIdBottom)[0]).getCenterY());
                              } else {
                                self2.nodeToTempPositionMapVertical.set(nodeIdBottom, self2.idToNodeMap.get(nodeIdBottom).getCenterY());
                              }
                            }
                            self2.nodeToRelativeConstraintMapVertical.get(nodeIdTop).push({ bottom: nodeIdBottom, gap: constraint.gap });
                            self2.nodeToRelativeConstraintMapVertical.get(nodeIdBottom).push({ top: nodeIdTop, gap: constraint.gap });
                          }
                        });
                      } else {
                        var subGraphOnHorizontal = /* @__PURE__ */ new Map();
                        var subGraphOnVertical = /* @__PURE__ */ new Map();
                        this.constraints.relativePlacementConstraint.forEach(function(constraint) {
                          if (constraint.left) {
                            var left3 = nodeToDummyForVerticalAlignment.has(constraint.left) ? nodeToDummyForVerticalAlignment.get(constraint.left) : constraint.left;
                            var right3 = nodeToDummyForVerticalAlignment.has(constraint.right) ? nodeToDummyForVerticalAlignment.get(constraint.right) : constraint.right;
                            if (subGraphOnHorizontal.has(left3)) {
                              subGraphOnHorizontal.get(left3).push(right3);
                            } else {
                              subGraphOnHorizontal.set(left3, [right3]);
                            }
                            if (subGraphOnHorizontal.has(right3)) {
                              subGraphOnHorizontal.get(right3).push(left3);
                            } else {
                              subGraphOnHorizontal.set(right3, [left3]);
                            }
                          } else {
                            var top2 = nodeToDummyForHorizontalAlignment.has(constraint.top) ? nodeToDummyForHorizontalAlignment.get(constraint.top) : constraint.top;
                            var bottom2 = nodeToDummyForHorizontalAlignment.has(constraint.bottom) ? nodeToDummyForHorizontalAlignment.get(constraint.bottom) : constraint.bottom;
                            if (subGraphOnVertical.has(top2)) {
                              subGraphOnVertical.get(top2).push(bottom2);
                            } else {
                              subGraphOnVertical.set(top2, [bottom2]);
                            }
                            if (subGraphOnVertical.has(bottom2)) {
                              subGraphOnVertical.get(bottom2).push(top2);
                            } else {
                              subGraphOnVertical.set(bottom2, [top2]);
                            }
                          }
                        });
                        var constructComponents = /* @__PURE__ */ __name(function constructComponents2(graph, fixedNodes) {
                          var components3 = [];
                          var isFixed = [];
                          var queue = new LinkedList();
                          var visited = /* @__PURE__ */ new Set();
                          var count2 = 0;
                          graph.forEach(function(value2, key) {
                            if (!visited.has(key)) {
                              components3[count2] = [];
                              isFixed[count2] = false;
                              var currentNode = key;
                              queue.push(currentNode);
                              visited.add(currentNode);
                              components3[count2].push(currentNode);
                              while (queue.length != 0) {
                                currentNode = queue.shift();
                                if (fixedNodes.has(currentNode)) {
                                  isFixed[count2] = true;
                                }
                                var neighbors = graph.get(currentNode);
                                neighbors.forEach(function(neighbor) {
                                  if (!visited.has(neighbor)) {
                                    queue.push(neighbor);
                                    visited.add(neighbor);
                                    components3[count2].push(neighbor);
                                  }
                                });
                              }
                              count2++;
                            }
                          });
                          return { components: components3, isFixed };
                        }, "constructComponents");
                        var resultOnHorizontal = constructComponents(subGraphOnHorizontal, self2.fixedNodesOnHorizontal);
                        this.componentsOnHorizontal = resultOnHorizontal.components;
                        this.fixedComponentsOnHorizontal = resultOnHorizontal.isFixed;
                        var resultOnVertical = constructComponents(subGraphOnVertical, self2.fixedNodesOnVertical);
                        this.componentsOnVertical = resultOnVertical.components;
                        this.fixedComponentsOnVertical = resultOnVertical.isFixed;
                      }
                    }
                  };
                  CoSELayout.prototype.updateDisplacements = function() {
                    var self2 = this;
                    if (this.constraints.fixedNodeConstraint) {
                      this.constraints.fixedNodeConstraint.forEach(function(nodeData2) {
                        var fixedNode = self2.idToNodeMap.get(nodeData2.nodeId);
                        fixedNode.displacementX = 0;
                        fixedNode.displacementY = 0;
                      });
                    }
                    if (this.constraints.alignmentConstraint) {
                      if (this.constraints.alignmentConstraint.vertical) {
                        var allVerticalAlignments = this.constraints.alignmentConstraint.vertical;
                        for (var i2 = 0; i2 < allVerticalAlignments.length; i2++) {
                          var totalDisplacementX = 0;
                          for (var j3 = 0; j3 < allVerticalAlignments[i2].length; j3++) {
                            if (this.fixedNodeSet.has(allVerticalAlignments[i2][j3])) {
                              totalDisplacementX = 0;
                              break;
                            }
                            totalDisplacementX += this.idToNodeMap.get(allVerticalAlignments[i2][j3]).displacementX;
                          }
                          var averageDisplacementX = totalDisplacementX / allVerticalAlignments[i2].length;
                          for (var j3 = 0; j3 < allVerticalAlignments[i2].length; j3++) {
                            this.idToNodeMap.get(allVerticalAlignments[i2][j3]).displacementX = averageDisplacementX;
                          }
                        }
                      }
                      if (this.constraints.alignmentConstraint.horizontal) {
                        var allHorizontalAlignments = this.constraints.alignmentConstraint.horizontal;
                        for (var i2 = 0; i2 < allHorizontalAlignments.length; i2++) {
                          var totalDisplacementY = 0;
                          for (var j3 = 0; j3 < allHorizontalAlignments[i2].length; j3++) {
                            if (this.fixedNodeSet.has(allHorizontalAlignments[i2][j3])) {
                              totalDisplacementY = 0;
                              break;
                            }
                            totalDisplacementY += this.idToNodeMap.get(allHorizontalAlignments[i2][j3]).displacementY;
                          }
                          var averageDisplacementY = totalDisplacementY / allHorizontalAlignments[i2].length;
                          for (var j3 = 0; j3 < allHorizontalAlignments[i2].length; j3++) {
                            this.idToNodeMap.get(allHorizontalAlignments[i2][j3]).displacementY = averageDisplacementY;
                          }
                        }
                      }
                    }
                    if (this.constraints.relativePlacementConstraint) {
                      if (CoSEConstants.RELAX_MOVEMENT_ON_CONSTRAINTS) {
                        if (this.totalIterations % 10 == 0) {
                          this.shuffle(this.nodesInRelativeHorizontal);
                          this.shuffle(this.nodesInRelativeVertical);
                        }
                        this.nodesInRelativeHorizontal.forEach(function(nodeId) {
                          if (!self2.fixedNodesOnHorizontal.has(nodeId)) {
                            var displacement = 0;
                            if (self2.dummyToNodeForVerticalAlignment.has(nodeId)) {
                              displacement = self2.idToNodeMap.get(self2.dummyToNodeForVerticalAlignment.get(nodeId)[0]).displacementX;
                            } else {
                              displacement = self2.idToNodeMap.get(nodeId).displacementX;
                            }
                            self2.nodeToRelativeConstraintMapHorizontal.get(nodeId).forEach(function(constraint) {
                              if (constraint.right) {
                                var diff2 = self2.nodeToTempPositionMapHorizontal.get(constraint.right) - self2.nodeToTempPositionMapHorizontal.get(nodeId) - displacement;
                                if (diff2 < constraint.gap) {
                                  displacement -= constraint.gap - diff2;
                                }
                              } else {
                                var diff2 = self2.nodeToTempPositionMapHorizontal.get(nodeId) - self2.nodeToTempPositionMapHorizontal.get(constraint.left) + displacement;
                                if (diff2 < constraint.gap) {
                                  displacement += constraint.gap - diff2;
                                }
                              }
                            });
                            self2.nodeToTempPositionMapHorizontal.set(nodeId, self2.nodeToTempPositionMapHorizontal.get(nodeId) + displacement);
                            if (self2.dummyToNodeForVerticalAlignment.has(nodeId)) {
                              self2.dummyToNodeForVerticalAlignment.get(nodeId).forEach(function(nodeId2) {
                                self2.idToNodeMap.get(nodeId2).displacementX = displacement;
                              });
                            } else {
                              self2.idToNodeMap.get(nodeId).displacementX = displacement;
                            }
                          }
                        });
                        this.nodesInRelativeVertical.forEach(function(nodeId) {
                          if (!self2.fixedNodesOnHorizontal.has(nodeId)) {
                            var displacement = 0;
                            if (self2.dummyToNodeForHorizontalAlignment.has(nodeId)) {
                              displacement = self2.idToNodeMap.get(self2.dummyToNodeForHorizontalAlignment.get(nodeId)[0]).displacementY;
                            } else {
                              displacement = self2.idToNodeMap.get(nodeId).displacementY;
                            }
                            self2.nodeToRelativeConstraintMapVertical.get(nodeId).forEach(function(constraint) {
                              if (constraint.bottom) {
                                var diff2 = self2.nodeToTempPositionMapVertical.get(constraint.bottom) - self2.nodeToTempPositionMapVertical.get(nodeId) - displacement;
                                if (diff2 < constraint.gap) {
                                  displacement -= constraint.gap - diff2;
                                }
                              } else {
                                var diff2 = self2.nodeToTempPositionMapVertical.get(nodeId) - self2.nodeToTempPositionMapVertical.get(constraint.top) + displacement;
                                if (diff2 < constraint.gap) {
                                  displacement += constraint.gap - diff2;
                                }
                              }
                            });
                            self2.nodeToTempPositionMapVertical.set(nodeId, self2.nodeToTempPositionMapVertical.get(nodeId) + displacement);
                            if (self2.dummyToNodeForHorizontalAlignment.has(nodeId)) {
                              self2.dummyToNodeForHorizontalAlignment.get(nodeId).forEach(function(nodeId2) {
                                self2.idToNodeMap.get(nodeId2).displacementY = displacement;
                              });
                            } else {
                              self2.idToNodeMap.get(nodeId).displacementY = displacement;
                            }
                          }
                        });
                      } else {
                        for (var i2 = 0; i2 < this.componentsOnHorizontal.length; i2++) {
                          var component2 = this.componentsOnHorizontal[i2];
                          if (this.fixedComponentsOnHorizontal[i2]) {
                            for (var j3 = 0; j3 < component2.length; j3++) {
                              if (this.dummyToNodeForVerticalAlignment.has(component2[j3])) {
                                this.dummyToNodeForVerticalAlignment.get(component2[j3]).forEach(function(nodeId) {
                                  self2.idToNodeMap.get(nodeId).displacementX = 0;
                                });
                              } else {
                                this.idToNodeMap.get(component2[j3]).displacementX = 0;
                              }
                            }
                          } else {
                            var sum2 = 0;
                            var count2 = 0;
                            for (var j3 = 0; j3 < component2.length; j3++) {
                              if (this.dummyToNodeForVerticalAlignment.has(component2[j3])) {
                                var actualNodes = this.dummyToNodeForVerticalAlignment.get(component2[j3]);
                                sum2 += actualNodes.length * this.idToNodeMap.get(actualNodes[0]).displacementX;
                                count2 += actualNodes.length;
                              } else {
                                sum2 += this.idToNodeMap.get(component2[j3]).displacementX;
                                count2++;
                              }
                            }
                            var averageDisplacement = sum2 / count2;
                            for (var j3 = 0; j3 < component2.length; j3++) {
                              if (this.dummyToNodeForVerticalAlignment.has(component2[j3])) {
                                this.dummyToNodeForVerticalAlignment.get(component2[j3]).forEach(function(nodeId) {
                                  self2.idToNodeMap.get(nodeId).displacementX = averageDisplacement;
                                });
                              } else {
                                this.idToNodeMap.get(component2[j3]).displacementX = averageDisplacement;
                              }
                            }
                          }
                        }
                        for (var i2 = 0; i2 < this.componentsOnVertical.length; i2++) {
                          var component2 = this.componentsOnVertical[i2];
                          if (this.fixedComponentsOnVertical[i2]) {
                            for (var j3 = 0; j3 < component2.length; j3++) {
                              if (this.dummyToNodeForHorizontalAlignment.has(component2[j3])) {
                                this.dummyToNodeForHorizontalAlignment.get(component2[j3]).forEach(function(nodeId) {
                                  self2.idToNodeMap.get(nodeId).displacementY = 0;
                                });
                              } else {
                                this.idToNodeMap.get(component2[j3]).displacementY = 0;
                              }
                            }
                          } else {
                            var sum2 = 0;
                            var count2 = 0;
                            for (var j3 = 0; j3 < component2.length; j3++) {
                              if (this.dummyToNodeForHorizontalAlignment.has(component2[j3])) {
                                var actualNodes = this.dummyToNodeForHorizontalAlignment.get(component2[j3]);
                                sum2 += actualNodes.length * this.idToNodeMap.get(actualNodes[0]).displacementY;
                                count2 += actualNodes.length;
                              } else {
                                sum2 += this.idToNodeMap.get(component2[j3]).displacementY;
                                count2++;
                              }
                            }
                            var averageDisplacement = sum2 / count2;
                            for (var j3 = 0; j3 < component2.length; j3++) {
                              if (this.dummyToNodeForHorizontalAlignment.has(component2[j3])) {
                                this.dummyToNodeForHorizontalAlignment.get(component2[j3]).forEach(function(nodeId) {
                                  self2.idToNodeMap.get(nodeId).displacementY = averageDisplacement;
                                });
                              } else {
                                this.idToNodeMap.get(component2[j3]).displacementY = averageDisplacement;
                              }
                            }
                          }
                        }
                      }
                    }
                  };
                  CoSELayout.prototype.calculateNodesToApplyGravitationTo = function() {
                    var nodeList = [];
                    var graph;
                    var graphs = this.graphManager.getGraphs();
                    var size4 = graphs.length;
                    var i2;
                    for (i2 = 0; i2 < size4; i2++) {
                      graph = graphs[i2];
                      graph.updateConnected();
                      if (!graph.isConnected) {
                        nodeList = nodeList.concat(graph.getNodes());
                      }
                    }
                    return nodeList;
                  };
                  CoSELayout.prototype.createBendpoints = function() {
                    var edges3 = [];
                    edges3 = edges3.concat(this.graphManager.getAllEdges());
                    var visited = /* @__PURE__ */ new Set();
                    var i2;
                    for (i2 = 0; i2 < edges3.length; i2++) {
                      var edge = edges3[i2];
                      if (!visited.has(edge)) {
                        var source = edge.getSource();
                        var target = edge.getTarget();
                        if (source == target) {
                          edge.getBendpoints().push(new PointD());
                          edge.getBendpoints().push(new PointD());
                          this.createDummyNodesForBendpoints(edge);
                          visited.add(edge);
                        } else {
                          var edgeList2 = [];
                          edgeList2 = edgeList2.concat(source.getEdgeListToNode(target));
                          edgeList2 = edgeList2.concat(target.getEdgeListToNode(source));
                          if (!visited.has(edgeList2[0])) {
                            if (edgeList2.length > 1) {
                              var k2;
                              for (k2 = 0; k2 < edgeList2.length; k2++) {
                                var multiEdge = edgeList2[k2];
                                multiEdge.getBendpoints().push(new PointD());
                                this.createDummyNodesForBendpoints(multiEdge);
                              }
                            }
                            edgeList2.forEach(function(edge2) {
                              visited.add(edge2);
                            });
                          }
                        }
                      }
                      if (visited.size == edges3.length) {
                        break;
                      }
                    }
                  };
                  CoSELayout.prototype.positionNodesRadially = function(forest) {
                    var currentStartingPoint = new Point3(0, 0);
                    var numberOfColumns = Math.ceil(Math.sqrt(forest.length));
                    var height2 = 0;
                    var currentY = 0;
                    var currentX = 0;
                    var point8 = new PointD(0, 0);
                    for (var i2 = 0; i2 < forest.length; i2++) {
                      if (i2 % numberOfColumns == 0) {
                        currentX = 0;
                        currentY = height2;
                        if (i2 != 0) {
                          currentY += CoSEConstants.DEFAULT_COMPONENT_SEPERATION;
                        }
                        height2 = 0;
                      }
                      var tree = forest[i2];
                      var centerNode = Layout2.findCenterOfTree(tree);
                      currentStartingPoint.x = currentX;
                      currentStartingPoint.y = currentY;
                      point8 = CoSELayout.radialLayout(tree, centerNode, currentStartingPoint);
                      if (point8.y > height2) {
                        height2 = Math.floor(point8.y);
                      }
                      currentX = Math.floor(point8.x + CoSEConstants.DEFAULT_COMPONENT_SEPERATION);
                    }
                    this.transform(new PointD(LayoutConstants.WORLD_CENTER_X - point8.x / 2, LayoutConstants.WORLD_CENTER_Y - point8.y / 2));
                  };
                  CoSELayout.radialLayout = function(tree, centerNode, startingPoint) {
                    var radialSep = Math.max(this.maxDiagonalInTree(tree), CoSEConstants.DEFAULT_RADIAL_SEPARATION);
                    CoSELayout.branchRadialLayout(centerNode, null, 0, 359, 0, radialSep);
                    var bounds4 = LGraph.calculateBounds(tree);
                    var transform8 = new Transform2();
                    transform8.setDeviceOrgX(bounds4.getMinX());
                    transform8.setDeviceOrgY(bounds4.getMinY());
                    transform8.setWorldOrgX(startingPoint.x);
                    transform8.setWorldOrgY(startingPoint.y);
                    for (var i2 = 0; i2 < tree.length; i2++) {
                      var node2 = tree[i2];
                      node2.transform(transform8);
                    }
                    var bottomRight = new PointD(bounds4.getMaxX(), bounds4.getMaxY());
                    return transform8.inverseTransformPoint(bottomRight);
                  };
                  CoSELayout.branchRadialLayout = function(node2, parentOfNode, startAngle, endAngle, distance3, radialSeparation) {
                    var halfInterval = (endAngle - startAngle + 1) / 2;
                    if (halfInterval < 0) {
                      halfInterval += 180;
                    }
                    var nodeAngle = (halfInterval + startAngle) % 360;
                    var teta = nodeAngle * IGeometry.TWO_PI / 360;
                    var cos_teta = Math.cos(teta);
                    var x_ = distance3 * Math.cos(teta);
                    var y_ = distance3 * Math.sin(teta);
                    node2.setCenter(x_, y_);
                    var neighborEdges = [];
                    neighborEdges = neighborEdges.concat(node2.getEdges());
                    var childCount = neighborEdges.length;
                    if (parentOfNode != null) {
                      childCount--;
                    }
                    var branchCount = 0;
                    var incEdgesCount = neighborEdges.length;
                    var startIndex;
                    var edges3 = node2.getEdgesBetween(parentOfNode);
                    while (edges3.length > 1) {
                      var temp = edges3[0];
                      edges3.splice(0, 1);
                      var index = neighborEdges.indexOf(temp);
                      if (index >= 0) {
                        neighborEdges.splice(index, 1);
                      }
                      incEdgesCount--;
                      childCount--;
                    }
                    if (parentOfNode != null) {
                      startIndex = (neighborEdges.indexOf(edges3[0]) + 1) % incEdgesCount;
                    } else {
                      startIndex = 0;
                    }
                    var stepAngle = Math.abs(endAngle - startAngle) / childCount;
                    for (var i2 = startIndex; branchCount != childCount; i2 = ++i2 % incEdgesCount) {
                      var currentNeighbor = neighborEdges[i2].getOtherEnd(node2);
                      if (currentNeighbor == parentOfNode) {
                        continue;
                      }
                      var childStartAngle = (startAngle + branchCount * stepAngle) % 360;
                      var childEndAngle = (childStartAngle + stepAngle) % 360;
                      CoSELayout.branchRadialLayout(currentNeighbor, node2, childStartAngle, childEndAngle, distance3 + radialSeparation, radialSeparation);
                      branchCount++;
                    }
                  };
                  CoSELayout.maxDiagonalInTree = function(tree) {
                    var maxDiagonal = Integer.MIN_VALUE;
                    for (var i2 = 0; i2 < tree.length; i2++) {
                      var node2 = tree[i2];
                      var diagonal = node2.getDiagonal();
                      if (diagonal > maxDiagonal) {
                        maxDiagonal = diagonal;
                      }
                    }
                    return maxDiagonal;
                  };
                  CoSELayout.prototype.calcRepulsionRange = function() {
                    return 2 * (this.level + 1) * this.idealEdgeLength;
                  };
                  CoSELayout.prototype.groupZeroDegreeMembers = function() {
                    var self2 = this;
                    var tempMemberGroups = {};
                    this.memberGroups = {};
                    this.idToDummyNode = {};
                    var zeroDegree = [];
                    var allNodes = this.graphManager.getAllNodes();
                    for (var i2 = 0; i2 < allNodes.length; i2++) {
                      var node2 = allNodes[i2];
                      var parent4 = node2.getParent();
                      if (this.getNodeDegreeWithChildren(node2) === 0 && (parent4.id == void 0 || !this.getToBeTiled(parent4))) {
                        zeroDegree.push(node2);
                      }
                    }
                    for (var i2 = 0; i2 < zeroDegree.length; i2++) {
                      var node2 = zeroDegree[i2];
                      var p_id = node2.getParent().id;
                      if (typeof tempMemberGroups[p_id] === "undefined") tempMemberGroups[p_id] = [];
                      tempMemberGroups[p_id] = tempMemberGroups[p_id].concat(node2);
                    }
                    Object.keys(tempMemberGroups).forEach(function(p_id2) {
                      if (tempMemberGroups[p_id2].length > 1) {
                        var dummyCompoundId = "DummyCompound_" + p_id2;
                        self2.memberGroups[dummyCompoundId] = tempMemberGroups[p_id2];
                        var parent5 = tempMemberGroups[p_id2][0].getParent();
                        var dummyCompound = new CoSENode(self2.graphManager);
                        dummyCompound.id = dummyCompoundId;
                        dummyCompound.paddingLeft = parent5.paddingLeft || 0;
                        dummyCompound.paddingRight = parent5.paddingRight || 0;
                        dummyCompound.paddingBottom = parent5.paddingBottom || 0;
                        dummyCompound.paddingTop = parent5.paddingTop || 0;
                        self2.idToDummyNode[dummyCompoundId] = dummyCompound;
                        var dummyParentGraph = self2.getGraphManager().add(self2.newGraph(), dummyCompound);
                        var parentGraph = parent5.getChild();
                        parentGraph.add(dummyCompound);
                        for (var i3 = 0; i3 < tempMemberGroups[p_id2].length; i3++) {
                          var node3 = tempMemberGroups[p_id2][i3];
                          parentGraph.remove(node3);
                          dummyParentGraph.add(node3);
                        }
                      }
                    });
                  };
                  CoSELayout.prototype.clearCompounds = function() {
                    var childGraphMap = {};
                    var idToNode = {};
                    this.performDFSOnCompounds();
                    for (var i2 = 0; i2 < this.compoundOrder.length; i2++) {
                      idToNode[this.compoundOrder[i2].id] = this.compoundOrder[i2];
                      childGraphMap[this.compoundOrder[i2].id] = [].concat(this.compoundOrder[i2].getChild().getNodes());
                      this.graphManager.remove(this.compoundOrder[i2].getChild());
                      this.compoundOrder[i2].child = null;
                    }
                    this.graphManager.resetAllNodes();
                    this.tileCompoundMembers(childGraphMap, idToNode);
                  };
                  CoSELayout.prototype.clearZeroDegreeMembers = function() {
                    var self2 = this;
                    var tiledZeroDegreePack = this.tiledZeroDegreePack = [];
                    Object.keys(this.memberGroups).forEach(function(id34) {
                      var compoundNode = self2.idToDummyNode[id34];
                      tiledZeroDegreePack[id34] = self2.tileNodes(self2.memberGroups[id34], compoundNode.paddingLeft + compoundNode.paddingRight);
                      compoundNode.rect.width = tiledZeroDegreePack[id34].width;
                      compoundNode.rect.height = tiledZeroDegreePack[id34].height;
                      compoundNode.setCenter(tiledZeroDegreePack[id34].centerX, tiledZeroDegreePack[id34].centerY);
                      compoundNode.labelMarginLeft = 0;
                      compoundNode.labelMarginTop = 0;
                      if (CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS) {
                        var width3 = compoundNode.rect.width;
                        var height2 = compoundNode.rect.height;
                        if (compoundNode.labelWidth) {
                          if (compoundNode.labelPosHorizontal == "left") {
                            compoundNode.rect.x -= compoundNode.labelWidth;
                            compoundNode.setWidth(width3 + compoundNode.labelWidth);
                            compoundNode.labelMarginLeft = compoundNode.labelWidth;
                          } else if (compoundNode.labelPosHorizontal == "center" && compoundNode.labelWidth > width3) {
                            compoundNode.rect.x -= (compoundNode.labelWidth - width3) / 2;
                            compoundNode.setWidth(compoundNode.labelWidth);
                            compoundNode.labelMarginLeft = (compoundNode.labelWidth - width3) / 2;
                          } else if (compoundNode.labelPosHorizontal == "right") {
                            compoundNode.setWidth(width3 + compoundNode.labelWidth);
                          }
                        }
                        if (compoundNode.labelHeight) {
                          if (compoundNode.labelPosVertical == "top") {
                            compoundNode.rect.y -= compoundNode.labelHeight;
                            compoundNode.setHeight(height2 + compoundNode.labelHeight);
                            compoundNode.labelMarginTop = compoundNode.labelHeight;
                          } else if (compoundNode.labelPosVertical == "center" && compoundNode.labelHeight > height2) {
                            compoundNode.rect.y -= (compoundNode.labelHeight - height2) / 2;
                            compoundNode.setHeight(compoundNode.labelHeight);
                            compoundNode.labelMarginTop = (compoundNode.labelHeight - height2) / 2;
                          } else if (compoundNode.labelPosVertical == "bottom") {
                            compoundNode.setHeight(height2 + compoundNode.labelHeight);
                          }
                        }
                      }
                    });
                  };
                  CoSELayout.prototype.repopulateCompounds = function() {
                    for (var i2 = this.compoundOrder.length - 1; i2 >= 0; i2--) {
                      var lCompoundNode = this.compoundOrder[i2];
                      var id34 = lCompoundNode.id;
                      var horizontalMargin = lCompoundNode.paddingLeft;
                      var verticalMargin = lCompoundNode.paddingTop;
                      var labelMarginLeft = lCompoundNode.labelMarginLeft;
                      var labelMarginTop = lCompoundNode.labelMarginTop;
                      this.adjustLocations(this.tiledMemberPack[id34], lCompoundNode.rect.x, lCompoundNode.rect.y, horizontalMargin, verticalMargin, labelMarginLeft, labelMarginTop);
                    }
                  };
                  CoSELayout.prototype.repopulateZeroDegreeMembers = function() {
                    var self2 = this;
                    var tiledPack = this.tiledZeroDegreePack;
                    Object.keys(tiledPack).forEach(function(id34) {
                      var compoundNode = self2.idToDummyNode[id34];
                      var horizontalMargin = compoundNode.paddingLeft;
                      var verticalMargin = compoundNode.paddingTop;
                      var labelMarginLeft = compoundNode.labelMarginLeft;
                      var labelMarginTop = compoundNode.labelMarginTop;
                      self2.adjustLocations(tiledPack[id34], compoundNode.rect.x, compoundNode.rect.y, horizontalMargin, verticalMargin, labelMarginLeft, labelMarginTop);
                    });
                  };
                  CoSELayout.prototype.getToBeTiled = function(node2) {
                    var id34 = node2.id;
                    if (this.toBeTiled[id34] != null) {
                      return this.toBeTiled[id34];
                    }
                    var childGraph = node2.getChild();
                    if (childGraph == null) {
                      this.toBeTiled[id34] = false;
                      return false;
                    }
                    var children2 = childGraph.getNodes();
                    for (var i2 = 0; i2 < children2.length; i2++) {
                      var theChild = children2[i2];
                      if (this.getNodeDegree(theChild) > 0) {
                        this.toBeTiled[id34] = false;
                        return false;
                      }
                      if (theChild.getChild() == null) {
                        this.toBeTiled[theChild.id] = false;
                        continue;
                      }
                      if (!this.getToBeTiled(theChild)) {
                        this.toBeTiled[id34] = false;
                        return false;
                      }
                    }
                    this.toBeTiled[id34] = true;
                    return true;
                  };
                  CoSELayout.prototype.getNodeDegree = function(node2) {
                    var id34 = node2.id;
                    var edges3 = node2.getEdges();
                    var degree = 0;
                    for (var i2 = 0; i2 < edges3.length; i2++) {
                      var edge = edges3[i2];
                      if (edge.getSource().id !== edge.getTarget().id) {
                        degree = degree + 1;
                      }
                    }
                    return degree;
                  };
                  CoSELayout.prototype.getNodeDegreeWithChildren = function(node2) {
                    var degree = this.getNodeDegree(node2);
                    if (node2.getChild() == null) {
                      return degree;
                    }
                    var children2 = node2.getChild().getNodes();
                    for (var i2 = 0; i2 < children2.length; i2++) {
                      var child = children2[i2];
                      degree += this.getNodeDegreeWithChildren(child);
                    }
                    return degree;
                  };
                  CoSELayout.prototype.performDFSOnCompounds = function() {
                    this.compoundOrder = [];
                    this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes());
                  };
                  CoSELayout.prototype.fillCompexOrderByDFS = function(children2) {
                    for (var i2 = 0; i2 < children2.length; i2++) {
                      var child = children2[i2];
                      if (child.getChild() != null) {
                        this.fillCompexOrderByDFS(child.getChild().getNodes());
                      }
                      if (this.getToBeTiled(child)) {
                        this.compoundOrder.push(child);
                      }
                    }
                  };
                  CoSELayout.prototype.adjustLocations = function(organization, x5, y6, compoundHorizontalMargin, compoundVerticalMargin, compoundLabelMarginLeft, compoundLabelMarginTop) {
                    x5 += compoundHorizontalMargin + compoundLabelMarginLeft;
                    y6 += compoundVerticalMargin + compoundLabelMarginTop;
                    var left3 = x5;
                    for (var i2 = 0; i2 < organization.rows.length; i2++) {
                      var row = organization.rows[i2];
                      x5 = left3;
                      var maxHeight = 0;
                      for (var j3 = 0; j3 < row.length; j3++) {
                        var lnode = row[j3];
                        lnode.rect.x = x5;
                        lnode.rect.y = y6;
                        x5 += lnode.rect.width + organization.horizontalPadding;
                        if (lnode.rect.height > maxHeight) maxHeight = lnode.rect.height;
                      }
                      y6 += maxHeight + organization.verticalPadding;
                    }
                  };
                  CoSELayout.prototype.tileCompoundMembers = function(childGraphMap, idToNode) {
                    var self2 = this;
                    this.tiledMemberPack = [];
                    Object.keys(childGraphMap).forEach(function(id34) {
                      var compoundNode = idToNode[id34];
                      self2.tiledMemberPack[id34] = self2.tileNodes(childGraphMap[id34], compoundNode.paddingLeft + compoundNode.paddingRight);
                      compoundNode.rect.width = self2.tiledMemberPack[id34].width;
                      compoundNode.rect.height = self2.tiledMemberPack[id34].height;
                      compoundNode.setCenter(self2.tiledMemberPack[id34].centerX, self2.tiledMemberPack[id34].centerY);
                      compoundNode.labelMarginLeft = 0;
                      compoundNode.labelMarginTop = 0;
                      if (CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS) {
                        var width3 = compoundNode.rect.width;
                        var height2 = compoundNode.rect.height;
                        if (compoundNode.labelWidth) {
                          if (compoundNode.labelPosHorizontal == "left") {
                            compoundNode.rect.x -= compoundNode.labelWidth;
                            compoundNode.setWidth(width3 + compoundNode.labelWidth);
                            compoundNode.labelMarginLeft = compoundNode.labelWidth;
                          } else if (compoundNode.labelPosHorizontal == "center" && compoundNode.labelWidth > width3) {
                            compoundNode.rect.x -= (compoundNode.labelWidth - width3) / 2;
                            compoundNode.setWidth(compoundNode.labelWidth);
                            compoundNode.labelMarginLeft = (compoundNode.labelWidth - width3) / 2;
                          } else if (compoundNode.labelPosHorizontal == "right") {
                            compoundNode.setWidth(width3 + compoundNode.labelWidth);
                          }
                        }
                        if (compoundNode.labelHeight) {
                          if (compoundNode.labelPosVertical == "top") {
                            compoundNode.rect.y -= compoundNode.labelHeight;
                            compoundNode.setHeight(height2 + compoundNode.labelHeight);
                            compoundNode.labelMarginTop = compoundNode.labelHeight;
                          } else if (compoundNode.labelPosVertical == "center" && compoundNode.labelHeight > height2) {
                            compoundNode.rect.y -= (compoundNode.labelHeight - height2) / 2;
                            compoundNode.setHeight(compoundNode.labelHeight);
                            compoundNode.labelMarginTop = (compoundNode.labelHeight - height2) / 2;
                          } else if (compoundNode.labelPosVertical == "bottom") {
                            compoundNode.setHeight(height2 + compoundNode.labelHeight);
                          }
                        }
                      }
                    });
                  };
                  CoSELayout.prototype.tileNodes = function(nodes5, minWidth) {
                    var horizontalOrg = this.tileNodesByFavoringDim(nodes5, minWidth, true);
                    var verticalOrg = this.tileNodesByFavoringDim(nodes5, minWidth, false);
                    var horizontalRatio = this.getOrgRatio(horizontalOrg);
                    var verticalRatio = this.getOrgRatio(verticalOrg);
                    var bestOrg;
                    if (verticalRatio < horizontalRatio) {
                      bestOrg = verticalOrg;
                    } else {
                      bestOrg = horizontalOrg;
                    }
                    return bestOrg;
                  };
                  CoSELayout.prototype.getOrgRatio = function(organization) {
                    var width3 = organization.width;
                    var height2 = organization.height;
                    var ratio = width3 / height2;
                    if (ratio < 1) {
                      ratio = 1 / ratio;
                    }
                    return ratio;
                  };
                  CoSELayout.prototype.calcIdealRowWidth = function(members, favorHorizontalDim) {
                    var verticalPadding = CoSEConstants.TILING_PADDING_VERTICAL;
                    var horizontalPadding = CoSEConstants.TILING_PADDING_HORIZONTAL;
                    var membersSize = members.length;
                    var totalWidth = 0;
                    var totalHeight = 0;
                    var maxWidth2 = 0;
                    members.forEach(function(node2) {
                      totalWidth += node2.getWidth();
                      totalHeight += node2.getHeight();
                      if (node2.getWidth() > maxWidth2) {
                        maxWidth2 = node2.getWidth();
                      }
                    });
                    var averageWidth = totalWidth / membersSize;
                    var averageHeight = totalHeight / membersSize;
                    var delta = Math.pow(verticalPadding - horizontalPadding, 2) + 4 * (averageWidth + horizontalPadding) * (averageHeight + verticalPadding) * membersSize;
                    var horizontalCountDouble = (horizontalPadding - verticalPadding + Math.sqrt(delta)) / (2 * (averageWidth + horizontalPadding));
                    var horizontalCount;
                    if (favorHorizontalDim) {
                      horizontalCount = Math.ceil(horizontalCountDouble);
                      if (horizontalCount == horizontalCountDouble) {
                        horizontalCount++;
                      }
                    } else {
                      horizontalCount = Math.floor(horizontalCountDouble);
                    }
                    var idealWidth = horizontalCount * (averageWidth + horizontalPadding) - horizontalPadding;
                    if (maxWidth2 > idealWidth) {
                      idealWidth = maxWidth2;
                    }
                    idealWidth += horizontalPadding * 2;
                    return idealWidth;
                  };
                  CoSELayout.prototype.tileNodesByFavoringDim = function(nodes5, minWidth, favorHorizontalDim) {
                    var verticalPadding = CoSEConstants.TILING_PADDING_VERTICAL;
                    var horizontalPadding = CoSEConstants.TILING_PADDING_HORIZONTAL;
                    var tilingCompareBy = CoSEConstants.TILING_COMPARE_BY;
                    var organization = {
                      rows: [],
                      rowWidth: [],
                      rowHeight: [],
                      width: 0,
                      height: minWidth,
                      // assume minHeight equals to minWidth
                      verticalPadding,
                      horizontalPadding,
                      centerX: 0,
                      centerY: 0
                    };
                    if (tilingCompareBy) {
                      organization.idealRowWidth = this.calcIdealRowWidth(nodes5, favorHorizontalDim);
                    }
                    var getNodeArea = /* @__PURE__ */ __name(function getNodeArea2(n2) {
                      return n2.rect.width * n2.rect.height;
                    }, "getNodeArea");
                    var areaCompareFcn = /* @__PURE__ */ __name(function areaCompareFcn2(n1, n2) {
                      return getNodeArea(n2) - getNodeArea(n1);
                    }, "areaCompareFcn");
                    nodes5.sort(function(n1, n2) {
                      var cmpBy = areaCompareFcn;
                      if (organization.idealRowWidth) {
                        cmpBy = tilingCompareBy;
                        return cmpBy(n1.id, n2.id);
                      }
                      return cmpBy(n1, n2);
                    });
                    var sumCenterX = 0;
                    var sumCenterY = 0;
                    for (var i2 = 0; i2 < nodes5.length; i2++) {
                      var lNode = nodes5[i2];
                      sumCenterX += lNode.getCenterX();
                      sumCenterY += lNode.getCenterY();
                    }
                    organization.centerX = sumCenterX / nodes5.length;
                    organization.centerY = sumCenterY / nodes5.length;
                    for (var i2 = 0; i2 < nodes5.length; i2++) {
                      var lNode = nodes5[i2];
                      if (organization.rows.length == 0) {
                        this.insertNodeToRow(organization, lNode, 0, minWidth);
                      } else if (this.canAddHorizontal(organization, lNode.rect.width, lNode.rect.height)) {
                        var rowIndex = organization.rows.length - 1;
                        if (!organization.idealRowWidth) {
                          rowIndex = this.getShortestRowIndex(organization);
                        }
                        this.insertNodeToRow(organization, lNode, rowIndex, minWidth);
                      } else {
                        this.insertNodeToRow(organization, lNode, organization.rows.length, minWidth);
                      }
                      this.shiftToLastRow(organization);
                    }
                    return organization;
                  };
                  CoSELayout.prototype.insertNodeToRow = function(organization, node2, rowIndex, minWidth) {
                    var minCompoundSize = minWidth;
                    if (rowIndex == organization.rows.length) {
                      var secondDimension = [];
                      organization.rows.push(secondDimension);
                      organization.rowWidth.push(minCompoundSize);
                      organization.rowHeight.push(0);
                    }
                    var w4 = organization.rowWidth[rowIndex] + node2.rect.width;
                    if (organization.rows[rowIndex].length > 0) {
                      w4 += organization.horizontalPadding;
                    }
                    organization.rowWidth[rowIndex] = w4;
                    if (organization.width < w4) {
                      organization.width = w4;
                    }
                    var h3 = node2.rect.height;
                    if (rowIndex > 0) h3 += organization.verticalPadding;
                    var extraHeight = 0;
                    if (h3 > organization.rowHeight[rowIndex]) {
                      extraHeight = organization.rowHeight[rowIndex];
                      organization.rowHeight[rowIndex] = h3;
                      extraHeight = organization.rowHeight[rowIndex] - extraHeight;
                    }
                    organization.height += extraHeight;
                    organization.rows[rowIndex].push(node2);
                  };
                  CoSELayout.prototype.getShortestRowIndex = function(organization) {
                    var r2 = -1;
                    var min9 = Number.MAX_VALUE;
                    for (var i2 = 0; i2 < organization.rows.length; i2++) {
                      if (organization.rowWidth[i2] < min9) {
                        r2 = i2;
                        min9 = organization.rowWidth[i2];
                      }
                    }
                    return r2;
                  };
                  CoSELayout.prototype.getLongestRowIndex = function(organization) {
                    var r2 = -1;
                    var max10 = Number.MIN_VALUE;
                    for (var i2 = 0; i2 < organization.rows.length; i2++) {
                      if (organization.rowWidth[i2] > max10) {
                        r2 = i2;
                        max10 = organization.rowWidth[i2];
                      }
                    }
                    return r2;
                  };
                  CoSELayout.prototype.canAddHorizontal = function(organization, extraWidth, extraHeight) {
                    if (organization.idealRowWidth) {
                      var lastRowIndex = organization.rows.length - 1;
                      var lastRowWidth = organization.rowWidth[lastRowIndex];
                      return lastRowWidth + extraWidth + organization.horizontalPadding <= organization.idealRowWidth;
                    }
                    var sri = this.getShortestRowIndex(organization);
                    if (sri < 0) {
                      return true;
                    }
                    var min9 = organization.rowWidth[sri];
                    if (min9 + organization.horizontalPadding + extraWidth <= organization.width) return true;
                    var hDiff = 0;
                    if (organization.rowHeight[sri] < extraHeight) {
                      if (sri > 0) hDiff = extraHeight + organization.verticalPadding - organization.rowHeight[sri];
                    }
                    var add_to_row_ratio;
                    if (organization.width - min9 >= extraWidth + organization.horizontalPadding) {
                      add_to_row_ratio = (organization.height + hDiff) / (min9 + extraWidth + organization.horizontalPadding);
                    } else {
                      add_to_row_ratio = (organization.height + hDiff) / organization.width;
                    }
                    hDiff = extraHeight + organization.verticalPadding;
                    var add_new_row_ratio;
                    if (organization.width < extraWidth) {
                      add_new_row_ratio = (organization.height + hDiff) / extraWidth;
                    } else {
                      add_new_row_ratio = (organization.height + hDiff) / organization.width;
                    }
                    if (add_new_row_ratio < 1) add_new_row_ratio = 1 / add_new_row_ratio;
                    if (add_to_row_ratio < 1) add_to_row_ratio = 1 / add_to_row_ratio;
                    return add_to_row_ratio < add_new_row_ratio;
                  };
                  CoSELayout.prototype.shiftToLastRow = function(organization) {
                    var longest = this.getLongestRowIndex(organization);
                    var last3 = organization.rowWidth.length - 1;
                    var row = organization.rows[longest];
                    var node2 = row[row.length - 1];
                    var diff2 = node2.width + organization.horizontalPadding;
                    if (organization.width - organization.rowWidth[last3] > diff2 && longest != last3) {
                      row.splice(-1, 1);
                      organization.rows[last3].push(node2);
                      organization.rowWidth[longest] = organization.rowWidth[longest] - diff2;
                      organization.rowWidth[last3] = organization.rowWidth[last3] + diff2;
                      organization.width = organization.rowWidth[instance.getLongestRowIndex(organization)];
                      var maxHeight = Number.MIN_VALUE;
                      for (var i2 = 0; i2 < row.length; i2++) {
                        if (row[i2].height > maxHeight) maxHeight = row[i2].height;
                      }
                      if (longest > 0) maxHeight += organization.verticalPadding;
                      var prevTotal = organization.rowHeight[longest] + organization.rowHeight[last3];
                      organization.rowHeight[longest] = maxHeight;
                      if (organization.rowHeight[last3] < node2.height + organization.verticalPadding) organization.rowHeight[last3] = node2.height + organization.verticalPadding;
                      var finalTotal = organization.rowHeight[longest] + organization.rowHeight[last3];
                      organization.height += finalTotal - prevTotal;
                      this.shiftToLastRow(organization);
                    }
                  };
                  CoSELayout.prototype.tilingPreLayout = function() {
                    if (CoSEConstants.TILE) {
                      this.groupZeroDegreeMembers();
                      this.clearCompounds();
                      this.clearZeroDegreeMembers();
                    }
                  };
                  CoSELayout.prototype.tilingPostLayout = function() {
                    if (CoSEConstants.TILE) {
                      this.repopulateZeroDegreeMembers();
                      this.repopulateCompounds();
                    }
                  };
                  CoSELayout.prototype.reduceTrees = function() {
                    var prunedNodesAll = [];
                    var containsLeaf = true;
                    var node2;
                    while (containsLeaf) {
                      var allNodes = this.graphManager.getAllNodes();
                      var prunedNodesInStepTemp = [];
                      containsLeaf = false;
                      for (var i2 = 0; i2 < allNodes.length; i2++) {
                        node2 = allNodes[i2];
                        if (node2.getEdges().length == 1 && !node2.getEdges()[0].isInterGraph && node2.getChild() == null) {
                          if (CoSEConstants.PURE_INCREMENTAL) {
                            var otherEnd = node2.getEdges()[0].getOtherEnd(node2);
                            var relativePosition2 = new DimensionD2(node2.getCenterX() - otherEnd.getCenterX(), node2.getCenterY() - otherEnd.getCenterY());
                            prunedNodesInStepTemp.push([node2, node2.getEdges()[0], node2.getOwner(), relativePosition2]);
                          } else {
                            prunedNodesInStepTemp.push([node2, node2.getEdges()[0], node2.getOwner()]);
                          }
                          containsLeaf = true;
                        }
                      }
                      if (containsLeaf == true) {
                        var prunedNodesInStep = [];
                        for (var j3 = 0; j3 < prunedNodesInStepTemp.length; j3++) {
                          if (prunedNodesInStepTemp[j3][0].getEdges().length == 1) {
                            prunedNodesInStep.push(prunedNodesInStepTemp[j3]);
                            prunedNodesInStepTemp[j3][0].getOwner().remove(prunedNodesInStepTemp[j3][0]);
                          }
                        }
                        prunedNodesAll.push(prunedNodesInStep);
                        this.graphManager.resetAllNodes();
                        this.graphManager.resetAllEdges();
                      }
                    }
                    this.prunedNodesAll = prunedNodesAll;
                  };
                  CoSELayout.prototype.growTree = function(prunedNodesAll) {
                    var lengthOfPrunedNodesInStep = prunedNodesAll.length;
                    var prunedNodesInStep = prunedNodesAll[lengthOfPrunedNodesInStep - 1];
                    var nodeData2;
                    for (var i2 = 0; i2 < prunedNodesInStep.length; i2++) {
                      nodeData2 = prunedNodesInStep[i2];
                      this.findPlaceforPrunedNode(nodeData2);
                      nodeData2[2].add(nodeData2[0]);
                      nodeData2[2].add(nodeData2[1], nodeData2[1].source, nodeData2[1].target);
                    }
                    prunedNodesAll.splice(prunedNodesAll.length - 1, 1);
                    this.graphManager.resetAllNodes();
                    this.graphManager.resetAllEdges();
                  };
                  CoSELayout.prototype.findPlaceforPrunedNode = function(nodeData2) {
                    var gridForPrunedNode;
                    var nodeToConnect;
                    var prunedNode = nodeData2[0];
                    if (prunedNode == nodeData2[1].source) {
                      nodeToConnect = nodeData2[1].target;
                    } else {
                      nodeToConnect = nodeData2[1].source;
                    }
                    if (CoSEConstants.PURE_INCREMENTAL) {
                      prunedNode.setCenter(nodeToConnect.getCenterX() + nodeData2[3].getWidth(), nodeToConnect.getCenterY() + nodeData2[3].getHeight());
                    } else {
                      var startGridX = nodeToConnect.startX;
                      var finishGridX = nodeToConnect.finishX;
                      var startGridY = nodeToConnect.startY;
                      var finishGridY = nodeToConnect.finishY;
                      var upNodeCount = 0;
                      var downNodeCount = 0;
                      var rightNodeCount = 0;
                      var leftNodeCount = 0;
                      var controlRegions = [upNodeCount, rightNodeCount, downNodeCount, leftNodeCount];
                      if (startGridY > 0) {
                        for (var i2 = startGridX; i2 <= finishGridX; i2++) {
                          controlRegions[0] += this.grid[i2][startGridY - 1].length + this.grid[i2][startGridY].length - 1;
                        }
                      }
                      if (finishGridX < this.grid.length - 1) {
                        for (var i2 = startGridY; i2 <= finishGridY; i2++) {
                          controlRegions[1] += this.grid[finishGridX + 1][i2].length + this.grid[finishGridX][i2].length - 1;
                        }
                      }
                      if (finishGridY < this.grid[0].length - 1) {
                        for (var i2 = startGridX; i2 <= finishGridX; i2++) {
                          controlRegions[2] += this.grid[i2][finishGridY + 1].length + this.grid[i2][finishGridY].length - 1;
                        }
                      }
                      if (startGridX > 0) {
                        for (var i2 = startGridY; i2 <= finishGridY; i2++) {
                          controlRegions[3] += this.grid[startGridX - 1][i2].length + this.grid[startGridX][i2].length - 1;
                        }
                      }
                      var min9 = Integer.MAX_VALUE;
                      var minCount;
                      var minIndex;
                      for (var j3 = 0; j3 < controlRegions.length; j3++) {
                        if (controlRegions[j3] < min9) {
                          min9 = controlRegions[j3];
                          minCount = 1;
                          minIndex = j3;
                        } else if (controlRegions[j3] == min9) {
                          minCount++;
                        }
                      }
                      if (minCount == 3 && min9 == 0) {
                        if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[2] == 0) {
                          gridForPrunedNode = 1;
                        } else if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[3] == 0) {
                          gridForPrunedNode = 0;
                        } else if (controlRegions[0] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) {
                          gridForPrunedNode = 3;
                        } else if (controlRegions[1] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) {
                          gridForPrunedNode = 2;
                        }
                      } else if (minCount == 2 && min9 == 0) {
                        var random2 = Math.floor(Math.random() * 2);
                        if (controlRegions[0] == 0 && controlRegions[1] == 0) {
                          ;
                          if (random2 == 0) {
                            gridForPrunedNode = 0;
                          } else {
                            gridForPrunedNode = 1;
                          }
                        } else if (controlRegions[0] == 0 && controlRegions[2] == 0) {
                          if (random2 == 0) {
                            gridForPrunedNode = 0;
                          } else {
                            gridForPrunedNode = 2;
                          }
                        } else if (controlRegions[0] == 0 && controlRegions[3] == 0) {
                          if (random2 == 0) {
                            gridForPrunedNode = 0;
                          } else {
                            gridForPrunedNode = 3;
                          }
                        } else if (controlRegions[1] == 0 && controlRegions[2] == 0) {
                          if (random2 == 0) {
                            gridForPrunedNode = 1;
                          } else {
                            gridForPrunedNode = 2;
                          }
                        } else if (controlRegions[1] == 0 && controlRegions[3] == 0) {
                          if (random2 == 0) {
                            gridForPrunedNode = 1;
                          } else {
                            gridForPrunedNode = 3;
                          }
                        } else {
                          if (random2 == 0) {
                            gridForPrunedNode = 2;
                          } else {
                            gridForPrunedNode = 3;
                          }
                        }
                      } else if (minCount == 4 && min9 == 0) {
                        var random2 = Math.floor(Math.random() * 4);
                        gridForPrunedNode = random2;
                      } else {
                        gridForPrunedNode = minIndex;
                      }
                      if (gridForPrunedNode == 0) {
                        prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() - nodeToConnect.getHeight() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getHeight() / 2);
                      } else if (gridForPrunedNode == 1) {
                        prunedNode.setCenter(nodeToConnect.getCenterX() + nodeToConnect.getWidth() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getWidth() / 2, nodeToConnect.getCenterY());
                      } else if (gridForPrunedNode == 2) {
                        prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() + nodeToConnect.getHeight() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getHeight() / 2);
                      } else {
                        prunedNode.setCenter(nodeToConnect.getCenterX() - nodeToConnect.getWidth() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getWidth() / 2, nodeToConnect.getCenterY());
                      }
                    }
                  };
                  module3.exports = CoSELayout;
                })
              ),
              /***/
              991: (
                /***/
                ((module3, __unused_webpack_exports, __webpack_require__2) => {
                  var FDLayoutNode = __webpack_require__2(551).FDLayoutNode;
                  var IMath = __webpack_require__2(551).IMath;
                  function CoSENode(gm, loc, size4, vNode) {
                    FDLayoutNode.call(this, gm, loc, size4, vNode);
                  }
                  __name(CoSENode, "CoSENode");
                  CoSENode.prototype = Object.create(FDLayoutNode.prototype);
                  for (var prop in FDLayoutNode) {
                    CoSENode[prop] = FDLayoutNode[prop];
                  }
                  CoSENode.prototype.calculateDisplacement = function() {
                    var layout7 = this.graphManager.getLayout();
                    if (this.getChild() != null && this.fixedNodeWeight) {
                      this.displacementX += layout7.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.fixedNodeWeight;
                      this.displacementY += layout7.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.fixedNodeWeight;
                    } else {
                      this.displacementX += layout7.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren;
                      this.displacementY += layout7.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren;
                    }
                    if (Math.abs(this.displacementX) > layout7.coolingFactor * layout7.maxNodeDisplacement) {
                      this.displacementX = layout7.coolingFactor * layout7.maxNodeDisplacement * IMath.sign(this.displacementX);
                    }
                    if (Math.abs(this.displacementY) > layout7.coolingFactor * layout7.maxNodeDisplacement) {
                      this.displacementY = layout7.coolingFactor * layout7.maxNodeDisplacement * IMath.sign(this.displacementY);
                    }
                    if (this.child && this.child.getNodes().length > 0) {
                      this.propogateDisplacementToChildren(this.displacementX, this.displacementY);
                    }
                  };
                  CoSENode.prototype.propogateDisplacementToChildren = function(dX, dY) {
                    var nodes5 = this.getChild().getNodes();
                    var node2;
                    for (var i2 = 0; i2 < nodes5.length; i2++) {
                      node2 = nodes5[i2];
                      if (node2.getChild() == null) {
                        node2.displacementX += dX;
                        node2.displacementY += dY;
                      } else {
                        node2.propogateDisplacementToChildren(dX, dY);
                      }
                    }
                  };
                  CoSENode.prototype.move = function() {
                    var layout7 = this.graphManager.getLayout();
                    if (this.child == null || this.child.getNodes().length == 0) {
                      this.moveBy(this.displacementX, this.displacementY);
                      layout7.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY);
                    }
                    this.springForceX = 0;
                    this.springForceY = 0;
                    this.repulsionForceX = 0;
                    this.repulsionForceY = 0;
                    this.gravitationForceX = 0;
                    this.gravitationForceY = 0;
                    this.displacementX = 0;
                    this.displacementY = 0;
                  };
                  CoSENode.prototype.setPred1 = function(pred12) {
                    this.pred1 = pred12;
                  };
                  CoSENode.prototype.getPred1 = function() {
                    return pred1;
                  };
                  CoSENode.prototype.getPred2 = function() {
                    return pred2;
                  };
                  CoSENode.prototype.setNext = function(next3) {
                    this.next = next3;
                  };
                  CoSENode.prototype.getNext = function() {
                    return next;
                  };
                  CoSENode.prototype.setProcessed = function(processed2) {
                    this.processed = processed2;
                  };
                  CoSENode.prototype.isProcessed = function() {
                    return processed;
                  };
                  module3.exports = CoSENode;
                })
              ),
              /***/
              902: (
                /***/
                ((module3, __unused_webpack_exports, __webpack_require__2) => {
                  function _toConsumableArray2(arr) {
                    if (Array.isArray(arr)) {
                      for (var i2 = 0, arr2 = Array(arr.length); i2 < arr.length; i2++) {
                        arr2[i2] = arr[i2];
                      }
                      return arr2;
                    } else {
                      return Array.from(arr);
                    }
                  }
                  __name(_toConsumableArray2, "_toConsumableArray");
                  var CoSEConstants = __webpack_require__2(806);
                  var LinkedList = __webpack_require__2(551).LinkedList;
                  var Matrix = __webpack_require__2(551).Matrix;
                  var SVD = __webpack_require__2(551).SVD;
                  function ConstraintHandler() {
                  }
                  __name(ConstraintHandler, "ConstraintHandler");
                  ConstraintHandler.handleConstraints = function(layout7) {
                    var constraints = {};
                    constraints.fixedNodeConstraint = layout7.constraints.fixedNodeConstraint;
                    constraints.alignmentConstraint = layout7.constraints.alignmentConstraint;
                    constraints.relativePlacementConstraint = layout7.constraints.relativePlacementConstraint;
                    var idToNodeMap = /* @__PURE__ */ new Map();
                    var nodeIndexes = /* @__PURE__ */ new Map();
                    var xCoords = [];
                    var yCoords = [];
                    var allNodes = layout7.getAllNodes();
                    var index = 0;
                    for (var i2 = 0; i2 < allNodes.length; i2++) {
                      var node2 = allNodes[i2];
                      if (node2.getChild() == null) {
                        nodeIndexes.set(node2.id, index++);
                        xCoords.push(node2.getCenterX());
                        yCoords.push(node2.getCenterY());
                        idToNodeMap.set(node2.id, node2);
                      }
                    }
                    if (constraints.relativePlacementConstraint) {
                      constraints.relativePlacementConstraint.forEach(function(constraint) {
                        if (!constraint.gap && constraint.gap != 0) {
                          if (constraint.left) {
                            constraint.gap = CoSEConstants.DEFAULT_EDGE_LENGTH + idToNodeMap.get(constraint.left).getWidth() / 2 + idToNodeMap.get(constraint.right).getWidth() / 2;
                          } else {
                            constraint.gap = CoSEConstants.DEFAULT_EDGE_LENGTH + idToNodeMap.get(constraint.top).getHeight() / 2 + idToNodeMap.get(constraint.bottom).getHeight() / 2;
                          }
                        }
                      });
                    }
                    var calculatePositionDiff = /* @__PURE__ */ __name(function calculatePositionDiff2(pos1, pos2) {
                      return { x: pos1.x - pos2.x, y: pos1.y - pos2.y };
                    }, "calculatePositionDiff");
                    var calculateAvgPosition = /* @__PURE__ */ __name(function calculateAvgPosition2(nodeIdSet) {
                      var xPosSum = 0;
                      var yPosSum = 0;
                      nodeIdSet.forEach(function(nodeId) {
                        xPosSum += xCoords[nodeIndexes.get(nodeId)];
                        yPosSum += yCoords[nodeIndexes.get(nodeId)];
                      });
                      return { x: xPosSum / nodeIdSet.size, y: yPosSum / nodeIdSet.size };
                    }, "calculateAvgPosition");
                    var findAppropriatePositionForRelativePlacement = /* @__PURE__ */ __name(function findAppropriatePositionForRelativePlacement2(graph, direction2, fixedNodes2, dummyPositions, componentSources) {
                      function setUnion(setA, setB) {
                        var union2 = new Set(setA);
                        var _iteratorNormalCompletion = true;
                        var _didIteratorError = false;
                        var _iteratorError = void 0;
                        try {
                          for (var _iterator = setB[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                            var elem = _step.value;
                            union2.add(elem);
                          }
                        } catch (err) {
                          _didIteratorError = true;
                          _iteratorError = err;
                        } finally {
                          try {
                            if (!_iteratorNormalCompletion && _iterator.return) {
                              _iterator.return();
                            }
                          } finally {
                            if (_didIteratorError) {
                              throw _iteratorError;
                            }
                          }
                        }
                        return union2;
                      }
                      __name(setUnion, "setUnion");
                      var inDegrees = /* @__PURE__ */ new Map();
                      graph.forEach(function(value2, key) {
                        inDegrees.set(key, 0);
                      });
                      graph.forEach(function(value2, key) {
                        value2.forEach(function(adjacent) {
                          inDegrees.set(adjacent.id, inDegrees.get(adjacent.id) + 1);
                        });
                      });
                      var positionMap = /* @__PURE__ */ new Map();
                      var pastMap = /* @__PURE__ */ new Map();
                      var queue = new LinkedList();
                      inDegrees.forEach(function(value2, key) {
                        if (value2 == 0) {
                          queue.push(key);
                          if (!fixedNodes2) {
                            if (direction2 == "horizontal") {
                              positionMap.set(key, nodeIndexes.has(key) ? xCoords[nodeIndexes.get(key)] : dummyPositions.get(key));
                            } else {
                              positionMap.set(key, nodeIndexes.has(key) ? yCoords[nodeIndexes.get(key)] : dummyPositions.get(key));
                            }
                          }
                        } else {
                          positionMap.set(key, Number.NEGATIVE_INFINITY);
                        }
                        if (fixedNodes2) {
                          pastMap.set(key, /* @__PURE__ */ new Set([key]));
                        }
                      });
                      if (fixedNodes2) {
                        componentSources.forEach(function(component2) {
                          var fixedIds = [];
                          component2.forEach(function(nodeId) {
                            if (fixedNodes2.has(nodeId)) {
                              fixedIds.push(nodeId);
                            }
                          });
                          if (fixedIds.length > 0) {
                            var position5 = 0;
                            fixedIds.forEach(function(fixedId) {
                              if (direction2 == "horizontal") {
                                positionMap.set(fixedId, nodeIndexes.has(fixedId) ? xCoords[nodeIndexes.get(fixedId)] : dummyPositions.get(fixedId));
                                position5 += positionMap.get(fixedId);
                              } else {
                                positionMap.set(fixedId, nodeIndexes.has(fixedId) ? yCoords[nodeIndexes.get(fixedId)] : dummyPositions.get(fixedId));
                                position5 += positionMap.get(fixedId);
                              }
                            });
                            position5 = position5 / fixedIds.length;
                            component2.forEach(function(nodeId) {
                              if (!fixedNodes2.has(nodeId)) {
                                positionMap.set(nodeId, position5);
                              }
                            });
                          } else {
                            var _position = 0;
                            component2.forEach(function(nodeId) {
                              if (direction2 == "horizontal") {
                                _position += nodeIndexes.has(nodeId) ? xCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId);
                              } else {
                                _position += nodeIndexes.has(nodeId) ? yCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId);
                              }
                            });
                            _position = _position / component2.length;
                            component2.forEach(function(nodeId) {
                              positionMap.set(nodeId, _position);
                            });
                          }
                        });
                      }
                      var _loop = /* @__PURE__ */ __name(function _loop2() {
                        var currentNode = queue.shift();
                        var neighbors = graph.get(currentNode);
                        neighbors.forEach(function(neighbor) {
                          if (positionMap.get(neighbor.id) < positionMap.get(currentNode) + neighbor.gap) {
                            if (fixedNodes2 && fixedNodes2.has(neighbor.id)) {
                              var fixedPosition = void 0;
                              if (direction2 == "horizontal") {
                                fixedPosition = nodeIndexes.has(neighbor.id) ? xCoords[nodeIndexes.get(neighbor.id)] : dummyPositions.get(neighbor.id);
                              } else {
                                fixedPosition = nodeIndexes.has(neighbor.id) ? yCoords[nodeIndexes.get(neighbor.id)] : dummyPositions.get(neighbor.id);
                              }
                              positionMap.set(neighbor.id, fixedPosition);
                              if (fixedPosition < positionMap.get(currentNode) + neighbor.gap) {
                                var diff2 = positionMap.get(currentNode) + neighbor.gap - fixedPosition;
                                pastMap.get(currentNode).forEach(function(nodeId) {
                                  positionMap.set(nodeId, positionMap.get(nodeId) - diff2);
                                });
                              }
                            } else {
                              positionMap.set(neighbor.id, positionMap.get(currentNode) + neighbor.gap);
                            }
                          }
                          inDegrees.set(neighbor.id, inDegrees.get(neighbor.id) - 1);
                          if (inDegrees.get(neighbor.id) == 0) {
                            queue.push(neighbor.id);
                          }
                          if (fixedNodes2) {
                            pastMap.set(neighbor.id, setUnion(pastMap.get(currentNode), pastMap.get(neighbor.id)));
                          }
                        });
                      }, "_loop");
                      while (queue.length != 0) {
                        _loop();
                      }
                      if (fixedNodes2) {
                        var sinkNodes = /* @__PURE__ */ new Set();
                        graph.forEach(function(value2, key) {
                          if (value2.length == 0) {
                            sinkNodes.add(key);
                          }
                        });
                        var _components = [];
                        pastMap.forEach(function(value2, key) {
                          if (sinkNodes.has(key)) {
                            var isFixedComponent = false;
                            var _iteratorNormalCompletion2 = true;
                            var _didIteratorError2 = false;
                            var _iteratorError2 = void 0;
                            try {
                              for (var _iterator2 = value2[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
                                var nodeId = _step2.value;
                                if (fixedNodes2.has(nodeId)) {
                                  isFixedComponent = true;
                                }
                              }
                            } catch (err) {
                              _didIteratorError2 = true;
                              _iteratorError2 = err;
                            } finally {
                              try {
                                if (!_iteratorNormalCompletion2 && _iterator2.return) {
                                  _iterator2.return();
                                }
                              } finally {
                                if (_didIteratorError2) {
                                  throw _iteratorError2;
                                }
                              }
                            }
                            if (!isFixedComponent) {
                              var isExist = false;
                              var existAt = void 0;
                              _components.forEach(function(component2, index2) {
                                if (component2.has([].concat(_toConsumableArray2(value2))[0])) {
                                  isExist = true;
                                  existAt = index2;
                                }
                              });
                              if (!isExist) {
                                _components.push(new Set(value2));
                              } else {
                                value2.forEach(function(ele) {
                                  _components[existAt].add(ele);
                                });
                              }
                            }
                          }
                        });
                        _components.forEach(function(component2, index2) {
                          var minBefore = Number.POSITIVE_INFINITY;
                          var minAfter = Number.POSITIVE_INFINITY;
                          var maxBefore = Number.NEGATIVE_INFINITY;
                          var maxAfter = Number.NEGATIVE_INFINITY;
                          var _iteratorNormalCompletion3 = true;
                          var _didIteratorError3 = false;
                          var _iteratorError3 = void 0;
                          try {
                            for (var _iterator3 = component2[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
                              var nodeId = _step3.value;
                              var posBefore = void 0;
                              if (direction2 == "horizontal") {
                                posBefore = nodeIndexes.has(nodeId) ? xCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId);
                              } else {
                                posBefore = nodeIndexes.has(nodeId) ? yCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId);
                              }
                              var posAfter = positionMap.get(nodeId);
                              if (posBefore < minBefore) {
                                minBefore = posBefore;
                              }
                              if (posBefore > maxBefore) {
                                maxBefore = posBefore;
                              }
                              if (posAfter < minAfter) {
                                minAfter = posAfter;
                              }
                              if (posAfter > maxAfter) {
                                maxAfter = posAfter;
                              }
                            }
                          } catch (err) {
                            _didIteratorError3 = true;
                            _iteratorError3 = err;
                          } finally {
                            try {
                              if (!_iteratorNormalCompletion3 && _iterator3.return) {
                                _iterator3.return();
                              }
                            } finally {
                              if (_didIteratorError3) {
                                throw _iteratorError3;
                              }
                            }
                          }
                          var diff2 = (minBefore + maxBefore) / 2 - (minAfter + maxAfter) / 2;
                          var _iteratorNormalCompletion4 = true;
                          var _didIteratorError4 = false;
                          var _iteratorError4 = void 0;
                          try {
                            for (var _iterator4 = component2[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
                              var _nodeId = _step4.value;
                              positionMap.set(_nodeId, positionMap.get(_nodeId) + diff2);
                            }
                          } catch (err) {
                            _didIteratorError4 = true;
                            _iteratorError4 = err;
                          } finally {
                            try {
                              if (!_iteratorNormalCompletion4 && _iterator4.return) {
                                _iterator4.return();
                              }
                            } finally {
                              if (_didIteratorError4) {
                                throw _iteratorError4;
                              }
                            }
                          }
                        });
                      }
                      return positionMap;
                    }, "findAppropriatePositionForRelativePlacement");
                    var applyReflectionForRelativePlacement = /* @__PURE__ */ __name(function applyReflectionForRelativePlacement2(relativePlacementConstraints) {
                      var reflectOnY = 0, notReflectOnY = 0;
                      var reflectOnX = 0, notReflectOnX = 0;
                      relativePlacementConstraints.forEach(function(constraint) {
                        if (constraint.left) {
                          xCoords[nodeIndexes.get(constraint.left)] - xCoords[nodeIndexes.get(constraint.right)] >= 0 ? reflectOnY++ : notReflectOnY++;
                        } else {
                          yCoords[nodeIndexes.get(constraint.top)] - yCoords[nodeIndexes.get(constraint.bottom)] >= 0 ? reflectOnX++ : notReflectOnX++;
                        }
                      });
                      if (reflectOnY > notReflectOnY && reflectOnX > notReflectOnX) {
                        for (var _i = 0; _i < nodeIndexes.size; _i++) {
                          xCoords[_i] = -1 * xCoords[_i];
                          yCoords[_i] = -1 * yCoords[_i];
                        }
                      } else if (reflectOnY > notReflectOnY) {
                        for (var _i2 = 0; _i2 < nodeIndexes.size; _i2++) {
                          xCoords[_i2] = -1 * xCoords[_i2];
                        }
                      } else if (reflectOnX > notReflectOnX) {
                        for (var _i3 = 0; _i3 < nodeIndexes.size; _i3++) {
                          yCoords[_i3] = -1 * yCoords[_i3];
                        }
                      }
                    }, "applyReflectionForRelativePlacement");
                    var findComponents = /* @__PURE__ */ __name(function findComponents2(graph) {
                      var components4 = [];
                      var queue = new LinkedList();
                      var visited = /* @__PURE__ */ new Set();
                      var count2 = 0;
                      graph.forEach(function(value2, key) {
                        if (!visited.has(key)) {
                          components4[count2] = [];
                          var _currentNode = key;
                          queue.push(_currentNode);
                          visited.add(_currentNode);
                          components4[count2].push(_currentNode);
                          while (queue.length != 0) {
                            _currentNode = queue.shift();
                            var neighbors = graph.get(_currentNode);
                            neighbors.forEach(function(neighbor) {
                              if (!visited.has(neighbor.id)) {
                                queue.push(neighbor.id);
                                visited.add(neighbor.id);
                                components4[count2].push(neighbor.id);
                              }
                            });
                          }
                          count2++;
                        }
                      });
                      return components4;
                    }, "findComponents");
                    var dagToUndirected = /* @__PURE__ */ __name(function dagToUndirected2(dag2) {
                      var undirected = /* @__PURE__ */ new Map();
                      dag2.forEach(function(value2, key) {
                        undirected.set(key, []);
                      });
                      dag2.forEach(function(value2, key) {
                        value2.forEach(function(adjacent) {
                          undirected.get(key).push(adjacent);
                          undirected.get(adjacent.id).push({ id: key, gap: adjacent.gap, direction: adjacent.direction });
                        });
                      });
                      return undirected;
                    }, "dagToUndirected");
                    var dagToReversed = /* @__PURE__ */ __name(function dagToReversed2(dag2) {
                      var reversed = /* @__PURE__ */ new Map();
                      dag2.forEach(function(value2, key) {
                        reversed.set(key, []);
                      });
                      dag2.forEach(function(value2, key) {
                        value2.forEach(function(adjacent) {
                          reversed.get(adjacent.id).push({ id: key, gap: adjacent.gap, direction: adjacent.direction });
                        });
                      });
                      return reversed;
                    }, "dagToReversed");
                    var targetMatrix = [];
                    var sourceMatrix = [];
                    var standardTransformation = false;
                    var reflectionType = false;
                    var fixedNodes = /* @__PURE__ */ new Set();
                    var dag = /* @__PURE__ */ new Map();
                    var dagUndirected = /* @__PURE__ */ new Map();
                    var components3 = [];
                    if (constraints.fixedNodeConstraint) {
                      constraints.fixedNodeConstraint.forEach(function(nodeData2) {
                        fixedNodes.add(nodeData2.nodeId);
                      });
                    }
                    if (constraints.relativePlacementConstraint) {
                      constraints.relativePlacementConstraint.forEach(function(constraint) {
                        if (constraint.left) {
                          if (dag.has(constraint.left)) {
                            dag.get(constraint.left).push({ id: constraint.right, gap: constraint.gap, direction: "horizontal" });
                          } else {
                            dag.set(constraint.left, [{ id: constraint.right, gap: constraint.gap, direction: "horizontal" }]);
                          }
                          if (!dag.has(constraint.right)) {
                            dag.set(constraint.right, []);
                          }
                        } else {
                          if (dag.has(constraint.top)) {
                            dag.get(constraint.top).push({ id: constraint.bottom, gap: constraint.gap, direction: "vertical" });
                          } else {
                            dag.set(constraint.top, [{ id: constraint.bottom, gap: constraint.gap, direction: "vertical" }]);
                          }
                          if (!dag.has(constraint.bottom)) {
                            dag.set(constraint.bottom, []);
                          }
                        }
                      });
                      dagUndirected = dagToUndirected(dag);
                      components3 = findComponents(dagUndirected);
                    }
                    if (CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING) {
                      if (constraints.fixedNodeConstraint && constraints.fixedNodeConstraint.length > 1) {
                        constraints.fixedNodeConstraint.forEach(function(nodeData2, i3) {
                          targetMatrix[i3] = [nodeData2.position.x, nodeData2.position.y];
                          sourceMatrix[i3] = [xCoords[nodeIndexes.get(nodeData2.nodeId)], yCoords[nodeIndexes.get(nodeData2.nodeId)]];
                        });
                        standardTransformation = true;
                      } else if (constraints.alignmentConstraint) {
                        (function() {
                          var count2 = 0;
                          if (constraints.alignmentConstraint.vertical) {
                            var verticalAlign = constraints.alignmentConstraint.vertical;
                            var _loop2 = /* @__PURE__ */ __name(function _loop22(_i42) {
                              var alignmentSet = /* @__PURE__ */ new Set();
                              verticalAlign[_i42].forEach(function(nodeId) {
                                alignmentSet.add(nodeId);
                              });
                              var intersection4 = new Set([].concat(_toConsumableArray2(alignmentSet)).filter(function(x5) {
                                return fixedNodes.has(x5);
                              }));
                              var xPos = void 0;
                              if (intersection4.size > 0) xPos = xCoords[nodeIndexes.get(intersection4.values().next().value)];
                              else xPos = calculateAvgPosition(alignmentSet).x;
                              verticalAlign[_i42].forEach(function(nodeId) {
                                targetMatrix[count2] = [xPos, yCoords[nodeIndexes.get(nodeId)]];
                                sourceMatrix[count2] = [xCoords[nodeIndexes.get(nodeId)], yCoords[nodeIndexes.get(nodeId)]];
                                count2++;
                              });
                            }, "_loop2");
                            for (var _i4 = 0; _i4 < verticalAlign.length; _i4++) {
                              _loop2(_i4);
                            }
                            standardTransformation = true;
                          }
                          if (constraints.alignmentConstraint.horizontal) {
                            var horizontalAlign = constraints.alignmentConstraint.horizontal;
                            var _loop3 = /* @__PURE__ */ __name(function _loop32(_i52) {
                              var alignmentSet = /* @__PURE__ */ new Set();
                              horizontalAlign[_i52].forEach(function(nodeId) {
                                alignmentSet.add(nodeId);
                              });
                              var intersection4 = new Set([].concat(_toConsumableArray2(alignmentSet)).filter(function(x5) {
                                return fixedNodes.has(x5);
                              }));
                              var yPos = void 0;
                              if (intersection4.size > 0) yPos = xCoords[nodeIndexes.get(intersection4.values().next().value)];
                              else yPos = calculateAvgPosition(alignmentSet).y;
                              horizontalAlign[_i52].forEach(function(nodeId) {
                                targetMatrix[count2] = [xCoords[nodeIndexes.get(nodeId)], yPos];
                                sourceMatrix[count2] = [xCoords[nodeIndexes.get(nodeId)], yCoords[nodeIndexes.get(nodeId)]];
                                count2++;
                              });
                            }, "_loop3");
                            for (var _i5 = 0; _i5 < horizontalAlign.length; _i5++) {
                              _loop3(_i5);
                            }
                            standardTransformation = true;
                          }
                          if (constraints.relativePlacementConstraint) {
                            reflectionType = true;
                          }
                        })();
                      } else if (constraints.relativePlacementConstraint) {
                        var largestComponentSize = 0;
                        var largestComponentIndex = 0;
                        for (var _i6 = 0; _i6 < components3.length; _i6++) {
                          if (components3[_i6].length > largestComponentSize) {
                            largestComponentSize = components3[_i6].length;
                            largestComponentIndex = _i6;
                          }
                        }
                        if (largestComponentSize < dagUndirected.size / 2) {
                          applyReflectionForRelativePlacement(constraints.relativePlacementConstraint);
                          standardTransformation = false;
                          reflectionType = false;
                        } else {
                          var subGraphOnHorizontal = /* @__PURE__ */ new Map();
                          var subGraphOnVertical = /* @__PURE__ */ new Map();
                          var constraintsInlargestComponent = [];
                          components3[largestComponentIndex].forEach(function(nodeId) {
                            dag.get(nodeId).forEach(function(adjacent) {
                              if (adjacent.direction == "horizontal") {
                                if (subGraphOnHorizontal.has(nodeId)) {
                                  subGraphOnHorizontal.get(nodeId).push(adjacent);
                                } else {
                                  subGraphOnHorizontal.set(nodeId, [adjacent]);
                                }
                                if (!subGraphOnHorizontal.has(adjacent.id)) {
                                  subGraphOnHorizontal.set(adjacent.id, []);
                                }
                                constraintsInlargestComponent.push({ left: nodeId, right: adjacent.id });
                              } else {
                                if (subGraphOnVertical.has(nodeId)) {
                                  subGraphOnVertical.get(nodeId).push(adjacent);
                                } else {
                                  subGraphOnVertical.set(nodeId, [adjacent]);
                                }
                                if (!subGraphOnVertical.has(adjacent.id)) {
                                  subGraphOnVertical.set(adjacent.id, []);
                                }
                                constraintsInlargestComponent.push({ top: nodeId, bottom: adjacent.id });
                              }
                            });
                          });
                          applyReflectionForRelativePlacement(constraintsInlargestComponent);
                          reflectionType = false;
                          var positionMapHorizontal = findAppropriatePositionForRelativePlacement(subGraphOnHorizontal, "horizontal");
                          var positionMapVertical = findAppropriatePositionForRelativePlacement(subGraphOnVertical, "vertical");
                          components3[largestComponentIndex].forEach(function(nodeId, i3) {
                            sourceMatrix[i3] = [xCoords[nodeIndexes.get(nodeId)], yCoords[nodeIndexes.get(nodeId)]];
                            targetMatrix[i3] = [];
                            if (positionMapHorizontal.has(nodeId)) {
                              targetMatrix[i3][0] = positionMapHorizontal.get(nodeId);
                            } else {
                              targetMatrix[i3][0] = xCoords[nodeIndexes.get(nodeId)];
                            }
                            if (positionMapVertical.has(nodeId)) {
                              targetMatrix[i3][1] = positionMapVertical.get(nodeId);
                            } else {
                              targetMatrix[i3][1] = yCoords[nodeIndexes.get(nodeId)];
                            }
                          });
                          standardTransformation = true;
                        }
                      }
                      if (standardTransformation) {
                        var transformationMatrix = void 0;
                        var targetMatrixTranspose = Matrix.transpose(targetMatrix);
                        var sourceMatrixTranspose = Matrix.transpose(sourceMatrix);
                        for (var _i7 = 0; _i7 < targetMatrixTranspose.length; _i7++) {
                          targetMatrixTranspose[_i7] = Matrix.multGamma(targetMatrixTranspose[_i7]);
                          sourceMatrixTranspose[_i7] = Matrix.multGamma(sourceMatrixTranspose[_i7]);
                        }
                        var tempMatrix = Matrix.multMat(targetMatrixTranspose, Matrix.transpose(sourceMatrixTranspose));
                        var SVDResult = SVD.svd(tempMatrix);
                        transformationMatrix = Matrix.multMat(SVDResult.V, Matrix.transpose(SVDResult.U));
                        for (var _i8 = 0; _i8 < nodeIndexes.size; _i8++) {
                          var temp1 = [xCoords[_i8], yCoords[_i8]];
                          var temp2 = [transformationMatrix[0][0], transformationMatrix[1][0]];
                          var temp3 = [transformationMatrix[0][1], transformationMatrix[1][1]];
                          xCoords[_i8] = Matrix.dotProduct(temp1, temp2);
                          yCoords[_i8] = Matrix.dotProduct(temp1, temp3);
                        }
                        if (reflectionType) {
                          applyReflectionForRelativePlacement(constraints.relativePlacementConstraint);
                        }
                      }
                    }
                    if (CoSEConstants.ENFORCE_CONSTRAINTS) {
                      if (constraints.fixedNodeConstraint && constraints.fixedNodeConstraint.length > 0) {
                        var translationAmount = { x: 0, y: 0 };
                        constraints.fixedNodeConstraint.forEach(function(nodeData2, i3) {
                          var posInTheory = { x: xCoords[nodeIndexes.get(nodeData2.nodeId)], y: yCoords[nodeIndexes.get(nodeData2.nodeId)] };
                          var posDesired = nodeData2.position;
                          var posDiff = calculatePositionDiff(posDesired, posInTheory);
                          translationAmount.x += posDiff.x;
                          translationAmount.y += posDiff.y;
                        });
                        translationAmount.x /= constraints.fixedNodeConstraint.length;
                        translationAmount.y /= constraints.fixedNodeConstraint.length;
                        xCoords.forEach(function(value2, i3) {
                          xCoords[i3] += translationAmount.x;
                        });
                        yCoords.forEach(function(value2, i3) {
                          yCoords[i3] += translationAmount.y;
                        });
                        constraints.fixedNodeConstraint.forEach(function(nodeData2) {
                          xCoords[nodeIndexes.get(nodeData2.nodeId)] = nodeData2.position.x;
                          yCoords[nodeIndexes.get(nodeData2.nodeId)] = nodeData2.position.y;
                        });
                      }
                      if (constraints.alignmentConstraint) {
                        if (constraints.alignmentConstraint.vertical) {
                          var xAlign = constraints.alignmentConstraint.vertical;
                          var _loop4 = /* @__PURE__ */ __name(function _loop42(_i92) {
                            var alignmentSet = /* @__PURE__ */ new Set();
                            xAlign[_i92].forEach(function(nodeId) {
                              alignmentSet.add(nodeId);
                            });
                            var intersection4 = new Set([].concat(_toConsumableArray2(alignmentSet)).filter(function(x5) {
                              return fixedNodes.has(x5);
                            }));
                            var xPos = void 0;
                            if (intersection4.size > 0) xPos = xCoords[nodeIndexes.get(intersection4.values().next().value)];
                            else xPos = calculateAvgPosition(alignmentSet).x;
                            alignmentSet.forEach(function(nodeId) {
                              if (!fixedNodes.has(nodeId)) xCoords[nodeIndexes.get(nodeId)] = xPos;
                            });
                          }, "_loop4");
                          for (var _i9 = 0; _i9 < xAlign.length; _i9++) {
                            _loop4(_i9);
                          }
                        }
                        if (constraints.alignmentConstraint.horizontal) {
                          var yAlign = constraints.alignmentConstraint.horizontal;
                          var _loop5 = /* @__PURE__ */ __name(function _loop52(_i102) {
                            var alignmentSet = /* @__PURE__ */ new Set();
                            yAlign[_i102].forEach(function(nodeId) {
                              alignmentSet.add(nodeId);
                            });
                            var intersection4 = new Set([].concat(_toConsumableArray2(alignmentSet)).filter(function(x5) {
                              return fixedNodes.has(x5);
                            }));
                            var yPos = void 0;
                            if (intersection4.size > 0) yPos = yCoords[nodeIndexes.get(intersection4.values().next().value)];
                            else yPos = calculateAvgPosition(alignmentSet).y;
                            alignmentSet.forEach(function(nodeId) {
                              if (!fixedNodes.has(nodeId)) yCoords[nodeIndexes.get(nodeId)] = yPos;
                            });
                          }, "_loop5");
                          for (var _i10 = 0; _i10 < yAlign.length; _i10++) {
                            _loop5(_i10);
                          }
                        }
                      }
                      if (constraints.relativePlacementConstraint) {
                        (function() {
                          var nodeToDummyForVerticalAlignment = /* @__PURE__ */ new Map();
                          var nodeToDummyForHorizontalAlignment = /* @__PURE__ */ new Map();
                          var dummyToNodeForVerticalAlignment = /* @__PURE__ */ new Map();
                          var dummyToNodeForHorizontalAlignment = /* @__PURE__ */ new Map();
                          var dummyPositionsForVerticalAlignment = /* @__PURE__ */ new Map();
                          var dummyPositionsForHorizontalAlignment = /* @__PURE__ */ new Map();
                          var fixedNodesOnHorizontal = /* @__PURE__ */ new Set();
                          var fixedNodesOnVertical = /* @__PURE__ */ new Set();
                          fixedNodes.forEach(function(nodeId2) {
                            fixedNodesOnHorizontal.add(nodeId2);
                            fixedNodesOnVertical.add(nodeId2);
                          });
                          if (constraints.alignmentConstraint) {
                            if (constraints.alignmentConstraint.vertical) {
                              var verticalAlignment2 = constraints.alignmentConstraint.vertical;
                              var _loop6 = /* @__PURE__ */ __name(function _loop62(_i112) {
                                dummyToNodeForVerticalAlignment.set("dummy" + _i112, []);
                                verticalAlignment2[_i112].forEach(function(nodeId2) {
                                  nodeToDummyForVerticalAlignment.set(nodeId2, "dummy" + _i112);
                                  dummyToNodeForVerticalAlignment.get("dummy" + _i112).push(nodeId2);
                                  if (fixedNodes.has(nodeId2)) {
                                    fixedNodesOnHorizontal.add("dummy" + _i112);
                                  }
                                });
                                dummyPositionsForVerticalAlignment.set("dummy" + _i112, xCoords[nodeIndexes.get(verticalAlignment2[_i112][0])]);
                              }, "_loop6");
                              for (var _i11 = 0; _i11 < verticalAlignment2.length; _i11++) {
                                _loop6(_i11);
                              }
                            }
                            if (constraints.alignmentConstraint.horizontal) {
                              var horizontalAlignment = constraints.alignmentConstraint.horizontal;
                              var _loop7 = /* @__PURE__ */ __name(function _loop72(_i122) {
                                dummyToNodeForHorizontalAlignment.set("dummy" + _i122, []);
                                horizontalAlignment[_i122].forEach(function(nodeId2) {
                                  nodeToDummyForHorizontalAlignment.set(nodeId2, "dummy" + _i122);
                                  dummyToNodeForHorizontalAlignment.get("dummy" + _i122).push(nodeId2);
                                  if (fixedNodes.has(nodeId2)) {
                                    fixedNodesOnVertical.add("dummy" + _i122);
                                  }
                                });
                                dummyPositionsForHorizontalAlignment.set("dummy" + _i122, yCoords[nodeIndexes.get(horizontalAlignment[_i122][0])]);
                              }, "_loop7");
                              for (var _i12 = 0; _i12 < horizontalAlignment.length; _i12++) {
                                _loop7(_i12);
                              }
                            }
                          }
                          var dagOnHorizontal = /* @__PURE__ */ new Map();
                          var dagOnVertical = /* @__PURE__ */ new Map();
                          var _loop8 = /* @__PURE__ */ __name(function _loop82(nodeId2) {
                            dag.get(nodeId2).forEach(function(adjacent) {
                              var sourceId = void 0;
                              var targetNode = void 0;
                              if (adjacent["direction"] == "horizontal") {
                                sourceId = nodeToDummyForVerticalAlignment.get(nodeId2) ? nodeToDummyForVerticalAlignment.get(nodeId2) : nodeId2;
                                if (nodeToDummyForVerticalAlignment.get(adjacent.id)) {
                                  targetNode = { id: nodeToDummyForVerticalAlignment.get(adjacent.id), gap: adjacent.gap, direction: adjacent.direction };
                                } else {
                                  targetNode = adjacent;
                                }
                                if (dagOnHorizontal.has(sourceId)) {
                                  dagOnHorizontal.get(sourceId).push(targetNode);
                                } else {
                                  dagOnHorizontal.set(sourceId, [targetNode]);
                                }
                                if (!dagOnHorizontal.has(targetNode.id)) {
                                  dagOnHorizontal.set(targetNode.id, []);
                                }
                              } else {
                                sourceId = nodeToDummyForHorizontalAlignment.get(nodeId2) ? nodeToDummyForHorizontalAlignment.get(nodeId2) : nodeId2;
                                if (nodeToDummyForHorizontalAlignment.get(adjacent.id)) {
                                  targetNode = { id: nodeToDummyForHorizontalAlignment.get(adjacent.id), gap: adjacent.gap, direction: adjacent.direction };
                                } else {
                                  targetNode = adjacent;
                                }
                                if (dagOnVertical.has(sourceId)) {
                                  dagOnVertical.get(sourceId).push(targetNode);
                                } else {
                                  dagOnVertical.set(sourceId, [targetNode]);
                                }
                                if (!dagOnVertical.has(targetNode.id)) {
                                  dagOnVertical.set(targetNode.id, []);
                                }
                              }
                            });
                          }, "_loop8");
                          var _iteratorNormalCompletion5 = true;
                          var _didIteratorError5 = false;
                          var _iteratorError5 = void 0;
                          try {
                            for (var _iterator5 = dag.keys()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
                              var nodeId = _step5.value;
                              _loop8(nodeId);
                            }
                          } catch (err) {
                            _didIteratorError5 = true;
                            _iteratorError5 = err;
                          } finally {
                            try {
                              if (!_iteratorNormalCompletion5 && _iterator5.return) {
                                _iterator5.return();
                              }
                            } finally {
                              if (_didIteratorError5) {
                                throw _iteratorError5;
                              }
                            }
                          }
                          var undirectedOnHorizontal = dagToUndirected(dagOnHorizontal);
                          var undirectedOnVertical = dagToUndirected(dagOnVertical);
                          var componentsOnHorizontal = findComponents(undirectedOnHorizontal);
                          var componentsOnVertical = findComponents(undirectedOnVertical);
                          var reversedDagOnHorizontal = dagToReversed(dagOnHorizontal);
                          var reversedDagOnVertical = dagToReversed(dagOnVertical);
                          var componentSourcesOnHorizontal = [];
                          var componentSourcesOnVertical = [];
                          componentsOnHorizontal.forEach(function(component2, index2) {
                            componentSourcesOnHorizontal[index2] = [];
                            component2.forEach(function(nodeId2) {
                              if (reversedDagOnHorizontal.get(nodeId2).length == 0) {
                                componentSourcesOnHorizontal[index2].push(nodeId2);
                              }
                            });
                          });
                          componentsOnVertical.forEach(function(component2, index2) {
                            componentSourcesOnVertical[index2] = [];
                            component2.forEach(function(nodeId2) {
                              if (reversedDagOnVertical.get(nodeId2).length == 0) {
                                componentSourcesOnVertical[index2].push(nodeId2);
                              }
                            });
                          });
                          var positionMapHorizontal2 = findAppropriatePositionForRelativePlacement(dagOnHorizontal, "horizontal", fixedNodesOnHorizontal, dummyPositionsForVerticalAlignment, componentSourcesOnHorizontal);
                          var positionMapVertical2 = findAppropriatePositionForRelativePlacement(dagOnVertical, "vertical", fixedNodesOnVertical, dummyPositionsForHorizontalAlignment, componentSourcesOnVertical);
                          var _loop9 = /* @__PURE__ */ __name(function _loop92(key2) {
                            if (dummyToNodeForVerticalAlignment.get(key2)) {
                              dummyToNodeForVerticalAlignment.get(key2).forEach(function(nodeId2) {
                                xCoords[nodeIndexes.get(nodeId2)] = positionMapHorizontal2.get(key2);
                              });
                            } else {
                              xCoords[nodeIndexes.get(key2)] = positionMapHorizontal2.get(key2);
                            }
                          }, "_loop9");
                          var _iteratorNormalCompletion6 = true;
                          var _didIteratorError6 = false;
                          var _iteratorError6 = void 0;
                          try {
                            for (var _iterator6 = positionMapHorizontal2.keys()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
                              var key = _step6.value;
                              _loop9(key);
                            }
                          } catch (err) {
                            _didIteratorError6 = true;
                            _iteratorError6 = err;
                          } finally {
                            try {
                              if (!_iteratorNormalCompletion6 && _iterator6.return) {
                                _iterator6.return();
                              }
                            } finally {
                              if (_didIteratorError6) {
                                throw _iteratorError6;
                              }
                            }
                          }
                          var _loop10 = /* @__PURE__ */ __name(function _loop102(key2) {
                            if (dummyToNodeForHorizontalAlignment.get(key2)) {
                              dummyToNodeForHorizontalAlignment.get(key2).forEach(function(nodeId2) {
                                yCoords[nodeIndexes.get(nodeId2)] = positionMapVertical2.get(key2);
                              });
                            } else {
                              yCoords[nodeIndexes.get(key2)] = positionMapVertical2.get(key2);
                            }
                          }, "_loop10");
                          var _iteratorNormalCompletion7 = true;
                          var _didIteratorError7 = false;
                          var _iteratorError7 = void 0;
                          try {
                            for (var _iterator7 = positionMapVertical2.keys()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
                              var key = _step7.value;
                              _loop10(key);
                            }
                          } catch (err) {
                            _didIteratorError7 = true;
                            _iteratorError7 = err;
                          } finally {
                            try {
                              if (!_iteratorNormalCompletion7 && _iterator7.return) {
                                _iterator7.return();
                              }
                            } finally {
                              if (_didIteratorError7) {
                                throw _iteratorError7;
                              }
                            }
                          }
                        })();
                      }
                    }
                    for (var _i13 = 0; _i13 < allNodes.length; _i13++) {
                      var _node = allNodes[_i13];
                      if (_node.getChild() == null) {
                        _node.setCenter(xCoords[nodeIndexes.get(_node.id)], yCoords[nodeIndexes.get(_node.id)]);
                      }
                    }
                  };
                  module3.exports = ConstraintHandler;
                })
              ),
              /***/
              551: (
                /***/
                ((module3) => {
                  module3.exports = __WEBPACK_EXTERNAL_MODULE__551__;
                })
              )
              /******/
            };
            var __webpack_module_cache__ = {};
            function __webpack_require__(moduleId) {
              var cachedModule = __webpack_module_cache__[moduleId];
              if (cachedModule !== void 0) {
                return cachedModule.exports;
              }
              var module3 = __webpack_module_cache__[moduleId] = {
                /******/
                // no module.id needed
                /******/
                // no module.loaded needed
                /******/
                exports: {}
                /******/
              };
              __webpack_modules__[moduleId](module3, module3.exports, __webpack_require__);
              return module3.exports;
            }
            __name(__webpack_require__, "__webpack_require__");
            var __webpack_exports__ = __webpack_require__(45);
            return __webpack_exports__;
          })()
        );
      });
    }
  });

  // ../../node_modules/.pnpm/cytoscape-fcose@2.2.0_cytoscape@3.33.1/node_modules/cytoscape-fcose/cytoscape-fcose.js
  var require_cytoscape_fcose = __commonJS({
    "../../node_modules/.pnpm/cytoscape-fcose@2.2.0_cytoscape@3.33.1/node_modules/cytoscape-fcose/cytoscape-fcose.js"(exports2, module2) {
      "use strict";
      (/* @__PURE__ */ __name((function webpackUniversalModuleDefinition(root3, factory) {
        if (typeof exports2 === "object" && typeof module2 === "object")
          module2.exports = factory(require_cose_base2());
        else if (typeof define === "function" && define.amd)
          define(["cose-base"], factory);
        else if (typeof exports2 === "object")
          exports2["cytoscapeFcose"] = factory(require_cose_base2());
        else
          root3["cytoscapeFcose"] = factory(root3["coseBase"]);
      }), "webpackUniversalModuleDefinition"))(exports2, function(__WEBPACK_EXTERNAL_MODULE__140__) {
        return (
          /******/
          (() => {
            "use strict";
            var __webpack_modules__ = {
              /***/
              658: (
                /***/
                ((module3) => {
                  module3.exports = Object.assign != null ? Object.assign.bind(Object) : function(tgt) {
                    for (var _len = arguments.length, srcs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
                      srcs[_key - 1] = arguments[_key];
                    }
                    srcs.forEach(function(src) {
                      Object.keys(src).forEach(function(k2) {
                        return tgt[k2] = src[k2];
                      });
                    });
                    return tgt;
                  };
                })
              ),
              /***/
              548: (
                /***/
                ((module3, __unused_webpack_exports, __webpack_require__2) => {
                  var _slicedToArray2 = /* @__PURE__ */ (function() {
                    function sliceIterator(arr, i2) {
                      var _arr = [];
                      var _n = true;
                      var _d = false;
                      var _e2 = void 0;
                      try {
                        for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
                          _arr.push(_s.value);
                          if (i2 && _arr.length === i2) break;
                        }
                      } catch (err) {
                        _d = true;
                        _e2 = err;
                      } finally {
                        try {
                          if (!_n && _i["return"]) _i["return"]();
                        } finally {
                          if (_d) throw _e2;
                        }
                      }
                      return _arr;
                    }
                    __name(sliceIterator, "sliceIterator");
                    return function(arr, i2) {
                      if (Array.isArray(arr)) {
                        return arr;
                      } else if (Symbol.iterator in Object(arr)) {
                        return sliceIterator(arr, i2);
                      } else {
                        throw new TypeError("Invalid attempt to destructure non-iterable instance");
                      }
                    };
                  })();
                  var LinkedList = __webpack_require__2(140).layoutBase.LinkedList;
                  var auxiliary = {};
                  auxiliary.getTopMostNodes = function(nodes5) {
                    var nodesMap2 = {};
                    for (var i2 = 0; i2 < nodes5.length; i2++) {
                      nodesMap2[nodes5[i2].id()] = true;
                    }
                    var roots = nodes5.filter(function(ele, i3) {
                      if (typeof ele === "number") {
                        ele = i3;
                      }
                      var parent4 = ele.parent()[0];
                      while (parent4 != null) {
                        if (nodesMap2[parent4.id()]) {
                          return false;
                        }
                        parent4 = parent4.parent()[0];
                      }
                      return true;
                    });
                    return roots;
                  };
                  auxiliary.connectComponents = function(cy, eles, topMostNodes, dummyNodes) {
                    var queue = new LinkedList();
                    var visited = /* @__PURE__ */ new Set();
                    var visitedTopMostNodes = [];
                    var currentNeighbor = void 0;
                    var minDegreeNode = void 0;
                    var minDegree = void 0;
                    var isConnected = false;
                    var count2 = 1;
                    var nodesConnectedToDummy = [];
                    var components3 = [];
                    var _loop = /* @__PURE__ */ __name(function _loop2() {
                      var cmpt = cy.collection();
                      components3.push(cmpt);
                      var currentNode = topMostNodes[0];
                      var childrenOfCurrentNode = cy.collection();
                      childrenOfCurrentNode.merge(currentNode).merge(currentNode.descendants().intersection(eles));
                      visitedTopMostNodes.push(currentNode);
                      childrenOfCurrentNode.forEach(function(node2) {
                        queue.push(node2);
                        visited.add(node2);
                        cmpt.merge(node2);
                      });
                      var _loop22 = /* @__PURE__ */ __name(function _loop23() {
                        currentNode = queue.shift();
                        var neighborNodes = cy.collection();
                        currentNode.neighborhood().nodes().forEach(function(node2) {
                          if (eles.intersection(currentNode.edgesWith(node2)).length > 0) {
                            neighborNodes.merge(node2);
                          }
                        });
                        for (var i2 = 0; i2 < neighborNodes.length; i2++) {
                          var neighborNode = neighborNodes[i2];
                          currentNeighbor = topMostNodes.intersection(neighborNode.union(neighborNode.ancestors()));
                          if (currentNeighbor != null && !visited.has(currentNeighbor[0])) {
                            var childrenOfNeighbor = currentNeighbor.union(currentNeighbor.descendants());
                            childrenOfNeighbor.forEach(function(node2) {
                              queue.push(node2);
                              visited.add(node2);
                              cmpt.merge(node2);
                              if (topMostNodes.has(node2)) {
                                visitedTopMostNodes.push(node2);
                              }
                            });
                          }
                        }
                      }, "_loop2");
                      while (queue.length != 0) {
                        _loop22();
                      }
                      cmpt.forEach(function(node2) {
                        eles.intersection(node2.connectedEdges()).forEach(function(e3) {
                          if (cmpt.has(e3.source()) && cmpt.has(e3.target())) {
                            cmpt.merge(e3);
                          }
                        });
                      });
                      if (visitedTopMostNodes.length == topMostNodes.length) {
                        isConnected = true;
                      }
                      if (!isConnected || isConnected && count2 > 1) {
                        minDegreeNode = visitedTopMostNodes[0];
                        minDegree = minDegreeNode.connectedEdges().length;
                        visitedTopMostNodes.forEach(function(node2) {
                          if (node2.connectedEdges().length < minDegree) {
                            minDegree = node2.connectedEdges().length;
                            minDegreeNode = node2;
                          }
                        });
                        nodesConnectedToDummy.push(minDegreeNode.id());
                        var temp = cy.collection();
                        temp.merge(visitedTopMostNodes[0]);
                        visitedTopMostNodes.forEach(function(node2) {
                          temp.merge(node2);
                        });
                        visitedTopMostNodes = [];
                        topMostNodes = topMostNodes.difference(temp);
                        count2++;
                      }
                    }, "_loop");
                    do {
                      _loop();
                    } while (!isConnected);
                    if (dummyNodes) {
                      if (nodesConnectedToDummy.length > 0) {
                        dummyNodes.set("dummy" + (dummyNodes.size + 1), nodesConnectedToDummy);
                      }
                    }
                    return components3;
                  };
                  auxiliary.relocateComponent = function(originalCenter, componentResult, options2) {
                    if (!options2.fixedNodeConstraint) {
                      var minXCoord = Number.POSITIVE_INFINITY;
                      var maxXCoord = Number.NEGATIVE_INFINITY;
                      var minYCoord = Number.POSITIVE_INFINITY;
                      var maxYCoord = Number.NEGATIVE_INFINITY;
                      if (options2.quality == "draft") {
                        var _iteratorNormalCompletion = true;
                        var _didIteratorError = false;
                        var _iteratorError = void 0;
                        try {
                          for (var _iterator = componentResult.nodeIndexes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                            var _ref = _step.value;
                            var _ref2 = _slicedToArray2(_ref, 2);
                            var key = _ref2[0];
                            var value2 = _ref2[1];
                            var cyNode = options2.cy.getElementById(key);
                            if (cyNode) {
                              var nodeBB = cyNode.boundingBox();
                              var leftX = componentResult.xCoords[value2] - nodeBB.w / 2;
                              var rightX = componentResult.xCoords[value2] + nodeBB.w / 2;
                              var topY = componentResult.yCoords[value2] - nodeBB.h / 2;
                              var bottomY = componentResult.yCoords[value2] + nodeBB.h / 2;
                              if (leftX < minXCoord) minXCoord = leftX;
                              if (rightX > maxXCoord) maxXCoord = rightX;
                              if (topY < minYCoord) minYCoord = topY;
                              if (bottomY > maxYCoord) maxYCoord = bottomY;
                            }
                          }
                        } catch (err) {
                          _didIteratorError = true;
                          _iteratorError = err;
                        } finally {
                          try {
                            if (!_iteratorNormalCompletion && _iterator.return) {
                              _iterator.return();
                            }
                          } finally {
                            if (_didIteratorError) {
                              throw _iteratorError;
                            }
                          }
                        }
                        var diffOnX = originalCenter.x - (maxXCoord + minXCoord) / 2;
                        var diffOnY = originalCenter.y - (maxYCoord + minYCoord) / 2;
                        componentResult.xCoords = componentResult.xCoords.map(function(x5) {
                          return x5 + diffOnX;
                        });
                        componentResult.yCoords = componentResult.yCoords.map(function(y6) {
                          return y6 + diffOnY;
                        });
                      } else {
                        Object.keys(componentResult).forEach(function(item) {
                          var node2 = componentResult[item];
                          var leftX2 = node2.getRect().x;
                          var rightX2 = node2.getRect().x + node2.getRect().width;
                          var topY2 = node2.getRect().y;
                          var bottomY2 = node2.getRect().y + node2.getRect().height;
                          if (leftX2 < minXCoord) minXCoord = leftX2;
                          if (rightX2 > maxXCoord) maxXCoord = rightX2;
                          if (topY2 < minYCoord) minYCoord = topY2;
                          if (bottomY2 > maxYCoord) maxYCoord = bottomY2;
                        });
                        var _diffOnX = originalCenter.x - (maxXCoord + minXCoord) / 2;
                        var _diffOnY = originalCenter.y - (maxYCoord + minYCoord) / 2;
                        Object.keys(componentResult).forEach(function(item) {
                          var node2 = componentResult[item];
                          node2.setCenter(node2.getCenterX() + _diffOnX, node2.getCenterY() + _diffOnY);
                        });
                      }
                    }
                  };
                  auxiliary.calcBoundingBox = function(parentNode, xCoords, yCoords, nodeIndexes) {
                    var left3 = Number.MAX_SAFE_INTEGER;
                    var right3 = Number.MIN_SAFE_INTEGER;
                    var top2 = Number.MAX_SAFE_INTEGER;
                    var bottom2 = Number.MIN_SAFE_INTEGER;
                    var nodeLeft = void 0;
                    var nodeRight = void 0;
                    var nodeTop = void 0;
                    var nodeBottom = void 0;
                    var nodes5 = parentNode.descendants().not(":parent");
                    var s2 = nodes5.length;
                    for (var i2 = 0; i2 < s2; i2++) {
                      var node2 = nodes5[i2];
                      nodeLeft = xCoords[nodeIndexes.get(node2.id())] - node2.width() / 2;
                      nodeRight = xCoords[nodeIndexes.get(node2.id())] + node2.width() / 2;
                      nodeTop = yCoords[nodeIndexes.get(node2.id())] - node2.height() / 2;
                      nodeBottom = yCoords[nodeIndexes.get(node2.id())] + node2.height() / 2;
                      if (left3 > nodeLeft) {
                        left3 = nodeLeft;
                      }
                      if (right3 < nodeRight) {
                        right3 = nodeRight;
                      }
                      if (top2 > nodeTop) {
                        top2 = nodeTop;
                      }
                      if (bottom2 < nodeBottom) {
                        bottom2 = nodeBottom;
                      }
                    }
                    var boundingBox3 = {};
                    boundingBox3.topLeftX = left3;
                    boundingBox3.topLeftY = top2;
                    boundingBox3.width = right3 - left3;
                    boundingBox3.height = bottom2 - top2;
                    return boundingBox3;
                  };
                  auxiliary.calcParentsWithoutChildren = function(cy, eles) {
                    var parentsWithoutChildren = cy.collection();
                    eles.nodes(":parent").forEach(function(parent4) {
                      var check = false;
                      parent4.children().forEach(function(child) {
                        if (child.css("display") != "none") {
                          check = true;
                        }
                      });
                      if (!check) {
                        parentsWithoutChildren.merge(parent4);
                      }
                    });
                    return parentsWithoutChildren;
                  };
                  module3.exports = auxiliary;
                })
              ),
              /***/
              816: (
                /***/
                ((module3, __unused_webpack_exports, __webpack_require__2) => {
                  var aux = __webpack_require__2(548);
                  var CoSELayout = __webpack_require__2(140).CoSELayout;
                  var CoSENode = __webpack_require__2(140).CoSENode;
                  var PointD = __webpack_require__2(140).layoutBase.PointD;
                  var DimensionD2 = __webpack_require__2(140).layoutBase.DimensionD;
                  var LayoutConstants = __webpack_require__2(140).layoutBase.LayoutConstants;
                  var FDLayoutConstants = __webpack_require__2(140).layoutBase.FDLayoutConstants;
                  var CoSEConstants = __webpack_require__2(140).CoSEConstants;
                  var coseLayout = /* @__PURE__ */ __name(function coseLayout2(options2, spectralResult) {
                    var cy = options2.cy;
                    var eles = options2.eles;
                    var nodes5 = eles.nodes();
                    var edges3 = eles.edges();
                    var nodeIndexes = void 0;
                    var xCoords = void 0;
                    var yCoords = void 0;
                    var idToLNode = {};
                    if (options2.randomize) {
                      nodeIndexes = spectralResult["nodeIndexes"];
                      xCoords = spectralResult["xCoords"];
                      yCoords = spectralResult["yCoords"];
                    }
                    var isFn = /* @__PURE__ */ __name(function isFn2(fn3) {
                      return typeof fn3 === "function";
                    }, "isFn");
                    var optFn = /* @__PURE__ */ __name(function optFn2(opt, ele) {
                      if (isFn(opt)) {
                        return opt(ele);
                      } else {
                        return opt;
                      }
                    }, "optFn");
                    var parentsWithoutChildren = aux.calcParentsWithoutChildren(cy, eles);
                    var processChildrenList = /* @__PURE__ */ __name(function processChildrenList2(parent4, children2, layout7, options3) {
                      var size4 = children2.length;
                      for (var i2 = 0; i2 < size4; i2++) {
                        var theChild = children2[i2];
                        var children_of_children = null;
                        if (theChild.intersection(parentsWithoutChildren).length == 0) {
                          children_of_children = theChild.children();
                        }
                        var theNode = void 0;
                        var dimensions2 = theChild.layoutDimensions({
                          nodeDimensionsIncludeLabels: options3.nodeDimensionsIncludeLabels
                        });
                        if (theChild.outerWidth() != null && theChild.outerHeight() != null) {
                          if (options3.randomize) {
                            if (!theChild.isParent()) {
                              theNode = parent4.add(new CoSENode(layout7.graphManager, new PointD(xCoords[nodeIndexes.get(theChild.id())] - dimensions2.w / 2, yCoords[nodeIndexes.get(theChild.id())] - dimensions2.h / 2), new DimensionD2(parseFloat(dimensions2.w), parseFloat(dimensions2.h))));
                            } else {
                              var parentInfo = aux.calcBoundingBox(theChild, xCoords, yCoords, nodeIndexes);
                              if (theChild.intersection(parentsWithoutChildren).length == 0) {
                                theNode = parent4.add(new CoSENode(layout7.graphManager, new PointD(parentInfo.topLeftX, parentInfo.topLeftY), new DimensionD2(parentInfo.width, parentInfo.height)));
                              } else {
                                theNode = parent4.add(new CoSENode(layout7.graphManager, new PointD(parentInfo.topLeftX, parentInfo.topLeftY), new DimensionD2(parseFloat(dimensions2.w), parseFloat(dimensions2.h))));
                              }
                            }
                          } else {
                            theNode = parent4.add(new CoSENode(layout7.graphManager, new PointD(theChild.position("x") - dimensions2.w / 2, theChild.position("y") - dimensions2.h / 2), new DimensionD2(parseFloat(dimensions2.w), parseFloat(dimensions2.h))));
                          }
                        } else {
                          theNode = parent4.add(new CoSENode(this.graphManager));
                        }
                        theNode.id = theChild.data("id");
                        theNode.nodeRepulsion = optFn(options3.nodeRepulsion, theChild);
                        theNode.paddingLeft = parseInt(theChild.css("padding"));
                        theNode.paddingTop = parseInt(theChild.css("padding"));
                        theNode.paddingRight = parseInt(theChild.css("padding"));
                        theNode.paddingBottom = parseInt(theChild.css("padding"));
                        if (options3.nodeDimensionsIncludeLabels) {
                          theNode.labelWidth = theChild.boundingBox({ includeLabels: true, includeNodes: false, includeOverlays: false }).w;
                          theNode.labelHeight = theChild.boundingBox({ includeLabels: true, includeNodes: false, includeOverlays: false }).h;
                          theNode.labelPosVertical = theChild.css("text-valign");
                          theNode.labelPosHorizontal = theChild.css("text-halign");
                        }
                        idToLNode[theChild.data("id")] = theNode;
                        if (isNaN(theNode.rect.x)) {
                          theNode.rect.x = 0;
                        }
                        if (isNaN(theNode.rect.y)) {
                          theNode.rect.y = 0;
                        }
                        if (children_of_children != null && children_of_children.length > 0) {
                          var theNewGraph = void 0;
                          theNewGraph = layout7.getGraphManager().add(layout7.newGraph(), theNode);
                          processChildrenList2(theNewGraph, children_of_children, layout7, options3);
                        }
                      }
                    }, "processChildrenList");
                    var processEdges = /* @__PURE__ */ __name(function processEdges2(layout7, gm2, edges4) {
                      var idealLengthTotal = 0;
                      var edgeCount3 = 0;
                      for (var i2 = 0; i2 < edges4.length; i2++) {
                        var edge = edges4[i2];
                        var sourceNode = idToLNode[edge.data("source")];
                        var targetNode = idToLNode[edge.data("target")];
                        if (sourceNode && targetNode && sourceNode !== targetNode && sourceNode.getEdgesBetween(targetNode).length == 0) {
                          var e1 = gm2.add(layout7.newEdge(), sourceNode, targetNode);
                          e1.id = edge.id();
                          e1.idealLength = optFn(options2.idealEdgeLength, edge);
                          e1.edgeElasticity = optFn(options2.edgeElasticity, edge);
                          idealLengthTotal += e1.idealLength;
                          edgeCount3++;
                        }
                      }
                      if (options2.idealEdgeLength != null) {
                        if (edgeCount3 > 0) CoSEConstants.DEFAULT_EDGE_LENGTH = FDLayoutConstants.DEFAULT_EDGE_LENGTH = idealLengthTotal / edgeCount3;
                        else if (!isFn(options2.idealEdgeLength))
                          CoSEConstants.DEFAULT_EDGE_LENGTH = FDLayoutConstants.DEFAULT_EDGE_LENGTH = options2.idealEdgeLength;
                        else
                          CoSEConstants.DEFAULT_EDGE_LENGTH = FDLayoutConstants.DEFAULT_EDGE_LENGTH = 50;
                        CoSEConstants.MIN_REPULSION_DIST = FDLayoutConstants.MIN_REPULSION_DIST = FDLayoutConstants.DEFAULT_EDGE_LENGTH / 10;
                        CoSEConstants.DEFAULT_RADIAL_SEPARATION = FDLayoutConstants.DEFAULT_EDGE_LENGTH;
                      }
                    }, "processEdges");
                    var processConstraints = /* @__PURE__ */ __name(function processConstraints2(layout7, options3) {
                      if (options3.fixedNodeConstraint) {
                        layout7.constraints["fixedNodeConstraint"] = options3.fixedNodeConstraint;
                      }
                      if (options3.alignmentConstraint) {
                        layout7.constraints["alignmentConstraint"] = options3.alignmentConstraint;
                      }
                      if (options3.relativePlacementConstraint) {
                        layout7.constraints["relativePlacementConstraint"] = options3.relativePlacementConstraint;
                      }
                    }, "processConstraints");
                    if (options2.nestingFactor != null) CoSEConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = options2.nestingFactor;
                    if (options2.gravity != null) CoSEConstants.DEFAULT_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = options2.gravity;
                    if (options2.numIter != null) CoSEConstants.MAX_ITERATIONS = FDLayoutConstants.MAX_ITERATIONS = options2.numIter;
                    if (options2.gravityRange != null) CoSEConstants.DEFAULT_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = options2.gravityRange;
                    if (options2.gravityCompound != null) CoSEConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = options2.gravityCompound;
                    if (options2.gravityRangeCompound != null) CoSEConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = options2.gravityRangeCompound;
                    if (options2.initialEnergyOnIncremental != null) CoSEConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = options2.initialEnergyOnIncremental;
                    if (options2.tilingCompareBy != null) CoSEConstants.TILING_COMPARE_BY = options2.tilingCompareBy;
                    if (options2.quality == "proof") LayoutConstants.QUALITY = 2;
                    else LayoutConstants.QUALITY = 0;
                    CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS = FDLayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = options2.nodeDimensionsIncludeLabels;
                    CoSEConstants.DEFAULT_INCREMENTAL = FDLayoutConstants.DEFAULT_INCREMENTAL = LayoutConstants.DEFAULT_INCREMENTAL = !options2.randomize;
                    CoSEConstants.ANIMATE = FDLayoutConstants.ANIMATE = LayoutConstants.ANIMATE = options2.animate;
                    CoSEConstants.TILE = options2.tile;
                    CoSEConstants.TILING_PADDING_VERTICAL = typeof options2.tilingPaddingVertical === "function" ? options2.tilingPaddingVertical.call() : options2.tilingPaddingVertical;
                    CoSEConstants.TILING_PADDING_HORIZONTAL = typeof options2.tilingPaddingHorizontal === "function" ? options2.tilingPaddingHorizontal.call() : options2.tilingPaddingHorizontal;
                    CoSEConstants.DEFAULT_INCREMENTAL = FDLayoutConstants.DEFAULT_INCREMENTAL = LayoutConstants.DEFAULT_INCREMENTAL = true;
                    CoSEConstants.PURE_INCREMENTAL = !options2.randomize;
                    LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES = options2.uniformNodeDimensions;
                    if (options2.step == "transformed") {
                      CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = true;
                      CoSEConstants.ENFORCE_CONSTRAINTS = false;
                      CoSEConstants.APPLY_LAYOUT = false;
                    }
                    if (options2.step == "enforced") {
                      CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = false;
                      CoSEConstants.ENFORCE_CONSTRAINTS = true;
                      CoSEConstants.APPLY_LAYOUT = false;
                    }
                    if (options2.step == "cose") {
                      CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = false;
                      CoSEConstants.ENFORCE_CONSTRAINTS = false;
                      CoSEConstants.APPLY_LAYOUT = true;
                    }
                    if (options2.step == "all") {
                      if (options2.randomize) CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = true;
                      else CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = false;
                      CoSEConstants.ENFORCE_CONSTRAINTS = true;
                      CoSEConstants.APPLY_LAYOUT = true;
                    }
                    if (options2.fixedNodeConstraint || options2.alignmentConstraint || options2.relativePlacementConstraint) {
                      CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = false;
                    } else {
                      CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = true;
                    }
                    var coseLayout3 = new CoSELayout();
                    var gm = coseLayout3.newGraphManager();
                    processChildrenList(gm.addRoot(), aux.getTopMostNodes(nodes5), coseLayout3, options2);
                    processEdges(coseLayout3, gm, edges3);
                    processConstraints(coseLayout3, options2);
                    coseLayout3.runLayout();
                    return idToLNode;
                  }, "coseLayout");
                  module3.exports = { coseLayout };
                })
              ),
              /***/
              212: (
                /***/
                ((module3, __unused_webpack_exports, __webpack_require__2) => {
                  var _createClass2 = /* @__PURE__ */ (function() {
                    function defineProperties(target, props) {
                      for (var i2 = 0; i2 < props.length; i2++) {
                        var descriptor = props[i2];
                        descriptor.enumerable = descriptor.enumerable || false;
                        descriptor.configurable = true;
                        if ("value" in descriptor) descriptor.writable = true;
                        Object.defineProperty(target, descriptor.key, descriptor);
                      }
                    }
                    __name(defineProperties, "defineProperties");
                    return function(Constructor, protoProps, staticProps) {
                      if (protoProps) defineProperties(Constructor.prototype, protoProps);
                      if (staticProps) defineProperties(Constructor, staticProps);
                      return Constructor;
                    };
                  })();
                  function _classCallCheck2(instance2, Constructor) {
                    if (!(instance2 instanceof Constructor)) {
                      throw new TypeError("Cannot call a class as a function");
                    }
                  }
                  __name(_classCallCheck2, "_classCallCheck");
                  var assign7 = __webpack_require__2(658);
                  var aux = __webpack_require__2(548);
                  var _require = __webpack_require__2(657), spectralLayout = _require.spectralLayout;
                  var _require2 = __webpack_require__2(816), coseLayout = _require2.coseLayout;
                  var defaults4 = Object.freeze({
                    // 'draft', 'default' or 'proof' 
                    // - 'draft' only applies spectral layout 
                    // - 'default' improves the quality with subsequent CoSE layout (fast cooling rate)
                    // - 'proof' improves the quality with subsequent CoSE layout (slow cooling rate) 
                    quality: "default",
                    // Use random node positions at beginning of layout
                    // if this is set to false, then quality option must be "proof"
                    randomize: true,
                    // Whether or not to animate the layout
                    animate: true,
                    // Duration of animation in ms, if enabled
                    animationDuration: 1e3,
                    // Easing of animation, if enabled
                    animationEasing: void 0,
                    // Fit the viewport to the repositioned nodes
                    fit: true,
                    // Padding around layout
                    padding: 30,
                    // Whether to include labels in node dimensions. Valid in "proof" quality
                    nodeDimensionsIncludeLabels: false,
                    // Whether or not simple nodes (non-compound nodes) are of uniform dimensions
                    uniformNodeDimensions: false,
                    // Whether to pack disconnected components - valid only if randomize: true
                    packComponents: true,
                    // Layout step - all, transformed, enforced, cose - for debug purpose only
                    step: "all",
                    /* spectral layout options */
                    // False for random, true for greedy
                    samplingType: true,
                    // Sample size to construct distance matrix
                    sampleSize: 25,
                    // Separation amount between nodes
                    nodeSeparation: 75,
                    // Power iteration tolerance
                    piTol: 1e-7,
                    /* CoSE layout options */
                    // Node repulsion (non overlapping) multiplier
                    nodeRepulsion: /* @__PURE__ */ __name(function nodeRepulsion4(node2) {
                      return 4500;
                    }, "nodeRepulsion"),
                    // Ideal edge (non nested) length
                    idealEdgeLength: /* @__PURE__ */ __name(function idealEdgeLength2(edge) {
                      return 50;
                    }, "idealEdgeLength"),
                    // Divisor to compute edge forces
                    edgeElasticity: /* @__PURE__ */ __name(function edgeElasticity2(edge) {
                      return 0.45;
                    }, "edgeElasticity"),
                    // Nesting factor (multiplier) to compute ideal edge length for nested edges
                    nestingFactor: 0.1,
                    // Gravity force (constant)
                    gravity: 0.25,
                    // Maximum number of iterations to perform
                    numIter: 2500,
                    // For enabling tiling
                    tile: true,
                    // The function that specifies the criteria for comparing nodes while sorting them during tiling operation.
                    // Takes the node id as a parameter and the default tiling operation is perfomed when this option is not set.
                    tilingCompareBy: void 0,
                    // Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function)
                    tilingPaddingVertical: 10,
                    // Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function)
                    tilingPaddingHorizontal: 10,
                    // Gravity range (constant) for compounds
                    gravityRangeCompound: 1.5,
                    // Gravity force (constant) for compounds
                    gravityCompound: 1,
                    // Gravity range (constant)
                    gravityRange: 3.8,
                    // Initial cooling factor for incremental layout  
                    initialEnergyOnIncremental: 0.3,
                    /* constraint options */
                    // Fix required nodes to predefined positions
                    // [{nodeId: 'n1', position: {x: 100, y: 200}, {...}]
                    fixedNodeConstraint: void 0,
                    // Align required nodes in vertical/horizontal direction
                    // {vertical: [['n1', 'n2')], ['n3', 'n4']], horizontal: ['n2', 'n4']}
                    alignmentConstraint: void 0,
                    // Place two nodes relatively in vertical/horizontal direction 
                    // [{top: 'n1', bottom: 'n2', gap: 100}, {left: 'n3', right: 'n4', gap: 75}]
                    relativePlacementConstraint: void 0,
                    /* layout event callbacks */
                    ready: /* @__PURE__ */ __name(function ready4() {
                    }, "ready"),
                    // on layoutready
                    stop: /* @__PURE__ */ __name(function stop5() {
                    }, "stop")
                    // on layoutstop
                  });
                  var Layout2 = (function() {
                    function Layout3(options2) {
                      _classCallCheck2(this, Layout3);
                      this.options = assign7({}, defaults4, options2);
                    }
                    __name(Layout3, "Layout");
                    _createClass2(Layout3, [{
                      key: "run",
                      value: /* @__PURE__ */ __name(function run5() {
                        var layout7 = this;
                        var options2 = this.options;
                        var cy = options2.cy;
                        var eles = options2.eles;
                        var spectralResult = [];
                        var xCoords = void 0;
                        var yCoords = void 0;
                        var coseResult = [];
                        var components3 = void 0;
                        var componentCenters = [];
                        if (options2.fixedNodeConstraint && (!Array.isArray(options2.fixedNodeConstraint) || options2.fixedNodeConstraint.length == 0)) {
                          options2.fixedNodeConstraint = void 0;
                        }
                        if (options2.alignmentConstraint) {
                          if (options2.alignmentConstraint.vertical && (!Array.isArray(options2.alignmentConstraint.vertical) || options2.alignmentConstraint.vertical.length == 0)) {
                            options2.alignmentConstraint.vertical = void 0;
                          }
                          if (options2.alignmentConstraint.horizontal && (!Array.isArray(options2.alignmentConstraint.horizontal) || options2.alignmentConstraint.horizontal.length == 0)) {
                            options2.alignmentConstraint.horizontal = void 0;
                          }
                        }
                        if (options2.relativePlacementConstraint && (!Array.isArray(options2.relativePlacementConstraint) || options2.relativePlacementConstraint.length == 0)) {
                          options2.relativePlacementConstraint = void 0;
                        }
                        var constraintExist = options2.fixedNodeConstraint || options2.alignmentConstraint || options2.relativePlacementConstraint;
                        if (constraintExist) {
                          options2.tile = false;
                          options2.packComponents = false;
                        }
                        var layUtil = void 0;
                        var packingEnabled = false;
                        if (cy.layoutUtilities && options2.packComponents) {
                          layUtil = cy.layoutUtilities("get");
                          if (!layUtil) layUtil = cy.layoutUtilities();
                          packingEnabled = true;
                        }
                        if (eles.nodes().length > 0) {
                          if (!packingEnabled) {
                            var boundingBox3 = options2.eles.boundingBox();
                            componentCenters.push({ x: boundingBox3.x1 + boundingBox3.w / 2, y: boundingBox3.y1 + boundingBox3.h / 2 });
                            if (options2.randomize) {
                              var result = spectralLayout(options2);
                              spectralResult.push(result);
                            }
                            if (options2.quality == "default" || options2.quality == "proof") {
                              coseResult.push(coseLayout(options2, spectralResult[0]));
                              aux.relocateComponent(componentCenters[0], coseResult[0], options2);
                            } else {
                              aux.relocateComponent(componentCenters[0], spectralResult[0], options2);
                            }
                          } else {
                            var topMostNodes = aux.getTopMostNodes(options2.eles.nodes());
                            components3 = aux.connectComponents(cy, options2.eles, topMostNodes);
                            components3.forEach(function(component2) {
                              var boundingBox4 = component2.boundingBox();
                              componentCenters.push({ x: boundingBox4.x1 + boundingBox4.w / 2, y: boundingBox4.y1 + boundingBox4.h / 2 });
                            });
                            if (options2.randomize) {
                              components3.forEach(function(component2) {
                                options2.eles = component2;
                                spectralResult.push(spectralLayout(options2));
                              });
                            }
                            if (options2.quality == "default" || options2.quality == "proof") {
                              var toBeTiledNodes = cy.collection();
                              if (options2.tile) {
                                var nodeIndexes = /* @__PURE__ */ new Map();
                                var _xCoords = [];
                                var _yCoords = [];
                                var count2 = 0;
                                var tempSpectralResult = { nodeIndexes, xCoords: _xCoords, yCoords: _yCoords };
                                var indexesToBeDeleted = [];
                                components3.forEach(function(component2, index) {
                                  if (component2.edges().length == 0) {
                                    component2.nodes().forEach(function(node2, i3) {
                                      toBeTiledNodes.merge(component2.nodes()[i3]);
                                      if (!node2.isParent()) {
                                        tempSpectralResult.nodeIndexes.set(component2.nodes()[i3].id(), count2++);
                                        tempSpectralResult.xCoords.push(component2.nodes()[0].position().x);
                                        tempSpectralResult.yCoords.push(component2.nodes()[0].position().y);
                                      }
                                    });
                                    indexesToBeDeleted.push(index);
                                  }
                                });
                                if (toBeTiledNodes.length > 1) {
                                  var _boundingBox = toBeTiledNodes.boundingBox();
                                  componentCenters.push({ x: _boundingBox.x1 + _boundingBox.w / 2, y: _boundingBox.y1 + _boundingBox.h / 2 });
                                  components3.push(toBeTiledNodes);
                                  spectralResult.push(tempSpectralResult);
                                  for (var i2 = indexesToBeDeleted.length - 1; i2 >= 0; i2--) {
                                    components3.splice(indexesToBeDeleted[i2], 1);
                                    spectralResult.splice(indexesToBeDeleted[i2], 1);
                                    componentCenters.splice(indexesToBeDeleted[i2], 1);
                                  }
                                  ;
                                }
                              }
                              components3.forEach(function(component2, index) {
                                options2.eles = component2;
                                coseResult.push(coseLayout(options2, spectralResult[index]));
                                aux.relocateComponent(componentCenters[index], coseResult[index], options2);
                              });
                            } else {
                              components3.forEach(function(component2, index) {
                                aux.relocateComponent(componentCenters[index], spectralResult[index], options2);
                              });
                            }
                            var componentsEvaluated = /* @__PURE__ */ new Set();
                            if (components3.length > 1) {
                              var subgraphs = [];
                              var hiddenEles = eles.filter(function(ele) {
                                return ele.css("display") == "none";
                              });
                              components3.forEach(function(component2, index) {
                                var nodeIndexes2 = void 0;
                                if (options2.quality == "draft") {
                                  nodeIndexes2 = spectralResult[index].nodeIndexes;
                                }
                                if (component2.nodes().not(hiddenEles).length > 0) {
                                  var subgraph = {};
                                  subgraph.edges = [];
                                  subgraph.nodes = [];
                                  var nodeIndex = void 0;
                                  component2.nodes().not(hiddenEles).forEach(function(node2) {
                                    if (options2.quality == "draft") {
                                      if (!node2.isParent()) {
                                        nodeIndex = nodeIndexes2.get(node2.id());
                                        subgraph.nodes.push({ x: spectralResult[index].xCoords[nodeIndex] - node2.boundingbox().w / 2, y: spectralResult[index].yCoords[nodeIndex] - node2.boundingbox().h / 2, width: node2.boundingbox().w, height: node2.boundingbox().h });
                                      } else {
                                        var parentInfo = aux.calcBoundingBox(node2, spectralResult[index].xCoords, spectralResult[index].yCoords, nodeIndexes2);
                                        subgraph.nodes.push({ x: parentInfo.topLeftX, y: parentInfo.topLeftY, width: parentInfo.width, height: parentInfo.height });
                                      }
                                    } else {
                                      if (coseResult[index][node2.id()]) {
                                        subgraph.nodes.push({ x: coseResult[index][node2.id()].getLeft(), y: coseResult[index][node2.id()].getTop(), width: coseResult[index][node2.id()].getWidth(), height: coseResult[index][node2.id()].getHeight() });
                                      }
                                    }
                                  });
                                  component2.edges().forEach(function(edge) {
                                    var source = edge.source();
                                    var target = edge.target();
                                    if (source.css("display") != "none" && target.css("display") != "none") {
                                      if (options2.quality == "draft") {
                                        var sourceNodeIndex = nodeIndexes2.get(source.id());
                                        var targetNodeIndex = nodeIndexes2.get(target.id());
                                        var sourceCenter = [];
                                        var targetCenter = [];
                                        if (source.isParent()) {
                                          var parentInfo = aux.calcBoundingBox(source, spectralResult[index].xCoords, spectralResult[index].yCoords, nodeIndexes2);
                                          sourceCenter.push(parentInfo.topLeftX + parentInfo.width / 2);
                                          sourceCenter.push(parentInfo.topLeftY + parentInfo.height / 2);
                                        } else {
                                          sourceCenter.push(spectralResult[index].xCoords[sourceNodeIndex]);
                                          sourceCenter.push(spectralResult[index].yCoords[sourceNodeIndex]);
                                        }
                                        if (target.isParent()) {
                                          var _parentInfo = aux.calcBoundingBox(target, spectralResult[index].xCoords, spectralResult[index].yCoords, nodeIndexes2);
                                          targetCenter.push(_parentInfo.topLeftX + _parentInfo.width / 2);
                                          targetCenter.push(_parentInfo.topLeftY + _parentInfo.height / 2);
                                        } else {
                                          targetCenter.push(spectralResult[index].xCoords[targetNodeIndex]);
                                          targetCenter.push(spectralResult[index].yCoords[targetNodeIndex]);
                                        }
                                        subgraph.edges.push({ startX: sourceCenter[0], startY: sourceCenter[1], endX: targetCenter[0], endY: targetCenter[1] });
                                      } else {
                                        if (coseResult[index][source.id()] && coseResult[index][target.id()]) {
                                          subgraph.edges.push({ startX: coseResult[index][source.id()].getCenterX(), startY: coseResult[index][source.id()].getCenterY(), endX: coseResult[index][target.id()].getCenterX(), endY: coseResult[index][target.id()].getCenterY() });
                                        }
                                      }
                                    }
                                  });
                                  if (subgraph.nodes.length > 0) {
                                    subgraphs.push(subgraph);
                                    componentsEvaluated.add(index);
                                  }
                                }
                              });
                              var shiftResult = layUtil.packComponents(subgraphs, options2.randomize).shifts;
                              if (options2.quality == "draft") {
                                spectralResult.forEach(function(result2, index) {
                                  var newXCoords = result2.xCoords.map(function(x5) {
                                    return x5 + shiftResult[index].dx;
                                  });
                                  var newYCoords = result2.yCoords.map(function(y6) {
                                    return y6 + shiftResult[index].dy;
                                  });
                                  result2.xCoords = newXCoords;
                                  result2.yCoords = newYCoords;
                                });
                              } else {
                                var _count = 0;
                                componentsEvaluated.forEach(function(index) {
                                  Object.keys(coseResult[index]).forEach(function(item) {
                                    var nodeRectangle = coseResult[index][item];
                                    nodeRectangle.setCenter(nodeRectangle.getCenterX() + shiftResult[_count].dx, nodeRectangle.getCenterY() + shiftResult[_count].dy);
                                  });
                                  _count++;
                                });
                              }
                            }
                          }
                        }
                        var getPositions = /* @__PURE__ */ __name(function getPositions2(ele, i3) {
                          if (options2.quality == "default" || options2.quality == "proof") {
                            if (typeof ele === "number") {
                              ele = i3;
                            }
                            var pos = void 0;
                            var node2 = void 0;
                            var theId = ele.data("id");
                            coseResult.forEach(function(result2) {
                              if (theId in result2) {
                                pos = { x: result2[theId].getRect().getCenterX(), y: result2[theId].getRect().getCenterY() };
                                node2 = result2[theId];
                              }
                            });
                            if (options2.nodeDimensionsIncludeLabels) {
                              if (node2.labelWidth) {
                                if (node2.labelPosHorizontal == "left") {
                                  pos.x += node2.labelWidth / 2;
                                } else if (node2.labelPosHorizontal == "right") {
                                  pos.x -= node2.labelWidth / 2;
                                }
                              }
                              if (node2.labelHeight) {
                                if (node2.labelPosVertical == "top") {
                                  pos.y += node2.labelHeight / 2;
                                } else if (node2.labelPosVertical == "bottom") {
                                  pos.y -= node2.labelHeight / 2;
                                }
                              }
                            }
                            if (pos == void 0) pos = { x: ele.position("x"), y: ele.position("y") };
                            return {
                              x: pos.x,
                              y: pos.y
                            };
                          } else {
                            var _pos = void 0;
                            spectralResult.forEach(function(result2) {
                              var index = result2.nodeIndexes.get(ele.id());
                              if (index != void 0) {
                                _pos = { x: result2.xCoords[index], y: result2.yCoords[index] };
                              }
                            });
                            if (_pos == void 0) _pos = { x: ele.position("x"), y: ele.position("y") };
                            return {
                              x: _pos.x,
                              y: _pos.y
                            };
                          }
                        }, "getPositions");
                        if (options2.quality == "default" || options2.quality == "proof" || options2.randomize) {
                          var parentsWithoutChildren = aux.calcParentsWithoutChildren(cy, eles);
                          var _hiddenEles = eles.filter(function(ele) {
                            return ele.css("display") == "none";
                          });
                          options2.eles = eles.not(_hiddenEles);
                          eles.nodes().not(":parent").not(_hiddenEles).layoutPositions(layout7, options2, getPositions);
                          if (parentsWithoutChildren.length > 0) {
                            parentsWithoutChildren.forEach(function(ele) {
                              ele.position(getPositions(ele));
                            });
                          }
                        } else {
                          console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.");
                        }
                      }, "run")
                    }]);
                    return Layout3;
                  })();
                  module3.exports = Layout2;
                })
              ),
              /***/
              657: (
                /***/
                ((module3, __unused_webpack_exports, __webpack_require__2) => {
                  var aux = __webpack_require__2(548);
                  var Matrix = __webpack_require__2(140).layoutBase.Matrix;
                  var SVD = __webpack_require__2(140).layoutBase.SVD;
                  var spectralLayout = /* @__PURE__ */ __name(function spectralLayout2(options2) {
                    var cy = options2.cy;
                    var eles = options2.eles;
                    var nodes5 = eles.nodes();
                    var parentNodes = eles.nodes(":parent");
                    var dummyNodes = /* @__PURE__ */ new Map();
                    var nodeIndexes = /* @__PURE__ */ new Map();
                    var parentChildMap = /* @__PURE__ */ new Map();
                    var allNodesNeighborhood = [];
                    var xCoords = [];
                    var yCoords = [];
                    var samplesColumn = [];
                    var minDistancesColumn = [];
                    var C3 = [];
                    var PHI = [];
                    var INV = [];
                    var firstSample = void 0;
                    var nodeSize = void 0;
                    var infinity = 1e8;
                    var small = 1e-9;
                    var piTol = options2.piTol;
                    var samplingType = options2.samplingType;
                    var nodeSeparation = options2.nodeSeparation;
                    var sampleSize = void 0;
                    var randomSampleCR = /* @__PURE__ */ __name(function randomSampleCR2() {
                      var sample2 = 0;
                      var count2 = 0;
                      var flag = false;
                      while (count2 < sampleSize) {
                        sample2 = Math.floor(Math.random() * nodeSize);
                        flag = false;
                        for (var i3 = 0; i3 < count2; i3++) {
                          if (samplesColumn[i3] == sample2) {
                            flag = true;
                            break;
                          }
                        }
                        if (!flag) {
                          samplesColumn[count2] = sample2;
                          count2++;
                        } else {
                          continue;
                        }
                      }
                    }, "randomSampleCR");
                    var BFS = /* @__PURE__ */ __name(function BFS2(pivot, index2, samplingMethod) {
                      var path4 = [];
                      var front = 0;
                      var back = 0;
                      var current = 0;
                      var temp = void 0;
                      var distance3 = [];
                      var max_dist = 0;
                      var max_ind = 1;
                      for (var i3 = 0; i3 < nodeSize; i3++) {
                        distance3[i3] = infinity;
                      }
                      path4[back] = pivot;
                      distance3[pivot] = 0;
                      while (back >= front) {
                        current = path4[front++];
                        var neighbors = allNodesNeighborhood[current];
                        for (var _i = 0; _i < neighbors.length; _i++) {
                          temp = nodeIndexes.get(neighbors[_i]);
                          if (distance3[temp] == infinity) {
                            distance3[temp] = distance3[current] + 1;
                            path4[++back] = temp;
                          }
                        }
                        C3[current][index2] = distance3[current] * nodeSeparation;
                      }
                      if (samplingMethod) {
                        for (var _i2 = 0; _i2 < nodeSize; _i2++) {
                          if (C3[_i2][index2] < minDistancesColumn[_i2]) minDistancesColumn[_i2] = C3[_i2][index2];
                        }
                        for (var _i3 = 0; _i3 < nodeSize; _i3++) {
                          if (minDistancesColumn[_i3] > max_dist) {
                            max_dist = minDistancesColumn[_i3];
                            max_ind = _i3;
                          }
                        }
                      }
                      return max_ind;
                    }, "BFS");
                    var allBFS = /* @__PURE__ */ __name(function allBFS2(samplingMethod) {
                      var sample2 = void 0;
                      if (!samplingMethod) {
                        randomSampleCR();
                        for (var i3 = 0; i3 < sampleSize; i3++) {
                          BFS(samplesColumn[i3], i3, samplingMethod, false);
                        }
                      } else {
                        sample2 = Math.floor(Math.random() * nodeSize);
                        firstSample = sample2;
                        for (var _i4 = 0; _i4 < nodeSize; _i4++) {
                          minDistancesColumn[_i4] = infinity;
                        }
                        for (var _i5 = 0; _i5 < sampleSize; _i5++) {
                          samplesColumn[_i5] = sample2;
                          sample2 = BFS(sample2, _i5, samplingMethod);
                        }
                      }
                      for (var _i6 = 0; _i6 < nodeSize; _i6++) {
                        for (var j3 = 0; j3 < sampleSize; j3++) {
                          C3[_i6][j3] *= C3[_i6][j3];
                        }
                      }
                      for (var _i7 = 0; _i7 < sampleSize; _i7++) {
                        PHI[_i7] = [];
                      }
                      for (var _i8 = 0; _i8 < sampleSize; _i8++) {
                        for (var _j = 0; _j < sampleSize; _j++) {
                          PHI[_i8][_j] = C3[samplesColumn[_j]][_i8];
                        }
                      }
                    }, "allBFS");
                    var sample = /* @__PURE__ */ __name(function sample2() {
                      var SVDResult = SVD.svd(PHI);
                      var a_q = SVDResult.S;
                      var a_u = SVDResult.U;
                      var a_v = SVDResult.V;
                      var max_s = a_q[0] * a_q[0] * a_q[0];
                      var a_Sig = [];
                      for (var i3 = 0; i3 < sampleSize; i3++) {
                        a_Sig[i3] = [];
                        for (var j3 = 0; j3 < sampleSize; j3++) {
                          a_Sig[i3][j3] = 0;
                          if (i3 == j3) {
                            a_Sig[i3][j3] = a_q[i3] / (a_q[i3] * a_q[i3] + max_s / (a_q[i3] * a_q[i3]));
                          }
                        }
                      }
                      INV = Matrix.multMat(Matrix.multMat(a_v, a_Sig), Matrix.transpose(a_u));
                    }, "sample");
                    var powerIteration = /* @__PURE__ */ __name(function powerIteration2() {
                      var theta1 = void 0;
                      var theta2 = void 0;
                      var Y1 = [];
                      var Y22 = [];
                      var V1 = [];
                      var V22 = [];
                      for (var i3 = 0; i3 < nodeSize; i3++) {
                        Y1[i3] = Math.random();
                        Y22[i3] = Math.random();
                      }
                      Y1 = Matrix.normalize(Y1);
                      Y22 = Matrix.normalize(Y22);
                      var count2 = 0;
                      var current = small;
                      var previous = small;
                      var temp = void 0;
                      while (true) {
                        count2++;
                        for (var _i9 = 0; _i9 < nodeSize; _i9++) {
                          V1[_i9] = Y1[_i9];
                        }
                        Y1 = Matrix.multGamma(Matrix.multL(Matrix.multGamma(V1), C3, INV));
                        theta1 = Matrix.dotProduct(V1, Y1);
                        Y1 = Matrix.normalize(Y1);
                        current = Matrix.dotProduct(V1, Y1);
                        temp = Math.abs(current / previous);
                        if (temp <= 1 + piTol && temp >= 1) {
                          break;
                        }
                        previous = current;
                      }
                      for (var _i10 = 0; _i10 < nodeSize; _i10++) {
                        V1[_i10] = Y1[_i10];
                      }
                      count2 = 0;
                      previous = small;
                      while (true) {
                        count2++;
                        for (var _i11 = 0; _i11 < nodeSize; _i11++) {
                          V22[_i11] = Y22[_i11];
                        }
                        V22 = Matrix.minusOp(V22, Matrix.multCons(V1, Matrix.dotProduct(V1, V22)));
                        Y22 = Matrix.multGamma(Matrix.multL(Matrix.multGamma(V22), C3, INV));
                        theta2 = Matrix.dotProduct(V22, Y22);
                        Y22 = Matrix.normalize(Y22);
                        current = Matrix.dotProduct(V22, Y22);
                        temp = Math.abs(current / previous);
                        if (temp <= 1 + piTol && temp >= 1) {
                          break;
                        }
                        previous = current;
                      }
                      for (var _i12 = 0; _i12 < nodeSize; _i12++) {
                        V22[_i12] = Y22[_i12];
                      }
                      xCoords = Matrix.multCons(V1, Math.sqrt(Math.abs(theta1)));
                      yCoords = Matrix.multCons(V22, Math.sqrt(Math.abs(theta2)));
                    }, "powerIteration");
                    aux.connectComponents(cy, eles, aux.getTopMostNodes(nodes5), dummyNodes);
                    parentNodes.forEach(function(ele) {
                      aux.connectComponents(cy, eles, aux.getTopMostNodes(ele.descendants().intersection(eles)), dummyNodes);
                    });
                    var index = 0;
                    for (var i2 = 0; i2 < nodes5.length; i2++) {
                      if (!nodes5[i2].isParent()) {
                        nodeIndexes.set(nodes5[i2].id(), index++);
                      }
                    }
                    var _iteratorNormalCompletion = true;
                    var _didIteratorError = false;
                    var _iteratorError = void 0;
                    try {
                      for (var _iterator = dummyNodes.keys()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                        var key = _step.value;
                        nodeIndexes.set(key, index++);
                      }
                    } catch (err) {
                      _didIteratorError = true;
                      _iteratorError = err;
                    } finally {
                      try {
                        if (!_iteratorNormalCompletion && _iterator.return) {
                          _iterator.return();
                        }
                      } finally {
                        if (_didIteratorError) {
                          throw _iteratorError;
                        }
                      }
                    }
                    for (var _i13 = 0; _i13 < nodeIndexes.size; _i13++) {
                      allNodesNeighborhood[_i13] = [];
                    }
                    parentNodes.forEach(function(ele) {
                      var children2 = ele.children().intersection(eles);
                      while (children2.nodes(":childless").length == 0) {
                        children2 = children2.nodes()[0].children().intersection(eles);
                      }
                      var index2 = 0;
                      var min9 = children2.nodes(":childless")[0].connectedEdges().length;
                      children2.nodes(":childless").forEach(function(ele2, i3) {
                        if (ele2.connectedEdges().length < min9) {
                          min9 = ele2.connectedEdges().length;
                          index2 = i3;
                        }
                      });
                      parentChildMap.set(ele.id(), children2.nodes(":childless")[index2].id());
                    });
                    nodes5.forEach(function(ele) {
                      var eleIndex = void 0;
                      if (ele.isParent()) eleIndex = nodeIndexes.get(parentChildMap.get(ele.id()));
                      else eleIndex = nodeIndexes.get(ele.id());
                      ele.neighborhood().nodes().forEach(function(node2) {
                        if (eles.intersection(ele.edgesWith(node2)).length > 0) {
                          if (node2.isParent()) allNodesNeighborhood[eleIndex].push(parentChildMap.get(node2.id()));
                          else allNodesNeighborhood[eleIndex].push(node2.id());
                        }
                      });
                    });
                    var _loop = /* @__PURE__ */ __name(function _loop2(_key2) {
                      var eleIndex = nodeIndexes.get(_key2);
                      var disconnectedId = void 0;
                      dummyNodes.get(_key2).forEach(function(id34) {
                        if (cy.getElementById(id34).isParent()) disconnectedId = parentChildMap.get(id34);
                        else disconnectedId = id34;
                        allNodesNeighborhood[eleIndex].push(disconnectedId);
                        allNodesNeighborhood[nodeIndexes.get(disconnectedId)].push(_key2);
                      });
                    }, "_loop");
                    var _iteratorNormalCompletion2 = true;
                    var _didIteratorError2 = false;
                    var _iteratorError2 = void 0;
                    try {
                      for (var _iterator2 = dummyNodes.keys()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
                        var _key = _step2.value;
                        _loop(_key);
                      }
                    } catch (err) {
                      _didIteratorError2 = true;
                      _iteratorError2 = err;
                    } finally {
                      try {
                        if (!_iteratorNormalCompletion2 && _iterator2.return) {
                          _iterator2.return();
                        }
                      } finally {
                        if (_didIteratorError2) {
                          throw _iteratorError2;
                        }
                      }
                    }
                    nodeSize = nodeIndexes.size;
                    var spectralResult = void 0;
                    if (nodeSize > 2) {
                      sampleSize = nodeSize < options2.sampleSize ? nodeSize : options2.sampleSize;
                      for (var _i14 = 0; _i14 < nodeSize; _i14++) {
                        C3[_i14] = [];
                      }
                      for (var _i15 = 0; _i15 < sampleSize; _i15++) {
                        INV[_i15] = [];
                      }
                      if (options2.quality == "draft" || options2.step == "all") {
                        allBFS(samplingType);
                        sample();
                        powerIteration();
                        spectralResult = { nodeIndexes, xCoords, yCoords };
                      } else {
                        nodeIndexes.forEach(function(value2, key2) {
                          xCoords.push(cy.getElementById(key2).position("x"));
                          yCoords.push(cy.getElementById(key2).position("y"));
                        });
                        spectralResult = { nodeIndexes, xCoords, yCoords };
                      }
                      return spectralResult;
                    } else {
                      var iterator = nodeIndexes.keys();
                      var firstNode = cy.getElementById(iterator.next().value);
                      var firstNodePos = firstNode.position();
                      var firstNodeWidth = firstNode.outerWidth();
                      xCoords.push(firstNodePos.x);
                      yCoords.push(firstNodePos.y);
                      if (nodeSize == 2) {
                        var secondNode = cy.getElementById(iterator.next().value);
                        var secondNodeWidth = secondNode.outerWidth();
                        xCoords.push(firstNodePos.x + firstNodeWidth / 2 + secondNodeWidth / 2 + options2.idealEdgeLength);
                        yCoords.push(firstNodePos.y);
                      }
                      spectralResult = { nodeIndexes, xCoords, yCoords };
                      return spectralResult;
                    }
                  }, "spectralLayout");
                  module3.exports = { spectralLayout };
                })
              ),
              /***/
              579: (
                /***/
                ((module3, __unused_webpack_exports, __webpack_require__2) => {
                  var impl2 = __webpack_require__2(212);
                  var register = /* @__PURE__ */ __name(function register2(cytoscape4) {
                    if (!cytoscape4) {
                      return;
                    }
                    cytoscape4("layout", "fcose", impl2);
                  }, "register");
                  if (typeof cytoscape !== "undefined") {
                    register(cytoscape);
                  }
                  module3.exports = register;
                })
              ),
              /***/
              140: (
                /***/
                ((module3) => {
                  module3.exports = __WEBPACK_EXTERNAL_MODULE__140__;
                })
              )
              /******/
            };
            var __webpack_module_cache__ = {};
            function __webpack_require__(moduleId) {
              var cachedModule = __webpack_module_cache__[moduleId];
              if (cachedModule !== void 0) {
                return cachedModule.exports;
              }
              var module3 = __webpack_module_cache__[moduleId] = {
                /******/
                // no module.id needed
                /******/
                // no module.loaded needed
                /******/
                exports: {}
                /******/
              };
              __webpack_modules__[moduleId](module3, module3.exports, __webpack_require__);
              return module3.exports;
            }
            __name(__webpack_require__, "__webpack_require__");
            var __webpack_exports__ = __webpack_require__(579);
            return __webpack_exports__;
          })()
        );
      });
    }
  });

  // src/diagrams/architecture/architectureIcons.ts
  var wrapIcon, architectureIcons;
  var init_architectureIcons = __esm({
    "src/diagrams/architecture/architectureIcons.ts"() {
      "use strict";
      init_icons();
      wrapIcon = /* @__PURE__ */ __name((icon2) => {
        return `<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${icon2}</g>`;
      }, "wrapIcon");
      architectureIcons = {
        prefix: "mermaid-architecture",
        height: 80,
        width: 80,
        icons: {
          database: {
            body: wrapIcon(
              '<path id="b" data-name="4" d="m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="c" data-name="3" d="m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="d" data-name="2" d="m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse id="e" data-name="1" cx="40" cy="22.14" rx="20" ry="7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="20" y1="57.86" x2="20" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="60" y1="57.86" x2="60" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>'
            )
          },
          server: {
            body: wrapIcon(
              '<rect x="17.5" y="17.5" width="45" height="45" rx="2" ry="2" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="32.5" x2="62.5" y2="32.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="47.5" x2="62.5" y2="47.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><g><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g>'
            )
          },
          disk: {
            body: wrapIcon(
              '<rect x="20" y="15" width="40" height="50" rx="1" ry="1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="14" ry="14.58" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="4" ry="4.17" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z" style="fill: #fff; stroke-width: 0px;"/>'
            )
          },
          internet: {
            body: wrapIcon(
              '<circle cx="40" cy="40" r="22.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="40" y1="17.5" x2="40" y2="62.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="40" x2="62.5" y2="40" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="30.1" x2="60.25" y2="30.1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="49.9" x2="60.25" y2="49.9" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>'
            )
          },
          cloud: {
            body: wrapIcon(
              '<path d="m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>'
            )
          },
          unknown: unknownIcon,
          blank: {
            body: wrapIcon("")
          }
        }
      };
    }
  });

  // src/diagrams/architecture/svgDraw.ts
  var drawEdges, drawGroups, drawServices, drawJunctions;
  var init_svgDraw6 = __esm({
    "src/diagrams/architecture/svgDraw.ts"() {
      "use strict";
      init_diagramAPI();
      init_createText();
      init_icons();
      init_common();
      init_architectureIcons();
      init_architectureTypes();
      init_utils2();
      drawEdges = /* @__PURE__ */ __name(async function(edgesEl, cy, db9, diagramId3) {
        const padding2 = db9.getConfigField("padding");
        const iconSize = db9.getConfigField("iconSize");
        const halfIconSize = iconSize / 2;
        const arrowSize = iconSize / 6;
        const halfArrowSize = arrowSize / 2;
        await Promise.all(
          cy.edges().map(async (edge) => {
            const {
              source,
              sourceDir,
              sourceArrow,
              sourceGroup,
              target,
              targetDir,
              targetArrow,
              targetGroup,
              label
            } = edgeData(edge);
            let { x: startX2, y: startY2 } = edge[0].sourceEndpoint();
            const { x: midX, y: midY } = edge[0].midpoint();
            let { x: endX, y: endY } = edge[0].targetEndpoint();
            const groupEdgeShift = padding2 + 4;
            if (sourceGroup) {
              if (isArchitectureDirectionX(sourceDir)) {
                startX2 += sourceDir === "L" ? -groupEdgeShift : groupEdgeShift;
              } else {
                startY2 += sourceDir === "T" ? -groupEdgeShift : groupEdgeShift + 18;
              }
            }
            if (targetGroup) {
              if (isArchitectureDirectionX(targetDir)) {
                endX += targetDir === "L" ? -groupEdgeShift : groupEdgeShift;
              } else {
                endY += targetDir === "T" ? -groupEdgeShift : groupEdgeShift + 18;
              }
            }
            if (!sourceGroup && db9.getNode(source)?.type === "junction") {
              if (isArchitectureDirectionX(sourceDir)) {
                startX2 += sourceDir === "L" ? halfIconSize : -halfIconSize;
              } else {
                startY2 += sourceDir === "T" ? halfIconSize : -halfIconSize;
              }
            }
            if (!targetGroup && db9.getNode(target)?.type === "junction") {
              if (isArchitectureDirectionX(targetDir)) {
                endX += targetDir === "L" ? halfIconSize : -halfIconSize;
              } else {
                endY += targetDir === "T" ? halfIconSize : -halfIconSize;
              }
            }
            if (edge[0]._private.rscratch) {
              const g2 = edgesEl.insert("g");
              g2.insert("path").attr("d", `M ${startX2},${startY2} L ${midX},${midY} L${endX},${endY} `).attr("class", "edge").attr("id", `${diagramId3}-${getEdgeId(source, target, { prefix: "L" })}`);
              if (sourceArrow) {
                const xShift = isArchitectureDirectionX(sourceDir) ? ArchitectureDirectionArrowShift[sourceDir](startX2, arrowSize) : startX2 - halfArrowSize;
                const yShift = isArchitectureDirectionY(sourceDir) ? ArchitectureDirectionArrowShift[sourceDir](startY2, arrowSize) : startY2 - halfArrowSize;
                g2.insert("polygon").attr("points", ArchitectureDirectionArrow[sourceDir](arrowSize)).attr("transform", `translate(${xShift},${yShift})`).attr("class", "arrow");
              }
              if (targetArrow) {
                const xShift = isArchitectureDirectionX(targetDir) ? ArchitectureDirectionArrowShift[targetDir](endX, arrowSize) : endX - halfArrowSize;
                const yShift = isArchitectureDirectionY(targetDir) ? ArchitectureDirectionArrowShift[targetDir](endY, arrowSize) : endY - halfArrowSize;
                g2.insert("polygon").attr("points", ArchitectureDirectionArrow[targetDir](arrowSize)).attr("transform", `translate(${xShift},${yShift})`).attr("class", "arrow");
              }
              if (label) {
                const axis2 = !isArchitectureDirectionXY(sourceDir, targetDir) ? isArchitectureDirectionX(sourceDir) ? "X" : "Y" : "XY";
                let width3 = 0;
                if (axis2 === "X") {
                  width3 = Math.abs(startX2 - endX);
                } else if (axis2 === "Y") {
                  width3 = Math.abs(startY2 - endY) / 1.5;
                } else {
                  width3 = Math.abs(startX2 - endX) / 2;
                }
                const textElem = g2.append("g");
                await createText(
                  textElem,
                  label,
                  {
                    useHtmlLabels: false,
                    width: width3,
                    classes: "architecture-service-label"
                  },
                  getConfig2()
                );
                textElem.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle");
                if (axis2 === "X") {
                  textElem.attr("transform", "translate(" + midX + ", " + midY + ")");
                } else if (axis2 === "Y") {
                  textElem.attr("transform", "translate(" + midX + ", " + midY + ") rotate(-90)");
                } else if (axis2 === "XY") {
                  const pair = getArchitectureDirectionPair(sourceDir, targetDir);
                  if (pair && isArchitecturePairXY(pair)) {
                    const bboxOrig = textElem.node().getBoundingClientRect();
                    const [x5, y6] = getArchitectureDirectionXYFactors(pair);
                    textElem.attr("dominant-baseline", "auto").attr("transform", `rotate(${-1 * x5 * y6 * 45})`);
                    const bboxNew = textElem.node().getBoundingClientRect();
                    textElem.attr(
                      "transform",
                      `
                translate(${midX}, ${midY - bboxOrig.height / 2})
                translate(${x5 * bboxNew.width / 2}, ${y6 * bboxNew.height / 2})
                rotate(${-1 * x5 * y6 * 45}, 0, ${bboxOrig.height / 2})
              `
                    );
                  }
                }
              }
            }
          })
        );
      }, "drawEdges");
      drawGroups = /* @__PURE__ */ __name(async function(groupsEl, cy, db9, diagramId3) {
        const padding2 = db9.getConfigField("padding");
        const groupIconSize = padding2 * 0.75;
        const fontSize = db9.getConfigField("fontSize");
        const iconSize = db9.getConfigField("iconSize");
        const halfIconSize = iconSize / 2;
        await Promise.all(
          cy.nodes().map(async (node2) => {
            const data5 = nodeData(node2);
            if (data5.type === "group") {
              const { h: h3, w: w4, x1, y1 } = node2.boundingBox();
              const groupsNode = groupsEl.append("rect");
              groupsNode.attr("id", `${diagramId3}-group-${data5.id}`).attr("x", x1 + halfIconSize).attr("y", y1 + halfIconSize).attr("width", w4).attr("height", h3).attr("class", "node-bkg");
              const groupLabelContainer = groupsEl.append("g");
              let shiftedX1 = x1;
              let shiftedY1 = y1;
              if (data5.icon) {
                const bkgElem = groupLabelContainer.append("g");
                bkgElem.html(
                  `<g>${await getIconSVG(data5.icon, { height: groupIconSize, width: groupIconSize, fallbackPrefix: architectureIcons.prefix })}</g>`
                );
                bkgElem.attr(
                  "transform",
                  "translate(" + (shiftedX1 + halfIconSize + 1) + ", " + (shiftedY1 + halfIconSize + 1) + ")"
                );
                shiftedX1 += groupIconSize;
                shiftedY1 += fontSize / 2 - 1 - 2;
              }
              if (data5.label) {
                const textElem = groupLabelContainer.append("g");
                await createText(
                  textElem,
                  data5.label,
                  {
                    useHtmlLabels: false,
                    width: w4,
                    classes: "architecture-service-label"
                  },
                  getConfig2()
                );
                textElem.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "start").attr("text-anchor", "start");
                textElem.attr(
                  "transform",
                  "translate(" + (shiftedX1 + halfIconSize + 4) + ", " + (shiftedY1 + halfIconSize + 2) + ")"
                );
              }
              db9.setElementForId(data5.id, groupsNode);
            }
          })
        );
      }, "drawGroups");
      drawServices = /* @__PURE__ */ __name(async function(db9, elem, services, diagramId3) {
        const config5 = getConfig2();
        for (const service of services) {
          const serviceElem = elem.append("g");
          const iconSize = db9.getConfigField("iconSize");
          if (service.title) {
            const textElem = serviceElem.append("g");
            await createText(
              textElem,
              service.title,
              {
                useHtmlLabels: false,
                width: iconSize * 1.5,
                classes: "architecture-service-label"
              },
              config5
            );
            textElem.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle");
            textElem.attr("transform", "translate(" + iconSize / 2 + ", " + iconSize + ")");
          }
          const bkgElem = serviceElem.append("g");
          if (service.icon) {
            bkgElem.html(
              `<g>${await getIconSVG(service.icon, { height: iconSize, width: iconSize, fallbackPrefix: architectureIcons.prefix })}</g>`
            );
          } else if (service.iconText) {
            bkgElem.html(
              `<g>${await getIconSVG("blank", { height: iconSize, width: iconSize, fallbackPrefix: architectureIcons.prefix })}</g>`
            );
            const textElemContainer = bkgElem.append("g");
            const fo = textElemContainer.append("foreignObject").attr("width", iconSize).attr("height", iconSize);
            const divElem = fo.append("div").attr("class", "node-icon-text").attr("style", `height: ${iconSize}px;`).append("div").html(sanitizeText(service.iconText, config5));
            const fontSize = parseInt(
              window.getComputedStyle(divElem.node(), null).getPropertyValue("font-size").replace(/\D/g, "")
            ) ?? 16;
            divElem.attr("style", `-webkit-line-clamp: ${Math.floor((iconSize - 2) / fontSize)};`);
          } else {
            bkgElem.append("path").attr("class", "node-bkg").attr("id", `${diagramId3}-node-${service.id}`).attr(
              "d",
              `M0,${iconSize} V5 Q0,0 5,0 H${iconSize - 5} Q${iconSize},0 ${iconSize},5 V${iconSize} Z`
            );
          }
          serviceElem.attr("id", `${diagramId3}-service-${service.id}`).attr("class", "architecture-service");
          const { width: width3, height: height2 } = serviceElem.node().getBBox();
          service.width = width3;
          service.height = height2;
          db9.setElementForId(service.id, serviceElem);
        }
        return 0;
      }, "drawServices");
      drawJunctions = /* @__PURE__ */ __name(function(db9, elem, junctions, diagramId3) {
        junctions.forEach((junction) => {
          const junctionElem = elem.append("g");
          const iconSize = db9.getConfigField("iconSize");
          const bkgElem = junctionElem.append("g");
          bkgElem.append("rect").attr("id", `${diagramId3}-node-${junction.id}`).attr("fill-opacity", "0").attr("width", iconSize).attr("height", iconSize);
          junctionElem.attr("class", "architecture-junction");
          const { width: width3, height: height2 } = junctionElem._groups[0][0].getBBox();
          junctionElem.width = width3;
          junctionElem.height = height2;
          db9.setElementForId(junction.id, junctionElem);
        });
      }, "drawJunctions");
    }
  });

  // src/diagrams/architecture/architectureRenderer.ts
  function addServices(services, cy, db9) {
    services.forEach((service) => {
      cy.add({
        group: "nodes",
        data: {
          type: "service",
          id: service.id,
          icon: service.icon,
          label: service.title,
          parent: service.in,
          width: db9.getConfigField("iconSize"),
          height: db9.getConfigField("iconSize")
        },
        classes: "node-service"
      });
    });
  }
  function addJunctions(junctions, cy, db9) {
    junctions.forEach((junction) => {
      cy.add({
        group: "nodes",
        data: {
          type: "junction",
          id: junction.id,
          parent: junction.in,
          width: db9.getConfigField("iconSize"),
          height: db9.getConfigField("iconSize")
        },
        classes: "node-junction"
      });
    });
  }
  function positionNodes(db9, cy) {
    cy.nodes().map((node2) => {
      const data5 = nodeData(node2);
      if (data5.type === "group") {
        return;
      }
      data5.x = node2.position().x;
      data5.y = node2.position().y;
      const nodeElem = db9.getElementById(data5.id);
      nodeElem.attr("transform", "translate(" + (data5.x || 0) + "," + (data5.y || 0) + ")");
    });
  }
  function addGroups(groups, cy) {
    groups.forEach((group2) => {
      cy.add({
        group: "nodes",
        data: {
          type: "group",
          id: group2.id,
          icon: group2.icon,
          label: group2.title,
          parent: group2.in
        },
        classes: "node-group"
      });
    });
  }
  function addEdges2(edges3, cy) {
    edges3.forEach((parsedEdge) => {
      const { lhsId, rhsId, lhsInto, lhsGroup, rhsInto, lhsDir, rhsDir, rhsGroup, title: title2 } = parsedEdge;
      const edgeType = isArchitectureDirectionXY(parsedEdge.lhsDir, parsedEdge.rhsDir) ? "segments" : "straight";
      const edge = {
        id: `${lhsId}-${rhsId}`,
        label: title2,
        source: lhsId,
        sourceDir: lhsDir,
        sourceArrow: lhsInto,
        sourceGroup: lhsGroup,
        sourceEndpoint: lhsDir === "L" ? "0 50%" : lhsDir === "R" ? "100% 50%" : lhsDir === "T" ? "50% 0" : "50% 100%",
        target: rhsId,
        targetDir: rhsDir,
        targetArrow: rhsInto,
        targetGroup: rhsGroup,
        targetEndpoint: rhsDir === "L" ? "0 50%" : rhsDir === "R" ? "100% 50%" : rhsDir === "T" ? "50% 0" : "50% 100%"
      };
      cy.add({
        group: "edges",
        data: edge,
        classes: edgeType
      });
    });
  }
  function getAlignments(db9, spatialMaps, groupAlignments) {
    const flattenAlignments = /* @__PURE__ */ __name((alignmentObj, alignmentDir) => {
      return Object.entries(alignmentObj).reduce(
        (prev2, [dir2, alignments2]) => {
          let cnt4 = 0;
          const arr = Object.entries(alignments2);
          if (arr.length === 1) {
            prev2[dir2] = arr[0][1];
            return prev2;
          }
          for (let i2 = 0; i2 < arr.length - 1; i2++) {
            for (let j3 = i2 + 1; j3 < arr.length; j3++) {
              const [aGroupId, aNodeIds] = arr[i2];
              const [bGroupId, bNodeIds] = arr[j3];
              const alignment = groupAlignments[aGroupId]?.[bGroupId];
              if (alignment === alignmentDir) {
                prev2[dir2] ??= [];
                prev2[dir2] = [...prev2[dir2], ...aNodeIds, ...bNodeIds];
              } else if (aGroupId === "default" || bGroupId === "default") {
                prev2[dir2] ??= [];
                prev2[dir2] = [...prev2[dir2], ...aNodeIds, ...bNodeIds];
              } else {
                const keyA = `${dir2}-${cnt4++}`;
                prev2[keyA] = aNodeIds;
                const keyB = `${dir2}-${cnt4++}`;
                prev2[keyB] = bNodeIds;
              }
            }
          }
          return prev2;
        },
        {}
      );
    }, "flattenAlignments");
    const alignments = spatialMaps.map((spatialMap) => {
      const horizontalAlignments = {};
      const verticalAlignments = {};
      Object.entries(spatialMap).forEach(([id34, [x5, y6]]) => {
        const nodeGroup = db9.getNode(id34)?.in ?? "default";
        horizontalAlignments[y6] ??= {};
        horizontalAlignments[y6][nodeGroup] ??= [];
        horizontalAlignments[y6][nodeGroup].push(id34);
        verticalAlignments[x5] ??= {};
        verticalAlignments[x5][nodeGroup] ??= [];
        verticalAlignments[x5][nodeGroup].push(id34);
      });
      return {
        horiz: Object.values(flattenAlignments(horizontalAlignments, "horizontal")).filter(
          (arr) => arr.length > 1
        ),
        vert: Object.values(flattenAlignments(verticalAlignments, "vertical")).filter(
          (arr) => arr.length > 1
        )
      };
    });
    const [horizontal, vertical] = alignments.reduce(
      ([prevHoriz, prevVert], { horiz, vert }) => {
        return [
          [...prevHoriz, ...horiz],
          [...prevVert, ...vert]
        ];
      },
      [[], []]
    );
    return {
      horizontal,
      vertical
    };
  }
  function getRelativeConstraints(spatialMaps, db9) {
    const relativeConstraints = [];
    const posToStr = /* @__PURE__ */ __name((pos) => `${pos[0]},${pos[1]}`, "posToStr");
    const strToPos = /* @__PURE__ */ __name((pos) => pos.split(",").map((p3) => parseInt(p3)), "strToPos");
    spatialMaps.forEach((spatialMap) => {
      const invSpatialMap = Object.fromEntries(
        Object.entries(spatialMap).map(([id34, pos]) => [posToStr(pos), id34])
      );
      const queue = [posToStr([0, 0])];
      const visited = {};
      const directions = {
        L: [-1, 0],
        R: [1, 0],
        T: [0, 1],
        B: [0, -1]
      };
      while (queue.length > 0) {
        const curr = queue.shift();
        if (curr) {
          visited[curr] = 1;
          const currId = invSpatialMap[curr];
          if (currId) {
            const currPos = strToPos(curr);
            Object.entries(directions).forEach(([dir2, shift2]) => {
              const newPos = posToStr([currPos[0] + shift2[0], currPos[1] + shift2[1]]);
              const newId2 = invSpatialMap[newPos];
              if (newId2 && !visited[newPos]) {
                queue.push(newPos);
                relativeConstraints.push({
                  [ArchitectureDirectionName[dir2]]: newId2,
                  [ArchitectureDirectionName[getOppositeArchitectureDirection(dir2)]]: currId,
                  gap: 1.5 * db9.getConfigField("iconSize")
                });
              }
            });
          }
        }
      }
    });
    return relativeConstraints;
  }
  function layoutArchitecture(services, junctions, groups, edges3, db9, { spatialMaps, groupAlignments }) {
    return new Promise((resolve2) => {
      const renderEl = select_default2("body").append("div").attr("id", "cy").attr("style", "display:none");
      const cy = cytoscape2({
        container: document.getElementById("cy"),
        style: [
          {
            selector: "edge",
            style: {
              "curve-style": "straight",
              "source-endpoint": "data(sourceEndpoint)",
              "target-endpoint": "data(targetEndpoint)"
            }
          },
          {
            selector: "edge[label]",
            style: {
              label: "data(label)"
            }
          },
          {
            selector: "edge.segments",
            style: {
              "curve-style": "segments",
              "segment-weights": "0",
              "segment-distances": [0.5],
              // @ts-ignore Incorrect library types
              "edge-distances": "endpoints",
              "source-endpoint": "data(sourceEndpoint)",
              "target-endpoint": "data(targetEndpoint)"
            }
          },
          {
            selector: "node",
            style: {
              // @ts-ignore Incorrect library types
              "compound-sizing-wrt-labels": "include"
            }
          },
          {
            selector: "node[label]",
            style: {
              "text-valign": "bottom",
              "text-halign": "center",
              "font-size": `${db9.getConfigField("fontSize")}px`
            }
          },
          {
            selector: ".node-service",
            style: {
              label: "data(label)",
              width: "data(width)",
              height: "data(height)"
            }
          },
          {
            selector: ".node-junction",
            style: {
              width: "data(width)",
              height: "data(height)"
            }
          },
          {
            selector: ".node-group",
            style: {
              // @ts-ignore Incorrect library types
              padding: `${db9.getConfigField("padding")}px`
            }
          }
        ],
        layout: {
          name: "grid",
          boundingBox: {
            x1: 0,
            x2: 100,
            y1: 0,
            y2: 100
          }
        }
      });
      renderEl.remove();
      addGroups(groups, cy);
      addServices(services, cy, db9);
      addJunctions(junctions, cy, db9);
      addEdges2(edges3, cy);
      const alignmentConstraint = getAlignments(db9, spatialMaps, groupAlignments);
      const relativePlacementConstraint = getRelativeConstraints(spatialMaps, db9);
      const layout7 = cy.layout({
        name: "fcose",
        quality: "proof",
        randomize: db9.getConfigField("randomize"),
        styleEnabled: false,
        animate: false,
        nodeDimensionsIncludeLabels: false,
        // Adjust the edge parameters if it passes through the border of a group
        // Hacky fix for: https://github.com/iVis-at-Bilkent/cytoscape.js-fcose/issues/67
        idealEdgeLength(edge) {
          const [nodeA, nodeB] = edge.connectedNodes();
          const { parent: parentA } = nodeData(nodeA);
          const { parent: parentB } = nodeData(nodeB);
          const elasticity = parentA === parentB ? 1.5 * db9.getConfigField("iconSize") : 0.5 * db9.getConfigField("iconSize");
          return elasticity;
        },
        edgeElasticity(edge) {
          const [nodeA, nodeB] = edge.connectedNodes();
          const { parent: parentA } = nodeData(nodeA);
          const { parent: parentB } = nodeData(nodeB);
          const elasticity = parentA === parentB ? 0.45 : 1e-3;
          return elasticity;
        },
        alignmentConstraint,
        relativePlacementConstraint
      });
      layout7.one("layoutstop", () => {
        function getSegmentWeights(source, target, pointX, pointY) {
          let W3, D4;
          const { x: sX, y: sY } = source;
          const { x: tX, y: tY } = target;
          D4 = (pointY - sY + (sX - pointX) * (sY - tY) / (sX - tX)) / Math.sqrt(1 + Math.pow((sY - tY) / (sX - tX), 2));
          W3 = Math.sqrt(Math.pow(pointY - sY, 2) + Math.pow(pointX - sX, 2) - Math.pow(D4, 2));
          const distAB = Math.sqrt(Math.pow(tX - sX, 2) + Math.pow(tY - sY, 2));
          W3 = W3 / distAB;
          let delta1 = (tX - sX) * (pointY - sY) - (tY - sY) * (pointX - sX);
          switch (true) {
            case delta1 >= 0:
              delta1 = 1;
              break;
            case delta1 < 0:
              delta1 = -1;
              break;
          }
          let delta2 = (tX - sX) * (pointX - sX) + (tY - sY) * (pointY - sY);
          switch (true) {
            case delta2 >= 0:
              delta2 = 1;
              break;
            case delta2 < 0:
              delta2 = -1;
              break;
          }
          D4 = Math.abs(D4) * delta1;
          W3 = W3 * delta2;
          return {
            distances: D4,
            weights: W3
          };
        }
        __name(getSegmentWeights, "getSegmentWeights");
        cy.startBatch();
        for (const edge of Object.values(cy.edges())) {
          if (edge.data?.()) {
            const { x: sX, y: sY } = edge.source().position();
            const { x: tX, y: tY } = edge.target().position();
            if (sX !== tX && sY !== tY) {
              const sEP = edge.sourceEndpoint();
              const tEP = edge.targetEndpoint();
              const { sourceDir } = edgeData(edge);
              const [pointX, pointY] = isArchitectureDirectionY(sourceDir) ? [sEP.x, tEP.y] : [tEP.x, sEP.y];
              const { weights, distances: distances2 } = getSegmentWeights(sEP, tEP, pointX, pointY);
              edge.style("segment-distances", distances2);
              edge.style("segment-weights", weights);
            }
          }
        }
        cy.endBatch();
        layout7.run();
      });
      layout7.run();
      cy.ready((e3) => {
        log.info("Ready", e3);
        resolve2(cy);
      });
    });
  }
  var import_cytoscape_fcose, draw26, renderer9;
  var init_architectureRenderer = __esm({
    "src/diagrams/architecture/architectureRenderer.ts"() {
      "use strict";
      init_cytoscape_esm();
      import_cytoscape_fcose = __toESM(require_cytoscape_fcose(), 1);
      init_src32();
      init_logger();
      init_icons();
      init_selectSvgElement();
      init_setupGraphViewbox();
      init_architectureIcons();
      init_architectureTypes();
      init_svgDraw6();
      registerIconPacks([
        {
          name: architectureIcons.prefix,
          icons: architectureIcons
        }
      ]);
      cytoscape2.use(import_cytoscape_fcose.default);
      __name(addServices, "addServices");
      __name(addJunctions, "addJunctions");
      __name(positionNodes, "positionNodes");
      __name(addGroups, "addGroups");
      __name(addEdges2, "addEdges");
      __name(getAlignments, "getAlignments");
      __name(getRelativeConstraints, "getRelativeConstraints");
      __name(layoutArchitecture, "layoutArchitecture");
      draw26 = /* @__PURE__ */ __name(async (text4, id34, _version, diagObj) => {
        const db9 = diagObj.db;
        db9.setDiagramId(id34);
        const services = db9.getServices();
        const junctions = db9.getJunctions();
        const groups = db9.getGroups();
        const edges3 = db9.getEdges();
        const ds = db9.getDataStructures();
        const svg2 = selectSvgElement(id34);
        const edgesElem = svg2.append("g");
        edgesElem.attr("class", "architecture-edges");
        const servicesElem = svg2.append("g");
        servicesElem.attr("class", "architecture-services");
        const groupElem = svg2.append("g");
        groupElem.attr("class", "architecture-groups");
        await drawServices(db9, servicesElem, services, id34);
        drawJunctions(db9, servicesElem, junctions, id34);
        const cy = await layoutArchitecture(services, junctions, groups, edges3, db9, ds);
        await drawEdges(edgesElem, cy, db9, id34);
        await drawGroups(groupElem, cy, db9, id34);
        positionNodes(db9, cy);
        setupGraphViewbox(void 0, svg2, db9.getConfigField("padding"), db9.getConfigField("useMaxWidth"));
      }, "draw");
      renderer9 = { draw: draw26 };
    }
  });

  // src/diagrams/architecture/architectureDiagram.ts
  var architectureDiagram_exports = {};
  __export(architectureDiagram_exports, {
    diagram: () => diagram26
  });
  var diagram26;
  var init_architectureDiagram = __esm({
    "src/diagrams/architecture/architectureDiagram.ts"() {
      "use strict";
      init_architectureParser();
      init_architectureDb();
      init_architectureStyles();
      init_architectureRenderer();
      diagram26 = {
        parser: parser23,
        get db() {
          return new ArchitectureDB();
        },
        renderer: renderer9,
        styles: architectureStyles_default
      };
    }
  });

  // src/diagrams/ishikawa/parser/ishikawa.jison
  var parser24, ishikawa_default;
  var init_ishikawa = __esm({
    "src/diagrams/ishikawa/parser/ishikawa.jison"() {
      "use strict";
      parser24 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [1, 4], $V1 = [1, 14], $V2 = [1, 12], $V3 = [1, 13], $V4 = [6, 7, 8], $V5 = [1, 20], $V6 = [1, 18], $V7 = [1, 19], $V8 = [6, 7, 11], $V9 = [1, 6, 13, 14], $Va = [1, 23], $Vb = [1, 24], $Vc = [1, 6, 7, 11, 13, 14];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "ishikawa": 4, "spaceLines": 5, "SPACELINE": 6, "NL": 7, "ISHIKAWA": 8, "document": 9, "stop": 10, "EOF": 11, "statement": 12, "SPACELIST": 13, "TEXT": 14, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "ISHIKAWA", 11: "EOF", 13: "SPACELIST", 14: "TEXT" },
          productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 1], [12, 1], [12, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 6:
              case 7:
                return yy;
                break;
              case 15:
                yy.addNode($$[$0 - 1].length, $$[$0].trim());
                break;
              case 16:
                yy.addNode(0, $$[$0].trim());
                break;
            }
          }, "anonymous"),
          table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: $V0 }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: $V0 }, { 6: $V1, 7: [1, 10], 9: 9, 12: 11, 13: $V2, 14: $V3 }, o2($V4, [2, 3]), { 1: [2, 2] }, o2($V4, [2, 4]), o2($V4, [2, 5]), { 1: [2, 6], 6: $V1, 12: 15, 13: $V2, 14: $V3 }, { 6: $V1, 9: 16, 12: 11, 13: $V2, 14: $V3 }, { 6: $V5, 7: $V6, 10: 17, 11: $V7 }, o2($V8, [2, 18], { 14: [1, 21] }), o2($V8, [2, 16]), o2($V8, [2, 17]), { 6: $V5, 7: $V6, 10: 22, 11: $V7 }, { 1: [2, 7], 6: $V1, 12: 15, 13: $V2, 14: $V3 }, o2($V9, [2, 14], { 7: $Va, 11: $Vb }), o2($Vc, [2, 8]), o2($Vc, [2, 9]), o2($Vc, [2, 10]), o2($V8, [2, 15]), o2($V9, [2, 13], { 7: $Va, 11: $Vb }), o2($Vc, [2, 11]), o2($Vc, [2, 12])],
          defaultActions: { 2: [2, 1], 6: [2, 2] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  return 6;
                  break;
                case 1:
                  return 8;
                  break;
                case 2:
                  return 8;
                  break;
                case 3:
                  return 6;
                  break;
                case 4:
                  return 7;
                  break;
                case 5:
                  return 13;
                  break;
                case 6:
                  return 14;
                  break;
                case 7:
                  return 11;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:\s*%%.*)/i, /^(?:ishikawa-beta\b)/i, /^(?:ishikawa\b)/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[\s]+)/i, /^(?:[^\n]+)/i, /^(?:$)/i],
            conditions: { "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser24.parser = parser24;
      ishikawa_default = parser24;
    }
  });

  // src/diagrams/ishikawa/ishikawaDb.ts
  var IshikawaDB;
  var init_ishikawaDb = __esm({
    "src/diagrams/ishikawa/ishikawaDb.ts"() {
      "use strict";
      init_diagramAPI();
      init_common();
      init_commonDb();
      IshikawaDB = class {
        constructor() {
          this.stack = [];
          this.clear = this.clear.bind(this);
          this.addNode = this.addNode.bind(this);
          this.getRoot = this.getRoot.bind(this);
        }
        static {
          __name(this, "IshikawaDB");
        }
        clear() {
          this.root = void 0;
          this.stack = [];
          this.baseLevel = void 0;
          clear();
        }
        getRoot() {
          return this.root;
        }
        addNode(rawLevel, text4) {
          const label = common_default.sanitizeText(text4, getConfig2());
          if (!this.root) {
            this.root = { text: label, children: [] };
            this.stack = [{ level: 0, node: this.root }];
            setDiagramTitle(label);
            return;
          }
          this.baseLevel ??= rawLevel;
          let level = rawLevel - this.baseLevel + 1;
          if (level <= 0) {
            level = 1;
          }
          while (this.stack.length > 1 && this.stack[this.stack.length - 1].level >= level) {
            this.stack.pop();
          }
          const parent4 = this.stack[this.stack.length - 1].node;
          const node2 = { text: label, children: [] };
          parent4.children.push(node2);
          this.stack.push({ level, node: node2 });
        }
        getAccTitle() {
          return getAccTitle();
        }
        setAccTitle(title2) {
          setAccTitle(title2);
        }
        getAccDescription() {
          return getAccDescription();
        }
        setAccDescription(description) {
          setAccDescription(description);
        }
        getDiagramTitle() {
          return getDiagramTitle();
        }
        setDiagramTitle(title2) {
          setDiagramTitle(title2);
        }
      };
    }
  });

  // src/diagrams/ishikawa/ishikawaRenderer.ts
  var FONT_SIZE_DEFAULT, SPINE_BASE_LENGTH, BONE_STUB, BONE_BASE, BONE_PER_CHILD, ANGLE, COS_A, SIN_A, applyPaddedViewBox, draw27, sideStats, drawHead, flattenTree, drawCauseLabel, drawArrowMarker, drawBranch, splitLines, wrapText, drawMultilineText, lerp, drawLine, renderer10;
  var init_ishikawaRenderer = __esm({
    "src/diagrams/ishikawa/ishikawaRenderer.ts"() {
      "use strict";
      init_diagramAPI();
      init_selectSvgElement();
      init_setupGraphViewbox();
      init_utils2();
      init_rough_esm();
      FONT_SIZE_DEFAULT = 14;
      SPINE_BASE_LENGTH = 250;
      BONE_STUB = 30;
      BONE_BASE = 60;
      BONE_PER_CHILD = 5;
      ANGLE = 82 * Math.PI / 180;
      COS_A = Math.cos(ANGLE);
      SIN_A = Math.sin(ANGLE);
      applyPaddedViewBox = /* @__PURE__ */ __name((svgEl, pad3, maxW) => {
        const bbox = svgEl.node().getBBox();
        const w4 = bbox.width + pad3 * 2;
        const h3 = bbox.height + pad3 * 2;
        configureSvgSize(svgEl, h3, w4, maxW);
        svgEl.attr("viewBox", `${bbox.x - pad3} ${bbox.y - pad3} ${w4} ${h3}`);
      }, "applyPaddedViewBox");
      draw27 = /* @__PURE__ */ __name((_text, id34, _version, diagram31) => {
        const db9 = diagram31.db;
        const root3 = db9.getRoot();
        if (!root3) {
          return;
        }
        const drawConfig = getConfig2();
        const { look, handDrawnSeed, themeVariables } = drawConfig;
        const fontSize = parseFontSize(drawConfig.fontSize)[0] ?? FONT_SIZE_DEFAULT;
        const isHandDrawn = look === "handDrawn";
        const causes = root3.children ?? [];
        const padding2 = drawConfig.ishikawa?.diagramPadding ?? 20;
        const useMaxWidth = drawConfig.ishikawa?.useMaxWidth ?? false;
        const svg2 = selectSvgElement(id34);
        const g2 = svg2.append("g").attr("class", "ishikawa");
        const roughSvg = isHandDrawn ? at.svg(svg2.node()) : void 0;
        const roughContext = roughSvg ? {
          roughSvg,
          seed: handDrawnSeed ?? 0,
          lineColor: themeVariables?.lineColor ?? "#333",
          fillColor: themeVariables?.mainBkg ?? "#fff"
        } : void 0;
        const markerId = `ishikawa-arrow-${id34}`;
        if (!isHandDrawn) {
          g2.append("defs").append("marker").attr("id", markerId).attr("viewBox", "0 0 10 10").attr("refX", 0).attr("refY", 5).attr("markerWidth", 6).attr("markerHeight", 6).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 Z").attr("class", "ishikawa-arrow");
        }
        let spineX = 0;
        let spineY = SPINE_BASE_LENGTH;
        const spineLine = isHandDrawn ? void 0 : drawLine(g2, spineX, spineY, spineX, spineY, "ishikawa-spine");
        drawHead(g2, spineX, spineY, root3.text, fontSize, roughContext);
        if (!causes.length) {
          if (isHandDrawn) {
            drawLine(g2, spineX, spineY, spineX, spineY, "ishikawa-spine", roughContext);
          }
          applyPaddedViewBox(svg2, padding2, useMaxWidth);
          return;
        }
        spineX -= 20;
        const upperCauses = causes.filter((_3, i2) => i2 % 2 === 0);
        const lowerCauses = causes.filter((_3, i2) => i2 % 2 === 1);
        const upperStats = sideStats(upperCauses);
        const lowerStats = sideStats(lowerCauses);
        const descendantTotal = upperStats.total + lowerStats.total;
        let upperLen = SPINE_BASE_LENGTH;
        let lowerLen = SPINE_BASE_LENGTH;
        if (descendantTotal > 0) {
          const pool = SPINE_BASE_LENGTH * 2;
          const minLen = SPINE_BASE_LENGTH * 0.3;
          upperLen = Math.max(minLen, pool * (upperStats.total / descendantTotal));
          lowerLen = Math.max(minLen, pool * (lowerStats.total / descendantTotal));
        }
        const minSpacing = fontSize * 2;
        upperLen = Math.max(upperLen, upperStats.max * minSpacing);
        lowerLen = Math.max(lowerLen, lowerStats.max * minSpacing);
        spineY = Math.max(upperLen, SPINE_BASE_LENGTH);
        if (spineLine) {
          spineLine.attr("y1", spineY).attr("y2", spineY);
        }
        g2.select(".ishikawa-head-group").attr("transform", `translate(0,${spineY})`);
        const pairCount = Math.ceil(causes.length / 2);
        for (let p3 = 0; p3 < pairCount; p3++) {
          const pg = g2.append("g").attr("class", "ishikawa-pair");
          for (const [cause, dir2, len] of [
            [causes[p3 * 2], -1, upperLen],
            [causes[p3 * 2 + 1], 1, lowerLen]
          ]) {
            if (cause) {
              drawBranch(pg, cause, spineX, spineY, dir2, len, fontSize, roughContext);
            }
          }
          spineX = pg.selectAll("text").nodes().reduce((left3, n2) => Math.min(left3, n2.getBBox().x), Infinity);
        }
        if (isHandDrawn) {
          drawLine(g2, spineX, spineY, 0, spineY, "ishikawa-spine", roughContext);
        } else {
          spineLine.attr("x1", spineX);
          const markerUrl = `url(#${markerId})`;
          g2.selectAll("line.ishikawa-branch, line.ishikawa-sub-branch").attr("marker-start", markerUrl);
        }
        applyPaddedViewBox(svg2, padding2, useMaxWidth);
      }, "draw");
      sideStats = /* @__PURE__ */ __name((nodes5) => {
        const countDescendants = /* @__PURE__ */ __name((node2) => node2.children.reduce((sum2, child) => sum2 + 1 + countDescendants(child), 0), "countDescendants");
        return nodes5.reduce(
          (stats, node2) => {
            const descendants3 = countDescendants(node2);
            stats.total += descendants3;
            stats.max = Math.max(stats.max, descendants3);
            return stats;
          },
          { total: 0, max: 0 }
        );
      }, "sideStats");
      drawHead = /* @__PURE__ */ __name((svg2, x5, y6, label, fontSize, roughContext) => {
        const maxChars = Math.max(6, Math.floor(110 / (fontSize * 0.6)));
        const headGroup = svg2.append("g").attr("class", "ishikawa-head-group").attr("transform", `translate(${x5},${y6})`);
        const textEl = drawMultilineText(
          headGroup,
          wrapText(label, maxChars),
          0,
          0,
          "ishikawa-head-label",
          "start",
          fontSize
        );
        const tb = textEl.node().getBBox();
        const w4 = Math.max(60, tb.width + 6);
        const h3 = Math.max(40, tb.height * 2 + 40);
        const headPath = `M 0 ${-h3 / 2} L 0 ${h3 / 2} Q ${w4 * 2.4} 0 0 ${-h3 / 2} Z`;
        if (roughContext) {
          const roughNode = roughContext.roughSvg.path(headPath, {
            roughness: 1.5,
            seed: roughContext.seed,
            fill: roughContext.fillColor,
            fillStyle: "hachure",
            fillWeight: 2.5,
            hachureGap: 5,
            stroke: roughContext.lineColor,
            strokeWidth: 2
          });
          headGroup.insert(() => roughNode, ":first-child").attr("class", "ishikawa-head");
        } else {
          headGroup.insert("path", ":first-child").attr("class", "ishikawa-head").attr("d", headPath);
        }
        textEl.attr("transform", `translate(${(w4 - tb.width) / 2 - tb.x + 3},${-tb.y - tb.height / 2})`);
      }, "drawHead");
      flattenTree = /* @__PURE__ */ __name((children2, direction2) => {
        const entries2 = [];
        const yOrder = [];
        const walk = /* @__PURE__ */ __name((nodes5, pid, depth) => {
          const ordered = direction2 === -1 ? [...nodes5].reverse() : nodes5;
          for (const child of ordered) {
            const idx = entries2.length;
            const gc2 = child.children ?? [];
            entries2.push({
              depth,
              text: wrapText(child.text, 15),
              parentIndex: pid,
              childCount: gc2.length
            });
            if (depth % 2 === 0) {
              yOrder.push(idx);
              if (gc2.length) {
                walk(gc2, idx, depth + 1);
              }
            } else {
              if (gc2.length) {
                walk(gc2, idx, depth + 1);
              }
              yOrder.push(idx);
            }
          }
        }, "walk");
        walk(children2, -1, 2);
        return { entries: entries2, yOrder };
      }, "flattenTree");
      drawCauseLabel = /* @__PURE__ */ __name((svg2, text4, x5, y6, direction2, fontSize, roughContext) => {
        const lg = svg2.append("g").attr("class", "ishikawa-label-group");
        const lt = drawMultilineText(
          lg,
          text4,
          x5,
          y6 + 11 * direction2,
          "ishikawa-label cause",
          "middle",
          fontSize
        );
        const tb = lt.node().getBBox();
        if (roughContext) {
          const roughNode = roughContext.roughSvg.rectangle(
            tb.x - 20,
            tb.y - 2,
            tb.width + 40,
            tb.height + 4,
            {
              roughness: 1.5,
              seed: roughContext.seed,
              fill: roughContext.fillColor,
              fillStyle: "hachure",
              fillWeight: 2.5,
              hachureGap: 5,
              stroke: roughContext.lineColor,
              strokeWidth: 2
            }
          );
          lg.insert(() => roughNode, ":first-child").attr("class", "ishikawa-label-box");
        } else {
          lg.insert("rect", ":first-child").attr("class", "ishikawa-label-box").attr("x", tb.x - 20).attr("y", tb.y - 2).attr("width", tb.width + 40).attr("height", tb.height + 4);
        }
      }, "drawCauseLabel");
      drawArrowMarker = /* @__PURE__ */ __name((g2, x5, y6, dx, dy, roughContext) => {
        const len = Math.sqrt(dx * dx + dy * dy);
        if (len === 0) {
          return;
        }
        const ux = dx / len;
        const uy = dy / len;
        const s2 = 6;
        const px = -uy * s2;
        const py = ux * s2;
        const tipX = x5;
        const tipY = y6;
        const d3 = `M ${tipX} ${tipY} L ${tipX - ux * s2 * 2 + px} ${tipY - uy * s2 * 2 + py} L ${tipX - ux * s2 * 2 - px} ${tipY - uy * s2 * 2 - py} Z`;
        const roughNode = roughContext.roughSvg.path(d3, {
          roughness: 1,
          seed: roughContext.seed,
          fill: roughContext.lineColor,
          fillStyle: "solid",
          stroke: roughContext.lineColor,
          strokeWidth: 1
        });
        g2.append(() => roughNode);
      }, "drawArrowMarker");
      drawBranch = /* @__PURE__ */ __name((svg2, node2, startX2, startY2, direction2, length2, fontSize, roughContext) => {
        const children2 = node2.children ?? [];
        const lineLen = length2 * (children2.length ? 1 : 0.2);
        const dx = -COS_A * lineLen;
        const dy = SIN_A * lineLen * direction2;
        const endX = startX2 + dx;
        const endY = startY2 + dy;
        drawLine(svg2, startX2, startY2, endX, endY, "ishikawa-branch", roughContext);
        if (roughContext) {
          drawArrowMarker(svg2, startX2, startY2, startX2 - endX, startY2 - endY, roughContext);
        }
        drawCauseLabel(svg2, node2.text, endX, endY, direction2, fontSize, roughContext);
        if (!children2.length) {
          return;
        }
        const { entries: entries2, yOrder } = flattenTree(children2, direction2);
        const entryCount = entries2.length;
        const ys = new Array(entryCount);
        for (const [slot, entryIdx] of yOrder.entries()) {
          ys[entryIdx] = startY2 + dy * ((slot + 1) / (entryCount + 1));
        }
        const bones = /* @__PURE__ */ new Map();
        bones.set(-1, {
          x0: startX2,
          y0: startY2,
          x1: endX,
          y1: endY,
          childCount: children2.length,
          childrenDrawn: 0
        });
        const diagonalX = -COS_A;
        const diagonalY = SIN_A * direction2;
        const oddLabel = direction2 < 0 ? "ishikawa-label up" : "ishikawa-label down";
        for (const [i2, e3] of entries2.entries()) {
          const y6 = ys[i2];
          const par = bones.get(e3.parentIndex);
          const grp = svg2.append("g").attr("class", "ishikawa-sub-group");
          let bx0 = 0;
          let by0 = 0;
          let bx1 = 0;
          if (e3.depth % 2 === 0) {
            const dyP = par.y1 - par.y0;
            bx0 = lerp(par.x0, par.x1, dyP ? (y6 - par.y0) / dyP : 0.5);
            by0 = y6;
            bx1 = bx0 - (e3.childCount > 0 ? BONE_BASE + e3.childCount * BONE_PER_CHILD : BONE_STUB);
            drawLine(grp, bx0, y6, bx1, y6, "ishikawa-sub-branch", roughContext);
            if (roughContext) {
              drawArrowMarker(grp, bx0, y6, 1, 0, roughContext);
            }
            drawMultilineText(grp, e3.text, bx1, y6, "ishikawa-label align", "end", fontSize);
          } else {
            const k2 = par.childrenDrawn++;
            bx0 = lerp(par.x0, par.x1, (par.childCount - k2) / (par.childCount + 1));
            by0 = par.y0;
            bx1 = bx0 + diagonalX * ((y6 - by0) / diagonalY);
            drawLine(grp, bx0, by0, bx1, y6, "ishikawa-sub-branch", roughContext);
            if (roughContext) {
              drawArrowMarker(grp, bx0, by0, bx0 - bx1, by0 - y6, roughContext);
            }
            drawMultilineText(grp, e3.text, bx1, y6, oddLabel, "end", fontSize);
          }
          if (e3.childCount > 0) {
            bones.set(i2, {
              x0: bx0,
              y0: by0,
              x1: bx1,
              y1: y6,
              childCount: e3.childCount,
              childrenDrawn: 0
            });
          }
        }
      }, "drawBranch");
      splitLines = /* @__PURE__ */ __name((text4) => text4.split(/<br\s*\/?>|\n/), "splitLines");
      wrapText = /* @__PURE__ */ __name((text4, maxChars) => {
        if (text4.length <= maxChars) {
          return text4;
        }
        const lines = [];
        for (const word of text4.split(/\s+/)) {
          const last3 = lines.length - 1;
          if (last3 >= 0 && lines[last3].length + 1 + word.length <= maxChars) {
            lines[last3] += " " + word;
          } else {
            lines.push(word);
          }
        }
        return lines.join("\n");
      }, "wrapText");
      drawMultilineText = /* @__PURE__ */ __name((g2, text4, x5, y6, cls, anchor2, fontSize) => {
        const lines = splitLines(text4);
        const lh = fontSize * 1.05;
        const el = g2.append("text").attr("class", cls).attr("text-anchor", anchor2).attr("x", x5).attr("y", y6 - (lines.length - 1) * lh / 2);
        for (const [i2, line2] of lines.entries()) {
          el.append("tspan").attr("x", x5).attr("dy", i2 === 0 ? 0 : lh).text(line2);
        }
        return el;
      }, "drawMultilineText");
      lerp = /* @__PURE__ */ __name((a2, b3, t4) => a2 + (b3 - a2) * t4, "lerp");
      drawLine = /* @__PURE__ */ __name((g2, x1, y1, x22, y22, cls, roughContext) => {
        if (roughContext) {
          const roughNode = roughContext.roughSvg.line(x1, y1, x22, y22, {
            roughness: 1.5,
            seed: roughContext.seed,
            stroke: roughContext.lineColor,
            strokeWidth: 2
          });
          g2.append(() => roughNode).attr("class", cls);
          return void 0;
        }
        return g2.append("line").attr("class", cls).attr("x1", x1).attr("y1", y1).attr("x2", x22).attr("y2", y22);
      }, "drawLine");
      renderer10 = { draw: draw27 };
    }
  });

  // src/diagrams/ishikawa/ishikawaStyles.ts
  var getStyles19, ishikawaStyles_default;
  var init_ishikawaStyles = __esm({
    "src/diagrams/ishikawa/ishikawaStyles.ts"() {
      "use strict";
      getStyles19 = /* @__PURE__ */ __name((options2) => `
.ishikawa .ishikawa-spine,
.ishikawa .ishikawa-branch,
.ishikawa .ishikawa-sub-branch {
  stroke: ${options2.lineColor};
  stroke-width: 2;
  fill: none;
}

.ishikawa .ishikawa-sub-branch {
  stroke-width: 1;
}

.ishikawa .ishikawa-arrow {
  fill: ${options2.lineColor};
}

.ishikawa .ishikawa-head {
  fill: ${options2.mainBkg};
  stroke: ${options2.lineColor};
  stroke-width: 2;
}

.ishikawa .ishikawa-label-box {
  fill: ${options2.mainBkg};
  stroke: ${options2.lineColor};
  stroke-width: 2;
}

.ishikawa text {
  font-family: ${options2.fontFamily};
  font-size: ${options2.fontSize};
  fill: ${options2.textColor};
}

.ishikawa .ishikawa-head-label {
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
  font-size: 14px;
}

.ishikawa .ishikawa-label {
  text-anchor: end;
}

.ishikawa .ishikawa-label.cause {
  text-anchor: middle;
  dominant-baseline: middle;
}

.ishikawa .ishikawa-label.align {
  text-anchor: end;
  dominant-baseline: middle;
}

.ishikawa .ishikawa-label.up {
  dominant-baseline: baseline;
}

.ishikawa .ishikawa-label.down {
  dominant-baseline: hanging;
}
`, "getStyles");
      ishikawaStyles_default = getStyles19;
    }
  });

  // src/diagrams/ishikawa/ishikawaDiagram.ts
  var ishikawaDiagram_exports = {};
  __export(ishikawaDiagram_exports, {
    diagram: () => diagram27
  });
  var diagram27;
  var init_ishikawaDiagram = __esm({
    "src/diagrams/ishikawa/ishikawaDiagram.ts"() {
      "use strict";
      init_ishikawa();
      init_ishikawaDb();
      init_ishikawaRenderer();
      init_ishikawaStyles();
      diagram27 = {
        parser: ishikawa_default,
        get db() {
          return new IshikawaDB();
        },
        renderer: renderer10,
        styles: ishikawaStyles_default
      };
    }
  });

  // src/diagrams/venn/parser/venn.jison
  var parser25, venn_default;
  var init_venn = __esm({
    "src/diagrams/venn/parser/venn.jison"() {
      "use strict";
      parser25 = (function() {
        var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) {
          for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ;
          return o3;
        }, "o"), $V0 = [5, 8], $V1 = [7, 8, 11, 12, 17, 19, 22, 24], $V2 = [1, 17], $V3 = [1, 18], $V4 = [7, 8, 11, 12, 14, 15, 16, 17, 19, 20, 21, 22, 24, 27], $V5 = [1, 31], $V6 = [1, 39], $V7 = [7, 8, 11, 12, 17, 19, 22, 24, 27], $V8 = [1, 57], $V9 = [1, 56], $Va = [1, 58], $Vb = [1, 59], $Vc = [1, 60], $Vd = [7, 8, 11, 12, 16, 17, 19, 20, 22, 24, 27, 31, 32, 33];
        var parser28 = {
          trace: /* @__PURE__ */ __name(function trace() {
          }, "trace"),
          yy: {},
          symbols_: { "error": 2, "start": 3, "optNewlines": 4, "VENN": 5, "document": 6, "EOF": 7, "NEWLINE": 8, "line": 9, "statement": 10, "TITLE": 11, "SET": 12, "identifier": 13, "BRACKET_LABEL": 14, "COLON": 15, "NUMERIC": 16, "UNION": 17, "identifierList": 18, "TEXT": 19, "IDENTIFIER": 20, "STRING": 21, "INDENT_TEXT": 22, "indentedTextTail": 23, "STYLE": 24, "stylesOpt": 25, "styleField": 26, "COMMA": 27, "styleValue": 28, "valueTokens": 29, "valueToken": 30, "HEXCOLOR": 31, "RGBCOLOR": 32, "RGBACOLOR": 33, "$accept": 0, "$end": 1 },
          terminals_: { 2: "error", 5: "VENN", 7: "EOF", 8: "NEWLINE", 11: "TITLE", 12: "SET", 14: "BRACKET_LABEL", 15: "COLON", 16: "NUMERIC", 17: "UNION", 19: "TEXT", 20: "IDENTIFIER", 21: "STRING", 22: "INDENT_TEXT", 24: "STYLE", 27: "COMMA", 31: "HEXCOLOR", 32: "RGBCOLOR", 33: "RGBACOLOR" },
          productions_: [0, [3, 4], [4, 0], [4, 2], [6, 0], [6, 2], [9, 1], [9, 1], [10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 2], [10, 3], [10, 4], [10, 5], [10, 3], [10, 3], [10, 3], [10, 4], [10, 4], [10, 2], [10, 3], [23, 1], [23, 1], [23, 1], [23, 2], [23, 2], [25, 1], [25, 3], [26, 3], [28, 1], [28, 1], [29, 1], [29, 2], [30, 1], [30, 1], [30, 1], [30, 1], [30, 1], [18, 1], [18, 3], [13, 1], [13, 1]],
          performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
            var $0 = $$.length - 1;
            switch (yystate) {
              case 1:
                return $$[$0 - 1];
                break;
              case 2:
              case 3:
              case 4:
                this.$ = [];
                break;
              case 5:
                $$[$0 - 1].push($$[$0]);
                this.$ = $$[$0 - 1];
                break;
              case 6:
                this.$ = [];
                break;
              case 7:
              case 22:
              case 32:
              case 36:
              case 37:
              case 38:
              case 39:
              case 40:
                this.$ = $$[$0];
                break;
              case 8:
                yy.setDiagramTitle($$[$0].substr(6));
                this.$ = $$[$0].substr(6);
                break;
              case 9:
                yy.addSubsetData([$$[$0]], void 0, void 0);
                if (yy.setIndentMode) {
                  yy.setIndentMode(true);
                }
                break;
              case 10:
                yy.addSubsetData([$$[$0 - 1]], $$[$0], void 0);
                if (yy.setIndentMode) {
                  yy.setIndentMode(true);
                }
                break;
              case 11:
                yy.addSubsetData([$$[$0 - 2]], void 0, parseFloat($$[$0]));
                if (yy.setIndentMode) {
                  yy.setIndentMode(true);
                }
                break;
              case 12:
                yy.addSubsetData([$$[$0 - 3]], $$[$0 - 2], parseFloat($$[$0]));
                if (yy.setIndentMode) {
                  yy.setIndentMode(true);
                }
                break;
              case 13:
                if ($$[$0].length < 2) {
                  throw new Error("union requires multiple identifiers");
                }
                if (yy.validateUnionIdentifiers) {
                  yy.validateUnionIdentifiers($$[$0]);
                }
                yy.addSubsetData($$[$0], void 0, void 0);
                if (yy.setIndentMode) {
                  yy.setIndentMode(true);
                }
                break;
              case 14:
                if ($$[$0 - 1].length < 2) {
                  throw new Error("union requires multiple identifiers");
                }
                if (yy.validateUnionIdentifiers) {
                  yy.validateUnionIdentifiers($$[$0 - 1]);
                }
                yy.addSubsetData($$[$0 - 1], $$[$0], void 0);
                if (yy.setIndentMode) {
                  yy.setIndentMode(true);
                }
                break;
              case 15:
                if ($$[$0 - 2].length < 2) {
                  throw new Error("union requires multiple identifiers");
                }
                if (yy.validateUnionIdentifiers) {
                  yy.validateUnionIdentifiers($$[$0 - 2]);
                }
                yy.addSubsetData($$[$0 - 2], void 0, parseFloat($$[$0]));
                if (yy.setIndentMode) {
                  yy.setIndentMode(true);
                }
                break;
              case 16:
                if ($$[$0 - 3].length < 2) {
                  throw new Error("union requires multiple identifiers");
                }
                if (yy.validateUnionIdentifiers) {
                  yy.validateUnionIdentifiers($$[$0 - 3]);
                }
                yy.addSubsetData($$[$0 - 3], $$[$0 - 2], parseFloat($$[$0]));
                if (yy.setIndentMode) {
                  yy.setIndentMode(true);
                }
                break;
              case 17:
              case 18:
              case 19:
                yy.addTextData($$[$0 - 1], $$[$0], void 0);
                break;
              case 20:
              case 21:
                yy.addTextData($$[$0 - 2], $$[$0 - 1], $$[$0]);
                break;
              case 23:
                yy.addStyleData($$[$0 - 1], $$[$0]);
                break;
              case 24:
              case 25:
              case 26:
                var cs = yy.getCurrentSets();
                if (!cs) throw new Error("text requires set");
                yy.addTextData(cs, $$[$0], void 0);
                break;
              case 27:
              case 28:
                var cs = yy.getCurrentSets();
                if (!cs) throw new Error("text requires set");
                yy.addTextData(cs, $$[$0 - 1], $$[$0]);
                break;
              case 29:
              case 41:
                this.$ = [$$[$0]];
                break;
              case 30:
              case 42:
                this.$ = [...$$[$0 - 2], $$[$0]];
                break;
              case 31:
                this.$ = [$$[$0 - 2], $$[$0]];
                break;
              case 33:
                this.$ = $$[$0].join(" ");
                break;
              case 34:
                this.$ = [$$[$0]];
                break;
              case 35:
                $$[$0 - 1].push($$[$0]);
                this.$ = $$[$0 - 1];
                break;
              case 43:
              case 44:
                this.$ = $$[$0];
                break;
            }
          }, "anonymous"),
          table: [o2($V0, [2, 2], { 3: 1, 4: 2 }), { 1: [3] }, { 5: [1, 3], 8: [1, 4] }, o2($V1, [2, 4], { 6: 5 }), o2($V0, [2, 3]), { 7: [1, 6], 8: [1, 8], 9: 7, 10: 9, 11: [1, 10], 12: [1, 11], 17: [1, 12], 19: [1, 13], 22: [1, 14], 24: [1, 15] }, { 1: [2, 1] }, o2($V1, [2, 5]), o2($V1, [2, 6]), o2($V1, [2, 7]), o2($V1, [2, 8]), { 13: 16, 20: $V2, 21: $V3 }, { 13: 20, 18: 19, 20: $V2, 21: $V3 }, { 13: 20, 18: 21, 20: $V2, 21: $V3 }, { 16: [1, 25], 20: [1, 23], 21: [1, 24], 23: 22 }, { 13: 20, 18: 26, 20: $V2, 21: $V3 }, o2($V1, [2, 9], { 14: [1, 27], 15: [1, 28] }), o2($V4, [2, 43]), o2($V4, [2, 44]), o2($V1, [2, 13], { 14: [1, 29], 15: [1, 30], 27: $V5 }), o2($V4, [2, 41]), { 16: [1, 34], 20: [1, 32], 21: [1, 33], 27: $V5 }, o2($V1, [2, 22]), o2($V1, [2, 24], { 14: [1, 35] }), o2($V1, [2, 25], { 14: [1, 36] }), o2($V1, [2, 26]), { 20: $V6, 25: 37, 26: 38, 27: $V5 }, o2($V1, [2, 10], { 15: [1, 40] }), { 16: [1, 41] }, o2($V1, [2, 14], { 15: [1, 42] }), { 16: [1, 43] }, { 13: 44, 20: $V2, 21: $V3 }, o2($V1, [2, 17], { 14: [1, 45] }), o2($V1, [2, 18], { 14: [1, 46] }), o2($V1, [2, 19]), o2($V1, [2, 27]), o2($V1, [2, 28]), o2($V1, [2, 23], { 27: [1, 47] }), o2($V7, [2, 29]), { 15: [1, 48] }, { 16: [1, 49] }, o2($V1, [2, 11]), { 16: [1, 50] }, o2($V1, [2, 15]), o2($V4, [2, 42]), o2($V1, [2, 20]), o2($V1, [2, 21]), { 20: $V6, 26: 51 }, { 16: $V8, 20: $V9, 21: [1, 53], 28: 52, 29: 54, 30: 55, 31: $Va, 32: $Vb, 33: $Vc }, o2($V1, [2, 12]), o2($V1, [2, 16]), o2($V7, [2, 30]), o2($V7, [2, 31]), o2($V7, [2, 32]), o2($V7, [2, 33], { 30: 61, 16: $V8, 20: $V9, 31: $Va, 32: $Vb, 33: $Vc }), o2($Vd, [2, 34]), o2($Vd, [2, 36]), o2($Vd, [2, 37]), o2($Vd, [2, 38]), o2($Vd, [2, 39]), o2($Vd, [2, 40]), o2($Vd, [2, 35])],
          defaultActions: { 6: [2, 1] },
          parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
            if (hash.recoverable) {
              this.trace(str2);
            } else {
              var error3 = new Error(str2);
              error3.hash = hash;
              throw error3;
            }
          }, "parseError"),
          parse: /* @__PURE__ */ __name(function parse7(input) {
            var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1;
            var args = lstack.slice.call(arguments, 1);
            var lexer2 = Object.create(this.lexer);
            var sharedState = { yy: {} };
            for (var k2 in this.yy) {
              if (Object.prototype.hasOwnProperty.call(this.yy, k2)) {
                sharedState.yy[k2] = this.yy[k2];
              }
            }
            lexer2.setInput(input, sharedState.yy);
            sharedState.yy.lexer = lexer2;
            sharedState.yy.parser = this;
            if (typeof lexer2.yylloc == "undefined") {
              lexer2.yylloc = {};
            }
            var yyloc = lexer2.yylloc;
            lstack.push(yyloc);
            var ranges = lexer2.options && lexer2.options.ranges;
            if (typeof sharedState.yy.parseError === "function") {
              this.parseError = sharedState.yy.parseError;
            } else {
              this.parseError = Object.getPrototypeOf(this).parseError;
            }
            function popStack(n2) {
              stack.length = stack.length - 2 * n2;
              vstack.length = vstack.length - n2;
              lstack.length = lstack.length - n2;
            }
            __name(popStack, "popStack");
            function lex() {
              var token2;
              token2 = tstack.pop() || lexer2.lex() || EOF2;
              if (typeof token2 !== "number") {
                if (token2 instanceof Array) {
                  tstack = token2;
                  token2 = tstack.pop();
                }
                token2 = self2.symbols_[token2] || token2;
              }
              return token2;
            }
            __name(lex, "lex");
            var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected;
            while (true) {
              state4 = stack[stack.length - 1];
              if (this.defaultActions[state4]) {
                action = this.defaultActions[state4];
              } else {
                if (symbol === null || typeof symbol == "undefined") {
                  symbol = lex();
                }
                action = table[state4] && table[state4][symbol];
              }
              if (typeof action === "undefined" || !action.length || !action[0]) {
                var errStr = "";
                expected = [];
                for (p3 in table[state4]) {
                  if (this.terminals_[p3] && p3 > TERROR) {
                    expected.push("'" + this.terminals_[p3] + "'");
                  }
                }
                if (lexer2.showPosition) {
                  errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                  errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {
                  text: lexer2.match,
                  token: this.terminals_[symbol] || symbol,
                  line: lexer2.yylineno,
                  loc: yyloc,
                  expected
                });
              }
              if (action[0] instanceof Array && action.length > 1) {
                throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol);
              }
              switch (action[0]) {
                case 1:
                  stack.push(symbol);
                  vstack.push(lexer2.yytext);
                  lstack.push(lexer2.yylloc);
                  stack.push(action[1]);
                  symbol = null;
                  if (!preErrorSymbol) {
                    yyleng = lexer2.yyleng;
                    yytext = lexer2.yytext;
                    yylineno = lexer2.yylineno;
                    yyloc = lexer2.yylloc;
                    if (recovering > 0) {
                      recovering--;
                    }
                  } else {
                    symbol = preErrorSymbol;
                    preErrorSymbol = null;
                  }
                  break;
                case 2:
                  len = this.productions_[action[1]][1];
                  yyval.$ = vstack[vstack.length - len];
                  yyval._$ = {
                    first_line: lstack[lstack.length - (len || 1)].first_line,
                    last_line: lstack[lstack.length - 1].last_line,
                    first_column: lstack[lstack.length - (len || 1)].first_column,
                    last_column: lstack[lstack.length - 1].last_column
                  };
                  if (ranges) {
                    yyval._$.range = [
                      lstack[lstack.length - (len || 1)].range[0],
                      lstack[lstack.length - 1].range[1]
                    ];
                  }
                  r2 = this.performAction.apply(yyval, [
                    yytext,
                    yyleng,
                    yylineno,
                    sharedState.yy,
                    action[1],
                    vstack,
                    lstack
                  ].concat(args));
                  if (typeof r2 !== "undefined") {
                    return r2;
                  }
                  if (len) {
                    stack = stack.slice(0, -1 * len * 2);
                    vstack = vstack.slice(0, -1 * len);
                    lstack = lstack.slice(0, -1 * len);
                  }
                  stack.push(this.productions_[action[1]][0]);
                  vstack.push(yyval.$);
                  lstack.push(yyval._$);
                  newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]];
                  stack.push(newState2);
                  break;
                case 3:
                  return true;
              }
            }
            return true;
          }, "parse")
        };
        var lexer = /* @__PURE__ */ (function() {
          var lexer2 = {
            EOF: 1,
            parseError: /* @__PURE__ */ __name(function parseError(str2, hash) {
              if (this.yy.parser) {
                this.yy.parser.parseError(str2, hash);
              } else {
                throw new Error(str2);
              }
            }, "parseError"),
            // resets the lexer, sets new input
            setInput: /* @__PURE__ */ __name(function(input, yy) {
              this.yy = yy || this.yy || {};
              this._input = input;
              this._more = this._backtrack = this.done = false;
              this.yylineno = this.yyleng = 0;
              this.yytext = this.matched = this.match = "";
              this.conditionStack = ["INITIAL"];
              this.yylloc = {
                first_line: 1,
                first_column: 0,
                last_line: 1,
                last_column: 0
              };
              if (this.options.ranges) {
                this.yylloc.range = [0, 0];
              }
              this.offset = 0;
              return this;
            }, "setInput"),
            // consumes and returns one char from the input
            input: /* @__PURE__ */ __name(function() {
              var ch = this._input[0];
              this.yytext += ch;
              this.yyleng++;
              this.offset++;
              this.match += ch;
              this.matched += ch;
              var lines = ch.match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno++;
                this.yylloc.last_line++;
              } else {
                this.yylloc.last_column++;
              }
              if (this.options.ranges) {
                this.yylloc.range[1]++;
              }
              this._input = this._input.slice(1);
              return ch;
            }, "input"),
            // unshifts one char (or a string) into the input
            unput: /* @__PURE__ */ __name(function(ch) {
              var len = ch.length;
              var lines = ch.split(/(?:\r\n?|\n)/g);
              this._input = ch + this._input;
              this.yytext = this.yytext.substr(0, this.yytext.length - len);
              this.offset -= len;
              var oldLines = this.match.split(/(?:\r\n?|\n)/g);
              this.match = this.match.substr(0, this.match.length - 1);
              this.matched = this.matched.substr(0, this.matched.length - 1);
              if (lines.length - 1) {
                this.yylineno -= lines.length - 1;
              }
              var r2 = this.yylloc.range;
              this.yylloc = {
                first_line: this.yylloc.first_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.first_column,
                last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
              };
              if (this.options.ranges) {
                this.yylloc.range = [r2[0], r2[0] + this.yyleng - len];
              }
              this.yyleng = this.yytext.length;
              return this;
            }, "unput"),
            // When called from action, caches matched text and appends it on next action
            more: /* @__PURE__ */ __name(function() {
              this._more = true;
              return this;
            }, "more"),
            // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
            reject: /* @__PURE__ */ __name(function() {
              if (this.options.backtrack_lexer) {
                this._backtrack = true;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
              return this;
            }, "reject"),
            // retain first n characters of the match
            less: /* @__PURE__ */ __name(function(n2) {
              this.unput(this.match.slice(n2));
            }, "less"),
            // displays already matched input, i.e. for error messages
            pastInput: /* @__PURE__ */ __name(function() {
              var past = this.matched.substr(0, this.matched.length - this.match.length);
              return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
            }, "pastInput"),
            // displays upcoming input, i.e. for error messages
            upcomingInput: /* @__PURE__ */ __name(function() {
              var next3 = this.match;
              if (next3.length < 20) {
                next3 += this._input.substr(0, 20 - next3.length);
              }
              return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, "");
            }, "upcomingInput"),
            // displays the character position where the lexing error occurred, i.e. for error messages
            showPosition: /* @__PURE__ */ __name(function() {
              var pre = this.pastInput();
              var c3 = new Array(pre.length + 1).join("-");
              return pre + this.upcomingInput() + "\n" + c3 + "^";
            }, "showPosition"),
            // test the lexed token: return FALSE when not a match, otherwise return token
            test_match: /* @__PURE__ */ __name(function(match2, indexed_rule) {
              var token2, lines, backup;
              if (this.options.backtrack_lexer) {
                backup = {
                  yylineno: this.yylineno,
                  yylloc: {
                    first_line: this.yylloc.first_line,
                    last_line: this.last_line,
                    first_column: this.yylloc.first_column,
                    last_column: this.yylloc.last_column
                  },
                  yytext: this.yytext,
                  match: this.match,
                  matches: this.matches,
                  matched: this.matched,
                  yyleng: this.yyleng,
                  offset: this.offset,
                  _more: this._more,
                  _input: this._input,
                  yy: this.yy,
                  conditionStack: this.conditionStack.slice(0),
                  done: this.done
                };
                if (this.options.ranges) {
                  backup.yylloc.range = this.yylloc.range.slice(0);
                }
              }
              lines = match2[0].match(/(?:\r\n?|\n).*/g);
              if (lines) {
                this.yylineno += lines.length;
              }
              this.yylloc = {
                first_line: this.yylloc.last_line,
                last_line: this.yylineno + 1,
                first_column: this.yylloc.last_column,
                last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match2[0].length
              };
              this.yytext += match2[0];
              this.match += match2[0];
              this.matches = match2;
              this.yyleng = this.yytext.length;
              if (this.options.ranges) {
                this.yylloc.range = [this.offset, this.offset += this.yyleng];
              }
              this._more = false;
              this._backtrack = false;
              this._input = this._input.slice(match2[0].length);
              this.matched += match2[0];
              token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
              if (this.done && this._input) {
                this.done = false;
              }
              if (token2) {
                return token2;
              } else if (this._backtrack) {
                for (var k2 in backup) {
                  this[k2] = backup[k2];
                }
                return false;
              }
              return false;
            }, "test_match"),
            // return next match in input
            next: /* @__PURE__ */ __name(function() {
              if (this.done) {
                return this.EOF;
              }
              if (!this._input) {
                this.done = true;
              }
              var token2, match2, tempMatch, index;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i2 = 0; i2 < rules.length; i2++) {
                tempMatch = this._input.match(this.rules[rules[i2]]);
                if (tempMatch && (!match2 || tempMatch[0].length > match2[0].length)) {
                  match2 = tempMatch;
                  index = i2;
                  if (this.options.backtrack_lexer) {
                    token2 = this.test_match(tempMatch, rules[i2]);
                    if (token2 !== false) {
                      return token2;
                    } else if (this._backtrack) {
                      match2 = false;
                      continue;
                    } else {
                      return false;
                    }
                  } else if (!this.options.flex) {
                    break;
                  }
                }
              }
              if (match2) {
                token2 = this.test_match(match2, rules[index]);
                if (token2 !== false) {
                  return token2;
                }
                return false;
              }
              if (this._input === "") {
                return this.EOF;
              } else {
                return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
                  text: "",
                  token: null,
                  line: this.yylineno
                });
              }
            }, "next"),
            // return next match that has a token
            lex: /* @__PURE__ */ __name(function lex() {
              var r2 = this.next();
              if (r2) {
                return r2;
              } else {
                return this.lex();
              }
            }, "lex"),
            // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
            begin: /* @__PURE__ */ __name(function begin(condition) {
              this.conditionStack.push(condition);
            }, "begin"),
            // pop the previously active lexer condition state off the condition stack
            popState: /* @__PURE__ */ __name(function popState() {
              var n2 = this.conditionStack.length - 1;
              if (n2 > 0) {
                return this.conditionStack.pop();
              } else {
                return this.conditionStack[0];
              }
            }, "popState"),
            // produce the lexer rule set which is active for the currently active lexer condition state
            _currentRules: /* @__PURE__ */ __name(function _currentRules() {
              if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
                return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
              } else {
                return this.conditions["INITIAL"].rules;
              }
            }, "_currentRules"),
            // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
            topState: /* @__PURE__ */ __name(function topState(n2) {
              n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0);
              if (n2 >= 0) {
                return this.conditionStack[n2];
              } else {
                return "INITIAL";
              }
            }, "topState"),
            // alias for begin(condition)
            pushState: /* @__PURE__ */ __name(function pushState(condition) {
              this.begin(condition);
            }, "pushState"),
            // return the number of states currently on the stack
            stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
              return this.conditionStack.length;
            }, "stateStackSize"),
            options: { "case-insensitive": true },
            performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
              var YYSTATE = YY_START;
              switch ($avoiding_name_collisions) {
                case 0:
                  break;
                case 1:
                  break;
                case 2:
                  break;
                case 3:
                  if (yy.getIndentMode && yy.getIndentMode()) {
                    yy.consumeIndentText = true;
                    this.begin("INITIAL");
                    return 22;
                  }
                  break;
                case 4:
                  break;
                case 5:
                  if (yy.setIndentMode) {
                    yy.setIndentMode(false);
                  }
                  this.begin("INITIAL");
                  this.unput(yy_.yytext);
                  break;
                case 6:
                  this.begin("bol");
                  return 8;
                  break;
                case 7:
                  break;
                case 8:
                  break;
                case 9:
                  return 7;
                  break;
                case 10:
                  return 11;
                  break;
                case 11:
                  return 5;
                  break;
                case 12:
                  return 12;
                  break;
                case 13:
                  return 17;
                  break;
                case 14:
                  if (yy.consumeIndentText) {
                    yy.consumeIndentText = false;
                  } else {
                    return 19;
                  }
                  break;
                case 15:
                  return 24;
                  break;
                case 16:
                  yy_.yytext = yy_.yytext.slice(2, -2);
                  return 14;
                  break;
                case 17:
                  yy_.yytext = yy_.yytext.slice(1, -1).trim();
                  return 14;
                  break;
                case 18:
                  return 16;
                  break;
                case 19:
                  return 31;
                  break;
                case 20:
                  return 33;
                  break;
                case 21:
                  return 32;
                  break;
                case 22:
                  return 20;
                  break;
                case 23:
                  return 21;
                  break;
                case 24:
                  return 27;
                  break;
                case 25:
                  return 15;
                  break;
              }
            }, "anonymous"),
            rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[ \t]+(?=[\n\r]))/i, /^(?:[ \t]+(?=text\b))/i, /^(?:[ \t]+)/i, /^(?:[^ \t\n\r])/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:[ \t]+)/i, /^(?:$)/i, /^(?:title\s[^#\n;]+)/i, /^(?:venn-beta\b)/i, /^(?:set\b)/i, /^(?:union\b)/i, /^(?:text\b)/i, /^(?:style\b)/i, /^(?:\["[^\"]*"\])/i, /^(?:\[[^\]\"]+\])/i, /^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i, /^(?:#[0-9a-fA-F]{3,8})/i, /^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i, /^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i, /^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i, /^(?:"[^\"]*")/i, /^(?:,)/i, /^(?::)/i],
            conditions: { "bol": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], "inclusive": true }, "INITIAL": { "rules": [0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], "inclusive": true } }
          };
          return lexer2;
        })();
        parser28.lexer = lexer;
        function Parser3() {
          this.yy = {};
        }
        __name(Parser3, "Parser");
        Parser3.prototype = parser28;
        parser28.Parser = Parser3;
        return new Parser3();
      })();
      parser25.parser = parser25;
      venn_default = parser25;
    }
  });

  // src/diagrams/venn/vennDB.ts
  function getConfig7() {
    return cleanAndMerge(DEFAULT_VENN_CONFIG, getConfig().venn);
  }
  var subsets, textNodes, styleEntries, knownSets, currentSets, indentMode, addSubsetData, getSubsetData, normalizeText, normalizeStyleValue, addTextData, addStyleData, getStyleData, normalizeIdentifierList, validateUnionIdentifiers, getTextData, getCurrentSets, getIndentMode, setIndentMode, DEFAULT_VENN_CONFIG, customClear, db8;
  var init_vennDB = __esm({
    "src/diagrams/venn/vennDB.ts"() {
      "use strict";
      init_utils2();
      init_config();
      init_commonDb();
      init_defaultConfig();
      subsets = [];
      textNodes = [];
      styleEntries = [];
      knownSets = /* @__PURE__ */ new Set();
      indentMode = false;
      addSubsetData = /* @__PURE__ */ __name((identifierList, label, size4) => {
        const sets = normalizeIdentifierList(identifierList).sort();
        const resolvedSize = size4 ?? 10 / Math.pow(identifierList.length, 2);
        currentSets = sets;
        if (sets.length === 1) {
          knownSets.add(sets[0]);
        }
        subsets.push({
          sets,
          size: resolvedSize,
          label: label ? normalizeText(label) : void 0
        });
      }, "addSubsetData");
      getSubsetData = /* @__PURE__ */ __name(() => {
        return subsets;
      }, "getSubsetData");
      normalizeText = /* @__PURE__ */ __name((text4) => {
        const trimmed = text4.trim();
        if (trimmed.length >= 2 && trimmed.startsWith('"') && trimmed.endsWith('"')) {
          return trimmed.slice(1, -1);
        }
        return trimmed;
      }, "normalizeText");
      normalizeStyleValue = /* @__PURE__ */ __name((value2) => {
        return value2 ? normalizeText(value2) : value2;
      }, "normalizeStyleValue");
      addTextData = /* @__PURE__ */ __name((identifierList, id34, label) => {
        const normalizedId = normalizeText(id34);
        textNodes.push({
          sets: normalizeIdentifierList(identifierList).sort(),
          id: normalizedId,
          label: label ? normalizeText(label) : void 0
        });
      }, "addTextData");
      addStyleData = /* @__PURE__ */ __name((identifierList, data5) => {
        const targets = normalizeIdentifierList(identifierList).sort();
        const styles5 = {};
        for (const [key, value2] of data5) {
          styles5[key] = normalizeStyleValue(value2) ?? value2;
        }
        styleEntries.push({ targets, styles: styles5 });
      }, "addStyleData");
      getStyleData = /* @__PURE__ */ __name(() => {
        return styleEntries;
      }, "getStyleData");
      normalizeIdentifierList = /* @__PURE__ */ __name((identifierList) => {
        return identifierList.map((identifier2) => normalizeText(identifier2));
      }, "normalizeIdentifierList");
      validateUnionIdentifiers = /* @__PURE__ */ __name((identifierList) => {
        const normalized = normalizeIdentifierList(identifierList);
        const unknown = normalized.filter((identifier2) => !knownSets.has(identifier2));
        if (unknown.length > 0) {
          throw new Error(`unknown set identifier: ${unknown.join(", ")}`);
        }
      }, "validateUnionIdentifiers");
      getTextData = /* @__PURE__ */ __name(() => {
        return textNodes;
      }, "getTextData");
      getCurrentSets = /* @__PURE__ */ __name(() => currentSets, "getCurrentSets");
      getIndentMode = /* @__PURE__ */ __name(() => indentMode, "getIndentMode");
      setIndentMode = /* @__PURE__ */ __name((enabled) => {
        indentMode = enabled;
      }, "setIndentMode");
      DEFAULT_VENN_CONFIG = defaultConfig_default.venn;
      __name(getConfig7, "getConfig");
      customClear = /* @__PURE__ */ __name(() => {
        clear();
        subsets.length = 0;
        textNodes.length = 0;
        styleEntries.length = 0;
        knownSets.clear();
        currentSets = void 0;
        indentMode = false;
      }, "customClear");
      db8 = {
        getConfig: getConfig7,
        clear: customClear,
        setAccTitle,
        getAccTitle,
        setDiagramTitle,
        getDiagramTitle,
        getAccDescription,
        setAccDescription,
        addSubsetData,
        getSubsetData,
        addTextData,
        addStyleData,
        validateUnionIdentifiers,
        getTextData,
        getStyleData,
        getCurrentSets,
        getIndentMode,
        setIndentMode
      };
    }
  });

  // src/diagrams/venn/styles.ts
  var getStyles20, styles_default18;
  var init_styles20 = __esm({
    "src/diagrams/venn/styles.ts"() {
      "use strict";
      getStyles20 = /* @__PURE__ */ __name((options2) => `
  .venn-title {
    font-size: 32px;
    fill: ${options2.vennTitleTextColor};
    font-family: ${options2.fontFamily};
  }

  .venn-circle text {
    font-size: 48px;
    font-family: ${options2.fontFamily};
  }

  .venn-intersection text {
    font-size: 48px;
    fill: ${options2.vennSetTextColor};
    font-family: ${options2.fontFamily};
  }

  .venn-text-node {
    font-family: ${options2.fontFamily};
    color: ${options2.vennSetTextColor};
  }
`, "getStyles");
      styles_default18 = getStyles20;
    }
  });

  // ../../node_modules/.pnpm/@upsetjs+venn.js@2.0.0/node_modules/@upsetjs/venn.js/build/venn.esm.js
  function intersectionArea(circles, stats) {
    const intersectionPoints = getIntersectionPoints(circles);
    const innerPoints = intersectionPoints.filter((p3) => containedInCircles(p3, circles));
    let arcArea = 0;
    let polygonArea = 0;
    const arcs = [];
    if (innerPoints.length > 1) {
      const center4 = getCenter(innerPoints);
      for (let i2 = 0; i2 < innerPoints.length; ++i2) {
        const p3 = innerPoints[i2];
        p3.angle = Math.atan2(p3.x - center4.x, p3.y - center4.y);
      }
      innerPoints.sort((a2, b3) => b3.angle - a2.angle);
      let p22 = innerPoints[innerPoints.length - 1];
      for (let i2 = 0; i2 < innerPoints.length; ++i2) {
        const p1 = innerPoints[i2];
        polygonArea += (p22.x + p1.x) * (p1.y - p22.y);
        const midPoint = { x: (p1.x + p22.x) / 2, y: (p1.y + p22.y) / 2 };
        let arc = null;
        for (let j3 = 0; j3 < p1.parentIndex.length; ++j3) {
          if (p22.parentIndex.includes(p1.parentIndex[j3])) {
            const circle6 = circles[p1.parentIndex[j3]];
            const a1 = Math.atan2(p1.x - circle6.x, p1.y - circle6.y);
            const a2 = Math.atan2(p22.x - circle6.x, p22.y - circle6.y);
            let angleDiff = a2 - a1;
            if (angleDiff < 0) {
              angleDiff += 2 * Math.PI;
            }
            const a3 = a2 - angleDiff / 2;
            let width3 = distance2(midPoint, {
              x: circle6.x + circle6.radius * Math.sin(a3),
              y: circle6.y + circle6.radius * Math.cos(a3)
            });
            if (width3 > circle6.radius * 2) {
              width3 = circle6.radius * 2;
            }
            if (arc == null || arc.width > width3) {
              arc = { circle: circle6, width: width3, p1, p2: p22, large: width3 > circle6.radius, sweep: true };
            }
          }
        }
        if (arc != null) {
          arcs.push(arc);
          arcArea += circleArea(arc.circle.radius, arc.width);
          p22 = p1;
        }
      }
    } else {
      let smallest = circles[0];
      for (let i2 = 1; i2 < circles.length; ++i2) {
        if (circles[i2].radius < smallest.radius) {
          smallest = circles[i2];
        }
      }
      let disjoint = false;
      for (let i2 = 0; i2 < circles.length; ++i2) {
        if (distance2(circles[i2], smallest) > Math.abs(smallest.radius - circles[i2].radius)) {
          disjoint = true;
          break;
        }
      }
      if (disjoint) {
        arcArea = polygonArea = 0;
      } else {
        arcArea = smallest.radius * smallest.radius * Math.PI;
        arcs.push({
          circle: smallest,
          p1: { x: smallest.x, y: smallest.y + smallest.radius },
          p2: { x: smallest.x - SMALL$1, y: smallest.y + smallest.radius },
          width: smallest.radius * 2,
          large: true,
          sweep: true
        });
      }
    }
    polygonArea /= 2;
    if (stats) {
      stats.area = arcArea + polygonArea;
      stats.arcArea = arcArea;
      stats.polygonArea = polygonArea;
      stats.arcs = arcs;
      stats.innerPoints = innerPoints;
      stats.intersectionPoints = intersectionPoints;
    }
    return arcArea + polygonArea;
  }
  function containedInCircles(point8, circles) {
    return circles.every((circle6) => distance2(point8, circle6) < circle6.radius + SMALL$1);
  }
  function getIntersectionPoints(circles) {
    const ret = [];
    for (let i2 = 0; i2 < circles.length; ++i2) {
      for (let j3 = i2 + 1; j3 < circles.length; ++j3) {
        const intersect3 = circleCircleIntersection(circles[i2], circles[j3]);
        for (const p3 of intersect3) {
          p3.parentIndex = [i2, j3];
          ret.push(p3);
        }
      }
    }
    return ret;
  }
  function circleArea(r2, width3) {
    return r2 * r2 * Math.acos(1 - width3 / r2) - (r2 - width3) * Math.sqrt(width3 * (2 * r2 - width3));
  }
  function distance2(p1, p22) {
    return Math.sqrt((p1.x - p22.x) * (p1.x - p22.x) + (p1.y - p22.y) * (p1.y - p22.y));
  }
  function circleOverlap(r1, r2, d3) {
    if (d3 >= r1 + r2) {
      return 0;
    }
    if (d3 <= Math.abs(r1 - r2)) {
      return Math.PI * Math.min(r1, r2) * Math.min(r1, r2);
    }
    const w1 = r1 - (d3 * d3 - r2 * r2 + r1 * r1) / (2 * d3);
    const w22 = r2 - (d3 * d3 - r1 * r1 + r2 * r2) / (2 * d3);
    return circleArea(r1, w1) + circleArea(r2, w22);
  }
  function circleCircleIntersection(p1, p22) {
    const d3 = distance2(p1, p22);
    const r1 = p1.radius;
    const r2 = p22.radius;
    if (d3 >= r1 + r2 || d3 <= Math.abs(r1 - r2)) {
      return [];
    }
    const a2 = (r1 * r1 - r2 * r2 + d3 * d3) / (2 * d3);
    const h3 = Math.sqrt(r1 * r1 - a2 * a2);
    const x0 = p1.x + a2 * (p22.x - p1.x) / d3;
    const y0 = p1.y + a2 * (p22.y - p1.y) / d3;
    const rx = -(p22.y - p1.y) * (h3 / d3);
    const ry = -(p22.x - p1.x) * (h3 / d3);
    return [
      { x: x0 + rx, y: y0 - ry },
      { x: x0 - rx, y: y0 + ry }
    ];
  }
  function getCenter(points) {
    const center4 = { x: 0, y: 0 };
    for (const point8 of points) {
      center4.x += point8.x;
      center4.y += point8.y;
    }
    center4.x /= points.length;
    center4.y /= points.length;
    return center4;
  }
  function bisect(f2, a2, b3, parameters) {
    parameters = parameters || {};
    const maxIterations = parameters.maxIterations || 100;
    const tolerance = parameters.tolerance || 1e-10;
    const fA = f2(a2);
    const fB = f2(b3);
    let delta = b3 - a2;
    if (fA * fB > 0) {
      throw "Initial bisect points must have opposite signs";
    }
    if (fA === 0) return a2;
    if (fB === 0) return b3;
    for (let i2 = 0; i2 < maxIterations; ++i2) {
      delta /= 2;
      const mid = a2 + delta;
      const fMid = f2(mid);
      if (fMid * fA >= 0) {
        a2 = mid;
      }
      if (Math.abs(delta) < tolerance || fMid === 0) {
        return mid;
      }
    }
    return a2 + delta;
  }
  function zeros(x5) {
    const r2 = new Array(x5);
    for (let i2 = 0; i2 < x5; ++i2) {
      r2[i2] = 0;
    }
    return r2;
  }
  function zerosM(x5, y6) {
    return zeros(x5).map(() => zeros(y6));
  }
  function dot(a2, b3) {
    let ret = 0;
    for (let i2 = 0; i2 < a2.length; ++i2) {
      ret += a2[i2] * b3[i2];
    }
    return ret;
  }
  function norm2(a2) {
    return Math.sqrt(dot(a2, a2));
  }
  function scale2(ret, value2, c3) {
    for (let i2 = 0; i2 < value2.length; ++i2) {
      ret[i2] = value2[i2] * c3;
    }
  }
  function weightedSum(ret, w1, v12, w22, v23) {
    for (let j3 = 0; j3 < ret.length; ++j3) {
      ret[j3] = w1 * v12[j3] + w22 * v23[j3];
    }
  }
  function nelderMead(f2, x0, parameters) {
    parameters = parameters || {};
    const maxIterations = parameters.maxIterations || x0.length * 200;
    const nonZeroDelta = parameters.nonZeroDelta || 1.05;
    const zeroDelta = parameters.zeroDelta || 1e-3;
    const minErrorDelta = parameters.minErrorDelta || 1e-6;
    const minTolerance = parameters.minErrorDelta || 1e-5;
    const rho = parameters.rho !== void 0 ? parameters.rho : 1;
    const chi = parameters.chi !== void 0 ? parameters.chi : 2;
    const psi = parameters.psi !== void 0 ? parameters.psi : -0.5;
    const sigma = parameters.sigma !== void 0 ? parameters.sigma : 0.5;
    let maxDiff;
    const N3 = x0.length;
    const simplex = new Array(N3 + 1);
    simplex[0] = x0;
    simplex[0].fx = f2(x0);
    simplex[0].id = 0;
    for (let i2 = 0; i2 < N3; ++i2) {
      const point8 = x0.slice();
      point8[i2] = point8[i2] ? point8[i2] * nonZeroDelta : zeroDelta;
      simplex[i2 + 1] = point8;
      simplex[i2 + 1].fx = f2(point8);
      simplex[i2 + 1].id = i2 + 1;
    }
    function updateSimplex(value2) {
      for (let i2 = 0; i2 < value2.length; i2++) {
        simplex[N3][i2] = value2[i2];
      }
      simplex[N3].fx = value2.fx;
    }
    __name(updateSimplex, "updateSimplex");
    const sortOrder = /* @__PURE__ */ __name((a2, b3) => a2.fx - b3.fx, "sortOrder");
    const centroid = x0.slice();
    const reflected = x0.slice();
    const contracted = x0.slice();
    const expanded = x0.slice();
    for (let iteration = 0; iteration < maxIterations; ++iteration) {
      simplex.sort(sortOrder);
      if (parameters.history) {
        const sortedSimplex = simplex.map((x5) => {
          const state4 = x5.slice();
          state4.fx = x5.fx;
          state4.id = x5.id;
          return state4;
        });
        sortedSimplex.sort((a2, b3) => a2.id - b3.id);
        parameters.history.push({
          x: simplex[0].slice(),
          fx: simplex[0].fx,
          simplex: sortedSimplex
        });
      }
      maxDiff = 0;
      for (let i2 = 0; i2 < N3; ++i2) {
        maxDiff = Math.max(maxDiff, Math.abs(simplex[0][i2] - simplex[1][i2]));
      }
      if (Math.abs(simplex[0].fx - simplex[N3].fx) < minErrorDelta && maxDiff < minTolerance) {
        break;
      }
      for (let i2 = 0; i2 < N3; ++i2) {
        centroid[i2] = 0;
        for (let j3 = 0; j3 < N3; ++j3) {
          centroid[i2] += simplex[j3][i2];
        }
        centroid[i2] /= N3;
      }
      const worst = simplex[N3];
      weightedSum(reflected, 1 + rho, centroid, -rho, worst);
      reflected.fx = f2(reflected);
      if (reflected.fx < simplex[0].fx) {
        weightedSum(expanded, 1 + chi, centroid, -chi, worst);
        expanded.fx = f2(expanded);
        if (expanded.fx < reflected.fx) {
          updateSimplex(expanded);
        } else {
          updateSimplex(reflected);
        }
      } else if (reflected.fx >= simplex[N3 - 1].fx) {
        let shouldReduce = false;
        if (reflected.fx > worst.fx) {
          weightedSum(contracted, 1 + psi, centroid, -psi, worst);
          contracted.fx = f2(contracted);
          if (contracted.fx < worst.fx) {
            updateSimplex(contracted);
          } else {
            shouldReduce = true;
          }
        } else {
          weightedSum(contracted, 1 - psi * rho, centroid, psi * rho, worst);
          contracted.fx = f2(contracted);
          if (contracted.fx < reflected.fx) {
            updateSimplex(contracted);
          } else {
            shouldReduce = true;
          }
        }
        if (shouldReduce) {
          if (sigma >= 1) break;
          for (let i2 = 1; i2 < simplex.length; ++i2) {
            weightedSum(simplex[i2], 1 - sigma, simplex[0], sigma, simplex[i2]);
            simplex[i2].fx = f2(simplex[i2]);
          }
        }
      } else {
        updateSimplex(reflected);
      }
    }
    simplex.sort(sortOrder);
    return { fx: simplex[0].fx, x: simplex[0] };
  }
  function wolfeLineSearch(f2, pk, current, next3, a2, c1, c22) {
    const phi0 = current.fx;
    const phiPrime0 = dot(current.fxprime, pk);
    let phi2 = phi0;
    let phi_old = phi0;
    let phiPrime = phiPrime0;
    let a0 = 0;
    a2 = a2 || 1;
    c1 = c1 || 1e-6;
    c22 = c22 || 0.1;
    function zoom2(a_lo, a_high, phi_lo) {
      for (let iteration = 0; iteration < 16; ++iteration) {
        a2 = (a_lo + a_high) / 2;
        weightedSum(next3.x, 1, current.x, a2, pk);
        phi2 = next3.fx = f2(next3.x, next3.fxprime);
        phiPrime = dot(next3.fxprime, pk);
        if (phi2 > phi0 + c1 * a2 * phiPrime0 || phi2 >= phi_lo) {
          a_high = a2;
        } else {
          if (Math.abs(phiPrime) <= -c22 * phiPrime0) {
            return a2;
          }
          if (phiPrime * (a_high - a_lo) >= 0) {
            a_high = a_lo;
          }
          a_lo = a2;
          phi_lo = phi2;
        }
      }
      return 0;
    }
    __name(zoom2, "zoom");
    for (let iteration = 0; iteration < 10; ++iteration) {
      weightedSum(next3.x, 1, current.x, a2, pk);
      phi2 = next3.fx = f2(next3.x, next3.fxprime);
      phiPrime = dot(next3.fxprime, pk);
      if (phi2 > phi0 + c1 * a2 * phiPrime0 || iteration && phi2 >= phi_old) {
        return zoom2(a0, a2, phi_old);
      }
      if (Math.abs(phiPrime) <= -c22 * phiPrime0) {
        return a2;
      }
      if (phiPrime >= 0) {
        return zoom2(a2, a0, phi2);
      }
      phi_old = phi2;
      a0 = a2;
      a2 *= 2;
    }
    return a2;
  }
  function conjugateGradient(f2, initial, params) {
    let current = { x: initial.slice(), fx: 0, fxprime: initial.slice() };
    let next3 = { x: initial.slice(), fx: 0, fxprime: initial.slice() };
    const yk = initial.slice();
    let pk;
    let temp;
    let a2 = 1;
    let maxIterations;
    params = params || {};
    maxIterations = params.maxIterations || initial.length * 20;
    current.fx = f2(current.x, current.fxprime);
    pk = current.fxprime.slice();
    scale2(pk, current.fxprime, -1);
    for (let i2 = 0; i2 < maxIterations; ++i2) {
      a2 = wolfeLineSearch(f2, pk, current, next3, a2);
      if (params.history) {
        params.history.push({
          x: current.x.slice(),
          fx: current.fx,
          fxprime: current.fxprime.slice(),
          alpha: a2
        });
      }
      if (!a2) {
        scale2(pk, current.fxprime, -1);
      } else {
        weightedSum(yk, 1, next3.fxprime, -1, current.fxprime);
        const delta_k = dot(current.fxprime, current.fxprime);
        const beta_k = Math.max(0, dot(yk, next3.fxprime) / delta_k);
        weightedSum(pk, beta_k, pk, -1, next3.fxprime);
        temp = current;
        current = next3;
        next3 = temp;
      }
      if (norm2(current.fxprime) <= 1e-5) {
        break;
      }
    }
    if (params.history) {
      params.history.push({
        x: current.x.slice(),
        fx: current.fx,
        fxprime: current.fxprime.slice(),
        alpha: a2
      });
    }
    return current;
  }
  function venn(sets, parameters = {}) {
    parameters.maxIterations = parameters.maxIterations || 500;
    const initialLayout = parameters.initialLayout || bestInitialLayout;
    const loss = parameters.lossFunction || lossFunction;
    const areas = addMissingAreas(sets, parameters);
    const circles = initialLayout(areas, parameters);
    const setids = Object.keys(circles);
    const initial = [];
    for (const setid of setids) {
      initial.push(circles[setid].x);
      initial.push(circles[setid].y);
    }
    const solution = nelderMead(
      (values2) => {
        const current = {};
        for (let i2 = 0; i2 < setids.length; ++i2) {
          const setid = setids[i2];
          current[setid] = {
            x: values2[2 * i2],
            y: values2[2 * i2 + 1],
            radius: circles[setid].radius
            // size : circles[setid].size
          };
        }
        return loss(current, areas);
      },
      initial,
      parameters
    );
    const positions2 = solution.x;
    for (let i2 = 0; i2 < setids.length; ++i2) {
      const setid = setids[i2];
      circles[setid].x = positions2[2 * i2];
      circles[setid].y = positions2[2 * i2 + 1];
    }
    return circles;
  }
  function distanceFromIntersectArea(r1, r2, overlap) {
    if (Math.min(r1, r2) * Math.min(r1, r2) * Math.PI <= overlap + SMALL) {
      return Math.abs(r1 - r2);
    }
    return bisect((distance3) => circleOverlap(r1, r2, distance3) - overlap, 0, r1 + r2);
  }
  function addMissingAreas(areas, parameters = {}) {
    const distinct = parameters.distinct;
    const r2 = areas.map((s2) => Object.assign({}, s2));
    function toKey2(arr) {
      return arr.join(";");
    }
    __name(toKey2, "toKey");
    if (distinct) {
      const count2 = /* @__PURE__ */ new Map();
      for (const area of r2) {
        for (let i2 = 0; i2 < area.sets.length; i2++) {
          const si = String(area.sets[i2]);
          count2.set(si, area.size + (count2.get(si) || 0));
          for (let j3 = i2 + 1; j3 < area.sets.length; j3++) {
            const sj = String(area.sets[j3]);
            const k1 = `${si};${sj}`;
            const k2 = `${sj};${si}`;
            count2.set(k1, area.size + (count2.get(k1) || 0));
            count2.set(k2, area.size + (count2.get(k2) || 0));
          }
        }
      }
      for (const area of r2) {
        if (area.sets.length < 3) {
          area.size = count2.get(toKey2(area.sets));
        }
      }
    }
    const ids = [];
    const pairs2 = /* @__PURE__ */ new Set();
    for (const area of r2) {
      if (area.sets.length === 1) {
        ids.push(area.sets[0]);
      } else if (area.sets.length === 2) {
        const a2 = area.sets[0];
        const b3 = area.sets[1];
        pairs2.add(toKey2(area.sets));
        pairs2.add(toKey2([b3, a2]));
      }
    }
    ids.sort((a2, b3) => a2 === b3 ? 0 : a2 < b3 ? -1 : 1);
    for (let i2 = 0; i2 < ids.length; ++i2) {
      const a2 = ids[i2];
      for (let j3 = i2 + 1; j3 < ids.length; ++j3) {
        const b3 = ids[j3];
        if (!pairs2.has(toKey2([a2, b3]))) {
          r2.push({ sets: [a2, b3], size: 0 });
        }
      }
    }
    return r2;
  }
  function getDistanceMatrices(areas, sets, setids) {
    const distances2 = zerosM(sets.length, sets.length);
    const constraints = zerosM(sets.length, sets.length);
    areas.filter((x5) => x5.sets.length === 2).forEach((current) => {
      const left3 = setids[current.sets[0]];
      const right3 = setids[current.sets[1]];
      const r1 = Math.sqrt(sets[left3].size / Math.PI);
      const r2 = Math.sqrt(sets[right3].size / Math.PI);
      const distance3 = distanceFromIntersectArea(r1, r2, current.size);
      distances2[left3][right3] = distances2[right3][left3] = distance3;
      let c3 = 0;
      if (current.size + 1e-10 >= Math.min(sets[left3].size, sets[right3].size)) {
        c3 = 1;
      } else if (current.size <= 1e-10) {
        c3 = -1;
      }
      constraints[left3][right3] = constraints[right3][left3] = c3;
    });
    return { distances: distances2, constraints };
  }
  function constrainedMDSGradient(x5, fxprime, distances2, constraints) {
    for (let i2 = 0; i2 < fxprime.length; ++i2) {
      fxprime[i2] = 0;
    }
    let loss = 0;
    for (let i2 = 0; i2 < distances2.length; ++i2) {
      const xi = x5[2 * i2];
      const yi = x5[2 * i2 + 1];
      for (let j3 = i2 + 1; j3 < distances2.length; ++j3) {
        const xj = x5[2 * j3];
        const yj = x5[2 * j3 + 1];
        const dij = distances2[i2][j3];
        const constraint = constraints[i2][j3];
        const squaredDistance = (xj - xi) * (xj - xi) + (yj - yi) * (yj - yi);
        const distance3 = Math.sqrt(squaredDistance);
        const delta = squaredDistance - dij * dij;
        if (constraint > 0 && distance3 <= dij || constraint < 0 && distance3 >= dij) {
          continue;
        }
        loss += 2 * delta * delta;
        fxprime[2 * i2] += 4 * delta * (xi - xj);
        fxprime[2 * i2 + 1] += 4 * delta * (yi - yj);
        fxprime[2 * j3] += 4 * delta * (xj - xi);
        fxprime[2 * j3 + 1] += 4 * delta * (yj - yi);
      }
    }
    return loss;
  }
  function bestInitialLayout(areas, params = {}) {
    let initial = greedyLayout(areas, params);
    const loss = params.lossFunction || lossFunction;
    if (areas.length >= 8) {
      const constrained = constrainedMDSLayout(areas, params);
      const constrainedLoss = loss(constrained, areas);
      const greedyLoss = loss(initial, areas);
      if (constrainedLoss + 1e-8 < greedyLoss) {
        initial = constrained;
      }
    }
    return initial;
  }
  function constrainedMDSLayout(areas, params = {}) {
    const restarts = params.restarts || 10;
    const sets = [];
    const setids = {};
    for (const area of areas) {
      if (area.sets.length === 1) {
        setids[area.sets[0]] = sets.length;
        sets.push(area);
      }
    }
    let { distances: distances2, constraints } = getDistanceMatrices(areas, sets, setids);
    const norm = norm2(distances2.map(norm2)) / distances2.length;
    distances2 = distances2.map((row) => row.map((value2) => value2 / norm));
    const obj = /* @__PURE__ */ __name((x5, fxprime) => constrainedMDSGradient(x5, fxprime, distances2, constraints), "obj");
    let best = null;
    for (let i2 = 0; i2 < restarts; ++i2) {
      const initial = zeros(distances2.length * 2).map(Math.random);
      const current = conjugateGradient(obj, initial, params);
      if (!best || current.fx < best.fx) {
        best = current;
      }
    }
    const positions2 = best.x;
    const circles = {};
    for (let i2 = 0; i2 < sets.length; ++i2) {
      const set5 = sets[i2];
      circles[set5.sets[0]] = {
        x: positions2[2 * i2] * norm,
        y: positions2[2 * i2 + 1] * norm,
        radius: Math.sqrt(set5.size / Math.PI)
      };
    }
    if (params.history) {
      for (const h3 of params.history) {
        scale2(h3.x, norm);
      }
    }
    return circles;
  }
  function greedyLayout(areas, params) {
    const loss = params && params.lossFunction ? params.lossFunction : lossFunction;
    const circles = {};
    const setOverlaps = {};
    for (const area of areas) {
      if (area.sets.length === 1) {
        const set5 = area.sets[0];
        circles[set5] = {
          x: 1e10,
          y: 1e10,
          rowid: circles.length,
          size: area.size,
          radius: Math.sqrt(area.size / Math.PI)
        };
        setOverlaps[set5] = [];
      }
    }
    areas = areas.filter((a2) => a2.sets.length === 2);
    for (const current of areas) {
      let weight8 = current.weight != null ? current.weight : 1;
      const left3 = current.sets[0];
      const right3 = current.sets[1];
      if (current.size + SMALL >= Math.min(circles[left3].size, circles[right3].size)) {
        weight8 = 0;
      }
      setOverlaps[left3].push({ set: right3, size: current.size, weight: weight8 });
      setOverlaps[right3].push({ set: left3, size: current.size, weight: weight8 });
    }
    const mostOverlapped = [];
    Object.keys(setOverlaps).forEach((set5) => {
      let size4 = 0;
      for (let i2 = 0; i2 < setOverlaps[set5].length; ++i2) {
        size4 += setOverlaps[set5][i2].size * setOverlaps[set5][i2].weight;
      }
      mostOverlapped.push({ set: set5, size: size4 });
    });
    function sortOrder(a2, b3) {
      return b3.size - a2.size;
    }
    __name(sortOrder, "sortOrder");
    mostOverlapped.sort(sortOrder);
    const positioned = {};
    function isPositioned(element3) {
      return element3.set in positioned;
    }
    __name(isPositioned, "isPositioned");
    function positionSet(point8, index) {
      circles[index].x = point8.x;
      circles[index].y = point8.y;
      positioned[index] = true;
    }
    __name(positionSet, "positionSet");
    positionSet({ x: 0, y: 0 }, mostOverlapped[0].set);
    for (let i2 = 1; i2 < mostOverlapped.length; ++i2) {
      const setIndex = mostOverlapped[i2].set;
      const overlap = setOverlaps[setIndex].filter(isPositioned);
      const set5 = circles[setIndex];
      overlap.sort(sortOrder);
      if (overlap.length === 0) {
        throw "ERROR: missing pairwise overlap information";
      }
      const points = [];
      for (var j3 = 0; j3 < overlap.length; ++j3) {
        const p1 = circles[overlap[j3].set];
        const d1 = distanceFromIntersectArea(set5.radius, p1.radius, overlap[j3].size);
        points.push({ x: p1.x + d1, y: p1.y });
        points.push({ x: p1.x - d1, y: p1.y });
        points.push({ y: p1.y + d1, x: p1.x });
        points.push({ y: p1.y - d1, x: p1.x });
        for (let k2 = j3 + 1; k2 < overlap.length; ++k2) {
          const p22 = circles[overlap[k2].set];
          const d22 = distanceFromIntersectArea(set5.radius, p22.radius, overlap[k2].size);
          const extraPoints = circleCircleIntersection(
            { x: p1.x, y: p1.y, radius: d1 },
            { x: p22.x, y: p22.y, radius: d22 }
          );
          points.push(...extraPoints);
        }
      }
      let bestLoss = 1e50;
      let bestPoint = points[0];
      for (const point8 of points) {
        circles[setIndex].x = point8.x;
        circles[setIndex].y = point8.y;
        const localLoss = loss(circles, areas);
        if (localLoss < bestLoss) {
          bestLoss = localLoss;
          bestPoint = point8;
        }
      }
      positionSet(bestPoint, setIndex);
    }
    return circles;
  }
  function lossFunction(circles, overlaps) {
    let output2 = 0;
    for (const area of overlaps) {
      if (area.sets.length === 1) {
        continue;
      }
      let overlap;
      if (area.sets.length === 2) {
        const left3 = circles[area.sets[0]];
        const right3 = circles[area.sets[1]];
        overlap = circleOverlap(left3.radius, right3.radius, distance2(left3, right3));
      } else {
        overlap = intersectionArea(area.sets.map((d3) => circles[d3]));
      }
      const weight8 = area.weight != null ? area.weight : 1;
      output2 += weight8 * (overlap - area.size) * (overlap - area.size);
    }
    return output2;
  }
  function logRatioLossFunction(circles, overlaps) {
    let output2 = 0;
    for (const area of overlaps) {
      if (area.sets.length === 1) {
        continue;
      }
      let overlap;
      if (area.sets.length === 2) {
        const left3 = circles[area.sets[0]];
        const right3 = circles[area.sets[1]];
        overlap = circleOverlap(left3.radius, right3.radius, distance2(left3, right3));
      } else {
        overlap = intersectionArea(area.sets.map((d3) => circles[d3]));
      }
      const weight8 = area.weight != null ? area.weight : 1;
      const differenceFromIdeal = Math.log((overlap + 1) / (area.size + 1));
      output2 += weight8 * differenceFromIdeal * differenceFromIdeal;
    }
    return output2;
  }
  function orientateCircles(circles, orientation, orientationOrder) {
    if (orientationOrder == null) {
      circles.sort((a2, b3) => b3.radius - a2.radius);
    } else {
      circles.sort(orientationOrder);
    }
    if (circles.length > 0) {
      const largestX = circles[0].x;
      const largestY = circles[0].y;
      for (const circle6 of circles) {
        circle6.x -= largestX;
        circle6.y -= largestY;
      }
    }
    if (circles.length === 2) {
      const dist3 = distance2(circles[0], circles[1]);
      if (dist3 < Math.abs(circles[1].radius - circles[0].radius)) {
        circles[1].x = circles[0].x + circles[0].radius - circles[1].radius - 1e-10;
        circles[1].y = circles[0].y;
      }
    }
    if (circles.length > 1) {
      const rotation = Math.atan2(circles[1].x, circles[1].y) - orientation;
      const c3 = Math.cos(rotation);
      const s2 = Math.sin(rotation);
      for (const circle6 of circles) {
        const x5 = circle6.x;
        const y6 = circle6.y;
        circle6.x = c3 * x5 - s2 * y6;
        circle6.y = s2 * x5 + c3 * y6;
      }
    }
    if (circles.length > 2) {
      let angle2 = Math.atan2(circles[2].x, circles[2].y) - orientation;
      while (angle2 < 0) {
        angle2 += 2 * Math.PI;
      }
      while (angle2 > 2 * Math.PI) {
        angle2 -= 2 * Math.PI;
      }
      if (angle2 > Math.PI) {
        const slope = circles[1].y / (1e-10 + circles[1].x);
        for (const circle6 of circles) {
          var d3 = (circle6.x + slope * circle6.y) / (1 + slope * slope);
          circle6.x = 2 * d3 - circle6.x;
          circle6.y = 2 * d3 * slope - circle6.y;
        }
      }
    }
  }
  function disjointCluster(circles) {
    circles.forEach((circle6) => {
      circle6.parent = circle6;
    });
    function find4(circle6) {
      if (circle6.parent !== circle6) {
        circle6.parent = find4(circle6.parent);
      }
      return circle6.parent;
    }
    __name(find4, "find");
    function union2(x5, y6) {
      const xRoot = find4(x5);
      const yRoot = find4(y6);
      xRoot.parent = yRoot;
    }
    __name(union2, "union");
    for (let i2 = 0; i2 < circles.length; ++i2) {
      for (let j3 = i2 + 1; j3 < circles.length; ++j3) {
        const maxDistance = circles[i2].radius + circles[j3].radius;
        if (distance2(circles[i2], circles[j3]) + 1e-10 < maxDistance) {
          union2(circles[j3], circles[i2]);
        }
      }
    }
    const disjointClusters = /* @__PURE__ */ new Map();
    for (let i2 = 0; i2 < circles.length; ++i2) {
      const setid = find4(circles[i2]).parent.setid;
      if (!disjointClusters.has(setid)) {
        disjointClusters.set(setid, []);
      }
      disjointClusters.get(setid).push(circles[i2]);
    }
    circles.forEach((circle6) => {
      delete circle6.parent;
    });
    return Array.from(disjointClusters.values());
  }
  function getBoundingBox(circles) {
    const minMax = /* @__PURE__ */ __name((d3) => {
      const hi = circles.reduce((acc, c3) => Math.max(acc, c3[d3] + c3.radius), Number.NEGATIVE_INFINITY);
      const lo = circles.reduce((acc, c3) => Math.min(acc, c3[d3] - c3.radius), Number.POSITIVE_INFINITY);
      return { max: hi, min: lo };
    }, "minMax");
    return { xRange: minMax("x"), yRange: minMax("y") };
  }
  function normalizeSolution(solution, orientation, orientationOrder) {
    if (orientation == null) {
      orientation = Math.PI / 2;
    }
    let circles = fromObjectNotation(solution).map((d3) => Object.assign({}, d3));
    const clusters = disjointCluster(circles);
    for (const cluster of clusters) {
      orientateCircles(cluster, orientation, orientationOrder);
      const bounds4 = getBoundingBox(cluster);
      cluster.size = (bounds4.xRange.max - bounds4.xRange.min) * (bounds4.yRange.max - bounds4.yRange.min);
      cluster.bounds = bounds4;
    }
    clusters.sort((a2, b3) => b3.size - a2.size);
    circles = clusters[0];
    let returnBounds = circles.bounds;
    const spacing2 = (returnBounds.xRange.max - returnBounds.xRange.min) / 50;
    function addCluster(cluster, right3, bottom2) {
      if (!cluster) {
        return;
      }
      const bounds4 = cluster.bounds;
      let xOffset;
      let yOffset;
      if (right3) {
        xOffset = returnBounds.xRange.max - bounds4.xRange.min + spacing2;
      } else {
        xOffset = returnBounds.xRange.max - bounds4.xRange.max;
        const centreing = (bounds4.xRange.max - bounds4.xRange.min) / 2 - (returnBounds.xRange.max - returnBounds.xRange.min) / 2;
        if (centreing < 0) {
          xOffset += centreing;
        }
      }
      if (bottom2) {
        yOffset = returnBounds.yRange.max - bounds4.yRange.min + spacing2;
      } else {
        yOffset = returnBounds.yRange.max - bounds4.yRange.max;
        const centreing = (bounds4.yRange.max - bounds4.yRange.min) / 2 - (returnBounds.yRange.max - returnBounds.yRange.min) / 2;
        if (centreing < 0) {
          yOffset += centreing;
        }
      }
      for (const c3 of cluster) {
        c3.x += xOffset;
        c3.y += yOffset;
        circles.push(c3);
      }
    }
    __name(addCluster, "addCluster");
    let index = 1;
    while (index < clusters.length) {
      addCluster(clusters[index], true, false);
      addCluster(clusters[index + 1], false, true);
      addCluster(clusters[index + 2], true, true);
      index += 3;
      returnBounds = getBoundingBox(circles);
    }
    return toObjectNotation(circles);
  }
  function scaleSolution(solution, width3, height2, padding2, scaleToFit) {
    const circles = fromObjectNotation(solution);
    width3 -= 2 * padding2;
    height2 -= 2 * padding2;
    const { xRange, yRange } = getBoundingBox(circles);
    if (xRange.max === xRange.min || yRange.max === yRange.min) {
      console.log("not scaling solution: zero size detected");
      return solution;
    }
    let xScaling;
    let yScaling;
    if (scaleToFit) {
      const toScaleDiameter = Math.sqrt(scaleToFit / Math.PI) * 2;
      xScaling = width3 / toScaleDiameter;
      yScaling = height2 / toScaleDiameter;
    } else {
      xScaling = width3 / (xRange.max - xRange.min);
      yScaling = height2 / (yRange.max - yRange.min);
    }
    const scaling = Math.min(yScaling, xScaling);
    const xOffset = (width3 - (xRange.max - xRange.min) * scaling) / 2;
    const yOffset = (height2 - (yRange.max - yRange.min) * scaling) / 2;
    return toObjectNotation(
      circles.map((circle6) => ({
        radius: scaling * circle6.radius,
        x: padding2 + xOffset + (circle6.x - xRange.min) * scaling,
        y: padding2 + yOffset + (circle6.y - yRange.min) * scaling,
        setid: circle6.setid
      }))
    );
  }
  function toObjectNotation(circles) {
    const r2 = {};
    for (const circle6 of circles) {
      r2[circle6.setid] = circle6;
    }
    return r2;
  }
  function fromObjectNotation(solution) {
    const setids = Object.keys(solution);
    return setids.map((id34) => Object.assign(solution[id34], { setid: id34 }));
  }
  function VennDiagram(options2 = {}) {
    let useViewBox = false, width3 = 600, height2 = 350, padding2 = 15, duration = 1e3, orientation = Math.PI / 2, normalize4 = true, scaleToFit = null, wrap3 = true, styled = true, fontSize = null, orientationOrder = null, distinct = false, round = null, symmetricalTextCentre = options2 && options2.symmetricalTextCentre ? options2.symmetricalTextCentre : false, colourMap = {}, colourScheme = options2 && options2.colourScheme ? options2.colourScheme : options2 && options2.colorScheme ? options2.colorScheme : [
      "#1f77b4",
      "#ff7f0e",
      "#2ca02c",
      "#d62728",
      "#9467bd",
      "#8c564b",
      "#e377c2",
      "#7f7f7f",
      "#bcbd22",
      "#17becf"
    ], colourIndex = 0, colours = /* @__PURE__ */ __name(function(key) {
      if (key in colourMap) {
        return colourMap[key];
      }
      var ret = colourMap[key] = colourScheme[colourIndex];
      colourIndex += 1;
      if (colourIndex >= colourScheme.length) {
        colourIndex = 0;
      }
      return ret;
    }, "colours"), layoutFunction = venn, loss = lossFunction;
    function chart(selection2) {
      let data5 = selection2.datum();
      const toRemove = /* @__PURE__ */ new Set();
      data5.forEach((datum2) => {
        if (datum2.size == 0 && datum2.sets.length == 1) {
          toRemove.add(datum2.sets[0]);
        }
      });
      data5 = data5.filter((datum2) => !datum2.sets.some((set5) => toRemove.has(set5)));
      let circles = {};
      let textCentres = {};
      if (data5.length > 0) {
        let solution = layoutFunction(data5, { lossFunction: loss, distinct });
        if (normalize4) {
          solution = normalizeSolution(solution, orientation, orientationOrder);
        }
        circles = scaleSolution(solution, width3, height2, padding2, scaleToFit);
        textCentres = computeTextCentres(circles, data5, symmetricalTextCentre);
      }
      const labels = {};
      data5.forEach((datum2) => {
        if (datum2.label) {
          labels[datum2.sets] = datum2.label;
        }
      });
      function label(d3) {
        if (d3.sets in labels) {
          return labels[d3.sets];
        }
        if (d3.sets.length == 1) {
          return "" + d3.sets[0];
        }
      }
      __name(label, "label");
      selection2.selectAll("svg").data([circles]).enter().append("svg");
      const svg2 = selection2.select("svg");
      if (useViewBox) {
        svg2.attr("viewBox", `0 0 ${width3} ${height2}`);
      } else {
        svg2.attr("width", width3).attr("height", height2);
      }
      const previous = {};
      let hasPrevious = false;
      svg2.selectAll(".venn-area path").each(function(d3) {
        const path4 = this.getAttribute("d");
        if (d3.sets.length == 1 && path4 && !distinct) {
          hasPrevious = true;
          previous[d3.sets[0]] = circleFromPath(path4);
        }
      });
      function pathTween(d3) {
        return (t4) => {
          const c3 = d3.sets.map((set5) => {
            let start3 = previous[set5];
            let end2 = circles[set5];
            if (!start3) {
              start3 = { x: width3 / 2, y: height2 / 2, radius: 1 };
            }
            if (!end2) {
              end2 = { x: width3 / 2, y: height2 / 2, radius: 1 };
            }
            return {
              x: start3.x * (1 - t4) + end2.x * t4,
              y: start3.y * (1 - t4) + end2.y * t4,
              radius: start3.radius * (1 - t4) + end2.radius * t4
            };
          });
          return intersectionAreaPath(c3, round);
        };
      }
      __name(pathTween, "pathTween");
      const nodes5 = svg2.selectAll(".venn-area").data(data5, (d3) => d3.sets);
      const enter = nodes5.enter().append("g").attr(
        "class",
        (d3) => `venn-area venn-${d3.sets.length == 1 ? "circle" : "intersection"}${d3.colour || d3.color ? " venn-coloured" : ""}`
      ).attr("data-venn-sets", (d3) => d3.sets.join("_"));
      const enterPath = enter.append("path");
      const enterText = enter.append("text").attr("class", "label").text((d3) => label(d3)).attr("text-anchor", "middle").attr("dy", ".35em").attr("x", width3 / 2).attr("y", height2 / 2);
      if (styled) {
        enterPath.style("fill-opacity", "0").filter((d3) => d3.sets.length == 1).style("fill", (d3) => d3.colour ? d3.colour : d3.color ? d3.color : colours(d3.sets)).style("fill-opacity", ".25");
        enterText.style("fill", (d3) => {
          if (d3.colour || d3.color) {
            return "#FFF";
          }
          if (options2.textFill) {
            return options2.textFill;
          }
          return d3.sets.length == 1 ? colours(d3.sets) : "#444";
        });
      }
      function asTransition(s2) {
        if (typeof s2.transition === "function") {
          return s2.transition("venn").duration(duration);
        }
        return s2;
      }
      __name(asTransition, "asTransition");
      let update2 = selection2;
      if (hasPrevious && typeof update2.transition === "function") {
        update2 = asTransition(selection2);
        update2.selectAll("path").attrTween("d", pathTween);
      } else {
        update2.selectAll("path").attr("d", (d3) => intersectionAreaPath(d3.sets.map((set5) => circles[set5])), round);
      }
      const updateText = update2.selectAll("text").filter((d3) => d3.sets in textCentres).text((d3) => label(d3)).attr("x", (d3) => Math.floor(textCentres[d3.sets].x)).attr("y", (d3) => Math.floor(textCentres[d3.sets].y));
      if (wrap3) {
        if (hasPrevious) {
          if ("on" in updateText) {
            updateText.on("end", wrapText2(circles, label));
          } else {
            updateText.each("end", wrapText2(circles, label));
          }
        } else {
          updateText.each(wrapText2(circles, label));
        }
      }
      const exit = asTransition(nodes5.exit()).remove();
      if (typeof nodes5.transition === "function") {
        exit.selectAll("path").attrTween("d", pathTween);
      }
      const exitText = exit.selectAll("text").attr("x", width3 / 2).attr("y", height2 / 2);
      if (fontSize !== null) {
        enterText.style("font-size", "0px");
        updateText.style("font-size", fontSize);
        exitText.style("font-size", "0px");
      }
      return { circles, textCentres, nodes: nodes5, enter, update: update2, exit };
    }
    __name(chart, "chart");
    chart.wrap = function(_3) {
      if (!arguments.length) return wrap3;
      wrap3 = _3;
      return chart;
    };
    chart.useViewBox = function() {
      useViewBox = true;
      return chart;
    };
    chart.width = function(_3) {
      if (!arguments.length) return width3;
      width3 = _3;
      return chart;
    };
    chart.height = function(_3) {
      if (!arguments.length) return height2;
      height2 = _3;
      return chart;
    };
    chart.padding = function(_3) {
      if (!arguments.length) return padding2;
      padding2 = _3;
      return chart;
    };
    chart.distinct = function(_3) {
      if (!arguments.length) return distinct;
      distinct = _3;
      return chart;
    };
    chart.colours = function(_3) {
      if (!arguments.length) return colours;
      colours = _3;
      return chart;
    };
    chart.colors = function(_3) {
      if (!arguments.length) return colours;
      colours = _3;
      return chart;
    };
    chart.fontSize = function(_3) {
      if (!arguments.length) return fontSize;
      fontSize = _3;
      return chart;
    };
    chart.round = function(_3) {
      if (!arguments.length) return round;
      round = _3;
      return chart;
    };
    chart.duration = function(_3) {
      if (!arguments.length) return duration;
      duration = _3;
      return chart;
    };
    chart.layoutFunction = function(_3) {
      if (!arguments.length) return layoutFunction;
      layoutFunction = _3;
      return chart;
    };
    chart.normalize = function(_3) {
      if (!arguments.length) return normalize4;
      normalize4 = _3;
      return chart;
    };
    chart.scaleToFit = function(_3) {
      if (!arguments.length) return scaleToFit;
      scaleToFit = _3;
      return chart;
    };
    chart.styled = function(_3) {
      if (!arguments.length) return styled;
      styled = _3;
      return chart;
    };
    chart.orientation = function(_3) {
      if (!arguments.length) return orientation;
      orientation = _3;
      return chart;
    };
    chart.orientationOrder = function(_3) {
      if (!arguments.length) return orientationOrder;
      orientationOrder = _3;
      return chart;
    };
    chart.lossFunction = function(_3) {
      if (!arguments.length) return loss;
      loss = _3 === "default" ? lossFunction : _3 === "logRatio" ? logRatioLossFunction : _3;
      return chart;
    };
    return chart;
  }
  function wrapText2(circles, labeller) {
    return function(data5) {
      const text4 = this;
      const width3 = circles[data5.sets[0]].radius || 50;
      const label = labeller(data5) || "";
      const words = label.split(/\s+/).reverse();
      const maxLines = 3;
      const minChars = (label.length + words.length) / maxLines;
      let word = words.pop();
      let line2 = [word];
      let lineNumber = 0;
      const lineHeight = 1.1;
      text4.textContent = null;
      const tspans = [];
      function append3(word2) {
        const tspan2 = text4.ownerDocument.createElementNS(text4.namespaceURI, "tspan");
        tspan2.textContent = word2;
        tspans.push(tspan2);
        text4.append(tspan2);
        return tspan2;
      }
      __name(append3, "append");
      let tspan = append3(word);
      while (true) {
        word = words.pop();
        if (!word) {
          break;
        }
        line2.push(word);
        const joined = line2.join(" ");
        tspan.textContent = joined;
        if (joined.length > minChars && tspan.getComputedTextLength() > width3) {
          line2.pop();
          tspan.textContent = line2.join(" ");
          line2 = [word];
          tspan = append3(word);
          lineNumber++;
        }
      }
      const initial = 0.35 - lineNumber * lineHeight / 2;
      const x5 = text4.getAttribute("x");
      const y6 = text4.getAttribute("y");
      tspans.forEach((t4, i2) => {
        t4.setAttribute("x", x5);
        t4.setAttribute("y", y6);
        t4.setAttribute("dy", `${initial + i2 * lineHeight}em`);
      });
    };
  }
  function circleMargin(current, interior, exterior) {
    let margin = interior[0].radius - distance2(interior[0], current);
    for (let i2 = 1; i2 < interior.length; ++i2) {
      const m3 = interior[i2].radius - distance2(interior[i2], current);
      if (m3 <= margin) {
        margin = m3;
      }
    }
    for (let i2 = 0; i2 < exterior.length; ++i2) {
      const m3 = distance2(exterior[i2], current) - exterior[i2].radius;
      if (m3 <= margin) {
        margin = m3;
      }
    }
    return margin;
  }
  function computeTextCentre(interior, exterior, symmetricalTextCentre) {
    const points = [];
    for (const c3 of interior) {
      points.push({ x: c3.x, y: c3.y });
      points.push({ x: c3.x + c3.radius / 2, y: c3.y });
      points.push({ x: c3.x - c3.radius / 2, y: c3.y });
      points.push({ x: c3.x, y: c3.y + c3.radius / 2 });
      points.push({ x: c3.x, y: c3.y - c3.radius / 2 });
    }
    let initial = points[0];
    let margin = circleMargin(points[0], interior, exterior);
    for (let i2 = 1; i2 < points.length; ++i2) {
      const m3 = circleMargin(points[i2], interior, exterior);
      if (m3 >= margin) {
        initial = points[i2];
        margin = m3;
      }
    }
    const solution = nelderMead(
      (p3) => -1 * circleMargin({ x: p3[0], y: p3[1] }, interior, exterior),
      [initial.x, initial.y],
      { maxIterations: 500, minErrorDelta: 1e-10 }
    ).x;
    const ret = { x: symmetricalTextCentre ? 0 : solution[0], y: solution[1] };
    let valid2 = true;
    for (const i2 of interior) {
      if (distance2(ret, i2) > i2.radius) {
        valid2 = false;
        break;
      }
    }
    for (const e3 of exterior) {
      if (distance2(ret, e3) < e3.radius) {
        valid2 = false;
        break;
      }
    }
    if (valid2) {
      return ret;
    }
    if (interior.length == 1) {
      return { x: interior[0].x, y: interior[0].y };
    }
    const areaStats = {};
    intersectionArea(interior, areaStats);
    if (areaStats.arcs.length === 0) {
      return { x: 0, y: -1e3, disjoint: true };
    }
    if (areaStats.arcs.length == 1) {
      return { x: areaStats.arcs[0].circle.x, y: areaStats.arcs[0].circle.y };
    }
    if (exterior.length) {
      return computeTextCentre(interior, []);
    }
    return getCenter(areaStats.arcs.map((a2) => a2.p1));
  }
  function getOverlappingCircles(circles) {
    const ret = {};
    const circleids = Object.keys(circles);
    for (const circleid of circleids) {
      ret[circleid] = [];
    }
    for (let i2 = 0; i2 < circleids.length; i2++) {
      const ci = circleids[i2];
      const a2 = circles[ci];
      for (let j3 = i2 + 1; j3 < circleids.length; ++j3) {
        const cj = circleids[j3];
        const b3 = circles[cj];
        const d3 = distance2(a2, b3);
        if (d3 + b3.radius <= a2.radius + 1e-10) {
          ret[cj].push(ci);
        } else if (d3 + a2.radius <= b3.radius + 1e-10) {
          ret[ci].push(cj);
        }
      }
    }
    return ret;
  }
  function computeTextCentres(circles, areas, symmetricalTextCentre) {
    const ret = {};
    const overlapped = getOverlappingCircles(circles);
    for (let i2 = 0; i2 < areas.length; ++i2) {
      const area = areas[i2].sets;
      const areaids = {};
      const exclude = {};
      for (let j3 = 0; j3 < area.length; ++j3) {
        areaids[area[j3]] = true;
        const overlaps = overlapped[area[j3]];
        for (let k2 = 0; k2 < overlaps.length; ++k2) {
          exclude[overlaps[k2]] = true;
        }
      }
      const interior = [];
      const exterior = [];
      for (let setid in circles) {
        if (setid in areaids) {
          interior.push(circles[setid]);
        } else if (!(setid in exclude)) {
          exterior.push(circles[setid]);
        }
      }
      const centre = computeTextCentre(interior, exterior, symmetricalTextCentre);
      ret[area] = centre;
      if (centre.disjoint && areas[i2].size > 0) {
        console.log("WARNING: area " + area + " not represented on screen");
      }
    }
    return ret;
  }
  function circlePath(x5, y6, r2) {
    const ret = [];
    ret.push("\nM", x5, y6);
    ret.push("\nm", -r2, 0);
    ret.push("\na", r2, r2, 0, 1, 0, r2 * 2, 0);
    ret.push("\na", r2, r2, 0, 1, 0, -r2 * 2, 0);
    return ret.join(" ");
  }
  function circleFromPath(path4) {
    const tokens2 = path4.split(" ");
    return { x: Number.parseFloat(tokens2[1]), y: Number.parseFloat(tokens2[2]), radius: -Number.parseFloat(tokens2[4]) };
  }
  function intersectionAreaArcs(circles) {
    if (circles.length === 0) {
      return [];
    }
    const stats = {};
    intersectionArea(circles, stats);
    return stats.arcs;
  }
  function arcsToPath(arcs, round) {
    if (arcs.length === 0) {
      return "M 0 0";
    }
    const rFactor = Math.pow(10, round || 0);
    const r2 = round != null ? (v3) => Math.round(v3 * rFactor) / rFactor : (v3) => v3;
    if (arcs.length == 1) {
      const circle6 = arcs[0].circle;
      return circlePath(r2(circle6.x), r2(circle6.y), r2(circle6.radius));
    }
    const ret = ["\nM", r2(arcs[0].p2.x), r2(arcs[0].p2.y)];
    for (const arc of arcs) {
      const radius2 = r2(arc.circle.radius);
      ret.push("\nA", radius2, radius2, 0, arc.large ? 1 : 0, arc.sweep ? 1 : 0, r2(arc.p1.x), r2(arc.p1.y));
    }
    return ret.join(" ");
  }
  function intersectionAreaPath(circles, round) {
    return arcsToPath(intersectionAreaArcs(circles), round);
  }
  function layout6(data5, options2 = {}) {
    const {
      lossFunction: loss,
      layoutFunction: layout7 = venn,
      normalize: normalize4 = true,
      orientation = Math.PI / 2,
      orientationOrder,
      width: width3 = 600,
      height: height2 = 350,
      padding: padding2 = 15,
      scaleToFit = false,
      symmetricalTextCentre = false,
      distinct,
      round = 2
    } = options2;
    let solution = layout7(data5, {
      lossFunction: loss === "default" || !loss ? lossFunction : loss === "logRatio" ? logRatioLossFunction : loss,
      distinct
    });
    if (normalize4) {
      solution = normalizeSolution(solution, orientation, orientationOrder);
    }
    const circles = scaleSolution(solution, width3, height2, padding2, scaleToFit);
    const textCentres = computeTextCentres(circles, data5, symmetricalTextCentre);
    const circleLookup = new Map(
      Object.keys(circles).map((set5) => [
        set5,
        {
          set: set5,
          x: circles[set5].x,
          y: circles[set5].y,
          radius: circles[set5].radius
        }
      ])
    );
    const helpers = data5.map((area) => {
      const circles2 = area.sets.map((s2) => circleLookup.get(s2));
      const arcs = intersectionAreaArcs(circles2);
      const path4 = arcsToPath(arcs, round);
      return { circles: circles2, arcs, path: path4, area, has: new Set(area.sets) };
    });
    function genDistinctPath(sets) {
      let r2 = "";
      for (const e3 of helpers) {
        if (e3.has.size > sets.length && sets.every((s2) => e3.has.has(s2))) {
          r2 += " " + e3.path;
        }
      }
      return r2;
    }
    __name(genDistinctPath, "genDistinctPath");
    return helpers.map(({ circles: circles2, arcs, path: path4, area }) => {
      return {
        data: area,
        text: textCentres[area.sets],
        circles: circles2,
        arcs,
        path: path4,
        distinctPath: path4 + genDistinctPath(area.sets)
      };
    });
  }
  var SMALL$1, SMALL;
  var init_venn_esm = __esm({
    "../../node_modules/.pnpm/@upsetjs+venn.js@2.0.0/node_modules/@upsetjs/venn.js/build/venn.esm.js"() {
      "use strict";
      SMALL$1 = 1e-10;
      __name(intersectionArea, "intersectionArea");
      __name(containedInCircles, "containedInCircles");
      __name(getIntersectionPoints, "getIntersectionPoints");
      __name(circleArea, "circleArea");
      __name(distance2, "distance");
      __name(circleOverlap, "circleOverlap");
      __name(circleCircleIntersection, "circleCircleIntersection");
      __name(getCenter, "getCenter");
      __name(bisect, "bisect");
      __name(zeros, "zeros");
      __name(zerosM, "zerosM");
      __name(dot, "dot");
      __name(norm2, "norm2");
      __name(scale2, "scale");
      __name(weightedSum, "weightedSum");
      __name(nelderMead, "nelderMead");
      __name(wolfeLineSearch, "wolfeLineSearch");
      __name(conjugateGradient, "conjugateGradient");
      __name(venn, "venn");
      SMALL = 1e-10;
      __name(distanceFromIntersectArea, "distanceFromIntersectArea");
      __name(addMissingAreas, "addMissingAreas");
      __name(getDistanceMatrices, "getDistanceMatrices");
      __name(constrainedMDSGradient, "constrainedMDSGradient");
      __name(bestInitialLayout, "bestInitialLayout");
      __name(constrainedMDSLayout, "constrainedMDSLayout");
      __name(greedyLayout, "greedyLayout");
      __name(lossFunction, "lossFunction");
      __name(logRatioLossFunction, "logRatioLossFunction");
      __name(orientateCircles, "orientateCircles");
      __name(disjointCluster, "disjointCluster");
      __name(getBoundingBox, "getBoundingBox");
      __name(normalizeSolution, "normalizeSolution");
      __name(scaleSolution, "scaleSolution");
      __name(toObjectNotation, "toObjectNotation");
      __name(fromObjectNotation, "fromObjectNotation");
      __name(VennDiagram, "VennDiagram");
      __name(wrapText2, "wrapText");
      __name(circleMargin, "circleMargin");
      __name(computeTextCentre, "computeTextCentre");
      __name(getOverlappingCircles, "getOverlappingCircles");
      __name(computeTextCentres, "computeTextCentres");
      __name(circlePath, "circlePath");
      __name(circleFromPath, "circleFromPath");
      __name(intersectionAreaArcs, "intersectionAreaArcs");
      __name(arcsToPath, "arcsToPath");
      __name(intersectionAreaPath, "intersectionAreaPath");
      __name(layout6, "layout");
    }
  });

  // src/diagrams/venn/vennRenderer.ts
  function buildStyleByKey(styleData) {
    const map5 = /* @__PURE__ */ new Map();
    for (const entry of styleData) {
      const key = entry.targets.join("|");
      const existing = map5.get(key);
      if (existing) {
        Object.assign(existing, entry.styles);
      } else {
        map5.set(key, { ...entry.styles });
      }
    }
    return map5;
  }
  function stableSetsKey(setIds) {
    return setIds.join("|");
  }
  function renderTextNodes(config5, layoutByKey, dummyD3root, textNodes2, scale3, styleByKey) {
    const useDebugLayout = config5?.useDebugLayout ?? false;
    const vennSvg = dummyD3root.select("svg");
    const textGroup = vennSvg.append("g").attr("class", "venn-text-nodes");
    const nodesByArea = /* @__PURE__ */ new Map();
    for (const node2 of textNodes2) {
      const key = stableSetsKey(node2.sets);
      const existing = nodesByArea.get(key);
      if (existing) {
        existing.push(node2);
      } else {
        nodesByArea.set(key, [node2]);
      }
    }
    for (const [key, nodes5] of nodesByArea.entries()) {
      const area = layoutByKey.get(key);
      if (!area?.text) {
        continue;
      }
      const centerX = area.text.x;
      const centerY = area.text.y;
      const minCircleRadius = Math.min(...area.circles.map((c3) => c3.radius));
      const innerRadiusRaw = Math.min(
        ...area.circles.map((c3) => c3.radius - Math.hypot(centerX - c3.x, centerY - c3.y))
      );
      let innerRadius = Number.isFinite(innerRadiusRaw) ? Math.max(0, innerRadiusRaw) : 0;
      if (innerRadius === 0 && Number.isFinite(minCircleRadius)) {
        innerRadius = minCircleRadius * 0.6;
      }
      const areaGroup = textGroup.append("g").attr("class", "venn-text-area").attr("font-size", `${40 * scale3}px`);
      if (useDebugLayout) {
        areaGroup.append("circle").attr("class", "venn-text-debug-circle").attr("cx", centerX).attr("cy", centerY).attr("r", innerRadius).attr("fill", "none").attr("stroke", "purple").attr("stroke-width", 1.5 * scale3).attr("stroke-dasharray", `${6 * scale3} ${4 * scale3}`);
      }
      const innerWidth = Math.max(80 * scale3, innerRadius * 2 * 0.95);
      const innerHeight = Math.max(60 * scale3, innerRadius * 2 * 0.95);
      const hasLabel = area.data.label && area.data.label.length > 0;
      const labelOffsetBase = hasLabel ? Math.min(32 * scale3, innerRadius * 0.25) : 0;
      const labelOffset = labelOffsetBase + (nodes5.length <= 2 ? 30 * scale3 : 0);
      const startX2 = centerX - innerWidth / 2;
      const startY2 = centerY - innerHeight / 2 + labelOffset;
      const cols = Math.max(1, Math.ceil(Math.sqrt(nodes5.length)));
      const rows = Math.max(1, Math.ceil(nodes5.length / cols));
      const cellWidth = innerWidth / cols;
      const cellHeight = innerHeight / rows;
      for (const [i2, node2] of nodes5.entries()) {
        const col = i2 % cols;
        const row = Math.floor(i2 / cols);
        const x5 = startX2 + cellWidth * (col + 0.5);
        const y6 = startY2 + cellHeight * (row + 0.5);
        if (useDebugLayout) {
          areaGroup.append("rect").attr("class", "venn-text-debug-cell").attr("x", startX2 + cellWidth * col).attr("y", startY2 + cellHeight * row).attr("width", cellWidth).attr("height", cellHeight).attr("fill", "none").attr("stroke", "teal").attr("stroke-width", 1 * scale3).attr("stroke-dasharray", `${4 * scale3} ${3 * scale3}`);
        }
        const boxWidth = cellWidth * 0.9;
        const boxHeight = cellHeight * 0.9;
        const container2 = areaGroup.append("foreignObject").attr("class", "venn-text-node-fo").attr("width", boxWidth).attr("height", boxHeight).attr("x", x5 - boxWidth / 2).attr("y", y6 - boxHeight / 2).attr("overflow", "visible");
        const textColor = styleByKey.get(node2.id)?.color;
        const text4 = container2.append("xhtml:span").attr("class", "venn-text-node").style("display", "flex").style("width", "100%").style("height", "100%").style("white-space", "normal").style("align-items", "center").style("justify-content", "center").style("text-align", "center").style("overflow-wrap", "normal").style("word-break", "normal").text(node2.label ?? node2.id);
        if (textColor) {
          text4.style("color", textColor);
        }
      }
    }
  }
  var draw28, renderer11;
  var init_vennRenderer = __esm({
    "src/diagrams/venn/vennRenderer.ts"() {
      "use strict";
      init_src32();
      init_dist();
      init_config();
      init_selectSvgElement();
      init_venn_esm();
      init_setupGraphViewbox();
      init_rough_esm();
      __name(buildStyleByKey, "buildStyleByKey");
      draw28 = /* @__PURE__ */ __name((_text, id34, _version, diagObj) => {
        const db9 = diagObj.db;
        const config5 = db9.getConfig?.();
        const { themeVariables, look, handDrawnSeed } = getConfig();
        const isHandDrawn = look === "handDrawn";
        const themeColors = [
          themeVariables.venn1,
          themeVariables.venn2,
          themeVariables.venn3,
          themeVariables.venn4,
          themeVariables.venn5,
          themeVariables.venn6,
          themeVariables.venn7,
          themeVariables.venn8
        ].filter(Boolean);
        const title2 = db9.getDiagramTitle?.();
        const sets = db9.getSubsetData();
        const textNodes2 = db9.getTextData();
        const styleByKey = buildStyleByKey(db9.getStyleData());
        const svgWidth = config5?.width ?? 800;
        const svgHeight = config5?.height ?? 450;
        const REFERENCE_WIDTH = 1600;
        const scale3 = svgWidth / REFERENCE_WIDTH;
        const titleHeight = title2 ? 48 * scale3 : 0;
        const defaultTextColor = themeVariables.primaryTextColor ?? themeVariables.textColor;
        const svg2 = selectSvgElement(id34);
        svg2.attr("viewBox", `0 0 ${svgWidth} ${svgHeight}`);
        if (title2) {
          svg2.append("text").text(title2).attr("class", "venn-title").attr("font-size", `${32 * scale3}px`).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("x", "50%").attr("y", 32 * scale3).style("fill", themeVariables.vennTitleTextColor || themeVariables.titleColor);
        }
        const dummyD3root = select_default2(document.createElement("div"));
        const vennDiagram = VennDiagram().width(svgWidth).height(svgHeight - titleHeight);
        dummyD3root.datum(sets).call(vennDiagram);
        const roughSvg = isHandDrawn ? at.svg(dummyD3root.select("svg").node()) : void 0;
        const layoutAreas = layout6(sets, {
          width: svgWidth,
          height: svgHeight - titleHeight,
          padding: config5?.padding ?? 15
        });
        const layoutByKey = /* @__PURE__ */ new Map();
        for (const area of layoutAreas) {
          const key = stableSetsKey([...area.data.sets].sort());
          layoutByKey.set(key, area);
        }
        if (textNodes2.length > 0) {
          renderTextNodes(config5, layoutByKey, dummyD3root, textNodes2, scale3, styleByKey);
        }
        const themeDark = is_dark_default(themeVariables.background || "#f4f4f4");
        dummyD3root.selectAll(".venn-circle").each(function(d3, i2) {
          const group2 = select_default2(this);
          const data5 = d3;
          const setsKey = stableSetsKey([...data5.sets].sort());
          const customStyle = styleByKey.get(setsKey);
          const baseColor = customStyle?.fill || themeColors[i2 % themeColors.length] || themeVariables.primaryColor;
          group2.classed(`venn-set-${i2 % 8}`, true);
          const fillOpacity = customStyle?.["fill-opacity"] ?? 0.1;
          const strokeColor = customStyle?.stroke || baseColor;
          const strokeWidthVal = customStyle?.["stroke-width"] || `${5 * scale3}`;
          if (isHandDrawn && roughSvg) {
            const layoutArea = layoutByKey.get(setsKey);
            if (layoutArea && layoutArea.circles.length > 0) {
              const c3 = layoutArea.circles[0];
              const roughNode = roughSvg.circle(c3.x, c3.y, c3.radius * 2, {
                roughness: 0.7,
                seed: handDrawnSeed,
                fill: transparentize_default(baseColor, 0.7),
                fillStyle: "hachure",
                fillWeight: 2,
                hachureGap: 8,
                hachureAngle: -41 + i2 * 60,
                stroke: strokeColor,
                strokeWidth: parseFloat(String(strokeWidthVal))
              });
              group2.select("path").remove();
              group2.node()?.insertBefore(roughNode, group2.select("text").node());
            }
          } else {
            group2.select("path").style("fill", baseColor).style("fill-opacity", fillOpacity).style("stroke", strokeColor).style("stroke-width", strokeWidthVal).style("stroke-opacity", 0.95);
          }
          const textColor = customStyle?.color || (themeDark ? lighten_default(baseColor, 30) : darken_default(baseColor, 30));
          group2.select("text").style("font-size", `${48 * scale3}px`).style("fill", textColor);
        });
        if (isHandDrawn && roughSvg) {
          dummyD3root.selectAll(".venn-intersection").each(function(d3) {
            const group2 = select_default2(this);
            const data5 = d3;
            const setsKey = stableSetsKey([...data5.sets].sort());
            const customStyle = styleByKey.get(setsKey);
            const customFill = customStyle?.fill;
            if (customFill) {
              const pathEl = group2.select("path");
              const pathD = pathEl.attr("d");
              if (pathD) {
                const roughNode = roughSvg.path(pathD, {
                  roughness: 0.7,
                  seed: handDrawnSeed,
                  fill: transparentize_default(customFill, 0.3),
                  fillStyle: "cross-hatch",
                  fillWeight: 2,
                  hachureGap: 6,
                  hachureAngle: 60,
                  stroke: "none"
                });
                const existingPath = pathEl.node();
                existingPath?.parentNode?.insertBefore(roughNode, existingPath);
                pathEl.remove();
              }
            } else {
              group2.select("path").style("fill-opacity", 0);
            }
            group2.select("text").style("font-size", `${48 * scale3}px`).style("fill", customStyle?.color ?? themeVariables.vennSetTextColor ?? defaultTextColor);
          });
        } else {
          dummyD3root.selectAll(".venn-intersection text").style("font-size", `${48 * scale3}px`).style("fill", (e3) => {
            const data5 = e3;
            const setsKey = stableSetsKey([...data5.sets].sort());
            return styleByKey.get(setsKey)?.color ?? themeVariables.vennSetTextColor ?? defaultTextColor;
          });
          dummyD3root.selectAll(".venn-intersection path").style("fill-opacity", (e3) => {
            const data5 = e3;
            const setsKey = stableSetsKey([...data5.sets].sort());
            return styleByKey.get(setsKey)?.fill ? 1 : 0;
          }).style("fill", (e3) => {
            const data5 = e3;
            const setsKey = stableSetsKey([...data5.sets].sort());
            return styleByKey.get(setsKey)?.fill ?? "transparent";
          });
        }
        const vennGroup = svg2.append("g").attr("transform", `translate(0, ${titleHeight})`);
        const dummySvg = dummyD3root.select("svg").node();
        if (dummySvg && "childNodes" in dummySvg) {
          for (const child of [...dummySvg.childNodes]) {
            vennGroup.node()?.appendChild(child);
          }
        }
        configureSvgSize(svg2, svgHeight, svgWidth, config5?.useMaxWidth ?? true);
      }, "draw");
      __name(stableSetsKey, "stableSetsKey");
      __name(renderTextNodes, "renderTextNodes");
      renderer11 = { draw: draw28 };
    }
  });

  // src/diagrams/venn/vennDiagram.ts
  var vennDiagram_exports = {};
  __export(vennDiagram_exports, {
    diagram: () => diagram28
  });
  var diagram28;
  var init_vennDiagram = __esm({
    "src/diagrams/venn/vennDiagram.ts"() {
      "use strict";
      init_venn();
      init_vennDB();
      init_styles20();
      init_vennRenderer();
      diagram28 = {
        parser: venn_default,
        db: db8,
        renderer: renderer11,
        styles: styles_default18
      };
    }
  });

  // src/diagrams/treemap/db.ts
  var TreeMapDB;
  var init_db4 = __esm({
    "src/diagrams/treemap/db.ts"() {
      "use strict";
      init_defaultConfig();
      init_config();
      init_utils2();
      init_handDrawnShapeStyles();
      init_commonDb();
      TreeMapDB = class {
        constructor() {
          this.nodes = [];
          this.levels = /* @__PURE__ */ new Map();
          this.outerNodes = [];
          this.classes = /* @__PURE__ */ new Map();
          this.setAccTitle = setAccTitle;
          this.getAccTitle = getAccTitle;
          this.setDiagramTitle = setDiagramTitle;
          this.getDiagramTitle = getDiagramTitle;
          this.getAccDescription = getAccDescription;
          this.setAccDescription = setAccDescription;
        }
        static {
          __name(this, "TreeMapDB");
        }
        getNodes() {
          return this.nodes;
        }
        getConfig() {
          const defaultConfig5 = defaultConfig_default;
          const userConfig = getConfig();
          return cleanAndMerge({
            ...defaultConfig5.treemap,
            ...userConfig.treemap ?? {}
          });
        }
        addNode(node2, level) {
          this.nodes.push(node2);
          this.levels.set(node2, level);
          if (level === 0) {
            this.outerNodes.push(node2);
            this.root ??= node2;
          }
        }
        getRoot() {
          return { name: "", children: this.outerNodes };
        }
        addClass(id34, _style) {
          const styleClass = this.classes.get(id34) ?? { id: id34, styles: [], textStyles: [] };
          const styles5 = _style.replace(/\\,/g, "\xA7\xA7\xA7").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
          if (styles5) {
            styles5.forEach((s2) => {
              if (isLabelStyle(s2)) {
                if (styleClass?.textStyles) {
                  styleClass.textStyles.push(s2);
                } else {
                  styleClass.textStyles = [s2];
                }
              }
              if (styleClass?.styles) {
                styleClass.styles.push(s2);
              } else {
                styleClass.styles = [s2];
              }
            });
          }
          this.classes.set(id34, styleClass);
        }
        getClasses() {
          return this.classes;
        }
        getStylesForClass(classSelector) {
          return this.classes.get(classSelector)?.styles ?? [];
        }
        clear() {
          clear();
          this.nodes = [];
          this.levels = /* @__PURE__ */ new Map();
          this.outerNodes = [];
          this.classes = /* @__PURE__ */ new Map();
          this.root = void 0;
        }
      };
    }
  });

  // src/diagrams/treemap/utils.ts
  function buildHierarchy(items) {
    if (!items.length) {
      return [];
    }
    const root3 = [];
    const stack = [];
    items.forEach((item) => {
      const node2 = {
        name: item.name,
        children: item.type === "Leaf" ? void 0 : []
      };
      node2.classSelector = item?.classSelector;
      if (item?.cssCompiledStyles) {
        node2.cssCompiledStyles = item.cssCompiledStyles;
      }
      if (item.type === "Leaf" && item.value !== void 0) {
        node2.value = item.value;
      }
      while (stack.length > 0 && stack[stack.length - 1].level >= item.level) {
        stack.pop();
      }
      if (stack.length === 0) {
        root3.push(node2);
      } else {
        const parent4 = stack[stack.length - 1].node;
        if (parent4.children) {
          parent4.children.push(node2);
        } else {
          parent4.children = [node2];
        }
      }
      if (item.type !== "Leaf") {
        stack.push({ node: node2, level: item.level });
      }
    });
    return root3;
  }
  var init_utils6 = __esm({
    "src/diagrams/treemap/utils.ts"() {
      "use strict";
      __name(buildHierarchy, "buildHierarchy");
    }
  });

  // src/diagrams/treemap/parser.ts
  var populate19, getItemName, parser26;
  var init_parser6 = __esm({
    "src/diagrams/treemap/parser.ts"() {
      "use strict";
      init_mermaid_parser_core();
      init_logger();
      init_populateCommonDb();
      init_utils6();
      init_db4();
      populate19 = /* @__PURE__ */ __name((ast, db9) => {
        populateCommonDb(ast, db9);
        const items = [];
        for (const row of ast.TreemapRows ?? []) {
          if (row.$type === "ClassDefStatement") {
            db9.addClass(row.className ?? "", row.styleText ?? "");
          }
        }
        for (const row of ast.TreemapRows ?? []) {
          const item = row.item;
          if (!item) {
            continue;
          }
          const level = row.indent ? parseInt(row.indent) : 0;
          const name = getItemName(item);
          const styles5 = item.classSelector ? db9.getStylesForClass(item.classSelector) : [];
          const cssCompiledStyles = styles5.length > 0 ? styles5 : void 0;
          const itemData = {
            level,
            name,
            type: item.$type,
            value: item.value,
            classSelector: item.classSelector,
            cssCompiledStyles
          };
          items.push(itemData);
        }
        const hierarchyNodes = buildHierarchy(items);
        const addNodesRecursively = /* @__PURE__ */ __name((nodes5, level) => {
          for (const node2 of nodes5) {
            db9.addNode(node2, level);
            if (node2.children && node2.children.length > 0) {
              addNodesRecursively(node2.children, level + 1);
            }
          }
        }, "addNodesRecursively");
        addNodesRecursively(hierarchyNodes, 0);
      }, "populate");
      getItemName = /* @__PURE__ */ __name((item) => {
        return item.name ? String(item.name) : "";
      }, "getItemName");
      parser26 = {
        // @ts-expect-error - TreeMapDB is not assignable to DiagramDB
        parser: { yy: void 0 },
        parse: /* @__PURE__ */ __name(async (text4) => {
          try {
            const parseFunc = parse3;
            const ast = await parseFunc("treemap", text4);
            log.debug("Treemap AST:", ast);
            const db9 = parser26.parser?.yy;
            if (!(db9 instanceof TreeMapDB)) {
              throw new Error(
                "parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
              );
            }
            populate19(ast, db9);
          } catch (error3) {
            log.error("Error parsing treemap:", error3);
            throw error3;
          }
        }, "parse")
      };
    }
  });

  // src/diagrams/treemap/renderer.ts
  var DEFAULT_INNER_PADDING, SECTION_INNER_PADDING, SECTION_HEADER_HEIGHT, draw29, getClasses6, renderer12;
  var init_renderer4 = __esm({
    "src/diagrams/treemap/renderer.ts"() {
      "use strict";
      init_selectSvgElement();
      init_setupViewPortForSVG();
      init_setupGraphViewbox();
      init_src32();
      init_handDrawnShapeStyles();
      init_config();
      init_logger();
      DEFAULT_INNER_PADDING = 10;
      SECTION_INNER_PADDING = 10;
      SECTION_HEADER_HEIGHT = 25;
      draw29 = /* @__PURE__ */ __name((_text, id34, _version, diagram31) => {
        const treemapDb = diagram31.db;
        const config5 = treemapDb.getConfig();
        const treemapInnerPadding = config5.padding ?? DEFAULT_INNER_PADDING;
        const title2 = treemapDb.getDiagramTitle();
        const root3 = treemapDb.getRoot();
        const { themeVariables } = getConfig();
        if (!root3) {
          return;
        }
        const titleHeight = title2 ? 30 : 0;
        const svg2 = selectSvgElement(id34);
        const width3 = config5.nodeWidth ? config5.nodeWidth * SECTION_INNER_PADDING : 960;
        const height2 = config5.nodeHeight ? config5.nodeHeight * SECTION_INNER_PADDING : 500;
        const svgWidth = width3;
        const svgHeight = height2 + titleHeight;
        svg2.attr("viewBox", `0 0 ${svgWidth} ${svgHeight}`);
        configureSvgSize(svg2, svgHeight, svgWidth, config5.useMaxWidth);
        let valueFormat;
        try {
          const formatStr = config5.valueFormat || ",";
          if (formatStr === "$0,0") {
            valueFormat = /* @__PURE__ */ __name((value2) => "$" + format2(",")(value2), "valueFormat");
          } else if (formatStr.startsWith("$") && formatStr.includes(",")) {
            const precision = /\.\d+/.exec(formatStr);
            const precisionStr = precision ? precision[0] : "";
            valueFormat = /* @__PURE__ */ __name((value2) => "$" + format2("," + precisionStr)(value2), "valueFormat");
          } else if (formatStr.startsWith("$")) {
            const restOfFormat = formatStr.substring(1);
            valueFormat = /* @__PURE__ */ __name((value2) => "$" + format2(restOfFormat || "")(value2), "valueFormat");
          } else {
            valueFormat = format2(formatStr);
          }
        } catch (error3) {
          log.error("Error creating format function:", error3);
          valueFormat = format2(",");
        }
        const colorScale = ordinal().range([
          "transparent",
          themeVariables.cScale0,
          themeVariables.cScale1,
          themeVariables.cScale2,
          themeVariables.cScale3,
          themeVariables.cScale4,
          themeVariables.cScale5,
          themeVariables.cScale6,
          themeVariables.cScale7,
          themeVariables.cScale8,
          themeVariables.cScale9,
          themeVariables.cScale10,
          themeVariables.cScale11
        ]);
        const colorScalePeer = ordinal().range([
          "transparent",
          themeVariables.cScalePeer0,
          themeVariables.cScalePeer1,
          themeVariables.cScalePeer2,
          themeVariables.cScalePeer3,
          themeVariables.cScalePeer4,
          themeVariables.cScalePeer5,
          themeVariables.cScalePeer6,
          themeVariables.cScalePeer7,
          themeVariables.cScalePeer8,
          themeVariables.cScalePeer9,
          themeVariables.cScalePeer10,
          themeVariables.cScalePeer11
        ]);
        const colorScaleLabel = ordinal().range([
          themeVariables.cScaleLabel0,
          themeVariables.cScaleLabel1,
          themeVariables.cScaleLabel2,
          themeVariables.cScaleLabel3,
          themeVariables.cScaleLabel4,
          themeVariables.cScaleLabel5,
          themeVariables.cScaleLabel6,
          themeVariables.cScaleLabel7,
          themeVariables.cScaleLabel8,
          themeVariables.cScaleLabel9,
          themeVariables.cScaleLabel10,
          themeVariables.cScaleLabel11
        ]);
        if (title2) {
          svg2.append("text").attr("x", svgWidth / 2).attr("y", titleHeight / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(title2);
        }
        const g2 = svg2.append("g").attr("transform", `translate(0, ${titleHeight})`).attr("class", "treemapContainer");
        const hierarchyRoot = hierarchy(root3).sum((d3) => d3.value ?? 0).sort((a2, b3) => (b3.value ?? 0) - (a2.value ?? 0));
        const treemapLayout = treemap_default().size([width3, height2]).paddingTop(
          (d3) => d3.children && d3.children.length > 0 ? SECTION_HEADER_HEIGHT + SECTION_INNER_PADDING : 0
        ).paddingInner(treemapInnerPadding).paddingLeft((d3) => d3.children && d3.children.length > 0 ? SECTION_INNER_PADDING : 0).paddingRight((d3) => d3.children && d3.children.length > 0 ? SECTION_INNER_PADDING : 0).paddingBottom((d3) => d3.children && d3.children.length > 0 ? SECTION_INNER_PADDING : 0).round(true);
        const treemapData = treemapLayout(hierarchyRoot);
        const branchNodes = treemapData.descendants().filter((d3) => d3.children && d3.children.length > 0);
        const sections6 = g2.selectAll(".treemapSection").data(branchNodes).enter().append("g").attr("class", "treemapSection").attr("transform", (d3) => `translate(${d3.x0},${d3.y0})`);
        sections6.append("rect").attr("width", (d3) => d3.x1 - d3.x0).attr("height", SECTION_HEADER_HEIGHT).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", 0.6).attr("stroke-width", 0.6).attr("style", (d3) => {
          if (d3.depth === 0) {
            return "display: none;";
          }
          return "";
        });
        sections6.append("clipPath").attr("id", (_d, i2) => `clip-section-${id34}-${i2}`).append("rect").attr("width", (d3) => Math.max(0, d3.x1 - d3.x0 - 12)).attr("height", SECTION_HEADER_HEIGHT);
        sections6.append("rect").attr("width", (d3) => d3.x1 - d3.x0).attr("height", (d3) => d3.y1 - d3.y0).attr("class", (_d, i2) => {
          return `treemapSection section${i2}`;
        }).attr("fill", (d3) => colorScale(d3.data.name)).attr("fill-opacity", 0.6).attr("stroke", (d3) => colorScalePeer(d3.data.name)).attr("stroke-width", 2).attr("stroke-opacity", 0.4).attr("style", (d3) => {
          if (d3.depth === 0) {
            return "display: none;";
          }
          const styles5 = styles2String({ cssCompiledStyles: d3.data.cssCompiledStyles });
          return styles5.nodeStyles + ";" + styles5.borderStyles.join(";");
        });
        sections6.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", SECTION_HEADER_HEIGHT / 2).attr("dominant-baseline", "middle").text((d3) => d3.depth === 0 ? "" : d3.data.name).attr("font-weight", "bold").attr("style", (d3) => {
          if (d3.depth === 0) {
            return "display: none;";
          }
          const labelStyles = "dominant-baseline: middle; font-size: 12px; fill:" + colorScaleLabel(d3.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;";
          const styles5 = styles2String({ cssCompiledStyles: d3.data.cssCompiledStyles });
          return labelStyles + styles5.labelStyles.replace("color:", "fill:");
        }).each(function(d3) {
          if (d3.depth === 0) {
            return;
          }
          const self2 = select_default2(this);
          const originalText = d3.data.name;
          self2.text(originalText);
          const totalHeaderWidth = d3.x1 - d3.x0;
          const labelXPosition = 6;
          let spaceForTextContent;
          if (config5.showValues !== false && d3.value) {
            const valueEndsAtXRelative = totalHeaderWidth - 10;
            const estimatedValueTextActualWidth = 30;
            const gapBetweenLabelAndValue = 10;
            const labelMustEndBeforeX = valueEndsAtXRelative - estimatedValueTextActualWidth - gapBetweenLabelAndValue;
            spaceForTextContent = labelMustEndBeforeX - labelXPosition;
          } else {
            const labelOwnRightPadding = 6;
            spaceForTextContent = totalHeaderWidth - labelXPosition - labelOwnRightPadding;
          }
          const minimumWidthToDisplay = 15;
          const actualAvailableWidth = Math.max(minimumWidthToDisplay, spaceForTextContent);
          const textNode = self2.node();
          const currentTextContentLength = textNode.getComputedTextLength();
          if (currentTextContentLength > actualAvailableWidth) {
            const ellipsis = "...";
            let currentTruncatedText = originalText;
            while (currentTruncatedText.length > 0) {
              currentTruncatedText = originalText.substring(0, currentTruncatedText.length - 1);
              if (currentTruncatedText.length === 0) {
                self2.text(ellipsis);
                if (textNode.getComputedTextLength() > actualAvailableWidth) {
                  self2.text("");
                }
                break;
              }
              self2.text(currentTruncatedText + ellipsis);
              if (textNode.getComputedTextLength() <= actualAvailableWidth) {
                break;
              }
            }
          }
        });
        if (config5.showValues !== false) {
          sections6.append("text").attr("class", "treemapSectionValue").attr("x", (d3) => d3.x1 - d3.x0 - 10).attr("y", SECTION_HEADER_HEIGHT / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").text((d3) => d3.value ? valueFormat(d3.value) : "").attr("font-style", "italic").attr("style", (d3) => {
            if (d3.depth === 0) {
              return "display: none;";
            }
            const labelStyles = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + colorScaleLabel(d3.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;";
            const styles5 = styles2String({ cssCompiledStyles: d3.data.cssCompiledStyles });
            return labelStyles + styles5.labelStyles.replace("color:", "fill:");
          });
        }
        const leafNodes = treemapData.leaves();
        const cell = g2.selectAll(".treemapLeafGroup").data(leafNodes).enter().append("g").attr("class", (d3, i2) => {
          return `treemapNode treemapLeafGroup leaf${i2}${d3.data.classSelector ? ` ${d3.data.classSelector}` : ""}x`;
        }).attr("transform", (d3) => `translate(${d3.x0},${d3.y0})`);
        cell.append("rect").attr("width", (d3) => d3.x1 - d3.x0).attr("height", (d3) => d3.y1 - d3.y0).attr("class", "treemapLeaf").attr("fill", (d3) => {
          return d3.parent ? colorScale(d3.parent.data.name) : colorScale(d3.data.name);
        }).attr("style", (d3) => {
          const styles5 = styles2String({ cssCompiledStyles: d3.data.cssCompiledStyles });
          return styles5.nodeStyles;
        }).attr("fill-opacity", 0.3).attr("stroke", (d3) => {
          return d3.parent ? colorScale(d3.parent.data.name) : colorScale(d3.data.name);
        }).attr("stroke-width", 3);
        cell.append("clipPath").attr("id", (_d, i2) => `clip-${id34}-${i2}`).append("rect").attr("width", (d3) => Math.max(0, d3.x1 - d3.x0 - 4)).attr("height", (d3) => Math.max(0, d3.y1 - d3.y0 - 4));
        const leafLabels = cell.append("text").attr("class", "treemapLabel").attr("x", (d3) => (d3.x1 - d3.x0) / 2).attr("y", (d3) => (d3.y1 - d3.y0) / 2).attr("style", (d3) => {
          const labelStyles = "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + colorScaleLabel(d3.data.name) + ";";
          const styles5 = styles2String({ cssCompiledStyles: d3.data.cssCompiledStyles });
          return labelStyles + styles5.labelStyles.replace("color:", "fill:");
        }).attr("clip-path", (_d, i2) => `url(#clip-${id34}-${i2})`).text((d3) => d3.data.name);
        leafLabels.each(function(d3) {
          const self2 = select_default2(this);
          const nodeWidth = d3.x1 - d3.x0;
          const nodeHeight = d3.y1 - d3.y0;
          const textNode = self2.node();
          const padding2 = 4;
          const availableWidth = nodeWidth - 2 * padding2;
          const availableHeight = nodeHeight - 2 * padding2;
          if (availableWidth < 10 || availableHeight < 10) {
            self2.style("display", "none");
            return;
          }
          let currentLabelFontSize = parseInt(self2.style("font-size"), 10);
          const minLabelFontSize = 8;
          const originalValueRelFontSize = 28;
          const valueScaleFactor = 0.6;
          const minValueFontSize = 6;
          const spacingBetweenLabelAndValue = 2;
          while (textNode.getComputedTextLength() > availableWidth && currentLabelFontSize > minLabelFontSize) {
            currentLabelFontSize--;
            self2.style("font-size", `${currentLabelFontSize}px`);
          }
          let prospectiveValueFontSize = Math.max(
            minValueFontSize,
            Math.min(originalValueRelFontSize, Math.round(currentLabelFontSize * valueScaleFactor))
          );
          let combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
          while (combinedHeight > availableHeight && currentLabelFontSize > minLabelFontSize) {
            currentLabelFontSize--;
            prospectiveValueFontSize = Math.max(
              minValueFontSize,
              Math.min(originalValueRelFontSize, Math.round(currentLabelFontSize * valueScaleFactor))
            );
            if (prospectiveValueFontSize < minValueFontSize && currentLabelFontSize === minLabelFontSize) {
              break;
            }
            self2.style("font-size", `${currentLabelFontSize}px`);
            combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
            if (prospectiveValueFontSize <= minValueFontSize && combinedHeight > availableHeight) {
            }
          }
          self2.style("font-size", `${currentLabelFontSize}px`);
          if (textNode.getComputedTextLength() > availableWidth || currentLabelFontSize < minLabelFontSize || availableHeight < currentLabelFontSize) {
            self2.style("display", "none");
          }
        });
        if (config5.showValues !== false) {
          const leafValues = cell.append("text").attr("class", "treemapValue").attr("x", (d3) => (d3.x1 - d3.x0) / 2).attr("y", function(d3) {
            return (d3.y1 - d3.y0) / 2;
          }).attr("style", (d3) => {
            const labelStyles = "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + colorScaleLabel(d3.data.name) + ";";
            const styles5 = styles2String({ cssCompiledStyles: d3.data.cssCompiledStyles });
            return labelStyles + styles5.labelStyles.replace("color:", "fill:");
          }).attr("clip-path", (_d, i2) => `url(#clip-${id34}-${i2})`).text((d3) => d3.value ? valueFormat(d3.value) : "");
          leafValues.each(function(d3) {
            const valueTextElement = select_default2(this);
            const parentCellNode = this.parentNode;
            if (!parentCellNode) {
              valueTextElement.style("display", "none");
              return;
            }
            const labelElement = select_default2(parentCellNode).select(".treemapLabel");
            if (labelElement.empty() || labelElement.style("display") === "none") {
              valueTextElement.style("display", "none");
              return;
            }
            const finalLabelFontSize = parseFloat(labelElement.style("font-size"));
            const originalValueFontSize = 28;
            const valueScaleFactor = 0.6;
            const minValueFontSize = 6;
            const spacingBetweenLabelAndValue = 2;
            const actualValueFontSize = Math.max(
              minValueFontSize,
              Math.min(originalValueFontSize, Math.round(finalLabelFontSize * valueScaleFactor))
            );
            valueTextElement.style("font-size", `${actualValueFontSize}px`);
            const labelCenterY = (d3.y1 - d3.y0) / 2;
            const valueTopActualY = labelCenterY + finalLabelFontSize / 2 + spacingBetweenLabelAndValue;
            valueTextElement.attr("y", valueTopActualY);
            const nodeWidth = d3.x1 - d3.x0;
            const nodeTotalHeight = d3.y1 - d3.y0;
            const cellBottomPadding = 4;
            const maxValueBottomY = nodeTotalHeight - cellBottomPadding;
            const availableWidthForValue = nodeWidth - 2 * 4;
            if (valueTextElement.node().getComputedTextLength() > availableWidthForValue || valueTopActualY + actualValueFontSize > maxValueBottomY || actualValueFontSize < minValueFontSize) {
              valueTextElement.style("display", "none");
            } else {
              valueTextElement.style("display", null);
            }
          });
        }
        const diagramPadding = config5.diagramPadding ?? 8;
        setupViewPortForSVG(svg2, diagramPadding, "flowchart", config5?.useMaxWidth || false);
      }, "draw");
      getClasses6 = /* @__PURE__ */ __name(function(_text, diagramObj) {
        return diagramObj.db.getClasses();
      }, "getClasses");
      renderer12 = { draw: draw29, getClasses: getClasses6 };
    }
  });

  // src/diagrams/treemap/styles.ts
  var defaultTreemapStyleOptions, getStyles21, styles_default19;
  var init_styles21 = __esm({
    "src/diagrams/treemap/styles.ts"() {
      "use strict";
      init_utils2();
      init_theme_default();
      init_config();
      defaultTreemapStyleOptions = {
        sectionStrokeColor: "black",
        sectionStrokeWidth: "1",
        sectionFillColor: "#efefef",
        leafStrokeColor: "black",
        leafStrokeWidth: "1",
        leafFillColor: "#efefef",
        labelFontSize: "12px",
        valueFontSize: "10px",
        titleFontSize: "14px"
      };
      getStyles21 = /* @__PURE__ */ __name(({
        treemap: treemap2
      } = {}) => {
        const defaultThemeVariables2 = getThemeVariables3();
        const currentConfig2 = getConfig();
        const themeVariables = cleanAndMerge(defaultThemeVariables2, currentConfig2.themeVariables);
        const options2 = cleanAndMerge(defaultTreemapStyleOptions, treemap2);
        const titleColor = options2.titleColor ?? themeVariables.titleColor;
        const labelColor = options2.labelColor ?? themeVariables.textColor;
        const valueColor = options2.valueColor ?? themeVariables.textColor;
        return `
  .treemapNode.section {
    stroke: ${options2.sectionStrokeColor};
    stroke-width: ${options2.sectionStrokeWidth};
    fill: ${options2.sectionFillColor};
  }
  .treemapNode.leaf {
    stroke: ${options2.leafStrokeColor};
    stroke-width: ${options2.leafStrokeWidth};
    fill: ${options2.leafFillColor};
  }
  .treemapLabel {
    fill: ${labelColor};
    font-size: ${options2.labelFontSize};
  }
  .treemapValue {
    fill: ${valueColor};
    font-size: ${options2.valueFontSize};
  }
  .treemapTitle {
    fill: ${titleColor};
    font-size: ${options2.titleFontSize};
  }
  `;
      }, "getStyles");
      styles_default19 = getStyles21;
    }
  });

  // src/diagrams/treemap/diagram.ts
  var diagram_exports4 = {};
  __export(diagram_exports4, {
    diagram: () => diagram29
  });
  var diagram29;
  var init_diagram4 = __esm({
    "src/diagrams/treemap/diagram.ts"() {
      "use strict";
      init_db4();
      init_parser6();
      init_renderer4();
      init_styles21();
      diagram29 = {
        parser: parser26,
        get db() {
          return new TreeMapDB();
        },
        renderer: renderer12,
        styles: styles_default19
      };
    }
  });

  // src/diagrams/wardley/wardleyParser.ts
  var toPercent, toCoordinates, getFlowFromPort, extractFlowFromArrow, populateDb3, parser27;
  var init_wardleyParser = __esm({
    "src/diagrams/wardley/wardleyParser.ts"() {
      "use strict";
      init_mermaid_parser_core();
      init_logger();
      init_populateCommonDb();
      toPercent = /* @__PURE__ */ __name((value2, context) => {
        const normalized = value2 <= 1 ? value2 * 100 : value2;
        if (normalized < 0 || normalized > 100) {
          throw new Error(
            `${context} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${value2}`
          );
        }
        return normalized;
      }, "toPercent");
      toCoordinates = /* @__PURE__ */ __name((visibility, evolution, context) => {
        return {
          x: toPercent(evolution, `${context} evolution`),
          y: toPercent(visibility, `${context} visibility`)
        };
      }, "toCoordinates");
      getFlowFromPort = /* @__PURE__ */ __name((port) => {
        if (!port) {
          return void 0;
        }
        if (port === "+<>") {
          return "bidirectional";
        }
        if (port === "+<") {
          return "backward";
        }
        if (port === "+>") {
          return "forward";
        }
        return void 0;
      }, "getFlowFromPort");
      extractFlowFromArrow = /* @__PURE__ */ __name((arrow) => {
        if (!arrow?.startsWith("+")) {
          return {};
        }
        const labelMatch = /^\+'([^']*)'/.exec(arrow);
        const flowLabel = labelMatch?.[1];
        if (arrow.includes("<>")) {
          return { flow: "bidirectional", label: flowLabel };
        }
        if (arrow.includes("<")) {
          return { flow: "backward", label: flowLabel };
        }
        if (arrow.includes(">")) {
          return { flow: "forward", label: flowLabel };
        }
        return { label: flowLabel };
      }, "extractFlowFromArrow");
      populateDb3 = /* @__PURE__ */ __name((ast, db9) => {
        populateCommonDb(ast, db9);
        if (ast.size) {
          db9.setSize(ast.size.width, ast.size.height);
        }
        if (ast.evolution) {
          const stages = ast.evolution.stages.map((stage) => {
            if (stage.secondName) {
              return `${stage.name.trim()} / ${stage.secondName.trim()}`;
            }
            return stage.name.trim();
          });
          const stageBoundaries = ast.evolution.stages.filter((stage) => stage.boundary !== void 0).map((stage) => stage.boundary);
          db9.updateAxes({ stages, stageBoundaries });
        }
        ast.anchors.forEach((anchor2) => {
          const coords = toCoordinates(anchor2.visibility, anchor2.evolution, `Anchor "${anchor2.name}"`);
          db9.addNode(anchor2.name, anchor2.name, coords.x, coords.y, "anchor");
        });
        ast.components.forEach((component2) => {
          const coords = toCoordinates(
            component2.visibility,
            component2.evolution,
            `Component "${component2.name}"`
          );
          const labelOffsetX = component2.label ? (component2.label.negX ? -1 : 1) * component2.label.offsetX : void 0;
          const labelOffsetY = component2.label ? (component2.label.negY ? -1 : 1) * component2.label.offsetY : void 0;
          const sourceStrategy = component2.decorator?.strategy;
          db9.addNode(
            component2.name,
            component2.name,
            coords.x,
            coords.y,
            "component",
            labelOffsetX,
            labelOffsetY,
            component2.inertia,
            sourceStrategy
          );
        });
        ast.notes.forEach((note3) => {
          const coords = toCoordinates(note3.visibility, note3.evolution, `Note "${note3.text}"`);
          db9.addNote(note3.text, coords.x, coords.y);
        });
        ast.pipelines.forEach((pipeline) => {
          const parentNode = db9.getNode(pipeline.parent);
          if (!parentNode || typeof parentNode.y !== "number") {
            throw new Error(
              `Pipeline "${pipeline.parent}" must reference an existing component with coordinates.`
            );
          }
          const parentY = parentNode.y;
          db9.startPipeline(pipeline.parent);
          pipeline.components.forEach((component2) => {
            const componentId = `${pipeline.parent}_${component2.name}`;
            const labelOffsetX = component2.label ? (component2.label.negX ? -1 : 1) * component2.label.offsetX : void 0;
            const labelOffsetY = component2.label ? (component2.label.negY ? -1 : 1) * component2.label.offsetY : void 0;
            const x5 = toPercent(component2.evolution, `Pipeline component "${component2.name}" evolution`);
            db9.addNode(
              componentId,
              component2.name,
              x5,
              parentY,
              "pipeline-component",
              labelOffsetX,
              labelOffsetY
            );
            db9.addPipelineComponent(pipeline.parent, componentId);
          });
        });
        ast.links.forEach((link2) => {
          const isDashed = !!link2.arrow && (link2.arrow.includes("-.->") || link2.arrow.includes(".-."));
          let flow = getFlowFromPort(link2.fromPort) ?? getFlowFromPort(link2.toPort);
          const { flow: arrowFlow, label: flowLabel } = extractFlowFromArrow(link2.arrow);
          if (!flow && arrowFlow) {
            flow = arrowFlow;
          }
          const annotation = link2.linkLabel;
          const label = flowLabel ?? annotation;
          db9.addLink(link2.from, link2.to, isDashed, label, flow);
        });
        ast.evolves.forEach((evolve) => {
          const node2 = db9.getNode(evolve.component);
          if (node2?.y !== void 0) {
            const target = toPercent(evolve.target, `Evolve target for "${evolve.component}"`);
            db9.addTrend(evolve.component, target, node2.y);
          }
        });
        if (ast.annotations.length > 0) {
          const annotationsBox = ast.annotations[0];
          const coords = toCoordinates(annotationsBox.x, annotationsBox.y, "Annotations box");
          db9.setAnnotationsBox(coords.x, coords.y);
        }
        ast.annotation.forEach((annotation) => {
          const coords = toCoordinates(annotation.x, annotation.y, `Annotation ${annotation.number}`);
          db9.addAnnotation(annotation.number, [{ x: coords.x, y: coords.y }], annotation.text);
        });
        ast.accelerators.forEach((accelerator) => {
          const coords = toCoordinates(accelerator.x, accelerator.y, `Accelerator "${accelerator.name}"`);
          db9.addAccelerator(accelerator.name, coords.x, coords.y);
        });
        ast.deaccelerators.forEach((deaccelerator) => {
          const coords = toCoordinates(
            deaccelerator.x,
            deaccelerator.y,
            `Deaccelerator "${deaccelerator.name}"`
          );
          db9.addDeaccelerator(deaccelerator.name, coords.x, coords.y);
        });
      }, "populateDb");
      parser27 = {
        parser: {
          // @ts-expect-error - WardleyDB is not assignable to DiagramDB
          yy: void 0
        },
        parse: /* @__PURE__ */ __name(async (input) => {
          const ast = await parse3("wardley", input);
          log.debug(ast);
          const db9 = parser27.parser?.yy;
          if (!db9 || typeof db9.addNode !== "function") {
            throw new Error(
              "parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
            );
          }
          populateDb3(ast, db9);
        }, "parse")
      };
    }
  });

  // src/diagrams/wardley/wardleyBuilder.ts
  var WardleyBuilder;
  var init_wardleyBuilder = __esm({
    "src/diagrams/wardley/wardleyBuilder.ts"() {
      "use strict";
      WardleyBuilder = class {
        constructor() {
          this.nodes = /* @__PURE__ */ new Map();
          this.links = [];
          this.trends = /* @__PURE__ */ new Map();
          this.pipelines = /* @__PURE__ */ new Map();
          this.annotations = [];
          this.notes = [];
          this.accelerators = [];
          this.deaccelerators = [];
          this.axes = {};
        }
        static {
          __name(this, "WardleyBuilder");
        }
        addNode(node2) {
          const existing = this.nodes.get(node2.id) ?? { id: node2.id, label: node2.label };
          const merged = {
            ...existing,
            ...node2,
            className: node2.className ?? existing.className,
            labelOffsetX: node2.labelOffsetX ?? existing.labelOffsetX,
            labelOffsetY: node2.labelOffsetY ?? existing.labelOffsetY
          };
          this.nodes.set(node2.id, merged);
        }
        addLink(link2) {
          this.links.push(link2);
        }
        addTrend(trend) {
          this.trends.set(trend.nodeId, trend);
        }
        startPipeline(nodeId) {
          this.pipelines.set(nodeId, { nodeId, componentIds: [] });
          const node2 = this.nodes.get(nodeId);
          if (node2) {
            node2.isPipelineParent = true;
          }
        }
        addPipelineComponent(pipelineNodeId, componentId) {
          const pipeline = this.pipelines.get(pipelineNodeId);
          if (pipeline) {
            pipeline.componentIds.push(componentId);
          }
          const node2 = this.nodes.get(componentId);
          if (node2) {
            node2.inPipeline = true;
          }
        }
        addAnnotation(annotation) {
          this.annotations.push(annotation);
        }
        addNote(note3) {
          this.notes.push(note3);
        }
        addAccelerator(accelerator) {
          this.accelerators.push(accelerator);
        }
        addDeaccelerator(deaccelerator) {
          this.deaccelerators.push(deaccelerator);
        }
        setAnnotationsBox(x5, y6) {
          this.annotationsBox = { x: x5, y: y6 };
        }
        setAxes(partial) {
          this.axes = {
            ...this.axes,
            ...partial
          };
        }
        setSize(width3, height2) {
          this.size = { width: width3, height: height2 };
        }
        getNode(id34) {
          return this.nodes.get(id34);
        }
        build() {
          const nodes5 = [];
          for (const node2 of this.nodes.values()) {
            if (typeof node2.x !== "number" || typeof node2.y !== "number") {
              throw new Error(`Node "${node2.label}" is missing coordinates`);
            }
            nodes5.push(node2);
          }
          return {
            nodes: nodes5,
            links: [...this.links],
            trends: [...this.trends.values()],
            pipelines: [...this.pipelines.values()],
            annotations: [...this.annotations],
            notes: [...this.notes],
            accelerators: [...this.accelerators],
            deaccelerators: [...this.deaccelerators],
            annotationsBox: this.annotationsBox,
            axes: { ...this.axes },
            size: this.size
          };
        }
        clear() {
          this.nodes.clear();
          this.links = [];
          this.trends.clear();
          this.pipelines.clear();
          this.annotations = [];
          this.notes = [];
          this.accelerators = [];
          this.deaccelerators = [];
          this.annotationsBox = void 0;
          this.axes = {};
          this.size = void 0;
        }
      };
    }
  });

  // src/diagrams/wardley/wardleyDb.ts
  function textSanitizer3(text4) {
    const config5 = getConfig2();
    return sanitizeText(text4.trim(), config5);
  }
  function getConfig8() {
    return getConfig2()["wardley-beta"];
  }
  function addNode3(id34, label, x5, y6, className, labelOffsetX, labelOffsetY, inertia, sourceStrategy) {
    builder.addNode({
      id: id34,
      label: textSanitizer3(label),
      x: x5,
      y: y6,
      className,
      labelOffsetX,
      labelOffsetY,
      inertia,
      sourceStrategy
    });
  }
  function addLink2(sourceId, targetId, dashed = false, label, flow) {
    builder.addLink({ source: sourceId, target: targetId, dashed, label, flow });
  }
  function addTrend(nodeId, targetX, targetY) {
    builder.addTrend({ nodeId, targetX, targetY });
  }
  function addAnnotation(number7, coordinates, text4) {
    builder.addAnnotation({
      number: number7,
      coordinates,
      text: text4 ? textSanitizer3(text4) : void 0
    });
  }
  function addNote(text4, x5, y6) {
    builder.addNote({
      text: textSanitizer3(text4),
      x: x5,
      y: y6
    });
  }
  function addAccelerator(name, x5, y6) {
    builder.addAccelerator({
      name: textSanitizer3(name),
      x: x5,
      y: y6
    });
  }
  function addDeaccelerator(name, x5, y6) {
    builder.addDeaccelerator({
      name: textSanitizer3(name),
      x: x5,
      y: y6
    });
  }
  function setAnnotationsBox(x5, y6) {
    builder.setAnnotationsBox(x5, y6);
  }
  function setSize(width3, height2) {
    builder.setSize(width3, height2);
  }
  function startPipeline(nodeId) {
    builder.startPipeline(nodeId);
  }
  function addPipelineComponent(pipelineNodeId, componentId) {
    builder.addPipelineComponent(pipelineNodeId, componentId);
  }
  function updateAxes(partial) {
    const sanitized = {};
    if (partial.xLabel) {
      sanitized.xLabel = textSanitizer3(partial.xLabel);
    }
    if (partial.yLabel) {
      sanitized.yLabel = textSanitizer3(partial.yLabel);
    }
    if (partial.stages) {
      sanitized.stages = partial.stages.map((stage) => textSanitizer3(stage));
    }
    if (partial.stageBoundaries) {
      sanitized.stageBoundaries = partial.stageBoundaries;
    }
    builder.setAxes(sanitized);
  }
  function getNode(id34) {
    return builder.getNode(id34);
  }
  function getWardleyData() {
    return builder.build();
  }
  function clear20() {
    builder.clear();
    clear();
  }
  var builder, wardleyDb_default;
  var init_wardleyDb = __esm({
    "src/diagrams/wardley/wardleyDb.ts"() {
      "use strict";
      init_diagramAPI();
      init_common();
      init_commonDb();
      init_wardleyBuilder();
      builder = new WardleyBuilder();
      __name(textSanitizer3, "textSanitizer");
      __name(getConfig8, "getConfig");
      __name(addNode3, "addNode");
      __name(addLink2, "addLink");
      __name(addTrend, "addTrend");
      __name(addAnnotation, "addAnnotation");
      __name(addNote, "addNote");
      __name(addAccelerator, "addAccelerator");
      __name(addDeaccelerator, "addDeaccelerator");
      __name(setAnnotationsBox, "setAnnotationsBox");
      __name(setSize, "setSize");
      __name(startPipeline, "startPipeline");
      __name(addPipelineComponent, "addPipelineComponent");
      __name(updateAxes, "updateAxes");
      __name(getNode, "getNode");
      __name(getWardleyData, "getWardleyData");
      __name(clear20, "clear");
      wardleyDb_default = {
        getConfig: getConfig8,
        addNode: addNode3,
        addLink: addLink2,
        addTrend,
        addAnnotation,
        addNote,
        addAccelerator,
        addDeaccelerator,
        setAnnotationsBox,
        setSize,
        startPipeline,
        addPipelineComponent,
        updateAxes,
        getNode,
        getWardleyData,
        clear: clear20,
        setAccTitle,
        getAccTitle,
        setDiagramTitle,
        getDiagramTitle,
        getAccDescription,
        setAccDescription
      };
    }
  });

  // src/diagrams/wardley/wardleyRenderer.ts
  var DEFAULT_STAGES, getTheme, getConfigValues, draw30, wardleyRenderer_default;
  var init_wardleyRenderer = __esm({
    "src/diagrams/wardley/wardleyRenderer.ts"() {
      "use strict";
      init_diagramAPI();
      init_logger();
      init_selectSvgElement();
      init_setupGraphViewbox();
      DEFAULT_STAGES = ["Genesis", "Custom Built", "Product", "Commodity"];
      getTheme = /* @__PURE__ */ __name(() => {
        const { themeVariables } = getConfig2();
        return {
          backgroundColor: themeVariables.wardley?.backgroundColor ?? themeVariables.background ?? "#fff",
          axisColor: themeVariables.wardley?.axisColor ?? "#000",
          axisTextColor: themeVariables.wardley?.axisTextColor ?? themeVariables.primaryTextColor ?? "#222",
          gridColor: themeVariables.wardley?.gridColor ?? "rgba(100, 100, 100, 0.2)",
          componentFill: themeVariables.wardley?.componentFill ?? "#fff",
          componentStroke: themeVariables.wardley?.componentStroke ?? "#000",
          componentLabelColor: themeVariables.wardley?.componentLabelColor ?? themeVariables.primaryTextColor ?? "#222",
          linkStroke: themeVariables.wardley?.linkStroke ?? "#000",
          evolutionStroke: themeVariables.wardley?.evolutionStroke ?? "#dc3545",
          annotationStroke: themeVariables.wardley?.annotationStroke ?? "#000",
          annotationTextColor: themeVariables.wardley?.annotationTextColor ?? themeVariables.primaryTextColor ?? "#222",
          annotationFill: themeVariables.wardley?.annotationFill ?? themeVariables.background ?? "#fff"
        };
      }, "getTheme");
      getConfigValues = /* @__PURE__ */ __name(() => {
        const wardleyConfig = getConfig2()["wardley-beta"];
        return {
          width: wardleyConfig?.width ?? 900,
          height: wardleyConfig?.height ?? 600,
          padding: wardleyConfig?.padding ?? 48,
          nodeRadius: wardleyConfig?.nodeRadius ?? 6,
          nodeLabelOffset: wardleyConfig?.nodeLabelOffset ?? 8,
          axisFontSize: wardleyConfig?.axisFontSize ?? 12,
          labelFontSize: wardleyConfig?.labelFontSize ?? 10,
          showGrid: wardleyConfig?.showGrid ?? false,
          useMaxWidth: wardleyConfig?.useMaxWidth ?? true
        };
      }, "getConfigValues");
      draw30 = /* @__PURE__ */ __name((text4, id34, _version, diagObj) => {
        log.debug("Rendering Wardley map\n" + text4);
        const configValues = getConfigValues();
        const theme = getTheme();
        const squareSize = configValues.nodeRadius * 1.6;
        const db9 = diagObj.db;
        const data5 = db9.getWardleyData();
        const title2 = db9.getDiagramTitle();
        const width3 = data5.size?.width ?? configValues.width;
        const height2 = data5.size?.height ?? configValues.height;
        const svg2 = selectSvgElement(id34);
        svg2.selectAll("*").remove();
        configureSvgSize(svg2, height2, width3, configValues.useMaxWidth);
        svg2.attr("viewBox", `0 0 ${width3} ${height2}`);
        const root3 = svg2.append("g").attr("class", "wardley-map");
        const defs2 = svg2.append("defs");
        defs2.append("marker").attr("id", `arrow-${id34}`).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerWidth", 6).attr("markerHeight", 6).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("fill", theme.evolutionStroke).attr("stroke", "none");
        defs2.append("marker").attr("id", `link-arrow-end-${id34}`).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerWidth", 5).attr("markerHeight", 5).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("fill", theme.linkStroke).attr("stroke", "none");
        defs2.append("marker").attr("id", `link-arrow-start-${id34}`).attr("viewBox", "0 0 10 10").attr("refX", 1).attr("refY", 5).attr("markerWidth", 5).attr("markerHeight", 5).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 z").attr("fill", theme.linkStroke).attr("stroke", "none");
        root3.append("rect").attr("class", "wardley-background").attr("width", width3).attr("height", height2).attr("fill", theme.backgroundColor);
        const chartWidth = width3 - configValues.padding * 2;
        const chartHeight = height2 - configValues.padding * 2;
        if (title2) {
          root3.append("text").attr("class", "wardley-title").attr("x", width3 / 2).attr("y", configValues.padding / 2).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize * 1.05).attr("font-weight", "bold").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(title2);
        }
        const projectX = /* @__PURE__ */ __name((value2) => configValues.padding + value2 / 100 * chartWidth, "projectX");
        const projectY = /* @__PURE__ */ __name((value2) => height2 - configValues.padding - value2 / 100 * chartHeight, "projectY");
        const axisGroup = root3.append("g").attr("class", "wardley-axes");
        axisGroup.append("line").attr("x1", configValues.padding).attr("x2", width3 - configValues.padding).attr("y1", height2 - configValues.padding).attr("y2", height2 - configValues.padding).attr("stroke", theme.axisColor).attr("stroke-width", 1);
        axisGroup.append("line").attr("x1", configValues.padding).attr("x2", configValues.padding).attr("y1", configValues.padding).attr("y2", height2 - configValues.padding).attr("stroke", theme.axisColor).attr("stroke-width", 1);
        const xLabel = data5.axes.xLabel ?? "Evolution";
        const yLabel = data5.axes.yLabel ?? "Visibility";
        axisGroup.append("text").attr("class", "wardley-axis-label wardley-axis-label-x").attr("x", configValues.padding + chartWidth / 2).attr("y", height2 - configValues.padding / 4).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").text(xLabel);
        axisGroup.append("text").attr("class", "wardley-axis-label wardley-axis-label-y").attr("x", configValues.padding / 3).attr("y", configValues.padding + chartHeight / 2).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").attr(
          "transform",
          `rotate(-90 ${configValues.padding / 3} ${configValues.padding + chartHeight / 2})`
        ).text(yLabel);
        const stages = data5.axes.stages && data5.axes.stages.length > 0 ? data5.axes.stages : DEFAULT_STAGES;
        if (stages.length > 0) {
          const stageGroup = root3.append("g").attr("class", "wardley-stages");
          const boundaries2 = data5.axes.stageBoundaries;
          const stagePositions = [];
          if (boundaries2 && boundaries2.length === stages.length) {
            let prevBoundary = 0;
            boundaries2.forEach((boundary) => {
              stagePositions.push({ start: prevBoundary, end: boundary });
              prevBoundary = boundary;
            });
          } else {
            const stageWidth = 1 / stages.length;
            stages.forEach((_3, index) => {
              stagePositions.push({
                start: index * stageWidth,
                end: (index + 1) * stageWidth
              });
            });
          }
          stages.forEach((stage, index) => {
            const pos = stagePositions[index];
            const startX2 = configValues.padding + pos.start * chartWidth;
            const endX = configValues.padding + pos.end * chartWidth;
            const centerX = (startX2 + endX) / 2;
            if (index > 0) {
              stageGroup.append("line").attr("x1", startX2).attr("x2", startX2).attr("y1", configValues.padding).attr("y2", height2 - configValues.padding).attr("stroke", "#000").attr("stroke-width", 1).attr("stroke-dasharray", "5 5").attr("opacity", 0.8);
            }
            stageGroup.append("text").attr("class", "wardley-stage-label").attr("x", centerX).attr("y", height2 - configValues.padding / 1.5).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize - 2).attr("text-anchor", "middle").text(stage);
          });
        }
        if (configValues.showGrid) {
          const gridGroup = root3.append("g").attr("class", "wardley-grid");
          for (let i2 = 1; i2 < 4; i2++) {
            const ratio = i2 / 4;
            const x5 = configValues.padding + chartWidth * ratio;
            gridGroup.append("line").attr("x1", x5).attr("x2", x5).attr("y1", configValues.padding).attr("y2", height2 - configValues.padding).attr("stroke", theme.gridColor).attr("stroke-dasharray", "2 6");
            gridGroup.append("line").attr("x1", configValues.padding).attr("x2", width3 - configValues.padding).attr("y1", height2 - configValues.padding - chartHeight * ratio).attr("y2", height2 - configValues.padding - chartHeight * ratio).attr("stroke", theme.gridColor).attr("stroke-dasharray", "2 6");
          }
        }
        const positions2 = /* @__PURE__ */ new Map();
        data5.nodes.forEach((node2) => {
          positions2.set(node2.id, {
            x: projectX(node2.x),
            y: projectY(node2.y),
            node: node2
          });
        });
        if (data5.pipelines.length > 0) {
          const pipelineGroup = root3.append("g").attr("class", "wardley-pipelines");
          const pipelineLinksGroup = root3.append("g").attr("class", "wardley-pipeline-links");
          data5.pipelines.forEach((pipeline) => {
            if (pipeline.componentIds.length === 0) {
              return;
            }
            const sortedComponents = pipeline.componentIds.map((id35) => ({ id: id35, pos: positions2.get(id35), node: data5.nodes.find((n2) => n2.id === id35) })).filter((c3) => c3.pos && c3.node).sort((a2, b3) => a2.node.x - b3.node.x);
            for (let i2 = 0; i2 < sortedComponents.length - 1; i2++) {
              const current = sortedComponents[i2];
              const next3 = sortedComponents[i2 + 1];
              pipelineLinksGroup.append("line").attr("class", "wardley-pipeline-evolution-link").attr("x1", current.pos.x).attr("y1", current.pos.y).attr("x2", next3.pos.x).attr("y2", next3.pos.y).attr("stroke", theme.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", "4 4");
            }
            let minX = Infinity;
            let maxX = -Infinity;
            let y6 = 0;
            pipeline.componentIds.forEach((componentId) => {
              const pos = positions2.get(componentId);
              if (pos) {
                minX = Math.min(minX, pos.x);
                maxX = Math.max(maxX, pos.x);
                y6 = pos.y;
              }
            });
            if (minX !== Infinity && maxX !== -Infinity) {
              const padding2 = 15;
              const height3 = configValues.nodeRadius * 4;
              const boxTop = y6 - height3 / 2;
              const parentPos = positions2.get(pipeline.nodeId);
              if (parentPos) {
                const centerX = (minX + maxX) / 2;
                parentPos.x = centerX;
                parentPos.y = boxTop - squareSize / 6;
              }
              pipelineGroup.append("rect").attr("class", "wardley-pipeline-box").attr("x", minX - padding2).attr("y", boxTop).attr("width", maxX - minX + padding2 * 2).attr("height", height3).attr("fill", "none").attr("stroke", theme.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4);
            }
          });
        }
        const linksGroup = root3.append("g").attr("class", "wardley-links");
        const pipelineMap = /* @__PURE__ */ new Map();
        data5.pipelines.forEach((pipeline) => {
          pipelineMap.set(pipeline.nodeId, new Set(pipeline.componentIds));
        });
        const validLinks = data5.links.filter((link2) => {
          if (!positions2.has(link2.source) || !positions2.has(link2.target)) {
            return false;
          }
          const pipelineComponents = pipelineMap.get(link2.target);
          if (pipelineComponents?.has(link2.source)) {
            return false;
          }
          return true;
        });
        linksGroup.selectAll("line").data(validLinks).enter().append("line").attr("class", (link2) => `wardley-link${link2.dashed ? " wardley-link--dashed" : ""}`).attr("x1", (link2) => {
          const sourcePos = positions2.get(link2.source);
          const targetPos = positions2.get(link2.target);
          const sourceNode = data5.nodes.find((n2) => n2.id === link2.source);
          const radius2 = sourceNode.isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
          const dx = targetPos.x - sourcePos.x;
          const dy = targetPos.y - sourcePos.y;
          const distance3 = Math.sqrt(dx * dx + dy * dy);
          return sourcePos.x + dx / distance3 * radius2;
        }).attr("y1", (link2) => {
          const sourcePos = positions2.get(link2.source);
          const targetPos = positions2.get(link2.target);
          const sourceNode = data5.nodes.find((n2) => n2.id === link2.source);
          const radius2 = sourceNode.isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
          const dx = targetPos.x - sourcePos.x;
          const dy = targetPos.y - sourcePos.y;
          const distance3 = Math.sqrt(dx * dx + dy * dy);
          return sourcePos.y + dy / distance3 * radius2;
        }).attr("x2", (link2) => {
          const sourcePos = positions2.get(link2.source);
          const targetPos = positions2.get(link2.target);
          const targetNode = data5.nodes.find((n2) => n2.id === link2.target);
          const radius2 = targetNode.isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
          const dx = sourcePos.x - targetPos.x;
          const dy = sourcePos.y - targetPos.y;
          const distance3 = Math.sqrt(dx * dx + dy * dy);
          return targetPos.x + dx / distance3 * radius2;
        }).attr("y2", (link2) => {
          const sourcePos = positions2.get(link2.source);
          const targetPos = positions2.get(link2.target);
          const targetNode = data5.nodes.find((n2) => n2.id === link2.target);
          const radius2 = targetNode.isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
          const dx = sourcePos.x - targetPos.x;
          const dy = sourcePos.y - targetPos.y;
          const distance3 = Math.sqrt(dx * dx + dy * dy);
          return targetPos.y + dy / distance3 * radius2;
        }).attr("stroke", theme.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", (link2) => link2.dashed ? "6 6" : null).attr("marker-end", (link2) => {
          if (link2.flow === "forward" || link2.flow === "bidirectional") {
            return `url(#link-arrow-end-${id34})`;
          }
          return null;
        }).attr("marker-start", (link2) => {
          if (link2.flow === "backward" || link2.flow === "bidirectional") {
            return `url(#link-arrow-start-${id34})`;
          }
          return null;
        });
        linksGroup.selectAll("text").data(validLinks.filter((link2) => link2.label)).enter().append("text").attr("class", "wardley-link-label").attr("x", (link2) => {
          const sourcePos = positions2.get(link2.source);
          const targetPos = positions2.get(link2.target);
          const midX = (sourcePos.x + targetPos.x) / 2;
          const dy = targetPos.y - sourcePos.y;
          const dx = targetPos.x - sourcePos.x;
          const distance3 = Math.sqrt(dx * dx + dy * dy);
          const offset = 8;
          const perpX = dy / distance3;
          return midX + perpX * offset;
        }).attr("y", (link2) => {
          const sourcePos = positions2.get(link2.source);
          const targetPos = positions2.get(link2.target);
          const midY = (sourcePos.y + targetPos.y) / 2;
          const dx = targetPos.x - sourcePos.x;
          const dy = targetPos.y - sourcePos.y;
          const distance3 = Math.sqrt(dx * dx + dy * dy);
          const offset = 8;
          const perpY = -dx / distance3;
          return midY + perpY * offset;
        }).attr("fill", theme.axisTextColor).attr("font-size", configValues.labelFontSize).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("transform", (link2) => {
          const sourcePos = positions2.get(link2.source);
          const targetPos = positions2.get(link2.target);
          const midX = (sourcePos.x + targetPos.x) / 2;
          const midY = (sourcePos.y + targetPos.y) / 2;
          const dx = targetPos.x - sourcePos.x;
          const dy = targetPos.y - sourcePos.y;
          const distance3 = Math.sqrt(dx * dx + dy * dy);
          const offset = 8;
          const perpX = dy / distance3;
          const perpY = -dx / distance3;
          const labelX = midX + perpX * offset;
          const labelY = midY + perpY * offset;
          let angle2 = Math.atan2(dy, dx) * 180 / Math.PI;
          if (angle2 > 90 || angle2 < -90) {
            angle2 += 180;
          }
          return `rotate(${angle2} ${labelX} ${labelY})`;
        }).text((link2) => link2.label);
        const trendGroup = root3.append("g").attr("class", "wardley-trends");
        const trendsWithPositions = data5.trends.map((trend) => {
          const origin = positions2.get(trend.nodeId);
          if (!origin) {
            return null;
          }
          const targetX = projectX(trend.targetX);
          const targetY = projectY(trend.targetY);
          const dx = targetX - origin.x;
          const dy = targetY - origin.y;
          const distance3 = Math.sqrt(dx * dx + dy * dy);
          const shortenBy = configValues.nodeRadius + 2;
          const adjustedX2 = distance3 > shortenBy ? targetX - dx / distance3 * shortenBy : targetX;
          const adjustedY2 = distance3 > shortenBy ? targetY - dy / distance3 * shortenBy : targetY;
          return {
            origin,
            targetX,
            targetY,
            adjustedX2,
            adjustedY2
          };
        }).filter((trend) => trend !== null);
        trendGroup.selectAll("line").data(trendsWithPositions).enter().append("line").attr("class", "wardley-trend").attr("x1", (trend) => trend.origin.x).attr("y1", (trend) => trend.origin.y).attr("x2", (trend) => trend.adjustedX2).attr("y2", (trend) => trend.adjustedY2).attr("stroke", theme.evolutionStroke).attr("stroke-width", 1).attr("stroke-dasharray", "4 4").attr("marker-end", `url(#arrow-${id34})`);
        const nodesGroup = root3.append("g").attr("class", "wardley-nodes");
        const nodeEnter = nodesGroup.selectAll("g").data(data5.nodes).enter().append("g").attr(
          "class",
          (node2) => ["wardley-node", node2.className ? `wardley-node--${node2.className}` : ""].filter(Boolean).join(" ")
        );
        nodeEnter.filter((node2) => node2.sourceStrategy === "outsource").append("circle").attr("class", "wardley-outsource-overlay").attr("cx", (node2) => positions2.get(node2.id).x).attr("cy", (node2) => positions2.get(node2.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "#666").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
        nodeEnter.filter((node2) => node2.sourceStrategy === "buy").append("circle").attr("class", "wardley-buy-overlay").attr("cx", (node2) => positions2.get(node2.id).x).attr("cy", (node2) => positions2.get(node2.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "#ccc").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
        nodeEnter.filter((node2) => node2.sourceStrategy === "build").append("circle").attr("class", "wardley-build-overlay").attr("cx", (node2) => positions2.get(node2.id).x).attr("cy", (node2) => positions2.get(node2.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "#eee").attr("stroke", "#000").attr("stroke-width", 1);
        const marketNodes = nodeEnter.filter((node2) => node2.sourceStrategy === "market");
        marketNodes.append("circle").attr("class", "wardley-market-overlay").attr("cx", (node2) => positions2.get(node2.id).x).attr("cy", (node2) => positions2.get(node2.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
        nodeEnter.filter(
          (node2) => !node2.isPipelineParent && node2.sourceStrategy !== "market" && node2.className !== "anchor"
        ).append("circle").attr("cx", (node2) => positions2.get(node2.id).x).attr("cy", (node2) => positions2.get(node2.id).y).attr("r", configValues.nodeRadius).attr("fill", theme.componentFill).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
        const smallCircleRadius = configValues.nodeRadius * 0.7;
        const triangleRadius = configValues.nodeRadius * 1.2;
        marketNodes.append("line").attr("class", "wardley-market-line").attr("x1", (node2) => positions2.get(node2.id).x).attr("y1", (node2) => positions2.get(node2.id).y - triangleRadius).attr("x2", (node2) => positions2.get(node2.id).x - triangleRadius * Math.cos(Math.PI / 6)).attr("y2", (node2) => positions2.get(node2.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
        marketNodes.append("line").attr("class", "wardley-market-line").attr("x1", (node2) => positions2.get(node2.id).x - triangleRadius * Math.cos(Math.PI / 6)).attr("y1", (node2) => positions2.get(node2.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("x2", (node2) => positions2.get(node2.id).x + triangleRadius * Math.cos(Math.PI / 6)).attr("y2", (node2) => positions2.get(node2.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
        marketNodes.append("line").attr("class", "wardley-market-line").attr("x1", (node2) => positions2.get(node2.id).x + triangleRadius * Math.cos(Math.PI / 6)).attr("y1", (node2) => positions2.get(node2.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("x2", (node2) => positions2.get(node2.id).x).attr("y2", (node2) => positions2.get(node2.id).y - triangleRadius).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
        marketNodes.append("circle").attr("class", "wardley-market-dot").attr("cx", (node2) => positions2.get(node2.id).x).attr("cy", (node2) => positions2.get(node2.id).y - triangleRadius).attr("r", smallCircleRadius).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 2);
        marketNodes.append("circle").attr("class", "wardley-market-dot").attr("cx", (node2) => positions2.get(node2.id).x - triangleRadius * Math.cos(Math.PI / 6)).attr("cy", (node2) => positions2.get(node2.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("r", smallCircleRadius).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 2);
        marketNodes.append("circle").attr("class", "wardley-market-dot").attr("cx", (node2) => positions2.get(node2.id).x + triangleRadius * Math.cos(Math.PI / 6)).attr("cy", (node2) => positions2.get(node2.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("r", smallCircleRadius).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 2);
        nodeEnter.filter((node2) => node2.isPipelineParent === true).append("rect").attr("x", (node2) => positions2.get(node2.id).x - squareSize / 2).attr("y", (node2) => positions2.get(node2.id).y - squareSize / 2).attr("width", squareSize).attr("height", squareSize).attr("fill", theme.componentFill).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
        nodeEnter.filter((node2) => node2.inertia === true).append("line").attr("class", "wardley-inertia").attr("x1", (node2) => {
          const pos = positions2.get(node2.id);
          let offset = node2.isPipelineParent ? squareSize / 2 + 15 : configValues.nodeRadius + 15;
          if (node2.sourceStrategy) {
            offset += configValues.nodeRadius + 10;
          }
          return pos.x + offset;
        }).attr("y1", (node2) => {
          const pos = positions2.get(node2.id);
          const lineHeight = node2.isPipelineParent ? squareSize : configValues.nodeRadius * 2;
          return pos.y - lineHeight / 2;
        }).attr("x2", (node2) => {
          const pos = positions2.get(node2.id);
          let offset = node2.isPipelineParent ? squareSize / 2 + 15 : configValues.nodeRadius + 15;
          if (node2.sourceStrategy) {
            offset += configValues.nodeRadius + 10;
          }
          return pos.x + offset;
        }).attr("y2", (node2) => {
          const pos = positions2.get(node2.id);
          const lineHeight = node2.isPipelineParent ? squareSize : configValues.nodeRadius * 2;
          return pos.y + lineHeight / 2;
        }).attr("stroke", theme.componentStroke).attr("stroke-width", 6);
        nodeEnter.append("text").attr("x", (node2) => {
          const pos = positions2.get(node2.id);
          if (node2.className === "anchor") {
            return node2.labelOffsetX !== void 0 ? pos.x + node2.labelOffsetX : pos.x;
          }
          let defaultOffset = configValues.nodeLabelOffset;
          if (node2.sourceStrategy && node2.labelOffsetX === void 0) {
            defaultOffset += 10;
          }
          const customOffset = node2.labelOffsetX ?? defaultOffset;
          return pos.x + customOffset;
        }).attr("y", (node2) => {
          const pos = positions2.get(node2.id);
          if (node2.className === "anchor") {
            return node2.labelOffsetY !== void 0 ? pos.y + node2.labelOffsetY : pos.y - 3;
          }
          let defaultOffset = -configValues.nodeLabelOffset;
          if (node2.sourceStrategy && node2.labelOffsetY === void 0) {
            defaultOffset -= 10;
          }
          const customOffset = node2.labelOffsetY ?? defaultOffset;
          return pos.y + customOffset;
        }).attr("class", "wardley-node-label").attr("fill", (node2) => {
          if (node2.className === "evolved") {
            return theme.evolutionStroke;
          }
          if (node2.className === "anchor") {
            return "#000";
          }
          return theme.componentLabelColor;
        }).attr("font-size", configValues.labelFontSize).attr("font-weight", (node2) => node2.className === "anchor" ? "bold" : "normal").attr("text-anchor", (node2) => node2.className === "anchor" ? "middle" : "start").attr("dominant-baseline", (node2) => node2.className === "anchor" ? "middle" : "auto").text((node2) => node2.label);
        if (data5.annotations.length > 0) {
          const annotationsGroup = root3.append("g").attr("class", "wardley-annotations");
          data5.annotations.forEach((annotation) => {
            const projectedCoords = annotation.coordinates.map((coord) => ({
              x: projectX(coord.x),
              y: projectY(coord.y)
            }));
            if (projectedCoords.length > 1) {
              for (let i2 = 0; i2 < projectedCoords.length - 1; i2++) {
                annotationsGroup.append("line").attr("class", "wardley-annotation-line").attr("x1", projectedCoords[i2].x).attr("y1", projectedCoords[i2].y).attr("x2", projectedCoords[i2 + 1].x).attr("y2", projectedCoords[i2 + 1].y).attr("stroke", theme.axisColor).attr("stroke-width", 1.5).attr("stroke-dasharray", "4 4");
              }
            }
            projectedCoords.forEach((coord) => {
              const annotationNode = annotationsGroup.append("g").attr("class", "wardley-annotation");
              annotationNode.append("circle").attr("cx", coord.x).attr("cy", coord.y).attr("r", 10).attr("fill", "white").attr("stroke", theme.axisColor).attr("stroke-width", 1.5);
              annotationNode.append("text").attr("x", coord.x).attr("y", coord.y).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("font-size", 10).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(annotation.number);
            });
          });
          if (data5.annotationsBox) {
            let boxX = projectX(data5.annotationsBox.x);
            let boxY = projectY(data5.annotationsBox.y);
            const padding2 = 10;
            const lineHeight = 16;
            const fontSize = 11;
            const textBoxGroup = annotationsGroup.append("g").attr("class", "wardley-annotations-box");
            const sortedAnnotations = [...data5.annotations].filter((a2) => a2.text).sort((a2, b3) => a2.number - b3.number);
            const textElements = [];
            sortedAnnotations.forEach((annotation, idx) => {
              const text5 = textBoxGroup.append("text").attr("x", boxX + padding2).attr("y", boxY + padding2 + (idx + 1) * lineHeight).attr("font-size", fontSize).attr("fill", theme.axisTextColor).attr("text-anchor", "start").attr("dominant-baseline", "middle").text(`${annotation.number}. ${annotation.text}`);
              textElements.push(text5);
            });
            if (textElements.length > 0) {
              let maxWidth2 = 0;
              let maxHeight = 0;
              textElements.forEach((text5) => {
                const textNode = text5.node();
                const textWidth = textNode.getComputedTextLength();
                maxWidth2 = Math.max(maxWidth2, textWidth);
                const bbox = textNode.getBBox();
                maxHeight = Math.max(maxHeight, bbox.height);
              });
              const boxWidth = maxWidth2 + padding2 * 2 + 105;
              const boxHeight = sortedAnnotations.length * lineHeight + padding2 * 2 + maxHeight / 2;
              const minX = configValues.padding;
              const maxX = width3 - configValues.padding - boxWidth;
              const minY = configValues.padding;
              const maxY = height2 - configValues.padding - boxHeight;
              boxX = Math.max(minX, Math.min(boxX, maxX));
              boxY = Math.max(minY, Math.min(boxY, maxY));
              textElements.forEach((text5, idx) => {
                text5.attr("x", boxX + padding2).attr("y", boxY + padding2 + (idx + 1) * lineHeight);
              });
              textBoxGroup.insert("rect", "text").attr("x", boxX).attr("y", boxY).attr("width", boxWidth).attr("height", boxHeight).attr("fill", "white").attr("stroke", theme.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4);
            }
          }
        }
        if (data5.notes.length > 0) {
          const notesGroup = root3.append("g").attr("class", "wardley-notes");
          data5.notes.forEach((note3) => {
            const noteX = projectX(note3.x);
            const noteY = projectY(note3.y);
            notesGroup.append("text").attr("x", noteX).attr("y", noteY).attr("text-anchor", "start").attr("font-size", 11).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(note3.text);
          });
        }
        if (data5.accelerators.length > 0) {
          const acceleratorsGroup = root3.append("g").attr("class", "wardley-accelerators");
          data5.accelerators.forEach((accelerator) => {
            const accX = projectX(accelerator.x);
            const accY = projectY(accelerator.y);
            const arrowWidth = 60;
            const arrowHeight = 30;
            const arrowHeadWidth = 20;
            const arrowPath = `
        M ${accX} ${accY - arrowHeight / 2}
        L ${accX + arrowWidth - arrowHeadWidth} ${accY - arrowHeight / 2}
        L ${accX + arrowWidth - arrowHeadWidth} ${accY - arrowHeight / 2 - 8}
        L ${accX + arrowWidth} ${accY}
        L ${accX + arrowWidth - arrowHeadWidth} ${accY + arrowHeight / 2 + 8}
        L ${accX + arrowWidth - arrowHeadWidth} ${accY + arrowHeight / 2}
        L ${accX} ${accY + arrowHeight / 2}
        Z
      `;
            acceleratorsGroup.append("path").attr("d", arrowPath).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
            acceleratorsGroup.append("text").attr("x", accX + arrowWidth / 2).attr("y", accY + arrowHeight / 2 + 15).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(accelerator.name);
          });
        }
        if (data5.deaccelerators.length > 0) {
          const deacceleratorsGroup = root3.append("g").attr("class", "wardley-deaccelerators");
          data5.deaccelerators.forEach((deaccelerator) => {
            const decX = projectX(deaccelerator.x);
            const decY = projectY(deaccelerator.y);
            const arrowWidth = 60;
            const arrowHeight = 30;
            const arrowHeadWidth = 20;
            const arrowPath = `
        M ${decX + arrowWidth} ${decY - arrowHeight / 2}
        L ${decX + arrowHeadWidth} ${decY - arrowHeight / 2}
        L ${decX + arrowHeadWidth} ${decY - arrowHeight / 2 - 8}
        L ${decX} ${decY}
        L ${decX + arrowHeadWidth} ${decY + arrowHeight / 2 + 8}
        L ${decX + arrowHeadWidth} ${decY + arrowHeight / 2}
        L ${decX + arrowWidth} ${decY + arrowHeight / 2}
        Z
      `;
            deacceleratorsGroup.append("path").attr("d", arrowPath).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
            deacceleratorsGroup.append("text").attr("x", decX + arrowWidth / 2).attr("y", decY + arrowHeight / 2 + 15).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(deaccelerator.name);
          });
        }
      }, "draw");
      wardleyRenderer_default = {
        draw: draw30
      };
    }
  });

  // src/diagrams/wardley/wardleyDiagram.ts
  var wardleyDiagram_exports = {};
  __export(wardleyDiagram_exports, {
    diagram: () => diagram30
  });
  var diagram30;
  var init_wardleyDiagram = __esm({
    "src/diagrams/wardley/wardleyDiagram.ts"() {
      "use strict";
      init_wardleyParser();
      init_wardleyDb();
      init_wardleyRenderer();
      diagram30 = {
        parser: parser27,
        db: wardleyDb_default,
        renderer: wardleyRenderer_default,
        styles: /* @__PURE__ */ __name(() => "", "styles")
      };
    }
  });

  // src/mermaid.ts
  var mermaid_exports = {};
  __export(mermaid_exports, {
    default: () => mermaid_default
  });
  init_icons();
  init_esm();
  init_detectType();

  // src/diagrams/c4/c4Detector.ts
  var id2 = "c4";
  var detector = /* @__PURE__ */ __name((txt) => {
    return /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt);
  }, "detector");
  var loader = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_c4Diagram2(), c4Diagram_exports));
    return { id: id2, diagram: diagram31 };
  }, "loader");
  var plugin = {
    id: id2,
    detector,
    loader
  };
  var c4Detector_default = plugin;

  // src/diagrams/flowchart/flowDetector.ts
  var id4 = "flowchart";
  var detector2 = /* @__PURE__ */ __name((txt, config5) => {
    if (config5?.flowchart?.defaultRenderer === "dagre-wrapper" || config5?.flowchart?.defaultRenderer === "elk") {
      return false;
    }
    return /^\s*graph/.test(txt);
  }, "detector");
  var loader3 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_flowDiagram(), flowDiagram_exports));
    return { id: id4, diagram: diagram31 };
  }, "loader");
  var plugin2 = {
    id: id4,
    detector: detector2,
    loader: loader3
  };
  var flowDetector_default = plugin2;

  // src/diagrams/flowchart/flowDetector-v2.ts
  var id5 = "flowchart-v2";
  var detector3 = /* @__PURE__ */ __name((txt, config5) => {
    if (config5?.flowchart?.defaultRenderer === "dagre-d3") {
      return false;
    }
    if (config5?.flowchart?.defaultRenderer === "elk") {
      config5.layout = "elk";
    }
    if (/^\s*graph/.test(txt) && config5?.flowchart?.defaultRenderer === "dagre-wrapper") {
      return true;
    }
    return /^\s*flowchart/.test(txt);
  }, "detector");
  var loader4 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_flowDiagram(), flowDiagram_exports));
    return { id: id5, diagram: diagram31 };
  }, "loader");
  var plugin3 = {
    id: id5,
    detector: detector3,
    loader: loader4
  };
  var flowDetector_v2_default = plugin3;

  // src/diagrams/er/erDetector.ts
  var id6 = "er";
  var detector4 = /* @__PURE__ */ __name((txt) => {
    return /^\s*erDiagram/.test(txt);
  }, "detector");
  var loader5 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_erDiagram2(), erDiagram_exports));
    return { id: id6, diagram: diagram31 };
  }, "loader");
  var plugin4 = {
    id: id6,
    detector: detector4,
    loader: loader5
  };
  var erDetector_default = plugin4;

  // src/diagrams/git/gitGraphDetector.ts
  var id7 = "gitGraph";
  var detector5 = /* @__PURE__ */ __name((txt) => {
    return /^\s*gitGraph/.test(txt);
  }, "detector");
  var loader6 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_gitGraphDiagram(), gitGraphDiagram_exports));
    return { id: id7, diagram: diagram31 };
  }, "loader");
  var plugin5 = {
    id: id7,
    detector: detector5,
    loader: loader6
  };
  var gitGraphDetector_default = plugin5;

  // src/diagrams/gantt/ganttDetector.ts
  var id8 = "gantt";
  var detector6 = /* @__PURE__ */ __name((txt) => {
    return /^\s*gantt/.test(txt);
  }, "detector");
  var loader7 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_ganttDiagram(), ganttDiagram_exports));
    return { id: id8, diagram: diagram31 };
  }, "loader");
  var plugin6 = {
    id: id8,
    detector: detector6,
    loader: loader7
  };
  var ganttDetector_default = plugin6;

  // src/diagrams/info/infoDetector.ts
  var id9 = "info";
  var detector7 = /* @__PURE__ */ __name((txt) => {
    return /^\s*info/.test(txt);
  }, "detector");
  var loader8 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_infoDiagram(), infoDiagram_exports));
    return { id: id9, diagram: diagram31 };
  }, "loader");
  var info = {
    id: id9,
    detector: detector7,
    loader: loader8
  };

  // src/diagrams/pie/pieDetector.ts
  var id10 = "pie";
  var detector8 = /* @__PURE__ */ __name((txt) => {
    return /^\s*pie/.test(txt);
  }, "detector");
  var loader9 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_pieDiagram(), pieDiagram_exports));
    return { id: id10, diagram: diagram31 };
  }, "loader");
  var pie = {
    id: id10,
    detector: detector8,
    loader: loader9
  };

  // src/diagrams/quadrant-chart/quadrantDetector.ts
  var id11 = "quadrantChart";
  var detector9 = /* @__PURE__ */ __name((txt) => {
    return /^\s*quadrantChart/.test(txt);
  }, "detector");
  var loader10 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_quadrantDiagram(), quadrantDiagram_exports));
    return { id: id11, diagram: diagram31 };
  }, "loader");
  var plugin7 = {
    id: id11,
    detector: detector9,
    loader: loader10
  };
  var quadrantDetector_default = plugin7;

  // src/diagrams/xychart/xychartDetector.ts
  var id12 = "xychart";
  var detector10 = /* @__PURE__ */ __name((txt) => {
    return /^\s*xychart(-beta)?/.test(txt);
  }, "detector");
  var loader11 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_xychartDiagram(), xychartDiagram_exports));
    return { id: id12, diagram: diagram31 };
  }, "loader");
  var plugin8 = {
    id: id12,
    detector: detector10,
    loader: loader11
  };
  var xychartDetector_default = plugin8;

  // src/diagrams/requirement/requirementDetector.ts
  var id13 = "requirement";
  var detector11 = /* @__PURE__ */ __name((txt) => {
    return /^\s*requirement(Diagram)?/.test(txt);
  }, "detector");
  var loader12 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_requirementDiagram2(), requirementDiagram_exports));
    return { id: id13, diagram: diagram31 };
  }, "loader");
  var plugin9 = {
    id: id13,
    detector: detector11,
    loader: loader12
  };
  var requirementDetector_default = plugin9;

  // src/diagrams/sequence/sequenceDetector.ts
  var id14 = "sequence";
  var detector12 = /* @__PURE__ */ __name((txt) => {
    return /^\s*sequenceDiagram/.test(txt);
  }, "detector");
  var loader13 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_sequenceDiagram2(), sequenceDiagram_exports));
    return { id: id14, diagram: diagram31 };
  }, "loader");
  var plugin10 = {
    id: id14,
    detector: detector12,
    loader: loader13
  };
  var sequenceDetector_default = plugin10;

  // src/diagrams/class/classDetector.ts
  var id15 = "class";
  var detector13 = /* @__PURE__ */ __name((txt, config5) => {
    if (config5?.class?.defaultRenderer === "dagre-wrapper") {
      return false;
    }
    return /^\s*classDiagram/.test(txt);
  }, "detector");
  var loader14 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_classDiagram2(), classDiagram_exports));
    return { id: id15, diagram: diagram31 };
  }, "loader");
  var plugin11 = {
    id: id15,
    detector: detector13,
    loader: loader14
  };
  var classDetector_default = plugin11;

  // src/diagrams/class/classDetector-V2.ts
  var id16 = "classDiagram";
  var detector14 = /* @__PURE__ */ __name((txt, config5) => {
    if (/^\s*classDiagram/.test(txt) && config5?.class?.defaultRenderer === "dagre-wrapper") {
      return true;
    }
    return /^\s*classDiagram-v2/.test(txt);
  }, "detector");
  var loader15 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_classDiagram_v2(), classDiagram_v2_exports));
    return { id: id16, diagram: diagram31 };
  }, "loader");
  var plugin12 = {
    id: id16,
    detector: detector14,
    loader: loader15
  };
  var classDetector_V2_default = plugin12;

  // src/diagrams/state/stateDetector.ts
  var id17 = "state";
  var detector15 = /* @__PURE__ */ __name((txt, config5) => {
    if (config5?.state?.defaultRenderer === "dagre-wrapper") {
      return false;
    }
    return /^\s*stateDiagram/.test(txt);
  }, "detector");
  var loader16 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_stateDiagram2(), stateDiagram_exports));
    return { id: id17, diagram: diagram31 };
  }, "loader");
  var plugin13 = {
    id: id17,
    detector: detector15,
    loader: loader16
  };
  var stateDetector_default = plugin13;

  // src/diagrams/state/stateDetector-V2.ts
  var id18 = "stateDiagram";
  var detector16 = /* @__PURE__ */ __name((txt, config5) => {
    if (/^\s*stateDiagram-v2/.test(txt)) {
      return true;
    }
    if (/^\s*stateDiagram/.test(txt) && config5?.state?.defaultRenderer === "dagre-wrapper") {
      return true;
    }
    return false;
  }, "detector");
  var loader17 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_stateDiagram_v2(), stateDiagram_v2_exports));
    return { id: id18, diagram: diagram31 };
  }, "loader");
  var plugin14 = {
    id: id18,
    detector: detector16,
    loader: loader17
  };
  var stateDetector_V2_default = plugin14;

  // src/diagrams/user-journey/journeyDetector.ts
  var id19 = "journey";
  var detector17 = /* @__PURE__ */ __name((txt) => {
    return /^\s*journey/.test(txt);
  }, "detector");
  var loader18 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_journeyDiagram(), journeyDiagram_exports));
    return { id: id19, diagram: diagram31 };
  }, "loader");
  var plugin15 = {
    id: id19,
    detector: detector17,
    loader: loader18
  };
  var journeyDetector_default = plugin15;

  // src/diagrams/error/errorRenderer.ts
  init_logger();
  init_selectSvgElement();
  init_setupGraphViewbox();
  var draw16 = /* @__PURE__ */ __name((_text, id34, version3) => {
    log.debug("rendering svg for syntax error\n");
    const svg2 = selectSvgElement(id34);
    const g2 = svg2.append("g");
    svg2.attr("viewBox", "0 0 2412 512");
    configureSvgSize(svg2, 100, 512, true);
    g2.append("path").attr("class", "error-icon").attr(
      "d",
      "m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"
    );
    g2.append("path").attr("class", "error-icon").attr(
      "d",
      "m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"
    );
    g2.append("path").attr("class", "error-icon").attr(
      "d",
      "m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"
    );
    g2.append("path").attr("class", "error-icon").attr(
      "d",
      "m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"
    );
    g2.append("path").attr("class", "error-icon").attr(
      "d",
      "m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"
    );
    g2.append("path").attr("class", "error-icon").attr(
      "d",
      "m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"
    );
    g2.append("text").attr("class", "error-text").attr("x", 1440).attr("y", 250).attr("font-size", "150px").style("text-anchor", "middle").text("Syntax error in text");
    g2.append("text").attr("class", "error-text").attr("x", 1250).attr("y", 400).attr("font-size", "100px").style("text-anchor", "middle").text(`mermaid version ${version3}`);
  }, "draw");
  var renderer5 = { draw: draw16 };
  var errorRenderer_default = renderer5;

  // src/diagrams/error/errorDiagram.ts
  var diagram17 = {
    db: {},
    renderer: renderer5,
    parser: {
      parse: /* @__PURE__ */ __name(() => {
        return;
      }, "parse")
    }
  };
  var errorDiagram_default = diagram17;

  // src/diagrams/flowchart/elk/detector.ts
  var id20 = "flowchart-elk";
  var detector18 = /* @__PURE__ */ __name((txt, config5 = {}) => {
    if (
      // If diagram explicitly states flowchart-elk
      /^\s*flowchart-elk/.test(txt) || // If a flowchart/graph diagram has their default renderer set to elk
      /^\s*(flowchart|graph)/.test(txt) && config5?.flowchart?.defaultRenderer === "elk"
    ) {
      config5.layout = "elk";
      return true;
    }
    return false;
  }, "detector");
  var loader19 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_flowDiagram(), flowDiagram_exports));
    return { id: id20, diagram: diagram31 };
  }, "loader");
  var plugin16 = {
    id: id20,
    detector: detector18,
    loader: loader19
  };
  var detector_default = plugin16;

  // src/diagrams/timeline/detector.ts
  var id21 = "timeline";
  var detector19 = /* @__PURE__ */ __name((txt) => {
    return /^\s*timeline/.test(txt);
  }, "detector");
  var loader20 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_timeline_definition(), timeline_definition_exports));
    return { id: id21, diagram: diagram31 };
  }, "loader");
  var plugin17 = {
    id: id21,
    detector: detector19,
    loader: loader20
  };
  var detector_default2 = plugin17;

  // src/diagrams/mindmap/detector.ts
  var id22 = "mindmap";
  var detector20 = /* @__PURE__ */ __name((txt) => {
    return /^\s*mindmap/.test(txt);
  }, "detector");
  var loader21 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_mindmap_definition(), mindmap_definition_exports));
    return { id: id22, diagram: diagram31 };
  }, "loader");
  var plugin18 = {
    id: id22,
    detector: detector20,
    loader: loader21
  };
  var detector_default3 = plugin18;

  // src/diagrams/kanban/detector.ts
  var id23 = "kanban";
  var detector21 = /* @__PURE__ */ __name((txt) => {
    return /^\s*kanban/.test(txt);
  }, "detector");
  var loader22 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_kanban_definition(), kanban_definition_exports));
    return { id: id23, diagram: diagram31 };
  }, "loader");
  var plugin19 = {
    id: id23,
    detector: detector21,
    loader: loader22
  };
  var detector_default4 = plugin19;

  // src/diagrams/sankey/sankeyDetector.ts
  var id24 = "sankey";
  var detector22 = /* @__PURE__ */ __name((txt) => {
    return /^\s*sankey(-beta)?/.test(txt);
  }, "detector");
  var loader23 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_sankeyDiagram(), sankeyDiagram_exports));
    return { id: id24, diagram: diagram31 };
  }, "loader");
  var plugin20 = {
    id: id24,
    detector: detector22,
    loader: loader23
  };
  var sankeyDetector_default = plugin20;

  // src/diagrams/packet/detector.ts
  var id25 = "packet";
  var detector23 = /* @__PURE__ */ __name((txt) => {
    return /^\s*packet(-beta)?/.test(txt);
  }, "detector");
  var loader24 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_diagram(), diagram_exports));
    return { id: id25, diagram: diagram31 };
  }, "loader");
  var packet = {
    id: id25,
    detector: detector23,
    loader: loader24
  };

  // src/diagrams/radar/detector.ts
  var id26 = "radar";
  var detector24 = /* @__PURE__ */ __name((txt) => {
    return /^\s*radar-beta/.test(txt);
  }, "detector");
  var loader25 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_diagram2(), diagram_exports2));
    return { id: id26, diagram: diagram31 };
  }, "loader");
  var radar = {
    id: id26,
    detector: detector24,
    loader: loader25
  };

  // src/diagrams/block/blockDetector.ts
  var id27 = "block";
  var detector25 = /* @__PURE__ */ __name((txt) => {
    return /^\s*block(-beta)?/.test(txt);
  }, "detector");
  var loader26 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_blockDiagram(), blockDiagram_exports));
    return { id: id27, diagram: diagram31 };
  }, "loader");
  var plugin21 = {
    id: id27,
    detector: detector25,
    loader: loader26
  };
  var blockDetector_default = plugin21;

  // src/diagrams/treeView/detector.ts
  var id28 = "treeView";
  var detector26 = /* @__PURE__ */ __name((txt) => {
    return /^\s*treeView-beta/.test(txt);
  }, "detector");
  var loader27 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_diagram3(), diagram_exports3));
    return { id: id28, diagram: diagram31 };
  }, "loader");
  var plugin22 = {
    id: id28,
    detector: detector26,
    loader: loader27
  };
  var detector_default5 = plugin22;

  // src/diagrams/architecture/architectureDetector.ts
  var id29 = "architecture";
  var detector27 = /* @__PURE__ */ __name((txt) => {
    return /^\s*architecture/.test(txt);
  }, "detector");
  var loader28 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_architectureDiagram(), architectureDiagram_exports));
    return { id: id29, diagram: diagram31 };
  }, "loader");
  var architecture = {
    id: id29,
    detector: detector27,
    loader: loader28
  };
  var architectureDetector_default = architecture;

  // src/diagrams/ishikawa/ishikawaDetector.ts
  var id30 = "ishikawa";
  var detector28 = /* @__PURE__ */ __name((txt) => {
    return /^\s*ishikawa(-beta)?\b/i.test(txt);
  }, "detector");
  var loader29 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_ishikawaDiagram(), ishikawaDiagram_exports));
    return { id: id30, diagram: diagram31 };
  }, "loader");
  var ishikawa = {
    id: id30,
    detector: detector28,
    loader: loader29
  };

  // src/diagrams/venn/vennDetector.ts
  var id31 = "venn";
  var detector29 = /* @__PURE__ */ __name((txt) => {
    return /^\s*venn-beta/.test(txt);
  }, "detector");
  var loader30 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_vennDiagram(), vennDiagram_exports));
    return { id: id31, diagram: diagram31 };
  }, "loader");
  var plugin23 = {
    id: id31,
    detector: detector29,
    loader: loader30
  };
  var vennDetector_default = plugin23;

  // src/diagram-api/diagram-orchestration.ts
  init_detectType();
  init_diagramAPI();

  // src/diagrams/treemap/detector.ts
  var id32 = "treemap";
  var detector30 = /* @__PURE__ */ __name((txt) => {
    return /^\s*treemap/.test(txt);
  }, "detector");
  var loader31 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_diagram4(), diagram_exports4));
    return { id: id32, diagram: diagram31 };
  }, "loader");
  var treemap = {
    id: id32,
    detector: detector30,
    loader: loader31
  };

  // src/diagrams/wardley/wardleyDetector.ts
  var id33 = "wardley-beta";
  var detector31 = /* @__PURE__ */ __name((text4) => {
    return /^\s*wardley-beta/i.test(text4);
  }, "detector");
  var loader32 = /* @__PURE__ */ __name(async () => {
    const { diagram: diagram31 } = await Promise.resolve().then(() => (init_wardleyDiagram(), wardleyDiagram_exports));
    return { id: id33, diagram: diagram31 };
  }, "loader");
  var plugin24 = {
    id: id33,
    detector: detector31,
    loader: loader32
  };
  var wardleyDetector_default = plugin24;

  // src/diagram-api/diagram-orchestration.ts
  var hasLoadedDiagrams = false;
  var addDiagrams = /* @__PURE__ */ __name(() => {
    if (hasLoadedDiagrams) {
      return;
    }
    hasLoadedDiagrams = true;
    registerDiagram("error", errorDiagram_default, (text4) => {
      return text4.toLowerCase().trim() === "error";
    });
    registerDiagram(
      "---",
      // --- diagram type may appear if YAML front-matter is not parsed correctly
      {
        db: {
          clear: /* @__PURE__ */ __name(() => {
          }, "clear")
        },
        styles: {},
        // should never be used
        renderer: {
          draw: /* @__PURE__ */ __name(() => {
          }, "draw")
        },
        parser: {
          parse: /* @__PURE__ */ __name(() => {
            throw new Error(
              "Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks"
            );
          }, "parse")
        },
        init: /* @__PURE__ */ __name(() => null, "init")
        // no op
      },
      (text4) => {
        return text4.toLowerCase().trimStart().startsWith("---");
      }
    );
    if (true) {
      registerLazyLoadedDiagrams(detector_default, detector_default3, architectureDetector_default);
    }
    registerLazyLoadedDiagrams(
      c4Detector_default,
      detector_default4,
      classDetector_V2_default,
      classDetector_default,
      erDetector_default,
      ganttDetector_default,
      info,
      pie,
      requirementDetector_default,
      sequenceDetector_default,
      flowDetector_v2_default,
      flowDetector_default,
      detector_default2,
      gitGraphDetector_default,
      stateDetector_V2_default,
      stateDetector_default,
      journeyDetector_default,
      quadrantDetector_default,
      sankeyDetector_default,
      packet,
      xychartDetector_default,
      blockDetector_default,
      detector_default5,
      radar,
      ishikawa,
      treemap,
      vennDetector_default,
      wardleyDetector_default
    );
  }, "addDiagrams");

  // src/diagram-api/loadDiagram.ts
  init_logger();
  init_detectType();
  init_diagramAPI();
  var loadRegisteredDiagrams = /* @__PURE__ */ __name(async () => {
    log.debug(`Loading registered diagrams`);
    const results = await Promise.allSettled(
      Object.entries(detectors).map(async ([key, { detector: detector32, loader: loader33 }]) => {
        if (!loader33) {
          return;
        }
        try {
          getDiagram(key);
        } catch {
          try {
            const { diagram: diagram31, id: id34 } = await loader33();
            registerDiagram(id34, diagram31, detector32);
          } catch (err) {
            log.error(`Failed to load external diagram with key ${key}. Removing from detectors.`);
            delete detectors[key];
            throw err;
          }
        }
      })
    );
    const failed = results.filter((result) => result.status === "rejected");
    if (failed.length > 0) {
      log.error(`Failed to load ${failed.length} external diagrams`);
      for (const res of failed) {
        log.error(res);
      }
      throw new Error(`Failed to load ${failed.length} external diagrams`);
    }
  }, "loadRegisteredDiagrams");

  // src/mermaid.ts
  init_logger();

  // src/mermaidAPI.ts
  init_src32();

  // ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Enum.js
  var COMMENT = "comm";
  var RULESET = "rule";
  var DECLARATION = "decl";
  var IMPORT = "@import";
  var NAMESPACE = "@namespace";
  var KEYFRAMES = "@keyframes";
  var LAYER = "@layer";

  // ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Utility.js
  var abs3 = Math.abs;
  var from = String.fromCharCode;
  function trim(value2) {
    return value2.trim();
  }
  __name(trim, "trim");
  function replace(value2, pattern, replacement) {
    return value2.replace(pattern, replacement);
  }
  __name(replace, "replace");
  function indexof(value2, search, position5) {
    return value2.indexOf(search, position5);
  }
  __name(indexof, "indexof");
  function charat(value2, index) {
    return value2.charCodeAt(index) | 0;
  }
  __name(charat, "charat");
  function substr(value2, begin, end2) {
    return value2.slice(begin, end2);
  }
  __name(substr, "substr");
  function strlen(value2) {
    return value2.length;
  }
  __name(strlen, "strlen");
  function sizeof(value2) {
    return value2.length;
  }
  __name(sizeof, "sizeof");
  function append2(value2, array4) {
    return array4.push(value2), value2;
  }
  __name(append2, "append");

  // ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Tokenizer.js
  var line = 1;
  var column = 1;
  var length = 0;
  var position4 = 0;
  var character = 0;
  var characters = "";
  function node(value2, root3, parent4, type3, props, children2, length2, siblings2) {
    return { value: value2, root: root3, parent: parent4, type: type3, props, children: children2, line, column, length: length2, return: "", siblings: siblings2 };
  }
  __name(node, "node");
  function char() {
    return character;
  }
  __name(char, "char");
  function prev() {
    character = position4 > 0 ? charat(characters, --position4) : 0;
    if (column--, character === 10)
      column = 1, line--;
    return character;
  }
  __name(prev, "prev");
  function next2() {
    character = position4 < length ? charat(characters, position4++) : 0;
    if (column++, character === 10)
      column = 1, line++;
    return character;
  }
  __name(next2, "next");
  function peek() {
    return charat(characters, position4);
  }
  __name(peek, "peek");
  function caret() {
    return position4;
  }
  __name(caret, "caret");
  function slice4(begin, end2) {
    return substr(characters, begin, end2);
  }
  __name(slice4, "slice");
  function token(type3) {
    switch (type3) {
      // \0 \t \n \r \s whitespace token
      case 0:
      case 9:
      case 10:
      case 13:
      case 32:
        return 5;
      // ! + , / > @ ~ isolate token
      case 33:
      case 43:
      case 44:
      case 47:
      case 62:
      case 64:
      case 126:
      // ; { } breakpoint token
      case 59:
      case 123:
      case 125:
        return 4;
      // : accompanied token
      case 58:
        return 3;
      // " ' ( [ opening delimit token
      case 34:
      case 39:
      case 40:
      case 91:
        return 2;
      // ) ] closing delimit token
      case 41:
      case 93:
        return 1;
    }
    return 0;
  }
  __name(token, "token");
  function alloc(value2) {
    return line = column = 1, length = strlen(characters = value2), position4 = 0, [];
  }
  __name(alloc, "alloc");
  function dealloc(value2) {
    return characters = "", value2;
  }
  __name(dealloc, "dealloc");
  function delimit(type3) {
    return trim(slice4(position4 - 1, delimiter2(type3 === 91 ? type3 + 2 : type3 === 40 ? type3 + 1 : type3)));
  }
  __name(delimit, "delimit");
  function whitespace(type3) {
    while (character = peek())
      if (character < 33)
        next2();
      else
        break;
    return token(type3) > 2 || token(character) > 3 ? "" : " ";
  }
  __name(whitespace, "whitespace");
  function escaping(index, count2) {
    while (--count2 && next2())
      if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97)
        break;
    return slice4(index, caret() + (count2 < 6 && peek() == 32 && next2() == 32));
  }
  __name(escaping, "escaping");
  function delimiter2(type3) {
    while (next2())
      switch (character) {
        // ] ) " '
        case type3:
          return position4;
        // " '
        case 34:
        case 39:
          if (type3 !== 34 && type3 !== 39)
            delimiter2(character);
          break;
        // (
        case 40:
          if (type3 === 41)
            delimiter2(type3);
          break;
        // \
        case 92:
          next2();
          break;
      }
    return position4;
  }
  __name(delimiter2, "delimiter");
  function commenter(type3, index) {
    while (next2())
      if (type3 + character === 47 + 10)
        break;
      else if (type3 + character === 42 + 42 && peek() === 47)
        break;
    return "/*" + slice4(index, position4 - 1) + "*" + from(type3 === 47 ? type3 : next2());
  }
  __name(commenter, "commenter");
  function identifier(index) {
    while (!token(peek()))
      next2();
    return slice4(index, position4);
  }
  __name(identifier, "identifier");

  // ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Parser.js
  function compile(value2) {
    return dealloc(parse4("", null, null, null, [""], value2 = alloc(value2), 0, [0], value2));
  }
  __name(compile, "compile");
  function parse4(value2, root3, parent4, rule, rules, rulesets, pseudo, points, declarations) {
    var index = 0;
    var offset = 0;
    var length2 = pseudo;
    var atrule = 0;
    var property2 = 0;
    var previous = 0;
    var variable = 1;
    var scanning = 1;
    var ampersand = 1;
    var character2 = 0;
    var type3 = "";
    var props = rules;
    var children2 = rulesets;
    var reference = rule;
    var characters2 = type3;
    while (scanning)
      switch (previous = character2, character2 = next2()) {
        // (
        case 40:
          if (previous != 108 && charat(characters2, length2 - 1) == 58) {
            if (indexof(characters2 += replace(delimit(character2), "&", "&\f"), "&\f", abs3(index ? points[index - 1] : 0)) != -1)
              ampersand = -1;
            break;
          }
        // " ' [
        case 34:
        case 39:
        case 91:
          characters2 += delimit(character2);
          break;
        // \t \n \r \s
        case 9:
        case 10:
        case 13:
        case 32:
          characters2 += whitespace(previous);
          break;
        // \
        case 92:
          characters2 += escaping(caret() - 1, 7);
          continue;
        // /
        case 47:
          switch (peek()) {
            case 42:
            case 47:
              append2(comment(commenter(next2(), caret()), root3, parent4, declarations), declarations);
              if ((token(previous || 1) == 5 || token(peek() || 1) == 5) && strlen(characters2) && substr(characters2, -1, void 0) !== " ") characters2 += " ";
              break;
            default:
              characters2 += "/";
          }
          break;
        // {
        case 123 * variable:
          points[index++] = strlen(characters2) * ampersand;
        // } ; \0
        case 125 * variable:
        case 59:
        case 0:
          switch (character2) {
            // \0 }
            case 0:
            case 125:
              scanning = 0;
            // ;
            case 59 + offset:
              if (ampersand == -1) characters2 = replace(characters2, /\f/g, "");
              if (property2 > 0 && (strlen(characters2) - length2 || variable === 0 && previous === 47))
                append2(property2 > 32 ? declaration(characters2 + ";", rule, parent4, length2 - 1, declarations) : declaration(replace(characters2, " ", "") + ";", rule, parent4, length2 - 2, declarations), declarations);
              break;
            // @ ;
            case 59:
              characters2 += ";";
            // { rule/at-rule
            default:
              append2(reference = ruleset(characters2, root3, parent4, index, offset, rules, points, type3, props = [], children2 = [], length2, rulesets), rulesets);
              if (character2 === 123)
                if (offset === 0)
                  parse4(characters2, root3, reference, reference, props, rulesets, length2, points, children2);
                else {
                  switch (atrule) {
                    // c(ontainer)
                    case 99:
                      if (charat(characters2, 3) === 110) break;
                    // l(ayer)
                    case 108:
                      if (charat(characters2, 2) === 97) break;
                    default:
                      offset = 0;
                    // d(ocument) m(edia) s(upports)
                    case 100:
                    case 109:
                    case 115:
                  }
                  if (offset) parse4(value2, reference, reference, rule && append2(ruleset(value2, reference, reference, 0, 0, rules, points, type3, rules, props = [], length2, children2), children2), rules, children2, length2, points, rule ? props : children2);
                  else parse4(characters2, reference, reference, reference, [""], children2, 0, points, children2);
                }
          }
          index = offset = property2 = 0, variable = ampersand = 1, type3 = characters2 = "", length2 = pseudo;
          break;
        // :
        case 58:
          length2 = 1 + strlen(characters2), property2 = previous;
        default:
          if (variable < 1) {
            if (character2 == 123)
              --variable;
            else if (character2 == 125 && variable++ == 0 && prev() == 125)
              continue;
          }
          switch (characters2 += from(character2), character2 * variable) {
            // &
            case 38:
              ampersand = offset > 0 ? 1 : (characters2 += "\f", -1);
              break;
            // ,
            case 44:
              points[index++] = (strlen(characters2) - 1) * ampersand, ampersand = 1;
              break;
            // @
            case 64:
              if (peek() === 45)
                characters2 += delimit(next2());
              atrule = peek(), offset = length2 = strlen(type3 = characters2 += identifier(caret())), character2++;
              break;
            // -
            case 45:
              if (previous === 45 && strlen(characters2) == 2)
                variable = 0;
          }
      }
    return rulesets;
  }
  __name(parse4, "parse");
  function ruleset(value2, root3, parent4, index, offset, rules, points, type3, props, children2, length2, siblings2) {
    var post = offset - 1;
    var rule = offset === 0 ? rules : [""];
    var size4 = sizeof(rule);
    for (var i2 = 0, j3 = 0, k2 = 0; i2 < index; ++i2)
      for (var x5 = 0, y6 = substr(value2, post + 1, post = abs3(j3 = points[i2])), z3 = value2; x5 < size4; ++x5)
        if (z3 = trim(j3 > 0 ? rule[x5] + " " + y6 : replace(y6, /&\f/g, rule[x5])))
          props[k2++] = z3;
    return node(value2, root3, parent4, offset === 0 ? RULESET : type3, props, children2, length2, siblings2);
  }
  __name(ruleset, "ruleset");
  function comment(value2, root3, parent4, siblings2) {
    return node(value2, root3, parent4, COMMENT, from(char()), substr(value2, 2, -2), 0, siblings2);
  }
  __name(comment, "comment");
  function declaration(value2, root3, parent4, length2, siblings2) {
    return node(value2, root3, parent4, DECLARATION, substr(value2, 0, length2), substr(value2, length2 + 1, -1), length2, siblings2);
  }
  __name(declaration, "declaration");

  // ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Serializer.js
  function serialize(children2, callback) {
    var output2 = "";
    for (var i2 = 0; i2 < children2.length; i2++)
      output2 += callback(children2[i2], i2, children2, callback) || "";
    return output2;
  }
  __name(serialize, "serialize");
  function stringify(element3, index, children2, callback) {
    switch (element3.type) {
      case LAYER:
        if (element3.children.length) break;
      case IMPORT:
      case NAMESPACE:
      case DECLARATION:
        return element3.return = element3.return || element3.value;
      case COMMENT:
        return "";
      case KEYFRAMES:
        return element3.return = element3.value + "{" + serialize(element3.children, callback) + "}";
      case RULESET:
        if (!strlen(element3.value = element3.props.join(","))) return "";
    }
    return strlen(children2 = serialize(element3.children, callback)) ? element3.return = element3.value + "{" + children2 + "}" : "";
  }
  __name(stringify, "stringify");

  // src/mermaidAPI.ts
  init_purify_es();
  init_isEmpty();

  // src/accessibility.ts
  var SVG_ROLE = "graphics-document document";
  function setA11yDiagramInfo(svg2, diagramType) {
    svg2.attr("role", SVG_ROLE);
    if (diagramType !== "") {
      svg2.attr("aria-roledescription", diagramType);
    }
  }
  __name(setA11yDiagramInfo, "setA11yDiagramInfo");
  function addSVGa11yTitleDescription(svg2, a11yTitle, a11yDesc, baseId) {
    if (svg2.insert === void 0) {
      return;
    }
    if (a11yDesc) {
      const descId = `chart-desc-${baseId}`;
      svg2.attr("aria-describedby", descId);
      svg2.insert("desc", ":first-child").attr("id", descId).text(a11yDesc);
    }
    if (a11yTitle) {
      const titleId = `chart-title-${baseId}`;
      svg2.attr("aria-labelledby", titleId);
      svg2.insert("title", ":first-child").attr("id", titleId).text(a11yTitle);
    }
  }
  __name(addSVGa11yTitleDescription, "addSVGa11yTitleDescription");

  // src/mermaidAPI.ts
  init_assignWithDepth();
  init_config();
  init_config();

  // src/Diagram.ts
  init_config();
  init_diagramAPI();
  init_detectType();
  init_errors();
  init_utils2();
  var Diagram = class _Diagram {
    constructor(type3, text4, db9, parser28, renderer13) {
      this.type = type3;
      this.text = text4;
      this.db = db9;
      this.parser = parser28;
      this.renderer = renderer13;
    }
    static {
      __name(this, "Diagram");
    }
    static async fromText(text4, metadata = {}) {
      const config5 = getConfig();
      const type3 = detectType(text4, config5);
      text4 = encodeEntities(text4) + "\n";
      try {
        getDiagram(type3);
      } catch {
        const loader33 = getDiagramLoader(type3);
        if (!loader33) {
          throw new UnknownDiagramError(`Diagram ${type3} not found.`);
        }
        const { id: id34, diagram: diagram31 } = await loader33();
        registerDiagram(id34, diagram31);
      }
      const { db: db9, parser: parser28, renderer: renderer13, init: init3 } = getDiagram(type3);
      if (parser28.parser) {
        parser28.parser.yy = db9;
      }
      db9.clear?.();
      init3?.(config5);
      if (metadata.title) {
        db9.setDiagramTitle?.(metadata.title);
      }
      await parser28.parse(text4);
      return new _Diagram(type3, text4, db9, parser28, renderer13);
    }
    async render(id34, version3) {
      await this.renderer.draw(this.text, id34, version3, this);
    }
    getParser() {
      return this.parser;
    }
    getType() {
      return this.type;
    }
  };

  // src/mermaidAPI.ts
  init_common();

  // src/interactionDb.ts
  var interactionFunctions = [];
  var attachFunctions = /* @__PURE__ */ __name(() => {
    interactionFunctions.forEach((f2) => {
      f2();
    });
    interactionFunctions = [];
  }, "attachFunctions");

  // src/mermaidAPI.ts
  init_logger();

  // src/diagram-api/comments.ts
  var cleanupComments = /* @__PURE__ */ __name((text4) => {
    return text4.replace(/^\s*%%(?!{)[^\n]+\n?/gm, "").trimStart();
  }, "cleanupComments");

  // src/diagram-api/frontmatter.ts
  init_regexes();
  init_js_yaml();
  function extractFrontMatter(text4) {
    const matches33 = text4.match(frontMatterRegex);
    if (!matches33) {
      return {
        text: text4,
        metadata: {}
      };
    }
    let parsed = load(matches33[1], {
      // To support config, we need JSON schema.
      // https://www.yaml.org/spec/1.2/spec.html#id2803231
      schema: JSON_SCHEMA
    }) ?? {};
    parsed = typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
    const metadata = {};
    if (parsed.displayMode) {
      metadata.displayMode = parsed.displayMode.toString();
    }
    if (parsed.title) {
      metadata.title = parsed.title.toString();
    }
    if (parsed.config) {
      metadata.config = parsed.config;
    }
    return {
      text: text4.slice(matches33[0].length),
      metadata
    };
  }
  __name(extractFrontMatter, "extractFrontMatter");

  // src/preprocess.ts
  init_utils2();
  var cleanupText = /* @__PURE__ */ __name((code) => {
    return code.replace(/\r\n?/g, "\n").replace(
      /<(\w+)([^>]*)>/g,
      (match2, tag, attributes) => "<" + tag + attributes.replace(/="([^"]*)"/g, "='$1'") + ">"
    );
  }, "cleanupText");
  var processFrontmatter = /* @__PURE__ */ __name((code) => {
    const { text: text4, metadata } = extractFrontMatter(code);
    const { displayMode: displayMode2, title: title2, config: config5 = {} } = metadata;
    if (displayMode2) {
      if (!config5.gantt) {
        config5.gantt = {};
      }
      config5.gantt.displayMode = displayMode2;
    }
    return { title: title2, config: config5, text: text4 };
  }, "processFrontmatter");
  var processDirectives = /* @__PURE__ */ __name((code) => {
    const initDirective = utils_default2.detectInit(code) ?? {};
    const wrapDirectives = utils_default2.detectDirective(code, "wrap");
    if (Array.isArray(wrapDirectives)) {
      initDirective.wrap = wrapDirectives.some(({ type: type3 }) => type3 === "wrap");
    } else if (wrapDirectives?.type === "wrap") {
      initDirective.wrap = true;
    }
    return {
      text: removeDirectives(code),
      directive: initDirective
    };
  }, "processDirectives");
  function preprocessDiagram(code) {
    const cleanedCode = cleanupText(code);
    const frontMatterResult = processFrontmatter(cleanedCode);
    const directiveResult = processDirectives(frontMatterResult.text);
    const config5 = cleanAndMerge(frontMatterResult.config, directiveResult.directive);
    code = cleanupComments(directiveResult.text);
    return {
      code,
      title: frontMatterResult.title,
      config: config5
    };
  }
  __name(preprocessDiagram, "preprocessDiagram");

  // src/mermaidAPI.ts
  init_styles();
  init_themes();
  init_utils2();

  // src/utils/base64.ts
  function toBase64(str2) {
    const utf8Bytes = new TextEncoder().encode(str2);
    const utf8Str = Array.from(utf8Bytes, (byte) => String.fromCodePoint(byte)).join("");
    return btoa(utf8Str);
  }
  __name(toBase64, "toBase64");

  // src/mermaidAPI.ts
  var MAX_TEXTLENGTH = 5e4;
  var MAX_TEXTLENGTH_EXCEEDED_MSG = "graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa";
  var SECURITY_LVL_SANDBOX = "sandbox";
  var SECURITY_LVL_LOOSE = "loose";
  var XMLNS_SVG_STD = "http://www.w3.org/2000/svg";
  var XMLNS_XLINK_STD = "http://www.w3.org/1999/xlink";
  var XMLNS_XHTML_STD = "http://www.w3.org/1999/xhtml";
  var IFRAME_WIDTH = "100%";
  var IFRAME_HEIGHT = "100%";
  var IFRAME_STYLES = "border:0;margin:0;";
  var IFRAME_BODY_STYLE = "margin:0";
  var IFRAME_SANDBOX_OPTS = "allow-top-navigation-by-user-activation allow-popups";
  var IFRAME_NOT_SUPPORTED_MSG = 'The "iframe" tag is not supported by your browser.';
  var DOMPURIFY_TAGS = ["foreignobject"];
  var DOMPURIFY_ATTR = ["dominant-baseline"];
  function processAndSetConfigs(text4) {
    const processed2 = preprocessDiagram(text4);
    reset();
    addDirective(processed2.config ?? {});
    return processed2;
  }
  __name(processAndSetConfigs, "processAndSetConfigs");
  async function parse5(text4, parseOptions) {
    addDiagrams();
    try {
      const { code, config: config5 } = processAndSetConfigs(text4);
      const diagram31 = await getDiagramFromText(code);
      return { diagramType: diagram31.type, config: config5 };
    } catch (error3) {
      if (parseOptions?.suppressErrors) {
        return false;
      }
      throw error3;
    }
  }
  __name(parse5, "parse");
  var cssImportantStyles = /* @__PURE__ */ __name((cssClass, element3, cssClasses = []) => {
    return `
.${cssClass} ${element3} { ${cssClasses.join(" !important; ")} !important; }`;
  }, "cssImportantStyles");
  var createCssStyles = /* @__PURE__ */ __name((config5, classDefs = /* @__PURE__ */ new Map()) => {
    let cssStyles = "";
    if (config5.themeCSS !== void 0) {
      cssStyles += `
${config5.themeCSS}`;
    }
    if (config5.fontFamily !== void 0) {
      cssStyles += `
:root { --mermaid-font-family: ${config5.fontFamily}}`;
    }
    if (config5.altFontFamily !== void 0) {
      cssStyles += `
:root { --mermaid-alt-font-family: ${config5.altFontFamily}}`;
    }
    if (classDefs instanceof Map) {
      const htmlLabels = getEffectiveHtmlLabels(config5);
      const cssHtmlElements = ["> *", "span"];
      const cssShapeElements = ["rect", "polygon", "ellipse", "circle", "path"];
      const cssElements = htmlLabels ? cssHtmlElements : cssShapeElements;
      classDefs.forEach((styleClassDef) => {
        if (!isEmpty_default(styleClassDef.styles)) {
          cssElements.forEach((cssElement) => {
            cssStyles += cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles);
          });
        }
        if (!isEmpty_default(styleClassDef.textStyles)) {
          cssStyles += cssImportantStyles(
            styleClassDef.id,
            "tspan",
            (styleClassDef?.textStyles || []).map((s2) => s2.replace("color", "fill"))
          );
        }
      });
    }
    return cssStyles;
  }, "createCssStyles");
  var createUserStyles = /* @__PURE__ */ __name((config5, graphType, classDefs, svgId) => {
    const userCSSstyles = createCssStyles(config5, classDefs);
    const allStyles = styles_default(
      graphType,
      userCSSstyles,
      { ...config5.themeVariables, theme: config5.theme, look: config5.look },
      svgId
    );
    return serialize(compile(`${svgId}{${allStyles}}`), stringify);
  }, "createUserStyles");
  var cleanUpSvgCode = /* @__PURE__ */ __name((svgCode = "", inSandboxMode, useArrowMarkerUrls) => {
    let cleanedUpSvg = svgCode;
    if (!useArrowMarkerUrls && !inSandboxMode) {
      cleanedUpSvg = cleanedUpSvg.replace(
        /marker-end="url\([\d+./:=?A-Za-z-]*?#/g,
        'marker-end="url(#'
      );
    }
    cleanedUpSvg = decodeEntities(cleanedUpSvg);
    cleanedUpSvg = cleanedUpSvg.replace(/<br>/g, "<br/>");
    return cleanedUpSvg;
  }, "cleanUpSvgCode");
  var putIntoIFrame = /* @__PURE__ */ __name((svgCode = "", svgElement) => {
    const height2 = svgElement?.viewBox?.baseVal?.height ? svgElement.viewBox.baseVal.height + "px" : IFRAME_HEIGHT;
    const base64encodedSrc = toBase64(`<body style="${IFRAME_BODY_STYLE}">${svgCode}</body>`);
    return `<iframe style="width:${IFRAME_WIDTH};height:${height2};${IFRAME_STYLES}" src="data:text/html;charset=UTF-8;base64,${base64encodedSrc}" sandbox="${IFRAME_SANDBOX_OPTS}">
  ${IFRAME_NOT_SUPPORTED_MSG}
</iframe>`;
  }, "putIntoIFrame");
  var appendDivSvgG = /* @__PURE__ */ __name((parentRoot, id34, enclosingDivId, divStyle, svgXlink) => {
    const enclosingDiv = parentRoot.append("div");
    enclosingDiv.attr("id", enclosingDivId);
    if (divStyle) {
      enclosingDiv.attr("style", divStyle);
    }
    const svgNode2 = enclosingDiv.append("svg").attr("id", id34).attr("width", "100%").attr("xmlns", XMLNS_SVG_STD);
    if (svgXlink) {
      svgNode2.attr("xmlns:xlink", svgXlink);
    }
    svgNode2.append("g");
    return parentRoot;
  }, "appendDivSvgG");
  function sandboxedIframe(parentNode, iFrameId) {
    return parentNode.append("iframe").attr("id", iFrameId).attr("style", "width: 100%; height: 100%;").attr("sandbox", "");
  }
  __name(sandboxedIframe, "sandboxedIframe");
  var removeExistingElements = /* @__PURE__ */ __name((doc, id34, divId, iFrameId) => {
    doc.getElementById(id34)?.remove();
    doc.getElementById(divId)?.remove();
    doc.getElementById(iFrameId)?.remove();
  }, "removeExistingElements");
  var render7 = /* @__PURE__ */ __name(async function(id34, text4, svgContainingElement) {
    addDiagrams();
    const processed2 = processAndSetConfigs(text4);
    text4 = processed2.code;
    const config5 = getConfig();
    log.debug(config5);
    if (text4.length > (config5?.maxTextSize ?? MAX_TEXTLENGTH)) {
      text4 = MAX_TEXTLENGTH_EXCEEDED_MSG;
    }
    const idSelector = "#" + id34;
    const iFrameID = "i" + id34;
    const iFrameID_selector = "#" + iFrameID;
    const enclosingDivID = "d" + id34;
    const enclosingDivID_selector = "#" + enclosingDivID;
    const removeTempElements = /* @__PURE__ */ __name(() => {
      const tmpElementSelector = isSandboxed ? iFrameID_selector : enclosingDivID_selector;
      const node2 = select_default2(tmpElementSelector).node();
      if (node2 && "remove" in node2) {
        node2.remove();
      }
    }, "removeTempElements");
    let root3 = select_default2("body");
    const isSandboxed = config5.securityLevel === SECURITY_LVL_SANDBOX;
    const isLooseSecurityLevel = config5.securityLevel === SECURITY_LVL_LOOSE;
    const fontFamily = config5.fontFamily;
    if (svgContainingElement !== void 0) {
      if (svgContainingElement) {
        svgContainingElement.innerHTML = "";
      }
      if (isSandboxed) {
        const iframe = sandboxedIframe(select_default2(svgContainingElement), iFrameID);
        root3 = select_default2(iframe.nodes()[0].contentDocument.body);
        root3.node().style.margin = 0;
      } else {
        root3 = select_default2(svgContainingElement);
      }
      appendDivSvgG(root3, id34, enclosingDivID, `font-family: ${fontFamily}`, XMLNS_XLINK_STD);
    } else {
      removeExistingElements(document, id34, enclosingDivID, iFrameID);
      if (isSandboxed) {
        const iframe = sandboxedIframe(select_default2("body"), iFrameID);
        root3 = select_default2(iframe.nodes()[0].contentDocument.body);
        root3.node().style.margin = 0;
      } else {
        root3 = select_default2("body");
      }
      appendDivSvgG(root3, id34, enclosingDivID);
    }
    let diag;
    let parseEncounteredException;
    try {
      diag = await Diagram.fromText(text4, { title: processed2.title });
    } catch (error3) {
      if (config5.suppressErrorRendering) {
        removeTempElements();
        throw error3;
      }
      diag = await Diagram.fromText("error");
      parseEncounteredException = error3;
    }
    const element3 = root3.select(enclosingDivID_selector).node();
    const diagramType = diag.type;
    const svg2 = element3.firstChild;
    const firstChild = svg2.firstChild;
    const diagramClassDefs = diag.renderer.getClasses?.(text4, diag);
    const rules = createUserStyles(config5, diagramType, diagramClassDefs, idSelector);
    const style1 = document.createElement("style");
    style1.innerHTML = rules;
    svg2.insertBefore(style1, firstChild);
    try {
      await diag.renderer.draw(text4, id34, "11.14.0", diag);
    } catch (e3) {
      if (config5.suppressErrorRendering) {
        removeTempElements();
      } else {
        errorRenderer_default.draw(text4, id34, "11.14.0");
      }
      throw e3;
    }
    const svgNode2 = root3.select(`${enclosingDivID_selector} svg`);
    const a11yTitle = diag.db.getAccTitle?.();
    const a11yDescr = diag.db.getAccDescription?.();
    addA11yInfo(diagramType, svgNode2, a11yTitle, a11yDescr);
    root3.select(`[id="${id34}"]`).selectAll("foreignobject > *").attr("xmlns", XMLNS_XHTML_STD);
    let svgCode = root3.select(enclosingDivID_selector).node().innerHTML;
    log.debug("config.arrowMarkerAbsolute", config5.arrowMarkerAbsolute);
    svgCode = cleanUpSvgCode(svgCode, isSandboxed, evaluate(config5.arrowMarkerAbsolute));
    if (isSandboxed) {
      const svgEl = root3.select(enclosingDivID_selector + " svg").node();
      svgCode = putIntoIFrame(svgCode, svgEl);
    } else if (!isLooseSecurityLevel) {
      svgCode = purify.sanitize(svgCode, {
        ADD_TAGS: DOMPURIFY_TAGS,
        ADD_ATTR: DOMPURIFY_ATTR,
        HTML_INTEGRATION_POINTS: { foreignobject: true }
      });
    }
    attachFunctions();
    if (parseEncounteredException) {
      throw parseEncounteredException;
    }
    removeTempElements();
    return {
      diagramType,
      svg: svgCode,
      bindFunctions: diag.db.bindFunctions
    };
  }, "render");
  function initialize(userOptions = {}) {
    const options2 = assignWithDepth_default({}, userOptions);
    if (options2?.fontFamily && !options2.themeVariables?.fontFamily) {
      if (!options2.themeVariables) {
        options2.themeVariables = {};
      }
      options2.themeVariables.fontFamily = options2.fontFamily;
    }
    saveConfigFromInitialize(options2);
    if (options2?.theme && options2.theme in themes_default) {
      options2.themeVariables = themes_default[options2.theme].getThemeVariables(
        options2.themeVariables
      );
    } else if (options2) {
      options2.themeVariables = themes_default.default.getThemeVariables(options2.themeVariables);
    }
    const config5 = typeof options2 === "object" ? setSiteConfig(options2) : getSiteConfig();
    setLogLevel(config5.logLevel);
    addDiagrams();
  }
  __name(initialize, "initialize");
  var getDiagramFromText = /* @__PURE__ */ __name((text4, metadata = {}) => {
    const { code } = preprocessDiagram(text4);
    return Diagram.fromText(code, metadata);
  }, "getDiagramFromText");
  function addA11yInfo(diagramType, svgNode2, a11yTitle, a11yDescr) {
    setA11yDiagramInfo(svgNode2, diagramType);
    addSVGa11yTitleDescription(svgNode2, a11yTitle, a11yDescr, svgNode2.attr("id"));
  }
  __name(addA11yInfo, "addA11yInfo");
  var mermaidAPI = Object.freeze({
    render: render7,
    parse: parse5,
    getDiagramFromText,
    initialize,
    getConfig,
    setConfig,
    getSiteConfig,
    updateSiteConfig,
    reset: /* @__PURE__ */ __name(() => {
      reset();
    }, "reset"),
    globalReset: /* @__PURE__ */ __name(() => {
      reset(defaultConfig);
    }, "globalReset"),
    defaultConfig
  });
  setLogLevel(getConfig().logLevel);
  reset(getConfig());

  // src/mermaid.ts
  init_render2();
  init_utils2();
  var handleError = /* @__PURE__ */ __name((error3, errors, parseError) => {
    log.warn(error3);
    if (isDetailedError(error3)) {
      if (parseError) {
        parseError(error3.str, error3.hash);
      }
      errors.push({ ...error3, message: error3.str, error: error3 });
    } else {
      if (parseError) {
        parseError(error3);
      }
      if (error3 instanceof Error) {
        errors.push({
          str: error3.message,
          message: error3.message,
          hash: error3.name,
          error: error3
        });
      }
    }
  }, "handleError");
  var run4 = /* @__PURE__ */ __name(async function(options2 = {
    querySelector: ".mermaid"
  }) {
    try {
      await runThrowsErrors(options2);
    } catch (e3) {
      if (isDetailedError(e3)) {
        log.error(e3.str);
      }
      if (mermaid.parseError) {
        mermaid.parseError(e3);
      }
      if (!options2.suppressErrors) {
        log.error("Use the suppressErrors option to suppress these errors");
        throw e3;
      }
    }
  }, "run");
  var runThrowsErrors = /* @__PURE__ */ __name(async function({ postRenderCallback, querySelector, nodes: nodes5 } = {
    querySelector: ".mermaid"
  }) {
    const conf5 = mermaidAPI.getConfig();
    log.debug(`${!postRenderCallback ? "No " : ""}Callback function found`);
    let nodesToProcess;
    if (nodes5) {
      nodesToProcess = nodes5;
    } else if (querySelector) {
      nodesToProcess = document.querySelectorAll(querySelector);
    } else {
      throw new Error("Nodes and querySelector are both undefined");
    }
    log.debug(`Found ${nodesToProcess.length} diagrams`);
    if (conf5?.startOnLoad !== void 0) {
      log.debug("Start On Load: " + conf5?.startOnLoad);
      mermaidAPI.updateSiteConfig({ startOnLoad: conf5?.startOnLoad });
    }
    const idGenerator = new utils_default2.InitIDGenerator(conf5.deterministicIds, conf5.deterministicIDSeed);
    let txt;
    const errors = [];
    for (const element3 of Array.from(nodesToProcess)) {
      log.info("Rendering diagram: " + element3.id);
      if (element3.getAttribute("data-processed")) {
        continue;
      }
      element3.setAttribute("data-processed", "true");
      const id34 = `mermaid-${idGenerator.next()}`;
      txt = element3.innerHTML;
      txt = dedent(utils_default2.entityDecode(txt)).trim().replace(/<br\s*\/?>/gi, "<br/>");
      const init3 = utils_default2.detectInit(txt);
      if (init3) {
        log.debug("Detected early reinit: ", init3);
      }
      try {
        const { svg: svg2, bindFunctions: bindFunctions2 } = await render8(id34, txt, element3);
        element3.innerHTML = svg2;
        if (postRenderCallback) {
          await postRenderCallback(id34);
        }
        if (bindFunctions2) {
          bindFunctions2(element3);
        }
      } catch (error3) {
        handleError(error3, errors, mermaid.parseError);
      }
    }
    if (errors.length > 0) {
      throw errors[0];
    }
  }, "runThrowsErrors");
  var initialize2 = /* @__PURE__ */ __name(function(config5) {
    mermaidAPI.initialize(config5);
  }, "initialize");
  var init2 = /* @__PURE__ */ __name(async function(config5, nodes5, callback) {
    log.warn("mermaid.init is deprecated. Please use run instead.");
    if (config5) {
      initialize2(config5);
    }
    const runOptions = { postRenderCallback: callback, querySelector: ".mermaid" };
    if (typeof nodes5 === "string") {
      runOptions.querySelector = nodes5;
    } else if (nodes5) {
      if (nodes5 instanceof HTMLElement) {
        runOptions.nodes = [nodes5];
      } else {
        runOptions.nodes = nodes5;
      }
    }
    await run4(runOptions);
  }, "init");
  var registerExternalDiagrams = /* @__PURE__ */ __name(async (diagrams2, {
    lazyLoad = true
  } = {}) => {
    addDiagrams();
    registerLazyLoadedDiagrams(...diagrams2);
    if (lazyLoad === false) {
      await loadRegisteredDiagrams();
    }
  }, "registerExternalDiagrams");
  var contentLoaded = /* @__PURE__ */ __name(function() {
    if (mermaid.startOnLoad) {
      const { startOnLoad } = mermaidAPI.getConfig();
      if (startOnLoad) {
        mermaid.run().catch((err) => log.error("Mermaid failed to initialize", err));
      }
    }
  }, "contentLoaded");
  if (typeof document !== "undefined") {
    window.addEventListener("load", contentLoaded, false);
  }
  var setParseErrorHandler = /* @__PURE__ */ __name(function(parseErrorHandler) {
    mermaid.parseError = parseErrorHandler;
  }, "setParseErrorHandler");
  var executionQueue = [];
  var executionQueueRunning = false;
  var executeQueue = /* @__PURE__ */ __name(async () => {
    if (executionQueueRunning) {
      return;
    }
    executionQueueRunning = true;
    while (executionQueue.length > 0) {
      const f2 = executionQueue.shift();
      if (f2) {
        try {
          await f2();
        } catch (e3) {
          log.error("Error executing queue", e3);
        }
      }
    }
    executionQueueRunning = false;
  }, "executeQueue");
  var parse6 = /* @__PURE__ */ __name(async (text4, parseOptions) => {
    return new Promise((resolve2, reject3) => {
      const performCall = /* @__PURE__ */ __name(() => new Promise((res, rej) => {
        mermaidAPI.parse(text4, parseOptions).then(
          (r2) => {
            res(r2);
            resolve2(r2);
          },
          (e3) => {
            log.error("Error parsing", e3);
            mermaid.parseError?.(e3);
            rej(e3);
            reject3(e3);
          }
        );
      }), "performCall");
      executionQueue.push(performCall);
      executeQueue().catch(reject3);
    });
  }, "parse");
  var render8 = /* @__PURE__ */ __name((id34, text4, container2) => {
    return new Promise((resolve2, reject3) => {
      const performCall = /* @__PURE__ */ __name(() => new Promise((res, rej) => {
        mermaidAPI.render(id34, text4, container2).then(
          (r2) => {
            res(r2);
            resolve2(r2);
          },
          (e3) => {
            log.error("Error parsing", e3);
            mermaid.parseError?.(e3);
            rej(e3);
            reject3(e3);
          }
        );
      }), "performCall");
      executionQueue.push(performCall);
      executeQueue().catch(reject3);
    });
  }, "render");
  var getRegisteredDiagramsMetadata = /* @__PURE__ */ __name(() => {
    return Object.keys(detectors).map((id34) => ({
      id: id34
    }));
  }, "getRegisteredDiagramsMetadata");
  var mermaid = {
    startOnLoad: true,
    mermaidAPI,
    parse: parse6,
    render: render8,
    init: init2,
    run: run4,
    registerExternalDiagrams,
    registerLayoutLoaders,
    initialize: initialize2,
    parseError: void 0,
    contentLoaded,
    setParseErrorHandler,
    detectType,
    registerIconPacks,
    getRegisteredDiagramsMetadata
  };
  var mermaid_default = mermaid;
  return __toCommonJS(mermaid_exports);
})();
/*! Check if previously processed */
/*!
 * Wait for document loaded before starting the execution
 */
/*! Bundled license information:

dompurify/dist/purify.es.mjs:
  (*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE *)

js-yaml/dist/js-yaml.mjs:
  (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)

lodash-es/lodash.js:
  (**
   * @license
   * Lodash (Custom Build) <https://lodash.com/>
   * Build: `lodash modularize exports="es" -o ./`
   * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
   * Released under MIT license <https://lodash.com/license>
   * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
   * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
   *)

cytoscape/dist/cytoscape.esm.mjs:
  (*!
  Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
  Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
  Licensed under The MIT License (http://opensource.org/licenses/MIT)
  *)
  (*!
  Event object based on jQuery events, MIT license
  
  https://jquery.org/license/
  https://tldrlegal.com/license/mit-license
  https://github.com/jquery/jquery/blob/master/src/event.js
  *)
  (*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
  (*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
*/
globalThis["mermaid"] = globalThis.__esbuild_esm_mermaid_nm["mermaid"].default;
