@diagrammo/dgmo 0.92.1 → 0.93.0

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.
Files changed (164) hide show
  1. package/dist/advanced.d.ts +77 -20
  2. package/dist/advanced.js +453 -420
  3. package/dist/block.d.ts +2 -2
  4. package/dist/block.js +75 -70
  5. package/dist/{chart-meta-BBqLnv5q.d.ts → chart-meta-BbjsRY7o.d.ts} +2 -2
  6. package/dist/chart-meta.d.ts +3 -3
  7. package/dist/chart-meta.js +25 -19
  8. package/dist/{chart-types-CbXlZFLd.d.ts → chart-types-Cppnp31G.d.ts} +173 -4
  9. package/dist/{charts-d3-QUUDVETP.js → charts-d3-ERYYVGP6.js} +7 -6
  10. package/dist/{chunk-HIWHIYLD.js → chunk-2TFXRBCD.js} +19 -19
  11. package/dist/{chunk-O5WUZGPV.js → chunk-3GCASUWA.js} +17 -17
  12. package/dist/{chunk-ZJAK6C7Y.js → chunk-3PP746YM.js} +6 -1
  13. package/dist/{chunk-WLLO3PZ3.js → chunk-472EOHVW.js} +17 -17
  14. package/dist/{chunk-JLU52ZDT.js → chunk-5CBX66KB.js} +10 -10
  15. package/dist/{chunk-DEFBUZWV.js → chunk-5HAYT43L.js} +70 -54
  16. package/dist/{chunk-S7W75MIM.js → chunk-65GPEV5V.js} +21 -3
  17. package/dist/{chunk-Q6W2K33N.js → chunk-6XLMTAEX.js} +1 -1
  18. package/dist/{chunk-JKST4RTT.js → chunk-7OWK5K5C.js} +6 -6
  19. package/dist/{chunk-73EYNV4O.js → chunk-A5WIAMCT.js} +4 -6
  20. package/dist/{chunk-X5BUX2GK.js → chunk-ADVGV3P7.js} +1 -1
  21. package/dist/{chunk-45QUTYPD.js → chunk-CYDM2XII.js} +17 -17
  22. package/dist/chunk-CYTFO2LF.js +209 -0
  23. package/dist/{chunk-JRWUHLRP.js → chunk-D6PVMUCX.js} +51 -8
  24. package/dist/{chunk-BRSM6Z34.js → chunk-DAHQL57W.js} +14 -14
  25. package/dist/{chunk-RBFJT23E.js → chunk-EQWC76GQ.js} +6 -6
  26. package/dist/{chunk-ADNIO3XY.js → chunk-FIYW7JW4.js} +5 -5
  27. package/dist/{chunk-7ENDOHAA.js → chunk-FMAVHTYB.js} +919 -927
  28. package/dist/{chunk-3PFMGNOM.js → chunk-GJXMG4S3.js} +26 -11
  29. package/dist/chunk-GXCDD6NG.js +24 -0
  30. package/dist/{chunk-Y2V5AEVG.js → chunk-IESUM4N5.js} +2331 -2236
  31. package/dist/{chunk-QQPNCXAO.js → chunk-IIV4SMJL.js} +18 -18
  32. package/dist/{chunk-5EBYPETE.js → chunk-J43OCO22.js} +3 -5
  33. package/dist/{chunk-L5NW3PVL.js → chunk-J6AEKIRQ.js} +1 -1
  34. package/dist/{chunk-2BJW7FSF.js → chunk-KBEWVCK3.js} +1 -1
  35. package/dist/{chunk-LRP5FXST.js → chunk-KCHQVED5.js} +18 -17
  36. package/dist/{chunk-Q6ZQX2HX.js → chunk-KCMGIYPO.js} +4 -6
  37. package/dist/{chunk-MDVJYRJT.js → chunk-KPGPK4SK.js} +22 -22
  38. package/dist/{chunk-Q2UFOKPB.js → chunk-KPSSNGAE.js} +22 -22
  39. package/dist/{chunk-V4D2ZQBE.js → chunk-KRPLP5LP.js} +6 -1
  40. package/dist/{chunk-BZX7QCXJ.js → chunk-KRU2LCIP.js} +15 -15
  41. package/dist/{chunk-HXULJZA2.js → chunk-LDDDKWL6.js} +6 -1
  42. package/dist/{chunk-NREU4JFE.js → chunk-LNVB75QU.js} +6 -8
  43. package/dist/{chunk-MX4SZLSV.js → chunk-LUDUDBO6.js} +16 -8
  44. package/dist/{chunk-2YAFDND3.js → chunk-M4NV5PPU.js} +4 -6
  45. package/dist/{chunk-26BBJUBW.js → chunk-M6ZQAFPD.js} +4 -6
  46. package/dist/{chunk-NPWVOFB3.js → chunk-MB2SQF7N.js} +1 -1
  47. package/dist/{chunk-6ZL2XYM7.js → chunk-MLY5ALOV.js} +6 -6
  48. package/dist/chunk-NJJCTEBM.js +416 -0
  49. package/dist/{chunk-OQW4ETJX.js → chunk-NM5V5EKY.js} +6 -1
  50. package/dist/{chunk-ONYO5WJW.js → chunk-NMK7KJZZ.js} +21 -21
  51. package/dist/{chunk-6BNNLVAR.js → chunk-NPDVWFAQ.js} +6 -1
  52. package/dist/{chunk-FTUMRSGT.js → chunk-P5FUWXPW.js} +4 -286
  53. package/dist/chunk-P7TRFL4P.js +54 -0
  54. package/dist/{chunk-A4PNWAUW.js → chunk-PGSGJLUR.js} +6 -1
  55. package/dist/{chunk-DRFGIOZ6.js → chunk-Q7Y6JQ3R.js} +4 -6
  56. package/dist/{chunk-J2E7EUER.js → chunk-QDRCWVV3.js} +17 -17
  57. package/dist/{chunk-MXAP37W6.js → chunk-TNV4F5WA.js} +16 -7
  58. package/dist/{chunk-EBSFSOJC.js → chunk-U7U64UUN.js} +22 -22
  59. package/dist/chunk-UCHZJJIT.js +421 -0
  60. package/dist/{chunk-FSJ3ZA6N.js → chunk-UG7AQQNR.js} +12 -12
  61. package/dist/{chunk-WFA6IULY.js → chunk-URRAWU5D.js} +5 -0
  62. package/dist/{chunk-VOR32OHN.js → chunk-USAGHYRD.js} +13 -15
  63. package/dist/{chunk-QUGC7GWB.js → chunk-UVX3IYXF.js} +15 -15
  64. package/dist/{chunk-B5PEKSRH.js → chunk-VSAKEMDD.js} +6 -1
  65. package/dist/{chunk-5SSTVFPX.js → chunk-WK5QEYFA.js} +5 -7
  66. package/dist/{chunk-KTGZDMDX.js → chunk-XUTR7GNT.js} +76 -28
  67. package/dist/{chunk-6WVX4KNP.js → chunk-YDZIVDVR.js} +97 -297
  68. package/dist/{chunk-URQIWIKX.js → chunk-YXXIRM4C.js} +3 -3
  69. package/dist/{chunk-H5UEVW6Q.js → chunk-ZD3QCNB7.js} +1 -1
  70. package/dist/{chunk-DUPZ2BBY.js → chunk-ZTLMEBAC.js} +66 -4
  71. package/dist/clock.js +168 -0
  72. package/dist/completion-registry.js +3 -1
  73. package/dist/countdown.js +36 -395
  74. package/dist/{dgmo-router-4UAPPIKN.js → dgmo-router-CZN36TR3.js} +50 -43
  75. package/dist/{dimensions-SCNVYLRF.js → dimensions-7HHKO5BS.js} +3 -3
  76. package/dist/{d3-BThYBTQk.d.ts → export-context-Ceh3wr0E.d.ts} +2 -8
  77. package/dist/{flowchart-parser-NA75YQ77.js → flowchart-parser-4MZPWYK6.js} +8 -3
  78. package/dist/{flowchart-renderer-6MGGX4RC.js → flowchart-renderer-5XDN575E.js} +13 -17
  79. package/dist/index.d.ts +8 -7
  80. package/dist/index.js +80 -74
  81. package/dist/{layout-S3RLVPH4.js → layout-33FHGDEV.js} +10 -12
  82. package/dist/{layout-MBVBAMPA.js → layout-3TSVAGWH.js} +2 -2
  83. package/dist/{layout-WRG4APSJ.js → layout-5GHV7HNM.js} +9 -13
  84. package/dist/layout-FTOGDNUL.js +23 -0
  85. package/dist/{layout-BNLFQHSB.js → layout-QXGPY7KA.js} +7 -9
  86. package/dist/{layout-search-PMYL3VWS.js → layout-search-EMTCDC3C.js} +8 -10
  87. package/dist/{palettes-IN7ZFRJM.js → palettes-4Y7CL2QL.js} +4 -2
  88. package/dist/{parser-3MK56JZC.js → parser-4Y6PODW6.js} +2 -2
  89. package/dist/{parser-2NWH5JUS.js → parser-A3AN76RQ.js} +2 -1
  90. package/dist/{parser-LCJ76UXS.js → parser-BT4NI6JY.js} +5 -1
  91. package/dist/{parser-FXDS4JDK.js → parser-F7NDRPMA.js} +2 -2
  92. package/dist/{parser-BES6LV3G.js → parser-GDLKUBTO.js} +5 -1
  93. package/dist/{parser-SEUTXN6U.js → parser-KJPPUN4D.js} +2 -2
  94. package/dist/{parser-SIKL4PLF.js → parser-KMKVFET2.js} +5 -1
  95. package/dist/{parser-5LW5JDYG.js → parser-NL73FSFI.js} +5 -1
  96. package/dist/{parser-VA7ZQQTA.js → parser-NUU3DVW4.js} +5 -1
  97. package/dist/{parser-L6RWDXQN.js → parser-OGF2CDA6.js} +8 -3
  98. package/dist/{parser-XZUKNZPB.js → parser-R3LPEQIT.js} +7 -1
  99. package/dist/{parser-X23GRTQJ.js → parser-RCIEKN7Y.js} +5 -1
  100. package/dist/{parser-GX5YLRIP.js → parser-VKYUAT4Y.js} +8 -3
  101. package/dist/{parser-QYISOAGR.js → parser-YX72VLDZ.js} +8 -3
  102. package/dist/redraw-MSXU4ZD2.js +73 -0
  103. package/dist/redraw-T324XAF3.js +1698 -0
  104. package/dist/{renderer-5VKPB4LL.js → renderer-37PLQHVB.js} +5 -5
  105. package/dist/{renderer-ISSDGK54.js → renderer-3F47TPZ2.js} +3 -3
  106. package/dist/{renderer-3QAFDXEY.js → renderer-5ITLW7MX.js} +14 -12
  107. package/dist/{renderer-ZZ6MWVB7.js → renderer-6GJWADLO.js} +4 -4
  108. package/dist/{renderer-MM27BSBO.js → renderer-7Y3LR4R2.js} +3 -4
  109. package/dist/{renderer-2FVUPBGV.js → renderer-AM7P4LN7.js} +1 -1
  110. package/dist/{renderer-ZHGHTSNG.js → renderer-BO73LSVT.js} +13 -12
  111. package/dist/{renderer-3IHQI4A4.js → renderer-CNRQFIEI.js} +11 -10
  112. package/dist/{renderer-OAR5VPH4.js → renderer-DAZWHNLI.js} +2 -2
  113. package/dist/{renderer-NDA2FFYB.js → renderer-DD6T3C4J.js} +5 -5
  114. package/dist/{renderer-WIU5BJUK.js → renderer-DDWDCM2K.js} +2 -2
  115. package/dist/{renderer-7ZZG5HR3.js → renderer-EVKWGUGT.js} +8 -9
  116. package/dist/{renderer-3JY6JAQJ.js → renderer-FL7EOSBU.js} +5 -6
  117. package/dist/{renderer-RUSFL7WU.js → renderer-GFALLIYT.js} +7 -6
  118. package/dist/{renderer-O6DY46AV.js → renderer-GFGFHYWY.js} +7 -7
  119. package/dist/{renderer-5TZVFQ7K.js → renderer-GOXAP2IE.js} +7 -8
  120. package/dist/{renderer-NHTR7IRR.js → renderer-GPAVVUET.js} +4 -5
  121. package/dist/{renderer-TO2NVJP3.js → renderer-HJ54YXT3.js} +50 -45
  122. package/dist/{renderer-LM4ICK6I.js → renderer-HYGTMBHT.js} +4 -5
  123. package/dist/{renderer-S3YCLJKL.js → renderer-IHCWBFPI.js} +17 -20
  124. package/dist/{renderer-XO57LTU4.js → renderer-ISDKO3DI.js} +5 -5
  125. package/dist/{renderer-LQP3AGEJ.js → renderer-J3QWK6IM.js} +3 -4
  126. package/dist/{renderer-J666LZXJ.js → renderer-J6H4Q3RM.js} +7 -8
  127. package/dist/{renderer-ALWVK3EJ.js → renderer-JJ4QW3SK.js} +6 -6
  128. package/dist/{renderer-DC7C5Q3G.js → renderer-NOYLNVTI.js} +2 -2
  129. package/dist/{renderer-ZGY7P4BM.js → renderer-PBKTAWQV.js} +16 -20
  130. package/dist/{renderer-XGG2UNXT.js → renderer-POBGKIUT.js} +3 -4
  131. package/dist/{renderer-QGIHLZOJ.js → renderer-RDI2RYUP.js} +9 -10
  132. package/dist/{renderer-JEJT3YET.js → renderer-TSCSZ6CL.js} +2 -3
  133. package/dist/{renderer-VPIELEE5.js → renderer-VDBNC7A6.js} +8 -9
  134. package/dist/{renderer-DVNMCYHZ.js → renderer-VI34SD5V.js} +14 -14
  135. package/dist/{renderer-J5FKF423.js → renderer-W4MUMXJE.js} +7 -4
  136. package/dist/{renderer-RSK6QFWN.js → renderer-XJMVG2WJ.js} +7 -9
  137. package/dist/{state-parser-TIR2ORJY.js → state-parser-NPYTMRXP.js} +8 -3
  138. package/dist/{state-renderer-G6SUXU4J.js → state-renderer-44K2KDX7.js} +15 -19
  139. package/dist/{tag-groups-DsoVpAY-.d.ts → tag-groups-DydewK3D.d.ts} +2 -173
  140. package/dist/{themes-DRNjxX7Q.d.ts → themes-DzIH3Hjv.d.ts} +3 -2
  141. package/docs/ai-integration.md +1 -1
  142. package/docs/language-reference.md +23 -2
  143. package/gallery/fixtures/whiteboard.dgmo +3 -0
  144. package/package.json +2 -6
  145. package/dist/chunk-3Y63RFJL.js +0 -75
  146. package/dist/chunk-5DH3KYFH.js +0 -20
  147. package/dist/chunk-O753JUEZ.js +0 -67
  148. package/dist/chunk-RJNZHFNG.js +0 -51
  149. package/dist/chunk-Z6DXWULM.js +0 -23
  150. package/dist/layout-5USEVQBY.js +0 -25
  151. package/dist/{chunk-YITHYQCL.js → chunk-4FT5KQ7H.js} +7 -7
  152. package/dist/{chunk-GE7ICBX6.js → chunk-4RY5D5RE.js} +4 -4
  153. package/dist/{chunk-4QLGGQNO.js → chunk-4WQX55VX.js} +14 -14
  154. package/dist/{chunk-DGUGE67L.js → chunk-CDYV46JE.js} +3 -3
  155. package/dist/{chunk-IGKFOHBG.js → chunk-CQYFZOUC.js} +13 -13
  156. package/dist/{chunk-TKAB3FTK.js → chunk-DRQSB72S.js} +11 -11
  157. package/dist/{chunk-ZKP77MB3.js → chunk-FVTYJUXR.js} +5 -5
  158. package/dist/{chunk-MA42PIGJ.js → chunk-H5NVCOEJ.js} +4 -4
  159. package/dist/{chunk-BEA4D7OS.js → chunk-IXHWS2HI.js} +3 -3
  160. package/dist/{chunk-QKY6W4NA.js → chunk-KHL652SX.js} +25 -25
  161. package/dist/{chunk-6OIMUSDX.js → chunk-MUJVNSEW.js} +9 -9
  162. package/dist/{chunk-YO6AQU4A.js → chunk-QJOVZ4TC.js} +12 -12
  163. package/dist/{chunk-SOHZDW6N.js → chunk-UXNA2H2V.js} +3 -3
  164. package/dist/{chunk-NO3UX6AP.js → chunk-V2NQV7VL.js} +4 -4
