@diagrammo/dgmo 0.8.16 → 0.8.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -8,6 +8,9 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __esm = (fn, res) => function __init() {
9
9
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
10
  };
11
+ var __commonJS = (cb, mod) => function __require() {
12
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
+ };
11
14
  var __export = (target, all) => {
12
15
  for (var name in all)
13
16
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -2251,13 +2254,13 @@ function capsuleWidth(name, entries, containerWidth, addonWidth = 0) {
2251
2254
  visibleEntries: entries.length
2252
2255
  };
2253
2256
  }
2254
- const rowWidth = maxCapsuleW - LEGEND_CAPSULE_PAD * 2;
2257
+ const rowWidth = maxCapsuleW - LEGEND_CAPSULE_PAD;
2255
2258
  let row = 1;
2256
- let rowX = pw + 4;
2259
+ let rowX = LEGEND_CAPSULE_PAD + pw + 4 + addonWidth;
2257
2260
  let visible = 0;
2258
2261
  for (let i = 0; i < entries.length; i++) {
2259
2262
  const ew2 = entryWidth(entries[i].value);
2260
- if (rowX + ew2 > rowWidth && rowX > pw + 4) {
2263
+ if (rowX + ew2 > rowWidth && i > 0) {
2261
2264
  row++;
2262
2265
  rowX = 0;
2263
2266
  if (row > LEGEND_MAX_ENTRY_ROWS) {
@@ -2423,7 +2426,7 @@ function buildCapsuleLayout(group, containerWidth, addonWidth = 0) {
2423
2426
  let ex = LEGEND_CAPSULE_PAD + pw + 4 + addonWidth;
2424
2427
  let ey = 0;
2425
2428
  let rowX = ex;
2426
- const maxRowW = containerWidth - LEGEND_CAPSULE_PAD * 2;
2429
+ const maxRowW = containerWidth - LEGEND_CAPSULE_PAD;
2427
2430
  let currentRow = 0;
2428
2431
  for (let i = 0; i < info.visibleEntries; i++) {
2429
2432
  const entry = group.entries[i];
@@ -10359,7 +10362,7 @@ function addBusinessDays(startDate, count, workweek, holidaySet, direction = 1)
10359
10362
  }
10360
10363
  return current;
10361
10364
  }
10362
- function addGanttDuration(startDate, duration, holidays, holidaySet, direction = 1) {
10365
+ function addGanttDuration(startDate, duration, holidays, holidaySet, direction = 1, opts) {
10363
10366
  const { amount, unit } = duration;
10364
10367
  switch (unit) {
10365
10368
  case "bd":
@@ -10421,10 +10424,22 @@ function addGanttDuration(startDate, duration, holidays, holidaySet, direction =
10421
10424
  result.setTime(result.getTime() + amount * 6e4 * direction);
10422
10425
  return result;
10423
10426
  }
10427
+ case "s": {
10428
+ if (!opts?.sprintLength) {
10429
+ throw new Error(
10430
+ 'Sprint duration unit "s" requires sprintLength configuration'
10431
+ );
10432
+ }
10433
+ const sl = opts.sprintLength;
10434
+ const totalDays = amount * sl.amount * (sl.unit === "w" ? 7 : 1);
10435
+ const result = new Date(startDate);
10436
+ result.setDate(result.getDate() + Math.round(totalDays) * direction);
10437
+ return result;
10438
+ }
10424
10439
  }
10425
10440
  }
10426
10441
  function parseDuration(s) {
10427
- const match = s.trim().match(/^(\d+(?:\.\d+)?)(min|bd|d|w|m|q|y|h)$/);
10442
+ const match = s.trim().match(/^(\d+(?:\.\d+)?)(min|bd|d|w|m|q|y|h|s)$/);
10428
10443
  if (!match) return null;
10429
10444
  return { amount: parseFloat(match[1]), unit: match[2] };
10430
10445
  }
@@ -10511,7 +10526,11 @@ function parseGantt(content, palette) {
10511
10526
  defaultSwimlaneGroup: null,
10512
10527
  activeTag: null,
10513
10528
  optionLineNumbers: {},
10514
- holidaysLineNumber: null
10529
+ holidaysLineNumber: null,
10530
+ sprintLength: null,
10531
+ sprintNumber: null,
10532
+ sprintStart: null,
10533
+ sprintMode: null
10515
10534
  },
10516
10535
  diagnostics,
10517
10536
  error: null
@@ -10927,6 +10946,55 @@ function parseGantt(content, palette) {
10927
10946
  case "active-tag":
10928
10947
  result.options.activeTag = value;
10929
10948
  break;
10949
+ case "sprint-length": {
10950
+ const dur = parseDuration(value);
10951
+ if (!dur) {
10952
+ warn(
10953
+ lineNumber,
10954
+ `Invalid sprint-length value: "${value}". Expected a duration like "2w" or "10d".`
10955
+ );
10956
+ } else if (dur.unit !== "d" && dur.unit !== "w") {
10957
+ warn(
10958
+ lineNumber,
10959
+ `sprint-length only accepts "d" or "w" units, got "${dur.unit}".`
10960
+ );
10961
+ } else if (dur.amount <= 0) {
10962
+ warn(lineNumber, `sprint-length must be greater than 0.`);
10963
+ } else if (!Number.isInteger(dur.amount * (dur.unit === "w" ? 7 : 1))) {
10964
+ warn(
10965
+ lineNumber,
10966
+ `sprint-length must resolve to a whole number of days.`
10967
+ );
10968
+ } else {
10969
+ result.options.sprintLength = dur;
10970
+ }
10971
+ break;
10972
+ }
10973
+ case "sprint-number": {
10974
+ const n = Number(value);
10975
+ if (!Number.isFinite(n) || !Number.isInteger(n) || n <= 0) {
10976
+ warn(
10977
+ lineNumber,
10978
+ `sprint-number must be a positive integer, got "${value}".`
10979
+ );
10980
+ } else {
10981
+ result.options.sprintNumber = n;
10982
+ }
10983
+ break;
10984
+ }
10985
+ case "sprint-start": {
10986
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
10987
+ warn(
10988
+ lineNumber,
10989
+ `sprint-start requires a full date (YYYY-MM-DD), got "${value}".`
10990
+ );
10991
+ } else if (Number.isNaN((/* @__PURE__ */ new Date(value + "T00:00:00")).getTime())) {
10992
+ warn(lineNumber, `sprint-start is not a valid date: "${value}".`);
10993
+ } else {
10994
+ result.options.sprintStart = value;
10995
+ }
10996
+ break;
10997
+ }
10930
10998
  }
10931
10999
  continue;
10932
11000
  }
@@ -11107,6 +11175,21 @@ function parseGantt(content, palette) {
11107
11175
  result.options.sort = "default";
11108
11176
  }
11109
11177
  validateTagGroupNames(result.tagGroups, warn);
11178
+ const hasSprintOption = result.options.sprintLength !== null || result.options.sprintNumber !== null || result.options.sprintStart !== null;
11179
+ const hasSprintUnit = hasSprintDurationUnit(result.nodes);
11180
+ if (hasSprintOption) {
11181
+ result.options.sprintMode = "explicit";
11182
+ } else if (hasSprintUnit) {
11183
+ result.options.sprintMode = "auto";
11184
+ }
11185
+ if (result.options.sprintMode) {
11186
+ if (!result.options.sprintLength) {
11187
+ result.options.sprintLength = { amount: 2, unit: "w" };
11188
+ }
11189
+ if (result.options.sprintNumber === null) {
11190
+ result.options.sprintNumber = 1;
11191
+ }
11192
+ }
11110
11193
  return result;
11111
11194
  function makeTask(labelRaw, duration, uncertain, ln, explicitStart) {
11112
11195
  const segments = labelRaw.split("|");
@@ -11224,6 +11307,16 @@ function parseWorkweek(s) {
11224
11307
  function isKnownOption(key) {
11225
11308
  return KNOWN_OPTIONS5.has(key);
11226
11309
  }
11310
+ function hasSprintDurationUnit(nodes) {
11311
+ for (const node of nodes) {
11312
+ if (node.kind === "task") {
11313
+ if (node.duration?.unit === "s") return true;
11314
+ } else if (node.kind === "group" || node.kind === "parallel") {
11315
+ if (hasSprintDurationUnit(node.children)) return true;
11316
+ }
11317
+ }
11318
+ return false;
11319
+ }
11227
11320
  var DURATION_RE, EXPLICIT_DATE_RE, TIMELINE_DURATION_RE, GROUP_RE2, DEPENDENCY_RE, COMMENT_RE, ERA_RE, MARKER_RE, HOLIDAY_DATE_RE, HOLIDAY_RANGE_RE, WORKWEEK_RE, ERA_ENTRY_RE, MARKER_ENTRY_RE, WEEKDAY_MAP, KNOWN_OPTIONS5, KNOWN_BOOLEANS4;
11228
11321
  var init_parser9 = __esm({
11229
11322
  "src/gantt/parser.ts"() {
@@ -11233,9 +11326,9 @@ var init_parser9 = __esm({
11233
11326
  init_parsing();
11234
11327
  init_duration();
11235
11328
  init_palettes();
11236
- DURATION_RE = /^(\d+(?:\.\d+)?)(min|bd|d|w|m|q|y|h)(\?)?\s+(.+)$/;
11329
+ DURATION_RE = /^(\d+(?:\.\d+)?)(min|bd|d|w|m|q|y|h|s)(\?)?\s+(.+)$/;
11237
11330
  EXPLICIT_DATE_RE = /^(\d{4}-\d{2}-\d{2}(?: \d{2}:\d{2})?)\s+(.+)$/;
11238
- TIMELINE_DURATION_RE = /^(\d{4}-\d{2}-\d{2}(?: \d{2}:\d{2})?)\s*(?:->|\u2013>)\s*(\d+(?:\.\d+)?)(min|bd|d|w|m|q|y|h)(\?)?\s+(.+)$/;
11331
+ TIMELINE_DURATION_RE = /^(\d{4}-\d{2}-\d{2}(?: \d{2}:\d{2})?)\s*(?:->|\u2013>)\s*(\d+(?:\.\d+)?)(min|bd|d|w|m|q|y|h|s)(\?)?\s+(.+)$/;
11239
11332
  GROUP_RE2 = /^\[(.+?)\]\s*(.*)$/;
11240
11333
  DEPENDENCY_RE = /^(?:-(.+?))?->\s*(.+)$/;
11241
11334
  COMMENT_RE = /^\/\//;
@@ -11270,7 +11363,10 @@ var init_parser9 = __esm({
11270
11363
  "dependencies",
11271
11364
  "chart",
11272
11365
  "sort",
11273
- "active-tag"
11366
+ "active-tag",
11367
+ "sprint-length",
11368
+ "sprint-number",
11369
+ "sprint-start"
11274
11370
  ]);
11275
11371
  KNOWN_BOOLEANS4 = /* @__PURE__ */ new Set([
11276
11372
  "critical-path",
@@ -22667,6 +22763,7 @@ function calculateSchedule(parsed) {
22667
22763
  tagGroups: parsed.tagGroups,
22668
22764
  eras: parsed.eras,
22669
22765
  markers: parsed.markers,
22766
+ sprints: [],
22670
22767
  options: parsed.options,
22671
22768
  diagnostics,
22672
22769
  error: parsed.error
@@ -22688,6 +22785,7 @@ function calculateSchedule(parsed) {
22688
22785
  } else {
22689
22786
  projectStart = new Date(2e3, 0, 1);
22690
22787
  }
22788
+ const sprintOpts = parsed.options.sprintLength ? { sprintLength: parsed.options.sprintLength } : void 0;
22691
22789
  const depOffsetMap = /* @__PURE__ */ new Map();
22692
22790
  const allTasks = collectTasks(parsed.nodes);
22693
22791
  if (allTasks.length === 0) {
@@ -22769,7 +22867,8 @@ function calculateSchedule(parsed) {
22769
22867
  depOffset.duration,
22770
22868
  parsed.holidays,
22771
22869
  holidaySet,
22772
- depOffset.direction
22870
+ depOffset.direction,
22871
+ sprintOpts
22773
22872
  );
22774
22873
  }
22775
22874
  if (predEnd.getTime() > start.getTime()) {
@@ -22783,7 +22882,8 @@ function calculateSchedule(parsed) {
22783
22882
  task.offset.duration,
22784
22883
  parsed.holidays,
22785
22884
  holidaySet,
22786
- task.offset.direction
22885
+ task.offset.direction,
22886
+ sprintOpts
22787
22887
  );
22788
22888
  if (start.getTime() < projectStart.getTime()) {
22789
22889
  warn(
@@ -22823,7 +22923,9 @@ function calculateSchedule(parsed) {
22823
22923
  start,
22824
22924
  task.duration,
22825
22925
  parsed.holidays,
22826
- holidaySet
22926
+ holidaySet,
22927
+ 1,
22928
+ sprintOpts
22827
22929
  );
22828
22930
  }
22829
22931
  } else {
@@ -22837,7 +22939,8 @@ function calculateSchedule(parsed) {
22837
22939
  taskMap,
22838
22940
  depOffsetMap,
22839
22941
  parsed.holidays,
22840
- holidaySet
22942
+ holidaySet,
22943
+ sprintOpts
22841
22944
  ) : /* @__PURE__ */ new Set();
22842
22945
  const uncertainSet = /* @__PURE__ */ new Set();
22843
22946
  for (const taskId of sortedIds) {
@@ -22877,6 +22980,20 @@ function calculateSchedule(parsed) {
22877
22980
  result.startDate = minDate;
22878
22981
  result.endDate = maxDate;
22879
22982
  }
22983
+ if (parsed.options.sprintMode && parsed.options.sprintLength && result.tasks.length > 0) {
22984
+ result.sprints = generateSprintBands(
22985
+ parsed.options,
22986
+ result.startDate,
22987
+ result.endDate,
22988
+ projectStart
22989
+ );
22990
+ if (result.sprints.length > 0) {
22991
+ const lastSprintEnd = result.sprints[result.sprints.length - 1].endDate;
22992
+ if (lastSprintEnd.getTime() > result.endDate.getTime()) {
22993
+ result.endDate = lastSprintEnd;
22994
+ }
22995
+ }
22996
+ }
22880
22997
  const topLevelGroups = parsed.nodes.filter((n) => n.kind === "group");
22881
22998
  if (topLevelGroups.length >= 2) {
22882
22999
  const names = topLevelGroups.map(
@@ -23077,7 +23194,7 @@ function breakCycle(cycle, taskMap, depOffsetMap) {
23077
23194
  }
23078
23195
  }
23079
23196
  }
23080
- function computeCriticalPath(sortedIds, taskMap, depOffsetMap, holidays, holidaySet) {
23197
+ function computeCriticalPath(sortedIds, taskMap, depOffsetMap, holidays, holidaySet, sprintOpts) {
23081
23198
  if (sortedIds.length === 0) return /* @__PURE__ */ new Set();
23082
23199
  const latestEnd = /* @__PURE__ */ new Map();
23083
23200
  const latestStart = /* @__PURE__ */ new Map();
@@ -23115,7 +23232,8 @@ function computeCriticalPath(sortedIds, taskMap, depOffsetMap, holidays, holiday
23115
23232
  succTask.offset.duration,
23116
23233
  holidays,
23117
23234
  holidaySet,
23118
- reverseDir
23235
+ reverseDir,
23236
+ sprintOpts
23119
23237
  );
23120
23238
  succLS = adjusted.getTime();
23121
23239
  }
@@ -23127,7 +23245,8 @@ function computeCriticalPath(sortedIds, taskMap, depOffsetMap, holidays, holiday
23127
23245
  depOffset.duration,
23128
23246
  holidays,
23129
23247
  holidaySet,
23130
- reverseDir
23248
+ reverseDir,
23249
+ sprintOpts
23131
23250
  );
23132
23251
  succLS = adjusted.getTime();
23133
23252
  }
@@ -23202,6 +23321,51 @@ function buildResolvedGroups(nodes, taskMap, groups, depth) {
23202
23321
  }
23203
23322
  }
23204
23323
  }
23324
+ function generateSprintBands(options, chartStart, chartEnd, projectStart) {
23325
+ const sprintLength = options.sprintLength;
23326
+ const sprintNumber = options.sprintNumber ?? 1;
23327
+ let anchorDate;
23328
+ if (options.sprintStart) {
23329
+ anchorDate = /* @__PURE__ */ new Date(options.sprintStart + "T00:00:00");
23330
+ } else if (options.start) {
23331
+ anchorDate = new Date(projectStart);
23332
+ } else {
23333
+ const now = /* @__PURE__ */ new Date();
23334
+ anchorDate = new Date(now.getFullYear(), now.getMonth(), now.getDate());
23335
+ }
23336
+ anchorDate.setHours(0, 0, 0, 0);
23337
+ const sprintDays = Math.round(
23338
+ sprintLength.amount * (sprintLength.unit === "w" ? 7 : 1)
23339
+ );
23340
+ if (sprintDays <= 0) return [];
23341
+ if (Number.isNaN(anchorDate.getTime())) return [];
23342
+ const chartStartTime = new Date(chartStart);
23343
+ chartStartTime.setHours(0, 0, 0, 0);
23344
+ const chartEndTime = new Date(chartEnd);
23345
+ chartEndTime.setHours(0, 0, 0, 0);
23346
+ const msPerDay = 864e5;
23347
+ const dayDiff = Math.floor(
23348
+ (chartStartTime.getTime() - anchorDate.getTime()) / msPerDay
23349
+ );
23350
+ const startSprintIndex = Math.floor(dayDiff / sprintDays);
23351
+ const sprints = [];
23352
+ const maxSprints = 1e3;
23353
+ for (let i = startSprintIndex; sprints.length < maxSprints; i++) {
23354
+ const sprintStartDate = new Date(anchorDate);
23355
+ sprintStartDate.setDate(sprintStartDate.getDate() + i * sprintDays);
23356
+ sprintStartDate.setHours(0, 0, 0, 0);
23357
+ const sprintEndDate = new Date(sprintStartDate);
23358
+ sprintEndDate.setDate(sprintEndDate.getDate() + sprintDays);
23359
+ sprintEndDate.setHours(0, 0, 0, 0);
23360
+ if (sprintStartDate.getTime() >= chartEndTime.getTime() + msPerDay) break;
23361
+ sprints.push({
23362
+ number: sprintNumber + i,
23363
+ startDate: sprintStartDate,
23364
+ endDate: sprintEndDate
23365
+ });
23366
+ }
23367
+ return sprints;
23368
+ }
23205
23369
  function formatDate(d) {
23206
23370
  const y = d.getFullYear();
23207
23371
  const m = String(d.getMonth() + 1).padStart(2, "0");
@@ -23306,14 +23470,16 @@ function renderGantt(container, resolved, palette, isDark, options, exportDims)
23306
23470
  const tagLegendReserve = resolved.tagGroups.length > 0 ? LEGEND_HEIGHT + 8 : 0;
23307
23471
  const topDateLabelReserve = 22;
23308
23472
  const hasOverheadLabels = resolved.markers.length > 0 || resolved.eras.length > 0;
23309
- const markerLabelReserve = hasOverheadLabels ? 18 : 0;
23473
+ const markerLabelReserve = hasOverheadLabels ? 28 : 0;
23474
+ const sprintLabelReserve = resolved.sprints.length > 0 ? 16 : 0;
23310
23475
  const CONTENT_TOP_PAD = 16;
23311
- const marginTop = titleHeight + tagLegendReserve + topDateLabelReserve + markerLabelReserve;
23476
+ const marginTop = titleHeight + tagLegendReserve + topDateLabelReserve + markerLabelReserve + sprintLabelReserve;
23312
23477
  const contentH = isTagMode ? totalRows * (BAR_H + ROW_GAP) : totalRows * (BAR_H + ROW_GAP) + GROUP_GAP2 * resolved.groups.length;
23313
23478
  const innerHeight = CONTENT_TOP_PAD + contentH;
23314
23479
  const outerHeight = marginTop + innerHeight + BOTTOM_MARGIN;
23315
23480
  const containerWidth = exportDims?.width ?? (container.clientWidth || 800);
23316
- const innerWidth = containerWidth - leftMargin - RIGHT_MARGIN;
23481
+ const sprintRightPad = resolved.sprints.length > 0 ? 50 : 0;
23482
+ const innerWidth = containerWidth - leftMargin - RIGHT_MARGIN - sprintRightPad;
23317
23483
  const svg = d3Selection10.select(container).append("svg").attr("viewBox", `0 0 ${containerWidth} ${outerHeight}`).attr("width", exportDims ? containerWidth : "100%").attr("preserveAspectRatio", "xMidYMin meet").attr("font-family", FONT_FAMILY).style("overflow", "visible");
23318
23484
  const g = svg.append("g").attr("transform", `translate(${leftMargin}, ${marginTop})`);
23319
23485
  if (title) {
@@ -23393,6 +23559,7 @@ function renderGantt(container, resolved, palette, isDark, options, exportDims)
23393
23559
  onClickItem
23394
23560
  );
23395
23561
  renderErasAndMarkers(g, svg, resolved, xScale, innerHeight, palette);
23562
+ renderSprintBands(g, svg, resolved, xScale, innerHeight, palette);
23396
23563
  let todayDate = null;
23397
23564
  let todayX = -1;
23398
23565
  const todayColor = palette.accent || "#e74c3c";
@@ -24296,7 +24463,7 @@ function renderErasAndMarkers(g, svg, resolved, xScale, innerHeight, palette) {
24296
24463
  const eraEndDate = parseDateStringToDate(era.endDate);
24297
24464
  const eraG = g.append("g").attr("class", "gantt-era-group").attr("data-line-number", String(era.lineNumber));
24298
24465
  const eraRect = eraG.append("rect").attr("class", "gantt-era").attr("x", sx).attr("y", 0).attr("width", ex - sx).attr("height", innerHeight).attr("fill", color).attr("opacity", baseEraOpacity);
24299
- eraG.append("text").attr("class", "gantt-era-label").attr("x", (sx + ex) / 2).attr("y", -24).attr("text-anchor", "middle").attr("font-size", "10px").attr("fill", color).attr("opacity", 0.7).style("cursor", "pointer").text(era.label);
24466
+ eraG.append("text").attr("class", "gantt-era-label").attr("x", (sx + ex) / 2).attr("y", -34).attr("text-anchor", "middle").attr("font-size", "10px").attr("fill", color).attr("opacity", 0.7).style("cursor", "pointer").text(era.label);
24300
24467
  eraG.on("mouseenter", () => {
24301
24468
  g.selectAll(".gantt-task").attr(
24302
24469
  "opacity",
@@ -24342,8 +24509,8 @@ function renderErasAndMarkers(g, svg, resolved, xScale, innerHeight, palette) {
24342
24509
  const mx = xScale(parseDateToFractionalYear(marker.date));
24343
24510
  const markerDate = parseDateStringToDate(marker.date);
24344
24511
  const diamondSize = 5;
24345
- const labelY = -24;
24346
- const diamondY = labelY + 14;
24512
+ const labelY = -34;
24513
+ const diamondY = -2;
24347
24514
  const markerG = g.append("g").attr("class", "gantt-marker-group").attr("data-line-number", String(marker.lineNumber)).style("cursor", "pointer");
24348
24515
  markerG.append("rect").attr("x", mx - 40).attr("y", labelY - 12).attr("width", 80).attr("height", innerHeight - labelY + 12).attr("fill", "transparent").attr("pointer-events", "all");
24349
24516
  markerG.append("text").attr("class", "gantt-marker-label").attr("x", mx).attr("y", labelY).attr("text-anchor", "middle").attr("font-size", "11px").attr("font-weight", "600").attr("fill", color).text(marker.label);
@@ -24403,6 +24570,139 @@ function renderErasAndMarkers(g, svg, resolved, xScale, innerHeight, palette) {
24403
24570
  });
24404
24571
  }
24405
24572
  }
24573
+ function renderSprintBands(g, svg, resolved, xScale, innerHeight, palette) {
24574
+ if (resolved.sprints.length === 0) return;
24575
+ if (resolved.eras.length > 0) return;
24576
+ const bandColor = palette.textMuted || palette.text || "#888";
24577
+ const chartMinX = 0;
24578
+ for (let i = 0; i < resolved.sprints.length; i++) {
24579
+ const sprint = resolved.sprints[i];
24580
+ const rawSx = xScale(dateToFractionalYear(sprint.startDate));
24581
+ const rawEx = xScale(dateToFractionalYear(sprint.endDate));
24582
+ if (rawEx <= rawSx) continue;
24583
+ const sx = Math.max(rawSx, chartMinX);
24584
+ const ex = rawEx;
24585
+ const bandWidth = ex - sx;
24586
+ if (bandWidth <= 0) continue;
24587
+ const sprintG = g.append("g").attr("class", "gantt-sprint-group").style("cursor", "pointer");
24588
+ const sprintRect = sprintG.append("rect").attr("class", "gantt-sprint-band").attr("x", sx).attr("y", 0).attr("width", bandWidth).attr("height", innerHeight).attr("fill", bandColor).attr("opacity", sprint.number % 2 === 0 ? SPRINT_BAND_OPACITY : 0);
24589
+ if (sprint.number % 2 !== 0) {
24590
+ sprintG.append("rect").attr("x", sx).attr("y", 0).attr("width", bandWidth).attr("height", innerHeight).attr("fill", "transparent");
24591
+ }
24592
+ const sprintLabel = sprintG.append("text").attr("class", "gantt-sprint-label").attr("x", (sx + ex) / 2).attr("y", -22).attr("text-anchor", "middle").attr("font-size", "10px").attr("font-weight", "600").attr("fill", bandColor).attr("opacity", 0.4).text(String(sprint.number));
24593
+ if (i > 0 && rawSx >= chartMinX) {
24594
+ sprintG.append("line").attr("class", "gantt-sprint-boundary").attr("x1", sx).attr("y1", -6).attr("x2", sx).attr("y2", innerHeight).attr("stroke", bandColor).attr("stroke-width", 1).attr("stroke-dasharray", "3 3").attr("opacity", SPRINT_BOUNDARY_OPACITY);
24595
+ }
24596
+ const sprintStartMs = sprint.startDate.getTime();
24597
+ const sprintEndMs = sprint.endDate.getTime();
24598
+ const overlappingTaskIds = /* @__PURE__ */ new Set();
24599
+ for (const rt of resolved.tasks) {
24600
+ const taskStart = rt.startDate.getTime();
24601
+ const taskEnd = rt.endDate.getTime();
24602
+ if (taskStart < sprintEndMs && taskEnd > sprintStartMs) {
24603
+ overlappingTaskIds.add(rt.task.id);
24604
+ }
24605
+ if (taskStart === taskEnd && taskStart >= sprintStartMs && taskStart < sprintEndMs) {
24606
+ overlappingTaskIds.add(rt.task.id);
24607
+ }
24608
+ }
24609
+ const overlappingGroupNames = /* @__PURE__ */ new Set();
24610
+ for (const rg of resolved.groups) {
24611
+ const gStart = rg.startDate.getTime();
24612
+ const gEnd = rg.endDate.getTime();
24613
+ if (gStart < sprintEndMs && gEnd > sprintStartMs) {
24614
+ overlappingGroupNames.add(rg.name);
24615
+ }
24616
+ }
24617
+ const baseOpacity = sprint.number % 2 === 0 ? SPRINT_BAND_OPACITY : 0;
24618
+ sprintG.on("mouseenter", () => {
24619
+ g.selectAll(".gantt-task").each(function() {
24620
+ const el = d3Selection10.select(this);
24621
+ const id = el.attr("data-task-id");
24622
+ el.attr(
24623
+ "opacity",
24624
+ id && overlappingTaskIds.has(id) ? 1 : FADE_OPACITY
24625
+ );
24626
+ });
24627
+ g.selectAll(".gantt-milestone").each(function() {
24628
+ const el = d3Selection10.select(this);
24629
+ const id = el.attr("data-task-id");
24630
+ el.attr(
24631
+ "opacity",
24632
+ id && overlappingTaskIds.has(id) ? 1 : FADE_OPACITY
24633
+ );
24634
+ });
24635
+ svg.selectAll(".gantt-task-label").each(function() {
24636
+ const el = d3Selection10.select(this);
24637
+ const id = el.attr("data-task-id");
24638
+ el.attr(
24639
+ "opacity",
24640
+ id && overlappingTaskIds.has(id) ? 1 : FADE_OPACITY
24641
+ );
24642
+ });
24643
+ g.selectAll(
24644
+ ".gantt-group-bar, .gantt-group-summary"
24645
+ ).each(function() {
24646
+ const el = d3Selection10.select(this);
24647
+ const name = el.attr("data-group");
24648
+ el.attr(
24649
+ "opacity",
24650
+ name && overlappingGroupNames.has(name) ? 1 : FADE_OPACITY
24651
+ );
24652
+ });
24653
+ svg.selectAll(".gantt-group-label").each(function() {
24654
+ const el = d3Selection10.select(this);
24655
+ const name = el.attr("data-group");
24656
+ el.attr(
24657
+ "opacity",
24658
+ name && overlappingGroupNames.has(name) ? 1 : FADE_OPACITY
24659
+ );
24660
+ });
24661
+ svg.selectAll(".gantt-lane-header").attr("opacity", FADE_OPACITY);
24662
+ g.selectAll(
24663
+ ".gantt-lane-band, .gantt-lane-accent, .gantt-lane-band-group"
24664
+ ).attr("opacity", FADE_OPACITY);
24665
+ g.selectAll(
24666
+ ".gantt-dep-arrow, .gantt-dep-arrowhead"
24667
+ ).attr("opacity", FADE_OPACITY);
24668
+ g.selectAll(".gantt-marker-group").attr(
24669
+ "opacity",
24670
+ FADE_OPACITY
24671
+ );
24672
+ sprintRect.attr("opacity", SPRINT_HOVER_OPACITY);
24673
+ const startVisible = rawSx >= chartMinX;
24674
+ if (startVisible) {
24675
+ showGanttDateIndicators(
24676
+ g,
24677
+ xScale,
24678
+ sprint.startDate,
24679
+ sprint.endDate,
24680
+ innerHeight,
24681
+ bandColor
24682
+ );
24683
+ } else {
24684
+ showGanttDateIndicators(
24685
+ g,
24686
+ xScale,
24687
+ sprint.endDate,
24688
+ null,
24689
+ innerHeight,
24690
+ bandColor
24691
+ );
24692
+ }
24693
+ const accentColor = palette.accent || palette.text || bandColor;
24694
+ sprintLabel.text(`Sprint ${sprint.number}`).attr("font-size", "13px").attr("font-weight", "700").attr("fill", accentColor).attr("opacity", 1);
24695
+ }).on("mouseleave", () => {
24696
+ resetHighlight(g, svg);
24697
+ sprintRect.attr("opacity", baseOpacity);
24698
+ sprintLabel.text(String(sprint.number)).attr("font-size", "10px").attr("font-weight", "600").attr("fill", bandColor).attr("opacity", 0.4);
24699
+ hideGanttDateIndicators(g);
24700
+ });
24701
+ }
24702
+ const lastSprint = resolved.sprints[resolved.sprints.length - 1];
24703
+ const lastEx = xScale(dateToFractionalYear(lastSprint.endDate));
24704
+ g.append("line").attr("class", "gantt-sprint-boundary").attr("x1", lastEx).attr("y1", -6).attr("x2", lastEx).attr("y2", innerHeight).attr("stroke", bandColor).attr("stroke-width", 1).attr("stroke-dasharray", "3 3").attr("opacity", SPRINT_BOUNDARY_OPACITY);
24705
+ }
24406
24706
  function parseDateStringToDate(s) {
24407
24707
  const parts = s.split("-").map((p) => parseInt(p, 10));
24408
24708
  const year = parts[0];
@@ -24875,7 +25175,7 @@ function renderTimeScaleHorizontal(g, scale, innerWidth, innerHeight, textColor)
24875
25175
  g.append("text").attr("class", "gantt-scale-tick").attr("x", tick.pos).attr("y", innerHeight + tickLen + 12).attr("text-anchor", "middle").attr("font-size", "10px").attr("fill", textColor).attr("opacity", opacity).text(tick.label);
24876
25176
  }
24877
25177
  }
24878
- var d3Scale, d3Selection10, BAR_H, ROW_GAP, GROUP_GAP2, MILESTONE_SIZE, MIN_LEFT_MARGIN, BOTTOM_MARGIN, RIGHT_MARGIN, CHAR_W2, LABEL_PAD, LABEL_GAP, BAND_ACCENT_W, BAND_RADIUS, bandClipCounter, JS_DAY_TO_WEEKDAY2, ERA_COLORS, FADE_OPACITY, MONTH_ABBR;
25178
+ var d3Scale, d3Selection10, BAR_H, ROW_GAP, GROUP_GAP2, MILESTONE_SIZE, MIN_LEFT_MARGIN, BOTTOM_MARGIN, RIGHT_MARGIN, CHAR_W2, LABEL_PAD, LABEL_GAP, BAND_ACCENT_W, BAND_RADIUS, bandClipCounter, JS_DAY_TO_WEEKDAY2, ERA_COLORS, SPRINT_BAND_OPACITY, SPRINT_HOVER_OPACITY, SPRINT_BOUNDARY_OPACITY, FADE_OPACITY, MONTH_ABBR;
24879
25179
  var init_renderer9 = __esm({
24880
25180
  "src/gantt/renderer.ts"() {
24881
25181
  "use strict";
@@ -24912,6 +25212,9 @@ var init_renderer9 = __esm({
24912
25212
  "sat"
24913
25213
  ];
24914
25214
  ERA_COLORS = ["#5e81ac", "#a3be8c", "#ebcb8b", "#d08770", "#b48ead"];
25215
+ SPRINT_BAND_OPACITY = 0.05;
25216
+ SPRINT_HOVER_OPACITY = 0.12;
25217
+ SPRINT_BOUNDARY_OPACITY = 0.3;
24915
25218
  FADE_OPACITY = 0.1;
24916
25219
  MONTH_ABBR = [
24917
25220
  "Jan",
@@ -30967,6 +31270,463 @@ var init_d3 = __esm({
30967
31270
  }
30968
31271
  });
30969
31272
 
31273
+ // node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js
31274
+ var require_lz_string = __commonJS({
31275
+ "node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js"(exports2, module2) {
31276
+ "use strict";
31277
+ var LZString = (function() {
31278
+ var f = String.fromCharCode;
31279
+ var keyStrBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
31280
+ var keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
31281
+ var baseReverseDic = {};
31282
+ function getBaseValue(alphabet, character) {
31283
+ if (!baseReverseDic[alphabet]) {
31284
+ baseReverseDic[alphabet] = {};
31285
+ for (var i = 0; i < alphabet.length; i++) {
31286
+ baseReverseDic[alphabet][alphabet.charAt(i)] = i;
31287
+ }
31288
+ }
31289
+ return baseReverseDic[alphabet][character];
31290
+ }
31291
+ var LZString2 = {
31292
+ compressToBase64: function(input) {
31293
+ if (input == null) return "";
31294
+ var res = LZString2._compress(input, 6, function(a) {
31295
+ return keyStrBase64.charAt(a);
31296
+ });
31297
+ switch (res.length % 4) {
31298
+ // To produce valid Base64
31299
+ default:
31300
+ // When could this happen ?
31301
+ case 0:
31302
+ return res;
31303
+ case 1:
31304
+ return res + "===";
31305
+ case 2:
31306
+ return res + "==";
31307
+ case 3:
31308
+ return res + "=";
31309
+ }
31310
+ },
31311
+ decompressFromBase64: function(input) {
31312
+ if (input == null) return "";
31313
+ if (input == "") return null;
31314
+ return LZString2._decompress(input.length, 32, function(index) {
31315
+ return getBaseValue(keyStrBase64, input.charAt(index));
31316
+ });
31317
+ },
31318
+ compressToUTF16: function(input) {
31319
+ if (input == null) return "";
31320
+ return LZString2._compress(input, 15, function(a) {
31321
+ return f(a + 32);
31322
+ }) + " ";
31323
+ },
31324
+ decompressFromUTF16: function(compressed) {
31325
+ if (compressed == null) return "";
31326
+ if (compressed == "") return null;
31327
+ return LZString2._decompress(compressed.length, 16384, function(index) {
31328
+ return compressed.charCodeAt(index) - 32;
31329
+ });
31330
+ },
31331
+ //compress into uint8array (UCS-2 big endian format)
31332
+ compressToUint8Array: function(uncompressed) {
31333
+ var compressed = LZString2.compress(uncompressed);
31334
+ var buf = new Uint8Array(compressed.length * 2);
31335
+ for (var i = 0, TotalLen = compressed.length; i < TotalLen; i++) {
31336
+ var current_value = compressed.charCodeAt(i);
31337
+ buf[i * 2] = current_value >>> 8;
31338
+ buf[i * 2 + 1] = current_value % 256;
31339
+ }
31340
+ return buf;
31341
+ },
31342
+ //decompress from uint8array (UCS-2 big endian format)
31343
+ decompressFromUint8Array: function(compressed) {
31344
+ if (compressed === null || compressed === void 0) {
31345
+ return LZString2.decompress(compressed);
31346
+ } else {
31347
+ var buf = new Array(compressed.length / 2);
31348
+ for (var i = 0, TotalLen = buf.length; i < TotalLen; i++) {
31349
+ buf[i] = compressed[i * 2] * 256 + compressed[i * 2 + 1];
31350
+ }
31351
+ var result = [];
31352
+ buf.forEach(function(c) {
31353
+ result.push(f(c));
31354
+ });
31355
+ return LZString2.decompress(result.join(""));
31356
+ }
31357
+ },
31358
+ //compress into a string that is already URI encoded
31359
+ compressToEncodedURIComponent: function(input) {
31360
+ if (input == null) return "";
31361
+ return LZString2._compress(input, 6, function(a) {
31362
+ return keyStrUriSafe.charAt(a);
31363
+ });
31364
+ },
31365
+ //decompress from an output of compressToEncodedURIComponent
31366
+ decompressFromEncodedURIComponent: function(input) {
31367
+ if (input == null) return "";
31368
+ if (input == "") return null;
31369
+ input = input.replace(/ /g, "+");
31370
+ return LZString2._decompress(input.length, 32, function(index) {
31371
+ return getBaseValue(keyStrUriSafe, input.charAt(index));
31372
+ });
31373
+ },
31374
+ compress: function(uncompressed) {
31375
+ return LZString2._compress(uncompressed, 16, function(a) {
31376
+ return f(a);
31377
+ });
31378
+ },
31379
+ _compress: function(uncompressed, bitsPerChar, getCharFromInt) {
31380
+ if (uncompressed == null) return "";
31381
+ var i, value, context_dictionary = {}, context_dictionaryToCreate = {}, context_c = "", context_wc = "", context_w = "", context_enlargeIn = 2, context_dictSize = 3, context_numBits = 2, context_data = [], context_data_val = 0, context_data_position = 0, ii;
31382
+ for (ii = 0; ii < uncompressed.length; ii += 1) {
31383
+ context_c = uncompressed.charAt(ii);
31384
+ if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) {
31385
+ context_dictionary[context_c] = context_dictSize++;
31386
+ context_dictionaryToCreate[context_c] = true;
31387
+ }
31388
+ context_wc = context_w + context_c;
31389
+ if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) {
31390
+ context_w = context_wc;
31391
+ } else {
31392
+ if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
31393
+ if (context_w.charCodeAt(0) < 256) {
31394
+ for (i = 0; i < context_numBits; i++) {
31395
+ context_data_val = context_data_val << 1;
31396
+ if (context_data_position == bitsPerChar - 1) {
31397
+ context_data_position = 0;
31398
+ context_data.push(getCharFromInt(context_data_val));
31399
+ context_data_val = 0;
31400
+ } else {
31401
+ context_data_position++;
31402
+ }
31403
+ }
31404
+ value = context_w.charCodeAt(0);
31405
+ for (i = 0; i < 8; i++) {
31406
+ context_data_val = context_data_val << 1 | value & 1;
31407
+ if (context_data_position == bitsPerChar - 1) {
31408
+ context_data_position = 0;
31409
+ context_data.push(getCharFromInt(context_data_val));
31410
+ context_data_val = 0;
31411
+ } else {
31412
+ context_data_position++;
31413
+ }
31414
+ value = value >> 1;
31415
+ }
31416
+ } else {
31417
+ value = 1;
31418
+ for (i = 0; i < context_numBits; i++) {
31419
+ context_data_val = context_data_val << 1 | value;
31420
+ if (context_data_position == bitsPerChar - 1) {
31421
+ context_data_position = 0;
31422
+ context_data.push(getCharFromInt(context_data_val));
31423
+ context_data_val = 0;
31424
+ } else {
31425
+ context_data_position++;
31426
+ }
31427
+ value = 0;
31428
+ }
31429
+ value = context_w.charCodeAt(0);
31430
+ for (i = 0; i < 16; i++) {
31431
+ context_data_val = context_data_val << 1 | value & 1;
31432
+ if (context_data_position == bitsPerChar - 1) {
31433
+ context_data_position = 0;
31434
+ context_data.push(getCharFromInt(context_data_val));
31435
+ context_data_val = 0;
31436
+ } else {
31437
+ context_data_position++;
31438
+ }
31439
+ value = value >> 1;
31440
+ }
31441
+ }
31442
+ context_enlargeIn--;
31443
+ if (context_enlargeIn == 0) {
31444
+ context_enlargeIn = Math.pow(2, context_numBits);
31445
+ context_numBits++;
31446
+ }
31447
+ delete context_dictionaryToCreate[context_w];
31448
+ } else {
31449
+ value = context_dictionary[context_w];
31450
+ for (i = 0; i < context_numBits; i++) {
31451
+ context_data_val = context_data_val << 1 | value & 1;
31452
+ if (context_data_position == bitsPerChar - 1) {
31453
+ context_data_position = 0;
31454
+ context_data.push(getCharFromInt(context_data_val));
31455
+ context_data_val = 0;
31456
+ } else {
31457
+ context_data_position++;
31458
+ }
31459
+ value = value >> 1;
31460
+ }
31461
+ }
31462
+ context_enlargeIn--;
31463
+ if (context_enlargeIn == 0) {
31464
+ context_enlargeIn = Math.pow(2, context_numBits);
31465
+ context_numBits++;
31466
+ }
31467
+ context_dictionary[context_wc] = context_dictSize++;
31468
+ context_w = String(context_c);
31469
+ }
31470
+ }
31471
+ if (context_w !== "") {
31472
+ if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
31473
+ if (context_w.charCodeAt(0) < 256) {
31474
+ for (i = 0; i < context_numBits; i++) {
31475
+ context_data_val = context_data_val << 1;
31476
+ if (context_data_position == bitsPerChar - 1) {
31477
+ context_data_position = 0;
31478
+ context_data.push(getCharFromInt(context_data_val));
31479
+ context_data_val = 0;
31480
+ } else {
31481
+ context_data_position++;
31482
+ }
31483
+ }
31484
+ value = context_w.charCodeAt(0);
31485
+ for (i = 0; i < 8; i++) {
31486
+ context_data_val = context_data_val << 1 | value & 1;
31487
+ if (context_data_position == bitsPerChar - 1) {
31488
+ context_data_position = 0;
31489
+ context_data.push(getCharFromInt(context_data_val));
31490
+ context_data_val = 0;
31491
+ } else {
31492
+ context_data_position++;
31493
+ }
31494
+ value = value >> 1;
31495
+ }
31496
+ } else {
31497
+ value = 1;
31498
+ for (i = 0; i < context_numBits; i++) {
31499
+ context_data_val = context_data_val << 1 | value;
31500
+ if (context_data_position == bitsPerChar - 1) {
31501
+ context_data_position = 0;
31502
+ context_data.push(getCharFromInt(context_data_val));
31503
+ context_data_val = 0;
31504
+ } else {
31505
+ context_data_position++;
31506
+ }
31507
+ value = 0;
31508
+ }
31509
+ value = context_w.charCodeAt(0);
31510
+ for (i = 0; i < 16; i++) {
31511
+ context_data_val = context_data_val << 1 | value & 1;
31512
+ if (context_data_position == bitsPerChar - 1) {
31513
+ context_data_position = 0;
31514
+ context_data.push(getCharFromInt(context_data_val));
31515
+ context_data_val = 0;
31516
+ } else {
31517
+ context_data_position++;
31518
+ }
31519
+ value = value >> 1;
31520
+ }
31521
+ }
31522
+ context_enlargeIn--;
31523
+ if (context_enlargeIn == 0) {
31524
+ context_enlargeIn = Math.pow(2, context_numBits);
31525
+ context_numBits++;
31526
+ }
31527
+ delete context_dictionaryToCreate[context_w];
31528
+ } else {
31529
+ value = context_dictionary[context_w];
31530
+ for (i = 0; i < context_numBits; i++) {
31531
+ context_data_val = context_data_val << 1 | value & 1;
31532
+ if (context_data_position == bitsPerChar - 1) {
31533
+ context_data_position = 0;
31534
+ context_data.push(getCharFromInt(context_data_val));
31535
+ context_data_val = 0;
31536
+ } else {
31537
+ context_data_position++;
31538
+ }
31539
+ value = value >> 1;
31540
+ }
31541
+ }
31542
+ context_enlargeIn--;
31543
+ if (context_enlargeIn == 0) {
31544
+ context_enlargeIn = Math.pow(2, context_numBits);
31545
+ context_numBits++;
31546
+ }
31547
+ }
31548
+ value = 2;
31549
+ for (i = 0; i < context_numBits; i++) {
31550
+ context_data_val = context_data_val << 1 | value & 1;
31551
+ if (context_data_position == bitsPerChar - 1) {
31552
+ context_data_position = 0;
31553
+ context_data.push(getCharFromInt(context_data_val));
31554
+ context_data_val = 0;
31555
+ } else {
31556
+ context_data_position++;
31557
+ }
31558
+ value = value >> 1;
31559
+ }
31560
+ while (true) {
31561
+ context_data_val = context_data_val << 1;
31562
+ if (context_data_position == bitsPerChar - 1) {
31563
+ context_data.push(getCharFromInt(context_data_val));
31564
+ break;
31565
+ } else context_data_position++;
31566
+ }
31567
+ return context_data.join("");
31568
+ },
31569
+ decompress: function(compressed) {
31570
+ if (compressed == null) return "";
31571
+ if (compressed == "") return null;
31572
+ return LZString2._decompress(compressed.length, 32768, function(index) {
31573
+ return compressed.charCodeAt(index);
31574
+ });
31575
+ },
31576
+ _decompress: function(length, resetValue, getNextValue) {
31577
+ var dictionary = [], next, enlargeIn = 4, dictSize = 4, numBits = 3, entry = "", result = [], i, w, bits, resb, maxpower, power, c, data = { val: getNextValue(0), position: resetValue, index: 1 };
31578
+ for (i = 0; i < 3; i += 1) {
31579
+ dictionary[i] = i;
31580
+ }
31581
+ bits = 0;
31582
+ maxpower = Math.pow(2, 2);
31583
+ power = 1;
31584
+ while (power != maxpower) {
31585
+ resb = data.val & data.position;
31586
+ data.position >>= 1;
31587
+ if (data.position == 0) {
31588
+ data.position = resetValue;
31589
+ data.val = getNextValue(data.index++);
31590
+ }
31591
+ bits |= (resb > 0 ? 1 : 0) * power;
31592
+ power <<= 1;
31593
+ }
31594
+ switch (next = bits) {
31595
+ case 0:
31596
+ bits = 0;
31597
+ maxpower = Math.pow(2, 8);
31598
+ power = 1;
31599
+ while (power != maxpower) {
31600
+ resb = data.val & data.position;
31601
+ data.position >>= 1;
31602
+ if (data.position == 0) {
31603
+ data.position = resetValue;
31604
+ data.val = getNextValue(data.index++);
31605
+ }
31606
+ bits |= (resb > 0 ? 1 : 0) * power;
31607
+ power <<= 1;
31608
+ }
31609
+ c = f(bits);
31610
+ break;
31611
+ case 1:
31612
+ bits = 0;
31613
+ maxpower = Math.pow(2, 16);
31614
+ power = 1;
31615
+ while (power != maxpower) {
31616
+ resb = data.val & data.position;
31617
+ data.position >>= 1;
31618
+ if (data.position == 0) {
31619
+ data.position = resetValue;
31620
+ data.val = getNextValue(data.index++);
31621
+ }
31622
+ bits |= (resb > 0 ? 1 : 0) * power;
31623
+ power <<= 1;
31624
+ }
31625
+ c = f(bits);
31626
+ break;
31627
+ case 2:
31628
+ return "";
31629
+ }
31630
+ dictionary[3] = c;
31631
+ w = c;
31632
+ result.push(c);
31633
+ while (true) {
31634
+ if (data.index > length) {
31635
+ return "";
31636
+ }
31637
+ bits = 0;
31638
+ maxpower = Math.pow(2, numBits);
31639
+ power = 1;
31640
+ while (power != maxpower) {
31641
+ resb = data.val & data.position;
31642
+ data.position >>= 1;
31643
+ if (data.position == 0) {
31644
+ data.position = resetValue;
31645
+ data.val = getNextValue(data.index++);
31646
+ }
31647
+ bits |= (resb > 0 ? 1 : 0) * power;
31648
+ power <<= 1;
31649
+ }
31650
+ switch (c = bits) {
31651
+ case 0:
31652
+ bits = 0;
31653
+ maxpower = Math.pow(2, 8);
31654
+ power = 1;
31655
+ while (power != maxpower) {
31656
+ resb = data.val & data.position;
31657
+ data.position >>= 1;
31658
+ if (data.position == 0) {
31659
+ data.position = resetValue;
31660
+ data.val = getNextValue(data.index++);
31661
+ }
31662
+ bits |= (resb > 0 ? 1 : 0) * power;
31663
+ power <<= 1;
31664
+ }
31665
+ dictionary[dictSize++] = f(bits);
31666
+ c = dictSize - 1;
31667
+ enlargeIn--;
31668
+ break;
31669
+ case 1:
31670
+ bits = 0;
31671
+ maxpower = Math.pow(2, 16);
31672
+ power = 1;
31673
+ while (power != maxpower) {
31674
+ resb = data.val & data.position;
31675
+ data.position >>= 1;
31676
+ if (data.position == 0) {
31677
+ data.position = resetValue;
31678
+ data.val = getNextValue(data.index++);
31679
+ }
31680
+ bits |= (resb > 0 ? 1 : 0) * power;
31681
+ power <<= 1;
31682
+ }
31683
+ dictionary[dictSize++] = f(bits);
31684
+ c = dictSize - 1;
31685
+ enlargeIn--;
31686
+ break;
31687
+ case 2:
31688
+ return result.join("");
31689
+ }
31690
+ if (enlargeIn == 0) {
31691
+ enlargeIn = Math.pow(2, numBits);
31692
+ numBits++;
31693
+ }
31694
+ if (dictionary[c]) {
31695
+ entry = dictionary[c];
31696
+ } else {
31697
+ if (c === dictSize) {
31698
+ entry = w + w.charAt(0);
31699
+ } else {
31700
+ return null;
31701
+ }
31702
+ }
31703
+ result.push(entry);
31704
+ dictionary[dictSize++] = w + entry.charAt(0);
31705
+ enlargeIn--;
31706
+ w = entry;
31707
+ if (enlargeIn == 0) {
31708
+ enlargeIn = Math.pow(2, numBits);
31709
+ numBits++;
31710
+ }
31711
+ }
31712
+ }
31713
+ };
31714
+ return LZString2;
31715
+ })();
31716
+ if (typeof define === "function" && define.amd) {
31717
+ define(function() {
31718
+ return LZString;
31719
+ });
31720
+ } else if (typeof module2 !== "undefined" && module2 != null) {
31721
+ module2.exports = LZString;
31722
+ } else if (typeof angular !== "undefined" && angular != null) {
31723
+ angular.module("LZString", []).factory("LZString", function() {
31724
+ return LZString;
31725
+ });
31726
+ }
31727
+ }
31728
+ });
31729
+
30970
31730
  // src/index.ts
30971
31731
  var index_exports = {};
30972
31732
  __export(index_exports, {
@@ -31925,13 +32685,12 @@ init_colors();
31925
32685
  init_palettes();
31926
32686
 
31927
32687
  // src/sharing.ts
31928
- var import_lz_string = __toESM(require("lz-string"), 1);
31929
- var { compressToEncodedURIComponent, decompressFromEncodedURIComponent } = import_lz_string.default;
32688
+ var import_lz_string = __toESM(require_lz_string(), 1);
31930
32689
  var DEFAULT_BASE_URL = "https://online.diagrammo.app";
31931
32690
  var COMPRESSED_SIZE_LIMIT = 8192;
31932
32691
  function encodeDiagramUrl(dsl, options) {
31933
32692
  const baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL;
31934
- const compressed = compressToEncodedURIComponent(dsl);
32693
+ const compressed = (0, import_lz_string.compressToEncodedURIComponent)(dsl);
31935
32694
  const byteSize = new TextEncoder().encode(compressed).byteLength;
31936
32695
  if (byteSize > COMPRESSED_SIZE_LIMIT) {
31937
32696
  return {
@@ -32002,7 +32761,7 @@ function decodeDiagramUrl(hash) {
32002
32761
  }
32003
32762
  if (!payload) return { dsl: "", viewState, filename };
32004
32763
  try {
32005
- const result = decompressFromEncodedURIComponent(payload);
32764
+ const result = (0, import_lz_string.decompressFromEncodedURIComponent)(payload);
32006
32765
  return { dsl: result ?? "", viewState, filename };
32007
32766
  } catch {
32008
32767
  return { dsl: "", viewState, filename };