@astrato-io/visualizations 0.0.0-stage → 0.6.5

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 (139) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +93 -0
  3. package/README.md +843 -2
  4. package/THIRD_PARTY_NOTICES.md +8477 -0
  5. package/VISUALIZATION_DEFINITIONS.md +2378 -0
  6. package/chunks/ClickAwayListener-BbeNMAvj.js +52 -0
  7. package/chunks/LinearProgress-B1FeWaen.js +253 -0
  8. package/chunks/accessors-DemrDevR.js +128 -0
  9. package/chunks/app-filter-bar.compiler-BGJ7HAbr.js +64 -0
  10. package/chunks/bar.compiler-CT0ZbQKc.js +374 -0
  11. package/chunks/builder-B6dWSIdD.js +12289 -0
  12. package/chunks/color-settings-ZIvgNTq1.js +10 -0
  13. package/chunks/coloring-B1XAfg6b.js +664 -0
  14. package/chunks/debounce-fn-CUixuz45.js +7 -0
  15. package/chunks/definitions-D3OVqmXl.js +2102 -0
  16. package/chunks/escobar-eDjtGpkC.js +34606 -0
  17. package/chunks/events-WZut5Ow6.js +4 -0
  18. package/chunks/extend-BKUkc4_i.js +37 -0
  19. package/chunks/filter.compiler-DBsyRBJt.js +70 -0
  20. package/chunks/filtering-tqjAyJH5.js +1072 -0
  21. package/chunks/grouping-type-On4s9Thj.js +3 -0
  22. package/chunks/handlers-VTBfIZYZ.js +13072 -0
  23. package/chunks/isEqual-BDxAhUo8.js +7514 -0
  24. package/chunks/line.compiler-CzdM5Ld0.js +198 -0
  25. package/chunks/metadata-BGElBy5Z.js +28 -0
  26. package/chunks/number.compiler-G-R7y16P.js +53 -0
  27. package/chunks/operations-CTNUX6Sy.js +26249 -0
  28. package/chunks/range-CiwTbMig.js +22 -0
  29. package/chunks/registry-CsQQzukD.js +920 -0
  30. package/chunks/requirements-DYjZCFyf.js +6 -0
  31. package/chunks/rolldown-runtime-DleVn1XH.js +28 -0
  32. package/chunks/set-coloring-datafield-B3uIS1Pe.js +8 -0
  33. package/chunks/shared-CBvcC5YV.js +1218 -0
  34. package/chunks/src-BOS6SqkZ.js +67 -0
  35. package/chunks/src-D9XogOrc.js +422 -0
  36. package/chunks/standalone-0M4HlmDW2.js +3944 -0
  37. package/chunks/standalone-0ashe9w1.js +411 -0
  38. package/chunks/standalone-B7jax8wa.js +339 -0
  39. package/chunks/standalone-BK0VYU-l.js +463 -0
  40. package/chunks/standalone-BMIbT1b2.js +4619 -0
  41. package/chunks/standalone-BZV5vOwA.js +6 -0
  42. package/chunks/standalone-BhDrWj4p.js +1980 -0
  43. package/chunks/standalone-BtSHCp2U2.js +673 -0
  44. package/chunks/standalone-BvaKdky9.js +344 -0
  45. package/chunks/standalone-BwtM31-f.js +2 -0
  46. package/chunks/standalone-C3gg736V.js +1129 -0
  47. package/chunks/standalone-CC1VUjO32.js +299 -0
  48. package/chunks/standalone-C_rYnZ0N.js +741 -0
  49. package/chunks/standalone-CoLrAxRV.js +13198 -0
  50. package/chunks/standalone-DC-aUgXC.js +3855 -0
  51. package/chunks/standalone-DCtRoTWg.js +675 -0
  52. package/chunks/standalone-DUDFTBqL.js +833 -0
  53. package/chunks/standalone-DhZkX9Td.js +2 -0
  54. package/chunks/standalone-DtLElfuM.js +512 -0
  55. package/chunks/standalone-G9Q4Uczu.js +726 -0
  56. package/chunks/standalone-JuLF-OoH.js +1762 -0
  57. package/chunks/standalone-_DeX21JJ.js +383 -0
  58. package/chunks/standalone-gFhKZh8m.js +179 -0
  59. package/chunks/standalone-tDNy-SFH.js +281 -0
  60. package/chunks/standalone-v1oxfU20.js +68 -0
  61. package/chunks/standalone-vzBY6q0I2.js +140 -0
  62. package/chunks/stroke-dash-UgMEcCS4.js +6 -0
  63. package/chunks/table.compiler-tb914oj3.js +222 -0
  64. package/chunks/typeof-CJDtcySz.js +13 -0
  65. package/chunks/ui-DQWtv2iM.js +63551 -0
  66. package/chunks/url-utils-B17gj_mr.js +5501 -0
  67. package/chunks/useFieldName-BvdcoJRl.js +7 -0
  68. package/chunks/utils-Bg7K-t6K.js +32379 -0
  69. package/chunks/view-Bn83C8d9.js +12466 -0
  70. package/definitions.js +3 -0
  71. package/docs/operations/astrato-app-filter-bar.md +161 -0
  72. package/docs/operations/bar.md +6968 -0
  73. package/docs/operations/combo.md +5804 -0
  74. package/docs/operations/date-picker.md +644 -0
  75. package/docs/operations/distribution-gauge.md +3082 -0
  76. package/docs/operations/dot.md +5570 -0
  77. package/docs/operations/filter.md +1483 -0
  78. package/docs/operations/gauge.md +3316 -0
  79. package/docs/operations/heatMap.md +5944 -0
  80. package/docs/operations/histogram.md +1856 -0
  81. package/docs/operations/iframe.md +56 -0
  82. package/docs/operations/image.md +177 -0
  83. package/docs/operations/index.md +46 -0
  84. package/docs/operations/line.md +6391 -0
  85. package/docs/operations/number.md +3903 -0
  86. package/docs/operations/pie.md +5956 -0
  87. package/docs/operations/radar.md +4566 -0
  88. package/docs/operations/sankey.md +3088 -0
  89. package/docs/operations/scatter.md +5969 -0
  90. package/docs/operations/shape.md +315 -0
  91. package/docs/operations/simpleTextObject.md +699 -0
  92. package/docs/operations/slider.md +220 -0
  93. package/docs/operations/table.md +8800 -0
  94. package/docs/operations/tree.md +2867 -0
  95. package/docs/operations/treemap.md +3527 -0
  96. package/docs/operations/waterfall.md +2928 -0
  97. package/docs/operations/word-cloud.md +3000 -0
  98. package/getters.js +18 -0
  99. package/index.js +1183 -0
  100. package/metadata.js +20 -0
  101. package/operations.js +64 -0
  102. package/package.json +185 -4
  103. package/src/definitions/index.d.ts +2 -0
  104. package/src/definitions/model/definitions/available-fields.d.ts +35 -0
  105. package/src/definitions/model/definitions/compilers/compile.d.ts +7 -0
  106. package/src/definitions/model/definitions/data-item-resolution.d.ts +19 -0
  107. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1341 -0
  108. package/src/definitions/model/definitions/descriptors/json-schema.d.ts +2 -0
  109. package/src/definitions/model/definitions/diagnostics.d.ts +5 -0
  110. package/src/definitions/model/definitions/field-suggestions.d.ts +2 -0
  111. package/src/definitions/model/definitions/index.d.ts +23 -0
  112. package/src/definitions/model/definitions/registry/compile.d.ts +2 -0
  113. package/src/definitions/model/definitions/registry/descriptor-registry.d.ts +3 -0
  114. package/src/definitions/model/definitions/schema-registry.d.ts +660 -0
  115. package/src/definitions/model/definitions/schemas/app-filter-bar.schema.d.ts +22 -0
  116. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +73 -0
  117. package/src/definitions/model/definitions/schemas/broad-chart.schema.d.ts +68 -0
  118. package/src/definitions/model/definitions/schemas/common.schema.d.ts +303 -0
  119. package/src/definitions/model/definitions/schemas/filter.schema.d.ts +22 -0
  120. package/src/definitions/model/definitions/schemas/index.d.ts +9 -0
  121. package/src/definitions/model/definitions/schemas/line.schema.d.ts +72 -0
  122. package/src/definitions/model/definitions/schemas/number.schema.d.ts +21 -0
  123. package/src/definitions/model/definitions/schemas/object.schema.d.ts +215 -0
  124. package/src/definitions/model/definitions/schemas/table.schema.d.ts +458 -0
  125. package/src/definitions/model/definitions/types/compilation.types.d.ts +36 -0
  126. package/src/definitions/model/definitions/types/definition.types.d.ts +2 -0
  127. package/src/definitions/model/definitions/types/descriptor.types.d.ts +39 -0
  128. package/src/definitions/model/definitions/types/index.d.ts +3 -0
  129. package/src/definitions/model/definitions/validation.d.ts +3 -0
  130. package/src/getters/index.d.ts +30 -0
  131. package/src/index.d.ts +4 -0
  132. package/src/metadata/index.d.ts +4 -0
  133. package/src/operations/index.d.ts +30 -0
  134. package/src/registry/index.d.ts +6 -0
  135. package/src/runtime/index.d.ts +2 -0
  136. package/src/types.d.ts +307 -0
  137. package/src/visualization-catalog.d.ts +82 -0
  138. package/src/web-components/index.d.ts +12 -0
  139. package/styles.css +2 -0
