@milaboratories/graph-maker 1.1.138 → 1.1.140
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.
- package/dist/GraphMaker/components/Chart.vue.d.ts.map +1 -1
- package/dist/GraphMaker/components/Chart.vue.js +1 -0
- package/dist/GraphMaker/components/Chart.vue.js.map +1 -1
- package/dist/GraphMaker/components/LassoControls/index.vue.js +15 -13
- package/dist/GraphMaker/components/LassoControls/index.vue.js.map +1 -1
- package/dist/GraphMaker/dataBindAes.d.ts +5 -5
- package/dist/GraphMaker/dataBindAes.d.ts.map +1 -1
- package/dist/GraphMaker/dataBindAes.js +52 -49
- package/dist/GraphMaker/dataBindAes.js.map +1 -1
- package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js +14 -14
- package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js.map +1 -1
- package/dist/GraphMaker/index.vue.d.ts.map +1 -1
- package/dist/GraphMaker/index.vue.js +125 -124
- package/dist/GraphMaker/index.vue.js.map +1 -1
- package/dist/GraphMaker/types.d.ts +1 -1
- package/dist/GraphMaker/types.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts +6 -0
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.d.ts +4 -8
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts +15 -0
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +12 -3
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +21 -0
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts +10 -6
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts +31 -13
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js +56 -62
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts +29 -13
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js +20 -19
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js.map +1 -1
- package/dist/GraphMaker/utils/loadUniqueValuesToSave.d.ts.map +1 -1
- package/dist/GraphMaker/utils/loadUniqueValuesToSave.js +57 -54
- package/dist/GraphMaker/utils/loadUniqueValuesToSave.js.map +1 -1
- package/dist/lib.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/AbstractChart.js +5 -5
- package/dist/node_modules/@milaboratories/miplots4/dist/AbstractChart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/DataFrame.js +95 -72
- package/dist/node_modules/@milaboratories/miplots4/dist/DataFrame.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js +8 -5
- package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/ChartRenderer.js +124 -122
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/Chart.js +72 -91
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/ChartsGroup.js +43 -41
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/ChartsGroup.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCellTooltip.js +28 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCellTooltip.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getGroupedCellsData.js +94 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getGroupedCellsData.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js +38 -34
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/utils/calculateCaptionTails.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/common/Error.js +4 -22
- package/dist/node_modules/@milaboratories/miplots4/dist/common/Error.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/common/Legend.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/common/Tooltip.js +11 -11
- package/dist/node_modules/@milaboratories/miplots4/dist/common/Tooltip.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/common/useDataFrame.js +20 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/common/useDataFrame.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/ChartRenderer.js +181 -181
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/DendroSettingsImpl.js +2 -2
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/DendroSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Chart.js +45 -45
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Heatmap.js +27 -27
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Heatmap.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Legend.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/LinksGroup.js +18 -18
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/LinksGroup.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/NodesGroup.js +36 -36
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/NodesGroup.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHeatmapData.js +45 -41
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHeatmapData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHierarchyData.js +33 -33
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHierarchyData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js +90 -93
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js +199 -198
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js +17 -17
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/BoxElement.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +102 -99
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/bar.js +31 -36
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/bar.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/binnedDots.js +62 -74
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/binnedDots.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/boxes.js +52 -53
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/boxes.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/dots.js +32 -32
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/dots.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.js +7 -6
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/logo.js +23 -23
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/logo.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/pairedPoints.js +63 -63
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/pairedPoints.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/sina.js +60 -64
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/sina.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedBar.js +23 -23
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedBar.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/getOutliersBounds.js +5 -5
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/getOutliersBounds.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/splitTextByWidth.js +13 -13
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/splitTextByWidth.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js +258 -256
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js +81 -79
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js +140 -134
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js +17 -17
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js +99 -95
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js +32 -31
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateAnnotationTitleSizes.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateAnnotationTitleSizes.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/ChartRenderer.js +143 -142
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/HistogramSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/Chart.js +30 -30
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/ChartsGroup.js +7 -7
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/getHistogramData.js +53 -54
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/getHistogramData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js +62 -58
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/@d3fc/d3fc-axis/src/axisBase.js +7 -7
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-array/src/min.js +6 -12
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-array/src/min.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-shape/src/line.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/kdbush/index.js +148 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/kdbush/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js +172 -168
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js +28 -28
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Chart.js +11 -11
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxisTitles.js +30 -29
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxisTitles.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartLayersData.js +135 -153
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartLayersData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTooltip.js +35 -32
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTooltip.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js +27 -27
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartsGroup.js +14 -14
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/constants.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js +24 -25
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js +13 -13
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js +69 -76
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/linearRegression.js +85 -83
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/linearRegression.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createAesGetter.js +20 -20
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createAesGetter.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js +50 -38
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/formatColumnValue.js +11 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/formatColumnValue.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/getVisibleLabels.js +46 -56
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/getVisibleLabels.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/sortDotsByGrouping.js +18 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/sortDotsByGrouping.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js +223 -205
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js +26 -26
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/colors.js +42 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/colors.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js +84 -81
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/SVGLayer.js +11 -11
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/UpperSVG.js +15 -14
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/UpperSVG.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js +97 -118
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js +3 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/dendro.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/dendro.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/histogram.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/histogram.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js +23 -17
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js +25 -19
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/TextMeasurer.js +39 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/TextMeasurer.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/charToWidth.json.js +101 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/charToWidth.json.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/arrangeLegendParts.js +4 -4
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/arrangeLegendParts.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/arraysAreDifferent.js +7 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/arraysAreDifferent.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/getLegendWidth.js +3 -3
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/getLegendWidth.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +1111 -1097
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCells.js +0 -91
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCells.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/add.js +0 -30
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/add.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/cover.js +0 -29
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/cover.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/data.js +0 -12
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/data.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/extent.js +0 -7
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/extent.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/find.js +0 -26
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/find.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quad.js +0 -7
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quad.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quadtree.js +0 -51
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quadtree.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/remove.js +0 -21
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/remove.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/root.js +0 -7
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/root.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/size.js +0 -12
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/size.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visit.js +0 -14
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visit.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visitAfter.js +0 -19
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visitAfter.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/x.js +0 -11
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/x.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/y.js +0 -11
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/y.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer.js +0 -24
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer.js.map +0 -1
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { l as f } from "../node_modules/lodash/lodash.js";
|
|
2
|
+
import m from "../node_modules/d3-hierarchy/src/stratify.js";
|
|
3
3
|
import b from "../node_modules/d3-array/src/max.js";
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
function F(a, r, u, i, d, o = !1) {
|
|
5
|
+
const n = f.groupBy(a.rowIndexes, (e) => a.getColumnValue(r, e)), t = Object.keys(n).map((e) => {
|
|
6
|
+
const c = n[e], p = c[0], h = a.getColumnValue(u, p), x = d ? f.uniq(c.map((w) => a.getColumnValue(d, w))).join(", ") : null, k = i ? Number(a.getColumnValue(i, p)) : 1;
|
|
7
7
|
return {
|
|
8
|
-
id: String(
|
|
9
|
-
parentId:
|
|
10
|
-
label:
|
|
11
|
-
height:
|
|
8
|
+
id: String(e),
|
|
9
|
+
parentId: h === null ? null : String(h),
|
|
10
|
+
label: x,
|
|
11
|
+
height: k,
|
|
12
12
|
isFake: !1,
|
|
13
|
-
|
|
13
|
+
rawIndexes: c
|
|
14
14
|
// save source row data to avoid any modifications
|
|
15
15
|
};
|
|
16
|
-
}),
|
|
17
|
-
if (!
|
|
18
|
-
return
|
|
19
|
-
const
|
|
20
|
-
id: `${
|
|
21
|
-
parentId:
|
|
16
|
+
}), l = m().id((e) => e.id).parentId((e) => e.parentId)(t);
|
|
17
|
+
if (!o)
|
|
18
|
+
return l;
|
|
19
|
+
const s = new Set(l.leaves().map((e) => e.id)), g = t.filter((e) => !s.has(e.id)).map((e) => ({
|
|
20
|
+
id: `${e.id}_extra`,
|
|
21
|
+
parentId: e.id,
|
|
22
22
|
height: 0,
|
|
23
23
|
label: null,
|
|
24
24
|
isFake: !0,
|
|
25
|
-
|
|
26
|
-
})),
|
|
27
|
-
return
|
|
25
|
+
rawIndexes: e.rawIndexes
|
|
26
|
+
})), I = t.concat(g);
|
|
27
|
+
return m().id((e) => e.id).parentId((e) => e.parentId)(I);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
function n
|
|
32
|
-
return
|
|
29
|
+
function H(a, r, u = !1) {
|
|
30
|
+
a.data.height = 0;
|
|
31
|
+
function i(n) {
|
|
32
|
+
return n.data.height;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return n
|
|
34
|
+
function d(n) {
|
|
35
|
+
return i(n) + (n.children ? b(n.children, d) : 0);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
37
|
+
function o(n, t, l) {
|
|
38
|
+
n.y = !n.children && u ? r : (t += i(n)) * l, n.children && n.children.forEach((s) => o(s, t, l));
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
o(a, 0, r / d(a));
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
42
|
+
function N(a) {
|
|
43
|
+
a.descendants().forEach((r) => {
|
|
44
44
|
!r.children && r.data.isFake && r.parent && (r.parent.x = r.x);
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
F as getHierarchy,
|
|
49
|
+
H as updateLinksHeight,
|
|
50
|
+
N as updateNodesHorizontalPosition
|
|
51
51
|
};
|
|
52
52
|
//# sourceMappingURL=getHierarchyData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHierarchyData.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/dendro/getHierarchyData.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"getHierarchyData.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/dendro/getHierarchyData.ts"],"sourcesContent":["import { max as d3max } from 'd3-array';\nimport { type HierarchyPointNode, stratify } from 'd3-hierarchy';\nimport { groupBy, uniq } from 'lodash';\nimport type { DataFrame } from '../DataFrame';\n\nexport type TreeNodeData = {\n id: string;\n parentId: string | null;\n height: number;\n label: string | null;\n isFake: boolean; // true for additional nodes for mode with all nodes used as leaves\n rawIndexes: number[];\n};\n\nexport function getHierarchy(\n dataFrame: DataFrame,\n idKey: string,\n parentIdKey: string,\n heightIdKey: string | null,\n labelIdKey: string | null,\n useAllNodesAsLeaves = false\n) {\n const groupedByNodeId = groupBy(dataFrame.rowIndexes, idx => dataFrame.getColumnValue(idKey, idx));\n const uniqueKeys = Object.keys(groupedByNodeId);\n\n const uniqueNodeRows: TreeNodeData[] = uniqueKeys\n .map((key) => {\n const indexes = groupedByNodeId[key];\n const first = indexes[0]; // some values must be the same for every row with the same NodeId, we can take them from any row of group\n const parentId = dataFrame.getColumnValue(parentIdKey, first);\n const label = labelIdKey ? uniq(indexes.map(idx => dataFrame.getColumnValue(labelIdKey, idx))).join(', ') : null;\n const height = heightIdKey ? Number(dataFrame.getColumnValue(heightIdKey, first)) : 1;\n return ({\n id: String(key),\n parentId: parentId === null ? null : String(parentId),\n label,\n height,\n isFake: false,\n rawIndexes: indexes, // save source row data to avoid any modifications\n } as TreeNodeData);\n });\n const tree = stratify<TreeNodeData>()\n .id(d => d.id)\n .parentId(d => d.parentId)(uniqueNodeRows);\n if (!useAllNodesAsLeaves) {\n return tree;\n }\n // for tree layout with every node aligned by side rows\n const leavesIdSet = new Set(tree.leaves().map(node => node.id));\n const noLeafRows = uniqueNodeRows.filter(row => !leavesIdSet.has(row.id));\n const extraRows = noLeafRows.map(row => ({\n id: `${row.id}_extra`,\n parentId: row.id,\n height: 0,\n label: null,\n isFake: true,\n rawIndexes: row.rawIndexes,\n }));\n const expandedRows = uniqueNodeRows.concat(extraRows);\n return stratify<TreeNodeData>()\n .id(d => d.id)\n .parentId(d => d.parentId)(expandedRows);\n}\n\nexport function updateLinksHeight(root: HierarchyPointNode<TreeNodeData>, chartHeight: number, alignLeavesToLine = false) {\n root.data.height = 0;\n function heightGetter(d: HierarchyPointNode<TreeNodeData>) {\n return d.data.height;\n }\n\n function maxLength(d: HierarchyPointNode<TreeNodeData>): number {\n return heightGetter(d) + (d.children ? (d3max(d.children, maxLength) as number) : 0);\n }\n\n function setHeight(d: HierarchyPointNode<TreeNodeData>, y0: number, k: number) {\n d.y = !d.children && alignLeavesToLine ? chartHeight : (y0 += heightGetter(d)) * k;\n if (d.children) {\n d.children.forEach(d => setHeight(d, y0, k));\n }\n }\n\n setHeight(root, 0, chartHeight / maxLength(root));\n}\n\nexport function updateNodesHorizontalPosition(root: HierarchyPointNode<TreeNodeData>) {\n root.descendants().forEach((d: HierarchyPointNode<TreeNodeData>) => {\n if (!d.children && d.data.isFake && d.parent) {\n d.parent.x = d.x;\n }\n });\n}\n"],"names":["getHierarchy","dataFrame","idKey","parentIdKey","heightIdKey","labelIdKey","useAllNodesAsLeaves","groupedByNodeId","groupBy","idx","uniqueNodeRows","key","indexes","first","parentId","label","uniq","height","tree","stratify","d","leavesIdSet","node","extraRows","row","expandedRows","updateLinksHeight","root","chartHeight","alignLeavesToLine","heightGetter","maxLength","d3max","setHeight","y0","k","updateNodesHorizontalPosition"],"mappings":";;;AAcO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,IAAsB,IACxB;AACE,QAAMC,IAAkBC,EAAAA,QAAQP,EAAU,YAAY,CA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EAAEK,CAAY;AAC/C;AAEO,SAASC,EAAkBC,GAAwCC,GAAqBC,IAAoB,IAAO;AACtHF,EAAAA,EAAK,KAAK,SAAS;AACnB,WAASG,EAAaV,GAAqC;AACvD,WAAOA,EAAE,KAAK;AAAA,EAClB;AAEA,WAASW,EAAUX,GAA6C;AAC5D,WAAOU,EAAaV,CAAC,KAAKA,EAAE,WAAYY,EAAMZ,EAAE,UAAUW,CAAS,IAAe;AAAA,EACtF;AAEA,WAASE,EAAUb,GAAqCc,GAAYC,GAAW;AAC3Ef,MAAE,IAAI,CAACA,EAAE,YAAYS,IAAoBD,KAAeM,KAAMJ,EAAaV,CAAC,KAAKe,GAC7Ef,EAAE,YACFA,EAAE,SAAS,QAAQ,CAAAA,MAAKa,EAAUb,GAAGc,GAAIC,CAAC,CAAC;AAAA,EAEnD;AAEAF,EAAAA,EAAUN,GAAM,GAAGC,IAAcG,EAAUJ,CAAI,CAAC;AACpD;AAEO,SAASS,EAA8BT,GAAwC;AAClFA,EAAAA,EAAK,YAAA,EAAc,QAAQ,CAACP,MAAwC;AAC5D,KAACA,EAAE,YAAYA,EAAE,KAAK,UAAUA,EAAE,WAClCA,EAAE,OAAO,IAAIA,EAAE;AAAA,EAEvB,CAAC;AACL;","x_google_ignoreList":[0]}
|
|
@@ -1,147 +1,144 @@
|
|
|
1
|
+
import { l as y } from "../node_modules/lodash/lodash.js";
|
|
2
|
+
import { renderToString as E } from "../node_modules/react-dom/server.browser.js";
|
|
3
|
+
import { undefined as C } from "../node_modules/zod/lib/index.js";
|
|
1
4
|
import { AbstractChart as S } from "../AbstractChart.js";
|
|
5
|
+
import A from "./ChartRenderer.js";
|
|
2
6
|
import { USER_UPDATE_EVENT as _ } from "./constants.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import C from "../node_modules/lodash/lodash.js";
|
|
10
|
-
var R = Object.defineProperty, I = (u, a, t) => a in u ? R(u, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[a] = t, g = (u, a, t) => I(u, typeof a != "symbol" ? a + "" : a, t);
|
|
11
|
-
function f(u) {
|
|
12
|
-
return typeof u != "object" ? !1 : "valuesMap" in u;
|
|
7
|
+
import { DendroSettingsImpl as D } from "./DendroSettingsImpl.js";
|
|
8
|
+
import { getHeatmapData as w } from "./getHeatmapData.js";
|
|
9
|
+
import { getHierarchy as L } from "./getHierarchyData.js";
|
|
10
|
+
var R = Object.defineProperty, N = (i, e, t) => e in i ? R(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, v = (i, e, t) => N(i, typeof e != "symbol" ? e + "" : e, t);
|
|
11
|
+
function g(i) {
|
|
12
|
+
return typeof i != "object" ? !1 : "valuesMap" in i;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const { nodeColor: t, nodeShape:
|
|
16
|
-
|
|
14
|
+
function f(i, e) {
|
|
15
|
+
const { nodeColor: t, nodeShape: a, lineColor: s } = e, h = [t, a, s].filter(
|
|
16
|
+
g
|
|
17
17
|
);
|
|
18
|
-
return
|
|
19
|
-
const { columnName:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
usedAes: [...h],
|
|
35
|
-
aesMap: c,
|
|
36
|
-
labels: i.reduce((n, l) => (n[o(l)] = p(l), n), {})
|
|
37
|
-
}, d;
|
|
18
|
+
return y.uniqBy(h, (l) => l.columnName.value).reduce((l, p) => {
|
|
19
|
+
const { columnName: n } = p, o = i.getColumnCategories(n.value, !1), c = (r) => String(
|
|
20
|
+
(n.valueLabels ? i.getColumnValue(n.valueLabels, i.getColumnCategoryRowIndex(n.value, r)) : C) ?? r
|
|
21
|
+
), u = /* @__PURE__ */ new Set(), d = o.reduce((r, m) => (r[m] || (r[m] = {}), r), {});
|
|
22
|
+
return g(t) && n.value === t.columnName.value && (u.add("dotFill"), o.forEach((r) => {
|
|
23
|
+
d[r].dotFill = t.valuesMap[r];
|
|
24
|
+
})), g(a) && n.value === a.columnName.value && (u.add("dotShape"), o.forEach((r) => {
|
|
25
|
+
d[r].dotShape = a.valuesMap[r];
|
|
26
|
+
})), g(s) && n.value === s.columnName.value && (u.add("lineColor"), o.forEach((r) => {
|
|
27
|
+
d[r].lineColor = s.valuesMap[r];
|
|
28
|
+
})), l[n.value] = {
|
|
29
|
+
values: o.sort(),
|
|
30
|
+
usedAes: [...u],
|
|
31
|
+
aesMap: d,
|
|
32
|
+
labels: o.reduce((r, m) => (r[m] = c(m), r), {})
|
|
33
|
+
}, l;
|
|
38
34
|
}, {});
|
|
39
35
|
}
|
|
40
|
-
class
|
|
41
|
-
constructor(
|
|
42
|
-
super(
|
|
36
|
+
class z extends S {
|
|
37
|
+
constructor(e, t, a) {
|
|
38
|
+
super(e, t), v(this, "settings"), v(this, "onClick", () => C), v(this, "chartRenderer", new A()), v(this, "calculatedData", null), this.settings = new D(t), a && (this.onClick = a[0]);
|
|
43
39
|
}
|
|
44
|
-
mount(
|
|
40
|
+
mount(e) {
|
|
45
41
|
try {
|
|
46
|
-
this.chartRenderer.init(
|
|
42
|
+
this.chartRenderer.init(e), this._updateData(), this._updateChart(), this.hasError = !1;
|
|
47
43
|
} catch (t) {
|
|
48
|
-
t instanceof Error && this.chartRenderer.renderError(t.message);
|
|
44
|
+
this.hasError = !0, t instanceof Error && (this.chartRenderer.renderError(t.message), console.error(t));
|
|
49
45
|
}
|
|
50
46
|
}
|
|
51
47
|
unmount() {
|
|
52
48
|
this.chartRenderer.clear();
|
|
53
49
|
}
|
|
54
|
-
updateSettingsAndData(
|
|
50
|
+
updateSettingsAndData(e, t) {
|
|
55
51
|
try {
|
|
56
|
-
const
|
|
57
|
-
this.settings = new
|
|
58
|
-
} catch (
|
|
59
|
-
|
|
52
|
+
const a = this.settings, s = this.data;
|
|
53
|
+
this.settings = new D(t), this.data = e, this._needUpdateCalculatedDataBySettings(a, this.settings) || this._needUpdateCalculatedDataByData(s, this.data) ? this._updateData() : this._updateAesInData(), this._updateChart(), this.hasError = !1;
|
|
54
|
+
} catch (a) {
|
|
55
|
+
this.hasError = !0, a instanceof Error && (this.chartRenderer.renderError(a.message), console.error(a));
|
|
60
56
|
}
|
|
61
57
|
}
|
|
62
|
-
updateChartState(
|
|
58
|
+
updateChartState(e, t) {
|
|
63
59
|
if (document) {
|
|
64
|
-
const
|
|
65
|
-
document.dispatchEvent(
|
|
60
|
+
const a = new CustomEvent(_, { detail: { [e]: t } });
|
|
61
|
+
document.dispatchEvent(a);
|
|
66
62
|
}
|
|
67
63
|
}
|
|
68
64
|
export() {
|
|
69
|
-
return this._updateChart(),
|
|
65
|
+
return this._updateChart(), E(this.chartRenderer.component);
|
|
70
66
|
}
|
|
71
|
-
_needUpdateCalculatedDataBySettings(
|
|
72
|
-
var
|
|
73
|
-
const { mode:
|
|
74
|
-
function
|
|
75
|
-
return
|
|
67
|
+
_needUpdateCalculatedDataBySettings(e, t) {
|
|
68
|
+
var a, s;
|
|
69
|
+
const { mode: h, id: l, parentId: p, heatmapAnnotation: n, heatmapAxis: o, heatmapGroup: c } = t;
|
|
70
|
+
function u(d, r) {
|
|
71
|
+
return d.length !== r.length || d.some((m, b) => m.value !== r[b].value);
|
|
76
72
|
}
|
|
77
|
-
return
|
|
73
|
+
return e.mode !== h || e.id.value !== l.value || e.parentId.value !== p.value || ((a = e.heatmapAnnotation) == null ? void 0 : a.value) !== (n == null ? void 0 : n.value) || ((s = e.heatmapAxis) == null ? void 0 : s.value) !== (o == null ? void 0 : o.value) || u(e.heatmapGroup, c);
|
|
78
74
|
}
|
|
79
|
-
_needUpdateCalculatedDataByData(
|
|
80
|
-
const
|
|
81
|
-
return
|
|
82
|
-
var
|
|
83
|
-
return
|
|
75
|
+
_needUpdateCalculatedDataByData(e, t) {
|
|
76
|
+
const a = Object.keys(e.data), s = Object.keys(t.data);
|
|
77
|
+
return e.id !== t.id || a.length !== s.length || a.some((h) => {
|
|
78
|
+
var l;
|
|
79
|
+
return e.data[h].length !== ((l = t.data[h]) == null ? void 0 : l.length);
|
|
84
80
|
});
|
|
85
81
|
}
|
|
86
82
|
_updateData() {
|
|
87
|
-
const { mode:
|
|
83
|
+
const { mode: e, id: t, parentId: a, aes: s, heatmapAnnotation: h, heatmapAxis: l, heatmapGroup: p, heatmapSettings: n, height: o, labels: c } = this.settings, u = L(
|
|
84
|
+
this.data,
|
|
88
85
|
t.value,
|
|
89
|
-
|
|
90
|
-
(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
), h = A(this.data, s.valueType, m, d, v, t, p), c = y(this.data, r);
|
|
86
|
+
a.value,
|
|
87
|
+
(o == null ? void 0 : o.value) ?? null,
|
|
88
|
+
c.valueLabels ?? c.value ?? null,
|
|
89
|
+
e === "useAllNodesAsLeaves"
|
|
90
|
+
), d = w(this.data, n.valueType, h, l, p, t, u), r = f(this.data, s);
|
|
95
91
|
this.calculatedData = {
|
|
96
92
|
chartSizes: this.chartRenderer.chartSizes,
|
|
97
|
-
hierarchy:
|
|
98
|
-
heatmapData:
|
|
99
|
-
legendLabels:
|
|
93
|
+
hierarchy: u,
|
|
94
|
+
heatmapData: d,
|
|
95
|
+
legendLabels: r
|
|
100
96
|
};
|
|
101
97
|
}
|
|
102
98
|
_updateAesInData() {
|
|
103
|
-
this.calculatedData && (this.calculatedData.legendLabels =
|
|
99
|
+
this.calculatedData && (this.calculatedData.legendLabels = f(this.data, this.settings.aes));
|
|
104
100
|
}
|
|
105
101
|
_updateChart() {
|
|
106
102
|
if (!this.calculatedData)
|
|
107
103
|
return;
|
|
108
104
|
const {
|
|
109
|
-
heatmapAnnotation:
|
|
105
|
+
heatmapAnnotation: e,
|
|
110
106
|
chartSettings: t,
|
|
111
|
-
connectionType:
|
|
112
|
-
edgeInheritance:
|
|
113
|
-
rootPosition:
|
|
114
|
-
showNodes:
|
|
115
|
-
showEdges:
|
|
116
|
-
showLeavesLabels:
|
|
117
|
-
showNodesLabels:
|
|
118
|
-
aes:
|
|
119
|
-
labels:
|
|
120
|
-
heatmapSettings:
|
|
121
|
-
leavesMode:
|
|
107
|
+
connectionType: a,
|
|
108
|
+
edgeInheritance: s,
|
|
109
|
+
rootPosition: h,
|
|
110
|
+
showNodes: l,
|
|
111
|
+
showEdges: p,
|
|
112
|
+
showLeavesLabels: n,
|
|
113
|
+
showNodesLabels: o,
|
|
114
|
+
aes: c,
|
|
115
|
+
labels: u,
|
|
116
|
+
heatmapSettings: d,
|
|
117
|
+
leavesMode: r
|
|
122
118
|
} = this.settings;
|
|
123
119
|
this.chartRenderer.render(
|
|
120
|
+
this.data,
|
|
124
121
|
t,
|
|
125
122
|
this.calculatedData.hierarchy,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
r,
|
|
129
|
-
d,
|
|
130
|
-
v,
|
|
123
|
+
a,
|
|
124
|
+
h,
|
|
131
125
|
s,
|
|
132
|
-
|
|
133
|
-
o,
|
|
126
|
+
l,
|
|
134
127
|
p,
|
|
135
|
-
|
|
128
|
+
n,
|
|
129
|
+
o,
|
|
130
|
+
c,
|
|
131
|
+
u,
|
|
132
|
+
e,
|
|
136
133
|
this.calculatedData.heatmapData,
|
|
137
|
-
|
|
134
|
+
d,
|
|
138
135
|
this.calculatedData.legendLabels,
|
|
139
|
-
|
|
136
|
+
r,
|
|
140
137
|
this.onClick
|
|
141
138
|
);
|
|
142
139
|
}
|
|
143
140
|
}
|
|
144
141
|
export {
|
|
145
|
-
|
|
142
|
+
z as ChartDendro
|
|
146
143
|
};
|
|
147
144
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/dendro/index.ts"],"sourcesContent":["import {AbstractChart} from '../AbstractChart';\nimport type {ChartSizes} from './components/types';\nimport {USER_UPDATE_EVENT} from './constants';\nimport type {HeatmapData} from './getHeatmapData';\nimport {getHeatmapData} from './getHeatmapData';\nimport type {TreeNodeData} from './getHierarchyData';\nimport {getHierarchy} from './getHierarchyData';\nimport {renderToString} from 'react-dom/server';\nimport {undefined} from 'zod';\nimport ChartRenderer from './ChartRenderer';\nimport type {\n AesItem,\n AesMap,\n CategoricalAesFromColumn,\n ClickEventData,\n ColumnName,\n ContinuousAesFromColumn,\n DendroEventHandlers,\n DendroLegendInfo,\n DendroSettings,\n LineShape,\n PointShape,\n Row,\n} from '../types';\nimport {DendroSettingsImpl} from './DendroSettingsImpl';\nimport type {DataFrame} from '../DataFrame';\nimport type {HierarchyNode} from 'd3-hierarchy';\nimport lodash from 'lodash';\n\nfunction isCategoricalAes<InputType extends string | number | PointShape | LineShape>(\n item: InputType | CategoricalAesFromColumn<InputType> | ContinuousAesFromColumn<InputType>\n): item is CategoricalAesFromColumn<InputType> {\n if (typeof item !== 'object') {\n return false;\n }\n return 'valuesMap' in item;\n}\nfunction getLegendLabelsMap(data: DataFrame, aes: DendroSettingsImpl['aes']): DendroLegendInfo {\n const {nodeColor, nodeShape, lineColor} = aes;\n const aesGrouping: CategoricalAesFromColumn<string | PointShape>[] = [nodeColor, nodeShape, lineColor].filter(\n isCategoricalAes\n );\n const uniqueColumns = lodash.uniqBy(aesGrouping, item => item.columnName.value);\n return uniqueColumns.reduce((res: DendroLegendInfo, item) => {\n const {columnName} = item;\n const uniqRowsByGrouping = lodash.uniqBy(data.rows, row => row[columnName.value]);\n const getValue = (row: Row) => String(row[columnName.value]);\n const getValueLabel = (row: Row) =>\n columnName.valueLabels ? String(row[columnName.valueLabels]) : getValue(row);\n\n const usedAes = new Set<keyof AesItem>();\n const aesMap: AesMap = uniqRowsByGrouping.reduce((res: AesMap, row) => {\n const value = getValue(row);\n if (!res[value]) {\n res[value] = {} as AesItem;\n }\n return res;\n }, {});\n if (isCategoricalAes(nodeColor) && columnName.value === nodeColor.columnName.value) {\n usedAes.add('dotFill');\n uniqRowsByGrouping.forEach(row => {\n const value = getValue(row);\n aesMap[value]['dotFill'] = nodeColor.valuesMap[value];\n });\n }\n if (isCategoricalAes(nodeShape) && columnName.value === nodeShape.columnName.value) {\n usedAes.add('dotShape');\n uniqRowsByGrouping.forEach(row => {\n const value = getValue(row);\n aesMap[value]['dotShape'] = nodeShape.valuesMap[value];\n });\n }\n if (isCategoricalAes(lineColor) && columnName.value === lineColor.columnName.value) {\n usedAes.add('lineColor');\n uniqRowsByGrouping.forEach(row => {\n const value = getValue(row);\n aesMap[value]['lineColor'] = lineColor.valuesMap[value];\n });\n }\n res[columnName.value] = {\n values: uniqRowsByGrouping.map(getValue).sort(),\n usedAes: [...usedAes],\n aesMap,\n labels: uniqRowsByGrouping.reduce((res: Record<string, string>, row) => {\n res[getValue(row)] = getValueLabel(row);\n return res;\n }, {}),\n };\n return res;\n }, {});\n}\n\nexport class ChartDendro extends AbstractChart {\n settings: DendroSettingsImpl;\n onClick: (data: ClickEventData) => void = () => undefined;\n chartRenderer = new ChartRenderer();\n\n calculatedData: {\n chartSizes: ChartSizes;\n hierarchy: HierarchyNode<TreeNodeData>;\n heatmapData: HeatmapData | null;\n legendLabels: DendroLegendInfo;\n } | null = null;\n\n constructor(data: DataFrame, settings: DendroSettings, eventHandlers?: DendroEventHandlers) {\n super(data, settings);\n\n this.settings = new DendroSettingsImpl(settings);\n if (eventHandlers) {\n this.onClick = eventHandlers[0];\n }\n }\n\n mount(node: HTMLElement) {\n try {\n this.chartRenderer.init(node);\n this._updateData();\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n }\n }\n }\n\n unmount() {\n this.chartRenderer.clear();\n }\n\n updateSettingsAndData(data: DataFrame, settings: DendroSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new DendroSettingsImpl(settings);\n this.data = data;\n if (\n this._needUpdateCalculatedDataBySettings(previousSettings, this.settings) ||\n this._needUpdateCalculatedDataByData(previousData, this.data)\n ) {\n this._updateData();\n } else {\n this._updateAesInData();\n }\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n }\n }\n }\n\n updateChartState(field: string, value: unknown) {\n if (document) {\n const event = new CustomEvent(USER_UPDATE_EVENT, {detail: {[field]: value}});\n document.dispatchEvent(event);\n }\n }\n\n export(): string {\n this._updateChart();\n return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: DendroSettingsImpl, settings: DendroSettingsImpl) {\n const {mode, id, parentId, heatmapAnnotation, heatmapAxis, heatmapGroup} = settings;\n\n function compareColumnGroups(columns1: ColumnName[], columns2: ColumnName[]) {\n return (\n columns1.length !== columns2.length ||\n columns1.some((column, idx) => column.value !== columns2[idx].value)\n );\n }\n\n return (\n prevSettings.mode !== mode ||\n prevSettings.id.value !== id.value ||\n prevSettings.parentId.value !== parentId.value ||\n prevSettings.heatmapAnnotation?.value !== heatmapAnnotation?.value ||\n prevSettings.heatmapAxis?.value !== heatmapAxis?.value ||\n compareColumnGroups(prevSettings.heatmapGroup, heatmapGroup)\n );\n }\n\n _needUpdateCalculatedDataByData(prevData: DataFrame, data: DataFrame) {\n const prevKeys = Object.keys(prevData.data);\n const keys = Object.keys(data.data);\n return (\n prevData.id !== data.id ||\n prevKeys.length !== keys.length ||\n prevKeys.some(key => prevData.data[key].length !== data.data[key]?.length)\n );\n }\n\n _updateData() {\n const {mode, id, parentId, aes, heatmapAnnotation, heatmapAxis, heatmapGroup, heatmapSettings, height, labels} = this.settings;\n const hierarchy = getHierarchy(\n id.value,\n parentId.value,\n height?.value ?? null,\n labels.valueLabels ?? labels.value ?? null,\n this.data.rows,\n mode === 'useAllNodesAsLeaves'\n );\n const heatmapData = getHeatmapData(this.data, heatmapSettings.valueType, heatmapAnnotation, heatmapAxis, heatmapGroup, id, hierarchy);\n\n const legendLabels = getLegendLabelsMap(this.data, aes);\n\n this.calculatedData = {\n chartSizes: this.chartRenderer.chartSizes,\n hierarchy,\n heatmapData,\n legendLabels,\n };\n }\n\n _updateAesInData() {\n if (!this.calculatedData) {\n return;\n }\n this.calculatedData.legendLabels = getLegendLabelsMap(this.data, this.settings.aes);\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {\n heatmapAnnotation,\n chartSettings,\n connectionType,\n edgeInheritance,\n rootPosition,\n showNodes,\n showEdges,\n showLeavesLabels,\n showNodesLabels,\n aes,\n labels,\n heatmapSettings,\n leavesMode\n } = this.settings;\n\n this.chartRenderer.render(\n chartSettings,\n this.calculatedData.hierarchy,\n connectionType,\n rootPosition,\n edgeInheritance,\n showNodes,\n showEdges,\n showLeavesLabels,\n showNodesLabels,\n aes,\n labels,\n heatmapAnnotation,\n this.calculatedData.heatmapData,\n heatmapSettings,\n this.calculatedData.legendLabels,\n leavesMode,\n this.onClick\n );\n }\n}\n"],"names":["isCategoricalAes","item","getLegendLabelsMap","data","aes","nodeColor","nodeShape","lineColor","aesGrouping","lodash","res","columnName","uniqRowsByGrouping","row","getValue","getValueLabel","usedAes","aesMap","value","ChartDendro","AbstractChart","settings","eventHandlers","__publicField","undefined","ChartRenderer","DendroSettingsImpl","node","err","previousSettings","previousData","field","event","USER_UPDATE_EVENT","renderToString","prevSettings","mode","id","parentId","heatmapAnnotation","heatmapAxis","heatmapGroup","compareColumnGroups","columns1","columns2","column","idx","_a","_b","prevData","prevKeys","keys","key","heatmapSettings","height","labels","hierarchy","getHierarchy","heatmapData","getHeatmapData","legendLabels","chartSettings","connectionType","edgeInheritance","rootPosition","showNodes","showEdges","showLeavesLabels","showNodesLabels","leavesMode"],"mappings":";;;;;;;;;;AA6BA,SAASA,EACLC,GAC2C;AAC3C,SAAI,OAAOA,KAAS,WACT,KAEJ,eAAeA;AAC1B;AACA,SAASC,EAAmBC,GAAiBC,GAAkD;AAC3F,QAAM,EAAC,WAAAC,GAAW,WAAAC,GAAW,WAAAC,EA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,MACA,QAAAmD;AAAAA,MACA,iBAAAF;AAAAA,MACA,YAAAgB;AAAAA,IAAA,IACA,KAAK;AAET,SAAK,cAAc;AAAA,MACfR;AAAAA,MACA,KAAK,eAAe;AAAA,MACpBC;AAAAA,MACAE;AAAAA,MACAD;AAAAA,MACAE;AAAAA,MACAC;AAAAA,MACAC;AAAAA,MACAC;AAAAA,MACAhE;AAAAA,MACAmD;AAAAA,MACAhB;AAAAA,MACA,KAAK,eAAe;AAAA,MACpBc;AAAAA,MACA,KAAK,eAAe;AAAA,MACpBgB;AAAAA,MACA,KAAK;AAAA,IAAA;AAAA,EAEb;AACJ;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/dendro/index.ts"],"sourcesContent":["import type { HierarchyNode } from 'd3-hierarchy';\nimport { uniqBy } from 'lodash';\nimport { renderToString } from 'react-dom/server';\nimport { undefined } from 'zod';\nimport { AbstractChart } from '../AbstractChart';\nimport type { DataFrame } from '../DataFrame';\nimport type {\n AesItem,\n AesRecord,\n CategoricalAesFromColumn,\n Category,\n ClickEventData,\n ColumnName,\n ContinuousAesFromColumn,\n DendroEventHandlers,\n DendroLegendInfo,\n DendroSettings,\n LineShape,\n PointShape\n} from '../types';\nimport ChartRenderer from './ChartRenderer';\nimport type { ChartSizes } from './components/types';\nimport { USER_UPDATE_EVENT } from './constants';\nimport { DendroSettingsImpl } from './DendroSettingsImpl';\nimport type { HeatmapData } from './getHeatmapData';\nimport { getHeatmapData } from './getHeatmapData';\nimport type { TreeNodeData } from './getHierarchyData';\nimport { getHierarchy } from './getHierarchyData';\n\nfunction isCategoricalAes<InputType extends string | number | PointShape | LineShape>(\n item: InputType | CategoricalAesFromColumn<InputType> | ContinuousAesFromColumn<InputType>\n): item is CategoricalAesFromColumn<InputType> {\n if (typeof item !== 'object') {\n return false;\n }\n return 'valuesMap' in item;\n}\nfunction getLegendLabelsMap(data: DataFrame, aes: DendroSettingsImpl['aes']): DendroLegendInfo {\n const {nodeColor, nodeShape, lineColor} = aes;\n const aesGrouping: CategoricalAesFromColumn<string | PointShape>[] = [nodeColor, nodeShape, lineColor].filter(\n isCategoricalAes\n );\n const uniqueColumns = uniqBy(aesGrouping, item => item.columnName.value);\n return uniqueColumns.reduce((res: DendroLegendInfo, item) => {\n const {columnName} = item;\n const categories = data.getColumnCategories(columnName.value, false);\n const getValueLabel = (category: Category) => String(\n (columnName.valueLabels\n ? data.getColumnValue(columnName.valueLabels, data.getColumnCategoryRowIndex(columnName.value, category))\n : undefined\n ) ?? category\n );\n\n const usedAes = new Set<keyof AesItem>();\n const aesMap: AesRecord = categories.reduce((res: AesRecord, category) => {\n if (!res[category]) {\n res[category] = {} as AesItem;\n }\n return res;\n }, {});\n if (isCategoricalAes(nodeColor) && columnName.value === nodeColor.columnName.value) {\n usedAes.add('dotFill');\n categories.forEach(category => {\n aesMap[category]['dotFill'] = nodeColor.valuesMap[category];\n });\n }\n if (isCategoricalAes(nodeShape) && columnName.value === nodeShape.columnName.value) {\n usedAes.add('dotShape');\n categories.forEach(category => {\n aesMap[category]['dotShape'] = nodeShape.valuesMap[category];\n });\n }\n if (isCategoricalAes(lineColor) && columnName.value === lineColor.columnName.value) {\n usedAes.add('lineColor');\n categories.forEach(category => {\n aesMap[category]['lineColor'] = lineColor.valuesMap[category];\n });\n }\n res[columnName.value] = {\n values: categories.sort(),\n usedAes: [...usedAes],\n aesMap,\n labels: categories.reduce((res: Record<string, string>, category) => {\n res[category] = getValueLabel(category);\n return res;\n }, {}),\n };\n return res;\n }, {});\n}\n\nexport class ChartDendro extends AbstractChart {\n settings: DendroSettingsImpl;\n onClick: (data: ClickEventData) => void = () => undefined;\n chartRenderer = new ChartRenderer();\n\n calculatedData: {\n chartSizes: ChartSizes;\n hierarchy: HierarchyNode<TreeNodeData>;\n heatmapData: HeatmapData | null;\n legendLabels: DendroLegendInfo;\n } | null = null;\n\n constructor(data: DataFrame, settings: DendroSettings, eventHandlers?: DendroEventHandlers) {\n super(data, settings);\n\n this.settings = new DendroSettingsImpl(settings);\n if (eventHandlers) {\n this.onClick = eventHandlers[0];\n }\n }\n\n mount(node: HTMLElement) {\n try {\n this.chartRenderer.init(node);\n this._updateData();\n this._updateChart();\n this.hasError = false;\n } catch (err) {\n this.hasError = true;\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n unmount() {\n this.chartRenderer.clear();\n }\n\n updateSettingsAndData(data: DataFrame, settings: DendroSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new DendroSettingsImpl(settings);\n this.data = data;\n if (\n this._needUpdateCalculatedDataBySettings(previousSettings, this.settings) ||\n this._needUpdateCalculatedDataByData(previousData, this.data)\n ) {\n this._updateData();\n } else {\n this._updateAesInData();\n }\n this._updateChart();\n this.hasError = false;\n } catch (err) {\n this.hasError = true;\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n updateChartState(field: string, value: unknown) {\n if (document) {\n const event = new CustomEvent(USER_UPDATE_EVENT, {detail: {[field]: value}});\n document.dispatchEvent(event);\n }\n }\n\n export(): string {\n this._updateChart();\n return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: DendroSettingsImpl, settings: DendroSettingsImpl) {\n const {mode, id, parentId, heatmapAnnotation, heatmapAxis, heatmapGroup} = settings;\n\n function compareColumnGroups(columns1: ColumnName[], columns2: ColumnName[]) {\n return (\n columns1.length !== columns2.length ||\n columns1.some((column, idx) => column.value !== columns2[idx].value)\n );\n }\n\n return (\n prevSettings.mode !== mode ||\n prevSettings.id.value !== id.value ||\n prevSettings.parentId.value !== parentId.value ||\n prevSettings.heatmapAnnotation?.value !== heatmapAnnotation?.value ||\n prevSettings.heatmapAxis?.value !== heatmapAxis?.value ||\n compareColumnGroups(prevSettings.heatmapGroup, heatmapGroup)\n );\n }\n\n _needUpdateCalculatedDataByData(prevData: DataFrame, data: DataFrame) {\n const prevKeys = Object.keys(prevData.data);\n const keys = Object.keys(data.data);\n return (\n prevData.id !== data.id ||\n prevKeys.length !== keys.length ||\n prevKeys.some(key => prevData.data[key].length !== data.data[key]?.length)\n );\n }\n\n _updateData() {\n const {mode, id, parentId, aes, heatmapAnnotation, heatmapAxis, heatmapGroup, heatmapSettings, height, labels} = this.settings;\n const hierarchy = getHierarchy(\n this.data,\n id.value,\n parentId.value,\n height?.value ?? null,\n labels.valueLabels ?? labels.value ?? null,\n mode === 'useAllNodesAsLeaves'\n );\n const heatmapData = getHeatmapData(this.data, heatmapSettings.valueType, heatmapAnnotation, heatmapAxis, heatmapGroup, id, hierarchy);\n\n const legendLabels = getLegendLabelsMap(this.data, aes);\n\n this.calculatedData = {\n chartSizes: this.chartRenderer.chartSizes,\n hierarchy,\n heatmapData,\n legendLabels,\n };\n }\n\n _updateAesInData() {\n if (!this.calculatedData) {\n return;\n }\n this.calculatedData.legendLabels = getLegendLabelsMap(this.data, this.settings.aes);\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {\n heatmapAnnotation,\n chartSettings,\n connectionType,\n edgeInheritance,\n rootPosition,\n showNodes,\n showEdges,\n showLeavesLabels,\n showNodesLabels,\n aes,\n labels,\n heatmapSettings,\n leavesMode\n } = this.settings;\n\n this.chartRenderer.render(\n this.data,\n chartSettings,\n this.calculatedData.hierarchy,\n connectionType,\n rootPosition,\n edgeInheritance,\n showNodes,\n showEdges,\n showLeavesLabels,\n showNodesLabels,\n aes,\n labels,\n heatmapAnnotation,\n this.calculatedData.heatmapData,\n heatmapSettings,\n this.calculatedData.legendLabels,\n leavesMode,\n this.onClick\n );\n }\n}\n"],"names":["isCategoricalAes","item","getLegendLabelsMap","data","aes","nodeColor","nodeShape","lineColor","aesGrouping","uniqBy","res","columnName","categories","getValueLabel","category","undefined","usedAes","aesMap","ChartDendro","AbstractChart","settings","eventHandlers","__publicField","ChartRenderer","DendroSettingsImpl","node","err","previousSettings","previousData","field","value","event","USER_UPDATE_EVENT","renderToString","prevSettings","mode","id","parentId","heatmapAnnotation","heatmapAxis","heatmapGroup","compareColumnGroups","columns1","columns2","column","idx","_a","_b","prevData","prevKeys","keys","c","key","heatmapSettings","height","labels","hierarchy","getHierarchy","heatmapData","getHeatmapData","legendLabels","chartSettings","connectionType","edgeInheritance","rootPosition","showNodes","showEdges","showLeavesLabels","showNodesLabels","leavesMode"],"mappings":";;;;;;;;;;AA6BA,SAASA,EACLC,GAC2C;AAC3C,SAAI,OAAOA,KAAS,WACT,KAEJ,eAAeA;AAC1B;AACA,SAASC,EAAmBC,GAAiBC,GAAkD;AAC3F,QAAM,EAAC,WAAAC,GAAW,WAAAC,GAAW,WAAAC,EAAAA,IAAaH,GACpCI,IAA+D,CAACH,GAAWC,GAAWC,CAAS,EAAE;AAAA,IACnGP;AAAAA,EAAA;AAGJ,SADsBS,EAAAA,OAAOD,GAAa,CAAAP,MAAQA,EAAK,WAAW,KAAK,EAClD,OAAO,CAACS,GAAuBT,MAAS;AACzD,UAAM,EAAC,YAAAU,EAAAA,IAAcV,GACfW,IAAaT,EAAK,oBAAoBQ,EAAW,OAAO,EAAK,GAC7DE,IAAgB,CAACC,MAAuB;AAAA,OACzCH,EAAW,cACNR,EAAK,eAAeQ,EAAW,aAAaR,EAAK,0BAA0BQ,EAAW,OAAOG,CAAQ,CAAC,IACtGC,MACDD;AAAAA,IAAA,GAGHE,wBAAc,IAAA,GACdC,IAAoBL,EAAW,OAAO,CAACF,GAAgBI,OACpDJ,EAAII,CAAQ,MACbJ,EAAII,CAAQ,IAAI,CAAA,IAEbJ,IACR,EAAE;AACL,WAAIV,EAAiBK,CAAS,KAAKM,EAAW,UAAUN,EAAU,WAAW,UACzEW,EAAQ,IAAI,SAAS,GACrBJ,EAAW,QAAQ,CAAAE,MAAY;AAC3BG,QAAOH,CAAQ,EAAE,UAAaT,EAAU,UAAUS,CAAQ;AAAA,IAC9D,CAAC,IAEDd,EAAiBM,CA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