@astrato-io/visualizations 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/README.md +19 -1
  3. package/THIRD_PARTY_NOTICES.md +494 -0
  4. package/VISUALIZATION_DEFINITIONS.md +6 -145
  5. package/chunks/{Button-Dn3rJrYf.js → Button-CPG4WX8X.js} +3 -3
  6. package/chunks/{CircularProgress-BFeu06Yb.js → CircularProgress-PSLW8HmD.js} +12 -12
  7. package/chunks/FieldTypeIcon-5k2bkqd0.js +22 -0
  8. package/chunks/{LinearProgress-ClO6GUjN.js → LinearProgress-KQ2EQlGL.js} +16 -16
  9. package/chunks/{MenuOption-Czc34u4q.js → MenuOption-B-6K7kks.js} +151 -151
  10. package/chunks/{Title-BgYnaVTR.js → Title-BmvwZYkh.js} +32 -32
  11. package/chunks/{_createAggregator-BMu9uRax.js → _createAggregator-CFmH6gUN.js} +16 -16
  12. package/chunks/{app-filter-bar.compiler-CVir0wkl.js → app-filter-bar.compiler-BY5-T16I.js} +8 -8
  13. package/chunks/{bar-layout-C_UgRlVl.js → bar-layout-BNou0dZF.js} +2 -2
  14. package/chunks/{bar.compiler-DYuFdi9J.js → bar.compiler-BkhO7sDd.js} +58 -56
  15. package/chunks/{builder-C-TKA-My.js → builder-CNjuqD2z.js} +107 -56
  16. package/chunks/category-axis-D1OVyMrr.js +20 -0
  17. package/chunks/{coloring-BtnPiQ_o.js → coloring-BOiP0rmn.js} +51 -51
  18. package/chunks/{createSimplePaletteValueFilter--zrZxRV9.js → createSimplePaletteValueFilter-BkgQ7MFE.js} +166 -166
  19. package/chunks/defaults-B5_8S-J-.js +3 -0
  20. package/chunks/{definitions-CT304NDn.js → definitions-AS9GcavE.js} +228 -233
  21. package/chunks/{escobar-CvEV2ES1.js → escobar-cQ1eQ64G.js} +4183 -4183
  22. package/chunks/{extend-preset-D9-JP92b.js → extend-preset-BlCbcXKR.js} +427 -427
  23. package/chunks/{filter.compiler-CXeZznks.js → filter.compiler-CI7dDNM1.js} +10 -10
  24. package/chunks/{filtering-8_bFv-jb.js → filtering-Dwi7hDPZ.js} +308 -308
  25. package/chunks/{handlers-C6CZ0XJA.js → handlers-C63NVo7i.js} +4593 -4559
  26. package/chunks/{icon-picker-styles-BXiJ1SZS.js → icon-picker-styles-CBlxEu3s.js} +8 -8
  27. package/chunks/{isEqual-D8Ay63xR.js → isEqual-BdHo6wqq.js} +1 -1
  28. package/chunks/{isFocusVisible-Bu8gGZu5.js → isFocusVisible-C1nlVUwL.js} +9 -9
  29. package/chunks/line.compiler-DCv3h42f.js +198 -0
  30. package/chunks/linear-Bq_r9l5S.js +264 -0
  31. package/chunks/{logger-DdZpR7xZ.js → logger-Bc-DqDM_.js} +64 -64
  32. package/chunks/{lookup-BWllin0q.js → lookup-B3tWH2hX.js} +1 -0
  33. package/chunks/{map.compiler-Q_Y1Pvat.js → map.compiler-CRO6XpdI.js} +43 -43
  34. package/chunks/measure-format-default-B6ghxih7.js +22 -0
  35. package/chunks/{metadata-BQm_TXI1.js → metadata-CtkvZEhS.js} +1 -1
  36. package/chunks/number.compiler-kV4lobCZ.js +57 -0
  37. package/chunks/{operations-DKQWuLL7.js → operations-COl9wgqi.js} +8524 -8480
  38. package/chunks/{range-BdhzvYQ_.js → range-CMJ5yc5Z.js} +2 -2
  39. package/chunks/{react-dom-BGP4tbXV.js → react-dom-BjsCbYHq.js} +76 -76
  40. package/chunks/{render-wrappers-BZpyDnJy.js → render-wrappers-DFHi3Wkr.js} +1 -1
  41. package/chunks/{requirements-e8Fe96ag.js → requirements-C5YLmHKe.js} +250 -226
  42. package/chunks/{shared-C_2F90xq.js → shared-DyqxOie0.js} +504 -498
  43. package/chunks/standalone-06i1wmIX.js +6 -0
  44. package/chunks/{standalone-BDrXVxlP.js → standalone-9jrQ3zJT.js} +10 -10
  45. package/chunks/standalone-B6zUvxNQ.js +357 -0
  46. package/chunks/{standalone-BkbiH-o8.js → standalone-BYK2U0Vd.js} +418 -679
  47. package/chunks/standalone-Be5APcVv.js +762 -0
  48. package/chunks/{standalone-Cl0TSfqC.js → standalone-Bp4G3MDx.js} +123 -123
  49. package/chunks/{standalone-DNh9NcMa.js → standalone-BrjtMIdd.js} +145 -145
  50. package/chunks/{standalone-BTY3w_JA.js → standalone-Bsfz5vnJ.js} +53 -53
  51. package/chunks/standalone-BuXpKMnc.js +2 -0
  52. package/chunks/standalone-CIjNYyya.js +8378 -0
  53. package/chunks/{standalone-CsoMmE9T.js → standalone-CS5VGoja.js} +347 -347
  54. package/chunks/standalone-CUGt2FUF.js +2 -0
  55. package/chunks/{standalone-CaTxAydz.js → standalone-ChfEHb28.js} +2296 -1069
  56. package/chunks/standalone-CnF2OYLQ.js +355 -0
  57. package/chunks/standalone-CznEEiq3.js +422 -0
  58. package/chunks/{standalone-DflyWtuR.js → standalone-D9k5SCd8.js} +169 -169
  59. package/chunks/{standalone-Cc98Pdr6.js → standalone-DYVYccmY.js} +829 -829
  60. package/chunks/{standalone-CY_kjarf.js → standalone-DaNxWIKn.js} +22 -22
  61. package/chunks/{standalone-wOWRCpdn.js → standalone-Db_HNuWx.js} +48 -48
  62. package/chunks/standalone-DcuE8KBa.js +287 -0
  63. package/chunks/{standalone-BE_ONgiG.js → standalone-I5kRIsp8.js} +76 -76
  64. package/chunks/{standalone-B8ZSqauS.js → standalone-K2OvRAQM.js} +113 -113
  65. package/chunks/{standalone-z0o52o5t.js → standalone-c4CPN6ug.js} +1719 -1718
  66. package/chunks/{standalone-DHRalbVO.js → standalone-iOnJhCvA.js} +312 -312
  67. package/chunks/{standalone-CXY4FpF7.js → standalone-pCrzBiTy.js} +222 -222
  68. package/chunks/standalone-qrZaimgC.js +689 -0
  69. package/chunks/standalone-yqDJ8h3K.js +1012 -0
  70. package/chunks/{table.compiler-COaHE9VD.js → table.compiler-CMH_dtYs.js} +35 -35
  71. package/chunks/{useFieldName-CdnCWzhd.js → useFieldName-BfxBzhhH.js} +1 -1
  72. package/chunks/{utils-DganVptf.js → utils-BdJrEeIQ.js} +3924 -3910
  73. package/chunks/{view-Bzlros43.js → view-Q-_XIrWE.js} +1680 -1680
  74. package/chunks/{visualization-filters-D7i6oh1Z.js → visualization-filters-BwS0xUqs.js} +1705 -1686
  75. package/chunks/{with-html-element-CiIhFEa5.js → with-html-element-D_ooGNWI.js} +3962 -3950
  76. package/definitions.js +2 -2
  77. package/docs/operations/astrato-app-filter-bar.md +1 -1
  78. package/docs/operations/bar.md +30 -1
  79. package/docs/operations/combo.md +30 -1
  80. package/docs/operations/date-picker.md +1 -1
  81. package/docs/operations/distribution-gauge.md +1 -1
  82. package/docs/operations/dot.md +1 -1
  83. package/docs/operations/filter.md +1 -1
  84. package/docs/operations/gauge.md +1 -1
  85. package/docs/operations/heatMap.md +1 -1
  86. package/docs/operations/histogram.md +1 -1
  87. package/docs/operations/iframe.md +1 -1
  88. package/docs/operations/image.md +1 -1
  89. package/docs/operations/index.md +5 -4
  90. package/docs/operations/line.md +30 -1
  91. package/docs/operations/map.md +5274 -0
  92. package/docs/operations/number.md +1 -1
  93. package/docs/operations/pie.md +1 -1
  94. package/docs/operations/radar.md +1 -1
  95. package/docs/operations/sankey.md +1 -1
  96. package/docs/operations/scatter.md +1 -1
  97. package/docs/operations/shape.md +1 -1
  98. package/docs/operations/simpleTextObject.md +1 -1
  99. package/docs/operations/slider.md +1 -1
  100. package/docs/operations/table.md +1 -1
  101. package/docs/operations/tree.md +1 -1
  102. package/docs/operations/treemap.md +1 -1
  103. package/docs/operations/waterfall.md +1 -1
  104. package/docs/operations/word-cloud.md +1 -1
  105. package/getters.js +3 -3
  106. package/index.js +524 -500
  107. package/metadata.js +2 -2
  108. package/operations.js +6 -6
  109. package/package.json +73 -68
  110. package/src/definitions/index.d.ts +1 -7
  111. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +3 -48
  112. package/src/definitions/model/definitions/schema-registry.d.ts +2 -2
  113. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +1 -1
  114. package/src/definitions/model/definitions/schemas/broad-chart.schema.d.ts +2 -2
  115. package/src/definitions/model/definitions/schemas/common.schema.d.ts +14 -2
  116. package/src/definitions/model/definitions/schemas/index.d.ts +1 -1
  117. package/src/definitions/model/definitions/schemas/line.schema.d.ts +1 -1
  118. package/src/visualization-catalog.d.ts +3 -0
  119. package/styles.css +1 -1
  120. package/chunks/FieldTypeIcon-DrMoGpHJ.js +0 -22
  121. package/chunks/defaults-Dtk7fg3C.js +0 -3
  122. package/chunks/line.compiler-DmHpmQCC.js +0 -198
  123. package/chunks/number.compiler-DQdg6zTy.js +0 -53
  124. package/chunks/standalone-4MsKiqs0.js +0 -355
  125. package/chunks/standalone-B794g9pE.js +0 -1012
  126. package/chunks/standalone-BA2YXyJS.js +0 -422
  127. package/chunks/standalone-BgumbdaJ2.js +0 -357
  128. package/chunks/standalone-Blh4qejk.js +0 -689
  129. package/chunks/standalone-DH0xTEes.js +0 -2
  130. package/chunks/standalone-DcnHjNnC.js +0 -2
  131. package/chunks/standalone-DrHdGkY7.js +0 -762
  132. package/chunks/standalone-c_rROMtx.js +0 -287
  133. package/chunks/standalone-drcFLeN6.js +0 -6
