UNPKG

suivi-dhx-trial-gantt

Version:

An open source JavaScript Gantt chart that helps you illustrate a project schedule in a nice-looking chart.

1,039 lines (1,036 loc) 840 kB
/** @license dhtmlxGantt v.9.0.7 Professional Evaluation This software is covered by DHTMLX Evaluation License. Contact sales@dhtmlx.com to get a proprietary license. Usage without proper license is prohibited. (c) XB Software */ function Ze(t) { t.config.auto_scheduling_use_progress = !1, t.config.auto_scheduling_project_constraint = !1; } function Qe(t) { t._get_linked_task = function(s, l) { var d = null, u = l ? s.target : s.source; return t.isTaskExists(u) && (d = t.getTask(u)), d; }, t._get_link_target = function(s) { return t._get_linked_task(s, !0); }, t._get_link_source = function(s) { return t._get_linked_task(s, !1); }; var n = !1, e = {}, i = {}, a = {}, r = {}; function o(s) { return t.isSummaryTask(s) && s.auto_scheduling === !1; } t._isLinksCacheEnabled = function() { return n; }, t._startLinksCache = function() { e = {}, i = {}, a = {}, r = {}, n = !0; }, t._endLinksCache = function() { e = {}, i = {}, a = {}, r = {}, n = !1; }, t._formatLink = function(s, l, d) { if (n && e[s.id]) return e[s.id]; var u = [], c = this._get_link_target(s), h = this._get_link_source(s); if (!h || !c || t.isSummaryTask(c) && t.isChildOf(h.id, c.id) || t.isSummaryTask(h) && t.isChildOf(c.id, h.id)) return u; var _ = t.config.schedule_from_end && t.config.project_end, f = t.config.auto_scheduling_move_projects; !t.config.auto_scheduling_compatibility && t.config.auto_scheduling_strict && (f = !1), l = l || this.isSummaryTask(h) && !o(h) ? this.getSubtaskDates(h.id) : { start_date: h.start_date, end_date: h.end_date }; var k = this._getImplicitLinks(s, h, function(S) { return f && _ ? S.$source.length || t.getState("tasksDnd").drag_id == S.id ? 0 : t.calculateDuration({ start_date: S.end_date, end_date: l.end_date, task: h }) : 0; }, !0); d || (d = { start_date: c.start_date, end_date: c.end_date }, this.isSummaryTask(c) && !o(c) && ((d = this.getSubtaskDates(c.id)).start_date = d.end_date, this.eachTask(function(S) { S.type !== this.config.types.project && !S.$target.length && S.start_date < d.start_date && (d.start_date = S.start_date); }, c.id))); for (var m = this._getImplicitLinks(s, c, function(S) { return !f || _ || S.$target.length || t.getState("tasksDnd").drag_id == S.id ? 0 : t.calculateDuration({ start_date: d.start_date, end_date: S.start_date, task: c }); }), b = 0, g = k.length; b < g; b++) for (var v = k[b], p = 0, y = m.length; p < y; p++) { var w = m[p], $ = 1 * v.lag + 1 * w.lag, x = { id: s.id, type: s.type, source: v.task, target: w.task, subtaskLink: v.subtaskLink, lag: (1 * s.lag || 0) + $ }; t._linkedTasks[x.target] = t._linkedTasks[x.target] || {}, t._linkedTasks[x.target][x.source] = !0, u.push(t._convertToFinishToStartLink(w.task, x, h, c, v.taskParent, w.taskParent)); } return n && (e[s.id] = u), u; }, t._isAutoSchedulable = function(s) { if (!(s.auto_scheduling !== !1 && s.unscheduled !== !0)) return !1; if (this.isSummaryTask(s)) { let l = !0; if (this.eachTask(function(d) { l && t._isAutoSchedulable(d) && (l = !1); }, s.id), l) return !1; } return !0; }, t._getImplicitLinks = function(s, l, d, u) { var c = []; if (this.isSummaryTask(l) && !o(l)) { var h, _ = {}; for (var f in this.eachTask(function(y) { this.isSummaryTask(y) && !o(y) || (_[y.id] = y); }, l.id), _) { var k = _[f]; if (t._isAutoSchedulable(k)) { var m = u ? k.$source : k.$target; h = !1; for (var b = 0; b < m.length && s.type != t.config.links.start_to_start && s.type != t.config.links.start_to_finish; b++) { var g = t.getLink(m[b]), v = u ? g.target : g.source, p = _[v]; if (p && t._isAutoSchedulable(k) && t._isAutoSchedulable(p)) { let y = 0; if (g.lag && (y = Math.abs(g.lag)), g.type != t.config.links.finish_to_start) { y += t._convertToFinishToStartLink(null, {}, k, p).additionalLag; continue; } const w = g.target == p.id && y && y <= p.duration, $ = g.target == k.id && y && y <= k.duration; if (w || $) { h = !0; break; } } } if (!h) { let y = !0; for (const $ in t._linkedTasks[k.id]) if (t.isChildOf($, s.target)) { y = !1; break; } let w = 0; y && (w = d(k)), c.push({ task: k.id, taskParent: k.parent, lag: w, subtaskLink: !0 }); } } } } else c.push({ task: l.id, taskParent: l.parent, lag: 0 }); return c; }, t._getDirectDependencies = function(s, l) { t._linkedTasks = t._linkedTasks || {}; for (var d = [], u = [], c = l ? s.$source : s.$target, h = 0; h < c.length; h++) { var _ = this.getLink(c[h]); if (this.isTaskExists(_.source) && this.isTaskExists(_.target)) { var f = this.getTask(_.target); if (!this._isAutoSchedulable(f) || !this._isAutoSchedulable(s)) continue; if (t.config.auto_scheduling_use_progress) { if (f.progress == 1) continue; d.push(_); } else d.push(_); } } for (h = 0; h < d.length; h++) u = u.concat(this._formatLink(d[h])); return u; }, t._getInheritedDependencies = function(s, l) { var d, u = !1, c = []; return this.isTaskExists(s.id) && this.eachParent(function(h) { var _; u || (n && (d = l ? i : a)[h.id] ? c = c.concat(d[h.id]) : this.isSummaryTask(h) && (this._isAutoSchedulable(h) ? (_ = this._getDirectDependencies(h, l), n && (d[h.id] = _), c = c.concat(_)) : u = !0)); }, s.id, this), c; }, t._getDirectSuccessors = function(s) { return this._getDirectDependencies(s, !0); }, t._getInheritedSuccessors = function(s) { return this._getInheritedDependencies(s, !0); }, t._getDirectPredecessors = function(s) { return this._getDirectDependencies(s, !1); }, t._getInheritedPredecessors = function(s) { return this._getInheritedDependencies(s, !1); }, t._getSuccessors = function(s, l) { var d = this._getDirectSuccessors(s); return l ? d : d.concat(this._getInheritedSuccessors(s)); }, t._getPredecessors = function(s, l) { var d, u = String(s.id) + "-" + String(l); if (n && r[u]) return r[u]; var c = this._getDirectPredecessors(s); return d = l ? c : c.concat(this._getInheritedPredecessors(s)), n && (r[u] = d), d; }, t._convertToFinishToStartLink = function(s, l, d, u, c, h) { var _ = { target: s, link: t.config.links.finish_to_start, id: l.id, lag: l.lag || 0, sourceLag: 0, targetLag: 0, trueLag: l.lag || 0, source: l.source, preferredStart: null, sourceParent: c, targetParent: h, hashSum: null, subtaskLink: l.subtaskLink }, f = 0; switch (String(l.type)) { case String(t.config.links.start_to_start): f = -d.duration, _.sourceLag = f; break; case String(t.config.links.finish_to_finish): f = -u.duration, _.targetLag = f; break; case String(t.config.links.start_to_finish): f = -d.duration - u.duration, _.sourceLag = -d.duration, _.targetLag = -u.duration; break; default: f = 0; } return _.lag += f, _.hashSum = _.lag + "_" + _.link + "_" + _.source + "_" + _.target, _; }; } var tn = { second: 1, minute: 60, hour: 3600, day: 86400, week: 604800, month: 2592e3, quarter: 7776e3, year: 31536e3 }; function Zt(t) { return tn[t] || tn.hour; } function _t(t, n) { if (t.forEach) t.forEach(n); else for (var e = t.slice(), i = 0; i < e.length; i++) n(e[i], i); } function Ee(t, n) { if (t.find) return t.find(n); for (var e = 0; e < t.length; e++) if (n(t[e], e)) return t[e]; } function Yt(t, n) { if (t.includes) return t.includes(n); for (var e = 0; e < t.length; e++) if (t[e] === n) return !0; return !1; } function Lt(t) { return Array.isArray ? Array.isArray(t) : t && t.length !== void 0 && t.pop && t.push; } function at(t) { return !(!t || typeof t != "object") && !!(t.getFullYear && t.getMonth && t.getDate); } function Et(t) { return at(t) && !isNaN(t.getTime()); } function Qt(t, n) { var e, i = function() { i.$cancelTimeout(), i.$pending = !0; var a = Array.prototype.slice.call(arguments); e = setTimeout(function() { t.apply(this, a), i.$pending = !1; }, n); }; return i.$pending = !1, i.$cancelTimeout = function() { clearTimeout(e), i.$pending = !1; }, i.$execute = function() { var a = Array.prototype.slice.call(arguments); t.apply(this, a), i.$cancelTimeout(); }, i; } function dt(t, n) { return en(t) && !en(n) && (t = "0"), t; } function en(t) { return t === 0; } function Bt(t, n) { for (var e, i, a, r = 0, o = t.length - 1; r <= o; ) if (i = +t[e = Math.floor((r + o) / 2)], a = +t[e - 1], i < n) r = e + 1; else { if (!(i > n)) { for (; +t[e] == +t[e + 1]; ) e++; return e; } if (!isNaN(a) && a < n) return e - 1; o = e - 1; } return t.length - 1; } function nn() { return { getVertices: function(t) { for (var n, e = {}, i = 0, a = t.length; i < a; i++) e[(n = t[i]).target] = n.target, e[n.source] = n.source; var r, o = []; for (var i in e) r = e[i], o.push(r); return o; }, topologicalSort: function(t) { for (var n = this.getVertices(t), e = {}, i = 0, a = n.length; i < a; i++) e[n[i]] = { id: n[i], $source: [], $target: [], $incoming: 0 }; for (i = 0, a = t.length; i < a; i++) { var r = e[t[i].target]; r.$target.push(i), r.$incoming = r.$target.length, e[t[i].source].$source.push(i); } for (var o = n.filter(function(c) { return !e[c].$incoming; }), s = []; o.length; ) { var l = o.pop(); s.push(l); var d = e[l]; for (i = 0; i < d.$source.length; i++) { var u = e[t[d.$source[i]].target]; u.$incoming--, u.$incoming || o.push(u.id); } } return s; }, groupAdjacentEdges: function(t) { for (var n, e = {}, i = 0, a = t.length; i < a; i++) e[(n = t[i]).source] || (e[n.source] = []), e[n.source].push(n); return e; }, tarjanStronglyConnectedComponents: function(t, n) { for (var e = {}, i = [], a = this.groupAdjacentEdges(n), r = !1, o = [], s = 0; s < t.length; s++) { var l = k(t[s]); if (!l.visited) for (var d = [l], u = 0; d.length; ) { var c = d.pop(); c.visited || (c.index = u, c.lowLink = u, u++, i.push(c), c.onStack = !0, c.visited = !0), r = !1, n = a[c.id] || []; for (var h = 0; h < n.length; h++) { var _ = k(n[h].target); if (_.edge = n[h], _.index === void 0) { d.push(c), d.push(_), r = !0; break; } _.onStack && (c.lowLink = Math.min(c.lowLink, _.index)); } if (!r) { if (c.index == c.lowLink) { for (var f = { tasks: [], links: [], linkKeys: [] }; (_ = i.pop()).onStack = !1, f.tasks.push(_.id), _.edge && (f.links.push(_.edge.id), f.linkKeys.push(_.edge.hashSum)), _ != c; ) ; o.push(f); } d.length && (_ = c, (c = d[d.length - 1]).lowLink = Math.min(c.lowLink, _.lowLink)); } } } return o; function k(m) { return e[m] || (e[m] = { id: m, onStack: !1, index: void 0, lowLink: void 0, edge: void 0 }), e[m]; } }, findLoops: function(t) { var n = []; _t(t, function(i) { i.target == i.source && n.push({ tasks: [i.source], links: [i.id] }); }); var e = this.getVertices(t); return _t(this.tarjanStronglyConnectedComponents(e, t), function(i) { i.tasks.length > 1 && n.push(i); }), n; } }; } function an(t) { return { getVirtualRoot: function() { return t.mixin(t.getSubtaskDates(), { id: t.config.root_id, type: t.config.types.project, $source: [], $target: [], $virtual: !0 }); }, getLinkedTasks: function(n, e) { var i = [n], a = !1; t._isLinksCacheEnabled() || (t._startLinksCache(), a = !0); for (var r = [], o = {}, s = {}, l = 0; l < i.length; l++) this._getLinkedTasks(i[l], o, e, s); for (var l in s) r.push(s[l]); return a && t._endLinksCache(), r; }, _collectRelations: function(n, e, i, a) { var r, o = t._getSuccessors(n, e), s = []; i && (s = t._getPredecessors(n, e)); for (var l = [], d = 0; d < o.length; d++) a[r = o[d].hashSum] || (a[r] = !0, l.push(o[d])); for (d = 0; d < s.length; d++) a[r = s[d].hashSum] || (a[r] = !0, l.push(s[d])); return l; }, _getLinkedTasks: function(n, e, i, a) { for (var r, o = n === void 0 ? t.config.root_id : n, s = (e = {}, {}), l = [{ from: o, includePredecessors: i, isChild: !1 }]; l.length; ) { var d = l.pop(), u = d.isChild; if (!e[o = d.from]) { r = t.isTaskExists(o) ? t.getTask(o) : this.getVirtualRoot(), e[o] = !0; for (var c = this._collectRelations(r, u, i, s), h = 0; h < c.length; h++) { var _ = c[h]; let m = !0; t.config.auto_scheduling_use_progress && t.getTask(_.target).progress == 1 && (m = !1); const b = t.getTask(_.target), g = t.getTask(_.source); (b.unscheduled || g.unscheduled) && (m = !1), m && (a[_.hashSum] = _); var f = _.sourceParent == _.targetParent; e[_.target] || l.push({ from: _.target, includePredecessors: !0, isChild: f }); } if (t.hasChild(r.id)) { var k = t.getChildren(r.id); for (h = 0; h < k.length; h++) e[k[h]] || l.push({ from: k[h], includePredecessors: !0, isChild: !0 }); } } } return a; } }; } var Jt, U = ((t) => (t.ASAP = "asap", t.ALAP = "alap", t.SNET = "snet", t.SNLT = "snlt", t.FNET = "fnet", t.FNLT = "fnlt", t.MSO = "mso", t.MFO = "mfo", t))(U || {}); class Pt { static Create(n) { const e = new Pt(); if (n) for (const i in e) n[i] !== void 0 && (e[i] = n[i]); return e; } constructor() { this.link = null, this.task = null, this.start_date = null, this.end_date = null, this.latestStart = null, this.earliestStart = null, this.earliestEnd = null, this.latestEnd = null, this.latestSchedulingStart = null, this.earliestSchedulingStart = null, this.latestSchedulingEnd = null, this.earliestSchedulingEnd = null, this.kind = "asap", this.conflict = !1; } } class ze { constructor(n) { this.isAsapTask = (e) => { const i = this.getConstraintType(e); return this._gantt.config.schedule_from_end ? i === U.ASAP : i !== U.ALAP; }, this.isAlapTask = (e) => !this.isAsapTask(e), this.getConstraintType = (e) => { if (!this._gantt._isAutoSchedulable(e)) return; const i = this._getTaskConstraint(e); return i.constraint_type ? i.constraint_type : this._gantt.config.schedule_from_end ? U.ALAP : U.ASAP; }, this._getTaskConstraint = (e) => { let i = this._getOwnConstraint(e); if (this._gantt.config.auto_scheduling_project_constraint && !this._gantt.getState().group_mode) { let a = U.ASAP; this._gantt.config.schedule_from_end && (a = U.ALAP), (i && i.constraint_type) !== a && i || (i = this._getParentConstraint(e)); } return i; }, this._getOwnConstraint = (e) => ({ constraint_type: e.constraint_type, constraint_date: e.constraint_date }), this._getParentConstraint = (e) => { let i = U.ASAP; this._gantt.config.schedule_from_end && (i = U.ALAP); let a = { constraint_type: i, constraint_date: null }; return this._gantt.eachParent((r) => { a.constraint_type === i && r.constraint_type && r.constraint_type !== i && (a = { constraint_type: r.constraint_type, constraint_date: r.constraint_date }); }, e.id), a; }, this.hasConstraint = (e) => !!this.getConstraintType(e), this.processConstraint = (e, i) => { const a = this._getTaskConstraint(e); if (a && !(a.constraint_type === U.ALAP || a.constraint_type === U.ASAP)) { if (Et(a.constraint_date)) { const r = a.constraint_date, o = Pt.Create(i); switch (o.task = e.id, a.constraint_type) { case U.SNET: o.earliestStart = new Date(r), o.earliestEnd = this._gantt.calculateEndDate({ start_date: o.earliestStart, duration: e.duration, task: e }), o.link = null; break; case U.SNLT: o.latestStart = new Date(r), o.latestEnd = this._gantt.calculateEndDate({ start_date: o.latestStart, duration: e.duration, task: e }), o.link = null; break; case U.FNET: o.earliestStart = this._gantt.calculateEndDate({ start_date: r, duration: -e.duration, task: e }), o.earliestEnd = new Date(r), o.link = null; break; case U.FNLT: o.latestStart = this._gantt.calculateEndDate({ start_date: r, duration: -e.duration, task: e }), o.latestEnd = new Date(r), o.link = null; break; case U.MSO: o.earliestStart = new Date(r), o.earliestEnd = this._gantt.calculateEndDate({ start_date: o.earliestStart, duration: e.duration, task: e }), o.latestStart = o.earliestStart, o.latestEnd = o.earliestEnd, o.link = null; break; case U.MFO: o.earliestStart = this._gantt.calculateEndDate({ start_date: r, duration: -e.duration, task: e }), o.earliestEnd = this._gantt.calculateEndDate({ start_date: o.earliestStart, duration: e.duration, task: e }), o.latestStart = o.earliestStart, o.latestEnd = o.earliestEnd, o.link = null; } return o; } } return i; }, this.getConstraints = (e, i) => { const a = [], r = {}, o = (l) => { r[l.id] || this.hasConstraint(l) && !this._gantt.isSummaryTask(l) && (r[l.id] = l); }; if (this._gantt.isTaskExists(e)) { const l = this._gantt.getTask(e); o(l); } let s; if (this._gantt.eachTask((l) => o(l), e), i) for (let l = 0; l < i.length; l++) { const d = i[l]; r[d.target] || (s = this._gantt.getTask(d.target), o(s)), r[d.source] || (s = this._gantt.getTask(d.source), o(s)); } for (const l in r) r[l].type !== this._gantt.config.types.placeholder && a.push(r[l]); return a; }, this._gantt = n; } static Create(n) { return new ze(n); } } class Cn { constructor(n) { this._gantt = n; } isEqual(n, e, i) { return !this._gantt._hasDuration(n, e, i); } isFirstSmaller(n, e, i) { return n.valueOf() < e.valueOf() && !this.isEqual(n, e, i); } isSmallerOrDefault(n, e, i) { return !(n && !this.isFirstSmaller(n, e, i)); } isGreaterOrDefault(n, e, i) { return !(n && !this.isFirstSmaller(e, n, i)); } } class je { static Create(n) { const e = new je(); return e._gantt = n, e._comparator = new Cn(n), e; } resolveRelationDate(n, e, i) { let a = null, r = null, o = null, s = null; const l = this._gantt.getTask(n), d = e.successors; let u = null; const c = i[n]; for (let _ = 0; _ < d.length; _++) { const f = d[_]; s = f.preferredStart; const k = this.getLatestEndDate(f, i, l), m = this._gantt.calculateEndDate({ start_date: k, duration: -l.duration, task: l }); this._comparator.isGreaterOrDefault(u, k, l) && (u = k), this._comparator.isGreaterOrDefault(s, m, l) && this._comparator.isGreaterOrDefault(a, k, l) && (a = k, o = m, r = f.id); } !d.length && this._gantt.config.project_end && (this._comparator.isGreaterOrDefault(this._gantt.config.project_end, l.end_date, l) && (a = this._gantt.config.project_end), this._gantt.callEvent("onBeforeTaskAutoSchedule", [l, l.end_date]) === !1 && (a = l.end_date)), a && (l.duration ? (a = this._gantt.getClosestWorkTime({ date: a, dir: "future", task: l }), o = this._gantt.calculateEndDate({ start_date: a, duration: -l.duration, task: l })) : o = a = this._gantt.getClosestWorkTime({ date: a, dir: "past", task: l })); const h = Pt.Create(c); return h.link = r, h.task = n, h.end_date = a, h.start_date = o, h.kind = "alap", u && (h.latestSchedulingStart = this._gantt.calculateEndDate({ start_date: u, duration: -l.duration, task: l }), h.latestSchedulingEnd = u), h; } getSuccessorStartDate(n, e) { const i = e[n], a = this._gantt.getTask(n); let r; return r = i && (i.start_date || i.end_date) ? i.start_date ? i.start_date : this._gantt.calculateEndDate({ start_date: i.end_date, duration: -a.duration, task: a }) : a.start_date, r; } getLatestEndDate(n, e, i) { const a = this.getSuccessorStartDate(n.target, e), r = i; let o = this._gantt.getClosestWorkTime({ date: a, dir: "past", task: r }); return o && n.lag && 1 * n.lag == 1 * n.lag && (o = this._gantt.calculateEndDate({ start_date: o, duration: 1 * -n.lag, task: r })), o; } } class Fe { static Create(n) { const e = new Fe(); return e._gantt = n, e._comparator = new Cn(n), e; } resolveRelationDate(n, e, i) { let a = null, r = null, o = null; const s = this._gantt.getTask(n), l = e.predecessors, d = {}; let u = null; for (let f = 0; f < l.length; f++) { const k = l[f]; o = k.preferredStart; const m = this.getEarliestStartDate(k, i, s); if (this._comparator.isSmallerOrDefault(u, m, s) && (u = m), this._comparator.isSmallerOrDefault(o, m, s) && this._comparator.isSmallerOrDefault(a, m, s) && (a = m, r = k.id), !s.duration) { const b = this._gantt.getLink(k.id); (d[b.type] === void 0 || d[b.type] < +m) && (d[b.type] = +m); } } !l.length && this._gantt.config.project_start && ((this._comparator.isSmallerOrDefault(s.start_date, this._gantt.config.project_start, s) || this._gantt.config.auto_scheduling_strict && this._comparator.isGreaterOrDefault(s.start_date, this._gantt.config.project_start, s)) && (a = this._gantt.config.project_start), this._gantt.callEvent("onBeforeTaskAutoSchedule", [s, s.start_date]) === !1 && (a = s.start_date)); let c = null; if (a) if (s.duration) a = this._gantt.getClosestWorkTime({ date: a, dir: "future", task: s }), c = this._gantt.calculateEndDate({ start_date: a, duration: s.duration, task: s }); else { let f = "future"; const k = this._gantt.config.links; if (d[k.finish_to_finish] !== void 0) { const m = l.length === 1; let b = !0; for (const g in d) if (g != k.finish_to_finish && d[k.finish_to_finish] < d[g]) { b = !1; break; } (m || b) && (f = "past"); } a = c = this._gantt.getClosestWorkTime({ date: a, dir: f, task: s }); } const h = i[n], _ = Pt.Create(h); return _.link = r, _.task = n, _.start_date = a, _.end_date = c, _.kind = "asap", u && (_.earliestSchedulingStart = u, _.earliestSchedulingEnd = this._gantt.calculateEndDate({ start_date: u, duration: s.duration, task: s })), _; } getPredecessorEndDate(n, e) { const i = e[n], a = this._gantt.getTask(n); let r; return r = i && (i.start_date || i.end_date) ? i.end_date ? i.end_date : this._gantt.calculateEndDate({ start_date: i.start_date, duration: a.duration, task: a }) : a.end_date, r; } getEarliestStartDate(n, e, i) { const a = this.getPredecessorEndDate(n.source, e), r = i, o = this._gantt.getTask(n.source); let s; if (a && n.lag && 1 * n.lag == 1 * n.lag) { let l = r; this._gantt.config.auto_scheduling_move_projects && n.subtaskLink && this._gantt.isTaskExists(n.targetParent) && (l = this._gantt.getTask(n.targetParent)), s = this._gantt.getClosestWorkTime({ date: a, dir: "future", task: o }), n.sourceLag && (s = this._gantt.calculateEndDate({ start_date: s, duration: 1 * n.sourceLag, task: o })), n.targetLag && (s = this._gantt.calculateEndDate({ start_date: s, duration: 1 * n.targetLag, task: l })), s = this._gantt.calculateEndDate({ start_date: s, duration: 1 * n.trueLag, task: l }); } else { const l = this._gantt.getLink(n.id).type === this._gantt.config.links.finish_to_finish; s = !r.duration && l ? this._gantt.getClosestWorkTime({ date: a, dir: "past", task: r }) : this._gantt.getClosestWorkTime({ date: a, dir: "future", task: r }); } return s; } } class si { constructor(n, e, i) { this._secondIteration = !1, this._gantt = n, this._constraintsHelper = i, this._graphHelper = e, this._asapStrategy = Fe.Create(n), this._alapStrategy = je.Create(n), this._secondIterationRequired = !1; } generatePlan(n, e) { const i = this._graphHelper, a = this._gantt, r = this._constraintsHelper, o = this._alapStrategy, s = this._asapStrategy, { orderedIds: l, reversedIds: d, relationsMap: u, plansHash: c } = this.buildWorkCollections(n, e, i); let h; return this.processConstraints(l, c, a, r), h = a.config.schedule_from_end ? this.iterateTasks(d, l, r.isAlapTask, o, s, u, c) : this.iterateTasks(l, d, r.isAsapTask, s, o, u, c), h; } applyProjectPlan(n) { const e = this._gantt; let i, a, r, o; const s = []; for (let l = 0; l < n.length; l++) { if (r = null, o = null, i = n[l], !e.isTaskExists(i.task)) continue; a = e.getTask(i.task), i.link && (r = e.getLink(i.link), o = i.kind === "asap" ? this._gantt.getTask(r.source) : this._gantt.getTask(r.target)); let d = null; i.start_date && a.start_date.valueOf() !== i.start_date.valueOf() && (d = i.start_date), d && (a.start_date = d, a.end_date = e.calculateEndDate(a), s.push(a.id), e.callEvent("onAfterTaskAutoSchedule", [a, d, r, o])); } return s; } iterateTasks(n, e, i, a, r, o, s) { const l = this._gantt, d = []; for (let u = 0; u < n.length; u++) { const c = n[u], h = l.getTask(c); if (!l._isAutoSchedulable(h)) continue; const _ = a.resolveRelationDate(c, o[c], s); this.limitPlanDates(h, _), i(h) ? this.processResolvedDate(h, _, d, s) : s[h.id] = _; } for (let u = 0; u < e.length; u++) { const c = e[u], h = l.getTask(c); if (l._isAutoSchedulable(h) && !i(h)) { const _ = r.resolveRelationDate(c, o[c], s); this.limitPlanDates(h, _), this.processResolvedDate(h, _, d, s); } } if (this._secondIterationRequired) { if (this._secondIteration) this._secondIteration = !1; else if (this._secondIteration = !0, this.summaryLagChanged(l, o, s)) return this.iterateTasks(n, e, i, a, r, o, s); } return d; } summaryLagChanged(n, e, i) { const a = {}, r = {}; for (const s in e) e[s].predecessors.forEach((l) => { if (l.subtaskLink) { const d = n.getLink(l.id); this.getProjectUpdates(n, i, l, d, "source", a, r), this.getProjectUpdates(n, i, l, d, "target", a, r); } }); let o = !1; for (const s in a) { const l = a[s]; if (!l.min || !l.max) continue; const d = n.getTask(s), u = n.calculateDuration({ start_date: d.start_date, end_date: d.end_date, task: d }), c = n.calculateDuration({ start_date: l.min, end_date: l.max, task: d }); c !== u && (d.start_date = l.min, d.end_date = l.max, d.duration = c); } for (const s in r) { const l = r[s]; let d, u; const c = a[l.source], h = a[l.target]; c && (d = { start_date: c.start_date, end_date: c.end_date }), h && (d = { start_date: h.start_date, end_date: h.end_date }), n._formatLink(l, d, u).forEach(function(_) { for (const f in e) e[f].predecessors.forEach(function(k) { const m = k.id === _.id, b = k.target === _.target, g = k.source === _.source; m && b && g && (k.lag = _.lag, k.sourceLag = _.sourceLag, k.targetLag = _.targetLag, k.hashSum = _.hashSum); }); }), o = !0; } return o; } getProjectUpdates(n, e, i, a, r, o, s) { if (n.getTask(a[r]).type === n.config.types.project) { o[a[r]] = o[a[r]] || { id: a[r], link: a }; const l = o[a[r]]; let d = e[i[r]]; d && (r != "source" || d.start_date && d.end_date || (d = n.getTask(d.task)), l.min = l.min || d.start_date, l.min > d.start_date && (l.min = d.start_date), l.max = l.max || d.end_date, l.max < d.end_date && (l.max = d.end_date), s[a.id] = a); } } processResolvedDate(n, e, i, a) { if (e.start_date && this._gantt.isLinkExists(e.link)) { let r = null, o = null; if (e.link && (r = this._gantt.getLink(e.link), o = e.kind === "asap" ? this._gantt.getTask(r.source) : this._gantt.getTask(r.target)), n.start_date.valueOf() !== e.start_date.valueOf() && this._gantt.callEvent("onBeforeTaskAutoSchedule", [n, e.start_date, r, o]) === !1) return; } a[n.id] = e, e.start_date && i.push(e); } limitPlanDates(n, e) { const i = e.start_date || n.start_date; return e.earliestStart && i < e.earliestStart && (e.start_date = e.earliestStart, e.end_date = e.earliestEnd), e.latestStart && i > e.latestStart && (e.start_date = e.latestStart, e.end_date = e.latestEnd), e.latestSchedulingStart && i > e.latestSchedulingStart && (e.start_date = e.latestSchedulingStart, e.end_date = e.latestSchedulingEnd), e.earliestSchedulingStart && i < e.earliestSchedulingStart && (e.start_date = e.earliestSchedulingStart, e.end_date = e.earliestSchedulingEnd), e.start_date && (e.start_date > e.latestSchedulingStart || e.start_date < e.earliestSchedulingStart || e.start_date > e.latestStart || e.start_date < e.earliestStart || e.end_date > e.latestSchedulingEnd || e.end_date < e.earliestSchedulingEnd || e.end_date > e.latestEnd || e.end_date < e.earliestEnd) && (e.conflict = !0), e; } buildWorkCollections(n, e, i) { const a = this._gantt, r = i.topologicalSort(n), o = r.slice().reverse(), s = {}, l = {}; for (let d = 0, u = r.length; d < u; d++) { const c = r[d], h = a.getTask(c); a._isAutoSchedulable(h) && (l[c] = { successors: [], predecessors: [] }, s[c] = null); } for (let d = 0, u = e.length; d < u; d++) { const c = e[d]; s[c.id] === void 0 && (o.unshift(c.id), r.unshift(c.id), s[c.id] = null, l[c.id] = { successors: [], predecessors: [] }); } for (let d = 0, u = n.length; d < u; d++) { const c = n[d]; l[c.source] && l[c.source].successors.push(c), l[c.target] && l[c.target].predecessors.push(c); } return { orderedIds: r, reversedIds: o, relationsMap: l, plansHash: s }; } processConstraints(n, e, i, a) { for (let r = 0; r < n.length; r++) { const o = n[r], s = i.getTask(o), l = a.getConstraintType(s); if (l && l !== U.ASAP && l !== U.ALAP) { const d = a.processConstraint(s, Pt.Create()); e[s.id] = d; } } } } function he(t, n, e) { const i = [t], a = [], r = {}, o = {}; let s; for (; i.length > 0; ) if (s = i.shift(), !e[s]) { e[s] = !0, a.push(s); for (let u = 0; u < n.length; u++) { const c = n[u]; c.source == s || c.sourceParent == s ? (e[c.target] || (i.push(c.target), o[c.id] = !0, n.splice(u, 1), u--), r[c.hashSum] = c) : c.target != s && c.targetParent != s || (e[c.source] || (i.push(c.source), o[c.id] = !0, n.splice(u, 1), u--), r[c.hashSum] = c); } } const l = []; let d = []; for (const u in o) l.push(u); for (const u in r) d.push(r[u]); return d.length || (d = n), { tasks: a, links: l, processedLinks: d }; } class oi { constructor(n, e) { this.getConnectedGroupRelations = (i) => he(i, this._linksBuilder.getLinkedTasks(), {}).processedLinks, this.getConnectedGroup = (i) => { const a = this._linksBuilder.getLinkedTasks(); if (i !== void 0) { if (this._gantt.getTask(i).type === this._gantt.config.types.project) return { tasks: [], links: [] }; const r = he(i, a, {}); return { tasks: r.tasks, links: r.links }; } return function(r) { const o = {}, s = []; let l, d, u; for (let c = 0; c < r.length; c++) if (l = r[c].source, d = r[c].target, u = null, o[l] ? o[d] || (u = d) : u = l, u) { const h = r.length; s.push(he(u, r, o)), h !== r.length && (c = -1); } return s; }(a).map((r) => ({ tasks: r.tasks, links: r.links })); }, this._linksBuilder = e, this._gantt = n; } } class li { constructor(n, e, i) { this.isCircularLink = (a) => !!this.getLoopContainingLink(a), this.getLoopContainingLink = (a) => { const r = this._graphHelper, o = this._linksBuilder, s = this._gantt; let l = o.getLinkedTasks(); s.isLinkExists(a.id) || (l = l.concat(s._formatLink(a))); const d = r.findLoops(l); for (let u = 0; u < d.length; u++) { const c = d[u].links; for (let h = 0; h < c.length; h++) if (c[h] == a.id) return d[u]; } return null; }, this.findCycles = () => { const a = this._graphHelper, r = this._linksBuilder.getLinkedTasks(); return a.findLoops(r); }, this._linksBuilder = i, this._graphHelper = e, this._gantt = n; } } function di(t, n, e, i) { const a = function() { let r, o, s = !1; function l($, x) { t.config.auto_scheduling && !t._autoscheduling_in_progress && (t.getState().batch_update ? s = !0 : t.autoSchedule(x.source)); } function d($, x) { const S = t.config.auto_scheduling_use_progress; return t.config.auto_scheduling_use_progress = !1, t.isCircularLink(x) ? (t.callEvent("onCircularLinkError", [x, e.getLoopContainingLink(x)]), t.config.auto_scheduling_use_progress = S, !1) : (t.config.auto_scheduling_use_progress = S, !0); } function u($, x) { const S = t.getTask(x.source), T = t.getTask(x.target); return !(!t.config.auto_scheduling_descendant_links && (t.isChildOf(S.id, T.id) && t.isSummaryTask(T) || t.isChildOf(T.id, S.id) && t.isSummaryTask(S))); } function c($, x, S, T) { return !!$ != !!x || !(!$ && !x) && ($.valueOf() > x.valueOf() ? t._hasDuration({ start_date: x, end_date: $, task: T }) : t._hasDuration({ start_date: $, end_date: x, task: S })); } function h($, x) { return !!c($.start_date, x.start_date, $, x) || t.getConstraintType($) !== t.getConstraintType(x) || !!c($.constraint_date, x.constraint_date, $, x) || !(!c($.start_date, x.start_date, $, x) && (!c($.end_date, x.end_date, $, x) && $.duration === x.duration || $.type === t.config.types.milestone)) || void 0; } function _($) { return t.config.auto_scheduling_compatibility ? n.getLinkedTasks($, !0) : i.getConnectedGroupRelations($); } function f($, x) { let S = !1; for (let T = 0; T < r.length; T++) { const E = t.getLink(x[T].id); !E || E.type !== t.config.links.start_to_start && E.type !== t.config.links.start_to_finish || (x.splice(T, 1), T--, S = !0); } if (S) { const T = {}; for (let C = 0; C < x.length; C++) T[x[C].id] = !0; const E = _($); for (let C = 0; C < E.length; C++) T[E[C].id] || x.push(E[C]); } } function k($, x) { if (t.config.schedule_from_end) { if (x.end_date && $.end_date && $.end_date.valueOf() === x.end_date.valueOf()) return !0; } else if (x.start_date && $.start_date && $.start_date.valueOf() === x.start_date.valueOf()) return !0; } function m($) { if ($.auto_scheduling === !1) return; const x = t.config.constraint_types, S = [x.SNLT, x.FNLT, x.MSO, x.MFO], T = [x.SNET, x.FNET, x.MSO, x.MFO]; t.config.schedule_from_end ? S.indexOf($.constraint_type) > -1 ? $.constraint_type == x.SNLT || $.constraint_type == x.MSO ? $.constraint_date = new Date($.start_date) : $.constraint_date = new Date($.end_date) : ($.constraint_type = x.FNLT, $.constraint_date = new Date($.end_date)) : T.indexOf($.constraint_type) > -1 ? $.constraint_type == x.SNET || $.constraint_type == x.MSO ? $.constraint_date = new Date($.start_date) : $.constraint_date = new Date($.end_date) : ($.constraint_type = x.SNET, $.constraint_date = new Date($.start_date)); } function b($) { t.config.auto_scheduling_compatibility && ($.constraint_type !== t.config.constraint_types.SNET && $.constraint_type !== t.config.constraint_types.FNLT || ($.constraint_type = null, $.constraint_date = null)); } t.attachEvent("onAfterBatchUpdate", function() { s && t.autoSchedule(), s = !1; }), t.attachEvent("onAfterLinkUpdate", l), t.attachEvent("onAfterLinkAdd", l), t.attachEvent("onAfterLinkDelete", function($, x) { if (t.config.auto_scheduling && !t._autoscheduling_in_progress && t.isTaskExists(x.target)) { const S = t.getTask(x.target), T = t._getPredecessors(S); T.length && (t.getState().batch_update ? s = !0 : t.autoSchedule(T[0].source, !1)); } }), t.attachEvent("onParse", function() { t.config.auto_scheduling && t.config.auto_scheduling_initial && t.autoSchedule(); }), t.attachEvent("onBeforeLinkAdd", d), t.attachEvent("onBeforeLinkAdd", u), t.attachEvent("onBeforeLinkUpdate", d), t.attachEvent("onBeforeLinkUpdate", u), t.attachEvent("onBeforeTaskDrag", function($, x, S) { return t.config.auto_scheduling && (t.getState().drag_mode !== "progress" && (r = _($)), o = $), !0; }); const g = function($, x) { const S = t.getTask($); k(S, x) || m(S); }; let v, p = null; if (t.ext && t.ext.inlineEditors) { const $ = t.ext.inlineEditors, x = { start_date: !0, end_date: !0, duration: !0, constraint_type: !0, constraint_date: !0 }; $.attachEvent("onBeforeSave", function(S) { if (x[S.columnName]) { p = S.id, S.columnName === "constraint_type" && (v = !0); const T = S.columnName === "duration", E = t.config.schedule_from_end && S.columnName === "start_date", C = !t.config.schedule_from_end && S.columnName === "end_date", D = t.config.inline_editors_date_processing !== "keepDuration" && (E || C), I = S.columnName === "constraint_date"; (T || D || I) && (t.getTask(S.id).$keep_constraints = !0); } return !0; }); } const y = {}; let w; t.attachEvent("onBeforeTaskChanged", function($, x, S) { return g($, S), y[$] = S, !0; }), t.attachEvent("onAfterTaskDrag", function($, x, S) { $ === o && (clearTimeout(w), w = setTimeout(function() { (function(T, E) { if (t.config.auto_scheduling && !t._autoscheduling_in_progress) { const C = t.getTask(T), D = t.config.auto_scheduling_use_progress && E.progress === 1 != (C.progress === 1); if (h(E, C)) { if (g(T, E), t.config.auto_scheduling_move_projects && o == T) { let I = !0; t.calculateDuration(E) !== t.calculateDuration(C) && (f(T, r), I = !1), D ? t.autoSchedule() : (I && f(T, r), t._autoSchedule(T, r)); } else t.autoSchedule(C.id); b(C); } } r = null, o = null; })($, y[$]); })); }), t.ext.inlineEditors && t.ext.inlineEditors.attachEvent("onBeforeSave", function($) { if (t.config.auto_scheduling && !t._autoscheduling_in_progress) { const x = t.ext.inlineEditors.getEditorConfig($.columnName); x.map_to !== "start_date" && x.map_to !== "end_date" && x.map_to !== "duration" || (p = $.id); } return !0; }), t.attachEvent("onLightboxSave", function($, x) { if (t.config.auto_scheduling && !t._autoscheduling_in_progress) { v = !1; const S = t.getTask($); h(x, S) && (p = $, k(x, S) && (x.$keep_constraints = !0), t.getConstraintType(x) === t.getConstraintType(S) && +x.constraint_date == +S.constraint_date || (v = !0)); } return !0; }), t.attachEvent("onAfterTaskUpdate", function($, x) { return t.config.auto_scheduling && !t._autoscheduling_in_progress && p !== null && p == $ && (p = null, x.$keep_constraints ? delete x.$keep_constraints : v || m(x), t.autoSchedule(x.id), v || b(x)), !0; }); }; t.attachEvent("onGanttReady", function() { a(); }, { once: !0 }); } function J(t) { var n = 0, e = 0, i = 0, a = 0; if (t.getBoundingClientRect) { var r = t.getBoundingClientRect(), o = document.body, s = document.documentElement || document.body.parentNode || document.body, l = window.pageYOffset || s.scrollTop || o.scrollTop, d = window.pageXOffset || s.scrollLeft || o.scrollLeft, u = s.clientTop || o.clientTop || 0, c = s.clientLeft || o.clientLeft || 0; n = r.top + l - u, e = r.left + d - c, i = document.body.offsetWidth - r.right, a = document.body.offsetHeight - r.bottom; } else { for (; t; ) n += parseInt(t.offsetTop, 10), e += parseInt(t.offsetLeft, 10), t = t.offsetParent; i = document.body.offsetWidth - t.offsetWidth - e, a = document.body.offsetHeight - t.offsetHeight - n; } return { y: Math.round(n), x: Math.round(e), width: t.offsetWidth, height: t.offsetHeight, right: Math.round(i), bottom: Math.round(a) }; } function ci(t) { var n = !1, e = !1; if (window.getComputedStyle) { var i = window.getComputedStyle(t, null); n = i.display, e = i.visibility; } else t.currentStyle && (n = t.currentStyle.display, e = t.currentStyle.visibility); return n != "none" && e != "hidden"; } function ui(t) { return !isNaN(t.getAttribute("tabindex")) && 1 * t.getAttribute("tabindex") >= 0; } function hi(t) { return !{ a: !0, area: !0 }[t.nodeName.loLowerCase()] || !!t.getAttribute("href"); } function _i(t) { return !{ input: !0, select: !0, textarea: !0, button: !0, object: !0 }[t.nodeName.toLowerCase()] || !t.hasAttribute("disabled"); } function Ut(t) { for (var n = t.querySelectorAll(["a[href]", "area[href]", "input", "select", "textarea", "button", "iframe", "object", "embed", "[tabindex]", "[contenteditable]"].join(", ")), e = Array.prototype.slice.call(n, 0), i = 0; i < e.length; i++) e[i].$position = i; for (e.sort(function(r, o) { return r.tabIndex === 0 && o.tabIndex !== 0 ? 1 : r.tabIndex !== 0 && o.tabIndex === 0 ? -1 : r.tabIndex === o.tabIndex ? r.$position - o.$position : r.tabIndex < o.tabIndex ? -1 : 1; }), i = 0; i < e.length; i++) { var a = e[i]; (ui(a) || _i(a) || hi(a)) && ci(a) || (e.splice(i, 1), i--); } return e; } function Dn() { var t = document.createElement("div"); t.style.cssText = "visibility:hidden;position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;height:110px;min-height:100px;overflow-y:scroll;", document.body.appendChild(t); var n = t.offsetWidth - t.clientWidth; return document.body.removeChild(t), Math.max(n, 15); } function it(t) { if (!t) return ""; var n = t.className || ""; return n.baseVal && (n = n.baseVal), n.indexOf || (n = ""), Ce(n); } function xt(t, n) { n && t.className.indexOf(n) === -1 && (t.className += " " + n); } function Nt(t, n) { n = n.split(" "); for (var e = 0; e < n.length; e++) { var i = new RegExp("\\s?\\b" + n[e] + "\\b(?![-_.])", ""); t.className = t.className.replace(i, ""); } } function We(t) { return typeof t == "string" ? document.getElementById(t) || document.querySelector(t) || document.body : t || document.body; } function An(t, n) { Jt || (Jt = document.createElement("div")), Jt.innerHTML = n; var e = Jt.firstChild; return t.appendChild(e), e; } function Mn(t) { t && t.parentNode && t.parentNode.removeChild(t); } function In(t, n) { for (var e = t.childNodes, i = e.length, a = [], r = 0; r < i; r++) { var o = e[r]; o.className && o.className.indexOf(n) !== -1 && a.push(o); } return a; } function At(t) { var n; return t.tagName ? n = t : (n = (t = t || window.event).target || t.srcElement).shadowRoot && t.composedPath && (n = t.composedPath()[0]), n; } function tt(t, n) { if (n) { for (var e = At(t); e; ) { if (e.getAttribute && e.getAttribute(n)) return e; e = e.parentNode; } return null; } } function Ce(t) { return (String.prototype.trim || function() { return this.replace(/^\s+|\s+$/g, ""); }).apply(t); } function yt(t, n, e) { var i = At(t), a = ""; for (e === void 0 && (e = !0); i; ) { if (a = it(i)) { var r = a.indexOf(n); if (r >= 0) { if (!e) return i; var o = r === 0 || !Ce(a.charAt(r - 1)), s = r + n.length >= a.length || !Ce(a.charAt(r + n.length)); if (o && s) return i; } } i = i.parentNode; } return null; } function ct(t, n) { var e = document.documentElement, i = J(n); return { x: t.clientX + e.scrollLeft - e.clientLeft - i.x + n.scrollLeft, y: t.clientY + e.scrollTop - e.clientTop - i.y + n.scrollTop }; } function Ln(t, n) { const e = J(t), i = J(n); return { x: e.x - i.x, y: e.y - i.y }; } function et(t, n) { if (!t || !n) return !1; for (; t && t != n; ) t = t.parentNode; return t === n; } function ut(t, n) { if (t.closest) return t.closest(n); if (t.matches || t.msMatchesSelector || t.webkitMatchesSelector) { var e = t; if (!document.documentElement.contains(e)) return null; do { if ((e.matches || e.msMatchesSelector || e.webkitMatchesSelector).call(e, n)) return e; e = e.parentElement || e.parentNode; } while (e !== null && e.nodeType === 1); return null; } return console.error("Your browser is not supported"), null; } function Nn(t) { for (; t; ) { if (t.offsetWidth > 0 && t.offsetHeight > 0) return t; t = t.parentElement; } return null; } function Pn() { return document.head.createShadowRoot || document.head.attachShadow; } function De() { var t = document.activeElement; return t.shadowRoot && (t = t.shadowRoot.activeElement), t === document.body && document.getSelection && (t = document.getSelection().focusNode || document.body), t; } function Dt(t) { if (!t || !Pn()) return document.body; for (; t.parentNode && (t = t.parentNode); ) if (t instanceof ShadowRoot) return t.host; return document.body; } const Rn = Object.freeze(Object.defineProperty({ __proto__: null, addClassName: xt, closest: ut, getActiveElement: De, getChildNodes: In, getClassName: it, getClosestSizedElement: Nn, getFocusableNodes: Ut, getNodePosition: J, getRelativeEventPosition: ct, getRelativeNodePosition: Ln, getRootNode: Dt, getScrollSize: Dn, getTargetNode: At, hasClass: function(t, n) { return "classList" in t ? t.classList.contains(n) : new RegExp("\\b" + n + "\\b").test(t.className); }, hasShadowParent: function(t) { return !!Dt(t); }, insertNode: An, isChildOf: et, isShadowDomSupported: Pn, locateAttribute: tt, locateClassName: yt, removeClassName: Nt, removeNode: Mn, toNode: We }, Symbol.toStringTag, { value: "Module" })), Q = typeof window < "u" ? window : global; let gi = class { constructor(t) { this._mouseDown = !1, this._gantt = t, this._domEvents = t._createDomEventScope(); } attach(t, n, e) { const i = this._gantt, a = t.getViewPort(); this._originPosition = Q.getComputedStyle(a).display, this._restoreOriginPosition = () => { a.style.position = this._originPosition; }, this._originPosition === "static" && (a.style.position = "relative"); const r = i.$services.getService("state"); r.registerProvider("clickDrag", () => ({ autoscroll: !1 })); let o = null; const s = () => { o && (this._mouseDown = !0, t.setStart(i.copy(o)), t.setPosition(i.copy(o)), t.setEnd(i.copy(o)), o = null); }; this._domEvents.attach(a, "mousedown", (d) => { o = null; let u = ".gantt_task_line, .gantt_task_link"; e !== void 0 && (u = e instanceof Array ? e.join(", ") : e), u && i.utils.dom.closest(d.target, u) || (r.registerProvider("clickDrag", () => ({ autoscroll: this._mouseDown })), n && d[n] !== !0 || (o = this._getCoordinates(d, t))); }); const l = Dt(i.$root) || document.body; this._domEvents.attach(l, "mouseup", (d) => { if (o = null, (!n || d[n] === !0) && this._mouseDown === !0) { this._mouseDown = !1; const u = this._getCoordinates(d, t); t.dragEnd(u); } }), this._domEvents.attach(a, "mousemove", (d) => { if (n && d[n] !== !0) return; const u = this._gantt.ext.clickDrag, c = (this._gantt.config.drag_timeline || {}).useKey; if (u && c && !n && d[c]) return; let h = null; if (!this._mouseDown && o) return h = this._getCoordinates(d, t), void (Math.abs(o.relative.left - h.relative.left) > 5 && s()); this._mouseDown === !0 && (h = this._getCoordinates(d, t), t.setEnd(h), t.render()); }); } detach() { const t = this._gantt; this._domEvents.detachAll(), this._restoreOriginPosition && this._restoreOriginPosition(), t.$services.getService("state").unregisterProvider("clickDrag"); } destructor() { this.detach(); } _getCoordinates(t, n) { const e = n.getViewPort(), i = e.getBoundingClientRect(), { clientX: a, clientY: r } = t; return { absolute: { left: a, top: r }, relative: { left: a - i.left + e.scrollLeft, top: r - i.top + e.scrollTop } }; } }; var Hn = function() { this._silent_mode = !1, this.listeners = {}; }; Hn.prototype = { _silentStart: function() { this._silent_mode = !0; }, _silentEnd: function() { this._silent_mode = !1; } }; var fi = function(t) { var n = {}, e = 0, i = function() { var a = !0; for (var r in n) { var o = n[r].apply(t, arguments); a = a && o; } return a; }; return i.addEvent = function(a, r) { if (typeof a == "function") { var o; if (r && r.id ? o = r.id : (o = e, e++), r && r.once) { var s = a; a = function() { s(), i.removeEvent(o); }; } return n[o] = a, o; } return !1; }, i.removeEvent = function(a) { delete n[a]; }, i.clear = function() { n = {}; }, i; }; function gt(t) { var n = new Hn(); t.attachEvent = function(e, i, a) { e = "ev_" + e.toLowerCase(), n.listeners[e] || (n.listeners[e] = fi(this)), a && a.thisObject && (i = i.bind(a.thisObject)); var r = e + ":" + n.listeners[e].addEvent(i, a); return a && a.id && (r = a.id), r; }, t.attachAll = fun