@fengwk/kchart 0.0.0-stage → 0.1.1

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 (201) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE.md +11 -0
  4. package/README.md +68 -2
  5. package/README.zh-CN.md +69 -0
  6. package/dist/LICENSE +21 -0
  7. package/dist/NOTICE.md +11 -0
  8. package/dist/assets/ICONS-LICENSE.txt +53 -0
  9. package/dist/assets/maps/LICENSE.md +75 -0
  10. package/dist/assets/maps/METADATA.md +9 -0
  11. package/dist/assets/maps/REGIONS.md +28 -0
  12. package/dist/assets/maps/us-states.geojson +1 -0
  13. package/dist/assets/maps/world.geojson +1 -0
  14. package/dist/esm/_virtual/_kchart-families.js +48 -0
  15. package/dist/esm/_virtual/_rolldown/runtime.js +12 -0
  16. package/dist/esm/assets/icons.js +11 -0
  17. package/dist/esm/assets/maps/us-states.js +3 -0
  18. package/dist/esm/assets/maps/world.js +3 -0
  19. package/dist/esm/assets/themes/claude.js +69 -0
  20. package/dist/esm/assets/themes/cloudmusic.js +62 -0
  21. package/dist/esm/assets/themes/kanagawa.js +67 -0
  22. package/dist/esm/assets/themes/obsidian.js +67 -0
  23. package/dist/esm/assets/themes/paper.js +61 -0
  24. package/dist/esm/assets/themes/terminal.js +60 -0
  25. package/dist/esm/assets/themes/tokyo.js +62 -0
  26. package/dist/esm/chart/basic.js +1313 -0
  27. package/dist/esm/chart/catalog.js +476 -0
  28. package/dist/esm/chart/composition.js +844 -0
  29. package/dist/esm/chart/context.js +189 -0
  30. package/dist/esm/chart/distribution.js +442 -0
  31. package/dist/esm/chart/fields.js +67 -0
  32. package/dist/esm/chart/maps.js +563 -0
  33. package/dist/esm/chart/mindmap.js +629 -0
  34. package/dist/esm/chart/multivariate.js +1229 -0
  35. package/dist/esm/chart/registry.js +108 -0
  36. package/dist/esm/chart/relations.js +949 -0
  37. package/dist/esm/chart/spec.js +1415 -0
  38. package/dist/esm/chart/stat-compare.js +302 -0
  39. package/dist/esm/chart/stat-trend.js +181 -0
  40. package/dist/esm/chart/statistics.js +1007 -0
  41. package/dist/esm/chart/unit-variants.js +645 -0
  42. package/dist/esm/chart/variants.js +552 -0
  43. package/dist/esm/core/color.js +197 -0
  44. package/dist/esm/core/context.js +256 -0
  45. package/dist/esm/core/diagnostics.js +23 -0
  46. package/dist/esm/core/format.js +167 -0
  47. package/dist/esm/core/geometry.js +130 -0
  48. package/dist/esm/core/icon-data.js +5 -0
  49. package/dist/esm/core/icons.js +173 -0
  50. package/dist/esm/core/scale.js +112 -0
  51. package/dist/esm/core/scene.js +234 -0
  52. package/dist/esm/core/svg.js +89 -0
  53. package/dist/esm/core/text.js +184 -0
  54. package/dist/esm/core/theme.js +318 -0
  55. package/dist/esm/diagram/agentflow.js +596 -0
  56. package/dist/esm/diagram/architecture.js +729 -0
  57. package/dist/esm/diagram/block.js +988 -0
  58. package/dist/esm/diagram/blocks.js +687 -0
  59. package/dist/esm/diagram/c4.js +1002 -0
  60. package/dist/esm/diagram/class.js +1158 -0
  61. package/dist/esm/diagram/cynefin.js +749 -0
  62. package/dist/esm/diagram/emphasis.js +7 -0
  63. package/dist/esm/diagram/er.js +657 -0
  64. package/dist/esm/diagram/eventmodeling.js +948 -0
  65. package/dist/esm/diagram/gantt-date.js +323 -0
  66. package/dist/esm/diagram/gantt.js +661 -0
  67. package/dist/esm/diagram/gitgraph.js +472 -0
  68. package/dist/esm/diagram/graph-layout.js +4046 -0
  69. package/dist/esm/diagram/graph-parse.js +1366 -0
  70. package/dist/esm/diagram/graph-route.js +490 -0
  71. package/dist/esm/diagram/graph.js +553 -0
  72. package/dist/esm/diagram/ishikawa.js +496 -0
  73. package/dist/esm/diagram/journey.js +512 -0
  74. package/dist/esm/diagram/kanban.js +280 -0
  75. package/dist/esm/diagram/label.js +56 -0
  76. package/dist/esm/diagram/layers.js +385 -0
  77. package/dist/esm/diagram/map-label.js +44 -0
  78. package/dist/esm/diagram/mindmap.js +277 -0
  79. package/dist/esm/diagram/numeric-composition.js +78 -0
  80. package/dist/esm/diagram/numeric-model.js +86 -0
  81. package/dist/esm/diagram/numeric-parse.js +205 -0
  82. package/dist/esm/diagram/numeric-radar.js +355 -0
  83. package/dist/esm/diagram/numeric-sankey.js +201 -0
  84. package/dist/esm/diagram/numeric-xy.js +422 -0
  85. package/dist/esm/diagram/packet.js +175 -0
  86. package/dist/esm/diagram/presentation.js +252 -0
  87. package/dist/esm/diagram/quadrant.js +297 -0
  88. package/dist/esm/diagram/railroad-parse.js +465 -0
  89. package/dist/esm/diagram/railroad.js +294 -0
  90. package/dist/esm/diagram/registry.js +296 -0
  91. package/dist/esm/diagram/relations.js +966 -0
  92. package/dist/esm/diagram/requirement.js +341 -0
  93. package/dist/esm/diagram/sequence.js +1228 -0
  94. package/dist/esm/diagram/shapes.js +366 -0
  95. package/dist/esm/diagram/source.js +538 -0
  96. package/dist/esm/diagram/support.js +153 -0
  97. package/dist/esm/diagram/swimlane-mermaid.js +140 -0
  98. package/dist/esm/diagram/swimlane.js +1186 -0
  99. package/dist/esm/diagram/time.js +748 -0
  100. package/dist/esm/diagram/timeline.js +376 -0
  101. package/dist/esm/diagram/tree-family-icon.js +22 -0
  102. package/dist/esm/diagram/treeview.js +293 -0
  103. package/dist/esm/diagram/usecase.js +852 -0
  104. package/dist/esm/diagram/venn.js +1038 -0
  105. package/dist/esm/diagram/wardley.js +838 -0
  106. package/dist/esm/index.d.ts +133 -0
  107. package/dist/esm/index.js +92 -0
  108. package/dist/esm/interaction.js +561 -0
  109. package/dist/esm/mermaid.d.ts +28 -0
  110. package/dist/esm/mermaid.js +70 -0
  111. package/dist/esm/node.d.ts +68 -0
  112. package/dist/esm/node.js +373 -0
  113. package/dist/esm/package.json +1 -0
  114. package/dist/esm/page-api.js +65 -0
  115. package/dist/esm/runtime.js +352 -0
  116. package/dist/esm/src/families.js +209 -0
  117. package/dist/page-api.js +1 -0
  118. package/dist/units/chart/basic.js +1 -0
  119. package/dist/units/chart/catalog.js +1 -0
  120. package/dist/units/chart/composition.js +1 -0
  121. package/dist/units/chart/context.js +1 -0
  122. package/dist/units/chart/distribution.js +1 -0
  123. package/dist/units/chart/fields.js +1 -0
  124. package/dist/units/chart/maps.js +1 -0
  125. package/dist/units/chart/mindmap.js +1 -0
  126. package/dist/units/chart/multivariate.js +1 -0
  127. package/dist/units/chart/registry.js +1 -0
  128. package/dist/units/chart/relations.js +1 -0
  129. package/dist/units/chart/spec.js +3 -0
  130. package/dist/units/chart/stat-compare.js +1 -0
  131. package/dist/units/chart/stat-trend.js +1 -0
  132. package/dist/units/chart/statistics.js +1 -0
  133. package/dist/units/chart/unit-variants.js +1 -0
  134. package/dist/units/chart/variants.js +1 -0
  135. package/dist/units/core/color.js +1 -0
  136. package/dist/units/core/context.js +1 -0
  137. package/dist/units/core/diagnostics.js +1 -0
  138. package/dist/units/core/format.js +1 -0
  139. package/dist/units/core/geometry.js +1 -0
  140. package/dist/units/core/icon-data.js +1 -0
  141. package/dist/units/core/icons.js +1 -0
  142. package/dist/units/core/scale.js +1 -0
  143. package/dist/units/core/scene.js +1 -0
  144. package/dist/units/core/svg.js +1 -0
  145. package/dist/units/core/text.js +2 -0
  146. package/dist/units/core/theme.js +1 -0
  147. package/dist/units/diagram/agentflow.js +12 -0
  148. package/dist/units/diagram/architecture.js +4 -0
  149. package/dist/units/diagram/block.js +2 -0
  150. package/dist/units/diagram/blocks.js +2 -0
  151. package/dist/units/diagram/c4.js +6 -0
  152. package/dist/units/diagram/class.js +5 -0
  153. package/dist/units/diagram/cynefin.js +4 -0
  154. package/dist/units/diagram/emphasis.js +1 -0
  155. package/dist/units/diagram/er.js +9 -0
  156. package/dist/units/diagram/eventmodeling.js +5 -0
  157. package/dist/units/diagram/gantt-date.js +1 -0
  158. package/dist/units/diagram/gantt.js +3 -0
  159. package/dist/units/diagram/gitgraph.js +2 -0
  160. package/dist/units/diagram/graph-layout.js +4 -0
  161. package/dist/units/diagram/graph-parse.js +9 -0
  162. package/dist/units/diagram/graph-route.js +1 -0
  163. package/dist/units/diagram/graph.js +1 -0
  164. package/dist/units/diagram/ishikawa.js +2 -0
  165. package/dist/units/diagram/journey.js +5 -0
  166. package/dist/units/diagram/kanban.js +2 -0
  167. package/dist/units/diagram/label.js +4 -0
  168. package/dist/units/diagram/layers.js +1 -0
  169. package/dist/units/diagram/map-label.js +1 -0
  170. package/dist/units/diagram/mindmap.js +2 -0
  171. package/dist/units/diagram/numeric-composition.js +1 -0
  172. package/dist/units/diagram/numeric-model.js +1 -0
  173. package/dist/units/diagram/numeric-parse.js +2 -0
  174. package/dist/units/diagram/numeric-radar.js +3 -0
  175. package/dist/units/diagram/numeric-sankey.js +2 -0
  176. package/dist/units/diagram/numeric-xy.js +2 -0
  177. package/dist/units/diagram/packet.js +2 -0
  178. package/dist/units/diagram/presentation.js +2 -0
  179. package/dist/units/diagram/quadrant.js +2 -0
  180. package/dist/units/diagram/railroad-parse.js +4 -0
  181. package/dist/units/diagram/railroad.js +1 -0
  182. package/dist/units/diagram/registry.js +2 -0
  183. package/dist/units/diagram/relations.js +3 -0
  184. package/dist/units/diagram/requirement.js +3 -0
  185. package/dist/units/diagram/sequence.js +2 -0
  186. package/dist/units/diagram/shapes.js +60 -0
  187. package/dist/units/diagram/source.js +20 -0
  188. package/dist/units/diagram/support.js +3 -0
  189. package/dist/units/diagram/swimlane-mermaid.js +3 -0
  190. package/dist/units/diagram/swimlane.js +2 -0
  191. package/dist/units/diagram/time.js +3 -0
  192. package/dist/units/diagram/timeline.js +2 -0
  193. package/dist/units/diagram/tree-family-icon.js +1 -0
  194. package/dist/units/diagram/treeview.js +2 -0
  195. package/dist/units/diagram/usecase.js +3 -0
  196. package/dist/units/diagram/venn.js +2 -0
  197. package/dist/units/diagram/wardley.js +4 -0
  198. package/dist/units/interaction.js +1 -0
  199. package/dist/units/runtime.js +1 -0
  200. package/dist/units.json +712 -0
  201. package/package.json +30 -4
