import { s as __toESM, t as __commonJSMin } from "./chunk-BNovOVIE.js";
import "./purify.es-DT70lfR0.js";
import { t as linear } from "./linear-2NnK4cxi.js";
import { n as time, o as min, s as max } from "./time-C1SGcFMH.js";
import "./defaultLocale-BpsHxBd7.js";
import { C as timeMinute, N as millisecond, T as second, c as timeMonth, d as timeMonday, f as timeSaturday, g as timeWednesday, h as timeTuesday, m as timeThursday, p as timeSunday, t as timeFormat, u as timeFriday, v as timeDay, x as timeHour } from "./defaultLocale-DoeErsX2.js";
import { g as utils_default } from "./chunk-S3R3BYOJ-mQeCz5CE.js";
import { s as hcl_default } from "./timer-YZl28NYN.js";
import { i as log, o as require_dayjs_min, r as __name, t as select_default } from "./src-Bf2iLOlr.js";
import { B as setAccTitle, C as getDiagramTitle, U as setDiagramTitle, _ as getAccDescription, a as clear, b as getConfig2, c as configureSvgSize, s as common_default, v as getAccTitle, z as setAccDescription } from "./chunk-ABZYJK2D-D0cLy8Bb.js";
import { t as require_dist } from "./dist-BGdYVvOu.js";
function identity_default(e) {
  return e;
}
var top = 1, right = 2, bottom = 3, left = 4, epsilon = 1e-6;
function translateX(e) {
  return "translate(" + e + ",0)";
}
function translateY(e) {
  return "translate(0," + e + ")";
}
function number(e) {
  return (f) => +e(f);
}
function center(e, f) {
  return f = Math.max(0, e.bandwidth() - f * 2) / 2, e.round() && (f = Math.round(f)), (p) => +e(p) + f;
}
function entering() {
  return !this.__axis;
}
function axis(e, f) {
  var p = [], m = null, h = null, g = 6, _ = 6, v = 3, y = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, b = e === top || e === left ? -1 : 1, x = e === left || e === right ? "x" : "y", S = e === top || e === bottom ? translateX : translateY;
  function C(C2) {
    var T = m ?? (f.ticks ? f.ticks.apply(f, p) : f.domain()), E = h ?? (f.tickFormat ? f.tickFormat.apply(f, p) : identity_default), D = Math.max(g, 0) + v, O = f.range(), k = +O[0] + y, A = +O[O.length - 1] + y, j = (f.bandwidth ? center : number)(f.copy(), y), M = C2.selection ? C2.selection() : C2, N = M.selectAll(".domain").data([null]), P = M.selectAll(".tick").data(T, f).order(), F = P.exit(), I = P.enter().append("g").attr("class", "tick"), L = P.select("line"), R = P.select("text");
    N = N.merge(N.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), P = P.merge(I), L = L.merge(I.append("line").attr("stroke", "currentColor").attr(x + "2", b * g)), R = R.merge(I.append("text").attr("fill", "currentColor").attr(x, b * D).attr("dy", e === top ? "0em" : e === bottom ? "0.71em" : "0.32em")), C2 !== M && (N = N.transition(C2), P = P.transition(C2), L = L.transition(C2), R = R.transition(C2), F = F.transition(C2).attr("opacity", epsilon).attr("transform", function(e2) {
      return isFinite(e2 = j(e2)) ? S(e2 + y) : this.getAttribute("transform");
    }), I.attr("opacity", epsilon).attr("transform", function(e2) {
      var f2 = this.parentNode.__axis;
      return S((f2 && isFinite(f2 = f2(e2)) ? f2 : j(e2)) + y);
    })), F.remove(), N.attr("d", e === left || e === right ? _ ? "M" + b * _ + "," + k + "H" + y + "V" + A + "H" + b * _ : "M" + y + "," + k + "V" + A : _ ? "M" + k + "," + b * _ + "V" + y + "H" + A + "V" + b * _ : "M" + k + "," + y + "H" + A), P.attr("opacity", 1).attr("transform", function(e2) {
      return S(j(e2) + y);
    }), L.attr(x + "2", b * g), R.attr(x, b * D).text(E), M.filter(entering).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", e === right ? "start" : e === left ? "end" : "middle"), M.each(function() {
      this.__axis = j;
    });
  }
  return C.scale = function(e2) {
    return arguments.length ? (f = e2, C) : f;
  }, C.ticks = function() {
    return p = Array.from(arguments), C;
  }, C.tickArguments = function(e2) {
    return arguments.length ? (p = e2 == null ? [] : Array.from(e2), C) : p.slice();
  }, C.tickValues = function(e2) {
    return arguments.length ? (m = e2 == null ? null : Array.from(e2), C) : m && m.slice();
  }, C.tickFormat = function(e2) {
    return arguments.length ? (h = e2, C) : h;
  }, C.tickSize = function(e2) {
    return arguments.length ? (g = _ = +e2, C) : g;
  }, C.tickSizeInner = function(e2) {
    return arguments.length ? (g = +e2, C) : g;
  }, C.tickSizeOuter = function(e2) {
    return arguments.length ? (_ = +e2, C) : _;
  }, C.tickPadding = function(e2) {
    return arguments.length ? (v = +e2, C) : v;
  }, C.offset = function(e2) {
    return arguments.length ? (y = +e2, C) : y;
  }, C;
}
function axisTop(e) {
  return axis(top, e);
}
function axisBottom(e) {
  return axis(bottom, e);
}
var require_isoWeek = /* @__PURE__ */ __commonJSMin(((e, f) => {
  (function(p, m) {
    typeof e == "object" && f !== void 0 ? f.exports = m() : typeof define == "function" && define.amd ? define(m) : (p = typeof globalThis < "u" ? globalThis : p || self).dayjs_plugin_isoWeek = m();
  })(e, (function() {
    var e2 = "day";
    return function(f2, p, m) {
      var h = function(f3) {
        return f3.add(4 - f3.isoWeekday(), e2);
      }, g = p.prototype;
      g.isoWeekYear = function() {
        return h(this).year();
      }, g.isoWeek = function(f3) {
        if (!this.$utils().u(f3)) return this.add(7 * (f3 - this.isoWeek()), e2);
        var p2, g2, _2, v, y = h(this), b = (p2 = this.isoWeekYear(), g2 = this.$u, _2 = (g2 ? m.utc : m)().year(p2).startOf("year"), v = 4 - _2.isoWeekday(), _2.isoWeekday() > 4 && (v += 7), _2.add(v, e2));
        return y.diff(b, "week") + 1;
      }, g.isoWeekday = function(e3) {
        return this.$utils().u(e3) ? this.day() || 7 : this.day(this.day() % 7 ? e3 : e3 - 7);
      };
      var _ = g.startOf;
      g.startOf = function(e3, f3) {
        var p2 = this.$utils(), m2 = !!p2.u(f3) || f3;
        return p2.p(e3) === "isoweek" ? m2 ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : _.bind(this)(e3, f3);
      };
    };
  }));
})), require_customParseFormat = /* @__PURE__ */ __commonJSMin(((e, f) => {
  (function(p, m) {
    typeof e == "object" && f !== void 0 ? f.exports = m() : typeof define == "function" && define.amd ? define(m) : (p = typeof globalThis < "u" ? globalThis : p || self).dayjs_plugin_customParseFormat = m();
  })(e, (function() {
    var e2 = {
      LTS: "h:mm:ss A",
      LT: "h:mm A",
      L: "MM/DD/YYYY",
      LL: "MMMM D, YYYY",
      LLL: "MMMM D, YYYY h:mm A",
      LLLL: "dddd, MMMM D, YYYY h:mm A"
    }, f2 = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, p = /\d/, m = /\d\d/, h = /\d\d?/, g = /\d*[^-_:/,()\s\d]+/, _ = {}, v = function(e3) {
      return (e3 = +e3) + (e3 > 68 ? 1900 : 2e3);
    }, y = function(e3) {
      return function(f3) {
        this[e3] = +f3;
      };
    }, b = [/[+-]\d\d:?(\d\d)?|Z/, function(e3) {
      (this.zone || (this.zone = {})).offset = (function(e4) {
        if (!e4 || e4 === "Z") return 0;
        var f3 = e4.match(/([+-]|\d\d)/g), p2 = 60 * f3[1] + (+f3[2] || 0);
        return p2 === 0 ? 0 : f3[0] === "+" ? -p2 : p2;
      })(e3);
    }], x = function(e3) {
      var f3 = _[e3];
      return f3 && (f3.indexOf ? f3 : f3.s.concat(f3.f));
    }, S = function(e3, f3) {
      var p2, m2 = _.meridiem;
      if (m2) {
        for (var h2 = 1; h2 <= 24; h2 += 1) if (e3.indexOf(m2(h2, 0, f3)) > -1) {
          p2 = h2 > 12;
          break;
        }
      } else p2 = e3 === (f3 ? "pm" : "PM");
      return p2;
    }, C = {
      A: [g, function(e3) {
        this.afternoon = S(e3, false);
      }],
      a: [g, function(e3) {
        this.afternoon = S(e3, true);
      }],
      Q: [p, function(e3) {
        this.month = 3 * (e3 - 1) + 1;
      }],
      S: [p, function(e3) {
        this.milliseconds = 100 * e3;
      }],
      SS: [m, function(e3) {
        this.milliseconds = 10 * e3;
      }],
      SSS: [/\d{3}/, function(e3) {
        this.milliseconds = +e3;
      }],
      s: [h, y("seconds")],
      ss: [h, y("seconds")],
      m: [h, y("minutes")],
      mm: [h, y("minutes")],
      H: [h, y("hours")],
      h: [h, y("hours")],
      HH: [h, y("hours")],
      hh: [h, y("hours")],
      D: [h, y("day")],
      DD: [m, y("day")],
      Do: [g, function(e3) {
        var f3 = _.ordinal;
        if (this.day = e3.match(/\d+/)[0], f3) for (var p2 = 1; p2 <= 31; p2 += 1) f3(p2).replace(/\[|\]/g, "") === e3 && (this.day = p2);
      }],
      w: [h, y("week")],
      ww: [m, y("week")],
      M: [h, y("month")],
      MM: [m, y("month")],
      MMM: [g, function(e3) {
        var f3 = x("months"), p2 = (x("monthsShort") || f3.map((function(e4) {
          return e4.slice(0, 3);
        }))).indexOf(e3) + 1;
        if (p2 < 1) throw Error();
        this.month = p2 % 12 || p2;
      }],
      MMMM: [g, function(e3) {
        var f3 = x("months").indexOf(e3) + 1;
        if (f3 < 1) throw Error();
        this.month = f3 % 12 || f3;
      }],
      Y: [/[+-]?\d+/, y("year")],
      YY: [m, function(e3) {
        this.year = v(e3);
      }],
      YYYY: [/\d{4}/, y("year")],
      Z: b,
      ZZ: b
    };
    function T(p2) {
      for (var m2 = p2, h2 = _ && _.formats, g2 = (p2 = m2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(f3, p3, m3) {
        var g3 = m3 && m3.toUpperCase();
        return p3 || h2[m3] || e2[m3] || h2[g3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(e3, f4, p4) {
          return f4 || p4.slice(1);
        }));
      }))).match(f2), v2 = g2.length, y2 = 0; y2 < v2; y2 += 1) {
        var b2 = g2[y2], x2 = C[b2], S2 = x2 && x2[0], T2 = x2 && x2[1];
        g2[y2] = T2 ? {
          regex: S2,
          parser: T2
        } : b2.replace(/^\[|\]$/g, "");
      }
      return function(e3) {
        for (var f3 = {}, p3 = 0, m3 = 0; p3 < v2; p3 += 1) {
          var h3 = g2[p3];
          if (typeof h3 == "string") m3 += h3.length;
          else {
            var _2 = h3.regex, y3 = h3.parser, b3 = e3.slice(m3), x3 = _2.exec(b3)[0];
            y3.call(f3, x3), e3 = e3.replace(x3, "");
          }
        }
        return (function(e4) {
          var f4 = e4.afternoon;
          if (f4 !== void 0) {
            var p4 = e4.hours;
            f4 ? p4 < 12 && (e4.hours += 12) : p4 === 12 && (e4.hours = 0), delete e4.afternoon;
          }
        })(f3), f3;
      };
    }
    return function(e3, f3, p2) {
      p2.p.customParseFormat = true, e3 && e3.parseTwoDigitYear && (v = e3.parseTwoDigitYear);
      var m2 = f3.prototype, h2 = m2.parse;
      m2.parse = function(e4) {
        var f4 = e4.date, m3 = e4.utc, g2 = e4.args;
        this.$u = m3;
        var v2 = g2[1];
        if (typeof v2 == "string") {
          var y2 = true === g2[2], b2 = true === g2[3], x2 = y2 || b2, S2 = g2[2];
          b2 && (S2 = g2[2]), _ = this.$locale(), !y2 && S2 && (_ = p2.Ls[S2]), this.$d = (function(e5, f5, p3, m4) {
            try {
              if (["x", "X"].indexOf(f5) > -1) return /* @__PURE__ */ new Date((f5 === "X" ? 1e3 : 1) * e5);
              var h3 = T(f5)(e5), g3 = h3.year, _2 = h3.month, v3 = h3.day, y3 = h3.hours, b3 = h3.minutes, x3 = h3.seconds, S3 = h3.milliseconds, C3 = h3.zone, E2 = h3.week, D2 = /* @__PURE__ */ new Date(), O = v3 || (g3 || _2 ? 1 : D2.getDate()), k = g3 || D2.getFullYear(), A = 0;
              g3 && !_2 || (A = _2 > 0 ? _2 - 1 : D2.getMonth());
              var j, M = y3 || 0, N = b3 || 0, P = x3 || 0, F = S3 || 0;
              return C3 ? new Date(Date.UTC(k, A, O, M, N, P, F + 60 * C3.offset * 1e3)) : p3 ? new Date(Date.UTC(k, A, O, M, N, P, F)) : (j = new Date(k, A, O, M, N, P, F), E2 && (j = m4(j).week(E2).toDate()), j);
            } catch {
              return /* @__PURE__ */ new Date("");
            }
          })(f4, v2, m3, p2), this.init(), S2 && true !== S2 && (this.$L = this.locale(S2).$L), x2 && f4 != this.format(v2) && (this.$d = /* @__PURE__ */ new Date("")), _ = {};
        } else if (v2 instanceof Array) for (var C2 = v2.length, E = 1; E <= C2; E += 1) {
          g2[1] = v2[E - 1];
          var D = p2.apply(this, g2);
          if (D.isValid()) {
            this.$d = D.$d, this.$L = D.$L, this.init();
            break;
          }
          E === C2 && (this.$d = /* @__PURE__ */ new Date(""));
        }
        else h2.call(this, e4);
      };
    };
  }));
})), require_advancedFormat = /* @__PURE__ */ __commonJSMin(((e, f) => {
  (function(p, m) {
    typeof e == "object" && f !== void 0 ? f.exports = m() : typeof define == "function" && define.amd ? define(m) : (p = typeof globalThis < "u" ? globalThis : p || self).dayjs_plugin_advancedFormat = m();
  })(e, (function() {
    return function(e2, f2) {
      var p = f2.prototype, m = p.format;
      p.format = function(e3) {
        var f3 = this, p2 = this.$locale();
        if (!this.isValid()) return m.bind(this)(e3);
        var h = this.$utils(), g = (e3 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, (function(e4) {
          switch (e4) {
            case "Q":
              return Math.ceil((f3.$M + 1) / 3);
            case "Do":
              return p2.ordinal(f3.$D);
            case "gggg":
              return f3.weekYear();
            case "GGGG":
              return f3.isoWeekYear();
            case "wo":
              return p2.ordinal(f3.week(), "W");
            case "w":
            case "ww":
              return h.s(f3.week(), e4 === "w" ? 1 : 2, "0");
            case "W":
            case "WW":
              return h.s(f3.isoWeek(), e4 === "W" ? 1 : 2, "0");
            case "k":
            case "kk":
              return h.s(String(f3.$H === 0 ? 24 : f3.$H), e4 === "k" ? 1 : 2, "0");
            case "X":
              return Math.floor(f3.$d.getTime() / 1e3);
            case "x":
              return f3.$d.getTime();
            case "z":
              return "[" + f3.offsetName() + "]";
            case "zzz":
              return "[" + f3.offsetName("long") + "]";
            default:
              return e4;
          }
        }));
        return m.bind(this)(g);
      };
    };
  }));
})), require_duration = /* @__PURE__ */ __commonJSMin(((e, f) => {
  (function(p, m) {
    typeof e == "object" && f !== void 0 ? f.exports = m() : typeof define == "function" && define.amd ? define(m) : (p = typeof globalThis < "u" ? globalThis : p || self).dayjs_plugin_duration = m();
  })(e, (function() {
    var e2, f2, p = 1e3, m = 6e4, h = 36e5, g = 864e5, _ = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, v = 31536e6, y = 2628e6, b = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, x = {
      years: v,
      months: y,
      days: g,
      hours: h,
      minutes: m,
      seconds: p,
      milliseconds: 1,
      weeks: 6048e5
    }, S = function(e3) {
      return e3 instanceof A;
    }, C = function(e3, f3, p2) {
      return new A(e3, p2, f3.$l);
    }, T = function(e3) {
      return f2.p(e3) + "s";
    }, E = function(e3) {
      return e3 < 0;
    }, D = function(e3) {
      return E(e3) ? Math.ceil(e3) : Math.floor(e3);
    }, O = function(e3) {
      return Math.abs(e3);
    }, k = function(e3, f3) {
      return e3 ? E(e3) ? {
        negative: true,
        format: "" + O(e3) + f3
      } : {
        negative: false,
        format: "" + e3 + f3
      } : {
        negative: false,
        format: ""
      };
    }, A = (function() {
      function E2(e3, f3, p2) {
        var m2 = this;
        if (this.$d = {}, this.$l = p2, e3 === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), f3) return C(e3 * x[T(f3)], this);
        if (typeof e3 == "number") return this.$ms = e3, this.parseFromMilliseconds(), this;
        if (typeof e3 == "object") return Object.keys(e3).forEach((function(f4) {
          m2.$d[T(f4)] = e3[f4];
        })), this.calMilliseconds(), this;
        if (typeof e3 == "string") {
          var h2 = e3.match(b);
          if (h2) {
            var g2 = h2.slice(2).map((function(e4) {
              return e4 == null ? 0 : Number(e4);
            }));
            return this.$d.years = g2[0], this.$d.months = g2[1], this.$d.weeks = g2[2], this.$d.days = g2[3], this.$d.hours = g2[4], this.$d.minutes = g2[5], this.$d.seconds = g2[6], this.calMilliseconds(), this;
          }
        }
        return this;
      }
      var O2 = E2.prototype;
      return O2.calMilliseconds = function() {
        var e3 = this;
        this.$ms = Object.keys(this.$d).reduce((function(f3, p2) {
          return f3 + (e3.$d[p2] || 0) * x[p2];
        }), 0);
      }, O2.parseFromMilliseconds = function() {
        var e3 = this.$ms;
        this.$d.years = D(e3 / v), e3 %= v, this.$d.months = D(e3 / y), e3 %= y, this.$d.days = D(e3 / g), e3 %= g, this.$d.hours = D(e3 / h), e3 %= h, this.$d.minutes = D(e3 / m), e3 %= m, this.$d.seconds = D(e3 / p), e3 %= p, this.$d.milliseconds = e3;
      }, O2.toISOString = function() {
        var e3 = k(this.$d.years, "Y"), f3 = k(this.$d.months, "M"), p2 = +this.$d.days || 0;
        this.$d.weeks && (p2 += 7 * this.$d.weeks);
        var m2 = k(p2, "D"), h2 = k(this.$d.hours, "H"), g2 = k(this.$d.minutes, "M"), _2 = this.$d.seconds || 0;
        this.$d.milliseconds && (_2 += this.$d.milliseconds / 1e3, _2 = Math.round(1e3 * _2) / 1e3);
        var v2 = k(_2, "S"), y2 = e3.negative || f3.negative || m2.negative || h2.negative || g2.negative || v2.negative, b2 = h2.format || g2.format || v2.format ? "T" : "", x2 = (y2 ? "-" : "") + "P" + e3.format + f3.format + m2.format + b2 + h2.format + g2.format + v2.format;
        return x2 === "P" || x2 === "-P" ? "P0D" : x2;
      }, O2.toJSON = function() {
        return this.toISOString();
      }, O2.format = function(e3) {
        var p2 = e3 || "YYYY-MM-DDTHH:mm:ss", m2 = {
          Y: this.$d.years,
          YY: f2.s(this.$d.years, 2, "0"),
          YYYY: f2.s(this.$d.years, 4, "0"),
          M: this.$d.months,
          MM: f2.s(this.$d.months, 2, "0"),
          D: this.$d.days,
          DD: f2.s(this.$d.days, 2, "0"),
          H: this.$d.hours,
          HH: f2.s(this.$d.hours, 2, "0"),
          m: this.$d.minutes,
          mm: f2.s(this.$d.minutes, 2, "0"),
          s: this.$d.seconds,
          ss: f2.s(this.$d.seconds, 2, "0"),
          SSS: f2.s(this.$d.milliseconds, 3, "0")
        };
        return p2.replace(_, (function(e4, f3) {
          return f3 || String(m2[e4]);
        }));
      }, O2.as = function(e3) {
        return this.$ms / x[T(e3)];
      }, O2.get = function(e3) {
        var f3 = this.$ms, p2 = T(e3);
        return p2 === "milliseconds" ? f3 %= 1e3 : f3 = p2 === "weeks" ? D(f3 / x[p2]) : this.$d[p2], f3 || 0;
      }, O2.add = function(e3, f3, p2) {
        var m2;
        return m2 = f3 ? e3 * x[T(f3)] : S(e3) ? e3.$ms : C(e3, this).$ms, C(this.$ms + m2 * (p2 ? -1 : 1), this);
      }, O2.subtract = function(e3, f3) {
        return this.add(e3, f3, true);
      }, O2.locale = function(e3) {
        var f3 = this.clone();
        return f3.$l = e3, f3;
      }, O2.clone = function() {
        return C(this.$ms, this);
      }, O2.humanize = function(f3) {
        return e2().add(this.$ms, "ms").locale(this.$l).fromNow(!f3);
      }, O2.valueOf = function() {
        return this.asMilliseconds();
      }, O2.milliseconds = function() {
        return this.get("milliseconds");
      }, O2.asMilliseconds = function() {
        return this.as("milliseconds");
      }, O2.seconds = function() {
        return this.get("seconds");
      }, O2.asSeconds = function() {
        return this.as("seconds");
      }, O2.minutes = function() {
        return this.get("minutes");
      }, O2.asMinutes = function() {
        return this.as("minutes");
      }, O2.hours = function() {
        return this.get("hours");
      }, O2.asHours = function() {
        return this.as("hours");
      }, O2.days = function() {
        return this.get("days");
      }, O2.asDays = function() {
        return this.as("days");
      }, O2.weeks = function() {
        return this.get("weeks");
      }, O2.asWeeks = function() {
        return this.as("weeks");
      }, O2.months = function() {
        return this.get("months");
      }, O2.asMonths = function() {
        return this.as("months");
      }, O2.years = function() {
        return this.get("years");
      }, O2.asYears = function() {
        return this.as("years");
      }, E2;
    })(), j = function(e3, f3, p2) {
      return e3.add(f3.years() * p2, "y").add(f3.months() * p2, "M").add(f3.days() * p2, "d").add(f3.hours() * p2, "h").add(f3.minutes() * p2, "m").add(f3.seconds() * p2, "s").add(f3.milliseconds() * p2, "ms");
    };
    return function(p2, m2, h2) {
      e2 = h2, f2 = h2().$utils(), h2.duration = function(e3, f3) {
        return C(e3, { $l: h2.locale() }, f3);
      }, h2.isDuration = S;
      var g2 = m2.prototype.add, _2 = m2.prototype.subtract;
      m2.prototype.add = function(e3, f3) {
        return S(e3) ? j(this, e3, 1) : g2.bind(this)(e3, f3);
      }, m2.prototype.subtract = function(e3, f3) {
        return S(e3) ? j(this, e3, -1) : _2.bind(this)(e3, f3);
      };
    };
  }));
})), import_dist = require_dist(), import_dayjs_min = /* @__PURE__ */ __toESM(require_dayjs_min(), 1), import_isoWeek = /* @__PURE__ */ __toESM(require_isoWeek(), 1), import_customParseFormat = /* @__PURE__ */ __toESM(require_customParseFormat(), 1), import_advancedFormat = /* @__PURE__ */ __toESM(require_advancedFormat(), 1), import_dayjs_min$1 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1), import_duration = /* @__PURE__ */ __toESM(require_duration(), 1), parser = (function() {
  var e = /* @__PURE__ */ __name(function(e2, f2, p2, m2) {
    for (p2 || (p2 = {}), m2 = e2.length; m2--; p2[e2[m2]] = f2) ;
    return p2;
  }, "o"), f = [
    6,
    8,
    10,
    12,
    13,
    14,
    15,
    16,
    17,
    18,
    20,
    21,
    22,
    23,
    24,
    25,
    26,
    27,
    28,
    29,
    30,
    31,
    33,
    35,
    36,
    38,
    40
  ], p = [1, 26], m = [1, 27], h = [1, 28], g = [1, 29], _ = [1, 30], v = [1, 31], y = [1, 32], b = [1, 33], x = [1, 34], S = [1, 9], C = [1, 10], T = [1, 11], E = [1, 12], D = [1, 13], O = [1, 14], k = [1, 15], A = [1, 16], j = [1, 19], M = [1, 20], N = [1, 21], P = [1, 22], F = [1, 23], L = [1, 25], R = [1, 35], z = {
    trace: /* @__PURE__ */ __name(function() {
    }, "trace"),
    yy: {},
    symbols_: {
      error: 2,
      start: 3,
      gantt: 4,
      document: 5,
      EOF: 6,
      line: 7,
      SPACE: 8,
      statement: 9,
      NL: 10,
      weekday: 11,
      weekday_monday: 12,
      weekday_tuesday: 13,
      weekday_wednesday: 14,
      weekday_thursday: 15,
      weekday_friday: 16,
      weekday_saturday: 17,
      weekday_sunday: 18,
      weekend: 19,
      weekend_friday: 20,
      weekend_saturday: 21,
      dateFormat: 22,
      inclusiveEndDates: 23,
      topAxis: 24,
      axisFormat: 25,
      tickInterval: 26,
      excludes: 27,
      includes: 28,
      todayMarker: 29,
      title: 30,
      acc_title: 31,
      acc_title_value: 32,
      acc_descr: 33,
      acc_descr_value: 34,
      acc_descr_multiline_value: 35,
      section: 36,
      clickStatement: 37,
      taskTxt: 38,
      taskData: 39,
      click: 40,
      callbackname: 41,
      callbackargs: 42,
      href: 43,
      clickStatementDebug: 44,
      $accept: 0,
      $end: 1
    },
    terminals_: {
      2: "error",
      4: "gantt",
      6: "EOF",
      8: "SPACE",
      10: "NL",
      12: "weekday_monday",
      13: "weekday_tuesday",
      14: "weekday_wednesday",
      15: "weekday_thursday",
      16: "weekday_friday",
      17: "weekday_saturday",
      18: "weekday_sunday",
      20: "weekend_friday",
      21: "weekend_saturday",
      22: "dateFormat",
      23: "inclusiveEndDates",
      24: "topAxis",
      25: "axisFormat",
      26: "tickInterval",
      27: "excludes",
      28: "includes",
      29: "todayMarker",
      30: "title",
      31: "acc_title",
      32: "acc_title_value",
      33: "acc_descr",
      34: "acc_descr_value",
      35: "acc_descr_multiline_value",
      36: "section",
      38: "taskTxt",
      39: "taskData",
      40: "click",
      41: "callbackname",
      42: "callbackargs",
      43: "href"
    },
    productions_: [
      0,
      [3, 3],
      [5, 0],
      [5, 2],
      [7, 2],
      [7, 1],
      [7, 1],
      [7, 1],
      [11, 1],
      [11, 1],
      [11, 1],
      [11, 1],
      [11, 1],
      [11, 1],
      [11, 1],
      [19, 1],
      [19, 1],
      [9, 1],
      [9, 1],
      [9, 1],
      [9, 1],
      [9, 1],
      [9, 1],
      [9, 1],
      [9, 1],
      [9, 1],
      [9, 1],
      [9, 1],
      [9, 2],
      [9, 2],
      [9, 1],
      [9, 1],
      [9, 1],
      [9, 2],
      [37, 2],
      [37, 3],
      [37, 3],
      [37, 4],
      [37, 3],
      [37, 4],
      [37, 2],
      [44, 2],
      [44, 3],
      [44, 3],
      [44, 4],
      [44, 3],
      [44, 4],
      [44, 2]
    ],
    performAction: /* @__PURE__ */ __name(function(e2, f2, p2, m2, h2, g2, _2) {
      var v2 = g2.length - 1;
      switch (h2) {
        case 1:
          return g2[v2 - 1];
        case 2:
          this.$ = [];
          break;
        case 3:
          g2[v2 - 1].push(g2[v2]), this.$ = g2[v2 - 1];
          break;
        case 4:
        case 5:
          this.$ = g2[v2];
          break;
        case 6:
        case 7:
          this.$ = [];
          break;
        case 8:
          m2.setWeekday("monday");
          break;
        case 9:
          m2.setWeekday("tuesday");
          break;
        case 10:
          m2.setWeekday("wednesday");
          break;
        case 11:
          m2.setWeekday("thursday");
          break;
        case 12:
          m2.setWeekday("friday");
          break;
        case 13:
          m2.setWeekday("saturday");
          break;
        case 14:
          m2.setWeekday("sunday");
          break;
        case 15:
          m2.setWeekend("friday");
          break;
        case 16:
          m2.setWeekend("saturday");
          break;
        case 17:
          m2.setDateFormat(g2[v2].substr(11)), this.$ = g2[v2].substr(11);
          break;
        case 18:
          m2.enableInclusiveEndDates(), this.$ = g2[v2].substr(18);
          break;
        case 19:
          m2.TopAxis(), this.$ = g2[v2].substr(8);
          break;
        case 20:
          m2.setAxisFormat(g2[v2].substr(11)), this.$ = g2[v2].substr(11);
          break;
        case 21:
          m2.setTickInterval(g2[v2].substr(13)), this.$ = g2[v2].substr(13);
          break;
        case 22:
          m2.setExcludes(g2[v2].substr(9)), this.$ = g2[v2].substr(9);
          break;
        case 23:
          m2.setIncludes(g2[v2].substr(9)), this.$ = g2[v2].substr(9);
          break;
        case 24:
          m2.setTodayMarker(g2[v2].substr(12)), this.$ = g2[v2].substr(12);
          break;
        case 27:
          m2.setDiagramTitle(g2[v2].substr(6)), this.$ = g2[v2].substr(6);
          break;
        case 28:
          this.$ = g2[v2].trim(), m2.setAccTitle(this.$);
          break;
        case 29:
        case 30:
          this.$ = g2[v2].trim(), m2.setAccDescription(this.$);
          break;
        case 31:
          m2.addSection(g2[v2].substr(8)), this.$ = g2[v2].substr(8);
          break;
        case 33:
          m2.addTask(g2[v2 - 1], g2[v2]), this.$ = "task";
          break;
        case 34:
          this.$ = g2[v2 - 1], m2.setClickEvent(g2[v2 - 1], g2[v2], null);
          break;
        case 35:
          this.$ = g2[v2 - 2], m2.setClickEvent(g2[v2 - 2], g2[v2 - 1], g2[v2]);
          break;
        case 36:
          this.$ = g2[v2 - 2], m2.setClickEvent(g2[v2 - 2], g2[v2 - 1], null), m2.setLink(g2[v2 - 2], g2[v2]);
          break;
        case 37:
          this.$ = g2[v2 - 3], m2.setClickEvent(g2[v2 - 3], g2[v2 - 2], g2[v2 - 1]), m2.setLink(g2[v2 - 3], g2[v2]);
          break;
        case 38:
          this.$ = g2[v2 - 2], m2.setClickEvent(g2[v2 - 2], g2[v2], null), m2.setLink(g2[v2 - 2], g2[v2 - 1]);
          break;
        case 39:
          this.$ = g2[v2 - 3], m2.setClickEvent(g2[v2 - 3], g2[v2 - 1], g2[v2]), m2.setLink(g2[v2 - 3], g2[v2 - 2]);
          break;
        case 40:
          this.$ = g2[v2 - 1], m2.setLink(g2[v2 - 1], g2[v2]);
          break;
        case 41:
        case 47:
          this.$ = g2[v2 - 1] + " " + g2[v2];
          break;
        case 42:
        case 43:
        case 45:
          this.$ = g2[v2 - 2] + " " + g2[v2 - 1] + " " + g2[v2];
          break;
        case 44:
        case 46:
          this.$ = g2[v2 - 3] + " " + g2[v2 - 2] + " " + g2[v2 - 1] + " " + g2[v2];
          break;
      }
    }, "anonymous"),
    table: [
      {
        3: 1,
        4: [1, 2]
      },
      { 1: [3] },
      e(f, [2, 2], { 5: 3 }),
      {
        6: [1, 4],
        7: 5,
        8: [1, 6],
        9: 7,
        10: [1, 8],
        11: 17,
        12: p,
        13: m,
        14: h,
        15: g,
        16: _,
        17: v,
        18: y,
        19: 18,
        20: b,
        21: x,
        22: S,
        23: C,
        24: T,
        25: E,
        26: D,
        27: O,
        28: k,
        29: A,
        30: j,
        31: M,
        33: N,
        35: P,
        36: F,
        37: 24,
        38: L,
        40: R
      },
      e(f, [2, 7], { 1: [2, 1] }),
      e(f, [2, 3]),
      {
        9: 36,
        11: 17,
        12: p,
        13: m,
        14: h,
        15: g,
        16: _,
        17: v,
        18: y,
        19: 18,
        20: b,
        21: x,
        22: S,
        23: C,
        24: T,
        25: E,
        26: D,
        27: O,
        28: k,
        29: A,
        30: j,
        31: M,
        33: N,
        35: P,
        36: F,
        37: 24,
        38: L,
        40: R
      },
      e(f, [2, 5]),
      e(f, [2, 6]),
      e(f, [2, 17]),
      e(f, [2, 18]),
      e(f, [2, 19]),
      e(f, [2, 20]),
      e(f, [2, 21]),
      e(f, [2, 22]),
      e(f, [2, 23]),
      e(f, [2, 24]),
      e(f, [2, 25]),
      e(f, [2, 26]),
      e(f, [2, 27]),
      { 32: [1, 37] },
      { 34: [1, 38] },
      e(f, [2, 30]),
      e(f, [2, 31]),
      e(f, [2, 32]),
      { 39: [1, 39] },
      e(f, [2, 8]),
      e(f, [2, 9]),
      e(f, [2, 10]),
      e(f, [2, 11]),
      e(f, [2, 12]),
      e(f, [2, 13]),
      e(f, [2, 14]),
      e(f, [2, 15]),
      e(f, [2, 16]),
      {
        41: [1, 40],
        43: [1, 41]
      },
      e(f, [2, 4]),
      e(f, [2, 28]),
      e(f, [2, 29]),
      e(f, [2, 33]),
      e(f, [2, 34], {
        42: [1, 42],
        43: [1, 43]
      }),
      e(f, [2, 40], { 41: [1, 44] }),
      e(f, [2, 35], { 43: [1, 45] }),
      e(f, [2, 36]),
      e(f, [2, 38], { 42: [1, 46] }),
      e(f, [2, 37]),
      e(f, [2, 39])
    ],
    defaultActions: {},
    parseError: /* @__PURE__ */ __name(function(e2, f2) {
      if (f2.recoverable) this.trace(e2);
      else {
        var p2 = Error(e2);
        throw p2.hash = f2, p2;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ __name(function(e2) {
      var f2 = this, p2 = [0], m2 = [], h2 = [null], g2 = [], _2 = this.table, v2 = "", y2 = 0, b2 = 0, x2 = 0, S2 = 2, C2 = 1, T2 = g2.slice.call(arguments, 1), E2 = Object.create(this.lexer), D2 = { yy: {} };
      for (var O2 in this.yy) Object.prototype.hasOwnProperty.call(this.yy, O2) && (D2.yy[O2] = this.yy[O2]);
      E2.setInput(e2, D2.yy), D2.yy.lexer = E2, D2.yy.parser = this, E2.yylloc === void 0 && (E2.yylloc = {});
      var k2 = E2.yylloc;
      g2.push(k2);
      var A2 = E2.options && E2.options.ranges;
      typeof D2.yy.parseError == "function" ? this.parseError = D2.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function j2(e3) {
        p2.length -= 2 * e3, h2.length -= e3, g2.length -= e3;
      }
      __name(j2, "popStack");
      function M2() {
        var e3 = m2.pop() || E2.lex() || C2;
        return typeof e3 != "number" && (e3 instanceof Array && (m2 = e3, e3 = m2.pop()), e3 = f2.symbols_[e3] || e3), e3;
      }
      __name(M2, "lex");
      for (var N2, P2, F2, L2, R2, z2 = {}, B2, V, H, U; ; ) {
        if (F2 = p2[p2.length - 1], this.defaultActions[F2] ? L2 = this.defaultActions[F2] : (N2 ?? (N2 = M2()), L2 = _2[F2] && _2[F2][N2]), L2 === void 0 || !L2.length || !L2[0]) {
          var W = "";
          for (B2 in U = [], _2[F2]) this.terminals_[B2] && B2 > S2 && U.push("'" + this.terminals_[B2] + "'");
          W = E2.showPosition ? "Parse error on line " + (y2 + 1) + ":\n" + E2.showPosition() + "\nExpecting " + U.join(", ") + ", got '" + (this.terminals_[N2] || N2) + "'" : "Parse error on line " + (y2 + 1) + ": Unexpected " + (N2 == C2 ? "end of input" : "'" + (this.terminals_[N2] || N2) + "'"), this.parseError(W, {
            text: E2.match,
            token: this.terminals_[N2] || N2,
            line: E2.yylineno,
            loc: k2,
            expected: U
          });
        }
        if (L2[0] instanceof Array && L2.length > 1) throw Error("Parse Error: multiple actions possible at state: " + F2 + ", token: " + N2);
        switch (L2[0]) {
          case 1:
            p2.push(N2), h2.push(E2.yytext), g2.push(E2.yylloc), p2.push(L2[1]), N2 = null, P2 ? (N2 = P2, P2 = null) : (b2 = E2.yyleng, v2 = E2.yytext, y2 = E2.yylineno, k2 = E2.yylloc, x2 > 0 && x2--);
            break;
          case 2:
            if (V = this.productions_[L2[1]][1], z2.$ = h2[h2.length - V], z2._$ = {
              first_line: g2[g2.length - (V || 1)].first_line,
              last_line: g2[g2.length - 1].last_line,
              first_column: g2[g2.length - (V || 1)].first_column,
              last_column: g2[g2.length - 1].last_column
            }, A2 && (z2._$.range = [g2[g2.length - (V || 1)].range[0], g2[g2.length - 1].range[1]]), R2 = this.performAction.apply(z2, [
              v2,
              b2,
              y2,
              D2.yy,
              L2[1],
              h2,
              g2
            ].concat(T2)), R2 !== void 0) return R2;
            V && (p2 = p2.slice(0, -1 * V * 2), h2 = h2.slice(0, -1 * V), g2 = g2.slice(0, -1 * V)), p2.push(this.productions_[L2[1]][0]), h2.push(z2.$), g2.push(z2._$), H = _2[p2[p2.length - 2]][p2[p2.length - 1]], p2.push(H);
            break;
          case 3:
            return true;
        }
      }
      return true;
    }, "parse")
  };
  z.lexer = /* @__PURE__ */ (function() {
    return {
      EOF: 1,
      parseError: /* @__PURE__ */ __name(function(e2, f2) {
        if (this.yy.parser) this.yy.parser.parseError(e2, f2);
        else throw Error(e2);
      }, "parseError"),
      setInput: /* @__PURE__ */ __name(function(e2, f2) {
        return this.yy = f2 || this.yy || {}, this._input = e2, this._more = this._backtrack = this.done = false, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
          first_line: 1,
          first_column: 0,
          last_line: 1,
          last_column: 0
        }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
      }, "setInput"),
      input: /* @__PURE__ */ __name(function() {
        var e2 = this._input[0];
        return this.yytext += e2, this.yyleng++, this.offset++, this.match += e2, this.matched += e2, e2.match(/(?:\r\n?|\n).*/g) ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), e2;
      }, "input"),
      unput: /* @__PURE__ */ __name(function(e2) {
        var f2 = e2.length, p2 = e2.split(/(?:\r\n?|\n)/g);
        this._input = e2 + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - f2), this.offset -= f2;
        var m2 = 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), p2.length - 1 && (this.yylineno -= p2.length - 1);
        var h2 = 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: p2 ? (p2.length === m2.length ? this.yylloc.first_column : 0) + m2[m2.length - p2.length].length - p2[0].length : this.yylloc.first_column - f2
        }, this.options.ranges && (this.yylloc.range = [h2[0], h2[0] + this.yyleng - f2]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      more: /* @__PURE__ */ __name(function() {
        return this._more = true, this;
      }, "more"),
      reject: /* @__PURE__ */ __name(function() {
        if (this.options.backtrack_lexer) this._backtrack = true;
        else return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
        return this;
      }, "reject"),
      less: /* @__PURE__ */ __name(function(e2) {
        this.unput(this.match.slice(e2));
      }, "less"),
      pastInput: /* @__PURE__ */ __name(function() {
        var e2 = this.matched.substr(0, this.matched.length - this.match.length);
        return (e2.length > 20 ? "..." : "") + e2.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      upcomingInput: /* @__PURE__ */ __name(function() {
        var e2 = this.match;
        return e2.length < 20 && (e2 += this._input.substr(0, 20 - e2.length)), (e2.substr(0, 20) + (e2.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      showPosition: /* @__PURE__ */ __name(function() {
        var e2 = this.pastInput(), f2 = Array(e2.length + 1).join("-");
        return e2 + this.upcomingInput() + "\n" + f2 + "^";
      }, "showPosition"),
      test_match: /* @__PURE__ */ __name(function(e2, f2) {
        var p2, m2, h2;
        if (this.options.backtrack_lexer && (h2 = {
          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 && (h2.yylloc.range = this.yylloc.range.slice(0))), m2 = e2[0].match(/(?:\r\n?|\n).*/g), m2 && (this.yylineno += m2.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: m2 ? m2[m2.length - 1].length - m2[m2.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + e2[0].length
        }, this.yytext += e2[0], this.match += e2[0], this.matches = e2, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = false, this._backtrack = false, this._input = this._input.slice(e2[0].length), this.matched += e2[0], p2 = this.performAction.call(this, this.yy, this, f2, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = false), p2) return p2;
        if (this._backtrack) {
          for (var g2 in h2) this[g2] = h2[g2];
          return false;
        }
        return false;
      }, "test_match"),
      next: /* @__PURE__ */ __name(function() {
        if (this.done) return this.EOF;
        this._input || (this.done = true);
        var e2, f2, p2, m2;
        this._more || (this.yytext = "", this.match = "");
        for (var h2 = this._currentRules(), g2 = 0; g2 < h2.length; g2++) if (p2 = this._input.match(this.rules[h2[g2]]), p2 && (!f2 || p2[0].length > f2[0].length)) {
          if (f2 = p2, m2 = g2, this.options.backtrack_lexer) {
            if (e2 = this.test_match(p2, h2[g2]), e2 !== false) return e2;
            if (this._backtrack) {
              f2 = false;
              continue;
            } else return false;
          } else if (!this.options.flex) break;
        }
        return f2 ? (e2 = this.test_match(f2, h2[m2]), e2 === false ? false : e2) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      lex: /* @__PURE__ */ __name(function() {
        return this.next() || this.lex();
      }, "lex"),
      begin: /* @__PURE__ */ __name(function(e2) {
        this.conditionStack.push(e2);
      }, "begin"),
      popState: /* @__PURE__ */ __name(function() {
        return this.conditionStack.length - 1 > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      _currentRules: /* @__PURE__ */ __name(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      topState: /* @__PURE__ */ __name(function(e2) {
        return e2 = this.conditionStack.length - 1 - Math.abs(e2 || 0), e2 >= 0 ? this.conditionStack[e2] : "INITIAL";
      }, "topState"),
      pushState: /* @__PURE__ */ __name(function(e2) {
        this.begin(e2);
      }, "pushState"),
      stateStackSize: /* @__PURE__ */ __name(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": true },
      performAction: /* @__PURE__ */ __name(function(e2, f2, p2, m2) {
        switch (p2) {
          case 0:
            return this.begin("open_directive"), "open_directive";
          case 1:
            return this.begin("acc_title"), 31;
          case 2:
            return this.popState(), "acc_title_value";
          case 3:
            return this.begin("acc_descr"), 33;
          case 4:
            return this.popState(), "acc_descr_value";
          case 5:
            this.begin("acc_descr_multiline");
            break;
          case 6:
            this.popState();
            break;
          case 7:
            return "acc_descr_multiline_value";
          case 8:
            break;
          case 9:
            break;
          case 10:
            break;
          case 11:
            return 10;
          case 12:
            break;
          case 13:
            break;
          case 14:
            this.begin("href");
            break;
          case 15:
            this.popState();
            break;
          case 16:
            return 43;
          case 17:
            this.begin("callbackname");
            break;
          case 18:
            this.popState();
            break;
          case 19:
            this.popState(), this.begin("callbackargs");
            break;
          case 20:
            return 41;
          case 21:
            this.popState();
            break;
          case 22:
            return 42;
          case 23:
            this.begin("click");
            break;
          case 24:
            this.popState();
            break;
          case 25:
            return 40;
          case 26:
            return 4;
          case 27:
            return 22;
          case 28:
            return 23;
          case 29:
            return 24;
          case 30:
            return 25;
          case 31:
            return 26;
          case 32:
            return 28;
          case 33:
            return 27;
          case 34:
            return 29;
          case 35:
            return 12;
          case 36:
            return 13;
          case 37:
            return 14;
          case 38:
            return 15;
          case 39:
            return 16;
          case 40:
            return 17;
          case 41:
            return 18;
          case 42:
            return 20;
          case 43:
            return 21;
          case 44:
            return "date";
          case 45:
            return 30;
          case 46:
            return "accDescription";
          case 47:
            return 36;
          case 48:
            return 38;
          case 49:
            return 39;
          case 50:
            return ":";
          case 51:
            return 6;
          case 52:
            return "INVALID";
        }
      }, "anonymous"),
      rules: [
        /^(?:%%\{)/i,
        /^(?:accTitle\s*:\s*)/i,
        /^(?:(?!\n||)*[^\n]*)/i,
        /^(?:accDescr\s*:\s*)/i,
        /^(?:(?!\n||)*[^\n]*)/i,
        /^(?:accDescr\s*\{\s*)/i,
        /^(?:[\}])/i,
        /^(?:[^\}]*)/i,
        /^(?:%%(?!\{)*[^\n]*)/i,
        /^(?:[^\}]%%*[^\n]*)/i,
        /^(?:%%*[^\n]*[\n]*)/i,
        /^(?:[\n]+)/i,
        /^(?:\s+)/i,
        /^(?:%[^\n]*)/i,
        /^(?:href[\s]+["])/i,
        /^(?:["])/i,
        /^(?:[^"]*)/i,
        /^(?:call[\s]+)/i,
        /^(?:\([\s]*\))/i,
        /^(?:\()/i,
        /^(?:[^(]*)/i,
        /^(?:\))/i,
        /^(?:[^)]*)/i,
        /^(?:click[\s]+)/i,
        /^(?:[\s\n])/i,
        /^(?:[^\s\n]*)/i,
        /^(?:gantt\b)/i,
        /^(?:dateFormat\s[^#\n;]+)/i,
        /^(?:inclusiveEndDates\b)/i,
        /^(?:topAxis\b)/i,
        /^(?:axisFormat\s[^#\n;]+)/i,
        /^(?:tickInterval\s[^#\n;]+)/i,
        /^(?:includes\s[^#\n;]+)/i,
        /^(?:excludes\s[^#\n;]+)/i,
        /^(?:todayMarker\s[^\n;]+)/i,
        /^(?:weekday\s+monday\b)/i,
        /^(?:weekday\s+tuesday\b)/i,
        /^(?:weekday\s+wednesday\b)/i,
        /^(?:weekday\s+thursday\b)/i,
        /^(?:weekday\s+friday\b)/i,
        /^(?:weekday\s+saturday\b)/i,
        /^(?:weekday\s+sunday\b)/i,
        /^(?:weekend\s+friday\b)/i,
        /^(?:weekend\s+saturday\b)/i,
        /^(?:\d\d\d\d-\d\d-\d\d\b)/i,
        /^(?:title\s[^\n]+)/i,
        /^(?:accDescription\s[^#\n;]+)/i,
        /^(?:section\s[^\n]+)/i,
        /^(?:[^:\n]+)/i,
        /^(?::[^#\n;]+)/i,
        /^(?::)/i,
        /^(?:$)/i,
        /^(?:.)/i
      ],
      conditions: {
        acc_descr_multiline: {
          rules: [6, 7],
          inclusive: false
        },
        acc_descr: {
          rules: [4],
          inclusive: false
        },
        acc_title: {
          rules: [2],
          inclusive: false
        },
        callbackargs: {
          rules: [21, 22],
          inclusive: false
        },
        callbackname: {
          rules: [
            18,
            19,
            20
          ],
          inclusive: false
        },
        href: {
          rules: [15, 16],
          inclusive: false
        },
        click: {
          rules: [24, 25],
          inclusive: false
        },
        INITIAL: {
          rules: [
            0,
            1,
            3,
            5,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            17,
            23,
            26,
            27,
            28,
            29,
            30,
            31,
            32,
            33,
            34,
            35,
            36,
            37,
            38,
            39,
            40,
            41,
            42,
            43,
            44,
            45,
            46,
            47,
            48,
            49,
            50,
            51,
            52
          ],
          inclusive: true
        }
      }
    };
  })();
  function B() {
    this.yy = {};
  }
  return __name(B, "Parser"), B.prototype = z, z.Parser = B, new B();
})();
parser.parser = parser;
var gantt_default = parser;
import_dayjs_min.default.extend(import_isoWeek.default), import_dayjs_min.default.extend(import_customParseFormat.default), import_dayjs_min.default.extend(import_advancedFormat.default);
var WEEKEND_START_DAY = {
  friday: 5,
  saturday: 6
}, dateFormat = "", axisFormat = "", tickInterval = void 0, todayMarker = "", includes = [], excludes = [], links = /* @__PURE__ */ new Map(), sections = [], tasks = [], currentSection = "", displayMode = "", tags = [
  "active",
  "done",
  "crit",
  "milestone",
  "vert"
], funs = [], inclusiveEndDates = false, topAxis = false, weekday = "sunday", weekend = "saturday", lastOrder = 0, clear2 = /* @__PURE__ */ __name(function() {
  sections = [], tasks = [], currentSection = "", funs = [], taskCnt = 0, lastTask = void 0, lastTaskID = void 0, rawTasks = [], dateFormat = "", axisFormat = "", displayMode = "", tickInterval = void 0, todayMarker = "", includes = [], excludes = [], inclusiveEndDates = false, topAxis = false, lastOrder = 0, links = /* @__PURE__ */ new Map(), clear(), weekday = "sunday", weekend = "saturday";
}, "clear"), setAxisFormat = /* @__PURE__ */ __name(function(e) {
  axisFormat = e;
}, "setAxisFormat"), getAxisFormat = /* @__PURE__ */ __name(function() {
  return axisFormat;
}, "getAxisFormat"), setTickInterval = /* @__PURE__ */ __name(function(e) {
  tickInterval = e;
}, "setTickInterval"), getTickInterval = /* @__PURE__ */ __name(function() {
  return tickInterval;
}, "getTickInterval"), setTodayMarker = /* @__PURE__ */ __name(function(e) {
  todayMarker = e;
}, "setTodayMarker"), getTodayMarker = /* @__PURE__ */ __name(function() {
  return todayMarker;
}, "getTodayMarker"), setDateFormat = /* @__PURE__ */ __name(function(e) {
  dateFormat = e;
}, "setDateFormat"), enableInclusiveEndDates = /* @__PURE__ */ __name(function() {
  inclusiveEndDates = true;
}, "enableInclusiveEndDates"), endDatesAreInclusive = /* @__PURE__ */ __name(function() {
  return inclusiveEndDates;
}, "endDatesAreInclusive"), enableTopAxis = /* @__PURE__ */ __name(function() {
  topAxis = true;
}, "enableTopAxis"), topAxisEnabled = /* @__PURE__ */ __name(function() {
  return topAxis;
}, "topAxisEnabled"), setDisplayMode = /* @__PURE__ */ __name(function(e) {
  displayMode = e;
}, "setDisplayMode"), getDisplayMode = /* @__PURE__ */ __name(function() {
  return displayMode;
}, "getDisplayMode"), getDateFormat = /* @__PURE__ */ __name(function() {
  return dateFormat;
}, "getDateFormat"), setIncludes = /* @__PURE__ */ __name(function(e) {
  includes = e.toLowerCase().split(/[\s,]+/);
}, "setIncludes"), getIncludes = /* @__PURE__ */ __name(function() {
  return includes;
}, "getIncludes"), setExcludes = /* @__PURE__ */ __name(function(e) {
  excludes = e.toLowerCase().split(/[\s,]+/);
}, "setExcludes"), getExcludes = /* @__PURE__ */ __name(function() {
  return excludes;
}, "getExcludes"), getLinks = /* @__PURE__ */ __name(function() {
  return links;
}, "getLinks"), addSection = /* @__PURE__ */ __name(function(e) {
  currentSection = e, sections.push(e);
}, "addSection"), getSections = /* @__PURE__ */ __name(function() {
  return sections;
}, "getSections"), getTasks = /* @__PURE__ */ __name(function() {
  let e = compileTasks(), f = 0;
  for (; !e && f < 10; ) e = compileTasks(), f++;
  return tasks = rawTasks, tasks;
}, "getTasks"), isInvalidDate = /* @__PURE__ */ __name(function(e, f, p, m) {
  let h = e.format(f.trim()), g = e.format("YYYY-MM-DD");
  return m.includes(h) || m.includes(g) ? false : p.includes("weekends") && (e.isoWeekday() === WEEKEND_START_DAY[weekend] || e.isoWeekday() === WEEKEND_START_DAY[weekend] + 1) || p.includes(e.format("dddd").toLowerCase()) ? true : p.includes(h) || p.includes(g);
}, "isInvalidDate"), setWeekday = /* @__PURE__ */ __name(function(e) {
  weekday = e;
}, "setWeekday"), getWeekday = /* @__PURE__ */ __name(function() {
  return weekday;
}, "getWeekday"), setWeekend = /* @__PURE__ */ __name(function(e) {
  weekend = e;
}, "setWeekend"), checkTaskDates = /* @__PURE__ */ __name(function(e, f, p, m) {
  if (!p.length || e.manualEndTime) return;
  let h;
  h = e.startTime instanceof Date ? (0, import_dayjs_min.default)(e.startTime) : (0, import_dayjs_min.default)(e.startTime, f, true), h = h.add(1, "d");
  let g;
  g = e.endTime instanceof Date ? (0, import_dayjs_min.default)(e.endTime) : (0, import_dayjs_min.default)(e.endTime, f, true);
  let [_, v] = fixTaskDates(h, g, f, p, m);
  e.endTime = _.toDate(), e.renderEndTime = v;
}, "checkTaskDates"), fixTaskDates = /* @__PURE__ */ __name(function(e, f, p, m, h) {
  let g = false, _ = null;
  for (; e <= f; ) g || (_ = f.toDate()), g = isInvalidDate(e, p, m, h), g && (f = f.add(1, "d")), e = e.add(1, "d");
  return [f, _];
}, "fixTaskDates"), getStartDate = /* @__PURE__ */ __name(function(e, f, p) {
  if (p = p.trim(), (/* @__PURE__ */ __name((e2) => {
    let f2 = e2.trim();
    return f2 === "x" || f2 === "X";
  }, "isTimestampFormat"))(f) && /^\d+$/.test(p)) return new Date(Number(p));
  let m = /^after\s+(?<ids>[\d\w- ]+)/.exec(p);
  if (m !== null) {
    let e2 = null;
    for (let f3 of m.groups.ids.split(" ")) {
      let p2 = findTaskById(f3);
      p2 !== void 0 && (!e2 || p2.endTime > e2.endTime) && (e2 = p2);
    }
    if (e2) return e2.endTime;
    let f2 = /* @__PURE__ */ new Date();
    return f2.setHours(0, 0, 0, 0), f2;
  }
  let h = (0, import_dayjs_min.default)(p, f.trim(), true);
  if (h.isValid()) return h.toDate();
  {
    log.debug("Invalid date:" + p), log.debug("With date format:" + f.trim());
    let e2 = new Date(p);
    if (e2 === void 0 || isNaN(e2.getTime()) || e2.getFullYear() < -1e4 || e2.getFullYear() > 1e4) throw Error("Invalid date:" + p);
    return e2;
  }
}, "getStartDate"), parseDuration = /* @__PURE__ */ __name(function(e) {
  let f = /^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(e.trim());
  return f === null ? [NaN, "ms"] : [Number.parseFloat(f[1]), f[2]];
}, "parseDuration"), getEndDate = /* @__PURE__ */ __name(function(e, f, p, m = false) {
  p = p.trim();
  let h = /^until\s+(?<ids>[\d\w- ]+)/.exec(p);
  if (h !== null) {
    let e2 = null;
    for (let f3 of h.groups.ids.split(" ")) {
      let p2 = findTaskById(f3);
      p2 !== void 0 && (!e2 || p2.startTime < e2.startTime) && (e2 = p2);
    }
    if (e2) return e2.startTime;
    let f2 = /* @__PURE__ */ new Date();
    return f2.setHours(0, 0, 0, 0), f2;
  }
  let g = (0, import_dayjs_min.default)(p, f.trim(), true);
  if (g.isValid()) return m && (g = g.add(1, "d")), g.toDate();
  let _ = (0, import_dayjs_min.default)(e), [v, y] = parseDuration(p);
  if (!Number.isNaN(v)) {
    let e2 = _.add(v, y);
    e2.isValid() && (_ = e2);
  }
  return _.toDate();
}, "getEndDate"), taskCnt = 0, parseId = /* @__PURE__ */ __name(function(e) {
  return e === void 0 ? (taskCnt += 1, "task" + taskCnt) : e;
}, "parseId"), compileData = /* @__PURE__ */ __name(function(e, f) {
  let p;
  p = f.substr(0, 1) === ":" ? f.substr(1, f.length) : f;
  let m = p.split(","), h = {};
  getTaskTags(m, h, tags);
  for (let e2 = 0; e2 < m.length; e2++) m[e2] = m[e2].trim();
  let g = "";
  switch (m.length) {
    case 1:
      h.id = parseId(), h.startTime = e.endTime, g = m[0];
      break;
    case 2:
      h.id = parseId(), h.startTime = getStartDate(void 0, dateFormat, m[0]), g = m[1];
      break;
    case 3:
      h.id = parseId(m[0]), h.startTime = getStartDate(void 0, dateFormat, m[1]), g = m[2];
      break;
    default:
  }
  return g && (h.endTime = getEndDate(h.startTime, dateFormat, g, inclusiveEndDates), h.manualEndTime = (0, import_dayjs_min.default)(g, "YYYY-MM-DD", true).isValid(), checkTaskDates(h, dateFormat, excludes, includes)), h;
}, "compileData"), parseData = /* @__PURE__ */ __name(function(e, f) {
  let p;
  p = f.substr(0, 1) === ":" ? f.substr(1, f.length) : f;
  let m = p.split(","), h = {};
  getTaskTags(m, h, tags);
  for (let e2 = 0; e2 < m.length; e2++) m[e2] = m[e2].trim();
  switch (m.length) {
    case 1:
      h.id = parseId(), h.startTime = {
        type: "prevTaskEnd",
        id: e
      }, h.endTime = { data: m[0] };
      break;
    case 2:
      h.id = parseId(), h.startTime = {
        type: "getStartDate",
        startData: m[0]
      }, h.endTime = { data: m[1] };
      break;
    case 3:
      h.id = parseId(m[0]), h.startTime = {
        type: "getStartDate",
        startData: m[1]
      }, h.endTime = { data: m[2] };
      break;
    default:
  }
  return h;
}, "parseData"), lastTask, lastTaskID, rawTasks = [], taskDb = {}, addTask = /* @__PURE__ */ __name(function(e, f) {
  let p = {
    section: currentSection,
    type: currentSection,
    processed: false,
    manualEndTime: false,
    renderEndTime: null,
    raw: { data: f },
    task: e,
    classes: []
  }, m = parseData(lastTaskID, f);
  p.raw.startTime = m.startTime, p.raw.endTime = m.endTime, p.id = m.id, p.prevTaskId = lastTaskID, p.active = m.active, p.done = m.done, p.crit = m.crit, p.milestone = m.milestone, p.vert = m.vert, p.order = lastOrder, lastOrder++;
  let h = rawTasks.push(p);
  lastTaskID = p.id, taskDb[p.id] = h - 1;
}, "addTask"), findTaskById = /* @__PURE__ */ __name(function(e) {
  let f = taskDb[e];
  return rawTasks[f];
}, "findTaskById"), addTaskOrg = /* @__PURE__ */ __name(function(e, f) {
  let p = {
    section: currentSection,
    type: currentSection,
    description: e,
    task: e,
    classes: []
  }, m = compileData(lastTask, f);
  p.startTime = m.startTime, p.endTime = m.endTime, p.id = m.id, p.active = m.active, p.done = m.done, p.crit = m.crit, p.milestone = m.milestone, p.vert = m.vert, lastTask = p, tasks.push(p);
}, "addTaskOrg"), compileTasks = /* @__PURE__ */ __name(function() {
  let e = /* @__PURE__ */ __name(function(e2) {
    let f2 = rawTasks[e2], p = "";
    switch (rawTasks[e2].raw.startTime.type) {
      case "prevTaskEnd":
        f2.startTime = findTaskById(f2.prevTaskId).endTime;
        break;
      case "getStartDate":
        p = getStartDate(void 0, dateFormat, rawTasks[e2].raw.startTime.startData), p && (rawTasks[e2].startTime = p);
        break;
    }
    return rawTasks[e2].startTime && (rawTasks[e2].endTime = getEndDate(rawTasks[e2].startTime, dateFormat, rawTasks[e2].raw.endTime.data, inclusiveEndDates), rawTasks[e2].endTime && (rawTasks[e2].processed = true, rawTasks[e2].manualEndTime = (0, import_dayjs_min.default)(rawTasks[e2].raw.endTime.data, "YYYY-MM-DD", true).isValid(), checkTaskDates(rawTasks[e2], dateFormat, excludes, includes))), rawTasks[e2].processed;
  }, "compileTask"), f = true;
  for (let [p, m] of rawTasks.entries()) e(p), f && (f = m.processed);
  return f;
}, "compileTasks"), setLink = /* @__PURE__ */ __name(function(e, f) {
  let p = f;
  getConfig2().securityLevel !== "loose" && (p = (0, import_dist.sanitizeUrl)(f)), e.split(",").forEach(function(e2) {
    findTaskById(e2) !== void 0 && (pushFun(e2, () => {
      window.open(p, "_self");
    }), links.set(e2, p));
  }), setClass(e, "clickable");
}, "setLink"), setClass = /* @__PURE__ */ __name(function(e, f) {
  e.split(",").forEach(function(e2) {
    let p = findTaskById(e2);
    p !== void 0 && p.classes.push(f);
  });
}, "setClass"), setClickFun = /* @__PURE__ */ __name(function(e, f, p) {
  if (getConfig2().securityLevel !== "loose" || f === void 0) return;
  let m = [];
  if (typeof p == "string") {
    m = p.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
    for (let e2 = 0; e2 < m.length; e2++) {
      let f2 = m[e2].trim();
      f2.startsWith('"') && f2.endsWith('"') && (f2 = f2.substr(1, f2.length - 2)), m[e2] = f2;
    }
  }
  m.length === 0 && m.push(e), findTaskById(e) !== void 0 && pushFun(e, () => {
    utils_default.runFunc(f, ...m);
  });
}, "setClickFun"), pushFun = /* @__PURE__ */ __name(function(e, f) {
  funs.push(function() {
    let p = document.querySelector(`[id="${e}"]`);
    p !== null && p.addEventListener("click", function() {
      f();
    });
  }, function() {
    let p = document.querySelector(`[id="${e}-text"]`);
    p !== null && p.addEventListener("click", function() {
      f();
    });
  });
}, "pushFun"), ganttDb_default = {
  getConfig: /* @__PURE__ */ __name(() => getConfig2().gantt, "getConfig"),
  clear: clear2,
  setDateFormat,
  getDateFormat,
  enableInclusiveEndDates,
  endDatesAreInclusive,
  enableTopAxis,
  topAxisEnabled,
  setAxisFormat,
  getAxisFormat,
  setTickInterval,
  getTickInterval,
  setTodayMarker,
  getTodayMarker,
  setAccTitle,
  getAccTitle,
  setDiagramTitle,
  getDiagramTitle,
  setDisplayMode,
  getDisplayMode,
  setAccDescription,
  getAccDescription,
  addSection,
  getSections,
  getTasks,
  addTask,
  findTaskById,
  addTaskOrg,
  setIncludes,
  getIncludes,
  setExcludes,
  getExcludes,
  setClickEvent: /* @__PURE__ */ __name(function(e, f, p) {
    e.split(",").forEach(function(e2) {
      setClickFun(e2, f, p);
    }), setClass(e, "clickable");
  }, "setClickEvent"),
  setLink,
  getLinks,
  bindFunctions: /* @__PURE__ */ __name(function(e) {
    funs.forEach(function(f) {
      f(e);
    });
  }, "bindFunctions"),
  parseDuration,
  isInvalidDate,
  setWeekday,
  getWeekday,
  setWeekend
};
function getTaskTags(e, f, p) {
  let m = true;
  for (; m; ) m = false, p.forEach(function(p2) {
    let h = "^\\s*" + p2 + "\\s*$", g = new RegExp(h);
    e[0].match(g) && (f[p2] = true, e.shift(1), m = true);
  });
}
__name(getTaskTags, "getTaskTags"), import_dayjs_min$1.default.extend(import_duration.default);
var setConf = /* @__PURE__ */ __name(function() {
  log.debug("Something is calling, setConf, remove the call");
}, "setConf"), mapWeekdayToTimeFunction = {
  monday: timeMonday,
  tuesday: timeTuesday,
  wednesday: timeWednesday,
  thursday: timeThursday,
  friday: timeFriday,
  saturday: timeSaturday,
  sunday: timeSunday
}, getMaxIntersections = /* @__PURE__ */ __name((e, f) => {
  let p = [...e].map(() => -Infinity), m = [...e].sort((e2, f2) => e2.startTime - f2.startTime || e2.order - f2.order), h = 0;
  for (let e2 of m) for (let m2 = 0; m2 < p.length; m2++) if (e2.startTime >= p[m2]) {
    p[m2] = e2.endTime, e2.order = m2 + f, m2 > h && (h = m2);
    break;
  }
  return h;
}, "getMaxIntersections"), w, MAX_TICK_COUNT = 1e4, diagram = {
  parser: gantt_default,
  db: ganttDb_default,
  renderer: {
    setConf,
    draw: /* @__PURE__ */ __name(function(e, f, x, S) {
      let C = getConfig2().gantt, T = getConfig2().securityLevel, E;
      T === "sandbox" && (E = select_default("#i" + f));
      let D = select_default(T === "sandbox" ? E.nodes()[0].contentDocument.body : "body"), k = T === "sandbox" ? E.nodes()[0].contentDocument : document, M = k.getElementById(f);
      w = M.parentElement.offsetWidth, w === void 0 && (w = 1200), C.useWidth !== void 0 && (w = C.useWidth);
      let F = S.db.getTasks(), R = [];
      for (let e2 of F) R.push(e2.type);
      R = $(R);
      let z = {}, B = 2 * C.topPadding;
      if (S.db.getDisplayMode() === "compact" || C.displayMode === "compact") {
        let e2 = {};
        for (let f3 of F) e2[f3.section] === void 0 ? e2[f3.section] = [f3] : e2[f3.section].push(f3);
        let f2 = 0;
        for (let p of Object.keys(e2)) {
          let m = getMaxIntersections(e2[p], f2) + 1;
          f2 += m, B += m * (C.barHeight + C.barGap), z[p] = m;
        }
      } else {
        B += F.length * (C.barHeight + C.barGap);
        for (let e2 of R) z[e2] = F.filter((f2) => f2.type === e2).length;
      }
      M.setAttribute("viewBox", "0 0 " + w + " " + B);
      let V = D.select(`[id="${f}"]`), H = time().domain([min(F, function(e2) {
        return e2.startTime;
      }), max(F, function(e2) {
        return e2.endTime;
      })]).rangeRound([0, w - C.leftPadding - C.rightPadding]);
      function G(e2, f2) {
        let p = e2.startTime, m = f2.startTime, h = 0;
        return p > m ? h = 1 : p < m && (h = -1), h;
      }
      __name(G, "taskCompare"), F.sort(G), K(F, w, B), configureSvgSize(V, B, w, C.useMaxWidth), V.append("text").text(S.db.getDiagramTitle()).attr("x", w / 2).attr("y", C.titleTopMargin).attr("class", "titleText");
      function K(e2, f2, m) {
        let h = C.barHeight, g = h + C.barGap, _ = C.topPadding, v = C.leftPadding, y = linear().domain([0, R.length]).range(["#00B9FA", "#F95002"]).interpolate(hcl_default);
        J(g, _, v, f2, m, e2, S.db.getExcludes(), S.db.getIncludes()), X(v, _, f2, m), q(e2, g, _, v, h, y, f2, m), Z(g, _, v, h, y), Q(v, _, f2, m);
      }
      __name(K, "makeGantt");
      function q(e2, p, m, h, g, _, v) {
        e2.sort((e3, f2) => e3.vert === f2.vert ? 0 : e3.vert ? 1 : -1);
        let y = [...new Set(e2.map((e3) => e3.order))].map((f2) => e2.find((e3) => e3.order === f2));
        V.append("g").selectAll("rect").data(y).enter().append("rect").attr("x", 0).attr("y", function(e3, f2) {
          return f2 = e3.order, f2 * p + m - 2;
        }).attr("width", function() {
          return v - C.rightPadding / 2;
        }).attr("height", p).attr("class", function(e3) {
          for (let [f2, p2] of R.entries()) if (e3.type === p2) return "section section" + f2 % C.numberSectionStyles;
          return "section section0";
        }).enter();
        let b = V.append("g").selectAll("rect").data(e2).enter(), x2 = S.db.getLinks();
        if (b.append("rect").attr("id", function(e3) {
          return e3.id;
        }).attr("rx", 3).attr("ry", 3).attr("x", function(e3) {
          return e3.milestone ? H(e3.startTime) + h + 0.5 * (H(e3.endTime) - H(e3.startTime)) - 0.5 * g : H(e3.startTime) + h;
        }).attr("y", function(e3, f2) {
          return f2 = e3.order, e3.vert ? C.gridLineStartPadding : f2 * p + m;
        }).attr("width", function(e3) {
          return e3.milestone ? g : e3.vert ? 0.08 * g : H(e3.renderEndTime || e3.endTime) - H(e3.startTime);
        }).attr("height", function(e3) {
          return e3.vert ? F.length * (C.barHeight + C.barGap) + C.barHeight * 2 : g;
        }).attr("transform-origin", function(e3, f2) {
          return f2 = e3.order, (H(e3.startTime) + h + 0.5 * (H(e3.endTime) - H(e3.startTime))).toString() + "px " + (f2 * p + m + 0.5 * g).toString() + "px";
        }).attr("class", function(e3) {
          let f2 = "";
          e3.classes.length > 0 && (f2 = e3.classes.join(" "));
          let p2 = 0;
          for (let [f3, m3] of R.entries()) e3.type === m3 && (p2 = f3 % C.numberSectionStyles);
          let m2 = "";
          return e3.active ? e3.crit ? m2 += " activeCrit" : m2 = " active" : e3.done ? m2 = e3.crit ? " doneCrit" : " done" : e3.crit && (m2 += " crit"), m2.length === 0 && (m2 = " task"), e3.milestone && (m2 = " milestone " + m2), e3.vert && (m2 = " vert " + m2), m2 += p2, m2 += " " + f2, "task" + m2;
        }), b.append("text").attr("id", function(e3) {
          return e3.id + "-text";
        }).text(function(e3) {
          return e3.task;
        }).attr("font-size", C.fontSize).attr("x", function(e3) {
          let f2 = H(e3.startTime), p2 = H(e3.renderEndTime || e3.endTime);
          if (e3.milestone && (f2 += 0.5 * (H(e3.endTime) - H(e3.startTime)) - 0.5 * g, p2 = f2 + g), e3.vert) return H(e3.startTime) + h;
          let m2 = this.getBBox().width;
          return m2 > p2 - f2 ? p2 + m2 + 1.5 * C.leftPadding > v ? f2 + h - 5 : p2 + h + 5 : (p2 - f2) / 2 + f2 + h;
        }).attr("y", function(e3, f2) {
          return e3.vert ? C.gridLineStartPadding + F.length * (C.barHeight + C.barGap) + 60 : (f2 = e3.order, f2 * p + C.barHeight / 2 + (C.fontSize / 2 - 2) + m);
        }).attr("text-height", g).attr("class", function(e3) {
          let f2 = H(e3.startTime), p2 = H(e3.endTime);
          e3.milestone && (p2 = f2 + g);
          let m2 = this.getBBox().width, h2 = "";
          e3.classes.length > 0 && (h2 = e3.classes.join(" "));
          let _2 = 0;
          for (let [f3, p3] of R.entries()) e3.type === p3 && (_2 = f3 % C.numberSectionStyles);
          let y2 = "";
          return e3.active && (y2 = e3.crit ? "activeCritText" + _2 : "activeText" + _2), e3.done ? y2 = e3.crit ? y2 + " doneCritText" + _2 : y2 + " doneText" + _2 : e3.crit && (y2 = y2 + " critText" + _2), e3.milestone && (y2 += " milestoneText"), e3.vert && (y2 += " vertText"), m2 > p2 - f2 ? p2 + m2 + 1.5 * C.leftPadding > v ? h2 + " taskTextOutsideLeft taskTextOutside" + _2 + " " + y2 : h2 + " taskTextOutsideRight taskTextOutside" + _2 + " " + y2 + " width-" + m2 : h2 + " taskText taskText" + _2 + " " + y2 + " width-" + m2;
        }), getConfig2().securityLevel === "sandbox") {
          let e3;
          e3 = select_default("#i" + f);
          let p2 = e3.nodes()[0].contentDocument;
          b.filter(function(e4) {
            return x2.has(e4.id);
          }).each(function(e4) {
            var f2 = p2.querySelector("#" + e4.id), m2 = p2.querySelector("#" + e4.id + "-text");
            let h2 = f2.parentNode;
            var g2 = p2.createElement("a");
            g2.setAttribute("xlink:href", x2.get(e4.id)), g2.setAttribute("target", "_top"), h2.appendChild(g2), g2.appendChild(f2), g2.appendChild(m2);
          });
        }
      }
      __name(q, "drawRects");
      function J(e2, f2, p, m, h, g, _, v) {
        if (_.length === 0 && v.length === 0) return;
        let y, b;
        for (let { startTime: e3, endTime: f3 } of g) (y === void 0 || e3 < y) && (y = e3), (b === void 0 || f3 > b) && (b = f3);
        if (!y || !b) return;
        if ((0, import_dayjs_min$1.default)(b).diff((0, import_dayjs_min$1.default)(y), "year") > 5) {
          log.warn("The difference between the min and max time is more than 5 years. This will cause performance issues. Skipping drawing exclude days.");
          return;
        }
        let x2 = S.db.getDateFormat(), T2 = [], E2 = null, D2 = (0, import_dayjs_min$1.default)(y);
        for (; D2.valueOf() <= b; ) S.db.isInvalidDate(D2, x2, _, v) ? E2 ? E2.end = D2 : E2 = {
          start: D2,
          end: D2
        } : E2 && (E2 = (T2.push(E2), null)), D2 = D2.add(1, "d");
        V.append("g").selectAll("rect").data(T2).enter().append("rect").attr("id", (e3) => "exclude-" + e3.start.format("YYYY-MM-DD")).attr("x", (e3) => H(e3.start.startOf("day")) + p).attr("y", C.gridLineStartPadding).attr("width", (e3) => H(e3.end.endOf("day")) - H(e3.start.startOf("day"))).attr("height", h - f2 - C.gridLineStartPadding).attr("transform-origin", function(f3, m2) {
          return (H(f3.start) + p + 0.5 * (H(f3.end) - H(f3.start))).toString() + "px " + (m2 * e2 + 0.5 * h).toString() + "px";
        }).attr("class", "exclude-range");
      }
      __name(J, "drawExcludeDays");
      function Y(e2, f2, p, m) {
        if (p <= 0 || e2 > f2) return Infinity;
        let h = f2 - e2, g = import_dayjs_min$1.default.duration({ [m ?? "day"]: p }).asMilliseconds();
        return g <= 0 ? Infinity : Math.ceil(h / g);
      }
      __name(Y, "getEstimatedTickCount");
      function X(e2, f2, p, m) {
        let h = S.db.getDateFormat(), g = S.db.getAxisFormat(), x2;
        x2 = g || (h === "D" ? "%d" : C.axisFormat ?? "%Y-%m-%d");
        let T2 = axisBottom(H).tickSize(-m + f2 + C.gridLineStartPadding).tickFormat(timeFormat(x2)), E2 = /^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/.exec(S.db.getTickInterval() || C.tickInterval);
        if (E2 !== null) {
          let e3 = parseInt(E2[1], 10);
          if (isNaN(e3) || e3 <= 0) log.warn(`Invalid tick interval value: "${E2[1]}". Skipping custom tick interval.`);
          else {
            let f3 = E2[2], p2 = S.db.getWeekday() || C.weekday, m2 = H.domain(), h2 = m2[0], g2 = m2[1], x3 = Y(h2, g2, e3, f3);
            if (x3 > MAX_TICK_COUNT) log.warn(`The tick interval "${e3}${f3}" would generate ${x3} ticks, which exceeds the maximum allowed (${MAX_TICK_COUNT}). This may indicate an invalid date or time range. Skipping custom tick interval.`);
            else switch (f3) {
              case "millisecond":
                T2.ticks(millisecond.every(e3));
                break;
              case "second":
                T2.ticks(second.every(e3));
                break;
              case "minute":
                T2.ticks(timeMinute.every(e3));
                break;
              case "hour":
                T2.ticks(timeHour.every(e3));
                break;
              case "day":
                T2.ticks(timeDay.every(e3));
                break;
              case "week":
                T2.ticks(mapWeekdayToTimeFunction[p2].every(e3));
                break;
              case "month":
                T2.ticks(timeMonth.every(e3));
                break;
            }
          }
        }
        if (V.append("g").attr("class", "grid").attr("transform", "translate(" + e2 + ", " + (m - 50) + ")").call(T2).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10).attr("dy", "1em"), S.db.topAxisEnabled() || C.topAxis) {
          let p2 = axisTop(H).tickSize(-m + f2 + C.gridLineStartPadding).tickFormat(timeFormat(x2));
          if (E2 !== null) {
            let e3 = parseInt(E2[1], 10);
            if (isNaN(e3) || e3 <= 0) log.warn(`Invalid tick interval value: "${E2[1]}". Skipping custom tick interval.`);
            else {
              let f3 = E2[2], m2 = S.db.getWeekday() || C.weekday, h2 = H.domain(), g2 = h2[0], x3 = h2[1];
              if (Y(g2, x3, e3, f3) <= MAX_TICK_COUNT) switch (f3) {
                case "millisecond":
                  p2.ticks(millisecond.every(e3));
                  break;
                case "second":
                  p2.ticks(second.every(e3));
                  break;
                case "minute":
                  p2.ticks(timeMinute.every(e3));
                  break;
                case "hour":
                  p2.ticks(timeHour.every(e3));
                  break;
                case "day":
                  p2.ticks(timeDay.every(e3));
                  break;
                case "week":
                  p2.ticks(mapWeekdayToTimeFunction[m2].every(e3));
                  break;
                case "month":
                  p2.ticks(timeMonth.every(e3));
                  break;
              }
            }
          }
          V.append("g").attr("class", "grid").attr("transform", "translate(" + e2 + ", " + f2 + ")").call(p2).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10);
        }
      }
      __name(X, "makeGrid");
      function Z(e2, f2) {
        let p = 0, m = Object.keys(z).map((e3) => [e3, z[e3]]);
        V.append("g").selectAll("text").data(m).enter().append(function(e3) {
          let f3 = e3[0].split(common_default.lineBreakRegex), p2 = -(f3.length - 1) / 2, m2 = k.createElementNS("http://www.w3.org/2000/svg", "text");
          m2.setAttribute("dy", p2 + "em");
          for (let [e4, p3] of f3.entries()) {
            let f4 = k.createElementNS("http://www.w3.org/2000/svg", "tspan");
            f4.setAttribute("alignment-baseline", "central"), f4.setAttribute("x", "10"), e4 > 0 && f4.setAttribute("dy", "1em"), f4.textContent = p3, m2.appendChild(f4);
          }
          return m2;
        }).attr("x", 10).attr("y", function(h, g) {
          if (g > 0) for (let _ = 0; _ < g; _++) return p += m[g - 1][1], h[1] * e2 / 2 + p * e2 + f2;
          else return h[1] * e2 / 2 + f2;
        }).attr("font-size", C.sectionFontSize).attr("class", function(e3) {
          for (let [f3, p2] of R.entries()) if (e3[0] === p2) return "sectionTitle sectionTitle" + f3 % C.numberSectionStyles;
          return "sectionTitle";
        });
      }
      __name(Z, "vertLabels");
      function Q(e2, f2, p, m) {
        let h = S.db.getTodayMarker();
        if (h === "off") return;
        let g = V.append("g").attr("class", "today"), _ = /* @__PURE__ */ new Date(), v = g.append("line");
        v.attr("x1", H(_) + e2).attr("x2", H(_) + e2).attr("y1", C.titleTopMargin).attr("y2", m - C.titleTopMargin).attr("class", "today"), h !== "" && v.attr("style", h.replace(/,/g, ";"));
      }
      __name(Q, "drawToday");
      function $(e2) {
        let f2 = {}, p = [];
        for (let m = 0, h = e2.length; m < h; ++m) Object.prototype.hasOwnProperty.call(f2, e2[m]) || (f2[e2[m]] = true, p.push(e2[m]));
        return p;
      }
      __name($, "checkUnique");
    }, "draw")
  },
  styles: /* @__PURE__ */ __name((e) => `
  .mermaid-main-font {
        font-family: ${e.fontFamily};
  }

  .exclude-range {
    fill: ${e.excludeBkgColor};
  }

  .section {
    stroke: none;
    opacity: 0.2;
  }

  .section0 {
    fill: ${e.sectionBkgColor};
  }

  .section2 {
    fill: ${e.sectionBkgColor2};
  }

  .section1,
  .section3 {
    fill: ${e.altSectionBkgColor};
    opacity: 0.2;
  }

  .sectionTitle0 {
    fill: ${e.titleColor};
  }

  .sectionTitle1 {
    fill: ${e.titleColor};
  }

  .sectionTitle2 {
    fill: ${e.titleColor};
  }

  .sectionTitle3 {
    fill: ${e.titleColor};
  }

  .sectionTitle {
    text-anchor: start;
    font-family: ${e.fontFamily};
  }


  /* Grid and axis */

  .grid .tick {
    stroke: ${e.gridColor};
    opacity: 0.8;
    shape-rendering: crispEdges;
  }

  .grid .tick text {
    font-family: ${e.fontFamily};
    fill: ${e.textColor};
  }

  .grid path {
    stroke-width: 0;
  }


  /* Today line */

  .today {
    fill: none;
    stroke: ${e.todayLineColor};
    stroke-width: 2px;
  }


  /* Task styling */

  /* Default task */

  .task {
    stroke-width: 2;
  }

  .taskText {
    text-anchor: middle;
    font-family: ${e.fontFamily};
  }

  .taskTextOutsideRight {
    fill: ${e.taskTextDarkColor};
    text-anchor: start;
    font-family: ${e.fontFamily};
  }

  .taskTextOutsideLeft {
    fill: ${e.taskTextDarkColor};
    text-anchor: end;
  }


  /* Special case clickable */

  .task.clickable {
    cursor: pointer;
  }

  .taskText.clickable {
    cursor: pointer;
    fill: ${e.taskTextClickableColor} !important;
    font-weight: bold;
  }

  .taskTextOutsideLeft.clickable {
    cursor: pointer;
    fill: ${e.taskTextClickableColor} !important;
    font-weight: bold;
  }

  .taskTextOutsideRight.clickable {
    cursor: pointer;
    fill: ${e.taskTextClickableColor} !important;
    font-weight: bold;
  }


  /* Specific task settings for the sections*/

  .taskText0,
  .taskText1,
  .taskText2,
  .taskText3 {
    fill: ${e.taskTextColor};
  }

  .task0,
  .task1,
  .task2,
  .task3 {
    fill: ${e.taskBkgColor};
    stroke: ${e.taskBorderColor};
  }

  .taskTextOutside0,
  .taskTextOutside2
  {
    fill: ${e.taskTextOutsideColor};
  }

  .taskTextOutside1,
  .taskTextOutside3 {
    fill: ${e.taskTextOutsideColor};
  }


  /* Active task */

  .active0,
  .active1,
  .active2,
  .active3 {
    fill: ${e.activeTaskBkgColor};
    stroke: ${e.activeTaskBorderColor};
  }

  .activeText0,
  .activeText1,
  .activeText2,
  .activeText3 {
    fill: ${e.taskTextDarkColor} !important;
  }


  /* Completed task */

  .done0,
  .done1,
  .done2,
  .done3 {
    stroke: ${e.doneTaskBorderColor};
    fill: ${e.doneTaskBkgColor};
    stroke-width: 2;
  }

  .doneText0,
  .doneText1,
  .doneText2,
  .doneText3 {
    fill: ${e.taskTextDarkColor} !important;
  }


  /* Tasks on the critical line */

  .crit0,
  .crit1,
  .crit2,
  .crit3 {
    stroke: ${e.critBorderColor};
    fill: ${e.critBkgColor};
    stroke-width: 2;
  }

  .activeCrit0,
  .activeCrit1,
  .activeCrit2,
  .activeCrit3 {
    stroke: ${e.critBorderColor};
    fill: ${e.activeTaskBkgColor};
    stroke-width: 2;
  }

  .doneCrit0,
  .doneCrit1,
  .doneCrit2,
  .doneCrit3 {
    stroke: ${e.critBorderColor};
    fill: ${e.doneTaskBkgColor};
    stroke-width: 2;
    cursor: pointer;
    shape-rendering: crispEdges;
  }

  .milestone {
    transform: rotate(45deg) scale(0.8,0.8);
  }

  .milestoneText {
    font-style: italic;
  }
  .doneCritText0,
  .doneCritText1,
  .doneCritText2,
  .doneCritText3 {
    fill: ${e.taskTextDarkColor} !important;
  }

  .vert {
    stroke: ${e.vertLineColor};
  }

  .vertText {
    font-size: 15px;
    text-anchor: middle;
    fill: ${e.vertLineColor} !important;
  }

  .activeCritText0,
  .activeCritText1,
  .activeCritText2,
  .activeCritText3 {
    fill: ${e.taskTextDarkColor} !important;
  }

  .titleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${e.titleColor || e.textColor};
    font-family: ${e.fontFamily};
  }
`, "getStyles")
};
export {
  diagram
};
