import { u as Z, wt as lt } from "./vendor/recharts.js";
import { f as Ct } from "./chunk-5PVQY5BW.js";
import { n as o, r as b, t as Wt } from "./chunk-AGHRB4JF.js";
import { $ as Pt, K as gt, Q as Bt, a as Vt, b as ft, o as Ft, tt as zt, y as yt } from "./chunk-ICPOFSXX.js";
import { t as Ot } from "./chunk-426QAEUC.js";
var tt = (function() {
  var e = /* @__PURE__ */ o(function(i, l, u, d) {
    for (u = u || {}, d = i.length; d--; u[i[d]] = l) ;
    return u;
  }, "o"), t = [
    6,
    11,
    13,
    14,
    15,
    17,
    19,
    20,
    23,
    24
  ], n = [1, 12], a = [1, 13], r = [1, 14], c = [1, 15], s = [1, 16], h = [1, 19], m = [1, 20], f = {
    trace: /* @__PURE__ */ o(function() {
    }, "trace"),
    yy: {},
    symbols_: {
      error: 2,
      start: 3,
      timeline_header: 4,
      document: 5,
      EOF: 6,
      timeline: 7,
      timeline_lr: 8,
      timeline_td: 9,
      line: 10,
      SPACE: 11,
      statement: 12,
      NEWLINE: 13,
      title: 14,
      acc_title: 15,
      acc_title_value: 16,
      acc_descr: 17,
      acc_descr_value: 18,
      acc_descr_multiline_value: 19,
      section: 20,
      period_statement: 21,
      event_statement: 22,
      period: 23,
      event: 24,
      $accept: 0,
      $end: 1
    },
    terminals_: {
      2: "error",
      6: "EOF",
      7: "timeline",
      8: "timeline_lr",
      9: "timeline_td",
      11: "SPACE",
      13: "NEWLINE",
      14: "title",
      15: "acc_title",
      16: "acc_title_value",
      17: "acc_descr",
      18: "acc_descr_value",
      19: "acc_descr_multiline_value",
      20: "section",
      23: "period",
      24: "event"
    },
    productions_: [
      0,
      [3, 3],
      [4, 1],
      [4, 1],
      [4, 1],
      [5, 0],
      [5, 2],
      [10, 2],
      [10, 1],
      [10, 1],
      [10, 1],
      [12, 1],
      [12, 2],
      [12, 2],
      [12, 1],
      [12, 1],
      [12, 1],
      [12, 1],
      [21, 1],
      [22, 1]
    ],
    performAction: /* @__PURE__ */ o(function(l, u, d, g, y, p, S) {
      var k = p.length - 1;
      switch (y) {
        case 1:
          return p[k - 1];
        case 3:
          g.setDirection("LR");
          break;
        case 4:
          g.setDirection("TD");
          break;
        case 5:
          this.$ = [];
          break;
        case 6:
          p[k - 1].push(p[k]), this.$ = p[k - 1];
          break;
        case 7:
        case 8:
          this.$ = p[k];
          break;
        case 9:
        case 10:
          this.$ = [];
          break;
        case 11:
          g.getCommonDb().setDiagramTitle(p[k].substr(6)), this.$ = p[k].substr(6);
          break;
        case 12:
          this.$ = p[k].trim(), g.getCommonDb().setAccTitle(this.$);
          break;
        case 13:
        case 14:
          this.$ = p[k].trim(), g.getCommonDb().setAccDescription(this.$);
          break;
        case 15:
          g.addSection(p[k].substr(8)), this.$ = p[k].substr(8);
          break;
        case 18:
          g.addTask(p[k], 0, ""), this.$ = p[k];
          break;
        case 19:
          g.addEvent(p[k].substr(2)), this.$ = p[k];
          break;
      }
    }, "anonymous"),
    table: [
      {
        3: 1,
        4: 2,
        7: [1, 3],
        8: [1, 4],
        9: [1, 5]
      },
      { 1: [3] },
      e(t, [2, 5], { 5: 6 }),
      e(t, [2, 2]),
      e(t, [2, 3]),
      e(t, [2, 4]),
      {
        6: [1, 7],
        10: 8,
        11: [1, 9],
        12: 10,
        13: [1, 11],
        14: n,
        15: a,
        17: r,
        19: c,
        20: s,
        21: 17,
        22: 18,
        23: h,
        24: m
      },
      e(t, [2, 10], { 1: [2, 1] }),
      e(t, [2, 6]),
      {
        12: 21,
        14: n,
        15: a,
        17: r,
        19: c,
        20: s,
        21: 17,
        22: 18,
        23: h,
        24: m
      },
      e(t, [2, 8]),
      e(t, [2, 9]),
      e(t, [2, 11]),
      { 16: [1, 22] },
      { 18: [1, 23] },
      e(t, [2, 14]),
      e(t, [2, 15]),
      e(t, [2, 16]),
      e(t, [2, 17]),
      e(t, [2, 18]),
      e(t, [2, 19]),
      e(t, [2, 7]),
      e(t, [2, 12]),
      e(t, [2, 13])
    ],
    defaultActions: {},
    parseError: /* @__PURE__ */ o(function(l, u) {
      if (u.recoverable) this.trace(l);
      else {
        var d = new Error(l);
        throw d.hash = u, d;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ o(function(l) {
      var u = this, d = [0], g = [], y = [null], p = [], S = this.table, k = "", P = 0, C = 0, B = 0, V = 2, I = 1, A = p.slice.call(arguments, 1), w = Object.create(this.lexer), L = { yy: {} };
      for (var F in this.yy) Object.prototype.hasOwnProperty.call(this.yy, F) && (L.yy[F] = this.yy[F]);
      w.setInput(l, L.yy), L.yy.lexer = w, L.yy.parser = this, typeof w.yylloc > "u" && (w.yylloc = {});
      var T = w.yylloc;
      p.push(T);
      var v = w.options && w.options.ranges;
      typeof L.yy.parseError == "function" ? this.parseError = L.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function E(W) {
        d.length = d.length - 2 * W, y.length = y.length - W, p.length = p.length - W;
      }
      o(E, "popStack");
      function $() {
        var W = g.pop() || w.lex() || I;
        return typeof W != "number" && (W instanceof Array && (g = W, W = g.pop()), W = u.symbols_[W] || W), W;
      }
      o($, "lex");
      for (var _, H, R, N, D, G = {}, K, z, ot, j; ; ) {
        if (R = d[d.length - 1], this.defaultActions[R] ? N = this.defaultActions[R] : ((_ === null || typeof _ > "u") && (_ = $()), N = S[R] && S[R][_]), typeof N > "u" || !N.length || !N[0]) {
          var Y = "";
          j = [];
          for (K in S[R]) this.terminals_[K] && K > V && j.push("'" + this.terminals_[K] + "'");
          w.showPosition ? Y = "Parse error on line " + (P + 1) + `:
` + w.showPosition() + `
Expecting ` + j.join(", ") + ", got '" + (this.terminals_[_] || _) + "'" : Y = "Parse error on line " + (P + 1) + ": Unexpected " + (_ == I ? "end of input" : "'" + (this.terminals_[_] || _) + "'"), this.parseError(Y, {
            text: w.match,
            token: this.terminals_[_] || _,
            line: w.yylineno,
            loc: T,
            expected: j
          });
        }
        if (N[0] instanceof Array && N.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + R + ", token: " + _);
        switch (N[0]) {
          case 1:
            d.push(_), y.push(w.yytext), p.push(w.yylloc), d.push(N[1]), _ = null, H ? (_ = H, H = null) : (C = w.yyleng, k = w.yytext, P = w.yylineno, T = w.yylloc, B > 0 && B--);
            break;
          case 2:
            if (z = this.productions_[N[1]][1], G.$ = y[y.length - z], G._$ = {
              first_line: p[p.length - (z || 1)].first_line,
              last_line: p[p.length - 1].last_line,
              first_column: p[p.length - (z || 1)].first_column,
              last_column: p[p.length - 1].last_column
            }, v && (G._$.range = [p[p.length - (z || 1)].range[0], p[p.length - 1].range[1]]), D = this.performAction.apply(G, [
              k,
              C,
              P,
              L.yy,
              N[1],
              y,
              p
            ].concat(A)), typeof D < "u") return D;
            z && (d = d.slice(0, -1 * z * 2), y = y.slice(0, -1 * z), p = p.slice(0, -1 * z)), d.push(this.productions_[N[1]][0]), y.push(G.$), p.push(G._$), ot = S[d[d.length - 2]][d[d.length - 1]], d.push(ot);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  };
  f.lexer = /* @__PURE__ */ (function() {
    return {
      EOF: 1,
      parseError: /* @__PURE__ */ o(function(l, u) {
        if (this.yy.parser) this.yy.parser.parseError(l, u);
        else throw new Error(l);
      }, "parseError"),
      setInput: /* @__PURE__ */ o(function(i, l) {
        return this.yy = l || this.yy || {}, this._input = i, 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__ */ o(function() {
        var i = this._input[0];
        return this.yytext += i, this.yyleng++, this.offset++, this.match += i, this.matched += i, i.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), i;
      }, "input"),
      unput: /* @__PURE__ */ o(function(i) {
        var l = i.length, u = i.split(/(?:\r\n?|\n)/g);
        this._input = i + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - l), this.offset -= l;
        var d = 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), u.length - 1 && (this.yylineno -= u.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: u ? (u.length === d.length ? this.yylloc.first_column : 0) + d[d.length - u.length].length - u[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__ */ o(function() {
        return this._more = !0, this;
      }, "more"),
      reject: /* @__PURE__ */ o(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__ */ o(function(i) {
        this.unput(this.match.slice(i));
      }, "less"),
      pastInput: /* @__PURE__ */ o(function() {
        var i = this.matched.substr(0, this.matched.length - this.match.length);
        return (i.length > 20 ? "..." : "") + i.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      upcomingInput: /* @__PURE__ */ o(function() {
        var i = this.match;
        return i.length < 20 && (i += this._input.substr(0, 20 - i.length)), (i.substr(0, 20) + (i.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      showPosition: /* @__PURE__ */ o(function() {
        var i = this.pastInput(), l = new Array(i.length + 1).join("-");
        return i + this.upcomingInput() + `
` + l + "^";
      }, "showPosition"),
      test_match: /* @__PURE__ */ o(function(i, l) {
        var u, d, 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))), d = i[0].match(/(?:\r\n?|\n).*/g), d && (this.yylineno += d.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: d ? d[d.length - 1].length - d[d.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + i[0].length
        }, this.yytext += i[0], this.match += i[0], this.matches = i, 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(i[0].length), this.matched += i[0], u = this.performAction.call(this, this.yy, this, l, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), u) return u;
        if (this._backtrack) {
          for (var y in g) this[y] = g[y];
          return !1;
        }
        return !1;
      }, "test_match"),
      next: /* @__PURE__ */ o(function() {
        if (this.done) return this.EOF;
        this._input || (this.done = !0);
        var i, l, u, d;
        this._more || (this.yytext = "", this.match = "");
        for (var g = this._currentRules(), y = 0; y < g.length; y++)
          if (u = this._input.match(this.rules[g[y]]), u && (!l || u[0].length > l[0].length)) {
            if (l = u, d = y, this.options.backtrack_lexer) {
              if (i = this.test_match(u, g[y]), i !== !1) return i;
              if (this._backtrack) {
                l = !1;
                continue;
              } else return !1;
            } else if (!this.options.flex) break;
          }
        return l ? (i = this.test_match(l, g[d]), i !== !1 ? i : !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__ */ o(function() {
        var l = this.next();
        return l || this.lex();
      }, "lex"),
      begin: /* @__PURE__ */ o(function(l) {
        this.conditionStack.push(l);
      }, "begin"),
      popState: /* @__PURE__ */ o(function() {
        return this.conditionStack.length - 1 > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      _currentRules: /* @__PURE__ */ o(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__ */ o(function(l) {
        return l = this.conditionStack.length - 1 - Math.abs(l || 0), l >= 0 ? this.conditionStack[l] : "INITIAL";
      }, "topState"),
      pushState: /* @__PURE__ */ o(function(l) {
        this.begin(l);
      }, "pushState"),
      stateStackSize: /* @__PURE__ */ o(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ o(function(l, u, d, g) {
        switch (d) {
          case 0:
            break;
          case 1:
            break;
          case 2:
            return 13;
          case 3:
            break;
          case 4:
            break;
          case 5:
            return 8;
          case 6:
            return 9;
          case 7:
            return 7;
          case 8:
            return 14;
          case 9:
            return this.begin("acc_title"), 15;
          case 10:
            return this.popState(), "acc_title_value";
          case 11:
            return this.begin("acc_descr"), 17;
          case 12:
            return this.popState(), "acc_descr_value";
          case 13:
            this.begin("acc_descr_multiline");
            break;
          case 14:
            this.popState();
            break;
          case 15:
            return "acc_descr_multiline_value";
          case 16:
            return 20;
          case 17:
            return 24;
          case 18:
            return 23;
          case 19:
            return 6;
          case 20:
            return "INVALID";
        }
      }, "anonymous"),
      rules: [
        /^(?:%(?!\{)[^\n]*)/i,
        /^(?:[^\}]%%[^\n]*)/i,
        /^(?:[\n]+)/i,
        /^(?:\s+)/i,
        /^(?:#[^\n]*)/i,
        /^(?:timeline[ \t]+LR\b)/i,
        /^(?:timeline[ \t]+TD\b)/i,
        /^(?:timeline\b)/i,
        /^(?:title\s[^\n]+)/i,
        /^(?:accTitle\s*:\s*)/i,
        /^(?:(?!\n||)*[^\n]*)/i,
        /^(?:accDescr\s*:\s*)/i,
        /^(?:(?!\n||)*[^\n]*)/i,
        /^(?:accDescr\s*\{\s*)/i,
        /^(?:[\}])/i,
        /^(?:[^\}]*)/i,
        /^(?:section\s[^:\n]+)/i,
        /^(?::\s(?:[^:\n]|:(?!\s))+)/i,
        /^(?:[^#:\n]+)/i,
        /^(?:$)/i,
        /^(?:.)/i
      ],
      conditions: {
        acc_descr_multiline: {
          rules: [14, 15],
          inclusive: !1
        },
        acc_descr: {
          rules: [12],
          inclusive: !1
        },
        acc_title: {
          rules: [10],
          inclusive: !1
        },
        INITIAL: {
          rules: [
            0,
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            11,
            13,
            16,
            17,
            18,
            19,
            20
          ],
          inclusive: !0
        }
      }
    };
  })();
  function x() {
    this.yy = {};
  }
  return o(x, "Parser"), x.prototype = f, f.Parser = x, new x();
})();
tt.parser = tt;
var Gt = tt, mt = {};
Wt(mt, {
  addEvent: () => $t,
  addSection: () => wt,
  addTask: () => Tt,
  addTaskOrg: () => Nt,
  clear: () => bt,
  default: () => Dt,
  getCommonDb: () => kt,
  getDirection: () => _t,
  getSections: () => St,
  getTasks: () => Et,
  setDirection: () => vt
});
var U = "", xt = 0, nt = "LR", rt = [], q = [], X = [], kt = /* @__PURE__ */ o(() => Ft, "getCommonDb"), bt = /* @__PURE__ */ o(function() {
  rt.length = 0, q.length = 0, U = "", X.length = 0, nt = "LR", Vt();
}, "clear"), vt = /* @__PURE__ */ o(function(e) {
  nt = e;
}, "setDirection"), _t = /* @__PURE__ */ o(function() {
  return nt;
}, "getDirection"), wt = /* @__PURE__ */ o(function(e) {
  U = e, rt.push(e);
}, "addSection"), St = /* @__PURE__ */ o(function() {
  return rt;
}, "getSections"), Et = /* @__PURE__ */ o(function() {
  let e = ct();
  const t = 100;
  let n = 0;
  for (; !e && n < t; )
    e = ct(), n++;
  return q.push(...X), q;
}, "getTasks"), Tt = /* @__PURE__ */ o(function(e, t, n) {
  const a = {
    id: xt++,
    section: U,
    type: U,
    task: e,
    score: t || 0,
    events: n ? [n] : []
  };
  X.push(a);
}, "addTask"), $t = /* @__PURE__ */ o(function(e) {
  X.find((t) => t.id === xt - 1).events.push(e);
}, "addEvent"), Nt = /* @__PURE__ */ o(function(e) {
  const t = {
    section: U,
    type: U,
    description: e,
    task: e,
    classes: []
  };
  q.push(t);
}, "addTaskOrg"), ct = /* @__PURE__ */ o(function() {
  const e = /* @__PURE__ */ o(function(n) {
    return X[n].processed;
  }, "compileTask");
  let t = !0;
  for (const [n, a] of X.entries())
    e(n), t = t && a.processed;
  return t;
}, "compileTasks"), Dt = {
  clear: bt,
  getCommonDb: kt,
  getDirection: _t,
  setDirection: vt,
  addSection: wt,
  getSections: St,
  getTasks: Et,
  addTask: Tt,
  addTaskOrg: Nt,
  addEvent: $t
}, It = 0, Q = /* @__PURE__ */ o(function(e, t) {
  const n = e.append("rect");
  return n.attr("x", t.x), n.attr("y", t.y), n.attr("fill", t.fill), n.attr("stroke", t.stroke), n.attr("width", t.width), n.attr("height", t.height), n.attr("rx", t.rx), n.attr("ry", t.ry), t.class !== void 0 && n.attr("class", t.class), n;
}, "drawRect"), Kt = /* @__PURE__ */ o(function(e, t) {
  const a = e.append("circle").attr("cx", t.cx).attr("cy", t.cy).attr("class", "face").attr("r", 15).attr("stroke-width", 2).attr("overflow", "visible"), r = e.append("g");
  r.append("circle").attr("cx", t.cx - 15 / 3).attr("cy", t.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"), r.append("circle").attr("cx", t.cx + 15 / 3).attr("cy", t.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
  function c(m) {
    const f = lt().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
    m.append("path").attr("class", "mouth").attr("d", f).attr("transform", "translate(" + t.cx + "," + (t.cy + 2) + ")");
  }
  o(c, "smile");
  function s(m) {
    const f = lt().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
    m.append("path").attr("class", "mouth").attr("d", f).attr("transform", "translate(" + t.cx + "," + (t.cy + 7) + ")");
  }
  o(s, "sad");
  function h(m) {
    m.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", t.cx - 5).attr("y1", t.cy + 7).attr("x2", t.cx + 5).attr("y2", t.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
  }
  return o(h, "ambivalent"), t.score > 3 ? c(r) : t.score < 3 ? s(r) : h(r), a;
}, "drawFace"), Ut = /* @__PURE__ */ o(function(e, t) {
  const n = e.append("circle");
  return n.attr("cx", t.cx), n.attr("cy", t.cy), n.attr("class", "actor-" + t.pos), n.attr("fill", t.fill), n.attr("stroke", t.stroke), n.attr("r", t.r), n.class !== void 0 && n.attr("class", n.class), t.title !== void 0 && n.append("title").text(t.title), n;
}, "drawCircle"), Ht = /* @__PURE__ */ o(function(e, t) {
  const n = t.text.replace(/<br\s*\/?>/gi, " "), a = e.append("text");
  a.attr("x", t.x), a.attr("y", t.y), a.attr("class", "legend"), a.style("text-anchor", t.anchor), t.class !== void 0 && a.attr("class", t.class);
  const r = a.append("tspan");
  return r.attr("x", t.x + t.textMargin * 2), r.text(n), a;
}, "drawText"), Xt = /* @__PURE__ */ o(function(e, t) {
  function n(r, c, s, h, m) {
    return r + "," + c + " " + (r + s) + "," + c + " " + (r + s) + "," + (c + h - m) + " " + (r + s - m * 1.2) + "," + (c + h) + " " + r + "," + (c + h);
  }
  o(n, "genPoints");
  const a = e.append("polygon");
  a.attr("points", n(t.x, t.y, 50, 20, 7)), a.attr("class", "labelBox"), t.y = t.y + t.labelMargin, t.x = t.x + 0.5 * t.labelMargin, Ht(e, t);
}, "drawLabel"), Zt = /* @__PURE__ */ o(function(e, t, n) {
  const a = e.append("g"), r = it();
  r.x = t.x, r.y = t.y, r.fill = t.fill, r.width = n.width, r.height = n.height, r.class = "journey-section section-type-" + t.num, r.rx = 3, r.ry = 3, Q(a, r), Lt(n)(t.text, a, r.x, r.y, r.width, r.height, { class: "journey-section section-type-" + t.num }, n, t.colour);
}, "drawSection"), et = -1, jt = /* @__PURE__ */ o(function(e, t, n, a) {
  const r = t.x + n.width / 2, c = e.append("g");
  et++, c.append("line").attr("id", a + "-task" + et).attr("x1", r).attr("y1", t.y).attr("x2", r).attr("y2", 450).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"), Kt(c, {
    cx: r,
    cy: 300 + (5 - t.score) * 30,
    score: t.score
  });
  const s = it();
  s.x = t.x, s.y = t.y, s.fill = t.fill, s.width = n.width, s.height = n.height, s.class = "task task-type-" + t.num, s.rx = 3, s.ry = 3, Q(c, s), Lt(n)(t.task, c, s.x, s.y, s.width, s.height, { class: "task" }, n, t.colour);
}, "drawTask"), qt = /* @__PURE__ */ o(function(e, t) {
  Q(e, {
    x: t.startx,
    y: t.starty,
    width: t.stopx - t.startx,
    height: t.stopy - t.starty,
    fill: t.fill,
    class: "rect"
  }).lower();
}, "drawBackgroundRect"), Qt = /* @__PURE__ */ o(function() {
  return {
    x: 0,
    y: 0,
    fill: void 0,
    "text-anchor": "start",
    width: 100,
    height: 100,
    textMargin: 0,
    rx: 0,
    ry: 0
  };
}, "getTextObj"), it = /* @__PURE__ */ o(function() {
  return {
    x: 0,
    y: 0,
    width: 100,
    anchor: "start",
    height: 100,
    rx: 0,
    ry: 0
  };
}, "getNoteRect"), Lt = /* @__PURE__ */ (function() {
  function e(r, c, s, h, m, f, x, i) {
    a(c.append("text").attr("x", s + m / 2).attr("y", h + f / 2 + 5).style("font-color", i).style("text-anchor", "middle").text(r), x);
  }
  o(e, "byText");
  function t(r, c, s, h, m, f, x, i, l) {
    const { taskFontSize: u, taskFontFamily: d } = i, g = r.split(/<br\s*\/?>/gi);
    for (let y = 0; y < g.length; y++) {
      const p = y * u - u * (g.length - 1) / 2, S = c.append("text").attr("x", s + m / 2).attr("y", h).attr("fill", l).style("text-anchor", "middle").style("font-size", u).style("font-family", d);
      S.append("tspan").attr("x", s + m / 2).attr("dy", p).text(g[y]), S.attr("y", h + f / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), a(S, x);
    }
  }
  o(t, "byTspan");
  function n(r, c, s, h, m, f, x, i) {
    const l = c.append("switch"), u = l.append("foreignObject").attr("x", s).attr("y", h).attr("width", m).attr("height", f).attr("position", "fixed").append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
    u.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(r), t(r, l, s, h, m, f, x, i), a(u, x);
  }
  o(n, "byFo");
  function a(r, c) {
    for (const s in c) s in c && r.attr(s, c[s]);
  }
  return o(a, "_setTextAttrs"), function(r) {
    return r.textPlacement === "fo" ? n : r.textPlacement === "old" ? e : t;
  };
})(), Jt = /* @__PURE__ */ o(function(e, t) {
  It = 0, et = -1, e.append("defs").append("marker").attr("id", t + "-arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
}, "initGraphics");
function st(e, t) {
  e.each(function() {
    var n = Z(this), a = n.text().split(/(\s+|<br>)/).reverse(), r, c = [], s = 1.1, h = n.attr("y"), m = parseFloat(n.attr("dy")), f = n.text(null).append("tspan").attr("x", 0).attr("y", h).attr("dy", m + "em");
    for (let x = 0; x < a.length; x++)
      r = a[a.length - 1 - x], c.push(r), f.text(c.join(" ").trim()), (f.node().getComputedTextLength() > t || r === "<br>") && (c.pop(), f.text(c.join(" ").trim()), r === "<br>" ? c = [""] : c = [r], f = n.append("tspan").attr("x", 0).attr("y", h).attr("dy", s + "em").text(r));
  });
}
o(st, "wrap");
var Yt = /* @__PURE__ */ o(function(e, t, n, a, r, c = !1) {
  const { theme: s, look: h } = a, m = s?.includes("redux"), f = n % (a?.themeVariables?.THEME_COLOR_LIMIT ?? 12) - 1, x = e.append("g");
  t.section = f, x.attr("class", (t.class ? t.class + " " : "") + "timeline-node " + ("section-" + f));
  const i = x.append("g"), l = x.append("g"), u = l.append("text").text(t.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(st, t.width).node().getBBox(), d = a.fontSize?.replace ? a.fontSize.replace("px", "") : a.fontSize;
  if (t.height = u.height + d * 1.1 * 0.5 + t.padding, t.height = Math.max(t.height, t.maxHeight), t.width = t.width + 2 * t.padding, l.attr("transform", "translate(" + t.width / 2 + ", " + t.padding / 2 + ")"), m && l.attr("transform", `translate(${t.width / 2}, ${c ? t.padding / 2 + 3 : t.padding})`), ee(i, t, f, r, a), h === "neo" && (x.attr("data-look", "neo"), m)) {
    const g = s.includes("dark"), y = Z(e.node()?.ownerSVGElement ?? e.node()), p = y.attr("id") ?? "", S = p ? `${p}-drop-shadow` : "drop-shadow";
    if (y.select(`#${S}`).empty()) {
      const k = y.select("defs");
      (k.empty() ? y.append("defs") : k).append("filter").attr("id", S).attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", g ? "0.2" : "0.06").attr("flood-color", g ? "#FFFFFF" : "#000000");
    }
  }
  return t;
}, "drawNode"), te = /* @__PURE__ */ o(function(e, t, n) {
  const a = e.append("g"), r = a.append("text").text(t.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(st, t.width).node().getBBox(), c = n.fontSize?.replace ? n.fontSize.replace("px", "") : n.fontSize;
  return a.remove(), r.height + c * 1.1 * 0.5 + t.padding;
}, "getVirtualNodeHeight"), ee = /* @__PURE__ */ o(function(e, t, n, a, r) {
  const { theme: c } = r, s = c?.includes("redux") ? 0 : 5, h = 5, m = s > 0 ? `M0 ${t.height - h} v${-t.height + 2 * h} q0,-${s},${s},-${s} h${t.width - 2 * h} q${s},0,${s},${s} v${t.height - h} H0 Z` : `M0 ${t.height - h} v${-(t.height - h)} h${t.width} v${t.height} H0 Z`;
  e.append("path").attr("id", a + "-node-" + It++).attr("class", "node-bkg node-" + t.type).attr("d", m), c?.includes("redux") || e.append("line").attr("class", "node-line-" + n).attr("x1", 0).attr("y1", t.height).attr("x2", t.width).attr("y2", t.height);
}, "defaultBkg"), M = {
  drawRect: Q,
  drawCircle: Ut,
  drawSection: Zt,
  drawText: Ht,
  drawLabel: Xt,
  drawTask: jt,
  drawBackgroundRect: qt,
  getTextObj: Qt,
  getNoteRect: it,
  initGraphics: Jt,
  drawNode: Yt,
  getVirtualNodeHeight: te
}, ne = /* @__PURE__ */ o(function(e, t, n, a) {
  const r = ft(), { look: c, theme: s, themeVariables: h } = r, { useGradient: m, gradientStart: f, gradientStop: x } = h, i = r.timeline?.leftMargin ?? 50;
  b.debug("timeline", a.db);
  const l = r.securityLevel;
  let u;
  l === "sandbox" && (u = Z("#i" + t));
  const d = (l === "sandbox" ? Z(u.nodes()[0].contentDocument.body) : Z("body")).select("#" + t);
  d.append("g");
  const g = a.db.getTasks(), y = a.db.getCommonDb().getDiagramTitle();
  b.debug("task", g), M.initGraphics(d, t);
  const p = a.db.getSections();
  b.debug("sections", p);
  let S = 0, k = 0, P = 0, C = 0, B = 50 + i, V = 50;
  C = 50;
  let I = 0, A = !0;
  p.forEach(function(T) {
    const v = {
      number: I,
      descr: T,
      section: I,
      width: 150,
      padding: 20,
      maxHeight: S
    }, E = M.getVirtualNodeHeight(d, v, r);
    b.debug("sectionHeight before draw", E), S = Math.max(S, E + 20);
  });
  let w = 0, L = 0;
  b.debug("tasks.length", g.length);
  for (const [T, v] of g.entries()) {
    const E = {
      number: T,
      descr: v,
      section: v.section,
      width: 150,
      padding: 20,
      maxHeight: k
    }, $ = M.getVirtualNodeHeight(d, E, r);
    b.debug("taskHeight before draw", $), k = Math.max(k, $ + 20), w = Math.max(w, v.events.length);
    let _ = 0;
    for (const H of v.events) {
      const R = {
        descr: H,
        section: v.section,
        number: v.section,
        width: 150,
        padding: 20,
        maxHeight: 50
      };
      _ += M.getVirtualNodeHeight(d, R, r);
    }
    v.events.length > 0 && (_ += (v.events.length - 1) * 10), L = Math.max(L, _);
  }
  b.debug("maxSectionHeight before draw", S), b.debug("maxTaskHeight before draw", k), p && p.length > 0 ? p.forEach((T) => {
    const v = g.filter((H) => H.section === T), E = {
      number: I,
      descr: T,
      section: I,
      width: 200 * Math.max(v.length, 1) - 50,
      padding: 20,
      maxHeight: S
    };
    b.debug("sectionNode", E);
    const $ = d.append("g"), _ = M.drawNode($, E, I, r, t);
    b.debug("sectionNode output", _), $.attr("transform", `translate(${B}, ${C})`), V += S + 50, v.length > 0 && ht(d, v, I, B, V, k, r, w, L, S, !1, t), B += 200 * Math.max(v.length, 1), V = C, I++;
  }) : (A = !1, ht(d, g, I, B, V, k, r, w, L, S, !0, t));
  const F = d.node().getBBox();
  if (b.debug("bounds", F), y && d.append("text").text(y).attr("x", c === "neo" ? F.x * 2 + i : F.width / 2 - i).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20), P = A ? S + k + 150 : k + 100, d.append("g").attr("class", "lineWrapper").append("line").attr("x1", i).attr("y1", P).attr("x2", F.width + 3 * i).attr("y2", P).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", `url(#${t}-arrowhead)`), c === "neo" && m && s !== "neutral") {
    const T = d.select("defs"), v = (T.empty() ? d.append("defs") : T).append("linearGradient").attr("id", d.attr("id") + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
    v.append("stop").attr("offset", "0%").attr("stop-color", f).attr("stop-opacity", 1), v.append("stop").attr("offset", "100%").attr("stop-color", x).attr("stop-opacity", 1);
  }
  gt(void 0, d, r.timeline?.padding ?? 50, r.timeline?.useMaxWidth ?? !1);
}, "draw"), ht = /* @__PURE__ */ o(function(e, t, n, a, r, c, s, h, m, f, x, i) {
  for (const l of t) {
    const u = {
      descr: l.task,
      section: n,
      number: n,
      width: 150,
      padding: 20,
      maxHeight: c
    };
    b.debug("taskNode", u);
    const d = e.append("g").attr("class", "taskWrapper"), g = M.drawNode(d, u, n, s, i).height;
    if (b.debug("taskHeight after draw", g), d.attr("transform", `translate(${a}, ${r})`), c = Math.max(c, g), l.events) {
      const y = e.append("g").attr("class", "lineWrapper");
      let p = c;
      r += 100, p = p + re(e, l.events, n, a, r, s, i), r -= 100, y.append("line").attr("x1", a + 190 / 2).attr("y1", r + c).attr("x2", a + 190 / 2).attr("y2", r + c + 100 + m + 100).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", `url(#${i}-arrowhead)`).attr("stroke-dasharray", "5,5");
    }
    a = a + 200, x && !s.timeline?.disableMulticolor && n++;
  }
  r = r - 10;
}, "drawTasks"), re = /* @__PURE__ */ o(function(e, t, n, a, r, c, s) {
  let h = 0;
  const m = r;
  r = r + 100;
  for (const f of t) {
    const x = {
      descr: f,
      section: n,
      number: n,
      width: 150,
      padding: 20,
      maxHeight: 50
    };
    b.debug("eventNode", x);
    const i = e.append("g").attr("class", "eventWrapper"), l = M.drawNode(i, x, n, c, s, !0).height;
    h = h + l, i.attr("transform", `translate(${a}, ${r})`), r = r + 10 + l;
  }
  return r = m, h;
}, "drawEvents"), ie = {
  setConf: /* @__PURE__ */ o(() => {
  }, "setConf"),
  draw: ne
}, J = 200, O = 5, se = J + O * 2, at = J + 100, ae = at + O * 2, Mt = 10, oe = 0, dt = 20, At = 20, ut = 30, Rt = 50, le = /* @__PURE__ */ o(function(e, t, n, a) {
  const r = ft(), c = r.timeline?.leftMargin ?? 50;
  b.debug("timeline", a.db);
  const s = Ot(t);
  s.append("g");
  const h = a.db.getTasks(), m = a.db.getCommonDb().getDiagramTitle();
  b.debug("task", h), M.initGraphics(s);
  const f = a.db.getSections();
  b.debug("sections", f);
  let x = 0, i = 0;
  const l = 50 + c;
  let u = 50;
  const d = u, g = l, y = se + At, p = ae + Rt, S = g + y;
  let k = 0;
  const P = f && f.length > 0, C = P ? S : l + y, B = Math.max(50, y + p - O * 2);
  f.forEach(function(v) {
    const E = {
      number: k,
      descr: v,
      section: k,
      width: B,
      padding: O,
      maxHeight: x
    }, $ = M.getVirtualNodeHeight(s, E, r);
    b.debug("sectionHeight before draw", $), x = Math.max(x, $);
  });
  let V = 0;
  b.debug("tasks.length", h.length);
  for (const [v, E] of h.entries()) {
    const $ = {
      number: v,
      descr: E,
      section: E.section,
      width: J,
      padding: O,
      maxHeight: i
    }, _ = M.getVirtualNodeHeight(s, $, r);
    b.debug("taskHeight before draw", _), i = Math.max(i, _);
    let H = 0;
    for (const R of E.events) {
      const N = {
        descr: R,
        section: E.section,
        number: E.section,
        width: at,
        padding: O,
        maxHeight: 50
      };
      H += M.getVirtualNodeHeight(s, N, r);
    }
    E.events.length > 0 && (H += (E.events.length - 1) * Mt), V = Math.max(V, H) + oe;
  }
  b.debug("maxSectionHeight before draw", x), b.debug("maxTaskHeight before draw", i);
  const I = Math.max(i, V) + ut;
  P ? f.forEach((v) => {
    const E = h.filter((K) => K.section === v), $ = {
      number: k,
      descr: v,
      section: k,
      width: B,
      padding: O,
      maxHeight: x
    };
    b.debug("sectionNode", $);
    const _ = s.append("g"), H = M.drawNode(_, $, k, r);
    b.debug("sectionNode output", H);
    const R = C - y;
    _.attr("transform", `translate(${R}, ${u})`);
    const N = u + H.height + dt;
    E.length > 0 && pt(s, E, k, C, N, i, r, I, !1);
    const D = E.length, G = H.height + dt + I * Math.max(D, 1) - (D > 0 ? ut * 2 : 0);
    u += G, k++;
  }) : pt(s, h, k, C, u, i, r, I, !0);
  let A = s.node()?.getBBox();
  if (!A) throw new Error("bbox not found");
  if (b.debug("bounds", A), m) {
    if (s.append("text").text(m).attr("x", A.width / 2 - c).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20), A = s.node()?.getBBox(), !A) throw new Error("bbox not found");
    b.debug("bounds after title", A);
  }
  const [w] = Ct(r.fontSize), L = (w ?? 16) * 2, F = (w ?? 16) * 0.5 + 20, T = s.append("g").attr("class", "lineWrapper");
  T.append("line").attr("x1", C).attr("y1", d - L).attr("x2", C).attr("y2", A.y + A.height + F).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)"), T.lower(), gt(void 0, s, r.timeline?.padding ?? 50, r.timeline?.useMaxWidth ?? !1);
}, "draw"), pt = /* @__PURE__ */ o(function(e, t, n, a, r, c, s, h, m) {
  for (const f of t) {
    const x = {
      descr: f.task,
      section: n,
      number: n,
      width: J,
      padding: O,
      maxHeight: c
    };
    b.debug("taskNode", x);
    const i = e.append("g").attr("class", "taskWrapper"), l = M.drawNode(i, x, n, s), u = l.height;
    b.debug("taskHeight after draw", u);
    const d = a - At - l.width;
    if (i.attr("transform", `translate(${d}, ${r})`), c = Math.max(c, u), f.events && f.events.length > 0) {
      const g = r, y = a + Rt;
      ce(e, f.events, n, a, y, g, s);
    }
    r = r + h, m && !s.timeline?.disableMulticolor && n++;
  }
}, "drawTasks"), ce = /* @__PURE__ */ o(function(e, t, n, a, r, c, s) {
  let h = c;
  for (const m of t) {
    const f = {
      descr: m,
      section: n,
      number: n,
      width: at,
      padding: O,
      maxHeight: 0
    };
    b.debug("eventNode", f);
    const x = e.append("g").attr("class", "eventWrapper"), i = M.drawNode(x, f, n, s).height;
    x.attr("transform", `translate(${r}, ${h})`);
    const l = e.append("g").attr("class", "lineWrapper"), u = h + i / 2;
    l.append("line").attr("x1", a).attr("y1", u).attr("x2", r).attr("y2", u).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", "url(#arrowhead)").attr("stroke-dasharray", "5,5"), h = h + i + Mt;
  }
  return h - c;
}, "drawEvents"), he = {
  setConf: /* @__PURE__ */ o(() => {
  }, "setConf"),
  draw: le
}, de = /* @__PURE__ */ o((e) => {
  const { theme: t } = yt(), n = t?.includes("dark"), a = t?.includes("color"), r = e.svgId?.replace(/^#/, "") ?? "", c = r ? `url(#${r}-drop-shadow)` : e.dropShadow ?? "none";
  let s = "";
  for (let h = 0; h < e.THEME_COLOR_LIMIT; h++) {
    const m = `${17 - 3 * h}`, f = a ? e.borderColorArray[h] : e.mainBkg, x = a ? e.borderColorArray[h] : e.nodeBorder;
    s += `
    .section-${h - 1} rect,
    .section-${h - 1} path,
    .section-${h - 1} circle {
      fill: ${n && a ? e.mainBkg : f};
      stroke: ${x};
      stroke-width: ${e.strokeWidth};
      filter: ${c};
    }

    .section-${h - 1} text {
      fill: ${e.nodeBorder};
      font-weight: ${e.fontWeight}
    }

    .node-icon-${h - 1} {
      font-size: 40px;
      color: ${e["cScaleLabel" + h]};
    }

    .section-edge-${h - 1} {
      stroke: ${e["cScale" + h]};
    }

    .edge-depth-${h - 1} {
      stroke-width: ${m};
    }

    .section-${h - 1} line {
      stroke: ${e["cScaleInv" + h]};
      stroke-width: 3;
    }

    .lineWrapper line {
      stroke: ${e.nodeBorder};
      stroke-width:${e.strokeWidth}
    }

    .disabled,
    .disabled circle,
    .disabled text {
      fill: ${e.tertiaryColor ?? "lightgray"};
    }

    .disabled text {
      fill: ${e.clusterBorder ?? "#efefef"};
    }
    `;
  }
  return s;
}, "genReduxSections"), ue = /* @__PURE__ */ o((e) => {
  let t = "";
  for (let n = 0; n < e.THEME_COLOR_LIMIT; n++)
    e["lineColor" + n] = e["lineColor" + n] || e["cScaleInv" + n], zt(e["lineColor" + n]) ? e["lineColor" + n] = Pt(e["lineColor" + n], 20) : e["lineColor" + n] = Bt(e["lineColor" + n], 20);
  for (let n = 0; n < e.THEME_COLOR_LIMIT; n++) {
    const a = "" + (17 - 3 * n);
    t += `
    .section-${n - 1} rect, .section-${n - 1} path, .section-${n - 1} circle, .section-${n - 1} path  {
      fill: ${e["cScale" + n]};
    }
    .section-${n - 1} text {
     fill: ${e["cScaleLabel" + n]};
    }
    .node-icon-${n - 1} {
      font-size: 40px;
      color: ${e["cScaleLabel" + n]};
    }
    .section-edge-${n - 1}{
      stroke: ${e["cScale" + n]};
    }
    .edge-depth-${n - 1}{
      stroke-width: ${a};
    }
    .section-${n - 1} line {
      stroke: ${e["cScaleInv" + n]} ;
      stroke-width: 3;
    }

    .lineWrapper line{
      stroke: ${e["cScaleLabel" + n]} ;
    }

    .disabled, .disabled circle, .disabled text {
      fill: ${e.tertiaryColor ?? "lightgray"};
    }
    .disabled text {
      fill: ${e.clusterBorder ?? "#efefef"};
    }
    `;
  }
  return t;
}, "genSections"), xe = {
  db: mt,
  renderer: {
    setConf: /* @__PURE__ */ o(() => {
    }, "setConf"),
    draw: /* @__PURE__ */ o((e, t, n, a) => (a?.db?.getDirection?.() ?? "LR") === "TD" ? he.draw(e, t, n, a) : ie.draw(e, t, n, a), "draw")
  },
  parser: Gt,
  styles: /* @__PURE__ */ o((e) => {
    const { theme: t } = yt(), n = t?.includes("redux"), a = t === "neutral", r = e.svgId?.replace(/^#/, "") ?? "";
    let c = "";
    if (e.useGradient && r && e.THEME_COLOR_LIMIT && !a) for (let s = 0; s < e.THEME_COLOR_LIMIT; s++) c += `
      .section-${s - 1}[data-look="neo"] rect,
      .section-${s - 1}[data-look="neo"] path,
      .section-${s - 1}[data-look="neo"] circle {
        fill: ${e.mainBkg};
        stroke: url(#${r}-gradient);
        stroke-width: 2;
      }
      .section-${s - 1}[data-look="neo"] line {
        stroke: url(#${r}-gradient);
        stroke-width: 2;
      }`;
    return `
  .edge {
    stroke-width: 3;
  }
  ${n ? de(e) : ue(e)}
  ${c}
  .section-root rect, .section-root path, .section-root circle  {
    fill: ${e.git0};
  }
  .section-root text {
    fill: ${e.gitBranchLabel0};
  }
  .icon-container {
    height:100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .edge {
    fill: none;
  }
  .eventWrapper  {
   filter: brightness(120%);
  }
`;
  }, "getStyles")
};
export {
  xe as diagram
};

//# sourceMappingURL=timeline-definition-GMOUNBTQ.js.map