in assets/js/316.d513d091.js [1013:1154]
const draw = function(text, id, version, diagObj) {
const conf2 = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.g)();
const LEFT_MARGIN = conf2.leftMargin ? conf2.leftMargin : 50;
diagObj.db.clear();
diagObj.parser.parse(text + "\n");
_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("timeline", diagObj.db);
const securityLevel = conf2.securityLevel;
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("#i" + id);
}
const root = securityLevel === "sandbox" ? (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("body");
const svg = root.select("#" + id);
svg.append("g");
const tasks2 = diagObj.db.getTasks();
const title = diagObj.db.getCommonDb().getDiagramTitle();
_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("task", tasks2);
svgDraw.initGraphics(svg);
const sections2 = diagObj.db.getSections();
_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("sections", sections2);
let maxSectionHeight = 0;
let maxTaskHeight = 0;
let depthY = 0;
let sectionBeginY = 0;
let masterX = 50 + LEFT_MARGIN;
let masterY = 50;
sectionBeginY = 50;
let sectionNumber = 0;
let hasSections = true;
sections2.forEach(function(section) {
const sectionNode = {
number: sectionNumber,
descr: section,
section: sectionNumber,
width: 150,
padding: 20,
maxHeight: maxSectionHeight
};
const sectionHeight = svgDraw.getVirtualNodeHeight(svg, sectionNode, conf2);
_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("sectionHeight before draw", sectionHeight);
maxSectionHeight = Math.max(maxSectionHeight, sectionHeight + 20);
});
let maxEventCount = 0;
let maxEventLineLength = 0;
_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("tasks.length", tasks2.length);
for (const [i, task] of tasks2.entries()) {
const taskNode = {
number: i,
descr: task,
section: task.section,
width: 150,
padding: 20,
maxHeight: maxTaskHeight
};
const taskHeight = svgDraw.getVirtualNodeHeight(svg, taskNode, conf2);
_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("taskHeight before draw", taskHeight);
maxTaskHeight = Math.max(maxTaskHeight, taskHeight + 20);
maxEventCount = Math.max(maxEventCount, task.events.length);
let maxEventLineLengthTemp = 0;
for (let j = 0; j < task.events.length; j++) {
const event = task.events[j];
const eventNode = {
descr: event,
section: task.section,
number: task.section,
width: 150,
padding: 20,
maxHeight: 50
};
maxEventLineLengthTemp += svgDraw.getVirtualNodeHeight(svg, eventNode, conf2);
}
maxEventLineLength = Math.max(maxEventLineLength, maxEventLineLengthTemp);
}
_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("maxSectionHeight before draw", maxSectionHeight);
_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("maxTaskHeight before draw", maxTaskHeight);
if (sections2 && sections2.length > 0) {
sections2.forEach((section) => {
const sectionNode = {
number: sectionNumber,
descr: section,
section: sectionNumber,
width: 150,
padding: 20,
maxHeight: maxSectionHeight
};
_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("sectionNode", sectionNode);
const sectionNodeWrapper = svg.append("g");
const node = svgDraw.drawNode(sectionNodeWrapper, sectionNode, sectionNumber, conf2);
_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("sectionNode output", node);
sectionNodeWrapper.attr("transform", `translate(${masterX}, ${sectionBeginY})`);
masterY += maxSectionHeight + 50;
const tasksForSection = tasks2.filter((task) => task.section === section);
if (tasksForSection.length > 0) {
drawTasks(
svg,
tasksForSection,
sectionNumber,
masterX,
masterY,
maxTaskHeight,
conf2,
maxEventCount,
maxEventLineLength,
maxSectionHeight,
false
);
}
masterX += 200 * Math.max(tasksForSection.length, 1);
masterY = sectionBeginY;
sectionNumber++;
});
} else {
hasSections = false;
drawTasks(
svg,
tasks2,
sectionNumber,
masterX,
masterY,
maxTaskHeight,
conf2,
maxEventCount,
maxEventLineLength,
maxSectionHeight,
true
);
}
const box = svg.node().getBBox();
_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("bounds", box);
if (title) {
svg.append("text").text(title).attr("x", box.width / 2 - LEFT_MARGIN).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20);
}
depthY = hasSections ? maxSectionHeight + maxTaskHeight + 150 : maxTaskHeight + 100;
const lineWrapper = svg.append("g").attr("class", "lineWrapper");
lineWrapper.append("line").attr("x1", LEFT_MARGIN).attr("y1", depthY).attr("x2", box.width + 3 * LEFT_MARGIN).attr("y2", depthY).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)");
(0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.s)(
void 0,
svg,
conf2.timeline.padding ? conf2.timeline.padding : 50,
conf2.timeline.useMaxWidth ? conf2.timeline.useMaxWidth : false
);
};