import { G as Se, K as ke, i as ae, f as Fe, W as Pe, U as Ce, p as r, Z as zt, g as bt, q as ee, A as Le, H as ve, F as D, c as Ee, ah as ze } from "./index-CNUFa5l3.js";
import { q as ie } from "./linear-1MXhYum8-DQFsmHI2.js";
var vt = function() {
  var t = /* @__PURE__ */ r(function(n, b, g, h) {
    for (g || (g = {}), h = n.length; h--; g[n[h]] = b) ;
    return g;
  }, "o"), l = [1, 3], u = [1, 4], c = [1, 5], o = [1, 6], x = [1, 7], f = [
    1,
    4,
    5,
    10,
    12,
    13,
    14,
    15,
    18,
    25,
    35,
    37,
    39,
    41,
    42,
    48,
    50,
    51,
    52,
    53,
    54,
    55,
    56,
    57,
    60,
    61,
    63,
    64,
    65,
    66,
    67
  ], _ = [
    1,
    4,
    5,
    10,
    12,
    13,
    14,
    15,
    18,
    25,
    28,
    35,
    37,
    39,
    41,
    42,
    48,
    50,
    51,
    52,
    53,
    54,
    55,
    56,
    57,
    60,
    61,
    63,
    64,
    65,
    66,
    67
  ], a = [
    55,
    56,
    57
  ], m = [2, 36], p = [1, 37], y = [1, 36], q = [1, 38], T = [1, 35], d = [1, 43], A = [1, 41], S = [1, 45], Y = [1, 14], j = [1, 23], pt = [1, 18], ct = [1, 19], dt = [1, 20], ut = [1, 21], xt = [1, 22], ft = [1, 24], i = [1, 25], Dt = [1, 26], It = [1, 27], Nt = [1, 28], wt = [1, 29], U = [1, 32], Q = [1, 33], F = [1, 34], P = [1, 39], C = [1, 40], L = [1, 42], v = [1, 44], X = [1, 63], O = [1, 62], E = [
    4,
    5,
    8,
    10,
    12,
    13,
    14,
    15,
    18,
    44,
    47,
    49,
    55,
    56,
    57,
    63,
    64,
    65,
    66,
    67
  ], Wt = [1, 66], $t = [1, 67], Bt = [1, 68], Rt = [1, 69], Ut = [1, 70], Qt = [1, 71], Ht = [1, 72], Xt = [1, 73], Ot = [1, 74], Mt = [1, 75], Yt = [1, 76], jt = [1, 77], w = [
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12,
    13,
    14,
    15,
    18
  ], Z = [1, 91], J = [1, 92], V = [1, 93], tt = [1, 100], et = [1, 94], it = [1, 97], at = [1, 95], nt = [1, 96], st = [1, 98], rt = [1, 99], St = [1, 103], Gt = [
    10,
    55,
    56,
    57
  ], $ = [
    4,
    5,
    6,
    8,
    10,
    11,
    13,
    17,
    18,
    19,
    20,
    55,
    56,
    57
  ], kt = {
    trace: /* @__PURE__ */ r(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],
      [58, 1],
      [59, 1],
      [59, 1],
      [59, 1]
    ],
    performAction: /* @__PURE__ */ r(function(n, b, g, h, k, e, gt) {
      var s = e.length - 1;
      switch (k) {
        case 23:
          this.$ = e[s];
          break;
        case 24:
          this.$ = e[s - 1] + "" + e[s];
          break;
        case 26:
          this.$ = e[s - 1] + e[s];
          break;
        case 27:
          this.$ = [e[s].trim()];
          break;
        case 28:
          e[s - 2].push(e[s].trim()), this.$ = e[s - 2];
          break;
        case 29:
          this.$ = e[s - 4], h.addClass(e[s - 2], e[s]);
          break;
        case 37:
          this.$ = [];
          break;
        case 42:
          this.$ = e[s].trim(), h.setDiagramTitle(this.$);
          break;
        case 43:
          this.$ = e[s].trim(), h.setAccTitle(this.$);
          break;
        case 44:
        case 45:
          this.$ = e[s].trim(), h.setAccDescription(this.$);
          break;
        case 46:
          h.addSection(e[s].substr(8)), this.$ = e[s].substr(8);
          break;
        case 47:
          h.addPoint(e[s - 3], "", e[s - 1], e[s], []);
          break;
        case 48:
          h.addPoint(e[s - 4], e[s - 3], e[s - 1], e[s], []);
          break;
        case 49:
          h.addPoint(e[s - 4], "", e[s - 2], e[s - 1], e[s]);
          break;
        case 50:
          h.addPoint(e[s - 5], e[s - 4], e[s - 2], e[s - 1], e[s]);
          break;
        case 51:
          h.setXAxisLeftText(e[s - 2]), h.setXAxisRightText(e[s]);
          break;
        case 52:
          e[s - 1].text += " ⟶ ", h.setXAxisLeftText(e[s - 1]);
          break;
        case 53:
          h.setXAxisLeftText(e[s]);
          break;
        case 54:
          h.setYAxisBottomText(e[s - 2]), h.setYAxisTopText(e[s]);
          break;
        case 55:
          e[s - 1].text += " ⟶ ", h.setYAxisBottomText(e[s - 1]);
          break;
        case 56:
          h.setYAxisBottomText(e[s]);
          break;
        case 57:
          h.setQuadrant1Text(e[s]);
          break;
        case 58:
          h.setQuadrant2Text(e[s]);
          break;
        case 59:
          h.setQuadrant3Text(e[s]);
          break;
        case 60:
          h.setQuadrant4Text(e[s]);
          break;
        case 64:
          this.$ = {
            text: e[s],
            type: "text"
          };
          break;
        case 65:
          this.$ = {
            text: e[s - 1].text + "" + e[s],
            type: e[s - 1].type
          };
          break;
        case 66:
          this.$ = {
            text: e[s],
            type: "text"
          };
          break;
        case 67:
          this.$ = {
            text: e[s],
            type: "markdown"
          };
          break;
        case 68:
          this.$ = e[s];
          break;
        case 69:
          this.$ = e[s - 1] + "" + e[s];
          break;
      }
    }, "anonymous"),
    table: [
      {
        18: l,
        26: 1,
        27: 2,
        28: u,
        55: c,
        56: o,
        57: x
      },
      { 1: [3] },
      {
        18: l,
        26: 8,
        27: 2,
        28: u,
        55: c,
        56: o,
        57: x
      },
      {
        18: l,
        26: 9,
        27: 2,
        28: u,
        55: c,
        56: o,
        57: x
      },
      t(f, [2, 33], { 29: 10 }),
      t(_, [2, 61]),
      t(_, [2, 62]),
      t(_, [2, 63]),
      { 1: [2, 30] },
      { 1: [2, 31] },
      t(a, m, {
        30: 11,
        31: 12,
        24: 13,
        32: 15,
        33: 16,
        34: 17,
        43: 30,
        58: 31,
        1: [2, 32],
        4: p,
        5: y,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        18: Y,
        25: j,
        35: pt,
        37: ct,
        39: dt,
        41: ut,
        42: xt,
        48: ft,
        50: i,
        51: Dt,
        52: It,
        53: Nt,
        54: wt,
        60: U,
        61: Q,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      }),
      t(f, [2, 34]),
      {
        27: 46,
        55: c,
        56: o,
        57: x
      },
      t(a, [2, 37]),
      t(a, m, {
        24: 13,
        32: 15,
        33: 16,
        34: 17,
        43: 30,
        58: 31,
        31: 47,
        4: p,
        5: y,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        18: Y,
        25: j,
        35: pt,
        37: ct,
        39: dt,
        41: ut,
        42: xt,
        48: ft,
        50: i,
        51: Dt,
        52: It,
        53: Nt,
        54: wt,
        60: U,
        61: Q,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      }),
      t(a, [2, 39]),
      t(a, [2, 40]),
      t(a, [2, 41]),
      { 36: [1, 48] },
      { 38: [1, 49] },
      { 40: [1, 50] },
      t(a, [2, 45]),
      t(a, [2, 46]),
      { 18: [1, 51] },
      {
        4: p,
        5: y,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        43: 52,
        58: 31,
        60: U,
        61: Q,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      },
      {
        4: p,
        5: y,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        43: 53,
        58: 31,
        60: U,
        61: Q,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      },
      {
        4: p,
        5: y,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        43: 54,
        58: 31,
        60: U,
        61: Q,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      },
      {
        4: p,
        5: y,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        43: 55,
        58: 31,
        60: U,
        61: Q,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      },
      {
        4: p,
        5: y,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        43: 56,
        58: 31,
        60: U,
        61: Q,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      },
      {
        4: p,
        5: y,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        43: 57,
        58: 31,
        60: U,
        61: Q,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      },
      {
        4: p,
        5: y,
        8: X,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        18: O,
        44: [1, 58],
        47: [1, 59],
        58: 61,
        59: 60,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      },
      t(E, [2, 64]),
      t(E, [2, 66]),
      t(E, [2, 67]),
      t(E, [2, 70]),
      t(E, [2, 71]),
      t(E, [2, 72]),
      t(E, [2, 73]),
      t(E, [2, 74]),
      t(E, [2, 75]),
      t(E, [2, 76]),
      t(E, [2, 77]),
      t(E, [2, 78]),
      t(E, [2, 79]),
      t(E, [2, 80]),
      t(E, [2, 81]),
      t(f, [2, 35]),
      t(a, [2, 38]),
      t(a, [2, 42]),
      t(a, [2, 43]),
      t(a, [2, 44]),
      {
        3: 65,
        4: Wt,
        5: $t,
        6: Bt,
        7: Rt,
        8: Ut,
        9: Qt,
        10: Ht,
        11: Xt,
        12: Ot,
        13: Mt,
        14: Yt,
        15: jt,
        21: 64
      },
      t(a, [2, 53], {
        59: 60,
        58: 61,
        4: p,
        5: y,
        8: X,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        18: O,
        49: [1, 78],
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      }),
      t(a, [2, 56], {
        59: 60,
        58: 61,
        4: p,
        5: y,
        8: X,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        18: O,
        49: [1, 79],
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      }),
      t(a, [2, 57], {
        59: 60,
        58: 61,
        4: p,
        5: y,
        8: X,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        18: O,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      }),
      t(a, [2, 58], {
        59: 60,
        58: 61,
        4: p,
        5: y,
        8: X,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        18: O,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      }),
      t(a, [2, 59], {
        59: 60,
        58: 61,
        4: p,
        5: y,
        8: X,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        18: O,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      }),
      t(a, [2, 60], {
        59: 60,
        58: 61,
        4: p,
        5: y,
        8: X,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        18: O,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      }),
      { 45: [1, 80] },
      { 44: [1, 81] },
      t(E, [2, 65]),
      t(E, [2, 82]),
      t(E, [2, 83]),
      t(E, [2, 84]),
      {
        3: 83,
        4: Wt,
        5: $t,
        6: Bt,
        7: Rt,
        8: Ut,
        9: Qt,
        10: Ht,
        11: Xt,
        12: Ot,
        13: Mt,
        14: Yt,
        15: jt,
        18: [1, 82]
      },
      t(w, [2, 23]),
      t(w, [2, 1]),
      t(w, [2, 2]),
      t(w, [2, 3]),
      t(w, [2, 4]),
      t(w, [2, 5]),
      t(w, [2, 6]),
      t(w, [2, 7]),
      t(w, [2, 8]),
      t(w, [2, 9]),
      t(w, [2, 10]),
      t(w, [2, 11]),
      t(w, [2, 12]),
      t(a, [2, 52], {
        58: 31,
        43: 84,
        4: p,
        5: y,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        60: U,
        61: Q,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      }),
      t(a, [2, 55], {
        58: 31,
        43: 85,
        4: p,
        5: y,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        60: U,
        61: Q,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      }),
      { 46: [1, 86] },
      { 45: [1, 87] },
      {
        4: Z,
        5: J,
        6: V,
        8: tt,
        11: et,
        13: it,
        16: 90,
        17: at,
        18: nt,
        19: st,
        20: rt,
        22: 89,
        23: 88
      },
      t(w, [2, 24]),
      t(a, [2, 51], {
        59: 60,
        58: 61,
        4: p,
        5: y,
        8: X,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        18: O,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      }),
      t(a, [2, 54], {
        59: 60,
        58: 61,
        4: p,
        5: y,
        8: X,
        10: q,
        12: T,
        13: d,
        14: A,
        15: S,
        18: O,
        63: F,
        64: P,
        65: C,
        66: L,
        67: v
      }),
      t(a, [2, 47], {
        22: 89,
        16: 90,
        23: 101,
        4: Z,
        5: J,
        6: V,
        8: tt,
        11: et,
        13: it,
        17: at,
        18: nt,
        19: st,
        20: rt
      }),
      { 46: [1, 102] },
      t(a, [2, 29], { 10: St }),
      t(Gt, [2, 27], {
        16: 104,
        4: Z,
        5: J,
        6: V,
        8: tt,
        11: et,
        13: it,
        17: at,
        18: nt,
        19: st,
        20: rt
      }),
      t($, [2, 25]),
      t($, [2, 13]),
      t($, [2, 14]),
      t($, [2, 15]),
      t($, [2, 16]),
      t($, [2, 17]),
      t($, [2, 18]),
      t($, [2, 19]),
      t($, [2, 20]),
      t($, [2, 21]),
      t($, [2, 22]),
      t(a, [2, 49], { 10: St }),
      t(a, [2, 48], {
        22: 89,
        16: 90,
        23: 105,
        4: Z,
        5: J,
        6: V,
        8: tt,
        11: et,
        13: it,
        17: at,
        18: nt,
        19: st,
        20: rt
      }),
      {
        4: Z,
        5: J,
        6: V,
        8: tt,
        11: et,
        13: it,
        16: 90,
        17: at,
        18: nt,
        19: st,
        20: rt,
        22: 106
      },
      t($, [2, 26]),
      t(a, [2, 50], { 10: St }),
      t(Gt, [2, 28], {
        16: 104,
        4: Z,
        5: J,
        6: V,
        8: tt,
        11: et,
        13: it,
        17: at,
        18: nt,
        19: st,
        20: rt
      })
    ],
    defaultActions: {
      8: [2, 30],
      9: [2, 31]
    },
    parseError: /* @__PURE__ */ r(function(n, b) {
      if (b.recoverable) this.trace(n);
      else {
        var g = Error(n);
        throw g.hash = b, g;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ r(function(n) {
      var b = this, g = [0], h = [], k = [null], e = [], gt = this.table, s = "", mt = 0, Kt = 0, Te = 0, qe = 2, Zt = 1, Ae = e.slice.call(arguments, 1), z = Object.create(this.lexer), G = { yy: {} };
      for (var Ft in this.yy) Object.prototype.hasOwnProperty.call(this.yy, Ft) && (G.yy[Ft] = this.yy[Ft]);
      z.setInput(n, G.yy), G.yy.lexer = z, G.yy.parser = this, z.yylloc === void 0 && (z.yylloc = {});
      var Pt = z.yylloc;
      e.push(Pt);
      var be = z.options && z.options.ranges;
      typeof G.yy.parseError == "function" ? this.parseError = G.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function _e(R) {
        g.length -= 2 * R, k.length -= R, e.length -= R;
      }
      r(_e, "popStack");
      function Jt() {
        var R = h.pop() || z.lex() || Zt;
        return typeof R != "number" && (R instanceof Array && (h = R, R = h.pop()), R = b.symbols_[R] || R), R;
      }
      r(Jt, "lex");
      for (var W, Ct, K, B, Lt, lt = {}, Tt, M, Vt, qt; ; ) {
        if (K = g[g.length - 1], this.defaultActions[K] ? B = this.defaultActions[K] : (W ?? (W = Jt()), B = gt[K] && gt[K][W]), B === void 0 || !B.length || !B[0]) {
          var te = "";
          for (Tt in qt = [], gt[K]) this.terminals_[Tt] && Tt > qe && qt.push("'" + this.terminals_[Tt] + "'");
          te = z.showPosition ? "Parse error on line " + (mt + 1) + `:
` + z.showPosition() + `
Expecting ` + qt.join(", ") + ", got '" + (this.terminals_[W] || W) + "'" : "Parse error on line " + (mt + 1) + ": Unexpected " + (W == Zt ? "end of input" : "'" + (this.terminals_[W] || W) + "'"), this.parseError(te, {
            text: z.match,
            token: this.terminals_[W] || W,
            line: z.yylineno,
            loc: Pt,
            expected: qt
          });
        }
        if (B[0] instanceof Array && B.length > 1) throw Error("Parse Error: multiple actions possible at state: " + K + ", token: " + W);
        switch (B[0]) {
          case 1:
            g.push(W), k.push(z.yytext), e.push(z.yylloc), g.push(B[1]), W = null, Ct ? (W = Ct, Ct = null) : (Kt = z.yyleng, s = z.yytext, mt = z.yylineno, Pt = z.yylloc, Te > 0);
            break;
          case 2:
            if (M = this.productions_[B[1]][1], lt.$ = k[k.length - M], lt._$ = {
              first_line: e[e.length - (M || 1)].first_line,
              last_line: e[e.length - 1].last_line,
              first_column: e[e.length - (M || 1)].first_column,
              last_column: e[e.length - 1].last_column
            }, be && (lt._$.range = [e[e.length - (M || 1)].range[0], e[e.length - 1].range[1]]), Lt = this.performAction.apply(lt, [
              s,
              Kt,
              mt,
              G.yy,
              B[1],
              k,
              e
            ].concat(Ae)), Lt !== void 0) return Lt;
            M && (g = g.slice(0, -1 * M * 2), k = k.slice(0, -1 * M), e = e.slice(0, -1 * M)), g.push(this.productions_[B[1]][0]), k.push(lt.$), e.push(lt._$), Vt = gt[g[g.length - 2]][g[g.length - 1]], g.push(Vt);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  };
  kt.lexer = /* @__PURE__ */ function() {
    return {
      EOF: 1,
      parseError: /* @__PURE__ */ r(function(n, b) {
        if (this.yy.parser) this.yy.parser.parseError(n, b);
        else throw Error(n);
      }, "parseError"),
      setInput: /* @__PURE__ */ r(function(n, b) {
        return this.yy = b || this.yy || {}, this._input = n, this._more = this._backtrack = this.done = !1, 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__ */ r(function() {
        var n = this._input[0];
        return this.yytext += n, this.yyleng++, this.offset++, this.match += n, this.matched += n, n.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), n;
      }, "input"),
      unput: /* @__PURE__ */ r(function(n) {
        var b = n.length, g = n.split(/(?:\r\n?|\n)/g);
        this._input = n + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - b), this.offset -= b;
        var h = 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), g.length - 1 && (this.yylineno -= g.length - 1);
        var k = 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: g ? (g.length === h.length ? this.yylloc.first_column : 0) + h[h.length - g.length].length - g[0].length : this.yylloc.first_column - b
        }, this.options.ranges && (this.yylloc.range = [k[0], k[0] + this.yyleng - b]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      more: /* @__PURE__ */ r(function() {
        return this._more = !0, this;
      }, "more"),
      reject: /* @__PURE__ */ r(function() {
        if (this.options.backtrack_lexer) this._backtrack = !0;
        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).
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
        return this;
      }, "reject"),
      less: /* @__PURE__ */ r(function(n) {
        this.unput(this.match.slice(n));
      }, "less"),
      pastInput: /* @__PURE__ */ r(function() {
        var n = this.matched.substr(0, this.matched.length - this.match.length);
        return (n.length > 20 ? "..." : "") + n.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      upcomingInput: /* @__PURE__ */ r(function() {
        var n = this.match;
        return n.length < 20 && (n += this._input.substr(0, 20 - n.length)), (n.substr(0, 20) + (n.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      showPosition: /* @__PURE__ */ r(function() {
        var n = this.pastInput(), b = Array(n.length + 1).join("-");
        return n + this.upcomingInput() + `
` + b + "^";
      }, "showPosition"),
      test_match: /* @__PURE__ */ r(function(n, b) {
        var g, h, k;
        if (this.options.backtrack_lexer && (k = {
          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 && (k.yylloc.range = this.yylloc.range.slice(0))), h = n[0].match(/(?:\r\n?|\n).*/g), h && (this.yylineno += h.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: h ? h[h.length - 1].length - h[h.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + n[0].length
        }, this.yytext += n[0], this.match += n[0], this.matches = n, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(n[0].length), this.matched += n[0], g = this.performAction.call(this, this.yy, this, b, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), g) return g;
        if (this._backtrack) {
          for (var e in k) this[e] = k[e];
          return !1;
        }
        return !1;
      }, "test_match"),
      next: /* @__PURE__ */ r(function() {
        if (this.done) return this.EOF;
        this._input || (this.done = !0);
        var n, b, g, h;
        this._more || (this.yytext = "", this.match = "");
        for (var k = this._currentRules(), e = 0; e < k.length; e++) if (g = this._input.match(this.rules[k[e]]), g && (!b || g[0].length > b[0].length)) {
          if (b = g, h = e, this.options.backtrack_lexer) {
            if (n = this.test_match(g, k[e]), n !== !1) return n;
            if (this._backtrack) {
              b = !1;
              continue;
            } else return !1;
          } else if (!this.options.flex) break;
        }
        return b ? (n = this.test_match(b, k[h]), n === !1 ? !1 : n) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      lex: /* @__PURE__ */ r(function() {
        return this.next() || this.lex();
      }, "lex"),
      begin: /* @__PURE__ */ r(function(n) {
        this.conditionStack.push(n);
      }, "begin"),
      popState: /* @__PURE__ */ r(function() {
        return this.conditionStack.length - 1 > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      _currentRules: /* @__PURE__ */ r(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__ */ r(function(n) {
        return n = this.conditionStack.length - 1 - Math.abs(n || 0), n >= 0 ? this.conditionStack[n] : "INITIAL";
      }, "topState"),
      pushState: /* @__PURE__ */ r(function(n) {
        this.begin(n);
      }, "pushState"),
      stateStackSize: /* @__PURE__ */ r(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ r(function(n, b, g, h) {
        switch (g) {
          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 15;
          case 37:
            return 11;
          case 38:
            return 64;
          case 39:
            return 10;
          case 40:
            return 65;
          case 41:
            return 65;
          case 42:
            return 14;
          case 43:
            return 13;
          case 44:
            return 67;
          case 45:
            return 66;
          case 46:
            return 12;
          case 47:
            return 8;
          case 48:
            return 5;
          case 49:
            return 18;
          case 50:
            return 56;
          case 51:
            return 63;
          case 52:
            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,
        /^(?:[^\x00-\x7F]+)/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: !1
        },
        point_y: {
          rules: [33],
          inclusive: !1
        },
        point_x: {
          rules: [32],
          inclusive: !1
        },
        point_start: {
          rules: [30, 31],
          inclusive: !1
        },
        acc_descr_multiline: {
          rules: [11, 12],
          inclusive: !1
        },
        acc_descr: {
          rules: [9],
          inclusive: !1
        },
        acc_title: {
          rules: [7],
          inclusive: !1
        },
        title: {
          rules: [5],
          inclusive: !1
        },
        md_string: {
          rules: [22, 23],
          inclusive: !1
        },
        string: {
          rules: [25, 26],
          inclusive: !1
        },
        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,
            52
          ],
          inclusive: !0
        }
      }
    };
  }();
  function yt() {
    this.yy = {};
  }
  return r(yt, "Parser"), yt.prototype = kt, kt.Parser = yt, new yt();
}();
vt.parser = vt;
var De = vt, N = ze(), ot, Ie = (ot = 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 l, u, c, o, x, f, _, a, m, p, y, q, T, d, A, S, Y, j;
    return {
      showXAxis: !0,
      showYAxis: !0,
      showTitle: !0,
      chartHeight: ((l = D.quadrantChart) == null ? void 0 : l.chartWidth) || 500,
      chartWidth: ((u = D.quadrantChart) == null ? void 0 : u.chartHeight) || 500,
      titlePadding: ((c = D.quadrantChart) == null ? void 0 : c.titlePadding) || 10,
      titleFontSize: ((o = D.quadrantChart) == null ? void 0 : o.titleFontSize) || 20,
      quadrantPadding: ((x = D.quadrantChart) == null ? void 0 : x.quadrantPadding) || 5,
      xAxisLabelPadding: ((f = D.quadrantChart) == null ? void 0 : f.xAxisLabelPadding) || 5,
      yAxisLabelPadding: ((_ = D.quadrantChart) == null ? void 0 : _.yAxisLabelPadding) || 5,
      xAxisLabelFontSize: ((a = D.quadrantChart) == null ? void 0 : a.xAxisLabelFontSize) || 16,
      yAxisLabelFontSize: ((m = D.quadrantChart) == null ? void 0 : m.yAxisLabelFontSize) || 16,
      quadrantLabelFontSize: ((p = D.quadrantChart) == null ? void 0 : p.quadrantLabelFontSize) || 16,
      quadrantTextTopPadding: ((y = D.quadrantChart) == null ? void 0 : y.quadrantTextTopPadding) || 5,
      pointTextPadding: ((q = D.quadrantChart) == null ? void 0 : q.pointTextPadding) || 5,
      pointLabelFontSize: ((T = D.quadrantChart) == null ? void 0 : T.pointLabelFontSize) || 12,
      pointRadius: ((d = D.quadrantChart) == null ? void 0 : d.pointRadius) || 5,
      xAxisPosition: ((A = D.quadrantChart) == null ? void 0 : A.xAxisPosition) || "top",
      yAxisPosition: ((S = D.quadrantChart) == null ? void 0 : S.yAxisPosition) || "left",
      quadrantInternalBorderStrokeWidth: ((Y = D.quadrantChart) == null ? void 0 : Y.quadrantInternalBorderStrokeWidth) || 1,
      quadrantExternalBorderStrokeWidth: ((j = D.quadrantChart) == null ? void 0 : j.quadrantExternalBorderStrokeWidth) || 2
    };
  }
  getDefaultThemeConfig() {
    return {
      quadrant1Fill: N.quadrant1Fill,
      quadrant2Fill: N.quadrant2Fill,
      quadrant3Fill: N.quadrant3Fill,
      quadrant4Fill: N.quadrant4Fill,
      quadrant1TextFill: N.quadrant1TextFill,
      quadrant2TextFill: N.quadrant2TextFill,
      quadrant3TextFill: N.quadrant3TextFill,
      quadrant4TextFill: N.quadrant4TextFill,
      quadrantPointFill: N.quadrantPointFill,
      quadrantPointTextFill: N.quadrantPointTextFill,
      quadrantXAxisTextFill: N.quadrantXAxisTextFill,
      quadrantYAxisTextFill: N.quadrantYAxisTextFill,
      quadrantTitleFill: N.quadrantTitleFill,
      quadrantInternalBorderStrokeFill: N.quadrantInternalBorderStrokeFill,
      quadrantExternalBorderStrokeFill: N.quadrantExternalBorderStrokeFill
    };
  }
  clear() {
    this.config = this.getDefaultConfig(), this.themeConfig = this.getDefaultThemeConfig(), this.data = this.getDefaultData(), this.classes = /* @__PURE__ */ new Map(), bt.info("clear called");
  }
  setData(l) {
    this.data = {
      ...this.data,
      ...l
    };
  }
  addPoints(l) {
    this.data.points = [...l, ...this.data.points];
  }
  addClass(l, u) {
    this.classes.set(l, u);
  }
  setConfig(l) {
    bt.trace("setConfig called with: ", l), this.config = {
      ...this.config,
      ...l
    };
  }
  setThemeConfig(l) {
    bt.trace("setThemeConfig called with: ", l), this.themeConfig = {
      ...this.themeConfig,
      ...l
    };
  }
  calculateSpace(l, u, c, o) {
    let x = this.config.xAxisLabelPadding * 2 + this.config.xAxisLabelFontSize, f = {
      top: l === "top" && u ? x : 0,
      bottom: l === "bottom" && u ? x : 0
    }, _ = this.config.yAxisLabelPadding * 2 + this.config.yAxisLabelFontSize, a = {
      left: this.config.yAxisPosition === "left" && c ? _ : 0,
      right: this.config.yAxisPosition === "right" && c ? _ : 0
    }, m = this.config.titleFontSize + this.config.titlePadding * 2, p = { top: o ? m : 0 }, y = this.config.quadrantPadding + a.left, q = this.config.quadrantPadding + f.top + p.top, T = this.config.chartWidth - this.config.quadrantPadding * 2 - a.left - a.right, d = this.config.chartHeight - this.config.quadrantPadding * 2 - f.top - f.bottom - p.top;
    return {
      xAxisSpace: f,
      yAxisSpace: a,
      titleSpace: p,
      quadrantSpace: {
        quadrantLeft: y,
        quadrantTop: q,
        quadrantWidth: T,
        quadrantHalfWidth: T / 2,
        quadrantHeight: d,
        quadrantHalfHeight: d / 2
      }
    };
  }
  getAxisLabels(l, u, c, o) {
    let { quadrantSpace: x, titleSpace: f } = o, { quadrantHalfHeight: _, quadrantHeight: a, quadrantLeft: m, quadrantHalfWidth: p, quadrantTop: y, quadrantWidth: q } = x, T = !!this.data.xAxisRightText, d = !!this.data.yAxisTopText, A = [];
    return this.data.xAxisLeftText && u && A.push({
      text: this.data.xAxisLeftText,
      fill: this.themeConfig.quadrantXAxisTextFill,
      x: m + (T ? p / 2 : 0),
      y: l === "top" ? this.config.xAxisLabelPadding + f.top : this.config.xAxisLabelPadding + y + a + this.config.quadrantPadding,
      fontSize: this.config.xAxisLabelFontSize,
      verticalPos: T ? "center" : "left",
      horizontalPos: "top",
      rotation: 0
    }), this.data.xAxisRightText && u && A.push({
      text: this.data.xAxisRightText,
      fill: this.themeConfig.quadrantXAxisTextFill,
      x: m + p + (T ? p / 2 : 0),
      y: l === "top" ? this.config.xAxisLabelPadding + f.top : this.config.xAxisLabelPadding + y + a + this.config.quadrantPadding,
      fontSize: this.config.xAxisLabelFontSize,
      verticalPos: T ? "center" : "left",
      horizontalPos: "top",
      rotation: 0
    }), this.data.yAxisBottomText && c && A.push({
      text: this.data.yAxisBottomText,
      fill: this.themeConfig.quadrantYAxisTextFill,
      x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + m + q + this.config.quadrantPadding,
      y: y + a - (d ? _ / 2 : 0),
      fontSize: this.config.yAxisLabelFontSize,
      verticalPos: d ? "center" : "left",
      horizontalPos: "top",
      rotation: -90
    }), this.data.yAxisTopText && c && A.push({
      text: this.data.yAxisTopText,
      fill: this.themeConfig.quadrantYAxisTextFill,
      x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + m + q + this.config.quadrantPadding,
      y: y + _ - (d ? _ / 2 : 0),
      fontSize: this.config.yAxisLabelFontSize,
      verticalPos: d ? "center" : "left",
      horizontalPos: "top",
      rotation: -90
    }), A;
  }
  getQuadrants(l) {
    let { quadrantSpace: u } = l, { quadrantHalfHeight: c, quadrantLeft: o, quadrantHalfWidth: x, quadrantTop: f } = u, _ = [
      {
        text: {
          text: this.data.quadrant1Text,
          fill: this.themeConfig.quadrant1TextFill,
          x: 0,
          y: 0,
          fontSize: this.config.quadrantLabelFontSize,
          verticalPos: "center",
          horizontalPos: "middle",
          rotation: 0
        },
        x: o + x,
        y: f,
        width: x,
        height: c,
        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: o,
        y: f,
        width: x,
        height: c,
        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: o,
        y: f + c,
        width: x,
        height: c,
        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: o + x,
        y: f + c,
        width: x,
        height: c,
        fill: this.themeConfig.quadrant4Fill
      }
    ];
    for (let a of _) a.text.x = a.x + a.width / 2, this.data.points.length === 0 ? (a.text.y = a.y + a.height / 2, a.text.horizontalPos = "middle") : (a.text.y = a.y + this.config.quadrantTextTopPadding, a.text.horizontalPos = "top");
    return _;
  }
  getQuadrantPoints(l) {
    let { quadrantSpace: u } = l, { quadrantHeight: c, quadrantLeft: o, quadrantTop: x, quadrantWidth: f } = u, _ = ie().domain([0, 1]).range([o, f + o]), a = ie().domain([0, 1]).range([c + x, x]);
    return this.data.points.map((m) => {
      let p = this.classes.get(m.className);
      return p && (m = {
        ...p,
        ...m
      }), {
        x: _(m.x),
        y: a(m.y),
        fill: m.color ?? this.themeConfig.quadrantPointFill,
        radius: m.radius ?? this.config.pointRadius,
        text: {
          text: m.text,
          fill: this.themeConfig.quadrantPointTextFill,
          x: _(m.x),
          y: a(m.y) + this.config.pointTextPadding,
          verticalPos: "center",
          horizontalPos: "top",
          fontSize: this.config.pointLabelFontSize,
          rotation: 0
        },
        strokeColor: m.strokeColor ?? this.themeConfig.quadrantPointFill,
        strokeWidth: m.strokeWidth ?? "0px"
      };
    });
  }
  getBorders(l) {
    let u = this.config.quadrantExternalBorderStrokeWidth / 2, { quadrantSpace: c } = l, { quadrantHalfHeight: o, quadrantHeight: x, quadrantLeft: f, quadrantHalfWidth: _, quadrantTop: a, quadrantWidth: m } = c;
    return [
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: f - u,
        y1: a,
        x2: f + m + u,
        y2: a
      },
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: f + m,
        y1: a + u,
        x2: f + m,
        y2: a + x - u
      },
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: f - u,
        y1: a + x,
        x2: f + m + u,
        y2: a + x
      },
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: f,
        y1: a + u,
        x2: f,
        y2: a + x - u
      },
      {
        strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
        strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
        x1: f + _,
        y1: a + u,
        x2: f + _,
        y2: a + x - u
      },
      {
        strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
        strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
        x1: f + u,
        y1: a + o,
        x2: f + m - u,
        y2: a + o
      }
    ];
  }
  getTitle(l) {
    if (l) 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 l = this.config.showXAxis && !!(this.data.xAxisLeftText || this.data.xAxisRightText), u = this.config.showYAxis && !!(this.data.yAxisTopText || this.data.yAxisBottomText), c = this.config.showTitle && !!this.data.titleText, o = this.data.points.length > 0 ? "bottom" : this.config.xAxisPosition, x = this.calculateSpace(o, l, u, c);
    return {
      points: this.getQuadrantPoints(x),
      quadrants: this.getQuadrants(x),
      axisLabels: this.getAxisLabels(o, l, u, x),
      borderLines: this.getBorders(x),
      title: this.getTitle(c)
    };
  }
}, r(ot, "QuadrantBuilder"), ot), ht, At = (ht = class extends Error {
  constructor(l, u, c) {
    super(`value for ${l} ${u} is invalid, please use a valid ${c}`), this.name = "InvalidStyleError";
  }
}, r(ht, "InvalidStyleError"), ht);
function Et(t) {
  return !/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(t);
}
r(Et, "validateHexCode");
function ne(t) {
  return !/^\d+$/.test(t);
}
r(ne, "validateNumber");
function se(t) {
  return !/^\d+px$/.test(t);
}
r(se, "validateSizeInPixels");
var Ne = zt();
function H(t) {
  return Ee(t.trim(), Ne);
}
r(H, "textSanitizer");
var I = new Ie();
function re(t) {
  I.setData({ quadrant1Text: H(t.text) });
}
r(re, "setQuadrant1Text");
function le(t) {
  I.setData({ quadrant2Text: H(t.text) });
}
r(le, "setQuadrant2Text");
function oe(t) {
  I.setData({ quadrant3Text: H(t.text) });
}
r(oe, "setQuadrant3Text");
function he(t) {
  I.setData({ quadrant4Text: H(t.text) });
}
r(he, "setQuadrant4Text");
function ce(t) {
  I.setData({ xAxisLeftText: H(t.text) });
}
r(ce, "setXAxisLeftText");
function de(t) {
  I.setData({ xAxisRightText: H(t.text) });
}
r(de, "setXAxisRightText");
function ue(t) {
  I.setData({ yAxisTopText: H(t.text) });
}
r(ue, "setYAxisTopText");
function xe(t) {
  I.setData({ yAxisBottomText: H(t.text) });
}
r(xe, "setYAxisBottomText");
function _t(t) {
  let l = {};
  for (let u of t) {
    let [c, o] = u.trim().split(/\s*:\s*/);
    if (c === "radius") {
      if (ne(o)) throw new At(c, o, "number");
      l.radius = parseInt(o);
    } else if (c === "color") {
      if (Et(o)) throw new At(c, o, "hex code");
      l.color = o;
    } else if (c === "stroke-color") {
      if (Et(o)) throw new At(c, o, "hex code");
      l.strokeColor = o;
    } else if (c === "stroke-width") {
      if (se(o)) throw new At(c, o, "number of pixels (eg. 10px)");
      l.strokeWidth = o;
    } else throw Error(`style named ${c} is not supported.`);
  }
  return l;
}
r(_t, "parseStyles");
function fe(t, l, u, c, o) {
  let x = _t(o);
  I.addPoints([{
    x: u,
    y: c,
    text: H(t.text),
    className: l,
    ...x
  }]);
}
r(fe, "addPoint");
function ge(t, l) {
  I.addClass(t, _t(l));
}
r(ge, "addClass");
function pe(t) {
  I.setConfig({ chartWidth: t });
}
r(pe, "setWidth");
function ye(t) {
  I.setConfig({ chartHeight: t });
}
r(ye, "setHeight");
function me() {
  let { themeVariables: t, quadrantChart: l } = zt();
  return l && I.setConfig(l), I.setThemeConfig({
    quadrant1Fill: t.quadrant1Fill,
    quadrant2Fill: t.quadrant2Fill,
    quadrant3Fill: t.quadrant3Fill,
    quadrant4Fill: t.quadrant4Fill,
    quadrant1TextFill: t.quadrant1TextFill,
    quadrant2TextFill: t.quadrant2TextFill,
    quadrant3TextFill: t.quadrant3TextFill,
    quadrant4TextFill: t.quadrant4TextFill,
    quadrantPointFill: t.quadrantPointFill,
    quadrantPointTextFill: t.quadrantPointTextFill,
    quadrantXAxisTextFill: t.quadrantXAxisTextFill,
    quadrantYAxisTextFill: t.quadrantYAxisTextFill,
    quadrantExternalBorderStrokeFill: t.quadrantExternalBorderStrokeFill,
    quadrantInternalBorderStrokeFill: t.quadrantInternalBorderStrokeFill,
    quadrantTitleFill: t.quadrantTitleFill
  }), I.setData({ titleText: ae() }), I.build();
}
r(me, "getQuadrantData");
var $e = {
  parser: De,
  db: {
    setWidth: pe,
    setHeight: ye,
    setQuadrant1Text: re,
    setQuadrant2Text: le,
    setQuadrant3Text: oe,
    setQuadrant4Text: he,
    setXAxisLeftText: ce,
    setXAxisRightText: de,
    setYAxisTopText: ue,
    setYAxisBottomText: xe,
    parseStyles: _t,
    addPoint: fe,
    addClass: ge,
    getQuadrantData: me,
    clear: /* @__PURE__ */ r(function() {
      I.clear(), ve();
    }, "clear"),
    setAccTitle: Ce,
    getAccTitle: Pe,
    setDiagramTitle: Fe,
    getDiagramTitle: ae,
    getAccDescription: ke,
    setAccDescription: Se
  },
  renderer: { draw: /* @__PURE__ */ r((t, l, u, c) => {
    var ut, xt, ft;
    function o(i) {
      return i === "top" ? "hanging" : "middle";
    }
    r(o, "getDominantBaseLine");
    function x(i) {
      return i === "left" ? "start" : "middle";
    }
    r(x, "getTextAnchor");
    function f(i) {
      return `translate(${i.x}, ${i.y}) rotate(${i.rotation || 0})`;
    }
    r(f, "getTransformation");
    let _ = zt();
    bt.debug(`Rendering quadrant chart
` + t);
    let a = _.securityLevel, m;
    a === "sandbox" && (m = ee("#i" + l));
    let p = ee(a === "sandbox" ? m.nodes()[0].contentDocument.body : "body").select(`[id="${l}"]`), y = p.append("g").attr("class", "main"), q = ((ut = _.quadrantChart) == null ? void 0 : ut.chartWidth) ?? 500, T = ((xt = _.quadrantChart) == null ? void 0 : xt.chartHeight) ?? 500;
    Le(p, T, q, ((ft = _.quadrantChart) == null ? void 0 : ft.useMaxWidth) ?? !0), p.attr("viewBox", "0 0 " + q + " " + T), c.db.setHeight(T), c.db.setWidth(q);
    let d = c.db.getQuadrantData(), A = y.append("g").attr("class", "quadrants"), S = y.append("g").attr("class", "border"), Y = y.append("g").attr("class", "data-points"), j = y.append("g").attr("class", "labels"), pt = y.append("g").attr("class", "title");
    d.title && pt.append("text").attr("x", 0).attr("y", 0).attr("fill", d.title.fill).attr("font-size", d.title.fontSize).attr("dominant-baseline", o(d.title.horizontalPos)).attr("text-anchor", x(d.title.verticalPos)).attr("transform", f(d.title)).text(d.title.text), d.borderLines && S.selectAll("line").data(d.borderLines).enter().append("line").attr("x1", (i) => i.x1).attr("y1", (i) => i.y1).attr("x2", (i) => i.x2).attr("y2", (i) => i.y2).style("stroke", (i) => i.strokeFill).style("stroke-width", (i) => i.strokeWidth);
    let ct = A.selectAll("g.quadrant").data(d.quadrants).enter().append("g").attr("class", "quadrant");
    ct.append("rect").attr("x", (i) => i.x).attr("y", (i) => i.y).attr("width", (i) => i.width).attr("height", (i) => i.height).attr("fill", (i) => i.fill), ct.append("text").attr("x", 0).attr("y", 0).attr("fill", (i) => i.text.fill).attr("font-size", (i) => i.text.fontSize).attr("dominant-baseline", (i) => o(i.text.horizontalPos)).attr("text-anchor", (i) => x(i.text.verticalPos)).attr("transform", (i) => f(i.text)).text((i) => i.text.text), j.selectAll("g.label").data(d.axisLabels).enter().append("g").attr("class", "label").append("text").attr("x", 0).attr("y", 0).text((i) => i.text).attr("fill", (i) => i.fill).attr("font-size", (i) => i.fontSize).attr("dominant-baseline", (i) => o(i.horizontalPos)).attr("text-anchor", (i) => x(i.verticalPos)).attr("transform", (i) => f(i));
    let dt = Y.selectAll("g.data-point").data(d.points).enter().append("g").attr("class", "data-point");
    dt.append("circle").attr("cx", (i) => i.x).attr("cy", (i) => i.y).attr("r", (i) => i.radius).attr("fill", (i) => i.fill).attr("stroke", (i) => i.strokeColor).attr("stroke-width", (i) => i.strokeWidth), dt.append("text").attr("x", 0).attr("y", 0).text((i) => i.text.text).attr("fill", (i) => i.text.fill).attr("font-size", (i) => i.text.fontSize).attr("dominant-baseline", (i) => o(i.text.horizontalPos)).attr("text-anchor", (i) => x(i.text.verticalPos)).attr("transform", (i) => f(i.text));
  }, "draw") },
  styles: /* @__PURE__ */ r(() => "", "styles")
};
export {
  $e as diagram
};
