minerva-design 1.17.2 → 1.19.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 (98) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/custom-elements.json +10 -6
  3. package/dist/angular/fesm2022/minerva-angular.mjs +173 -70
  4. package/dist/angular/fesm2022/minerva-angular.mjs.map +1 -1
  5. package/dist/angular/types/minerva-angular.d.ts +33 -21
  6. package/dist/charts/core.cjs +1 -1
  7. package/dist/charts/core.d.cts +1 -0
  8. package/dist/charts/core.d.ts +1 -0
  9. package/dist/charts/core.js +22 -21
  10. package/dist/charts/engine/chart.cjs +1 -1
  11. package/dist/charts/engine/chart.cjs.map +1 -1
  12. package/dist/charts/engine/chart.js +414 -376
  13. package/dist/charts/engine/chart.js.map +1 -1
  14. package/dist/charts/engine/overlay.cjs +1 -1
  15. package/dist/charts/engine/overlay.cjs.map +1 -1
  16. package/dist/charts/engine/overlay.d.cts +5 -0
  17. package/dist/charts/engine/overlay.d.ts +5 -0
  18. package/dist/charts/engine/overlay.js +94 -69
  19. package/dist/charts/engine/overlay.js.map +1 -1
  20. package/dist/charts/engine/quadrant-card.cjs +2 -0
  21. package/dist/charts/engine/quadrant-card.cjs.map +1 -0
  22. package/dist/charts/engine/quadrant-card.d.cts +83 -0
  23. package/dist/charts/engine/quadrant-card.d.ts +83 -0
  24. package/dist/charts/engine/quadrant-card.js +154 -0
  25. package/dist/charts/engine/quadrant-card.js.map +1 -0
  26. package/dist/charts/engine/scene.cjs +1 -1
  27. package/dist/charts/engine/scene.cjs.map +1 -1
  28. package/dist/charts/engine/scene.d.cts +5 -0
  29. package/dist/charts/engine/scene.d.ts +5 -0
  30. package/dist/charts/engine/scene.js +32 -32
  31. package/dist/charts/engine/scene.js.map +1 -1
  32. package/dist/charts/engine/types.d.cts +14 -0
  33. package/dist/charts/engine/types.d.ts +14 -0
  34. package/dist/charts/index.cjs +1 -1
  35. package/dist/charts/index.js +28 -27
  36. package/dist/charts/react/Chart.cjs +1 -1
  37. package/dist/charts/react/Chart.cjs.map +1 -1
  38. package/dist/charts/react/Chart.d.cts +4 -2
  39. package/dist/charts/react/Chart.d.ts +4 -2
  40. package/dist/charts/react/Chart.js +42 -42
  41. package/dist/charts/react/Chart.js.map +1 -1
  42. package/dist/charts/react/charts.cjs +1 -1
  43. package/dist/charts/react/charts.cjs.map +1 -1
  44. package/dist/charts/react/charts.js +395 -391
  45. package/dist/charts/react/charts.js.map +1 -1
  46. package/dist/charts/react/types.d.cts +8 -2
  47. package/dist/charts/react/types.d.ts +8 -2
  48. package/dist/core/contracts.cjs +1 -1
  49. package/dist/core/contracts.cjs.map +1 -1
  50. package/dist/core/contracts.js +1 -1
  51. package/dist/core/contracts.js.map +1 -1
  52. package/dist/native/charts/src/engine/overlay.cjs +1 -1
  53. package/dist/native/charts/src/engine/overlay.cjs.map +1 -1
  54. package/dist/native/charts/src/engine/overlay.js +89 -65
  55. package/dist/native/charts/src/engine/overlay.js.map +1 -1
  56. package/dist/native/charts/src/engine/scene.cjs +1 -1
  57. package/dist/native/charts/src/engine/scene.cjs.map +1 -1
  58. package/dist/native/charts/src/engine/scene.js +32 -32
  59. package/dist/native/charts/src/engine/scene.js.map +1 -1
  60. package/dist/react/components/QuadrantTaskBoard/QuadrantTaskBoard.cjs +1 -1
  61. package/dist/react/components/QuadrantTaskBoard/QuadrantTaskBoard.cjs.map +1 -1
  62. package/dist/react/components/QuadrantTaskBoard/QuadrantTaskBoard.js +14 -8
  63. package/dist/react/components/QuadrantTaskBoard/QuadrantTaskBoard.js.map +1 -1
  64. package/dist/react/components/QuadrantTaskBoard/quadrantTaskBoard.module.scss.cjs +1 -1
  65. package/dist/react/components/QuadrantTaskBoard/quadrantTaskBoard.module.scss.cjs.map +1 -1
  66. package/dist/react/components/QuadrantTaskBoard/quadrantTaskBoard.module.scss.js +16 -15
  67. package/dist/react/components/QuadrantTaskBoard/quadrantTaskBoard.module.scss.js.map +1 -1
  68. package/dist/react/style.css +1 -1
  69. package/dist/react/styles/quadrant-task-board.css +1 -1
  70. package/dist/taro/index.js +1521 -1496
  71. package/dist/taro/style.css +22 -0
  72. package/dist/uni/manifest.d.ts +34 -34
  73. package/dist/uni/manifest.js +34 -39
  74. package/dist/uni/style.css +22 -0
  75. package/dist/vue/components/Chart/QuadrantChart.vue.d.ts +4 -3
  76. package/dist/vue/components/Chart/QuadrantChart.vue.js.map +1 -1
  77. package/dist/vue/components/Chart/QuadrantChart.vue_vue_type_script_setup_true_lang.js +186 -142
  78. package/dist/vue/components/Chart/QuadrantChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
  79. package/dist/vue/components/Chart/cartesian.d.ts +5 -1
  80. package/dist/vue/components/Chart/cartesian.js +2 -0
  81. package/dist/vue/components/Chart/cartesian.js.map +1 -1
  82. package/dist/vue/components/QuadrantTaskBoard/QuadrantTaskBoard.vue.js.map +1 -1
  83. package/dist/vue/components/QuadrantTaskBoard/QuadrantTaskBoard.vue_vue_type_script_setup_true_lang.js +18 -12
  84. package/dist/vue/components/QuadrantTaskBoard/QuadrantTaskBoard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  85. package/dist/weapp/charts/canvas.js +48 -11
  86. package/dist/weapp/controls.wxss +22 -0
  87. package/dist/web-components/components/chart/chart.d.ts +4 -1
  88. package/dist/web-components/components/chart/chart.js +3 -1
  89. package/dist/web-components/components/chart/chart.js.map +1 -1
  90. package/dist/web-components/components/chart/charts.d.ts +34 -14
  91. package/dist/web-components/components/chart/charts.js +145 -98
  92. package/dist/web-components/components/chart/charts.js.map +1 -1
  93. package/dist/web-components/components/quadrant-task-board/quadrant-task-board.d.ts +8 -8
  94. package/dist/web-components/components/quadrant-task-board/quadrant-task-board.js +16 -12
  95. package/dist/web-components/components/quadrant-task-board/quadrant-task-board.js.map +1 -1
  96. package/dist/web-components/styles/QuadrantTaskBoard/quadrantTaskBoard.css.js +1 -1
  97. package/dist/web-components/styles/QuadrantTaskBoard/quadrantTaskBoard.css.js.map +1 -1
  98. package/package.json +1 -1
