UNPKG

116 kBJavaScriptView Raw
1import { J as define, K as extend, R as Rgb, L as Color, M as rgbConvert, N as nogamma, O as hue, P as commonjsGlobal, Q as getDefaultExportFromCjs, c as getConfig, s as setAccTitle, g as getAccTitle, C as setDiagramTitle, D as getDiagramTitle, b as setAccDescription, a as getAccDescription, T as dayjs, E as clear$1, e as dist, A as utils, l as log, j as d3select, k as configureSvgSize, f as common } from "./mermaid-dcacb631.js";
2import { b as bisector, t as tickStep, c as continuous, a as copy, l as linear } from "./linear-0ad15847.js";
3import { i as initRange } from "./init-cc95ec8e.js";
4function max(values, valueof) {
5 let max2;
6 if (valueof === void 0) {
7 for (const value of values) {
8 if (value != null && (max2 < value || max2 === void 0 && value >= value)) {
9 max2 = value;
10 }
11 }
12 } else {
13 let index = -1;
14 for (let value of values) {
15 if ((value = valueof(value, ++index, values)) != null && (max2 < value || max2 === void 0 && value >= value)) {
16 max2 = value;
17 }
18 }
19 }
20 return max2;
21}
22function min(values, valueof) {
23 let min2;
24 if (valueof === void 0) {
25 for (const value of values) {
26 if (value != null && (min2 > value || min2 === void 0 && value >= value)) {
27 min2 = value;
28 }
29 }
30 } else {
31 let index = -1;
32 for (let value of values) {
33 if ((value = valueof(value, ++index, values)) != null && (min2 > value || min2 === void 0 && value >= value)) {
34 min2 = value;
35 }
36 }
37 }
38 return min2;
39}
40function identity(x) {
41 return x;
42}
43var top = 1, right = 2, bottom = 3, left = 4, epsilon = 1e-6;
44function translateX(x) {
45 return "translate(" + x + ",0)";
46}
47function translateY(y) {
48 return "translate(0," + y + ")";
49}
50function number$1(scale) {
51 return (d) => +scale(d);
52}
53function center(scale, offset) {
54 offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
55 if (scale.round())
56 offset = Math.round(offset);
57 return (d) => +scale(d) + offset;
58}
59function entering() {
60 return !this.__axis;
61}
62function axis(orient, scale) {
63 var tickArguments = [], tickValues = null, tickFormat = null, tickSizeInner = 6, tickSizeOuter = 6, tickPadding = 3, offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5, k = orient === top || orient === left ? -1 : 1, x = orient === left || orient === right ? "x" : "y", transform = orient === top || orient === bottom ? translateX : translateY;
64 function axis2(context) {
65 var values = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain() : tickValues, format = tickFormat == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity : tickFormat, spacing = Math.max(tickSizeInner, 0) + tickPadding, range = scale.range(), range0 = +range[0] + offset, range1 = +range[range.length - 1] + offset, position = (scale.bandwidth ? center : number$1)(scale.copy(), offset), selection = context.selection ? context.selection() : context, path = selection.selectAll(".domain").data([null]), tick = selection.selectAll(".tick").data(values, scale).order(), tickExit = tick.exit(), tickEnter = tick.enter().append("g").attr("class", "tick"), line = tick.select("line"), text = tick.select("text");
66 path = path.merge(path.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor"));
67 tick = tick.merge(tickEnter);
68 line = line.merge(tickEnter.append("line").attr("stroke", "currentColor").attr(x + "2", k * tickSizeInner));
69 text = text.merge(tickEnter.append("text").attr("fill", "currentColor").attr(x, k * spacing).attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
70 if (context !== selection) {
71 path = path.transition(context);
72 tick = tick.transition(context);
73 line = line.transition(context);
74 text = text.transition(context);
75 tickExit = tickExit.transition(context).attr("opacity", epsilon).attr("transform", function(d) {
76 return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform");
77 });
78 tickEnter.attr("opacity", epsilon).attr("transform", function(d) {
79 var p = this.parentNode.__axis;
80 return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset);
81 });
82 }
83 tickExit.remove();
84 path.attr("d", orient === left || orient === right ? tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1 : tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1);
85 tick.attr("opacity", 1).attr("transform", function(d) {
86 return transform(position(d) + offset);
87 });
88 line.attr(x + "2", k * tickSizeInner);
89 text.attr(x, k * spacing).text(format);
90 selection.filter(entering).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle");
91 selection.each(function() {
92 this.__axis = position;
93 });
94 }
95 axis2.scale = function(_) {
96 return arguments.length ? (scale = _, axis2) : scale;
97 };
98 axis2.ticks = function() {
99 return tickArguments = Array.from(arguments), axis2;
100 };
101 axis2.tickArguments = function(_) {
102 return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis2) : tickArguments.slice();
103 };
104 axis2.tickValues = function(_) {
105 return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis2) : tickValues && tickValues.slice();
106 };
107 axis2.tickFormat = function(_) {
108 return arguments.length ? (tickFormat = _, axis2) : tickFormat;
109 };
110 axis2.tickSize = function(_) {
111 return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis2) : tickSizeInner;
112 };
113 axis2.tickSizeInner = function(_) {
114 return arguments.length ? (tickSizeInner = +_, axis2) : tickSizeInner;
115 };
116 axis2.tickSizeOuter = function(_) {
117 return arguments.length ? (tickSizeOuter = +_, axis2) : tickSizeOuter;
118 };
119 axis2.tickPadding = function(_) {
120 return arguments.length ? (tickPadding = +_, axis2) : tickPadding;
121 };
122 axis2.offset = function(_) {
123 return arguments.length ? (offset = +_, axis2) : offset;
124 };
125 return axis2;
126}
127function axisTop(scale) {
128 return axis(top, scale);
129}
130function axisBottom(scale) {
131 return axis(bottom, scale);
132}
133const radians = Math.PI / 180;
134const degrees = 180 / Math.PI;
135const K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0$1 = 4 / 29, t1$1 = 6 / 29, t2 = 3 * t1$1 * t1$1, t3 = t1$1 * t1$1 * t1$1;
136function labConvert(o) {
137 if (o instanceof Lab)
138 return new Lab(o.l, o.a, o.b, o.opacity);
139 if (o instanceof Hcl)
140 return hcl2lab(o);
141 if (!(o instanceof Rgb))
142 o = rgbConvert(o);
143 var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b = rgb2lrgb(o.b), y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
144 if (r === g && g === b)
145 x = z = y;
146 else {
147 x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
148 z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
149 }
150 return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
151}
152function lab(l, a, b, opacity) {
153 return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
154}
155function Lab(l, a, b, opacity) {
156 this.l = +l;
157 this.a = +a;
158 this.b = +b;
159 this.opacity = +opacity;
160}
161define(Lab, lab, extend(Color, {
162 brighter(k) {
163 return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
164 },
165 darker(k) {
166 return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
167 },
168 rgb() {
169 var y = (this.l + 16) / 116, x = isNaN(this.a) ? y : y + this.a / 500, z = isNaN(this.b) ? y : y - this.b / 200;
170 x = Xn * lab2xyz(x);
171 y = Yn * lab2xyz(y);
172 z = Zn * lab2xyz(z);
173 return new Rgb(
174 lrgb2rgb(3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
175 lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.033454 * z),
176 lrgb2rgb(0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
177 this.opacity
178 );
179 }
180}));
181function xyz2lab(t) {
182 return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0$1;
183}
184function lab2xyz(t) {
185 return t > t1$1 ? t * t * t : t2 * (t - t0$1);
186}
187function lrgb2rgb(x) {
188 return 255 * (x <= 31308e-7 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
189}
190function rgb2lrgb(x) {
191 return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
192}
193function hclConvert(o) {
194 if (o instanceof Hcl)
195 return new Hcl(o.h, o.c, o.l, o.opacity);
196 if (!(o instanceof Lab))
197 o = labConvert(o);
198 if (o.a === 0 && o.b === 0)
199 return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
200 var h = Math.atan2(o.b, o.a) * degrees;
201 return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
202}
203function hcl$1(h, c, l, opacity) {
204 return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
205}
206function Hcl(h, c, l, opacity) {
207 this.h = +h;
208 this.c = +c;
209 this.l = +l;
210 this.opacity = +opacity;
211}
212function hcl2lab(o) {
213 if (isNaN(o.h))
214 return new Lab(o.l, 0, 0, o.opacity);
215 var h = o.h * radians;
216 return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
217}
218define(Hcl, hcl$1, extend(Color, {
219 brighter(k) {
220 return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
221 },
222 darker(k) {
223 return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
224 },
225 rgb() {
226 return hcl2lab(this).rgb();
227 }
228}));
229function hcl(hue2) {
230 return function(start, end) {
231 var h = hue2((start = hcl$1(start)).h, (end = hcl$1(end)).h), c = nogamma(start.c, end.c), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity);
232 return function(t) {
233 start.h = h(t);
234 start.c = c(t);
235 start.l = l(t);
236 start.opacity = opacity(t);
237 return start + "";
238 };
239 };
240}
241const interpolateHcl = hcl(hue);
242function nice(domain, interval) {
243 domain = domain.slice();
244 var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], t;
245 if (x1 < x0) {
246 t = i0, i0 = i1, i1 = t;
247 t = x0, x0 = x1, x1 = t;
248 }
249 domain[i0] = interval.floor(x0);
250 domain[i1] = interval.ceil(x1);
251 return domain;
252}
253const t0 = /* @__PURE__ */ new Date(), t1 = /* @__PURE__ */ new Date();
254function timeInterval(floori, offseti, count, field) {
255 function interval(date2) {
256 return floori(date2 = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date2)), date2;
257 }
258 interval.floor = (date2) => {
259 return floori(date2 = /* @__PURE__ */ new Date(+date2)), date2;
260 };
261 interval.ceil = (date2) => {
262 return floori(date2 = new Date(date2 - 1)), offseti(date2, 1), floori(date2), date2;
263 };
264 interval.round = (date2) => {
265 const d0 = interval(date2), d1 = interval.ceil(date2);
266 return date2 - d0 < d1 - date2 ? d0 : d1;
267 };
268 interval.offset = (date2, step) => {
269 return offseti(date2 = /* @__PURE__ */ new Date(+date2), step == null ? 1 : Math.floor(step)), date2;
270 };
271 interval.range = (start, stop, step) => {
272 const range = [];
273 start = interval.ceil(start);
274 step = step == null ? 1 : Math.floor(step);
275 if (!(start < stop) || !(step > 0))
276 return range;
277 let previous;
278 do
279 range.push(previous = /* @__PURE__ */ new Date(+start)), offseti(start, step), floori(start);
280 while (previous < start && start < stop);
281 return range;
282 };
283 interval.filter = (test) => {
284 return timeInterval((date2) => {
285 if (date2 >= date2)
286 while (floori(date2), !test(date2))
287 date2.setTime(date2 - 1);
288 }, (date2, step) => {
289 if (date2 >= date2) {
290 if (step < 0)
291 while (++step <= 0) {
292 while (offseti(date2, -1), !test(date2)) {
293 }
294 }
295 else
296 while (--step >= 0) {
297 while (offseti(date2, 1), !test(date2)) {
298 }
299 }
300 }
301 });
302 };
303 if (count) {
304 interval.count = (start, end) => {
305 t0.setTime(+start), t1.setTime(+end);
306 floori(t0), floori(t1);
307 return Math.floor(count(t0, t1));
308 };
309 interval.every = (step) => {
310 step = Math.floor(step);
311 return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? (d) => field(d) % step === 0 : (d) => interval.count(0, d) % step === 0);
312 };
313 }
314 return interval;
315}
316const millisecond = timeInterval(() => {
317}, (date2, step) => {
318 date2.setTime(+date2 + step);
319}, (start, end) => {
320 return end - start;
321});
322millisecond.every = (k) => {
323 k = Math.floor(k);
324 if (!isFinite(k) || !(k > 0))
325 return null;
326 if (!(k > 1))
327 return millisecond;
328 return timeInterval((date2) => {
329 date2.setTime(Math.floor(date2 / k) * k);
330 }, (date2, step) => {
331 date2.setTime(+date2 + step * k);
332 }, (start, end) => {
333 return (end - start) / k;
334 });
335};
336millisecond.range;
337const durationSecond = 1e3;
338const durationMinute = durationSecond * 60;
339const durationHour = durationMinute * 60;
340const durationDay = durationHour * 24;
341const durationWeek = durationDay * 7;
342const durationMonth = durationDay * 30;
343const durationYear = durationDay * 365;
344const second = timeInterval((date2) => {
345 date2.setTime(date2 - date2.getMilliseconds());
346}, (date2, step) => {
347 date2.setTime(+date2 + step * durationSecond);
348}, (start, end) => {
349 return (end - start) / durationSecond;
350}, (date2) => {
351 return date2.getUTCSeconds();
352});
353second.range;
354const timeMinute = timeInterval((date2) => {
355 date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond);
356}, (date2, step) => {
357 date2.setTime(+date2 + step * durationMinute);
358}, (start, end) => {
359 return (end - start) / durationMinute;
360}, (date2) => {
361 return date2.getMinutes();
362});
363timeMinute.range;
364const utcMinute = timeInterval((date2) => {
365 date2.setUTCSeconds(0, 0);
366}, (date2, step) => {
367 date2.setTime(+date2 + step * durationMinute);
368}, (start, end) => {
369 return (end - start) / durationMinute;
370}, (date2) => {
371 return date2.getUTCMinutes();
372});
373utcMinute.range;
374const timeHour = timeInterval((date2) => {
375 date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond - date2.getMinutes() * durationMinute);
376}, (date2, step) => {
377 date2.setTime(+date2 + step * durationHour);
378}, (start, end) => {
379 return (end - start) / durationHour;
380}, (date2) => {
381 return date2.getHours();
382});
383timeHour.range;
384const utcHour = timeInterval((date2) => {
385 date2.setUTCMinutes(0, 0, 0);
386}, (date2, step) => {
387 date2.setTime(+date2 + step * durationHour);
388}, (start, end) => {
389 return (end - start) / durationHour;
390}, (date2) => {
391 return date2.getUTCHours();
392});
393utcHour.range;
394const timeDay = timeInterval(
395 (date2) => date2.setHours(0, 0, 0, 0),
396 (date2, step) => date2.setDate(date2.getDate() + step),
397 (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,
398 (date2) => date2.getDate() - 1
399);
400timeDay.range;
401const utcDay = timeInterval((date2) => {
402 date2.setUTCHours(0, 0, 0, 0);
403}, (date2, step) => {
404 date2.setUTCDate(date2.getUTCDate() + step);
405}, (start, end) => {
406 return (end - start) / durationDay;
407}, (date2) => {
408 return date2.getUTCDate() - 1;
409});
410utcDay.range;
411const unixDay = timeInterval((date2) => {
412 date2.setUTCHours(0, 0, 0, 0);
413}, (date2, step) => {
414 date2.setUTCDate(date2.getUTCDate() + step);
415}, (start, end) => {
416 return (end - start) / durationDay;
417}, (date2) => {
418 return Math.floor(date2 / durationDay);
419});
420unixDay.range;
421function timeWeekday(i) {
422 return timeInterval((date2) => {
423 date2.setDate(date2.getDate() - (date2.getDay() + 7 - i) % 7);
424 date2.setHours(0, 0, 0, 0);
425 }, (date2, step) => {
426 date2.setDate(date2.getDate() + step * 7);
427 }, (start, end) => {
428 return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
429 });
430}
431const timeSunday = timeWeekday(0);
432const timeMonday = timeWeekday(1);
433const timeTuesday = timeWeekday(2);
434const timeWednesday = timeWeekday(3);
435const timeThursday = timeWeekday(4);
436const timeFriday = timeWeekday(5);
437const timeSaturday = timeWeekday(6);
438timeSunday.range;
439timeMonday.range;
440timeTuesday.range;
441timeWednesday.range;
442timeThursday.range;
443timeFriday.range;
444timeSaturday.range;
445function utcWeekday(i) {
446 return timeInterval((date2) => {
447 date2.setUTCDate(date2.getUTCDate() - (date2.getUTCDay() + 7 - i) % 7);
448 date2.setUTCHours(0, 0, 0, 0);
449 }, (date2, step) => {
450 date2.setUTCDate(date2.getUTCDate() + step * 7);
451 }, (start, end) => {
452 return (end - start) / durationWeek;
453 });
454}
455const utcSunday = utcWeekday(0);
456const utcMonday = utcWeekday(1);
457const utcTuesday = utcWeekday(2);
458const utcWednesday = utcWeekday(3);
459const utcThursday = utcWeekday(4);
460const utcFriday = utcWeekday(5);
461const utcSaturday = utcWeekday(6);
462utcSunday.range;
463utcMonday.range;
464utcTuesday.range;
465utcWednesday.range;
466utcThursday.range;
467utcFriday.range;
468utcSaturday.range;
469const timeMonth = timeInterval((date2) => {
470 date2.setDate(1);
471 date2.setHours(0, 0, 0, 0);
472}, (date2, step) => {
473 date2.setMonth(date2.getMonth() + step);
474}, (start, end) => {
475 return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
476}, (date2) => {
477 return date2.getMonth();
478});
479timeMonth.range;
480const utcMonth = timeInterval((date2) => {
481 date2.setUTCDate(1);
482 date2.setUTCHours(0, 0, 0, 0);
483}, (date2, step) => {
484 date2.setUTCMonth(date2.getUTCMonth() + step);
485}, (start, end) => {
486 return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
487}, (date2) => {
488 return date2.getUTCMonth();
489});
490utcMonth.range;
491const timeYear = timeInterval((date2) => {
492 date2.setMonth(0, 1);
493 date2.setHours(0, 0, 0, 0);
494}, (date2, step) => {
495 date2.setFullYear(date2.getFullYear() + step);
496}, (start, end) => {
497 return end.getFullYear() - start.getFullYear();
498}, (date2) => {
499 return date2.getFullYear();
500});
501timeYear.every = (k) => {
502 return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date2) => {
503 date2.setFullYear(Math.floor(date2.getFullYear() / k) * k);
504 date2.setMonth(0, 1);
505 date2.setHours(0, 0, 0, 0);
506 }, (date2, step) => {
507 date2.setFullYear(date2.getFullYear() + step * k);
508 });
509};
510timeYear.range;
511const utcYear = timeInterval((date2) => {
512 date2.setUTCMonth(0, 1);
513 date2.setUTCHours(0, 0, 0, 0);
514}, (date2, step) => {
515 date2.setUTCFullYear(date2.getUTCFullYear() + step);
516}, (start, end) => {
517 return end.getUTCFullYear() - start.getUTCFullYear();
518}, (date2) => {
519 return date2.getUTCFullYear();
520});
521utcYear.every = (k) => {
522 return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date2) => {
523 date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / k) * k);
524 date2.setUTCMonth(0, 1);
525 date2.setUTCHours(0, 0, 0, 0);
526 }, (date2, step) => {
527 date2.setUTCFullYear(date2.getUTCFullYear() + step * k);
528 });
529};
530utcYear.range;
531function ticker(year, month, week, day, hour, minute) {
532 const tickIntervals = [
533 [second, 1, durationSecond],
534 [second, 5, 5 * durationSecond],
535 [second, 15, 15 * durationSecond],
536 [second, 30, 30 * durationSecond],
537 [minute, 1, durationMinute],
538 [minute, 5, 5 * durationMinute],
539 [minute, 15, 15 * durationMinute],
540 [minute, 30, 30 * durationMinute],
541 [hour, 1, durationHour],
542 [hour, 3, 3 * durationHour],
543 [hour, 6, 6 * durationHour],
544 [hour, 12, 12 * durationHour],
545 [day, 1, durationDay],
546 [day, 2, 2 * durationDay],
547 [week, 1, durationWeek],
548 [month, 1, durationMonth],
549 [month, 3, 3 * durationMonth],
550 [year, 1, durationYear]
551 ];
552 function ticks(start, stop, count) {
553 const reverse = stop < start;
554 if (reverse)
555 [start, stop] = [stop, start];
556 const interval = count && typeof count.range === "function" ? count : tickInterval2(start, stop, count);
557 const ticks2 = interval ? interval.range(start, +stop + 1) : [];
558 return reverse ? ticks2.reverse() : ticks2;
559 }
560 function tickInterval2(start, stop, count) {
561 const target = Math.abs(stop - start) / count;
562 const i = bisector(([, , step2]) => step2).right(tickIntervals, target);
563 if (i === tickIntervals.length)
564 return year.every(tickStep(start / durationYear, stop / durationYear, count));
565 if (i === 0)
566 return millisecond.every(Math.max(tickStep(start, stop, count), 1));
567 const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
568 return t.every(step);
569 }
570 return [ticks, tickInterval2];
571}
572const [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);
573function localDate(d) {
574 if (0 <= d.y && d.y < 100) {
575 var date2 = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
576 date2.setFullYear(d.y);
577 return date2;
578 }
579 return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
580}
581function utcDate(d) {
582 if (0 <= d.y && d.y < 100) {
583 var date2 = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
584 date2.setUTCFullYear(d.y);
585 return date2;
586 }
587 return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
588}
589function newDate(y, m, d) {
590 return { y, m, d, H: 0, M: 0, S: 0, L: 0 };
591}
592function formatLocale(locale2) {
593 var locale_dateTime = locale2.dateTime, locale_date = locale2.date, locale_time = locale2.time, locale_periods = locale2.periods, locale_weekdays = locale2.days, locale_shortWeekdays = locale2.shortDays, locale_months = locale2.months, locale_shortMonths = locale2.shortMonths;
594 var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths);
595 var formats = {
596 "a": formatShortWeekday,
597 "A": formatWeekday,
598 "b": formatShortMonth,
599 "B": formatMonth,
600 "c": null,
601 "d": formatDayOfMonth,
602 "e": formatDayOfMonth,
603 "f": formatMicroseconds,
604 "g": formatYearISO,
605 "G": formatFullYearISO,
606 "H": formatHour24,
607 "I": formatHour12,
608 "j": formatDayOfYear,
609 "L": formatMilliseconds,
610 "m": formatMonthNumber,
611 "M": formatMinutes,
612 "p": formatPeriod,
613 "q": formatQuarter,
614 "Q": formatUnixTimestamp,
615 "s": formatUnixTimestampSeconds,
616 "S": formatSeconds,
617 "u": formatWeekdayNumberMonday,
618 "U": formatWeekNumberSunday,
619 "V": formatWeekNumberISO,
620 "w": formatWeekdayNumberSunday,
621 "W": formatWeekNumberMonday,
622 "x": null,
623 "X": null,
624 "y": formatYear,
625 "Y": formatFullYear,
626 "Z": formatZone,
627 "%": formatLiteralPercent
628 };
629 var utcFormats = {
630 "a": formatUTCShortWeekday,
631 "A": formatUTCWeekday,
632 "b": formatUTCShortMonth,
633 "B": formatUTCMonth,
634 "c": null,
635 "d": formatUTCDayOfMonth,
636 "e": formatUTCDayOfMonth,
637 "f": formatUTCMicroseconds,
638 "g": formatUTCYearISO,
639 "G": formatUTCFullYearISO,
640 "H": formatUTCHour24,
641 "I": formatUTCHour12,
642 "j": formatUTCDayOfYear,
643 "L": formatUTCMilliseconds,
644 "m": formatUTCMonthNumber,
645 "M": formatUTCMinutes,
646 "p": formatUTCPeriod,
647 "q": formatUTCQuarter,
648 "Q": formatUnixTimestamp,
649 "s": formatUnixTimestampSeconds,
650 "S": formatUTCSeconds,
651 "u": formatUTCWeekdayNumberMonday,
652 "U": formatUTCWeekNumberSunday,
653 "V": formatUTCWeekNumberISO,
654 "w": formatUTCWeekdayNumberSunday,
655 "W": formatUTCWeekNumberMonday,
656 "x": null,
657 "X": null,
658 "y": formatUTCYear,
659 "Y": formatUTCFullYear,
660 "Z": formatUTCZone,
661 "%": formatLiteralPercent
662 };
663 var parses = {
664 "a": parseShortWeekday,
665 "A": parseWeekday,
666 "b": parseShortMonth,
667 "B": parseMonth,
668 "c": parseLocaleDateTime,
669 "d": parseDayOfMonth,
670 "e": parseDayOfMonth,
671 "f": parseMicroseconds,
672 "g": parseYear,
673 "G": parseFullYear,
674 "H": parseHour24,
675 "I": parseHour24,
676 "j": parseDayOfYear,
677 "L": parseMilliseconds,
678 "m": parseMonthNumber,
679 "M": parseMinutes,
680 "p": parsePeriod,
681 "q": parseQuarter,
682 "Q": parseUnixTimestamp,
683 "s": parseUnixTimestampSeconds,
684 "S": parseSeconds,
685 "u": parseWeekdayNumberMonday,
686 "U": parseWeekNumberSunday,
687 "V": parseWeekNumberISO,
688 "w": parseWeekdayNumberSunday,
689 "W": parseWeekNumberMonday,
690 "x": parseLocaleDate,
691 "X": parseLocaleTime,
692 "y": parseYear,
693 "Y": parseFullYear,
694 "Z": parseZone,
695 "%": parseLiteralPercent
696 };
697 formats.x = newFormat(locale_date, formats);
698 formats.X = newFormat(locale_time, formats);
699 formats.c = newFormat(locale_dateTime, formats);
700 utcFormats.x = newFormat(locale_date, utcFormats);
701 utcFormats.X = newFormat(locale_time, utcFormats);
702 utcFormats.c = newFormat(locale_dateTime, utcFormats);
703 function newFormat(specifier, formats2) {
704 return function(date2) {
705 var string = [], i = -1, j = 0, n = specifier.length, c, pad2, format;
706 if (!(date2 instanceof Date))
707 date2 = /* @__PURE__ */ new Date(+date2);
708 while (++i < n) {
709 if (specifier.charCodeAt(i) === 37) {
710 string.push(specifier.slice(j, i));
711 if ((pad2 = pads[c = specifier.charAt(++i)]) != null)
712 c = specifier.charAt(++i);
713 else
714 pad2 = c === "e" ? " " : "0";
715 if (format = formats2[c])
716 c = format(date2, pad2);
717 string.push(c);
718 j = i + 1;
719 }
720 }
721 string.push(specifier.slice(j, i));
722 return string.join("");
723 };
724 }
725 function newParse(specifier, Z) {
726 return function(string) {
727 var d = newDate(1900, void 0, 1), i = parseSpecifier(d, specifier, string += "", 0), week, day;
728 if (i != string.length)
729 return null;
730 if ("Q" in d)
731 return new Date(d.Q);
732 if ("s" in d)
733 return new Date(d.s * 1e3 + ("L" in d ? d.L : 0));
734 if (Z && !("Z" in d))
735 d.Z = 0;
736 if ("p" in d)
737 d.H = d.H % 12 + d.p * 12;
738 if (d.m === void 0)
739 d.m = "q" in d ? d.q : 0;
740 if ("V" in d) {
741 if (d.V < 1 || d.V > 53)
742 return null;
743 if (!("w" in d))
744 d.w = 1;
745 if ("Z" in d) {
746 week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();
747 week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
748 week = utcDay.offset(week, (d.V - 1) * 7);
749 d.y = week.getUTCFullYear();
750 d.m = week.getUTCMonth();
751 d.d = week.getUTCDate() + (d.w + 6) % 7;
752 } else {
753 week = localDate(newDate(d.y, 0, 1)), day = week.getDay();
754 week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);
755 week = timeDay.offset(week, (d.V - 1) * 7);
756 d.y = week.getFullYear();
757 d.m = week.getMonth();
758 d.d = week.getDate() + (d.w + 6) % 7;
759 }
760 } else if ("W" in d || "U" in d) {
761 if (!("w" in d))
762 d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
763 day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();
764 d.m = 0;
765 d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;
766 }
767 if ("Z" in d) {
768 d.H += d.Z / 100 | 0;
769 d.M += d.Z % 100;
770 return utcDate(d);
771 }
772 return localDate(d);
773 };
774 }
775 function parseSpecifier(d, specifier, string, j) {
776 var i = 0, n = specifier.length, m = string.length, c, parse;
777 while (i < n) {
778 if (j >= m)
779 return -1;
780 c = specifier.charCodeAt(i++);
781 if (c === 37) {
782 c = specifier.charAt(i++);
783 parse = parses[c in pads ? specifier.charAt(i++) : c];
784 if (!parse || (j = parse(d, string, j)) < 0)
785 return -1;
786 } else if (c != string.charCodeAt(j++)) {
787 return -1;
788 }
789 }
790 return j;
791 }
792 function parsePeriod(d, string, i) {
793 var n = periodRe.exec(string.slice(i));
794 return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
795 }
796 function parseShortWeekday(d, string, i) {
797 var n = shortWeekdayRe.exec(string.slice(i));
798 return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
799 }
800 function parseWeekday(d, string, i) {
801 var n = weekdayRe.exec(string.slice(i));
802 return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
803 }
804 function parseShortMonth(d, string, i) {
805 var n = shortMonthRe.exec(string.slice(i));
806 return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
807 }
808 function parseMonth(d, string, i) {
809 var n = monthRe.exec(string.slice(i));
810 return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
811 }
812 function parseLocaleDateTime(d, string, i) {
813 return parseSpecifier(d, locale_dateTime, string, i);
814 }
815 function parseLocaleDate(d, string, i) {
816 return parseSpecifier(d, locale_date, string, i);
817 }
818 function parseLocaleTime(d, string, i) {
819 return parseSpecifier(d, locale_time, string, i);
820 }
821 function formatShortWeekday(d) {
822 return locale_shortWeekdays[d.getDay()];
823 }
824 function formatWeekday(d) {
825 return locale_weekdays[d.getDay()];
826 }
827 function formatShortMonth(d) {
828 return locale_shortMonths[d.getMonth()];
829 }
830 function formatMonth(d) {
831 return locale_months[d.getMonth()];
832 }
833 function formatPeriod(d) {
834 return locale_periods[+(d.getHours() >= 12)];
835 }
836 function formatQuarter(d) {
837 return 1 + ~~(d.getMonth() / 3);
838 }
839 function formatUTCShortWeekday(d) {
840 return locale_shortWeekdays[d.getUTCDay()];
841 }
842 function formatUTCWeekday(d) {
843 return locale_weekdays[d.getUTCDay()];
844 }
845 function formatUTCShortMonth(d) {
846 return locale_shortMonths[d.getUTCMonth()];
847 }
848 function formatUTCMonth(d) {
849 return locale_months[d.getUTCMonth()];
850 }
851 function formatUTCPeriod(d) {
852 return locale_periods[+(d.getUTCHours() >= 12)];
853 }
854 function formatUTCQuarter(d) {
855 return 1 + ~~(d.getUTCMonth() / 3);
856 }
857 return {
858 format: function(specifier) {
859 var f = newFormat(specifier += "", formats);
860 f.toString = function() {
861 return specifier;
862 };
863 return f;
864 },
865 parse: function(specifier) {
866 var p = newParse(specifier += "", false);
867 p.toString = function() {
868 return specifier;
869 };
870 return p;
871 },
872 utcFormat: function(specifier) {
873 var f = newFormat(specifier += "", utcFormats);
874 f.toString = function() {
875 return specifier;
876 };
877 return f;
878 },
879 utcParse: function(specifier) {
880 var p = newParse(specifier += "", true);
881 p.toString = function() {
882 return specifier;
883 };
884 return p;
885 }
886 };
887}
888var pads = { "-": "", "_": " ", "0": "0" }, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g;
889function pad(value, fill, width) {
890 var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length;
891 return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
892}
893function requote(s) {
894 return s.replace(requoteRe, "\\$&");
895}
896function formatRe(names) {
897 return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
898}
899function formatLookup(names) {
900 return new Map(names.map((name, i) => [name.toLowerCase(), i]));
901}
902function parseWeekdayNumberSunday(d, string, i) {
903 var n = numberRe.exec(string.slice(i, i + 1));
904 return n ? (d.w = +n[0], i + n[0].length) : -1;
905}
906function parseWeekdayNumberMonday(d, string, i) {
907 var n = numberRe.exec(string.slice(i, i + 1));
908 return n ? (d.u = +n[0], i + n[0].length) : -1;
909}
910function parseWeekNumberSunday(d, string, i) {
911 var n = numberRe.exec(string.slice(i, i + 2));
912 return n ? (d.U = +n[0], i + n[0].length) : -1;
913}
914function parseWeekNumberISO(d, string, i) {
915 var n = numberRe.exec(string.slice(i, i + 2));
916 return n ? (d.V = +n[0], i + n[0].length) : -1;
917}
918function parseWeekNumberMonday(d, string, i) {
919 var n = numberRe.exec(string.slice(i, i + 2));
920 return n ? (d.W = +n[0], i + n[0].length) : -1;
921}
922function parseFullYear(d, string, i) {
923 var n = numberRe.exec(string.slice(i, i + 4));
924 return n ? (d.y = +n[0], i + n[0].length) : -1;
925}
926function parseYear(d, string, i) {
927 var n = numberRe.exec(string.slice(i, i + 2));
928 return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), i + n[0].length) : -1;
929}
930function parseZone(d, string, i) {
931 var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
932 return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
933}
934function parseQuarter(d, string, i) {
935 var n = numberRe.exec(string.slice(i, i + 1));
936 return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;
937}
938function parseMonthNumber(d, string, i) {
939 var n = numberRe.exec(string.slice(i, i + 2));
940 return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
941}
942function parseDayOfMonth(d, string, i) {
943 var n = numberRe.exec(string.slice(i, i + 2));
944 return n ? (d.d = +n[0], i + n[0].length) : -1;
945}
946function parseDayOfYear(d, string, i) {
947 var n = numberRe.exec(string.slice(i, i + 3));
948 return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
949}
950function parseHour24(d, string, i) {
951 var n = numberRe.exec(string.slice(i, i + 2));
952 return n ? (d.H = +n[0], i + n[0].length) : -1;
953}
954function parseMinutes(d, string, i) {
955 var n = numberRe.exec(string.slice(i, i + 2));
956 return n ? (d.M = +n[0], i + n[0].length) : -1;
957}
958function parseSeconds(d, string, i) {
959 var n = numberRe.exec(string.slice(i, i + 2));
960 return n ? (d.S = +n[0], i + n[0].length) : -1;
961}
962function parseMilliseconds(d, string, i) {
963 var n = numberRe.exec(string.slice(i, i + 3));
964 return n ? (d.L = +n[0], i + n[0].length) : -1;
965}
966function parseMicroseconds(d, string, i) {
967 var n = numberRe.exec(string.slice(i, i + 6));
968 return n ? (d.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1;
969}
970function parseLiteralPercent(d, string, i) {
971 var n = percentRe.exec(string.slice(i, i + 1));
972 return n ? i + n[0].length : -1;
973}
974function parseUnixTimestamp(d, string, i) {
975 var n = numberRe.exec(string.slice(i));
976 return n ? (d.Q = +n[0], i + n[0].length) : -1;
977}
978function parseUnixTimestampSeconds(d, string, i) {
979 var n = numberRe.exec(string.slice(i));
980 return n ? (d.s = +n[0], i + n[0].length) : -1;
981}
982function formatDayOfMonth(d, p) {
983 return pad(d.getDate(), p, 2);
984}
985function formatHour24(d, p) {
986 return pad(d.getHours(), p, 2);
987}
988function formatHour12(d, p) {
989 return pad(d.getHours() % 12 || 12, p, 2);
990}
991function formatDayOfYear(d, p) {
992 return pad(1 + timeDay.count(timeYear(d), d), p, 3);
993}
994function formatMilliseconds(d, p) {
995 return pad(d.getMilliseconds(), p, 3);
996}
997function formatMicroseconds(d, p) {
998 return formatMilliseconds(d, p) + "000";
999}
1000function formatMonthNumber(d, p) {
1001 return pad(d.getMonth() + 1, p, 2);
1002}
1003function formatMinutes(d, p) {
1004 return pad(d.getMinutes(), p, 2);
1005}
1006function formatSeconds(d, p) {
1007 return pad(d.getSeconds(), p, 2);
1008}
1009function formatWeekdayNumberMonday(d) {
1010 var day = d.getDay();
1011 return day === 0 ? 7 : day;
1012}
1013function formatWeekNumberSunday(d, p) {
1014 return pad(timeSunday.count(timeYear(d) - 1, d), p, 2);
1015}
1016function dISO(d) {
1017 var day = d.getDay();
1018 return day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d);
1019}
1020function formatWeekNumberISO(d, p) {
1021 d = dISO(d);
1022 return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);
1023}
1024function formatWeekdayNumberSunday(d) {
1025 return d.getDay();
1026}
1027function formatWeekNumberMonday(d, p) {
1028 return pad(timeMonday.count(timeYear(d) - 1, d), p, 2);
1029}
1030function formatYear(d, p) {
1031 return pad(d.getFullYear() % 100, p, 2);
1032}
1033function formatYearISO(d, p) {
1034 d = dISO(d);
1035 return pad(d.getFullYear() % 100, p, 2);
1036}
1037function formatFullYear(d, p) {
1038 return pad(d.getFullYear() % 1e4, p, 4);
1039}
1040function formatFullYearISO(d, p) {
1041 var day = d.getDay();
1042 d = day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d);
1043 return pad(d.getFullYear() % 1e4, p, 4);
1044}
1045function formatZone(d) {
1046 var z = d.getTimezoneOffset();
1047 return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2);
1048}
1049function formatUTCDayOfMonth(d, p) {
1050 return pad(d.getUTCDate(), p, 2);
1051}
1052function formatUTCHour24(d, p) {
1053 return pad(d.getUTCHours(), p, 2);
1054}
1055function formatUTCHour12(d, p) {
1056 return pad(d.getUTCHours() % 12 || 12, p, 2);
1057}
1058function formatUTCDayOfYear(d, p) {
1059 return pad(1 + utcDay.count(utcYear(d), d), p, 3);
1060}
1061function formatUTCMilliseconds(d, p) {
1062 return pad(d.getUTCMilliseconds(), p, 3);
1063}
1064function formatUTCMicroseconds(d, p) {
1065 return formatUTCMilliseconds(d, p) + "000";
1066}
1067function formatUTCMonthNumber(d, p) {
1068 return pad(d.getUTCMonth() + 1, p, 2);
1069}
1070function formatUTCMinutes(d, p) {
1071 return pad(d.getUTCMinutes(), p, 2);
1072}
1073function formatUTCSeconds(d, p) {
1074 return pad(d.getUTCSeconds(), p, 2);
1075}
1076function formatUTCWeekdayNumberMonday(d) {
1077 var dow = d.getUTCDay();
1078 return dow === 0 ? 7 : dow;
1079}
1080function formatUTCWeekNumberSunday(d, p) {
1081 return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);
1082}
1083function UTCdISO(d) {
1084 var day = d.getUTCDay();
1085 return day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d);
1086}
1087function formatUTCWeekNumberISO(d, p) {
1088 d = UTCdISO(d);
1089 return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
1090}
1091function formatUTCWeekdayNumberSunday(d) {
1092 return d.getUTCDay();
1093}
1094function formatUTCWeekNumberMonday(d, p) {
1095 return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);
1096}
1097function formatUTCYear(d, p) {
1098 return pad(d.getUTCFullYear() % 100, p, 2);
1099}
1100function formatUTCYearISO(d, p) {
1101 d = UTCdISO(d);
1102 return pad(d.getUTCFullYear() % 100, p, 2);
1103}
1104function formatUTCFullYear(d, p) {
1105 return pad(d.getUTCFullYear() % 1e4, p, 4);
1106}
1107function formatUTCFullYearISO(d, p) {
1108 var day = d.getUTCDay();
1109 d = day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d);
1110 return pad(d.getUTCFullYear() % 1e4, p, 4);
1111}
1112function formatUTCZone() {
1113 return "+0000";
1114}
1115function formatLiteralPercent() {
1116 return "%";
1117}
1118function formatUnixTimestamp(d) {
1119 return +d;
1120}
1121function formatUnixTimestampSeconds(d) {
1122 return Math.floor(+d / 1e3);
1123}
1124var locale;
1125var timeFormat;
1126defaultLocale({
1127 dateTime: "%x, %X",
1128 date: "%-m/%-d/%Y",
1129 time: "%-I:%M:%S %p",
1130 periods: ["AM", "PM"],
1131 days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
1132 shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
1133 months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
1134 shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
1135});
1136function defaultLocale(definition) {
1137 locale = formatLocale(definition);
1138 timeFormat = locale.format;
1139 locale.parse;
1140 locale.utcFormat;
1141 locale.utcParse;
1142 return locale;
1143}
1144function date(t) {
1145 return new Date(t);
1146}
1147function number(t) {
1148 return t instanceof Date ? +t : +/* @__PURE__ */ new Date(+t);
1149}
1150function calendar(ticks, tickInterval2, year, month, week, day, hour, minute, second2, format) {
1151 var scale = continuous(), invert = scale.invert, domain = scale.domain;
1152 var formatMillisecond = format(".%L"), formatSecond = format(":%S"), formatMinute = format("%I:%M"), formatHour = format("%I %p"), formatDay = format("%a %d"), formatWeek = format("%b %d"), formatMonth = format("%B"), formatYear2 = format("%Y");
1153 function tickFormat(date2) {
1154 return (second2(date2) < date2 ? formatMillisecond : minute(date2) < date2 ? formatSecond : hour(date2) < date2 ? formatMinute : day(date2) < date2 ? formatHour : month(date2) < date2 ? week(date2) < date2 ? formatDay : formatWeek : year(date2) < date2 ? formatMonth : formatYear2)(date2);
1155 }
1156 scale.invert = function(y) {
1157 return new Date(invert(y));
1158 };
1159 scale.domain = function(_) {
1160 return arguments.length ? domain(Array.from(_, number)) : domain().map(date);
1161 };
1162 scale.ticks = function(interval) {
1163 var d = domain();
1164 return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval);
1165 };
1166 scale.tickFormat = function(count, specifier) {
1167 return specifier == null ? tickFormat : format(specifier);
1168 };
1169 scale.nice = function(interval) {
1170 var d = domain();
1171 if (!interval || typeof interval.range !== "function")
1172 interval = tickInterval2(d[0], d[d.length - 1], interval == null ? 10 : interval);
1173 return interval ? domain(nice(d, interval)) : scale;
1174 };
1175 scale.copy = function() {
1176 return copy(scale, calendar(ticks, tickInterval2, year, month, week, day, hour, minute, second2, format));
1177 };
1178 return scale;
1179}
1180function time() {
1181 return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute, second, timeFormat).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments);
1182}
1183var parser = function() {
1184 var o = function(k, v, o2, l) {
1185 for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
1186 ;
1187 return o2;
1188 }, $V0 = [6, 8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 32, 33, 35, 37], $V1 = [1, 25], $V2 = [1, 26], $V3 = [1, 27], $V4 = [1, 28], $V5 = [1, 29], $V6 = [1, 30], $V7 = [1, 31], $V8 = [1, 9], $V9 = [1, 10], $Va = [1, 11], $Vb = [1, 12], $Vc = [1, 13], $Vd = [1, 14], $Ve = [1, 15], $Vf = [1, 16], $Vg = [1, 18], $Vh = [1, 19], $Vi = [1, 20], $Vj = [1, 21], $Vk = [1, 22], $Vl = [1, 24], $Vm = [1, 32];
1189 var parser2 = {
1190 trace: function trace() {
1191 },
1192 yy: {},
1193 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, "dateFormat": 19, "inclusiveEndDates": 20, "topAxis": 21, "axisFormat": 22, "tickInterval": 23, "excludes": 24, "includes": 25, "todayMarker": 26, "title": 27, "acc_title": 28, "acc_title_value": 29, "acc_descr": 30, "acc_descr_value": 31, "acc_descr_multiline_value": 32, "section": 33, "clickStatement": 34, "taskTxt": 35, "taskData": 36, "click": 37, "callbackname": 38, "callbackargs": 39, "href": 40, "clickStatementDebug": 41, "$accept": 0, "$end": 1 },
1194 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", 19: "dateFormat", 20: "inclusiveEndDates", 21: "topAxis", 22: "axisFormat", 23: "tickInterval", 24: "excludes", 25: "includes", 26: "todayMarker", 27: "title", 28: "acc_title", 29: "acc_title_value", 30: "acc_descr", 31: "acc_descr_value", 32: "acc_descr_multiline_value", 33: "section", 35: "taskTxt", 36: "taskData", 37: "click", 38: "callbackname", 39: "callbackargs", 40: "href" },
1195 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], [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], [34, 2], [34, 3], [34, 3], [34, 4], [34, 3], [34, 4], [34, 2], [41, 2], [41, 3], [41, 3], [41, 4], [41, 3], [41, 4], [41, 2]],
1196 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
1197 var $0 = $$.length - 1;
1198 switch (yystate) {
1199 case 1:
1200 return $$[$0 - 1];
1201 case 2:
1202 this.$ = [];
1203 break;
1204 case 3:
1205 $$[$0 - 1].push($$[$0]);
1206 this.$ = $$[$0 - 1];
1207 break;
1208 case 4:
1209 case 5:
1210 this.$ = $$[$0];
1211 break;
1212 case 6:
1213 case 7:
1214 this.$ = [];
1215 break;
1216 case 8:
1217 yy.setWeekday("monday");
1218 break;
1219 case 9:
1220 yy.setWeekday("tuesday");
1221 break;
1222 case 10:
1223 yy.setWeekday("wednesday");
1224 break;
1225 case 11:
1226 yy.setWeekday("thursday");
1227 break;
1228 case 12:
1229 yy.setWeekday("friday");
1230 break;
1231 case 13:
1232 yy.setWeekday("saturday");
1233 break;
1234 case 14:
1235 yy.setWeekday("sunday");
1236 break;
1237 case 15:
1238 yy.setDateFormat($$[$0].substr(11));
1239 this.$ = $$[$0].substr(11);
1240 break;
1241 case 16:
1242 yy.enableInclusiveEndDates();
1243 this.$ = $$[$0].substr(18);
1244 break;
1245 case 17:
1246 yy.TopAxis();
1247 this.$ = $$[$0].substr(8);
1248 break;
1249 case 18:
1250 yy.setAxisFormat($$[$0].substr(11));
1251 this.$ = $$[$0].substr(11);
1252 break;
1253 case 19:
1254 yy.setTickInterval($$[$0].substr(13));
1255 this.$ = $$[$0].substr(13);
1256 break;
1257 case 20:
1258 yy.setExcludes($$[$0].substr(9));
1259 this.$ = $$[$0].substr(9);
1260 break;
1261 case 21:
1262 yy.setIncludes($$[$0].substr(9));
1263 this.$ = $$[$0].substr(9);
1264 break;
1265 case 22:
1266 yy.setTodayMarker($$[$0].substr(12));
1267 this.$ = $$[$0].substr(12);
1268 break;
1269 case 24:
1270 yy.setDiagramTitle($$[$0].substr(6));
1271 this.$ = $$[$0].substr(6);
1272 break;
1273 case 25:
1274 this.$ = $$[$0].trim();
1275 yy.setAccTitle(this.$);
1276 break;
1277 case 26:
1278 case 27:
1279 this.$ = $$[$0].trim();
1280 yy.setAccDescription(this.$);
1281 break;
1282 case 28:
1283 yy.addSection($$[$0].substr(8));
1284 this.$ = $$[$0].substr(8);
1285 break;
1286 case 30:
1287 yy.addTask($$[$0 - 1], $$[$0]);
1288 this.$ = "task";
1289 break;
1290 case 31:
1291 this.$ = $$[$0 - 1];
1292 yy.setClickEvent($$[$0 - 1], $$[$0], null);
1293 break;
1294 case 32:
1295 this.$ = $$[$0 - 2];
1296 yy.setClickEvent($$[$0 - 2], $$[$0 - 1], $$[$0]);
1297 break;
1298 case 33:
1299 this.$ = $$[$0 - 2];
1300 yy.setClickEvent($$[$0 - 2], $$[$0 - 1], null);
1301 yy.setLink($$[$0 - 2], $$[$0]);
1302 break;
1303 case 34:
1304 this.$ = $$[$0 - 3];
1305 yy.setClickEvent($$[$0 - 3], $$[$0 - 2], $$[$0 - 1]);
1306 yy.setLink($$[$0 - 3], $$[$0]);
1307 break;
1308 case 35:
1309 this.$ = $$[$0 - 2];
1310 yy.setClickEvent($$[$0 - 2], $$[$0], null);
1311 yy.setLink($$[$0 - 2], $$[$0 - 1]);
1312 break;
1313 case 36:
1314 this.$ = $$[$0 - 3];
1315 yy.setClickEvent($$[$0 - 3], $$[$0 - 1], $$[$0]);
1316 yy.setLink($$[$0 - 3], $$[$0 - 2]);
1317 break;
1318 case 37:
1319 this.$ = $$[$0 - 1];
1320 yy.setLink($$[$0 - 1], $$[$0]);
1321 break;
1322 case 38:
1323 case 44:
1324 this.$ = $$[$0 - 1] + " " + $$[$0];
1325 break;
1326 case 39:
1327 case 40:
1328 case 42:
1329 this.$ = $$[$0 - 2] + " " + $$[$0 - 1] + " " + $$[$0];
1330 break;
1331 case 41:
1332 case 43:
1333 this.$ = $$[$0 - 3] + " " + $$[$0 - 2] + " " + $$[$0 - 1] + " " + $$[$0];
1334 break;
1335 }
1336 },
1337 table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 17, 12: $V1, 13: $V2, 14: $V3, 15: $V4, 16: $V5, 17: $V6, 18: $V7, 19: $V8, 20: $V9, 21: $Va, 22: $Vb, 23: $Vc, 24: $Vd, 25: $Ve, 26: $Vf, 27: $Vg, 28: $Vh, 30: $Vi, 32: $Vj, 33: $Vk, 34: 23, 35: $Vl, 37: $Vm }, o($V0, [2, 7], { 1: [2, 1] }), o($V0, [2, 3]), { 9: 33, 11: 17, 12: $V1, 13: $V2, 14: $V3, 15: $V4, 16: $V5, 17: $V6, 18: $V7, 19: $V8, 20: $V9, 21: $Va, 22: $Vb, 23: $Vc, 24: $Vd, 25: $Ve, 26: $Vf, 27: $Vg, 28: $Vh, 30: $Vi, 32: $Vj, 33: $Vk, 34: 23, 35: $Vl, 37: $Vm }, o($V0, [2, 5]), o($V0, [2, 6]), o($V0, [2, 15]), o($V0, [2, 16]), o($V0, [2, 17]), o($V0, [2, 18]), o($V0, [2, 19]), o($V0, [2, 20]), o($V0, [2, 21]), o($V0, [2, 22]), o($V0, [2, 23]), o($V0, [2, 24]), { 29: [1, 34] }, { 31: [1, 35] }, o($V0, [2, 27]), o($V0, [2, 28]), o($V0, [2, 29]), { 36: [1, 36] }, o($V0, [2, 8]), o($V0, [2, 9]), o($V0, [2, 10]), o($V0, [2, 11]), o($V0, [2, 12]), o($V0, [2, 13]), o($V0, [2, 14]), { 38: [1, 37], 40: [1, 38] }, o($V0, [2, 4]), o($V0, [2, 25]), o($V0, [2, 26]), o($V0, [2, 30]), o($V0, [2, 31], { 39: [1, 39], 40: [1, 40] }), o($V0, [2, 37], { 38: [1, 41] }), o($V0, [2, 32], { 40: [1, 42] }), o($V0, [2, 33]), o($V0, [2, 35], { 39: [1, 43] }), o($V0, [2, 34]), o($V0, [2, 36])],
1338 defaultActions: {},
1339 parseError: function parseError(str, hash) {
1340 if (hash.recoverable) {
1341 this.trace(str);
1342 } else {
1343 var error = new Error(str);
1344 error.hash = hash;
1345 throw error;
1346 }
1347 },
1348 parse: function parse(input) {
1349 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
1350 var args = lstack.slice.call(arguments, 1);
1351 var lexer2 = Object.create(this.lexer);
1352 var sharedState = { yy: {} };
1353 for (var k in this.yy) {
1354 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
1355 sharedState.yy[k] = this.yy[k];
1356 }
1357 }
1358 lexer2.setInput(input, sharedState.yy);
1359 sharedState.yy.lexer = lexer2;
1360 sharedState.yy.parser = this;
1361 if (typeof lexer2.yylloc == "undefined") {
1362 lexer2.yylloc = {};
1363 }
1364 var yyloc = lexer2.yylloc;
1365 lstack.push(yyloc);
1366 var ranges = lexer2.options && lexer2.options.ranges;
1367 if (typeof sharedState.yy.parseError === "function") {
1368 this.parseError = sharedState.yy.parseError;
1369 } else {
1370 this.parseError = Object.getPrototypeOf(this).parseError;
1371 }
1372 function lex() {
1373 var token;
1374 token = tstack.pop() || lexer2.lex() || EOF;
1375 if (typeof token !== "number") {
1376 if (token instanceof Array) {
1377 tstack = token;
1378 token = tstack.pop();
1379 }
1380 token = self.symbols_[token] || token;
1381 }
1382 return token;
1383 }
1384 var symbol, state, action, r, yyval = {}, p, len, newState, expected;
1385 while (true) {
1386 state = stack[stack.length - 1];
1387 if (this.defaultActions[state]) {
1388 action = this.defaultActions[state];
1389 } else {
1390 if (symbol === null || typeof symbol == "undefined") {
1391 symbol = lex();
1392 }
1393 action = table[state] && table[state][symbol];
1394 }
1395 if (typeof action === "undefined" || !action.length || !action[0]) {
1396 var errStr = "";
1397 expected = [];
1398 for (p in table[state]) {
1399 if (this.terminals_[p] && p > TERROR) {
1400 expected.push("'" + this.terminals_[p] + "'");
1401 }
1402 }
1403 if (lexer2.showPosition) {
1404 errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
1405 } else {
1406 errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
1407 }
1408 this.parseError(errStr, {
1409 text: lexer2.match,
1410 token: this.terminals_[symbol] || symbol,
1411 line: lexer2.yylineno,
1412 loc: yyloc,
1413 expected
1414 });
1415 }
1416 if (action[0] instanceof Array && action.length > 1) {
1417 throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
1418 }
1419 switch (action[0]) {
1420 case 1:
1421 stack.push(symbol);
1422 vstack.push(lexer2.yytext);
1423 lstack.push(lexer2.yylloc);
1424 stack.push(action[1]);
1425 symbol = null;
1426 {
1427 yyleng = lexer2.yyleng;
1428 yytext = lexer2.yytext;
1429 yylineno = lexer2.yylineno;
1430 yyloc = lexer2.yylloc;
1431 }
1432 break;
1433 case 2:
1434 len = this.productions_[action[1]][1];
1435 yyval.$ = vstack[vstack.length - len];
1436 yyval._$ = {
1437 first_line: lstack[lstack.length - (len || 1)].first_line,
1438 last_line: lstack[lstack.length - 1].last_line,
1439 first_column: lstack[lstack.length - (len || 1)].first_column,
1440 last_column: lstack[lstack.length - 1].last_column
1441 };
1442 if (ranges) {
1443 yyval._$.range = [
1444 lstack[lstack.length - (len || 1)].range[0],
1445 lstack[lstack.length - 1].range[1]
1446 ];
1447 }
1448 r = this.performAction.apply(yyval, [
1449 yytext,
1450 yyleng,
1451 yylineno,
1452 sharedState.yy,
1453 action[1],
1454 vstack,
1455 lstack
1456 ].concat(args));
1457 if (typeof r !== "undefined") {
1458 return r;
1459 }
1460 if (len) {
1461 stack = stack.slice(0, -1 * len * 2);
1462 vstack = vstack.slice(0, -1 * len);
1463 lstack = lstack.slice(0, -1 * len);
1464 }
1465 stack.push(this.productions_[action[1]][0]);
1466 vstack.push(yyval.$);
1467 lstack.push(yyval._$);
1468 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
1469 stack.push(newState);
1470 break;
1471 case 3:
1472 return true;
1473 }
1474 }
1475 return true;
1476 }
1477 };
1478 var lexer = function() {
1479 var lexer2 = {
1480 EOF: 1,
1481 parseError: function parseError(str, hash) {
1482 if (this.yy.parser) {
1483 this.yy.parser.parseError(str, hash);
1484 } else {
1485 throw new Error(str);
1486 }
1487 },
1488 // resets the lexer, sets new input
1489 setInput: function(input, yy) {
1490 this.yy = yy || this.yy || {};
1491 this._input = input;
1492 this._more = this._backtrack = this.done = false;
1493 this.yylineno = this.yyleng = 0;
1494 this.yytext = this.matched = this.match = "";
1495 this.conditionStack = ["INITIAL"];
1496 this.yylloc = {
1497 first_line: 1,
1498 first_column: 0,
1499 last_line: 1,
1500 last_column: 0
1501 };
1502 if (this.options.ranges) {
1503 this.yylloc.range = [0, 0];
1504 }
1505 this.offset = 0;
1506 return this;
1507 },
1508 // consumes and returns one char from the input
1509 input: function() {
1510 var ch = this._input[0];
1511 this.yytext += ch;
1512 this.yyleng++;
1513 this.offset++;
1514 this.match += ch;
1515 this.matched += ch;
1516 var lines = ch.match(/(?:\r\n?|\n).*/g);
1517 if (lines) {
1518 this.yylineno++;
1519 this.yylloc.last_line++;
1520 } else {
1521 this.yylloc.last_column++;
1522 }
1523 if (this.options.ranges) {
1524 this.yylloc.range[1]++;
1525 }
1526 this._input = this._input.slice(1);
1527 return ch;
1528 },
1529 // unshifts one char (or a string) into the input
1530 unput: function(ch) {
1531 var len = ch.length;
1532 var lines = ch.split(/(?:\r\n?|\n)/g);
1533 this._input = ch + this._input;
1534 this.yytext = this.yytext.substr(0, this.yytext.length - len);
1535 this.offset -= len;
1536 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
1537 this.match = this.match.substr(0, this.match.length - 1);
1538 this.matched = this.matched.substr(0, this.matched.length - 1);
1539 if (lines.length - 1) {
1540 this.yylineno -= lines.length - 1;
1541 }
1542 var r = this.yylloc.range;
1543 this.yylloc = {
1544 first_line: this.yylloc.first_line,
1545 last_line: this.yylineno + 1,
1546 first_column: this.yylloc.first_column,
1547 last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
1548 };
1549 if (this.options.ranges) {
1550 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
1551 }
1552 this.yyleng = this.yytext.length;
1553 return this;
1554 },
1555 // When called from action, caches matched text and appends it on next action
1556 more: function() {
1557 this._more = true;
1558 return this;
1559 },
1560 // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
1561 reject: function() {
1562 if (this.options.backtrack_lexer) {
1563 this._backtrack = true;
1564 } else {
1565 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(), {
1566 text: "",
1567 token: null,
1568 line: this.yylineno
1569 });
1570 }
1571 return this;
1572 },
1573 // retain first n characters of the match
1574 less: function(n) {
1575 this.unput(this.match.slice(n));
1576 },
1577 // displays already matched input, i.e. for error messages
1578 pastInput: function() {
1579 var past = this.matched.substr(0, this.matched.length - this.match.length);
1580 return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
1581 },
1582 // displays upcoming input, i.e. for error messages
1583 upcomingInput: function() {
1584 var next = this.match;
1585 if (next.length < 20) {
1586 next += this._input.substr(0, 20 - next.length);
1587 }
1588 return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
1589 },
1590 // displays the character position where the lexing error occurred, i.e. for error messages
1591 showPosition: function() {
1592 var pre = this.pastInput();
1593 var c = new Array(pre.length + 1).join("-");
1594 return pre + this.upcomingInput() + "\n" + c + "^";
1595 },
1596 // test the lexed token: return FALSE when not a match, otherwise return token
1597 test_match: function(match, indexed_rule) {
1598 var token, lines, backup;
1599 if (this.options.backtrack_lexer) {
1600 backup = {
1601 yylineno: this.yylineno,
1602 yylloc: {
1603 first_line: this.yylloc.first_line,
1604 last_line: this.last_line,
1605 first_column: this.yylloc.first_column,
1606 last_column: this.yylloc.last_column
1607 },
1608 yytext: this.yytext,
1609 match: this.match,
1610 matches: this.matches,
1611 matched: this.matched,
1612 yyleng: this.yyleng,
1613 offset: this.offset,
1614 _more: this._more,
1615 _input: this._input,
1616 yy: this.yy,
1617 conditionStack: this.conditionStack.slice(0),
1618 done: this.done
1619 };
1620 if (this.options.ranges) {
1621 backup.yylloc.range = this.yylloc.range.slice(0);
1622 }
1623 }
1624 lines = match[0].match(/(?:\r\n?|\n).*/g);
1625 if (lines) {
1626 this.yylineno += lines.length;
1627 }
1628 this.yylloc = {
1629 first_line: this.yylloc.last_line,
1630 last_line: this.yylineno + 1,
1631 first_column: this.yylloc.last_column,
1632 last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
1633 };
1634 this.yytext += match[0];
1635 this.match += match[0];
1636 this.matches = match;
1637 this.yyleng = this.yytext.length;
1638 if (this.options.ranges) {
1639 this.yylloc.range = [this.offset, this.offset += this.yyleng];
1640 }
1641 this._more = false;
1642 this._backtrack = false;
1643 this._input = this._input.slice(match[0].length);
1644 this.matched += match[0];
1645 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
1646 if (this.done && this._input) {
1647 this.done = false;
1648 }
1649 if (token) {
1650 return token;
1651 } else if (this._backtrack) {
1652 for (var k in backup) {
1653 this[k] = backup[k];
1654 }
1655 return false;
1656 }
1657 return false;
1658 },
1659 // return next match in input
1660 next: function() {
1661 if (this.done) {
1662 return this.EOF;
1663 }
1664 if (!this._input) {
1665 this.done = true;
1666 }
1667 var token, match, tempMatch, index;
1668 if (!this._more) {
1669 this.yytext = "";
1670 this.match = "";
1671 }
1672 var rules = this._currentRules();
1673 for (var i = 0; i < rules.length; i++) {
1674 tempMatch = this._input.match(this.rules[rules[i]]);
1675 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
1676 match = tempMatch;
1677 index = i;
1678 if (this.options.backtrack_lexer) {
1679 token = this.test_match(tempMatch, rules[i]);
1680 if (token !== false) {
1681 return token;
1682 } else if (this._backtrack) {
1683 match = false;
1684 continue;
1685 } else {
1686 return false;
1687 }
1688 } else if (!this.options.flex) {
1689 break;
1690 }
1691 }
1692 }
1693 if (match) {
1694 token = this.test_match(match, rules[index]);
1695 if (token !== false) {
1696 return token;
1697 }
1698 return false;
1699 }
1700 if (this._input === "") {
1701 return this.EOF;
1702 } else {
1703 return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
1704 text: "",
1705 token: null,
1706 line: this.yylineno
1707 });
1708 }
1709 },
1710 // return next match that has a token
1711 lex: function lex() {
1712 var r = this.next();
1713 if (r) {
1714 return r;
1715 } else {
1716 return this.lex();
1717 }
1718 },
1719 // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
1720 begin: function begin(condition) {
1721 this.conditionStack.push(condition);
1722 },
1723 // pop the previously active lexer condition state off the condition stack
1724 popState: function popState() {
1725 var n = this.conditionStack.length - 1;
1726 if (n > 0) {
1727 return this.conditionStack.pop();
1728 } else {
1729 return this.conditionStack[0];
1730 }
1731 },
1732 // produce the lexer rule set which is active for the currently active lexer condition state
1733 _currentRules: function _currentRules() {
1734 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
1735 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
1736 } else {
1737 return this.conditions["INITIAL"].rules;
1738 }
1739 },
1740 // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
1741 topState: function topState(n) {
1742 n = this.conditionStack.length - 1 - Math.abs(n || 0);
1743 if (n >= 0) {
1744 return this.conditionStack[n];
1745 } else {
1746 return "INITIAL";
1747 }
1748 },
1749 // alias for begin(condition)
1750 pushState: function pushState(condition) {
1751 this.begin(condition);
1752 },
1753 // return the number of states currently on the stack
1754 stateStackSize: function stateStackSize() {
1755 return this.conditionStack.length;
1756 },
1757 options: { "case-insensitive": true },
1758 performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
1759 switch ($avoiding_name_collisions) {
1760 case 0:
1761 this.begin("open_directive");
1762 return "open_directive";
1763 case 1:
1764 this.begin("acc_title");
1765 return 28;
1766 case 2:
1767 this.popState();
1768 return "acc_title_value";
1769 case 3:
1770 this.begin("acc_descr");
1771 return 30;
1772 case 4:
1773 this.popState();
1774 return "acc_descr_value";
1775 case 5:
1776 this.begin("acc_descr_multiline");
1777 break;
1778 case 6:
1779 this.popState();
1780 break;
1781 case 7:
1782 return "acc_descr_multiline_value";
1783 case 8:
1784 break;
1785 case 9:
1786 break;
1787 case 10:
1788 break;
1789 case 11:
1790 return 10;
1791 case 12:
1792 break;
1793 case 13:
1794 break;
1795 case 14:
1796 this.begin("href");
1797 break;
1798 case 15:
1799 this.popState();
1800 break;
1801 case 16:
1802 return 40;
1803 case 17:
1804 this.begin("callbackname");
1805 break;
1806 case 18:
1807 this.popState();
1808 break;
1809 case 19:
1810 this.popState();
1811 this.begin("callbackargs");
1812 break;
1813 case 20:
1814 return 38;
1815 case 21:
1816 this.popState();
1817 break;
1818 case 22:
1819 return 39;
1820 case 23:
1821 this.begin("click");
1822 break;
1823 case 24:
1824 this.popState();
1825 break;
1826 case 25:
1827 return 37;
1828 case 26:
1829 return 4;
1830 case 27:
1831 return 19;
1832 case 28:
1833 return 20;
1834 case 29:
1835 return 21;
1836 case 30:
1837 return 22;
1838 case 31:
1839 return 23;
1840 case 32:
1841 return 25;
1842 case 33:
1843 return 24;
1844 case 34:
1845 return 26;
1846 case 35:
1847 return 12;
1848 case 36:
1849 return 13;
1850 case 37:
1851 return 14;
1852 case 38:
1853 return 15;
1854 case 39:
1855 return 16;
1856 case 40:
1857 return 17;
1858 case 41:
1859 return 18;
1860 case 42:
1861 return "date";
1862 case 43:
1863 return 27;
1864 case 44:
1865 return "accDescription";
1866 case 45:
1867 return 33;
1868 case 46:
1869 return 35;
1870 case 47:
1871 return 36;
1872 case 48:
1873 return ":";
1874 case 49:
1875 return 6;
1876 case 50:
1877 return "INVALID";
1878 }
1879 },
1880 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, /^(?:\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],
1881 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], "inclusive": true } }
1882 };
1883 return lexer2;
1884 }();
1885 parser2.lexer = lexer;
1886 function Parser() {
1887 this.yy = {};
1888 }
1889 Parser.prototype = parser2;
1890 parser2.Parser = Parser;
1891 return new Parser();
1892}();
1893parser.parser = parser;
1894const ganttParser = parser;
1895var isoWeek = { exports: {} };
1896(function(module, exports) {
1897 !function(e, t) {
1898 module.exports = t();
1899 }(commonjsGlobal, function() {
1900 var e = "day";
1901 return function(t, i, s) {
1902 var a = function(t4) {
1903 return t4.add(4 - t4.isoWeekday(), e);
1904 }, d = i.prototype;
1905 d.isoWeekYear = function() {
1906 return a(this).year();
1907 }, d.isoWeek = function(t4) {
1908 if (!this.$utils().u(t4))
1909 return this.add(7 * (t4 - this.isoWeek()), e);
1910 var i2, d2, n2, o, r = a(this), u = (i2 = this.isoWeekYear(), d2 = this.$u, n2 = (d2 ? s.utc : s)().year(i2).startOf("year"), o = 4 - n2.isoWeekday(), n2.isoWeekday() > 4 && (o += 7), n2.add(o, e));
1911 return r.diff(u, "week") + 1;
1912 }, d.isoWeekday = function(e2) {
1913 return this.$utils().u(e2) ? this.day() || 7 : this.day(this.day() % 7 ? e2 : e2 - 7);
1914 };
1915 var n = d.startOf;
1916 d.startOf = function(e2, t4) {
1917 var i2 = this.$utils(), s2 = !!i2.u(t4) || t4;
1918 return "isoweek" === i2.p(e2) ? s2 ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : n.bind(this)(e2, t4);
1919 };
1920 };
1921 });
1922})(isoWeek);
1923var isoWeekExports = isoWeek.exports;
1924const dayjsIsoWeek = /* @__PURE__ */ getDefaultExportFromCjs(isoWeekExports);
1925var customParseFormat = { exports: {} };
1926(function(module, exports) {
1927 !function(e, t) {
1928 module.exports = t();
1929 }(commonjsGlobal, function() {
1930 var e = { 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" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d\d/, r = /\d\d?/, i = /\d*[^-_:/,()\s\d]+/, o = {}, s = function(e2) {
1931 return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
1932 };
1933 var a = function(e2) {
1934 return function(t4) {
1935 this[e2] = +t4;
1936 };
1937 }, f = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
1938 (this.zone || (this.zone = {})).offset = function(e3) {
1939 if (!e3)
1940 return 0;
1941 if ("Z" === e3)
1942 return 0;
1943 var t4 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t4[1] + (+t4[2] || 0);
1944 return 0 === n2 ? 0 : "+" === t4[0] ? -n2 : n2;
1945 }(e2);
1946 }], h = function(e2) {
1947 var t4 = o[e2];
1948 return t4 && (t4.indexOf ? t4 : t4.s.concat(t4.f));
1949 }, u = function(e2, t4) {
1950 var n2, r2 = o.meridiem;
1951 if (r2) {
1952 for (var i2 = 1; i2 <= 24; i2 += 1)
1953 if (e2.indexOf(r2(i2, 0, t4)) > -1) {
1954 n2 = i2 > 12;
1955 break;
1956 }
1957 } else
1958 n2 = e2 === (t4 ? "pm" : "PM");
1959 return n2;
1960 }, d = { A: [i, function(e2) {
1961 this.afternoon = u(e2, false);
1962 }], a: [i, function(e2) {
1963 this.afternoon = u(e2, true);
1964 }], S: [/\d/, function(e2) {
1965 this.milliseconds = 100 * +e2;
1966 }], SS: [n, function(e2) {
1967 this.milliseconds = 10 * +e2;
1968 }], SSS: [/\d{3}/, function(e2) {
1969 this.milliseconds = +e2;
1970 }], s: [r, a("seconds")], ss: [r, a("seconds")], m: [r, a("minutes")], mm: [r, a("minutes")], H: [r, a("hours")], h: [r, a("hours")], HH: [r, a("hours")], hh: [r, a("hours")], D: [r, a("day")], DD: [n, a("day")], Do: [i, function(e2) {
1971 var t4 = o.ordinal, n2 = e2.match(/\d+/);
1972 if (this.day = n2[0], t4)
1973 for (var r2 = 1; r2 <= 31; r2 += 1)
1974 t4(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
1975 }], M: [r, a("month")], MM: [n, a("month")], MMM: [i, function(e2) {
1976 var t4 = h("months"), n2 = (h("monthsShort") || t4.map(function(e3) {
1977 return e3.slice(0, 3);
1978 })).indexOf(e2) + 1;
1979 if (n2 < 1)
1980 throw new Error();
1981 this.month = n2 % 12 || n2;
1982 }], MMMM: [i, function(e2) {
1983 var t4 = h("months").indexOf(e2) + 1;
1984 if (t4 < 1)
1985 throw new Error();
1986 this.month = t4 % 12 || t4;
1987 }], Y: [/[+-]?\d+/, a("year")], YY: [n, function(e2) {
1988 this.year = s(e2);
1989 }], YYYY: [/\d{4}/, a("year")], Z: f, ZZ: f };
1990 function c(n2) {
1991 var r2, i2;
1992 r2 = n2, i2 = o && o.formats;
1993 for (var s2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t4, n3, r3) {
1994 var o2 = r3 && r3.toUpperCase();
1995 return n3 || i2[r3] || e[r3] || i2[o2].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t5, n4) {
1996 return t5 || n4.slice(1);
1997 });
1998 })).match(t), a2 = s2.length, f2 = 0; f2 < a2; f2 += 1) {
1999 var h2 = s2[f2], u2 = d[h2], c2 = u2 && u2[0], l = u2 && u2[1];
2000 s2[f2] = l ? { regex: c2, parser: l } : h2.replace(/^\[|\]$/g, "");
2001 }
2002 return function(e2) {
2003 for (var t4 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
2004 var i3 = s2[n3];
2005 if ("string" == typeof i3)
2006 r3 += i3.length;
2007 else {
2008 var o2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = o2.exec(h3)[0];
2009 f3.call(t4, u3), e2 = e2.replace(u3, "");
2010 }
2011 }
2012 return function(e3) {
2013 var t5 = e3.afternoon;
2014 if (void 0 !== t5) {
2015 var n4 = e3.hours;
2016 t5 ? n4 < 12 && (e3.hours += 12) : 12 === n4 && (e3.hours = 0), delete e3.afternoon;
2017 }
2018 }(t4), t4;
2019 };
2020 }
2021 return function(e2, t4, n2) {
2022 n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (s = e2.parseTwoDigitYear);
2023 var r2 = t4.prototype, i2 = r2.parse;
2024 r2.parse = function(e3) {
2025 var t5 = e3.date, r3 = e3.utc, s2 = e3.args;
2026 this.$u = r3;
2027 var a2 = s2[1];
2028 if ("string" == typeof a2) {
2029 var f2 = true === s2[2], h2 = true === s2[3], u2 = f2 || h2, d2 = s2[2];
2030 h2 && (d2 = s2[2]), o = this.$locale(), !f2 && d2 && (o = n2.Ls[d2]), this.$d = function(e4, t6, n3) {
2031 try {
2032 if (["x", "X"].indexOf(t6) > -1)
2033 return new Date(("X" === t6 ? 1e3 : 1) * e4);
2034 var r4 = c(t6)(e4), i3 = r4.year, o2 = r4.month, s3 = r4.day, a3 = r4.hours, f3 = r4.minutes, h3 = r4.seconds, u3 = r4.milliseconds, d3 = r4.zone, l2 = /* @__PURE__ */ new Date(), m2 = s3 || (i3 || o2 ? 1 : l2.getDate()), M2 = i3 || l2.getFullYear(), Y = 0;
2035 i3 && !o2 || (Y = o2 > 0 ? o2 - 1 : l2.getMonth());
2036 var p = a3 || 0, v = f3 || 0, D = h3 || 0, g = u3 || 0;
2037 return d3 ? new Date(Date.UTC(M2, Y, m2, p, v, D, g + 60 * d3.offset * 1e3)) : n3 ? new Date(Date.UTC(M2, Y, m2, p, v, D, g)) : new Date(M2, Y, m2, p, v, D, g);
2038 } catch (e5) {
2039 return /* @__PURE__ */ new Date("");
2040 }
2041 }(t5, a2, r3), this.init(), d2 && true !== d2 && (this.$L = this.locale(d2).$L), u2 && t5 != this.format(a2) && (this.$d = /* @__PURE__ */ new Date("")), o = {};
2042 } else if (a2 instanceof Array)
2043 for (var l = a2.length, m = 1; m <= l; m += 1) {
2044 s2[1] = a2[m - 1];
2045 var M = n2.apply(this, s2);
2046 if (M.isValid()) {
2047 this.$d = M.$d, this.$L = M.$L, this.init();
2048 break;
2049 }
2050 m === l && (this.$d = /* @__PURE__ */ new Date(""));
2051 }
2052 else
2053 i2.call(this, e3);
2054 };
2055 };
2056 });
2057})(customParseFormat);
2058var customParseFormatExports = customParseFormat.exports;
2059const dayjsCustomParseFormat = /* @__PURE__ */ getDefaultExportFromCjs(customParseFormatExports);
2060var advancedFormat = { exports: {} };
2061(function(module, exports) {
2062 !function(e, t) {
2063 module.exports = t();
2064 }(commonjsGlobal, function() {
2065 return function(e, t) {
2066 var r = t.prototype, n = r.format;
2067 r.format = function(e2) {
2068 var t4 = this, r2 = this.$locale();
2069 if (!this.isValid())
2070 return n.bind(this)(e2);
2071 var s = this.$utils(), a = (e2 || "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(e3) {
2072 switch (e3) {
2073 case "Q":
2074 return Math.ceil((t4.$M + 1) / 3);
2075 case "Do":
2076 return r2.ordinal(t4.$D);
2077 case "gggg":
2078 return t4.weekYear();
2079 case "GGGG":
2080 return t4.isoWeekYear();
2081 case "wo":
2082 return r2.ordinal(t4.week(), "W");
2083 case "w":
2084 case "ww":
2085 return s.s(t4.week(), "w" === e3 ? 1 : 2, "0");
2086 case "W":
2087 case "WW":
2088 return s.s(t4.isoWeek(), "W" === e3 ? 1 : 2, "0");
2089 case "k":
2090 case "kk":
2091 return s.s(String(0 === t4.$H ? 24 : t4.$H), "k" === e3 ? 1 : 2, "0");
2092 case "X":
2093 return Math.floor(t4.$d.getTime() / 1e3);
2094 case "x":
2095 return t4.$d.getTime();
2096 case "z":
2097 return "[" + t4.offsetName() + "]";
2098 case "zzz":
2099 return "[" + t4.offsetName("long") + "]";
2100 default:
2101 return e3;
2102 }
2103 });
2104 return n.bind(this)(a);
2105 };
2106 };
2107 });
2108})(advancedFormat);
2109var advancedFormatExports = advancedFormat.exports;
2110const dayjsAdvancedFormat = /* @__PURE__ */ getDefaultExportFromCjs(advancedFormatExports);
2111dayjs.extend(dayjsIsoWeek);
2112dayjs.extend(dayjsCustomParseFormat);
2113dayjs.extend(dayjsAdvancedFormat);
2114let dateFormat = "";
2115let axisFormat = "";
2116let tickInterval = void 0;
2117let todayMarker = "";
2118let includes = [];
2119let excludes = [];
2120let links = {};
2121let sections = [];
2122let tasks = [];
2123let currentSection = "";
2124let displayMode = "";
2125const tags = ["active", "done", "crit", "milestone"];
2126let funs = [];
2127let inclusiveEndDates = false;
2128let topAxis = false;
2129let weekday = "sunday";
2130let lastOrder = 0;
2131const clear = function() {
2132 sections = [];
2133 tasks = [];
2134 currentSection = "";
2135 funs = [];
2136 taskCnt = 0;
2137 lastTask = void 0;
2138 lastTaskID = void 0;
2139 rawTasks = [];
2140 dateFormat = "";
2141 axisFormat = "";
2142 displayMode = "";
2143 tickInterval = void 0;
2144 todayMarker = "";
2145 includes = [];
2146 excludes = [];
2147 inclusiveEndDates = false;
2148 topAxis = false;
2149 lastOrder = 0;
2150 links = {};
2151 clear$1();
2152 weekday = "sunday";
2153};
2154const setAxisFormat = function(txt) {
2155 axisFormat = txt;
2156};
2157const getAxisFormat = function() {
2158 return axisFormat;
2159};
2160const setTickInterval = function(txt) {
2161 tickInterval = txt;
2162};
2163const getTickInterval = function() {
2164 return tickInterval;
2165};
2166const setTodayMarker = function(txt) {
2167 todayMarker = txt;
2168};
2169const getTodayMarker = function() {
2170 return todayMarker;
2171};
2172const setDateFormat = function(txt) {
2173 dateFormat = txt;
2174};
2175const enableInclusiveEndDates = function() {
2176 inclusiveEndDates = true;
2177};
2178const endDatesAreInclusive = function() {
2179 return inclusiveEndDates;
2180};
2181const enableTopAxis = function() {
2182 topAxis = true;
2183};
2184const topAxisEnabled = function() {
2185 return topAxis;
2186};
2187const setDisplayMode = function(txt) {
2188 displayMode = txt;
2189};
2190const getDisplayMode = function() {
2191 return displayMode;
2192};
2193const getDateFormat = function() {
2194 return dateFormat;
2195};
2196const setIncludes = function(txt) {
2197 includes = txt.toLowerCase().split(/[\s,]+/);
2198};
2199const getIncludes = function() {
2200 return includes;
2201};
2202const setExcludes = function(txt) {
2203 excludes = txt.toLowerCase().split(/[\s,]+/);
2204};
2205const getExcludes = function() {
2206 return excludes;
2207};
2208const getLinks = function() {
2209 return links;
2210};
2211const addSection = function(txt) {
2212 currentSection = txt;
2213 sections.push(txt);
2214};
2215const getSections = function() {
2216 return sections;
2217};
2218const getTasks = function() {
2219 let allItemsProcessed = compileTasks();
2220 const maxDepth = 10;
2221 let iterationCount = 0;
2222 while (!allItemsProcessed && iterationCount < maxDepth) {
2223 allItemsProcessed = compileTasks();
2224 iterationCount++;
2225 }
2226 tasks = rawTasks;
2227 return tasks;
2228};
2229const isInvalidDate = function(date2, dateFormat2, excludes2, includes2) {
2230 if (includes2.includes(date2.format(dateFormat2.trim()))) {
2231 return false;
2232 }
2233 if (date2.isoWeekday() >= 6 && excludes2.includes("weekends")) {
2234 return true;
2235 }
2236 if (excludes2.includes(date2.format("dddd").toLowerCase())) {
2237 return true;
2238 }
2239 return excludes2.includes(date2.format(dateFormat2.trim()));
2240};
2241const setWeekday = function(txt) {
2242 weekday = txt;
2243};
2244const getWeekday = function() {
2245 return weekday;
2246};
2247const checkTaskDates = function(task, dateFormat2, excludes2, includes2) {
2248 if (!excludes2.length || task.manualEndTime) {
2249 return;
2250 }
2251 let startTime;
2252 if (task.startTime instanceof Date) {
2253 startTime = dayjs(task.startTime);
2254 } else {
2255 startTime = dayjs(task.startTime, dateFormat2, true);
2256 }
2257 startTime = startTime.add(1, "d");
2258 let originalEndTime;
2259 if (task.endTime instanceof Date) {
2260 originalEndTime = dayjs(task.endTime);
2261 } else {
2262 originalEndTime = dayjs(task.endTime, dateFormat2, true);
2263 }
2264 const [fixedEndTime, renderEndTime] = fixTaskDates(
2265 startTime,
2266 originalEndTime,
2267 dateFormat2,
2268 excludes2,
2269 includes2
2270 );
2271 task.endTime = fixedEndTime.toDate();
2272 task.renderEndTime = renderEndTime;
2273};
2274const fixTaskDates = function(startTime, endTime, dateFormat2, excludes2, includes2) {
2275 let invalid = false;
2276 let renderEndTime = null;
2277 while (startTime <= endTime) {
2278 if (!invalid) {
2279 renderEndTime = endTime.toDate();
2280 }
2281 invalid = isInvalidDate(startTime, dateFormat2, excludes2, includes2);
2282 if (invalid) {
2283 endTime = endTime.add(1, "d");
2284 }
2285 startTime = startTime.add(1, "d");
2286 }
2287 return [endTime, renderEndTime];
2288};
2289const getStartDate = function(prevTime, dateFormat2, str) {
2290 str = str.trim();
2291 const afterRePattern = /^after\s+(?<ids>[\d\w- ]+)/;
2292 const afterStatement = afterRePattern.exec(str);
2293 if (afterStatement !== null) {
2294 let latestTask = null;
2295 for (const id of afterStatement.groups.ids.split(" ")) {
2296 let task = findTaskById(id);
2297 if (task !== void 0 && (!latestTask || task.endTime > latestTask.endTime)) {
2298 latestTask = task;
2299 }
2300 }
2301 if (latestTask) {
2302 return latestTask.endTime;
2303 }
2304 const today = /* @__PURE__ */ new Date();
2305 today.setHours(0, 0, 0, 0);
2306 return today;
2307 }
2308 let mDate = dayjs(str, dateFormat2.trim(), true);
2309 if (mDate.isValid()) {
2310 return mDate.toDate();
2311 } else {
2312 log.debug("Invalid date:" + str);
2313 log.debug("With date format:" + dateFormat2.trim());
2314 const d = new Date(str);
2315 if (d === void 0 || isNaN(d.getTime()) || // WebKit browsers can mis-parse invalid dates to be ridiculously
2316 // huge numbers, e.g. new Date('202304') gets parsed as January 1, 202304.
2317 // This can cause virtually infinite loops while rendering, so for the
2318 // purposes of Gantt charts we'll just treat any date beyond 10,000 AD/BC as
2319 // invalid.
2320 d.getFullYear() < -1e4 || d.getFullYear() > 1e4) {
2321 throw new Error("Invalid date:" + str);
2322 }
2323 return d;
2324 }
2325};
2326const parseDuration = function(str) {
2327 const statement = /^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(str.trim());
2328 if (statement !== null) {
2329 return [Number.parseFloat(statement[1]), statement[2]];
2330 }
2331 return [NaN, "ms"];
2332};
2333const getEndDate = function(prevTime, dateFormat2, str, inclusive = false) {
2334 str = str.trim();
2335 const untilRePattern = /^until\s+(?<ids>[\d\w- ]+)/;
2336 const untilStatement = untilRePattern.exec(str);
2337 if (untilStatement !== null) {
2338 let earliestTask = null;
2339 for (const id of untilStatement.groups.ids.split(" ")) {
2340 let task = findTaskById(id);
2341 if (task !== void 0 && (!earliestTask || task.startTime < earliestTask.startTime)) {
2342 earliestTask = task;
2343 }
2344 }
2345 if (earliestTask) {
2346 return earliestTask.startTime;
2347 }
2348 const today = /* @__PURE__ */ new Date();
2349 today.setHours(0, 0, 0, 0);
2350 return today;
2351 }
2352 let parsedDate = dayjs(str, dateFormat2.trim(), true);
2353 if (parsedDate.isValid()) {
2354 if (inclusive) {
2355 parsedDate = parsedDate.add(1, "d");
2356 }
2357 return parsedDate.toDate();
2358 }
2359 let endTime = dayjs(prevTime);
2360 const [durationValue, durationUnit] = parseDuration(str);
2361 if (!Number.isNaN(durationValue)) {
2362 const newEndTime = endTime.add(durationValue, durationUnit);
2363 if (newEndTime.isValid()) {
2364 endTime = newEndTime;
2365 }
2366 }
2367 return endTime.toDate();
2368};
2369let taskCnt = 0;
2370const parseId = function(idStr) {
2371 if (idStr === void 0) {
2372 taskCnt = taskCnt + 1;
2373 return "task" + taskCnt;
2374 }
2375 return idStr;
2376};
2377const compileData = function(prevTask, dataStr) {
2378 let ds;
2379 if (dataStr.substr(0, 1) === ":") {
2380 ds = dataStr.substr(1, dataStr.length);
2381 } else {
2382 ds = dataStr;
2383 }
2384 const data = ds.split(",");
2385 const task = {};
2386 getTaskTags(data, task, tags);
2387 for (let i = 0; i < data.length; i++) {
2388 data[i] = data[i].trim();
2389 }
2390 let endTimeData = "";
2391 switch (data.length) {
2392 case 1:
2393 task.id = parseId();
2394 task.startTime = prevTask.endTime;
2395 endTimeData = data[0];
2396 break;
2397 case 2:
2398 task.id = parseId();
2399 task.startTime = getStartDate(void 0, dateFormat, data[0]);
2400 endTimeData = data[1];
2401 break;
2402 case 3:
2403 task.id = parseId(data[0]);
2404 task.startTime = getStartDate(void 0, dateFormat, data[1]);
2405 endTimeData = data[2];
2406 break;
2407 }
2408 if (endTimeData) {
2409 task.endTime = getEndDate(task.startTime, dateFormat, endTimeData, inclusiveEndDates);
2410 task.manualEndTime = dayjs(endTimeData, "YYYY-MM-DD", true).isValid();
2411 checkTaskDates(task, dateFormat, excludes, includes);
2412 }
2413 return task;
2414};
2415const parseData = function(prevTaskId, dataStr) {
2416 let ds;
2417 if (dataStr.substr(0, 1) === ":") {
2418 ds = dataStr.substr(1, dataStr.length);
2419 } else {
2420 ds = dataStr;
2421 }
2422 const data = ds.split(",");
2423 const task = {};
2424 getTaskTags(data, task, tags);
2425 for (let i = 0; i < data.length; i++) {
2426 data[i] = data[i].trim();
2427 }
2428 switch (data.length) {
2429 case 1:
2430 task.id = parseId();
2431 task.startTime = {
2432 type: "prevTaskEnd",
2433 id: prevTaskId
2434 };
2435 task.endTime = {
2436 data: data[0]
2437 };
2438 break;
2439 case 2:
2440 task.id = parseId();
2441 task.startTime = {
2442 type: "getStartDate",
2443 startData: data[0]
2444 };
2445 task.endTime = {
2446 data: data[1]
2447 };
2448 break;
2449 case 3:
2450 task.id = parseId(data[0]);
2451 task.startTime = {
2452 type: "getStartDate",
2453 startData: data[1]
2454 };
2455 task.endTime = {
2456 data: data[2]
2457 };
2458 break;
2459 }
2460 return task;
2461};
2462let lastTask;
2463let lastTaskID;
2464let rawTasks = [];
2465const taskDb = {};
2466const addTask = function(descr, data) {
2467 const rawTask = {
2468 section: currentSection,
2469 type: currentSection,
2470 processed: false,
2471 manualEndTime: false,
2472 renderEndTime: null,
2473 raw: { data },
2474 task: descr,
2475 classes: []
2476 };
2477 const taskInfo = parseData(lastTaskID, data);
2478 rawTask.raw.startTime = taskInfo.startTime;
2479 rawTask.raw.endTime = taskInfo.endTime;
2480 rawTask.id = taskInfo.id;
2481 rawTask.prevTaskId = lastTaskID;
2482 rawTask.active = taskInfo.active;
2483 rawTask.done = taskInfo.done;
2484 rawTask.crit = taskInfo.crit;
2485 rawTask.milestone = taskInfo.milestone;
2486 rawTask.order = lastOrder;
2487 lastOrder++;
2488 const pos = rawTasks.push(rawTask);
2489 lastTaskID = rawTask.id;
2490 taskDb[rawTask.id] = pos - 1;
2491};
2492const findTaskById = function(id) {
2493 const pos = taskDb[id];
2494 return rawTasks[pos];
2495};
2496const addTaskOrg = function(descr, data) {
2497 const newTask = {
2498 section: currentSection,
2499 type: currentSection,
2500 description: descr,
2501 task: descr,
2502 classes: []
2503 };
2504 const taskInfo = compileData(lastTask, data);
2505 newTask.startTime = taskInfo.startTime;
2506 newTask.endTime = taskInfo.endTime;
2507 newTask.id = taskInfo.id;
2508 newTask.active = taskInfo.active;
2509 newTask.done = taskInfo.done;
2510 newTask.crit = taskInfo.crit;
2511 newTask.milestone = taskInfo.milestone;
2512 lastTask = newTask;
2513 tasks.push(newTask);
2514};
2515const compileTasks = function() {
2516 const compileTask = function(pos) {
2517 const task = rawTasks[pos];
2518 let startTime = "";
2519 switch (rawTasks[pos].raw.startTime.type) {
2520 case "prevTaskEnd": {
2521 const prevTask = findTaskById(task.prevTaskId);
2522 task.startTime = prevTask.endTime;
2523 break;
2524 }
2525 case "getStartDate":
2526 startTime = getStartDate(void 0, dateFormat, rawTasks[pos].raw.startTime.startData);
2527 if (startTime) {
2528 rawTasks[pos].startTime = startTime;
2529 }
2530 break;
2531 }
2532 if (rawTasks[pos].startTime) {
2533 rawTasks[pos].endTime = getEndDate(
2534 rawTasks[pos].startTime,
2535 dateFormat,
2536 rawTasks[pos].raw.endTime.data,
2537 inclusiveEndDates
2538 );
2539 if (rawTasks[pos].endTime) {
2540 rawTasks[pos].processed = true;
2541 rawTasks[pos].manualEndTime = dayjs(
2542 rawTasks[pos].raw.endTime.data,
2543 "YYYY-MM-DD",
2544 true
2545 ).isValid();
2546 checkTaskDates(rawTasks[pos], dateFormat, excludes, includes);
2547 }
2548 }
2549 return rawTasks[pos].processed;
2550 };
2551 let allProcessed = true;
2552 for (const [i, rawTask] of rawTasks.entries()) {
2553 compileTask(i);
2554 allProcessed = allProcessed && rawTask.processed;
2555 }
2556 return allProcessed;
2557};
2558const setLink = function(ids, _linkStr) {
2559 let linkStr = _linkStr;
2560 if (getConfig().securityLevel !== "loose") {
2561 linkStr = dist.sanitizeUrl(_linkStr);
2562 }
2563 ids.split(",").forEach(function(id) {
2564 let rawTask = findTaskById(id);
2565 if (rawTask !== void 0) {
2566 pushFun(id, () => {
2567 window.open(linkStr, "_self");
2568 });
2569 links[id] = linkStr;
2570 }
2571 });
2572 setClass(ids, "clickable");
2573};
2574const setClass = function(ids, className) {
2575 ids.split(",").forEach(function(id) {
2576 let rawTask = findTaskById(id);
2577 if (rawTask !== void 0) {
2578 rawTask.classes.push(className);
2579 }
2580 });
2581};
2582const setClickFun = function(id, functionName, functionArgs) {
2583 if (getConfig().securityLevel !== "loose") {
2584 return;
2585 }
2586 if (functionName === void 0) {
2587 return;
2588 }
2589 let argList = [];
2590 if (typeof functionArgs === "string") {
2591 argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
2592 for (let i = 0; i < argList.length; i++) {
2593 let item = argList[i].trim();
2594 if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
2595 item = item.substr(1, item.length - 2);
2596 }
2597 argList[i] = item;
2598 }
2599 }
2600 if (argList.length === 0) {
2601 argList.push(id);
2602 }
2603 let rawTask = findTaskById(id);
2604 if (rawTask !== void 0) {
2605 pushFun(id, () => {
2606 utils.runFunc(functionName, ...argList);
2607 });
2608 }
2609};
2610const pushFun = function(id, callbackFunction) {
2611 funs.push(
2612 function() {
2613 const elem = document.querySelector(`[id="${id}"]`);
2614 if (elem !== null) {
2615 elem.addEventListener("click", function() {
2616 callbackFunction();
2617 });
2618 }
2619 },
2620 function() {
2621 const elem = document.querySelector(`[id="${id}-text"]`);
2622 if (elem !== null) {
2623 elem.addEventListener("click", function() {
2624 callbackFunction();
2625 });
2626 }
2627 }
2628 );
2629};
2630const setClickEvent = function(ids, functionName, functionArgs) {
2631 ids.split(",").forEach(function(id) {
2632 setClickFun(id, functionName, functionArgs);
2633 });
2634 setClass(ids, "clickable");
2635};
2636const bindFunctions = function(element) {
2637 funs.forEach(function(fun) {
2638 fun(element);
2639 });
2640};
2641const ganttDb = {
2642 getConfig: () => getConfig().gantt,
2643 clear,
2644 setDateFormat,
2645 getDateFormat,
2646 enableInclusiveEndDates,
2647 endDatesAreInclusive,
2648 enableTopAxis,
2649 topAxisEnabled,
2650 setAxisFormat,
2651 getAxisFormat,
2652 setTickInterval,
2653 getTickInterval,
2654 setTodayMarker,
2655 getTodayMarker,
2656 setAccTitle,
2657 getAccTitle,
2658 setDiagramTitle,
2659 getDiagramTitle,
2660 setDisplayMode,
2661 getDisplayMode,
2662 setAccDescription,
2663 getAccDescription,
2664 addSection,
2665 getSections,
2666 getTasks,
2667 addTask,
2668 findTaskById,
2669 addTaskOrg,
2670 setIncludes,
2671 getIncludes,
2672 setExcludes,
2673 getExcludes,
2674 setClickEvent,
2675 setLink,
2676 getLinks,
2677 bindFunctions,
2678 parseDuration,
2679 isInvalidDate,
2680 setWeekday,
2681 getWeekday
2682};
2683function getTaskTags(data, task, tags2) {
2684 let matchFound = true;
2685 while (matchFound) {
2686 matchFound = false;
2687 tags2.forEach(function(t) {
2688 const pattern = "^\\s*" + t + "\\s*$";
2689 const regex = new RegExp(pattern);
2690 if (data[0].match(regex)) {
2691 task[t] = true;
2692 data.shift(1);
2693 matchFound = true;
2694 }
2695 });
2696 }
2697}
2698const setConf = function() {
2699 log.debug("Something is calling, setConf, remove the call");
2700};
2701const mapWeekdayToTimeFunction = {
2702 monday: timeMonday,
2703 tuesday: timeTuesday,
2704 wednesday: timeWednesday,
2705 thursday: timeThursday,
2706 friday: timeFriday,
2707 saturday: timeSaturday,
2708 sunday: timeSunday
2709};
2710const getMaxIntersections = (tasks2, orderOffset) => {
2711 let timeline = [...tasks2].map(() => -Infinity);
2712 let sorted = [...tasks2].sort((a, b) => a.startTime - b.startTime || a.order - b.order);
2713 let maxIntersections = 0;
2714 for (const element of sorted) {
2715 for (let j = 0; j < timeline.length; j++) {
2716 if (element.startTime >= timeline[j]) {
2717 timeline[j] = element.endTime;
2718 element.order = j + orderOffset;
2719 if (j > maxIntersections) {
2720 maxIntersections = j;
2721 }
2722 break;
2723 }
2724 }
2725 }
2726 return maxIntersections;
2727};
2728let w;
2729const draw = function(text, id, version, diagObj) {
2730 const conf = getConfig().gantt;
2731 const securityLevel = getConfig().securityLevel;
2732 let sandboxElement;
2733 if (securityLevel === "sandbox") {
2734 sandboxElement = d3select("#i" + id);
2735 }
2736 const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
2737 const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
2738 const elem = doc.getElementById(id);
2739 w = elem.parentElement.offsetWidth;
2740 if (w === void 0) {
2741 w = 1200;
2742 }
2743 if (conf.useWidth !== void 0) {
2744 w = conf.useWidth;
2745 }
2746 const taskArray = diagObj.db.getTasks();
2747 let categories = [];
2748 for (const element of taskArray) {
2749 categories.push(element.type);
2750 }
2751 categories = checkUnique(categories);
2752 const categoryHeights = {};
2753 let h = 2 * conf.topPadding;
2754 if (diagObj.db.getDisplayMode() === "compact" || conf.displayMode === "compact") {
2755 const categoryElements = {};
2756 for (const element of taskArray) {
2757 if (categoryElements[element.section] === void 0) {
2758 categoryElements[element.section] = [element];
2759 } else {
2760 categoryElements[element.section].push(element);
2761 }
2762 }
2763 let intersections = 0;
2764 for (const category of Object.keys(categoryElements)) {
2765 const categoryHeight = getMaxIntersections(categoryElements[category], intersections) + 1;
2766 intersections += categoryHeight;
2767 h += categoryHeight * (conf.barHeight + conf.barGap);
2768 categoryHeights[category] = categoryHeight;
2769 }
2770 } else {
2771 h += taskArray.length * (conf.barHeight + conf.barGap);
2772 for (const category of categories) {
2773 categoryHeights[category] = taskArray.filter((task) => task.type === category).length;
2774 }
2775 }
2776 elem.setAttribute("viewBox", "0 0 " + w + " " + h);
2777 const svg = root.select(`[id="${id}"]`);
2778 const timeScale = time().domain([
2779 min(taskArray, function(d) {
2780 return d.startTime;
2781 }),
2782 max(taskArray, function(d) {
2783 return d.endTime;
2784 })
2785 ]).rangeRound([0, w - conf.leftPadding - conf.rightPadding]);
2786 function taskCompare(a, b) {
2787 const taskA = a.startTime;
2788 const taskB = b.startTime;
2789 let result = 0;
2790 if (taskA > taskB) {
2791 result = 1;
2792 } else if (taskA < taskB) {
2793 result = -1;
2794 }
2795 return result;
2796 }
2797 taskArray.sort(taskCompare);
2798 makeGantt(taskArray, w, h);
2799 configureSvgSize(svg, h, w, conf.useMaxWidth);
2800 svg.append("text").text(diagObj.db.getDiagramTitle()).attr("x", w / 2).attr("y", conf.titleTopMargin).attr("class", "titleText");
2801 function makeGantt(tasks2, pageWidth, pageHeight) {
2802 const barHeight = conf.barHeight;
2803 const gap = barHeight + conf.barGap;
2804 const topPadding = conf.topPadding;
2805 const leftPadding = conf.leftPadding;
2806 const colorScale = linear().domain([0, categories.length]).range(["#00B9FA", "#F95002"]).interpolate(interpolateHcl);
2807 drawExcludeDays(
2808 gap,
2809 topPadding,
2810 leftPadding,
2811 pageWidth,
2812 pageHeight,
2813 tasks2,
2814 diagObj.db.getExcludes(),
2815 diagObj.db.getIncludes()
2816 );
2817 makeGrid(leftPadding, topPadding, pageWidth, pageHeight);
2818 drawRects(tasks2, gap, topPadding, leftPadding, barHeight, colorScale, pageWidth);
2819 vertLabels(gap, topPadding);
2820 drawToday(leftPadding, topPadding, pageWidth, pageHeight);
2821 }
2822 function drawRects(theArray, theGap, theTopPad, theSidePad, theBarHeight, theColorScale, w2) {
2823 const uniqueTaskOrderIds = [...new Set(theArray.map((item) => item.order))];
2824 const uniqueTasks = uniqueTaskOrderIds.map((id2) => theArray.find((item) => item.order === id2));
2825 svg.append("g").selectAll("rect").data(uniqueTasks).enter().append("rect").attr("x", 0).attr("y", function(d, i) {
2826 i = d.order;
2827 return i * theGap + theTopPad - 2;
2828 }).attr("width", function() {
2829 return w2 - conf.rightPadding / 2;
2830 }).attr("height", theGap).attr("class", function(d) {
2831 for (const [i, category] of categories.entries()) {
2832 if (d.type === category) {
2833 return "section section" + i % conf.numberSectionStyles;
2834 }
2835 }
2836 return "section section0";
2837 });
2838 const rectangles = svg.append("g").selectAll("rect").data(theArray).enter();
2839 const links2 = diagObj.db.getLinks();
2840 rectangles.append("rect").attr("id", function(d) {
2841 return d.id;
2842 }).attr("rx", 3).attr("ry", 3).attr("x", function(d) {
2843 if (d.milestone) {
2844 return timeScale(d.startTime) + theSidePad + 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - 0.5 * theBarHeight;
2845 }
2846 return timeScale(d.startTime) + theSidePad;
2847 }).attr("y", function(d, i) {
2848 i = d.order;
2849 return i * theGap + theTopPad;
2850 }).attr("width", function(d) {
2851 if (d.milestone) {
2852 return theBarHeight;
2853 }
2854 return timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime);
2855 }).attr("height", theBarHeight).attr("transform-origin", function(d, i) {
2856 i = d.order;
2857 return (timeScale(d.startTime) + theSidePad + 0.5 * (timeScale(d.endTime) - timeScale(d.startTime))).toString() + "px " + (i * theGap + theTopPad + 0.5 * theBarHeight).toString() + "px";
2858 }).attr("class", function(d) {
2859 const res = "task";
2860 let classStr = "";
2861 if (d.classes.length > 0) {
2862 classStr = d.classes.join(" ");
2863 }
2864 let secNum = 0;
2865 for (const [i, category] of categories.entries()) {
2866 if (d.type === category) {
2867 secNum = i % conf.numberSectionStyles;
2868 }
2869 }
2870 let taskClass = "";
2871 if (d.active) {
2872 if (d.crit) {
2873 taskClass += " activeCrit";
2874 } else {
2875 taskClass = " active";
2876 }
2877 } else if (d.done) {
2878 if (d.crit) {
2879 taskClass = " doneCrit";
2880 } else {
2881 taskClass = " done";
2882 }
2883 } else {
2884 if (d.crit) {
2885 taskClass += " crit";
2886 }
2887 }
2888 if (taskClass.length === 0) {
2889 taskClass = " task";
2890 }
2891 if (d.milestone) {
2892 taskClass = " milestone " + taskClass;
2893 }
2894 taskClass += secNum;
2895 taskClass += " " + classStr;
2896 return res + taskClass;
2897 });
2898 rectangles.append("text").attr("id", function(d) {
2899 return d.id + "-text";
2900 }).text(function(d) {
2901 return d.task;
2902 }).attr("font-size", conf.fontSize).attr("x", function(d) {
2903 let startX = timeScale(d.startTime);
2904 let endX = timeScale(d.renderEndTime || d.endTime);
2905 if (d.milestone) {
2906 startX += 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - 0.5 * theBarHeight;
2907 }
2908 if (d.milestone) {
2909 endX = startX + theBarHeight;
2910 }
2911 const textWidth = this.getBBox().width;
2912 if (textWidth > endX - startX) {
2913 if (endX + textWidth + 1.5 * conf.leftPadding > w2) {
2914 return startX + theSidePad - 5;
2915 } else {
2916 return endX + theSidePad + 5;
2917 }
2918 } else {
2919 return (endX - startX) / 2 + startX + theSidePad;
2920 }
2921 }).attr("y", function(d, i) {
2922 i = d.order;
2923 return i * theGap + conf.barHeight / 2 + (conf.fontSize / 2 - 2) + theTopPad;
2924 }).attr("text-height", theBarHeight).attr("class", function(d) {
2925 const startX = timeScale(d.startTime);
2926 let endX = timeScale(d.endTime);
2927 if (d.milestone) {
2928 endX = startX + theBarHeight;
2929 }
2930 const textWidth = this.getBBox().width;
2931 let classStr = "";
2932 if (d.classes.length > 0) {
2933 classStr = d.classes.join(" ");
2934 }
2935 let secNum = 0;
2936 for (const [i, category] of categories.entries()) {
2937 if (d.type === category) {
2938 secNum = i % conf.numberSectionStyles;
2939 }
2940 }
2941 let taskType = "";
2942 if (d.active) {
2943 if (d.crit) {
2944 taskType = "activeCritText" + secNum;
2945 } else {
2946 taskType = "activeText" + secNum;
2947 }
2948 }
2949 if (d.done) {
2950 if (d.crit) {
2951 taskType = taskType + " doneCritText" + secNum;
2952 } else {
2953 taskType = taskType + " doneText" + secNum;
2954 }
2955 } else {
2956 if (d.crit) {
2957 taskType = taskType + " critText" + secNum;
2958 }
2959 }
2960 if (d.milestone) {
2961 taskType += " milestoneText";
2962 }
2963 if (textWidth > endX - startX) {
2964 if (endX + textWidth + 1.5 * conf.leftPadding > w2) {
2965 return classStr + " taskTextOutsideLeft taskTextOutside" + secNum + " " + taskType;
2966 } else {
2967 return classStr + " taskTextOutsideRight taskTextOutside" + secNum + " " + taskType + " width-" + textWidth;
2968 }
2969 } else {
2970 return classStr + " taskText taskText" + secNum + " " + taskType + " width-" + textWidth;
2971 }
2972 });
2973 const securityLevel2 = getConfig().securityLevel;
2974 if (securityLevel2 === "sandbox") {
2975 let sandboxElement2;
2976 sandboxElement2 = d3select("#i" + id);
2977 const doc2 = sandboxElement2.nodes()[0].contentDocument;
2978 rectangles.filter(function(d) {
2979 return links2[d.id] !== void 0;
2980 }).each(function(o) {
2981 var taskRect = doc2.querySelector("#" + o.id);
2982 var taskText = doc2.querySelector("#" + o.id + "-text");
2983 const oldParent = taskRect.parentNode;
2984 var Link = doc2.createElement("a");
2985 Link.setAttribute("xlink:href", links2[o.id]);
2986 Link.setAttribute("target", "_top");
2987 oldParent.appendChild(Link);
2988 Link.appendChild(taskRect);
2989 Link.appendChild(taskText);
2990 });
2991 }
2992 }
2993 function drawExcludeDays(theGap, theTopPad, theSidePad, w2, h2, tasks2, excludes2, includes2) {
2994 if (excludes2.length === 0 && includes2.length === 0) {
2995 return;
2996 }
2997 let minTime;
2998 let maxTime;
2999 for (const { startTime, endTime } of tasks2) {
3000 if (minTime === void 0 || startTime < minTime) {
3001 minTime = startTime;
3002 }
3003 if (maxTime === void 0 || endTime > maxTime) {
3004 maxTime = endTime;
3005 }
3006 }
3007 if (!minTime || !maxTime) {
3008 return;
3009 }
3010 if (dayjs(maxTime).diff(dayjs(minTime), "year") > 5) {
3011 log.warn(
3012 "The difference between the min and max time is more than 5 years. This will cause performance issues. Skipping drawing exclude days."
3013 );
3014 return;
3015 }
3016 const dateFormat2 = diagObj.db.getDateFormat();
3017 const excludeRanges = [];
3018 let range = null;
3019 let d = dayjs(minTime);
3020 while (d.valueOf() <= maxTime) {
3021 if (diagObj.db.isInvalidDate(d, dateFormat2, excludes2, includes2)) {
3022 if (!range) {
3023 range = {
3024 start: d,
3025 end: d
3026 };
3027 } else {
3028 range.end = d;
3029 }
3030 } else {
3031 if (range) {
3032 excludeRanges.push(range);
3033 range = null;
3034 }
3035 }
3036 d = d.add(1, "d");
3037 }
3038 const rectangles = svg.append("g").selectAll("rect").data(excludeRanges).enter();
3039 rectangles.append("rect").attr("id", function(d2) {
3040 return "exclude-" + d2.start.format("YYYY-MM-DD");
3041 }).attr("x", function(d2) {
3042 return timeScale(d2.start) + theSidePad;
3043 }).attr("y", conf.gridLineStartPadding).attr("width", function(d2) {
3044 const renderEnd = d2.end.add(1, "day");
3045 return timeScale(renderEnd) - timeScale(d2.start);
3046 }).attr("height", h2 - theTopPad - conf.gridLineStartPadding).attr("transform-origin", function(d2, i) {
3047 return (timeScale(d2.start) + theSidePad + 0.5 * (timeScale(d2.end) - timeScale(d2.start))).toString() + "px " + (i * theGap + 0.5 * h2).toString() + "px";
3048 }).attr("class", "exclude-range");
3049 }
3050 function makeGrid(theSidePad, theTopPad, w2, h2) {
3051 let bottomXAxis = axisBottom(timeScale).tickSize(-h2 + theTopPad + conf.gridLineStartPadding).tickFormat(timeFormat(diagObj.db.getAxisFormat() || conf.axisFormat || "%Y-%m-%d"));
3052 const reTickInterval = /^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/;
3053 const resultTickInterval = reTickInterval.exec(
3054 diagObj.db.getTickInterval() || conf.tickInterval
3055 );
3056 if (resultTickInterval !== null) {
3057 const every = resultTickInterval[1];
3058 const interval = resultTickInterval[2];
3059 const weekday2 = diagObj.db.getWeekday() || conf.weekday;
3060 switch (interval) {
3061 case "millisecond":
3062 bottomXAxis.ticks(millisecond.every(every));
3063 break;
3064 case "second":
3065 bottomXAxis.ticks(second.every(every));
3066 break;
3067 case "minute":
3068 bottomXAxis.ticks(timeMinute.every(every));
3069 break;
3070 case "hour":
3071 bottomXAxis.ticks(timeHour.every(every));
3072 break;
3073 case "day":
3074 bottomXAxis.ticks(timeDay.every(every));
3075 break;
3076 case "week":
3077 bottomXAxis.ticks(mapWeekdayToTimeFunction[weekday2].every(every));
3078 break;
3079 case "month":
3080 bottomXAxis.ticks(timeMonth.every(every));
3081 break;
3082 }
3083 }
3084 svg.append("g").attr("class", "grid").attr("transform", "translate(" + theSidePad + ", " + (h2 - 50) + ")").call(bottomXAxis).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10).attr("dy", "1em");
3085 if (diagObj.db.topAxisEnabled() || conf.topAxis) {
3086 let topXAxis = axisTop(timeScale).tickSize(-h2 + theTopPad + conf.gridLineStartPadding).tickFormat(timeFormat(diagObj.db.getAxisFormat() || conf.axisFormat || "%Y-%m-%d"));
3087 if (resultTickInterval !== null) {
3088 const every = resultTickInterval[1];
3089 const interval = resultTickInterval[2];
3090 const weekday2 = diagObj.db.getWeekday() || conf.weekday;
3091 switch (interval) {
3092 case "millisecond":
3093 topXAxis.ticks(millisecond.every(every));
3094 break;
3095 case "second":
3096 topXAxis.ticks(second.every(every));
3097 break;
3098 case "minute":
3099 topXAxis.ticks(timeMinute.every(every));
3100 break;
3101 case "hour":
3102 topXAxis.ticks(timeHour.every(every));
3103 break;
3104 case "day":
3105 topXAxis.ticks(timeDay.every(every));
3106 break;
3107 case "week":
3108 topXAxis.ticks(mapWeekdayToTimeFunction[weekday2].every(every));
3109 break;
3110 case "month":
3111 topXAxis.ticks(timeMonth.every(every));
3112 break;
3113 }
3114 }
3115 svg.append("g").attr("class", "grid").attr("transform", "translate(" + theSidePad + ", " + theTopPad + ")").call(topXAxis).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10);
3116 }
3117 }
3118 function vertLabels(theGap, theTopPad) {
3119 let prevGap = 0;
3120 const numOccurrences = Object.keys(categoryHeights).map((d) => [d, categoryHeights[d]]);
3121 svg.append("g").selectAll("text").data(numOccurrences).enter().append(function(d) {
3122 const rows = d[0].split(common.lineBreakRegex);
3123 const dy = -(rows.length - 1) / 2;
3124 const svgLabel = doc.createElementNS("http://www.w3.org/2000/svg", "text");
3125 svgLabel.setAttribute("dy", dy + "em");
3126 for (const [j, row] of rows.entries()) {
3127 const tspan = doc.createElementNS("http://www.w3.org/2000/svg", "tspan");
3128 tspan.setAttribute("alignment-baseline", "central");
3129 tspan.setAttribute("x", "10");
3130 if (j > 0) {
3131 tspan.setAttribute("dy", "1em");
3132 }
3133 tspan.textContent = row;
3134 svgLabel.appendChild(tspan);
3135 }
3136 return svgLabel;
3137 }).attr("x", 10).attr("y", function(d, i) {
3138 if (i > 0) {
3139 for (let j = 0; j < i; j++) {
3140 prevGap += numOccurrences[i - 1][1];
3141 return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
3142 }
3143 } else {
3144 return d[1] * theGap / 2 + theTopPad;
3145 }
3146 }).attr("font-size", conf.sectionFontSize).attr("class", function(d) {
3147 for (const [i, category] of categories.entries()) {
3148 if (d[0] === category) {
3149 return "sectionTitle sectionTitle" + i % conf.numberSectionStyles;
3150 }
3151 }
3152 return "sectionTitle";
3153 });
3154 }
3155 function drawToday(theSidePad, theTopPad, w2, h2) {
3156 const todayMarker2 = diagObj.db.getTodayMarker();
3157 if (todayMarker2 === "off") {
3158 return;
3159 }
3160 const todayG = svg.append("g").attr("class", "today");
3161 const today = /* @__PURE__ */ new Date();
3162 const todayLine = todayG.append("line");
3163 todayLine.attr("x1", timeScale(today) + theSidePad).attr("x2", timeScale(today) + theSidePad).attr("y1", conf.titleTopMargin).attr("y2", h2 - conf.titleTopMargin).attr("class", "today");
3164 if (todayMarker2 !== "") {
3165 todayLine.attr("style", todayMarker2.replace(/,/g, ";"));
3166 }
3167 }
3168 function checkUnique(arr) {
3169 const hash = {};
3170 const result = [];
3171 for (let i = 0, l = arr.length; i < l; ++i) {
3172 if (!Object.prototype.hasOwnProperty.call(hash, arr[i])) {
3173 hash[arr[i]] = true;
3174 result.push(arr[i]);
3175 }
3176 }
3177 return result;
3178 }
3179};
3180const ganttRenderer = {
3181 setConf,
3182 draw
3183};
3184const getStyles = (options) => `
3185 .mermaid-main-font {
3186 font-family: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif);
3187 }
3188
3189 .exclude-range {
3190 fill: ${options.excludeBkgColor};
3191 }
3192
3193 .section {
3194 stroke: none;
3195 opacity: 0.2;
3196 }
3197
3198 .section0 {
3199 fill: ${options.sectionBkgColor};
3200 }
3201
3202 .section2 {
3203 fill: ${options.sectionBkgColor2};
3204 }
3205
3206 .section1,
3207 .section3 {
3208 fill: ${options.altSectionBkgColor};
3209 opacity: 0.2;
3210 }
3211
3212 .sectionTitle0 {
3213 fill: ${options.titleColor};
3214 }
3215
3216 .sectionTitle1 {
3217 fill: ${options.titleColor};
3218 }
3219
3220 .sectionTitle2 {
3221 fill: ${options.titleColor};
3222 }
3223
3224 .sectionTitle3 {
3225 fill: ${options.titleColor};
3226 }
3227
3228 .sectionTitle {
3229 text-anchor: start;
3230 font-family: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif);
3231 }
3232
3233
3234 /* Grid and axis */
3235
3236 .grid .tick {
3237 stroke: ${options.gridColor};
3238 opacity: 0.8;
3239 shape-rendering: crispEdges;
3240 }
3241
3242 .grid .tick text {
3243 font-family: ${options.fontFamily};
3244 fill: ${options.textColor};
3245 }
3246
3247 .grid path {
3248 stroke-width: 0;
3249 }
3250
3251
3252 /* Today line */
3253
3254 .today {
3255 fill: none;
3256 stroke: ${options.todayLineColor};
3257 stroke-width: 2px;
3258 }
3259
3260
3261 /* Task styling */
3262
3263 /* Default task */
3264
3265 .task {
3266 stroke-width: 2;
3267 }
3268
3269 .taskText {
3270 text-anchor: middle;
3271 font-family: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif);
3272 }
3273
3274 .taskTextOutsideRight {
3275 fill: ${options.taskTextDarkColor};
3276 text-anchor: start;
3277 font-family: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif);
3278 }
3279
3280 .taskTextOutsideLeft {
3281 fill: ${options.taskTextDarkColor};
3282 text-anchor: end;
3283 }
3284
3285
3286 /* Special case clickable */
3287
3288 .task.clickable {
3289 cursor: pointer;
3290 }
3291
3292 .taskText.clickable {
3293 cursor: pointer;
3294 fill: ${options.taskTextClickableColor} !important;
3295 font-weight: bold;
3296 }
3297
3298 .taskTextOutsideLeft.clickable {
3299 cursor: pointer;
3300 fill: ${options.taskTextClickableColor} !important;
3301 font-weight: bold;
3302 }
3303
3304 .taskTextOutsideRight.clickable {
3305 cursor: pointer;
3306 fill: ${options.taskTextClickableColor} !important;
3307 font-weight: bold;
3308 }
3309
3310
3311 /* Specific task settings for the sections*/
3312
3313 .taskText0,
3314 .taskText1,
3315 .taskText2,
3316 .taskText3 {
3317 fill: ${options.taskTextColor};
3318 }
3319
3320 .task0,
3321 .task1,
3322 .task2,
3323 .task3 {
3324 fill: ${options.taskBkgColor};
3325 stroke: ${options.taskBorderColor};
3326 }
3327
3328 .taskTextOutside0,
3329 .taskTextOutside2
3330 {
3331 fill: ${options.taskTextOutsideColor};
3332 }
3333
3334 .taskTextOutside1,
3335 .taskTextOutside3 {
3336 fill: ${options.taskTextOutsideColor};
3337 }
3338
3339
3340 /* Active task */
3341
3342 .active0,
3343 .active1,
3344 .active2,
3345 .active3 {
3346 fill: ${options.activeTaskBkgColor};
3347 stroke: ${options.activeTaskBorderColor};
3348 }
3349
3350 .activeText0,
3351 .activeText1,
3352 .activeText2,
3353 .activeText3 {
3354 fill: ${options.taskTextDarkColor} !important;
3355 }
3356
3357
3358 /* Completed task */
3359
3360 .done0,
3361 .done1,
3362 .done2,
3363 .done3 {
3364 stroke: ${options.doneTaskBorderColor};
3365 fill: ${options.doneTaskBkgColor};
3366 stroke-width: 2;
3367 }
3368
3369 .doneText0,
3370 .doneText1,
3371 .doneText2,
3372 .doneText3 {
3373 fill: ${options.taskTextDarkColor} !important;
3374 }
3375
3376
3377 /* Tasks on the critical line */
3378
3379 .crit0,
3380 .crit1,
3381 .crit2,
3382 .crit3 {
3383 stroke: ${options.critBorderColor};
3384 fill: ${options.critBkgColor};
3385 stroke-width: 2;
3386 }
3387
3388 .activeCrit0,
3389 .activeCrit1,
3390 .activeCrit2,
3391 .activeCrit3 {
3392 stroke: ${options.critBorderColor};
3393 fill: ${options.activeTaskBkgColor};
3394 stroke-width: 2;
3395 }
3396
3397 .doneCrit0,
3398 .doneCrit1,
3399 .doneCrit2,
3400 .doneCrit3 {
3401 stroke: ${options.critBorderColor};
3402 fill: ${options.doneTaskBkgColor};
3403 stroke-width: 2;
3404 cursor: pointer;
3405 shape-rendering: crispEdges;
3406 }
3407
3408 .milestone {
3409 transform: rotate(45deg) scale(0.8,0.8);
3410 }
3411
3412 .milestoneText {
3413 font-style: italic;
3414 }
3415 .doneCritText0,
3416 .doneCritText1,
3417 .doneCritText2,
3418 .doneCritText3 {
3419 fill: ${options.taskTextDarkColor} !important;
3420 }
3421
3422 .activeCritText0,
3423 .activeCritText1,
3424 .activeCritText2,
3425 .activeCritText3 {
3426 fill: ${options.taskTextDarkColor} !important;
3427 }
3428
3429 .titleText {
3430 text-anchor: middle;
3431 font-size: 18px;
3432 fill: ${options.titleColor || options.textColor};
3433 font-family: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif);
3434 }
3435`;
3436const ganttStyles = getStyles;
3437const diagram = {
3438 parser: ganttParser,
3439 db: ganttDb,
3440 renderer: ganttRenderer,
3441 styles: ganttStyles
3442};
3443export {
3444 diagram
3445};