@milaboratories/graph-maker 1.1.136 → 1.1.137

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 (40) hide show
  1. package/dist/GraphMaker/constantsCommon.d.ts +2 -0
  2. package/dist/GraphMaker/constantsCommon.d.ts.map +1 -1
  3. package/dist/GraphMaker/constantsCommon.js +19 -17
  4. package/dist/GraphMaker/constantsCommon.js.map +1 -1
  5. package/dist/GraphMaker/forms/AxesSettingsForm/HeatmapAxesSettingsForm.vue.d.ts.map +1 -1
  6. package/dist/GraphMaker/forms/AxesSettingsForm/HeatmapAxesSettingsForm.vue.js +144 -122
  7. package/dist/GraphMaker/forms/AxesSettingsForm/HeatmapAxesSettingsForm.vue.js.map +1 -1
  8. package/dist/GraphMaker/index.vue.js +72 -72
  9. package/dist/GraphMaker/index.vue.js.map +1 -1
  10. package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.d.ts.map +1 -1
  11. package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.js +9 -9
  12. package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.js.map +1 -1
  13. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js +246 -228
  14. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js.map +1 -1
  15. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Captions/GroupCaptions.js +46 -37
  16. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Captions/GroupCaptions.js.map +1 -1
  17. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js +63 -61
  18. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js.map +1 -1
  19. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js +4 -4
  20. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Dendrograms.js +57 -51
  21. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Dendrograms.js.map +1 -1
  22. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getDendrograms.js +33 -33
  23. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getDendrograms.js.map +1 -1
  24. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js +20 -20
  25. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js +89 -54
  26. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
  27. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateChartSideElementSizes.js +19 -19
  28. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateChartSideElementSizes.js.map +1 -1
  29. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js +181 -168
  30. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js.map +1 -1
  31. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartsGroup.js +1 -1
  32. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartsGroup.js.map +1 -1
  33. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js +5 -5
  34. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/Lasso.js +144 -120
  35. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/Lasso.js.map +1 -1
  36. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js +35 -35
  37. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
  38. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js +1 -1
  39. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js.map +1 -1
  40. package/package.json +2 -2
@@ -1,48 +1,48 @@
1
- import { getClusters as K } from "./getClusters.js";
1
+ import { getClusters as m } from "./getClusters.js";
2
2
  import d from "../node_modules/d3-hierarchy/src/hierarchy/index.js";
