var _a, _b;
import "./purify.es-DT70lfR0.js";
import { t as linear } from "./linear-2NnK4cxi.js";
import "./defaultLocale-BpsHxBd7.js";
import { i as log, r as __name, t as select_default } from "./src-Bf2iLOlr.js";
import { B as setAccTitle, C as getDiagramTitle, I as sanitizeText, T as getThemeVariables3, U as setDiagramTitle, _ as getAccDescription, a as clear, b as getConfig2, c as configureSvgSize, d as defaultConfig_default, v as getAccTitle, z as setAccDescription } from "./chunk-ABZYJK2D-D0cLy8Bb.js";
var parser = (function() {
  var e = /* @__PURE__ */ __name(function(e2, t2, n, r2) {
    for (n || (n = {}), r2 = e2.length; r2--; n[e2[r2]] = t2) ;
    return n;
  }, "o"), t = [1, 3], r = [1, 4], i = [1, 5], a = [1, 6], o = [1, 7], s = [
    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
  ], c = [
    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
  ], l = [
    55,
    56,
    57
  ], u = [2, 36], d = [1, 37], f = [1, 36], p = [1, 38], m = [1, 35], h = [1, 43], g = [1, 41], _ = [1, 14], v = [1, 23], y = [1, 18], b = [1, 19], x = [1, 20], S = [1, 21], C = [1, 22], w = [1, 24], T = [1, 25], E = [1, 26], D = [1, 27], O = [1, 28], k = [1, 29], A = [1, 32], j = [1, 33], M = [1, 34], N = [1, 39], P = [1, 40], F = [1, 42], I = [1, 44], L = [1, 62], R = [1, 61], z = [
    4,
    5,
    8,
    10,
    12,
    13,
    14,
    18,
    44,
    47,
    49,
    55,
    56,
    57,
    63,
    64,
    65,
    66,
    67
  ], ee = [1, 65], te = [1, 66], ne = [1, 67], re = [1, 68], ie = [1, 69], ae = [1, 70], oe = [1, 71], se = [1, 72], ce = [1, 73], le = [1, 74], ue = [1, 75], de = [1, 76], B = [
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12,
    13,
    14,
    15,
    18
  ], V = [1, 90], H = [1, 91], U = [1, 92], W = [1, 99], G = [1, 93], K = [1, 96], q = [1, 94], J = [1, 95], Y = [1, 97], X = [1, 98], Z = [1, 102], fe = [
    10,
    55,
    56,
    57
  ], Q = [
    4,
    5,
    6,
    8,
    10,
    11,
    13,
    17,
    18,
    19,
    20,
    55,
    56,
    57
  ], pe = {
    trace: /* @__PURE__ */ __name(function() {
    }, "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(e2, t2, n, r2, i2, a2, o2) {
      var s2 = a2.length - 1;
      switch (i2) {
        case 23:
          this.$ = a2[s2];
          break;
        case 24:
          this.$ = a2[s2 - 1] + "" + a2[s2];
          break;
        case 26:
          this.$ = a2[s2 - 1] + a2[s2];
          break;
        case 27:
          this.$ = [a2[s2].trim()];
          break;
        case 28:
          a2[s2 - 2].push(a2[s2].trim()), this.$ = a2[s2 - 2];
          break;
        case 29:
          this.$ = a2[s2 - 4], r2.addClass(a2[s2 - 2], a2[s2]);
          break;
        case 37:
          this.$ = [];
          break;
        case 42:
          this.$ = a2[s2].trim(), r2.setDiagramTitle(this.$);
          break;
        case 43:
          this.$ = a2[s2].trim(), r2.setAccTitle(this.$);
          break;
        case 44:
        case 45:
          this.$ = a2[s2].trim(), r2.setAccDescription(this.$);
          break;
        case 46:
          r2.addSection(a2[s2].substr(8)), this.$ = a2[s2].substr(8);
          break;
        case 47:
          r2.addPoint(a2[s2 - 3], "", a2[s2 - 1], a2[s2], []);
          break;
        case 48:
          r2.addPoint(a2[s2 - 4], a2[s2 - 3], a2[s2 - 1], a2[s2], []);
          break;
        case 49:
          r2.addPoint(a2[s2 - 4], "", a2[s2 - 2], a2[s2 - 1], a2[s2]);
          break;
        case 50:
          r2.addPoint(a2[s2 - 5], a2[s2 - 4], a2[s2 - 2], a2[s2 - 1], a2[s2]);
          break;
        case 51:
          r2.setXAxisLeftText(a2[s2 - 2]), r2.setXAxisRightText(a2[s2]);
          break;
        case 52:
          a2[s2 - 1].text += " \u27F6 ", r2.setXAxisLeftText(a2[s2 - 1]);
          break;
        case 53:
          r2.setXAxisLeftText(a2[s2]);
          break;
        case 54:
          r2.setYAxisBottomText(a2[s2 - 2]), r2.setYAxisTopText(a2[s2]);
          break;
        case 55:
          a2[s2 - 1].text += " \u27F6 ", r2.setYAxisBottomText(a2[s2 - 1]);
          break;
        case 56:
          r2.setYAxisBottomText(a2[s2]);
          break;
        case 57:
          r2.setQuadrant1Text(a2[s2]);
          break;
        case 58:
          r2.setQuadrant2Text(a2[s2]);
          break;
        case 59:
          r2.setQuadrant3Text(a2[s2]);
          break;
        case 60:
          r2.setQuadrant4Text(a2[s2]);
          break;
        case 64:
          this.$ = {
            text: a2[s2],
            type: "text"
          };
          break;
        case 65:
          this.$ = {
            text: a2[s2 - 1].text + "" + a2[s2],
            type: a2[s2 - 1].type
          };
          break;
        case 66:
          this.$ = {
            text: a2[s2],
            type: "text"
          };
          break;
        case 67:
          this.$ = {
            text: a2[s2],
            type: "markdown"
          };
          break;
        case 68:
          this.$ = a2[s2];
          break;
        case 69:
          this.$ = a2[s2 - 1] + "" + a2[s2];
          break;
      }
    }, "anonymous"),
    table: [
      {
        18: t,
        26: 1,
        27: 2,
        28: r,
        55: i,
        56: a,
        57: o
      },
      { 1: [3] },
      {
        18: t,
        26: 8,
        27: 2,
        28: r,
        55: i,
        56: a,
        57: o
      },
      {
        18: t,
        26: 9,
        27: 2,
        28: r,
        55: i,
        56: a,
        57: o
      },
      e(s, [2, 33], { 29: 10 }),
      e(c, [2, 61]),
      e(c, [2, 62]),
      e(c, [2, 63]),
      { 1: [2, 30] },
      { 1: [2, 31] },
      e(l, u, {
        30: 11,
        31: 12,
        24: 13,
        32: 15,
        33: 16,
        34: 17,
        43: 30,
        58: 31,
        1: [2, 32],
        4: d,
        5: f,
        10: p,
        12: m,
        13: h,
        14: g,
        18: _,
        25: v,
        35: y,
        37: b,
        39: x,
        41: S,
        42: C,
        48: w,
        50: T,
        51: E,
        52: D,
        53: O,
        54: k,
        60: A,
        61: j,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      }),
      e(s, [2, 34]),
      {
        27: 45,
        55: i,
        56: a,
        57: o
      },
      e(l, [2, 37]),
      e(l, u, {
        24: 13,
        32: 15,
        33: 16,
        34: 17,
        43: 30,
        58: 31,
        31: 46,
        4: d,
        5: f,
        10: p,
        12: m,
        13: h,
        14: g,
        18: _,
        25: v,
        35: y,
        37: b,
        39: x,
        41: S,
        42: C,
        48: w,
        50: T,
        51: E,
        52: D,
        53: O,
        54: k,
        60: A,
        61: j,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      }),
      e(l, [2, 39]),
      e(l, [2, 40]),
      e(l, [2, 41]),
      { 36: [1, 47] },
      { 38: [1, 48] },
      { 40: [1, 49] },
      e(l, [2, 45]),
      e(l, [2, 46]),
      { 18: [1, 50] },
      {
        4: d,
        5: f,
        10: p,
        12: m,
        13: h,
        14: g,
        43: 51,
        58: 31,
        60: A,
        61: j,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      },
      {
        4: d,
        5: f,
        10: p,
        12: m,
        13: h,
        14: g,
        43: 52,
        58: 31,
        60: A,
        61: j,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      },
      {
        4: d,
        5: f,
        10: p,
        12: m,
        13: h,
        14: g,
        43: 53,
        58: 31,
        60: A,
        61: j,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      },
      {
        4: d,
        5: f,
        10: p,
        12: m,
        13: h,
        14: g,
        43: 54,
        58: 31,
        60: A,
        61: j,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      },
      {
        4: d,
        5: f,
        10: p,
        12: m,
        13: h,
        14: g,
        43: 55,
        58: 31,
        60: A,
        61: j,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      },
      {
        4: d,
        5: f,
        10: p,
        12: m,
        13: h,
        14: g,
        43: 56,
        58: 31,
        60: A,
        61: j,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      },
      {
        4: d,
        5: f,
        8: L,
        10: p,
        12: m,
        13: h,
        14: g,
        18: R,
        44: [1, 57],
        47: [1, 58],
        58: 60,
        59: 59,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      },
      e(z, [2, 64]),
      e(z, [2, 66]),
      e(z, [2, 67]),
      e(z, [2, 70]),
      e(z, [2, 71]),
      e(z, [2, 72]),
      e(z, [2, 73]),
      e(z, [2, 74]),
      e(z, [2, 75]),
      e(z, [2, 76]),
      e(z, [2, 77]),
      e(z, [2, 78]),
      e(z, [2, 79]),
      e(z, [2, 80]),
      e(s, [2, 35]),
      e(l, [2, 38]),
      e(l, [2, 42]),
      e(l, [2, 43]),
      e(l, [2, 44]),
      {
        3: 64,
        4: ee,
        5: te,
        6: ne,
        7: re,
        8: ie,
        9: ae,
        10: oe,
        11: se,
        12: ce,
        13: le,
        14: ue,
        15: de,
        21: 63
      },
      e(l, [2, 53], {
        59: 59,
        58: 60,
        4: d,
        5: f,
        8: L,
        10: p,
        12: m,
        13: h,
        14: g,
        18: R,
        49: [1, 77],
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      }),
      e(l, [2, 56], {
        59: 59,
        58: 60,
        4: d,
        5: f,
        8: L,
        10: p,
        12: m,
        13: h,
        14: g,
        18: R,
        49: [1, 78],
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      }),
      e(l, [2, 57], {
        59: 59,
        58: 60,
        4: d,
        5: f,
        8: L,
        10: p,
        12: m,
        13: h,
        14: g,
        18: R,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      }),
      e(l, [2, 58], {
        59: 59,
        58: 60,
        4: d,
        5: f,
        8: L,
        10: p,
        12: m,
        13: h,
        14: g,
        18: R,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      }),
      e(l, [2, 59], {
        59: 59,
        58: 60,
        4: d,
        5: f,
        8: L,
        10: p,
        12: m,
        13: h,
        14: g,
        18: R,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      }),
      e(l, [2, 60], {
        59: 59,
        58: 60,
        4: d,
        5: f,
        8: L,
        10: p,
        12: m,
        13: h,
        14: g,
        18: R,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      }),
      { 45: [1, 79] },
      { 44: [1, 80] },
      e(z, [2, 65]),
      e(z, [2, 81]),
      e(z, [2, 82]),
      e(z, [2, 83]),
      {
        3: 82,
        4: ee,
        5: te,
        6: ne,
        7: re,
        8: ie,
        9: ae,
        10: oe,
        11: se,
        12: ce,
        13: le,
        14: ue,
        15: de,
        18: [1, 81]
      },
      e(B, [2, 23]),
      e(B, [2, 1]),
      e(B, [2, 2]),
      e(B, [2, 3]),
      e(B, [2, 4]),
      e(B, [2, 5]),
      e(B, [2, 6]),
      e(B, [2, 7]),
      e(B, [2, 8]),
      e(B, [2, 9]),
      e(B, [2, 10]),
      e(B, [2, 11]),
      e(B, [2, 12]),
      e(l, [2, 52], {
        58: 31,
        43: 83,
        4: d,
        5: f,
        10: p,
        12: m,
        13: h,
        14: g,
        60: A,
        61: j,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      }),
      e(l, [2, 55], {
        58: 31,
        43: 84,
        4: d,
        5: f,
        10: p,
        12: m,
        13: h,
        14: g,
        60: A,
        61: j,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      }),
      { 46: [1, 85] },
      { 45: [1, 86] },
      {
        4: V,
        5: H,
        6: U,
        8: W,
        11: G,
        13: K,
        16: 89,
        17: q,
        18: J,
        19: Y,
        20: X,
        22: 88,
        23: 87
      },
      e(B, [2, 24]),
      e(l, [2, 51], {
        59: 59,
        58: 60,
        4: d,
        5: f,
        8: L,
        10: p,
        12: m,
        13: h,
        14: g,
        18: R,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      }),
      e(l, [2, 54], {
        59: 59,
        58: 60,
        4: d,
        5: f,
        8: L,
        10: p,
        12: m,
        13: h,
        14: g,
        18: R,
        63: M,
        64: N,
        65: P,
        66: F,
        67: I
      }),
      e(l, [2, 47], {
        22: 88,
        16: 89,
        23: 100,
        4: V,
        5: H,
        6: U,
        8: W,
        11: G,
        13: K,
        17: q,
        18: J,
        19: Y,
        20: X
      }),
      { 46: [1, 101] },
      e(l, [2, 29], { 10: Z }),
      e(fe, [2, 27], {
        16: 103,
        4: V,
        5: H,
        6: U,
        8: W,
        11: G,
        13: K,
        17: q,
        18: J,
        19: Y,
        20: X
      }),
      e(Q, [2, 25]),
      e(Q, [2, 13]),
      e(Q, [2, 14]),
      e(Q, [2, 15]),
      e(Q, [2, 16]),
      e(Q, [2, 17]),
      e(Q, [2, 18]),
      e(Q, [2, 19]),
      e(Q, [2, 20]),
      e(Q, [2, 21]),
      e(Q, [2, 22]),
      e(l, [2, 49], { 10: Z }),
      e(l, [2, 48], {
        22: 88,
        16: 89,
        23: 104,
        4: V,
        5: H,
        6: U,
        8: W,
        11: G,
        13: K,
        17: q,
        18: J,
        19: Y,
        20: X
      }),
      {
        4: V,
        5: H,
        6: U,
        8: W,
        11: G,
        13: K,
        16: 89,
        17: q,
        18: J,
        19: Y,
        20: X,
        22: 105
      },
      e(Q, [2, 26]),
      e(l, [2, 50], { 10: Z }),
      e(fe, [2, 28], {
        16: 103,
        4: V,
        5: H,
        6: U,
        8: W,
        11: G,
        13: K,
        17: q,
        18: J,
        19: Y,
        20: X
      })
    ],
    defaultActions: {
      8: [2, 30],
      9: [2, 31]
    },
    parseError: /* @__PURE__ */ __name(function(e2, t2) {
      if (t2.recoverable) this.trace(e2);
      else {
        var n = Error(e2);
        throw n.hash = t2, n;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ __name(function(e2) {
      var t2 = this, r2 = [0], i2 = [], a2 = [null], o2 = [], s2 = this.table, c2 = "", l2 = 0, u2 = 0, d2 = 0, f2 = 2, p2 = 1, m2 = o2.slice.call(arguments, 1), h2 = Object.create(this.lexer), g2 = { yy: {} };
      for (var _2 in this.yy) Object.prototype.hasOwnProperty.call(this.yy, _2) && (g2.yy[_2] = this.yy[_2]);
      h2.setInput(e2, g2.yy), g2.yy.lexer = h2, g2.yy.parser = this, h2.yylloc === void 0 && (h2.yylloc = {});
      var v2 = h2.yylloc;
      o2.push(v2);
      var y2 = h2.options && h2.options.ranges;
      typeof g2.yy.parseError == "function" ? this.parseError = g2.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function b2(e3) {
        r2.length -= 2 * e3, a2.length -= e3, o2.length -= e3;
      }
      __name(b2, "popStack");
      function x2() {
        var e3 = i2.pop() || h2.lex() || p2;
        return typeof e3 != "number" && (e3 instanceof Array && (i2 = e3, e3 = i2.pop()), e3 = t2.symbols_[e3] || e3), e3;
      }
      __name(x2, "lex");
      for (var S2, C2, w2, T2, E2, D2 = {}, O2, k2, A2, j2; ; ) {
        if (w2 = r2[r2.length - 1], this.defaultActions[w2] ? T2 = this.defaultActions[w2] : (S2 ?? (S2 = x2()), T2 = s2[w2] && s2[w2][S2]), T2 === void 0 || !T2.length || !T2[0]) {
          var M2 = "";
          for (O2 in j2 = [], s2[w2]) this.terminals_[O2] && O2 > f2 && j2.push("'" + this.terminals_[O2] + "'");
          M2 = h2.showPosition ? "Parse error on line " + (l2 + 1) + ":\n" + h2.showPosition() + "\nExpecting " + j2.join(", ") + ", got '" + (this.terminals_[S2] || S2) + "'" : "Parse error on line " + (l2 + 1) + ": Unexpected " + (S2 == p2 ? "end of input" : "'" + (this.terminals_[S2] || S2) + "'"), this.parseError(M2, {
            text: h2.match,
            token: this.terminals_[S2] || S2,
            line: h2.yylineno,
            loc: v2,
            expected: j2
          });
        }
        if (T2[0] instanceof Array && T2.length > 1) throw Error("Parse Error: multiple actions possible at state: " + w2 + ", token: " + S2);
        switch (T2[0]) {
          case 1:
            r2.push(S2), a2.push(h2.yytext), o2.push(h2.yylloc), r2.push(T2[1]), S2 = null, C2 ? (S2 = C2, C2 = null) : (u2 = h2.yyleng, c2 = h2.yytext, l2 = h2.yylineno, v2 = h2.yylloc, d2 > 0 && d2--);
            break;
          case 2:
            if (k2 = this.productions_[T2[1]][1], D2.$ = a2[a2.length - k2], D2._$ = {
              first_line: o2[o2.length - (k2 || 1)].first_line,
              last_line: o2[o2.length - 1].last_line,
              first_column: o2[o2.length - (k2 || 1)].first_column,
              last_column: o2[o2.length - 1].last_column
            }, y2 && (D2._$.range = [o2[o2.length - (k2 || 1)].range[0], o2[o2.length - 1].range[1]]), E2 = this.performAction.apply(D2, [
              c2,
              u2,
              l2,
              g2.yy,
              T2[1],
              a2,
              o2
            ].concat(m2)), E2 !== void 0) return E2;
            k2 && (r2 = r2.slice(0, -1 * k2 * 2), a2 = a2.slice(0, -1 * k2), o2 = o2.slice(0, -1 * k2)), r2.push(this.productions_[T2[1]][0]), a2.push(D2.$), o2.push(D2._$), A2 = s2[r2[r2.length - 2]][r2[r2.length - 1]], r2.push(A2);
            break;
          case 3:
            return true;
        }
      }
      return true;
    }, "parse")
  };
  pe.lexer = /* @__PURE__ */ (function() {
    return {
      EOF: 1,
      parseError: /* @__PURE__ */ __name(function(e2, t2) {
        if (this.yy.parser) this.yy.parser.parseError(e2, t2);
        else throw Error(e2);
      }, "parseError"),
      setInput: /* @__PURE__ */ __name(function(e2, t2) {
        return this.yy = t2 || this.yy || {}, this._input = e2, 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
        }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
      }, "setInput"),
      input: /* @__PURE__ */ __name(function() {
        var e2 = this._input[0];
        return this.yytext += e2, this.yyleng++, this.offset++, this.match += e2, this.matched += e2, e2.match(/(?:\r\n?|\n).*/g) ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), e2;
      }, "input"),
      unput: /* @__PURE__ */ __name(function(e2) {
        var t2 = e2.length, n = e2.split(/(?:\r\n?|\n)/g);
        this._input = e2 + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - t2), this.offset -= t2;
        var r2 = 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), n.length - 1 && (this.yylineno -= n.length - 1);
        var i2 = this.yylloc.range;
        return this.yylloc = {
          first_line: this.yylloc.first_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.first_column,
          last_column: n ? (n.length === r2.length ? this.yylloc.first_column : 0) + r2[r2.length - n.length].length - n[0].length : this.yylloc.first_column - t2
        }, this.options.ranges && (this.yylloc.range = [i2[0], i2[0] + this.yyleng - t2]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      more: /* @__PURE__ */ __name(function() {
        return this._more = true, this;
      }, "more"),
      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"),
      less: /* @__PURE__ */ __name(function(e2) {
        this.unput(this.match.slice(e2));
      }, "less"),
      pastInput: /* @__PURE__ */ __name(function() {
        var e2 = this.matched.substr(0, this.matched.length - this.match.length);
        return (e2.length > 20 ? "..." : "") + e2.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      upcomingInput: /* @__PURE__ */ __name(function() {
        var e2 = this.match;
        return e2.length < 20 && (e2 += this._input.substr(0, 20 - e2.length)), (e2.substr(0, 20) + (e2.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      showPosition: /* @__PURE__ */ __name(function() {
        var e2 = this.pastInput(), t2 = Array(e2.length + 1).join("-");
        return e2 + this.upcomingInput() + "\n" + t2 + "^";
      }, "showPosition"),
      test_match: /* @__PURE__ */ __name(function(e2, t2) {
        var n, r2, i2;
        if (this.options.backtrack_lexer && (i2 = {
          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
        }, this.options.ranges && (i2.yylloc.range = this.yylloc.range.slice(0))), r2 = e2[0].match(/(?:\r\n?|\n).*/g), r2 && (this.yylineno += r2.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: r2 ? r2[r2.length - 1].length - r2[r2.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + e2[0].length
        }, this.yytext += e2[0], this.match += e2[0], this.matches = e2, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = false, this._backtrack = false, this._input = this._input.slice(e2[0].length), this.matched += e2[0], n = this.performAction.call(this, this.yy, this, t2, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = false), n) return n;
        if (this._backtrack) {
          for (var a2 in i2) this[a2] = i2[a2];
          return false;
        }
        return false;
      }, "test_match"),
      next: /* @__PURE__ */ __name(function() {
        if (this.done) return this.EOF;
        this._input || (this.done = true);
        var e2, t2, n, r2;
        this._more || (this.yytext = "", this.match = "");
        for (var i2 = this._currentRules(), a2 = 0; a2 < i2.length; a2++) if (n = this._input.match(this.rules[i2[a2]]), n && (!t2 || n[0].length > t2[0].length)) {
          if (t2 = n, r2 = a2, this.options.backtrack_lexer) {
            if (e2 = this.test_match(n, i2[a2]), e2 !== false) return e2;
            if (this._backtrack) {
              t2 = false;
              continue;
            } else return false;
          } else if (!this.options.flex) break;
        }
        return t2 ? (e2 = this.test_match(t2, i2[r2]), e2 === false ? false : e2) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      lex: /* @__PURE__ */ __name(function() {
        return this.next() || this.lex();
      }, "lex"),
      begin: /* @__PURE__ */ __name(function(e2) {
        this.conditionStack.push(e2);
      }, "begin"),
      popState: /* @__PURE__ */ __name(function() {
        return this.conditionStack.length - 1 > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      _currentRules: /* @__PURE__ */ __name(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      topState: /* @__PURE__ */ __name(function(e2) {
        return e2 = this.conditionStack.length - 1 - Math.abs(e2 || 0), e2 >= 0 ? this.conditionStack[e2] : "INITIAL";
      }, "topState"),
      pushState: /* @__PURE__ */ __name(function(e2) {
        this.begin(e2);
      }, "pushState"),
      stateStackSize: /* @__PURE__ */ __name(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": true },
      performAction: /* @__PURE__ */ __name(function(e2, t2, n, r2) {
        switch (n) {
          case 0:
            break;
          case 1:
            break;
          case 2:
            return 55;
          case 3:
            break;
          case 4:
            return this.begin("title"), 35;
          case 5:
            return this.popState(), "title_value";
          case 6:
            return this.begin("acc_title"), 37;
          case 7:
            return this.popState(), "acc_title_value";
          case 8:
            return this.begin("acc_descr"), 39;
          case 9:
            return this.popState(), "acc_descr_value";
          case 10:
            this.begin("acc_descr_multiline");
            break;
          case 11:
            this.popState();
            break;
          case 12:
            return "acc_descr_multiline_value";
          case 13:
            return 48;
          case 14:
            return 50;
          case 15:
            return 49;
          case 16:
            return 51;
          case 17:
            return 52;
          case 18:
            return 53;
          case 19:
            return 54;
          case 20:
            return 25;
          case 21:
            this.begin("md_string");
            break;
          case 22:
            return "MD_STR";
          case 23:
            this.popState();
            break;
          case 24:
            this.begin("string");
            break;
          case 25:
            this.popState();
            break;
          case 26:
            return "STR";
          case 27:
            this.begin("class_name");
            break;
          case 28:
            return this.popState(), 47;
          case 29:
            return this.begin("point_start"), 44;
          case 30:
            return this.begin("point_x"), 45;
          case 31:
            this.popState();
            break;
          case 32:
            this.popState(), this.begin("point_y");
            break;
          case 33:
            return this.popState(), 46;
          case 34:
            return 28;
          case 35:
            return 4;
          case 36:
            return 11;
          case 37:
            return 64;
          case 38:
            return 10;
          case 39:
            return 65;
          case 40:
            return 65;
          case 41:
            return 14;
          case 42:
            return 13;
          case 43:
            return 67;
          case 44:
            return 66;
          case 45:
            return 12;
          case 46:
            return 8;
          case 47:
            return 5;
          case 48:
            return 18;
          case 49:
            return 56;
          case 50:
            return 63;
          case 51:
            return 57;
        }
      }, "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
        }
      }
    };
  })();
  function $() {
    this.yy = {};
  }
  return __name($, "Parser"), $.prototype = pe, pe.Parser = $, new $();
})();
parser.parser = parser;
var quadrant_default = parser, defaultThemeVariables = getThemeVariables3(), QuadrantBuilder = (_a = class {
  constructor() {
    this.classes = /* @__PURE__ */ new Map(), this.config = this.getDefaultConfig(), this.themeConfig = this.getDefaultThemeConfig(), this.data = this.getDefaultData();
  }
  getDefaultData() {
    return {
      titleText: "",
      quadrant1Text: "",
      quadrant2Text: "",
      quadrant3Text: "",
      quadrant4Text: "",
      xAxisLeftText: "",
      xAxisRightText: "",
      yAxisBottomText: "",
      yAxisTopText: "",
      points: []
    };
  }
  getDefaultConfig() {
    var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
    return {
      showXAxis: true,
      showYAxis: true,
      showTitle: true,
      chartHeight: ((_a2 = defaultConfig_default.quadrantChart) == null ? void 0 : _a2.chartWidth) || 500,
      chartWidth: ((_b2 = defaultConfig_default.quadrantChart) == null ? void 0 : _b2.chartHeight) || 500,
      titlePadding: ((_c = defaultConfig_default.quadrantChart) == null ? void 0 : _c.titlePadding) || 10,
      titleFontSize: ((_d = defaultConfig_default.quadrantChart) == null ? void 0 : _d.titleFontSize) || 20,
      quadrantPadding: ((_e = defaultConfig_default.quadrantChart) == null ? void 0 : _e.quadrantPadding) || 5,
      xAxisLabelPadding: ((_f = defaultConfig_default.quadrantChart) == null ? void 0 : _f.xAxisLabelPadding) || 5,
      yAxisLabelPadding: ((_g = defaultConfig_default.quadrantChart) == null ? void 0 : _g.yAxisLabelPadding) || 5,
      xAxisLabelFontSize: ((_h = defaultConfig_default.quadrantChart) == null ? void 0 : _h.xAxisLabelFontSize) || 16,
      yAxisLabelFontSize: ((_i = defaultConfig_default.quadrantChart) == null ? void 0 : _i.yAxisLabelFontSize) || 16,
      quadrantLabelFontSize: ((_j = defaultConfig_default.quadrantChart) == null ? void 0 : _j.quadrantLabelFontSize) || 16,
      quadrantTextTopPadding: ((_k = defaultConfig_default.quadrantChart) == null ? void 0 : _k.quadrantTextTopPadding) || 5,
      pointTextPadding: ((_l = defaultConfig_default.quadrantChart) == null ? void 0 : _l.pointTextPadding) || 5,
      pointLabelFontSize: ((_m = defaultConfig_default.quadrantChart) == null ? void 0 : _m.pointLabelFontSize) || 12,
      pointRadius: ((_n = defaultConfig_default.quadrantChart) == null ? void 0 : _n.pointRadius) || 5,
      xAxisPosition: ((_o = defaultConfig_default.quadrantChart) == null ? void 0 : _o.xAxisPosition) || "top",
      yAxisPosition: ((_p = defaultConfig_default.quadrantChart) == null ? void 0 : _p.yAxisPosition) || "left",
      quadrantInternalBorderStrokeWidth: ((_q = defaultConfig_default.quadrantChart) == null ? void 0 : _q.quadrantInternalBorderStrokeWidth) || 1,
      quadrantExternalBorderStrokeWidth: ((_r = defaultConfig_default.quadrantChart) == null ? void 0 : _r.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(e) {
    this.data = {
      ...this.data,
      ...e
    };
  }
  addPoints(e) {
    this.data.points = [...e, ...this.data.points];
  }
  addClass(e, t) {
    this.classes.set(e, t);
  }
  setConfig(e) {
    log.trace("setConfig called with: ", e), this.config = {
      ...this.config,
      ...e
    };
  }
  setThemeConfig(e) {
    log.trace("setThemeConfig called with: ", e), this.themeConfig = {
      ...this.themeConfig,
      ...e
    };
  }
  calculateSpace(e, t, n, r) {
    let i = this.config.xAxisLabelPadding * 2 + this.config.xAxisLabelFontSize, a = {
      top: e === "top" && t ? i : 0,
      bottom: e === "bottom" && t ? i : 0
    }, o = this.config.yAxisLabelPadding * 2 + this.config.yAxisLabelFontSize, s = {
      left: this.config.yAxisPosition === "left" && n ? o : 0,
      right: this.config.yAxisPosition === "right" && n ? o : 0
    }, c = this.config.titleFontSize + this.config.titlePadding * 2, l = { top: r ? c : 0 }, u = this.config.quadrantPadding + s.left, d = this.config.quadrantPadding + a.top + l.top, f = this.config.chartWidth - this.config.quadrantPadding * 2 - s.left - s.right, p = this.config.chartHeight - this.config.quadrantPadding * 2 - a.top - a.bottom - l.top;
    return {
      xAxisSpace: a,
      yAxisSpace: s,
      titleSpace: l,
      quadrantSpace: {
        quadrantLeft: u,
        quadrantTop: d,
        quadrantWidth: f,
        quadrantHalfWidth: f / 2,
        quadrantHeight: p,
        quadrantHalfHeight: p / 2
      }
    };
  }
  getAxisLabels(e, t, n, r) {
    let { quadrantSpace: i, titleSpace: a } = r, { quadrantHalfHeight: o, quadrantHeight: s, quadrantLeft: c, quadrantHalfWidth: l, quadrantTop: u, quadrantWidth: d } = i, f = !!this.data.xAxisRightText, p = !!this.data.yAxisTopText, m = [];
    return this.data.xAxisLeftText && t && m.push({
      text: this.data.xAxisLeftText,
      fill: this.themeConfig.quadrantXAxisTextFill,
      x: c + (f ? l / 2 : 0),
      y: e === "top" ? this.config.xAxisLabelPadding + a.top : this.config.xAxisLabelPadding + u + s + this.config.quadrantPadding,
      fontSize: this.config.xAxisLabelFontSize,
      verticalPos: f ? "center" : "left",
      horizontalPos: "top",
      rotation: 0
    }), this.data.xAxisRightText && t && m.push({
      text: this.data.xAxisRightText,
      fill: this.themeConfig.quadrantXAxisTextFill,
      x: c + l + (f ? l / 2 : 0),
      y: e === "top" ? this.config.xAxisLabelPadding + a.top : this.config.xAxisLabelPadding + u + s + this.config.quadrantPadding,
      fontSize: this.config.xAxisLabelFontSize,
      verticalPos: f ? "center" : "left",
      horizontalPos: "top",
      rotation: 0
    }), this.data.yAxisBottomText && n && m.push({
      text: this.data.yAxisBottomText,
      fill: this.themeConfig.quadrantYAxisTextFill,
      x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + c + d + this.config.quadrantPadding,
      y: u + s - (p ? o / 2 : 0),
      fontSize: this.config.yAxisLabelFontSize,
      verticalPos: p ? "center" : "left",
      horizontalPos: "top",
      rotation: -90
    }), this.data.yAxisTopText && n && m.push({
      text: this.data.yAxisTopText,
      fill: this.themeConfig.quadrantYAxisTextFill,
      x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + c + d + this.config.quadrantPadding,
      y: u + o - (p ? o / 2 : 0),
      fontSize: this.config.yAxisLabelFontSize,
      verticalPos: p ? "center" : "left",
      horizontalPos: "top",
      rotation: -90
    }), m;
  }
  getQuadrants(e) {
    let { quadrantSpace: t } = e, { quadrantHalfHeight: n, quadrantLeft: r, quadrantHalfWidth: i, quadrantTop: a } = t, o = [
      {
        text: {
          text: this.data.quadrant1Text,
          fill: this.themeConfig.quadrant1TextFill,
          x: 0,
          y: 0,
          fontSize: this.config.quadrantLabelFontSize,
          verticalPos: "center",
          horizontalPos: "middle",
          rotation: 0
        },
        x: r + i,
        y: a,
        width: i,
        height: n,
        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: r,
        y: a,
        width: i,
        height: n,
        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: r,
        y: a + n,
        width: i,
        height: n,
        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: r + i,
        y: a + n,
        width: i,
        height: n,
        fill: this.themeConfig.quadrant4Fill
      }
    ];
    for (let e2 of o) e2.text.x = e2.x + e2.width / 2, this.data.points.length === 0 ? (e2.text.y = e2.y + e2.height / 2, e2.text.horizontalPos = "middle") : (e2.text.y = e2.y + this.config.quadrantTextTopPadding, e2.text.horizontalPos = "top");
    return o;
  }
  getQuadrantPoints(t) {
    let { quadrantSpace: n } = t, { quadrantHeight: r, quadrantLeft: i, quadrantTop: a, quadrantWidth: o } = n, s = linear().domain([0, 1]).range([i, o + i]), c = linear().domain([0, 1]).range([r + a, a]);
    return this.data.points.map((e) => {
      let t2 = this.classes.get(e.className);
      return t2 && (e = {
        ...t2,
        ...e
      }), {
        x: s(e.x),
        y: c(e.y),
        fill: e.color ?? this.themeConfig.quadrantPointFill,
        radius: e.radius ?? this.config.pointRadius,
        text: {
          text: e.text,
          fill: this.themeConfig.quadrantPointTextFill,
          x: s(e.x),
          y: c(e.y) + this.config.pointTextPadding,
          verticalPos: "center",
          horizontalPos: "top",
          fontSize: this.config.pointLabelFontSize,
          rotation: 0
        },
        strokeColor: e.strokeColor ?? this.themeConfig.quadrantPointFill,
        strokeWidth: e.strokeWidth ?? "0px"
      };
    });
  }
  getBorders(e) {
    let t = this.config.quadrantExternalBorderStrokeWidth / 2, { quadrantSpace: n } = e, { quadrantHalfHeight: r, quadrantHeight: i, quadrantLeft: a, quadrantHalfWidth: o, quadrantTop: s, quadrantWidth: c } = n;
    return [
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: a - t,
        y1: s,
        x2: a + c + t,
        y2: s
      },
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: a + c,
        y1: s + t,
        x2: a + c,
        y2: s + i - t
      },
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: a - t,
        y1: s + i,
        x2: a + c + t,
        y2: s + i
      },
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: a,
        y1: s + t,
        x2: a,
        y2: s + i - t
      },
      {
        strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
        strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
        x1: a + o,
        y1: s + t,
        x2: a + o,
        y2: s + i - t
      },
      {
        strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
        strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
        x1: a + t,
        y1: s + r,
        x2: a + c - t,
        y2: s + r
      }
    ];
  }
  getTitle(e) {
    if (e) 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
    };
  }
  build() {
    let e = this.config.showXAxis && !!(this.data.xAxisLeftText || this.data.xAxisRightText), t = this.config.showYAxis && !!(this.data.yAxisTopText || this.data.yAxisBottomText), n = this.config.showTitle && !!this.data.titleText, r = this.data.points.length > 0 ? "bottom" : this.config.xAxisPosition, i = this.calculateSpace(r, e, t, n);
    return {
      points: this.getQuadrantPoints(i),
      quadrants: this.getQuadrants(i),
      axisLabels: this.getAxisLabels(r, e, t, i),
      borderLines: this.getBorders(i),
      title: this.getTitle(n)
    };
  }
}, __name(_a, "QuadrantBuilder"), _a), InvalidStyleError = (_b = class extends Error {
  constructor(e, t, n) {
    super(`value for ${e} ${t} is invalid, please use a valid ${n}`), this.name = "InvalidStyleError";
  }
}, __name(_b, "InvalidStyleError"), _b);
function validateHexCode(e) {
  return !/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(e);
}
__name(validateHexCode, "validateHexCode");
function validateNumber(e) {
  return !/^\d+$/.test(e);
}
__name(validateNumber, "validateNumber");
function validateSizeInPixels(e) {
  return !/^\d+px$/.test(e);
}
__name(validateSizeInPixels, "validateSizeInPixels");
var config = getConfig2();
function textSanitizer(e) {
  return sanitizeText(e.trim(), config);
}
__name(textSanitizer, "textSanitizer");
var quadrantBuilder = new QuadrantBuilder();
function setQuadrant1Text(e) {
  quadrantBuilder.setData({ quadrant1Text: textSanitizer(e.text) });
}
__name(setQuadrant1Text, "setQuadrant1Text");
function setQuadrant2Text(e) {
  quadrantBuilder.setData({ quadrant2Text: textSanitizer(e.text) });
}
__name(setQuadrant2Text, "setQuadrant2Text");
function setQuadrant3Text(e) {
  quadrantBuilder.setData({ quadrant3Text: textSanitizer(e.text) });
}
__name(setQuadrant3Text, "setQuadrant3Text");
function setQuadrant4Text(e) {
  quadrantBuilder.setData({ quadrant4Text: textSanitizer(e.text) });
}
__name(setQuadrant4Text, "setQuadrant4Text");
function setXAxisLeftText(e) {
  quadrantBuilder.setData({ xAxisLeftText: textSanitizer(e.text) });
}
__name(setXAxisLeftText, "setXAxisLeftText");
function setXAxisRightText(e) {
  quadrantBuilder.setData({ xAxisRightText: textSanitizer(e.text) });
}
__name(setXAxisRightText, "setXAxisRightText");
function setYAxisTopText(e) {
  quadrantBuilder.setData({ yAxisTopText: textSanitizer(e.text) });
}
__name(setYAxisTopText, "setYAxisTopText");
function setYAxisBottomText(e) {
  quadrantBuilder.setData({ yAxisBottomText: textSanitizer(e.text) });
}
__name(setYAxisBottomText, "setYAxisBottomText");
function parseStyles(e) {
  let t = {};
  for (let n of e) {
    let [e2, r] = n.trim().split(/\s*:\s*/);
    if (e2 === "radius") {
      if (validateNumber(r)) throw new InvalidStyleError(e2, r, "number");
      t.radius = parseInt(r);
    } else if (e2 === "color") {
      if (validateHexCode(r)) throw new InvalidStyleError(e2, r, "hex code");
      t.color = r;
    } else if (e2 === "stroke-color") {
      if (validateHexCode(r)) throw new InvalidStyleError(e2, r, "hex code");
      t.strokeColor = r;
    } else if (e2 === "stroke-width") {
      if (validateSizeInPixels(r)) throw new InvalidStyleError(e2, r, "number of pixels (eg. 10px)");
      t.strokeWidth = r;
    } else throw Error(`style named ${e2} is not supported.`);
  }
  return t;
}
__name(parseStyles, "parseStyles");
function addPoint(e, t, n, r, i) {
  let a = parseStyles(i);
  quadrantBuilder.addPoints([{
    x: n,
    y: r,
    text: textSanitizer(e.text),
    className: t,
    ...a
  }]);
}
__name(addPoint, "addPoint");
function addClass(e, t) {
  quadrantBuilder.addClass(e, parseStyles(t));
}
__name(addClass, "addClass");
function setWidth(e) {
  quadrantBuilder.setConfig({ chartWidth: e });
}
__name(setWidth, "setWidth");
function setHeight(e) {
  quadrantBuilder.setConfig({ chartHeight: e });
}
__name(setHeight, "setHeight");
function getQuadrantData() {
  let { themeVariables: e, quadrantChart: t } = getConfig2();
  return t && quadrantBuilder.setConfig(t), quadrantBuilder.setThemeConfig({
    quadrant1Fill: e.quadrant1Fill,
    quadrant2Fill: e.quadrant2Fill,
    quadrant3Fill: e.quadrant3Fill,
    quadrant4Fill: e.quadrant4Fill,
    quadrant1TextFill: e.quadrant1TextFill,
    quadrant2TextFill: e.quadrant2TextFill,
    quadrant3TextFill: e.quadrant3TextFill,
    quadrant4TextFill: e.quadrant4TextFill,
    quadrantPointFill: e.quadrantPointFill,
    quadrantPointTextFill: e.quadrantPointTextFill,
    quadrantXAxisTextFill: e.quadrantXAxisTextFill,
    quadrantYAxisTextFill: e.quadrantYAxisTextFill,
    quadrantExternalBorderStrokeFill: e.quadrantExternalBorderStrokeFill,
    quadrantInternalBorderStrokeFill: e.quadrantInternalBorderStrokeFill,
    quadrantTitleFill: e.quadrantTitleFill
  }), quadrantBuilder.setData({ titleText: getDiagramTitle() }), quadrantBuilder.build();
}
__name(getQuadrantData, "getQuadrantData");
var diagram = {
  parser: quadrant_default,
  db: {
    setWidth,
    setHeight,
    setQuadrant1Text,
    setQuadrant2Text,
    setQuadrant3Text,
    setQuadrant4Text,
    setXAxisLeftText,
    setXAxisRightText,
    setYAxisTopText,
    setYAxisBottomText,
    parseStyles,
    addPoint,
    addClass,
    getQuadrantData,
    clear: /* @__PURE__ */ __name(function() {
      quadrantBuilder.clear(), clear();
    }, "clear"),
    setAccTitle,
    getAccTitle,
    setDiagramTitle,
    getDiagramTitle,
    getAccDescription,
    setAccDescription
  },
  renderer: { draw: /* @__PURE__ */ __name((e, i, a, o) => {
    var _a2, _b2, _c;
    function s(e2) {
      return e2 === "top" ? "hanging" : "middle";
    }
    __name(s, "getDominantBaseLine");
    function c(e2) {
      return e2 === "left" ? "start" : "middle";
    }
    __name(c, "getTextAnchor");
    function l(e2) {
      return `translate(${e2.x}, ${e2.y}) rotate(${e2.rotation || 0})`;
    }
    __name(l, "getTransformation");
    let u = getConfig2();
    log.debug("Rendering quadrant chart\n" + e);
    let p = u.securityLevel, m;
    p === "sandbox" && (m = select_default("#i" + i));
    let h = select_default(p === "sandbox" ? m.nodes()[0].contentDocument.body : "body").select(`[id="${i}"]`), g = h.append("g").attr("class", "main"), _ = ((_a2 = u.quadrantChart) == null ? void 0 : _a2.chartWidth) ?? 500, v = ((_b2 = u.quadrantChart) == null ? void 0 : _b2.chartHeight) ?? 500;
    configureSvgSize(h, v, _, ((_c = u.quadrantChart) == null ? void 0 : _c.useMaxWidth) ?? true), h.attr("viewBox", "0 0 " + _ + " " + v), o.db.setHeight(v), o.db.setWidth(_);
    let y = o.db.getQuadrantData(), b = g.append("g").attr("class", "quadrants"), x = g.append("g").attr("class", "border"), S = g.append("g").attr("class", "data-points"), C = g.append("g").attr("class", "labels"), w = g.append("g").attr("class", "title");
    y.title && w.append("text").attr("x", 0).attr("y", 0).attr("fill", y.title.fill).attr("font-size", y.title.fontSize).attr("dominant-baseline", s(y.title.horizontalPos)).attr("text-anchor", c(y.title.verticalPos)).attr("transform", l(y.title)).text(y.title.text), y.borderLines && x.selectAll("line").data(y.borderLines).enter().append("line").attr("x1", (e2) => e2.x1).attr("y1", (e2) => e2.y1).attr("x2", (e2) => e2.x2).attr("y2", (e2) => e2.y2).style("stroke", (e2) => e2.strokeFill).style("stroke-width", (e2) => e2.strokeWidth);
    let T = b.selectAll("g.quadrant").data(y.quadrants).enter().append("g").attr("class", "quadrant");
    T.append("rect").attr("x", (e2) => e2.x).attr("y", (e2) => e2.y).attr("width", (e2) => e2.width).attr("height", (e2) => e2.height).attr("fill", (e2) => e2.fill), T.append("text").attr("x", 0).attr("y", 0).attr("fill", (e2) => e2.text.fill).attr("font-size", (e2) => e2.text.fontSize).attr("dominant-baseline", (e2) => s(e2.text.horizontalPos)).attr("text-anchor", (e2) => c(e2.text.verticalPos)).attr("transform", (e2) => l(e2.text)).text((e2) => e2.text.text), C.selectAll("g.label").data(y.axisLabels).enter().append("g").attr("class", "label").append("text").attr("x", 0).attr("y", 0).text((e2) => e2.text).attr("fill", (e2) => e2.fill).attr("font-size", (e2) => e2.fontSize).attr("dominant-baseline", (e2) => s(e2.horizontalPos)).attr("text-anchor", (e2) => c(e2.verticalPos)).attr("transform", (e2) => l(e2));
    let E = S.selectAll("g.data-point").data(y.points).enter().append("g").attr("class", "data-point");
    E.append("circle").attr("cx", (e2) => e2.x).attr("cy", (e2) => e2.y).attr("r", (e2) => e2.radius).attr("fill", (e2) => e2.fill).attr("stroke", (e2) => e2.strokeColor).attr("stroke-width", (e2) => e2.strokeWidth), E.append("text").attr("x", 0).attr("y", 0).text((e2) => e2.text.text).attr("fill", (e2) => e2.text.fill).attr("font-size", (e2) => e2.text.fontSize).attr("dominant-baseline", (e2) => s(e2.text.horizontalPos)).attr("text-anchor", (e2) => c(e2.text.verticalPos)).attr("transform", (e2) => l(e2.text));
  }, "draw") },
  styles: /* @__PURE__ */ __name(() => "", "styles")
};
export {
  diagram
};