@@ -0,0 +1,3944 @@
1
+ import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { Ai as t, Ea as n, Es as r, Hn as i, La as a, Mi as o, Si as s, Ta as c, fc as l, js as u, ki as d, n as f } from "./isEqual-BDxAhUo8.js";
3
+ import { $t as p, B as m, Cn as h, Ei as g, Gn as _, Ir as v, M as y, N as b, Yi as x, Zi as S, _n as C, a as w, s as T, u as ee } from "./utils-Bg7K-t6K.js";
4
+ import { Oi as te } from "./handlers-VTBfIZYZ.js";
5
+ import { Ht as E, On as ne, S as re, mt as ie } from "./ui-DQWtv2iM.js";
6
+ import { C as ae, E as oe, Gt as se, Ht as ce, Jt as D, O as le, T as ue, a as de, d as fe, f as pe, g as me, k as O, m as he, u as ge, v as _e, x as ve, y as ye } from "./escobar-eDjtGpkC.js";
7
+ import { l as be, r as xe } from "./coloring-B1XAfg6b.js";
8
+ import { f as Se, r as Ce, t as we, u as Te, y as Ee } from "./src-D9XogOrc.js";
9
+ import { a as De, i as Oe, r as ke, t as Ae } from "./accessors-DemrDevR.js";
10
+ import { r as je, t as Me } from "./src-BOS6SqkZ.js";
11
+ var k = /* @__PURE__ */ e(x()), Ne = ({ vTheme: e, vSpec: n, id: r, layout: i }) => {
12
+ let a = e?.fonts?.general.fontFamily ?? "Roboto", s = {
13
+ ...d,
14
+ ...n.treeChartSettings?.nodeLayout?.border
15
+ };
16
+ s.enabled === !1 && (s.borderWidth = 0);
17
+ let l = {
18
+ ...t,
19
+ ...n.treeChartSettings?.nodeLayout.hoverStyle
20
+ }, u = n.treeChartSettings?.nodeLayout?.backgroundColor ?? o.backgroundColor, f = new ie(u).isLight() ? c.grey1 : c.grey5;
21
+ return `
22
+ #${r} {
23
+ &[data-mode="view"] .tree-toolbar {
24
+ display: none;
25
+ }
26
+ .tree-toolbar, &:hover .tree-toolbar {
27
+ display: flex;
28
+ }
29
+
30
+ --link-color: ${c.grey3};
31
+
32
+ --border-color: ${s.borderColor};
33
+ --border-width: ${s.borderWidth}px;
34
+ --border-color-edit: ${c.secondaryPurple};
35
+ --border-radius: ${s.borderRadius}px;
36
+ --border-color-selected: ${c.grey2};
37
+
38
+ --border-hover-width: ${l.borderWidth}px;
39
+ --border-hover-color: ${l.borderColor || s.borderColor};
40
+
41
+ --node-background: ${u};
42
+ --node-background-highlight: ${c.grey2};
43
+ --font-color: ${f};
44
+
45
+ .links-wrapper path {
46
+ stroke: var(--link-color);
47
+ stroke-width: 1px;
48
+ fill: none;
49
+ transition: stroke-width 0.1s ease-in-out;
50
+ }
51
+
52
+ .node {
53
+ user-select: none;
54
+ }
55
+
56
+ .node-button-g {
57
+ cursor: pointer;
58
+
59
+ .node-button-div {
60
+ color: var(--font-color);
61
+ pointer-events: none;
62
+ display: flex;
63
+ width: 100%;
64
+ height: 100%;
65
+ }
66
+
67
+ .button-content {
68
+ border:1px solid var(--border-color);
69
+ border-radius: ${Math.ceil(s.borderRadius / 2)}px;
70
+ padding:1px 3px;
71
+ font-size:9px;
72
+ margin:auto auto;
73
+ background-color: var(--node-background);
74
+ }
75
+ &:hover .button-content {
76
+ background-color: ${c.grey5};
77
+ }
78
+ }
79
+
80
+ .drag-enabled .node.draggable > rect {
81
+ stroke: var(--border-color-edit);
82
+ stroke-width: 1px;
83
+ stroke-dasharray: 4px 2px;
84
+ }
85
+
86
+ .node.dragging > rect {
87
+ stroke-dasharray: 0 !important;
88
+ stroke-width: 0 !important;
89
+ }
90
+
91
+ .node-content {
92
+ color: var(--font-color);
93
+ font-size: 12px;
94
+ font-family: ${a}, sans-serif;
95
+ width: 100%;
96
+ height: 100%;
97
+ border: var(--border-width) solid var(--border-color);
98
+ border-radius: var(--border-radius);
99
+ background-color: var(--node-background);
100
+ outline-style: solid;
101
+ outline-width: 0px;
102
+ outline-color: transparent;
103
+ outline-offset: 0px;
104
+ transition:
105
+ outline-offset 0.1s ease-in-out,
106
+ outline-width 0.1s ease-in-out,
107
+ outline-color 0.1s ease-in-out,
108
+ border-color 0.1s ease-in-out;
109
+
110
+ .node-highlight & {
111
+ outline-offset: calc(var(--border-width) * -1);
112
+ outline-width: var(--border-hover-width);
113
+ outline-color: var(--border-hover-color);
114
+ border-color: transparent;
115
+ }
116
+ }
117
+
118
+ .node.hovered .node-content::after, .node-content:hover::after,
119
+ .dragging-active .drop-target .node-content::after {
120
+ content: '';
121
+ position: absolute;
122
+ top: 0;
123
+ left: 0;
124
+ width: 100%;
125
+ height: 100%;
126
+ border-radius: var(--border-radius);
127
+ background-color: var(--node-background-highlight);
128
+ opacity: 0.1;
129
+ }
130
+
131
+ .dragging-active .drop-target .node-content::after {
132
+ background-color: ${c.feedbackBlue};
133
+ opacity: 1;
134
+ }
135
+
136
+ .node.selected .node-foreign-object-div {
137
+ outline-style: solid;
138
+ outline-width: 2px;
139
+ outline-color: var(--border-color-selected);
140
+ border-radius: var(--border-radius);
141
+ }
142
+
143
+ .node-excluded .node-foreign-object-div::after {
144
+ content: '';
145
+ position: absolute;
146
+ top: 0;
147
+ left: 0;
148
+ width: 100%;
149
+ height: 100%;
150
+ border-radius: var(--border-radius);
151
+ background-color: ${c.grey2};
152
+ opacity: 0.2;
153
+ }
154
+ .node-excluded .node-foreign-object-div {
155
+ opacity: 0.8;
156
+ }
157
+ }
158
+
159
+ ${i.getCSS(r, n)}`;
160
+ }, Pe = { depth: -1 }, Fe = {}, Ie = {};
161
+ function Le(e) {
162
+ return e.id;
163
+ }
164
+ function Re(e) {
165
+ return e.parentId;
166
+ }
167
+ function ze() {
168
+ var e = Le, t = Re, n;
169
+ function r(r) {
170
+ var i = Array.from(r), a = e, o = t, s, c, l, u, d, f, p, m, h = /* @__PURE__ */ new Map();
171
+ if (n != null) {
172
+ let e = i.map((e, t) => Be(n(e, t, r))), t = e.map(Ve), s = new Set(e).add("");
173
+ for (let n of t) s.has(n) || (s.add(n), e.push(n), t.push(Ve(n)), i.push(Ie));
174
+ a = (t, n) => e[n], o = (e, n) => t[n];
175
+ }
176
+ for (l = 0, s = i.length; l < s; ++l) c = i[l], f = i[l] = new ke(c), (p = a(c, l, r)) != null && (p += "") && (m = f.id = p, h.set(m, h.has(m) ? Fe : f)), (p = o(c, l, r)) != null && (p += "") && (f.parent = p);
177
+ for (l = 0; l < s; ++l) if (f = i[l], p = f.parent) {
178
+ if (d = h.get(p), !d) throw Error("missing: " + p);
179
+ if (d === Fe) throw Error("ambiguous: " + p);
180
+ d.children ? d.children.push(f) : d.children = [f], f.parent = d;
181
+ } else {
182
+ if (u) throw Error("multiple roots");
183
+ u = f;
184
+ }
185
+ if (!u) throw Error("no root");
186
+ if (n != null) {
187
+ for (; u.data === Ie && u.children.length === 1;) u = u.children[0], --s;
188
+ for (let e = i.length - 1; e >= 0 && (f = i[e], f.data === Ie); --e) f.data = null;
189
+ }
190
+ if (u.parent = Pe, u.eachBefore(function(e) {
191
+ e.depth = e.parent.depth + 1, --s;
192
+ }).eachBefore(Oe), u.parent = null, s > 0) throw Error("cycle");
193
+ return u;
194
+ }
195
+ return r.id = function(t) {
196
+ return arguments.length ? (e = Ae(t), r) : e;
197
+ }, r.parentId = function(e) {
198
+ return arguments.length ? (t = Ae(e), r) : t;
199
+ }, r.path = function(e) {
200
+ return arguments.length ? (n = Ae(e), r) : n;
201
+ }, r;
202
+ }
203
+ function Be(e) {
204
+ e = `${e}`;
205
+ let t = e.length;
206
+ return He(e, t - 1) && !He(e, t - 2) && (e = e.slice(0, -1)), e[0] === "/" ? e : `/${e}`;
207
+ }
208
+ function Ve(e) {
209
+ let t = e.length;
210
+ if (t < 2) return "";
211
+ for (; --t > 1 && !He(e, t););
212
+ return e.slice(0, t);
213
+ }
214
+ function He(e, t) {
215
+ if (e[t] === "/") {
216
+ let n = 0;
217
+ for (; t > 0 && e[--t] === "\\";) ++n;
218
+ if (!(n & 1)) return !0;
219
+ }
220
+ return !1;
221
+ }
222
+ function Ue(e, t) {
223
+ return e.parent === t.parent ? 1 : 2;
224
+ }
225
+ function We(e) {
226
+ var t = e.children;
227
+ return t ? t[0] : e.t;
228
+ }
229
+ function Ge(e) {
230
+ var t = e.children;
231
+ return t ? t[t.length - 1] : e.t;
232
+ }
233
+ function Ke(e, t, n) {
234
+ var r = n / (t.i - e.i);
235
+ t.c -= r, t.s += n, e.c += r, t.z += n, t.m += n;
236
+ }
237
+ function qe(e) {
238
+ for (var t = 0, n = 0, r = e.children, i = r.length, a; --i >= 0;) a = r[i], a.z += t, a.m += t, t += a.s + (n += a.c);
239
+ }
240
+ function Je(e, t, n) {
241
+ return e.a.parent === t.parent ? e.a : n;
242
+ }
243
+ function Ye(e, t) {
244
+ this._ = e, this.parent = null, this.children = null, this.A = null, this.a = this, this.z = 0, this.m = 0, this.c = 0, this.s = 0, this.t = null, this.i = t;
245
+ }
246
+ Ye.prototype = Object.create(ke.prototype);
247
+ function Xe(e) {
248
+ for (var t = new Ye(e, 0), n, r = [t], i, a, o, s; n = r.pop();) if (a = n._.children) for (n.children = Array(s = a.length), o = s - 1; o >= 0; --o) r.push(i = n.children[o] = new Ye(a[o], o)), i.parent = n;
249
+ return (t.parent = new Ye(null, 0)).children = [t], t;
250
+ }
251
+ function Ze() {
252
+ var e = Ue, t = 1, n = 1, r = null;
253
+ function i(i) {
254
+ var s = Xe(i);
255
+ if (s.eachAfter(a), s.parent.m = -s.z, s.eachBefore(o), r) i.eachBefore(c);
256
+ else {
257
+ var l = i, u = i, d = i;
258
+ i.eachBefore(function(e) {
259
+ e.x < l.x && (l = e), e.x > u.x && (u = e), e.depth > d.depth && (d = e);
260
+ });
261
+ var f = l === u ? 1 : e(l, u) / 2, p = f - l.x, m = t / (u.x + f + p), h = n / (d.depth || 1);
262
+ i.eachBefore(function(e) {
263
+ e.x = (e.x + p) * m, e.y = e.depth * h;
264
+ });
265
+ }
266
+ return i;
267
+ }
268
+ function a(t) {
269
+ var n = t.children, r = t.parent.children, i = t.i ? r[t.i - 1] : null;
270
+ if (n) {
271
+ qe(t);
272
+ var a = (n[0].z + n[n.length - 1].z) / 2;
273
+ i ? (t.z = i.z + e(t._, i._), t.m = t.z - a) : t.z = a;
274
+ } else i && (t.z = i.z + e(t._, i._));
275
+ t.parent.A = s(t, i, t.parent.A || r[0]);
276
+ }
277
+ function o(e) {
278
+ e._.x = e.z + e.parent.m, e.m += e.parent.m;
279
+ }
280
+ function s(t, n, r) {
281
+ if (n) {
282
+ for (var i = t, a = t, o = n, s = i.parent.children[0], c = i.m, l = a.m, u = o.m, d = s.m, f; o = Ge(o), i = We(i), o && i;) s = We(s), a = Ge(a), a.a = t, f = o.z + u - i.z - c + e(o._, i._), f > 0 && (Ke(Je(o, t, r), t, f), c += f, l += f), u += o.m, c += i.m, d += s.m, l += a.m;
283
+ o && !Ge(a) && (a.t = o, a.m += u - l), i && !We(s) && (s.t = i, s.m += c - d, r = t);
284
+ }
285
+ return r;
286
+ }
287
+ function c(e) {
288
+ e.x *= t, e.y = e.depth * n;
289
+ }
290
+ return i.separation = function(t) {
291
+ return arguments.length ? (e = t, i) : e;
292
+ }, i.size = function(e) {
293
+ return arguments.length ? (r = !1, t = +e[0], n = +e[1], i) : r ? null : [t, n];
294
+ }, i.nodeSize = function(e) {
295
+ return arguments.length ? (r = !0, t = +e[0], n = +e[1], i) : r ? [t, n] : null;
296
+ }, i;
297
+ }
298
+ var A = "__root__", Qe = "__total__", $e = (e) => `__dimension__${JSON.stringify(e)}`, et = (e, t) => {
299
+ let n = e[t];
300
+ return n == null ? ["nil"] : [
301
+ "value",
302
+ typeof n,
303
+ n
304
+ ];
305
+ }, tt = (e, t) => {
306
+ if (t?.indicator !== "custom") return;
307
+ let n = t?.indicatorThreshold;
308
+ if (!n || e == null) return {
309
+ color: null,
310
+ icon: void 0
311
+ };
312
+ if (n.thresholdType === "target" && n.targetThreshold) {
313
+ let t = n.targetThreshold.target;
314
+ if (e < t) return {
315
+ color: n.targetThreshold.belowTargetColorAndIcon?.numberColor ?? null,
316
+ icon: n.targetThreshold.belowTargetColorAndIcon?.icon ?? void 0
317
+ };
318
+ if (e > t) return {
319
+ color: n.targetThreshold.aboveTargetColorAndIcon?.numberColor ?? null,
320
+ icon: n.targetThreshold.aboveTargetColorAndIcon?.icon ?? void 0
321
+ };
322
+ if (e === t) return {
323
+ color: n.targetThreshold.targetColorAndIcon?.numberColor ?? null,
324
+ icon: n.targetThreshold.targetColorAndIcon?.icon ?? void 0
325
+ };
326
+ }
327
+ return {
328
+ color: null,
329
+ icon: void 0
330
+ };
331
+ }, nt = (e, t, n, r) => {
332
+ let i = {};
333
+ return e.slots?.forEach((n) => {
334
+ if (n.key === "main") return;
335
+ let a = {
336
+ enabled: n.enabled === !0,
337
+ label: "-",
338
+ value: null,
339
+ indicator: n.indicator ?? null
340
+ };
341
+ if (a.enabled) {
342
+ let i = e.formatter;
343
+ if (n.source === "field") {
344
+ let o = r?.find((t) => t.parentId === e.dataItem.uniqueSignature && t.role === `tree-${n.key}`);
345
+ if (o) {
346
+ let e = l(o.dataItem);
347
+ o.formatter && (i = o.formatter), e && (a.value = t?.[e], a.label = a.value === null ? "-" : C(i?.format, a.value) ?? "-");
348
+ }
349
+ } else n.source === "variable" && (a.value = n.propertyValue, a.label = a.value === null ? "-" : C(i?.format, a.value) ?? "-");
350
+ a.customIndicator = tt(a.value, n);
351
+ }
352
+ i[n.key] = { ...a };
353
+ }), i;
354
+ }, rt = (e, t, n, r = !1) => {
355
+ if (n === 0 || e.data.id === "__total__") return !0;
356
+ let i = t ?? 2;
357
+ return e.depth - +!!r < i;
358
+ }, it = (e, t, n) => {
359
+ let r = [{
360
+ id: A,
361
+ parentId: null,
362
+ disabled: !1
363
+ }], a = /* @__PURE__ */ new Set();
364
+ e.measures.forEach((e) => {
365
+ a.add(e.dataItem.uniqueSignature);
366
+ });
367
+ let o = e.measures.filter((e) => s(e));
368
+ e.measures.forEach((e) => {
369
+ let t = e.dataItem.uniqueSignature, n = e.parentId && a.has(e.parentId) ? e.parentId : A;
370
+ r.push({
371
+ id: t,
372
+ parentId: n,
373
+ disabled: !s(e)
374
+ });
375
+ });
376
+ let c = ze().id((e) => e.id).parentId((e) => e.parentId)(r), u = [];
377
+ c.descendants().forEach((e) => {
378
+ if (e.data.disabled) return;
379
+ let t = e.ancestors().slice(1).find((e) => !e.data.disabled);
380
+ t ? u.push({
381
+ id: e.data.id,
382
+ parentId: t.data.id
383
+ }) : u.push({
384
+ id: e.data.id,
385
+ parentId: null
386
+ });
387
+ });
388
+ let d = u.map((n) => {
389
+ if (n.id === "__root__") return {
390
+ id: n.id,
391
+ parentId: null,
392
+ label: "Dummy Root",
393
+ value: {
394
+ label: "-",
395
+ value: null
396
+ }
397
+ };
398
+ let r = o.find((e) => e.dataItem.uniqueSignature === n.id), a = l(r.dataItem), s = t[0].items?.[0], c = r ? nt(r, s, o, e.supportingMeasures) : {}, u = s?.[a], d = r?.slots?.find((e) => e.key === "main");
399
+ return {
400
+ id: n.id,
401
+ parentId: n.parentId,
402
+ label: i(r),
403
+ value: {
404
+ label: C(r.formatter?.format, t[0].items?.[0]?.[a]) ?? "-",
405
+ value: u
406
+ },
407
+ indicator: d?.indicator ?? null,
408
+ customIndicator: tt(u, d),
409
+ brush: {
410
+ key: [se.sourceKey, se.field].join("/"),
411
+ value: ce(r)
412
+ },
413
+ ...c
414
+ };
415
+ }), f = ze().id((e) => e.id).parentId((e) => e.parentId)(d), p = o.map((e) => e.dataItem.uniqueSignature);
416
+ return f.sort((e, t) => p.indexOf(e.data.id) - p.indexOf(t.data.id)), f.descendants().forEach((e) => {
417
+ let t = !1;
418
+ t = e.data.id in n ? n[e.data.id] === !1 : e.data.expanded?.enabled ? e.data.expanded.value === !1 : !1, t && (e._children = e.children, e.children = null);
419
+ }), f;
420
+ }, at = (e, t, n) => {
421
+ if (t.itemsNotAffectedByFiltering?.pattern?.length && e.staticFilters.ignoreGlobalFilters && e.staticFilters.showGlobalFiltersEffect) {
422
+ let e = [0, ...t.itemsNotAffectedByFiltering.pattern.map((e) => n[e]).filter((e) => e !== null)].join("-");
423
+ return !t.itemsNotAffectedByFiltering.itemsMap?.[e];
424
+ }
425
+ return !1;
426
+ }, ot = (e, t, n, r, i, a) => {
427
+ let { id: o, parentId: s, prop: c, measureProp: l, dataItemIdx: u, engineKey: d } = a, f = n?.slots?.find((e) => e.key === "main"), p = i && n ? nt(n, r, [n], e.supportingMeasures) : {};
428
+ return {
429
+ id: o,
430
+ parentId: s,
431
+ label: String(r[c]),
432
+ row: +u,
433
+ value: i ? {
434
+ label: C(n.formatter?.format, r[l]) ?? "-",
435
+ value: r[l]
436
+ } : null,
437
+ indicator: f?.indicator ?? null,
438
+ customIndicator: tt(r[l], f),
439
+ brush: {
440
+ key: d,
441
+ value: r[c]
442
+ },
443
+ _excluded: at(e, t, r),
444
+ ...p
445
+ };
446
+ };
447
+ function st(e, t, n) {
448
+ let i = t[0], a = e.dimensions.filter((e) => s(e)), o = {}, c = a.map((t) => [l(t.dataItem), r(e.referencedData, t.dataItem.internalKey)]), u = e.measures.filter((e) => s(e))[0], d = u ? l(u.dataItem) : null, f = e.totals?.enabled ?? !1, p = u?.slots?.find((e) => e.key === "main"), m, h, g = /* @__PURE__ */ new Set(), _ = i.groupings ? Object.keys(i.groupings) : void 0;
449
+ _ && _.forEach((t) => {
450
+ let n = i.groupings[t], r = i.items[+t], a = c.filter(([e]) => n[e] === 0);
451
+ if (!a.length) {
452
+ m = d ? r[d] : void 0, h = r;
453
+ return;
454
+ }
455
+ let [s, l] = a.length ? a[a.length - 1] : ["", ""], p = $e(a.map((e) => et(r, e[0]))), _ = a.slice(0, -1), v = _.length ? $e(_.map((e) => et(r, e[0]))) : f ? Qe : A;
456
+ a.length < c.length && g.add(p), o[p] || (o[p] = ot(e, i, u, r, !!u, {
457
+ engineKey: l,
458
+ id: p,
459
+ parentId: v,
460
+ measureProp: d,
461
+ prop: s,
462
+ dataItemIdx: +t
463
+ }));
464
+ }), i.items.forEach((t, n) => {
465
+ _?.includes(String(n)) || c.forEach(([r, a], s, c) => {
466
+ if (t[r] === void 0) {
467
+ console.warn(`Dimension property ${r} is missing in data item at index ${n}, skipping this dimension for this item`);
468
+ return;
469
+ }
470
+ let l = $e(c.slice(0, s + 1).map((e) => et(t, e[0]))), p = s === 0 ? f ? Qe : A : $e(c.slice(0, s).map((e) => et(t, e[0])));
471
+ o[l] || (o[l] = ot(e, i, u, t, s === c.length - 1 && !!u, {
472
+ engineKey: a,
473
+ dataItemIdx: n,
474
+ id: l,
475
+ parentId: p,
476
+ measureProp: d,
477
+ prop: r
478
+ }));
479
+ });
480
+ });
481
+ let v = m ?? Object.values(o).reduce((e, t) => e + (g.has(t.id) ? 0 : t.value?.value ?? 0), 0), y = h ?? i.totals, b = Object.values(o);
482
+ f && b.unshift({
483
+ id: Qe,
484
+ parentId: A,
485
+ label: "Total",
486
+ row: -1,
487
+ value: u ? {
488
+ label: C(u.formatter?.format, v) ?? "-",
489
+ value: v
490
+ } : null,
491
+ indicator: p?.indicator ?? null,
492
+ customIndicator: tt(v, p),
493
+ ...u ? nt(u, y, [u], e.supportingMeasures) : {}
494
+ }), b.unshift({
495
+ id: A,
496
+ parentId: null,
497
+ label: "Dummy Root",
498
+ row: -1,
499
+ value: null
500
+ });
501
+ let x = ze().id((e) => e.id).parentId((e) => e.parentId)(b);
502
+ return x.sort((e, t) => e.data.row - t.data.row), x.descendants().forEach((t) => {
503
+ if (t.data.id === "__total__") return;
504
+ let r = !1;
505
+ r = t.data.id in n ? n[t.data.id] === !1 : !rt(t, e.treeChartSettings?.initialExpandedLevels, a.length, f), r && (t._children = t.children, t.children = null);
506
+ }), x;
507
+ }
508
+ var ct = ({ vSpec: e, data: t, nodeExpandState: n }) => {
509
+ let r = e.dimensions.filter(s).length, [i, a] = (0, k.useState)(null);
510
+ return (0, k.useEffect)(() => {
511
+ if (r > 0) {
512
+ let r = st(e, t, n.current);
513
+ a(r);
514
+ return;
515
+ }
516
+ let i = it(e, t, n.current);
517
+ a(i);
518
+ }, [
519
+ t,
520
+ e.dimensions,
521
+ e.measures,
522
+ e.supportingMeasures,
523
+ e.treeChartSettings?.nodeExpandState,
524
+ e.totals?.enabled
525
+ ]), i;
526
+ }, lt = {
527
+ svg: "http://www.w3.org/2000/svg",
528
+ xhtml: "http://www.w3.org/1999/xhtml",
529
+ xlink: "http://www.w3.org/1999/xlink",
530
+ xml: "http://www.w3.org/XML/1998/namespace",
531
+ xmlns: "http://www.w3.org/2000/xmlns/"
532
+ };
533
+ function ut(e) {
534
+ var t = e += "", n = t.indexOf(":");
535
+ return n >= 0 && (t = e.slice(0, n)) !== "xmlns" && (e = e.slice(n + 1)), lt.hasOwnProperty(t) ? {
536
+ space: lt[t],
537
+ local: e
538
+ } : e;
539
+ }
540
+ function dt(e) {
541
+ return function() {
542
+ var t = this.ownerDocument, n = this.namespaceURI;
543
+ return n === "http://www.w3.org/1999/xhtml" && t.documentElement.namespaceURI === "http://www.w3.org/1999/xhtml" ? t.createElement(e) : t.createElementNS(n, e);
544
+ };
545
+ }
546
+ function ft(e) {
547
+ return function() {
548
+ return this.ownerDocument.createElementNS(e.space, e.local);
549
+ };
550
+ }
551
+ function pt(e) {
552
+ var t = ut(e);
553
+ return (t.local ? ft : dt)(t);
554
+ }
555
+ function mt() {}
556
+ function ht(e) {
557
+ return e == null ? mt : function() {
558
+ return this.querySelector(e);
559
+ };
560
+ }
561
+ function gt(e) {
562
+ typeof e != "function" && (e = ht(e));
563
+ for (var t = this._groups, n = t.length, r = Array(n), i = 0; i < n; ++i) for (var a = t[i], o = a.length, s = r[i] = Array(o), c, l, u = 0; u < o; ++u) (c = a[u]) && (l = e.call(c, c.__data__, u, a)) && ("__data__" in c && (l.__data__ = c.__data__), s[u] = l);
564
+ return new M(r, this._parents);
565
+ }
566
+ function _t(e) {
567
+ return e == null ? [] : Array.isArray(e) ? e : Array.from(e);
568
+ }
569
+ function vt() {
570
+ return [];
571
+ }
572
+ function yt(e) {
573
+ return e == null ? vt : function() {
574
+ return this.querySelectorAll(e);
575
+ };
576
+ }
577
+ function bt(e) {
578
+ return function() {
579
+ return _t(e.apply(this, arguments));
580
+ };
581
+ }
582
+ function xt(e) {
583
+ e = typeof e == "function" ? bt(e) : yt(e);
584
+ for (var t = this._groups, n = t.length, r = [], i = [], a = 0; a < n; ++a) for (var o = t[a], s = o.length, c, l = 0; l < s; ++l) (c = o[l]) && (r.push(e.call(c, c.__data__, l, o)), i.push(c));
585
+ return new M(r, i);
586
+ }
587
+ function St(e) {
588
+ return function() {
589
+ return this.matches(e);
590
+ };
591
+ }
592
+ function Ct(e) {
593
+ return function(t) {
594
+ return t.matches(e);
595
+ };
596
+ }
597
+ var wt = Array.prototype.find;
598
+ function Tt(e) {
599
+ return function() {
600
+ return wt.call(this.children, e);
601
+ };
602
+ }
603
+ function Et() {
604
+ return this.firstElementChild;
605
+ }
606
+ function Dt(e) {
607
+ return this.select(e == null ? Et : Tt(typeof e == "function" ? e : Ct(e)));
608
+ }
609
+ var Ot = Array.prototype.filter;
610
+ function kt() {
611
+ return Array.from(this.children);
612
+ }
613
+ function At(e) {
614
+ return function() {
615
+ return Ot.call(this.children, e);
616
+ };
617
+ }
618
+ function jt(e) {
619
+ return this.selectAll(e == null ? kt : At(typeof e == "function" ? e : Ct(e)));
620
+ }
621
+ function Mt(e) {
622
+ typeof e != "function" && (e = St(e));
623
+ for (var t = this._groups, n = t.length, r = Array(n), i = 0; i < n; ++i) for (var a = t[i], o = a.length, s = r[i] = [], c, l = 0; l < o; ++l) (c = a[l]) && e.call(c, c.__data__, l, a) && s.push(c);
624
+ return new M(r, this._parents);
625
+ }
626
+ function Nt(e) {
627
+ return Array(e.length);
628
+ }
629
+ function Pt() {
630
+ return new M(this._enter || this._groups.map(Nt), this._parents);
631
+ }
632
+ function Ft(e, t) {
633
+ this.ownerDocument = e.ownerDocument, this.namespaceURI = e.namespaceURI, this._next = null, this._parent = e, this.__data__ = t;
634
+ }
635
+ Ft.prototype = {
636
+ constructor: Ft,
637
+ appendChild: function(e) {
638
+ return this._parent.insertBefore(e, this._next);
639
+ },
640
+ insertBefore: function(e, t) {
641
+ return this._parent.insertBefore(e, t);
642
+ },
643
+ querySelector: function(e) {
644
+ return this._parent.querySelector(e);
645
+ },
646
+ querySelectorAll: function(e) {
647
+ return this._parent.querySelectorAll(e);
648
+ }
649
+ };
650
+ function It(e) {
651
+ return function() {
652
+ return e;
653
+ };
654
+ }
655
+ function Lt(e, t, n, r, i, a) {
656
+ for (var o = 0, s, c = t.length, l = a.length; o < l; ++o) (s = t[o]) ? (s.__data__ = a[o], r[o] = s) : n[o] = new Ft(e, a[o]);
657
+ for (; o < c; ++o) (s = t[o]) && (i[o] = s);
658
+ }
659
+ function Rt(e, t, n, r, i, a, o) {
660
+ var s, c, l = /* @__PURE__ */ new Map(), u = t.length, d = a.length, f = Array(u), p;
661
+ for (s = 0; s < u; ++s) (c = t[s]) && (f[s] = p = o.call(c, c.__data__, s, t) + "", l.has(p) ? i[s] = c : l.set(p, c));
662
+ for (s = 0; s < d; ++s) p = o.call(e, a[s], s, a) + "", (c = l.get(p)) ? (r[s] = c, c.__data__ = a[s], l.delete(p)) : n[s] = new Ft(e, a[s]);
663
+ for (s = 0; s < u; ++s) (c = t[s]) && l.get(f[s]) === c && (i[s] = c);
664
+ }
665
+ function zt(e) {
666
+ return e.__data__;
667
+ }
668
+ function Bt(e, t) {
669
+ if (!arguments.length) return Array.from(this, zt);
670
+ var n = t ? Rt : Lt, r = this._parents, i = this._groups;
671
+ typeof e != "function" && (e = It(e));
672
+ for (var a = i.length, o = Array(a), s = Array(a), c = Array(a), l = 0; l < a; ++l) {
673
+ var u = r[l], d = i[l], f = d.length, p = Vt(e.call(u, u && u.__data__, l, r)), m = p.length, h = s[l] = Array(m), g = o[l] = Array(m);
674
+ n(u, d, h, g, c[l] = Array(f), p, t);
675
+ for (var _ = 0, v = 0, y, b; _ < m; ++_) if (y = h[_]) {
676
+ for (_ >= v && (v = _ + 1); !(b = g[v]) && ++v < m;);
677
+ y._next = b || null;
678
+ }
679
+ }
680
+ return o = new M(o, r), o._enter = s, o._exit = c, o;
681
+ }
682
+ function Vt(e) {
683
+ return typeof e == "object" && "length" in e ? e : Array.from(e);
684
+ }
685
+ function Ht() {
686
+ return new M(this._exit || this._groups.map(Nt), this._parents);
687
+ }
688
+ function Ut(e, t, n) {
689
+ var r = this.enter(), i = this, a = this.exit();
690
+ return typeof e == "function" ? (r = e(r), r &&= r.selection()) : r = r.append(e + ""), t != null && (i = t(i), i &&= i.selection()), n == null ? a.remove() : n(a), r && i ? r.merge(i).order() : i;
691
+ }
692
+ function Wt(e) {
693
+ for (var t = e.selection ? e.selection() : e, n = this._groups, r = t._groups, i = n.length, a = r.length, o = Math.min(i, a), s = Array(i), c = 0; c < o; ++c) for (var l = n[c], u = r[c], d = l.length, f = s[c] = Array(d), p, m = 0; m < d; ++m) (p = l[m] || u[m]) && (f[m] = p);
694
+ for (; c < i; ++c) s[c] = n[c];
695
+ return new M(s, this._parents);
696
+ }
697
+ function Gt() {
698
+ for (var e = this._groups, t = -1, n = e.length; ++t < n;) for (var r = e[t], i = r.length - 1, a = r[i], o; --i >= 0;) (o = r[i]) && (a && o.compareDocumentPosition(a) ^ 4 && a.parentNode.insertBefore(o, a), a = o);
699
+ return this;
700
+ }
701
+ function Kt(e) {
702
+ e ||= qt;
703
+ function t(t, n) {
704
+ return t && n ? e(t.__data__, n.__data__) : !t - !n;
705
+ }
706
+ for (var n = this._groups, r = n.length, i = Array(r), a = 0; a < r; ++a) {
707
+ for (var o = n[a], s = o.length, c = i[a] = Array(s), l, u = 0; u < s; ++u) (l = o[u]) && (c[u] = l);
708
+ c.sort(t);
709
+ }
710
+ return new M(i, this._parents).order();
711
+ }
712
+ function qt(e, t) {
713
+ return e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
714
+ }
715
+ function Jt() {
716
+ var e = arguments[0];
717
+ return arguments[0] = this, e.apply(null, arguments), this;
718
+ }
719
+ function Yt() {
720
+ return Array.from(this);
721
+ }
722
+ function Xt() {
723
+ for (var e = this._groups, t = 0, n = e.length; t < n; ++t) for (var r = e[t], i = 0, a = r.length; i < a; ++i) {
724
+ var o = r[i];
725
+ if (o) return o;
726
+ }
727
+ return null;
728
+ }
729
+ function Zt() {
730
+ let e = 0;
731
+ for (let t of this) ++e;
732
+ return e;
733
+ }
734
+ function Qt() {
735
+ return !this.node();
736
+ }
737
+ function $t(e) {
738
+ for (var t = this._groups, n = 0, r = t.length; n < r; ++n) for (var i = t[n], a = 0, o = i.length, s; a < o; ++a) (s = i[a]) && e.call(s, s.__data__, a, i);
739
+ return this;
740
+ }
741
+ function en(e) {
742
+ return function() {
743
+ this.removeAttribute(e);
744
+ };
745
+ }
746
+ function tn(e) {
747
+ return function() {
748
+ this.removeAttributeNS(e.space, e.local);
749
+ };
750
+ }
751
+ function nn(e, t) {
752
+ return function() {
753
+ this.setAttribute(e, t);
754
+ };
755
+ }
756
+ function rn(e, t) {
757
+ return function() {
758
+ this.setAttributeNS(e.space, e.local, t);
759
+ };
760
+ }
761
+ function an(e, t) {
762
+ return function() {
763
+ var n = t.apply(this, arguments);
764
+ n == null ? this.removeAttribute(e) : this.setAttribute(e, n);
765
+ };
766
+ }
767
+ function on(e, t) {
768
+ return function() {
769
+ var n = t.apply(this, arguments);
770
+ n == null ? this.removeAttributeNS(e.space, e.local) : this.setAttributeNS(e.space, e.local, n);
771
+ };
772
+ }
773
+ function sn(e, t) {
774
+ var n = ut(e);
775
+ if (arguments.length < 2) {
776
+ var r = this.node();
777
+ return n.local ? r.getAttributeNS(n.space, n.local) : r.getAttribute(n);
778
+ }
779
+ return this.each((t == null ? n.local ? tn : en : typeof t == "function" ? n.local ? on : an : n.local ? rn : nn)(n, t));
780
+ }
781
+ function cn(e) {
782
+ return e.ownerDocument && e.ownerDocument.defaultView || e.document && e || e.defaultView;
783
+ }
784
+ function ln(e) {
785
+ return function() {
786
+ this.style.removeProperty(e);
787
+ };
788
+ }
789
+ function un(e, t, n) {
790
+ return function() {
791
+ this.style.setProperty(e, t, n);
792
+ };
793
+ }
794
+ function dn(e, t, n) {
795
+ return function() {
796
+ var r = t.apply(this, arguments);
797
+ r == null ? this.style.removeProperty(e) : this.style.setProperty(e, r, n);
798
+ };
799
+ }
800
+ function fn(e, t, n) {
801
+ return arguments.length > 1 ? this.each((t == null ? ln : typeof t == "function" ? dn : un)(e, t, n ?? "")) : j(this.node(), e);
802
+ }
803
+ function j(e, t) {
804
+ return e.style.getPropertyValue(t) || cn(e).getComputedStyle(e, null).getPropertyValue(t);
805
+ }
806
+ function pn(e) {
807
+ return function() {
808
+ delete this[e];
809
+ };
810
+ }
811
+ function mn(e, t) {
812
+ return function() {
813
+ this[e] = t;
814
+ };
815
+ }
816
+ function hn(e, t) {
817
+ return function() {
818
+ var n = t.apply(this, arguments);
819
+ n == null ? delete this[e] : this[e] = n;
820
+ };
821
+ }
822
+ function gn(e, t) {
823
+ return arguments.length > 1 ? this.each((t == null ? pn : typeof t == "function" ? hn : mn)(e, t)) : this.node()[e];
824
+ }
825
+ function _n(e) {
826
+ return e.trim().split(/^|\s+/);
827
+ }
828
+ function vn(e) {
829
+ return e.classList || new yn(e);
830
+ }
831
+ function yn(e) {
832
+ this._node = e, this._names = _n(e.getAttribute("class") || "");
833
+ }
834
+ yn.prototype = {
835
+ add: function(e) {
836
+ this._names.indexOf(e) < 0 && (this._names.push(e), this._node.setAttribute("class", this._names.join(" ")));
837
+ },
838
+ remove: function(e) {
839
+ var t = this._names.indexOf(e);
840
+ t >= 0 && (this._names.splice(t, 1), this._node.setAttribute("class", this._names.join(" ")));
841
+ },
842
+ contains: function(e) {
843
+ return this._names.indexOf(e) >= 0;
844
+ }
845
+ };
846
+ function bn(e, t) {
847
+ for (var n = vn(e), r = -1, i = t.length; ++r < i;) n.add(t[r]);
848
+ }
849
+ function xn(e, t) {
850
+ for (var n = vn(e), r = -1, i = t.length; ++r < i;) n.remove(t[r]);
851
+ }
852
+ function Sn(e) {
853
+ return function() {
854
+ bn(this, e);
855
+ };
856
+ }
857
+ function Cn(e) {
858
+ return function() {
859
+ xn(this, e);
860
+ };
861
+ }
862
+ function wn(e, t) {
863
+ return function() {
864
+ (t.apply(this, arguments) ? bn : xn)(this, e);
865
+ };
866
+ }
867
+ function Tn(e, t) {
868
+ var n = _n(e + "");
869
+ if (arguments.length < 2) {
870
+ for (var r = vn(this.node()), i = -1, a = n.length; ++i < a;) if (!r.contains(n[i])) return !1;
871
+ return !0;
872
+ }
873
+ return this.each((typeof t == "function" ? wn : t ? Sn : Cn)(n, t));
874
+ }
875
+ function En() {
876
+ this.textContent = "";
877
+ }
878
+ function Dn(e) {
879
+ return function() {
880
+ this.textContent = e;
881
+ };
882
+ }
883
+ function On(e) {
884
+ return function() {
885
+ var t = e.apply(this, arguments);
886
+ this.textContent = t ?? "";
887
+ };
888
+ }
889
+ function kn(e) {
890
+ return arguments.length ? this.each(e == null ? En : (typeof e == "function" ? On : Dn)(e)) : this.node().textContent;
891
+ }
892
+ function An() {
893
+ this.innerHTML = "";
894
+ }
895
+ function jn(e) {
896
+ return function() {
897
+ this.innerHTML = e;
898
+ };
899
+ }
900
+ function Mn(e) {
901
+ return function() {
902
+ var t = e.apply(this, arguments);
903
+ this.innerHTML = t ?? "";
904
+ };
905
+ }
906
+ function Nn(e) {
907
+ return arguments.length ? this.each(e == null ? An : (typeof e == "function" ? Mn : jn)(e)) : this.node().innerHTML;
908
+ }
909
+ function Pn() {
910
+ this.nextSibling && this.parentNode.appendChild(this);
911
+ }
912
+ function Fn() {
913
+ return this.each(Pn);
914
+ }
915
+ function In() {
916
+ this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
917
+ }
918
+ function Ln() {
919
+ return this.each(In);
920
+ }
921
+ function Rn(e) {
922
+ var t = typeof e == "function" ? e : pt(e);
923
+ return this.select(function() {
924
+ return this.appendChild(t.apply(this, arguments));
925
+ });
926
+ }
927
+ function zn() {
928
+ return null;
929
+ }
930
+ function Bn(e, t) {
931
+ var n = typeof e == "function" ? e : pt(e), r = t == null ? zn : typeof t == "function" ? t : ht(t);
932
+ return this.select(function() {
933
+ return this.insertBefore(n.apply(this, arguments), r.apply(this, arguments) || null);
934
+ });
935
+ }
936
+ function Vn() {
937
+ var e = this.parentNode;
938
+ e && e.removeChild(this);
939
+ }
940
+ function Hn() {
941
+ return this.each(Vn);
942
+ }
943
+ function Un() {
944
+ var e = this.cloneNode(!1), t = this.parentNode;
945
+ return t ? t.insertBefore(e, this.nextSibling) : e;
946
+ }
947
+ function Wn() {
948
+ var e = this.cloneNode(!0), t = this.parentNode;
949
+ return t ? t.insertBefore(e, this.nextSibling) : e;
950
+ }
951
+ function Gn(e) {
952
+ return this.select(e ? Wn : Un);
953
+ }
954
+ function Kn(e) {
955
+ return arguments.length ? this.property("__data__", e) : this.node().__data__;
956
+ }
957
+ function qn(e) {
958
+ return function(t) {
959
+ e.call(this, t, this.__data__);
960
+ };
961
+ }
962
+ function Jn(e) {
963
+ return e.trim().split(/^|\s+/).map(function(e) {
964
+ var t = "", n = e.indexOf(".");
965
+ return n >= 0 && (t = e.slice(n + 1), e = e.slice(0, n)), {
966
+ type: e,
967
+ name: t
968
+ };
969
+ });
970
+ }
971
+ function Yn(e) {
972
+ return function() {
973
+ var t = this.__on;
974
+ if (t) {
975
+ for (var n = 0, r = -1, i = t.length, a; n < i; ++n) a = t[n], (!e.type || a.type === e.type) && a.name === e.name ? this.removeEventListener(a.type, a.listener, a.options) : t[++r] = a;
976
+ ++r ? t.length = r : delete this.__on;
977
+ }
978
+ };
979
+ }
980
+ function Xn(e, t, n) {
981
+ return function() {
982
+ var r = this.__on, i, a = qn(t);
983
+ if (r) {
984
+ for (var o = 0, s = r.length; o < s; ++o) if ((i = r[o]).type === e.type && i.name === e.name) {
985
+ this.removeEventListener(i.type, i.listener, i.options), this.addEventListener(i.type, i.listener = a, i.options = n), i.value = t;
986
+ return;
987
+ }
988
+ }
989
+ this.addEventListener(e.type, a, n), i = {
990
+ type: e.type,
991
+ name: e.name,
992
+ value: t,
993
+ listener: a,
994
+ options: n
995
+ }, r ? r.push(i) : this.__on = [i];
996
+ };
997
+ }
998
+ function Zn(e, t, n) {
999
+ var r = Jn(e + ""), i, a = r.length, o;
1000
+ if (arguments.length < 2) {
1001
+ var s = this.node().__on;
1002
+ if (s) {
1003
+ for (var c = 0, l = s.length, u; c < l; ++c) for (i = 0, u = s[c]; i < a; ++i) if ((o = r[i]).type === u.type && o.name === u.name) return u.value;
1004
+ }
1005
+ return;
1006
+ }
1007
+ for (s = t ? Xn : Yn, i = 0; i < a; ++i) this.each(s(r[i], t, n));
1008
+ return this;
1009
+ }
1010
+ function Qn(e, t, n) {
1011
+ var r = cn(e), i = r.CustomEvent;
1012
+ typeof i == "function" ? i = new i(t, n) : (i = r.document.createEvent("Event"), n ? (i.initEvent(t, n.bubbles, n.cancelable), i.detail = n.detail) : i.initEvent(t, !1, !1)), e.dispatchEvent(i);
1013
+ }
1014
+ function $n(e, t) {
1015
+ return function() {
1016
+ return Qn(this, e, t);
1017
+ };
1018
+ }
1019
+ function er(e, t) {
1020
+ return function() {
1021
+ return Qn(this, e, t.apply(this, arguments));
1022
+ };
1023
+ }
1024
+ function tr(e, t) {
1025
+ return this.each((typeof t == "function" ? er : $n)(e, t));
1026
+ }
1027
+ function* nr() {
1028
+ for (var e = this._groups, t = 0, n = e.length; t < n; ++t) for (var r = e[t], i = 0, a = r.length, o; i < a; ++i) (o = r[i]) && (yield o);
1029
+ }
1030
+ var rr = [null];
1031
+ function M(e, t) {
1032
+ this._groups = e, this._parents = t;
1033
+ }
1034
+ function N() {
1035
+ return new M([[document.documentElement]], rr);
1036
+ }
1037
+ function ir() {
1038
+ return this;
1039
+ }
1040
+ M.prototype = N.prototype = {
1041
+ constructor: M,
1042
+ select: gt,
1043
+ selectAll: xt,
1044
+ selectChild: Dt,
1045
+ selectChildren: jt,
1046
+ filter: Mt,
1047
+ data: Bt,
1048
+ enter: Pt,
1049
+ exit: Ht,
1050
+ join: Ut,
1051
+ merge: Wt,
1052
+ selection: ir,
1053
+ order: Gt,
1054
+ sort: Kt,
1055
+ call: Jt,
1056
+ nodes: Yt,
1057
+ node: Xt,
1058
+ size: Zt,
1059
+ empty: Qt,
1060
+ each: $t,
1061
+ attr: sn,
1062
+ style: fn,
1063
+ property: gn,
1064
+ classed: Tn,
1065
+ text: kn,
1066
+ html: Nn,
1067
+ raise: Fn,
1068
+ lower: Ln,
1069
+ append: Rn,
1070
+ insert: Bn,
1071
+ remove: Hn,
1072
+ clone: Gn,
1073
+ datum: Kn,
1074
+ on: Zn,
1075
+ dispatch: tr,
1076
+ [Symbol.iterator]: nr
1077
+ };
1078
+ function P(e) {
1079
+ return typeof e == "string" ? new M([[document.querySelector(e)]], [document.documentElement]) : new M([[e]], rr);
1080
+ }
1081
+ function ar(e) {
1082
+ let t;
1083
+ for (; t = e.sourceEvent;) e = t;
1084
+ return e;
1085
+ }
1086
+ function F(e, t) {
1087
+ if (e = ar(e), t === void 0 && (t = e.currentTarget), t) {
1088
+ var n = t.ownerSVGElement || t;
1089
+ if (n.createSVGPoint) {
1090
+ var r = n.createSVGPoint();
1091
+ return r.x = e.clientX, r.y = e.clientY, r = r.matrixTransform(t.getScreenCTM().inverse()), [r.x, r.y];
1092
+ }
1093
+ if (t.getBoundingClientRect) {
1094
+ var i = t.getBoundingClientRect();
1095
+ return [e.clientX - i.left - t.clientLeft, e.clientY - i.top - t.clientTop];
1096
+ }
1097
+ }
1098
+ return [e.pageX, e.pageY];
1099
+ }
1100
+ function or(e) {
1101
+ return typeof e == "string" ? new M([document.querySelectorAll(e)], [document.documentElement]) : new M([_t(e)], rr);
1102
+ }
1103
+ var sr = /* @__PURE__ */ e(ne()), I = n[a.KPIChange], L = I.slots, cr = "#577f56", lr = "#9e4d53", R = (e) => typeof e == "number" && Number.isFinite(e), ur = (e, t) => {
1104
+ let n = new sr.default(e);
1105
+ return (new sr.default(t).isLight() ? n.lighten(.5).alpha(.5) : n.darken(.5).alpha(.5)).rgb().string();
1106
+ }, dr = (e, t) => {
1107
+ if (!e.enabled) return "";
1108
+ let n = R(e.value) ? e.value : null, r = n === null ? "" : n < 0 ? "negative" : "positive", i = "", a = "";
1109
+ if (e.indicator === "inverse") r = r === "negative" ? "positive" : "negative";
1110
+ else if (e.indicator === "none") r = "";
1111
+ else if (e.indicator === "custom") {
1112
+ r = "";
1113
+ let n = e.customIndicator?.color ? ur(e.customIndicator.color, t) : "inherit";
1114
+ i = `color: ${e.customIndicator?.color ?? "inherit"}; background-color: ${n};`, e.customIndicator?.icon && (a = `<span class="footer-icon">${_.sanitize(e.customIndicator.icon)}</span>`);
1115
+ }
1116
+ return `<div class="footer ${r}" style="${i}"><span class="footer-label">${_.sanitize(e.label)}</span>${a}</div>`;
1117
+ }, fr = (e, t) => {
1118
+ if (!e.enabled) return "";
1119
+ let n = e.indicator, r = R(e.value) ? e.value : null, i = r === null ? "neutral" : r < 0 ? "negative" : "positive", a = "", o = r === null ? "" : r < 0 ? "arrow_downward" : "arrow_upward";
1120
+ if (n === "inverse") i = i === "negative" ? "positive" : "negative";
1121
+ else if (n === "none") i = "", o = void 0;
1122
+ else if (n === "custom") {
1123
+ i = "";
1124
+ let n = e.customIndicator?.color ? ur(e.customIndicator.color, t) : "inherit";
1125
+ a = `color: ${e.customIndicator?.color ?? "inherit"}; background-color: ${n};`, o = e.customIndicator?.icon;
1126
+ }
1127
+ let s = o ? `<span class="pill-icon">${_.sanitize(o)}</span>` : "";
1128
+ return `<div class="pill ${i}" style="${a}"><span class="pill-label">${_.sanitize(e.label)}</span>${s}</div>`;
1129
+ }, pr = (e, t) => {
1130
+ let n = e.value ?? {
1131
+ label: "-",
1132
+ value: null,
1133
+ enabled: !1
1134
+ }, r = "", i = "";
1135
+ return e.indicator === "custom" && (e.customIndicator?.color && (r = `color: ${e.customIndicator.color};`), e.customIndicator?.icon && (i = `<span class="value-icon">${_.sanitize(e.customIndicator.icon)}</span>`)), `<div class="value ${t ? "value-space" : ""}" style="${r}"><span class="value-label">${_.sanitize(n.label)}</span>${i}</div>`;
1136
+ }, mr = (e, t) => {
1137
+ let n = e.data.diff ?? L.diff.defaults, r = e.data.change ?? L.change.defaults, i = t.config.nodeDefaultBackground ?? "#ffffff", a = pr(e.data, !r.enabled), o = dr(n, i), s = fr(r, i), c = [];
1138
+ return e.data._upToTheRootHighlighted && c.push("node-highlight"), `
1139
+ <div class="node-content layout-a ${c.join(" ")}">
1140
+ <div class="label">${_.sanitize(e.data.label)}</div>
1141
+ <div class="flex-row">
1142
+ ${a}
1143
+ ${s}
1144
+ </div>
1145
+ ${o}
1146
+
1147
+ </div>
1148
+ `;
1149
+ }, hr = ({ node: e, config: t }) => e.data?.id === "__root__" ? null : `<div class="button-content"> ${{
1150
+ left: (e) => e ? "◀" : "▶",
1151
+ bottom: (e) => e ? "▼" : "▲",
1152
+ right: (e) => e ? "▶" : "◀",
1153
+ top: (e) => e ? "▲" : "▼"
1154
+ }[t.layout](e.children)} </div>`;
1155
+ function gr(e) {
1156
+ if (e.data._upToTheRootHighlighted) {
1157
+ P(this).style("stroke-width", "var(--border-hover-width)").style("stroke", "var(--border-hover-color)");
1158
+ return;
1159
+ }
1160
+ if (!e.data.diff?.enabled) {
1161
+ P(this).style("stroke-width", null).style("stroke", null);
1162
+ return;
1163
+ }
1164
+ let t = (R(e.data.diff?.value) ? e.data.diff.value : null) ?? (R(L.diff.defaults.value) ? L.diff.defaults.value : 0), n = e.parent?.children?.flatMap((t) => t.id === e.id || !t.data.diff?.enabled || !R(t.data.diff?.value) ? [] : [Math.abs(t.data.diff.value)]) ?? [], r = n.length ? Math.max(...n) : 0, i = Math.abs(t) > r, a = t < 0, o = a ? lr : cr, s = e.data.diff?.indicator;
1165
+ s === "inverse" ? o = a ? cr : lr : s === "none" ? o = "var(--link-color)" : s === "custom" && (o = e.data.diff?.customIndicator?.color ?? "var(--link-color)");
1166
+ let c = i ? 2 : 1;
1167
+ P(this).style("stroke", o).style("stroke-width", c);
1168
+ }
1169
+ var _r = (e, t) => {
1170
+ let n = {
1171
+ ...I.labelStyle,
1172
+ ...t.treeChartSettings.nodeLayout?.labelStyle
1173
+ }, r = {
1174
+ ...I.valueStyle,
1175
+ ...t.treeChartSettings.nodeLayout?.valueStyle
1176
+ }, i = {
1177
+ ...L.change.styling,
1178
+ ...L.change.styling.fontStyle,
1179
+ ...t.treeChartSettings.nodeLayout?.slots?.change
1180
+ }, a = {
1181
+ ...L.diff.styling,
1182
+ ...L.diff.styling.fontStyle,
1183
+ ...t.treeChartSettings.nodeLayout?.slots?.diff
1184
+ };
1185
+ return `
1186
+ #${e} {
1187
+ .layout-a {
1188
+ padding: 8px 8px 0px 8px;
1189
+ display: grid;
1190
+ grid-template-rows: min-content 1fr min-content;
1191
+ grid-row-gap: 8px;
1192
+ justify-content: stretch;
1193
+
1194
+ .flex-row {
1195
+ display: flex;
1196
+ flex-direction: row;
1197
+ align-items: center;
1198
+ justify-content: space-between;
1199
+ gap: 4px;
1200
+ overflow: hidden;
1201
+ }
1202
+
1203
+ .label {
1204
+ font-family: ${n.fontFamily ?? "inherit"};
1205
+ font-size: ${n.fontSize}px;
1206
+ font-weight: ${n.weight ?? (n.bold ? "bold" : "normal")};
1207
+ font-style: ${n.italic ? "italic" : "normal"};
1208
+ text-decoration: ${n.underlined ? "underline" : ""} ${n.strikethrough ? "line-through" : ""};
1209
+ color: ${n.fontColor ?? "inherit"};
1210
+ overflow: hidden;
1211
+ text-overflow: ellipsis;
1212
+ white-space: nowrap;
1213
+ line-height: 1;
1214
+ }
1215
+
1216
+ .value {
1217
+ font-family: ${r.fontFamily ?? "inherit"};
1218
+ font-size: ${r.fontSize}px;
1219
+ font-weight: ${r.weight ?? (r.bold ? "bold" : "normal")};
1220
+ font-style: ${r.italic ? "italic" : "normal"};
1221
+ text-decoration: ${r.underlined ? "underline" : ""} ${r.strikethrough ? "line-through" : ""};
1222
+ color: ${r.fontColor ?? "inherit"};
1223
+ flex: 1 1 auto;
1224
+ overflow: hidden;
1225
+ text-overflow: ellipsis;
1226
+ line-height: 1;
1227
+ display: flex;
1228
+ align-items: center;
1229
+ justify-content: flex-start;
1230
+ }
1231
+
1232
+ .value-space {
1233
+ justify-content: space-between;
1234
+ }
1235
+
1236
+ .value-label {
1237
+ overflow: hidden;
1238
+ text-overflow: ellipsis;
1239
+ }
1240
+
1241
+ .value-icon {
1242
+ font-family: 'Material Icons';
1243
+ vertical-align: middle;
1244
+ display: inline-block;
1245
+ margin-left: 4px;
1246
+ }
1247
+
1248
+ .pill {
1249
+ font-family: ${i.fontFamily ?? "inherit"};
1250
+ font-size: ${i.fontSize}px;
1251
+ font-weight: ${i.weight ?? (i.bold ? "bold" : "normal")};
1252
+ font-style: ${i.italic ? "italic" : "normal"};
1253
+ text-decoration: ${i.underlined ? "underline" : ""} ${i.strikethrough ? "line-through" : ""};
1254
+ padding: 3px 6px;
1255
+ border-radius: 4px;
1256
+ flex: 0 1 auto;
1257
+ overflow: hidden;
1258
+ text-overflow: ellipsis;
1259
+ display: flex;
1260
+ align-items: center;
1261
+ justify-content: center;
1262
+
1263
+ &.neutral {
1264
+ background-color: #eee;
1265
+ }
1266
+
1267
+ .pill-label {
1268
+ overflow: hidden;
1269
+ text-overflow: ellipsis;
1270
+ }
1271
+
1272
+ .pill-icon {
1273
+ font-family: 'Material Icons';
1274
+ flex: 1 0 auto;
1275
+ margin-left: 4px;
1276
+ }
1277
+ }
1278
+
1279
+ .footer {
1280
+ font-family: ${a.fontFamily ?? "inherit"};
1281
+ font-size: ${a.fontSize}px;
1282
+ font-weight: ${a.weight ?? (a.bold ? "bold" : "normal")};
1283
+ font-style: ${a.italic ? "italic" : "normal"};
1284
+ text-decoration: ${a.underlined ? "underline" : ""} ${a.strikethrough ? "line-through" : ""};
1285
+ overflow: hidden;
1286
+ width: calc(100% + 16px);
1287
+ padding: 8px;
1288
+ border-radius: 0px 0px calc(var(--border-radius) - var(--border-width)) calc(var(--border-radius) - var(--border-width));
1289
+ left: -8px;
1290
+ position: relative;
1291
+ line-height: 1;
1292
+ display: flex;
1293
+ align-items: center;
1294
+ justify-content: space-between;
1295
+ }
1296
+
1297
+ .footer-label {
1298
+ overflow: hidden;
1299
+ text-overflow: ellipsis;
1300
+ }
1301
+
1302
+ .footer-icon {
1303
+ font-family: 'Material Icons';
1304
+ font-size: ${a.fontSize}px;
1305
+ vertical-align: middle;
1306
+ display: inline-block;
1307
+ margin-left: 4px;
1308
+ }
1309
+
1310
+ .positive {
1311
+ color: ${cr};
1312
+ background-color: #e4fae8;
1313
+ }
1314
+
1315
+ .negative {
1316
+ color: ${lr};
1317
+ background-color: #fcecec;
1318
+ }
1319
+ }
1320
+ }`;
1321
+ }, vr = {
1322
+ name: "KPI Change",
1323
+ ...I,
1324
+ getNodeContent: mr,
1325
+ getButtonContent: hr,
1326
+ linkUpdate: gr,
1327
+ getCSS: _r,
1328
+ width: 180,
1329
+ sizes: (e) => {
1330
+ let t = {
1331
+ ...L.diff.styling,
1332
+ ...L.diff.styling.fontStyle,
1333
+ ...e.treeChartSettings.nodeLayout?.slots?.diff
1334
+ }, n = {
1335
+ ...I.labelStyle,
1336
+ ...e.treeChartSettings.nodeLayout?.labelStyle
1337
+ }, r = {
1338
+ ...I.valueStyle,
1339
+ ...e.treeChartSettings.nodeLayout?.valueStyle
1340
+ };
1341
+ return {
1342
+ label: Math.ceil(D(n.fontSize)) + 8,
1343
+ value: Math.ceil(D(r.fontSize)) + 8,
1344
+ diff: Math.ceil(D(t.fontSize)) + 16
1345
+ };
1346
+ },
1347
+ height: (e, t) => {
1348
+ let n = 20;
1349
+ return n += t?.label ?? 0, n += t?.value ?? 0, (e.data.diff ?? L.diff.defaults)?.enabled && (n += t?.diff ?? 0), n;
1350
+ }
1351
+ }, z = n[a.Basic], yr = (e) => {
1352
+ if (e.id === "__root__") return null;
1353
+ let t = "", n = "";
1354
+ e.data.indicator === "custom" && (e.data.customIndicator?.color && (t = `color: ${e.data.customIndicator.color};`), e.data.customIndicator?.icon && (n = `<span class="value-icon">${_.sanitize(e.data.customIndicator.icon)}</span>`));
1355
+ let r = e.data.value ? `<div class="value" style="${t}"><span class="value-label">${_.sanitize(e.data.value.label)}</span>${n}</div>` : "", i = [];
1356
+ return e.data._upToTheRootHighlighted && i.push("node-highlight"), `
1357
+ <div class="node-content layout-b ${i.join(" ")}">
1358
+ <div class="label">${_.sanitize(e.data.label)}</div>
1359
+ ${r}
1360
+ </div>`;
1361
+ }, br = (e, t) => {
1362
+ let n = {
1363
+ ...z.labelStyle,
1364
+ ...t.treeChartSettings.nodeLayout?.labelStyle
1365
+ }, r = {
1366
+ ...z.valueStyle,
1367
+ ...t.treeChartSettings.nodeLayout?.valueStyle
1368
+ };
1369
+ return `
1370
+ #${e} {
1371
+ .layout-b {
1372
+ padding: 4px;
1373
+ display: flex;
1374
+ align-items: center;
1375
+ justify-content: center;
1376
+ flex-direction: column;
1377
+ gap: 8px;
1378
+
1379
+ .label {
1380
+ font-family: ${n.fontFamily ?? "inherit"};
1381
+ font-size: ${n.fontSize}px;
1382
+ font-weight: ${n.weight ?? (n.bold ? "bold" : "normal")};
1383
+ font-style: ${n.italic ? "italic" : "normal"};
1384
+ text-decoration: ${n.underlined ? "underline" : ""} ${n.strikethrough ? "line-through" : ""};
1385
+ color: ${n.fontColor ?? "inherit"};
1386
+ overflow: hidden;
1387
+ text-overflow: ellipsis;
1388
+ white-space: nowrap;
1389
+ max-width: 100%;
1390
+ }
1391
+ .value {
1392
+ font-family: ${r.fontFamily ?? "inherit"};
1393
+ font-size: ${r.fontSize}px;
1394
+ font-weight: ${r.weight ?? (r.bold ? "bold" : "normal")};
1395
+ font-style: ${r.italic ? "italic" : "normal"};
1396
+ color: ${r.fontColor ?? "inherit"};
1397
+ overflow: hidden;
1398
+ text-overflow: ellipsis;
1399
+ white-space: nowrap;
1400
+ max-width: 100%;
1401
+ }
1402
+
1403
+ .value-icon {
1404
+ font-family: 'Material Icons';
1405
+ vertical-align: middle;
1406
+ display: inline-block;
1407
+ margin-left: 4px;
1408
+ }
1409
+ }
1410
+ }`;
1411
+ }, xr = {
1412
+ name: "Basic",
1413
+ ...z,
1414
+ getNodeContent: yr,
1415
+ getCSS: br,
1416
+ width: 140,
1417
+ sizes: (e) => {
1418
+ let t = {
1419
+ ...z.labelStyle,
1420
+ ...e.treeChartSettings.nodeLayout?.labelStyle
1421
+ }, n = {
1422
+ ...z.valueStyle,
1423
+ ...e.treeChartSettings.nodeLayout?.valueStyle
1424
+ };
1425
+ return {
1426
+ label: D(t.fontSize) + 8,
1427
+ value: D(n.fontSize) + 8
1428
+ };
1429
+ },
1430
+ height: (e, t) => {
1431
+ let n = 8 + t.label;
1432
+ return e.data.value && (n += 8 + t.value), n;
1433
+ }
1434
+ }, Sr = {
1435
+ [a.KPIChange]: vr,
1436
+ [a.Basic]: xr
1437
+ }, Cr = { passive: !1 }, B = {
1438
+ capture: !0,
1439
+ passive: !1
1440
+ };
1441
+ function wr(e) {
1442
+ e.stopImmediatePropagation();
1443
+ }
1444
+ function V(e) {
1445
+ e.preventDefault(), e.stopImmediatePropagation();
1446
+ }
1447
+ function Tr(e) {
1448
+ var t = e.document.documentElement, n = P(e).on("dragstart.drag", V, B);
1449
+ "onselectstart" in t ? n.on("selectstart.drag", V, B) : (t.__noselect = t.style.MozUserSelect, t.style.MozUserSelect = "none");
1450
+ }
1451
+ function Er(e, t) {
1452
+ var n = e.document.documentElement, r = P(e).on("dragstart.drag", null);
1453
+ t && (r.on("click.drag", V, B), setTimeout(function() {
1454
+ r.on("click.drag", null);
1455
+ }, 0)), "onselectstart" in n ? r.on("selectstart.drag", null) : (n.style.MozUserSelect = n.__noselect, delete n.__noselect);
1456
+ }
1457
+ var Dr = (e) => () => e;
1458
+ function Or(e, { sourceEvent: t, subject: n, target: r, identifier: i, active: a, x: o, y: s, dx: c, dy: l, dispatch: u }) {
1459
+ Object.defineProperties(this, {
1460
+ type: {
1461
+ value: e,
1462
+ enumerable: !0,
1463
+ configurable: !0
1464
+ },
1465
+ sourceEvent: {
1466
+ value: t,
1467
+ enumerable: !0,
1468
+ configurable: !0
1469
+ },
1470
+ subject: {
1471
+ value: n,
1472
+ enumerable: !0,
1473
+ configurable: !0
1474
+ },
1475
+ target: {
1476
+ value: r,
1477
+ enumerable: !0,
1478
+ configurable: !0
1479
+ },
1480
+ identifier: {
1481
+ value: i,
1482
+ enumerable: !0,
1483
+ configurable: !0
1484
+ },
1485
+ active: {
1486
+ value: a,
1487
+ enumerable: !0,
1488
+ configurable: !0
1489
+ },
1490
+ x: {
1491
+ value: o,
1492
+ enumerable: !0,
1493
+ configurable: !0
1494
+ },
1495
+ y: {
1496
+ value: s,
1497
+ enumerable: !0,
1498
+ configurable: !0
1499
+ },
1500
+ dx: {
1501
+ value: c,
1502
+ enumerable: !0,
1503
+ configurable: !0
1504
+ },
1505
+ dy: {
1506
+ value: l,
1507
+ enumerable: !0,
1508
+ configurable: !0
1509
+ },
1510
+ _: { value: u }
1511
+ });
1512
+ }
1513
+ Or.prototype.on = function() {
1514
+ var e = this._.on.apply(this._, arguments);
1515
+ return e === this._ ? this : e;
1516
+ }, Me();
1517
+ function kr(e) {
1518
+ return !e.ctrlKey && !e.button;
1519
+ }
1520
+ function Ar() {
1521
+ return this.parentNode;
1522
+ }
1523
+ function jr(e, t) {
1524
+ return t ?? {
1525
+ x: e.x,
1526
+ y: e.y
1527
+ };
1528
+ }
1529
+ function Mr() {
1530
+ return navigator.maxTouchPoints || "ontouchstart" in this;
1531
+ }
1532
+ function Nr() {
1533
+ var e = kr, t = Ar, n = jr, r = Mr, i = {}, a = je("start", "drag", "end"), o = 0, s, c, l, u, d = 0;
1534
+ function f(e) {
1535
+ e.on("mousedown.drag", p).filter(r).on("touchstart.drag", g).on("touchmove.drag", _, Cr).on("touchend.drag touchcancel.drag", v).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
1536
+ }
1537
+ function p(n, r) {
1538
+ if (!(u || !e.call(this, n, r))) {
1539
+ var i = y(this, t.call(this, n, r), n, r, "mouse");
1540
+ i && (P(n.view).on("mousemove.drag", m, B).on("mouseup.drag", h, B), Tr(n.view), wr(n), l = !1, s = n.clientX, c = n.clientY, i("start", n));
1541
+ }
1542
+ }
1543
+ function m(e) {
1544
+ if (V(e), !l) {
1545
+ var t = e.clientX - s, n = e.clientY - c;
1546
+ l = t * t + n * n > d;
1547
+ }
1548
+ i.mouse("drag", e);
1549
+ }
1550
+ function h(e) {
1551
+ P(e.view).on("mousemove.drag mouseup.drag", null), Er(e.view, l), V(e), i.mouse("end", e);
1552
+ }
1553
+ function g(n, r) {
1554
+ if (e.call(this, n, r)) {
1555
+ var i = n.changedTouches, a = t.call(this, n, r), o = i.length, s, c;
1556
+ for (s = 0; s < o; ++s) (c = y(this, a, n, r, i[s].identifier, i[s])) && (wr(n), c("start", n, i[s]));
1557
+ }
1558
+ }
1559
+ function _(e) {
1560
+ var t = e.changedTouches, n = t.length, r, a;
1561
+ for (r = 0; r < n; ++r) (a = i[t[r].identifier]) && (V(e), a("drag", e, t[r]));
1562
+ }
1563
+ function v(e) {
1564
+ var t = e.changedTouches, n = t.length, r, a;
1565
+ for (u && clearTimeout(u), u = setTimeout(function() {
1566
+ u = null;
1567
+ }, 500), r = 0; r < n; ++r) (a = i[t[r].identifier]) && (wr(e), a("end", e, t[r]));
1568
+ }
1569
+ function y(e, t, r, s, c, l) {
1570
+ var u = a.copy(), d = F(l || r, t), p, m, h;
1571
+ if ((h = n.call(e, new Or("beforestart", {
1572
+ sourceEvent: r,
1573
+ target: f,
1574
+ identifier: c,
1575
+ active: o,
1576
+ x: d[0],
1577
+ y: d[1],
1578
+ dx: 0,
1579
+ dy: 0,
1580
+ dispatch: u
1581
+ }), s)) != null) return p = h.x - d[0] || 0, m = h.y - d[1] || 0, function n(r, a, l) {
1582
+ var g = d, _;
1583
+ switch (r) {
1584
+ case "start":
1585
+ i[c] = n, _ = o++;
1586
+ break;
1587
+ case "end": delete i[c], --o;
1588
+ case "drag":
1589
+ d = F(l || a, t), _ = o;
1590
+ break;
1591
+ }
1592
+ u.call(r, e, new Or(r, {
1593
+ sourceEvent: a,
1594
+ subject: h,
1595
+ target: f,
1596
+ identifier: c,
1597
+ active: _,
1598
+ x: d[0] + p,
1599
+ y: d[1] + m,
1600
+ dx: d[0] - g[0],
1601
+ dy: d[1] - g[1],
1602
+ dispatch: u
1603
+ }), s);
1604
+ };
1605
+ }
1606
+ return f.filter = function(t) {
1607
+ return arguments.length ? (e = typeof t == "function" ? t : Dr(!!t), f) : e;
1608
+ }, f.container = function(e) {
1609
+ return arguments.length ? (t = typeof e == "function" ? e : Dr(e), f) : t;
1610
+ }, f.subject = function(e) {
1611
+ return arguments.length ? (n = typeof e == "function" ? e : Dr(e), f) : n;
1612
+ }, f.touchable = function(e) {
1613
+ return arguments.length ? (r = typeof e == "function" ? e : Dr(!!e), f) : r;
1614
+ }, f.on = function() {
1615
+ var e = a.on.apply(a, arguments);
1616
+ return e === a ? f : e;
1617
+ }, f.clickDistance = function(e) {
1618
+ return arguments.length ? (d = (e = +e) * e, f) : Math.sqrt(d);
1619
+ }, f;
1620
+ }
1621
+ var H = 0, Pr = 0, Fr = 0, Ir = 1e3, Lr, U, Rr = 0, W = 0, zr = 0, G = typeof performance == "object" && performance.now ? performance : Date, Br = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(e) {
1622
+ setTimeout(e, 17);
1623
+ };
1624
+ function Vr() {
1625
+ return W ||= (Br(Hr), G.now() + zr);
1626
+ }
1627
+ function Hr() {
1628
+ W = 0;
1629
+ }
1630
+ function Ur() {
1631
+ this._call = this._time = this._next = null;
1632
+ }
1633
+ Ur.prototype = Wr.prototype = {
1634
+ constructor: Ur,
1635
+ restart: function(e, t, n) {
1636
+ if (typeof e != "function") throw TypeError("callback is not a function");
1637
+ n = (n == null ? Vr() : +n) + (t == null ? 0 : +t), !this._next && U !== this && (U ? U._next = this : Lr = this, U = this), this._call = e, this._time = n, Yr();
1638
+ },
1639
+ stop: function() {
1640
+ this._call && (this._call = null, this._time = Infinity, Yr());
1641
+ }
1642
+ };
1643
+ function Wr(e, t, n) {
1644
+ var r = new Ur();
1645
+ return r.restart(e, t, n), r;
1646
+ }
1647
+ function Gr() {
1648
+ Vr(), ++H;
1649
+ for (var e = Lr, t; e;) (t = W - e._time) >= 0 && e._call.call(void 0, t), e = e._next;
1650
+ --H;
1651
+ }
1652
+ function Kr() {
1653
+ W = (Rr = G.now()) + zr, H = Pr = 0;
1654
+ try {
1655
+ Gr();
1656
+ } finally {
1657
+ H = 0, Jr(), W = 0;
1658
+ }
1659
+ }
1660
+ function qr() {
1661
+ var e = G.now(), t = e - Rr;
1662
+ t > Ir && (zr -= t, Rr = e);
1663
+ }
1664
+ function Jr() {
1665
+ for (var e, t = Lr, n, r = Infinity; t;) t._call ? (r > t._time && (r = t._time), e = t, t = t._next) : (n = t._next, t._next = null, t = e ? e._next = n : Lr = n);
1666
+ U = e, Yr(r);
1667
+ }
1668
+ function Yr(e) {
1669
+ H || (Pr &&= clearTimeout(Pr), e - W > 24 ? (e < Infinity && (Pr = setTimeout(Kr, e - G.now() - zr)), Fr &&= clearInterval(Fr)) : (Fr ||= (Rr = G.now(), setInterval(qr, Ir)), H = 1, Br(Kr)));
1670
+ }
1671
+ function Xr(e, t, n) {
1672
+ var r = new Ur();
1673
+ return t = t == null ? 0 : +t, r.restart((n) => {
1674
+ r.stop(), e(n + t);
1675
+ }, t, n), r;
1676
+ }
1677
+ xe(), he(), Me();
1678
+ var Zr = je("start", "end", "cancel", "interrupt"), Qr = [];
1679
+ function $r(e, t, n, r, i, a) {
1680
+ var o = e.__transition;
1681
+ if (!o) e.__transition = {};
1682
+ else if (n in o) return;
1683
+ ti(e, n, {
1684
+ name: t,
1685
+ index: r,
1686
+ group: i,
1687
+ on: Zr,
1688
+ tween: Qr,
1689
+ time: a.time,
1690
+ delay: a.delay,
1691
+ duration: a.duration,
1692
+ ease: a.ease,
1693
+ timer: null,
1694
+ state: 0
1695
+ });
1696
+ }
1697
+ function ei(e, t) {
1698
+ var n = q(e, t);
1699
+ if (n.state > 0) throw Error("too late; already scheduled");
1700
+ return n;
1701
+ }
1702
+ function K(e, t) {
1703
+ var n = q(e, t);
1704
+ if (n.state > 3) throw Error("too late; already running");
1705
+ return n;
1706
+ }
1707
+ function q(e, t) {
1708
+ var n = e.__transition;
1709
+ if (!n || !(n = n[t])) throw Error("transition not found");
1710
+ return n;
1711
+ }
1712
+ function ti(e, t, n) {
1713
+ var r = e.__transition, i;
1714
+ r[t] = n, n.timer = Wr(a, 0, n.time);
1715
+ function a(e) {
1716
+ n.state = 1, n.timer.restart(o, n.delay, n.time), n.delay <= e && o(e - n.delay);
1717
+ }
1718
+ function o(a) {
1719
+ var l, u, d, f;
1720
+ if (n.state !== 1) return c();
1721
+ for (l in r) if (f = r[l], f.name === n.name) {
1722
+ if (f.state === 3) return Xr(o);
1723
+ f.state === 4 ? (f.state = 6, f.timer.stop(), f.on.call("interrupt", e, e.__data__, f.index, f.group), delete r[l]) : +l < t && (f.state = 6, f.timer.stop(), f.on.call("cancel", e, e.__data__, f.index, f.group), delete r[l]);
1724
+ }
1725
+ if (Xr(function() {
1726
+ n.state === 3 && (n.state = 4, n.timer.restart(s, n.delay, n.time), s(a));
1727
+ }), n.state = 2, n.on.call("start", e, e.__data__, n.index, n.group), n.state === 2) {
1728
+ for (n.state = 3, i = Array(d = n.tween.length), l = 0, u = -1; l < d; ++l) (f = n.tween[l].value.call(e, e.__data__, n.index, n.group)) && (i[++u] = f);
1729
+ i.length = u + 1;
1730
+ }
1731
+ }
1732
+ function s(t) {
1733
+ for (var r = t < n.duration ? n.ease.call(null, t / n.duration) : (n.timer.restart(c), n.state = 5, 1), a = -1, o = i.length; ++a < o;) i[a].call(e, r);
1734
+ n.state === 5 && (n.on.call("end", e, e.__data__, n.index, n.group), c());
1735
+ }
1736
+ function c() {
1737
+ for (var i in n.state = 6, n.timer.stop(), delete r[t], r) return;
1738
+ delete e.__transition;
1739
+ }
1740
+ }
1741
+ function ni(e, t) {
1742
+ var n = e.__transition, r, i, a = !0, o;
1743
+ if (n) {
1744
+ for (o in t = t == null ? null : t + "", n) {
1745
+ if ((r = n[o]).name !== t) {
1746
+ a = !1;
1747
+ continue;
1748
+ }
1749
+ i = r.state > 2 && r.state < 5, r.state = 6, r.timer.stop(), r.on.call(i ? "interrupt" : "cancel", e, e.__data__, r.index, r.group), delete n[o];
1750
+ }
1751
+ a && delete e.__transition;
1752
+ }
1753
+ }
1754
+ function ri(e) {
1755
+ return this.each(function() {
1756
+ ni(this, e);
1757
+ });
1758
+ }
1759
+ function ii(e, t) {
1760
+ var n, r;
1761
+ return function() {
1762
+ var i = K(this, e), a = i.tween;
1763
+ if (a !== n) {
1764
+ r = n = a;
1765
+ for (var o = 0, s = r.length; o < s; ++o) if (r[o].name === t) {
1766
+ r = r.slice(), r.splice(o, 1);
1767
+ break;
1768
+ }
1769
+ }
1770
+ i.tween = r;
1771
+ };
1772
+ }
1773
+ function ai(e, t, n) {
1774
+ var r, i;
1775
+ if (typeof n != "function") throw Error();
1776
+ return function() {
1777
+ var a = K(this, e), o = a.tween;
1778
+ if (o !== r) {
1779
+ i = (r = o).slice();
1780
+ for (var s = {
1781
+ name: t,
1782
+ value: n
1783
+ }, c = 0, l = i.length; c < l; ++c) if (i[c].name === t) {
1784
+ i[c] = s;
1785
+ break;
1786
+ }
1787
+ c === l && i.push(s);
1788
+ }
1789
+ a.tween = i;
1790
+ };
1791
+ }
1792
+ function oi(e, t) {
1793
+ var n = this._id;
1794
+ if (e += "", arguments.length < 2) {
1795
+ for (var r = q(this.node(), n).tween, i = 0, a = r.length, o; i < a; ++i) if ((o = r[i]).name === e) return o.value;
1796
+ return null;
1797
+ }
1798
+ return this.each((t == null ? ii : ai)(n, e, t));
1799
+ }
1800
+ function si(e, t, n) {
1801
+ var r = e._id;
1802
+ return e.each(function() {
1803
+ var e = K(this, r);
1804
+ (e.value ||= {})[t] = n.apply(this, arguments);
1805
+ }), function(e) {
1806
+ return q(e, r).value[t];
1807
+ };
1808
+ }
1809
+ function ci(e, t) {
1810
+ var n;
1811
+ return (typeof t == "number" ? ae : t instanceof be ? ue : (n = be(t)) ? (t = n, ue) : ve)(e, t);
1812
+ }
1813
+ he();
1814
+ function li(e) {
1815
+ return function() {
1816
+ this.removeAttribute(e);
1817
+ };
1818
+ }
1819
+ function ui(e) {
1820
+ return function() {
1821
+ this.removeAttributeNS(e.space, e.local);
1822
+ };
1823
+ }
1824
+ function di(e, t, n) {
1825
+ var r, i = n + "", a;
1826
+ return function() {
1827
+ var o = this.getAttribute(e);
1828
+ return o === i ? null : o === r ? a : a = t(r = o, n);
1829
+ };
1830
+ }
1831
+ function fi(e, t, n) {
1832
+ var r, i = n + "", a;
1833
+ return function() {
1834
+ var o = this.getAttributeNS(e.space, e.local);
1835
+ return o === i ? null : o === r ? a : a = t(r = o, n);
1836
+ };
1837
+ }
1838
+ function pi(e, t, n) {
1839
+ var r, i, a;
1840
+ return function() {
1841
+ var o, s = n(this), c;
1842
+ return s == null ? void this.removeAttribute(e) : (o = this.getAttribute(e), c = s + "", o === c ? null : o === r && c === i ? a : (i = c, a = t(r = o, s)));
1843
+ };
1844
+ }
1845
+ function mi(e, t, n) {
1846
+ var r, i, a;
1847
+ return function() {
1848
+ var o, s = n(this), c;
1849
+ return s == null ? void this.removeAttributeNS(e.space, e.local) : (o = this.getAttributeNS(e.space, e.local), c = s + "", o === c ? null : o === r && c === i ? a : (i = c, a = t(r = o, s)));
1850
+ };
1851
+ }
1852
+ function hi(e, t) {
1853
+ var n = ut(e), r = n === "transform" ? ye : ci;
1854
+ return this.attrTween(e, typeof t == "function" ? (n.local ? mi : pi)(n, r, si(this, "attr." + e, t)) : t == null ? (n.local ? ui : li)(n) : (n.local ? fi : di)(n, r, t));
1855
+ }
1856
+ function gi(e, t) {
1857
+ return function(n) {
1858
+ this.setAttribute(e, t.call(this, n));
1859
+ };
1860
+ }
1861
+ function _i(e, t) {
1862
+ return function(n) {
1863
+ this.setAttributeNS(e.space, e.local, t.call(this, n));
1864
+ };
1865
+ }
1866
+ function vi(e, t) {
1867
+ var n, r;
1868
+ function i() {
1869
+ var i = t.apply(this, arguments);
1870
+ return i !== r && (n = (r = i) && _i(e, i)), n;
1871
+ }
1872
+ return i._value = t, i;
1873
+ }
1874
+ function yi(e, t) {
1875
+ var n, r;
1876
+ function i() {
1877
+ var i = t.apply(this, arguments);
1878
+ return i !== r && (n = (r = i) && gi(e, i)), n;
1879
+ }
1880
+ return i._value = t, i;
1881
+ }
1882
+ function bi(e, t) {
1883
+ var n = "attr." + e;
1884
+ if (arguments.length < 2) return (n = this.tween(n)) && n._value;
1885
+ if (t == null) return this.tween(n, null);
1886
+ if (typeof t != "function") throw Error();
1887
+ var r = ut(e);
1888
+ return this.tween(n, (r.local ? vi : yi)(r, t));
1889
+ }
1890
+ function xi(e, t) {
1891
+ return function() {
1892
+ ei(this, e).delay = +t.apply(this, arguments);
1893
+ };
1894
+ }
1895
+ function Si(e, t) {
1896
+ return t = +t, function() {
1897
+ ei(this, e).delay = t;
1898
+ };
1899
+ }
1900
+ function Ci(e) {
1901
+ var t = this._id;
1902
+ return arguments.length ? this.each((typeof e == "function" ? xi : Si)(t, e)) : q(this.node(), t).delay;
1903
+ }
1904
+ function wi(e, t) {
1905
+ return function() {
1906
+ K(this, e).duration = +t.apply(this, arguments);
1907
+ };
1908
+ }
1909
+ function Ti(e, t) {
1910
+ return t = +t, function() {
1911
+ K(this, e).duration = t;
1912
+ };
1913
+ }
1914
+ function Ei(e) {
1915
+ var t = this._id;
1916
+ return arguments.length ? this.each((typeof e == "function" ? wi : Ti)(t, e)) : q(this.node(), t).duration;
1917
+ }
1918
+ function Di(e, t) {
1919
+ if (typeof t != "function") throw Error();
1920
+ return function() {
1921
+ K(this, e).ease = t;
1922
+ };
1923
+ }
1924
+ function Oi(e) {
1925
+ var t = this._id;
1926
+ return arguments.length ? this.each(Di(t, e)) : q(this.node(), t).ease;
1927
+ }
1928
+ function ki(e, t) {
1929
+ return function() {
1930
+ var n = t.apply(this, arguments);
1931
+ if (typeof n != "function") throw Error();
1932
+ K(this, e).ease = n;
1933
+ };
1934
+ }
1935
+ function Ai(e) {
1936
+ if (typeof e != "function") throw Error();
1937
+ return this.each(ki(this._id, e));
1938
+ }
1939
+ function ji(e) {
1940
+ typeof e != "function" && (e = St(e));
1941
+ for (var t = this._groups, n = t.length, r = Array(n), i = 0; i < n; ++i) for (var a = t[i], o = a.length, s = r[i] = [], c, l = 0; l < o; ++l) (c = a[l]) && e.call(c, c.__data__, l, a) && s.push(c);
1942
+ return new J(r, this._parents, this._name, this._id);
1943
+ }
1944
+ function Mi(e) {
1945
+ if (e._id !== this._id) throw Error();
1946
+ for (var t = this._groups, n = e._groups, r = t.length, i = n.length, a = Math.min(r, i), o = Array(r), s = 0; s < a; ++s) for (var c = t[s], l = n[s], u = c.length, d = o[s] = Array(u), f, p = 0; p < u; ++p) (f = c[p] || l[p]) && (d[p] = f);
1947
+ for (; s < r; ++s) o[s] = t[s];
1948
+ return new J(o, this._parents, this._name, this._id);
1949
+ }
1950
+ function Ni(e) {
1951
+ return (e + "").trim().split(/^|\s+/).every(function(e) {
1952
+ var t = e.indexOf(".");
1953
+ return t >= 0 && (e = e.slice(0, t)), !e || e === "start";
1954
+ });
1955
+ }
1956
+ function Pi(e, t, n) {
1957
+ var r, i, a = Ni(t) ? ei : K;
1958
+ return function() {
1959
+ var o = a(this, e), s = o.on;
1960
+ s !== r && (i = (r = s).copy()).on(t, n), o.on = i;
1961
+ };
1962
+ }
1963
+ function Fi(e, t) {
1964
+ var n = this._id;
1965
+ return arguments.length < 2 ? q(this.node(), n).on.on(e) : this.each(Pi(n, e, t));
1966
+ }
1967
+ function Ii(e) {
1968
+ return function() {
1969
+ var t = this.parentNode;
1970
+ for (var n in this.__transition) if (+n !== e) return;
1971
+ t && t.removeChild(this);
1972
+ };
1973
+ }
1974
+ function Li() {
1975
+ return this.on("end.remove", Ii(this._id));
1976
+ }
1977
+ function Ri(e) {
1978
+ var t = this._name, n = this._id;
1979
+ typeof e != "function" && (e = ht(e));
1980
+ for (var r = this._groups, i = r.length, a = Array(i), o = 0; o < i; ++o) for (var s = r[o], c = s.length, l = a[o] = Array(c), u, d, f = 0; f < c; ++f) (u = s[f]) && (d = e.call(u, u.__data__, f, s)) && ("__data__" in u && (d.__data__ = u.__data__), l[f] = d, $r(l[f], t, n, f, l, q(u, n)));
1981
+ return new J(a, this._parents, t, n);
1982
+ }
1983
+ function zi(e) {
1984
+ var t = this._name, n = this._id;
1985
+ typeof e != "function" && (e = yt(e));
1986
+ for (var r = this._groups, i = r.length, a = [], o = [], s = 0; s < i; ++s) for (var c = r[s], l = c.length, u, d = 0; d < l; ++d) if (u = c[d]) {
1987
+ for (var f = e.call(u, u.__data__, d, c), p, m = q(u, n), h = 0, g = f.length; h < g; ++h) (p = f[h]) && $r(p, t, n, h, f, m);
1988
+ a.push(f), o.push(u);
1989
+ }
1990
+ return new J(a, o, t, n);
1991
+ }
1992
+ var Bi = N.prototype.constructor;
1993
+ function Vi() {
1994
+ return new Bi(this._groups, this._parents);
1995
+ }
1996
+ he();
1997
+ function Hi(e, t) {
1998
+ var n, r, i;
1999
+ return function() {
2000
+ var a = j(this, e), o = (this.style.removeProperty(e), j(this, e));
2001
+ return a === o ? null : a === n && o === r ? i : i = t(n = a, r = o);
2002
+ };
2003
+ }
2004
+ function Ui(e) {
2005
+ return function() {
2006
+ this.style.removeProperty(e);
2007
+ };
2008
+ }
2009
+ function Wi(e, t, n) {
2010
+ var r, i = n + "", a;
2011
+ return function() {
2012
+ var o = j(this, e);
2013
+ return o === i ? null : o === r ? a : a = t(r = o, n);
2014
+ };
2015
+ }
2016
+ function Gi(e, t, n) {
2017
+ var r, i, a;
2018
+ return function() {
2019
+ var o = j(this, e), s = n(this), c = s + "";
2020
+ return s ?? (c = s = (this.style.removeProperty(e), j(this, e))), o === c ? null : o === r && c === i ? a : (i = c, a = t(r = o, s));
2021
+ };
2022
+ }
2023
+ function Ki(e, t) {
2024
+ var n, r, i, a = "style." + t, o = "end." + a, s;
2025
+ return function() {
2026
+ var c = K(this, e), l = c.on, u = c.value[a] == null ? s ||= Ui(t) : void 0;
2027
+ (l !== n || i !== u) && (r = (n = l).copy()).on(o, i = u), c.on = r;
2028
+ };
2029
+ }
2030
+ function qi(e, t, n) {
2031
+ var r = (e += "") == "transform" ? _e : ci;
2032
+ return t == null ? this.styleTween(e, Hi(e, r)).on("end.style." + e, Ui(e)) : typeof t == "function" ? this.styleTween(e, Gi(e, r, si(this, "style." + e, t))).each(Ki(this._id, e)) : this.styleTween(e, Wi(e, r, t), n).on("end.style." + e, null);
2033
+ }
2034
+ function Ji(e, t, n) {
2035
+ return function(r) {
2036
+ this.style.setProperty(e, t.call(this, r), n);
2037
+ };
2038
+ }
2039
+ function Yi(e, t, n) {
2040
+ var r, i;
2041
+ function a() {
2042
+ var a = t.apply(this, arguments);
2043
+ return a !== i && (r = (i = a) && Ji(e, a, n)), r;
2044
+ }
2045
+ return a._value = t, a;
2046
+ }
2047
+ function Xi(e, t, n) {
2048
+ var r = "style." + (e += "");
2049
+ if (arguments.length < 2) return (r = this.tween(r)) && r._value;
2050
+ if (t == null) return this.tween(r, null);
2051
+ if (typeof t != "function") throw Error();
2052
+ return this.tween(r, Yi(e, t, n ?? ""));
2053
+ }
2054
+ function Zi(e) {
2055
+ return function() {
2056
+ this.textContent = e;
2057
+ };
2058
+ }
2059
+ function Qi(e) {
2060
+ return function() {
2061
+ var t = e(this);
2062
+ this.textContent = t ?? "";
2063
+ };
2064
+ }
2065
+ function $i(e) {
2066
+ return this.tween("text", typeof e == "function" ? Qi(si(this, "text", e)) : Zi(e == null ? "" : e + ""));
2067
+ }
2068
+ function ea(e) {
2069
+ return function(t) {
2070
+ this.textContent = e.call(this, t);
2071
+ };
2072
+ }
2073
+ function ta(e) {
2074
+ var t, n;
2075
+ function r() {
2076
+ var r = e.apply(this, arguments);
2077
+ return r !== n && (t = (n = r) && ea(r)), t;
2078
+ }
2079
+ return r._value = e, r;
2080
+ }
2081
+ function na(e) {
2082
+ var t = "text";
2083
+ if (arguments.length < 1) return (t = this.tween(t)) && t._value;
2084
+ if (e == null) return this.tween(t, null);
2085
+ if (typeof e != "function") throw Error();
2086
+ return this.tween(t, ta(e));
2087
+ }
2088
+ function ra() {
2089
+ for (var e = this._name, t = this._id, n = sa(), r = this._groups, i = r.length, a = 0; a < i; ++a) for (var o = r[a], s = o.length, c, l = 0; l < s; ++l) if (c = o[l]) {
2090
+ var u = q(c, t);
2091
+ $r(c, e, n, l, o, {
2092
+ time: u.time + u.delay + u.duration,
2093
+ delay: 0,
2094
+ duration: u.duration,
2095
+ ease: u.ease
2096
+ });
2097
+ }
2098
+ return new J(r, this._parents, e, n);
2099
+ }
2100
+ function ia() {
2101
+ var e, t, n = this, r = n._id, i = n.size();
2102
+ return new Promise(function(a, o) {
2103
+ var s = { value: o }, c = { value: function() {
2104
+ --i === 0 && a();
2105
+ } };
2106
+ n.each(function() {
2107
+ var n = K(this, r), i = n.on;
2108
+ i !== e && (t = (e = i).copy(), t._.cancel.push(s), t._.interrupt.push(s), t._.end.push(c)), n.on = t;
2109
+ }), i === 0 && a();
2110
+ });
2111
+ }
2112
+ var aa = 0;
2113
+ function J(e, t, n, r) {
2114
+ this._groups = e, this._parents = t, this._name = n, this._id = r;
2115
+ }
2116
+ function oa(e) {
2117
+ return N().transition(e);
2118
+ }
2119
+ function sa() {
2120
+ return ++aa;
2121
+ }
2122
+ var Y = N.prototype;
2123
+ J.prototype = oa.prototype = {
2124
+ constructor: J,
2125
+ select: Ri,
2126
+ selectAll: zi,
2127
+ selectChild: Y.selectChild,
2128
+ selectChildren: Y.selectChildren,
2129
+ filter: ji,
2130
+ merge: Mi,
2131
+ selection: Vi,
2132
+ transition: ra,
2133
+ call: Y.call,
2134
+ nodes: Y.nodes,
2135
+ node: Y.node,
2136
+ size: Y.size,
2137
+ empty: Y.empty,
2138
+ each: Y.each,
2139
+ on: Fi,
2140
+ attr: hi,
2141
+ attrTween: bi,
2142
+ style: qi,
2143
+ styleTween: Xi,
2144
+ text: $i,
2145
+ textTween: na,
2146
+ remove: Li,
2147
+ tween: oi,
2148
+ delay: Ci,
2149
+ duration: Ei,
2150
+ ease: Oi,
2151
+ easeVarying: Ai,
2152
+ end: ia,
2153
+ [Symbol.iterator]: Y[Symbol.iterator]
2154
+ }, fe();
2155
+ var ca = {
2156
+ time: null,
2157
+ delay: 0,
2158
+ duration: 250,
2159
+ ease: pe
2160
+ };
2161
+ function la(e, t) {
2162
+ for (var n; !(n = e.__transition) || !(n = n[t]);) if (!(e = e.parentNode)) throw Error(`transition ${t} not found`);
2163
+ return n;
2164
+ }
2165
+ function ua(e) {
2166
+ var t, n;
2167
+ e instanceof J ? (t = e._id, e = e._name) : (t = sa(), (n = ca).time = Vr(), e = e == null ? null : e + "");
2168
+ for (var r = this._groups, i = r.length, a = 0; a < i; ++a) for (var o = r[a], s = o.length, c, l = 0; l < s; ++l) (c = o[l]) && $r(c, e, t, l, o, n || la(c, t));
2169
+ return new J(r, this._parents, e, t);
2170
+ }
2171
+ N.prototype.interrupt = ri, N.prototype.transition = ua;
2172
+ var da = (e) => () => e;
2173
+ function fa(e, { sourceEvent: t, target: n, transform: r, dispatch: i }) {
2174
+ Object.defineProperties(this, {
2175
+ type: {
2176
+ value: e,
2177
+ enumerable: !0,
2178
+ configurable: !0
2179
+ },
2180
+ sourceEvent: {
2181
+ value: t,
2182
+ enumerable: !0,
2183
+ configurable: !0
2184
+ },
2185
+ target: {
2186
+ value: n,
2187
+ enumerable: !0,
2188
+ configurable: !0
2189
+ },
2190
+ transform: {
2191
+ value: r,
2192
+ enumerable: !0,
2193
+ configurable: !0
2194
+ },
2195
+ _: { value: i }
2196
+ });
2197
+ }
2198
+ function X(e, t, n) {
2199
+ this.k = e, this.x = t, this.y = n;
2200
+ }
2201
+ X.prototype = {
2202
+ constructor: X,
2203
+ scale: function(e) {
2204
+ return e === 1 ? this : new X(this.k * e, this.x, this.y);
2205
+ },
2206
+ translate: function(e, t) {
2207
+ return e === 0 & t === 0 ? this : new X(this.k, this.x + this.k * e, this.y + this.k * t);
2208
+ },
2209
+ apply: function(e) {
2210
+ return [e[0] * this.k + this.x, e[1] * this.k + this.y];
2211
+ },
2212
+ applyX: function(e) {
2213
+ return e * this.k + this.x;
2214
+ },
2215
+ applyY: function(e) {
2216
+ return e * this.k + this.y;
2217
+ },
2218
+ invert: function(e) {
2219
+ return [(e[0] - this.x) / this.k, (e[1] - this.y) / this.k];
2220
+ },
2221
+ invertX: function(e) {
2222
+ return (e - this.x) / this.k;
2223
+ },
2224
+ invertY: function(e) {
2225
+ return (e - this.y) / this.k;
2226
+ },
2227
+ rescaleX: function(e) {
2228
+ return e.copy().domain(e.range().map(this.invertX, this).map(e.invert, e));
2229
+ },
2230
+ rescaleY: function(e) {
2231
+ return e.copy().domain(e.range().map(this.invertY, this).map(e.invert, e));
2232
+ },
2233
+ toString: function() {
2234
+ return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
2235
+ }
2236
+ };
2237
+ var pa = new X(1, 0, 0);
2238
+ ma.prototype = X.prototype;
2239
+ function ma(e) {
2240
+ for (; !e.__zoom;) if (!(e = e.parentNode)) return pa;
2241
+ return e.__zoom;
2242
+ }
2243
+ function ha(e) {
2244
+ e.stopImmediatePropagation();
2245
+ }
2246
+ function ga(e) {
2247
+ e.preventDefault(), e.stopImmediatePropagation();
2248
+ }
2249
+ Me(), he();
2250
+ function _a(e) {
2251
+ return (!e.ctrlKey || e.type === "wheel") && !e.button;
2252
+ }
2253
+ function va() {
2254
+ var e = this;
2255
+ return e instanceof SVGElement ? (e = e.ownerSVGElement || e, e.hasAttribute("viewBox") ? (e = e.viewBox.baseVal, [[e.x, e.y], [e.x + e.width, e.y + e.height]]) : [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]]) : [[0, 0], [e.clientWidth, e.clientHeight]];
2256
+ }
2257
+ function ya() {
2258
+ return this.__zoom || pa;
2259
+ }
2260
+ function ba(e) {
2261
+ return -e.deltaY * (e.deltaMode === 1 ? .05 : e.deltaMode ? 1 : .002) * (e.ctrlKey ? 10 : 1);
2262
+ }
2263
+ function xa() {
2264
+ return navigator.maxTouchPoints || "ontouchstart" in this;
2265
+ }
2266
+ function Sa(e, t, n) {
2267
+ var r = e.invertX(t[0][0]) - n[0][0], i = e.invertX(t[1][0]) - n[1][0], a = e.invertY(t[0][1]) - n[0][1], o = e.invertY(t[1][1]) - n[1][1];
2268
+ return e.translate(i > r ? (r + i) / 2 : Math.min(0, r) || Math.max(0, i), o > a ? (a + o) / 2 : Math.min(0, a) || Math.max(0, o));
2269
+ }
2270
+ function Ca() {
2271
+ var e = _a, t = va, n = Sa, r = ba, i = xa, a = [0, Infinity], o = [[-Infinity, -Infinity], [Infinity, Infinity]], s = 250, c = me, l = je("start", "zoom", "end"), u, d, f, p = 500, m = 150, h = 0, g = 10;
2272
+ function _(e) {
2273
+ e.property("__zoom", ya).on("wheel.zoom", w, { passive: !1 }).on("mousedown.zoom", T).on("dblclick.zoom", ee).filter(i).on("touchstart.zoom", te).on("touchmove.zoom", E).on("touchend.zoom touchcancel.zoom", ne).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
2274
+ }
2275
+ _.transform = function(e, t, n, r) {
2276
+ var i = e.selection ? e.selection() : e;
2277
+ i.property("__zoom", ya), e === i ? i.interrupt().each(function() {
2278
+ S(this, arguments).event(r).start().zoom(null, typeof t == "function" ? t.apply(this, arguments) : t).end();
2279
+ }) : x(e, t, n, r);
2280
+ }, _.scaleBy = function(e, t, n, r) {
2281
+ _.scaleTo(e, function() {
2282
+ return this.__zoom.k * (typeof t == "function" ? t.apply(this, arguments) : t);
2283
+ }, n, r);
2284
+ }, _.scaleTo = function(e, r, i, a) {
2285
+ _.transform(e, function() {
2286
+ var e = t.apply(this, arguments), a = this.__zoom, s = i == null ? b(e) : typeof i == "function" ? i.apply(this, arguments) : i, c = a.invert(s), l = typeof r == "function" ? r.apply(this, arguments) : r;
2287
+ return n(y(v(a, l), s, c), e, o);
2288
+ }, i, a);
2289
+ }, _.translateBy = function(e, r, i, a) {
2290
+ _.transform(e, function() {
2291
+ return n(this.__zoom.translate(typeof r == "function" ? r.apply(this, arguments) : r, typeof i == "function" ? i.apply(this, arguments) : i), t.apply(this, arguments), o);
2292
+ }, null, a);
2293
+ }, _.translateTo = function(e, r, i, a, s) {
2294
+ _.transform(e, function() {
2295
+ var e = t.apply(this, arguments), s = this.__zoom, c = a == null ? b(e) : typeof a == "function" ? a.apply(this, arguments) : a;
2296
+ return n(pa.translate(c[0], c[1]).scale(s.k).translate(typeof r == "function" ? -r.apply(this, arguments) : -r, typeof i == "function" ? -i.apply(this, arguments) : -i), e, o);
2297
+ }, a, s);
2298
+ };
2299
+ function v(e, t) {
2300
+ return t = Math.max(a[0], Math.min(a[1], t)), t === e.k ? e : new X(t, e.x, e.y);
2301
+ }
2302
+ function y(e, t, n) {
2303
+ var r = t[0] - n[0] * e.k, i = t[1] - n[1] * e.k;
2304
+ return r === e.x && i === e.y ? e : new X(e.k, r, i);
2305
+ }
2306
+ function b(e) {
2307
+ return [(+e[0][0] + +e[1][0]) / 2, (+e[0][1] + +e[1][1]) / 2];
2308
+ }
2309
+ function x(e, n, r, i) {
2310
+ e.on("start.zoom", function() {
2311
+ S(this, arguments).event(i).start();
2312
+ }).on("interrupt.zoom end.zoom", function() {
2313
+ S(this, arguments).event(i).end();
2314
+ }).tween("zoom", function() {
2315
+ var e = this, a = arguments, o = S(e, a).event(i), s = t.apply(e, a), l = r == null ? b(s) : typeof r == "function" ? r.apply(e, a) : r, u = Math.max(s[1][0] - s[0][0], s[1][1] - s[0][1]), d = e.__zoom, f = typeof n == "function" ? n.apply(e, a) : n, p = c(d.invert(l).concat(u / d.k), f.invert(l).concat(u / f.k));
2316
+ return function(e) {
2317
+ if (e === 1) e = f;
2318
+ else {
2319
+ var t = p(e), n = u / t[2];
2320
+ e = new X(n, l[0] - t[0] * n, l[1] - t[1] * n);
2321
+ }
2322
+ o.zoom(null, e);
2323
+ };
2324
+ });
2325
+ }
2326
+ function S(e, t, n) {
2327
+ return !n && e.__zooming || new C(e, t);
2328
+ }
2329
+ function C(e, n) {
2330
+ this.that = e, this.args = n, this.active = 0, this.sourceEvent = null, this.extent = t.apply(e, n), this.taps = 0;
2331
+ }
2332
+ C.prototype = {
2333
+ event: function(e) {
2334
+ return e && (this.sourceEvent = e), this;
2335
+ },
2336
+ start: function() {
2337
+ return ++this.active === 1 && (this.that.__zooming = this, this.emit("start")), this;
2338
+ },
2339
+ zoom: function(e, t) {
2340
+ return this.mouse && e !== "mouse" && (this.mouse[1] = t.invert(this.mouse[0])), this.touch0 && e !== "touch" && (this.touch0[1] = t.invert(this.touch0[0])), this.touch1 && e !== "touch" && (this.touch1[1] = t.invert(this.touch1[0])), this.that.__zoom = t, this.emit("zoom"), this;
2341
+ },
2342
+ end: function() {
2343
+ return --this.active === 0 && (delete this.that.__zooming, this.emit("end")), this;
2344
+ },
2345
+ emit: function(e) {
2346
+ var t = P(this.that).datum();
2347
+ l.call(e, this.that, new fa(e, {
2348
+ sourceEvent: this.sourceEvent,
2349
+ target: _,
2350
+ type: e,
2351
+ transform: this.that.__zoom,
2352
+ dispatch: l
2353
+ }), t);
2354
+ }
2355
+ };
2356
+ function w(t, ...i) {
2357
+ if (!e.apply(this, arguments)) return;
2358
+ var s = S(this, i).event(t), c = this.__zoom, l = Math.max(a[0], Math.min(a[1], c.k * 2 ** r.apply(this, arguments))), u = F(t);
2359
+ if (s.wheel) (s.mouse[0][0] !== u[0] || s.mouse[0][1] !== u[1]) && (s.mouse[1] = c.invert(s.mouse[0] = u)), clearTimeout(s.wheel);
2360
+ else if (c.k === l) return;
2361
+ else s.mouse = [u, c.invert(u)], ni(this), s.start();
2362
+ ga(t), s.wheel = setTimeout(d, m), s.zoom("mouse", n(y(v(c, l), s.mouse[0], s.mouse[1]), s.extent, o));
2363
+ function d() {
2364
+ s.wheel = null, s.end();
2365
+ }
2366
+ }
2367
+ function T(t, ...r) {
2368
+ if (f || !e.apply(this, arguments)) return;
2369
+ var i = t.currentTarget, a = S(this, r, !0).event(t), s = P(t.view).on("mousemove.zoom", d, !0).on("mouseup.zoom", p, !0), c = F(t, i), l = t.clientX, u = t.clientY;
2370
+ Tr(t.view), ha(t), a.mouse = [c, this.__zoom.invert(c)], ni(this), a.start();
2371
+ function d(e) {
2372
+ if (ga(e), !a.moved) {
2373
+ var t = e.clientX - l, r = e.clientY - u;
2374
+ a.moved = t * t + r * r > h;
2375
+ }
2376
+ a.event(e).zoom("mouse", n(y(a.that.__zoom, a.mouse[0] = F(e, i), a.mouse[1]), a.extent, o));
2377
+ }
2378
+ function p(e) {
2379
+ s.on("mousemove.zoom mouseup.zoom", null), Er(e.view, a.moved), ga(e), a.event(e).end();
2380
+ }
2381
+ }
2382
+ function ee(r, ...i) {
2383
+ if (e.apply(this, arguments)) {
2384
+ var a = this.__zoom, c = F(r.changedTouches ? r.changedTouches[0] : r, this), l = a.invert(c), u = a.k * (r.shiftKey ? .5 : 2), d = n(y(v(a, u), c, l), t.apply(this, i), o);
2385
+ ga(r), s > 0 ? P(this).transition().duration(s).call(x, d, c, r) : P(this).call(_.transform, d, c, r);
2386
+ }
2387
+ }
2388
+ function te(t, ...n) {
2389
+ if (e.apply(this, arguments)) {
2390
+ var r = t.touches, i = r.length, a = S(this, n, t.changedTouches.length === i).event(t), o, s, c, l;
2391
+ for (ha(t), s = 0; s < i; ++s) c = r[s], l = F(c, this), l = [
2392
+ l,
2393
+ this.__zoom.invert(l),
2394
+ c.identifier
2395
+ ], a.touch0 ? !a.touch1 && a.touch0[2] !== l[2] && (a.touch1 = l, a.taps = 0) : (a.touch0 = l, o = !0, a.taps = 1 + !!u);
2396
+ u &&= clearTimeout(u), o && (a.taps < 2 && (d = l[0], u = setTimeout(function() {
2397
+ u = null;
2398
+ }, p)), ni(this), a.start());
2399
+ }
2400
+ }
2401
+ function E(e, ...t) {
2402
+ if (this.__zooming) {
2403
+ var r = S(this, t).event(e), i = e.changedTouches, a = i.length, s, c, l, u;
2404
+ for (ga(e), s = 0; s < a; ++s) c = i[s], l = F(c, this), r.touch0 && r.touch0[2] === c.identifier ? r.touch0[0] = l : r.touch1 && r.touch1[2] === c.identifier && (r.touch1[0] = l);
2405
+ if (c = r.that.__zoom, r.touch1) {
2406
+ var d = r.touch0[0], f = r.touch0[1], p = r.touch1[0], m = r.touch1[1], h = (h = p[0] - d[0]) * h + (h = p[1] - d[1]) * h, g = (g = m[0] - f[0]) * g + (g = m[1] - f[1]) * g;
2407
+ c = v(c, Math.sqrt(h / g)), l = [(d[0] + p[0]) / 2, (d[1] + p[1]) / 2], u = [(f[0] + m[0]) / 2, (f[1] + m[1]) / 2];
2408
+ } else if (r.touch0) l = r.touch0[0], u = r.touch0[1];
2409
+ else return;
2410
+ r.zoom("touch", n(y(c, l, u), r.extent, o));
2411
+ }
2412
+ }
2413
+ function ne(e, ...t) {
2414
+ if (this.__zooming) {
2415
+ var n = S(this, t).event(e), r = e.changedTouches, i = r.length, a, o;
2416
+ for (ha(e), f && clearTimeout(f), f = setTimeout(function() {
2417
+ f = null;
2418
+ }, p), a = 0; a < i; ++a) o = r[a], n.touch0 && n.touch0[2] === o.identifier ? delete n.touch0 : n.touch1 && n.touch1[2] === o.identifier && delete n.touch1;
2419
+ if (n.touch1 && !n.touch0 && (n.touch0 = n.touch1, delete n.touch1), n.touch0) n.touch0[1] = this.__zoom.invert(n.touch0[0]);
2420
+ else if (n.end(), n.taps === 2 && (o = F(o, this), Math.hypot(d[0] - o[0], d[1] - o[1]) < g)) {
2421
+ var s = P(this).on("dblclick.zoom");
2422
+ s && s.apply(this, arguments);
2423
+ }
2424
+ }
2425
+ }
2426
+ return _.wheelDelta = function(e) {
2427
+ return arguments.length ? (r = typeof e == "function" ? e : da(+e), _) : r;
2428
+ }, _.filter = function(t) {
2429
+ return arguments.length ? (e = typeof t == "function" ? t : da(!!t), _) : e;
2430
+ }, _.touchable = function(e) {
2431
+ return arguments.length ? (i = typeof e == "function" ? e : da(!!e), _) : i;
2432
+ }, _.extent = function(e) {
2433
+ return arguments.length ? (t = typeof e == "function" ? e : da([[+e[0][0], +e[0][1]], [+e[1][0], +e[1][1]]]), _) : t;
2434
+ }, _.scaleExtent = function(e) {
2435
+ return arguments.length ? (a[0] = +e[0], a[1] = +e[1], _) : [a[0], a[1]];
2436
+ }, _.translateExtent = function(e) {
2437
+ return arguments.length ? (o[0][0] = +e[0][0], o[1][0] = +e[1][0], o[0][1] = +e[0][1], o[1][1] = +e[1][1], _) : [[o[0][0], o[0][1]], [o[1][0], o[1][1]]];
2438
+ }, _.constrain = function(e) {
2439
+ return arguments.length ? (n = e, _) : n;
2440
+ }, _.duration = function(e) {
2441
+ return arguments.length ? (s = +e, _) : s;
2442
+ }, _.interpolate = function(e) {
2443
+ return arguments.length ? (c = e, _) : c;
2444
+ }, _.on = function() {
2445
+ var e = l.on.apply(l, arguments);
2446
+ return e === l ? _ : e;
2447
+ }, _.clickDistance = function(e) {
2448
+ return arguments.length ? (h = (e = +e) * e, _) : Math.sqrt(h);
2449
+ }, _.tapDistance = function(e) {
2450
+ return arguments.length ? (g = +e, _) : g;
2451
+ }, _;
2452
+ }
2453
+ oe();
2454
+ var wa = (e) => ({
2455
+ left: {
2456
+ nodeLeftX: () => 0,
2457
+ nodeRightX: (e) => e.width,
2458
+ nodeTopY: (e) => -e.height / 2,
2459
+ nodeBottomY: (e) => e.height / 2,
2460
+ nodeJoinX: (e) => e.x + e.width,
2461
+ nodeJoinY: (e) => e.y - e.height / 2,
2462
+ linkJoinX: (e) => e.x + e.width,
2463
+ linkJoinY: (e) => e.y,
2464
+ linkX: (e) => e.x,
2465
+ linkY: (e) => e.y,
2466
+ linkCompactXStart: (e) => e.x + e.width / 2,
2467
+ linkCompactYStart: (e) => e.y + (e.compactEven ? e.height / 2 : -e.height / 2),
2468
+ compactLinkMidX: (e) => e.firstCompactNode.x,
2469
+ compactLinkMidY: (e, t) => e.firstCompactNode.y + e.firstCompactNode.flexCompactDim[0] / 4 + t.compactMarginPair(e) / 4,
2470
+ linkParentX: (e) => e.parent.x + e.parent.width,
2471
+ linkParentY: (e) => e.parent.y,
2472
+ buttonX: (e) => e.width,
2473
+ buttonY: (e) => e.height / 2,
2474
+ centerTransform: ({ rootMargin: e, centerY: t, scale: n }) => `translate(${e},${t}) scale(${n})`,
2475
+ compactDimension: {
2476
+ sizeColumn: (e) => e.height,
2477
+ sizeRow: (e) => e.width,
2478
+ reverse: (e) => e.slice().reverse()
2479
+ },
2480
+ nodeFlexSize: ({ height: e, width: t, siblingsMargin: n, childrenMargin: r, config: i, node: a }) => i.compact && a.flexCompactDim ? [a.flexCompactDim[0], a.flexCompactDim[1]] : [e + n, t + r],
2481
+ zoomTransform: ({ centerY: e, scale: t }) => `translate(0,${e}) scale(${t})`,
2482
+ diagonal: e.hdiagonal,
2483
+ swap: (e) => {
2484
+ let t = e.x;
2485
+ e.x = e.y, e.y = t;
2486
+ },
2487
+ nodeUpdateTransform: ({ x: e, y: t, height: n }) => `translate(${e},${t - n / 2})`
2488
+ },
2489
+ top: {
2490
+ nodeLeftX: (e) => -e.width / 2,
2491
+ nodeRightX: (e) => e.width / 2,
2492
+ nodeTopY: () => 0,
2493
+ nodeBottomY: (e) => e.height,
2494
+ nodeJoinX: (e) => e.x - e.width / 2,
2495
+ nodeJoinY: (e) => e.y + e.height,
2496
+ linkJoinX: (e) => e.x,
2497
+ linkJoinY: (e) => e.y + e.height,
2498
+ linkCompactXStart: (e) => e.x + (e.compactEven ? e.width / 2 : -e.width / 2),
2499
+ linkCompactYStart: (e) => e.y + e.height / 2,
2500
+ compactLinkMidX: (e, t) => e.firstCompactNode.x + e.firstCompactNode.flexCompactDim[0] / 4 + t.compactMarginPair(e) / 4,
2501
+ compactLinkMidY: (e) => e.firstCompactNode.y,
2502
+ compactDimension: {
2503
+ sizeColumn: (e) => e.width,
2504
+ sizeRow: (e) => e.height,
2505
+ reverse: (e) => e
2506
+ },
2507
+ linkX: (e) => e.x,
2508
+ linkY: (e) => e.y,
2509
+ linkParentX: (e) => e.parent.x,
2510
+ linkParentY: (e) => e.parent.y + e.parent.height,
2511
+ buttonX: (e) => e.width / 2,
2512
+ buttonY: (e) => e.height,
2513
+ centerTransform: ({ rootMargin: e, scale: t, centerX: n }) => `translate(${n},${e}) scale(${t})`,
2514
+ nodeFlexSize: ({ height: e, width: t, siblingsMargin: n, childrenMargin: r, config: i, node: a }) => i.compact && a.flexCompactDim ? [a.flexCompactDim[0], a.flexCompactDim[1]] : [t + n, e + r],
2515
+ zoomTransform: ({ centerX: e, scale: t }) => `translate(${e},0}) scale(${t})`,
2516
+ diagonal: e.diagonal,
2517
+ swap: () => {},
2518
+ nodeUpdateTransform: ({ x: e, y: t, width: n }) => `translate(${e - n / 2},${t})`
2519
+ },
2520
+ bottom: {
2521
+ nodeLeftX: (e) => -e.width / 2,
2522
+ nodeRightX: (e) => e.width / 2,
2523
+ nodeTopY: (e) => -e.height,
2524
+ nodeBottomY: () => 0,
2525
+ nodeJoinX: (e) => e.x - e.width / 2,
2526
+ nodeJoinY: (e) => e.y - e.height - e.height,
2527
+ linkJoinX: (e) => e.x,
2528
+ linkJoinY: (e) => e.y - e.height,
2529
+ linkCompactXStart: (e) => e.x + (e.compactEven ? e.width / 2 : -e.width / 2),
2530
+ linkCompactYStart: (e) => e.y - e.height / 2,
2531
+ compactLinkMidX: (e, t) => e.firstCompactNode.x + e.firstCompactNode.flexCompactDim[0] / 4 + t.compactMarginPair(e) / 4,
2532
+ compactLinkMidY: (e) => e.firstCompactNode.y,
2533
+ linkX: (e) => e.x,
2534
+ linkY: (e) => e.y,
2535
+ compactDimension: {
2536
+ sizeColumn: (e) => e.width,
2537
+ sizeRow: (e) => e.height,
2538
+ reverse: (e) => e
2539
+ },
2540
+ linkParentX: (e) => e.parent.x,
2541
+ linkParentY: (e) => e.parent.y - e.parent.height,
2542
+ buttonX: (e) => e.width / 2,
2543
+ buttonY: () => 0,
2544
+ centerTransform: ({ rootMargin: e, scale: t, centerX: n, chartHeight: r }) => `translate(${n},${r - e}) scale(${t})`,
2545
+ nodeFlexSize: ({ height: e, width: t, siblingsMargin: n, childrenMargin: r, config: i, node: a }) => i.compact && a.flexCompactDim ? [a.flexCompactDim[0], a.flexCompactDim[1]] : [t + n, e + r],
2546
+ zoomTransform: ({ centerX: e, scale: t }) => `translate(${e},0}) scale(${t})`,
2547
+ diagonal: e.diagonal,
2548
+ swap: (e) => {
2549
+ e.y = -e.y;
2550
+ },
2551
+ nodeUpdateTransform: ({ x: e, y: t, width: n, height: r }) => `translate(${e - n / 2},${t - r})`
2552
+ },
2553
+ right: {
2554
+ nodeLeftX: (e) => -e.width,
2555
+ nodeRightX: () => 0,
2556
+ nodeTopY: (e) => -e.height / 2,
2557
+ nodeBottomY: (e) => e.height / 2,
2558
+ nodeJoinX: (e) => e.x - e.width - e.width,
2559
+ nodeJoinY: (e) => e.y - e.height / 2,
2560
+ linkJoinX: (e) => e.x - e.width,
2561
+ linkJoinY: (e) => e.y,
2562
+ linkX: (e) => e.x,
2563
+ linkY: (e) => e.y,
2564
+ linkParentX: (e) => e.parent.x - e.parent.width,
2565
+ linkParentY: (e) => e.parent.y,
2566
+ buttonX: () => 0,
2567
+ buttonY: (e) => e.height / 2,
2568
+ linkCompactXStart: (e) => e.x - e.width / 2,
2569
+ linkCompactYStart: (e) => e.y + (e.compactEven ? e.height / 2 : -e.height / 2),
2570
+ compactLinkMidX: (e) => e.firstCompactNode.x,
2571
+ compactLinkMidY: (e, t) => e.firstCompactNode.y + e.firstCompactNode.flexCompactDim[0] / 4 + t.compactMarginPair(e) / 4,
2572
+ centerTransform: ({ rootMargin: e, centerY: t, scale: n, chartWidth: r }) => `translate(${r - e},${t}) scale(${n})`,
2573
+ nodeFlexSize: ({ height: e, width: t, siblingsMargin: n, childrenMargin: r, config: i, node: a }) => i.compact && a.flexCompactDim ? [a.flexCompactDim[0], a.flexCompactDim[1]] : [e + n, t + r],
2574
+ compactDimension: {
2575
+ sizeColumn: (e) => e.height,
2576
+ sizeRow: (e) => e.width,
2577
+ reverse: (e) => e.slice().reverse()
2578
+ },
2579
+ zoomTransform: ({ centerY: e, scale: t }) => `translate(0,${e}) scale(${t})`,
2580
+ diagonal: e.hdiagonal,
2581
+ swap: (e) => {
2582
+ let t = e.x;
2583
+ e.x = -e.y, e.y = t;
2584
+ },
2585
+ nodeUpdateTransform: ({ x: e, y: t, width: n, height: r }) => `translate(${e - n},${t - r / 2})`
2586
+ }
2587
+ });
2588
+ function Ta(e, t, n) {
2589
+ let r = e.x, i = e.y, a = t.x, o = t.y, s = n && n.x != null ? n.x : r, c = n && n.y != null ? n.y : i, l = a - r < 0 ? -1 : 1, u = o - i < 0 ? -1 : 1, d = Math.abs(a - r) / 2 < 35 ? Math.abs(a - r) / 2 : 35;
2590
+ d = Math.abs(o - i) / 2 < d ? Math.abs(o - i) / 2 : d;
2591
+ let f = Math.abs(a - r) / 2 - d;
2592
+ return `
2593
+ M ${s} ${c}
2594
+ L ${s} ${i}
2595
+ L ${r} ${i}
2596
+ L ${r + f * l} ${i}
2597
+ C ${r + f * l + d * l} ${i}
2598
+ ${r + f * l + d * l} ${i}
2599
+ ${r + f * l + d * l} ${i + d * u}
2600
+ L ${r + f * l + d * l} ${o - d * u}
2601
+ C ${r + f * l + d * l} ${o}
2602
+ ${r + f * l + d * l} ${o}
2603
+ ${a - f * l} ${o}
2604
+ L ${a} ${o}`;
2605
+ }
2606
+ function Ea(e, t, n, r = { sy: 0 }) {
2607
+ let i = e.x, a = e.y, o = t.x, s = t.y, c = n && n.x != null ? n.x : i, l = n && n.y != null ? n.y : a, u = o - i < 0 ? -1 : 1, d = s - a < 0 ? -1 : 1;
2608
+ a += r.sy;
2609
+ let f = Math.abs(o - i) / 2 < 15 ? Math.abs(o - i) / 2 : 15;
2610
+ f = Math.abs(s - a) / 2 < f ? Math.abs(s - a) / 2 : f;
2611
+ let p = Math.abs(s - a) / 2 - f, m = Math.abs(o - i) - f * 2;
2612
+ return `
2613
+ M ${c} ${l}
2614
+ L ${i} ${l}
2615
+ L ${i} ${a}
2616
+ L ${i} ${a + p * d}
2617
+ C ${i} ${a + p * d + f * d} ${i} ${a + p * d + f * d} ${i + f * u} ${a + p * d + f * d}
2618
+ L ${i + m * u + f * u} ${a + p * d + f * d}
2619
+ C ${o} ${a + p * d + f * d} ${o} ${a + p * d + f * d} ${o} ${s - p * d}
2620
+ L ${o} ${s}`;
2621
+ }
2622
+ function Da({ node: e, config: t }) {
2623
+ return e.data?.id === "__root__" ? null : `<div class="button-content"> ${{
2624
+ left: (t) => t ? `<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2625
+ <path d="M14.283 3.50094L6.51 11.4749C6.37348 11.615 6.29707 11.8029 6.29707 11.9984C6.29707 12.194 6.37348 12.3819 6.51 12.5219L14.283 20.4989C14.3466 20.5643 14.4226 20.6162 14.5066 20.6516C14.5906 20.6871 14.6808 20.7053 14.772 20.7053C14.8632 20.7053 14.9534 20.6871 15.0374 20.6516C15.1214 20.6162 15.1974 20.5643 15.261 20.4989C15.3918 20.365 15.4651 20.1852 15.4651 19.9979C15.4651 19.8107 15.3918 19.6309 15.261 19.4969L7.9515 11.9984L15.261 4.50144C15.3914 4.36756 15.4643 4.18807 15.4643 4.00119C15.4643 3.81431 15.3914 3.63482 15.261 3.50094C15.1974 3.43563 15.1214 3.38371 15.0374 3.34827C14.9534 3.31282 14.8632 3.29456 14.772 3.29456C14.6808 3.29456 14.5906 3.31282 14.5066 3.34827C14.4226 3.38371 14.3466 3.43563 14.283 3.50094V3.50094Z" fill="#716E7B" stroke="#716E7B"/>
2626
+ </svg></span><span style="color:#716E7B">${e.data._directSubordinatesPaging} </span></div>` : `<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2627
+ <path d="M7.989 3.49944C7.85817 3.63339 7.78492 3.8132 7.78492 4.00044C7.78492 4.18768 7.85817 4.36749 7.989 4.50144L15.2985 11.9999L7.989 19.4969C7.85817 19.6309 7.78492 19.8107 7.78492 19.9979C7.78492 20.1852 7.85817 20.365 7.989 20.4989C8.05259 20.5643 8.12863 20.6162 8.21261 20.6516C8.2966 20.6871 8.38684 20.7053 8.478 20.7053C8.56916 20.7053 8.6594 20.6871 8.74338 20.6516C8.82737 20.6162 8.90341 20.5643 8.967 20.4989L16.74 12.5234C16.8765 12.3834 16.9529 12.1955 16.9529 11.9999C16.9529 11.8044 16.8765 11.6165 16.74 11.4764L8.967 3.50094C8.90341 3.43563 8.82737 3.38371 8.74338 3.34827C8.6594 3.31282 8.56916 3.29456 8.478 3.29456C8.38684 3.29456 8.2966 3.31282 8.21261 3.34827C8.12863 3.38371 8.05259 3.43563 7.989 3.50094V3.49944Z" fill="#716E7B" stroke="#716E7B"/>
2628
+ </svg></span><span style="color:#716E7B">${e.data._directSubordinatesPaging} </span></div>`,
2629
+ bottom: (t) => t ? `<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2630
+ <path d="M19.497 7.98903L12 15.297L4.503 7.98903C4.36905 7.85819 4.18924 7.78495 4.002 7.78495C3.81476 7.78495 3.63495 7.85819 3.501 7.98903C3.43614 8.05257 3.38462 8.12842 3.34944 8.21213C3.31427 8.29584 3.29615 8.38573 3.29615 8.47653C3.29615 8.56733 3.31427 8.65721 3.34944 8.74092C3.38462 8.82463 3.43614 8.90048 3.501 8.96403L11.4765 16.74C11.6166 16.8765 11.8044 16.953 12 16.953C12.1956 16.953 12.3834 16.8765 12.5235 16.74L20.499 8.96553C20.5643 8.90193 20.6162 8.8259 20.6517 8.74191C20.6871 8.65792 20.7054 8.56769 20.7054 8.47653C20.7054 8.38537 20.6871 8.29513 20.6517 8.21114C20.6162 8.12715 20.5643 8.05112 20.499 7.98753C20.3651 7.85669 20.1852 7.78345 19.998 7.78345C19.8108 7.78345 19.6309 7.85669 19.497 7.98753V7.98903Z" fill="#716E7B" stroke="#716E7B"/>
2631
+ </svg></span><span style="margin-left:1px;color:#716E7B" >${e.data._directSubordinatesPaging} </span></div>
2632
+ ` : `<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2633
+ <path d="M11.457 8.07005L3.49199 16.4296C3.35903 16.569 3.28485 16.7543 3.28485 16.9471C3.28485 17.1398 3.35903 17.3251 3.49199 17.4646L3.50099 17.4736C3.56545 17.5414 3.64304 17.5954 3.72904 17.6324C3.81504 17.6693 3.90765 17.6883 4.00124 17.6883C4.09483 17.6883 4.18745 17.6693 4.27344 17.6324C4.35944 17.5954 4.43703 17.5414 4.50149 17.4736L12.0015 9.60155L19.4985 17.4736C19.563 17.5414 19.6405 17.5954 19.7265 17.6324C19.8125 17.6693 19.9052 17.6883 19.9987 17.6883C20.0923 17.6883 20.1849 17.6693 20.2709 17.6324C20.3569 17.5954 20.4345 17.5414 20.499 17.4736L20.508 17.4646C20.641 17.3251 20.7151 17.1398 20.7151 16.9471C20.7151 16.7543 20.641 16.569 20.508 16.4296L12.543 8.07005C12.4729 7.99653 12.3887 7.93801 12.2954 7.89801C12.202 7.85802 12.1015 7.8374 12 7.8374C11.8984 7.8374 11.798 7.85802 11.7046 7.89801C11.6113 7.93801 11.527 7.99653 11.457 8.07005Z" fill="#716E7B" stroke="#716E7B"/>
2634
+ </svg></span><span style="margin-left:1px;color:#716E7B" >${e.data._directSubordinatesPaging} </span></div>
2635
+ `,
2636
+ right: (t) => t ? `<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2637
+ <path d="M7.989 3.49944C7.85817 3.63339 7.78492 3.8132 7.78492 4.00044C7.78492 4.18768 7.85817 4.36749 7.989 4.50144L15.2985 11.9999L7.989 19.4969C7.85817 19.6309 7.78492 19.8107 7.78492 19.9979C7.78492 20.1852 7.85817 20.365 7.989 20.4989C8.05259 20.5643 8.12863 20.6162 8.21261 20.6516C8.2966 20.6871 8.38684 20.7053 8.478 20.7053C8.56916 20.7053 8.6594 20.6871 8.74338 20.6516C8.82737 20.6162 8.90341 20.5643 8.967 20.4989L16.74 12.5234C16.8765 12.3834 16.9529 12.1955 16.9529 11.9999C16.9529 11.8044 16.8765 11.6165 16.74 11.4764L8.967 3.50094C8.90341 3.43563 8.82737 3.38371 8.74338 3.34827C8.6594 3.31282 8.56916 3.29456 8.478 3.29456C8.38684 3.29456 8.2966 3.31282 8.21261 3.34827C8.12863 3.38371 8.05259 3.43563 7.989 3.50094V3.49944Z" fill="#716E7B" stroke="#716E7B"/>
2638
+ </svg></span><span style="color:#716E7B">${e.data._directSubordinatesPaging} </span></div>` : `<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2639
+ <path d="M14.283 3.50094L6.51 11.4749C6.37348 11.615 6.29707 11.8029 6.29707 11.9984C6.29707 12.194 6.37348 12.3819 6.51 12.5219L14.283 20.4989C14.3466 20.5643 14.4226 20.6162 14.5066 20.6516C14.5906 20.6871 14.6808 20.7053 14.772 20.7053C14.8632 20.7053 14.9534 20.6871 15.0374 20.6516C15.1214 20.6162 15.1974 20.5643 15.261 20.4989C15.3918 20.365 15.4651 20.1852 15.4651 19.9979C15.4651 19.8107 15.3918 19.6309 15.261 19.4969L7.9515 11.9984L15.261 4.50144C15.3914 4.36756 15.4643 4.18807 15.4643 4.00119C15.4643 3.81431 15.3914 3.63482 15.261 3.50094C15.1974 3.43563 15.1214 3.38371 15.0374 3.34827C14.9534 3.31282 14.8632 3.29456 14.772 3.29456C14.6808 3.29456 14.5906 3.31282 14.5066 3.34827C14.4226 3.38371 14.3466 3.43563 14.283 3.50094V3.50094Z" fill="#716E7B" stroke="#716E7B"/>
2640
+ </svg></span><span style="color:#716E7B">${e.data._directSubordinatesPaging} </span></div>`,
2641
+ top: (t) => t ? `<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2642
+ <path d="M11.457 8.07005L3.49199 16.4296C3.35903 16.569 3.28485 16.7543 3.28485 16.9471C3.28485 17.1398 3.35903 17.3251 3.49199 17.4646L3.50099 17.4736C3.56545 17.5414 3.64304 17.5954 3.72904 17.6324C3.81504 17.6693 3.90765 17.6883 4.00124 17.6883C4.09483 17.6883 4.18745 17.6693 4.27344 17.6324C4.35944 17.5954 4.43703 17.5414 4.50149 17.4736L12.0015 9.60155L19.4985 17.4736C19.563 17.5414 19.6405 17.5954 19.7265 17.6324C19.8125 17.6693 19.9052 17.6883 19.9987 17.6883C20.0923 17.6883 20.1849 17.6693 20.2709 17.6324C20.3569 17.5954 20.4345 17.5414 20.499 17.4736L20.508 17.4646C20.641 17.3251 20.7151 17.1398 20.7151 16.9471C20.7151 16.7543 20.641 16.569 20.508 16.4296L12.543 8.07005C12.4729 7.99653 12.3887 7.93801 12.2954 7.89801C12.202 7.85802 12.1015 7.8374 12 7.8374C11.8984 7.8374 11.798 7.85802 11.7046 7.89801C11.6113 7.93801 11.527 7.99653 11.457 8.07005Z" fill="#716E7B" stroke="#716E7B"/>
2643
+ </svg></span><span style="margin-left:1px;color:#716E7B">${e.data._directSubordinatesPaging} </span></div>
2644
+ ` : `<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2645
+ <path d="M19.497 7.98903L12 15.297L4.503 7.98903C4.36905 7.85819 4.18924 7.78495 4.002 7.78495C3.81476 7.78495 3.63495 7.85819 3.501 7.98903C3.43614 8.05257 3.38462 8.12842 3.34944 8.21213C3.31427 8.29584 3.29615 8.38573 3.29615 8.47653C3.29615 8.56733 3.31427 8.65721 3.34944 8.74092C3.38462 8.82463 3.43614 8.90048 3.501 8.96403L11.4765 16.74C11.6166 16.8765 11.8044 16.953 12 16.953C12.1956 16.953 12.3834 16.8765 12.5235 16.74L20.499 8.96553C20.5643 8.90193 20.6162 8.8259 20.6517 8.74191C20.6871 8.65792 20.7054 8.56769 20.7054 8.47653C20.7054 8.38537 20.6871 8.29513 20.6517 8.21114C20.6162 8.12715 20.5643 8.05112 20.499 7.98753C20.3651 7.85669 20.1852 7.78345 19.998 7.78345C19.8108 7.78345 19.6309 7.85669 19.497 7.98753V7.98903Z" fill="#716E7B" stroke="#716E7B"/>
2646
+ </svg></span><span style="margin-left:1px;color:#716E7B">${e.data._directSubordinatesPaging} </span></div>
2647
+ `
2648
+ }[t.layout](e.children)} </div>`;
2649
+ }
2650
+ function Oa(e, t, n, r) {
2651
+ let i = r.pagingStep(e.parent), a = e.parent.data._pagingStep, o = e.parent.data._directSubordinatesPaging - a;
2652
+ return `
2653
+ <div style="margin-top:90px;">
2654
+ <div style="display:flex;width:170px;border-radius:20px;padding:5px 15px; padding-bottom:4px;;background-color:#E5E9F2">
2655
+ <div><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2656
+ <path d="M5.59 7.41L10.18 12L5.59 16.59L7 18L13 12L7 6L5.59 7.41ZM16 6H18V18H16V6Z" fill="#716E7B" stroke="#716E7B"/>
2657
+ </svg>
2658
+ </div><div style="line-height:2"> Show next ${Math.min(o, i)} nodes </div></div>
2659
+ </div>
2660
+ `;
2661
+ }
2662
+ var ka = () => {
2663
+ let e = {
2664
+ svgWidth: 800,
2665
+ svgHeight: window.innerHeight - 100,
2666
+ padding: {
2667
+ top: 0,
2668
+ right: 0,
2669
+ bottom: 0,
2670
+ left: 0
2671
+ },
2672
+ container: document.createElement("div"),
2673
+ initialExpandLevel: 1,
2674
+ forceAutoFit: !1,
2675
+ root: null,
2676
+ defaultFont: "Helvetica",
2677
+ nodeDefaultBackground: "none",
2678
+ nodeId: (e) => e.id,
2679
+ parentNodeId: (e) => e.parentId,
2680
+ rootMargin: 0,
2681
+ nodeWidth: () => 120,
2682
+ nodeHeight: () => 40,
2683
+ neighbourMargin: () => 80,
2684
+ siblingsMargin: () => 20,
2685
+ childrenMargin: (e) => e.parent ? 36 : 0,
2686
+ compactMarginPair: () => 80,
2687
+ compactMarginBetween: () => 20,
2688
+ nodeButtonWidth: () => 32,
2689
+ nodeButtonHeight: () => 32,
2690
+ nodeButtonX: () => -16,
2691
+ nodeButtonY: () => -16,
2692
+ linkYOffset: 0,
2693
+ pagingStep: () => 5,
2694
+ minPagingVisibleNodes: () => 2e3,
2695
+ scaleExtent: [.05, 2.5],
2696
+ duration: 400,
2697
+ setActiveNodeCentered: !0,
2698
+ layout: "top",
2699
+ compact: !0,
2700
+ gridEnabled: !1,
2701
+ gridRows: 0,
2702
+ createZoom: () => Ca(),
2703
+ onZoomStart: () => {},
2704
+ onZoom: () => {},
2705
+ onZoomEnd: () => {},
2706
+ onUserZoom: () => {},
2707
+ onNodeClick: (e) => e,
2708
+ onNodeMouseEnter: () => {},
2709
+ onNodeMouseLeave: () => {},
2710
+ onNodeMouseMove: () => {},
2711
+ onNodeHover: () => {},
2712
+ onNodeLeave: () => {},
2713
+ onNodeParentChange() {},
2714
+ onExpandOrCollapse: (e) => e,
2715
+ nodeContent: (e) => e.id === "__root__" ? null : "<div class=\"node-content\"></div>",
2716
+ buttonContent: Da,
2717
+ pagingButton: Oa,
2718
+ nodeUpdate: function() {
2719
+ P(this).select(".node-rect").attr("stroke", void 0).attr("stroke-width", void 0);
2720
+ },
2721
+ nodeEnter: (e) => e,
2722
+ nodeExit: (e) => e,
2723
+ linkUpdate: function(e) {
2724
+ if (e.data._upToTheRootHighlighted) {
2725
+ P(this).style("stroke-width", "var(--border-hover-width)").style("stroke", "var(--border-hover-color)");
2726
+ return;
2727
+ }
2728
+ P(this).style("stroke", void 0).style("stroke-width", void 0), e.data._upToTheRootHighlighted && P(this).raise();
2729
+ },
2730
+ hdiagonal: Ta,
2731
+ diagonal: Ea,
2732
+ linkGroupArc: le().x((e) => e.x).y((e) => e.y)
2733
+ };
2734
+ return e.layoutBindings = wa(e), e;
2735
+ }, Aa = (e, n, r) => {
2736
+ let i = (0, k.useRef)(e.treeChartSettings?.transform), a = (0, k.useRef)(null);
2737
+ return a.current = (n) => {
2738
+ let i = ka(), a = n.treeOptions, s = {
2739
+ linkUpdate: i.linkUpdate,
2740
+ getButtonContent: i.buttonContent,
2741
+ ...Sr[a.layoutPreset]
2742
+ }, c = s.sizes ? s.sizes(e) : {}, l = {
2743
+ ...d,
2744
+ ...e.treeChartSettings?.nodeLayout?.border
2745
+ };
2746
+ l.enabled === !1 && (l.borderWidth = 0);
2747
+ let u = {
2748
+ ...t,
2749
+ ...e.treeChartSettings?.nodeLayout.hoverStyle
2750
+ }, f = u.enabled ? u.borderWidth : 0;
2751
+ r.nodeWidth((e) => (a.nodeWidth ? a.nodeWidth : typeof s.width == "function" ? s.width(e) : s.width) + (l.borderWidth ?? 0) * 2).nodeHeight((e) => (e.id === "__root__" ? 0 : typeof s.height == "function" ? s.height(e, c) : s.height) + (l.borderWidth ?? 0) * 2).nodeDefaultBackground(e.treeChartSettings?.nodeLayout?.backgroundColor ?? o.backgroundColor).compact(a.compact).layout(a.directionOrigin).padding({
2752
+ top: f,
2753
+ right: f,
2754
+ bottom: f,
2755
+ left: f
2756
+ }).gridEnabled(a.gridLayoutEnabled).gridRows(a.gridLayoutRows).forceAutoFit(a.forceAutoFit).setActiveNodeCentered(!a.forceAutoFit).duration(a.animate === !1 ? 0 : 400).root(n.root).linkUpdate(s.linkUpdate).buttonContent(s.getButtonContent).container(n.container).nodeContent((e) => s.getNodeContent(e, { config: r.getConfig() })).render({
2757
+ zoomToFit: n.zoomToFit ?? !1,
2758
+ transform: n.transform
2759
+ });
2760
+ }, (0, k.useCallback)((e, t) => {
2761
+ a.current({
2762
+ root: e,
2763
+ container: n.current,
2764
+ treeOptions: t,
2765
+ zoomToFit: !0,
2766
+ transform: i.current ?? void 0
2767
+ });
2768
+ }, []);
2769
+ }, ja = {
2770
+ directionOrigin: "top",
2771
+ compact: !1,
2772
+ layoutPreset: a.Basic,
2773
+ forceAutoFit: !1,
2774
+ animate: !0,
2775
+ interactive: !0,
2776
+ gridLayoutEnabled: !1,
2777
+ gridLayoutRows: 0
2778
+ }, Ma = (e, t) => {
2779
+ let n = {
2780
+ directionOrigin: e.treeChartSettings?.directionOrigin ?? ja.directionOrigin,
2781
+ compact: e.treeChartSettings?.compact ?? ja.compact,
2782
+ layoutPreset: e.treeChartSettings?.nodeLayout?.preset ?? ja.layoutPreset,
2783
+ forceAutoFit: e.treeChartSettings?.forceAutoFit ?? ja.forceAutoFit,
2784
+ nodeWidth: e.treeChartSettings?.nodeLayout?.width,
2785
+ animate: !(t?.isPrintMode ?? !1),
2786
+ interactive: t.disable?.interactions !== !0,
2787
+ gridLayoutEnabled: e.treeChartSettings.gridLayout?.enabled ?? !1,
2788
+ gridLayoutRows: e.treeChartSettings.gridLayout?.rows ?? 0
2789
+ };
2790
+ return {
2791
+ treeSettings: n,
2792
+ layout: Sr[n.layoutPreset || a.Basic]
2793
+ };
2794
+ };
2795
+ function Na(e) {
2796
+ var t = 0, n = e.children, r = n && n.length;
2797
+ if (!r) t = 1;
2798
+ else for (; --r >= 0;) t += n[r].value;
2799
+ e.value = t;
2800
+ }
2801
+ function Pa() {
2802
+ return this.eachAfter(Na);
2803
+ }
2804
+ function Fa(e) {
2805
+ var t = this, n, r = [t], i, a, o;
2806
+ do
2807
+ for (n = r.reverse(), r = []; t = n.pop();) if (e(t), i = t.children, i) for (a = 0, o = i.length; a < o; ++a) r.push(i[a]);
2808
+ while (r.length);
2809
+ return this;
2810
+ }
2811
+ function Ia(e) {
2812
+ for (var t = this, n = [t], r, i; t = n.pop();) if (e(t), r = t.children, r) for (i = r.length - 1; i >= 0; --i) n.push(r[i]);
2813
+ return this;
2814
+ }
2815
+ function La(e) {
2816
+ for (var t = this, n = [t], r = [], i, a, o; t = n.pop();) if (r.push(t), i = t.children, i) for (a = 0, o = i.length; a < o; ++a) n.push(i[a]);
2817
+ for (; t = r.pop();) e(t);
2818
+ return this;
2819
+ }
2820
+ function Ra(e) {
2821
+ return this.eachAfter(function(t) {
2822
+ for (var n = +e(t.data) || 0, r = t.children, i = r && r.length; --i >= 0;) n += r[i].value;
2823
+ t.value = n;
2824
+ });
2825
+ }
2826
+ function za(e) {
2827
+ return this.eachBefore(function(t) {
2828
+ t.children && t.children.sort(e);
2829
+ });
2830
+ }
2831
+ function Ba(e) {
2832
+ for (var t = this, n = Va(t, e), r = [t]; t !== n;) t = t.parent, r.push(t);
2833
+ for (var i = r.length; e !== n;) r.splice(i, 0, e), e = e.parent;
2834
+ return r;
2835
+ }
2836
+ function Va(e, t) {
2837
+ if (e === t) return e;
2838
+ var n = e.ancestors(), r = t.ancestors(), i = null;
2839
+ for (e = n.pop(), t = r.pop(); e === t;) i = e, e = n.pop(), t = r.pop();
2840
+ return i;
2841
+ }
2842
+ function Ha() {
2843
+ for (var e = this, t = [e]; e = e.parent;) t.push(e);
2844
+ return t;
2845
+ }
2846
+ function Ua() {
2847
+ var e = [];
2848
+ return this.each(function(t) {
2849
+ e.push(t);
2850
+ }), e;
2851
+ }
2852
+ function Wa() {
2853
+ var e = [];
2854
+ return this.eachBefore(function(t) {
2855
+ t.children || e.push(t);
2856
+ }), e;
2857
+ }
2858
+ function Ga() {
2859
+ var e = this, t = [];
2860
+ return e.each(function(n) {
2861
+ n !== e && t.push({
2862
+ source: n.parent,
2863
+ target: n
2864
+ });
2865
+ }), t;
2866
+ }
2867
+ function Ka(e, t) {
2868
+ var n = new Za(e), r = +e.value && (n.value = e.value), i, a = [n], o, s, c, l;
2869
+ for (t ??= Ja; i = a.pop();) if (r && (i.value = +i.data.value), (s = t(i.data)) && (l = s.length)) for (i.children = Array(l), c = l - 1; c >= 0; --c) a.push(o = i.children[c] = new Za(s[c])), o.parent = i, o.depth = i.depth + 1;
2870
+ return n.eachBefore(Xa);
2871
+ }
2872
+ function qa() {
2873
+ return Ka(this).eachBefore(Ya);
2874
+ }
2875
+ function Ja(e) {
2876
+ return e.children;
2877
+ }
2878
+ function Ya(e) {
2879
+ e.data = e.data.data;
2880
+ }
2881
+ function Xa(e) {
2882
+ var t = 0;
2883
+ do
2884
+ e.height = t;
2885
+ while ((e = e.parent) && e.height < ++t);
2886
+ }
2887
+ function Za(e) {
2888
+ this.data = e, this.depth = this.height = 0, this.parent = null;
2889
+ }
2890
+ Za.prototype = Ka.prototype = {
2891
+ constructor: Za,
2892
+ count: Pa,
2893
+ each: Fa,
2894
+ eachAfter: La,
2895
+ eachBefore: Ia,
2896
+ sum: Ra,
2897
+ sort: za,
2898
+ path: Ba,
2899
+ ancestors: Ha,
2900
+ descendants: Ua,
2901
+ leaves: Wa,
2902
+ links: Ga,
2903
+ copy: qa
2904
+ };
2905
+ var Qa = S();
2906
+ we();
2907
+ var { version: $a } = {
2908
+ name: "d3-flextree",
2909
+ version: "2.1.2",
2910
+ main: "build/d3-flextree.js",
2911
+ module: "index",
2912
+ "jsnext:main": "index",
2913
+ author: {
2914
+ name: "Chris Maloney",
2915
+ url: "http://chrismaloney.org"
2916
+ },
2917
+ description: "Flexible tree layout algorithm that allows for variable node sizes.",
2918
+ keywords: [
2919
+ "d3",
2920
+ "d3-module",
2921
+ "layout",
2922
+ "tree",
2923
+ "hierarchy",
2924
+ "d3-hierarchy",
2925
+ "plugin",
2926
+ "d3-plugin",
2927
+ "infovis",
2928
+ "visualization",
2929
+ "2d"
2930
+ ],
2931
+ homepage: "https://github.com/klortho/d3-flextree",
2932
+ license: "WTFPL",
2933
+ repository: {
2934
+ type: "git",
2935
+ url: "https://github.com/klortho/d3-flextree.git"
2936
+ },
2937
+ scripts: {
2938
+ clean: "rm -rf build demo test",
2939
+ "build:demo": "rollup -c --environment BUILD:demo",
2940
+ "build:dev": "rollup -c --environment BUILD:dev",
2941
+ "build:prod": "rollup -c --environment BUILD:prod",
2942
+ "build:test": "rollup -c --environment BUILD:test",
2943
+ build: "rollup -c",
2944
+ lint: "eslint index.js src",
2945
+ "test:main": "node test/bundle.js",
2946
+ "test:browser": "node test/browser-tests.js",
2947
+ test: "npm-run-all test:*",
2948
+ prepare: "npm-run-all clean build lint test"
2949
+ },
2950
+ dependencies: { "d3-hierarchy": "^1.1.5" },
2951
+ devDependencies: {
2952
+ "babel-plugin-external-helpers": "^6.22.0",
2953
+ "babel-preset-es2015-rollup": "^3.0.0",
2954
+ d3: "^4.13.0",
2955
+ "d3-selection-multi": "^1.0.1",
2956
+ eslint: "^4.19.1",
2957
+ jsdom: "^11.6.2",
2958
+ "npm-run-all": "^4.1.2",
2959
+ rollup: "^0.55.3",
2960
+ "rollup-plugin-babel": "^2.7.1",
2961
+ "rollup-plugin-commonjs": "^8.0.2",
2962
+ "rollup-plugin-copy": "^0.2.3",
2963
+ "rollup-plugin-json": "^2.3.0",
2964
+ "rollup-plugin-node-resolve": "^3.0.2",
2965
+ "rollup-plugin-uglify": "^3.0.0",
2966
+ "uglify-es": "^3.3.9"
2967
+ }
2968
+ }, eo = Object.freeze({
2969
+ children: (e) => e.children,
2970
+ nodeSize: (e) => e.data.size,
2971
+ spacing: 0
2972
+ });
2973
+ function to(e) {
2974
+ let t = Object.assign({}, eo, e);
2975
+ function n(e) {
2976
+ let n = t[e];
2977
+ return typeof n == "function" ? n : () => n;
2978
+ }
2979
+ function r(e) {
2980
+ let t = o(a(), e, (e) => e.children);
2981
+ return t.update(), t.data;
2982
+ }
2983
+ function i() {
2984
+ let e = n("nodeSize"), t = n("spacing");
2985
+ return class n extends Ka.prototype.constructor {
2986
+ constructor(e) {
2987
+ super(e);
2988
+ }
2989
+ copy() {
2990
+ let e = o(this.constructor, this, (e) => e.children);
2991
+ return e.each((e) => e.data = e.data.data), e;
2992
+ }
2993
+ get size() {
2994
+ return e(this);
2995
+ }
2996
+ spacing(e) {
2997
+ return t(this, e);
2998
+ }
2999
+ get nodes() {
3000
+ return this.descendants();
3001
+ }
3002
+ get xSize() {
3003
+ return this.size[0];
3004
+ }
3005
+ get ySize() {
3006
+ return this.size[1];
3007
+ }
3008
+ get top() {
3009
+ return this.y;
3010
+ }
3011
+ get bottom() {
3012
+ return this.y + this.ySize;
3013
+ }
3014
+ get left() {
3015
+ return this.x - this.xSize / 2;
3016
+ }
3017
+ get right() {
3018
+ return this.x + this.xSize / 2;
3019
+ }
3020
+ get root() {
3021
+ let e = this.ancestors();
3022
+ return e[e.length - 1];
3023
+ }
3024
+ get numChildren() {
3025
+ return this.hasChildren ? this.children.length : 0;
3026
+ }
3027
+ get hasChildren() {
3028
+ return !this.noChildren;
3029
+ }
3030
+ get noChildren() {
3031
+ return this.children === null;
3032
+ }
3033
+ get firstChild() {
3034
+ return this.hasChildren ? this.children[0] : null;
3035
+ }
3036
+ get lastChild() {
3037
+ return this.hasChildren ? this.children[this.numChildren - 1] : null;
3038
+ }
3039
+ get extents() {
3040
+ return (this.children || []).reduce((e, t) => n.maxExtents(e, t.extents), this.nodeExtents);
3041
+ }
3042
+ get nodeExtents() {
3043
+ return {
3044
+ top: this.top,
3045
+ bottom: this.bottom,
3046
+ left: this.left,
3047
+ right: this.right
3048
+ };
3049
+ }
3050
+ static maxExtents(e, t) {
3051
+ return {
3052
+ top: Math.min(e.top, t.top),
3053
+ bottom: Math.max(e.bottom, t.bottom),
3054
+ left: Math.min(e.left, t.left),
3055
+ right: Math.max(e.right, t.right)
3056
+ };
3057
+ }
3058
+ };
3059
+ }
3060
+ function a() {
3061
+ let e = i(), t = n("nodeSize"), r = n("spacing");
3062
+ return class extends e {
3063
+ constructor(e) {
3064
+ super(e), Object.assign(this, {
3065
+ x: 0,
3066
+ y: 0,
3067
+ relX: 0,
3068
+ prelim: 0,
3069
+ shift: 0,
3070
+ change: 0,
3071
+ lExt: this,
3072
+ lExtRelX: 0,
3073
+ lThr: null,
3074
+ rExt: this,
3075
+ rExtRelX: 0,
3076
+ rThr: null
3077
+ });
3078
+ }
3079
+ get size() {
3080
+ return t(this.data);
3081
+ }
3082
+ spacing(e) {
3083
+ return r(this.data, e.data);
3084
+ }
3085
+ get x() {
3086
+ return this.data.x;
3087
+ }
3088
+ set x(e) {
3089
+ this.data.x = e;
3090
+ }
3091
+ get y() {
3092
+ return this.data.y;
3093
+ }
3094
+ set y(e) {
3095
+ this.data.y = e;
3096
+ }
3097
+ update() {
3098
+ return no(this), ro(this), this;
3099
+ }
3100
+ };
3101
+ }
3102
+ function o(e, t, n) {
3103
+ let r = (t, i) => {
3104
+ let a = new e(t);
3105
+ Object.assign(a, {
3106
+ parent: i,
3107
+ depth: i === null ? 0 : i.depth + 1,
3108
+ height: 0,
3109
+ length: 1
3110
+ });
3111
+ let o = n(t) || [];
3112
+ return a.children = o.length === 0 ? null : o.map((e) => r(e, a)), a.children && Object.assign(a, a.children.reduce((e, t) => ({
3113
+ height: Math.max(e.height, t.height + 1),
3114
+ length: e.length + t.length
3115
+ }), a)), a;
3116
+ };
3117
+ return r(t, null);
3118
+ }
3119
+ return Object.assign(r, {
3120
+ nodeSize(e) {
3121
+ return arguments.length ? (t.nodeSize = e, r) : t.nodeSize;
3122
+ },
3123
+ spacing(e) {
3124
+ return arguments.length ? (t.spacing = e, r) : t.spacing;
3125
+ },
3126
+ children(e) {
3127
+ return arguments.length ? (t.children = e, r) : t.children;
3128
+ },
3129
+ hierarchy(e, n) {
3130
+ let r = n === void 0 ? t.children : n;
3131
+ return o(i(), e, r);
3132
+ },
3133
+ dump(e) {
3134
+ let t = n("nodeSize"), r = (e) => (n) => {
3135
+ let i = e + " ", a = e + " ", { x: o, y: s } = n, c = t(n), l = n.children || [], u = l.length === 0 ? " " : `,${i}children: [${a}${l.map(r(a)).join(a)}${i}],${e}`;
3136
+ return `{ size: [${c.join(", ")}],${i}x: ${o}, y: ${s}${u}},`;
3137
+ };
3138
+ return r("\n")(e);
3139
+ }
3140
+ }), r;
3141
+ }
3142
+ to.version = $a;
3143
+ var no = (e, t = 0) => (e.y = t, (e.children || []).reduce((t, n) => {
3144
+ let [r, i] = t;
3145
+ no(n, e.y + e.ySize);
3146
+ let a = (r === 0 ? n.lExt : n.rExt).bottom;
3147
+ r !== 0 && ao(e, r, i);
3148
+ let o = mo(a, r, i);
3149
+ return [r + 1, o];
3150
+ }, [0, null]), io(e), po(e), e), ro = (e, t, n) => {
3151
+ t === void 0 && (t = -e.relX - e.prelim, n = 0);
3152
+ let r = t + e.relX;
3153
+ return e.relX = r + e.prelim - n, e.prelim = 0, e.x = n + e.relX, (e.children || []).forEach((t) => ro(t, r, e.x)), e;
3154
+ }, io = (e) => {
3155
+ (e.children || []).reduce((e, t) => {
3156
+ let [n, r] = e, i = n + t.shift, a = r + i + t.change;
3157
+ return t.relX += a, [i, a];
3158
+ }, [0, 0]);
3159
+ }, ao = (e, t, n) => {
3160
+ let r = e.children[t - 1], i = e.children[t], a = r, o = r.relX, s = i, c = i.relX, l = !0;
3161
+ for (; a && s;) {
3162
+ a.bottom > n.lowY && (n = n.next);
3163
+ let r = o + a.prelim - (c + s.prelim) + a.xSize / 2 + s.xSize / 2 + a.spacing(s);
3164
+ (r > 0 || r < 0 && l) && (c += r, oo(i, r), so(e, t, n.index, r)), l = !1;
3165
+ let u = a.bottom, d = s.bottom;
3166
+ u <= d && (a = lo(a), a && (o += a.relX)), u >= d && (s = co(s), s && (c += s.relX));
3167
+ }
3168
+ !a && s ? uo(e, t, s, c) : a && !s && fo(e, t, a, o);
3169
+ }, oo = (e, t) => {
3170
+ e.relX += t, e.lExtRelX += t, e.rExtRelX += t;
3171
+ }, so = (e, t, n, r) => {
3172
+ let i = e.children[t], a = t - n;
3173
+ if (a > 1) {
3174
+ let t = r / a;
3175
+ e.children[n + 1].shift += t, i.shift -= t, i.change -= r - t;
3176
+ }
3177
+ }, co = (e) => e.hasChildren ? e.firstChild : e.lThr, lo = (e) => e.hasChildren ? e.lastChild : e.rThr, uo = (e, t, n, r) => {
3178
+ let i = e.firstChild, a = i.lExt, o = e.children[t];
3179
+ a.lThr = n;
3180
+ let s = r - n.relX - i.lExtRelX;
3181
+ a.relX += s, a.prelim -= s, i.lExt = o.lExt, i.lExtRelX = o.lExtRelX;
3182
+ }, fo = (e, t, n, r) => {
3183
+ let i = e.children[t], a = i.rExt, o = e.children[t - 1];
3184
+ a.rThr = n;
3185
+ let s = r - n.relX - i.rExtRelX;
3186
+ a.relX += s, a.prelim -= s, i.rExt = o.rExt, i.rExtRelX = o.rExtRelX;
3187
+ }, po = (e) => {
3188
+ if (e.hasChildren) {
3189
+ let t = e.firstChild, n = e.lastChild, r = (t.prelim + t.relX - t.xSize / 2 + n.relX + n.prelim + n.xSize / 2) / 2;
3190
+ Object.assign(e, {
3191
+ prelim: r,
3192
+ lExt: t.lExt,
3193
+ lExtRelX: t.lExtRelX,
3194
+ rExt: n.rExt,
3195
+ rExtRelX: n.rExtRelX
3196
+ });
3197
+ }
3198
+ }, mo = (e, t, n) => {
3199
+ for (; n !== null && e >= n.lowY;) n = n.next;
3200
+ return {
3201
+ lowY: e,
3202
+ index: t,
3203
+ next: n
3204
+ };
3205
+ };
3206
+ oe();
3207
+ var Z = {
3208
+ selection: N,
3209
+ select: P,
3210
+ max: Se,
3211
+ min: Te,
3212
+ sum: Ce,
3213
+ cumsum: Ee,
3214
+ tree: Ze,
3215
+ stratify: ze,
3216
+ zoom: Ca,
3217
+ zoomIdentity: pa,
3218
+ linkHorizontal: le,
3219
+ flextree: to
3220
+ }, ho = class {
3221
+ stateInternal = {
3222
+ root: null,
3223
+ lastTransform: {
3224
+ x: 0,
3225
+ y: 0,
3226
+ k: 1
3227
+ },
3228
+ highlightedNode: null
3229
+ };
3230
+ getConfig;
3231
+ constructor() {
3232
+ let e = ka();
3233
+ this.getConfig = () => e, Object.keys(e).forEach((t) => {
3234
+ this[t] = function(n) {
3235
+ if (arguments.length) e[t] = n;
3236
+ else return e[t];
3237
+ return this;
3238
+ };
3239
+ }), this.initializeEnterExitUpdatePattern(), this.extendHierarchyNodePrototype();
3240
+ }
3241
+ init() {
3242
+ let e = this.getChartState(), t = this.getConfig(), n = Z.select(t.container), r = n.node().getBoundingClientRect();
3243
+ e.containerRect = r;
3244
+ let i = n.patternify({
3245
+ tag: "svg",
3246
+ selector: "svg-chart-container"
3247
+ }).attr("width", r.width).attr("height", r.height).attr("font-family", t.defaultFont);
3248
+ e.svg = i;
3249
+ let a = i.patternify({
3250
+ tag: "g",
3251
+ selector: "chart"
3252
+ });
3253
+ e.chart = a, e.centerG = a.patternify({
3254
+ tag: "g",
3255
+ selector: "center-group"
3256
+ }), e.linksWrapper = e.centerG.patternify({
3257
+ tag: "g",
3258
+ selector: "links-wrapper"
3259
+ }), e.nodesWrapper = e.centerG.patternify({
3260
+ tag: "g",
3261
+ selector: "nodes-wrapper"
3262
+ });
3263
+ let o = null;
3264
+ e.nodesWrapper.on("mouseleave", () => {
3265
+ o &&= (t.onNodeLeave(o), null);
3266
+ }).on("mousemove", (e) => {
3267
+ let n = e.target.closest("g.node"), r = null;
3268
+ n && ([...e.target.classList].includes("node-button-foreign-object") || (r = Z.select(n).datum(), r.parent || (r = null))), o && o !== r && t.onNodeLeave(o), r && o !== r && t.onNodeHover(r), o = r;
3269
+ }), e.chart = a;
3270
+ let s = { zoom: null }, c = !1;
3271
+ s.zoom = t.createZoom().clickDistance(10).on("start", (e) => {
3272
+ t.onZoomStart(e);
3273
+ }).on("end", (n) => {
3274
+ c && (e.userTransform = {
3275
+ x: n.transform.x,
3276
+ y: n.transform.y,
3277
+ k: n.transform.k
3278
+ }, t.onUserZoom(e.userTransform)), c = !1, t.onZoomEnd(n);
3279
+ }).on("zoom", (e) => {
3280
+ t.onZoom(e), this.zoomed(e);
3281
+ }).scaleExtent(t.scaleExtent), e.zoomBehavior = s.zoom, i.on("wheel", () => {
3282
+ c = !0;
3283
+ }), i.call(e.zoomBehavior).on("dblclick.zoom", null).attr("cursor", "grab");
3284
+ let l = i.on("mousedown.zoom");
3285
+ i.on("mousedown.zoom", null), i.on("mousedown.zoom", (e) => {
3286
+ c = !0, setTimeout(() => {
3287
+ l?.call(i.node(), e);
3288
+ }, 0);
3289
+ });
3290
+ }
3291
+ getChartState() {
3292
+ return this.stateInternal;
3293
+ }
3294
+ initializeEnterExitUpdatePattern() {
3295
+ Z.selection.prototype.patternify = function(e) {
3296
+ let t = e.selector, n = e.tag, r = e.data || [t], i = this.selectAll("." + t).data(r, (e, t) => typeof e == "object" && e.id ? e.id : t);
3297
+ return i.exit().remove(), i = i.enter().append(n).merge(i), i.attr("class", t), i;
3298
+ };
3299
+ }
3300
+ extendHierarchyNodePrototype() {
3301
+ De.prototype.allDescendants || (De.prototype.allDescendants = function() {
3302
+ let e = [];
3303
+ this.each((t) => {
3304
+ e.push(t);
3305
+ });
3306
+ let t = (n) => {
3307
+ n._children && n._children.forEach((n) => {
3308
+ e.push(n), t(n);
3309
+ });
3310
+ };
3311
+ return t(this), e;
3312
+ });
3313
+ }
3314
+ initialZoom(e) {
3315
+ let t = this.getChartState();
3316
+ return t.lastTransform.k = e, this;
3317
+ }
3318
+ initialTransform(e) {
3319
+ if (e) {
3320
+ let t = this.getChartState();
3321
+ t.lastTransform = e;
3322
+ }
3323
+ return this;
3324
+ }
3325
+ render(e = {}) {
3326
+ let t = this.getConfig(), n = this.getChartState();
3327
+ if (!t.root?.children || t.root.children.length == 0) return this;
3328
+ let r = Z.select(t.container).node().getBoundingClientRect();
3329
+ if (n.containerRect = r, !r.width || !r.height) return this;
3330
+ let i = {
3331
+ chartWidth: r.width,
3332
+ chartHeight: r.height
3333
+ };
3334
+ return n.calc = i, n.calc.centerX = i.chartWidth / 2, n.calc.centerY = i.chartHeight / 2, n.flexTreeLayout = to({ nodeSize: (e) => {
3335
+ let n = t.nodeWidth(e), r = t.nodeHeight(e), i = t.siblingsMargin(e), a = t.childrenMargin(e);
3336
+ return t.layoutBindings[t.layout].nodeFlexSize({
3337
+ config: t,
3338
+ node: e,
3339
+ width: n,
3340
+ height: r,
3341
+ siblingsMargin: i,
3342
+ childrenMargin: a
3343
+ });
3344
+ } }).spacing((e, n) => e.parent == n.parent ? 0 : t.neighbourMargin(e, n)), this.setLayouts(), n.svg.attr("width", r.width).attr("height", r.height), this.update(n.root, e), this;
3345
+ }
3346
+ groupBy(e, t, n) {
3347
+ let r = {};
3348
+ return e.forEach((e) => {
3349
+ let n = t(e);
3350
+ r[n] || (r[n] = []), r[n].push(e);
3351
+ }), Object.keys(r).forEach((e) => {
3352
+ r[e] = n(r[e]);
3353
+ }), Object.entries(r);
3354
+ }
3355
+ calculateCompactFlexDimensions(e) {
3356
+ let t = this.getConfig();
3357
+ e.eachBefore((e) => {
3358
+ e.firstCompact = null, e.compactEven = null, e.flexCompactDim = null, e.firstCompactNode = null;
3359
+ }), e.eachBefore((e) => {
3360
+ if (e.children && e.children.length > 1) {
3361
+ let n = e.children.filter((e) => !e.children);
3362
+ if (n.length < 2) return;
3363
+ n.forEach((e, t) => {
3364
+ t || (e.firstCompact = !0), t % 2 ? e.compactEven = !1 : e.compactEven = !0, e.row = Math.floor(t / 2);
3365
+ });
3366
+ let r = Z.max(n.filter((e) => e.compactEven), t.layoutBindings[t.layout].compactDimension.sizeColumn), i = Z.max(n.filter((e) => !e.compactEven), t.layoutBindings[t.layout].compactDimension.sizeColumn), a = Math.max(r, i) * 2, o = this.groupBy(n, (e) => e.row, (e) => Z.max(e, (e) => t.layoutBindings[t.layout].compactDimension.sizeRow(e) + t.compactMarginBetween())), s = Z.sum(o.map((e) => e[1]));
3367
+ n.forEach((e) => {
3368
+ e.firstCompactNode = n[0], e.firstCompact ? e.flexCompactDim = [a + t.compactMarginPair(e), s - t.compactMarginBetween()] : e.flexCompactDim = [0, 0];
3369
+ }), e.flexCompactDim = null;
3370
+ }
3371
+ });
3372
+ }
3373
+ calculateCompactFlexPositions(e) {
3374
+ let t = this.getConfig();
3375
+ e.eachBefore((e) => {
3376
+ if (e.children) {
3377
+ let n = e.children.filter((e) => e.flexCompactDim), r = n[0];
3378
+ if (!r) return;
3379
+ n.forEach((e, n) => {
3380
+ n == 0 && (r.x -= r.flexCompactDim[0] / 2), n & n % 2 - 1 ? e.x = r.x + r.flexCompactDim[0] * .25 - t.compactMarginPair(e) / 4 : n && (e.x = r.x + r.flexCompactDim[0] * .75 + t.compactMarginPair(e) / 4);
3381
+ });
3382
+ let i = r.x + r.flexCompactDim[0] * .5;
3383
+ r.x = r.x + r.flexCompactDim[0] * .25 - t.compactMarginPair(r) / 4;
3384
+ let a = e.x - i;
3385
+ Math.abs(a) < 10 && n.forEach((e) => e.x += a);
3386
+ let o = this.groupBy(n, (e) => e.row, (e) => Z.max(e, (e) => t.layoutBindings[t.layout].compactDimension.sizeRow(e))), s = Z.cumsum(o.map((e) => e[1] + t.compactMarginBetween()));
3387
+ n.forEach((e) => {
3388
+ e.row ? e.y = r.y + s[e.row - 1] : e.y = r.y;
3389
+ });
3390
+ }
3391
+ });
3392
+ }
3393
+ calculateGridLayout(e) {
3394
+ let t = this.getChartState(), n = this.getConfig(), r = e.descendants().slice(1);
3395
+ if (e.x = 0, e.y = 0, !r.length) return e;
3396
+ let i = Z.max(r, (e) => e.width) ?? 0, a = Z.max(r, (e) => e.height) ?? 0, o = Z.max(r, (e) => n.siblingsMargin(e)) ?? 0, s = Math.max(1, i + o), c = Math.max(1, a + o), l = Math.max(1, Math.floor((t.calc?.chartWidth ?? s) / s)), u = n.layout === "top" || n.layout === "bottom", d = Math.max(0, Math.floor(n.gridRows)), f = d === 0 ? l : u ? Math.ceil(r.length / d) : d, p = Math.ceil(r.length / f);
3397
+ return r.forEach((e, t) => {
3398
+ let i, a;
3399
+ if (u) {
3400
+ let e = Math.floor(t / f), o = t % f, s = Math.min(f, r.length - e * f);
3401
+ i = o + (f - s) / 2, a = n.layout === "bottom" ? p - e - 1 : e;
3402
+ } else {
3403
+ let e = Math.floor(t / p), o = t % p, s = Math.min(p, r.length - e * p), c = (p - s) / 2;
3404
+ i = n.layout === "right" ? f - e - 1 : e, a = o + c;
3405
+ }
3406
+ let o = i * s, l = a * c;
3407
+ switch (n.layout) {
3408
+ case "bottom":
3409
+ e.x = o + e.width / 2, e.y = l + e.height;
3410
+ break;
3411
+ case "left":
3412
+ e.x = o, e.y = l + e.height / 2;
3413
+ break;
3414
+ case "right":
3415
+ e.x = o + e.width, e.y = l + e.height / 2;
3416
+ break;
3417
+ default:
3418
+ e.x = o + e.width / 2, e.y = l;
3419
+ break;
3420
+ }
3421
+ }), e;
3422
+ }
3423
+ update({ x0: e, y0: t }, n = {}) {
3424
+ let r = this.getChartState(), i = this.getConfig();
3425
+ i.compact && !i.gridEnabled && this.calculateCompactFlexDimensions(r.root);
3426
+ let a = i.gridEnabled ? this.calculateGridLayout(r.root) : r.flexTreeLayout(r.root);
3427
+ i.compact && !i.gridEnabled && this.calculateCompactFlexPositions(r.root), i.forceAutoFit ? (r.svg.attr("cursor", "default"), r.zoomBehavior.filter(() => !1)) : (r.svg.attr("cursor", "grab"), r.zoomBehavior.filter(() => !0));
3428
+ let o = a.descendants().slice(1), s = r.root.children?.length || 0, c = i.gridEnabled ? [] : a.descendants().slice(s + 1);
3429
+ i.gridEnabled || o.forEach((e) => i.layoutBindings[i.layout].swap(e));
3430
+ let l = r.linksWrapper.selectAll("path.link").data(c, (e) => i.nodeId(e.data)), u = l.enter().insert("path", "g").attr("class", "link").attr("d", (e) => {
3431
+ let t = {
3432
+ x: i.layoutBindings[i.layout].linkJoinX(e.parent || e),
3433
+ y: i.layoutBindings[i.layout].linkJoinY(e.parent || e)
3434
+ };
3435
+ return i.layoutBindings[i.layout].diagonal(t, t, t);
3436
+ }).merge(l);
3437
+ u.each(i.linkUpdate), u.transition().duration(i.duration).attr("d", (e) => {
3438
+ let t = i.compact && e.flexCompactDim ? {
3439
+ x: i.layoutBindings[i.layout].compactLinkMidX(e, i),
3440
+ y: i.layoutBindings[i.layout].compactLinkMidY(e, i)
3441
+ } : {
3442
+ x: i.layoutBindings[i.layout].linkX(e),
3443
+ y: i.layoutBindings[i.layout].linkY(e)
3444
+ }, n = {
3445
+ x: i.layoutBindings[i.layout].linkParentX(e),
3446
+ y: i.layoutBindings[i.layout].linkParentY(e)
3447
+ }, r = i.compact && e.flexCompactDim ? {
3448
+ x: i.layoutBindings[i.layout].linkCompactXStart(e),
3449
+ y: i.layoutBindings[i.layout].linkCompactYStart(e)
3450
+ } : t;
3451
+ return i.layoutBindings[i.layout].diagonal(t, n, r, { sy: i.linkYOffset });
3452
+ }), l.exit().transition().duration(i.duration).attr("d", (e) => {
3453
+ let t = {
3454
+ x: i.layoutBindings[i.layout].linkJoinX(e.parent || e),
3455
+ y: i.layoutBindings[i.layout].linkJoinY(e.parent || e)
3456
+ };
3457
+ return i.layoutBindings[i.layout].diagonal(t, t, null, { sy: i.linkYOffset });
3458
+ }).remove();
3459
+ let d = this, f = r.nodesWrapper.selectAll("g.node").data(o, ({ data: e }) => i.nodeId(e)), p = f.enter().append("g").attr("data-brush", (e) => {
3460
+ let t = e.data;
3461
+ if (t.brush) return t.brush.key;
3462
+ }).attr("class", "node").attr("transform", (n) => n == r.root ? `translate(${e},${t})` : `translate(${i.layoutBindings[i.layout].nodeJoinX(n.parent || n)},${i.layoutBindings[i.layout].nodeJoinY(n.parent || n)})`).classed("draggable droppable", !0).on("click.node", (e, t) => {
3463
+ [...e.srcElement.classList].includes("node-button-foreign-object") || i.onNodeClick(t);
3464
+ }).call(Nr().filter(function(e, t) {
3465
+ return r.dragEnabled && t.depth > 0;
3466
+ }).on("start", function(e, t) {
3467
+ d.onDragStart(this, e, t);
3468
+ }).on("drag", function(e) {
3469
+ d.onDrag(this, e);
3470
+ }).on("end", function(e) {
3471
+ d.onDragEnd(this, e);
3472
+ }));
3473
+ p.each(i.nodeEnter), p.patternify({
3474
+ tag: "rect",
3475
+ selector: "node-rect",
3476
+ data: (e) => [e]
3477
+ });
3478
+ let m = p.merge(f);
3479
+ m.patternify({
3480
+ tag: "foreignObject",
3481
+ selector: "node-foreign-object",
3482
+ data: (e) => [e]
3483
+ }).style("overflow", "visible").patternify({
3484
+ tag: "xhtml:div",
3485
+ selector: "node-foreign-object-div",
3486
+ data: (e) => [e]
3487
+ }), this.restyleForeignObjectElements(), p.patternify({
3488
+ tag: "g",
3489
+ selector: "node-button-g",
3490
+ data: (e) => [e]
3491
+ }).on("click", (e, t) => this.onButtonClick(e, t)).patternify({
3492
+ tag: "foreignObject",
3493
+ selector: "node-button-foreign-object",
3494
+ data: (e) => [e]
3495
+ }).attr("width", (e) => i.nodeButtonWidth(e)).attr("height", (e) => i.nodeButtonHeight(e)).attr("x", (e) => i.nodeButtonX(e)).attr("y", (e) => i.nodeButtonY(e)).style("overflow", "visible").patternify({
3496
+ tag: "xhtml:div",
3497
+ selector: "node-button-div",
3498
+ data: (e) => [e]
3499
+ }), m.transition().attr("opacity", 0).duration(i.duration).attr("transform", ({ x: e, y: t, width: n, height: r }) => i.layoutBindings[i.layout].nodeUpdateTransform({
3500
+ x: e,
3501
+ y: t,
3502
+ width: n,
3503
+ height: r
3504
+ })).attr("opacity", 1), m.select(".node-rect").attr("width", ({ width: e }) => e).attr("height", ({ height: e }) => e).attr("x", () => 0).attr("y", () => 0).attr("rx", 3).attr("fill", "none"), m.select(".node-button-g").attr("transform", ({ width: e, height: t }) => `translate(${i.layoutBindings[i.layout].buttonX({
3505
+ width: e,
3506
+ height: t
3507
+ })},${i.layoutBindings[i.layout].buttonY({
3508
+ width: e,
3509
+ height: t
3510
+ })})`).attr("display", ({ data: e }) => !i.gridEnabled && e._directSubordinates > 0 ? null : "none").attr("opacity", ({ children: e, _children: t }) => e || t ? 1 : 0), m.select(".node-button-foreign-object .node-button-div").html((e) => i.buttonContent({
3511
+ node: e,
3512
+ config: i
3513
+ })), m.attr("data-value", (e) => {
3514
+ let t = e.data;
3515
+ if (t.brush) return t.brush.value;
3516
+ }), m.each(i.nodeUpdate);
3517
+ let h = f.exit();
3518
+ h.each(i.nodeExit);
3519
+ let g = h.data().reduce((e, t) => e.depth < t.depth ? e : t, { depth: Infinity });
3520
+ h.attr("opacity", 1).transition().duration(i.duration).attr("transform", () => {
3521
+ let { x: e, y: t, width: n, height: r } = g.parent || {};
3522
+ return `translate(${i.layoutBindings[i.layout].nodeJoinX({
3523
+ x: e,
3524
+ y: t,
3525
+ width: n,
3526
+ height: r
3527
+ })},${i.layoutBindings[i.layout].nodeJoinY({
3528
+ x: e,
3529
+ y: t,
3530
+ width: n,
3531
+ height: r
3532
+ })})`;
3533
+ }).on("end", function() {
3534
+ Z.select(this).remove();
3535
+ }).attr("opacity", 0), o.forEach((e) => {
3536
+ e.x0 = e.x, e.y0 = e.y;
3537
+ });
3538
+ let _ = r.allNodes.filter((e) => e.data._centered)[0];
3539
+ if (_) {
3540
+ let e = [_];
3541
+ _.data._centeredWithDescendants && (e = i.compact ? _.descendants().filter((e, t) => t < 7) : _.descendants().filter((e, t, n) => {
3542
+ let r = Math.round(n.length / 2);
3543
+ return n.length % 2 ? t > r - 2 && t < r + 2 - 1 : t > r - 2 && t < r + 2;
3544
+ })), _.data._centeredWithDescendants = null, _.data._centered = null, this.fit({
3545
+ animate: !0,
3546
+ scale: !1,
3547
+ nodes: e
3548
+ });
3549
+ } else i.forceAutoFit ? this.fit() : n.transform ? this.applyTransform(n.transform) : n.zoomToFit && this.fit();
3550
+ }
3551
+ highlight(e) {
3552
+ let t = this.getChartState();
3553
+ if (e === t.highlightedNode) return;
3554
+ let n = /* @__PURE__ */ new Set([...t.highlightedNode?.ancestors() ?? [], ...e?.ancestors() ?? []]);
3555
+ t.highlightedNode && t.highlightedNode.ancestors().forEach((e) => {
3556
+ e.data._upToTheRootHighlighted = !1;
3557
+ }), e && e.ancestors().forEach((e) => {
3558
+ e.data._upToTheRootHighlighted = !0;
3559
+ }), t.highlightedNode = e, t.svg?.selectAll(".node-foreign-object").filter((e) => !n || n.has(e)).classed("node-highlight", (e) => !!e.data._upToTheRootHighlighted);
3560
+ let r = this.getConfig();
3561
+ (t.linksWrapper?.selectAll("path.link").filter((e) => n.has(e)))?.each(r.linkUpdate);
3562
+ }
3563
+ restyleForeignObjectElements(e) {
3564
+ let t = this.getChartState(), n = this.getConfig();
3565
+ t.svg.selectAll(".node-foreign-object").filter((t) => !e || e.has(t)).classed("node-excluded", (e) => e.data._excluded).attr("width", ({ width: e }) => e).attr("height", ({ height: e }) => e).attr("x", () => 0).attr("y", () => 0), t.svg.selectAll(".node-foreign-object-div").filter((t) => !e || e.has(t)).style("width", ({ width: e }) => `${e}px`).style("height", ({ height: e }) => `${e}px`).html(function(e, r, i) {
3566
+ return n.nodeContent.bind(this)(e, r, i, t);
3567
+ });
3568
+ }
3569
+ onButtonClick(e, t) {
3570
+ let n = this.getConfig();
3571
+ t.parent && (n.setActiveNodeCentered && (t.data._centered = !0, t.data._centeredWithDescendants = !0), t.children ? (t._children = t.children, t.children = null) : (t.children = t._children, t._children = null), this.updateNodesState(), e.stopPropagation(), n.onExpandOrCollapse(t));
3572
+ }
3573
+ updateNodesState() {
3574
+ let e = this.getChartState();
3575
+ this.setLayouts(), this.update(e.root);
3576
+ }
3577
+ setLayouts() {
3578
+ let e = this.getChartState(), t = this.getConfig();
3579
+ e.root = t.root, e.root.each((e) => {
3580
+ let n = e._hierarchyHeight || e.height, r = t.nodeWidth(e), i = t.nodeHeight(e);
3581
+ Object.assign(e, {
3582
+ width: r,
3583
+ height: i,
3584
+ _hierarchyHeight: n
3585
+ });
3586
+ }), e.root.x0 = 0, e.root.y0 = 0, e.allNodes = e.root.allDescendants(), e.allNodes.forEach((e) => {
3587
+ Object.assign(e.data, {
3588
+ _directSubordinates: (e.children || e._children || []).length,
3589
+ _directSubordinatesPaging: (e.children || e._children || []).length,
3590
+ _totalSubordinates: e.allDescendants().length - 1
3591
+ });
3592
+ });
3593
+ }
3594
+ collapse(e) {
3595
+ e.children &&= (e._children = e.children, e._children.forEach((e) => this.collapse(e)), null);
3596
+ }
3597
+ expand(e) {
3598
+ e._children &&= (e.children = e._children, e.children.forEach((e) => this.expand(e)), null);
3599
+ }
3600
+ enableDrag() {
3601
+ let e = this.getChartState();
3602
+ e.dragEnabled || (e.dragEnabled = !0, this.getConfig().container.classList.add("drag-enabled"));
3603
+ }
3604
+ disableDrag() {
3605
+ let e = this.getChartState();
3606
+ e.dragEnabled && (e.dragEnabled = !1, this.getConfig().container.classList.remove("drag-enabled"));
3607
+ }
3608
+ onDragStart(e, t, n) {
3609
+ let r = this.getChartState();
3610
+ r.dragNode = n;
3611
+ let i = t.subject.width / 2;
3612
+ r.dragStartX = t.x - i, r.dragStartY = parseFloat(t.y), r.isDragStarting = !0, P(e).classed("dragging", !0);
3613
+ }
3614
+ onDrag(e, t) {
3615
+ let n = this.getChartState(), r = this.getConfig();
3616
+ if (!n.dragNode) return;
3617
+ let i = P(e);
3618
+ if (n.isDragStarting) {
3619
+ n.isDragStarting = !1, r.container.classList.add("dragging-active"), i.raise();
3620
+ let e = t.subject.descendants(), a = [...e || [], t.subject], o = e.filter((e) => e.data.id !== t.subject.id);
3621
+ n.linksWrapper.selectAll("path.link").data(a, (e) => r.nodeId(e.data)).remove(), o && n.nodesWrapper.selectAll("g.node").data(o, (e) => r.nodeId(e.data)).remove();
3622
+ }
3623
+ n.dropNode = null;
3624
+ let a = {
3625
+ width: t.subject.width,
3626
+ height: t.subject.height,
3627
+ left: t.x,
3628
+ right: t.x + t.subject.width,
3629
+ top: t.y,
3630
+ bottom: t.y + t.subject.height,
3631
+ midX: t.x + t.subject.width / 2,
3632
+ midY: t.y + t.subject.height / 2
3633
+ }, o = or("g.node:not(.dragging)");
3634
+ o.classed("drop-target", !1), o.filter(function(e) {
3635
+ let t = {
3636
+ left: e.x,
3637
+ right: e.x + e.width,
3638
+ top: e.y,
3639
+ bottom: e.y + e.height
3640
+ };
3641
+ if (n.dragNode.parent === e) return !1;
3642
+ if (a.midX > t.left && a.midX < t.right && a.midY > t.top && a.midY < t.bottom && this.classList.contains("droppable")) return n.dropNode = e, !!e;
3643
+ }).classed("drop-target", !0), n.dragStartX += parseFloat(t.dx), n.dragStartY += parseFloat(t.dy), i.attr("transform", "translate(" + n.dragStartX + "," + n.dragStartY + ")");
3644
+ }
3645
+ onDragEnd(e, t) {
3646
+ this.getConfig().container.classList.remove("dragging-active");
3647
+ let n = this.getChartState();
3648
+ if (n.dragNode) {
3649
+ if (P(e).classed("dragging", !1), !n.dropNode) {
3650
+ this.render();
3651
+ return;
3652
+ }
3653
+ if (t.subject.parent.id === n.dropNode.id) {
3654
+ this.render();
3655
+ return;
3656
+ }
3657
+ P(e).remove(), n.dragNode.parent = n.dropNode, n.dragNode.parent && (n.dragNode.parent.children = n.dragNode.parent.children?.filter((e) => e.id !== n.dragNode?.id) || null), this.getConfig().onNodeParentChange?.(n.dragNode), n.dropNode = null, n.dragNode = null, this.render();
3658
+ }
3659
+ }
3660
+ zoomed(e) {
3661
+ let t = this.getChartState(), n = t.chart;
3662
+ if (!n) return;
3663
+ let r = e.transform;
3664
+ t.lastTransform = r, n.attr("transform", r.toString());
3665
+ }
3666
+ zoomTreeBounds({ x0: e, x1: t, y0: n, y1: r, params: i = {
3667
+ animate: !0,
3668
+ scale: !0,
3669
+ onCompleted: void 0
3670
+ } }) {
3671
+ let { width: a, height: o } = this.getChartState().containerRect, { svg: s, zoomBehavior: c, lastTransform: l } = this.getChartState(), { duration: u, scaleExtent: d } = this.getConfig(), f = Math.min(d[1], Math.max(d[0], 1 / Math.max((t - e) / a, (r - n) / o))), p = Z.zoomIdentity.translate(a / 2, o / 2);
3672
+ p = p.scale(i.scale ? f : l.k), p = p.translate(-(e + t) / 2, -(n + r) / 2), s.transition().duration(i.animate ? u : 0).call(c.transform, p);
3673
+ }
3674
+ applyTransform(e, t = !1) {
3675
+ let { zoomBehavior: n, lastTransform: r, svg: i } = this.getChartState(), { duration: a } = this.getConfig();
3676
+ if (e.k === r.k && e.x === r.x && e.y === r.y) return;
3677
+ let o = Z.zoomIdentity.translate(e.x, e.y).scale(e.k);
3678
+ i && i.transition().duration(t ? 0 : a).call(n.transform, o);
3679
+ }
3680
+ fit({ animate: e = !0, nodes: t, scale: n = !0, onCompleted: r } = {}) {
3681
+ let i = this.getChartState(), a = this.getConfig(), { root: o } = i, s = t || (a.gridEnabled ? o.descendants().slice(1) : o.descendants()), c = Z.min(s, (e) => e.x + a.layoutBindings[a.layout].nodeLeftX(e)), l = Z.max(s, (e) => e.x + a.layoutBindings[a.layout].nodeRightX(e)), u = Z.min(s, (e) => e.y + a.layoutBindings[a.layout].nodeTopY(e)), d = Z.max(s, (e) => e.y + a.layoutBindings[a.layout].nodeBottomY(e));
3682
+ return this.zoomTreeBounds({
3683
+ params: {
3684
+ animate: e,
3685
+ scale: n,
3686
+ onCompleted: r
3687
+ },
3688
+ x0: c - a.padding.left,
3689
+ x1: l + a.padding.right,
3690
+ y0: u - a.padding.top,
3691
+ y1: d + a.padding.bottom
3692
+ }), this;
3693
+ }
3694
+ unsetUserTransform() {
3695
+ let e = this.getChartState();
3696
+ delete e.userTransform;
3697
+ }
3698
+ zoomIn() {
3699
+ let { svg: e, zoomBehavior: t } = this.getChartState();
3700
+ e.transition().call(t.scaleBy, 1.3);
3701
+ }
3702
+ zoomOut() {
3703
+ let { svg: e, zoomBehavior: t } = this.getChartState();
3704
+ e.transition().call(t.scaleBy, .78);
3705
+ }
3706
+ destroy() {
3707
+ let e = this.getChartState();
3708
+ e.svg && (e.svg.selectAll("*").remove(), e.svg = null, e.chart = null);
3709
+ }
3710
+ }, Q = ge(), go = (e, t, n) => {
3711
+ let r = String(n);
3712
+ return Array.from(e.querySelectorAll(".node[data-brush][data-value]")).find((e) => e.getAttribute("data-brush") === t && e.getAttribute("data-value") === r);
3713
+ }, _o = (e, t, n) => {
3714
+ let r = h(), i = (0, k.useCallback)((t) => {
3715
+ t.data.brush && r.daedalus.emitEvent(O.Brush, {
3716
+ data: {
3717
+ action: Q.BrushEventAction.Hover,
3718
+ data: [{
3719
+ id: t.data.brush.key,
3720
+ values: [t.data.brush.value]
3721
+ }]
3722
+ },
3723
+ emitter: e
3724
+ });
3725
+ }, [r, e]), a = (0, k.useCallback)((t) => {
3726
+ t.data.brush && r.daedalus.emitEvent(O.Brush, {
3727
+ data: {
3728
+ action: Q.BrushEventAction.Blur,
3729
+ data: [{
3730
+ id: t.data.brush.key,
3731
+ values: [t.data.brush.value]
3732
+ }]
3733
+ },
3734
+ emitter: e
3735
+ });
3736
+ }, [r, e]), o = (0, k.useRef)({});
3737
+ return o.current[O.Brush] = (r) => {
3738
+ if (r.emitter !== e && !(!t || !n.interactive)) switch (r.data.action) {
3739
+ case Q.BrushEventAction.Hover:
3740
+ r.data.data.forEach(({ id: e, values: n }) => {
3741
+ n.forEach((n) => {
3742
+ go(t, e, n)?.classList.add("hovered");
3743
+ });
3744
+ });
3745
+ break;
3746
+ case Q.BrushEventAction.Blur:
3747
+ r.data.data.forEach(({ id: e, values: n }) => {
3748
+ n.forEach((n) => {
3749
+ go(t, e, n)?.classList.remove("hovered");
3750
+ });
3751
+ });
3752
+ break;
3753
+ case Q.BrushEventAction.End:
3754
+ t.querySelectorAll(".node.hovered").forEach((e) => e.classList.remove("hovered"));
3755
+ break;
3756
+ }
3757
+ }, y({
3758
+ action: O.Brush,
3759
+ handler: ({ payload: e }) => e && o.current[O.Brush](e)
3760
+ }, []), {
3761
+ onTreeNodeHover: i,
3762
+ onTreeNodeLeave: a
3763
+ };
3764
+ }, vo = (e) => {
3765
+ let { variables: t, variablesFetched: n, updateVariable: r } = w();
3766
+ return {
3767
+ variables: (0, k.useMemo)(() => {
3768
+ let n = {};
3769
+ return e.measures?.forEach((e) => {
3770
+ !e.slots || !s(e) || Object.values(e.slots).filter((e) => e.enabled && e.source === "variable" && e.propertyValue?.type === "variable").forEach((r) => {
3771
+ let i = r.propertyValue.variableName;
3772
+ if (!i) return;
3773
+ let a = t.find((e) => e.name === i);
3774
+ n[i] || (n[i] = {
3775
+ id: a?.id ?? null,
3776
+ measureId: []
3777
+ });
3778
+ let o = l(e.dataItem);
3779
+ n[i].measureId.includes(o) || n[i].measureId.push(o);
3780
+ });
3781
+ }), n;
3782
+ }, [
3783
+ e.measures,
3784
+ t,
3785
+ n
3786
+ ]),
3787
+ updateVariable: r,
3788
+ variablesFetched: n
3789
+ };
3790
+ }, yo = (e, t) => {
3791
+ let n = e.dimensions.filter(s), r = n.map((e) => l(e.dataItem)), i = n.length, a = (0, k.useMemo)(() => T(n.map((e) => ({
3792
+ dataItem: e.dataItem,
3793
+ dateLevel: void 0,
3794
+ datePart: void 0,
3795
+ operator: Qa.FilterOperator.InList
3796
+ })), { ignoreApplied: !0 }), [r]), o = (0, k.useCallback)((e) => {
3797
+ if (!i || !a?.length || !e.data.brush) return;
3798
+ let { key: t, value: n } = e.data.brush, r = a.find((e) => e.fieldKey === t && de(e.operators));
3799
+ if (!r) return;
3800
+ let o = (r.operators.pending ?? r.operators.applied ?? r.operators.initial) === Qa.FilterOperator.NotInList ? "off" : "on";
3801
+ r.state.pending && r.state.pending.includes(n) && (o = o === "off" ? "on" : "off"), r.onClick(n, { [o]: !0 });
3802
+ }, [a, r]);
3803
+ return (0, k.useEffect)(() => {
3804
+ t && (t.querySelectorAll(".node.selected").forEach((e) => e.classList.remove("selected")), a.forEach(({ fieldKey: e, state: n }) => {
3805
+ n.pending !== null && n.pending.forEach((n) => {
3806
+ go(t, e, n)?.classList.add("selected");
3807
+ });
3808
+ }));
3809
+ }, [t, JSON.stringify(a)]), { onTreeNodeClick: o };
3810
+ }, bo = (e, t) => {
3811
+ e.next({
3812
+ action: f.SaveLocalVSpec,
3813
+ payload: { vSpecChange: { treeChartSettings: { ...t } } },
3814
+ mergeWith(e, t, n) {
3815
+ if (n === "nodeExpandState") return t;
3816
+ }
3817
+ });
3818
+ }, xo = 80, So = (e, t, n, r) => {
3819
+ let i = (0, k.useRef)(e.treeChartSettings?.nodeExpandState ?? {}), a = r.forceAutoFit, o = ee(), c = vo(o), u = b(), d = m(), f = e.dimensions.filter(s), p = f.length, [h] = (0, k.useState)(e.treeChartSettings?.transform ?? null), [g, _] = (0, k.useState)(h ?? {
3820
+ k: 1,
3821
+ x: 0,
3822
+ y: 0
3823
+ }), v = (0, k.useRef)(e.treeChartSettings?.transform), { onTreeNodeHover: y, onTreeNodeLeave: x } = _o(n, t.current, r), { onTreeNodeClick: S } = yo(e, t.current), C = (0, k.useRef)(new ho()), w = (0, k.useRef)(null), T = !e.treeChartSettings.gridLayout?.enabled && e.treeChartSettings?.nodeLayout?.hoverStyle?.enabled, E = (0, k.useCallback)(() => {
3824
+ w.current &&= (clearTimeout(w.current), null);
3825
+ }, []);
3826
+ return C.current.onNodeHover((e) => {
3827
+ r.interactive && y(e), T && (E(), C.current.highlight(e));
3828
+ }).onNodeLeave((e) => {
3829
+ r.interactive && x(e), T && (E(), w.current = setTimeout(() => {
3830
+ C.current.highlight(null), w.current = null;
3831
+ }, xo));
3832
+ }).onNodeClick((e) => {
3833
+ r.interactive && S(e);
3834
+ }).onNodeParentChange((t) => {
3835
+ if (p > 0) return;
3836
+ let n = e.measures.find((e) => e.dataItem.uniqueSignature === t.data.id);
3837
+ n && te(d, e.measures, l(n.dataItem), !t.parent || t.parent.data.id === "__root__" ? null : t.parent.data.id);
3838
+ }).onExpandOrCollapse((t) => {
3839
+ let n = rt(t, e.treeChartSettings?.initialExpandedLevels, f.length, e.totals?.enabled ?? !1), r = !(t._children?.length > 0 && !t.children?.length);
3840
+ r === n ? delete i.current[t.data.id] : i.current[t.data.id] = r, bo(u, { nodeExpandState: i.current }), !(p > 0) && Object.values(c.variables).filter((e) => e.measureId.includes(t.data.id)).forEach((e) => {
3841
+ c.updateVariable(e.id, r, Qa.VariableType.boolean);
3842
+ });
3843
+ }).onUserZoom(() => {
3844
+ v.current = null;
3845
+ }).onZoomEnd((e) => {
3846
+ if (a) return;
3847
+ let t = {
3848
+ k: e.transform.k,
3849
+ x: e.transform.x,
3850
+ y: e.transform.y
3851
+ };
3852
+ t.k === g.k && t.x === g.x && t.y === g.y || (_(t), bo(u, {
3853
+ nodeExpandState: i.current,
3854
+ transform: t
3855
+ }));
3856
+ }), (0, k.useEffect)(() => () => E(), [E]), (0, k.useEffect)(() => {
3857
+ e.treeChartSettings?.nodeExpandState && (i.current = e.treeChartSettings.nodeExpandState ?? {});
3858
+ }, [e.treeChartSettings?.nodeExpandState]), (0, k.useEffect)(() => {
3859
+ o.treeChartSettings?.nodeExpandState || (i.current = {});
3860
+ }, [o.treeChartSettings?.initialExpandedLevels]), (0, k.useEffect)(() => {
3861
+ v.current = e.treeChartSettings?.transform, C.current && C.current.unsetUserTransform(), !(!e.treeChartSettings?.transform || !C.current) && C.current.applyTransform(e.treeChartSettings.transform);
3862
+ }, [e.treeChartSettings?.transform]), {
3863
+ chart: C.current,
3864
+ expandedState: i
3865
+ };
3866
+ }, $ = g(), Co = ({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
3867
+ let a = i?.isEditMode ?? !1, o = i?.isPrintMode ?? !1, c = e?.treeChartSettings?.gridLayout?.enabled, l = e.dimensions.filter(s).length, d = e.measures.filter(s), f = (0, k.useRef)("tree-" + u(10)), p = (0, k.useRef)(null), m = e.treeChartSettings?.forceAutoFit === !0, { layout: h, treeSettings: g } = Ma(e, i), { chart: _, expandedState: y } = So(e, p, f.current, g), b = Aa(e, p, _), x = ct({
3868
+ vSpec: e,
3869
+ data: n,
3870
+ nodeExpandState: y
3871
+ }), [S, C] = (0, k.useState)(!1);
3872
+ (0, k.useLayoutEffect)(() => (_ && _.init(), () => {
3873
+ _?.destroy();
3874
+ }), [p.current]), (0, k.useEffect)(() => {
3875
+ S ? _.enableDrag() : _.disableDrag();
3876
+ }, [S]), (0, k.useEffect)(() => {
3877
+ !p.current || !_ || !r.width || !r.height || b(x, g);
3878
+ }, [
3879
+ r.width,
3880
+ r.height,
3881
+ b
3882
+ ]);
3883
+ let w = a && l === 0 && !c;
3884
+ (0, k.useEffect)(() => {
3885
+ p.current && b(x, g);
3886
+ }, [
3887
+ x,
3888
+ JSON.stringify(g),
3889
+ b
3890
+ ]);
3891
+ let T = Ne({
3892
+ vTheme: t,
3893
+ vSpec: e,
3894
+ id: f.current,
3895
+ layout: h
3896
+ });
3897
+ return /* @__PURE__ */ (0, $.jsxs)("div", {
3898
+ style: {
3899
+ width: "100%",
3900
+ height: "100%"
3901
+ },
3902
+ id: f.current,
3903
+ "data-mode": a ? "edit" : "view",
3904
+ children: [
3905
+ !o && /* @__PURE__ */ (0, $.jsxs)("div", {
3906
+ className: "tree-toolbar",
3907
+ style: {
3908
+ position: "absolute",
3909
+ zIndex: 1,
3910
+ padding: 10,
3911
+ right: 0,
3912
+ top: 0,
3913
+ gap: 10
3914
+ },
3915
+ children: [w && /* @__PURE__ */ (0, $.jsx)(E, {
3916
+ size: "small",
3917
+ value: "organize",
3918
+ selected: S,
3919
+ onChange: () => C(!S),
3920
+ disabled: d.length < 2,
3921
+ children: /* @__PURE__ */ (0, $.jsx)(re, {})
3922
+ }), !m && /* @__PURE__ */ (0, $.jsx)(E, {
3923
+ value: "",
3924
+ size: "small",
3925
+ onClick: () => _?.fit(),
3926
+ children: /* @__PURE__ */ (0, $.jsx)(v, {})
3927
+ })]
3928
+ }),
3929
+ /* @__PURE__ */ (0, $.jsx)("style", { children: T }),
3930
+ /* @__PURE__ */ (0, $.jsx)("div", {
3931
+ style: {
3932
+ width: "100%",
3933
+ height: "100%"
3934
+ },
3935
+ ref: p
3936
+ })
3937
+ ]
3938
+ });
3939
+ }, wo = p(class extends k.Component {
3940
+ render() {
3941
+ return /* @__PURE__ */ (0, $.jsx)(Co, { ...this.props });
3942
+ }
3943
+ });
3944
+ export { wo as Tree };