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