@@ -0,0 +1,323 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ // src/diagram/gantt-date.js
3
+ var gantt_date_exports = /* @__PURE__ */ __exportAll({
4
+ DAY: () => DAY,
5
+ add: () => add,
6
+ axisTokens: () => axisTokens,
7
+ compileAxis: () => compileAxis,
8
+ compileDate: () => compileDate,
9
+ dateTokens: () => dateTokens,
10
+ durationPattern: () => durationPattern,
11
+ excludedBy: () => excludedBy,
12
+ intervalPattern: () => intervalPattern,
13
+ shiftEnd: () => shiftEnd,
14
+ ticks: () => ticks,
15
+ weekdays: () => weekdays
16
+ });
17
+ var DAY = 864e5;
18
+ var weekdays = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" ");
19
+ var months = "January February March April May June July August September October November December".split(" ");
20
+ var shortMonths = months.map((name) => name.slice(0, 3));
21
+ var shortWeekdays = weekdays.map((name) => name.slice(0, 3));
22
+ var pad = (n, width = 2, char = "0") => String(n).padStart(width, char);
23
+ var ordinal = (n) => n + (n % 100 >= 11 && n % 100 <= 13 ? "th" : {
24
+ 1: "st",
25
+ 2: "nd",
26
+ 3: "rd"
27
+ }[n % 10] || "th");
28
+ var escape = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
29
+ function civil(y, m = 0, d = 1, h = 0, min = 0, s = 0, ms = 0) {
30
+ const date = /* @__PURE__ */ new Date(0);
31
+ date.setUTCFullYear(y, m, d);
32
+ date.setUTCHours(h, min, s, ms);
33
+ return date;
34
+ }
35
+ var parts = (stamp) => {
36
+ const d = new Date(stamp), y = d.getUTCFullYear();
37
+ return {
38
+ y,
39
+ m: d.getUTCMonth(),
40
+ day: d.getUTCDate(),
41
+ dow: d.getUTCDay(),
42
+ h: d.getUTCHours(),
43
+ min: d.getUTCMinutes(),
44
+ s: d.getUTCSeconds(),
45
+ ms: d.getUTCMilliseconds(),
46
+ doy: Math.floor((stamp - +civil(y)) / DAY) + 1
47
+ };
48
+ };
49
+ var one = "\\d{1,2}";
50
+ var two = "\\d{2}";
51
+ var patterns = {
52
+ YYYY: "\\d{4}",
53
+ YY: two,
54
+ Q: "[1-4]",
55
+ M: one,
56
+ MM: two,
57
+ MMM: shortMonths.join("|"),
58
+ MMMM: months.join("|"),
59
+ D: one,
60
+ DD: two,
61
+ Do: "\\d{1,2}(?:st|nd|rd|th)",
62
+ DDD: "\\d{1,3}",
63
+ DDDD: "\\d{3}",
64
+ d: "[0-6]",
65
+ dd: weekdays.map((x) => x.slice(0, 2)).join("|"),
66
+ ddd: shortWeekdays.join("|"),
67
+ dddd: weekdays.join("|"),
68
+ H: one,
69
+ HH: two,
70
+ h: one,
71
+ hh: two,
72
+ a: "am|pm",
73
+ A: "AM|PM",
74
+ m: one,
75
+ mm: two,
76
+ s: one,
77
+ ss: two,
78
+ S: "\\d",
79
+ SS: two,
80
+ SSS: "\\d{3}",
81
+ Z: "Z|[+-]\\d{2}:\\d{2}",
82
+ ZZ: "Z|[+-]\\d{4}"
83
+ };
84
+ var dateTokens = [
85
+ ...Object.keys(patterns),
86
+ "X",
87
+ "x"
88
+ ];
89
+ function compileDate(format) {
90
+ if (format === "X" || format === "x") return {
91
+ parse: (text) => /^-?\d+(?:\.\d+)?$/.test(text) ? +/* @__PURE__ */ new Date(Number(text) * (format === "X" ? 1e3 : 1)) : NaN,
92
+ format: (stamp) => String(format === "X" ? Math.floor(stamp / 1e3) : stamp)
93
+ };
94
+ const tokens = [], fields = [], atom = /\[([^\]]*)\]|([A-Za-z]+)|([^A-Za-z\[\]]+)|([\[\]])/g;
95
+ const scan = new RegExp(Object.keys(patterns).sort((a, b) => b.length - a.length).join("|"), "y");
96
+ for (const [, literal, word, punctuation, invalid] of format.matchAll(atom)) {
97
+ if (invalid) throw new Error(invalid);
98
+ if (!word) {
99
+ tokens.push({ literal: literal ?? punctuation });
100
+ continue;
101
+ }
102
+ scan.lastIndex = 0;
103
+ while (scan.lastIndex < word.length) {
104
+ const index = scan.lastIndex, match = scan.exec(word);
105
+ if (!match) throw new Error(word.slice(index));
106
+ fields.push(match[0]);
107
+ tokens.push({ key: match[0] });
108
+ }
109
+ }
110
+ const keys = fields.map((key) => key === "Do" ? "D" : key.replace(/(.)\1+/g, "$1").replace(/^[aA]$/, "a").replace(/^[hH]$/, "H"));
111
+ if (!fields.length || new Set(keys).size !== fields.length) throw new Error(format);
112
+ const re = new RegExp(`^${tokens.map(({ key, literal }) => key ? `(${patterns[key]})` : escape(literal)).join("")}$`, "u");
113
+ const formatParts = (p) => {
114
+ const { y, m, day, dow, h, min, s, ms, doy } = p, hh = h % 12 || 12;
115
+ return {
116
+ YYYY: pad(y, 4),
117
+ YY: pad(y % 100),
118
+ Q: Math.floor(m / 3) + 1,
119
+ M: m + 1,
120
+ MM: pad(m + 1),
121
+ MMM: shortMonths[m],
122
+ MMMM: months[m],
123
+ D: day,
124
+ DD: pad(day),
125
+ Do: ordinal(day),
126
+ DDD: doy,
127
+ DDDD: pad(doy, 3),
128
+ d: dow,
129
+ dd: weekdays[dow].slice(0, 2),
130
+ ddd: shortWeekdays[dow],
131
+ dddd: weekdays[dow],
132
+ H: h,
133
+ HH: pad(h),
134
+ h: hh,
135
+ hh: pad(hh),
136
+ a: h < 12 ? "am" : "pm",
137
+ A: h < 12 ? "AM" : "PM",
138
+ m: min,
139
+ mm: pad(min),
140
+ s,
141
+ ss: pad(s),
142
+ S: Math.floor(ms / 100),
143
+ SS: pad(Math.floor(ms / 10)),
144
+ SSS: pad(ms, 3),
145
+ Z: "+00:00",
146
+ ZZ: "+0000"
147
+ };
148
+ };
149
+ return {
150
+ parse(text) {
151
+ const match = re.exec(text);
152
+ if (!match) return NaN;
153
+ const f = Object.fromEntries(fields.map((key, i) => [key, match[i + 1]]));
154
+ const yy = Number(f.YY), y = Number(f.YYYY ?? (f.YY ? (yy > 68 ? 1900 : 2e3) + yy : 1970));
155
+ const m = f.MMM ? shortMonths.indexOf(f.MMM) : f.MMMM ? months.indexOf(f.MMMM) : Number(f.M ?? f.MM ?? (f.Q ? (+f.Q - 1) * 3 + 1 : 1)) - 1;
156
+ const doy = f.DDD ?? f.DDDD, day = Number(doy ?? f.D ?? f.DD ?? (f.Do ? parseInt(f.Do, 10) : 1));
157
+ const hour = Number(f.h ?? f.hh), ampm = (f.a ?? f.A)?.toLowerCase();
158
+ if ((f.h || f.hh) && (hour < 1 || hour > 12)) return NaN;
159
+ const h = Number(f.H ?? f.HH ?? (Number.isNaN(hour) ? 0 : ampm ? hour % 12 + (ampm === "pm" ? 12 : 0) : hour));
160
+ const stamp = +civil(y, doy ? 0 : m, day, h, Number(f.m ?? f.mm ?? 0), Number(f.s ?? f.ss ?? 0), Number(f.SSS ?? (f.SS ?? f.S ?? "").padEnd(3, "0")));
161
+ if (!Number.isFinite(stamp)) return NaN;
162
+ const zone = f.Z ?? f.ZZ, digits = zone?.replace(":", "");
163
+ const zh = Number(digits?.slice(1, 3)), zm = Number(digits?.slice(3));
164
+ const values = formatParts(parts(stamp));
165
+ if (fields.some((key) => key !== "Z" && key !== "ZZ" && String(values[key]) !== f[key])) return NaN;
166
+ if (!zone || zone === "Z") return stamp;
167
+ return zh <= 23 && zm <= 59 ? stamp - (zone[0] === "-" ? -1 : 1) * (zh * 60 + zm) * 6e4 : NaN;
168
+ },
169
+ format(stamp) {
170
+ const values = formatParts(parts(stamp));
171
+ return tokens.map(({ key, literal }) => key ? values[key] : literal).join("");
172
+ }
173
+ };
174
+ }
175
+ var axisTokens = "a A b B c d e H I j m M L p S U w W x X y Y Z % s Q f g G q u V".split(" ");
176
+ function compileAxis(format) {
177
+ const directives = /%([-_0]?)(.)?/g;
178
+ for (const [token, , key] of format.matchAll(directives)) if (!key || !axisTokens.includes(key)) throw new Error(token);
179
+ return (stamp) => {
180
+ const { y, m, day, dow, h, min, s, ms, doy } = parts(stamp), hh = h % 12 || 12;
181
+ const thursday = parts(stamp + (3 - (dow + 6) % 7) * DAY);
182
+ const values = {
183
+ a: shortWeekdays[dow],
184
+ A: weekdays[dow],
185
+ b: shortMonths[m],
186
+ B: months[m],
187
+ d: day,
188
+ e: day,
189
+ H: h,
190
+ I: hh,
191
+ j: doy,
192
+ m: m + 1,
193
+ M: min,
194
+ L: ms,
195
+ p: h < 12 ? "AM" : "PM",
196
+ S: s,
197
+ U: Math.floor((doy + 6 - dow) / 7),
198
+ W: Math.floor((doy + 6 - (dow + 6) % 7) / 7),
199
+ w: dow,
200
+ y: y % 100,
201
+ Y: y,
202
+ Z: "+0000",
203
+ "%": "%",
204
+ x: `${m + 1}/${day}/${y}`,
205
+ X: `${hh}:${pad(min)}:${pad(s)} ${h < 12 ? "AM" : "PM"}`,
206
+ s: Math.floor(stamp / 1e3),
207
+ Q: stamp,
208
+ f: ms * 1e3,
209
+ g: thursday.y % 100,
210
+ G: thursday.y,
211
+ q: Math.floor(m / 3) + 1,
212
+ u: dow || 7,
213
+ V: Math.ceil(thursday.doy / 7)
214
+ };
215
+ values.c = `${values.x}, ${values.X}`;
216
+ const widths = {
217
+ Y: 4,
218
+ G: 4,
219
+ f: 6,
220
+ L: 3,
221
+ j: 3
222
+ };
223
+ return format.replace(directives, (_, modifier, key) => {
224
+ const n = values[key];
225
+ return modifier === "-" || typeof n !== "number" || "sQqwu".includes(key) ? String(n) : pad(n, widths[key] || 2, modifier === "_" || !modifier && key === "e" ? " " : "0");
226
+ });
227
+ };
228
+ }
229
+ var units = {
230
+ ms: 1,
231
+ s: 1e3,
232
+ m: 6e4,
233
+ h: 36e5,
234
+ d: DAY,
235
+ w: 7 * DAY
236
+ };
237
+ var durationPattern = /^(\d+(?:\.\d+)?)(ms|[smhdwMy])$/;
238
+ function add(stamp, n, unit) {
239
+ if (unit !== "M" && unit !== "y") return +new Date(stamp + n * units[unit]);
240
+ const { y, m, day, h, min, s, ms } = parts(stamp);
241
+ const endMonth = m + (unit === "M" ? Math.trunc(n) : 0), endYear = y + (unit === "y" ? Math.trunc(n) : 0);
242
+ const lastDay = civil(endYear, endMonth + 1, 0).getUTCDate();
243
+ return +civil(endYear, endMonth, Math.min(day, lastDay), h, min, s, ms);
244
+ }
245
+ function excludedBy({ includes, excludes, weekend }, format) {
246
+ const iso = compileDate("YYYY-MM-DD").format;
247
+ return (stamp) => {
248
+ const full = format(stamp).toLowerCase(), day = iso(stamp), dow = parts(stamp).dow;
249
+ if (includes.has(full) || includes.has(day) || includes.has(weekdays[dow].toLowerCase()) || includes.has("weekends") && (dow === weekend || dow === (weekend + 1) % 7)) return false;
250
+ return excludes.has(full) || excludes.has(day) || excludes.has(weekdays[dow].toLowerCase()) || excludes.has("weekends") && (dow === weekend || dow === (weekend + 1) % 7);
251
+ };
252
+ }
253
+ function shiftEnd(start, end, excluded) {
254
+ for (let day = start + DAY; day <= end; day += DAY) {
255
+ if (day - start > 864e9) return NaN;
256
+ if (excluded(day)) end += DAY;
257
+ }
258
+ return end;
259
+ }
260
+ var intervalUnits = {
261
+ millisecond: "ms",
262
+ second: "s",
263
+ minute: "m",
264
+ hour: "h",
265
+ day: "d",
266
+ week: "w",
267
+ month: "M",
268
+ year: "y"
269
+ };
270
+ var intervalPattern = /^([1-9]\d*)(millisecond|second|minute|hour|day|week|month|year)$/;
271
+ var autoIntervals = [
272
+ [1, "ms"],
273
+ [10, "ms"],
274
+ [100, "ms"],
275
+ [1, "s"],
276
+ [5, "s"],
277
+ [15, "s"],
278
+ [30, "s"],
279
+ [1, "m"],
280
+ [5, "m"],
281
+ [15, "m"],
282
+ [30, "m"],
283
+ [1, "h"],
284
+ [3, "h"],
285
+ [6, "h"],
286
+ [12, "h"],
287
+ [1, "d"],
288
+ [1, "w"],
289
+ [1, "M"],
290
+ [3, "M"],
291
+ [1, "y"]
292
+ ];
293
+ var approx = (unit) => units[unit] ?? (unit === "M" ? 30 : 365) * 864e5;
294
+ function ticks(min, max, weekday, interval) {
295
+ const span = max - min;
296
+ const unit = interval ? intervalUnits[interval[2]] : null;
297
+ const dropped = Boolean(unit && span / (approx(unit) * Number(interval[1])) > 9999);
298
+ const [step, kind] = unit && !dropped ? [Number(interval[1]), unit] : autoIntervals.find(([n, key]) => n * approx(key) >= span / 9) || [Math.ceil(span / (9 * approx("y"))), "y"];
299
+ const p = parts(min), weekBase = (weekday - 4) * DAY;
300
+ const floor = (n, base) => Math.floor(n / base) * base;
301
+ let stamp;
302
+ if (kind === "y") stamp = +civil(floor(p.y, step));
303
+ else if (kind === "M") stamp = +civil(p.y, floor(p.m, step));
304
+ else if (kind === "w") stamp = floor(min - weekBase, step * units.w) + weekBase;
305
+ else if (kind === "d") stamp = +civil(p.y, p.m, 1 + floor(p.day - 1, step));
306
+ else stamp = floor(min, step * units[kind]);
307
+ const values = [];
308
+ while (Number.isFinite(stamp) && stamp <= max && values.length <= 1e4) {
309
+ if (stamp >= min) values.push(stamp);
310
+ const next = add(stamp, step, kind), a = parts(stamp), b = parts(next);
311
+ stamp = kind === "d" && (a.y !== b.y || a.m !== b.m) ? +civil(a.y, a.m + 1) : kind === "M" && a.y !== b.y ? +civil(a.y + 1) : next;
312
+ if (stamp <= (values.at(-1) ?? -Infinity)) break;
313
+ }
314
+ if (values.length > 1e4) return {
315
+ ...ticks(min, max, weekday),
316
+ dropped: true
317
+ };
318
+ return {
319
+ values: values.length ? values : [min],
320
+ dropped
321
+ };
322
+ }
323
+ export { DAY, add, axisTokens, compileAxis, compileDate, dateTokens, durationPattern, excludedBy, gantt_date_exports, intervalPattern, shiftEnd, ticks, weekdays };