@@ -0,0 +1,154 @@
1
+ import { styleTooltip as e, themeTooltip as t } from "./tooltip.js";
2
+ import { DEFAULT_QUADRANT_COLORS as n, quadrantLabels as r, quadrantOf as i } from "./presets.js";
3
+ import { quadrantName as ee } from "./quadrant-keyboard.js";
4
+ var a = 5, te = 7, ne = 18, o = 24, s = 6, c = 180, l = (e) => ({
5
+ ...e,
6
+ tooltip: !1,
7
+ interaction: typeof e.interaction == "object" ? {
8
+ ...e.interaction,
9
+ dragLabel: !1,
10
+ hoverLabel: !1
11
+ } : e.interaction
12
+ }), u = (e) => e ? `${e.x}|${e.y}|${e.label ?? ""}` : null, d = (e, t, n) => (e - t) / (n - t || 1), f = (c, l) => {
13
+ let f = l, p = null, m = null, h = null, g = null, _ = null, v = !1, y = null, b = null, x = !1, S = "", C = null, w = null, T = null, E = 0, D = c.ownerDocument, O = D.defaultView, k = D.createElement("div");
14
+ k.className = "minerva-chart-quadrant-card", e(k, {
15
+ zIndex: "3",
16
+ boxSizing: "border-box",
17
+ maxWidth: "min(280px, calc(100% + 12px))",
18
+ paddingTop: `${a}px`,
19
+ paddingBottom: `${a}px`,
20
+ borderRadius: "12px",
21
+ fontSize: "12px",
22
+ lineHeight: "18px"
23
+ });
24
+ let A = D.createElement("span");
25
+ A.setAttribute("aria-hidden", "true"), A.dataset.cardDot = "", A.style.cssText = "position:absolute;border-radius:50%;pointer-events:none";
26
+ let j = D.createElement("div");
27
+ j.dataset.cardContent = "", j.style.cssText = "display:grid;column-gap:6px;align-items:center";
28
+ let M = D.createElement("div");
29
+ M.setAttribute("aria-hidden", "true"), M.style.cssText = "grid-area:label;min-width:0;cursor:pointer";
30
+ let N = D.createElement("strong");
31
+ N.style.cssText = "display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600";
32
+ let P = D.createElement("div");
33
+ M.append(N, P);
34
+ let F = D.createElement("div");
35
+ F.dataset.cardActions = "", F.style.cssText = `grid-area:actions;align-self:start;display:flex;align-items:center;height:${o}px`;
36
+ let I = D.createElement("span");
37
+ I.setAttribute("aria-hidden", "true"), I.style.cssText = "grid-area:meta;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text-secondary-color, #6b7280);font-size:11px;line-height:16px", j.append(M, F, I), k.append(A, j);
38
+ let L = () => f.config.points, R = (e) => e === null ? null : {
39
+ index: e,
40
+ key: u(L()[e])
41
+ }, z = (e) => e && e.key !== null && u(L()[e.index]) === e.key ? e.index : null, B = () => {
42
+ let e = f.selectedIndex;
43
+ return f.showSelected && e != null && L()[e] ? e : null;
44
+ }, V = () => v ? null : z(m) ?? (f.hover === !1 ? null : z(p)) ?? z(h) ?? B(), H = () => {
45
+ if (g !== null) return L()[g] ? g : null;
46
+ let e = V(), t = e === null ? void 0 : L()[e];
47
+ return t && Number.isFinite(t.x) && Number.isFinite(t.y) ? e : null;
48
+ }, U = (e) => g === null && !!f.hasActions?.(e), W = () => {
49
+ let e = y, a = e === null ? void 0 : L()[e];
50
+ if (e === null || !a || !k.parentNode) return;
51
+ let { config: l } = f;
52
+ x || (x = !0, t(k, k));
53
+ let u = g === null ? null : _, p = u ?? a, [m, h] = l.xDomain ?? [0, 10], [v, b] = l.yDomain ?? [0, 10], C = d(p.x, m, h), w = l.reverseX ? 1 - C : C, T = parseFloat(c.style.width) || c.clientWidth, E = parseFloat(c.style.height) || c.clientHeight, D = w * T, O = (1 - d(p.y, v, b)) * E, M = a.size ?? f.pointSize ?? 12, N = U(e), P = N ? o : ne, F = 9 + M / 2 + (u ? 8 : 0), R = k.offsetWidth, z = k.offsetHeight, B = w > .6;
54
+ if (R) {
55
+ let e = D - F + R - T, t = R - F - D, n = k.dataset.side;
56
+ B = n === "start" && e <= s ? !1 : n === "end" && t <= s || e > 0 && t < e;
57
+ }
58
+ let V = O - (6 + P / 2);
59
+ z && (V = Math.max(-6, Math.min(V, E + s - z)));
60
+ let H = B ? "end" : "start";
61
+ k.dataset.side = H;
62
+ let W = `${H}|${N}|${M}`;
63
+ if (S !== W) {
64
+ S = W;
65
+ let e = `${8 + M + te}px`, t = N ? "4px" : "12px";
66
+ k.style.paddingLeft = B ? t : e, k.style.paddingRight = B ? e : t, k.style.textAlign = B ? "right" : "left", j.style.minHeight = `${P}px`, j.style.gridTemplateAreas = B ? "\"actions label\" \". meta\"" : "\"label actions\" \"meta .\"", j.style.gridTemplateColumns = B ? "auto minmax(0, 1fr)" : "minmax(0, 1fr) auto", A.style.width = `${M}px`, A.style.height = `${M}px`;
67
+ }
68
+ k.style.transform = `translate(${D}px, ${V}px) translate(${B ? `calc(-100% + ${F}px)` : `${-F}px`}, 0)`;
69
+ let G = i(l, p.x, p.y), K = l.quadrants?.[G], q = ee(G, l, r(f.locale)), J = K?.badge ? `${K.badge} · ${q}` : q;
70
+ I.textContent !== J && (I.textContent = J);
71
+ let Y = i(l, a.x, a.y), X = a.color ?? l.quadrants?.[Y]?.color ?? n[Y];
72
+ A.style.display = u ? "none" : "block", A.style.left = B ? "auto" : "8px", A.style.right = B ? "8px" : "auto", A.style.top = `${O - V - 1 - M / 2}px`, A.style.background = X, A.style.boxShadow = `0 0 0 2px var(--surface-color, var(--background-color, #fff)), 0 0 0 4px color-mix(in srgb, ${X} 45%, transparent)`;
73
+ }, G = (e) => {
74
+ e.key === "Escape" && g === null && y !== null && ($.dismiss(), f.onDismiss?.());
75
+ }, K = () => {
76
+ let e = H(), t = e !== y;
77
+ if (y = e, e === null) k.parentNode && (k.remove(), D.removeEventListener("keydown", G)), S = "", delete k.dataset.side;
78
+ else {
79
+ let n = L()[e];
80
+ t && (x = !1, delete k.dataset.side), k.dataset.pointPreview = String(e), g === null ? delete k.dataset.dragging : k.dataset.dragging = "";
81
+ let r = !!f.custom && g === null;
82
+ N.textContent = n.label ?? "", N.style.display = r ? "none" : "block", P.style.display = r ? "block" : "none", I.style.display = r ? "none" : "block", F.style.display = U(e) ? "flex" : "none", j.style.pointerEvents = g === null ? "auto" : "none", k.parentNode || (c.appendChild(k), D.addEventListener("keydown", G));
83
+ }
84
+ f.chart?.setLabelHidden(e !== null && g === null ? {
85
+ seriesIndex: 0,
86
+ index: e
87
+ } : null), W();
88
+ let n = g === null ? e : null;
89
+ n !== b && (b = n, f.onChange?.(n));
90
+ }, q = (e) => {
91
+ if (w && clearTimeout(w), w = null, e !== null) return m = R(e), K();
92
+ w = setTimeout(() => {
93
+ w = null, m = null, K();
94
+ }, 180);
95
+ }, J = () => {
96
+ y !== null && g === null && q(y);
97
+ }, Y = () => q(null), X = (e) => {
98
+ j.contains(e.relatedTarget) || q(null);
99
+ }, Z = () => {
100
+ y !== null && g === null && f.onClick?.(y);
101
+ };
102
+ j.addEventListener("pointerenter", J), j.addEventListener("pointerleave", Y), j.addEventListener("focusin", J), j.addEventListener("focusout", X), M.addEventListener("click", Z);
103
+ let Q = typeof ResizeObserver == "function" ? new ResizeObserver(() => W()) : null;
104
+ Q?.observe(k), Q?.observe(c);
105
+ let $ = {
106
+ element: k,
107
+ actions: F,
108
+ content: P,
109
+ get index() {
110
+ return y;
111
+ },
112
+ update(e) {
113
+ let t = f.selectedIndex;
114
+ f = e, e.showSelected && e.selectedIndex !== t && e.selectedIndex != null && (v = !1), K();
115
+ },
116
+ hover(e) {
117
+ if (C && clearTimeout(C), C = null, e !== null) return p = R(e), v = !1, K();
118
+ C = setTimeout(() => {
119
+ C = null, p = null, K();
120
+ }, 180);
121
+ },
122
+ focus(e) {
123
+ if (T && clearTimeout(T), T = null, e === null) {
124
+ if (!h) return;
125
+ T = setTimeout(() => {
126
+ T = null, h = null, K();
127
+ }, 0);
128
+ return;
129
+ }
130
+ h = R(e), v = !1, K();
131
+ },
132
+ drag(e, t) {
133
+ g = e, _ = e === null ? null : t ?? null, e !== null && (v = !1, m = null), K();
134
+ },
135
+ move(e) {
136
+ if (_ = e, !O?.requestAnimationFrame) return W();
137
+ E || (E = O.requestAnimationFrame(() => {
138
+ E = 0, W();
139
+ }));
140
+ },
141
+ dismiss() {
142
+ v = !0, m = null, p = null, w && clearTimeout(w), C && clearTimeout(C), w = C = null, K();
143
+ },
144
+ place: W,
145
+ destroy() {
146
+ C && clearTimeout(C), w && clearTimeout(w), T && clearTimeout(T), E && O?.cancelAnimationFrame(E), Q?.disconnect(), D.removeEventListener("keydown", G), j.removeEventListener("pointerenter", J), j.removeEventListener("pointerleave", Y), j.removeEventListener("focusin", J), j.removeEventListener("focusout", X), M.removeEventListener("click", Z), k.remove(), f.chart?.setLabelHidden(null);
147
+ }
148
+ };
149
+ return K(), $;
150
+ };
151
+ //#endregion
152
+ export { c as CARD_LINGER_MS, f as createQuadrantPointCard, l as withQuadrantCard };
153
+
154
+ //# sourceMappingURL=quadrant-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quadrant-card.js","names":["CARD_PAD_Y","CARD_DOT_GAP","CARD_ROW","CARD_ACTIONS_ROW","CARD_OVERHANG","CARD_LINGER_MS","withQuadrantCard","options","keyOf","point","fraction","v","a","b","createQuadrantPointCard","initial","hovered","held","focused","dragging","dragAt","dismissed","shown","reported","themed","layout","hoverTimer","holdTimer","focusTimer","frame","doc","host","win","card","styleTooltip","dot","body","label","name","content","actions","meta","points","refTo","index","valid","ref","selected","activeIndex","cardIndex","withActions","place","themeTooltip","live","at","x0","x1","config","y0","y1","fx","visualX","plotWidth","plotHeight","left","top","size","hasActions","row","reach","width","height","mirrored","overRight","overLeft","was","cardTop","side","nextLayout","lead","trail","corner","quadrantOf","region","where","quadrantName","quadrantLabels","text","own","color","DEFAULT_QUADRANT_COLORS","onKey","event","api","render","changed","custom","report","hold","onEnter","onLeave","onFocusOut","onClick","resizeObserver","selection","next"],"sources":["../../../../charts/src/engine/quadrant-card.ts"],"sourcesContent":["// The point card of the quadrant matrices, shared by every renderer: one\n// glass card for the hovered, focused, dragged (or, on boards, selected)\n// point. Its dot lies on the point, the name and the quadrant beside it, the\n// actions of the host (edit, delete...) in its first row. The card is DOM\n// placed by hand: hover, focus and drag moves render no framework component;\n// the host only fills the actions box (and, in React, a custom content) when\n// the point of the card changes.\n\nimport {\n DEFAULT_QUADRANT_COLORS,\n quadrantLabels,\n quadrantOf,\n type QuadrantPoint,\n} from \"./presets\";\nimport {\n quadrantName,\n type QuadrantAccessibleConfig,\n} from \"./quadrant-keyboard\";\nimport { styleTooltip, themeTooltip } from \"./tooltip\";\nimport type { ChartInstance, ChartOptions } from \"./types\";\n\n/** Settings of the point card of a quadrant matrix */\nexport interface QuadrantPointCardOptions {\n /** The points and the geometry of the matrix */\n config: QuadrantAccessibleConfig;\n /** Language of the built-in quadrant names */\n locale?: string;\n /** Diameter of the dots (`pointSize`); 12 by default */\n pointSize?: number;\n /** A hovered point shows the card; `false` (no tooltip): focus and drag only */\n hover?: boolean;\n /** The selected point */\n selectedIndex?: number | null;\n /**\n * The selected point keeps the card (boards: its actions stay at hand);\n * otherwise a selection shows only its ring\n */\n showSelected?: boolean;\n /** The card of this point has actions: the host fills `actions` */\n hasActions?: (index: number) => boolean;\n /** The host fills `content` (a custom card) instead of the name and quadrant */\n custom?: boolean;\n /** The engine of the chart: the drawn label of the point gives way to the card */\n chart?: ChartInstance | null;\n /** A click on the name of the card (like a click on the dot) */\n onClick?: (index: number) => void;\n /**\n * The point whose actions (or custom content) the host renders changed;\n * `null`: none (no card, or a drag)\n */\n onChange?: (index: number | null) => void;\n /** Escape closed the card */\n onDismiss?: () => void;\n}\n\n/** Position of a dragged point, in data values */\nexport interface QuadrantCardPosition {\n x: number;\n y: number;\n}\n\n/** The point card of a quadrant matrix */\nexport interface QuadrantPointCard {\n /** Root of the card (`.minerva-chart-quadrant-card`); in the DOM while shown */\n readonly element: HTMLElement;\n /** Box of the actions of the host, in the first row of the card */\n readonly actions: HTMLElement;\n /** Box of a custom content (`custom`), in place of the name and quadrant */\n readonly content: HTMLElement;\n /** The point of the card, `null` while hidden */\n readonly index: number | null;\n /** Applies new settings (new points: the card keeps its point while it is the same) */\n update(options: QuadrantPointCardOptions): void;\n /** The hovered point of the engine (`null`: the card lingers a moment, then goes) */\n hover(index: number | null): void;\n /** The focused point button */\n focus(index: number | null): void;\n /** A point is dragged (`null`: the drag ended); the card follows `move` */\n drag(index: number | null, at?: QuadrantCardPosition): void;\n /** New position of the dragged point (placed once per frame) */\n move(at: QuadrantCardPosition): void;\n /** Hides the card until another point is hovered, focused or selected */\n dismiss(): void;\n /** Places the card again (the plot or the content of the host changed) */\n place(): void;\n destroy(): void;\n}\n\n/** Room between the edge of the point card and its dot, CSS pixels */\nexport const CARD_PAD_X = 8;\nconst CARD_PAD_Y = 5;\n/** Room between the dot of the card and its text */\nconst CARD_DOT_GAP = 7;\n/** Height of the first row of the card: the name, or the name and actions */\nconst CARD_ROW = 18;\nconst CARD_ACTIONS_ROW = 24;\n/** How far the card may reach past the plot edges */\nconst CARD_OVERHANG = 6;\n/**\n * The card stays this long after the pointer leaves its dot: time to reach\n * its actions\n */\nexport const CARD_LINGER_MS = 180;\n\n/**\n * Engine options of a matrix showing the point card: no engine tooltip, no\n * label chip and no drag pill beside it\n */\nexport const withQuadrantCard = (options: ChartOptions): ChartOptions => ({\n ...options,\n tooltip: false,\n interaction:\n typeof options.interaction === \"object\"\n ? { ...options.interaction, dragLabel: false, hoverLabel: false }\n : options.interaction,\n});\n\n/** A point named by its content: new arrays of the same points keep it */\nconst keyOf = (point: QuadrantPoint | undefined) =>\n point ? `${point.x}|${point.y}|${point.label ?? \"\"}` : null;\n\ninterface PointRef {\n index: number;\n key: string | null;\n}\n\nconst fraction = (v: number, a: number, b: number) => (v - a) / (b - a || 1);\n\n/**\n * Mounts the point card of a quadrant matrix in `host`, a box covering the\n * plot area (its `style.width` / `style.height`, else its client size)\n */\nexport const createQuadrantPointCard = (\n host: HTMLElement,\n initial: QuadrantPointCardOptions,\n): QuadrantPointCard => {\n let options = initial;\n let hovered: PointRef | null = null;\n let held: PointRef | null = null;\n let focused: PointRef | null = null;\n let dragging: number | null = null;\n let dragAt: QuadrantCardPosition | null = null;\n let dismissed = false;\n let shown: number | null = null;\n let reported: number | null = null;\n let themed = false;\n let layout = \"\";\n let hoverTimer: ReturnType<typeof setTimeout> | null = null;\n let holdTimer: ReturnType<typeof setTimeout> | null = null;\n let focusTimer: ReturnType<typeof setTimeout> | null = null;\n let frame = 0;\n const doc = host.ownerDocument;\n const win = doc.defaultView;\n\n const card = doc.createElement(\"div\");\n card.className = \"minerva-chart-quadrant-card\";\n styleTooltip(card, {\n zIndex: \"3\",\n boxSizing: \"border-box\",\n maxWidth: \"min(280px, calc(100% + 12px))\",\n paddingTop: `${CARD_PAD_Y}px`,\n paddingBottom: `${CARD_PAD_Y}px`,\n borderRadius: \"12px\",\n fontSize: \"12px\",\n lineHeight: \"18px\",\n });\n const dot = doc.createElement(\"span\");\n dot.setAttribute(\"aria-hidden\", \"true\");\n dot.dataset.cardDot = \"\";\n dot.style.cssText = \"position:absolute;border-radius:50%;pointer-events:none\";\n // the dot lets the pointer through to the chart (hover, drag); the text\n // and the actions hold the card\n const body = doc.createElement(\"div\");\n body.dataset.cardContent = \"\";\n body.style.cssText = \"display:grid;column-gap:6px;align-items:center\";\n // a click on the name acts like a click on the dot\n const label = doc.createElement(\"div\");\n label.setAttribute(\"aria-hidden\", \"true\");\n label.style.cssText = \"grid-area:label;min-width:0;cursor:pointer\";\n const name = doc.createElement(\"strong\");\n name.style.cssText =\n \"display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600\";\n const content = doc.createElement(\"div\");\n label.append(name, content);\n const actions = doc.createElement(\"div\");\n actions.dataset.cardActions = \"\";\n actions.style.cssText = `grid-area:actions;align-self:start;display:flex;align-items:center;height:${CARD_ACTIONS_ROW}px`;\n const meta = doc.createElement(\"span\");\n meta.setAttribute(\"aria-hidden\", \"true\");\n meta.style.cssText =\n \"grid-area:meta;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;\" +\n \"color:var(--text-secondary-color, #6b7280);font-size:11px;line-height:16px\";\n body.append(label, actions, meta);\n card.append(dot, body);\n\n const points = () => options.config.points;\n const refTo = (index: number | null): PointRef | null =>\n index === null ? null : { index, key: keyOf(points()[index]) };\n const valid = (ref: PointRef | null) =>\n ref && ref.key !== null && keyOf(points()[ref.index]) === ref.key\n ? ref.index\n : null;\n const selected = () => {\n const index = options.selectedIndex;\n return options.showSelected &&\n index !== null &&\n index !== undefined &&\n points()[index]\n ? index\n : null;\n };\n const activeIndex = () =>\n dismissed\n ? null\n : (valid(held) ??\n (options.hover !== false ? valid(hovered) : null) ??\n valid(focused) ??\n selected());\n const cardIndex = () => {\n if (dragging !== null) return points()[dragging] ? dragging : null;\n const index = activeIndex();\n const point = index === null ? undefined : points()[index];\n return point && Number.isFinite(point.x) && Number.isFinite(point.y)\n ? index\n : null;\n };\n const withActions = (index: number) =>\n dragging === null && !!options.hasActions?.(index);\n\n const place = () => {\n const index = shown;\n const point = index === null ? undefined : points()[index];\n if (index === null || !point || !card.parentNode) return;\n const { config } = options;\n if (!themed) {\n themed = true;\n // the colors of the theme around it, read again for every new point\n themeTooltip(card, card);\n }\n const live = dragging !== null ? dragAt : null;\n const at = live ?? point;\n const [x0, x1] = config.xDomain ?? [0, 10];\n const [y0, y1] = config.yDomain ?? [0, 10];\n const fx = fraction(at.x, x0, x1);\n const visualX = config.reverseX ? 1 - fx : fx;\n const plotWidth = parseFloat(host.style.width) || host.clientWidth;\n const plotHeight = parseFloat(host.style.height) || host.clientHeight;\n const left = visualX * plotWidth;\n const top = (1 - fraction(at.y, y0, y1)) * plotHeight;\n const size = point.size ?? options.pointSize ?? 12;\n const hasActions = withActions(index);\n const row = hasActions ? CARD_ACTIONS_ROW : CARD_ROW;\n // the dot of the card lies on the point (the border is 1px); the lifted\n // dot of a drag is larger: the card keeps off it\n const reach = 1 + CARD_PAD_X + size / 2 + (live ? 8 : 0);\n const width = card.offsetWidth;\n const height = card.offsetHeight;\n // the text on the side with room (mirrored near the right edge); a side\n // that still fits is kept (no flipping back and forth in a drag)\n let mirrored = visualX > 0.6;\n if (width) {\n const overRight = left - reach + width - plotWidth;\n const overLeft = width - reach - left;\n const was = card.dataset.side;\n mirrored =\n was === \"start\" && overRight <= CARD_OVERHANG\n ? false\n : was === \"end\" && overLeft <= CARD_OVERHANG\n ? true\n : overRight > 0 && overLeft < overRight;\n }\n // the dot on the first row, the card kept in the plot near its edges\n let cardTop = top - (1 + CARD_PAD_Y + row / 2);\n if (height)\n cardTop = Math.max(\n -CARD_OVERHANG,\n Math.min(cardTop, plotHeight + CARD_OVERHANG - height),\n );\n const side = mirrored ? \"end\" : \"start\";\n card.dataset.side = side;\n const nextLayout = `${side}|${hasActions}|${size}`;\n if (layout !== nextLayout) {\n layout = nextLayout;\n const lead = `${CARD_PAD_X + size + CARD_DOT_GAP}px`;\n const trail = hasActions ? \"4px\" : \"12px\";\n card.style.paddingLeft = mirrored ? trail : lead;\n card.style.paddingRight = mirrored ? lead : trail;\n card.style.textAlign = mirrored ? \"right\" : \"left\";\n body.style.minHeight = `${row}px`;\n body.style.gridTemplateAreas = mirrored\n ? '\"actions label\" \". meta\"'\n : '\"label actions\" \"meta .\"';\n body.style.gridTemplateColumns = mirrored\n ? \"auto minmax(0, 1fr)\"\n : \"minmax(0, 1fr) auto\";\n dot.style.width = `${size}px`;\n dot.style.height = `${size}px`;\n }\n card.style.transform = `translate(${left}px, ${cardTop}px) translate(${\n mirrored ? `calc(-100% + ${reach}px)` : `${-reach}px`\n }, 0)`;\n // the quadrant under the point (live in a drag)\n const corner = quadrantOf(config, at.x, at.y);\n const region = config.quadrants?.[corner];\n const where = quadrantName(corner, config, quadrantLabels(options.locale));\n const text = region?.badge ? `${region.badge} · ${where}` : where;\n if (meta.textContent !== text) meta.textContent = text;\n const own = quadrantOf(config, point.x, point.y);\n const color =\n point.color ??\n config.quadrants?.[own]?.color ??\n DEFAULT_QUADRANT_COLORS[own];\n dot.style.display = live ? \"none\" : \"block\";\n dot.style.left = mirrored ? \"auto\" : `${CARD_PAD_X}px`;\n dot.style.right = mirrored ? `${CARD_PAD_X}px` : \"auto\";\n dot.style.top = `${top - cardTop - 1 - size / 2}px`;\n dot.style.background = color;\n dot.style.boxShadow = `0 0 0 2px var(--surface-color, var(--background-color, #fff)), 0 0 0 4px color-mix(in srgb, ${color} 45%, transparent)`;\n };\n\n const onKey = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || dragging !== null || shown === null) return;\n api.dismiss();\n options.onDismiss?.();\n };\n\n const render = () => {\n const index = cardIndex();\n const changed = index !== shown;\n shown = index;\n if (index === null) {\n if (card.parentNode) {\n card.remove();\n doc.removeEventListener(\"keydown\", onKey);\n }\n layout = \"\";\n delete card.dataset.side;\n } else {\n const point = points()[index]!;\n if (changed) {\n // a new point: its colors, its side\n themed = false;\n delete card.dataset.side;\n }\n card.dataset.pointPreview = String(index);\n if (dragging !== null) card.dataset.dragging = \"\";\n else delete card.dataset.dragging;\n const custom = !!options.custom && dragging === null;\n name.textContent = point.label ?? \"\";\n name.style.display = custom ? \"none\" : \"block\";\n content.style.display = custom ? \"block\" : \"none\";\n meta.style.display = custom ? \"none\" : \"block\";\n actions.style.display = withActions(index) ? \"flex\" : \"none\";\n body.style.pointerEvents = dragging !== null ? \"none\" : \"auto\";\n if (!card.parentNode) {\n host.appendChild(card);\n doc.addEventListener(\"keydown\", onKey);\n }\n }\n // the card names the point: its drawn label gives way (keeping its place)\n options.chart?.setLabelHidden(\n index !== null && dragging === null ? { seriesIndex: 0, index } : null,\n );\n place();\n const report = dragging === null ? index : null;\n if (report !== reported) {\n reported = report;\n options.onChange?.(report);\n }\n };\n\n const hold = (index: number | null) => {\n if (holdTimer) clearTimeout(holdTimer);\n holdTimer = null;\n if (index !== null) {\n held = refTo(index);\n return render();\n }\n holdTimer = setTimeout(() => {\n holdTimer = null;\n held = null;\n render();\n }, CARD_LINGER_MS);\n };\n const onEnter = () => {\n if (shown !== null && dragging === null) hold(shown);\n };\n const onLeave = () => hold(null);\n const onFocusOut = (event: FocusEvent) => {\n if (!body.contains(event.relatedTarget as Node | null)) hold(null);\n };\n const onClick = () => {\n if (shown !== null && dragging === null) options.onClick?.(shown);\n };\n body.addEventListener(\"pointerenter\", onEnter);\n body.addEventListener(\"pointerleave\", onLeave);\n body.addEventListener(\"focusin\", onEnter);\n body.addEventListener(\"focusout\", onFocusOut);\n label.addEventListener(\"click\", onClick);\n\n // the size of the card follows its content (actions, custom content)\n const resizeObserver =\n typeof ResizeObserver === \"function\"\n ? new ResizeObserver(() => place())\n : null;\n resizeObserver?.observe(card);\n // and its place follows the plot\n resizeObserver?.observe(host);\n\n const api: QuadrantPointCard = {\n element: card,\n actions,\n content,\n get index() {\n return shown;\n },\n update(next) {\n const selection = options.selectedIndex;\n options = next;\n if (\n next.showSelected &&\n next.selectedIndex !== selection &&\n next.selectedIndex != null\n )\n dismissed = false;\n render();\n },\n hover(index) {\n if (hoverTimer) clearTimeout(hoverTimer);\n hoverTimer = null;\n if (index !== null) {\n hovered = refTo(index);\n dismissed = false;\n return render();\n }\n // off the dot: the card stays a moment (the pointer may be on its way\n // to the actions)\n hoverTimer = setTimeout(() => {\n hoverTimer = null;\n hovered = null;\n render();\n }, CARD_LINGER_MS);\n },\n focus(index) {\n if (focusTimer) clearTimeout(focusTimer);\n focusTimer = null;\n if (index === null) {\n // focus leaving a point button may be on its way into the actions\n // of the card: they hold it first\n if (!focused) return;\n focusTimer = setTimeout(() => {\n focusTimer = null;\n focused = null;\n render();\n }, 0);\n return;\n }\n focused = refTo(index);\n dismissed = false;\n render();\n },\n drag(index, at) {\n dragging = index;\n dragAt = index === null ? null : (at ?? null);\n if (index !== null) {\n dismissed = false;\n held = null;\n }\n render();\n },\n move(at) {\n dragAt = at;\n if (!win?.requestAnimationFrame) return place();\n if (!frame)\n frame = win.requestAnimationFrame(() => {\n frame = 0;\n place();\n });\n },\n dismiss() {\n dismissed = true;\n held = null;\n hovered = null;\n if (holdTimer) clearTimeout(holdTimer);\n if (hoverTimer) clearTimeout(hoverTimer);\n holdTimer = hoverTimer = null;\n render();\n },\n place,\n destroy() {\n if (hoverTimer) clearTimeout(hoverTimer);\n if (holdTimer) clearTimeout(holdTimer);\n if (focusTimer) clearTimeout(focusTimer);\n if (frame) win?.cancelAnimationFrame(frame);\n resizeObserver?.disconnect();\n doc.removeEventListener(\"keydown\", onKey);\n body.removeEventListener(\"pointerenter\", onEnter);\n body.removeEventListener(\"pointerleave\", onLeave);\n body.removeEventListener(\"focusin\", onEnter);\n body.removeEventListener(\"focusout\", onFocusOut);\n label.removeEventListener(\"click\", onClick);\n card.remove();\n options.chart?.setLabelHidden(null);\n },\n };\n render();\n return api;\n};\n"],"mappings":";;;AA0FA,IAAMA,IAAa,GAEbC,KAAe,GAEfC,KAAW,IACXC,IAAmB,IAEnBC,IAAgB,GAKTC,IAAiB,KAMjBC,KAAoB,OAAyC;CACxE,GAAGC;CACH,SAAS;CACT,aACE,OAAOA,EAAQ,eAAgB,WAC3B;EAAE,GAAGA,EAAQ;EAAa,WAAW;EAAO,YAAY;CAAM,IAC9DA,EAAQ;AAChB,IAGMC,KAAS,MACbC,IAAQ,GAAGA,EAAM,EAAE,GAAGA,EAAM,EAAE,GAAGA,EAAM,SAAS,OAAO,MAOnDC,KAAY,GAAW,GAAW,OAAeC,IAAIC,MAAMC,IAAID,KAAK,IAM7DE,KACX,GACA,MACsB;CACtB,IAAIP,IAAUQ,GACVC,IAA2B,MAC3BC,IAAwB,MACxBC,IAA2B,MAC3BC,IAA0B,MAC1BC,IAAsC,MACtCC,IAAY,IACZC,IAAuB,MACvBC,IAA0B,MAC1BC,IAAS,IACTC,IAAS,IACTC,IAAmD,MACnDC,IAAkD,MAClDC,IAAmD,MACnDC,IAAQ,GACNC,IAAMC,EAAK,eACXC,IAAMF,EAAI,aAEVG,IAAOH,EAAI,cAAc,KAAK;CAEpC,AADA,EAAK,YAAY,+BACjBI,EAAaD,GAAM;EACjB,QAAQ;EACR,WAAW;EACX,UAAU;EACV,YAAY,GAAGjC,EAAW;EAC1B,eAAe,GAAGA,EAAW;EAC7B,cAAc;EACd,UAAU;EACV,YAAY;CACd,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AAY,aAAaA,CAAU,GACnCC,KAAW,aAAaA,CAAS,GACjCC,KAAY,aAAaA,CAAU,GACnCC,KAAOG,GAAK,qBAAqBH,CAAK,GAC1C0E,GAAgB,WAAW,GAC3BzE,EAAI,oBAAoB,WAAW6D,CAAK,GACxCvD,EAAK,oBAAoB,gBAAgB+D,CAAO,GAChD/D,EAAK,oBAAoB,gBAAgBgE,CAAO,GAChDhE,EAAK,oBAAoB,WAAW+D,CAAO,GAC3C/D,EAAK,oBAAoB,YAAYiE,CAAU,GAC/ChE,EAAM,oBAAoB,SAASiE,CAAO,GAC1CrE,EAAK,OAAO,GACZ1B,EAAQ,OAAO,eAAe,IAAI;EACpC;CACF;CAEA,OADAuF,EAAO,GACAD;AACT"}
@@ -1,2 +1,2 @@
1
- const e=require("./data.cjs"),t=require("./color.cjs"),n=require("./layout.cjs"),r=require("./overlay.cjs"),i=require("./locale.cjs"),a=require("./format.cjs"),o=require("./axis.cjs"),s=require("./model.cjs");var c={top:12,right:16,bottom:4,left:4},l=(e,t)=>t,u=(e,n,r,i)=>{let a=n.resolve??l,o=e=>r&&e!==void 0?r(e):e,s=e=>i&&e!==void 0?i(e):e;return(e??[]).map(e=>{if(e.type===`rect`){let r=e.color?a(e.color,n.primary):n.primary;return{type:`rect`,x0:s(e.x0),x1:s(e.x1),y0:o(e.y0),y1:o(e.y1),color:r,opacity:e.opacity??.08,label:e.label,labelPosition:e.labelPosition??`top-left`,labelColor:e.labelColor?a(e.labelColor,r):t.mix(r,n.text,.2),...e.badge?{badge:e.badge}:{},...e.detail?{detail:e.detail}:{},...e.description?{description:e.description}:{}}}return e.type===`text`?{type:`text`,x:s(e.x),y:o(e.y),text:e.text,anchor:e.anchor??`center`,color:e.color?a(e.color,n.textMuted):n.textMuted,weight:e.weight??500}:{type:`line`,axis:e.axis,value:e.axis===`y`?o(e.value):s(e.value),color:e.color?a(e.color,n.textMuted):n.textMuted,width:e.width??1,dash:[...e.dash??[4,4]],label:e.label}})},d=e=>{let{model:t,view:r,theme:i,width:a,height:s,measure:l}=e;if(t.horizontal)return p(e);let u=t.y.tickCount??(t.y.type===`category`?Math.max(1,Math.floor((s-40)/(i.fontSize+5))):s>=220?5:Math.max(2,Math.round((s-48)/52))),d=o.axisTicks(t.y,r.y,u),m=0;if(t.y.visible)for(let e of d.labels)m=Math.max(m,l(e));let h=f(t,d,r.y,u),g=0;if(h&&t.y2?.visible)for(let e of h.labels)g=Math.max(g,l(e));let _=48;if(t.x.type===`category`){_=0;let e=Math.max(1,Math.floor(t.x.categories.length/200));for(let n=0;n<t.x.categories.length;n+=e)_=Math.max(_,l(t.x.categories[n]))}let v={...c,...e.padding},y=n.computePlot({width:a,height:s,padding:v,yLabelWidth:t.y.visible?Math.ceil(m):0,y2LabelWidth:Math.ceil(g),y2Title:!!t.y2?.title&&!!t.y2.visible,xAxisVisible:t.x.visible,xTitle:!!t.x.title&&t.x.visible,yTitle:!!t.y.title&&t.y.visible,fontSize:i.fontSize});e.top&&(y.y+=e.top);let b=t.x.type===`category`?Math.max(1,Math.floor(y.width/(_+14))):t.x.tickCount??Math.max(3,Math.floor(y.width/88)),x=o.axisTicks(t.x,r.x,b);return{plot:y,scales:n.createScales(y,r,t.x.reverse,t.y.reverse),xTicks:x,yTicks:d,y2Ticks:h}},f=(e,t,n,r)=>{let i=e.y2,s=e.y2Map;if(!i||!s||!s.scale)return null;if(s.log){let e=(n[0]-s.offset)/s.scale,t=(n[1]-s.offset)/s.scale,a=o.axisTicks(i,[Math.min(e,t),Math.max(e,t)],r);return{...a,values:a.values.map(e=>e*s.scale+s.offset)}}let c=t.values.map(e=>(e-s.offset)/s.scale),l=c.length>1?Math.abs(c[1]-c[0]):1,u=0;for(let e of c)u=Math.max(u,Math.abs(e));let d=i.format??a.tickFormatter(l,u,e.locale);return{values:t.values,labels:c.map(d),formatValue:i.format??e.formatValue}},p=e=>{let{model:t,view:r,theme:i,width:a,height:s,measure:l}=e,u=Math.max(1,Math.floor((s-40)/(i.fontSize+5))),d=t.x.tickCount??(t.x.type===`category`?u:s>=220?5:Math.max(2,Math.round((s-48)/52))),f=o.axisTicks(t.x,r.x,d),p=0;if(t.x.visible){if(t.x.type===`category`){let e=t.x.categories,n=Math.max(1,Math.floor(e.length/200));for(let r=0;r<e.length;r+=n){let n=t.x.format?t.x.format(r):e[r];p=Math.max(p,l(n))}}else for(let e of f.labels)p=Math.max(p,l(e))}let m={...c,...e.padding},h=n.computePlot({width:a,height:s,padding:m,yLabelWidth:t.x.visible?Math.ceil(p):0,xAxisVisible:t.y.visible,xTitle:!!t.y.title&&t.y.visible,yTitle:!!t.x.title&&t.x.visible,fontSize:i.fontSize});e.top&&(h.y+=e.top);let g=t.y.tickCount??(t.y.type===`category`?Math.max(1,Math.floor(h.width/60)):Math.max(t.y.type===`time`?4:3,Math.min(8,Math.floor(h.width/88)))),_=o.axisTicks(t.y,r.y,g);return{plot:h,scales:n.createScales(h,r,t.x.reverse,t.y.reverse,!0),xTicks:f,yTicks:_,y2Ticks:null}},m=(e,t,n)=>{let{plot:r}=e,i=r.x,a=r.x+r.width,o=r.y,s=r.y+r.height,c=[],l=[];t.x!==void 0&&Number.isFinite(t.x)&&(e.horizontal?l:c).push(e.xToPx(t.x)),t.y!==void 0&&Number.isFinite(t.y)&&(e.horizontal?c:l).push(e.yToPx(t.y));for(let e of c)e>i&&e<a&&(n.x<e?a=e:i=e);for(let e of l)e>o&&e<s&&(n.y<e?s=e:o=e);return{x:i,y:o,width:a-i,height:s-o}},h=(e,t,i,a,o,c)=>{let l=[],u=e.percent?e.formatValue:a?.formatValue??e.formatValue;for(let a of e.series){if(a.hidden||!a.showLabels)continue;if(a.type===`bar`&&a.barTop){let c=a.format??(a.yAxis===`right`?e.y2?.format??e.formatValue:u),{x:d,count:f}=a.cols,{y:p,y0:m,labels:h}=a.raw,g=a.barTop,[_,v]=t.x[0]<=t.x[1]?t.x:[t.x[1],t.x[0]];for(let t=0;t<f&&l.length<300;t++){let u=d[t]+a.barOffset;if(!Number.isFinite(p[t])||u<_||u>v)continue;let f=g[t]<(a.barBase?.[t]??0)!==e.y.reverse,y=n.toScreen(i,u,g[t]),b=a.floating&&m&&Number.isFinite(m[t]);if(b&&e.y.type===`time`&&!h?.[t])continue;let x=b?p[t]-(m?.[t]??0):0,S=h?.[t]??(b?`${x>0?`+`:``}${c(x)}`:c(p[t]));if(a.labelsInside){let e=a.barBase?.[t]??0,c=a.barHalfWidth,d=a.pointColors?.[t]??a.color,f=[d[0],d[1],d[2],d[3]*s.barOpacity(a,t)],p=o?r.insideLabelColor(f,o):void 0,m=n.toScreen(i,u,(e+g[t])/2);l.push({x:m.x,y:m.y,r:0,text:S,placement:`inside`,align:i.horizontal?`start`:`center`,bar:n.screenRect(i,i.xToPx(u-c),i.xToPx(u+c),i.yToPx(e),i.yToPx(g[t])),...p?{color:p}:{}});continue}l.push({x:y.x,y:y.y,r:0,text:S,placement:i.horizontal?f?`left`:`right`:f?`below`:`above`})}continue}if(a.type!==`scatter`)continue;let{x:d,y:f,count:p,labels:h,size:g}=a.cols;if(h)for(let e=0;e<p&&l.length<300;e++){let r=h[e];if(!r||c&&c.seriesIndex===a.index&&c.index===e)continue;let o=d[e],s=f[e];if(o<t.x[0]||o>t.x[1]||s<t.y[0]||s>t.y[1])continue;let u=g&&g[e]>0?g[e]:a.pointSize,p=n.toScreen(i,o,s);l.push(a.labelCells?{x:p.x,y:p.y,r:u/2,text:r,bounds:m(i,a.labelCells,p)}:{x:p.x,y:p.y,r:u/2,text:r})}}return l},g=e=>e.type===`bar`||e.type===`boxplot`?e.barOffset:0,_=(e,t,r)=>{let i=n.toScreen(r,e.cols.x[t]+g(e),s.plottedY(e,t));return{px:i.x,py:i.y}},v=(e,t,n,r,i,a,o)=>{let s=e.yToPx(r),c=e.yToPx(i);return Math.abs(a-t)<=n&&o>=Math.min(s,c)-2&&o<=Math.max(s,c)+2},y=(e,t,r,i,a)=>{let o=_(e,t,a),s=n.alongX(a,r,i),c=n.alongY(a,r,i),l=a.xToPx(e.cols.x[t]+g(e)),u=!1;if(e.type===`bar`&&e.barBase&&e.barTop)u=v(a,l,e.barHalfWidth/Math.abs(a.xPerPx),e.barBase[t],e.barTop[t],s,c);else if(e.type===`candlestick`||e.type===`boxplot`){let{high:n,low:r,y:i}=e.cols;u=v(a,l,Math.max(e.barHalfWidth/Math.abs(a.xPerPx),3),n?n[t]:i[t],r?r[t]:i[t],s,c)}return{series:e,index:t,px:o.px,py:o.py,dx:Math.abs(a.xToPx(e.cols.x[t])-s),dist:u?0:Math.hypot(o.px-r,o.py-i),inside:u}},b=(e,t,r,i,a,o)=>{let s=e.cols.outliers?.[t];if(!s)return;let c=a.xToPx(e.cols.x[t]+g(e)),l=n.alongX(a,r,i)-c,u=n.alongY(a,r,i),d=e.outlierSize/2+4+o,f,p=d;return s.forEach((n,r)=>{let i=Math.hypot(l,a.yToPx(n)-u);i<=p&&(p=i,f=e.raw.outliers?.[t]?.[r]??n)}),f},x=(e,t)=>e.cols.size&&e.cols.size[t]>0?e.cols.size[t]:e.pointSize,S=new WeakMap,ee=e=>{let t=e.cols.size;if(!t)return e.pointSize;let n=S.get(t);if(n===void 0){n=e.pointSize;for(let e=0;e<t.length;e++)t[e]>n&&(n=t[e]);S.set(t,n)}return n},C=(e,t,r,i,a)=>{let o=Math.max(ee(e)/2+6,10)+a,c=n.toData(i,t,r),l=o*Math.abs(i.xPerPx),u=o*Math.abs(i.yPerPx),d=-1,f=1/0,{x:p,y:m}=e.cols;return s.gridOf(e).query(c.x-l,c.x+l,c.y-u,c.y+u,o=>{let s=n.toScreen(i,p[o],m[o]),c=Math.hypot(s.x-t,s.y-r);c<=Math.max(x(e,o)/2+4,8)+a&&c<=f&&(f=c,d=o)}),d},te=(e,t,n)=>{let{x:r,y:i}=e.cellHalf,{x:a,y:o}=e.cols,c=-1;return s.gridOf(e).query(t-r,t+r,n-i,n+i,s=>{e.cellColors?.[s]&&Math.abs(a[s]-t)<=r&&Math.abs(o[s]-n)<=i&&(c=s)}),c},w=(t,n)=>{let{x:r,y:i,count:a,sorted:o}=t.cols;if(o)return e.nearestIndex(r,i,a,n);let s=-1,c=1/0;for(let e=0;e<a;e++){if(!Number.isFinite(i[e]))continue;let t=Math.abs(r[e]-n);t<c&&(c=t,s=e)}return s},T=(e,n)=>{let r=e.pointColors?.[n],{open:i,high:a,low:o,value:s,y0:c,q1:l,q3:u,outliers:d,labels:f}=e.raw,p=f?.[n],m=r?t.toCss(r):e.colorCss,h={};if(e.type===`candlestick`){let r=i?i[n]:NaN;Number.isFinite(r)&&(h.open=r),a&&Number.isFinite(a[n])&&(h.high=a[n]),o&&Number.isFinite(o[n])&&(h.low=o[n]),m=t.toCss(e.raw.y[n]<r?e.downColor:e.upColor)}else if(e.type===`heatmap`){let r=s?s[n]:e.raw.y[n];Number.isFinite(r)&&(h.value=r);let i=e.cellColors?.[n];i&&(m=t.toCss(t.unpackColor(i)))}else if(e.type===`boxplot`){a&&Number.isFinite(a[n])&&(h.high=a[n]),o&&Number.isFinite(o[n])&&(h.low=o[n]),l&&Number.isFinite(l[n])&&(h.q1=l[n]),u&&Number.isFinite(u[n])&&(h.q3=u[n]);let e=d?.[n];e&&(h.outliers=e.length)}else c&&Number.isFinite(c[n])&&(h.y0=c[n]),e.type===`scatter`&&s&&Number.isFinite(s[n])&&(h.value=s[n]);return{seriesIndex:e.index,seriesId:e.id,seriesName:e.name,index:n,x:e.raw.x[n],y:e.raw.y[n],color:m,...p===void 0?{}:{label:p},...h}},E=(e,t)=>{if(!e.length)return null;e.sort((e,t)=>e.series.index-t.series.index);let n=e.map(e=>{let t=T(e.series,e.index);return e.outlier!==void 0&&(t.outlier=e.outlier),t}),r=n[0].x;return{items:n,x:r,xLabel:t?.formatValue(r)??String(r)}},D=(e,t,r,i,a,o=0)=>{let{plot:s}=t,c=6+o;if(i<s.x-c||i>s.x+s.width+c||a<s.y-c||a>s.y+s.height+c)return null;let l=n.toData(t,i,a),u=[],d=[];for(let n of e.series)if(!n.hidden&&n.tooltip&&n.cols.count!==0){if(n.type===`scatter`){let e=C(n,i,a,t,o);e>=0&&u.push(y(n,e,i,a,t))}else if(n.type===`heatmap`){let e=te(n,l.x,l.y);if(e>=0){let r=y(n,e,i,a,t);r.inside=!0,r.dist=0,u.push(r)}}else{let e=w(n,l.x);if(e<0)continue;let r=y(n,e,i,a,t);n.type===`boxplot`&&(r.outlier=b(n,e,i,a,t,o),r.outlier!==void 0&&(r.inside=!0,r.dist=0)),d.push(r)}}let f=d.filter(e=>(e.series.type===`line`||e.series.type===`area`)&&e.dist<=8+o);if((e.tooltipMode===`item`||e.tooltipMode===`nearest`)&&f.length)return E([f.reduce((e,t)=>t.dist<e.dist?t:e)],r);if(e.tooltipMode===`item`){let e=[...u,...d].filter(e=>e.inside||e.series.type===`scatter`||(e.series.type===`line`||e.series.type===`area`)&&e.dist<=8+o);return e.length?E([e.reduce((e,t)=>t.dist<e.dist||t.dist===e.dist&&t.series.index>e.series.index?t:e)],r):null}if(e.tooltipMode===`nearest`){let e=[...u,...d].filter(e=>e.inside||e.series.type===`scatter`||e.dist<=32+o);return e.length?E([e.reduce((e,t)=>t.dist<=e.dist?t:e)],r):null}if(!d.length)return u.length?E([u.reduce((e,t)=>t.dist<=e.dist?t:e)],r):null;let p=Math.min(...d.map(e=>e.dx)),m=e.x.type===`category`?.5/Math.abs(t.xPerPx):0,h=d.filter(e=>e.dx<=p+Math.max(1,m)),g=h.reduce((e,t)=>t.dx<e.dx?t:e),_=E([g,...h.filter(e=>e!==g),...u],r);return _&&(_.x=T(g.series,g.index).x,_.xLabel=r?.formatValue(_.x)??String(_.x)),_},O=(e,t)=>e===t||!!e&&!!t&&e.items.length===t.items.length&&e.items.every((e,n)=>e.index===t.items[n].index&&e.seriesIndex===t.items[n].seriesIndex),k={style:`percent`,minimumFractionDigits:2,maximumFractionDigits:2},A=(e,t)=>e.raw.details?.[t]?.map(e=>({color:null,name:e.name,value:e.value}))??[],j=(e,t,n,r=null)=>{let o=n?.formatValue??String,s=t=>t.format??(t.yAxis===`right`?r?.formatValue??e.y2?.format??e.formatValue:o),c=e.labels,l=t.items[0],u=l?e.series[l.seriesIndex]:null;if(t.items.length===1&&l&&u?.type===`bar`&&l.y0!==void 0&&e.y.type===`time`){let n=s(u);return{title:l.label??t.xLabel,titleColor:l.color,subtitle:l.label===void 0?u.name:`${t.xLabel} · ${u.name}`,rows:[{color:null,name:c.start,value:n(l.y0)},{color:null,name:c.end,value:n(l.y)},{color:null,name:c.duration,value:a.formatDuration(l.y-l.y0,e.locale)},...A(u,l.index)]}}if(t.items.length===1&&u?.type===`heatmap`){let n=e.y.type===`category`?e.y.categories[Math.round(l.y)]??o(l.y):o(l.y);return{title:`${t.xLabel} · ${n}`,titleColor:null,rows:[{color:l.color,name:l.label??u.name,value:l.value===void 0?`–`:(u.format??e.formatValue)(l.value)},...A(u,l.index)]}}if(t.items.every(t=>e.series[t.seriesIndex].type===`scatter`)&&t.items.length===1){let n=t.items[0],i=e.series[n.seriesIndex],a=n.value===void 0?[]:[{color:null,name:i.valueName??c.value,value:(i.format??e.formatValue)(n.value)}];if(e.x.type===`category`)return{title:n.label??t.xLabel,titleColor:null,rows:[{color:n.color,name:n.seriesName,value:s(i)(n.y)},...a,...A(i,n.index)]};let l=i.yAxis===`right`?r?.formatValue??e.y2?.format??e.formatValue:o,u=[{color:null,name:e.x.title??c.x,value:t.xLabel},{color:null,name:(i.yAxis===`right`?e.y2?.title:e.y.title)??c.y,value:(n.value===void 0?s(i):l)(n.y)},...a,...A(i,n.index)];return{title:n.label??n.seriesName,titleColor:n.color,...n.label!==void 0&&e.series.length>1?{subtitle:n.seriesName}:{},rows:u}}let d=[],f=[],p=t.items.length===1&&u?.type===`bar`&&e.x.type!==`category`&&l?.label!==void 0?l.label:null;for(let n of t.items){let t=e.series[n.seriesIndex],r=s(t);if(f.push(d.length),t.type===`candlestick`){let a=n.open!==void 0&&n.open!==0?(n.y-n.open)/Math.abs(n.open)*100:NaN;d.push({color:n.color,name:t.name,value:Number.isFinite(a)?`${a>=0?`+`:``}${i.numberFormat(e.locale,k).format(a/100)}`:``});let o=[[c.open,n.open],[c.high,n.high],[c.low,n.low],[c.close,n.y]];for(let[e,t]of o)t!==void 0&&Number.isFinite(t)&&d.push({color:null,name:e,value:r(t)});continue}if(t.type===`boxplot`){if(n.outlier!==void 0){d.push({color:n.color,name:n.label?`${n.seriesName} · ${n.label}`:n.seriesName,value:``},{color:null,name:c.outlier,value:r(n.outlier)});continue}d.push({color:n.color,name:n.label?`${n.seriesName} · ${n.label}`:n.seriesName,value:``});let e=[[c.max,n.high],[c.q3,n.q3],[c.median,n.y],[c.q1,n.q1],[c.min,n.low]];for(let[t,n]of e)n!==void 0&&Number.isFinite(n)&&d.push({color:null,name:t,value:r(n)});n.outliers&&d.push({color:null,name:c.outliers,value:String(n.outliers)});continue}let a=r(n.y);if(n.y0!==void 0){let i=n.y-n.y0;a=t.type===`bar`&&e.y.type!==`time`?`${i>0?`+`:``}${r(i)}`:`${r(n.y0)} – ${r(n.y)}`}d.push({color:n.color,name:n.label&&p===null?`${n.seriesName} · ${n.label}`:n.seriesName,value:a}),d.push(...A(t,n.index))}if(e.percent){let n=new Map;for(let r of t.items){let t=M(e,r.seriesIndex);t!==null&&Number.isFinite(r.y)&&n.set(t,(n.get(t)??0)+Math.abs(r.y))}t.items.forEach((t,r)=>{let i=M(e,t.seriesIndex),o=i===null?void 0:n.get(i),s=d[f[r]];o&&s&&Number.isFinite(t.y)&&(s.value=`${(e.series[t.seriesIndex].format??e.formatValue)(t.y)} · ${a.formatPercent(Math.abs(t.y)/o*100,e.locale,!0)}`)})}return{title:p??t.xLabel,titleColor:null,rows:d}},M=(e,t)=>e.series[t].hidden?null:e.stacks[t],ne=(e,r,i)=>{let a=[],{plot:o}=r,s=1/0,c=-1/0;for(let l of i.items){let i=e.series[l.seriesIndex],u=i.cols.x[l.index]??l.x;if(i.type===`boxplot`&&l.outlier!==void 0){let e=n.toScreen(r,u+g(i),V(i,l));a.push({kind:`dot`,x:e.x,y:e.y,size:i.outlierSize+3,color:l.color,halo:t.toCss(i.pointColors?.[l.index]??i.color,.2)});continue}if(i.type===`bar`||i.type===`candlestick`||i.type===`boxplot`){let t=r.xToPx(u+g(i)),n=Math.max(i.barHalfWidth/Math.abs(r.xPerPx),1);s=Math.min(s,t-n),c=Math.max(c,t+n),i.type===`bar`&&a.push(...z(e,r,i,l.index));continue}if(i.type===`heatmap`){let e=r.xToPx(u),s=r.yToPx(l.y),c=Math.abs(i.cellHalf.x/r.xPerPx),d=Math.abs(i.cellHalf.y/r.yPerPx),f=n.screenRect(r,e-c,e+c,s-d,s+d),p=n.heatCellStyle(f.width,f.height,i.radius),m=Math.max(o.y,f.y),h=Math.min(o.y+o.height,f.y+f.height),g=Math.max(o.x,f.x),_=Math.min(o.x+o.width,f.x+f.width);h>m&&a.push({kind:`guide`,x:o.x,y:m,width:o.width,height:h-m}),_>g&&a.push({kind:`guide`,x:g,y:o.y,width:_-g,height:o.height});let v=i.cellColors?.[l.index],y=v?t.unpackColor(v):i.color;a.push({kind:`cell`,x:f.x+p.inset,y:f.y+p.inset,width:Math.max(1,f.width-p.inset*2),height:Math.max(1,f.height-p.inset*2),seriesIndex:i.index,index:l.index,color:l.color,ring:N(y),radius:p.radius});continue}let{px:d,py:f}=_(i,l.index,r);if(d<o.x-1||d>o.x+o.width+1||f<o.y-1||f>o.y+o.height+1)continue;let p=i.type===`scatter`?x(i,l.index)+4:Math.max(9,i.lineWidth*2+5),m=i.pointColors?.[l.index]??i.color;a.push({kind:`dot`,x:d,y:f,size:p,color:l.color,halo:t.toCss(m,.2)})}if(c>s){let e=Math.max(4,(c-s)*.14),t=r.horizontal?o.y:o.x,n=t+(r.horizontal?o.height:o.width),i=Math.max(t,s-e),l=Math.min(n,c+e);l>i&&a.unshift({kind:`band`,...r.horizontal?{x:o.x,y:i,width:o.width,height:l-i}:{x:i,y:o.y,width:l-i,height:o.height}})}return a},N=e=>t.luminance(e)>.45?`rgba(15, 23, 42, 0.78)`:`rgba(255, 255, 255, 0.9)`,P=.6,F=(e,t)=>!t.floating&&e.series.some(e=>e!==t&&!e.hidden&&e.type===`bar`&&!e.floating&&e.barOffset===t.barOffset)?0:t.radius,I=(e,t)=>{let n=1/0;for(let r of e.series){if(r.hidden||r.type!==`bar`&&r.type!==`boxplot`)continue;let e=Math.abs(r.barOffset-t.barOffset);e>0&&e<n&&(n=e)}return Number.isFinite(n)?Math.max(0,n/2-t.barHalfWidth):null},L=(e,t,n,r)=>{let i=Math.min(5,Math.max(1.5,r*.08)),a=I(e,n);return a!==null&&(i=Math.min(i,a/Math.abs(t.xPerPx)*.5)),i>=.75?Math.round(i*4)/4:0},R=(e,t,r,i)=>{let a=r.barBase?.[i],o=r.barTop?.[i],s=r.cols.x[i];if(a===void 0||o===void 0||Number.isNaN(a)||Number.isNaN(o)||!Number.isFinite(s))return null;let{plot:c}=t,l=t.xToPx(s+r.barOffset),u=Math.max(r.barHalfWidth/Math.abs(t.xPerPx),.5),d=t.horizontal?c.x:c.y,f=d+(t.horizontal?c.width:c.height),p=e=>Math.min(f+16,Math.max(d-16,Number.isNaN(e)?d:e)),m=p(t.yToPx(a)),h=p(t.yToPx(o));if(Math.abs(m-h)<.5)return null;let g=n.screenRect(t,l-u,l+u,m,h);return g.x>c.x+c.width||g.x+g.width<c.x||g.y>c.y+c.height||g.y+g.height<c.y?null:{...g,radius:Math.min(F(e,r),g.width/2,g.height/2),base:t.horizontal?m<h?`left`:`right`:m>h?`bottom`:`top`}},z=(e,n,r,i)=>{let a=R(e,n,r,i);if(!a)return[];let o=L(e,n,r,a.base===`top`||a.base===`bottom`?a.width:a.height),c=r.pointColors?.[i]??r.color,l=c[3]*s.barOpacity(r,i),u=l<P,d=[{kind:`bar`,...a,seriesIndex:r.index,index:i,color:t.toCss(c,s.barOpacity(r,i)),backdrop:l<.98,ring:u?t.toCss([c[0],c[1],c[2],1]):N(c),grow:o}],f=Math.min(r.barBase?.[i]??NaN,r.barTop?.[i]??NaN),p=Math.max(r.barBase?.[i]??NaN,r.barTop?.[i]??NaN);if(!r.floating||!(p>=f))return d;let m=(p-f)*1e-9;for(let a of e.series)if(a!==r&&!a.hidden&&!a.tooltip&&a.type===`bar`&&a.floating&&a.barOffset===r.barOffset&&a.barBase&&a.barTop)for(let c=0;c<a.cols.count;c++){if(a.cols.x[c]!==r.cols.x[i])continue;let l=Math.min(a.barBase[c],a.barTop[c]),u=Math.max(a.barBase[c],a.barTop[c]);if(!(l>=f-m&&u<=p+m))continue;let h=R(e,n,a,c);if(!h)continue;let g=a.pointColors?.[c]??a.color;d.push({kind:`bar`,...h,seriesIndex:a.index,index:c,color:t.toCss(g,s.barOpacity(a,c)),backdrop:!1,ring:null,grow:o})}return d},B=e=>e.base===`top`||e.base===`bottom`?{x:e.x-e.grow,y:e.y,width:e.width+e.grow*2,height:e.height}:{x:e.x,y:e.y-e.grow,width:e.width,height:e.height+e.grow*2},V=(e,t)=>{let n=e.raw.outliers?.[t.index],r=n?n.indexOf(t.outlier??NaN):-1;return(r>=0?e.cols.outliers?.[t.index]?.[r]:void 0)??t.outlier??0},H=(e,r)=>{let i=[];for(let a of e.series){let e=a.connector;if(!e||a.hidden||a.type!==`bar`||!a.barTop)continue;let{x:o,count:s}=a.cols,c=a.barTop,l=a.barHalfWidth,[u,d]=r.view.x[0]<=r.view.x[1]?r.view.x:[r.view.x[1],r.view.x[0]],f=t.toCss(e.color,.75),p=-1;for(let t=0;t<s&&i.length<1200;t++)if(Number.isFinite(c[t])&&Number.isFinite(o[t])){if(p>=0&&o[t]+l>=u&&o[p]-l<=d){let s=n.toScreen(r,o[p]+a.barOffset+l,c[p]),u=n.toScreen(r,o[t]+a.barOffset-l,c[p]);i.push({x0:s.x,y0:s.y,x1:u.x,y1:u.y,color:f,width:e.width,dash:e.dash})}p=t}}return i},U=(e,n)=>{let r=n.resolve??l,i=t.toCss(n.textMuted,.85);return(e??[]).map(e=>({from:e.from,to:e.to,color:e.color?t.toCss(r(e.color,n.textMuted)):i}))},W={length:6,half:3.5},G=(e,t,n,r)=>{let i={boxes:[],byId:new Map,byRow:new Map,ids:new Set},a=e.x.type===`category`?e.x.categories:null;for(let o of e.series){if(o.type!==`bar`&&o.type!==`scatter`)continue;let e=o.raw.ids;if(e)for(let t of e)t!==void 0&&i.ids.add(t);if(o.hidden||!o.tooltip)continue;let{x:s,y:c,count:l}=o.cols,u=o.type===`bar`&&o.barBase&&o.barTop,d=g(o);for(let f=0;f<l;f++){let l=u?o.barBase[f]:c[f],p=u?o.barTop[f]:c[f];if(!Number.isFinite(s[f])||!Number.isFinite(l)||!Number.isFinite(p))continue;let m=u?o.barHalfWidth/Math.abs(t.xPerPx):x(o,f)/2,h=n(Math.min(l,p)),g=n(Math.max(l,p)),_=u?0:m,v={c:r(s[f]+d),half:m,start:h,end:g,lo:Math.min(h,g)-_,hi:Math.max(h,g)+_,dot:!u};i.boxes.push(v);let y=e?.[f];y!==void 0&&!i.byId.has(y)&&i.byId.set(y,v);let b=a?a[Math.round(s[f])]:String(o.raw.x[f]);b!==void 0&&!i.byRow.has(b)&&i.byRow.set(b,v)}}return i},K=8,q=4,J=e=>{let t=e.map(e=>[e.lo-q,e.hi+q]).sort((e,t)=>e[0]-t[0]),n=[];for(let e of t){let t=n[n.length-1];t&&e[0]<=t[1]?t[1]=Math.max(t[1],e[1]):n.push(e)}return n},Y=(e,t)=>e.some(([e,n])=>t>e+1e-6&&t<n-1e-6),X=(e,t,n,r)=>{let i=[t];for(let[t,n]of e)i.push(t,n);let a=null;for(let o of i){let i=r*(o-t);i<0||r*(n-o)<0||Y(e,o)||(a===null||i<r*(a-t))&&(a=o)}return a},re=(e,t)=>{let n=e.find(([e,n])=>t>e+1e-6&&t<n-1e-6);if(!n)return t;let[r,i]=n;return t-r<=i-t?r:i},Z=e=>{let t=[],n=(e,t)=>Math.abs(e-t)<1e-6;for(let r of e){let e=t[t.length-1];if(e&&n(e[0],r[0])&&n(e[1],r[1]))continue;let i=t[t.length-2];i&&e&&(n(i[0],e[0])&&n(e[0],r[0])||n(i[1],e[1])&&n(e[1],r[1]))&&t.pop(),t.push(r)}return t},ie=(e,t,n,r,i,a)=>{let o=e.c,s=t.c,c=n+i*K,l=i*(r-c)>=0,u=Math.min(o,s),d=Math.max(o,s),f=d-u<.5?[]:a.filter(n=>n!==e&&n!==t&&n.c+n.half>u&&n.c-n.half<d);if(l){let e=X(J(f),c,r,i);if(e!==null)return Z([[n,o],[e,o],[e,s],[r,s]])}let p=Math.sign(s-o)||1,m=new Map;for(let e of f){if(Math.abs(e.c-o)<.5||Math.abs(e.c-s)<.5)continue;let t=Math.round(e.c*2),n=m.get(t);n?(n.half=Math.max(n.half,e.half),n.of.push(e)):m.set(t,{c:e.c,half:e.half,of:[e]})}let h=[{c:o,half:e.half,lanes:[]},...[...m.values()].sort((e,t)=>p*(e.c-t.c)).map(e=>({c:e.c,half:e.half,lanes:J(e.of)})),{c:s,half:t.half,lanes:[]}],g=r-i*K,_=[[n,o],[c,o]],v=c;for(let e=0;e+1<h.length;e++){let t=h[e],n=h[e+1],a=Math.abs(n.c-t.c)<.5?t.c+p*(Math.max(t.half,n.half)+q):(t.c+p*t.half+n.c-p*n.half)/2,o=e+2===h.length?l&&i*(r-v)>=0?v:g:re(n.lanes,l?v:g);o!==v&&(_.push([v,a],[o,a]),v=o)}return _.push([v,s],[r,s]),Z(_)},ae=(e,t,r)=>{if(!r.length)return[];let i=t.horizontal,a=(e,t)=>i?{x:e,y:t}:{x:t,y:e},o=e=>{let r=n.toScreen(t,0,e);return i?r.x:r.y},s=e=>{let r=n.toScreen(t,e,0);return i?r.y:r.x},c=Math.sign(o(t.view.y[1])-o(t.view.y[0]))||1,l=G(e,t,o,s),u=e=>l.byId.get(e)??(l.ids.has(e)?void 0:l.byRow.get(e)),{length:d,half:f}=W,p=[];for(let e of r){let t=u(e.from),n=u(e.to);if(!t||!n||t===n)continue;let r=t.end+(t.dot?c*t.half:0),i=n.start-c*(n.dot?n.half+1:1),o=i-c*d,s=ie(t,n,r,o,c,l.boxes);p.push({points:s.map(([e,t])=>a(e,t)),head:[a(i,n.c),a(o,n.c-f),a(o,n.c+f)],color:e.color,width:1.25})}return p},oe=12,Q=e=>{if(!e.series.length||e.series.some(e=>e.type!==`heatmap`))return null;let n=e.series.find(e=>!e.hidden&&e.colorLut),r=n?.colorLut;if(!n||!r)return null;let i=[];for(let e=0;e<oe;e++){let n=r[Math.round(e/11*(r.length-1))];i.push(t.toCss(t.unpackColor(n??0)))}let a=n.format??e.formatValue,[o,s]=n.valueRange,c=[{at:0,text:a(o)},{at:1,text:a(s)}],l=n.colorMidpoint;return l!==null&&l>o&&l<s&&c.splice(1,0,{at:.5,text:a(l)}),{seriesIndex:n.index,stops:i,labels:c}},se=(e,t,n)=>e===void 0?n>1||Q(t)!==null:!!e,ce=e=>e===`scatter`?`dot`:e===`line`?`line`:`square`,$=(e,t,n)=>n??(e.tooltipMode===`axis`&&t.items.some(t=>{let n=e.series[t.seriesIndex].type;return n===`line`||n===`area`})&&!t.items.some(t=>{let n=e.series[t.seriesIndex].type;return n===`bar`||n===`candlestick`||n===`boxplot`})),le=(e,t,n,r)=>{if(!$(e,n,r))return null;let i=n.items[0],a=t.xToPx(e.series[i.seriesIndex]?.cols.x[i.index]??s.toPlotX(e,i.x)),o=t.horizontal?t.plot.y:t.plot.x,c=o+(t.horizontal?t.plot.height:t.plot.width);return a>=o&&a<=c?a:null};exports.ARROW_HEAD=W,exports.DEFAULT_PADDING=c,exports.collectPointLabels=h,exports.colorLegend=Q,exports.connectorSegments=H,exports.contrastRing=N,exports.crosshairAt=le,exports.dependencyArrows=ae,exports.dotSize=x,exports.fallbackResolve=l,exports.hitTest=D,exports.hoverItemOf=T,exports.hoverMarks=ne,exports.labelCell=m,exports.layoutChart=d,exports.legendShape=ce,exports.legendShown=se,exports.liftedBarRect=B,exports.pointOf=_,exports.resolveAnnotations=u,exports.resolveDependencies=U,exports.sameHover=O,exports.showsCrosshair=$,exports.tooltipContent=j;
1
+ const e=require("./data.cjs"),t=require("./color.cjs"),n=require("./layout.cjs"),r=require("./overlay.cjs"),i=require("./locale.cjs"),a=require("./format.cjs"),o=require("./axis.cjs"),s=require("./model.cjs");var c={top:12,right:16,bottom:4,left:4},l=(e,t)=>t,u=(e,n,r,i)=>{let a=n.resolve??l,o=e=>r&&e!==void 0?r(e):e,s=e=>i&&e!==void 0?i(e):e;return(e??[]).map(e=>{if(e.type===`rect`){let r=e.color?a(e.color,n.primary):n.primary;return{type:`rect`,x0:s(e.x0),x1:s(e.x1),y0:o(e.y0),y1:o(e.y1),color:r,opacity:e.opacity??.08,label:e.label,labelPosition:e.labelPosition??`top-left`,labelColor:e.labelColor?a(e.labelColor,r):t.mix(r,n.text,.2),...e.badge?{badge:e.badge}:{},...e.detail?{detail:e.detail}:{},...e.description?{description:e.description}:{}}}return e.type===`text`?{type:`text`,x:s(e.x),y:o(e.y),text:e.text,anchor:e.anchor??`center`,color:e.color?a(e.color,n.textMuted):n.textMuted,weight:e.weight??500}:{type:`line`,axis:e.axis,value:e.axis===`y`?o(e.value):s(e.value),color:e.color?a(e.color,n.textMuted):n.textMuted,width:e.width??1,dash:[...e.dash??[4,4]],label:e.label}})},d=e=>{let{model:t,view:r,theme:i,width:a,height:s,measure:l}=e;if(t.horizontal)return p(e);let u=t.y.tickCount??(t.y.type===`category`?Math.max(1,Math.floor((s-40)/(i.fontSize+5))):s>=220?5:Math.max(2,Math.round((s-48)/52))),d=o.axisTicks(t.y,r.y,u),m=0;if(t.y.visible)for(let e of d.labels)m=Math.max(m,l(e));let h=f(t,d,r.y,u),g=0;if(h&&t.y2?.visible)for(let e of h.labels)g=Math.max(g,l(e));let _=48;if(t.x.type===`category`){_=0;let e=Math.max(1,Math.floor(t.x.categories.length/200));for(let n=0;n<t.x.categories.length;n+=e)_=Math.max(_,l(t.x.categories[n]))}let v={...c,...e.padding},y=n.computePlot({width:a,height:s,padding:v,yLabelWidth:t.y.visible?Math.ceil(m):0,y2LabelWidth:Math.ceil(g),y2Title:!!t.y2?.title&&!!t.y2.visible,xAxisVisible:t.x.visible,xTitle:!!t.x.title&&t.x.visible,yTitle:!!t.y.title&&t.y.visible,fontSize:i.fontSize});e.top&&(y.y+=e.top);let b=t.x.type===`category`?Math.max(1,Math.floor(y.width/(_+14))):t.x.tickCount??Math.max(3,Math.floor(y.width/88)),x=o.axisTicks(t.x,r.x,b);return{plot:y,scales:n.createScales(y,r,t.x.reverse,t.y.reverse),xTicks:x,yTicks:d,y2Ticks:h}},f=(e,t,n,r)=>{let i=e.y2,s=e.y2Map;if(!i||!s||!s.scale)return null;if(s.log){let e=(n[0]-s.offset)/s.scale,t=(n[1]-s.offset)/s.scale,a=o.axisTicks(i,[Math.min(e,t),Math.max(e,t)],r);return{...a,values:a.values.map(e=>e*s.scale+s.offset)}}let c=t.values.map(e=>(e-s.offset)/s.scale),l=c.length>1?Math.abs(c[1]-c[0]):1,u=0;for(let e of c)u=Math.max(u,Math.abs(e));let d=i.format??a.tickFormatter(l,u,e.locale);return{values:t.values,labels:c.map(d),formatValue:i.format??e.formatValue}},p=e=>{let{model:t,view:r,theme:i,width:a,height:s,measure:l}=e,u=Math.max(1,Math.floor((s-40)/(i.fontSize+5))),d=t.x.tickCount??(t.x.type===`category`?u:s>=220?5:Math.max(2,Math.round((s-48)/52))),f=o.axisTicks(t.x,r.x,d),p=0;if(t.x.visible){if(t.x.type===`category`){let e=t.x.categories,n=Math.max(1,Math.floor(e.length/200));for(let r=0;r<e.length;r+=n){let n=t.x.format?t.x.format(r):e[r];p=Math.max(p,l(n))}}else for(let e of f.labels)p=Math.max(p,l(e))}let m={...c,...e.padding},h=n.computePlot({width:a,height:s,padding:m,yLabelWidth:t.x.visible?Math.ceil(p):0,xAxisVisible:t.y.visible,xTitle:!!t.y.title&&t.y.visible,yTitle:!!t.x.title&&t.x.visible,fontSize:i.fontSize});e.top&&(h.y+=e.top);let g=t.y.tickCount??(t.y.type===`category`?Math.max(1,Math.floor(h.width/60)):Math.max(t.y.type===`time`?4:3,Math.min(8,Math.floor(h.width/88)))),_=o.axisTicks(t.y,r.y,g);return{plot:h,scales:n.createScales(h,r,t.x.reverse,t.y.reverse,!0),xTicks:f,yTicks:_,y2Ticks:null}},m=(e,t,n)=>{let{plot:r}=e,i=r.x,a=r.x+r.width,o=r.y,s=r.y+r.height,c=[],l=[];t.x!==void 0&&Number.isFinite(t.x)&&(e.horizontal?l:c).push(e.xToPx(t.x)),t.y!==void 0&&Number.isFinite(t.y)&&(e.horizontal?c:l).push(e.yToPx(t.y));for(let e of c)e>i&&e<a&&(n.x<e?a=e:i=e);for(let e of l)e>o&&e<s&&(n.y<e?s=e:o=e);return{x:i,y:o,width:a-i,height:s-o}},h=(e,t,i,a,o,c,l)=>{let u=[],d=e.percent?e.formatValue:a?.formatValue??e.formatValue;for(let a of e.series){if(a.hidden||!a.showLabels)continue;if(a.type===`bar`&&a.barTop){let c=a.format??(a.yAxis===`right`?e.y2?.format??e.formatValue:d),{x:l,count:f}=a.cols,{y:p,y0:m,labels:h}=a.raw,g=a.barTop,[_,v]=t.x[0]<=t.x[1]?t.x:[t.x[1],t.x[0]];for(let t=0;t<f&&u.length<300;t++){let d=l[t]+a.barOffset;if(!Number.isFinite(p[t])||d<_||d>v)continue;let f=g[t]<(a.barBase?.[t]??0)!==e.y.reverse,y=n.toScreen(i,d,g[t]),b=a.floating&&m&&Number.isFinite(m[t]);if(b&&e.y.type===`time`&&!h?.[t])continue;let x=b?p[t]-(m?.[t]??0):0,S=h?.[t]??(b?`${x>0?`+`:``}${c(x)}`:c(p[t]));if(a.labelsInside){let e=a.barBase?.[t]??0,c=a.barHalfWidth,l=a.pointColors?.[t]??a.color,f=[l[0],l[1],l[2],l[3]*s.barOpacity(a,t)],p=o?r.insideLabelColor(f,o):void 0,m=n.toScreen(i,d,(e+g[t])/2);u.push({x:m.x,y:m.y,r:0,text:S,placement:`inside`,align:i.horizontal?`start`:`center`,bar:n.screenRect(i,i.xToPx(d-c),i.xToPx(d+c),i.yToPx(e),i.yToPx(g[t])),...p?{color:p}:{}});continue}u.push({x:y.x,y:y.y,r:0,text:S,placement:i.horizontal?f?`left`:`right`:f?`below`:`above`})}continue}if(a.type!==`scatter`)continue;let{x:f,y:p,count:h,labels:g,size:_}=a.cols;if(g)for(let e=0;e<h&&u.length<300;e++){let r=g[e];if(!r||c&&c.seriesIndex===a.index&&c.index===e)continue;let o=f[e],s=p[e];if(o<t.x[0]||o>t.x[1]||s<t.y[0]||s>t.y[1])continue;let d=_&&_[e]>0?_[e]:a.pointSize,h=n.toScreen(i,o,s),v=a.labelCells?{x:h.x,y:h.y,r:d/2,text:r,bounds:m(i,a.labelCells,h)}:{x:h.x,y:h.y,r:d/2,text:r};l&&l.seriesIndex===a.index&&l.index===e&&(v.hidden=!0),u.push(v)}}return u},g=e=>e.type===`bar`||e.type===`boxplot`?e.barOffset:0,_=(e,t,r)=>{let i=n.toScreen(r,e.cols.x[t]+g(e),s.plottedY(e,t));return{px:i.x,py:i.y}},v=(e,t,n,r,i,a,o)=>{let s=e.yToPx(r),c=e.yToPx(i);return Math.abs(a-t)<=n&&o>=Math.min(s,c)-2&&o<=Math.max(s,c)+2},y=(e,t,r,i,a)=>{let o=_(e,t,a),s=n.alongX(a,r,i),c=n.alongY(a,r,i),l=a.xToPx(e.cols.x[t]+g(e)),u=!1;if(e.type===`bar`&&e.barBase&&e.barTop)u=v(a,l,e.barHalfWidth/Math.abs(a.xPerPx),e.barBase[t],e.barTop[t],s,c);else if(e.type===`candlestick`||e.type===`boxplot`){let{high:n,low:r,y:i}=e.cols;u=v(a,l,Math.max(e.barHalfWidth/Math.abs(a.xPerPx),3),n?n[t]:i[t],r?r[t]:i[t],s,c)}return{series:e,index:t,px:o.px,py:o.py,dx:Math.abs(a.xToPx(e.cols.x[t])-s),dist:u?0:Math.hypot(o.px-r,o.py-i),inside:u}},b=(e,t,r,i,a,o)=>{let s=e.cols.outliers?.[t];if(!s)return;let c=a.xToPx(e.cols.x[t]+g(e)),l=n.alongX(a,r,i)-c,u=n.alongY(a,r,i),d=e.outlierSize/2+4+o,f,p=d;return s.forEach((n,r)=>{let i=Math.hypot(l,a.yToPx(n)-u);i<=p&&(p=i,f=e.raw.outliers?.[t]?.[r]??n)}),f},x=(e,t)=>e.cols.size&&e.cols.size[t]>0?e.cols.size[t]:e.pointSize,S=new WeakMap,ee=e=>{let t=e.cols.size;if(!t)return e.pointSize;let n=S.get(t);if(n===void 0){n=e.pointSize;for(let e=0;e<t.length;e++)t[e]>n&&(n=t[e]);S.set(t,n)}return n},C=(e,t,r,i,a)=>{let o=Math.max(ee(e)/2+6,10)+a,c=n.toData(i,t,r),l=o*Math.abs(i.xPerPx),u=o*Math.abs(i.yPerPx),d=-1,f=1/0,{x:p,y:m}=e.cols;return s.gridOf(e).query(c.x-l,c.x+l,c.y-u,c.y+u,o=>{let s=n.toScreen(i,p[o],m[o]),c=Math.hypot(s.x-t,s.y-r);c<=Math.max(x(e,o)/2+4,8)+a&&c<=f&&(f=c,d=o)}),d},te=(e,t,n)=>{let{x:r,y:i}=e.cellHalf,{x:a,y:o}=e.cols,c=-1;return s.gridOf(e).query(t-r,t+r,n-i,n+i,s=>{e.cellColors?.[s]&&Math.abs(a[s]-t)<=r&&Math.abs(o[s]-n)<=i&&(c=s)}),c},w=(t,n)=>{let{x:r,y:i,count:a,sorted:o}=t.cols;if(o)return e.nearestIndex(r,i,a,n);let s=-1,c=1/0;for(let e=0;e<a;e++){if(!Number.isFinite(i[e]))continue;let t=Math.abs(r[e]-n);t<c&&(c=t,s=e)}return s},T=(e,n)=>{let r=e.pointColors?.[n],{open:i,high:a,low:o,value:s,y0:c,q1:l,q3:u,outliers:d,labels:f}=e.raw,p=f?.[n],m=r?t.toCss(r):e.colorCss,h={};if(e.type===`candlestick`){let r=i?i[n]:NaN;Number.isFinite(r)&&(h.open=r),a&&Number.isFinite(a[n])&&(h.high=a[n]),o&&Number.isFinite(o[n])&&(h.low=o[n]),m=t.toCss(e.raw.y[n]<r?e.downColor:e.upColor)}else if(e.type===`heatmap`){let r=s?s[n]:e.raw.y[n];Number.isFinite(r)&&(h.value=r);let i=e.cellColors?.[n];i&&(m=t.toCss(t.unpackColor(i)))}else if(e.type===`boxplot`){a&&Number.isFinite(a[n])&&(h.high=a[n]),o&&Number.isFinite(o[n])&&(h.low=o[n]),l&&Number.isFinite(l[n])&&(h.q1=l[n]),u&&Number.isFinite(u[n])&&(h.q3=u[n]);let e=d?.[n];e&&(h.outliers=e.length)}else c&&Number.isFinite(c[n])&&(h.y0=c[n]),e.type===`scatter`&&s&&Number.isFinite(s[n])&&(h.value=s[n]);return{seriesIndex:e.index,seriesId:e.id,seriesName:e.name,index:n,x:e.raw.x[n],y:e.raw.y[n],color:m,...p===void 0?{}:{label:p},...h}},E=(e,t)=>{if(!e.length)return null;e.sort((e,t)=>e.series.index-t.series.index);let n=e.map(e=>{let t=T(e.series,e.index);return e.outlier!==void 0&&(t.outlier=e.outlier),t}),r=n[0].x;return{items:n,x:r,xLabel:t?.formatValue(r)??String(r)}},D=(e,t,r,i,a,o=0)=>{let{plot:s}=t,c=6+o;if(i<s.x-c||i>s.x+s.width+c||a<s.y-c||a>s.y+s.height+c)return null;let l=n.toData(t,i,a),u=[],d=[];for(let n of e.series)if(!n.hidden&&n.tooltip&&n.cols.count!==0){if(n.type===`scatter`){let e=C(n,i,a,t,o);e>=0&&u.push(y(n,e,i,a,t))}else if(n.type===`heatmap`){let e=te(n,l.x,l.y);if(e>=0){let r=y(n,e,i,a,t);r.inside=!0,r.dist=0,u.push(r)}}else{let e=w(n,l.x);if(e<0)continue;let r=y(n,e,i,a,t);n.type===`boxplot`&&(r.outlier=b(n,e,i,a,t,o),r.outlier!==void 0&&(r.inside=!0,r.dist=0)),d.push(r)}}let f=d.filter(e=>(e.series.type===`line`||e.series.type===`area`)&&e.dist<=8+o);if((e.tooltipMode===`item`||e.tooltipMode===`nearest`)&&f.length)return E([f.reduce((e,t)=>t.dist<e.dist?t:e)],r);if(e.tooltipMode===`item`){let e=[...u,...d].filter(e=>e.inside||e.series.type===`scatter`||(e.series.type===`line`||e.series.type===`area`)&&e.dist<=8+o);return e.length?E([e.reduce((e,t)=>t.dist<e.dist||t.dist===e.dist&&t.series.index>e.series.index?t:e)],r):null}if(e.tooltipMode===`nearest`){let e=[...u,...d].filter(e=>e.inside||e.series.type===`scatter`||e.dist<=32+o);return e.length?E([e.reduce((e,t)=>t.dist<=e.dist?t:e)],r):null}if(!d.length)return u.length?E([u.reduce((e,t)=>t.dist<=e.dist?t:e)],r):null;let p=Math.min(...d.map(e=>e.dx)),m=e.x.type===`category`?.5/Math.abs(t.xPerPx):0,h=d.filter(e=>e.dx<=p+Math.max(1,m)),g=h.reduce((e,t)=>t.dx<e.dx?t:e),_=E([g,...h.filter(e=>e!==g),...u],r);return _&&(_.x=T(g.series,g.index).x,_.xLabel=r?.formatValue(_.x)??String(_.x)),_},O=(e,t)=>e===t||!!e&&!!t&&e.items.length===t.items.length&&e.items.every((e,n)=>e.index===t.items[n].index&&e.seriesIndex===t.items[n].seriesIndex),k={style:`percent`,minimumFractionDigits:2,maximumFractionDigits:2},A=(e,t)=>e.raw.details?.[t]?.map(e=>({color:null,name:e.name,value:e.value}))??[],j=(e,t,n,r=null)=>{let o=n?.formatValue??String,s=t=>t.format??(t.yAxis===`right`?r?.formatValue??e.y2?.format??e.formatValue:o),c=e.labels,l=t.items[0],u=l?e.series[l.seriesIndex]:null;if(t.items.length===1&&l&&u?.type===`bar`&&l.y0!==void 0&&e.y.type===`time`){let n=s(u);return{title:l.label??t.xLabel,titleColor:l.color,subtitle:l.label===void 0?u.name:`${t.xLabel} · ${u.name}`,rows:[{color:null,name:c.start,value:n(l.y0)},{color:null,name:c.end,value:n(l.y)},{color:null,name:c.duration,value:a.formatDuration(l.y-l.y0,e.locale)},...A(u,l.index)]}}if(t.items.length===1&&u?.type===`heatmap`){let n=e.y.type===`category`?e.y.categories[Math.round(l.y)]??o(l.y):o(l.y);return{title:`${t.xLabel} · ${n}`,titleColor:null,rows:[{color:l.color,name:l.label??u.name,value:l.value===void 0?`–`:(u.format??e.formatValue)(l.value)},...A(u,l.index)]}}if(t.items.every(t=>e.series[t.seriesIndex].type===`scatter`)&&t.items.length===1){let n=t.items[0],i=e.series[n.seriesIndex],a=n.value===void 0?[]:[{color:null,name:i.valueName??c.value,value:(i.format??e.formatValue)(n.value)}];if(e.x.type===`category`)return{title:n.label??t.xLabel,titleColor:null,rows:[{color:n.color,name:n.seriesName,value:s(i)(n.y)},...a,...A(i,n.index)]};let l=i.yAxis===`right`?r?.formatValue??e.y2?.format??e.formatValue:o,u=[{color:null,name:e.x.title??c.x,value:t.xLabel},{color:null,name:(i.yAxis===`right`?e.y2?.title:e.y.title)??c.y,value:(n.value===void 0?s(i):l)(n.y)},...a,...A(i,n.index)];return{title:n.label??n.seriesName,titleColor:n.color,...n.label!==void 0&&e.series.length>1?{subtitle:n.seriesName}:{},rows:u}}let d=[],f=[],p=t.items.length===1&&u?.type===`bar`&&e.x.type!==`category`&&l?.label!==void 0?l.label:null;for(let n of t.items){let t=e.series[n.seriesIndex],r=s(t);if(f.push(d.length),t.type===`candlestick`){let a=n.open!==void 0&&n.open!==0?(n.y-n.open)/Math.abs(n.open)*100:NaN;d.push({color:n.color,name:t.name,value:Number.isFinite(a)?`${a>=0?`+`:``}${i.numberFormat(e.locale,k).format(a/100)}`:``});let o=[[c.open,n.open],[c.high,n.high],[c.low,n.low],[c.close,n.y]];for(let[e,t]of o)t!==void 0&&Number.isFinite(t)&&d.push({color:null,name:e,value:r(t)});continue}if(t.type===`boxplot`){if(n.outlier!==void 0){d.push({color:n.color,name:n.label?`${n.seriesName} · ${n.label}`:n.seriesName,value:``},{color:null,name:c.outlier,value:r(n.outlier)});continue}d.push({color:n.color,name:n.label?`${n.seriesName} · ${n.label}`:n.seriesName,value:``});let e=[[c.max,n.high],[c.q3,n.q3],[c.median,n.y],[c.q1,n.q1],[c.min,n.low]];for(let[t,n]of e)n!==void 0&&Number.isFinite(n)&&d.push({color:null,name:t,value:r(n)});n.outliers&&d.push({color:null,name:c.outliers,value:String(n.outliers)});continue}let a=r(n.y);if(n.y0!==void 0){let i=n.y-n.y0;a=t.type===`bar`&&e.y.type!==`time`?`${i>0?`+`:``}${r(i)}`:`${r(n.y0)} – ${r(n.y)}`}d.push({color:n.color,name:n.label&&p===null?`${n.seriesName} · ${n.label}`:n.seriesName,value:a}),d.push(...A(t,n.index))}if(e.percent){let n=new Map;for(let r of t.items){let t=M(e,r.seriesIndex);t!==null&&Number.isFinite(r.y)&&n.set(t,(n.get(t)??0)+Math.abs(r.y))}t.items.forEach((t,r)=>{let i=M(e,t.seriesIndex),o=i===null?void 0:n.get(i),s=d[f[r]];o&&s&&Number.isFinite(t.y)&&(s.value=`${(e.series[t.seriesIndex].format??e.formatValue)(t.y)} · ${a.formatPercent(Math.abs(t.y)/o*100,e.locale,!0)}`)})}return{title:p??t.xLabel,titleColor:null,rows:d}},M=(e,t)=>e.series[t].hidden?null:e.stacks[t],ne=(e,r,i)=>{let a=[],{plot:o}=r,s=1/0,c=-1/0;for(let l of i.items){let i=e.series[l.seriesIndex],u=i.cols.x[l.index]??l.x;if(i.type===`boxplot`&&l.outlier!==void 0){let e=n.toScreen(r,u+g(i),V(i,l));a.push({kind:`dot`,x:e.x,y:e.y,size:i.outlierSize+3,color:l.color,halo:t.toCss(i.pointColors?.[l.index]??i.color,.2)});continue}if(i.type===`bar`||i.type===`candlestick`||i.type===`boxplot`){let t=r.xToPx(u+g(i)),n=Math.max(i.barHalfWidth/Math.abs(r.xPerPx),1);s=Math.min(s,t-n),c=Math.max(c,t+n),i.type===`bar`&&a.push(...z(e,r,i,l.index));continue}if(i.type===`heatmap`){let e=r.xToPx(u),s=r.yToPx(l.y),c=Math.abs(i.cellHalf.x/r.xPerPx),d=Math.abs(i.cellHalf.y/r.yPerPx),f=n.screenRect(r,e-c,e+c,s-d,s+d),p=n.heatCellStyle(f.width,f.height,i.radius),m=Math.max(o.y,f.y),h=Math.min(o.y+o.height,f.y+f.height),g=Math.max(o.x,f.x),_=Math.min(o.x+o.width,f.x+f.width);h>m&&a.push({kind:`guide`,x:o.x,y:m,width:o.width,height:h-m}),_>g&&a.push({kind:`guide`,x:g,y:o.y,width:_-g,height:o.height});let v=i.cellColors?.[l.index],y=v?t.unpackColor(v):i.color;a.push({kind:`cell`,x:f.x+p.inset,y:f.y+p.inset,width:Math.max(1,f.width-p.inset*2),height:Math.max(1,f.height-p.inset*2),seriesIndex:i.index,index:l.index,color:l.color,ring:N(y),radius:p.radius});continue}let{px:d,py:f}=_(i,l.index,r);if(d<o.x-1||d>o.x+o.width+1||f<o.y-1||f>o.y+o.height+1)continue;let p=i.type===`scatter`?x(i,l.index)+4:Math.max(9,i.lineWidth*2+5),m=i.pointColors?.[l.index]??i.color;a.push({kind:`dot`,x:d,y:f,size:p,color:l.color,halo:t.toCss(m,.2)})}if(c>s){let e=Math.max(4,(c-s)*.14),t=r.horizontal?o.y:o.x,n=t+(r.horizontal?o.height:o.width),i=Math.max(t,s-e),l=Math.min(n,c+e);l>i&&a.unshift({kind:`band`,...r.horizontal?{x:o.x,y:i,width:o.width,height:l-i}:{x:i,y:o.y,width:l-i,height:o.height}})}return a},N=e=>t.luminance(e)>.45?`rgba(15, 23, 42, 0.78)`:`rgba(255, 255, 255, 0.9)`,P=.6,F=(e,t)=>!t.floating&&e.series.some(e=>e!==t&&!e.hidden&&e.type===`bar`&&!e.floating&&e.barOffset===t.barOffset)?0:t.radius,I=(e,t)=>{let n=1/0;for(let r of e.series){if(r.hidden||r.type!==`bar`&&r.type!==`boxplot`)continue;let e=Math.abs(r.barOffset-t.barOffset);e>0&&e<n&&(n=e)}return Number.isFinite(n)?Math.max(0,n/2-t.barHalfWidth):null},L=(e,t,n,r)=>{let i=Math.min(5,Math.max(1.5,r*.08)),a=I(e,n);return a!==null&&(i=Math.min(i,a/Math.abs(t.xPerPx)*.5)),i>=.75?Math.round(i*4)/4:0},R=(e,t,r,i)=>{let a=r.barBase?.[i],o=r.barTop?.[i],s=r.cols.x[i];if(a===void 0||o===void 0||Number.isNaN(a)||Number.isNaN(o)||!Number.isFinite(s))return null;let{plot:c}=t,l=t.xToPx(s+r.barOffset),u=Math.max(r.barHalfWidth/Math.abs(t.xPerPx),.5),d=t.horizontal?c.x:c.y,f=d+(t.horizontal?c.width:c.height),p=e=>Math.min(f+16,Math.max(d-16,Number.isNaN(e)?d:e)),m=p(t.yToPx(a)),h=p(t.yToPx(o));if(Math.abs(m-h)<.5)return null;let g=n.screenRect(t,l-u,l+u,m,h);return g.x>c.x+c.width||g.x+g.width<c.x||g.y>c.y+c.height||g.y+g.height<c.y?null:{...g,radius:Math.min(F(e,r),g.width/2,g.height/2),base:t.horizontal?m<h?`left`:`right`:m>h?`bottom`:`top`}},z=(e,n,r,i)=>{let a=R(e,n,r,i);if(!a)return[];let o=L(e,n,r,a.base===`top`||a.base===`bottom`?a.width:a.height),c=r.pointColors?.[i]??r.color,l=c[3]*s.barOpacity(r,i),u=l<P,d=[{kind:`bar`,...a,seriesIndex:r.index,index:i,color:t.toCss(c,s.barOpacity(r,i)),backdrop:l<.98,ring:u?t.toCss([c[0],c[1],c[2],1]):N(c),grow:o}],f=Math.min(r.barBase?.[i]??NaN,r.barTop?.[i]??NaN),p=Math.max(r.barBase?.[i]??NaN,r.barTop?.[i]??NaN);if(!r.floating||!(p>=f))return d;let m=(p-f)*1e-9;for(let a of e.series)if(a!==r&&!a.hidden&&!a.tooltip&&a.type===`bar`&&a.floating&&a.barOffset===r.barOffset&&a.barBase&&a.barTop)for(let c=0;c<a.cols.count;c++){if(a.cols.x[c]!==r.cols.x[i])continue;let l=Math.min(a.barBase[c],a.barTop[c]),u=Math.max(a.barBase[c],a.barTop[c]);if(!(l>=f-m&&u<=p+m))continue;let h=R(e,n,a,c);if(!h)continue;let g=a.pointColors?.[c]??a.color;d.push({kind:`bar`,...h,seriesIndex:a.index,index:c,color:t.toCss(g,s.barOpacity(a,c)),backdrop:!1,ring:null,grow:o})}return d},B=e=>e.base===`top`||e.base===`bottom`?{x:e.x-e.grow,y:e.y,width:e.width+e.grow*2,height:e.height}:{x:e.x,y:e.y-e.grow,width:e.width,height:e.height+e.grow*2},V=(e,t)=>{let n=e.raw.outliers?.[t.index],r=n?n.indexOf(t.outlier??NaN):-1;return(r>=0?e.cols.outliers?.[t.index]?.[r]:void 0)??t.outlier??0},H=(e,r)=>{let i=[];for(let a of e.series){let e=a.connector;if(!e||a.hidden||a.type!==`bar`||!a.barTop)continue;let{x:o,count:s}=a.cols,c=a.barTop,l=a.barHalfWidth,[u,d]=r.view.x[0]<=r.view.x[1]?r.view.x:[r.view.x[1],r.view.x[0]],f=t.toCss(e.color,.75),p=-1;for(let t=0;t<s&&i.length<1200;t++)if(Number.isFinite(c[t])&&Number.isFinite(o[t])){if(p>=0&&o[t]+l>=u&&o[p]-l<=d){let s=n.toScreen(r,o[p]+a.barOffset+l,c[p]),u=n.toScreen(r,o[t]+a.barOffset-l,c[p]);i.push({x0:s.x,y0:s.y,x1:u.x,y1:u.y,color:f,width:e.width,dash:e.dash})}p=t}}return i},U=(e,n)=>{let r=n.resolve??l,i=t.toCss(n.textMuted,.85);return(e??[]).map(e=>({from:e.from,to:e.to,color:e.color?t.toCss(r(e.color,n.textMuted)):i}))},W={length:6,half:3.5},G=(e,t,n,r)=>{let i={boxes:[],byId:new Map,byRow:new Map,ids:new Set},a=e.x.type===`category`?e.x.categories:null;for(let o of e.series){if(o.type!==`bar`&&o.type!==`scatter`)continue;let e=o.raw.ids;if(e)for(let t of e)t!==void 0&&i.ids.add(t);if(o.hidden||!o.tooltip)continue;let{x:s,y:c,count:l}=o.cols,u=o.type===`bar`&&o.barBase&&o.barTop,d=g(o);for(let f=0;f<l;f++){let l=u?o.barBase[f]:c[f],p=u?o.barTop[f]:c[f];if(!Number.isFinite(s[f])||!Number.isFinite(l)||!Number.isFinite(p))continue;let m=u?o.barHalfWidth/Math.abs(t.xPerPx):x(o,f)/2,h=n(Math.min(l,p)),g=n(Math.max(l,p)),_=u?0:m,v={c:r(s[f]+d),half:m,start:h,end:g,lo:Math.min(h,g)-_,hi:Math.max(h,g)+_,dot:!u};i.boxes.push(v);let y=e?.[f];y!==void 0&&!i.byId.has(y)&&i.byId.set(y,v);let b=a?a[Math.round(s[f])]:String(o.raw.x[f]);b!==void 0&&!i.byRow.has(b)&&i.byRow.set(b,v)}}return i},K=8,q=4,J=e=>{let t=e.map(e=>[e.lo-q,e.hi+q]).sort((e,t)=>e[0]-t[0]),n=[];for(let e of t){let t=n[n.length-1];t&&e[0]<=t[1]?t[1]=Math.max(t[1],e[1]):n.push(e)}return n},Y=(e,t)=>e.some(([e,n])=>t>e+1e-6&&t<n-1e-6),X=(e,t,n,r)=>{let i=[t];for(let[t,n]of e)i.push(t,n);let a=null;for(let o of i){let i=r*(o-t);i<0||r*(n-o)<0||Y(e,o)||(a===null||i<r*(a-t))&&(a=o)}return a},re=(e,t)=>{let n=e.find(([e,n])=>t>e+1e-6&&t<n-1e-6);if(!n)return t;let[r,i]=n;return t-r<=i-t?r:i},Z=e=>{let t=[],n=(e,t)=>Math.abs(e-t)<1e-6;for(let r of e){let e=t[t.length-1];if(e&&n(e[0],r[0])&&n(e[1],r[1]))continue;let i=t[t.length-2];i&&e&&(n(i[0],e[0])&&n(e[0],r[0])||n(i[1],e[1])&&n(e[1],r[1]))&&t.pop(),t.push(r)}return t},ie=(e,t,n,r,i,a)=>{let o=e.c,s=t.c,c=n+i*K,l=i*(r-c)>=0,u=Math.min(o,s),d=Math.max(o,s),f=d-u<.5?[]:a.filter(n=>n!==e&&n!==t&&n.c+n.half>u&&n.c-n.half<d);if(l){let e=X(J(f),c,r,i);if(e!==null)return Z([[n,o],[e,o],[e,s],[r,s]])}let p=Math.sign(s-o)||1,m=new Map;for(let e of f){if(Math.abs(e.c-o)<.5||Math.abs(e.c-s)<.5)continue;let t=Math.round(e.c*2),n=m.get(t);n?(n.half=Math.max(n.half,e.half),n.of.push(e)):m.set(t,{c:e.c,half:e.half,of:[e]})}let h=[{c:o,half:e.half,lanes:[]},...[...m.values()].sort((e,t)=>p*(e.c-t.c)).map(e=>({c:e.c,half:e.half,lanes:J(e.of)})),{c:s,half:t.half,lanes:[]}],g=r-i*K,_=[[n,o],[c,o]],v=c;for(let e=0;e+1<h.length;e++){let t=h[e],n=h[e+1],a=Math.abs(n.c-t.c)<.5?t.c+p*(Math.max(t.half,n.half)+q):(t.c+p*t.half+n.c-p*n.half)/2,o=e+2===h.length?l&&i*(r-v)>=0?v:g:re(n.lanes,l?v:g);o!==v&&(_.push([v,a],[o,a]),v=o)}return _.push([v,s],[r,s]),Z(_)},ae=(e,t,r)=>{if(!r.length)return[];let i=t.horizontal,a=(e,t)=>i?{x:e,y:t}:{x:t,y:e},o=e=>{let r=n.toScreen(t,0,e);return i?r.x:r.y},s=e=>{let r=n.toScreen(t,e,0);return i?r.y:r.x},c=Math.sign(o(t.view.y[1])-o(t.view.y[0]))||1,l=G(e,t,o,s),u=e=>l.byId.get(e)??(l.ids.has(e)?void 0:l.byRow.get(e)),{length:d,half:f}=W,p=[];for(let e of r){let t=u(e.from),n=u(e.to);if(!t||!n||t===n)continue;let r=t.end+(t.dot?c*t.half:0),i=n.start-c*(n.dot?n.half+1:1),o=i-c*d,s=ie(t,n,r,o,c,l.boxes);p.push({points:s.map(([e,t])=>a(e,t)),head:[a(i,n.c),a(o,n.c-f),a(o,n.c+f)],color:e.color,width:1.25})}return p},oe=12,Q=e=>{if(!e.series.length||e.series.some(e=>e.type!==`heatmap`))return null;let n=e.series.find(e=>!e.hidden&&e.colorLut),r=n?.colorLut;if(!n||!r)return null;let i=[];for(let e=0;e<oe;e++){let n=r[Math.round(e/11*(r.length-1))];i.push(t.toCss(t.unpackColor(n??0)))}let a=n.format??e.formatValue,[o,s]=n.valueRange,c=[{at:0,text:a(o)},{at:1,text:a(s)}],l=n.colorMidpoint;return l!==null&&l>o&&l<s&&c.splice(1,0,{at:.5,text:a(l)}),{seriesIndex:n.index,stops:i,labels:c}},se=(e,t,n)=>e===void 0?n>1||Q(t)!==null:!!e,ce=e=>e===`scatter`?`dot`:e===`line`?`line`:`square`,$=(e,t,n)=>n??(e.tooltipMode===`axis`&&t.items.some(t=>{let n=e.series[t.seriesIndex].type;return n===`line`||n===`area`})&&!t.items.some(t=>{let n=e.series[t.seriesIndex].type;return n===`bar`||n===`candlestick`||n===`boxplot`})),le=(e,t,n,r)=>{if(!$(e,n,r))return null;let i=n.items[0],a=t.xToPx(e.series[i.seriesIndex]?.cols.x[i.index]??s.toPlotX(e,i.x)),o=t.horizontal?t.plot.y:t.plot.x,c=o+(t.horizontal?t.plot.height:t.plot.width);return a>=o&&a<=c?a:null};exports.ARROW_HEAD=W,exports.DEFAULT_PADDING=c,exports.collectPointLabels=h,exports.colorLegend=Q,exports.connectorSegments=H,exports.contrastRing=N,exports.crosshairAt=le,exports.dependencyArrows=ae,exports.dotSize=x,exports.fallbackResolve=l,exports.hitTest=D,exports.hoverItemOf=T,exports.hoverMarks=ne,exports.labelCell=m,exports.layoutChart=d,exports.legendShape=ce,exports.legendShown=se,exports.liftedBarRect=B,exports.pointOf=_,exports.resolveAnnotations=u,exports.resolveDependencies=U,exports.sameHover=O,exports.showsCrosshair=$,exports.tooltipContent=j;
2
2
  //# sourceMappingURL=scene.cjs.map