@astrato-io/visualizations 0.0.0-stage → 0.6.4

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