import { St as Rt, X as Dt, q as Lt } from "./vendor/recharts.js";
import { r as Et } from "./chunk-5PVQY5BW.js";
import { n as a, r as It } from "./chunk-AGHRB4JF.js";
import { B as si, C as Vt, E as ai, L as ni, V as oi, W as ri, _ as hi, a as li, c as ci, d as ui, v as gi, y as xt } from "./chunk-ICPOFSXX.js";
import { t as xi } from "./chunk-426QAEUC.js";
import { t as di } from "./chunk-U2HBQHQK.js";
var lt = (function() {
  var t = /* @__PURE__ */ a(function(n, l, d, c) {
    for (d = d || {}, c = n.length; c--; d[n[c]] = l) ;
    return d;
  }, "o"), i = [
    1,
    10,
    12,
    14,
    16,
    18,
    19,
    21,
    23
  ], e = [2, 6], s = [1, 3], h = [1, 5], p = [1, 6], u = [1, 7], w = [
    1,
    5,
    10,
    12,
    14,
    16,
    18,
    19,
    21,
    23,
    34,
    35,
    36
  ], P = [1, 25], W = [1, 26], M = [1, 28], R = [1, 29], v = [1, 30], O = [1, 31], F = [1, 32], D = [1, 33], B = [1, 34], f = [1, 35], _ = [1, 36], r = [1, 37], E = [1, 43], z = [1, 42], X = [1, 47], Y = [1, 50], A = [
    1,
    10,
    12,
    14,
    16,
    18,
    19,
    21,
    23,
    34,
    35,
    36
  ], H = [
    1,
    10,
    12,
    14,
    16,
    18,
    19,
    21,
    23,
    24,
    26,
    27,
    28,
    34,
    35,
    36
  ], m = [
    1,
    10,
    12,
    14,
    16,
    18,
    19,
    21,
    23,
    24,
    26,
    27,
    28,
    34,
    35,
    36,
    41,
    42,
    43,
    44,
    45,
    46,
    47,
    48,
    49,
    50
  ], b = [1, 64], L = {
    trace: /* @__PURE__ */ a(function() {
    }, "trace"),
    yy: {},
    symbols_: {
      error: 2,
      start: 3,
      eol: 4,
      XYCHART: 5,
      chartConfig: 6,
      document: 7,
      CHART_ORIENTATION: 8,
      statement: 9,
      title: 10,
      text: 11,
      X_AXIS: 12,
      parseXAxis: 13,
      Y_AXIS: 14,
      parseYAxis: 15,
      LINE: 16,
      plotData: 17,
      BAR: 18,
      acc_title: 19,
      acc_title_value: 20,
      acc_descr: 21,
      acc_descr_value: 22,
      acc_descr_multiline_value: 23,
      SQUARE_BRACES_START: 24,
      commaSeparatedNumbers: 25,
      SQUARE_BRACES_END: 26,
      NUMBER_WITH_DECIMAL: 27,
      COMMA: 28,
      xAxisData: 29,
      bandData: 30,
      ARROW_DELIMITER: 31,
      commaSeparatedTexts: 32,
      yAxisData: 33,
      NEWLINE: 34,
      SEMI: 35,
      EOF: 36,
      alphaNum: 37,
      STR: 38,
      MD_STR: 39,
      alphaNumToken: 40,
      AMP: 41,
      NUM: 42,
      ALPHA: 43,
      PLUS: 44,
      EQUALS: 45,
      MULT: 46,
      DOT: 47,
      BRKT: 48,
      MINUS: 49,
      UNDERSCORE: 50,
      $accept: 0,
      $end: 1
    },
    terminals_: {
      2: "error",
      5: "XYCHART",
      8: "CHART_ORIENTATION",
      10: "title",
      12: "X_AXIS",
      14: "Y_AXIS",
      16: "LINE",
      18: "BAR",
      19: "acc_title",
      20: "acc_title_value",
      21: "acc_descr",
      22: "acc_descr_value",
      23: "acc_descr_multiline_value",
      24: "SQUARE_BRACES_START",
      26: "SQUARE_BRACES_END",
      27: "NUMBER_WITH_DECIMAL",
      28: "COMMA",
      31: "ARROW_DELIMITER",
      34: "NEWLINE",
      35: "SEMI",
      36: "EOF",
      38: "STR",
      39: "MD_STR",
      41: "AMP",
      42: "NUM",
      43: "ALPHA",
      44: "PLUS",
      45: "EQUALS",
      46: "MULT",
      47: "DOT",
      48: "BRKT",
      49: "MINUS",
      50: "UNDERSCORE"
    },
    productions_: [
      0,
      [3, 2],
      [3, 3],
      [3, 2],
      [3, 1],
      [6, 1],
      [7, 0],
      [7, 2],
      [9, 2],
      [9, 2],
      [9, 2],
      [9, 2],
      [9, 2],
      [9, 3],
      [9, 2],
      [9, 3],
      [9, 2],
      [9, 2],
      [9, 1],
      [17, 3],
      [25, 3],
      [25, 1],
      [13, 1],
      [13, 2],
      [13, 1],
      [29, 1],
      [29, 3],
      [30, 3],
      [32, 3],
      [32, 1],
      [15, 1],
      [15, 2],
      [15, 1],
      [33, 3],
      [4, 1],
      [4, 1],
      [4, 1],
      [11, 1],
      [11, 1],
      [11, 1],
      [37, 1],
      [37, 2],
      [40, 1],
      [40, 1],
      [40, 1],
      [40, 1],
      [40, 1],
      [40, 1],
      [40, 1],
      [40, 1],
      [40, 1],
      [40, 1]
    ],
    performAction: /* @__PURE__ */ a(function(l, d, c, g, S, o, j) {
      var x = o.length - 1;
      switch (S) {
        case 5:
          g.setOrientation(o[x]);
          break;
        case 9:
          g.setDiagramTitle(o[x].text.trim());
          break;
        case 12:
          g.setLineData({
            text: "",
            type: "text"
          }, o[x]);
          break;
        case 13:
          g.setLineData(o[x - 1], o[x]);
          break;
        case 14:
          g.setBarData({
            text: "",
            type: "text"
          }, o[x]);
          break;
        case 15:
          g.setBarData(o[x - 1], o[x]);
          break;
        case 16:
          this.$ = o[x].trim(), g.setAccTitle(this.$);
          break;
        case 17:
        case 18:
          this.$ = o[x].trim(), g.setAccDescription(this.$);
          break;
        case 19:
          this.$ = o[x - 1];
          break;
        case 20:
          this.$ = [Number(o[x - 2]), ...o[x]];
          break;
        case 21:
          this.$ = [Number(o[x])];
          break;
        case 22:
          g.setXAxisTitle(o[x]);
          break;
        case 23:
          g.setXAxisTitle(o[x - 1]);
          break;
        case 24:
          g.setXAxisTitle({
            type: "text",
            text: ""
          });
          break;
        case 25:
          g.setXAxisBand(o[x]);
          break;
        case 26:
          g.setXAxisRangeData(Number(o[x - 2]), Number(o[x]));
          break;
        case 27:
          this.$ = o[x - 1];
          break;
        case 28:
          this.$ = [o[x - 2], ...o[x]];
          break;
        case 29:
          this.$ = [o[x]];
          break;
        case 30:
          g.setYAxisTitle(o[x]);
          break;
        case 31:
          g.setYAxisTitle(o[x - 1]);
          break;
        case 32:
          g.setYAxisTitle({
            type: "text",
            text: ""
          });
          break;
        case 33:
          g.setYAxisRangeData(Number(o[x - 2]), Number(o[x]));
          break;
        case 37:
          this.$ = {
            text: o[x],
            type: "text"
          };
          break;
        case 38:
          this.$ = {
            text: o[x],
            type: "text"
          };
          break;
        case 39:
          this.$ = {
            text: o[x],
            type: "markdown"
          };
          break;
        case 40:
          this.$ = o[x];
          break;
        case 41:
          this.$ = o[x - 1] + "" + o[x];
          break;
      }
    }, "anonymous"),
    table: [
      t(i, e, {
        3: 1,
        4: 2,
        7: 4,
        5: s,
        34: h,
        35: p,
        36: u
      }),
      { 1: [3] },
      t(i, e, {
        4: 2,
        7: 4,
        3: 8,
        5: s,
        34: h,
        35: p,
        36: u
      }),
      t(i, e, {
        4: 2,
        7: 4,
        6: 9,
        3: 10,
        5: s,
        8: [1, 11],
        34: h,
        35: p,
        36: u
      }),
      {
        1: [2, 4],
        9: 12,
        10: [1, 13],
        12: [1, 14],
        14: [1, 15],
        16: [1, 16],
        18: [1, 17],
        19: [1, 18],
        21: [1, 19],
        23: [1, 20]
      },
      t(w, [2, 34]),
      t(w, [2, 35]),
      t(w, [2, 36]),
      { 1: [2, 1] },
      t(i, e, {
        4: 2,
        7: 4,
        3: 21,
        5: s,
        34: h,
        35: p,
        36: u
      }),
      { 1: [2, 3] },
      t(w, [2, 5]),
      t(i, [2, 7], {
        4: 22,
        34: h,
        35: p,
        36: u
      }),
      {
        11: 23,
        37: 24,
        38: P,
        39: W,
        40: 27,
        41: M,
        42: R,
        43: v,
        44: O,
        45: F,
        46: D,
        47: B,
        48: f,
        49: _,
        50: r
      },
      {
        11: 39,
        13: 38,
        24: E,
        27: z,
        29: 40,
        30: 41,
        37: 24,
        38: P,
        39: W,
        40: 27,
        41: M,
        42: R,
        43: v,
        44: O,
        45: F,
        46: D,
        47: B,
        48: f,
        49: _,
        50: r
      },
      {
        11: 45,
        15: 44,
        27: X,
        33: 46,
        37: 24,
        38: P,
        39: W,
        40: 27,
        41: M,
        42: R,
        43: v,
        44: O,
        45: F,
        46: D,
        47: B,
        48: f,
        49: _,
        50: r
      },
      {
        11: 49,
        17: 48,
        24: Y,
        37: 24,
        38: P,
        39: W,
        40: 27,
        41: M,
        42: R,
        43: v,
        44: O,
        45: F,
        46: D,
        47: B,
        48: f,
        49: _,
        50: r
      },
      {
        11: 52,
        17: 51,
        24: Y,
        37: 24,
        38: P,
        39: W,
        40: 27,
        41: M,
        42: R,
        43: v,
        44: O,
        45: F,
        46: D,
        47: B,
        48: f,
        49: _,
        50: r
      },
      { 20: [1, 53] },
      { 22: [1, 54] },
      t(A, [2, 18]),
      { 1: [2, 2] },
      t(A, [2, 8]),
      t(A, [2, 9]),
      t(H, [2, 37], {
        40: 55,
        41: M,
        42: R,
        43: v,
        44: O,
        45: F,
        46: D,
        47: B,
        48: f,
        49: _,
        50: r
      }),
      t(H, [2, 38]),
      t(H, [2, 39]),
      t(m, [2, 40]),
      t(m, [2, 42]),
      t(m, [2, 43]),
      t(m, [2, 44]),
      t(m, [2, 45]),
      t(m, [2, 46]),
      t(m, [2, 47]),
      t(m, [2, 48]),
      t(m, [2, 49]),
      t(m, [2, 50]),
      t(m, [2, 51]),
      t(A, [2, 10]),
      t(A, [2, 22], {
        30: 41,
        29: 56,
        24: E,
        27: z
      }),
      t(A, [2, 24]),
      t(A, [2, 25]),
      { 31: [1, 57] },
      {
        11: 59,
        32: 58,
        37: 24,
        38: P,
        39: W,
        40: 27,
        41: M,
        42: R,
        43: v,
        44: O,
        45: F,
        46: D,
        47: B,
        48: f,
        49: _,
        50: r
      },
      t(A, [2, 11]),
      t(A, [2, 30], {
        33: 60,
        27: X
      }),
      t(A, [2, 32]),
      { 31: [1, 61] },
      t(A, [2, 12]),
      {
        17: 62,
        24: Y
      },
      {
        25: 63,
        27: b
      },
      t(A, [2, 14]),
      {
        17: 65,
        24: Y
      },
      t(A, [2, 16]),
      t(A, [2, 17]),
      t(m, [2, 41]),
      t(A, [2, 23]),
      { 27: [1, 66] },
      { 26: [1, 67] },
      {
        26: [2, 29],
        28: [1, 68]
      },
      t(A, [2, 31]),
      { 27: [1, 69] },
      t(A, [2, 13]),
      { 26: [1, 70] },
      {
        26: [2, 21],
        28: [1, 71]
      },
      t(A, [2, 15]),
      t(A, [2, 26]),
      t(A, [2, 27]),
      {
        11: 59,
        32: 72,
        37: 24,
        38: P,
        39: W,
        40: 27,
        41: M,
        42: R,
        43: v,
        44: O,
        45: F,
        46: D,
        47: B,
        48: f,
        49: _,
        50: r
      },
      t(A, [2, 33]),
      t(A, [2, 19]),
      {
        25: 73,
        27: b
      },
      { 26: [2, 28] },
      { 26: [2, 20] }
    ],
    defaultActions: {
      8: [2, 1],
      10: [2, 3],
      21: [2, 2],
      72: [2, 28],
      73: [2, 20]
    },
    parseError: /* @__PURE__ */ a(function(l, d) {
      if (d.recoverable) this.trace(l);
      else {
        var c = new Error(l);
        throw c.hash = d, c;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ a(function(l) {
      var d = this, c = [0], g = [], S = [null], o = [], j = this.table, x = "", J = 0, Ct = 0, St = 0, Jt = 2, _t = 1, ti = o.slice.call(arguments, 1), k = Object.create(this.lexer), U = { yy: {} };
      for (var at in this.yy) Object.prototype.hasOwnProperty.call(this.yy, at) && (U.yy[at] = this.yy[at]);
      k.setInput(l, U.yy), U.yy.lexer = k, U.yy.parser = this, typeof k.yylloc > "u" && (k.yylloc = {});
      var nt = k.yylloc;
      o.push(nt);
      var ii = k.options && k.options.ranges;
      typeof U.yy.parseError == "function" ? this.parseError = U.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function ei(V) {
        c.length = c.length - 2 * V, S.length = S.length - V, o.length = o.length - V;
      }
      a(ei, "popStack");
      function kt() {
        var V = g.pop() || k.lex() || _t;
        return typeof V != "number" && (V instanceof Array && (g = V, V = g.pop()), V = d.symbols_[V] || V), V;
      }
      a(kt, "lex");
      for (var T, ot, $, I, rt, q = {}, tt, N, Tt, it; ; ) {
        if ($ = c[c.length - 1], this.defaultActions[$] ? I = this.defaultActions[$] : ((T === null || typeof T > "u") && (T = kt()), I = j[$] && j[$][T]), typeof I > "u" || !I.length || !I[0]) {
          var ht = "";
          it = [];
          for (tt in j[$]) this.terminals_[tt] && tt > Jt && it.push("'" + this.terminals_[tt] + "'");
          k.showPosition ? ht = "Parse error on line " + (J + 1) + `:
` + k.showPosition() + `
Expecting ` + it.join(", ") + ", got '" + (this.terminals_[T] || T) + "'" : ht = "Parse error on line " + (J + 1) + ": Unexpected " + (T == _t ? "end of input" : "'" + (this.terminals_[T] || T) + "'"), this.parseError(ht, {
            text: k.match,
            token: this.terminals_[T] || T,
            line: k.yylineno,
            loc: nt,
            expected: it
          });
        }
        if (I[0] instanceof Array && I.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + $ + ", token: " + T);
        switch (I[0]) {
          case 1:
            c.push(T), S.push(k.yytext), o.push(k.yylloc), c.push(I[1]), T = null, ot ? (T = ot, ot = null) : (Ct = k.yyleng, x = k.yytext, J = k.yylineno, nt = k.yylloc, St > 0 && St--);
            break;
          case 2:
            if (N = this.productions_[I[1]][1], q.$ = S[S.length - N], q._$ = {
              first_line: o[o.length - (N || 1)].first_line,
              last_line: o[o.length - 1].last_line,
              first_column: o[o.length - (N || 1)].first_column,
              last_column: o[o.length - 1].last_column
            }, ii && (q._$.range = [o[o.length - (N || 1)].range[0], o[o.length - 1].range[1]]), rt = this.performAction.apply(q, [
              x,
              Ct,
              J,
              U.yy,
              I[1],
              S,
              o
            ].concat(ti)), typeof rt < "u") return rt;
            N && (c = c.slice(0, -1 * N * 2), S = S.slice(0, -1 * N), o = o.slice(0, -1 * N)), c.push(this.productions_[I[1]][0]), S.push(q.$), o.push(q._$), Tt = j[c[c.length - 2]][c[c.length - 1]], c.push(Tt);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  };
  L.lexer = /* @__PURE__ */ (function() {
    return {
      EOF: 1,
      parseError: /* @__PURE__ */ a(function(l, d) {
        if (this.yy.parser) this.yy.parser.parseError(l, d);
        else throw new Error(l);
      }, "parseError"),
      setInput: /* @__PURE__ */ a(function(n, l) {
        return this.yy = l || 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__ */ a(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__ */ a(function(n) {
        var l = n.length, d = n.split(/(?:\r\n?|\n)/g);
        this._input = n + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - l), this.offset -= l;
        var c = 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), d.length - 1 && (this.yylineno -= d.length - 1);
        var g = 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: d ? (d.length === c.length ? this.yylloc.first_column : 0) + c[c.length - d.length].length - d[0].length : this.yylloc.first_column - l
        }, this.options.ranges && (this.yylloc.range = [g[0], g[0] + this.yyleng - l]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      more: /* @__PURE__ */ a(function() {
        return this._more = !0, this;
      }, "more"),
      reject: /* @__PURE__ */ a(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__ */ a(function(n) {
        this.unput(this.match.slice(n));
      }, "less"),
      pastInput: /* @__PURE__ */ a(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__ */ a(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__ */ a(function() {
        var n = this.pastInput(), l = new Array(n.length + 1).join("-");
        return n + this.upcomingInput() + `
` + l + "^";
      }, "showPosition"),
      test_match: /* @__PURE__ */ a(function(n, l) {
        var d, c, g;
        if (this.options.backtrack_lexer && (g = {
          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 && (g.yylloc.range = this.yylloc.range.slice(0))), c = n[0].match(/(?:\r\n?|\n).*/g), c && (this.yylineno += c.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: c ? c[c.length - 1].length - c[c.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], d = this.performAction.call(this, this.yy, this, l, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), d) return d;
        if (this._backtrack) {
          for (var S in g) this[S] = g[S];
          return !1;
        }
        return !1;
      }, "test_match"),
      next: /* @__PURE__ */ a(function() {
        if (this.done) return this.EOF;
        this._input || (this.done = !0);
        var n, l, d, c;
        this._more || (this.yytext = "", this.match = "");
        for (var g = this._currentRules(), S = 0; S < g.length; S++)
          if (d = this._input.match(this.rules[g[S]]), d && (!l || d[0].length > l[0].length)) {
            if (l = d, c = S, this.options.backtrack_lexer) {
              if (n = this.test_match(d, g[S]), n !== !1) return n;
              if (this._backtrack) {
                l = !1;
                continue;
              } else return !1;
            } else if (!this.options.flex) break;
          }
        return l ? (n = this.test_match(l, g[c]), n !== !1 ? n : !1) : 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__ */ a(function() {
        var l = this.next();
        return l || this.lex();
      }, "lex"),
      begin: /* @__PURE__ */ a(function(l) {
        this.conditionStack.push(l);
      }, "begin"),
      popState: /* @__PURE__ */ a(function() {
        return this.conditionStack.length - 1 > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      _currentRules: /* @__PURE__ */ a(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__ */ a(function(l) {
        return l = this.conditionStack.length - 1 - Math.abs(l || 0), l >= 0 ? this.conditionStack[l] : "INITIAL";
      }, "topState"),
      pushState: /* @__PURE__ */ a(function(l) {
        this.begin(l);
      }, "pushState"),
      stateStackSize: /* @__PURE__ */ a(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ a(function(l, d, c, g) {
        switch (c) {
          case 0:
            break;
          case 1:
            break;
          case 2:
            return this.popState(), 34;
          case 3:
            return this.popState(), 34;
          case 4:
            return 34;
          case 5:
            break;
          case 6:
            return 10;
          case 7:
            return this.pushState("acc_title"), 19;
          case 8:
            return this.popState(), "acc_title_value";
          case 9:
            return this.pushState("acc_descr"), 21;
          case 10:
            return this.popState(), "acc_descr_value";
          case 11:
            this.pushState("acc_descr_multiline");
            break;
          case 12:
            this.popState();
            break;
          case 13:
            return "acc_descr_multiline_value";
          case 14:
            return 5;
          case 15:
            return 5;
          case 16:
            return 8;
          case 17:
            return this.pushState("axis_data"), "X_AXIS";
          case 18:
            return this.pushState("axis_data"), "Y_AXIS";
          case 19:
            return this.pushState("axis_band_data"), 24;
          case 20:
            return 31;
          case 21:
            return this.pushState("data"), 16;
          case 22:
            return this.pushState("data"), 18;
          case 23:
            return this.pushState("data_inner"), 24;
          case 24:
            return 27;
          case 25:
            return this.popState(), 26;
          case 26:
            this.popState();
            break;
          case 27:
            this.pushState("string");
            break;
          case 28:
            this.popState();
            break;
          case 29:
            return "STR";
          case 30:
            return 24;
          case 31:
            return 26;
          case 32:
            return 43;
          case 33:
            return "COLON";
          case 34:
            return 44;
          case 35:
            return 28;
          case 36:
            return 45;
          case 37:
            return 46;
          case 38:
            return 48;
          case 39:
            return 50;
          case 40:
            return 47;
          case 41:
            return 41;
          case 42:
            return 49;
          case 43:
            return 42;
          case 44:
            break;
          case 45:
            return 35;
          case 46:
            return 36;
        }
      }, "anonymous"),
      rules: [
        /^(?:%%(?!\{)[^\n]*)/i,
        /^(?:[^\}]%%[^\n]*)/i,
        /^(?:(\r?\n))/i,
        /^(?:(\r?\n))/i,
        /^(?:[\n\r]+)/i,
        /^(?:%%[^\n]*)/i,
        /^(?:title\b)/i,
        /^(?:accTitle\s*:\s*)/i,
        /^(?:(?!\n||)*[^\n]*)/i,
        /^(?:accDescr\s*:\s*)/i,
        /^(?:(?!\n||)*[^\n]*)/i,
        /^(?:accDescr\s*\{\s*)/i,
        /^(?:\})/i,
        /^(?:[^\}]*)/i,
        /^(?:xychart-beta\b)/i,
        /^(?:xychart\b)/i,
        /^(?:(?:vertical|horizontal))/i,
        /^(?:x-axis\b)/i,
        /^(?:y-axis\b)/i,
        /^(?:\[)/i,
        /^(?:-->)/i,
        /^(?:line\b)/i,
        /^(?:bar\b)/i,
        /^(?:\[)/i,
        /^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,
        /^(?:\])/i,
        /^(?:(?:`\)                                    \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+                  \{ return MD_STR; \}\n<md_string>\(\?:`))/i,
        /^(?:["])/i,
        /^(?:["])/i,
        /^(?:[^"]*)/i,
        /^(?:\[)/i,
        /^(?:\])/i,
        /^(?:[A-Za-z]+)/i,
        /^(?::)/i,
        /^(?:\+)/i,
        /^(?:,)/i,
        /^(?:=)/i,
        /^(?:\*)/i,
        /^(?:#)/i,
        /^(?:[\_])/i,
        /^(?:\.)/i,
        /^(?:&)/i,
        /^(?:-)/i,
        /^(?:[0-9]+)/i,
        /^(?:\s+)/i,
        /^(?:;)/i,
        /^(?:$)/i
      ],
      conditions: {
        data_inner: {
          rules: [
            0,
            1,
            4,
            5,
            6,
            7,
            9,
            11,
            14,
            15,
            16,
            17,
            18,
            21,
            22,
            24,
            25,
            26,
            27,
            30,
            31,
            32,
            33,
            34,
            35,
            36,
            37,
            38,
            39,
            40,
            41,
            42,
            43,
            44,
            45,
            46
          ],
          inclusive: !0
        },
        data: {
          rules: [
            0,
            1,
            3,
            4,
            5,
            6,
            7,
            9,
            11,
            14,
            15,
            16,
            17,
            18,
            21,
            22,
            23,
            26,
            27,
            30,
            31,
            32,
            33,
            34,
            35,
            36,
            37,
            38,
            39,
            40,
            41,
            42,
            43,
            44,
            45,
            46
          ],
          inclusive: !0
        },
        axis_band_data: {
          rules: [
            0,
            1,
            4,
            5,
            6,
            7,
            9,
            11,
            14,
            15,
            16,
            17,
            18,
            21,
            22,
            25,
            26,
            27,
            30,
            31,
            32,
            33,
            34,
            35,
            36,
            37,
            38,
            39,
            40,
            41,
            42,
            43,
            44,
            45,
            46
          ],
          inclusive: !0
        },
        axis_data: {
          rules: [
            0,
            1,
            2,
            4,
            5,
            6,
            7,
            9,
            11,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            24,
            26,
            27,
            30,
            31,
            32,
            33,
            34,
            35,
            36,
            37,
            38,
            39,
            40,
            41,
            42,
            43,
            44,
            45,
            46
          ],
          inclusive: !0
        },
        acc_descr_multiline: {
          rules: [12, 13],
          inclusive: !1
        },
        acc_descr: {
          rules: [10],
          inclusive: !1
        },
        acc_title: {
          rules: [8],
          inclusive: !1
        },
        title: {
          rules: [],
          inclusive: !1
        },
        md_string: {
          rules: [],
          inclusive: !1
        },
        string: {
          rules: [28, 29],
          inclusive: !1
        },
        INITIAL: {
          rules: [
            0,
            1,
            4,
            5,
            6,
            7,
            9,
            11,
            14,
            15,
            16,
            17,
            18,
            21,
            22,
            26,
            27,
            30,
            31,
            32,
            33,
            34,
            35,
            36,
            37,
            38,
            39,
            40,
            41,
            42,
            43,
            44,
            45,
            46
          ],
          inclusive: !0
        }
      }
    };
  })();
  function C() {
    this.yy = {};
  }
  return a(C, "Parser"), C.prototype = L, L.Parser = C, new C();
})();
lt.parser = lt;
var pi = lt;
function ct(t) {
  return t.type === "bar";
}
a(ct, "isBarPlot");
function dt(t) {
  return t.type === "band";
}
a(dt, "isBandAxisData");
function G(t) {
  return t.type === "linear";
}
a(G, "isLinearAxisData");
var Mt = class {
  constructor(t) {
    this.parentGroup = t;
  }
  static {
    a(this, "TextDimensionCalculatorWithFont");
  }
  getMaxDimension(t, i) {
    if (!this.parentGroup) return {
      width: t.reduce((h, p) => Math.max(p.length, h), 0) * i,
      height: i
    };
    const e = {
      width: 0,
      height: 0
    }, s = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", i);
    for (const h of t) {
      const p = di(s, 1, h), u = p ? p.width : h.length * i, w = p ? p.height : i;
      e.width = Math.max(e.width, u), e.height = Math.max(e.height, w);
    }
    return s.remove(), e;
  }
}, Pt = 0.7, vt = 0.2, Bt = class {
  constructor(t, i, e, s) {
    this.axisConfig = t, this.title = i, this.textDimensionCalculator = e, this.axisThemeConfig = s, this.boundingRect = {
      x: 0,
      y: 0,
      width: 0,
      height: 0
    }, this.axisPosition = "left", this.showTitle = !1, this.showLabel = !1, this.showTick = !1, this.showAxisLine = !1, this.outerPadding = 0, this.titleTextHeight = 0, this.labelTextHeight = 0, this.range = [0, 10], this.boundingRect = {
      x: 0,
      y: 0,
      width: 0,
      height: 0
    }, this.axisPosition = "left";
  }
  static {
    a(this, "BaseAxis");
  }
  setRange(t) {
    this.range = t, this.axisPosition === "left" || this.axisPosition === "right" ? this.boundingRect.height = t[1] - t[0] : this.boundingRect.width = t[1] - t[0], this.recalculateScale();
  }
  getRange() {
    return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
  }
  setAxisPosition(t) {
    this.axisPosition = t, this.setRange(this.range);
  }
  getTickDistance() {
    const t = this.getRange();
    return Math.abs(t[0] - t[1]) / this.getTickValues().length;
  }
  getAxisOuterPadding() {
    return this.outerPadding;
  }
  getLabelDimension() {
    return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map((t) => t.toString()), this.axisConfig.labelFontSize);
  }
  recalculateOuterPaddingToDrawBar() {
    Pt * this.getTickDistance() > this.outerPadding * 2 && (this.outerPadding = Math.floor(Pt * this.getTickDistance() / 2)), this.recalculateScale();
  }
  calculateSpaceIfDrawnHorizontally(t) {
    let i = t.height;
    if (this.axisConfig.showAxisLine && i > this.axisConfig.axisLineWidth && (i -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
      const e = this.getLabelDimension(), s = vt * t.width;
      this.outerPadding = Math.min(e.width / 2, s);
      const h = e.height + this.axisConfig.labelPadding * 2;
      this.labelTextHeight = e.height, h <= i && (i -= h, this.showLabel = !0);
    }
    if (this.axisConfig.showTick && i >= this.axisConfig.tickLength && (this.showTick = !0, i -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
      const e = this.textDimensionCalculator.getMaxDimension([this.title], this.axisConfig.titleFontSize), s = e.height + this.axisConfig.titlePadding * 2;
      this.titleTextHeight = e.height, s <= i && (i -= s, this.showTitle = !0);
    }
    this.boundingRect.width = t.width, this.boundingRect.height = t.height - i;
  }
  calculateSpaceIfDrawnVertical(t) {
    let i = t.width;
    if (this.axisConfig.showAxisLine && i > this.axisConfig.axisLineWidth && (i -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
      const e = this.getLabelDimension(), s = vt * t.height;
      this.outerPadding = Math.min(e.height / 2, s);
      const h = e.width + this.axisConfig.labelPadding * 2;
      h <= i && (i -= h, this.showLabel = !0);
    }
    if (this.axisConfig.showTick && i >= this.axisConfig.tickLength && (this.showTick = !0, i -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
      const e = this.textDimensionCalculator.getMaxDimension([this.title], this.axisConfig.titleFontSize), s = e.height + this.axisConfig.titlePadding * 2;
      this.titleTextHeight = e.height, s <= i && (i -= s, this.showTitle = !0);
    }
    this.boundingRect.width = t.width - i, this.boundingRect.height = t.height;
  }
  calculateSpace(t) {
    return this.axisPosition === "left" || this.axisPosition === "right" ? this.calculateSpaceIfDrawnVertical(t) : this.calculateSpaceIfDrawnHorizontally(t), this.recalculateScale(), {
      width: this.boundingRect.width,
      height: this.boundingRect.height
    };
  }
  setBoundingBoxXY(t) {
    this.boundingRect.x = t.x, this.boundingRect.y = t.y;
  }
  getDrawableElementsForLeftAxis() {
    const t = [];
    if (this.showAxisLine) {
      const i = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
      t.push({
        type: "path",
        groupTexts: ["left-axis", "axisl-line"],
        data: [{
          path: `M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y + this.boundingRect.height} `,
          strokeFill: this.axisThemeConfig.axisLineColor,
          strokeWidth: this.axisConfig.axisLineWidth
        }]
      });
    }
    if (this.showLabel && t.push({
      type: "text",
      groupTexts: ["left-axis", "label"],
      data: this.getTickValues().map((i) => ({
        text: i.toString(),
        x: this.boundingRect.x + this.boundingRect.width - (this.showLabel ? this.axisConfig.labelPadding : 0) - (this.showTick ? this.axisConfig.tickLength : 0) - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
        y: this.getScaleValue(i),
        fill: this.axisThemeConfig.labelColor,
        fontSize: this.axisConfig.labelFontSize,
        rotation: 0,
        verticalPos: "middle",
        horizontalPos: "right"
      }))
    }), this.showTick) {
      const i = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
      t.push({
        type: "path",
        groupTexts: ["left-axis", "ticks"],
        data: this.getTickValues().map((e) => ({
          path: `M ${i},${this.getScaleValue(e)} L ${i - this.axisConfig.tickLength},${this.getScaleValue(e)}`,
          strokeFill: this.axisThemeConfig.tickColor,
          strokeWidth: this.axisConfig.tickWidth
        }))
      });
    }
    return this.showTitle && t.push({
      type: "text",
      groupTexts: ["left-axis", "title"],
      data: [{
        text: this.title,
        x: this.boundingRect.x + this.axisConfig.titlePadding,
        y: this.boundingRect.y + this.boundingRect.height / 2,
        fill: this.axisThemeConfig.titleColor,
        fontSize: this.axisConfig.titleFontSize,
        rotation: 270,
        verticalPos: "top",
        horizontalPos: "center"
      }]
    }), t;
  }
  getDrawableElementsForBottomAxis() {
    const t = [];
    if (this.showAxisLine) {
      const i = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
      t.push({
        type: "path",
        groupTexts: ["bottom-axis", "axis-line"],
        data: [{
          path: `M ${this.boundingRect.x},${i} L ${this.boundingRect.x + this.boundingRect.width},${i}`,
          strokeFill: this.axisThemeConfig.axisLineColor,
          strokeWidth: this.axisConfig.axisLineWidth
        }]
      });
    }
    if (this.showLabel && t.push({
      type: "text",
      groupTexts: ["bottom-axis", "label"],
      data: this.getTickValues().map((i) => ({
        text: i.toString(),
        x: this.getScaleValue(i),
        y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
        fill: this.axisThemeConfig.labelColor,
        fontSize: this.axisConfig.labelFontSize,
        rotation: 0,
        verticalPos: "top",
        horizontalPos: "center"
      }))
    }), this.showTick) {
      const i = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
      t.push({
        type: "path",
        groupTexts: ["bottom-axis", "ticks"],
        data: this.getTickValues().map((e) => ({
          path: `M ${this.getScaleValue(e)},${i} L ${this.getScaleValue(e)},${i + this.axisConfig.tickLength}`,
          strokeFill: this.axisThemeConfig.tickColor,
          strokeWidth: this.axisConfig.tickWidth
        }))
      });
    }
    return this.showTitle && t.push({
      type: "text",
      groupTexts: ["bottom-axis", "title"],
      data: [{
        text: this.title,
        x: this.range[0] + (this.range[1] - this.range[0]) / 2,
        y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
        fill: this.axisThemeConfig.titleColor,
        fontSize: this.axisConfig.titleFontSize,
        rotation: 0,
        verticalPos: "top",
        horizontalPos: "center"
      }]
    }), t;
  }
  getDrawableElementsForTopAxis() {
    const t = [];
    if (this.showAxisLine) {
      const i = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
      t.push({
        type: "path",
        groupTexts: ["top-axis", "axis-line"],
        data: [{
          path: `M ${this.boundingRect.x},${i} L ${this.boundingRect.x + this.boundingRect.width},${i}`,
          strokeFill: this.axisThemeConfig.axisLineColor,
          strokeWidth: this.axisConfig.axisLineWidth
        }]
      });
    }
    if (this.showLabel && t.push({
      type: "text",
      groupTexts: ["top-axis", "label"],
      data: this.getTickValues().map((i) => ({
        text: i.toString(),
        x: this.getScaleValue(i),
        y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
        fill: this.axisThemeConfig.labelColor,
        fontSize: this.axisConfig.labelFontSize,
        rotation: 0,
        verticalPos: "top",
        horizontalPos: "center"
      }))
    }), this.showTick) {
      const i = this.boundingRect.y;
      t.push({
        type: "path",
        groupTexts: ["top-axis", "ticks"],
        data: this.getTickValues().map((e) => ({
          path: `M ${this.getScaleValue(e)},${i + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(e)},${i + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`,
          strokeFill: this.axisThemeConfig.tickColor,
          strokeWidth: this.axisConfig.tickWidth
        }))
      });
    }
    return this.showTitle && t.push({
      type: "text",
      groupTexts: ["top-axis", "title"],
      data: [{
        text: this.title,
        x: this.boundingRect.x + this.boundingRect.width / 2,
        y: this.boundingRect.y + this.axisConfig.titlePadding,
        fill: this.axisThemeConfig.titleColor,
        fontSize: this.axisConfig.titleFontSize,
        rotation: 0,
        verticalPos: "top",
        horizontalPos: "center"
      }]
    }), t;
  }
  getDrawableElements() {
    if (this.axisPosition === "left") return this.getDrawableElementsForLeftAxis();
    if (this.axisPosition === "right") throw Error("Drawing of right axis is not implemented");
    return this.axisPosition === "bottom" ? this.getDrawableElementsForBottomAxis() : this.axisPosition === "top" ? this.getDrawableElementsForTopAxis() : [];
  }
}, fi = class extends Bt {
  static {
    a(this, "BandAxis");
  }
  constructor(t, i, e, s, h) {
    super(t, s, h, i), this.categories = e, this.scale = Dt().domain(this.categories).range(this.getRange());
  }
  setRange(t) {
    super.setRange(t);
  }
  recalculateScale() {
    this.scale = Dt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5), It.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
  }
  getTickValues() {
    return this.categories;
  }
  getScaleValue(t) {
    return this.scale(t) ?? this.getRange()[0];
  }
}, mi = class extends Bt {
  static {
    a(this, "LinearAxis");
  }
  constructor(t, i, e, s, h) {
    super(t, s, h, i), this.domain = e, this.scale = Lt().domain(this.domain).range(this.getRange());
  }
  getTickValues() {
    return this.scale.ticks();
  }
  recalculateScale() {
    const t = [...this.domain];
    this.axisPosition === "left" && t.reverse(), this.scale = Lt().domain(t).range(this.getRange());
  }
  getScaleValue(t) {
    return this.scale(t);
  }
};
function ut(t, i, e, s) {
  const h = new Mt(s);
  return dt(t) ? new fi(i, e, t.categories, t.title, h) : new mi(i, e, [t.min, t.max], t.title, h);
}
a(ut, "getAxis");
var yi = class {
  constructor(t, i, e, s) {
    this.textDimensionCalculator = t, this.chartConfig = i, this.chartData = e, this.chartThemeConfig = s, this.boundingRect = {
      x: 0,
      y: 0,
      width: 0,
      height: 0
    }, this.showChartTitle = !1;
  }
  static {
    a(this, "ChartTitle");
  }
  setBoundingBoxXY(t) {
    this.boundingRect.x = t.x, this.boundingRect.y = t.y;
  }
  calculateSpace(t) {
    const i = this.textDimensionCalculator.getMaxDimension([this.chartData.title], this.chartConfig.titleFontSize), e = Math.max(i.width, t.width), s = i.height + 2 * this.chartConfig.titlePadding;
    return i.width <= e && i.height <= s && this.chartConfig.showTitle && this.chartData.title && (this.boundingRect.width = e, this.boundingRect.height = s, this.showChartTitle = !0), {
      width: this.boundingRect.width,
      height: this.boundingRect.height
    };
  }
  getDrawableElements() {
    const t = [];
    return this.showChartTitle && t.push({
      groupTexts: ["chart-title"],
      type: "text",
      data: [{
        fontSize: this.chartConfig.titleFontSize,
        text: this.chartData.title,
        verticalPos: "middle",
        horizontalPos: "center",
        x: this.boundingRect.x + this.boundingRect.width / 2,
        y: this.boundingRect.y + this.boundingRect.height / 2,
        fill: this.chartThemeConfig.titleColor,
        rotation: 0
      }]
    }), t;
  }
};
function zt(t, i, e, s) {
  return new yi(new Mt(s), t, i, e);
}
a(zt, "getChartTitleComponent");
var bi = class {
  constructor(t, i, e, s, h) {
    this.plotData = t, this.xAxis = i, this.yAxis = e, this.orientation = s, this.plotIndex = h;
  }
  static {
    a(this, "LinePlot");
  }
  getDrawableElement() {
    const t = this.plotData.data.map((e) => [this.xAxis.getScaleValue(e[0]), this.yAxis.getScaleValue(e[1])]);
    let i;
    return this.orientation === "horizontal" ? i = Rt().y((e) => e[0]).x((e) => e[1])(t) : i = Rt().x((e) => e[0]).y((e) => e[1])(t), i ? [{
      groupTexts: ["plot", `line-plot-${this.plotIndex}`],
      type: "path",
      data: [{
        path: i,
        strokeFill: this.plotData.strokeFill,
        strokeWidth: this.plotData.strokeWidth
      }]
    }] : [];
  }
}, Ai = class {
  constructor(t, i, e, s, h, p) {
    this.barData = t, this.boundingRect = i, this.xAxis = e, this.yAxis = s, this.orientation = h, this.plotIndex = p;
  }
  static {
    a(this, "BarPlot");
  }
  getDrawableElement() {
    const t = this.barData.data.map((s) => [this.xAxis.getScaleValue(s[0]), this.yAxis.getScaleValue(s[1])]), i = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * 0.95, e = i / 2;
    return this.orientation === "horizontal" ? [{
      groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
      type: "rect",
      data: t.map((s) => ({
        x: this.boundingRect.x,
        y: s[0] - e,
        height: i,
        width: s[1] - this.boundingRect.x,
        fill: this.barData.fill,
        strokeWidth: 0,
        strokeFill: this.barData.fill
      }))
    }] : [{
      groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
      type: "rect",
      data: t.map((s) => ({
        x: s[0] - e,
        y: s[1],
        width: i,
        height: this.boundingRect.y + this.boundingRect.height - s[1],
        fill: this.barData.fill,
        strokeWidth: 0,
        strokeFill: this.barData.fill
      }))
    }];
  }
}, wi = class {
  constructor(t, i, e) {
    this.chartConfig = t, this.chartData = i, this.chartThemeConfig = e, this.boundingRect = {
      x: 0,
      y: 0,
      width: 0,
      height: 0
    };
  }
  static {
    a(this, "BasePlot");
  }
  setAxes(t, i) {
    this.xAxis = t, this.yAxis = i;
  }
  setBoundingBoxXY(t) {
    this.boundingRect.x = t.x, this.boundingRect.y = t.y;
  }
  calculateSpace(t) {
    return this.boundingRect.width = t.width, this.boundingRect.height = t.height, {
      width: this.boundingRect.width,
      height: this.boundingRect.height
    };
  }
  getDrawableElements() {
    if (!(this.xAxis && this.yAxis)) throw Error("Axes must be passed to render Plots");
    const t = [];
    for (const [i, e] of this.chartData.plots.entries()) switch (e.type) {
      case "line":
        {
          const s = new bi(e, this.xAxis, this.yAxis, this.chartConfig.chartOrientation, i);
          t.push(...s.getDrawableElement());
        }
        break;
      case "bar":
        {
          const s = new Ai(e, this.boundingRect, this.xAxis, this.yAxis, this.chartConfig.chartOrientation, i);
          t.push(...s.getDrawableElement());
        }
        break;
    }
    return t;
  }
};
function Wt(t, i, e) {
  return new wi(t, i, e);
}
a(Wt, "getPlotComponent");
var Ci = class {
  constructor(t, i, e, s) {
    this.chartConfig = t, this.chartData = i, this.componentStore = {
      title: zt(t, i, e, s),
      plot: Wt(t, i, e),
      xAxis: ut(i.xAxis, t.xAxis, {
        titleColor: e.xAxisTitleColor,
        labelColor: e.xAxisLabelColor,
        tickColor: e.xAxisTickColor,
        axisLineColor: e.xAxisLineColor
      }, s),
      yAxis: ut(i.yAxis, t.yAxis, {
        titleColor: e.yAxisTitleColor,
        labelColor: e.yAxisLabelColor,
        tickColor: e.yAxisTickColor,
        axisLineColor: e.yAxisLineColor
      }, s)
    };
  }
  static {
    a(this, "Orchestrator");
  }
  calculateVerticalSpace() {
    let t = this.chartConfig.width, i = this.chartConfig.height, e = 0, s = 0, h = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), p = Math.floor(i * this.chartConfig.plotReservedSpacePercent / 100), u = this.componentStore.plot.calculateSpace({
      width: h,
      height: p
    });
    t -= u.width, i -= u.height, u = this.componentStore.title.calculateSpace({
      width: this.chartConfig.width,
      height: i
    }), s = u.height, i -= u.height, this.componentStore.xAxis.setAxisPosition("bottom"), u = this.componentStore.xAxis.calculateSpace({
      width: t,
      height: i
    }), i -= u.height, this.componentStore.yAxis.setAxisPosition("left"), u = this.componentStore.yAxis.calculateSpace({
      width: t,
      height: i
    }), e = u.width, t -= u.width, t > 0 && (h += t, t = 0), i > 0 && (p += i, i = 0), this.componentStore.plot.calculateSpace({
      width: h,
      height: p
    }), this.componentStore.plot.setBoundingBoxXY({
      x: e,
      y: s
    }), this.componentStore.xAxis.setRange([e, e + h]), this.componentStore.xAxis.setBoundingBoxXY({
      x: e,
      y: s + p
    }), this.componentStore.yAxis.setRange([s, s + p]), this.componentStore.yAxis.setBoundingBoxXY({
      x: 0,
      y: s
    }), this.chartData.plots.some((w) => ct(w)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
  }
  calculateHorizontalSpace() {
    let t = this.chartConfig.width, i = this.chartConfig.height, e = 0, s = 0, h = 0, p = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), u = Math.floor(i * this.chartConfig.plotReservedSpacePercent / 100), w = this.componentStore.plot.calculateSpace({
      width: p,
      height: u
    });
    t -= w.width, i -= w.height, w = this.componentStore.title.calculateSpace({
      width: this.chartConfig.width,
      height: i
    }), e = w.height, i -= w.height, this.componentStore.xAxis.setAxisPosition("left"), w = this.componentStore.xAxis.calculateSpace({
      width: t,
      height: i
    }), t -= w.width, s = w.width, this.componentStore.yAxis.setAxisPosition("top"), w = this.componentStore.yAxis.calculateSpace({
      width: t,
      height: i
    }), i -= w.height, h = e + w.height, t > 0 && (p += t, t = 0), i > 0 && (u += i, i = 0), this.componentStore.plot.calculateSpace({
      width: p,
      height: u
    }), this.componentStore.plot.setBoundingBoxXY({
      x: s,
      y: h
    }), this.componentStore.yAxis.setRange([s, s + p]), this.componentStore.yAxis.setBoundingBoxXY({
      x: s,
      y: e
    }), this.componentStore.xAxis.setRange([h, h + u]), this.componentStore.xAxis.setBoundingBoxXY({
      x: 0,
      y: h
    }), this.chartData.plots.some((P) => ct(P)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
  }
  calculateSpace() {
    this.chartConfig.chartOrientation === "horizontal" ? this.calculateHorizontalSpace() : this.calculateVerticalSpace();
  }
  getDrawableElement() {
    this.calculateSpace();
    const t = [];
    this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
    for (const i of Object.values(this.componentStore)) t.push(...i.getDrawableElements());
    return t;
  }
}, Si = class {
  static {
    a(this, "XYChartBuilder");
  }
  static build(t, i, e, s) {
    return new Ci(t, i, e, s).getDrawableElement();
  }
}, Q = 0, Ot, K = mt(), Z = ft(), y = yt(), gt = Z.plotColorPalette.split(",").map((t) => t.trim()), et = !1, pt = !1;
function ft() {
  const t = ai(), i = xt();
  return Et(t.xyChart, i.themeVariables.xyChart);
}
a(ft, "getChartDefaultThemeConfig");
function mt() {
  const t = xt();
  return Et(ui.xyChart, t.xyChart);
}
a(mt, "getChartDefaultConfig");
function yt() {
  return {
    yAxis: {
      type: "linear",
      title: "",
      min: 1 / 0,
      max: -1 / 0
    },
    xAxis: {
      type: "band",
      title: "",
      categories: []
    },
    title: "",
    plots: []
  };
}
a(yt, "getChartDefaultData");
function st(t) {
  const i = xt();
  return ni(t.trim(), i);
}
a(st, "textSanitizer");
function Ft(t) {
  Ot = t;
}
a(Ft, "setTmpSVGG");
function Xt(t) {
  t === "horizontal" ? K.chartOrientation = "horizontal" : K.chartOrientation = "vertical";
}
a(Xt, "setOrientation");
function Yt(t) {
  y.xAxis.title = st(t.text);
}
a(Yt, "setXAxisTitle");
function bt(t, i) {
  y.xAxis = {
    type: "linear",
    title: y.xAxis.title,
    min: t,
    max: i
  }, et = !0;
}
a(bt, "setXAxisRangeData");
function Nt(t) {
  y.xAxis = {
    type: "band",
    title: y.xAxis.title,
    categories: t.map((i) => st(i.text))
  }, et = !0;
}
a(Nt, "setXAxisBand");
function Ht(t) {
  y.yAxis.title = st(t.text);
}
a(Ht, "setYAxisTitle");
function Ut(t, i) {
  y.yAxis = {
    type: "linear",
    title: y.yAxis.title,
    min: t,
    max: i
  }, pt = !0;
}
a(Ut, "setYAxisRangeData");
function $t(t) {
  const i = Math.min(...t), e = Math.max(...t), s = G(y.yAxis) ? y.yAxis.min : 1 / 0, h = G(y.yAxis) ? y.yAxis.max : -1 / 0;
  y.yAxis = {
    type: "linear",
    title: y.yAxis.title,
    min: Math.min(s, i),
    max: Math.max(h, e)
  };
}
a($t, "setYAxisRangeFromPlotData");
function At(t) {
  let i = [];
  if (t.length === 0) return i;
  if (!et) {
    const e = G(y.xAxis) ? y.xAxis.min : 1 / 0, s = G(y.xAxis) ? y.xAxis.max : -1 / 0;
    bt(Math.min(e, 1), Math.max(s, t.length));
  }
  if (pt || $t(t), dt(y.xAxis) && (i = y.xAxis.categories.map((e, s) => [e, t[s]])), G(y.xAxis)) {
    const e = y.xAxis.min, s = y.xAxis.max, h = (s - e) / (t.length - 1), p = [];
    for (let u = e; u <= s; u += h) p.push(`${u}`);
    i = p.map((u, w) => [u, t[w]]);
  }
  return i;
}
a(At, "transformDataWithoutCategory");
function wt(t) {
  return gt[t === 0 ? 0 : t % gt.length];
}
a(wt, "getPlotColorFromPalette");
function qt(t, i) {
  const e = At(i);
  y.plots.push({
    type: "line",
    strokeFill: wt(Q),
    strokeWidth: 2,
    data: e
  }), Q++;
}
a(qt, "setLineData");
function Gt(t, i) {
  const e = At(i);
  y.plots.push({
    type: "bar",
    fill: wt(Q),
    data: e
  }), Q++;
}
a(Gt, "setBarData");
function jt() {
  if (y.plots.length === 0) throw Error("No Plot to render, please provide a plot with some data");
  return y.title = Vt(), Si.build(K, y, Z, Ot);
}
a(jt, "getDrawableElem");
function Qt() {
  return Z;
}
a(Qt, "getChartThemeConfig");
function Kt() {
  return K;
}
a(Kt, "getChartConfig");
function Zt() {
  return y;
}
a(Zt, "getXYChartData");
var Pi = {
  parser: pi,
  db: {
    getDrawableElem: jt,
    clear: /* @__PURE__ */ a(function() {
      li(), Q = 0, K = mt(), y = yt(), Z = ft(), gt = Z.plotColorPalette.split(",").map((t) => t.trim()), et = !1, pt = !1;
    }, "clear"),
    setAccTitle: oi,
    getAccTitle: gi,
    setDiagramTitle: ri,
    getDiagramTitle: Vt,
    getAccDescription: hi,
    setAccDescription: si,
    setOrientation: Xt,
    setXAxisTitle: Yt,
    setXAxisRangeData: bt,
    setXAxisBand: Nt,
    setYAxisTitle: Ht,
    setYAxisRangeData: Ut,
    setLineData: qt,
    setBarData: Gt,
    setTmpSVGG: Ft,
    getChartThemeConfig: Qt,
    getChartConfig: Kt,
    getXYChartData: Zt
  },
  renderer: { draw: /* @__PURE__ */ a((t, i, e, s) => {
    const h = s.db, p = h.getChartThemeConfig(), u = h.getChartConfig(), w = h.getXYChartData().plots[0].data.map((f) => f[1]);
    function P(f) {
      return f === "top" ? "text-before-edge" : "middle";
    }
    a(P, "getDominantBaseLine");
    function W(f) {
      return f === "left" ? "start" : f === "right" ? "end" : "middle";
    }
    a(W, "getTextAnchor");
    function M(f) {
      return `translate(${f.x}, ${f.y}) rotate(${f.rotation || 0})`;
    }
    a(M, "getTextTransformation"), It.debug(`Rendering xychart chart
` + t);
    const R = xi(i), v = R.append("g").attr("class", "main"), O = v.append("rect").attr("width", u.width).attr("height", u.height).attr("class", "background");
    ci(R, u.height, u.width, !0), R.attr("viewBox", `0 0 ${u.width} ${u.height}`), O.attr("fill", p.backgroundColor), h.setTmpSVGG(R.append("g").attr("class", "mermaid-tmp-group"));
    const F = h.getDrawableElem(), D = {};
    function B(f) {
      let _ = v, r = "";
      for (const [E] of f.entries()) {
        let z = v;
        E > 0 && D[r] && (z = D[r]), r += f[E], _ = D[r], _ || (_ = D[r] = z.append("g").attr("class", f[E]));
      }
      return _;
    }
    a(B, "getGroup");
    for (const f of F) {
      if (f.data.length === 0) continue;
      const _ = B(f.groupTexts);
      switch (f.type) {
        case "rect":
          if (_.selectAll("rect").data(f.data).enter().append("rect").attr("x", (r) => r.x).attr("y", (r) => r.y).attr("width", (r) => r.width).attr("height", (r) => r.height).attr("fill", (r) => r.fill).attr("stroke", (r) => r.strokeFill).attr("stroke-width", (r) => r.strokeWidth), u.showDataLabel) {
            const r = u.showDataLabelOutsideBar;
            if (u.chartOrientation === "horizontal") {
              let E = function(b, L) {
                const { data: C, label: n } = b;
                return L * n.length * z <= C.width - X;
              };
              a(E, "fitsHorizontally");
              const z = 0.7, X = 10, Y = f.data.map((b, L) => ({
                data: b,
                label: w[L].toString()
              })).filter((b) => b.data.width > 0 && b.data.height > 0), A = Y.map((b) => {
                const { data: L } = b;
                let C = L.height * 0.7;
                for (; !E(b, C) && C > 0; ) C -= 1;
                return C;
              }), H = Math.floor(Math.min(...A)), m = /* @__PURE__ */ a((b) => r ? b.data.x + b.data.width + X : b.data.x + b.data.width - X, "determineLabelXPosition");
              _.selectAll("text").data(Y).enter().append("text").attr("x", m).attr("y", (b) => b.data.y + b.data.height / 2).attr("text-anchor", r ? "start" : "end").attr("dominant-baseline", "middle").attr("fill", p.dataLabelColor).attr("font-size", `${H}px`).text((b) => b.label);
            } else {
              let E = function(m, b, L) {
                const { data: C, label: n } = m, l = b * n.length * 0.7, d = C.x + C.width / 2, c = d - l / 2, g = d + l / 2, S = c >= C.x && g <= C.x + C.width, o = C.y + L + b <= C.y + C.height;
                return S && o;
              };
              a(E, "fitsInBar");
              const z = 10, X = f.data.map((m, b) => ({
                data: m,
                label: w[b].toString()
              })).filter((m) => m.data.width > 0 && m.data.height > 0), Y = X.map((m) => {
                const { data: b, label: L } = m;
                let C = b.width / (L.length * 0.7);
                for (; !E(m, C, z) && C > 0; ) C -= 1;
                return C;
              }), A = Math.floor(Math.min(...Y)), H = /* @__PURE__ */ a((m) => r ? m.data.y - z : m.data.y + z, "determineLabelYPosition");
              _.selectAll("text").data(X).enter().append("text").attr("x", (m) => m.data.x + m.data.width / 2).attr("y", H).attr("text-anchor", "middle").attr("dominant-baseline", r ? "auto" : "hanging").attr("fill", p.dataLabelColor).attr("font-size", `${A}px`).text((m) => m.label);
            }
          }
          break;
        case "text":
          _.selectAll("text").data(f.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (r) => r.fill).attr("font-size", (r) => r.fontSize).attr("dominant-baseline", (r) => P(r.verticalPos)).attr("text-anchor", (r) => W(r.horizontalPos)).attr("transform", (r) => M(r)).text((r) => r.text);
          break;
        case "path":
          _.selectAll("path").data(f.data).enter().append("path").attr("d", (r) => r.path).attr("fill", (r) => r.fill ? r.fill : "none").attr("stroke", (r) => r.strokeFill).attr("stroke-width", (r) => r.strokeWidth);
          break;
      }
    }
  }, "draw") }
};
export {
  Pi as diagram
};

//# sourceMappingURL=xychartDiagram-5P7HB3ND.js.map