@fusedashlabs/widgets 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +1 -1
- package/dist/components/chart-renderer/element/ui9000-chart-renderer.d.ts +1 -0
- package/dist/components/chart-renderer/element/ui9000-chart-renderer.d.ts.map +1 -1
- package/dist/components/chart-renderer/element/ui9000-chart-renderer.js +12 -1
- package/dist/components/chart-renderer/element/ui9000-chart-renderer.js.map +1 -1
- package/dist/components/chart-renderer/lib/registry.d.ts.map +1 -1
- package/dist/components/chart-renderer/lib/registry.js +17 -4
- package/dist/components/chart-renderer/lib/registry.js.map +1 -1
- package/dist/components/chart-renderer/lib/types.d.ts +5 -0
- package/dist/components/chart-renderer/lib/types.d.ts.map +1 -1
- package/dist/components/donut-chart/element/ui9000-donut-chart.js +1 -1
- package/dist/components/donut-chart/element/ui9000-donut-chart.js.map +1 -1
- package/dist/components/lollipop/element/styles.d.ts.map +1 -1
- package/dist/components/lollipop/element/styles.js +19 -1
- package/dist/components/lollipop/element/styles.js.map +1 -1
- package/dist/components/lollipop/element/ui9000-lollipop.d.ts +6 -1
- package/dist/components/lollipop/element/ui9000-lollipop.d.ts.map +1 -1
- package/dist/components/lollipop/element/ui9000-lollipop.js +68 -7
- package/dist/components/lollipop/element/ui9000-lollipop.js.map +1 -1
- package/dist/components/lollipop/index.d.ts +1 -1
- package/dist/components/lollipop/index.d.ts.map +1 -1
- package/dist/components/lollipop/index.js +2 -0
- package/dist/components/lollipop/index.js.map +1 -1
- package/dist/components/lollipop/lib/domain.d.ts +16 -1
- package/dist/components/lollipop/lib/domain.d.ts.map +1 -1
- package/dist/components/lollipop/lib/domain.js +56 -1
- package/dist/components/lollipop/lib/domain.js.map +1 -1
- package/dist/components/lollipop/lib/index.d.ts +3 -2
- package/dist/components/lollipop/lib/index.d.ts.map +1 -1
- package/dist/components/lollipop/lib/layout.d.ts +16 -0
- package/dist/components/lollipop/lib/layout.d.ts.map +1 -0
- package/dist/components/lollipop/lib/layout.js +16 -0
- package/dist/components/lollipop/lib/layout.js.map +1 -0
- package/dist/components/lollipop/lib/types.d.ts +5 -0
- package/dist/components/lollipop/lib/types.d.ts.map +1 -1
- package/dist/components/lollipop/metadata.json.d.ts +10 -0
- package/dist/components/lollipop/metadata.json.js +4 -1
- package/dist/components/lollipop/metadata.json.js.map +1 -1
- package/dist/components/lollipop/render/draw.d.ts +8 -1
- package/dist/components/lollipop/render/draw.d.ts.map +1 -1
- package/dist/components/lollipop/render/draw.js +155 -84
- package/dist/components/lollipop/render/draw.js.map +1 -1
- package/dist/components/map-chart/element/styles.d.ts +2 -0
- package/dist/components/map-chart/element/styles.d.ts.map +1 -0
- package/dist/components/map-chart/element/styles.js +372 -0
- package/dist/components/map-chart/element/styles.js.map +1 -0
- package/dist/components/map-chart/element/ui9000-map-chart.d.ts +54 -0
- package/dist/components/map-chart/element/ui9000-map-chart.d.ts.map +1 -0
- package/dist/components/map-chart/element/ui9000-map-chart.js +539 -0
- package/dist/components/map-chart/element/ui9000-map-chart.js.map +1 -0
- package/dist/components/map-chart/index.d.ts +5 -0
- package/dist/components/map-chart/index.d.ts.map +1 -0
- package/dist/components/map-chart/index.js +29 -0
- package/dist/components/map-chart/index.js.map +1 -0
- package/dist/components/map-chart/lib/constants.d.ts +34 -0
- package/dist/components/map-chart/lib/constants.d.ts.map +1 -0
- package/dist/components/map-chart/lib/constants.js +122 -0
- package/dist/components/map-chart/lib/constants.js.map +1 -0
- package/dist/components/map-chart/lib/domain.d.ts +12 -0
- package/dist/components/map-chart/lib/domain.d.ts.map +1 -0
- package/dist/components/map-chart/lib/domain.js +105 -0
- package/dist/components/map-chart/lib/domain.js.map +1 -0
- package/dist/components/map-chart/lib/format.d.ts +8 -0
- package/dist/components/map-chart/lib/format.d.ts.map +1 -0
- package/dist/components/map-chart/lib/format.js +45 -0
- package/dist/components/map-chart/lib/format.js.map +1 -0
- package/dist/components/map-chart/lib/geo-index.d.ts +7 -0
- package/dist/components/map-chart/lib/geo-index.d.ts.map +1 -0
- package/dist/components/map-chart/lib/geo-index.js +200 -0
- package/dist/components/map-chart/lib/geo-index.js.map +1 -0
- package/dist/components/map-chart/lib/geojson.d.ts +5 -0
- package/dist/components/map-chart/lib/geojson.d.ts.map +1 -0
- package/dist/components/map-chart/lib/geojson.js +47 -0
- package/dist/components/map-chart/lib/geojson.js.map +1 -0
- package/dist/components/map-chart/lib/index.d.ts +13 -0
- package/dist/components/map-chart/lib/index.d.ts.map +1 -0
- package/dist/components/map-chart/lib/join.d.ts +7 -0
- package/dist/components/map-chart/lib/join.d.ts.map +1 -0
- package/dist/components/map-chart/lib/join.js +156 -0
- package/dist/components/map-chart/lib/join.js.map +1 -0
- package/dist/components/map-chart/lib/legend.d.ts +45 -0
- package/dist/components/map-chart/lib/legend.d.ts.map +1 -0
- package/dist/components/map-chart/lib/legend.js +108 -0
- package/dist/components/map-chart/lib/legend.js.map +1 -0
- package/dist/components/map-chart/lib/normalize.d.ts +3 -0
- package/dist/components/map-chart/lib/normalize.d.ts.map +1 -0
- package/dist/components/map-chart/lib/normalize.js +177 -0
- package/dist/components/map-chart/lib/normalize.js.map +1 -0
- package/dist/components/map-chart/lib/pmtiles.d.ts +41 -0
- package/dist/components/map-chart/lib/pmtiles.d.ts.map +1 -0
- package/dist/components/map-chart/lib/pmtiles.js +112 -0
- package/dist/components/map-chart/lib/pmtiles.js.map +1 -0
- package/dist/components/map-chart/lib/types.d.ts +128 -0
- package/dist/components/map-chart/lib/types.d.ts.map +1 -0
- package/dist/components/map-chart/metadata.json.d.ts +83 -0
- package/dist/components/map-chart/metadata.json.js +42 -0
- package/dist/components/map-chart/metadata.json.js.map +1 -0
- package/dist/components/map-chart/render/draw.d.ts +24 -0
- package/dist/components/map-chart/render/draw.d.ts.map +1 -0
- package/dist/components/map-chart/render/draw.js +455 -0
- package/dist/components/map-chart/render/draw.js.map +1 -0
- package/dist/components/map-chart/render/index.d.ts +2 -0
- package/dist/components/map-chart/render/index.d.ts.map +1 -0
- package/dist/components/matrix-chart/element/styles.d.ts +2 -0
- package/dist/components/matrix-chart/element/styles.d.ts.map +1 -0
- package/dist/components/matrix-chart/element/styles.js +97 -0
- package/dist/components/matrix-chart/element/styles.js.map +1 -0
- package/dist/components/matrix-chart/element/ui9000-matrix-chart.d.ts +39 -0
- package/dist/components/matrix-chart/element/ui9000-matrix-chart.d.ts.map +1 -0
- package/dist/components/matrix-chart/element/ui9000-matrix-chart.js +238 -0
- package/dist/components/matrix-chart/element/ui9000-matrix-chart.js.map +1 -0
- package/dist/components/matrix-chart/index.d.ts +5 -0
- package/dist/components/matrix-chart/index.d.ts.map +1 -0
- package/dist/components/matrix-chart/index.js +20 -0
- package/dist/components/matrix-chart/lib/domain.d.ts +7 -0
- package/dist/components/matrix-chart/lib/domain.d.ts.map +1 -0
- package/dist/components/matrix-chart/lib/domain.js +58 -0
- package/dist/components/matrix-chart/lib/domain.js.map +1 -0
- package/dist/components/matrix-chart/lib/format.d.ts +5 -0
- package/dist/components/matrix-chart/lib/format.d.ts.map +1 -0
- package/dist/components/matrix-chart/lib/format.js +16 -0
- package/dist/components/matrix-chart/lib/format.js.map +1 -0
- package/dist/components/matrix-chart/lib/index.d.ts +5 -0
- package/dist/components/matrix-chart/lib/index.d.ts.map +1 -0
- package/dist/components/matrix-chart/lib/normalize.d.ts +5 -0
- package/dist/components/matrix-chart/lib/normalize.d.ts.map +1 -0
- package/dist/components/matrix-chart/lib/normalize.js +165 -0
- package/dist/components/matrix-chart/lib/normalize.js.map +1 -0
- package/dist/components/matrix-chart/lib/types.d.ts +33 -0
- package/dist/components/matrix-chart/lib/types.d.ts.map +1 -0
- package/dist/components/matrix-chart/metadata.json.d.ts +110 -0
- package/dist/components/matrix-chart/metadata.json.js +42 -0
- package/dist/components/matrix-chart/metadata.json.js.map +1 -0
- package/dist/components/matrix-chart/render/draw.d.ts +63 -0
- package/dist/components/matrix-chart/render/draw.d.ts.map +1 -0
- package/dist/components/matrix-chart/render/draw.js +225 -0
- package/dist/components/matrix-chart/render/draw.js.map +1 -0
- package/dist/components/matrix-chart/render/index.d.ts +2 -0
- package/dist/components/matrix-chart/render/index.d.ts.map +1 -0
- package/dist/components/network-graph/element/styles.d.ts.map +1 -1
- package/dist/components/network-graph/element/styles.js +177 -57
- package/dist/components/network-graph/element/styles.js.map +1 -1
- package/dist/components/network-graph/element/ui9000-network-graph.d.ts +4 -0
- package/dist/components/network-graph/element/ui9000-network-graph.d.ts.map +1 -1
- package/dist/components/network-graph/element/ui9000-network-graph.js +116 -39
- package/dist/components/network-graph/element/ui9000-network-graph.js.map +1 -1
- package/dist/components/network-graph/lib/domain.d.ts +2 -2
- package/dist/components/network-graph/lib/domain.js.map +1 -1
- package/dist/components/network-graph/lib/index.d.ts +1 -0
- package/dist/components/network-graph/lib/index.d.ts.map +1 -1
- package/dist/components/network-graph/lib/legend.d.ts +15 -0
- package/dist/components/network-graph/lib/legend.d.ts.map +1 -0
- package/dist/components/network-graph/lib/legend.js +35 -0
- package/dist/components/network-graph/lib/legend.js.map +1 -0
- package/dist/components/network-graph/render/draw.d.ts +4 -1
- package/dist/components/network-graph/render/draw.d.ts.map +1 -1
- package/dist/components/network-graph/render/draw.js +34 -9
- package/dist/components/network-graph/render/draw.js.map +1 -1
- package/dist/components/pie-chart/element/styles.d.ts.map +1 -1
- package/dist/components/pie-chart/element/styles.js +34 -1
- package/dist/components/pie-chart/element/styles.js.map +1 -1
- package/dist/components/pie-chart/element/ui9000-pie-chart.d.ts +0 -2
- package/dist/components/pie-chart/element/ui9000-pie-chart.d.ts.map +1 -1
- package/dist/components/pie-chart/element/ui9000-pie-chart.js +2 -8
- package/dist/components/pie-chart/element/ui9000-pie-chart.js.map +1 -1
- package/dist/components/pie-chart/metadata.json.d.ts +1 -7
- package/dist/components/pie-chart/metadata.json.js +2 -2
- package/dist/components/polar-area-chart/element/styles.d.ts +1 -1
- package/dist/components/polar-area-chart/element/styles.d.ts.map +1 -1
- package/dist/components/{donut-group-chart → polar-area-chart}/element/styles.js +9 -27
- package/dist/components/polar-area-chart/element/styles.js.map +1 -0
- package/dist/components/polar-area-chart/element/ui9000-polar-area-chart.d.ts.map +1 -1
- package/dist/components/polar-area-chart/element/ui9000-polar-area-chart.js +4 -3
- package/dist/components/polar-area-chart/element/ui9000-polar-area-chart.js.map +1 -1
- package/dist/components/polar-area-chart/index.d.ts +1 -1
- package/dist/components/polar-area-chart/index.d.ts.map +1 -1
- package/dist/components/polar-area-chart/index.js +2 -1
- package/dist/components/polar-area-chart/lib/domain.d.ts +8 -0
- package/dist/components/polar-area-chart/lib/domain.d.ts.map +1 -1
- package/dist/components/polar-area-chart/lib/domain.js +20 -0
- package/dist/components/polar-area-chart/lib/domain.js.map +1 -1
- package/dist/components/polar-area-chart/lib/index.d.ts +1 -1
- package/dist/components/polar-area-chart/lib/index.d.ts.map +1 -1
- package/dist/components/polar-area-chart/lib/normalize.d.ts.map +1 -1
- package/dist/components/polar-area-chart/lib/normalize.js +72 -6
- package/dist/components/polar-area-chart/lib/normalize.js.map +1 -1
- package/dist/components/polar-area-chart/lib/types.d.ts +6 -1
- package/dist/components/polar-area-chart/lib/types.d.ts.map +1 -1
- package/dist/components/polar-area-chart/metadata.json.d.ts +1 -1
- package/dist/components/polar-area-chart/metadata.json.js +1 -1
- package/dist/components/polar-area-chart/render/draw.d.ts.map +1 -1
- package/dist/components/polar-area-chart/render/draw.js +2 -2
- package/dist/components/polar-area-chart/render/draw.js.map +1 -1
- package/dist/components/punchcard-chart/metadata.json.d.ts +1 -1
- package/dist/components/punchcard-chart/metadata.json.js +1 -1
- package/dist/components/sankey-chart/element/styles.d.ts.map +1 -1
- package/dist/components/sankey-chart/element/styles.js +7 -27
- package/dist/components/sankey-chart/element/styles.js.map +1 -1
- package/dist/components/sankey-chart/element/ui9000-sankey-chart.d.ts +5 -5
- package/dist/components/sankey-chart/element/ui9000-sankey-chart.d.ts.map +1 -1
- package/dist/components/sankey-chart/element/ui9000-sankey-chart.js +37 -35
- package/dist/components/sankey-chart/element/ui9000-sankey-chart.js.map +1 -1
- package/dist/components/treemap-chart/element/styles.d.ts +2 -0
- package/dist/components/treemap-chart/element/styles.d.ts.map +1 -0
- package/dist/components/treemap-chart/element/styles.js +141 -0
- package/dist/components/treemap-chart/element/styles.js.map +1 -0
- package/dist/components/treemap-chart/element/ui9000-treemap-chart.d.ts +35 -0
- package/dist/components/treemap-chart/element/ui9000-treemap-chart.d.ts.map +1 -0
- package/dist/components/treemap-chart/element/ui9000-treemap-chart.js +177 -0
- package/dist/components/treemap-chart/element/ui9000-treemap-chart.js.map +1 -0
- package/dist/components/treemap-chart/index.d.ts +5 -0
- package/dist/components/treemap-chart/index.d.ts.map +1 -0
- package/dist/components/treemap-chart/index.js +22 -0
- package/dist/components/treemap-chart/index.js.map +1 -0
- package/dist/components/treemap-chart/lib/color.d.ts +25 -0
- package/dist/components/treemap-chart/lib/color.d.ts.map +1 -0
- package/dist/components/treemap-chart/lib/color.js +67 -0
- package/dist/components/treemap-chart/lib/color.js.map +1 -0
- package/dist/components/treemap-chart/lib/format.d.ts +7 -0
- package/dist/components/treemap-chart/lib/format.d.ts.map +1 -0
- package/dist/components/treemap-chart/lib/format.js +9 -0
- package/dist/components/treemap-chart/lib/format.js.map +1 -0
- package/dist/components/treemap-chart/lib/index.d.ts +6 -0
- package/dist/components/treemap-chart/lib/index.d.ts.map +1 -0
- package/dist/components/treemap-chart/lib/layout.d.ts +18 -0
- package/dist/components/treemap-chart/lib/layout.d.ts.map +1 -0
- package/dist/components/treemap-chart/lib/layout.js +31 -0
- package/dist/components/treemap-chart/lib/layout.js.map +1 -0
- package/dist/components/treemap-chart/lib/normalize.d.ts +4 -0
- package/dist/components/treemap-chart/lib/normalize.d.ts.map +1 -0
- package/dist/components/treemap-chart/lib/normalize.js +182 -0
- package/dist/components/treemap-chart/lib/normalize.js.map +1 -0
- package/dist/components/treemap-chart/lib/types.d.ts +63 -0
- package/dist/components/treemap-chart/lib/types.d.ts.map +1 -0
- package/dist/components/treemap-chart/metadata.json.d.ts +126 -0
- package/dist/components/treemap-chart/metadata.json.js +45 -0
- package/dist/components/treemap-chart/render/draw.d.ts +24 -0
- package/dist/components/treemap-chart/render/draw.d.ts.map +1 -0
- package/dist/components/treemap-chart/render/draw.js +124 -0
- package/dist/components/treemap-chart/render/draw.js.map +1 -0
- package/dist/components/treemap-chart/render/index.d.ts +2 -0
- package/dist/components/treemap-chart/render/index.d.ts.map +1 -0
- package/dist/element/chart-legend-render.d.ts +5 -0
- package/dist/element/chart-legend-render.d.ts.map +1 -1
- package/dist/element/chart-legend-render.js +19 -1
- package/dist/element/chart-legend-render.js.map +1 -1
- package/dist/element/chart-shell-styles.d.ts.map +1 -1
- package/dist/element/chart-shell-styles.js +35 -0
- package/dist/element/chart-shell-styles.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -39
- package/dist/index.js.map +1 -1
- package/dist/lazy/index.d.ts +4 -2
- package/dist/lazy/index.d.ts.map +1 -1
- package/dist/lazy/index.js +24 -8
- package/dist/lazy/index.js.map +1 -1
- package/dist/lazy/map-chart.d.ts +4 -0
- package/dist/lazy/map-chart.d.ts.map +1 -0
- package/dist/lazy/map-chart.js +5 -0
- package/dist/lazy/map-chart.js.map +1 -0
- package/dist/lazy/matrix-chart.d.ts +4 -0
- package/dist/lazy/matrix-chart.d.ts.map +1 -0
- package/dist/lazy/matrix-chart.js +5 -0
- package/dist/lazy/matrix-chart.js.map +1 -0
- package/dist/lazy/treemap-chart.d.ts +4 -0
- package/dist/lazy/treemap-chart.d.ts.map +1 -0
- package/dist/lazy/treemap-chart.js +5 -0
- package/dist/lazy/treemap-chart.js.map +1 -0
- package/dist/node_modules/lit-html/directive.js +28 -0
- package/dist/node_modules/lit-html/directive.js.map +1 -0
- package/dist/node_modules/lit-html/directives/style-map.js +37 -0
- package/dist/node_modules/lit-html/directives/style-map.js.map +1 -0
- package/dist/node_modules/lit-html/lit-html.js +231 -0
- package/dist/node_modules/lit-html/lit-html.js.map +1 -0
- package/dist/utils/axis-units.d.ts +15 -0
- package/dist/utils/axis-units.d.ts.map +1 -0
- package/dist/utils/axis-units.js +27 -0
- package/dist/utils/axis-units.js.map +1 -0
- package/dist/utils/chart-helpers.d.ts +4 -6
- package/dist/utils/chart-helpers.d.ts.map +1 -1
- package/dist/utils/chart-helpers.js +16 -15
- package/dist/utils/chart-helpers.js.map +1 -1
- package/dist/utils/format-text.d.ts +5 -0
- package/dist/utils/format-text.d.ts.map +1 -1
- package/dist/utils/format-text.js +7 -0
- package/dist/utils/format-text.js.map +1 -1
- package/dist/utils/fuse-palette.d.ts +12 -0
- package/dist/utils/fuse-palette.d.ts.map +1 -1
- package/dist/utils/fuse-palette.js +23 -1
- package/dist/utils/fuse-palette.js.map +1 -1
- package/dist/utils/fuse-widget.d.ts +13 -4
- package/dist/utils/fuse-widget.d.ts.map +1 -1
- package/dist/utils/fuse-widget.js.map +1 -1
- package/dist/utils/fusedash-visual.d.ts +65 -52
- package/dist/utils/fusedash-visual.d.ts.map +1 -1
- package/dist/utils/fusedash-visual.js +48 -29
- package/dist/utils/fusedash-visual.js.map +1 -1
- package/package.json +38 -11
- package/dist/components/donut-group-chart/element/styles.d.ts +0 -2
- package/dist/components/donut-group-chart/element/styles.d.ts.map +0 -1
- package/dist/components/donut-group-chart/element/styles.js.map +0 -1
- package/dist/components/donut-group-chart/element/ui9000-donut-group-chart.d.ts +0 -34
- package/dist/components/donut-group-chart/element/ui9000-donut-group-chart.d.ts.map +0 -1
- package/dist/components/donut-group-chart/element/ui9000-donut-group-chart.js +0 -169
- package/dist/components/donut-group-chart/element/ui9000-donut-group-chart.js.map +0 -1
- package/dist/components/donut-group-chart/index.d.ts +0 -5
- package/dist/components/donut-group-chart/index.d.ts.map +0 -1
- package/dist/components/donut-group-chart/index.js +0 -23
- package/dist/components/donut-group-chart/lib/domain.d.ts +0 -39
- package/dist/components/donut-group-chart/lib/domain.d.ts.map +0 -1
- package/dist/components/donut-group-chart/lib/domain.js +0 -51
- package/dist/components/donut-group-chart/lib/domain.js.map +0 -1
- package/dist/components/donut-group-chart/lib/format.d.ts +0 -7
- package/dist/components/donut-group-chart/lib/format.d.ts.map +0 -1
- package/dist/components/donut-group-chart/lib/format.js +0 -21
- package/dist/components/donut-group-chart/lib/format.js.map +0 -1
- package/dist/components/donut-group-chart/lib/index.d.ts +0 -5
- package/dist/components/donut-group-chart/lib/index.d.ts.map +0 -1
- package/dist/components/donut-group-chart/lib/normalize.d.ts +0 -14
- package/dist/components/donut-group-chart/lib/normalize.d.ts.map +0 -1
- package/dist/components/donut-group-chart/lib/normalize.js +0 -98
- package/dist/components/donut-group-chart/lib/normalize.js.map +0 -1
- package/dist/components/donut-group-chart/lib/types.d.ts +0 -49
- package/dist/components/donut-group-chart/lib/types.d.ts.map +0 -1
- package/dist/components/donut-group-chart/metadata.json.d.ts +0 -113
- package/dist/components/donut-group-chart/metadata.json.js +0 -45
- package/dist/components/donut-group-chart/render/draw.d.ts +0 -44
- package/dist/components/donut-group-chart/render/draw.d.ts.map +0 -1
- package/dist/components/donut-group-chart/render/draw.js +0 -194
- package/dist/components/donut-group-chart/render/draw.js.map +0 -1
- package/dist/components/donut-group-chart/render/index.d.ts +0 -2
- package/dist/components/donut-group-chart/render/index.d.ts.map +0 -1
- package/dist/components/donut-group-chart/tests/fixtures.d.ts +0 -33
- package/dist/components/donut-group-chart/tests/fixtures.d.ts.map +0 -1
- package/dist/lazy/donut-group-chart.d.ts +0 -4
- package/dist/lazy/donut-group-chart.d.ts.map +0 -1
- package/dist/lazy/donut-group-chart.js +0 -5
- package/dist/lazy/donut-group-chart.js.map +0 -1
- /package/dist/components/{donut-group-chart → matrix-chart}/index.js.map +0 -0
- /package/dist/components/{donut-group-chart → treemap-chart}/metadata.json.js.map +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.js","sources":["../../../../src/components/map-chart/lib/normalize.ts"],"sourcesContent":["import {\n QUALITATIVE_2,\n resolveFormattingColor,\n SEQUENTIAL_1,\n type FuseFormattingEntry,\n} from '../../../utils/fuse-palette.js';\n\nimport { generateColorRanges, rangesFromPaletteStops, valuesOfRows } from './domain.js';\nimport { inferMapTypeFromKeyNames } from './geo-index.js';\nimport { isFeatureCollection } from './geojson.js';\nimport { isMapVisualisation, joinLayerFeatures } from './join.js';\nimport { layerAverage } from './legend.js';\nimport type {\n GeoJsonFeatureCollection,\n MapChartInput,\n MapChatRow,\n MapLayerInput,\n MapLayerModel,\n MapModel,\n MapRow,\n MapWidgetInput,\n} from './types.js';\n\nconst EMPTY: MapModel = { title: '', terrain: false, showLegend: true, layers: [] };\n\nfunction asRecord(value: unknown): Record<string, unknown> | null {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return null;\n return value as Record<string, unknown>;\n}\n\nfunction rowsFromUnknown(value: unknown): MapRow[] {\n if (!Array.isArray(value)) return [];\n return value.filter(\n (row): row is MapRow => !!row && typeof row === 'object' && !Array.isArray(row),\n );\n}\n\nfunction isChatRow(value: unknown): value is MapChatRow {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return false;\n const row = value as MapChatRow;\n return typeof row.label === 'string' && typeof row.value === 'number';\n}\n\nexport function normalizeMapData(\n input: MapChartInput,\n geoJson?: GeoJsonFeatureCollection | Record<string, GeoJsonFeatureCollection>,\n): MapModel {\n if (input == null) return EMPTY;\n\n if (Array.isArray(input)) {\n if (!input.length) return EMPTY;\n if (isChatRow(input[0])) {\n return normalizeMapData(\n {\n name: '',\n chartType: 'mapChart',\n layers: [\n {\n name: 'Map',\n visualisationType: 'choropleth',\n geospatialData: ['label'],\n arrangeByMetric: ['value'],\n data: input.map((row) => ({\n label: (row as MapChatRow).label,\n value: (row as MapChatRow).value,\n })),\n mapType: (input[0] as MapChatRow).mapType ?? 'country',\n },\n ],\n },\n geoJson,\n );\n }\n return EMPTY;\n }\n\n const obj = asRecord(input);\n if (!obj) return EMPTY;\n\n if (Array.isArray(obj.points)) {\n const points = obj.points as Array<{ x?: string; y?: number }>;\n return normalizeMapData(\n points.map((p) => ({ label: String(p.x ?? ''), value: Number(p.y ?? 0) })),\n geoJson,\n );\n }\n\n if (Array.isArray(obj.regions)) {\n const regions = obj.regions as Array<{ name?: string; label?: string; value?: number }>;\n return normalizeMapData(\n regions.map((r) => ({\n label: String(r.name ?? r.label ?? ''),\n value: Number(r.value ?? 0),\n })),\n geoJson,\n );\n }\n\n const widget = obj as MapWidgetInput;\n const rawLayers = (widget.layers ?? []).filter((layer) => !layer.hideLayer);\n const fallbackRows = rowsFromUnknown(widget.data);\n const layersIn =\n rawLayers.length > 0\n ? rawLayers\n : fallbackRows.length\n ? [\n {\n name: widget.name ?? 'Map',\n visualisationType: widget.visualisationType ?? 'choropleth',\n geospatialData: inferKeys(fallbackRows),\n arrangeByMetric: inferValueKeys(fallbackRows),\n data: fallbackRows,\n mapType: widget.mapType,\n formatting: widget.formatting,\n } satisfies MapLayerInput,\n ]\n : [];\n\n if (!layersIn.length) return EMPTY;\n\n const inlineGeo = resolveGeoJson(widget.geoJson ?? geoJson);\n const layers = layersIn.map((layer, index) =>\n buildLayer(layer, index, widget, inlineGeo[layer.mapType ?? ''] ?? widget.geoJson ?? undefined),\n );\n\n return {\n title: typeof widget.name === 'string' ? widget.name : '',\n terrain: Boolean(widget.terrain),\n showLegend: widget.legend !== false,\n layers,\n };\n}\n\nfunction inferKeys(rows: MapRow[]): string[] {\n const first = rows[0];\n if (!first) return ['label'];\n const geo = Object.keys(first).find((k) => inferMapTypeFromKeyNames([k]));\n if (geo) return [geo];\n if ('label' in first) return ['label'];\n return [Object.keys(first)[0] ?? 'label'];\n}\n\nfunction inferValueKeys(rows: MapRow[]): string[] {\n const first = rows[0];\n if (!first) return ['value'];\n if ('value' in first) return ['value'];\n const numeric = Object.keys(first).find((k) => typeof first[k] === 'number');\n return [numeric ?? 'value'];\n}\n\nfunction resolveGeoJson(\n geoJson: GeoJsonFeatureCollection | Record<string, GeoJsonFeatureCollection> | null | undefined,\n): Record<string, GeoJsonFeatureCollection> {\n if (!geoJson) return {};\n if (isFeatureCollection(geoJson)) {\n return { country: geoJson, '': geoJson };\n }\n return geoJson as Record<string, GeoJsonFeatureCollection>;\n}\n\nfunction buildLayer(\n layer: MapLayerInput,\n index: number,\n widget: MapWidgetInput,\n geoJson?: GeoJsonFeatureCollection,\n): MapLayerModel {\n const rows = rowsFromUnknown(layer.data);\n const visualisationType = isMapVisualisation(layer.visualisationType)\n ? layer.visualisationType\n : 'choropleth';\n const geoKey = layer.geospatialData?.[0] ?? inferKeys(rows)[0] ?? 'label';\n const valueKey = layer.arrangeByMetric?.[0] ?? inferValueKeys(rows)[0] ?? 'value';\n const mapType =\n layer.mapType ||\n inferMapTypeFromKeyNames(layer.geospatialData ?? []) ||\n inferMapTypeFromKeyNames([geoKey]) ||\n 'country';\n const values = valuesOfRows(rows, valueKey);\n const formatting: FuseFormattingEntry[] = layer.formatting?.length\n ? layer.formatting\n : (widget.formatting ?? []);\n const isQualitative =\n visualisationType === 'bubbles' ||\n visualisationType === 'spike' ||\n visualisationType === 'markers';\n const customHex = layer.palette?.customColors?.find((c) => c.hex)?.hex;\n const fillColor =\n customHex ??\n (isQualitative ? resolveFormattingColor(formatting, 'default', formatting.length || 1) : SEQUENTIAL_1[3]);\n const paletteColors = isQualitative\n ? [fillColor, ...QUALITATIVE_2.filter((c) => c !== fillColor)]\n : [...SEQUENTIAL_1];\n const paletteRange = layer.palette?.range;\n const colorRanges =\n paletteRange && paletteRange.length > 1\n ? rangesFromPaletteStops(paletteRange, paletteColors)\n : generateColorRanges(values, paletteColors);\n\n const years = collectYears(rows, layer.timePeriod);\n const layerId = String(layer.layerId || layer.query || layer.name || `layer-${index}`);\n\n const model: MapLayerModel = {\n layerId,\n layerName: layer.name || 'Map',\n visualisationType,\n mapType,\n geoKey,\n valueKey,\n yearKey: layer.timePeriod?.field || 'year',\n rows,\n values,\n colorRanges,\n fillColor,\n average: layerAverage(values),\n years: years.years,\n selectedYear: years.year,\n features: [],\n colorById: {},\n matchTotal: 0,\n matchHit: 0,\n };\n\n const layerGeo = layer.geoJson ?? geoJson;\n return layerGeo ? joinLayerFeatures(model, layerGeo) : model;\n}\n\nfunction collectYears(\n rows: MapRow[],\n timePeriod: MapLayerInput['timePeriod'],\n): { year?: string; years: string[] } {\n if (timePeriod?.values?.length) {\n return { year: timePeriod.values[0], years: [...timePeriod.values] };\n }\n const field = timePeriod?.field || 'year';\n const years: string[] = [];\n for (const row of rows) {\n const value = row[field];\n if (value == null || value === '') continue;\n const text = String(value);\n if (!years.includes(text)) years.push(text);\n }\n years.sort();\n return { year: years[0], years };\n}\n"],"names":[],"mappings":";;;;;;AAuBA,MAAM,QAAkB,EAAE,OAAO,IAAI,SAAS,OAAO,YAAY,MAAM,QAAQ,GAAC;AAEhF,SAAS,SAAS,OAAgD;AAChE,MAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,EAAG,QAAO;AACxE,SAAO;AACT;AAEA,SAAS,gBAAgB,OAA0B;AACjD,MAAI,CAAC,MAAM,QAAQ,KAAK,UAAU,CAAA;AAClC,SAAO,MAAM;AAAA,IACX,CAAC,QAAuB,CAAC,CAAC,OAAO,OAAO,QAAQ,YAAY,CAAC,MAAM,QAAQ,GAAG;AAAA,EAAA;AAElF;AAEA,SAAS,UAAU,OAAqC;AACtD,MAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,EAAG,QAAO;AACxE,QAAM,MAAM;AACZ,SAAO,OAAO,IAAI,UAAU,YAAY,OAAO,IAAI,UAAU;AAC/D;AAEO,SAAS,iBACd,OACA,SACU;AACV,MAAI,SAAS,KAAM,QAAO;AAE1B,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,QAAI,CAAC,MAAM,OAAQ,QAAO;AAC1B,QAAI,UAAU,MAAM,CAAC,CAAC,GAAG;AACvB,aAAO;AAA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,QAAM,QAAuB;AAAA,IAC3B;AAAA,IACA,WAAW,MAAM,QAAQ;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAS,WAAM,eAAN,mBAAkB,UAAS;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,aAAa,MAAM;AAAA,IAC5B,OAAO,MAAM;AAAA,IACb,cAAc,MAAM;AAAA,IACpB,UAAU,CAAA;AAAA,IACV,WAAW,CAAA;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA,EAAA;AAGZ,QAAM,WAAW,MAAM,WAAW;AAClC,SAAO,WAAW,kBAAkB,OAAO,QAAQ,IAAI;AACzD;AAEA,SAAS,aACP,MACA,YACoC;;AACpC,OAAI,8CAAY,WAAZ,mBAAoB,QAAQ;AAC9B,WAAO,EAAE,MAAM,WAAW,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,WAAW,MAAM,EAAA;AAAA,EACnE;AACA,QAAM,SAAQ,yCAAY,UAAS;AACnC,QAAM,QAAkB,CAAA;AACxB,aAAW,OAAO,MAAM;AACtB,UAAM,QAAQ,IAAI,KAAK;AACvB,QAAI,SAAS,QAAQ,UAAU,GAAI;AACnC,UAAM,OAAO,OAAO,KAAK;AACzB,QAAI,CAAC,MAAM,SAAS,IAAI,EAAG,OAAM,KAAK,IAAI;AAAA,EAC5C;AACA,QAAM,KAAA;AACN,SAAO,EAAE,MAAM,MAAM,CAAC,GAAG,MAAA;AAC3B;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PMTiles choropleth boundaries — lockstep with client MapBox/Config/pmtiles.ts.
|
|
3
|
+
*
|
|
4
|
+
* country.json (and the other admin GeoJSONs) are centroid Points used for the
|
|
5
|
+
* data-join / bubbles / spikes. Polygon fills come from `{base}/{file}` vector
|
|
6
|
+
* tiles via mapbox-gl native `provider: "pmtiles"` (3.21+).
|
|
7
|
+
*/
|
|
8
|
+
export type PmtilesLayerConfig = {
|
|
9
|
+
file: string;
|
|
10
|
+
sourceLayer: string;
|
|
11
|
+
idProp: string;
|
|
12
|
+
idExpr?: unknown[];
|
|
13
|
+
};
|
|
14
|
+
export declare const PMTILES_VERSION = "3";
|
|
15
|
+
export declare const PMTILES_CONFIG: Record<string, PmtilesLayerConfig>;
|
|
16
|
+
export declare function getPmtilesConfig(mapType: string): PmtilesLayerConfig | undefined;
|
|
17
|
+
export declare function pmtilesIdExpression(config: PmtilesLayerConfig): unknown[];
|
|
18
|
+
/** True when joined features can paint as a Mapbox fill layer. */
|
|
19
|
+
export declare function featuresHavePolygonGeometry(features: Array<{
|
|
20
|
+
geometry?: {
|
|
21
|
+
type?: string;
|
|
22
|
+
} | null;
|
|
23
|
+
}>): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Resolve `{base}/{file}?v=` to an absolute URL. The pmtiles provider runs in a
|
|
26
|
+
* worker, so a root-relative path would not resolve against the page origin.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolvePmtilesUrl(mapType: string, baseUrl?: string, origin?: string): string | null;
|
|
29
|
+
export declare function choroplethPmtilesSource(mapType: string, features: Array<{
|
|
30
|
+
geometry?: {
|
|
31
|
+
type?: string;
|
|
32
|
+
} | null;
|
|
33
|
+
}>, baseUrl?: string, origin?: string): {
|
|
34
|
+
config: PmtilesLayerConfig;
|
|
35
|
+
url: string;
|
|
36
|
+
} | null;
|
|
37
|
+
/** Replace every `["get", "id"]` with the tile join expression. */
|
|
38
|
+
export declare function rebindGetId(expr: unknown, idExpr: unknown[]): unknown;
|
|
39
|
+
export declare function toPmtilesFillLayer(fillLayer: Record<string, unknown>, config: PmtilesLayerConfig, inRangeIds: string[]): Record<string, unknown>;
|
|
40
|
+
export declare function toPmtilesStrokeLayer(strokeLayer: Record<string, unknown>, config: PmtilesLayerConfig): Record<string, unknown>;
|
|
41
|
+
//# sourceMappingURL=pmtiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAYrE;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,MAAM,EAAE,kBAAkB,EAC1B,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAezB;AAED,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,MAAM,EAAE,kBAAkB,GACzB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMzB"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
const PMTILES_VERSION = "3";
|
|
2
|
+
const PMTILES_CONFIG = {
|
|
3
|
+
country: {
|
|
4
|
+
file: "world-countries.pmtiles",
|
|
5
|
+
sourceLayer: "world-countries",
|
|
6
|
+
idProp: "iso_a3",
|
|
7
|
+
idExpr: ["case", ["==", ["get", "iso_a3"], "-99"], ["get", "adm0_a3"], ["get", "iso_a3"]]
|
|
8
|
+
},
|
|
9
|
+
county: {
|
|
10
|
+
file: "us-counties.pmtiles",
|
|
11
|
+
sourceLayer: "us-counties",
|
|
12
|
+
idProp: "GID_2"
|
|
13
|
+
},
|
|
14
|
+
state: {
|
|
15
|
+
file: "us-states.pmtiles",
|
|
16
|
+
sourceLayer: "us-states",
|
|
17
|
+
idProp: "GID_1"
|
|
18
|
+
},
|
|
19
|
+
city: {
|
|
20
|
+
file: "world-cities.pmtiles",
|
|
21
|
+
sourceLayer: "world-cities",
|
|
22
|
+
idProp: "GID_2"
|
|
23
|
+
},
|
|
24
|
+
province: {
|
|
25
|
+
file: "world-provinces.pmtiles",
|
|
26
|
+
sourceLayer: "world-provinces",
|
|
27
|
+
idProp: "iso_3166_2"
|
|
28
|
+
},
|
|
29
|
+
region: {
|
|
30
|
+
file: "world-provinces.pmtiles",
|
|
31
|
+
sourceLayer: "world-provinces",
|
|
32
|
+
idProp: "iso_3166_2"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
function getPmtilesConfig(mapType) {
|
|
36
|
+
return PMTILES_CONFIG[mapType];
|
|
37
|
+
}
|
|
38
|
+
function pmtilesIdExpression(config) {
|
|
39
|
+
return config.idExpr ?? ["get", config.idProp];
|
|
40
|
+
}
|
|
41
|
+
function featuresHavePolygonGeometry(features) {
|
|
42
|
+
return features.some(
|
|
43
|
+
(feature) => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
return ((_a = feature.geometry) == null ? void 0 : _a.type) === "Polygon" || ((_b = feature.geometry) == null ? void 0 : _b.type) === "MultiPolygon";
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
function resolvePmtilesUrl(mapType, baseUrl, origin) {
|
|
50
|
+
const config = PMTILES_CONFIG[mapType];
|
|
51
|
+
if (!config) return null;
|
|
52
|
+
const base = ((baseUrl == null ? void 0 : baseUrl.trim()) || "/pmtiles").replace(/\/$/, "");
|
|
53
|
+
const pageOrigin = typeof window !== "undefined" ? window.location.origin : "";
|
|
54
|
+
const absoluteBase = base.startsWith("/") && pageOrigin ? `${pageOrigin}${base}` : base;
|
|
55
|
+
if (!absoluteBase || absoluteBase.startsWith("/")) return null;
|
|
56
|
+
return `${absoluteBase}/${config.file}?v=${PMTILES_VERSION}`;
|
|
57
|
+
}
|
|
58
|
+
function choroplethPmtilesSource(mapType, features, baseUrl, origin) {
|
|
59
|
+
if (featuresHavePolygonGeometry(features)) return null;
|
|
60
|
+
const config = getPmtilesConfig(mapType);
|
|
61
|
+
if (!config) return null;
|
|
62
|
+
const url = resolvePmtilesUrl(mapType, baseUrl);
|
|
63
|
+
if (!url) return null;
|
|
64
|
+
return { config, url };
|
|
65
|
+
}
|
|
66
|
+
const isGetId = (value) => Array.isArray(value) && value.length === 2 && value[0] === "get" && value[1] === "id";
|
|
67
|
+
function rebindGetId(expr, idExpr) {
|
|
68
|
+
if (isGetId(expr)) return idExpr;
|
|
69
|
+
if (Array.isArray(expr)) return expr.map((part) => rebindGetId(part, idExpr));
|
|
70
|
+
if (expr && typeof expr === "object") {
|
|
71
|
+
return Object.fromEntries(
|
|
72
|
+
Object.entries(expr).map(([key, value]) => [
|
|
73
|
+
key,
|
|
74
|
+
rebindGetId(value, idExpr)
|
|
75
|
+
])
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return expr;
|
|
79
|
+
}
|
|
80
|
+
function toPmtilesFillLayer(fillLayer, config, inRangeIds) {
|
|
81
|
+
const paint = fillLayer.paint ?? {};
|
|
82
|
+
const idExpr = pmtilesIdExpression(config);
|
|
83
|
+
return {
|
|
84
|
+
...fillLayer,
|
|
85
|
+
"source-layer": config.sourceLayer,
|
|
86
|
+
filter: inRangeIds.length > 0 ? ["in", idExpr, ["literal", inRangeIds]] : ["==", 1, 0],
|
|
87
|
+
paint: {
|
|
88
|
+
...paint,
|
|
89
|
+
"fill-color": rebindGetId(paint["fill-color"], idExpr)
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function toPmtilesStrokeLayer(strokeLayer, config) {
|
|
94
|
+
return {
|
|
95
|
+
...strokeLayer,
|
|
96
|
+
"source-layer": config.sourceLayer,
|
|
97
|
+
paint: rebindGetId(strokeLayer.paint ?? {}, pmtilesIdExpression(config))
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
PMTILES_CONFIG,
|
|
102
|
+
PMTILES_VERSION,
|
|
103
|
+
choroplethPmtilesSource,
|
|
104
|
+
featuresHavePolygonGeometry,
|
|
105
|
+
getPmtilesConfig,
|
|
106
|
+
pmtilesIdExpression,
|
|
107
|
+
rebindGetId,
|
|
108
|
+
resolvePmtilesUrl,
|
|
109
|
+
toPmtilesFillLayer,
|
|
110
|
+
toPmtilesStrokeLayer
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=pmtiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pmtiles.js","sources":["../../../../src/components/map-chart/lib/pmtiles.ts"],"sourcesContent":["/**\n * PMTiles choropleth boundaries — lockstep with client MapBox/Config/pmtiles.ts.\n *\n * country.json (and the other admin GeoJSONs) are centroid Points used for the\n * data-join / bubbles / spikes. Polygon fills come from `{base}/{file}` vector\n * tiles via mapbox-gl native `provider: \"pmtiles\"` (3.21+).\n */\n\nexport type PmtilesLayerConfig = {\n file: string;\n sourceLayer: string;\n idProp: string;\n idExpr?: unknown[];\n};\n\nexport const PMTILES_VERSION = '3';\n\nexport const PMTILES_CONFIG: Record<string, PmtilesLayerConfig> = {\n country: {\n file: 'world-countries.pmtiles',\n sourceLayer: 'world-countries',\n idProp: 'iso_a3',\n idExpr: ['case', ['==', ['get', 'iso_a3'], '-99'], ['get', 'adm0_a3'], ['get', 'iso_a3']],\n },\n county: {\n file: 'us-counties.pmtiles',\n sourceLayer: 'us-counties',\n idProp: 'GID_2',\n },\n state: {\n file: 'us-states.pmtiles',\n sourceLayer: 'us-states',\n idProp: 'GID_1',\n },\n city: {\n file: 'world-cities.pmtiles',\n sourceLayer: 'world-cities',\n idProp: 'GID_2',\n },\n province: {\n file: 'world-provinces.pmtiles',\n sourceLayer: 'world-provinces',\n idProp: 'iso_3166_2',\n },\n region: {\n file: 'world-provinces.pmtiles',\n sourceLayer: 'world-provinces',\n idProp: 'iso_3166_2',\n },\n};\n\nexport function getPmtilesConfig(mapType: string): PmtilesLayerConfig | undefined {\n return PMTILES_CONFIG[mapType];\n}\n\nexport function pmtilesIdExpression(config: PmtilesLayerConfig): unknown[] {\n return config.idExpr ?? ['get', config.idProp];\n}\n\n/** True when joined features can paint as a Mapbox fill layer. */\nexport function featuresHavePolygonGeometry(\n features: Array<{ geometry?: { type?: string } | null }>,\n): boolean {\n return features.some(\n (feature) => feature.geometry?.type === 'Polygon' || feature.geometry?.type === 'MultiPolygon',\n );\n}\n\n/**\n * Resolve `{base}/{file}?v=` to an absolute URL. The pmtiles provider runs in a\n * worker, so a root-relative path would not resolve against the page origin.\n */\nexport function resolvePmtilesUrl(\n mapType: string,\n baseUrl?: string,\n origin?: string,\n): string | null {\n const config = PMTILES_CONFIG[mapType];\n if (!config) return null;\n const base = (baseUrl?.trim() || '/pmtiles').replace(/\\/$/, '');\n const pageOrigin =\n origin ?? (typeof window !== 'undefined' ? window.location.origin : '');\n const absoluteBase = base.startsWith('/') && pageOrigin ? `${pageOrigin}${base}` : base;\n if (!absoluteBase || absoluteBase.startsWith('/')) return null;\n return `${absoluteBase}/${config.file}?v=${PMTILES_VERSION}`;\n}\n\nexport function choroplethPmtilesSource(\n mapType: string,\n features: Array<{ geometry?: { type?: string } | null }>,\n baseUrl?: string,\n origin?: string,\n): { config: PmtilesLayerConfig; url: string } | null {\n if (featuresHavePolygonGeometry(features)) return null;\n const config = getPmtilesConfig(mapType);\n if (!config) return null;\n const url = resolvePmtilesUrl(mapType, baseUrl, origin);\n if (!url) return null;\n return { config, url };\n}\n\nconst isGetId = (value: unknown): boolean =>\n Array.isArray(value) && value.length === 2 && value[0] === 'get' && value[1] === 'id';\n\n/** Replace every `[\"get\", \"id\"]` with the tile join expression. */\nexport function rebindGetId(expr: unknown, idExpr: unknown[]): unknown {\n if (isGetId(expr)) return idExpr;\n if (Array.isArray(expr)) return expr.map((part) => rebindGetId(part, idExpr));\n if (expr && typeof expr === 'object') {\n return Object.fromEntries(\n Object.entries(expr as Record<string, unknown>).map(([key, value]) => [\n key,\n rebindGetId(value, idExpr),\n ]),\n );\n }\n return expr;\n}\n\nexport function toPmtilesFillLayer(\n fillLayer: Record<string, unknown>,\n config: PmtilesLayerConfig,\n inRangeIds: string[],\n): Record<string, unknown> {\n const paint = (fillLayer.paint ?? {}) as Record<string, unknown>;\n const idExpr = pmtilesIdExpression(config);\n return {\n ...fillLayer,\n 'source-layer': config.sourceLayer,\n filter:\n inRangeIds.length > 0\n ? ['in', idExpr, ['literal', inRangeIds]]\n : ['==', 1, 0],\n paint: {\n ...paint,\n 'fill-color': rebindGetId(paint['fill-color'], idExpr),\n },\n };\n}\n\nexport function toPmtilesStrokeLayer(\n strokeLayer: Record<string, unknown>,\n config: PmtilesLayerConfig,\n): Record<string, unknown> {\n return {\n ...strokeLayer,\n 'source-layer': config.sourceLayer,\n paint: rebindGetId(strokeLayer.paint ?? {}, pmtilesIdExpression(config)),\n };\n}\n"],"names":[],"mappings":"AAeO,MAAM,kBAAkB;AAExB,MAAM,iBAAqD;AAAA,EAChE,SAAS;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,QAAQ,GAAG,KAAK,GAAG,CAAC,OAAO,SAAS,GAAG,CAAC,OAAO,QAAQ,CAAC;AAAA,EAAA;AAAA,EAE1F,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,EAAA;AAAA,EAEV,OAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,EAAA;AAAA,EAEV,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,EAAA;AAAA,EAEV,UAAU;AAAA,IACR,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,EAAA;AAAA,EAEV,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,EAAA;AAEZ;AAEO,SAAS,iBAAiB,SAAiD;AAChF,SAAO,eAAe,OAAO;AAC/B;AAEO,SAAS,oBAAoB,QAAuC;AACzE,SAAO,OAAO,UAAU,CAAC,OAAO,OAAO,MAAM;AAC/C;AAGO,SAAS,4BACd,UACS;AACT,SAAO,SAAS;AAAA,IACd,CAAC;AAjDE;AAiDU,4BAAQ,aAAR,mBAAkB,UAAS,eAAa,aAAQ,aAAR,mBAAkB,UAAS;AAAA;AAAA,EAAA;AA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AAClC,QAAM,SAAS,oBAAoB,MAAM;AACzC,SAAO;AAAA,IACL,GAAG;AAAA,IACH,gBAAgB,OAAO;AAAA,IACvB,QACE,WAAW,SAAS,IAChB,CAAC,MAAM,QAAQ,CAAC,WAAW,UAAU,CAAC,IACtC,CAAC,MAAM,GAAG,CAAC;AAAA,IACjB,OAAO;AAAA,MACL,GAAG;AAAA,MACH,cAAc,YAAY,MAAM,YAAY,GAAG,MAAM;AAAA,IAAA;AAAA,EACvD;AAEJ;AAEO,SAAS,qBACd,aACA,QACyB;AACzB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,gBAAgB,OAAO;AAAA,IACvB,OAAO,YAAY,YAAY,SAAS,CAAA,GAAI,oBAAoB,MAAM,CAAC;AAAA,EAAA;AAE3E;"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { FuseFormattingEntry } from '../../../utils/fuse-palette.js';
|
|
2
|
+
import { MapAdminType, MapVisualisation } from './constants.js';
|
|
3
|
+
export type MapRow = Record<string, unknown>;
|
|
4
|
+
export type ColorRange = {
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
color: string;
|
|
8
|
+
radius: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
export type GeoJsonGeometry = {
|
|
12
|
+
type: string;
|
|
13
|
+
coordinates: unknown;
|
|
14
|
+
};
|
|
15
|
+
export type GeoJsonFeature = {
|
|
16
|
+
type: 'Feature';
|
|
17
|
+
id?: string | number;
|
|
18
|
+
properties: Record<string, unknown> | null;
|
|
19
|
+
geometry: GeoJsonGeometry | null;
|
|
20
|
+
};
|
|
21
|
+
export type GeoJsonFeatureCollection = {
|
|
22
|
+
type: 'FeatureCollection';
|
|
23
|
+
features: GeoJsonFeature[];
|
|
24
|
+
};
|
|
25
|
+
export type MapLayerInput = {
|
|
26
|
+
layerId?: string;
|
|
27
|
+
name?: string;
|
|
28
|
+
query?: string;
|
|
29
|
+
visualisationType?: string;
|
|
30
|
+
geospatialData?: string[];
|
|
31
|
+
arrangeByMetric?: string[];
|
|
32
|
+
timePeriod?: {
|
|
33
|
+
field?: string;
|
|
34
|
+
values?: string[];
|
|
35
|
+
} | null;
|
|
36
|
+
data?: MapRow[];
|
|
37
|
+
formatting?: FuseFormattingEntry[] | null;
|
|
38
|
+
palette?: {
|
|
39
|
+
paletteId?: string;
|
|
40
|
+
range?: number[];
|
|
41
|
+
customColors?: Array<{
|
|
42
|
+
key?: string;
|
|
43
|
+
hex?: string;
|
|
44
|
+
}>;
|
|
45
|
+
} | null;
|
|
46
|
+
hideLayer?: boolean;
|
|
47
|
+
geoJson?: GeoJsonFeatureCollection | null;
|
|
48
|
+
mapType?: string;
|
|
49
|
+
};
|
|
50
|
+
export type MapWidgetInput = {
|
|
51
|
+
name?: string;
|
|
52
|
+
chartType?: string;
|
|
53
|
+
legend?: boolean;
|
|
54
|
+
terrain?: boolean;
|
|
55
|
+
tooltip?: boolean;
|
|
56
|
+
timeline?: boolean;
|
|
57
|
+
paletteId?: string;
|
|
58
|
+
formatting?: FuseFormattingEntry[] | null;
|
|
59
|
+
layers?: MapLayerInput[];
|
|
60
|
+
data?: MapRow[] | unknown;
|
|
61
|
+
geoJson?: GeoJsonFeatureCollection | null;
|
|
62
|
+
mapType?: string;
|
|
63
|
+
visualisationType?: string;
|
|
64
|
+
regions?: Array<{
|
|
65
|
+
name?: string;
|
|
66
|
+
label?: string;
|
|
67
|
+
value?: number;
|
|
68
|
+
}>;
|
|
69
|
+
};
|
|
70
|
+
export type MapChatRow = {
|
|
71
|
+
label: string;
|
|
72
|
+
value: number;
|
|
73
|
+
mapType?: string;
|
|
74
|
+
};
|
|
75
|
+
export type MapChartInput = MapWidgetInput | MapChatRow[] | {
|
|
76
|
+
points?: Array<{
|
|
77
|
+
x: string;
|
|
78
|
+
y: number;
|
|
79
|
+
}>;
|
|
80
|
+
} | null | undefined;
|
|
81
|
+
export type MapLayerModel = {
|
|
82
|
+
layerId: string;
|
|
83
|
+
layerName: string;
|
|
84
|
+
visualisationType: MapVisualisation;
|
|
85
|
+
mapType: string;
|
|
86
|
+
geoKey: string;
|
|
87
|
+
valueKey: string;
|
|
88
|
+
yearKey: string;
|
|
89
|
+
rows: MapRow[];
|
|
90
|
+
values: number[];
|
|
91
|
+
colorRanges: ColorRange[];
|
|
92
|
+
fillColor: string;
|
|
93
|
+
average: number;
|
|
94
|
+
years: string[];
|
|
95
|
+
selectedYear?: string;
|
|
96
|
+
features: GeoJsonFeature[];
|
|
97
|
+
colorById: Record<string, string>;
|
|
98
|
+
matchTotal: number;
|
|
99
|
+
matchHit: number;
|
|
100
|
+
};
|
|
101
|
+
export type MapModel = {
|
|
102
|
+
title: string;
|
|
103
|
+
terrain: boolean;
|
|
104
|
+
showLegend: boolean;
|
|
105
|
+
layers: MapLayerModel[];
|
|
106
|
+
};
|
|
107
|
+
export type MapHoverEntry = {
|
|
108
|
+
regionId: string;
|
|
109
|
+
regionName: string;
|
|
110
|
+
value: number;
|
|
111
|
+
valueKey: string;
|
|
112
|
+
layerName: string;
|
|
113
|
+
lngLat: {
|
|
114
|
+
lng: number;
|
|
115
|
+
lat: number;
|
|
116
|
+
};
|
|
117
|
+
point?: {
|
|
118
|
+
x: number;
|
|
119
|
+
y: number;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
export type FeaturesIndex = {
|
|
123
|
+
byId: Map<string, GeoJsonFeature>;
|
|
124
|
+
byDataValue: Map<string, string>;
|
|
125
|
+
byNormalizedValue: Map<string, string>;
|
|
126
|
+
};
|
|
127
|
+
export type { MapAdminType, MapVisualisation };
|
|
128
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/map-chart/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,KAAK,EAAE,YAAY,EAAE,gBAA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C;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,KAAK,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAClC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"id": "map-chart",
|
|
3
|
+
"tag": "ui9000-map-chart",
|
|
4
|
+
"title": "Map",
|
|
5
|
+
"description": "FuseDash MapBox / UniversalMap as a Shadow DOM web component. Choropleth fills come from PMTiles vector tiles; centroid GeoJSON is fetched at runtime for the data-join, bubbles, and spikes. mapbox-gl is an optional peer — not inlined in the D3 chart budget.",
|
|
6
|
+
"chartTypeKeys": ["mapChart", "UniversalMap"],
|
|
7
|
+
"source": "client/libs/shared/components/src/Widgets/MapBox/",
|
|
8
|
+
"stack": "mapbox-gl",
|
|
9
|
+
"lazyImport": "@fusedashlabs/widgets/lazy/map-chart",
|
|
10
|
+
"entry": "@fusedashlabs/widgets/map-chart",
|
|
11
|
+
"usageConditions": {
|
|
12
|
+
"host": "mcp-chat",
|
|
13
|
+
"notFor": "fusedash-editor",
|
|
14
|
+
"mapsExcluded": false,
|
|
15
|
+
"hostReady": false,
|
|
16
|
+
"requires": ["mapbox-token", "geojson", "pmtiles"]
|
|
17
|
+
},
|
|
18
|
+
"allowedActions": ["hover", "pan", "zoom", "resize"],
|
|
19
|
+
"propsSchema": {
|
|
20
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"data": {
|
|
24
|
+
"oneOf": [
|
|
25
|
+
{
|
|
26
|
+
"type": "object",
|
|
27
|
+
"description": "FuseDash WidgetItem-shaped map payload (layers[].data + geospatialData).",
|
|
28
|
+
"properties": {
|
|
29
|
+
"name": { "type": "string" },
|
|
30
|
+
"chartType": { "type": "string", "const": "mapChart" },
|
|
31
|
+
"layers": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"items": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"properties": {
|
|
36
|
+
"name": { "type": "string" },
|
|
37
|
+
"visualisationType": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"enum": ["choropleth", "bubbles", "spike", "markers"]
|
|
40
|
+
},
|
|
41
|
+
"geospatialData": { "type": "array", "items": { "type": "string" } },
|
|
42
|
+
"arrangeByMetric": { "type": "array", "items": { "type": "string" } },
|
|
43
|
+
"data": { "type": "array", "items": { "type": "object" } }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"type": "array",
|
|
51
|
+
"description": "Chat rows { label, value } joined as a country choropleth.",
|
|
52
|
+
"items": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"required": ["label", "value"],
|
|
55
|
+
"properties": {
|
|
56
|
+
"label": { "type": "string" },
|
|
57
|
+
"value": { "type": "number" }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"chart-title": { "type": "string" },
|
|
64
|
+
"show-header": { "type": "boolean", "default": true },
|
|
65
|
+
"show-legend": { "type": "boolean", "default": true },
|
|
66
|
+
"show-tooltip": { "type": "boolean", "default": true },
|
|
67
|
+
"mapbox-token": { "type": "string" },
|
|
68
|
+
"geojson-base-url": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"description": "Base URL that serves {country,state,county,city,province}.json centroid FeatureCollections used for the data-join / bubbles / spikes."
|
|
71
|
+
},
|
|
72
|
+
"pmtiles-base-url": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"default": "/pmtiles",
|
|
75
|
+
"description": "Base URL that serves world-countries.pmtiles (and other admin archives). Choropleth fills use these vector tiles — the GeoJSON files are centroids, not polygons."
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"required": ["data"]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
;
|
|
82
|
+
|
|
83
|
+
export default _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const id = "map-chart";
|
|
2
|
+
const tag = "ui9000-map-chart";
|
|
3
|
+
const title = "Map";
|
|
4
|
+
const description = "FuseDash MapBox / UniversalMap as a Shadow DOM web component. Choropleth fills come from PMTiles vector tiles; centroid GeoJSON is fetched at runtime for the data-join, bubbles, and spikes. mapbox-gl is an optional peer — not inlined in the D3 chart budget.";
|
|
5
|
+
const chartTypeKeys = ["mapChart", "UniversalMap"];
|
|
6
|
+
const source = "client/libs/shared/components/src/Widgets/MapBox/";
|
|
7
|
+
const stack = "mapbox-gl";
|
|
8
|
+
const lazyImport = "@fusedashlabs/widgets/lazy/map-chart";
|
|
9
|
+
const entry = "@fusedashlabs/widgets/map-chart";
|
|
10
|
+
const usageConditions = { "host": "mcp-chat", "notFor": "fusedash-editor", "mapsExcluded": false, "hostReady": false, "requires": ["mapbox-token", "geojson", "pmtiles"] };
|
|
11
|
+
const allowedActions = ["hover", "pan", "zoom", "resize"];
|
|
12
|
+
const propsSchema = { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "oneOf": [{ "type": "object", "description": "FuseDash WidgetItem-shaped map payload (layers[].data + geospatialData).", "properties": { "name": { "type": "string" }, "chartType": { "type": "string", "const": "mapChart" }, "layers": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "visualisationType": { "type": "string", "enum": ["choropleth", "bubbles", "spike", "markers"] }, "geospatialData": { "type": "array", "items": { "type": "string" } }, "arrangeByMetric": { "type": "array", "items": { "type": "string" } }, "data": { "type": "array", "items": { "type": "object" } } } } } } }, { "type": "array", "description": "Chat rows { label, value } joined as a country choropleth.", "items": { "type": "object", "required": ["label", "value"], "properties": { "label": { "type": "string" }, "value": { "type": "number" } } } }] }, "chart-title": { "type": "string" }, "show-header": { "type": "boolean", "default": true }, "show-legend": { "type": "boolean", "default": true }, "show-tooltip": { "type": "boolean", "default": true }, "mapbox-token": { "type": "string" }, "geojson-base-url": { "type": "string", "description": "Base URL that serves {country,state,county,city,province}.json centroid FeatureCollections used for the data-join / bubbles / spikes." }, "pmtiles-base-url": { "type": "string", "default": "/pmtiles", "description": "Base URL that serves world-countries.pmtiles (and other admin archives). Choropleth fills use these vector tiles — the GeoJSON files are centroids, not polygons." } }, "required": ["data"] };
|
|
13
|
+
const mapChartMeta = {
|
|
14
|
+
id,
|
|
15
|
+
tag,
|
|
16
|
+
title,
|
|
17
|
+
description,
|
|
18
|
+
chartTypeKeys,
|
|
19
|
+
source,
|
|
20
|
+
stack,
|
|
21
|
+
lazyImport,
|
|
22
|
+
entry,
|
|
23
|
+
usageConditions,
|
|
24
|
+
allowedActions,
|
|
25
|
+
propsSchema
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
allowedActions,
|
|
29
|
+
chartTypeKeys,
|
|
30
|
+
mapChartMeta as default,
|
|
31
|
+
description,
|
|
32
|
+
entry,
|
|
33
|
+
id,
|
|
34
|
+
lazyImport,
|
|
35
|
+
propsSchema,
|
|
36
|
+
source,
|
|
37
|
+
stack,
|
|
38
|
+
tag,
|
|
39
|
+
title,
|
|
40
|
+
usageConditions
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=metadata.json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LayerSlider } from '../lib/legend.js';
|
|
2
|
+
import { MapHoverEntry, MapModel } from '../lib/types.js';
|
|
3
|
+
export type MapMode = 'light' | 'dark';
|
|
4
|
+
export type RenderMapChartOptions = {
|
|
5
|
+
model: MapModel;
|
|
6
|
+
token: string;
|
|
7
|
+
mode?: MapMode;
|
|
8
|
+
showTooltip?: boolean;
|
|
9
|
+
pmtilesBaseUrl?: string;
|
|
10
|
+
activeLayerIds?: string[];
|
|
11
|
+
sliders?: Record<string, LayerSlider>;
|
|
12
|
+
year?: string;
|
|
13
|
+
onHover?: (entry: MapHoverEntry | null) => void;
|
|
14
|
+
};
|
|
15
|
+
export type MapChartController = {
|
|
16
|
+
resize: () => void;
|
|
17
|
+
destroy: () => void;
|
|
18
|
+
setYear: (year: string | undefined) => void;
|
|
19
|
+
applyLegend: (activeLayerIds: string[], sliders: Record<string, LayerSlider>) => void;
|
|
20
|
+
};
|
|
21
|
+
export declare function stopMapChart(container: HTMLElement): void;
|
|
22
|
+
export declare function resizeMapChart(container: HTMLElement): boolean;
|
|
23
|
+
export declare function renderMapChart(container: HTMLElement, options: RenderMapChartOptions): Promise<MapChartController | null>;
|
|
24
|
+
//# sourceMappingURL=draw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../../../../src/components/map-chart/render/draw.ts"],"names":[],"mappings":"AAYA,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,KAAK,EAA8B,aAAa,EAAiB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE1G,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAEvC,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,QAAQ,CAAC;IAChB,KAAK,EAAE,MAA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