3
- function E(a, t, p, x) {
4
- const { facetKeys: G, xGroupKeys: g, yGroupKeys: k } = a.meta, m = {};
5
- if (t && x.sharedX)
3
+ function v(s, t, n, G) {
4
+ const { facetKeys: K, xGroupKeys: x, yGroupKeys: B } = s.meta, f = {};
5
+ if (t && G.sharedX)
6
6
  throw Error("Dendrogram on X axis is not available with shared by facets X axis");
7
- return G.forEach((e) => {
8
- const c = {
9
- hierarchyX: [],
10
- hierarchyY: []
11
- }, o = a.facets[e];
7
+ return K.forEach((a) => {
8
+ const u = {
9
+ hierarchyByGroupX: {},
10
+ hierarchyByGroupY: {}
11
+ }, o = s.facets[a];
12
12
  if (t) {
13
- const i = [], y = [];
14
- g.forEach((s) => {
15
- const h = o.xKeysByGroups[s], n = o.yKeys, r = K(
16
- h,
17
- h.map((u) => n.map((f) => {
18
- var l;
19
- return ((l = o.cells[u][f]) == null ? void 0 : l.normalizedValue) ?? t.fillNA;
13
+ const y = [];
14
+ x.forEach((r) => {
15
+ const i = o.xKeysByGroups[r], l = o.yKeys, e = m(
16
+ i,
17
+ i.map((p) => l.map((h) => {
18
+ var c;
19
+ return ((c = o.cells[p][h]) == null ? void 0 : c.normalizedValue) ?? t.fillNA;
20
20
  })),
21
21
  t.distance,
22
22
  t.linkage
23
23
  );
24
- a.facets[e].xKeysByGroups[s] = r.keys, y.push(...r.keys), i.push(r);
25
- }), a.facets[e].xKeys = y, c.hierarchyX = i.map((s) => d(s));
24
+ s.facets[a].xKeysByGroups[r] = e.keys, y.push(...e.keys), u.hierarchyByGroupX[r] = d(e);
25
+ }), s.facets[a].xKeys = y;
26
26
  }
27
- if (p) {
28
- const i = [], y = [];
29
- k.forEach((s) => {
30
- const h = o.yKeysByGroups[s], n = o.xKeys, r = K(
31
- h,
32
- h.map((u) => n.map((f) => {
33
- var l;
34
- return ((l = o.cells[f][u]) == null ? void 0 : l.normalizedValue) ?? p.fillNA;
27
+ if (n) {
28
+ const y = [];
29
+ B.forEach((r) => {
30
+ const i = o.yKeysByGroups[r], l = o.xKeys, e = m(
31
+ i,
32
+ i.map((p) => l.map((h) => {
33
+ var c;
34
+ return ((c = o.cells[h][p]) == null ? void 0 : c.normalizedValue) ?? n.fillNA;
35
35
  })),
36
- p.distance,
37
- p.linkage
36
+ n.distance,
37
+ n.linkage
38
38
  );
39
- a.facets[e].yKeysByGroups[s] = r.keys, y.push(...r.keys), i.push(r);
40
- }), a.facets[e].yKeys = y, c.hierarchyY = i.map((s) => d(s));
39
+ s.facets[a].yKeysByGroups[r] = e.keys, y.push(...e.keys), u.hierarchyByGroupY[r] = d(e);
40
+ }), s.facets[a].yKeys = y;
41
41
  }
42
- m[e] = c;
43
- }), m;
42
+ f[a] = u;
43
+ }), f;
44
44
  }
45
45
  export {
46
- E as getDendrograms
46
+ v as getDendrograms
47
47
  };
48
48
  //# sourceMappingURL=getDendrograms.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDendrograms.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/getDendrograms.ts"],"sourcesContent":["import type {Cluster} from './components/types';\nimport type {GroupedCellsData} from './getCells';\nimport type {HeatmapSettingsImpl} from './HeatmapSettingsImpl';\nimport {getClusters} from './getClusters';\nimport type {HierarchyNode} from 'd3-hierarchy';\nimport {hierarchy} from 'd3-hierarchy';\n\nexport type DendrogramsData = Record<string, {\n hierarchyX: HierarchyNode<Cluster>[];\n hierarchyY: HierarchyNode<Cluster>[];\n}>\n\nexport function getDendrograms(\n groupedCellsData: GroupedCellsData,\n dendrogramX: HeatmapSettingsImpl['dendrogramX'],\n dendrogramY: HeatmapSettingsImpl['dendrogramY'],\n facetSettings: HeatmapSettingsImpl['facetSettings']\n): DendrogramsData {\n const {facetKeys, xGroupKeys, yGroupKeys} = groupedCellsData.meta;\n const result:DendrogramsData = {};\n\n if (dendrogramX && facetSettings.sharedX) {\n throw Error('Dendrogram on X axis is not available with shared by facets X axis');\n }\n\n facetKeys.forEach(facetKey => {\n const facetResult: DendrogramsData[string] = {\n hierarchyX: [],\n hierarchyY: [],\n };\n const cellsGroup = groupedCellsData.facets[facetKey];\n if (dendrogramX) {\n const groupClusters:Cluster[] = [];\n const updatedXKeys:string[] = [];\n xGroupKeys.forEach(xGroupKey => {\n const xKeys = cellsGroup.xKeysByGroups[xGroupKey];\n const yKeys = cellsGroup.yKeys;\n const rootCluster = getClusters(\n xKeys,\n xKeys.map(x => yKeys.map(y => (cellsGroup.cells[x][y]?.normalizedValue ?? dendrogramX.fillNA) as number)),\n dendrogramX.distance,\n dendrogramX.linkage\n );\n //set sorted group keys\n groupedCellsData.facets[facetKey].xKeysByGroups[xGroupKey] = rootCluster.keys;\n updatedXKeys.push(...rootCluster.keys);\n groupClusters.push(rootCluster);\n });\n // set sorted group keys of all groups\n groupedCellsData.facets[facetKey].xKeys = updatedXKeys;\n facetResult.hierarchyX = groupClusters.map((item) => hierarchy(item));\n }\n if (dendrogramY) {\n const groupClusters:Cluster[] = [];\n const updatedYKeys:string[] = [];\n yGroupKeys.forEach(yGroupKey => {\n const yKeys = cellsGroup.yKeysByGroups[yGroupKey];\n const xKeys = cellsGroup.xKeys;\n const rootCluster = getClusters(\n yKeys,\n yKeys.map(y => xKeys.map(x => (cellsGroup.cells[x][y]?.normalizedValue ?? dendrogramY.fillNA) as number)),\n dendrogramY.distance,\n dendrogramY.linkage\n );\n //set sorted group keys\n groupedCellsData.facets[facetKey].yKeysByGroups[yGroupKey] = rootCluster.keys;\n updatedYKeys.push(...rootCluster.keys);\n groupClusters.push(rootCluster);\n });\n // set sorted group keys of all groups\n groupedCellsData.facets[facetKey].yKeys = updatedYKeys;\n facetResult.hierarchyY = groupClusters.map((item) => hierarchy(item));\n }\n result[facetKey] = facetResult;\n });\n\n return result;\n}\n"],"names":["getDendrograms","groupedCellsData","dendrogramX","dendrogramY","facetSettings","facetKeys","xGroupKeys","yGroupKeys","result","facetKey","facetResult","cellsGroup","groupClusters","updatedXKeys","xGroupKey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C5B,cAAMT,IAAQL,EAAW,cAAcc,CAAS,GAC1CV,IAAQJ,EAAW,OACnBM,IAAcC;AAAAA,UAChBF;AAAAA,UACAA,EAAM,IAAI,CAAAI,MAAKL,EAAM,IAAI,CAAAI,MAAA;;AAAM,qBAAAE,IAAAV,EAAW,MAAMQ,CAAC,EAAEC,CAAC,MAArB,OAAA,SAAAC,EAAwB,oBAAmBlB,EAAY;AAAA,UAAA,CAAiB,CAAC;AAAA,UACxGA,EAAY;AAAA,UACZA,EAAY;AAAA,QAAA;AAGhBF,QAAAA,EAAiB,OAAOQ,CAAQ,EAAE,cAAcgB,CAAS,IAAIR,EAAY,MACzEO,EAAa,KAAK,GAAGP,EAAY,IAAI,GACrCL,EAAc,KAAKK,CAAW;AAAA,MAClC,CAAC,GAEDhB,EAAiB,OAAOQ,CAAQ,EAAE,QAAQe,GAC1Cd,EAAY,aAAaE,EAAc,IAAI,CAACU,MAASC,EAAUD,CAAI,CAAC;AAAA,IACxE;AACAd,IAAAA,EAAOC,CAAQ,IAAIC;AAAAA,EACvB,CAAC,GAEMF;AACX;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"getDendrograms.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/getDendrograms.ts"],"sourcesContent":["import type {Cluster} from './components/types';\nimport type {GroupedCellsData} from './getCells';\nimport type {HeatmapSettingsImpl} from './HeatmapSettingsImpl';\nimport {getClusters} from './getClusters';\nimport type {HierarchyNode} from 'd3-hierarchy';\nimport {hierarchy} from 'd3-hierarchy';\n\nexport type DendrogramsData = Record<string, {\n hierarchyByGroupX: Record<string, HierarchyNode<Cluster>>;\n hierarchyByGroupY: Record<string, HierarchyNode<Cluster>>;\n}>\n\nexport function getDendrograms(\n groupedCellsData: GroupedCellsData,\n dendrogramX: HeatmapSettingsImpl['dendrogramX'],\n dendrogramY: HeatmapSettingsImpl['dendrogramY'],\n facetSettings: HeatmapSettingsImpl['facetSettings']\n): DendrogramsData {\n const {facetKeys, xGroupKeys, yGroupKeys} = groupedCellsData.meta;\n const result:DendrogramsData = {};\n\n if (dendrogramX && facetSettings.sharedX) {\n throw Error('Dendrogram on X axis is not available with shared by facets X axis');\n }\n\n facetKeys.forEach(facetKey => {\n const facetResult: DendrogramsData[string] = {\n hierarchyByGroupX: {},\n hierarchyByGroupY: {},\n };\n const cellsGroup = groupedCellsData.facets[facetKey];\n if (dendrogramX) {\n const updatedXKeys:string[] = [];\n xGroupKeys.forEach(xGroupKey => {\n const xKeys = cellsGroup.xKeysByGroups[xGroupKey];\n const yKeys = cellsGroup.yKeys;\n const rootCluster = getClusters(\n xKeys,\n xKeys.map(x => yKeys.map(y => (cellsGroup.cells[x][y]?.normalizedValue ?? dendrogramX.fillNA) as number)),\n dendrogramX.distance,\n dendrogramX.linkage\n );\n //set sorted group keys\n groupedCellsData.facets[facetKey].xKeysByGroups[xGroupKey] = rootCluster.keys;\n updatedXKeys.push(...rootCluster.keys);\n facetResult.hierarchyByGroupX[xGroupKey] = hierarchy(rootCluster);\n });\n // set sorted group keys of all groups\n groupedCellsData.facets[facetKey].xKeys = updatedXKeys;\n }\n if (dendrogramY) {\n const updatedYKeys:string[] = [];\n yGroupKeys.forEach(yGroupKey => {\n const yKeys = cellsGroup.yKeysByGroups[yGroupKey];\n const xKeys = cellsGroup.xKeys;\n const rootCluster = getClusters(\n yKeys,\n yKeys.map(y => xKeys.map(x => (cellsGroup.cells[x][y]?.normalizedValue ?? dendrogramY.fillNA) as number)),\n dendrogramY.distance,\n dendrogramY.linkage\n );\n //set sorted group keys\n groupedCellsData.facets[facetKey].yKeysByGroups[yGroupKey] = rootCluster.keys;\n updatedYKeys.push(...rootCluster.keys);\n facetResult.hierarchyByGroupY[yGroupKey] = hierarchy(rootCluster);\n });\n // set sorted group keys of all groups\n groupedCellsData.facets[facetKey].yKeys = updatedYKeys;\n }\n result[facetKey] = facetResult;\n });\n\n return result;\n}\n"],"names":["getDendrograms","groupedCellsData","dendrogramX","dendrogramY","facetSettings","facetKeys","xGroupKeys","yGroupKeys","result","facetKey","facetResult","cellsGroup","updatedXKeys","xGroupKey","xKeys","yKeys","rootCluster","getClusters","x","y","_a","hierarchy","updatedYKeys","yGroupKey"],"mappings":";;AAYO,SAASA,EACZC,GACAC,GACAC,GACAC,GACe;AACf,QAAM,EAAC,WAAAC,GAAW,YAAAC,GAAY,YAAAC,MAAcN,EAAiB,MACvDO,IAAyB,CAAA;AAE/B,MAAIN,KAAeE,EAAc;AAC7B,UAAM,MAAM,oEAAoE;AAGpF,SAAAC,EAAU,QAAQ,CAAAI,MAAY;AAC1B,UAAMC,IAAuC;AAAA,MACzC,mBAAmB,CAAA;AAAA,MACnB,mBAAmB,CAAA;AAAA,IAAA,GAEjBC,IAAaV,EAAiB,OAAOQ,CAAQ;AACnD,QAAIP,GAAa;AACb,YAAMU,IAAwB,CAAA;AAC9BN,MAAAA,EAAW,QAAQ,CAAAO,MAAa;AAC5B,cAAMC,IAAQH,EAAW,cAAcE,CAAS,GAC1CE,IAAQJ,EAAW,OACnBK,IAAcC;AAAAA,UAChBH;AAAAA,UACAA,EAAM,IAAI,CAAAI,MAAKH,EAAM,IAAI,CAAAI,MAAA;;AAAM,qBAAAC,IAAAT,EAAW,MAAMO,CAAC,EAAEC,CAAC,MAArB,OAAA,SAAAC,EAAwB,oBAAmBlB,EAAY;AAAA,UAAA,CAAiB,CAAC;AAAA,UACxGA,EAAY;AAAA,UACZA,EAAY;AAAA,QAAA;AAGhBD,QAAAA,EAAiB,OAAOQ,CAAQ,EAAE,cAAcI,CAAS,IAAIG,EAAY,MACzEJ,EAAa,KAAK,GAAGI,EAAY,IAAI,GACrCN,EAAY,kBAAkBG,CAAS,IAAIQ,EAAUL,CAAW;AAAA,MACpE,CAAC,GAEDf,EAAiB,OAAOQ,CAAQ,EAAE,QAAQG;AAAAA,IAC9C;AACA,QAAIT,GAAa;AACb,YAAMmB,IAAwB,CAAA;AAC9Bf,MAAAA,EAAW,QAAQ,CAAAgB,MAAa;AAC5B,cAAMR,IAAQJ,EAAW,cAAcY,CAAS,GAC1CT,IAAQH,EAAW,OACnBK,IAAcC;AAAAA,UAChBF;AAAAA,UACAA,EAAM,IAAI,CAAAI,MAAKL,EAAM,IAAI,CAAAI,MAAA;;AAAM,qBAAAE,IAAAT,EAAW,MAAMO,CAAC,EAAEC,CAAC,MAArB,OAAA,SAAAC,EAAwB,oBAAmBjB,EAAY;AAAA,UAAA,CAAiB,CAAC;AAAA,UACxGA,EAAY;AAAA,UACZA,EAAY;AAAA,QAAA;AAGhBF,QAAAA,EAAiB,OAAOQ,CAAQ,EAAE,cAAcc,CAAS,IAAIP,EAAY,MACzEM,EAAa,KAAK,GAAGN,EAAY,IAAI,GACrCN,EAAY,kBAAkBa,CAAS,IAAIF,EAAUL,CAAW;AAAA,MACpE,CAAC,GAEDf,EAAiB,OAAOQ,CAAQ,EAAE,QAAQa;AAAAA,IAC9C;AACAd,IAAAA,EAAOC,CAAQ,IAAIC;AAAAA,EACvB,CAAC,GAEMF;AACX;","x_google_ignoreList":[0]}
@@ -3,13 +3,13 @@ import { getCells as N } from "./getCells.js";
3
3
  import { getDendrograms as q } from "./getDendrograms.js";
4
4
  import { isColumnName as y } from "../utils/index.js";
5
5
  import { renderToString as I } from "../node_modules/react-dom/server.browser.js";
6
- import $ from "./ChartRenderer.js";
7
- import { HeatmapSettingsImpl as X } from "./HeatmapSettingsImpl.js";
8
- var P = Object.defineProperty, F = (d, t, e) => t in d ? P(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e, f = (d, t, e) => F(d, typeof t != "symbol" ? t + "" : t, e);
6
+ import P from "./ChartRenderer.js";
7
+ import { HeatmapSettingsImpl as b } from "./HeatmapSettingsImpl.js";
8
+ var $ = Object.defineProperty, F = (d, t, e) => t in d ? $(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e, f = (d, t, e) => F(d, typeof t != "symbol" ? t + "" : t, e);
9
9
  class tt extends E {
10
10
  constructor(t, e, a) {
11
- super(t, e), f(this, "settings"), f(this, "chartRenderer", new $()), f(this, "onTooltipHintSwitch", () => {
12
- }), f(this, "calculatedData", null), this.settings = new X(e), a && (this.onTooltipHintSwitch = a[0]);
11
+ super(t, e), f(this, "settings"), f(this, "chartRenderer", new P()), f(this, "onTooltipHintSwitch", () => {
12
+ }), f(this, "calculatedData", null), this.settings = new b(e), a && (this.onTooltipHintSwitch = a[0]);
13
13
  }
14
14
  mount(t) {
15
15
  try {
@@ -24,7 +24,7 @@ class tt extends E {
24
24
  updateSettingsAndData(t, e) {
25
25
  try {
26
26
  const a = this.settings, r = this.data;
27
- this.settings = new X(e), this.data = t, this._needUpdateCalculatedDataBySettings(a, this.settings) || this._needUpdateCalculatedDataByData(r, this.data) ? this._updateData() : this._updateAesInData(), this._updateChart();
27
+ this.settings = new b(e), this.data = t, this._needUpdateCalculatedDataBySettings(a, this.settings) || this._needUpdateCalculatedDataByData(r, this.data) ? this._updateData() : this._updateAesInData(), this._updateChart();
28
28
  } catch (a) {
29
29
  a instanceof Error && this.chartRenderer.renderError(a.message);
30
30
  }
@@ -41,28 +41,28 @@ class tt extends E {
41
41
  xColumn: D,
42
42
  yColumn: S,
43
43
  valueColumn: A,
44
- xGroupBy: x,
45
- yGroupBy: w,
44
+ xGroupBy: w,
45
+ yGroupBy: x,
46
46
  facetBy: j,
47
- annotations: k,
48
- chartSettings: R,
47
+ annotations: R,
48
+ chartSettings: T,
49
49
  facetSettings: B,
50
50
  dendrogramX: _,
51
- dendrogramY: Y,
51
+ dendrogramY: X,
52
52
  normalization: C,
53
- NAValueAs: T
54
- } = e, z = Object.values(((a = t.dendrogramX) == null ? void 0 : a.aes) || {}).filter(
53
+ NAValueAs: k
54
+ } = e, G = Object.values(((a = t.dendrogramX) == null ? void 0 : a.aes) || {}).filter(
55
55
  y
56
- ), G = Object.values((_ == null ? void 0 : _.aes) || {}).filter(y), H = Object.values(((r = t.dendrogramY) == null ? void 0 : r.aes) || {}).filter(
56
+ ), z = Object.values((_ == null ? void 0 : _.aes) || {}).filter(y), H = Object.values(((r = t.dendrogramY) == null ? void 0 : r.aes) || {}).filter(
57
57
  y
58
- ), O = Object.values((Y == null ? void 0 : Y.aes) || {}).filter(y);
59
- function h(m, b) {
60
- return m.length !== b.length || m.some((U, V) => U.value !== b[V].value);
58
+ ), O = Object.values((X == null ? void 0 : X.aes) || {}).filter(y);
59
+ function h(m, Y) {
60
+ return m.length !== Y.length || m.some((U, V) => U.value !== Y[V].value);
61
61
  }
62
- return t.xColumn.value !== D.value || t.yColumn.value !== S.value || t.valueColumn.value !== A.value || h(t.xGroupBy, x) || h(t.yGroupBy, w) || h(t.facetBy, j) || h(
62
+ return t.xColumn.value !== D.value || t.yColumn.value !== S.value || t.valueColumn.value !== A.value || h(t.xGroupBy, w) || h(t.yGroupBy, x) || h(t.facetBy, j) || h(
63
63
  t.annotations.map((m) => m.valueColumn),
64
- k.map((m) => m.valueColumn)
65
- ) || h(z, G) || h(H, O) || (e.dendrogramX || t.dendrogramX) && (((n = t.dendrogramX) == null ? void 0 : n.distance) !== ((i = e.dendrogramX) == null ? void 0 : i.distance) || ((l = t.dendrogramX) == null ? void 0 : l.linkage) !== ((o = e.dendrogramX) == null ? void 0 : o.linkage)) || (e.dendrogramY || t.dendrogramY) && (((u = t.dendrogramY) == null ? void 0 : u.distance) !== ((s = e.dendrogramY) == null ? void 0 : s.distance) || ((c = t.dendrogramY) == null ? void 0 : c.linkage) !== ((p = e.dendrogramY) == null ? void 0 : p.linkage)) || t.chartSettings.valueType !== R.valueType || t.facetSettings.sharedX !== B.sharedX || t.facetSettings.sharedY !== B.sharedY || ((v = t.normalization) == null ? void 0 : v.method) !== (C == null ? void 0 : C.method) || ((g = t.normalization) == null ? void 0 : g.direction) !== (C == null ? void 0 : C.direction) || t.NAValueAs !== T;
64
+ R.map((m) => m.valueColumn)
65
+ ) || h(G, z) || h(H, O) || (e.dendrogramX || t.dendrogramX) && (((n = t.dendrogramX) == null ? void 0 : n.distance) !== ((i = e.dendrogramX) == null ? void 0 : i.distance) || ((l = t.dendrogramX) == null ? void 0 : l.linkage) !== ((o = e.dendrogramX) == null ? void 0 : o.linkage)) || (e.dendrogramY || t.dendrogramY) && (((u = t.dendrogramY) == null ? void 0 : u.distance) !== ((s = e.dendrogramY) == null ? void 0 : s.distance) || ((c = t.dendrogramY) == null ? void 0 : c.linkage) !== ((p = e.dendrogramY) == null ? void 0 : p.linkage)) || t.chartSettings.valueType !== T.valueType || t.facetSettings.sharedX !== B.sharedX || t.facetSettings.sharedY !== B.sharedY || ((v = t.normalization) == null ? void 0 : v.method) !== (C == null ? void 0 : C.method) || ((g = t.normalization) == null ? void 0 : g.direction) !== (C == null ? void 0 : C.direction) || t.NAValueAs !== k;
66
66
  }
67
67
  _needUpdateCalculatedDataByData(t, e) {
68
68
  const a = Object.keys(t.data), r = Object.keys(e.data);
@@ -1,66 +1,101 @@
1
- import { MIN_STEP_FOR_VISIBLE_LABELS as p } from "../constants.js";
2
- import _ from "../../node_modules/lodash/lodash.js";
3
- function V(a, T, c, y, h) {
4
- const { facetKeys: f, xGroupKeys: b, yGroupKeys: u, xKeysByGroups: P, yKeysByGroups: A, xLabels: m, yLabels: B } = y.meta, W = a.xGroupLabels / 180 * Math.PI, I = a.yGroupLabels / 180 * Math.PI, K = a.xAxisLabels / 180 * Math.PI, E = a.yAxisLabels / 180 * Math.PI;
5
- let l = 0, r = 0;
6
- const M = a.xGroupLabels === 45, g = a.xAxisLabels === 45;
7
- if (M || g)
8
- if (!T.sharedX)
9
- f.forEach((t) => {
10
- const o = b.find(
11
- (G) => y.facets[t].xKeysByGroups[G].length > 0
12
- );
13
- if (!o)
14
- return;
15
- const s = y.facets[t].xKeysByGroups[o], e = c.x[t], i = e > p, n = s.length * e / 2, x = m[s[0]];
16
- l = Math.max(
17
- l,
18
- (M ? h.getTextWidth(o) * Math.cos(W) : 0) - n,
19
- (g && i ? h.getTextWidth(x) * Math.cos(K) : 0) - e / 2
1
+ import { MIN_STEP_FOR_VISIBLE_LABELS as I } from "../constants.js";
2
+ const d = Math.cos(Math.PI / 4);
3
+ function E(e, y, n, x, h, c, s, M, B, K) {
4
+ const p = c[e], T = p > I;
5
+ let l = 0;
6
+ return y.forEach((f) => {
7
+ const i = h(e, f);
8
+ if (i.length === 0)
9
+ return 0;
10
+ const a = i.length * p / 2, o = M ? K.getTextWidth(n[f]) * d - a - s(i[0]) : 0, G = B && T ? y.reduce((L, u) => {
11
+ const b = x[u];
12
+ return Math.max(L, K.getTextWidth(b) * d - p / 2 - s(u));
13
+ }, 0) : 0;
14
+ l = Math.max(l, o, G);
15
+ }), l;
16
+ }
17
+ function g(e, y, n, x, h, c) {
18
+ const { facetKeys: s, xGroupKeys: M, yGroupKeys: B, xKeysByGroups: K, yKeysByGroups: p, xLabels: T, yLabels: l, xGroupLabels: f, yGroupLabels: i } = h.meta;
19
+ let a = 0, o = 0;
20
+ const G = e.xGroupLabels === 45, L = e.xAxisLabels === 45;
21
+ if (G || L)
22
+ if (!y.sharedX)
23
+ s.forEach((t) => {
24
+ a = Math.max(
25
+ E(
26
+ t,
27
+ M,
28
+ f,
29
+ T,
30
+ (m, r) => h.facets[m].xKeysByGroups[r],
31
+ x.x,
32
+ n.x[t],
33
+ G,
34
+ L,
35
+ c
36
+ ),
37
+ a
20
38
  );
21
39
  });
22
40
  else {
23
- const t = b[0], o = f[0];
24
- if (t) {
25
- const s = P[t], e = c.x[o], i = e > p, n = s.length * e / 2, x = m[s[0]];
26
- l = Math.max(
27
- l,
28
- (M ? h.getTextWidth(t) * Math.cos(W) : 0) - n,
29
- (g && i ? h.getTextWidth(x) * Math.cos(K) : 0) - e / 2
30
- );
31
- }
41
+ const t = s[0];
42
+ a = Math.max(
43
+ E(
44
+ t,
45
+ M,
46
+ f,
47
+ T,
48
+ (m, r) => K[r],
49
+ x.x,
50
+ n.x[t],
51
+ G,
52
+ L,
53
+ c
54
+ ),
55
+ a
56
+ );
32
57
  }
33
- const L = a.yGroupLabels === 45, d = a.yAxisLabels === 45;
34
- if (L || d)
35
- if (!T.sharedY)
36
- f.forEach((t) => {
37
- const o = _.findLast(
38
- u,
39
- (G) => y.facets[t].yKeysByGroups[G].length > 0
40
- );
41
- if (!o)
42
- return;
43
- const s = y.facets[t].yKeysByGroups[o], e = c.y[t], i = e > p, n = s.length * e / 2, x = B[s[s.length - 1]];
44
- r = Math.max(
45
- r,
46
- (L ? h.getTextWidth(o) * Math.cos(I) : 0) - n,
47
- (d && i ? h.getTextWidth(x) * Math.cos(E) : 0) - e / 2
58
+ const u = e.yGroupLabels === 45, b = e.yAxisLabels === 45;
59
+ if (u || b)
60
+ if (!y.sharedY)
61
+ s.forEach((t) => {
62
+ o = Math.max(
63
+ E(
64
+ t,
65
+ B,
66
+ i,
67
+ l,
68
+ (m, r) => h.facets[m].yKeysByGroups[r],
69
+ x.y,
70
+ n.y[t],
71
+ u,
72
+ b,
73
+ c
74
+ ),
75
+ o
48
76
  );
49
77
  });
50
78
  else {
51
- const t = u[u.length - 1], o = f[0];
52
- if (t) {
53
- const s = A[t], e = c.y[o], i = e > p, n = s.length * e / 2, x = B[s[s.length - 1]];
54
- r = Math.max(
55
- r,
56
- (L ? h.getTextWidth(t) * Math.cos(I) : 0) - n,
57
- (d && i ? h.getTextWidth(x) * Math.cos(E) : 0) - e / 2
58
- );
59
- }
79
+ const t = s[0];
80
+ o = Math.max(
81
+ E(
82
+ t,
83
+ B,
84
+ i,
85
+ l,
86
+ (m, r) => p[r],
87
+ x.y,
88
+ n.y[t],
89
+ u,
90
+ b,
91
+ c
92
+ ),
93
+ o
94
+ );
60
95
  }
61
- return { xCaptionTail: l, yCaptionTail: r };
96
+ return { xCaptionTail: a, yCaptionTail: o };
62
97
  }
63
98
  export {
64
- V as calculateCaptionTails
99
+ g as calculateCaptionTails
65
100
  };
66
101
  //# sourceMappingURL=calculateCaptionTails.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"calculateCaptionTails.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/utils/calculateCaptionTails.ts"],"sourcesContent":["import type {LabelAngles} from '../components/types';\nimport {MIN_STEP_FOR_VISIBLE_LABELS} from '../constants';\nimport type {GroupedCellsData} from '../getCells';\nimport type {HeatmapSettingsImpl} from '../HeatmapSettingsImpl';\nimport type {TextMeasurer} from '../../utils/TextMeasurer';\nimport lodash from 'lodash';\n\nexport function calculateCaptionTails(\n labelAngles: LabelAngles,\n facetSettings: HeatmapSettingsImpl['facetSettings'],\n steps: {\n x: Record<string, number>;\n y: Record<string, number>;\n },\n groupedCells: GroupedCellsData,\n textMeasurer: TextMeasurer\n): {xCaptionTail: number; yCaptionTail: number} {\n const {facetKeys, xGroupKeys, yGroupKeys, xKeysByGroups, yKeysByGroups, xLabels, yLabels} = groupedCells.meta;\n const xGroupAngle = (labelAngles.xGroupLabels / 180) * Math.PI;\n const yGroupAngle = (labelAngles.yGroupLabels / 180) * Math.PI;\n const xLabelAngle = (labelAngles.xAxisLabels / 180) * Math.PI;\n const yLabelAngle = (labelAngles.yAxisLabels / 180) * Math.PI;\n let xCaptionTail = 0;\n let yCaptionTail = 0;\n // tails from 45deg inclined captions of groups titles/cells labels, that take place on adjacent padding\n const xGroupTitleInclined = labelAngles.xGroupLabels === 45;\n const xLabelsInclined = labelAngles.xAxisLabels === 45;\n if (xGroupTitleInclined || xLabelsInclined) {\n if (!facetSettings.sharedX) {\n facetKeys.forEach(facetKey => {\n const firstGroupKey = xGroupKeys.find(\n key => groupedCells.facets[facetKey].xKeysByGroups[key].length > 0\n );\n if (!firstGroupKey) {\n return;\n }\n const groupKeys = groupedCells.facets[facetKey].xKeysByGroups[firstGroupKey];\n const step = steps.x[facetKey];\n const labelsVisible = step > MIN_STEP_FOR_VISIBLE_LABELS;\n const groupHalfWidth = (groupKeys.length * step) / 2;\n const firstLabel = xLabels[groupKeys[0]];\n xCaptionTail = Math.max(\n xCaptionTail,\n (xGroupTitleInclined ? textMeasurer.getTextWidth(firstGroupKey) * Math.cos(xGroupAngle) : 0) -\n groupHalfWidth,\n (xLabelsInclined && labelsVisible\n ? textMeasurer.getTextWidth(firstLabel) * Math.cos(xLabelAngle)\n : 0) -\n step / 2\n );\n });\n } else {\n const firstGroupKey = xGroupKeys[0];\n const facetKey = facetKeys[0]; // there is no difference between facets in this case\n if (firstGroupKey) {\n const groupKeys = xKeysByGroups[firstGroupKey];\n const step = steps.x[facetKey];\n const labelsVisible = step > MIN_STEP_FOR_VISIBLE_LABELS;\n const groupHalfWidth = (groupKeys.length * step) / 2;\n const firstLabel = xLabels[groupKeys[0]];\n xCaptionTail = Math.max(\n xCaptionTail,\n (xGroupTitleInclined ? textMeasurer.getTextWidth(firstGroupKey) * Math.cos(xGroupAngle) : 0) -\n groupHalfWidth,\n (xLabelsInclined && labelsVisible\n ? textMeasurer.getTextWidth(firstLabel) * Math.cos(xLabelAngle)\n : 0) -\n step / 2\n );\n }\n }\n }\n const yGroupTitleInclined = labelAngles.yGroupLabels === 45;\n const yLabelsInclined = labelAngles.yAxisLabels === 45;\n if (yGroupTitleInclined || yLabelsInclined) {\n if (!facetSettings.sharedY) {\n facetKeys.forEach(facetKey => {\n const lastGroupKey = lodash.findLast(\n yGroupKeys,\n key => groupedCells.facets[facetKey].yKeysByGroups[key].length > 0\n );\n if (!lastGroupKey) {\n return;\n }\n const groupKeys = groupedCells.facets[facetKey].yKeysByGroups[lastGroupKey];\n const step = steps.y[facetKey];\n const labelsVisible = step > MIN_STEP_FOR_VISIBLE_LABELS;\n const groupHalfWidth = (groupKeys.length * step) / 2;\n const lastLabel = yLabels[groupKeys[groupKeys.length - 1]];\n yCaptionTail = Math.max(\n yCaptionTail,\n (yGroupTitleInclined ? textMeasurer.getTextWidth(lastGroupKey) * Math.cos(yGroupAngle) : 0) -\n groupHalfWidth,\n (yLabelsInclined && labelsVisible\n ? textMeasurer.getTextWidth(lastLabel) * Math.cos(yLabelAngle)\n : 0) -\n step / 2\n );\n });\n } else {\n const lastGroupKey = yGroupKeys[yGroupKeys.length - 1];\n const facetKey = facetKeys[0]; // there is no difference between facets in this case\n if (lastGroupKey) {\n const groupKeys = yKeysByGroups[lastGroupKey];\n const step = steps.y[facetKey];\n const labelsVisible = step > MIN_STEP_FOR_VISIBLE_LABELS;\n const groupHalfWidth = (groupKeys.length * step) / 2;\n const lastLabel = yLabels[groupKeys[groupKeys.length - 1]];\n yCaptionTail = Math.max(\n yCaptionTail,\n (yGroupTitleInclined ? textMeasurer.getTextWidth(lastGroupKey) * Math.cos(yGroupAngle) : 0) -\n groupHalfWidth,\n (yLabelsInclined && labelsVisible\n ? textMeasurer.getTextWidth(lastLabel) * Math.cos(yLabelAngle)\n : 0) -\n step / 2\n );\n }\n }\n }\n return {xCaptionTail, yCaptionTail};\n}\n"],"names":["calculateCaptionTails","labelAngles","facetSettings","steps","groupedCells","textMeasurer","facetKeys","xGroupKeys","yGroupKeys","xKeysByGroups","yKeysByGroups","xLabels","yLabels","xGroupAngle","yGroupAngle","xLabelAngle","yLabelAngle","xCaptionTail","yCaptionTail","xGroupTitleInclined","xLabelsInclined","facetKey","firstGroupKey","key","groupKeys","step","labelsVisible","MIN_STEP_FOR_VISIBLE_LABELS","groupHalfWidth","firstLabel","yGroupTitleInclined","yLabelsInclined","lastGroupKey","lodash","lastLabel"],"mappings":";;AAOO,SAASA,EACZC,GACAC,GACAC,GAIAC,GACAC,GAC4C;AAC5C,QAAM,EAAC,WAAAC,GAAW,YAAAC,GAAY,YAAAC,GAAY,eAAAC,GAAe,eAAAC,GAAe,SAAAC,GAAS,SAAAC,EAAAA,IAAWR,EAAa,MACnGS,IAAeZ,EAAY,eAAe,MAAO,KAAK,IACtDa,IAAeb,EAAY,eAAe,MAAO,KAAK,IACtDc,IAAed,EAAY,cAAc,MAAO,KAAK,IACrDe,IAAef,EAAY,cAAc,MAAO,KAAK;AAC3D,MAAIgB,IAAe,GACfC,IAAe;AAEnB,QAAMC,IAAsBlB,EAAY,iBAAiB,IACnDmB,IAAkBnB,EAAY,gBAAgB;AACpD,MAAI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AO;AAAA,QAAA;AAAA,MAEnB;AAAA,IACJ;AAEJ,SAAO,EAAC,cAAAR,GAAc,cAAAC,EAAAA;AAC1B;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"calculateCaptionTails.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/utils/calculateCaptionTails.ts"],"sourcesContent":["import type {ChartsScales} from '../components/types';\nimport type {LabelAngles} from '../components/types';\nimport {MIN_STEP_FOR_VISIBLE_LABELS} from '../constants';\nimport type {GroupedCellsData} from '../getCells';\nimport type {HeatmapSettingsImpl} from '../HeatmapSettingsImpl';\nimport type {TextMeasurer} from '../../utils/TextMeasurer';\n\nconst COS_PI_4 = Math.cos(Math.PI / 4);\nfunction getTailByFacetKey (\n facetKey: string,\n groupKeys: string[],\n groupLabels: Record<string, string>,\n valueLabels: Record<string, string>,\n getKeysInGroup: (facetKey:string, groupKey:string) => string[],\n steps: Record<string, number>,\n scale: (v:string) => number,\n groupTitleInclined: boolean,\n labelTitleInclined: boolean,\n textMeasurer: TextMeasurer\n): number {\n const step = steps[facetKey];\n const labelsVisible = step > MIN_STEP_FOR_VISIBLE_LABELS;\n\n let maxTail = 0;\n groupKeys.forEach((groupKey) => {\n const keysInGroup = getKeysInGroup(facetKey, groupKey);\n if (keysInGroup.length === 0) {\n return 0;\n }\n const groupHalfWidth = (keysInGroup.length * step) / 2;\n const groupTail = groupTitleInclined\n ? textMeasurer.getTextWidth(groupLabels[groupKey]) * COS_PI_4 - groupHalfWidth - scale(keysInGroup[0])\n : 0;\n const labelTail = labelTitleInclined && labelsVisible\n ? groupKeys.reduce((res, key) => {\n const label = valueLabels[key];\n return Math.max(res, textMeasurer.getTextWidth(label) * COS_PI_4 - step / 2 - scale(key));\n }, 0)\n : 0;\n maxTail = Math.max(maxTail, groupTail, labelTail);\n });\n return maxTail;\n}\nexport function calculateCaptionTails(\n labelAngles: LabelAngles,\n facetSettings: HeatmapSettingsImpl['facetSettings'],\n scales: ChartsScales,\n steps: {\n x: Record<string, number>;\n y: Record<string, number>;\n },\n groupedCells: GroupedCellsData,\n textMeasurer: TextMeasurer\n): {xCaptionTail: number; yCaptionTail: number} {\n const {facetKeys, xGroupKeys, yGroupKeys, xKeysByGroups, yKeysByGroups, xLabels, yLabels, xGroupLabels, yGroupLabels} = groupedCells.meta;\n let xCaptionTail = 0;\n let yCaptionTail = 0;\n // tails from 45deg inclined captions of groups titles/cells labels, that take place on adjacent padding\n const xGroupTitleInclined = labelAngles.xGroupLabels === 45;\n const xLabelsInclined = labelAngles.xAxisLabels === 45;\n if (xGroupTitleInclined || xLabelsInclined) {\n if (!facetSettings.sharedX) {\n facetKeys.forEach(facetKey => {\n xCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n xGroupKeys,\n xGroupLabels,\n xLabels,\n (facetKey:string, groupKey:string) => groupedCells.facets[facetKey].xKeysByGroups[groupKey],\n steps.x,\n scales.x[facetKey],\n xGroupTitleInclined,\n xLabelsInclined,\n textMeasurer\n ),\n xCaptionTail\n );\n });\n } else {\n const facetKey = facetKeys[0]; // there is no difference between facets in this case\n xCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n xGroupKeys,\n xGroupLabels,\n xLabels,\n (facetKey:string, groupKey:string) => xKeysByGroups[groupKey],\n steps.x,\n scales.x[facetKey],\n xGroupTitleInclined,\n xLabelsInclined,\n textMeasurer\n ),\n xCaptionTail\n );\n }\n }\n const yGroupTitleInclined = labelAngles.yGroupLabels === 45;\n const yLabelsInclined = labelAngles.yAxisLabels === 45;\n if (yGroupTitleInclined || yLabelsInclined) {\n if (!facetSettings.sharedY) {\n facetKeys.forEach(facetKey => {\n yCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n yGroupKeys,\n yGroupLabels,\n yLabels,\n (facetKey:string, groupKey:string) => groupedCells.facets[facetKey].yKeysByGroups[groupKey],\n steps.y,\n scales.y[facetKey],\n yGroupTitleInclined,\n yLabelsInclined,\n textMeasurer\n ),\n yCaptionTail\n );\n });\n } else {\n const facetKey = facetKeys[0]; // there is no difference between facets in this case\n yCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n yGroupKeys,\n yGroupLabels,\n yLabels,\n (facetKey:string, groupKey:string) => yKeysByGroups[groupKey],\n steps.y,\n scales.y[facetKey],\n yGroupTitleInclined,\n yLabelsInclined,\n textMeasurer\n ),\n yCaptionTail\n );\n }\n }\n return {xCaptionTail, yCaptionTail};\n}\n"],"names":["COS_PI_4","getTailByFacetKey","facetKey","groupKeys","groupLabels","valueLabels","getKeysInGroup","steps","scale","groupTitleInclined","labelTitleInclined","textMeasurer","step","labelsVisible","MIN_STEP_FOR_VISIBLE_LABELS","maxTail","groupKey","keysInGroup","groupHalfWidth","groupTail","labelTail","res","key","label","calculateCaptionTails","labelAngles","facetSettings","scales","groupedCells","facetKeys","xGroupKeys","yGroupKeys","xKeysByGroups","yKeysByGroups","xLabels","yLabels","xGroupLabels","yGroupLabels","xCaptionTail","yCaptionTail","xGroupTitleInclined","xLabelsInclined","yGroupTitleInclined","yLabelsInclined"],"mappings":";AAOA,MAAMA,IAAW,KAAK,IAAI,KAAK,KAAK,CAAC;AACrC,SAASC,EACLC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACM;AACN,QAAMC,IAAOL,EAAML,CAAQ,GACrBW,IAAgBD,IAAOE;AAE7B,MAAIC,IAAU;AACd,SAAAZ,EAAU,QAAQ,CAACa,MAAa;AAC5B,UAAMC,IAAcX,EAAeJ,GAAUc,CAAQ;AACrD,QAAIC,EAAY,WAAW;AACvB,aAAO;AAEX,UAAMC,IAAkBD,EAAY,SAASL,IAAQ,GAC/CO,IAAYV,IACZE,EAAa,aAAaP,EAAYY,CAAQ,CAAC,IAAIhB,IAAWkB,IAAiBV,EAAMS,EAAY,CAAC,CAAC,IACnG,GACAG,IAAYV,KAAsBG,IAClCV,EAAU,OAAO,CAACkB,GAAKC,MAAQ;AAC7B,YAAMC,IAAQlB,EAAYiB,CAAG;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AAAA,QAEJ2B;AAAAA,MAAA;AAAA,IAER;AAEJ,QAAMI,IAAsBjB,EAAY,iBAAiB,IACnDkB,IAAkBlB,EAAY,gBAAgB;AACpD,MAAIiB,KAAuBC;AACvB,QAAI,CAACjB,EAAc;AACfG,MAAAA,EAAU,QAAQ,CAAA3B,MAAY;AAC1BqC,QAAAA,IAAe,KAAK;AAAA,UAChBtC;AAAAA,YACIC;AAAAA,YACA6B;AAAAA,YACAM;AAAAA,YACAF;AAAAA,YACA,CAACjC,GAAiBc,MAAoBY,EAAa,OAAO1B,CAAQ,EAAE,cAAcc,CAAQ;AAAA,YAC1FT,EAAM;AAAA,YACNoB,EAAO,EAAEzB,CAAQ;AAAA,YACjBwC;AAAAA,YACAC;AAAAA,YACAhC;AAAAA,UAAA;AAAA,UAEJ4B;AAAAA,QAAA;AAAA,MAER,CAAC;AAAA,SACE;AACH,YAAMrC,IAAW2B,EAAU,CAAC;AAC5BU,MAAAA,IAAe,KAAK;AAAA,QAChBtC;AAAAA,UACIC;AAAAA,UACA6B;AAAAA,UACAM;AAAAA,UACAF;AAAAA,UACA,CAACjC,GAAiBc,MAAoBiB,EAAcjB,CAAQ;AAAA,UAC5DT,EAAM;AAAA,UACNoB,EAAO,EAAEzB,CAAQ;AAAA,UACjBwC;AAAAA,UACAC;AAAAA,UACAhC;AAAAA,QAAA;AAAA,QAEJ4B;AAAAA,MAAA;AAAA,IAER;AAEJ,SAAO,EAAC,cAAAD,GAAc,cAAAC,EAAAA;AAC1B;","x_google_ignoreList":[0]}
@@ -1,35 +1,35 @@
1
- import { DEFAULT_TICKS_SIZE as N, TITLE_LINE as m, MIN_STEP_FOR_VISIBLE_LABELS as S, TICK_OFFSET as w, FACET_TITLE_LINE as K, ANNOTATION_WIDTH as a, ANNOTATIONS_OFFSET as r } from "../constants.js";
2
- function V(i, o, l, C, n, s, e, u, g, F, O, P, z, v) {
3
- const G = P.length > 1 && (!g || e.includes(o.groupingPosition)), d = !g || e.includes(o.position), k = O.length > 1 && (!u || e.includes(i.groupingPosition)), T = !u || e.includes(i.position), y = F.length > 1, p = C.filter((t) => e.includes(t.position) || !u && ["left", "right"].includes(t.position) || !g && ["top", "bottom"].includes(t.position)), h = p.filter((t) => t.position === "left").length, x = p.filter((t) => t.position === "right").length, I = p.filter((t) => t.position === "top").length, c = p.filter((t) => t.position === "bottom").length, B = i.showTicks ? N : 0, D = o.showTicks ? N : 0, E = T && i.showTitle ? m : 0, _ = d && o.showTitle ? m : 0, f = T && i.showAxisLabels && z > S ? l.xAxisCaptions + B + w : 0, L = d && o.showAxisLabels && v > S ? l.yAxisCaptions + D + w : 0, b = k && i.showGroupLabels ? l.xGroupCaptions : 0, A = G && o.showGroupLabels ? l.yGroupCaptions : 0;
1
+ import { DEFAULT_TICKS_SIZE as m, TITLE_LINE as S, MIN_STEP_FOR_VISIBLE_LABELS as w, TICK_OFFSET as a, FACET_TITLE_LINE as K, ANNOTATION_WIDTH as r, ANNOTATIONS_OFFSET as u } from "../constants.js";
2
+ function V(i, o, l, F, n, s, e, g, d, O, P, C, z, G) {
3
+ const v = C.length > 1 && (!d || e.includes(o.groupingPosition)), h = !d || e.includes(o.position), k = P.length > 1 && (!g || e.includes(i.groupingPosition)), T = !g || e.includes(i.position), y = O.length > 1, p = F.filter((t) => e.includes(t.position) || !g && ["left", "right"].includes(t.position) || !d && ["top", "bottom"].includes(t.position)), x = p.filter((t) => t.position === "left").length, I = p.filter((t) => t.position === "right").length, c = p.filter((t) => t.position === "top").length, E = p.filter((t) => t.position === "bottom").length, B = i.showTicks ? m : 0, D = o.showTicks ? m : 0, _ = T && i.showTitle ? S : 0, f = h && o.showTitle ? S : 0, L = T && i.showAxisLabels && z > w ? l.xAxisCaptions + B + a : 0, b = h && o.showAxisLabels && G > w ? l.yAxisCaptions + D + a : 0, A = k && i.showGroupLabels ? l.xGroupCaptions + a : 0, N = v && o.showGroupLabels ? l.yGroupCaptions + a : 0;
4
4
  return {
5
5
  left: {
6
6
  dendro: !(s != null && s.hidden) && (s == null ? void 0 : s.position) === "left" ? s.size : 0,
7
- axisTitle: o.position === "left" ? _ : 0,
8
- groups: o.groupingPosition === "left" ? A : 0,
9
- axis: o.position === "left" ? L : 0,
10
- annotations: h * a + (h && r)
7
+ axisTitle: o.position === "left" ? f : 0,
8
+ groups: o.groupingPosition === "left" ? N : 0,
9
+ axis: o.position === "left" ? b : 0,
10
+ annotations: x * r + (x && u)
11
11
  },
12
12
  right: {
13
13
  dendro: !(s != null && s.hidden) && (s == null ? void 0 : s.position) === "right" ? s.size : 0,
14
- axisTitle: o.position === "right" ? _ : 0,
15
- groups: o.groupingPosition === "right" ? A : 0,
16
- axis: o.position === "right" ? L : 0,
17
- annotations: x * a + (x && r)
14
+ axisTitle: o.position === "right" ? f : 0,
15
+ groups: o.groupingPosition === "right" ? N : 0,
16
+ axis: o.position === "right" ? b : 0,
17
+ annotations: I * r + (I && u)
18
18
  },
19
19
  top: {
20
20
  facetTitle: y ? K : 0,
21
21
  dendro: !(n != null && n.hidden) && (n == null ? void 0 : n.position) === "top" ? n.size : 0,
22
- axisTitle: i.position === "top" ? E : 0,
23
- groups: i.groupingPosition === "top" ? b : 0,
24
- axis: i.position === "top" ? f : 0,
25
- annotations: I * a + (I && r)
22
+ axisTitle: i.position === "top" ? _ : 0,
23
+ groups: i.groupingPosition === "top" ? A : 0,
24
+ axis: i.position === "top" ? L : 0,
25
+ annotations: c * r + (c && u)
26
26
  },
27
27
  bottom: {
28
28
  dendro: !(n != null && n.hidden) && (n == null ? void 0 : n.position) === "bottom" ? n.size : 0,
29
- axisTitle: i.position === "bottom" ? E : 0,
30
- groups: i.groupingPosition === "bottom" ? b : 0,
31
- axis: i.position === "bottom" ? f : 0,
32
- annotations: c * a + (c && r)
29
+ axisTitle: i.position === "bottom" ? _ : 0,
30
+ groups: i.groupingPosition === "bottom" ? A : 0,
31
+ axis: i.position === "bottom" ? L : 0,
32
+ annotations: E * r + (E && u)
33
33
  }
34
34
  };
35
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"calculateChartSideElementSizes.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/utils/calculateChartSideElementSizes.ts"],"sourcesContent":["import {\n ANNOTATION_WIDTH,\n ANNOTATIONS_OFFSET,\n DEFAULT_TICKS_SIZE,\n FACET_TITLE_LINE,\n MIN_STEP_FOR_VISIBLE_LABELS,\n TICK_OFFSET,\n TITLE_LINE,\n} from '../constants';\nimport type {CaptionsSizes} from '../components/types';\nimport type {HeatmapSettingsImpl} from '../HeatmapSettingsImpl';\n\nexport function calculateChartSideElementSizes(\n xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'],\n yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'],\n captionsSizes: CaptionsSizes,\n annotations: HeatmapSettingsImpl['annotations'],\n dendrogramX: HeatmapSettingsImpl['dendrogramX'],\n dendrogramY: HeatmapSettingsImpl['dendrogramY'],\n chartSides: ('left' | 'right' | 'top' | 'bottom')[],\n sharedX: boolean,\n sharedY: boolean,\n facetKeys: string[],\n xGroupKeys: string[],\n yGroupKeys: string[],\n stepX: number,\n stepY: number\n): Record<string, Record<string, number>> {\n const hasGroupingY = yGroupKeys.length > 1 && (!sharedY || chartSides.includes(yAxis.groupingPosition));\n const hasAxisY = !sharedY || chartSides.includes(yAxis.position);\n const hasGroupingX = xGroupKeys.length > 1 && (!sharedX || chartSides.includes(xAxis.groupingPosition));\n const hasAxisX = !sharedX || chartSides.includes(xAxis.position);\n const hasChartTitle = facetKeys.length > 1;\n const usedAnnotations = annotations.filter(item => {\n return (\n chartSides.includes(item.position) ||\n (!sharedX && ['left', 'right'].includes(item.position)) ||\n (!sharedY && ['top', 'bottom'].includes(item.position))\n );\n });\n const leftAnnotationsCount = usedAnnotations.filter(item => item.position === 'left').length;\n const rightAnnotationsCount = usedAnnotations.filter(item => item.position === 'right').length;\n const topAnnotationsCount = usedAnnotations.filter(item => item.position === 'top').length;\n const bottomAnnotationsCount = usedAnnotations.filter(item => item.position === 'bottom').length;\n\n const tickSizeX = xAxis.showTicks ? DEFAULT_TICKS_SIZE : 0;\n const tickSizeY = yAxis.showTicks ? DEFAULT_TICKS_SIZE : 0;\n const axisTitleX = hasAxisX && xAxis.showTitle ? TITLE_LINE : 0;\n const axisTitleY = hasAxisY && yAxis.showTitle ? TITLE_LINE : 0;\n\n const axisX =\n hasAxisX && xAxis.showAxisLabels && stepX > MIN_STEP_FOR_VISIBLE_LABELS\n ? captionsSizes.xAxisCaptions + tickSizeX + TICK_OFFSET\n : 0;\n const axisY =\n hasAxisY && yAxis.showAxisLabels && stepY > MIN_STEP_FOR_VISIBLE_LABELS\n ? captionsSizes.yAxisCaptions + tickSizeY + TICK_OFFSET\n : 0;\n // can be rotated, then labels max width\n const groupX = hasGroupingX && xAxis.showGroupLabels ? captionsSizes.xGroupCaptions : 0;\n const groupY = hasGroupingY && yAxis.showGroupLabels ? captionsSizes.yGroupCaptions : 0;\n\n return {\n left: {\n dendro: !dendrogramY?.hidden && dendrogramY?.position === 'left' ? dendrogramY.size : 0,\n axisTitle: yAxis.position === 'left' ? axisTitleY : 0,\n groups: yAxis.groupingPosition === 'left' ? groupY : 0,\n axis: yAxis.position === 'left' ? axisY : 0,\n annotations: leftAnnotationsCount * ANNOTATION_WIDTH + (leftAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n right: {\n dendro: !dendrogramY?.hidden && dendrogramY?.position === 'right' ? dendrogramY.size : 0,\n axisTitle: yAxis.position === 'right' ? axisTitleY : 0,\n groups: yAxis.groupingPosition === 'right' ? groupY : 0,\n axis: yAxis.position === 'right' ? axisY : 0,\n annotations: rightAnnotationsCount * ANNOTATION_WIDTH + (rightAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n top: {\n facetTitle: hasChartTitle ? FACET_TITLE_LINE : 0,\n dendro: !dendrogramX?.hidden && dendrogramX?.position === 'top' ? dendrogramX.size : 0,\n axisTitle: xAxis.position === 'top' ? axisTitleX : 0,\n groups: xAxis.groupingPosition === 'top' ? groupX : 0,\n axis: xAxis.position === 'top' ? axisX : 0,\n annotations: topAnnotationsCount * ANNOTATION_WIDTH + (topAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n bottom: {\n dendro: !dendrogramX?.hidden && dendrogramX?.position === 'bottom' ? dendrogramX.size : 0,\n axisTitle: xAxis.position === 'bottom' ? axisTitleX : 0,\n groups: xAxis.groupingPosition === 'bottom' ? groupX : 0,\n axis: xAxis.position === 'bottom' ? axisX : 0,\n annotations: bottomAnnotationsCount * ANNOTATION_WIDTH + (bottomAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n };\n}\n"],"names":["calculateChartSideElementSizes","xAxis","yAxis","captionsSizes","annotations","dendrogramX","dendrogramY","chartSides","sharedX","sharedY","facetKeys","xGroupKeys","yGroupKeys","stepX","stepY","hasGroupingY","hasAxisY","hasGroupingX","hasAxisX","hasChartTitle","usedAnnotations","item","leftAnnotationsCount","rightAnnotationsCount","n","topAnnotationsCount","bottomAnnotationsCount","tickSizeX","DEFAULT_TICKS_SIZE","tickSizeY","axisTitleX","TITLE_LINE","axisTitleY","axisX","MIN_STEP_FOR_VISIBLE_LABELS","TICK_OFFSET","axisY","groupX","groupY","ANNOTATION_WIDTH","ANNOTATIONS_OFFSET","FACET_TITLE_LINE"],"mappings":";AAYO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACsC;AACtC,QAAMC,IAAeH,EAAW,SAAS,MAAM,CAACH,KAAWF,EAAW,SAASL,EAAM,gBAAgB,IAC/Fc,IAAW,CAACP,KAAWF,EAAW,SAASL,EAAM,QAAQ,GACzDe,IAAeN,EAAW,SAAS,MAAM,CAACH,KAAWD,EAAW,SAASN,EAAM,gBAAgB,IAC/FiB,IAAW,CAACV,KAAWD,EAAW,SAASN,EAAM,QAAQ,GACzDkB,IAAgBT,EAAU,SAAS,GACnCU,IAAkBhB,EAAY,OAAO,CAAAiB,MAEnCd,EA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,KAAA,QAAAA,EAAa,YAAUA,KAAA,OAAA,SAAAA,EAAa,cAAa,UAAUA,EAAY,OAAO;AAAA,MACvF,WAAWJ,EAAM,aAAa,UAAU8B,IAAa;AAAA,MACrD,QAAQ9B,EAAM,qBAAqB,UAAUoC,IAAS;AAAA,MACtD,MAAMpC,EAAM,aAAa,UAAUkC,IAAQ;AAAA,MAC3C,aAAab,IAAwBgB,KAAoBhB,KAAyBiB;AAAAA,IAAA;AAAA,IAEtF,KAAK;AAAA,MACD,YAAYrB,IAAgBsB,IAAmB;AAAA,MAC/C,QAAQ,EAACpC,KAAA,QAAAA,EAAa,YAAUA,KAAA,OAAA,SAAAA,EAAa,cAAa,QAAQA,EAAY,OAAO;AAAA,MACrF,WAAWJ,EAAM,aAAa,QAAQ6B,IAAa;AAAA,MACnD,QAAQ7B,EAAM,qBAAqB,QAAQoC,IAAS;AAAA,MACpD,MAAMpC,EAAM,aAAa,QAAQgC,IAAQ;AAAA,MACzC,aAAaR,IAAsBc,KAAoBd,KAAuBe;AAAAA,IAAA;AAAA,IAElF,QAAQ;AAAA,MACJ,QAAQ,EAACnC,KAAA,QAAAA,EAAa,YAAUA,KAAA,OAAA,SAAAA,EAAa,cAAa,WAAWA,EAAY,OAAO;AAAA,MACxF,WAAWJ,EAAM,aAAa,WAAW6B,IAAa;AAAA,MACtD,QAAQ7B,EAAM,qBAAqB,WAAWoC,IAAS;AAAA,MACvD,MAAMpC,EAAM,aAAa,WAAWgC,IAAQ;AAAA,MAC5C,aAAaP,IAAyBa,KAAoBb,KAA0Bc;AAAAA,IAAA;AAAA,EAAA;AAGhG;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"calculateChartSideElementSizes.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/utils/calculateChartSideElementSizes.ts"],"sourcesContent":["import {\n ANNOTATION_WIDTH,\n ANNOTATIONS_OFFSET,\n DEFAULT_TICKS_SIZE,\n FACET_TITLE_LINE,\n MIN_STEP_FOR_VISIBLE_LABELS,\n TICK_OFFSET,\n TITLE_LINE,\n} from '../constants';\nimport type {CaptionsSizes} from '../components/types';\nimport type {HeatmapSettingsImpl} from '../HeatmapSettingsImpl';\n\nexport function calculateChartSideElementSizes(\n xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'],\n yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'],\n captionsSizes: CaptionsSizes,\n annotations: HeatmapSettingsImpl['annotations'],\n dendrogramX: HeatmapSettingsImpl['dendrogramX'],\n dendrogramY: HeatmapSettingsImpl['dendrogramY'],\n chartSides: ('left' | 'right' | 'top' | 'bottom')[],\n sharedX: boolean,\n sharedY: boolean,\n facetKeys: string[],\n xGroupKeys: string[],\n yGroupKeys: string[],\n stepX: number,\n stepY: number\n): Record<string, Record<string, number>> {\n const hasGroupingY = yGroupKeys.length > 1 && (!sharedY || chartSides.includes(yAxis.groupingPosition));\n const hasAxisY = !sharedY || chartSides.includes(yAxis.position);\n const hasGroupingX = xGroupKeys.length > 1 && (!sharedX || chartSides.includes(xAxis.groupingPosition));\n const hasAxisX = !sharedX || chartSides.includes(xAxis.position);\n const hasChartTitle = facetKeys.length > 1;\n const usedAnnotations = annotations.filter(item => {\n return (\n chartSides.includes(item.position) ||\n (!sharedX && ['left', 'right'].includes(item.position)) ||\n (!sharedY && ['top', 'bottom'].includes(item.position))\n );\n });\n const leftAnnotationsCount = usedAnnotations.filter(item => item.position === 'left').length;\n const rightAnnotationsCount = usedAnnotations.filter(item => item.position === 'right').length;\n const topAnnotationsCount = usedAnnotations.filter(item => item.position === 'top').length;\n const bottomAnnotationsCount = usedAnnotations.filter(item => item.position === 'bottom').length;\n\n const tickSizeX = xAxis.showTicks ? DEFAULT_TICKS_SIZE : 0;\n const tickSizeY = yAxis.showTicks ? DEFAULT_TICKS_SIZE : 0;\n const axisTitleX = hasAxisX && xAxis.showTitle ? TITLE_LINE : 0;\n const axisTitleY = hasAxisY && yAxis.showTitle ? TITLE_LINE : 0;\n\n const axisX =\n hasAxisX && xAxis.showAxisLabels && stepX > MIN_STEP_FOR_VISIBLE_LABELS\n ? captionsSizes.xAxisCaptions + tickSizeX + TICK_OFFSET\n : 0;\n const axisY =\n hasAxisY && yAxis.showAxisLabels && stepY > MIN_STEP_FOR_VISIBLE_LABELS\n ? captionsSizes.yAxisCaptions + tickSizeY + TICK_OFFSET\n : 0;\n // can be rotated, then labels max width\n const groupX = hasGroupingX && xAxis.showGroupLabels ? captionsSizes.xGroupCaptions + TICK_OFFSET : 0;\n const groupY = hasGroupingY && yAxis.showGroupLabels ? captionsSizes.yGroupCaptions + TICK_OFFSET : 0;\n\n return {\n left: {\n dendro: !dendrogramY?.hidden && dendrogramY?.position === 'left' ? dendrogramY.size : 0,\n axisTitle: yAxis.position === 'left' ? axisTitleY : 0,\n groups: yAxis.groupingPosition === 'left' ? groupY : 0,\n axis: yAxis.position === 'left' ? axisY : 0,\n annotations: leftAnnotationsCount * ANNOTATION_WIDTH + (leftAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n right: {\n dendro: !dendrogramY?.hidden && dendrogramY?.position === 'right' ? dendrogramY.size : 0,\n axisTitle: yAxis.position === 'right' ? axisTitleY : 0,\n groups: yAxis.groupingPosition === 'right' ? groupY : 0,\n axis: yAxis.position === 'right' ? axisY : 0,\n annotations: rightAnnotationsCount * ANNOTATION_WIDTH + (rightAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n top: {\n facetTitle: hasChartTitle ? FACET_TITLE_LINE : 0,\n dendro: !dendrogramX?.hidden && dendrogramX?.position === 'top' ? dendrogramX.size : 0,\n axisTitle: xAxis.position === 'top' ? axisTitleX : 0,\n groups: xAxis.groupingPosition === 'top' ? groupX : 0,\n axis: xAxis.position === 'top' ? axisX : 0,\n annotations: topAnnotationsCount * ANNOTATION_WIDTH + (topAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n bottom: {\n dendro: !dendrogramX?.hidden && dendrogramX?.position === 'bottom' ? dendrogramX.size : 0,\n axisTitle: xAxis.position === 'bottom' ? axisTitleX : 0,\n groups: xAxis.groupingPosition === 'bottom' ? groupX : 0,\n axis: xAxis.position === 'bottom' ? axisX : 0,\n annotations: bottomAnnotationsCount * ANNOTATION_WIDTH + (bottomAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n };\n}\n"],"names":["calculateChartSideElementSizes","xAxis","yAxis","captionsSizes","annotations","dendrogramX","dendrogramY","chartSides","sharedX","sharedY","facetKeys","xGroupKeys","yGroupKeys","stepX","stepY","hasGroupingY","hasAxisY","hasGroupingX","hasAxisX","hasChartTitle","usedAnnotations","item","leftAnnotationsCount","n","rightAnnotationsCount","topAnnotationsCount","bottomAnnotationsCount","tickSizeX","DEFAULT_TICKS_SIZE","tickSizeY","axisTitleX","TITLE_LINE","axisTitleY","axisX","MIN_STEP_FOR_VISIBLE_LABELS","TICK_OFFSET","axisY","groupX","groupY","ANNOTATION_WIDTH","ANNOTATIONS_OFFSET","FACET_TITLE_LINE"],"mappings":";AAYO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACsC;AACtC,QAAMC,IAAeH,EAAW,SAAS,MAAM,CAACH,KAAWF,EAAW,SAASL,EAAM,gBAAgB,IAC/Fc,IAAW,CAACP,KAAWF,EAAW,SAASL,EAAM,QAAQ,GACzDe,IAAeN,EAAW,SAAS,MAAM,CAACH,KAAWD,EAAW,SAASN,EAAM,gBAAgB,IAC/FiB,IAAW,CAACV,KAAWD,EAAW,SAASN,EAAM,QAAQ,GACzDkB,IAAgBT,EAAU,SAAS,GACnCU,IAAkBhB,EAAY,OAAO,CAAAiB,MAEnCd,EAAW,SAASc,EAAK,QAAQ,KAChC,CAACb,KAAW,CAAC,QAAQ,OAAO,EAAE,SAASa,EAAK,QAAQ,KACpD,CAACZ,KAAW,CAAC,OAAO,QAAQ,EAAE,SAASY,EAAK,QAAQ,CAE5D,GACKC,IAAuBF,EAAgB,OAAO,CAAAG,MAAQF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