@@ -0,0 +1,421 @@
1
+ // src/countdown/resolve.ts
2
+ var DAY_MS = 864e5;
3
+ var WEEK_MS = 7 * DAY_MS;
4
+ var ZONE_WD = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
5
+ function zoneFields(ms, tz) {
6
+ const d = new Date(ms);
7
+ if (!tz) {
8
+ return {
9
+ year: d.getFullYear(),
10
+ month: d.getMonth(),
11
+ day: d.getDate(),
12
+ hour: d.getHours(),
13
+ minute: d.getMinutes(),
14
+ second: d.getSeconds(),
15
+ weekday: d.getDay()
16
+ };
17
+ }
18
+ try {
19
+ const o = {};
20
+ new Intl.DateTimeFormat("en-US", {
21
+ timeZone: tz,
22
+ hour12: false,
23
+ year: "numeric",
24
+ month: "2-digit",
25
+ day: "2-digit",
26
+ hour: "2-digit",
27
+ minute: "2-digit",
28
+ second: "2-digit",
29
+ weekday: "short"
30
+ }).formatToParts(d).forEach((x) => {
31
+ o[x.type] = x.value;
32
+ });
33
+ return {
34
+ year: Number(o["year"]),
35
+ month: Number(o["month"]) - 1,
36
+ day: Number(o["day"]),
37
+ hour: Number(o["hour"]) % 24,
38
+ minute: Number(o["minute"]),
39
+ second: Number(o["second"]),
40
+ weekday: Math.max(0, ZONE_WD.indexOf(o["weekday"] ?? "Sun"))
41
+ };
42
+ } catch {
43
+ return {
44
+ year: d.getUTCFullYear(),
45
+ month: d.getUTCMonth(),
46
+ day: d.getUTCDate(),
47
+ hour: d.getUTCHours(),
48
+ minute: d.getUTCMinutes(),
49
+ second: d.getUTCSeconds(),
50
+ weekday: d.getUTCDay()
51
+ };
52
+ }
53
+ }
54
+ function zoneOffsetMs(tz, ms) {
55
+ const f = zoneFields(ms, tz);
56
+ const asUTC = Date.UTC(f.year, f.month, f.day, f.hour, f.minute, f.second);
57
+ return asUTC - Math.floor(ms / 1e3) * 1e3;
58
+ }
59
+ function wallToMs(y, mo, d, h, mi, tz) {
60
+ if (!tz) return new Date(y, mo, d, h, mi).getTime();
61
+ const guess = Date.UTC(y, mo, d, h, mi);
62
+ const off1 = zoneOffsetMs(tz, guess);
63
+ const ms = guess - off1;
64
+ const off2 = zoneOffsetMs(tz, ms);
65
+ return off2 === off1 ? ms : guess - off2;
66
+ }
67
+ function zoneOffsetLabel(ms, tz) {
68
+ if (!tz) return "";
69
+ try {
70
+ const off = new Intl.DateTimeFormat("en-US", {
71
+ timeZone: tz,
72
+ timeZoneName: "shortOffset"
73
+ }).formatToParts(new Date(ms)).find((x) => x.type === "timeZoneName");
74
+ return off ? off.value.replace("GMT", "UTC") : "";
75
+ } catch {
76
+ return "";
77
+ }
78
+ }
79
+ var DATE_ONLY_RE = /^\d{4}-\d{2}-\d{2}$/;
80
+ var LOCAL_DT_RE = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/;
81
+ function targetToMs(target, tz = null) {
82
+ const s = target.trim();
83
+ if (DATE_ONLY_RE.test(s)) {
84
+ const [y, m, d] = s.split("-").map(Number);
85
+ return wallToMs(y, m - 1, d, 0, 0, tz);
86
+ }
87
+ const dt = LOCAL_DT_RE.exec(s);
88
+ if (dt) {
89
+ return wallToMs(
90
+ Number(dt[1]),
91
+ Number(dt[2]) - 1,
92
+ Number(dt[3]),
93
+ Number(dt[4]),
94
+ Number(dt[5]),
95
+ tz
96
+ );
97
+ }
98
+ return new Date(s).getTime();
99
+ }
100
+ function ordinalWord(n) {
101
+ const abs = Math.abs(n);
102
+ const tens = abs % 100;
103
+ let suffix = "th";
104
+ if (tens < 11 || tens > 13) {
105
+ const ones = abs % 10;
106
+ suffix = ones === 1 ? "st" : ones === 2 ? "nd" : ones === 3 ? "rd" : "th";
107
+ }
108
+ return `${n}${suffix}`;
109
+ }
110
+ function applyOrdinalTemplate(template, n) {
111
+ return template.replace(/\bNth\b/g, ordinalWord(n)).replace(/\bN\b/g, String(n));
112
+ }
113
+ function dayStart(ms, tz = null) {
114
+ const f = zoneFields(ms, tz);
115
+ return wallToMs(f.year, f.month, f.day, 0, 0, tz);
116
+ }
117
+ function dayDelta(a, b, tz = null) {
118
+ return Math.round((dayStart(b, tz) - dayStart(a, tz)) / DAY_MS);
119
+ }
120
+ function dayKey(ms, tz = null) {
121
+ const f = zoneFields(ms, tz);
122
+ return `${f.year}-${f.month + 1}-${f.day}`;
123
+ }
124
+ function sameDay(a, b, tz = null) {
125
+ const x = zoneFields(a, tz);
126
+ const y = zoneFields(b, tz);
127
+ return x.year === y.year && x.month === y.month && x.day === y.day;
128
+ }
129
+ function nthWeekdayOfMonth(year, month, weekday, nth, hour, minute, tz) {
130
+ if (nth < 0) {
131
+ const last = new Date(year, month + 1, 0).getDate();
132
+ for (let d = last; d >= 1; d--) {
133
+ if (new Date(year, month, d).getDay() === weekday) {
134
+ return wallToMs(year, month, d, hour, minute, tz);
135
+ }
136
+ }
137
+ return null;
138
+ }
139
+ const firstDow = new Date(year, month, 1).getDay();
140
+ const offset = (weekday - firstDow + 7) % 7;
141
+ const day = 1 + offset + (nth - 1) * 7;
142
+ if (day > new Date(year, month + 1, 0).getDate()) return null;
143
+ return wallToMs(year, month, day, hour, minute, tz);
144
+ }
145
+ function resolveNext(rule, now2) {
146
+ const tz = rule.tz ?? null;
147
+ const nowF = zoneFields(now2, tz);
148
+ const { hour, minute } = rule;
149
+ const passes = rule.allDay ? (t) => dayStart(t, tz) >= dayStart(now2, tz) : (t) => t > now2;
150
+ const dayExists = (y, m, d) => new Date(y, m, d).getMonth() === m;
151
+ switch (rule.kind) {
152
+ case "month-day": {
153
+ const month = rule.month;
154
+ const day = rule.day;
155
+ for (let y = nowF.year; ; y++) {
156
+ if (!dayExists(y, month, day)) continue;
157
+ const t = wallToMs(y, month, day, hour, minute, tz);
158
+ if (passes(t)) return t;
159
+ }
160
+ }
161
+ case "nth-weekday":
162
+ case "last-weekday": {
163
+ const weekday = rule.weekday;
164
+ const nth = rule.kind === "last-weekday" ? -1 : rule.nth;
165
+ let y = nowF.year;
166
+ let m = nowF.month;
167
+ for (let i = 0; i < 24; i++) {
168
+ const t = nthWeekdayOfMonth(y, m, weekday, nth, hour, minute, tz);
169
+ if (t !== null && passes(t)) return t;
170
+ m++;
171
+ if (m > 11) {
172
+ m = 0;
173
+ y++;
174
+ }
175
+ }
176
+ return now2 + WEEK_MS;
177
+ }
178
+ case "weekly": {
179
+ const weekday = rule.weekday;
180
+ for (let i = 0; i < 8; i++) {
181
+ const cal = new Date(nowF.year, nowF.month, nowF.day + i);
182
+ if (cal.getDay() !== weekday) continue;
183
+ const t = wallToMs(
184
+ cal.getFullYear(),
185
+ cal.getMonth(),
186
+ cal.getDate(),
187
+ hour,
188
+ minute,
189
+ tz
190
+ );
191
+ if (passes(t)) return t;
192
+ }
193
+ return now2 + WEEK_MS;
194
+ }
195
+ case "interval": {
196
+ const n = rule.intervalN ?? 1;
197
+ const anchor = rule.anchorMs ?? now2;
198
+ if (rule.intervalUnit === "month") {
199
+ const a = zoneFields(anchor, tz);
200
+ const day = a.day;
201
+ for (let k = 0; ; k++) {
202
+ const y = a.year;
203
+ const m = a.month + k * n;
204
+ const yy = y + Math.floor(m / 12);
205
+ const mm = (m % 12 + 12) % 12;
206
+ if (!dayExists(yy, mm, day)) continue;
207
+ const t2 = wallToMs(yy, mm, day, hour, minute, tz);
208
+ if (passes(t2)) return t2;
209
+ }
210
+ }
211
+ const step = (rule.intervalUnit === "week" ? WEEK_MS : DAY_MS) * n;
212
+ let t = anchor;
213
+ if (!passes(t)) {
214
+ const k = Math.max(0, Math.floor((now2 - anchor) / step));
215
+ t = anchor + k * step;
216
+ while (!passes(t)) t += step;
217
+ }
218
+ return t;
219
+ }
220
+ }
221
+ }
222
+ function ordinalFor(resolvedMs, rule) {
223
+ const anchor = rule.anchorMs;
224
+ if (anchor === void 0) return 0;
225
+ const tz = rule.tz ?? null;
226
+ const a = zoneFields(anchor, tz);
227
+ const r = zoneFields(resolvedMs, tz);
228
+ const months = (r.year - a.year) * 12 + (r.month - a.month);
229
+ const spanDays = (dayStart(resolvedMs, tz) - dayStart(anchor, tz)) / DAY_MS;
230
+ switch (rule.kind) {
231
+ case "month-day":
232
+ return r.year - a.year;
233
+ case "nth-weekday":
234
+ case "last-weekday":
235
+ return months;
236
+ case "weekly":
237
+ return Math.round(spanDays / 7);
238
+ case "interval": {
239
+ const n = rule.intervalN ?? 1;
240
+ if (rule.intervalUnit === "month") return Math.floor(months / n);
241
+ const perStep = rule.intervalUnit === "week" ? 7 : 1;
242
+ return Math.round(spanDays / perStep / n);
243
+ }
244
+ }
245
+ }
246
+ function roundBy(value, mode) {
247
+ return mode === "down" ? Math.floor(value) : mode === "nearest" ? Math.round(value) : Math.ceil(value);
248
+ }
249
+ function pad2(n) {
250
+ return n < 10 ? "0" + n : String(n);
251
+ }
252
+ function plural(n, unit) {
253
+ return `${n} ${unit}${n === 1 ? "" : "s"}`;
254
+ }
255
+ function formatCount(remainingMs, opts) {
256
+ const { units, round, fields } = opts;
257
+ if (units === "days")
258
+ return plural(roundBy(remainingMs / DAY_MS, round), "day");
259
+ if (units === "weeks")
260
+ return plural(roundBy(remainingMs / WEEK_MS, round), "week");
261
+ const totalSec = Math.floor(remainingMs / 1e3);
262
+ if (units === "clock") {
263
+ const h2 = Math.floor(totalSec / 3600);
264
+ const m2 = Math.floor(totalSec % 3600 / 60);
265
+ const s2 = totalSec % 60;
266
+ return `${pad2(h2)}:${pad2(m2)}:${pad2(s2)}`;
267
+ }
268
+ if (units === "words") {
269
+ const days2 = Math.ceil(remainingMs / DAY_MS);
270
+ if (days2 <= 0) return "now";
271
+ if (days2 === 1) return "tomorrow";
272
+ if (days2 < 14) return `${days2} days`;
273
+ if (days2 < 60) return `${Math.round(days2 / 7)} weeks`;
274
+ return `${Math.round(days2 / 30)} months`;
275
+ }
276
+ const days = Math.floor(totalSec / 86400);
277
+ const h = Math.floor(totalSec % 86400 / 3600);
278
+ const m = Math.floor(totalSec % 3600 / 60);
279
+ const s = totalSec % 60;
280
+ const has = (f) => fields.includes(f);
281
+ const clockParts = [];
282
+ if (has("h")) clockParts.push(pad2(h));
283
+ if (has("m")) clockParts.push(pad2(m));
284
+ if (has("s")) clockParts.push(pad2(s));
285
+ const clock = clockParts.join(":");
286
+ const dayPrefix = has("d") && days > 0 ? `${days}d${clock ? " " : ""}` : "";
287
+ return dayPrefix + clock || plural(days, "day");
288
+ }
289
+ function splitClockSeconds(s) {
290
+ const m = /^(.+:\d{2}):(\d{2})$/.exec(s);
291
+ return m ? { lead: m[1], sec: ":" + m[2] } : { lead: s, sec: null };
292
+ }
293
+ function formatWordsDetail(remainingMs) {
294
+ const totalMin = Math.floor(Math.max(0, remainingMs) / 6e4);
295
+ const d = Math.floor(totalMin / 1440);
296
+ const h = Math.floor(totalMin % 1440 / 60);
297
+ const m = totalMin % 60;
298
+ const parts = [];
299
+ if (d > 0) parts.push(`${d} day${d === 1 ? "" : "s"}`);
300
+ if (d > 0 || h > 0) parts.push(`${h} hour${h === 1 ? "" : "s"}`);
301
+ parts.push(`${m} minute${m === 1 ? "" : "s"}`);
302
+ return parts.join(" ");
303
+ }
304
+ function breakdown(nowMs, targetMs, tz = null) {
305
+ const n = zoneFields(nowMs, tz);
306
+ const t = zoneFields(targetMs, tz);
307
+ let y = t.year - n.year;
308
+ let mo = t.month - n.month;
309
+ let d = t.day - n.day;
310
+ let h = t.hour - n.hour;
311
+ let mi = t.minute - n.minute;
312
+ let s = t.second - n.second;
313
+ if (s < 0) {
314
+ s += 60;
315
+ mi--;
316
+ }
317
+ if (mi < 0) {
318
+ mi += 60;
319
+ h--;
320
+ }
321
+ if (h < 0) {
322
+ h += 24;
323
+ d--;
324
+ }
325
+ if (d < 0) {
326
+ d += new Date(t.year, t.month, 0).getDate();
327
+ mo--;
328
+ }
329
+ if (mo < 0) {
330
+ mo += 12;
331
+ y--;
332
+ }
333
+ return { years: y, months: mo, days: d, hours: h, minutes: mi, seconds: s };
334
+ }
335
+ function humanUnits(nowMs, targetMs, tz = null) {
336
+ const b = breakdown(nowMs, targetMs, tz);
337
+ return [
338
+ [b.years, "year"],
339
+ [b.months, "month"],
340
+ [b.days, "day"],
341
+ [b.hours, "hour"],
342
+ [b.minutes, "minute"]
343
+ ];
344
+ }
345
+ function formatHuman(nowMs, targetMs, tz = null) {
346
+ const units = humanUnits(nowMs, targetMs, tz);
347
+ let i = 0;
348
+ while (i < units.length - 1 && units[i][0] === 0) i++;
349
+ const rest = units.slice(i);
350
+ const say = (arr) => arr.map(([n, u]) => `${n} ${u}${n === 1 ? "" : "s"}`).join(", ");
351
+ const primary = rest.slice(0, 2).filter((p, idx) => p[0] > 0 || idx === 0);
352
+ const secondary = rest.slice(2).filter((p) => p[0] > 0);
353
+ return { big: say(primary) || "now", sub: say(secondary) };
354
+ }
355
+ function formatCompound(nowMs, targetMs, maxUnits = 2, tz = null) {
356
+ const all = humanUnits(nowMs, targetMs, tz);
357
+ let i = 0;
358
+ while (i < all.length - 1 && all[i][0] === 0) i++;
359
+ const chosen = all.slice(i, i + maxUnits).filter((p, idx) => p[0] > 0 || idx === 0);
360
+ if (!chosen.length) return "now";
361
+ return chosen.map(([n, u]) => `${n} ${u}${n === 1 ? "" : "s"}`).join(", ");
362
+ }
363
+ var WEEKDAY_ABBR = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
364
+ var MONTH_ABBR = [
365
+ "Jan",
366
+ "Feb",
367
+ "Mar",
368
+ "Apr",
369
+ "May",
370
+ "Jun",
371
+ "Jul",
372
+ "Aug",
373
+ "Sep",
374
+ "Oct",
375
+ "Nov",
376
+ "Dec"
377
+ ];
378
+ function formatDate(ms, tz = null) {
379
+ const f = zoneFields(ms, tz);
380
+ return `${WEEKDAY_ABBR[f.weekday]} ${MONTH_ABBR[f.month]} ${f.day} ${f.year}`;
381
+ }
382
+ function formatDateShort(ms, tz = null) {
383
+ const f = zoneFields(ms, tz);
384
+ return `${MONTH_ABBR[f.month]} ${f.day} ${f.year}`;
385
+ }
386
+ function formatFooter(resolvedMs, hasTime, tz = null) {
387
+ const parts = [formatDate(resolvedMs, tz)];
388
+ if (hasTime) {
389
+ const f = zoneFields(resolvedMs, tz);
390
+ parts.push(`${pad2(f.hour)}:${pad2(f.minute)}`);
391
+ const label = zoneOffsetLabel(resolvedMs, tz);
392
+ if (label) parts.push(label);
393
+ }
394
+ return parts.join(" \xB7 ");
395
+ }
396
+
397
+ // src/utils/now.ts
398
+ var pinnedMs = null;
399
+ function now() {
400
+ return pinnedMs ?? Date.now();
401
+ }
402
+
403
+ export {
404
+ DAY_MS,
405
+ targetToMs,
406
+ applyOrdinalTemplate,
407
+ dayStart,
408
+ dayDelta,
409
+ dayKey,
410
+ sameDay,
411
+ resolveNext,
412
+ ordinalFor,
413
+ formatCount,
414
+ splitClockSeconds,
415
+ formatWordsDetail,
416
+ formatHuman,
417
+ formatCompound,
418
+ formatDateShort,
419
+ formatFooter,
420
+ now
421
+ };
@@ -1,24 +1,24 @@
1
- import {
2
- wrapDescriptionLines
3
- } from "./chunk-NPWVOFB3.js";
4
- import {
5
- renderInlineText
6
- } from "./chunk-S7W75MIM.js";
7
1
  import {
8
2
  ScaleContext
9
3
  } from "./chunk-24YPR5EH.js";