@@ -0,0 +1,6 @@
1
+ import "./rolldown-runtime-DleVn1XH.js";
2
+ import { Br as e, Mt as t, li as n } from "./utils-BdJrEeIQ.js";
3
+ import { n as r } from "./standalone-yqDJ8h3K.js";
4
+ n();
5
+ var i = e(), a = t((e) => /* @__PURE__ */ (0, i.jsx)(r, { ...e }));
6
+ export { a as HistogramChart };
@@ -1,8 +1,8 @@
1
1
  import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { On as t, Qs as n, Ut as r } from "./visualization-filters-D7i6oh1Z.js";
3
- import { W as i, Zt as a, ci as o, f as s, zr as c } from "./utils-DganVptf.js";
4
- import "./defaults-Dtk7fg3C.js";
5
- var l = /* @__PURE__ */ e(o()), u = i({
2
+ import { Nn as t, ac as n, qt as r } from "./visualization-filters-BwS0xUqs.js";
3
+ import { Br as i, G as a, Qt as o, f as s, li as c } from "./utils-BdJrEeIQ.js";
4
+ import "./defaults-B5_8S-J-.js";
5
+ var l = /* @__PURE__ */ e(c()), u = a({
6
6
  iframeWrapper: {
7
7
  width: "100%",
8
8
  height: "100%",
@@ -25,17 +25,17 @@ var l = /* @__PURE__ */ e(o()), u = i({
25
25
  width: "100%",
26
26
  height: "100%"
27
27
  }
28
- }), d = c(), f = t(), p = ({ vSpec: e }) => {
29
- let t = r((e && n(e) ? e : f).iframeSettings.url, null), i = s(), o = u(), c = a();
28
+ }), d = i(), f = t(), p = ({ vSpec: e }) => {
29
+ let t = r((e && n(e) ? e : f).iframeSettings.url, null), i = s(), a = u(), c = o();
30
30
  if ((0, l.useEffect)(() => {
31
31
  i();
32
32
  }, []), !t) return /* @__PURE__ */ (0, d.jsx)("div", {
33
- className: o.emptyState,
33
+ className: a.emptyState,
34
34
  "data-testid": "iframe-empty-container"
35
35
  });
36
36
  let p = "\n allow-scripts\n allow-forms\n allow-same-origin\n allow-popups\n allow-popups-to-escape-sandbox\n allow-modals\n allow-downloads\n ", m = "\n autoplay\n clipboard-write\n clipboard-read\n ";
37
37
  return c.daedalus.objectCapabilities.editable ? /* @__PURE__ */ (0, d.jsxs)("div", {
38
- className: o.iframeWrapper,
38
+ className: a.iframeWrapper,
39
39
  "data-testid": "iframe-container",
40
40
  children: [/* @__PURE__ */ (0, d.jsx)("iframe", {
41
41
  src: t,
@@ -48,11 +48,11 @@ var l = /* @__PURE__ */ e(o()), u = i({
48
48
  referrerPolicy: "no-referrer-when-downgrade",
49
49
  "data-testid": "iframe-content"
50
50
  }), /* @__PURE__ */ (0, d.jsx)("div", {
51
- className: o.overlay,
51
+ className: a.overlay,
52
52
  "data-testid": "iframe-overlay"
53
53
  })]
54
54
  }) : /* @__PURE__ */ (0, d.jsx)("div", {
55
- className: o.iframeWrapper,
55
+ className: a.iframeWrapper,
56
56
  "data-testid": "iframe-container",
57
57
  children: /* @__PURE__ */ (0, d.jsx)("iframe", {
58
58
  src: t,
@@ -0,0 +1,357 @@
1
+ import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { Cc as t, Ec as n, Hc as r, Uo as i, Wa as a, cr as o, dc as s, fa as c, ln as l, ri as u, yl as d } from "./visualization-filters-BwS0xUqs.js";
3
+ import { Br as f, Mt as p, P as m, li as h, s as g } from "./utils-BdJrEeIQ.js";
4
+ import { i_ as _, x_ as v } from "./handlers-C63NVo7i.js";
5
+ import { t as y } from "./label-format-type-C46pzgx7.js";
6
+ import "./logger-Bc-DqDM_.js";
7
+ import { $t as b, Cn as x, H as S, L as C, Mt as w, Pt as ee, R as te, Sn as ne, V as re, _ as T, _n as E, b as D, bt as O, i as ie, jn as k, ln as A, n as ae, on as j, v as oe, x as se, xn as M, xt as N, z as P, zt as F } from "./escobar-cQ1eQ64G.js";
8
+ import { _ as I } from "./MenuOption-B-6K7kks.js";
9
+ import { t as L } from "./coloring-BOiP0rmn.js";
10
+ import { t as R } from "./set-coloring-datafield-B3uIS1Pe.js";
11
+ var z = /* @__PURE__ */ e(h()), B = (e, t, i) => {
12
+ let { coloring: o } = e || {}, s = o?.fieldId, c = e.dimensions.filter((e) => u(e)), l = e.measures.filter((e) => u(e)), d = l.filter((e) => e.role === a.PIE_CHART_SLICE), f = l.filter((e) => e.role === a.PIE_CHART_LENGTH);
13
+ s || (e.coloring?.type === n.Gradient ? s = r(d[0]?.dataItem) : e.coloring?.type === n.Categorical && (s = r(c[0]?.dataItem))), w(i, 0, { color: { field: s } });
14
+ let p = F(R(e, s ?? null), t, {});
15
+ if (f.length > 0) {
16
+ let e = r(f[0]?.dataItem);
17
+ p[e] = { data: { field: e } };
18
+ }
19
+ return {
20
+ ...i,
21
+ scales: p
22
+ };
23
+ }, V = {
24
+ num: "num",
25
+ rad: "rad",
26
+ group: "group"
27
+ }, H = (e, t, n) => {
28
+ if (!e.dimensions[0]) return n;
29
+ let i = e.measures.filter((e) => u(e)), o = oe((e.supportingMeasures ?? []).filter((e) => u(e))), s = e.dimensions.filter((e) => u(e))?.[0], c = i.filter((e) => e.role === a.PIE_CHART_SLICE)?.[0], l = i.filter((e) => e.role === a.PIE_CHART_LENGTH)?.[0], d = r(c?.dataItem), f = r(l?.dataItem), p = r(s?.dataItem), m = {
30
+ [V.num]: c?.dataItem?.name ? { field: d } : void 0,
31
+ [V.rad]: l?.dataItem?.name ? { field: f } : void 0,
32
+ ...o
33
+ };
34
+ d && (m[d] = { field: d }), f && (m[f] = { field: f });
35
+ let h = [{
36
+ key: M.Collection,
37
+ data: { extract: [{
38
+ field: p,
39
+ props: m
40
+ }] }
41
+ }];
42
+ return {
43
+ ...n,
44
+ collections: h
45
+ };
46
+ }, U = "pie-alternates-switcher", W = "pie-alternates-switcher", G = (e) => l(e) || e.label || e.dataItem?.name || "Field", K = (e, t, n, i) => {
47
+ let a = n ? r(n.dataItem) : void 0;
48
+ return {
49
+ type: "native",
50
+ key: `${W}-interaction`,
51
+ events: { click(r) {
52
+ let o = this.element.getBoundingClientRect(), s = {
53
+ x: r.clientX - o.left,
54
+ y: r.clientY - o.top
55
+ }, c = this.chart.shapesAt(s, {
56
+ components: [{
57
+ key: W,
58
+ propagation: "stop"
59
+ }],
60
+ propagation: "stop"
61
+ }).find((e) => e.data?.target === "measure" || e.data?.target === "dimension");
62
+ if (c?.data?.target === "measure" && n && a) {
63
+ i(k.Text, "click", `text-${a}`, r, c, {
64
+ dataItemType: d.Measure,
65
+ dataItemRole: n.role
66
+ });
67
+ return;
68
+ }
69
+ c?.data?.target === "dimension" && e && i(k.Text, "click", `text-${e}`, r, c, {
70
+ dataItemType: d.Dimension,
71
+ dataItemRole: t
72
+ });
73
+ } }
74
+ };
75
+ }, ce = (e, t, n, s, c, l, f, p) => {
76
+ let m = o(e.dimensions, e.enableAlternate, l?.isPrintMode), h = e.dimensions.filter((e) => u(e)), g = h[0], _ = g ? r(g.dataItem) : void 0, v = e.measures.filter((e) => e.role === a.PIE_CHART_SLICE), y = o(v, e.enableAlternate, l?.isPrintMode), b = v.filter((e) => u(e))[0], x = m && h.length ? h.map((e) => G(e)).join(", ") : void 0, S = y && b ? G(b) : void 0;
77
+ if (!x && !S) return n;
78
+ let C = {
79
+ type: U,
80
+ key: W,
81
+ dimensionDataItemType: _ ? d.Dimension : void 0,
82
+ dimensionDataItemRole: g?.role,
83
+ measureDataItemType: b ? d.Measure : void 0,
84
+ measureDataItemRole: b?.role,
85
+ layout: {
86
+ dock: i.Bottom,
87
+ displayOrder: 0
88
+ },
89
+ settings: {
90
+ dimensionLabel: x ? j(x) : void 0,
91
+ measureLabel: S ? j(S) : void 0,
92
+ fontFamily: t.fonts.general.fontFamily ?? void 0,
93
+ fontSize: `${ne.fieldTitle.fontSize}px`,
94
+ color: t.fonts.general.color,
95
+ paddingLeft: 5,
96
+ paddingRight: 5,
97
+ paddingVertical: 5,
98
+ labelGap: 12
99
+ }
100
+ }, w = p ? [K(_, g?.role, b, p)] : [];
101
+ return {
102
+ ...n,
103
+ components: [...n.components, C],
104
+ interactions: n.interactions ? [...n.interactions, ...w] : w
105
+ };
106
+ }, q = {
107
+ outerRadius: .8,
108
+ outerRadiusWithoutLabels: .95,
109
+ cornerRadius: _.pie,
110
+ strokeWidth: 0,
111
+ strokeEnabled: !1,
112
+ strokeColor: "#C6C6C6",
113
+ multiMeasureMinRadius: .3,
114
+ donut: {
115
+ innerRadius: .55,
116
+ cornerRadius: _.donut,
117
+ multiMeasureMinRadius: .6
118
+ }
119
+ };
120
+ function J(e) {
121
+ return e.pieSettings?.donut ?? !1;
122
+ }
123
+ var le = (e, t, n, i, o, s) => {
124
+ let c = e.measures.filter((e) => u(e)), l = c.filter((e) => e.role === a.PIE_CHART_SLICE), d = c.filter((e) => e.role === a.PIE_CHART_LENGTH), f = l[0], p = d[0], m = new L(e, t, o?.[0]?.itemsNotAffectedByFiltering), h = J(e) ? q.donut.innerRadius : 0, g = f?.dataLabels?.show === !1 ? q.outerRadiusWithoutLabels : q.outerRadius, _ = e.pieSettings?.cornerRadius ?? (J(e) ? q.donut.cornerRadius : q.cornerRadius), v = e.pieSettings?.strokeEnabled ?? q.strokeEnabled, y = e.pieSettings?.strokeWidth ?? q.strokeWidth, b = e.pieSettings?.strokeColor ?? q.strokeColor;
125
+ if (p) {
126
+ let t = g, n = J(e) ? q.donut.multiMeasureMinRadius : q.multiMeasureMinRadius;
127
+ g = (e) => e.resources.scale(r(p.dataItem))(e.datum.rad.value) * (t - n) + n;
128
+ }
129
+ let x = {
130
+ type: k.Pie,
131
+ key: `${k.Pie}`,
132
+ data: { collection: M.Collection },
133
+ animations: {
134
+ enabled: !0,
135
+ presetId: "pie-chart"
136
+ },
137
+ settings: { slice: {
138
+ arc: { ref: "num" },
139
+ stroke: b,
140
+ strokeWidth: v ? y : 0,
141
+ cornerRadius: _,
142
+ innerRadius: h,
143
+ outerRadius: g,
144
+ fill: m.getColorDefinition({ ref: "color" })
145
+ } },
146
+ brush: A([""], s, { valuePickerMode: s?.valuePickerMode })
147
+ };
148
+ return {
149
+ ...n,
150
+ components: [...n.components, x]
151
+ };
152
+ }, ue = (e, t, n) => ({ data: r, formatter: i }) => {
153
+ let a = e.dimensions.filter((e) => u(e))[0], o = r.value, s = r[V.num].value, c = a.formatter && o && i ? i(a.formatter)(o) : `${o}`, l = t.formatter && s && i ? i(t.formatter)(s, void 0, r) : `${s}`, d = s != null && n && i ? i(N)(s / n) : null, f = () => t.dataLabels?.measureLabelFormat === v.Percentage ? d === null ? [] : [d] : t.dataLabels?.measureLabelFormat === v.ValueAndPercentage ? d === null ? [l] : [l, d] : [l];
154
+ switch (t.dataLabels?.labelFormat) {
155
+ case y.Measure: {
156
+ let e = f();
157
+ return e.length <= 1 ? e[0] ?? null : e;
158
+ }
159
+ case y.DimensionAndMeasure: return [c, ...f()];
160
+ default: return c;
161
+ }
162
+ }, de = (e, t, n, r, i, o) => {
163
+ let s = e.dimensions.filter((e) => u(e)), c = e.measures.filter((e) => u(e)), l = s[0], d = c.find((e) => e.role === a.PIE_CHART_SLICE) ?? c[0];
164
+ if (!l || !d || !d.dataLabels?.show) return n;
165
+ let f = new I(t.fonts.general.color), p = d.dataLabels.showBackdrop ? D(d.dataLabels.backdropColor ? { fill: d.dataLabels.backdropColor } : void 0) : void 0, m = p ? se(f) : d.dataLabels.textColor || "#000", { strokeEnabled: h, strokeWidth: g = q.strokeWidth } = e.pieSettings, _ = h ? g / 2 : 0, v = {
166
+ type: k.Labels,
167
+ key: "pie-labels",
168
+ animations: {
169
+ enabled: !0,
170
+ presetId: "chart-labels"
171
+ },
172
+ layout: { displayOrder: b.Labels },
173
+ settings: { sources: [{
174
+ component: `${k.Pie}`,
175
+ selector: x.Path,
176
+ strategy: {
177
+ type: "slice",
178
+ settings: {
179
+ fontSize: E(d.dataLabels.size),
180
+ fontFamily: t.fonts.general.fontFamily,
181
+ labels: [{
182
+ label: ue(e, d, i?.[0]?.sum),
183
+ placements: [{
184
+ position: "outside",
185
+ fill: m,
186
+ backdrop: p
187
+ }],
188
+ strokeDelta: _,
189
+ linkData: ({ data: e }) => e
190
+ }]
191
+ }
192
+ }
193
+ }] },
194
+ brush: A([""], o, { valuePickerMode: o?.valuePickerMode })
195
+ };
196
+ return {
197
+ ...n,
198
+ components: [...n.components, v]
199
+ };
200
+ }, Y = (e, t, n, r, i) => {
201
+ let a = n.data[t]?.value, o = l(e) || e.label || e.dataItem.name || "", s = a;
202
+ return !i && e.formatter ? s = r.formatter(e.formatter)(a, void 0, n.data) : i && (s = r.formatter(O(e.formatter))(a, void 0, n.data)), {
203
+ label: o,
204
+ value: s
205
+ };
206
+ }, fe = (e, t, n, r, i) => {
207
+ let o = !!e.measures.filter(u).filter((e) => e.role === a.PIE_CHART_LENGTH)?.[0], s = {
208
+ filter: (e) => e.filter((e) => e.key === k.Pie),
209
+ placement: {
210
+ type: "slice",
211
+ area: "target"
212
+ }
213
+ };
214
+ if (o) return C(e, t, n, s, "tooltip", i);
215
+ let c = S(e, i), l = te(e, t, pe, P, i?.[0]?.sum, c);
216
+ return C(e, t, n, {
217
+ ...s,
218
+ extract: l
219
+ }, "tooltip", i);
220
+ }, pe = (e, t, n, i, a, o, s, c) => {
221
+ let l = [], d = e.filter(u), f = re(n), p = d.filter((e) => !f.has(r(e.dataItem)))?.[0] ?? d?.[0], m = Object.keys(t.data).find((e) => t.data[e]?.source?.field === r(p?.dataItem));
222
+ if (!m || !p ? l.push({
223
+ label: "",
224
+ value: ""
225
+ }) : l.push(Y(p, m, t, n, c)), d.filter((e) => f.has(r(e.dataItem))).forEach((e) => {
226
+ let i = r(e.dataItem), a = Object.keys(t.data).find((e) => t.data[e]?.source?.field === i);
227
+ a && l.push(Y(e, a, t, n, c));
228
+ }), s) return l;
229
+ let h = Object.values(o ?? {}).reduce((e, t) => e + Number(t), 0);
230
+ return l.push({
231
+ label: "Total",
232
+ value: p?.formatter ? n.formatter(p.formatter)(h) : h
233
+ }), l;
234
+ }, me = class extends T {
235
+ constructor() {
236
+ super([
237
+ H,
238
+ B,
239
+ le,
240
+ ce,
241
+ de,
242
+ ee,
243
+ fe
244
+ ]);
245
+ }
246
+ preCompile(e) {
247
+ let t = e.dimensions.filter((e) => u(e))?.[0], n = e.measures.filter((e) => u(e))?.[0];
248
+ if (!t || !n) throw Error("Charts w/o dimensions or measures are not supported ATM.");
249
+ }
250
+ }, X = " ▼", Z = "...", Q = (e, t, n, r) => e.measureText({
251
+ text: t,
252
+ fontFamily: n,
253
+ fontSize: r
254
+ }).width, he = (e, t, n, r, i) => {
255
+ if (t <= 0 || Q(n, e, r, i) <= t) return e;
256
+ let a = e.endsWith(X), o = a ? X : "", s = a ? e.slice(0, -2) : e;
257
+ if (Q(n, `${Z}${o}`, r, i) > t) return Z;
258
+ let c = 0, l = s.length;
259
+ for (; c < l;) {
260
+ let e = Math.ceil((c + l) / 2);
261
+ Q(n, `${s.slice(0, e)}${Z}${o}`, r, i) <= t ? c = e : l = e - 1;
262
+ }
263
+ return `${s.slice(0, c)}${Z}${o}`;
264
+ }, ge = {
265
+ require: ["renderer"],
266
+ defaultSettings: { settings: {
267
+ dimensionLabel: "",
268
+ measureLabel: "",
269
+ fontSize: "12px",
270
+ color: "#000",
271
+ paddingLeft: 5,
272
+ paddingRight: 5,
273
+ paddingVertical: 5,
274
+ labelGap: 12
275
+ } },
276
+ preferredSize() {
277
+ if (!this.renderer) return 0;
278
+ let { fontFamily: e = "Arial", fontSize: t, paddingVertical: n } = this.settings.settings;
279
+ return this.renderer.measureText({
280
+ fontFamily: e,
281
+ fontSize: t
282
+ }).height + n * 2;
283
+ },
284
+ render() {
285
+ let { renderer: e } = this;
286
+ if (!e) return [];
287
+ let { dimensionLabel: t, measureLabel: n, fontFamily: r = "Arial", fontSize: i, color: a, paddingLeft: o, paddingRight: s, labelGap: c } = this.settings.settings, l = n ? Q(e, n, r, i) : 0, u = this.rect.width - s, d = u - l, f = Math.max(Math.min(n ? d - c - o : this.rect.width - o - s, this.rect.width / 2), 0), p = t ? he(t, f, e, r, i) : "", m = p ? Q(e, p, r, i) : 0, h = [];
288
+ return n && h.push({
289
+ type: "rect",
290
+ x: Math.max(d, 0),
291
+ y: 0,
292
+ width: Math.min(l, this.rect.width),
293
+ height: this.rect.height,
294
+ fill: "rgba(0, 0, 0, 0)",
295
+ strokeWidth: 0,
296
+ data: { target: "measure" }
297
+ }), t && (h.push({
298
+ type: "rect",
299
+ x: o,
300
+ y: 0,
301
+ width: m,
302
+ height: this.rect.height,
303
+ fill: "rgba(0, 0, 0, 0)",
304
+ strokeWidth: 0,
305
+ data: { target: "dimension" }
306
+ }), h.push({
307
+ type: "text",
308
+ text: p,
309
+ x: o,
310
+ y: this.rect.height / 2,
311
+ anchor: "start",
312
+ baseline: "central",
313
+ fontFamily: r,
314
+ fontSize: i,
315
+ fill: a,
316
+ maxWidth: f,
317
+ data: { target: "dimension" }
318
+ })), n && h.push({
319
+ type: "text",
320
+ text: n,
321
+ x: u,
322
+ y: this.rect.height / 2,
323
+ anchor: "end",
324
+ baseline: "central",
325
+ fontFamily: r,
326
+ fontSize: i,
327
+ fill: a,
328
+ data: { target: "measure" }
329
+ }), h;
330
+ }
331
+ };
332
+ function $(e) {
333
+ e.component(U, ge);
334
+ }
335
+ var _e = (e, t) => {
336
+ let n = e.find((e) => e.role === a.PIE_CHART_SLICE && u(e));
337
+ if (!n) return;
338
+ let i = r(n.dataItem);
339
+ return t.reduce((e, t) => e + t[i], 0);
340
+ }, ve = f(), ye = p(({ vSpec: e, vTheme: n, data: r, elementSize: i, vizProperties: a }) => {
341
+ let o = m(), [l] = (0, z.useState)(() => new me()), { activeKey: u } = g(), d = ae();
342
+ if (!e || !s(e) || !r || !i) return null;
343
+ let f = {
344
+ ...a,
345
+ valuePickerMode: !!u
346
+ }, p = n || c;
347
+ r[0] && (r[0].sum = _e(e.measures, r[0].items));
348
+ let h = l.compile(e, p, r, i, f, t.Pie, o, void 0, d);
349
+ return h ? /* @__PURE__ */ (0, ve.jsx)(ie, {
350
+ config: f,
351
+ definition: h,
352
+ size: i,
353
+ vSpec: e,
354
+ escobarPlugins: [$]
355
+ }) : null;
356
+ });
357
+ export { ye as PieChart };