10
4
  import {
11
- renderIntegratedLegend
12
- } from "./chunk-NMS5XSLX.js";
5
+ TITLE_FONT_SIZE,
6
+ TITLE_FONT_WEIGHT,
7
+ TITLE_Y
8
+ } from "./chunk-VLC6WNRD.js";
13
9
  import {
14
10
  ARROWHEAD_HEIGHT,
15
11
  ARROWHEAD_WIDTH
16
12
  } from "./chunk-XCKNFFKM.js";
17
13
  import {
18
- TITLE_FONT_SIZE,
19
- TITLE_FONT_WEIGHT,
20
- TITLE_Y
21
- } from "./chunk-VLC6WNRD.js";
14
+ renderIntegratedLegend
15
+ } from "./chunk-NMS5XSLX.js";
16
+ import {
17
+ wrapDescriptionLines
18
+ } from "./chunk-MB2SQF7N.js";
19
+ import {
20
+ renderInlineText
21
+ } from "./chunk-65GPEV5V.js";
22
22
  import {
23
23
  FONT_FAMILY
24
24
  } from "./chunk-ICLB27PZ.js";
@@ -172,6 +172,10 @@ function dayStart(ms, tz = null) {
172
172
  function dayDelta(a, b, tz = null) {
173
173
  return Math.round((dayStart(b, tz) - dayStart(a, tz)) / DAY_MS);
174
174
  }
175
+ function dayKey(ms, tz = null) {
176
+ const f = zoneFields(ms, tz);
177
+ return `${f.year}-${f.month + 1}-${f.day}`;
178
+ }
175
179
  function sameDay(a, b, tz = null) {
176
180
  const x = zoneFields(a, tz);
177
181
  const y = zoneFields(b, tz);
@@ -454,6 +458,7 @@ export {
454
458
  applyOrdinalTemplate,
455
459
  dayStart,
456
460
  dayDelta,
461
+ dayKey,
457
462
  sameDay,
458
463
  resolveNext,
459
464
  ordinalFor,
@@ -5,20 +5,14 @@ import {
5
5
  scoreToCurveY
6
6
  } from "./chunk-EBIDNRSR.js";
7
7
  import {
8
- wrapNoteBody
9
- } from "./chunk-RJNZHFNG.js";
10
- import {
11
- NOTE_BULLET_INDENT
12
- } from "./chunk-5DH3KYFH.js";
8
+ parseJourneyMap
9
+ } from "./chunk-PGSGJLUR.js";
13
10
  import {
14
- renderInlineText
15
- } from "./chunk-S7W75MIM.js";
11
+ serializeSvg
12
+ } from "./chunk-CYRB2JTN.js";
16
13
  import {
17
14
  ScaleContext
18
15
  } from "./chunk-24YPR5EH.js";
19
- import {
20
- renderIntegratedLegend
21
- } from "./chunk-NMS5XSLX.js";
22
16
  import {
23
17
  CARD_RADIUS,
24
18
  CONTAINER_RADIUS,
@@ -26,14 +20,18 @@ import {
26
20
  NODE_STROKE_WIDTH
27
21
  } from "./chunk-XCKNFFKM.js";
28
22
  import {
29
- serializeSvg
30
- } from "./chunk-CYRB2JTN.js";
23
+ renderIntegratedLegend
24
+ } from "./chunk-NMS5XSLX.js";
25
+ import {
26
+ NOTE_BULLET_INDENT,
27
+ wrapNoteBody
28
+ } from "./chunk-D6PVMUCX.js";
29
+ import {
30
+ renderInlineText
31
+ } from "./chunk-65GPEV5V.js";
31
32
  import {
32
33
  FONT_FAMILY
33
34
  } from "./chunk-ICLB27PZ.js";
34
- import {
35
- parseJourneyMap
36
- } from "./chunk-A4PNWAUW.js";
37
35
  import {
38
36
  resolveActiveTagGroup,
39
37
  tagAttrKey
@@ -1,30 +1,30 @@
1
- import {
2
- looksLikePert
3
- } from "./chunk-CDM6XMOT.js";
4
1
  import {
5
2
  isLiveLinkLine
6
3
  } from "./chunk-KBDMEOLI.js";
7
4
  import {
8
5
  looksLikeSequence
9
- } from "./chunk-B5PEKSRH.js";
6
+ } from "./chunk-VSAKEMDD.js";
7
+ import {
8
+ looksLikeOrg
9
+ } from "./chunk-5OTA2PUH.js";
10
+ import {
11
+ looksLikeSitemap
12
+ } from "./chunk-ZECJ7Q6C.js";
13
+ import {
14
+ looksLikePert
15
+ } from "./chunk-CDM6XMOT.js";
10
16
  import {
11
17
  looksLikeFlowchart
12
- } from "./chunk-26BBJUBW.js";
18
+ } from "./chunk-M6ZQAFPD.js";
13
19
  import {
14
20
  looksLikeState
15
- } from "./chunk-2YAFDND3.js";
16
- import {
17
- looksLikeClassDiagram
18
- } from "./chunk-Q6ZQX2HX.js";
21
+ } from "./chunk-M4NV5PPU.js";
19
22
  import {
20
23
  looksLikeERDiagram
21
- } from "./chunk-DRFGIOZ6.js";
22
- import {
23
- looksLikeOrg
24
- } from "./chunk-5OTA2PUH.js";
24
+ } from "./chunk-Q7Y6JQ3R.js";
25
25
  import {
26
- looksLikeSitemap
27
- } from "./chunk-ZECJ7Q6C.js";
26
+ looksLikeClassDiagram
27
+ } from "./chunk-KCMGIYPO.js";
28
28
  import {
29
29
  parseFirstLine
30
30
  } from "./chunk-TIIZIAGS.js";
@@ -1,3 +1,6 @@
1
+ import {
2
+ extractPaletteDirective
3
+ } from "./chunk-CYTFO2LF.js";
1
4
  import {
2
5
  inferParticipantType
3
6
  } from "./chunk-C3Z4DX3V.js";
@@ -247,7 +250,9 @@ function parseSequenceDgmo(content, palette) {
247
250
  if (!content?.trim()) {
248
251
  return fail(0, "Empty content");
249
252
  }
250
- const lines = content.split("\n");
253
+ const directive = extractPaletteDirective(content);
254
+ result.diagnostics.push(...directive.diagnostics);
255
+ const lines = directive.content.split("\n");
251
256
  let hasExplicitChart = false;
252
257
  let contentStarted = false;
253
258
  let activeTagOptionLine = 0;
@@ -1,16 +1,14 @@
1
1
  import {
2
2
  searchPlacement
3
- } from "./chunk-HXULJZA2.js";
3
+ } from "./chunk-LDDDKWL6.js";
4
4
  import {
5
5
  noteCanvasShift,
6
- placeNotes
7
- } from "./chunk-FTUMRSGT.js";
6
+ placeNotes,
7
+ resolveNotes
8
+ } from "./chunk-NJJCTEBM.js";
8
9
  import {
9
10
  noteBoxSize
10
- } from "./chunk-RJNZHFNG.js";
11
- import {
12
- resolveNotes
13
- } from "./chunk-O753JUEZ.js";
11
+ } from "./chunk-D6PVMUCX.js";
14
12
 
15
13
  // src/graph/layout.ts
16
14
  import dagre from "@dagrejs/dagre";