@redus/georedus-ui 0.19.4 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +132 -0
  3. package/dist/ExportImage/ExportImage.d.ts +1 -0
  4. package/dist/ExportImage/NorthArrow.d.ts +15 -0
  5. package/dist/ExportImage/constants.d.ts +2 -0
  6. package/dist/ExportImage/createMapBlob.d.ts +20 -0
  7. package/dist/ExportImage/createMapImage.d.ts +1 -0
  8. package/dist/ExportImage/index.d.ts +1 -0
  9. package/dist/ExportImage/paperDimensions.d.ts +8 -0
  10. package/dist/GeoReDUS/constants.d.ts +9 -0
  11. package/dist/GeoReDUSLogo/GeoReDUSLogo.d.ts +1 -1
  12. package/dist/LeftPanel/LeftPanel.d.ts +7 -3
  13. package/dist/LeftPanel/SharePanel.d.ts +7 -3
  14. package/dist/main.js +2690 -240
  15. package/dist/viewSpecs/presets/cem_censo/2010_2022/parseSchema.d.ts +1 -0
  16. package/dist/viewSpecs/presets/index.d.ts +5 -0
  17. package/dist/viewSpecs/presets/util/colorUtil.d.ts +2 -0
  18. package/dist/viewSpecs/presets/util/components/basicDownload.d.ts +12 -0
  19. package/dist/viewSpecs/presets/util/components/basicTooltip.d.ts +20 -0
  20. package/dist/viewSpecs/presets/util/components/confInputs.d.ts +127 -0
  21. package/dist/viewSpecs/presets/util/index.d.ts +6 -0
  22. package/dist/viewSpecs/presets/util/string.d.ts +1 -0
  23. package/dist/viewSpecs/presets/util/url.d.ts +7 -0
  24. package/dist/viewSpecs/presets/vector_circle/index.d.ts +75 -1
  25. package/dist/viewSpecs/presets/vector_line/index.d.ts +95 -2
  26. package/dist/viewSpecs/presets/vector_point_continuous/download.d.ts +9 -0
  27. package/dist/viewSpecs/presets/vector_point_continuous/index.d.ts +95 -0
  28. package/dist/viewSpecs/presets/vector_point_continuous/layers.d.ts +59 -0
  29. package/dist/viewSpecs/presets/vector_point_continuous/metadata/index.d.ts +11 -0
  30. package/dist/viewSpecs/presets/vector_point_continuous/parseStyleSpec.d.ts +34 -0
  31. package/dist/viewSpecs/presets/vector_point_continuous/sources.d.ts +8 -0
  32. package/dist/viewSpecs/presets/vector_point_single/confSchema.d.ts +63 -0
  33. package/dist/viewSpecs/presets/vector_point_single/download.d.ts +9 -0
  34. package/dist/viewSpecs/presets/vector_point_single/index.d.ts +142 -0
  35. package/dist/viewSpecs/presets/vector_point_single/layers.d.ts +53 -0
  36. package/dist/viewSpecs/presets/vector_point_single/metadata/index.d.ts +1 -0
  37. package/dist/viewSpecs/presets/vector_point_single/parseStyleSpec.d.ts +11 -0
  38. package/dist/viewSpecs/presets/vector_point_single/sources.d.ts +8 -0
  39. package/dist/viewSpecs/presets/vector_polygon/index.d.ts +93 -10
  40. package/dist/viewSpecs/presets/vector_polygon_categorical/confSchema.d.ts +14 -0
  41. package/dist/viewSpecs/presets/vector_polygon_categorical/download.d.ts +9 -0
  42. package/dist/viewSpecs/presets/vector_polygon_categorical/index.d.ts +108 -0
  43. package/dist/viewSpecs/presets/vector_polygon_categorical/layers.d.ts +58 -0
  44. package/dist/viewSpecs/presets/vector_polygon_categorical/metadata.d.ts +11 -0
  45. package/dist/viewSpecs/presets/vector_polygon_categorical/parseStyleSpec.d.ts +17 -0
  46. package/dist/viewSpecs/presets/vector_polygon_categorical/sources.d.ts +8 -0
  47. package/dist/viewSpecs/presets/vector_polygon_continuous/confSchema.d.ts +24 -0
  48. package/dist/viewSpecs/presets/vector_polygon_continuous/download.d.ts +9 -0
  49. package/dist/viewSpecs/presets/vector_polygon_continuous/index.d.ts +112 -0
  50. package/dist/viewSpecs/presets/vector_polygon_continuous/layers.d.ts +54 -0
  51. package/dist/viewSpecs/presets/vector_polygon_continuous/metadata/colorScaleStopResolvers.d.ts +21 -0
  52. package/dist/viewSpecs/presets/vector_polygon_continuous/metadata/index.d.ts +9 -0
  53. package/dist/viewSpecs/presets/vector_polygon_continuous/parseStyleSpec.d.ts +31 -0
  54. package/dist/viewSpecs/presets/vector_polygon_continuous/sources.d.ts +8 -0
  55. package/dist/viewSpecs/presets/vector_polygon_single/confSchema.d.ts +73 -0
  56. package/dist/viewSpecs/presets/vector_polygon_single/download.d.ts +9 -0
  57. package/dist/viewSpecs/presets/vector_polygon_single/index.d.ts +157 -0
  58. package/dist/viewSpecs/presets/vector_polygon_single/layers.d.ts +58 -0
  59. package/dist/viewSpecs/presets/vector_polygon_single/metadata.d.ts +1 -0
  60. package/dist/viewSpecs/presets/vector_polygon_single/parseStyleSpec.d.ts +7 -0
  61. package/dist/viewSpecs/presets/vector_polygon_single/sources.d.ts +7 -0
  62. package/dist/viewSpecs/util/colorSchemes/d3.d.ts +58 -0
  63. package/dist/viewSpecs/util/colorSchemes/georedus.d.ts +156 -0
  64. package/dist/viewSpecs/util/colorSchemes/index.d.ts +13 -0
  65. package/package.json +4 -2
  66. package/dist/viewSpecs/util/colorSchemes.d.ts +0 -15
package/dist/main.js CHANGED
@@ -1,26 +1,26 @@
1
- import { get, isPlainObject, pick, omit, set, uniqBy, groupBy, sortBy, uniq } from 'lodash';
1
+ import { isPlainObject, pick, omit, set, get as get$1, uniqBy, groupBy, sortBy, uniq } from 'lodash';
2
2
  import { slugify, dataJoin, interpolate } from '@orioro/util';
3
3
  import { makeResolve, $$literal, withExpressionResolvers, expressions, ALL_EXPR, fetchExpr, resolve, resolveAsync } from '@orioro/resolve';
4
4
  import { __assign, __spreadArray, __awaiter, __generator, __makeTemplateObject } from 'tslib';
5
5
  import { schemeTableau10, schemeSet3, schemeSet2, schemeSet1, schemePastel2, schemePastel1, schemePaired, schemeObservable10, schemeDark2, schemeAccent, schemeCategory10, schemeSpectral, schemeRdYlGn, schemeRdYlBu, schemeRdGy, schemeRdBu, schemePuOr, schemePiYG, schemePRGn, schemeBrBG, schemeYlOrRd, schemeYlOrBr, schemeYlGn, schemeYlGnBu, schemeRdPu, schemePuRd, schemePuBu, schemePuBuGn, schemeOrRd, schemeGnBu, schemeBuPu, schemeBuGn, schemeReds, schemePurples, schemeOranges, schemeGreys, schemeGreens, schemeBlues, interpolateSpectral } from 'd3-scale-chromatic';
6
- import { saveAs } from 'file-saver';
7
- import { CANCELLED, fileReadAs, AspectRatio, LoadingIndicator, Flex, Box, RichTextOutput, EvenSpacedList, FileOutput, MARKDOWN_DEFAULT_REMARK_PLUGINS, MARKDOWN_DEFAULT_REHYPE_PLUGINS, Markdown as Markdown$1, DropdownMenu, Input, SwitchInput, TextEllipsis, withDefaults, LoadingOverlay, Button, SingleFileInput, InputProvider as InputProvider$1, rendererSpecList, TextInput, withLabeledLayout, INPUTS, useLocalState } from '@orioro/react-ui-core';
6
+ import { get } from '@orioro/get';
7
+ import { saveAs as saveAs$1 } from 'file-saver';
8
+ import { CANCELLED, fileReadAs, Flex, AspectRatio, LoadingIndicator, Box, RichTextOutput, EvenSpacedList, FileOutput, MARKDOWN_DEFAULT_REMARK_PLUGINS, MARKDOWN_DEFAULT_REHYPE_PLUGINS, Markdown as Markdown$1, DropdownMenu, Input, SwitchInput, TextEllipsis, withDefaults, Button, LoadingOverlay, SingleFileInput, InputProvider as InputProvider$1, rendererSpecList, TextInput, withLabeledLayout, INPUTS, useLocalState } from '@orioro/react-ui-core';
8
9
  import initGdalJs from 'gdal3.js';
9
10
  import queryString from 'query-string';
10
11
  import { wrap } from 'comlink';
11
12
  import { dataMergeProtocol } from '@orioro/vector-tile-util';
12
13
  import maplibregl from 'maplibre-gl';
13
- import { get as get$1 } from '@orioro/get';
14
14
  import { buffer } from '@turf/turf';
15
15
  import { scaleQuantile } from 'd3-scale';
16
- import { fmtLayerAbsoluteId, waves_1, makeSyncedMaps, LayeredMap, svgImageGenerator, SVG_PATTERNS, useMapRegistry, useTilesLoading, HoverTooltip, layeredMapOnClickHandler, DynamicImages, ControlContainer, InspectControl, MapWindow, TerrainControl, fitGeometry } from '@orioro/react-maplibre-util';
16
+ import { SVG_PATTERNS, fmtLayerAbsoluteId, waves_1, ControlContainer, LayeredMap, makeSyncedMaps, svgImageGenerator, useMapRegistry, useTilesLoading, HoverTooltip, layeredMapOnClickHandler, DynamicImages, InspectControl, MapWindow, TerrainControl, fitGeometry } from '@orioro/react-maplibre-util';
17
+ import { cast, strAutoCast } from '@orioro/cast';
17
18
  import { csvParse } from 'd3-dsv';
18
- import { strAutoCast } from '@orioro/cast';
19
- import React$1, { useState, useMemo, useCallback, useContext, createContext, memo, useReducer, useEffect, useRef } from 'react';
19
+ import React$1, { useState, useMemo, useCallback, useContext, createContext, useRef, useEffect, forwardRef, useImperativeHandle, memo, useReducer } from 'react';
20
20
  import styled, { keyframes } from 'styled-components';
21
21
  import { colord } from 'colord';
22
- import { Heading, Portal, Badge, Tabs, Tooltip, IconButton, Theme, Text, Popover, Dialog } from '@radix-ui/themes';
23
- import { mdiSprout, mdiTree, mdiCurrencyUsd, mdiAccountMultipleOutline, mdiScaleBalance, mdiHelpCircleOutline, mdiDownload, mdiDotsVertical, mdiOpacity, mdiFilterVariant, mdiBookOpenVariant, mdiMap, mdiEarth, mdiHospitalBox, mdiHomeCity, mdiSchool, mdiAccountGroup, mdiContentCopy, mdiLinkVariant, mdiChevronLeft, mdiShareVariantOutline, mdiForumOutline, mdiDragVertical, mdiLayers, mdiClose, mdiHospital } from '@mdi/js';
22
+ import { Heading, Portal, Badge, Tabs, Tooltip, IconButton, Theme, Text, Popover, Strong } from '@radix-ui/themes';
23
+ import { mdiSprout, mdiTree, mdiCurrencyUsd, mdiAccountMultipleOutline, mdiScaleBalance, mdiHelpCircleOutline, mdiDownload, mdiDotsVertical, mdiOpacity, mdiFilterVariant, mdiBookOpenVariant, mdiMap, mdiEarth, mdiHospitalBox, mdiHomeCity, mdiSchool, mdiAccountGroup, mdiContentCopy, mdiLinkVariant, mdiNavigation, mdiChevronLeft, mdiForumOutline, mdiShareVariantOutline, mdiDragVertical, mdiLayers, mdiClose, mdiHospital } from '@mdi/js';
24
24
  import { Icon } from '@mdi/react';
25
25
  import Confetti from 'react-confetti';
26
26
  import { nodeIdFromPath } from '@orioro/tree-model';
@@ -35,12 +35,15 @@ import { CsvImportDialog } from '@orioro/react-csv';
35
35
  import Highlighter from 'react-highlight-words';
36
36
  import { LinkedinShareButton, LinkedinIcon, EmailShareButton, EmailIcon, FacebookShareButton, FacebookIcon, TwitterShareButton, TwitterIcon, WhatsappShareButton, WhatsappIcon } from 'react-share';
37
37
  import CopyToClipboard from 'react-copy-to-clipboard';
38
+ import { Legend } from '@orioro/react-chart-util';
39
+ import QRCode from 'react-qr-code';
40
+ import { useMap, useControl, AttributionControl, ScaleControl, GeolocateControl, FullscreenControl, NavigationControl } from 'react-map-gl/maplibre';
41
+ import { createPortal } from 'react-dom';
42
+ import { toBlob } from 'html-to-image';
38
43
  import { makeSortableMultiList } from '@orioro/react-sortable';
39
44
  import '@maplibre/maplibre-gl-inspect/dist/maplibre-gl-inspect.css';
40
- import { Legend } from '@orioro/react-chart-util';
41
45
  import 'maplibre-gl/dist/maplibre-gl.css';
42
46
  import { useQueries, useQuery } from '@tanstack/react-query';
43
- import { AttributionControl, GeolocateControl, FullscreenControl, NavigationControl, ScaleControl, useMap } from 'react-map-gl/maplibre';
44
47
  import { pointToTile, tileToBBOX } from '@mapbox/tilebelt';
45
48
 
46
49
  function _arrayLikeToArray(r, a) {
@@ -180,6 +183,9 @@ function _nonIterableRest() {
180
183
  function _nonIterableSpread() {
181
184
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
182
185
  }
186
+ function _objectDestructuringEmpty(t) {
187
+ if (null == t) throw new TypeError("Cannot destructure " + t);
188
+ }
183
189
  function ownKeys(e, r) {
184
190
  var t = Object.keys(e);
185
191
  if (Object.getOwnPropertySymbols) {
@@ -2931,7 +2937,10 @@ var D3_SEQUENTIAL = {
2931
2937
  schemeYlOrBr: schemeYlOrBr,
2932
2938
  schemeYlOrRd: schemeYlOrRd
2933
2939
  };
2934
- var COLOR_SCHEMES = __assign(__assign(__assign(__assign(__assign({}, _objMap(D3_CATEGORICAL, function (_a) {
2940
+ var SCHEME_GEOREDUS = ['#FF7F00', '#CAB2D6', '#FFE551', '#39BBA7', '#FB9A99', '#B15928', '#FDBF6F', '#DA5AD8', '#B4B282', '#6A3D9A'];
2941
+ var D3_COLOR_SCHEMES = __assign(__assign(__assign(__assign(__assign({
2942
+ schemeGeoReDUS: SCHEME_GEOREDUS
2943
+ }, _objMap(D3_CATEGORICAL, function (_a) {
2935
2944
  var id = _a[0],
2936
2945
  scheme = _a[1];
2937
2946
  return [id, _categoricalScheme(scheme)];
@@ -2952,6 +2961,96 @@ var COLOR_SCHEMES = __assign(__assign(__assign(__assign(__assign({}, _objMap(D3_
2952
2961
  scheme = _a[1];
2953
2962
  return ["-".concat(id), _reverseByKScheme(scheme)];
2954
2963
  }));
2964
+
2965
+ var GEOREDUS_LABELED_SAFE_COLORS = {
2966
+ laranja: {
2967
+ label: 'Laranja',
2968
+ value: '#FF7F00'
2969
+ },
2970
+ lilas: {
2971
+ label: 'Lilás',
2972
+ value: '#CAB2D6'
2973
+ },
2974
+ amarelo: {
2975
+ label: 'Amarelo',
2976
+ value: '#FFE551'
2977
+ },
2978
+ verde_agua: {
2979
+ label: 'Verde-água',
2980
+ value: '#39BBA7'
2981
+ },
2982
+ vermelho_claro: {
2983
+ label: 'Vermelho claro',
2984
+ value: '#FB9A99'
2985
+ },
2986
+ marrom: {
2987
+ label: 'Marrom',
2988
+ value: '#B15928'
2989
+ },
2990
+ laranja_claro: {
2991
+ label: 'Laranja claro',
2992
+ value: '#FDBF6F'
2993
+ },
2994
+ rosa: {
2995
+ label: 'Rosa',
2996
+ value: '#DA5AD8'
2997
+ },
2998
+ verde_marrom: {
2999
+ label: 'Verde-marrom',
3000
+ value: '#B4B282'
3001
+ },
3002
+ roxo: {
3003
+ label: 'Roxo',
3004
+ value: '#6A3D9A'
3005
+ }
3006
+ };
3007
+ var GEOREDUS_LABELED_RESTRICTED_USE_COLORS = {
3008
+ azul_claro: {
3009
+ label: 'Azul claro',
3010
+ value: '#A6CEE3'
3011
+ },
3012
+ azul: {
3013
+ label: 'Azul',
3014
+ value: '#1F78B4'
3015
+ },
3016
+ verde_claro: {
3017
+ label: 'Verde claro',
3018
+ value: '#B2DF8A'
3019
+ },
3020
+ verde: {
3021
+ label: 'Verde',
3022
+ value: '#33A02C'
3023
+ },
3024
+ vermelho: {
3025
+ label: 'Vermelho',
3026
+ value: '#E31A1C'
3027
+ },
3028
+ cinza_claro: {
3029
+ label: 'Cinza claro',
3030
+ value: '#CCCCCC'
3031
+ },
3032
+ cinza: {
3033
+ label: 'Cinza',
3034
+ value: '#828282'
3035
+ }
3036
+ };
3037
+ var GEOREDUS_LABELED_COLORS = __assign(__assign({}, GEOREDUS_LABELED_SAFE_COLORS), GEOREDUS_LABELED_RESTRICTED_USE_COLORS);
3038
+ var schemeGeoReDUS = Object.fromEntries(Object.entries(GEOREDUS_LABELED_COLORS).map(function (_a) {
3039
+ var key = _a[0],
3040
+ value = _a[1].value;
3041
+ return [key, value];
3042
+ }));
3043
+ var schemeGeoReDUSSafe = Object.fromEntries(Object.entries(GEOREDUS_LABELED_SAFE_COLORS).map(function (_a) {
3044
+ var key = _a[0],
3045
+ value = _a[1].value;
3046
+ return [key, value];
3047
+ }));
3048
+ var GEOREDUS_COLOR_SCHEMES = {
3049
+ schemeGeoReDUS: schemeGeoReDUS,
3050
+ schemeGeoReDUSSafe: schemeGeoReDUSSafe
3051
+ };
3052
+
3053
+ var COLOR_SCHEMES = __assign(__assign({}, D3_COLOR_SCHEMES), GEOREDUS_COLOR_SCHEMES);
2955
3054
  function colorScheme(path) {
2956
3055
  var scheme = get(COLOR_SCHEMES, path);
2957
3056
  if (!scheme) {
@@ -2959,6 +3058,13 @@ function colorScheme(path) {
2959
3058
  }
2960
3059
  return scheme;
2961
3060
  }
3061
+ function resolveColor(colorInput) {
3062
+ return colorInput ? get(COLOR_SCHEMES, colorInput) || colorInput : colorInput;
3063
+ }
3064
+ function resolveSchemeColor(colorSchemeId, indexOrId) {
3065
+ var colorScheme = COLOR_SCHEMES[colorSchemeId];
3066
+ return typeof indexOrId === 'string' ? colorScheme[indexOrId] : (Array.isArray(colorScheme) ? colorScheme : Object.values(colorScheme))[indexOrId];
3067
+ }
2962
3068
 
2963
3069
  //
2964
3070
  // Formats the filter to be a compatible searchParams for fetching
@@ -3267,7 +3373,7 @@ var _b = makeResolve({
3267
3373
  resolveExprAsync = _b.resolveAsync,
3268
3374
  resolveExpr = _b.resolve;
3269
3375
 
3270
- var EXTENSIONS_BY_FORMAT = {
3376
+ var EXTENSIONS_BY_FORMAT$1 = {
3271
3377
  GeoJSON: 'geojson',
3272
3378
  GPKG: 'gpkg',
3273
3379
  CSV: 'csv',
@@ -3398,9 +3504,9 @@ function downloadResolver(downloadConf) {
3398
3504
  });
3399
3505
  case 10:
3400
3506
  blob = _context.sent;
3401
- saveAs(blob, "".concat(typeof fileNameBase === 'function' ? fileNameBase({
3507
+ saveAs$1(blob, "".concat(typeof fileNameBase === 'function' ? fileNameBase({
3402
3508
  options: options
3403
- }) : fileNameBase, ".").concat(EXTENSIONS_BY_FORMAT[options.format]));
3509
+ }) : fileNameBase, ".").concat(EXTENSIONS_BY_FORMAT$1[options.format]));
3404
3510
  _context.next = 19;
3405
3511
  break;
3406
3512
  case 14:
@@ -3540,7 +3646,7 @@ function influenceAreaMetadata(_a) {
3540
3646
  getGeoJson = _c === void 0 ? _defaultGetGeoJson : _c,
3541
3647
  _d = _b.getConf,
3542
3648
  getConf = _d === void 0 ? function (context) {
3543
- return get$1(context, 'view.conf.data') || {};
3649
+ return get(context, 'view.conf.data') || {};
3544
3650
  } : _d;
3545
3651
  return {
3546
3652
  influenceArea: resolveAsync.fn(function (context) {
@@ -3631,12 +3737,12 @@ function influenceAreaLayers(_a) {
3631
3737
  };
3632
3738
  }
3633
3739
 
3634
- var _excluded$9 = ["version"];
3740
+ var _excluded$e = ["version"];
3635
3741
  function tableVectorSource(context, tableId) {
3636
3742
  var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
3637
3743
  _ref$version = _ref.version,
3638
3744
  version = _ref$version === void 0 ? '1' : _ref$version,
3639
- override = _objectWithoutProperties(_ref, _excluded$9);
3745
+ override = _objectWithoutProperties(_ref, _excluded$e);
3640
3746
  var VECTOR_TILE_SERVER_ENDPOINT = context.VECTOR_TILE_SERVER_ENDPOINT;
3641
3747
  return _objectSpread2({
3642
3748
  type: 'vector',
@@ -3818,7 +3924,7 @@ function numerical_size$1(base, _ref) {
3818
3924
  minSize: SIZE_MIN,
3819
3925
  maxSize: SIZE_MAX
3820
3926
  }), 10],
3821
- 'circle-color': get(COLOR_SCHEMES, color_scheme) || color_scheme
3927
+ 'circle-color': get$1(COLOR_SCHEMES, color_scheme) || color_scheme
3822
3928
  }
3823
3929
  })))
3824
3930
  });
@@ -3839,7 +3945,7 @@ function categorical$1(base, _ref) {
3839
3945
  var VECTOR_SOURCE_ID = "".concat(TABLE_ID, ".geom");
3840
3946
  categories = categories ? categories.map(function (category) {
3841
3947
  return _objectSpread2(_objectSpread2({}, category), {}, {
3842
- color: get(COLOR_SCHEMES, category.color) || category.color
3948
+ color: get$1(COLOR_SCHEMES, category.color) || category.color
3843
3949
  });
3844
3950
  }) : null;
3845
3951
  return _objectSpread2(_objectSpread2({}, base), {}, {
@@ -4014,11 +4120,11 @@ function cem_escolas_2022(config, allViewSpecs, context) {
4014
4120
  zIndex: Z_OVERLAY_MIDDLE_2000,
4015
4121
  dataPath: 'view.metadata.influenceArea',
4016
4122
  fillPaint: {
4017
- 'fill-color': get(COLOR_SCHEMES, 'schemeSet1.colors[1]'),
4123
+ 'fill-color': get$1(COLOR_SCHEMES, 'schemeSet1.colors[1]'),
4018
4124
  'fill-opacity': 0.3
4019
4125
  },
4020
4126
  boundaryPaint: {
4021
- 'line-color': get(COLOR_SCHEMES, 'schemeSet1.colors[1]'),
4127
+ 'line-color': get$1(COLOR_SCHEMES, 'schemeSet1.colors[1]'),
4022
4128
  'line-opacity': 0.8,
4023
4129
  'line-width': 2,
4024
4130
  'line-dasharray': [2, 2]
@@ -4165,6 +4271,7 @@ var VIEW_TYPE_SURFACE_CHOROPLETH = 'surface_choropleth';
4165
4271
 
4166
4272
  function parseSchema(viewSpec, allViewSpecs, context) {
4167
4273
  var collection_id = viewSpec.collection_id,
4274
+ source_table_id = viewSpec.source_table_id,
4168
4275
  indicator_path = viewSpec.indicator_path,
4169
4276
  indicator_id = viewSpec.indicator_id,
4170
4277
  indicator_label = viewSpec.indicator_label,
@@ -4199,6 +4306,7 @@ function parseSchema(viewSpec, allViewSpecs, context) {
4199
4306
  var sourceLabel = "CENSO ".concat(year);
4200
4307
  return {
4201
4308
  viewId: viewId,
4309
+ source_table_id: source_table_id,
4202
4310
  path: indicator_path,
4203
4311
  label: indicator_label,
4204
4312
  metodology: metodology,
@@ -4276,7 +4384,7 @@ function chartUtil(viewSpec, allViewSpecs, context) {
4276
4384
  }
4277
4385
 
4278
4386
  var DEFAULT_BUFFER_SIZE$1 = 200;
4279
- function confSchema(viewSpec, allViewSpecs, context, _ref) {
4387
+ function confSchema$4(viewSpec, allViewSpecs, context, _ref) {
4280
4388
  var PARSED_SCHEMA = _ref.PARSED_SCHEMA;
4281
4389
  var variable_id = viewSpec.variable_id;
4282
4390
  return {
@@ -4412,7 +4520,7 @@ var _resolveSourceBounds = resolve.fn(function (context) {
4412
4520
  return UNBOUNDED_BOUNDS;
4413
4521
  }
4414
4522
  });
4415
- function metadata$3(viewSpec, allViewSpecs, context, _ref2) {
4523
+ function metadata$8(viewSpec, allViewSpecs, context, _ref2) {
4416
4524
  var PARSED_SCHEMA = _ref2.PARSED_SCHEMA,
4417
4525
  DATA_UTIL = _ref2.DATA_UTIL,
4418
4526
  CHART_UTIL = _ref2.CHART_UTIL;
@@ -4544,7 +4652,7 @@ function dataUtil(viewSpec, allViewSpecs, context, _ref) {
4544
4652
  var PARSED_SCHEMA = _ref.PARSED_SCHEMA;
4545
4653
  var METADATA_API_ENDPOINT = context.METADATA_API_ENDPOINT;
4546
4654
  var _resolveDataUrl = resolve.fn(function (context) {
4547
- var _variableId = get$1(context, 'view.conf.data.variableId');
4655
+ var _variableId = get(context, 'view.conf.data.variableId');
4548
4656
  var _variant = PARSED_SCHEMA.variantsByVariableId[_variableId];
4549
4657
  var url = "".concat(METADATA_API_ENDPOINT, "/").concat(_variant.source_table_id, "?").concat($urlSearch([{
4550
4658
  select: ['cd_setor', _variableId].join(','),
@@ -4809,7 +4917,7 @@ function setor_censitario(viewSpec, allViewSpecs, context, _ref) {
4809
4917
  promoteId: 'cd_setor',
4810
4918
  bounds: _resolveSourceBounds,
4811
4919
  tiles: [resolve.fn(function (context) {
4812
- var _variableId = get$1(context, 'view.conf.data.variableId');
4920
+ var _variableId = get(context, 'view.conf.data.variableId');
4813
4921
  var _variant = PARSED_SCHEMA.variantsByVariableId[_variableId];
4814
4922
  return ['$vtxUrl', {
4815
4923
  tiles: "".concat(VECTOR_TILE_SERVER_ENDPOINT, "/dvt/{z}/{x}/{y}?").concat($urlSearch([{
@@ -4873,7 +4981,7 @@ function setor_censitario(viewSpec, allViewSpecs, context, _ref) {
4873
4981
  };
4874
4982
  }
4875
4983
 
4876
- function download$1(viewSpec, allViewSpecs, context, _ref) {
4984
+ function download$6(viewSpec, allViewSpecs, context, _ref) {
4877
4985
  var PARSED_SCHEMA = _ref.PARSED_SCHEMA;
4878
4986
  var METADATA_API_ENDPOINT = context.METADATA_API_ENDPOINT;
4879
4987
  return downloadResolver({
@@ -4943,7 +5051,7 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
4943
5051
  PARSED_SCHEMA: PARSED_SCHEMA,
4944
5052
  DATA_UTIL: DATA_UTIL
4945
5053
  });
4946
- var DOWNLOAD = download$1(viewSpec, allViewSpecs, context, {
5054
+ var DOWNLOAD = download$6(viewSpec, allViewSpecs, context, {
4947
5055
  PARSED_SCHEMA: PARSED_SCHEMA
4948
5056
  });
4949
5057
  return {
@@ -4955,10 +5063,10 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
4955
5063
  sourceLabel: PARSED_SCHEMA.sourceLabel,
4956
5064
  keywords: PARSED_SCHEMA.keywords,
4957
5065
  viewType: VIEW_TYPE_SURFACE_CHOROPLETH,
4958
- confSchema: confSchema(viewSpec, allViewSpecs, context, {
5066
+ confSchema: confSchema$4(viewSpec, allViewSpecs, context, {
4959
5067
  PARSED_SCHEMA: PARSED_SCHEMA
4960
5068
  }),
4961
- metadata: metadata$3(viewSpec, allViewSpecs, context, {
5069
+ metadata: metadata$8(viewSpec, allViewSpecs, context, {
4962
5070
  PARSED_SCHEMA: PARSED_SCHEMA,
4963
5071
  CHART_UTIL: CHART_UTIL,
4964
5072
  DATA_UTIL: DATA_UTIL
@@ -4976,7 +5084,7 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
4976
5084
  };
4977
5085
  }
4978
5086
 
4979
- function download(context, _ref) {
5087
+ function download$5(context, _ref) {
4980
5088
  var PARSED_SCHEMA = _ref.PARSED_SCHEMA;
4981
5089
  var METADATA_API_ENDPOINT = context.METADATA_API_ENDPOINT;
4982
5090
  return downloadResolver({
@@ -5096,7 +5204,7 @@ function _defaultMetadata() {
5096
5204
  GLOBAL_CONTEXT = _ref2.GLOBAL_CONTEXT, PARSED_SCHEMA = _ref2.PARSED_SCHEMA;
5097
5205
  METADATA_API_ENDPOINT = GLOBAL_CONTEXT.METADATA_API_ENDPOINT; // Load data on the municipio
5098
5206
  municipioId = context.app.municipioId;
5099
- variableId = get$1(context, 'view.conf.data.variableId');
5207
+ variableId = get(context, 'view.conf.data.variableId');
5100
5208
  variant = PARSED_SCHEMA.variantsByVariableId[variableId]; //
5101
5209
  // The rawDataCacheUrl should be shared with following pipeline steps
5102
5210
  // so that it may be effectively cached
@@ -5111,7 +5219,7 @@ function _defaultMetadata() {
5111
5219
  return vtx.memoFetchData(rawDataCacheUrl);
5112
5220
  case 8:
5113
5221
  rawData = _context.sent;
5114
- scaleValues = get$1(rawData, "[].".concat(variableId));
5222
+ scaleValues = get(rawData, "[].".concat(variableId));
5115
5223
  colorScheme = _censoColorScheme(variant.colorScheme);
5116
5224
  colorScaleStops = variant.classificationMethod === 'quantile(5)' ? _quantileBreakpoints(_objectSpread2({
5117
5225
  k: 5,
@@ -5203,7 +5311,7 @@ function _customGeoJSON_metadata() {
5203
5311
  });
5204
5312
  variableId = context.view.conf.data.variableId;
5205
5313
  variant = PARSED_SCHEMA.variantsByVariableId[variableId]; //
5206
- // Fetch variable values using rpc aggregate_by_geojson
5314
+ // Fetch variable values using rpc aggregate_by_geojson with join
5207
5315
  //
5208
5316
  _context.next = 13;
5209
5317
  return fetch("".concat(GLOBAL_CONTEXT.METADATA_API_ENDPOINT, "/rpc/aggregate_by_geojson"), {
@@ -5215,9 +5323,12 @@ function _customGeoJSON_metadata() {
5215
5323
  geometries: AREAS_FEATURES.map(function (feat) {
5216
5324
  return feat.geometry;
5217
5325
  }),
5218
- view: "ibge_malha_br_setor_censitario_".concat(PARSED_SCHEMA.year, "_spatial_agg"),
5326
+ view: "".concat(PARSED_SCHEMA.source_table_id),
5327
+ // no more need to generate a single unique table with all variables, since we are now sending the source table id in the body of the request to perform the join and aggregation in the backend
5328
+ join_table: "ibge_malha_br_setor_censitario_".concat(PARSED_SCHEMA.year),
5329
+ // added in order to perform the join in the backend
5219
5330
  agg_column: variableId,
5220
- agg_type: variableId.endsWith('_pct') ? 'weighted_avg' : 'sum'
5331
+ agg_type: variableId.endsWith('_2') ? 'weighted_avg' : 'sum' // _2 is the new suffix to indicate percentage variables
5221
5332
  })
5222
5333
  }).then(function (res) {
5223
5334
  return res.json();
@@ -5334,7 +5445,7 @@ function customGeoJson_layers(opts) {
5334
5445
  };
5335
5446
  }
5336
5447
 
5337
- function metadata$2(opts) {
5448
+ function metadata$7(opts) {
5338
5449
  return resolveAsync.fn(/*#__PURE__*/function () {
5339
5450
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(context) {
5340
5451
  var _context$view;
@@ -5380,7 +5491,7 @@ function buildings_sources(_ref) {
5380
5491
  minzoom: BUILDINGS_MIN_ZOOM,
5381
5492
  maxzoom: BUILDINGS_MIN_ZOOM,
5382
5493
  tiles: [resolve.fn(function (context) {
5383
- var variableId = get$1(context, 'view.conf.data.variableId');
5494
+ var variableId = get(context, 'view.conf.data.variableId');
5384
5495
  var variant = PARSED_SCHEMA.variantsByVariableId[variableId];
5385
5496
  return ['$vtxUrl', {
5386
5497
  tiles: "".concat(VECTOR_TILE_SERVER_ENDPOINT, "/").concat(BUILDINGS_SOURCE_ID, "/{z}/{x}/{y}"),
@@ -5482,7 +5593,7 @@ function setor_censitario_sources(_ref2) {
5482
5593
  // bounds: ['$get', 'view.metadata.municipioData.group_bbox'],
5483
5594
  promoteId: 'id',
5484
5595
  tiles: [resolve.fn(function (context) {
5485
- var variableId = get$1(context, 'view.conf.data.variableId');
5596
+ var variableId = get(context, 'view.conf.data.variableId');
5486
5597
  var variant = PARSED_SCHEMA.variantsByVariableId[variableId];
5487
5598
  return ['$vtxUrl', {
5488
5599
  tiles: "".concat(VECTOR_TILE_SERVER_ENDPOINT, "/").concat(SETOR_CENSITARIO_SOURCE_ID, "/{z}/{x}/{y}"),
@@ -5528,8 +5639,8 @@ function setor_censitario_layers(opts) {
5528
5639
  tooltip: {
5529
5640
  title: ['$literal', ['$template', 'Setor censitário ${0}', ['$get', 'feature.properties.id']]],
5530
5641
  entries: ['$literal', resolve.fn(function (context) {
5531
- var variableId = get$1(context, 'view.conf.data.variableId');
5532
- var variableLabel = get$1(context, "view.metadata.labels.".concat(variableId));
5642
+ var variableId = get(context, 'view.conf.data.variableId');
5643
+ var variableLabel = get(context, "view.metadata.labels.".concat(variableId));
5533
5644
  var mainValueDisplay;
5534
5645
  if (variableId === 'total_pessoas_por_km2') {
5535
5646
  try {
@@ -5540,8 +5651,8 @@ function setor_censitario_layers(opts) {
5540
5651
  mainValueDisplay = null;
5541
5652
  }
5542
5653
  } else {
5543
- var value = get$1(context, 'feature.properties.value');
5544
- var isPercentage = variableId.endsWith('_pct');
5654
+ var value = get(context, 'feature.properties.value');
5655
+ var isPercentage = variableId.endsWith('_2'); // _2 is the new suffix to indicate percentage variables
5545
5656
  var format = isPercentage ? {
5546
5657
  style: 'percent'
5547
5658
  } : {};
@@ -5593,7 +5704,7 @@ function setor_censitario_layers(opts) {
5593
5704
  filter: _filter,
5594
5705
  paint: {
5595
5706
  'line-color': resolve.fn(function (context) {
5596
- var variableId = get$1(context, 'view.conf.data.variableId');
5707
+ var variableId = get(context, 'view.conf.data.variableId');
5597
5708
  var variant = PARSED_SCHEMA.variantsByVariableId[variableId];
5598
5709
  return _censoColorScheme(variant.colorScheme).scalesByK[3][2];
5599
5710
  }),
@@ -5608,7 +5719,7 @@ function setor_censitario_layers(opts) {
5608
5719
  }
5609
5720
 
5610
5721
  var intramun = {
5611
- metadata: metadata$2,
5722
+ metadata: metadata$7,
5612
5723
  sources: function sources(opts) {
5613
5724
  return _objectSpread2(_objectSpread2(_objectSpread2({}, setor_censitario_sources(opts)), buildings_sources(opts)), customGeoJson_sources());
5614
5725
  },
@@ -5618,7 +5729,7 @@ var intramun = {
5618
5729
  };
5619
5730
 
5620
5731
  var DEFAULT_COLOR_SCHEME$1 = COLOR_SCHEMES.schemeOranges;
5621
- function metadata$1(_ref) {
5732
+ function metadata$6(_ref) {
5622
5733
  var GLOBAL_CONTEXT = _ref.GLOBAL_CONTEXT,
5623
5734
  PARSED_SCHEMA = _ref.PARSED_SCHEMA;
5624
5735
  var METADATA_API_ENDPOINT = GLOBAL_CONTEXT.METADATA_API_ENDPOINT;
@@ -5648,7 +5759,7 @@ function metadata$1(_ref) {
5648
5759
  }
5649
5760
  throw new Error("Municipio not found: ".concat(municipioId));
5650
5761
  case 9:
5651
- variableId = get$1(context, 'view.conf.data.variableId');
5762
+ variableId = get(context, 'view.conf.data.variableId');
5652
5763
  variant = PARSED_SCHEMA.variantsByVariableId[variableId]; //
5653
5764
  // The rawDataCacheUrl should be shared with following pipeline steps
5654
5765
  // so that it may be effectively cached
@@ -5666,7 +5777,7 @@ function metadata$1(_ref) {
5666
5777
  //
5667
5778
  // Use values for the focusMunicipio to build the scale
5668
5779
  //
5669
- scaleValues = get$1(rawData, "[].".concat(variableId));
5780
+ scaleValues = get(rawData, "[].".concat(variableId));
5670
5781
  colorScheme = variant.colorScheme ? COLOR_SCHEMES[variant.colorScheme] || DEFAULT_COLOR_SCHEME$1 : DEFAULT_COLOR_SCHEME$1;
5671
5782
  return _context.abrupt("return", {
5672
5783
  ufData: ufData,
@@ -5705,7 +5816,7 @@ function municipio_sources$1(_ref) {
5705
5816
  bounds: ['$get', 'view.metadata.ufData.bbox'],
5706
5817
  promoteId: 'id',
5707
5818
  tiles: [resolve.fn(function (context) {
5708
- get$1(context, 'view.conf.data.variableId');
5819
+ get(context, 'view.conf.data.variableId');
5709
5820
  return ['$vtxUrl', {
5710
5821
  tiles: "".concat(VECTOR_TILE_SERVER_ENDPOINT, "/").concat(MUNICIPIO_SOURCE_ID$1, "/{z}/{x}/{y}"),
5711
5822
  data: [['id', ['$get', 'view.metadata.rawDataCacheUrl']]]
@@ -5743,7 +5854,7 @@ function municipio_layers$1() {
5743
5854
  }
5744
5855
 
5745
5856
  var intrauf = {
5746
- metadata: metadata$1,
5857
+ metadata: metadata$6,
5747
5858
  sources: function sources(opts) {
5748
5859
  return _objectSpread2({}, municipio_sources$1(opts));
5749
5860
  },
@@ -5753,7 +5864,7 @@ var intrauf = {
5753
5864
  };
5754
5865
 
5755
5866
  var DEFAULT_COLOR_SCHEME = COLOR_SCHEMES.schemeOranges;
5756
- function metadata(_ref) {
5867
+ function metadata$5(_ref) {
5757
5868
  var GLOBAL_CONTEXT = _ref.GLOBAL_CONTEXT,
5758
5869
  PARSED_SCHEMA = _ref.PARSED_SCHEMA;
5759
5870
  var METADATA_API_ENDPOINT = GLOBAL_CONTEXT.METADATA_API_ENDPOINT;
@@ -5782,7 +5893,7 @@ function metadata(_ref) {
5782
5893
  }
5783
5894
  throw new Error("BR data not found");
5784
5895
  case 9:
5785
- variableId = get$1(context, 'view.conf.data.variableId');
5896
+ variableId = get(context, 'view.conf.data.variableId');
5786
5897
  variant = PARSED_SCHEMA.variantsByVariableId[variableId]; //
5787
5898
  // The rawDataCacheUrl should be shared with following pipeline steps
5788
5899
  // so that it may be effectively cached
@@ -5799,7 +5910,7 @@ function metadata(_ref) {
5799
5910
  //
5800
5911
  // Use values for the focusMunicipio to build the scale
5801
5912
  //
5802
- scaleValues = get$1(rawData, "[].".concat(variableId));
5913
+ scaleValues = get(rawData, "[].".concat(variableId));
5803
5914
  colorScheme = variant.colorScheme ? COLOR_SCHEMES[variant.colorScheme] || DEFAULT_COLOR_SCHEME : DEFAULT_COLOR_SCHEME;
5804
5915
  return _context.abrupt("return", {
5805
5916
  brData: brData,
@@ -5838,7 +5949,7 @@ function municipio_sources(_ref) {
5838
5949
  bounds: ['$get', 'view.metadata.brData.bbox'],
5839
5950
  promoteId: 'id',
5840
5951
  tiles: [resolve.fn(function (context) {
5841
- get$1(context, 'view.conf.data.variableId');
5952
+ get(context, 'view.conf.data.variableId');
5842
5953
  return ['$vtxUrl', {
5843
5954
  tiles: "".concat(VECTOR_TILE_SERVER_ENDPOINT, "/").concat(MUNICIPIO_SOURCE_ID, "/{z}/{x}/{y}"),
5844
5955
  data: [['id', ['$get', 'view.metadata.rawDataCacheUrl']]]
@@ -5873,7 +5984,7 @@ function municipio_layers() {
5873
5984
  }
5874
5985
 
5875
5986
  var intrabr = {
5876
- metadata: metadata,
5987
+ metadata: metadata$5,
5877
5988
  sources: function sources(opts) {
5878
5989
  return _objectSpread2({}, municipio_sources(opts));
5879
5990
  },
@@ -5908,14 +6019,14 @@ function cem_censo_2022(viewSpec, allViewSpecs, context) {
5908
6019
  if (!PARSED_SCHEMA) {
5909
6020
  return null;
5910
6021
  }
5911
- var DOWNLOAD = download(context, {
6022
+ var DOWNLOAD = download$5(context, {
5912
6023
  PARSED_SCHEMA: PARSED_SCHEMA
5913
6024
  });
5914
6025
  var CHOROPLETH = choropleth({
5915
6026
  GLOBAL_CONTEXT: context,
5916
6027
  PARSED_SCHEMA: PARSED_SCHEMA
5917
6028
  });
5918
- var CONF_SCHEMA = confSchema(viewSpec, allViewSpecs, context, {
6029
+ var CONF_SCHEMA = confSchema$4(viewSpec, allViewSpecs, context, {
5919
6030
  PARSED_SCHEMA: PARSED_SCHEMA
5920
6031
  });
5921
6032
  return {
@@ -5987,7 +6098,7 @@ function numerical_size(base, _ref) {
5987
6098
  minSize: SIZE_MIN,
5988
6099
  maxSize: SIZE_MAX
5989
6100
  }), 10],
5990
- 'circle-color': get(COLOR_SCHEMES, color_scheme) || color_scheme
6101
+ 'circle-color': get$1(COLOR_SCHEMES, color_scheme) || color_scheme
5991
6102
  }
5992
6103
  })))
5993
6104
  });
@@ -6009,7 +6120,7 @@ function categorical(base, _ref) {
6009
6120
  var VECTOR_SOURCE_ID = "".concat(TABLE_ID, ".geom");
6010
6121
  categories = categories ? categories.map(function (category) {
6011
6122
  return _objectSpread2(_objectSpread2({}, category), {}, {
6012
- color: get(COLOR_SCHEMES, category.color) || category.color
6123
+ color: get$1(COLOR_SCHEMES, category.color) || category.color
6013
6124
  });
6014
6125
  }) : null;
6015
6126
  var $circleColor = categories ? ['match', ['to-string', ['get', VARIABLE_ID]]].concat(_toConsumableArray(categories.flatMap(function (category) {
@@ -6315,7 +6426,341 @@ function cem_saude_2024(viewSpec, allViewSpecs, context) {
6315
6426
  }));
6316
6427
  }
6317
6428
 
6318
- var _excluded$8 = ["label", "color", "line", "fill", "tiles", "source_layer", "sources", "layers"];
6429
+ var DEFAULT_FILL_OPACITY$1 = 0.5;
6430
+ function applyOpacity(color, alpha) {
6431
+ if (color.startsWith('#')) {
6432
+ var hex = color;
6433
+ if (hex.length === 4) {
6434
+ hex = '#' + __spreadArray([], hex.slice(1), true).map(function (c) {
6435
+ return c + c;
6436
+ }).join('');
6437
+ }
6438
+ var r = parseInt(hex.slice(1, 3), 16);
6439
+ var g = parseInt(hex.slice(3, 5), 16);
6440
+ var b = parseInt(hex.slice(5, 7), 16);
6441
+ return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(alpha, ")");
6442
+ }
6443
+ console.warn("applyOpacity: unsupported color format \"".concat(color, "\", returning as-is"));
6444
+ return color;
6445
+ }
6446
+
6447
+ function parseTiles(tiles, context) {
6448
+ var parsedTiles = Array.isArray(tiles) ? tiles : typeof tiles === 'string' ? [tiles] : null;
6449
+ if (!parsedTiles) {
6450
+ throw new Error("tiles is required");
6451
+ }
6452
+ return parsedTiles.map(function (tileSrcUrl) {
6453
+ return interpolate(tileSrcUrl, context);
6454
+ });
6455
+ }
6456
+
6457
+ var LOWERCASE_WORDS = new Set(['de', 'da', 'do', 'das', 'dos', 'e', 'a', 'o', 'as', 'os', 'em', 'no', 'na', 'nos', 'nas', 'por', 'para', 'com', 'sem']);
6458
+ function humanize(str) {
6459
+ if (!str) return '';
6460
+ return str.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/[-_]+/g, ' ').replace(/\s+/g, ' ').trim().toLowerCase().replace(/(^\S+|\s\S+)/g, function (match, _, offset) {
6461
+ var word = match.trim();
6462
+ var isFirst = offset === 0;
6463
+ return isFirst || !LOWERCASE_WORDS.has(word) ? match.replace(word[0], word[0].toUpperCase()) : match;
6464
+ });
6465
+ }
6466
+
6467
+ function basicTooltip() {
6468
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
6469
+ title = _ref.title,
6470
+ entries = _ref.entries;
6471
+ var titleKey = title || 'name';
6472
+ return {
6473
+ title: ['$literal', resolve.fn(function (ctx) {
6474
+ var _ctx$feature;
6475
+ return ctx === null || ctx === void 0 || (_ctx$feature = ctx.feature) === null || _ctx$feature === void 0 || (_ctx$feature = _ctx$feature.properties) === null || _ctx$feature === void 0 ? void 0 : _ctx$feature[titleKey];
6476
+ })],
6477
+ entries: ['$literal', resolve.fn(function (ctx) {
6478
+ var _ctx$feature2;
6479
+ if (_typeof((_ctx$feature2 = ctx.feature) === null || _ctx$feature2 === void 0 ? void 0 : _ctx$feature2.properties) !== 'object') {
6480
+ return [];
6481
+ }
6482
+ var entrySpecs = Array.isArray(entries) ? Object.fromEntries(entries.map(function (spec) {
6483
+ return typeof spec === 'string' ? [spec, {
6484
+ label: humanize(spec)
6485
+ }] : [spec.key, spec];
6486
+ })) : _typeof(entries) === 'object' ? entries : Object.fromEntries(Object.keys(ctx.feature.properties).filter(function (key) {
6487
+ return key !== titleKey;
6488
+ }).map(function (key) {
6489
+ return [key, {
6490
+ label: humanize(key)
6491
+ }];
6492
+ }));
6493
+ return Object.entries(entrySpecs).map(function (_ref2) {
6494
+ var _ctx$feature3;
6495
+ var _ref3 = _slicedToArray(_ref2, 2),
6496
+ key = _ref3[0],
6497
+ spec = _ref3[1];
6498
+ spec = typeof spec === 'string' ? {
6499
+ label: spec
6500
+ } : spec;
6501
+ var _spec = spec,
6502
+ label = _spec.label,
6503
+ format = _spec.format;
6504
+ return [label, cast(_objectSpread2({
6505
+ type: 'string'
6506
+ }, format), (_ctx$feature3 = ctx.feature) === null || _ctx$feature3 === void 0 ? void 0 : _ctx$feature3.properties[key])];
6507
+ });
6508
+ })]
6509
+ };
6510
+ }
6511
+
6512
+ var GEOMETRY_KEY = 'geom';
6513
+ var EXTENSIONS_BY_FORMAT = {
6514
+ GeoJSON: 'geojson',
6515
+ GPKG: 'gpkg',
6516
+ CSV: 'csv',
6517
+ KML: 'kml'
6518
+ };
6519
+ var OPTIONS_SCHEMA = {
6520
+ format: {
6521
+ label: 'Selecione o formato do arquivo',
6522
+ type: 'radioSelect',
6523
+ required: true,
6524
+ options: [
6525
+ // {
6526
+ // value: 'CSV',
6527
+ // label: 'Planilha CSV (dados tabulares separados por vírgulas)',
6528
+ // },
6529
+ {
6530
+ value: 'GPKG',
6531
+ label: 'GeoPackage (banco de dados geoespacial compacto)'
6532
+ }, {
6533
+ value: 'GeoJSON',
6534
+ label: 'GeoJSON (dados geográficos em JSON)'
6535
+ }, {
6536
+ value: 'KML',
6537
+ label: 'KML (Keyhole Markup Language - mapas em XML)'
6538
+ }]
6539
+ }
6540
+ };
6541
+ function basicDownload(_ref) {
6542
+ var fileName = _ref.fileName,
6543
+ downloadUrl = _ref.downloadUrl;
6544
+ return resolve.fn(function (ctx) {
6545
+ return /*#__PURE__*/function () {
6546
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
6547
+ var dialogs, options;
6548
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
6549
+ while (1) switch (_context2.prev = _context2.next) {
6550
+ case 0:
6551
+ dialogs = _ref2.dialogs;
6552
+ _context2.next = 3;
6553
+ return dialogs.prompt({
6554
+ title: 'Baixar dados',
6555
+ submit: 'Baixar',
6556
+ input: {
6557
+ type: 'object',
6558
+ properties: OPTIONS_SCHEMA
6559
+ },
6560
+ defaultValue: {
6561
+ format: 'GPKG'
6562
+ }
6563
+ });
6564
+ case 3:
6565
+ options = _context2.sent;
6566
+ _context2.next = 6;
6567
+ return dialogs.loading(/*#__PURE__*/function () {
6568
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref4) {
6569
+ var setMessage, data, geoJsonData, blob;
6570
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
6571
+ while (1) switch (_context.prev = _context.next) {
6572
+ case 0:
6573
+ setMessage = _ref4.setMessage;
6574
+ _context.next = 3;
6575
+ return fetch(downloadUrl).then(function (res) {
6576
+ return res.json();
6577
+ });
6578
+ case 3:
6579
+ data = _context.sent;
6580
+ //
6581
+ // Build a geoJson data object
6582
+ //
6583
+ geoJsonData = {
6584
+ type: 'FeatureCollection',
6585
+ features: data.map(function (entry) {
6586
+ var geometry = entry[GEOMETRY_KEY];
6587
+ return {
6588
+ type: 'Feature',
6589
+ properties: omit(entry, [GEOMETRY_KEY]),
6590
+ geometry: geometry
6591
+ };
6592
+ })
6593
+ };
6594
+ _context.prev = 5;
6595
+ setMessage('Preparando arquivo');
6596
+ //
6597
+ // Convert to requested format using ogr2ogr
6598
+ //
6599
+ _context.next = 9;
6600
+ return ogr2ogr({
6601
+ src: geoJsonData,
6602
+ format: options.format
6603
+ });
6604
+ case 9:
6605
+ blob = _context.sent;
6606
+ saveAs(blob, "".concat(fileName, ".").concat(EXTENSIONS_BY_FORMAT[options.format]));
6607
+ _context.next = 18;
6608
+ break;
6609
+ case 13:
6610
+ _context.prev = 13;
6611
+ _context.t0 = _context["catch"](5);
6612
+ console.error(_context.t0.message);
6613
+ _context.next = 18;
6614
+ return dialogs.info("Ocorreu um erro ao gerar o arquivo: ".concat(_context.t0.message));
6615
+ case 18:
6616
+ case "end":
6617
+ return _context.stop();
6618
+ }
6619
+ }, _callee, null, [[5, 13]]);
6620
+ }));
6621
+ return function (_x2) {
6622
+ return _ref5.apply(this, arguments);
6623
+ };
6624
+ }(), 'Carregando dados');
6625
+ case 6:
6626
+ case "end":
6627
+ return _context2.stop();
6628
+ }
6629
+ }, _callee2);
6630
+ }));
6631
+ return function (_x) {
6632
+ return _ref3.apply(this, arguments);
6633
+ };
6634
+ }();
6635
+ });
6636
+ }
6637
+
6638
+ var COLOR_OPTIONS = Object.values(GEOREDUS_LABELED_COLORS);
6639
+ function colorSelector(_initialColor) {
6640
+ return {
6641
+ label: 'Cor',
6642
+ helperText: 'Selecione a cor para a camada',
6643
+ type: 'select',
6644
+ clearable: false,
6645
+ defaultValue: _initialColor,
6646
+ options: COLOR_OPTIONS.map(function (opt) {
6647
+ return _objectSpread2(_objectSpread2({}, opt), {}, {
6648
+ label: /*#__PURE__*/React.createElement(Flex, {
6649
+ direction: "row",
6650
+ alignItems: "center",
6651
+ gap: "2"
6652
+ }, /*#__PURE__*/React.createElement("div", {
6653
+ style: {
6654
+ width: '15px',
6655
+ height: '15px',
6656
+ backgroundColor: opt.value
6657
+ }
6658
+ }), /*#__PURE__*/React.createElement("div", null, opt.label))
6659
+ });
6660
+ })
6661
+ };
6662
+ }
6663
+ function svgBgImage$2(svg) {
6664
+ return "url(\"data:image/svg+xml,".concat(encodeURIComponent(svg), "\")");
6665
+ }
6666
+ var FILL_PATTERN_SOLID = 'solid';
6667
+ var FILL_PATTERN_OPTIONS$1 = [{
6668
+ label: 'Preenchido',
6669
+ value: FILL_PATTERN_SOLID
6670
+ }, {
6671
+ label: 'Quadrados',
6672
+ value: 'squares_1'
6673
+ }, {
6674
+ label: 'Triângulos',
6675
+ value: 'triangles_1'
6676
+ }, {
6677
+ label: 'Diamantes',
6678
+ value: 'diamonds_1'
6679
+ }, {
6680
+ label: 'Cruz',
6681
+ value: 'cross_1'
6682
+ }, {
6683
+ label: 'Mosaico 1',
6684
+ value: 'mosaic_1'
6685
+ }, {
6686
+ label: 'Mosaico 2',
6687
+ value: 'mosaic_2'
6688
+ }, {
6689
+ label: 'Ondas',
6690
+ value: 'waves_1'
6691
+ }, {
6692
+ label: 'Círculos',
6693
+ value: 'circles_1'
6694
+ }, {
6695
+ label: 'Linhas',
6696
+ value: 'lines_1'
6697
+ }];
6698
+ function fillPatternSelector() {
6699
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6700
+ return _objectSpread2({
6701
+ label: 'Textura',
6702
+ type: 'select',
6703
+ clearable: false,
6704
+ defaultValue: FILL_PATTERN_SOLID,
6705
+ options: FILL_PATTERN_OPTIONS$1.map(function (opt) {
6706
+ var pattern = opt.value === FILL_PATTERN_SOLID ? null : svgBgImage$2(SVG_PATTERNS[opt.value]({
6707
+ scale: '0.25'
6708
+ }));
6709
+ return _objectSpread2(_objectSpread2({}, opt), {}, {
6710
+ label: /*#__PURE__*/React.createElement(Flex, {
6711
+ direction: "row",
6712
+ alignItems: "center",
6713
+ gap: "2"
6714
+ }, /*#__PURE__*/React.createElement("div", {
6715
+ style: _objectSpread2({
6716
+ width: 15,
6717
+ height: 15,
6718
+ border: '1px solid #aaa'
6719
+ }, pattern ? {
6720
+ backgroundImage: pattern
6721
+ } : {
6722
+ backgroundColor: '#ccc'
6723
+ })
6724
+ }), /*#__PURE__*/React.createElement("div", null, " ", opt.label))
6725
+ });
6726
+ })
6727
+ }, props);
6728
+ }
6729
+
6730
+ var _excluded$d = ["label", "color", "line", "fill", "tiles", "source_layer", "sources", "layers", "fill_pattern"];
6731
+ var SOLID = 'solid';
6732
+ var DEFAULT_FILL_OPACITY = 0.5;
6733
+ var FILL_PATTERN_OPTIONS = [{
6734
+ label: 'Preenchido',
6735
+ value: SOLID
6736
+ }, {
6737
+ label: 'Quadrados',
6738
+ value: 'squares_1'
6739
+ }, {
6740
+ label: 'Triângulos',
6741
+ value: 'triangles_1'
6742
+ }, {
6743
+ label: 'Diamantes',
6744
+ value: 'diamonds_1'
6745
+ }, {
6746
+ label: 'Cruz',
6747
+ value: 'cross_1'
6748
+ }, {
6749
+ label: 'Mosaico 1',
6750
+ value: 'mosaic_1'
6751
+ }, {
6752
+ label: 'Mosaico 2',
6753
+ value: 'mosaic_2'
6754
+ }, {
6755
+ label: 'Ondas',
6756
+ value: 'waves_1'
6757
+ }, {
6758
+ label: 'Círculos',
6759
+ value: 'circles_1'
6760
+ }, {
6761
+ label: 'Linhas',
6762
+ value: 'lines_1'
6763
+ }];
6319
6764
  function _parseTiles$2(tiles, context) {
6320
6765
  tiles = Array.isArray(tiles) ? tiles : typeof tiles === 'string' ? [tiles] : null;
6321
6766
  if (!tiles) {
@@ -6325,6 +6770,9 @@ function _parseTiles$2(tiles, context) {
6325
6770
  return interpolate(tileSrcUrl, context);
6326
6771
  });
6327
6772
  }
6773
+ function svgBgImage$1(svg) {
6774
+ return "url(\"data:image/svg+xml,".concat(encodeURIComponent(svg), "\")");
6775
+ }
6328
6776
  function vector_polygon(_ref, allViewSpecs, context) {
6329
6777
  var label = _ref.label,
6330
6778
  color = _ref.color,
@@ -6338,12 +6786,87 @@ function vector_polygon(_ref, allViewSpecs, context) {
6338
6786
  sources = _ref$sources === void 0 ? {} : _ref$sources,
6339
6787
  _ref$layers = _ref.layers,
6340
6788
  layers = _ref$layers === void 0 ? {} : _ref$layers,
6341
- props = _objectWithoutProperties(_ref, _excluded$8);
6789
+ fill_pattern = _ref.fill_pattern,
6790
+ props = _objectWithoutProperties(_ref, _excluded$d);
6342
6791
  if (!source_layer) {
6343
6792
  throw new Error('source_layer must be defined');
6344
6793
  }
6794
+ var _initialColor = resolveColor(color);
6795
+ var _color = resolve.fn(function (ctx) {
6796
+ var _ctx$view;
6797
+ return resolveColor((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.color) || _initialColor;
6798
+ });
6799
+ var _legend = resolve.fn(_color, function (_resolvedColor, ctx) {
6800
+ var _ctx$view2;
6801
+ var resolvedFillPattern = ((_ctx$view2 = ctx.view) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.conf) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.style) === null || _ctx$view2 === void 0 ? void 0 : _ctx$view2.fillPattern) || fill_pattern;
6802
+ var legendItemProps = resolvedFillPattern || line ? {
6803
+ box: {
6804
+ style: _objectSpread2({
6805
+ borderColor: line !== null && line !== void 0 && line.paint && line.paint['line-color'] ? line.paint['line-color'] : _resolvedColor,
6806
+ borderStyle: line !== null && line !== void 0 && line.paint && line.paint['line-dasharray'] ? 'dashed' : 'solid',
6807
+ borderWidth: '1px'
6808
+ }, resolvedFillPattern && resolvedFillPattern !== SOLID ? {
6809
+ backgroundColor: 'transparent',
6810
+ backgroundImage: resolvedFillPattern && typeof SVG_PATTERNS[resolvedFillPattern] === 'function' ? svgBgImage$1(SVG_PATTERNS[resolvedFillPattern]({
6811
+ stroke: _resolvedColor,
6812
+ scale: '0.25'
6813
+ })) : ''
6814
+ } : {})
6815
+ }
6816
+ } : {};
6817
+ return {
6818
+ type: 'CategoricalLegend',
6819
+ items: [_objectSpread2({
6820
+ label: label,
6821
+ color: _color
6822
+ }, legendItemProps)]
6823
+ };
6824
+ });
6825
+ var _fillPaint = resolve.fn(_color, function (_resolvedColor, ctx) {
6826
+ var _ctx$view3;
6827
+ var resolvedFillPattern = ((_ctx$view3 = ctx.view) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.conf) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.style) === null || _ctx$view3 === void 0 ? void 0 : _ctx$view3.fillPattern) || fill_pattern;
6828
+ var resolvedFillPatternStr = resolvedFillPattern && resolvedFillPattern !== SOLID ? "".concat(resolvedFillPattern, "({ stroke: \"").concat(_resolvedColor, "\", scale: 0.5 })") : null;
6829
+ return _objectSpread2(_objectSpread2({
6830
+ 'fill-opacity': fill.paint && fill.paint['fill-opacity'] ? fill.paint['fill-opacity'] : DEFAULT_FILL_OPACITY,
6831
+ 'fill-color': _color
6832
+ }, fill['paint']), resolvedFillPatternStr ? {
6833
+ 'fill-pattern': resolvedFillPatternStr
6834
+ } : {});
6835
+ });
6345
6836
  return _objectSpread2(_objectSpread2({}, props), {}, {
6346
6837
  label: label,
6838
+ confSchema: {
6839
+ style: {
6840
+ color: colorSelector(_initialColor),
6841
+ fillPattern: {
6842
+ label: 'Textura',
6843
+ type: 'select',
6844
+ clearable: false,
6845
+ defaultValue: fill_pattern || SOLID,
6846
+ options: FILL_PATTERN_OPTIONS.map(function (opt) {
6847
+ var pattern = opt.value === SOLID ? null : svgBgImage$1(SVG_PATTERNS[opt.value]({
6848
+ scale: '0.25'
6849
+ }));
6850
+ return _objectSpread2(_objectSpread2({}, opt), {}, {
6851
+ label: /*#__PURE__*/React.createElement(Flex, {
6852
+ direction: "row",
6853
+ alignItems: "center",
6854
+ gap: "2"
6855
+ }, /*#__PURE__*/React.createElement("div", {
6856
+ style: _objectSpread2({
6857
+ width: 15,
6858
+ height: 15
6859
+ }, pattern ? {
6860
+ backgroundImage: pattern
6861
+ } : {
6862
+ backgroundColor: '#ccc'
6863
+ })
6864
+ }), /*#__PURE__*/React.createElement("div", null, " ", opt.label))
6865
+ });
6866
+ })
6867
+ }
6868
+ }
6869
+ },
6347
6870
  metadata: {},
6348
6871
  sources: _objectSpread2({
6349
6872
  main: {
@@ -6358,26 +6881,18 @@ function vector_polygon(_ref, allViewSpecs, context) {
6358
6881
  'source-layer': source_layer,
6359
6882
  type: 'line'
6360
6883
  }, line), {}, {
6361
- paint: {
6362
- 'line-color': color
6363
- }
6884
+ paint: _objectSpread2({
6885
+ 'line-color': _color
6886
+ }, line.paint)
6364
6887
  })), "main_fill", _objectSpread2(_objectSpread2({
6365
6888
  zIndex: Z_OVERLAY_BASE_1000,
6366
6889
  source: 'main',
6367
6890
  'source-layer': source_layer,
6368
6891
  type: 'fill'
6369
6892
  }, fill), {}, {
6370
- paint: _objectSpread2({
6371
- 'fill-opacity': 0.5,
6372
- 'fill-color': color
6373
- }, fill.paint),
6374
- legends: [{
6375
- type: 'CategoricalLegend',
6376
- items: [{
6377
- color: color,
6378
- label: label
6379
- }]
6380
- }],
6893
+ layout: _objectSpread2({}, fill['layout']),
6894
+ paint: _fillPaint,
6895
+ legends: [_legend],
6381
6896
  tooltip: {
6382
6897
  title: ['$literal', resolve.fn(function (ctx) {
6383
6898
  var _ctx$feature;
@@ -6392,64 +6907,846 @@ function vector_polygon(_ref, allViewSpecs, context) {
6392
6907
  });
6393
6908
  }
6394
6909
 
6395
- var _excluded$7 = ["line", "color", "tiles", "source_layer", "sources", "layers"];
6396
- function _parseTiles$1(tiles, context) {
6397
- tiles = Array.isArray(tiles) ? tiles : typeof tiles === 'string' ? [tiles] : null;
6398
- if (!tiles) {
6399
- throw new Error("tiles is required");
6400
- }
6401
- return tiles.map(function (tileSrcUrl) {
6402
- return interpolate(tileSrcUrl, context);
6403
- });
6404
- }
6405
- function vector_line(_ref, allViewSpecs, context) {
6406
- var _ref$line = _ref.line,
6407
- line = _ref$line === void 0 ? {} : _ref$line,
6408
- color = _ref.color,
6409
- tiles = _ref.tiles,
6410
- source_layer = _ref.source_layer,
6411
- _ref$sources = _ref.sources,
6412
- sources = _ref$sources === void 0 ? {} : _ref$sources,
6413
- _ref$layers = _ref.layers,
6414
- layers = _ref$layers === void 0 ? {} : _ref$layers,
6415
- props = _objectWithoutProperties(_ref, _excluded$7);
6416
- if (!source_layer) {
6417
- throw new Error('source_layer must be defined');
6418
- }
6419
- return _objectSpread2(_objectSpread2({}, props), {}, {
6420
- metadata: {},
6421
- sources: _objectSpread2({
6422
- main: {
6423
- promoteId: 'id',
6424
- type: 'vector',
6425
- tiles: _parseTiles$1(tiles, context)
6426
- }
6427
- }, sources),
6428
- layers: _objectSpread2(_defineProperty({}, "main_line", _objectSpread2(_objectSpread2({
6429
- zIndex: Z_OVERLAY_MIDDLE_2000,
6430
- source: 'main',
6431
- 'source-layer': source_layer,
6432
- type: 'line'
6433
- }, line), {}, {
6434
- paint: _objectSpread2({
6435
- 'line-width': 1,
6436
- 'line-color': color
6437
- }, line.paint || {}),
6438
- tooltip: {
6439
- title: ['$literal', resolve.fn(function (ctx) {
6440
- var _ctx$feature;
6441
- return ctx === null || ctx === void 0 || (_ctx$feature = ctx.feature) === null || _ctx$feature === void 0 || (_ctx$feature = _ctx$feature.properties) === null || _ctx$feature === void 0 ? void 0 : _ctx$feature.name;
6442
- })],
6443
- entries: ['$literal', resolve.fn(function (ctx) {
6444
- var _ctx$feature2;
6445
- return _typeof((_ctx$feature2 = ctx.feature) === null || _ctx$feature2 === void 0 ? void 0 : _ctx$feature2.properties) === 'object' ? Object.entries(ctx.feature.properties) : [];
6446
- })]
6447
- }
6448
- })), layers)
6449
- });
6910
+ function confSchema$3(viewSpec, allViewSpecs, context) {
6911
+ return {
6912
+ style: {
6913
+ fillPattern: fillPatternSelector()
6914
+ }
6915
+ };
6450
6916
  }
6451
6917
 
6452
- var _excluded$6 = ["circle", "color", "tiles", "source_layer", "sources", "layers"];
6918
+ function metadata$4(viewSpec, allViewSpecs, context) {
6919
+ var style = viewSpec.style;
6920
+ var categories = resolveAsync.fn(/*#__PURE__*/function () {
6921
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
6922
+ var _ctx$view;
6923
+ var colorSchemeId, resolvedCategories;
6924
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
6925
+ while (1) switch (_context.prev = _context.next) {
6926
+ case 0:
6927
+ // Resolve color scheme
6928
+ colorSchemeId = ((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.colorScheme) || 'schemeGeoReDUSSafe'; // resolve categories
6929
+ if (!(typeof style.categories === 'string')) {
6930
+ _context.next = 7;
6931
+ break;
6932
+ }
6933
+ _context.next = 4;
6934
+ return fetch(interpolate(style.categories, {
6935
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
6936
+ })).then(function (res) {
6937
+ return res.json();
6938
+ }).then(function (categories) {
6939
+ return uniqBy(categories, function (cat) {
6940
+ return cat.value;
6941
+ });
6942
+ });
6943
+ case 4:
6944
+ _context.t0 = _context.sent;
6945
+ _context.next = 8;
6946
+ break;
6947
+ case 7:
6948
+ _context.t0 = Array.isArray(style.categories) ? style.categories.map(function (categoryInput) {
6949
+ return typeof categoryInput === 'string' ? {
6950
+ value: categoryInput
6951
+ } : categoryInput;
6952
+ }) : null;
6953
+ case 8:
6954
+ resolvedCategories = _context.t0;
6955
+ if (resolvedCategories) {
6956
+ _context.next = 11;
6957
+ break;
6958
+ }
6959
+ throw new Error('could not resolve categories ' + viewSpec.id);
6960
+ case 11:
6961
+ return _context.abrupt("return", resolvedCategories.map(function (cat, index) {
6962
+ var color = cat.color || resolveSchemeColor(colorSchemeId, index);
6963
+ if (!color) {
6964
+ throw new Error("Could not resolve color for ".concat(cat.value));
6965
+ }
6966
+ return _objectSpread2(_objectSpread2({}, cat), {}, {
6967
+ color: color,
6968
+ label: cat.label || humanize(cat.value)
6969
+ });
6970
+ }));
6971
+ case 12:
6972
+ case "end":
6973
+ return _context.stop();
6974
+ }
6975
+ }, _callee);
6976
+ }));
6977
+ return function (_x) {
6978
+ return _ref.apply(this, arguments);
6979
+ };
6980
+ }());
6981
+ return {
6982
+ categories: categories
6983
+ };
6984
+ }
6985
+
6986
+ var MAIN_SOURCE_ID$3 = 'main';
6987
+ function sources$4(viewSpec, allViewSpecs, context) {
6988
+ var tiles = viewSpec.tiles;
6989
+ return _defineProperty({}, MAIN_SOURCE_ID$3, {
6990
+ promoteId: 'id',
6991
+ type: 'vector',
6992
+ tiles: parseTiles(tiles, context)
6993
+ });
6994
+ }
6995
+
6996
+ function _main_line$2(_ref, viewSpec, allViewSpecs, context) {
6997
+ var _viewSpec$style;
6998
+ var _maplibreColorExp = _ref._maplibreColorExp;
6999
+ var source_layer = viewSpec.source_layer;
7000
+ var borderStyle = ((_viewSpec$style = viewSpec.style) === null || _viewSpec$style === void 0 ? void 0 : _viewSpec$style.borderStyle) || 'solid';
7001
+ if (borderStyle === 'none') {
7002
+ return null;
7003
+ }
7004
+ var paint = {
7005
+ dashed: {
7006
+ 'line-dasharray': [4, 2],
7007
+ 'line-width': 2
7008
+ },
7009
+ dotted: {
7010
+ 'line-dasharray': [0.5, 2],
7011
+ 'line-width': 2
7012
+ },
7013
+ solid: {}
7014
+ }[borderStyle];
7015
+ return {
7016
+ zIndex: Z_OVERLAY_BASE_1000,
7017
+ source: MAIN_SOURCE_ID$3,
7018
+ 'source-layer': source_layer,
7019
+ type: 'line',
7020
+ layout: borderStyle === 'dotted' ? {
7021
+ 'line-cap': 'round'
7022
+ } : {},
7023
+ paint: _objectSpread2({
7024
+ 'line-color': _maplibreColorExp,
7025
+ 'line-width': 2
7026
+ }, paint)
7027
+ };
7028
+ }
7029
+ function _main_fill_legends$2(props, viewSpec, allViewSpecs, context) {
7030
+ var _legends = resolve.fn(function (context) {
7031
+ var categories = context.view.metadata.categories;
7032
+ return [{
7033
+ type: 'CategoricalLegend',
7034
+ title: viewSpec.label,
7035
+ items: categories.map(function (cat) {
7036
+ return {
7037
+ id: cat.value,
7038
+ label: cat.label,
7039
+ color: cat.color,
7040
+ box: {
7041
+ style: {
7042
+ backgroundColor: applyOpacity(cat.color, DEFAULT_FILL_OPACITY$1)
7043
+ }
7044
+ }
7045
+ };
7046
+ })
7047
+ }];
7048
+ });
7049
+ return _legends;
7050
+ }
7051
+ function _main_fill$2(props, viewSpec, allViewSpecs, context) {
7052
+ var _maplibreColorExp = props._maplibreColorExp,
7053
+ _fillPattern = props._fillPattern;
7054
+ var source_layer = viewSpec.source_layer;
7055
+ var _fillPaint = resolve.fn([_fillPattern], function (_ref2, ctx) {
7056
+ var _ref3 = _slicedToArray(_ref2, 1),
7057
+ resolvedFillPattern = _ref3[0];
7058
+ var resolvedFillPatternStr = resolvedFillPattern && resolvedFillPattern !== FILL_PATTERN_SOLID ? ['match', ['get', viewSpec.style.categoryKey]].concat(_toConsumableArray(ctx.view.metadata.categories.map(function (cat) {
7059
+ return [cat.value, "".concat(resolvedFillPattern, "({ stroke: \"").concat(cat.color, "\", scale: 0.5 })")];
7060
+ }).flat()), ['#CCCCCC']) : null;
7061
+ return _objectSpread2({
7062
+ 'fill-color': _maplibreColorExp,
7063
+ 'fill-opacity': DEFAULT_FILL_OPACITY$1
7064
+ }, resolvedFillPatternStr ? {
7065
+ 'fill-pattern': resolvedFillPatternStr
7066
+ } : {});
7067
+ });
7068
+ return {
7069
+ zIndex: Z_OVERLAY_BASE_1000,
7070
+ source: MAIN_SOURCE_ID$3,
7071
+ 'source-layer': source_layer,
7072
+ type: 'fill',
7073
+ paint: _fillPaint,
7074
+ legends: _main_fill_legends$2(props, viewSpec),
7075
+ tooltip: basicTooltip(viewSpec.tooltip)
7076
+ };
7077
+ }
7078
+ function layers$4(viewSpec, allViewSpecs, context) {
7079
+ var styleSpec = viewSpec.style;
7080
+ var source_layer = viewSpec.source_layer;
7081
+ if (!source_layer) {
7082
+ throw new Error('source_layer must be defined');
7083
+ }
7084
+ var _maplibreColorExp = resolve.fn(function (ctx) {
7085
+ return ['match', ['get', viewSpec.style.categoryKey]].concat(_toConsumableArray(ctx.view.metadata.categories.map(function (cat) {
7086
+ return [cat.value, cat.color];
7087
+ }).flat()), ['#CCCCCC']);
7088
+ });
7089
+ var _fillPattern = resolve.fn(function (ctx) {
7090
+ var _ctx$view;
7091
+ return ((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.fillPattern) || styleSpec.fillPattern;
7092
+ });
7093
+ return _defineProperty(_defineProperty({}, "main_line", _main_line$2({
7094
+ _maplibreColorExp: _maplibreColorExp
7095
+ }, viewSpec)), "main_fill", _main_fill$2({
7096
+ _maplibreColorExp: _maplibreColorExp,
7097
+ _fillPattern: _fillPattern
7098
+ }, viewSpec));
7099
+ }
7100
+
7101
+ function download$4(viewSpec, allViewSpecs, context) {
7102
+ return basicDownload({
7103
+ fileName: slugify(viewSpec.label),
7104
+ downloadUrl: interpolate(viewSpec.download_url, {
7105
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
7106
+ })
7107
+ });
7108
+ }
7109
+
7110
+ var DEFAULT_COLOR_SCHEME_ID$1 = 'schemeGeoReDUSSafe';
7111
+ function parseStyleSpec$4(styleInput) {
7112
+ if (!styleInput) {
7113
+ throw new Error('expected existing styleInput');
7114
+ }
7115
+ return __assign({
7116
+ colorScheme: DEFAULT_COLOR_SCHEME_ID$1
7117
+ }, styleInput);
7118
+ }
7119
+
7120
+ var _excluded$c = ["style"];
7121
+ function vector_polygon_categorical(_ref, allViewSpecs, context) {
7122
+ var style = _ref.style,
7123
+ viewSpec = _objectWithoutProperties(_ref, _excluded$c);
7124
+ viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
7125
+ style: parseStyleSpec$4(style)
7126
+ });
7127
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel'])), {}, {
7128
+ confSchema: confSchema$3(),
7129
+ metadata: metadata$4(viewSpec, allViewSpecs, context),
7130
+ sources: sources$4(viewSpec, allViewSpecs, context),
7131
+ layers: layers$4(viewSpec),
7132
+ download: download$4(viewSpec, allViewSpecs, context)
7133
+ });
7134
+ }
7135
+
7136
+ function confSchema$2(viewSpec, allViewSpecs, context) {
7137
+ var styleSpec = viewSpec.style;
7138
+ return {
7139
+ style: {
7140
+ color: colorSelector(styleSpec.color),
7141
+ fillPattern: fillPatternSelector()
7142
+ }
7143
+ };
7144
+ }
7145
+
7146
+ function metadata$3(viewSpec, allViewSpecs, context) {
7147
+ viewSpec.style;
7148
+ return {};
7149
+ }
7150
+
7151
+ function _main_fill_legends$1(_ref, viewSpec, allViewSpecs, context) {
7152
+ var _color = _ref._color,
7153
+ _fillPattern = _ref._fillPattern;
7154
+ var _legend = resolve.fn([_color, _fillPattern], function (_ref2, ctx) {
7155
+ var _viewSpec$style;
7156
+ var _ref3 = _slicedToArray(_ref2, 2),
7157
+ resolvedColor = _ref3[0],
7158
+ resolvedFillPattern = _ref3[1];
7159
+ var patternProps = resolvedFillPattern && resolvedFillPattern !== FILL_PATTERN_SOLID ? {
7160
+ color: resolvedColor,
7161
+ backgroundColor: 'transparent',
7162
+ backgroundImage: resolvedFillPattern && typeof SVG_PATTERNS[resolvedFillPattern] === 'function' ? svgBgImage$2(SVG_PATTERNS[resolvedFillPattern]({
7163
+ stroke: resolvedColor,
7164
+ scale: '0.25'
7165
+ })) : ''
7166
+ } : {
7167
+ backgroundColor: applyOpacity(resolvedColor, DEFAULT_FILL_OPACITY$1)
7168
+ };
7169
+ var legendItemProps = {
7170
+ box: {
7171
+ style: _objectSpread2({
7172
+ borderColor: resolvedColor,
7173
+ borderStyle: ((_viewSpec$style = viewSpec.style) === null || _viewSpec$style === void 0 ? void 0 : _viewSpec$style.borderStyle) || 'solid',
7174
+ borderWidth: '1px'
7175
+ }, patternProps)
7176
+ }
7177
+ };
7178
+ return {
7179
+ type: 'CategoricalLegend',
7180
+ items: [_objectSpread2({
7181
+ label: viewSpec.label,
7182
+ color: resolvedColor
7183
+ }, legendItemProps)]
7184
+ };
7185
+ });
7186
+ return [_legend];
7187
+ }
7188
+ function _main_fill$1(props, viewSpec, allViewSpecs, context) {
7189
+ var _color = props._color,
7190
+ _fillPattern = props._fillPattern;
7191
+ var source_layer = viewSpec.source_layer;
7192
+ var _fillPaint = resolve.fn([_color, _fillPattern], function (_ref4, ctx) {
7193
+ var _ref5 = _slicedToArray(_ref4, 2),
7194
+ resolvedColor = _ref5[0],
7195
+ resolvedFillPattern = _ref5[1];
7196
+ var resolvedFillPatternStr = resolvedFillPattern && resolvedFillPattern !== FILL_PATTERN_SOLID ? "".concat(resolvedFillPattern, "({ stroke: \"").concat(resolvedColor, "\", scale: 0.5 })") : null;
7197
+ return _objectSpread2({
7198
+ 'fill-opacity': DEFAULT_FILL_OPACITY$1,
7199
+ 'fill-color': resolvedColor
7200
+ }, resolvedFillPatternStr ? {
7201
+ 'fill-pattern': resolvedFillPatternStr
7202
+ } : {});
7203
+ });
7204
+ return {
7205
+ zIndex: Z_OVERLAY_BASE_1000,
7206
+ source: 'main',
7207
+ 'source-layer': source_layer,
7208
+ type: 'fill',
7209
+ paint: _fillPaint,
7210
+ legends: _main_fill_legends$1(props, viewSpec),
7211
+ tooltip: basicTooltip(viewSpec.tooltip)
7212
+ };
7213
+ }
7214
+ function _main_line$1(_ref6, viewSpec, allViewSpecs, context) {
7215
+ var _viewSpec$style2;
7216
+ var _color = _ref6._color;
7217
+ var source_layer = viewSpec.source_layer;
7218
+ var borderStyle = ((_viewSpec$style2 = viewSpec.style) === null || _viewSpec$style2 === void 0 ? void 0 : _viewSpec$style2.borderStyle) || 'solid';
7219
+ if (borderStyle === 'none') {
7220
+ return null;
7221
+ }
7222
+ var paint = {
7223
+ dashed: {
7224
+ 'line-dasharray': [4, 2],
7225
+ 'line-width': 2
7226
+ },
7227
+ dotted: {
7228
+ 'line-dasharray': [0.5, 2],
7229
+ 'line-width': 2
7230
+ },
7231
+ solid: {}
7232
+ }[borderStyle];
7233
+ return {
7234
+ zIndex: Z_OVERLAY_BASE_1000,
7235
+ source: 'main',
7236
+ 'source-layer': source_layer,
7237
+ type: 'line',
7238
+ layout: borderStyle === 'dotted' ? {
7239
+ 'line-cap': 'round'
7240
+ } : {},
7241
+ paint: _objectSpread2({
7242
+ 'line-color': _color
7243
+ }, paint)
7244
+ };
7245
+ }
7246
+ function layers$3(viewSpec, allViewSpecs, context) {
7247
+ var styleSpec = viewSpec.style;
7248
+ var source_layer = viewSpec.source_layer;
7249
+ if (!source_layer) {
7250
+ throw new Error('source_layer must be defined');
7251
+ }
7252
+ var _color = resolve.fn(function (ctx) {
7253
+ var _ctx$view;
7254
+ return resolveColor(((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.color) || styleSpec.color);
7255
+ });
7256
+ var _fillPattern = resolve.fn(function (ctx) {
7257
+ var _ctx$view2;
7258
+ return ((_ctx$view2 = ctx.view) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.conf) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.style) === null || _ctx$view2 === void 0 ? void 0 : _ctx$view2.fillPattern) || styleSpec.fillPattern;
7259
+ });
7260
+ return _defineProperty(_defineProperty({}, "main_line", _main_line$1({
7261
+ _color: _color}, viewSpec)), "main_fill", _main_fill$1({
7262
+ _color: _color,
7263
+ _fillPattern: _fillPattern
7264
+ }, viewSpec));
7265
+ }
7266
+
7267
+ function sources$3(viewSpec, allViewSpecs, context) {
7268
+ var tiles = viewSpec.tiles;
7269
+ return {
7270
+ main: {
7271
+ promoteId: 'id',
7272
+ type: 'vector',
7273
+ tiles: parseTiles(tiles, context)
7274
+ }
7275
+ };
7276
+ }
7277
+
7278
+ function _defaultColor$1(inputColor) {
7279
+ return inputColor ? resolveColor(inputColor) : schemeGeoReDUS.laranja;
7280
+ }
7281
+ function parseStyleSpec$3(styleInput) {
7282
+ if (!styleInput) {
7283
+ return {};
7284
+ }
7285
+ if (typeof styleInput === 'string') {
7286
+ return {
7287
+ color: _defaultColor$1(styleInput)
7288
+ };
7289
+ } else {
7290
+ return __assign(__assign({}, styleInput), {
7291
+ color: _defaultColor$1(styleInput.color)
7292
+ });
7293
+ }
7294
+ }
7295
+
7296
+ function download$3(viewSpec, allViewSpecs, context) {
7297
+ return basicDownload({
7298
+ fileName: slugify(viewSpec.label),
7299
+ downloadUrl: interpolate(viewSpec.download_url, {
7300
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
7301
+ })
7302
+ });
7303
+ }
7304
+
7305
+ var _excluded$b = ["style"];
7306
+ function vector_polygon_single(_ref, allViewSpecs, context) {
7307
+ var style = _ref.style,
7308
+ viewSpec = _objectWithoutProperties(_ref, _excluded$b);
7309
+ viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
7310
+ style: parseStyleSpec$3(style)
7311
+ });
7312
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel'])), {}, {
7313
+ confSchema: confSchema$2(viewSpec),
7314
+ metadata: metadata$3(viewSpec),
7315
+ sources: sources$3(viewSpec, allViewSpecs, context),
7316
+ layers: layers$3(viewSpec),
7317
+ download: download$3(viewSpec, allViewSpecs, context)
7318
+ });
7319
+ }
7320
+
7321
+ var DEFAULT_COLOR_SCHEME_ID = 'schemeOrRd';
7322
+ function parseStyleSpec$2(styleInput) {
7323
+ return __assign(__assign({
7324
+ colorScheme: DEFAULT_COLOR_SCHEME_ID
7325
+ }, styleInput), {
7326
+ classificationMethod: !styleInput.classificationMethod ? {
7327
+ type: 'naturalBreaks',
7328
+ k: 5
7329
+ } : typeof styleInput.classificationMethod === 'string' ? {
7330
+ type: styleInput.classificationMethod,
7331
+ k: 5
7332
+ } : styleInput.classificationMethod
7333
+ });
7334
+ }
7335
+
7336
+ var getLargestColorArray = function getLargestColorArray(scheme) {
7337
+ return scheme[scheme.length - 1];
7338
+ };
7339
+ var D3_SCHEMES = _objectSpread2(_objectSpread2({}, D3_SEQUENTIAL), D3_DIVERGING);
7340
+ var COLOR_SCHEME_OPTIONS = Object.entries(D3_SCHEMES).map(function (_ref) {
7341
+ var _ref2 = _slicedToArray(_ref, 2),
7342
+ name = _ref2[0],
7343
+ scheme = _ref2[1];
7344
+ var colors = getLargestColorArray(scheme);
7345
+ return {
7346
+ value: name,
7347
+ label: /*#__PURE__*/React.createElement(Flex, {
7348
+ direction: "row",
7349
+ gap: "2",
7350
+ alignItems: "center"
7351
+ }, /*#__PURE__*/React.createElement("div", {
7352
+ style: {
7353
+ display: 'flex',
7354
+ gap: '2px'
7355
+ }
7356
+ }, colors.map(function (color, idx) {
7357
+ return /*#__PURE__*/React.createElement("div", {
7358
+ key: idx,
7359
+ style: {
7360
+ width: 15,
7361
+ height: 15,
7362
+ backgroundColor: color,
7363
+ border: 'none'
7364
+ }
7365
+ });
7366
+ })))
7367
+ };
7368
+ });
7369
+ function confSchema$1(viewSpec, allViewSpecs, context) {
7370
+ var _viewSpec$style, _viewSpec$style2;
7371
+ return {
7372
+ style: {
7373
+ classificationMethodType: {
7374
+ label: 'Método de classificação',
7375
+ type: 'select',
7376
+ clearable: false,
7377
+ defaultValue: ((_viewSpec$style = viewSpec.style) === null || _viewSpec$style === void 0 || (_viewSpec$style = _viewSpec$style.classificationMethod) === null || _viewSpec$style === void 0 ? void 0 : _viewSpec$style.type) || 'naturalBreaks',
7378
+ options: [{
7379
+ value: 'naturalBreaks',
7380
+ label: 'Quebras naturais'
7381
+ }, {
7382
+ value: 'quantile',
7383
+ label: 'Quantis'
7384
+ }]
7385
+ },
7386
+ colorScheme: {
7387
+ label: 'Esquema de cores',
7388
+ type: 'select',
7389
+ clearable: false,
7390
+ defaultValue: ((_viewSpec$style2 = viewSpec.style) === null || _viewSpec$style2 === void 0 ? void 0 : _viewSpec$style2.colorScheme) || DEFAULT_COLOR_SCHEME_ID,
7391
+ options: COLOR_SCHEME_OPTIONS
7392
+ }
7393
+ }
7394
+ };
7395
+ }
7396
+
7397
+ var DEFAULT_COLOR = '#CCC';
7398
+ function custom(_ref) {
7399
+ _ref.values;
7400
+ var colorScheme = _ref.colorScheme,
7401
+ classificationMethod = _ref.classificationMethod;
7402
+ var k = classificationMethod.breaks.length;
7403
+ return [DEFAULT_COLOR].concat(_toConsumableArray(classificationMethod.breaks.map(function (breakValue, index) {
7404
+ return [breakValue, colorScheme.scalesByK[k][index]];
7405
+ }).flat()));
7406
+ }
7407
+ function quantile(_ref2) {
7408
+ var values = _ref2.values,
7409
+ colorScheme = _ref2.colorScheme,
7410
+ classificationMethod = _ref2.classificationMethod;
7411
+ var scale = scaleQuantile().domain(values) // your data
7412
+ .range(new Array(classificationMethod.k).fill(null).map(function (_, idx) {
7413
+ return idx;
7414
+ })); // number of bins
7415
+
7416
+ var breaks = scale.quantiles(); // → the cutoff values
7417
+
7418
+ //
7419
+ // Will produce an array such as:
7420
+ // [
7421
+ // "below_10",
7422
+ // 10,
7423
+ // "between_10_20",
7424
+ // 20,
7425
+ // "between_20_30",
7426
+ // 30,
7427
+ // "above_30"
7428
+ // ]
7429
+ //
7430
+
7431
+ var colorScale = colorScheme.scalesByK[classificationMethod.k];
7432
+ var colorScaleStops = breaks.map(function (breakValue, index) {
7433
+ var color = colorScale[index + 1];
7434
+ return index === 0 ? [
7435
+ // For below 0 values, will use defaultColor
7436
+ DEFAULT_COLOR, 0,
7437
+ // colorScale
7438
+ colorScale[0], breakValue, color] : [breakValue, color];
7439
+ }).flat(1);
7440
+ return colorScaleStops;
7441
+ }
7442
+ function naturalBreaks(_ref3) {
7443
+ var values = _ref3.values,
7444
+ colorScheme = _ref3.colorScheme,
7445
+ classificationMethod = _ref3.classificationMethod;
7446
+ return ['$naturalBreaks', values, _objectSpread2(_objectSpread2({}, colorScheme), {}, {
7447
+ defaultColor: DEFAULT_COLOR,
7448
+ k: classificationMethod.k,
7449
+ minK: 5
7450
+ })];
7451
+ }
7452
+ var COLOR_SCALE_STOPS_RESOLVERS = {
7453
+ custom: custom,
7454
+ quantile: quantile,
7455
+ naturalBreaks: naturalBreaks
7456
+ };
7457
+
7458
+ function metadata$2(viewSpec, allViewSpecs, context) {
7459
+ var style = viewSpec.style;
7460
+ return resolveAsync.fn(/*#__PURE__*/function () {
7461
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
7462
+ var _ctx$view$conf, _ctx$view$conf$style, _style$classification, _ctx$view$conf$style2, _style$classification2;
7463
+ var resolvedValues, colorSchemeId, colorScheme, _classificationMethod, colorScaleStops;
7464
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7465
+ while (1) switch (_context.prev = _context.next) {
7466
+ case 0:
7467
+ if (!(typeof style.values === 'string')) {
7468
+ _context.next = 6;
7469
+ break;
7470
+ }
7471
+ _context.next = 3;
7472
+ return fetch(interpolate(style.values, {
7473
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
7474
+ })).then(function (res) {
7475
+ return res.json();
7476
+ });
7477
+ case 3:
7478
+ _context.t0 = _context.sent;
7479
+ _context.next = 7;
7480
+ break;
7481
+ case 6:
7482
+ _context.t0 = Array.isArray(style.values) ? style.values : null;
7483
+ case 7:
7484
+ resolvedValues = _context.t0.map(function (entry) {
7485
+ return typeof entry === 'number' ? entry : entry.value;
7486
+ });
7487
+ //
7488
+ // Resolve color scale stops
7489
+ //
7490
+ colorSchemeId = ((_ctx$view$conf = ctx.view.conf) === null || _ctx$view$conf === void 0 || (_ctx$view$conf = _ctx$view$conf.style) === null || _ctx$view$conf === void 0 ? void 0 : _ctx$view$conf.colorScheme) || style.colorScheme;
7491
+ colorScheme = COLOR_SCHEMES[colorSchemeId] || COLOR_SCHEMES.schemeOrRd;
7492
+ _classificationMethod = _objectSpread2(_objectSpread2({}, style.classificationMethod || {}), {}, {
7493
+ type: ((_ctx$view$conf$style = ctx.view.conf.style) === null || _ctx$view$conf$style === void 0 ? void 0 : _ctx$view$conf$style.classificationMethodType) || ((_style$classification = style.classificationMethod) === null || _style$classification === void 0 ? void 0 : _style$classification.type),
7494
+ k: ((_ctx$view$conf$style2 = ctx.view.conf.style) === null || _ctx$view$conf$style2 === void 0 ? void 0 : _ctx$view$conf$style2.classificationMethodK) || ((_style$classification2 = style.classificationMethod) === null || _style$classification2 === void 0 ? void 0 : _style$classification2.k)
7495
+ });
7496
+ colorScaleStops = COLOR_SCALE_STOPS_RESOLVERS[_classificationMethod.type]({
7497
+ values: resolvedValues,
7498
+ colorScheme: colorScheme,
7499
+ classificationMethod: _classificationMethod
7500
+ });
7501
+ return _context.abrupt("return", {
7502
+ values: resolvedValues,
7503
+ colorScaleStops: colorScaleStops
7504
+ });
7505
+ case 13:
7506
+ case "end":
7507
+ return _context.stop();
7508
+ }
7509
+ }, _callee);
7510
+ }));
7511
+ return function (_x) {
7512
+ return _ref.apply(this, arguments);
7513
+ };
7514
+ }());
7515
+ }
7516
+
7517
+ var MAIN_SOURCE_ID$2 = 'main';
7518
+ function sources$2(viewSpec, allViewSpecs, context) {
7519
+ var tiles = viewSpec.tiles;
7520
+ return _defineProperty({}, MAIN_SOURCE_ID$2, {
7521
+ promoteId: 'id',
7522
+ type: 'vector',
7523
+ tiles: parseTiles(tiles, context)
7524
+ });
7525
+ }
7526
+
7527
+ function _main_line(props, viewSpec, allViewSpecs, context) {
7528
+ var source_layer = viewSpec.source_layer;
7529
+
7530
+ //
7531
+ // Resolve color scale stops
7532
+ //
7533
+ var colorScheme = COLOR_SCHEMES[viewSpec.style.colorScheme];
7534
+ return {
7535
+ zIndex: Z_OVERLAY_BASE_1000,
7536
+ source: MAIN_SOURCE_ID$2,
7537
+ 'source-layer': source_layer,
7538
+ type: 'line',
7539
+ interactive: true,
7540
+ paint: {
7541
+ 'line-color': colorScheme.scalesByK[3][2],
7542
+ 'line-width': 2,
7543
+ 'line-opacity': ['case', ['boolean', ['feature-state', 'hover'], false], 1, 0]
7544
+ }
7545
+ };
7546
+ }
7547
+ var DEFAULT_NUMBER_FORMAT = ['pt-BR', {}];
7548
+ function _main_fill_legends(props, viewSpec, allViewSpecs, context) {
7549
+ var _legends = resolve.fn(function (ctx) {
7550
+ var _viewSpec$style$legen;
7551
+ console.log('ctx', ctx);
7552
+ return [{
7553
+ type: 'SequentialColorLegend',
7554
+ title: viewSpec.label,
7555
+ unit: viewSpec.unit,
7556
+ steps: ctx.view.metadata.colorScaleStops,
7557
+ format: _objectSpread2({
7558
+ number: viewSpec.style.numberFormat || DEFAULT_NUMBER_FORMAT,
7559
+ below: 'Sem dados',
7560
+ above: 'Acima de ${0}'
7561
+ }, ((_viewSpec$style$legen = viewSpec.style.legend) === null || _viewSpec$style$legen === void 0 ? void 0 : _viewSpec$style$legen.format) || {})
7562
+ }];
7563
+ });
7564
+ return _legends;
7565
+ }
7566
+ function _main_fill(props, viewSpec, allViewSpecs, context) {
7567
+ var _maplibreColorExp = props._maplibreColorExp;
7568
+ var source_layer = viewSpec.source_layer;
7569
+ return {
7570
+ zIndex: Z_OVERLAY_BASE_1000,
7571
+ source: MAIN_SOURCE_ID$2,
7572
+ 'source-layer': source_layer,
7573
+ interactive: true,
7574
+ type: 'fill',
7575
+ paint: {
7576
+ 'fill-color': _maplibreColorExp,
7577
+ 'fill-opacity': DEFAULT_FILL_OPACITY$1
7578
+ },
7579
+ legends: _main_fill_legends(props, viewSpec),
7580
+ tooltip: basicTooltip(viewSpec.tooltip)
7581
+ };
7582
+ }
7583
+ function layers$2(viewSpec, allViewSpecs, context) {
7584
+ viewSpec.style;
7585
+ var source_layer = viewSpec.source_layer;
7586
+ if (!source_layer) {
7587
+ throw new Error('source_layer must be defined');
7588
+ }
7589
+ var _maplibreColorExp = resolve.fn(function (ctx) {
7590
+ return ['step', ['coalesce', ['get', viewSpec.style.valueKey],
7591
+ //
7592
+ // Just need to coalesce to value lower than the least existing value
7593
+ //
7594
+ Math.min.apply(Math, _toConsumableArray(ctx.view.metadata.values)) - 1]].concat(_toConsumableArray(ctx.view.metadata.colorScaleStops));
7595
+ });
7596
+
7597
+ // const _fillPattern = resolve.fn(
7598
+ // (ctx) => ctx.view?.conf?.style?.fillPattern || styleSpec.fillPattern,
7599
+ // )
7600
+
7601
+ return _defineProperty(_defineProperty({}, "main_line", _main_line({
7602
+ }, viewSpec)), "main_fill", _main_fill({
7603
+ _maplibreColorExp: _maplibreColorExp
7604
+ }, viewSpec));
7605
+ }
7606
+
7607
+ function download$2(viewSpec, allViewSpecs, context) {
7608
+ return basicDownload({
7609
+ fileName: slugify(viewSpec.label),
7610
+ downloadUrl: interpolate(viewSpec.download_url, {
7611
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
7612
+ })
7613
+ });
7614
+ }
7615
+
7616
+ var _excluded$a = ["style"];
7617
+ function vector_polygon_continuous(_ref, allViewSpecs, context) {
7618
+ var style = _ref.style,
7619
+ viewSpec = _objectWithoutProperties(_ref, _excluded$a);
7620
+ viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
7621
+ style: parseStyleSpec$2(style)
7622
+ });
7623
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel'])), {}, {
7624
+ confSchema: confSchema$1(viewSpec),
7625
+ metadata: metadata$2(viewSpec, allViewSpecs, context),
7626
+ sources: sources$2(viewSpec, allViewSpecs, context),
7627
+ layers: layers$2(viewSpec),
7628
+ download: download$2(viewSpec, allViewSpecs, context)
7629
+ });
7630
+ }
7631
+
7632
+ var _excluded$9 = ["label", "line", "color", "tiles", "source_layer", "sources", "layers", "tooltip"];
7633
+ var LINE_PATTERN_OPTIONS = [{
7634
+ label: 'Continua',
7635
+ value: 'line'
7636
+ }, {
7637
+ label: 'Tracejada',
7638
+ value: 'dashed'
7639
+ }];
7640
+ function _parseTiles$1(tiles, context) {
7641
+ tiles = Array.isArray(tiles) ? tiles : typeof tiles === 'string' ? [tiles] : null;
7642
+ if (!tiles) {
7643
+ throw new Error("tiles is required");
7644
+ }
7645
+ return tiles.map(function (tileSrcUrl) {
7646
+ return interpolate(tileSrcUrl, context);
7647
+ });
7648
+ }
7649
+ function vector_line(_ref, allViewSpecs, context) {
7650
+ var label = _ref.label,
7651
+ _ref$line = _ref.line,
7652
+ line = _ref$line === void 0 ? {} : _ref$line,
7653
+ color = _ref.color,
7654
+ tiles = _ref.tiles,
7655
+ source_layer = _ref.source_layer,
7656
+ _ref$sources = _ref.sources,
7657
+ sources = _ref$sources === void 0 ? {} : _ref$sources,
7658
+ _ref$layers = _ref.layers,
7659
+ layers = _ref$layers === void 0 ? {} : _ref$layers,
7660
+ _ref$tooltip = _ref.tooltip,
7661
+ tooltip = _ref$tooltip === void 0 ? {} : _ref$tooltip,
7662
+ props = _objectWithoutProperties(_ref, _excluded$9);
7663
+ if (!source_layer) {
7664
+ throw new Error('source_layer must be defined');
7665
+ }
7666
+ var _initialColor = resolveColor(color);
7667
+ var _color = resolve.fn(function (ctx) {
7668
+ var _ctx$view;
7669
+ return resolveColor((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.color) || _initialColor;
7670
+ });
7671
+ var _initialLinePattern = line.paint && line.paint['line-dasharray'] ? 'dashed' : 'line';
7672
+ var _linePattern = resolve.fn(_color, function (_resolvedColor, ctx) {
7673
+ var _ctx$view2;
7674
+ var resolvedLinePattern = ((_ctx$view2 = ctx.view) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.conf) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.style) === null || _ctx$view2 === void 0 ? void 0 : _ctx$view2.linePattern) || _initialLinePattern;
7675
+ return _objectSpread2(_objectSpread2({
7676
+ 'line-width': 1,
7677
+ 'line-color': _color
7678
+ }, line.paint || {}), resolvedLinePattern === 'dashed' ? {
7679
+ 'line-dasharray': [2, 2]
7680
+ } : {});
7681
+ });
7682
+ var _legend = resolve.fn(_color, function (_resolvedColor, ctx) {
7683
+ var _ctx$view3;
7684
+ return {
7685
+ type: 'CategoricalLegend',
7686
+ items: [{
7687
+ label: label,
7688
+ box: {
7689
+ style: {
7690
+ height: 0,
7691
+ borderColor: _resolvedColor,
7692
+ borderStyle: ((_ctx$view3 = ctx.view) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.conf) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.style) === null || _ctx$view3 === void 0 ? void 0 : _ctx$view3.linePattern) || _initialLinePattern,
7693
+ borderWidth: '1px'
7694
+ }
7695
+ }
7696
+ }]
7697
+ };
7698
+ });
7699
+ return _objectSpread2(_objectSpread2({}, props), {}, {
7700
+ label: label,
7701
+ confSchema: {
7702
+ style: {
7703
+ color: colorSelector(_initialColor),
7704
+ linePattern: {
7705
+ label: 'Linha',
7706
+ type: 'select',
7707
+ clearable: false,
7708
+ defaultValue: _initialLinePattern || 'line',
7709
+ options: LINE_PATTERN_OPTIONS.map(function (opt) {
7710
+ return _objectSpread2(_objectSpread2({}, opt), {}, {
7711
+ label: /*#__PURE__*/React.createElement(Flex, {
7712
+ direction: "row",
7713
+ alignItems: "center",
7714
+ gap: "2"
7715
+ }, /*#__PURE__*/React.createElement("div", {
7716
+ style: {
7717
+ width: 15,
7718
+ height: 0,
7719
+ borderStyle: opt.value === 'line' ? 'solid' : 'dashed',
7720
+ borderWidth: 1
7721
+ }
7722
+ }), /*#__PURE__*/React.createElement("div", null, " ", opt.label))
7723
+ });
7724
+ })
7725
+ }
7726
+ }
7727
+ },
7728
+ metadata: {},
7729
+ sources: _objectSpread2({
7730
+ main: {
7731
+ promoteId: 'id',
7732
+ type: 'vector',
7733
+ tiles: _parseTiles$1(tiles, context)
7734
+ }
7735
+ }, sources),
7736
+ layers: _objectSpread2(_defineProperty({}, "main_line", _objectSpread2(_objectSpread2({
7737
+ zIndex: Z_OVERLAY_MIDDLE_2000,
7738
+ source: 'main',
7739
+ 'source-layer': source_layer,
7740
+ type: 'line'
7741
+ }, line), {}, {
7742
+ paint: _linePattern,
7743
+ legends: [_legend],
7744
+ tooltip: basicTooltip(tooltip)
7745
+ })), layers)
7746
+ });
7747
+ }
7748
+
7749
+ var _excluded$8 = ["label", "circle", "color", "tiles", "source_layer", "sources", "layers"];
6453
7750
  function _parseTiles(tiles, context) {
6454
7751
  tiles = Array.isArray(tiles) ? tiles : typeof tiles === 'string' ? [tiles] : null;
6455
7752
  if (!tiles) {
@@ -6460,7 +7757,8 @@ function _parseTiles(tiles, context) {
6460
7757
  });
6461
7758
  }
6462
7759
  function vector_circle(_ref, allViewSpecs, context) {
6463
- var _ref$circle = _ref.circle,
7760
+ var label = _ref.label,
7761
+ _ref$circle = _ref.circle,
6464
7762
  circle = _ref$circle === void 0 ? {} : _ref$circle,
6465
7763
  color = _ref.color,
6466
7764
  tiles = _ref.tiles,
@@ -6469,11 +7767,37 @@ function vector_circle(_ref, allViewSpecs, context) {
6469
7767
  sources = _ref$sources === void 0 ? {} : _ref$sources,
6470
7768
  _ref$layers = _ref.layers,
6471
7769
  layers = _ref$layers === void 0 ? {} : _ref$layers,
6472
- props = _objectWithoutProperties(_ref, _excluded$6);
7770
+ props = _objectWithoutProperties(_ref, _excluded$8);
6473
7771
  if (!source_layer) {
6474
7772
  throw new Error('source_layer must be defined');
6475
7773
  }
7774
+ var _initialColor = resolveColor(color);
7775
+ var _color = resolve.fn(function (ctx) {
7776
+ var _ctx$view;
7777
+ return resolveColor((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.color) || _initialColor;
7778
+ });
7779
+ var _legend = resolve.fn(_color, function (_resolvedColor) {
7780
+ return {
7781
+ type: 'CategoricalLegend',
7782
+ items: [{
7783
+ label: label,
7784
+ box: {
7785
+ style: {
7786
+ backgroundColor: _resolvedColor,
7787
+ border: '1px solid black',
7788
+ borderRadius: '30px'
7789
+ }
7790
+ }
7791
+ }]
7792
+ };
7793
+ });
6476
7794
  return _objectSpread2(_objectSpread2({}, props), {}, {
7795
+ label: label,
7796
+ confSchema: {
7797
+ style: {
7798
+ color: colorSelector(_initialColor)
7799
+ }
7800
+ },
6477
7801
  metadata: {},
6478
7802
  sources: _objectSpread2({
6479
7803
  main: {
@@ -6490,11 +7814,12 @@ function vector_circle(_ref, allViewSpecs, context) {
6490
7814
  }, circle), {}, {
6491
7815
  paint: _objectSpread2({
6492
7816
  'circle-radius': 8,
6493
- 'circle-color': color,
7817
+ 'circle-color': _color,
6494
7818
  'circle-opacity': 1,
6495
7819
  'circle-stroke-color': '#000000',
6496
7820
  'circle-stroke-width': 1
6497
7821
  }, circle.paint || {}),
7822
+ legends: [_legend],
6498
7823
  tooltip: {
6499
7824
  title: ['$literal', resolve.fn(function (ctx) {
6500
7825
  var _ctx$feature;
@@ -6509,6 +7834,313 @@ function vector_circle(_ref, allViewSpecs, context) {
6509
7834
  });
6510
7835
  }
6511
7836
 
7837
+ function confSchema(viewSpec, allViewSpecs, context) {
7838
+ var styleSpec = viewSpec.style;
7839
+ return {
7840
+ style: {
7841
+ color: colorSelector(styleSpec.color)
7842
+ }
7843
+ };
7844
+ }
7845
+
7846
+ function metadata$1(viewSpec, allViewSpecs, context) {
7847
+ return {};
7848
+ }
7849
+
7850
+ var MAIN_SOURCE_ID$1 = 'main';
7851
+ function sources$1(viewSpec, allViewSpecs, context) {
7852
+ var tiles = viewSpec.tiles;
7853
+ return _defineProperty({}, MAIN_SOURCE_ID$1, {
7854
+ promoteId: 'id',
7855
+ type: 'vector',
7856
+ tiles: parseTiles(tiles, context)
7857
+ });
7858
+ }
7859
+
7860
+ function _main_circle_legends$1(props, viewSpec, allViewSpecs, context) {
7861
+ var _legends = resolve.fn(function (ctx) {
7862
+ var _ctx$view, _viewSpec$style, _viewSpec$style2;
7863
+ var _resolvedColor = resolveColor(((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.color) || ((_viewSpec$style = viewSpec.style) === null || _viewSpec$style === void 0 ? void 0 : _viewSpec$style.color)) || schemeGeoReDUS.laranja;
7864
+ return [{
7865
+ type: 'CategoricalLegend',
7866
+ items: [{
7867
+ label: viewSpec.label,
7868
+ box: {
7869
+ style: {
7870
+ backgroundColor: _resolvedColor,
7871
+ border: 'none',
7872
+ borderRadius: '30px',
7873
+ opacity: ((_viewSpec$style2 = viewSpec.style) === null || _viewSpec$style2 === void 0 ? void 0 : _viewSpec$style2.opacity) || 1
7874
+ }
7875
+ }
7876
+ }]
7877
+ }];
7878
+ });
7879
+ return _legends;
7880
+ }
7881
+ function _main_circle$1(props, viewSpec, allViewSpecs, context) {
7882
+ var _viewSpec$style4, _viewSpec$style5, _viewSpec$style6;
7883
+ _objectDestructuringEmpty(props);
7884
+ var source_layer = viewSpec.source_layer;
7885
+ return {
7886
+ zIndex: Z_OVERLAY_BASE_1000,
7887
+ source: MAIN_SOURCE_ID$1,
7888
+ 'source-layer': source_layer,
7889
+ interactive: true,
7890
+ type: 'circle',
7891
+ paint: {
7892
+ 'circle-color': resolve.fn(function (ctx) {
7893
+ var _ctx$view2, _viewSpec$style3;
7894
+ var _resolvedColor = resolveColor(((_ctx$view2 = ctx.view) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.conf) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.style) === null || _ctx$view2 === void 0 ? void 0 : _ctx$view2.color) || ((_viewSpec$style3 = viewSpec.style) === null || _viewSpec$style3 === void 0 ? void 0 : _viewSpec$style3.color)) || schemeGeoReDUS.laranja;
7895
+ return _resolvedColor;
7896
+ }),
7897
+ 'circle-opacity': ((_viewSpec$style4 = viewSpec.style) === null || _viewSpec$style4 === void 0 ? void 0 : _viewSpec$style4.opacity) || 1,
7898
+ 'circle-radius': ((_viewSpec$style5 = viewSpec.style) === null || _viewSpec$style5 === void 0 ? void 0 : _viewSpec$style5.radius) || 10,
7899
+ 'circle-stroke-color': '#ffffff',
7900
+ 'circle-stroke-width': (_viewSpec$style6 = viewSpec.style) !== null && _viewSpec$style6 !== void 0 && _viewSpec$style6.border ? 2 : 0
7901
+ },
7902
+ legends: _main_circle_legends$1(props, viewSpec),
7903
+ tooltip: basicTooltip(viewSpec.tooltip)
7904
+ };
7905
+ }
7906
+ function layers$1(viewSpec, allViewSpecs, context) {
7907
+ var source_layer = viewSpec.source_layer;
7908
+ if (!source_layer) {
7909
+ throw new Error('source_layer must be defined');
7910
+ }
7911
+ return _defineProperty({}, "main_circle", _main_circle$1({}, viewSpec));
7912
+ }
7913
+
7914
+ function _defaultColor(inputColor) {
7915
+ return inputColor ? resolveColor(inputColor) : schemeGeoReDUS.laranja;
7916
+ }
7917
+ function parseStyleSpec$1(styleInput) {
7918
+ if (!styleInput) {
7919
+ return {};
7920
+ }
7921
+ if (typeof styleInput === 'string') {
7922
+ return {
7923
+ color: _defaultColor(styleInput),
7924
+ border: true
7925
+ };
7926
+ } else {
7927
+ return __assign(__assign({
7928
+ border: true
7929
+ }, styleInput), {
7930
+ color: _defaultColor(styleInput.color)
7931
+ });
7932
+ }
7933
+ }
7934
+
7935
+ function download$1(viewSpec, allViewSpecs, context) {
7936
+ return basicDownload({
7937
+ fileName: slugify(viewSpec.label),
7938
+ downloadUrl: interpolate(viewSpec.download_url || "", {
7939
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
7940
+ })
7941
+ });
7942
+ }
7943
+
7944
+ var _excluded$7 = ["style"];
7945
+ function vector_point_single(_ref, allViewSpecs, context) {
7946
+ var style = _ref.style,
7947
+ viewSpec = _objectWithoutProperties(_ref, _excluded$7);
7948
+ viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
7949
+ style: parseStyleSpec$1(style)
7950
+ });
7951
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel'])), {}, {
7952
+ confSchema: confSchema(viewSpec),
7953
+ metadata: metadata$1(),
7954
+ sources: sources$1(viewSpec, allViewSpecs, context),
7955
+ layers: layers$1(viewSpec),
7956
+ download: download$1(viewSpec, allViewSpecs, context)
7957
+ });
7958
+ }
7959
+
7960
+ function metadata(viewSpec, allViewSpecs, context) {
7961
+ var _style$radius;
7962
+ var style = viewSpec.style;
7963
+ var radiusData = (_style$radius = style.radius) !== null && _style$radius !== void 0 && _style$radius.values ? resolveAsync.fn(/*#__PURE__*/function () {
7964
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
7965
+ var resolvedValues;
7966
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7967
+ while (1) switch (_context.prev = _context.next) {
7968
+ case 0:
7969
+ if (!(typeof style.radius.values === 'string')) {
7970
+ _context.next = 6;
7971
+ break;
7972
+ }
7973
+ _context.next = 3;
7974
+ return fetch(interpolate(style.radius.values, {
7975
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT,
7976
+ municipioId: context.municipioId,
7977
+ //
7978
+ // TODO: remove these hotfixes
7979
+ //
7980
+ municipioId_SUS: context.municipioId.substr(0, 6)
7981
+ })).then(function (res) {
7982
+ return res.json();
7983
+ });
7984
+ case 3:
7985
+ _context.t0 = _context.sent;
7986
+ _context.next = 7;
7987
+ break;
7988
+ case 6:
7989
+ _context.t0 = Array.isArray(style.radius.values) ? style.radius.values : null;
7990
+ case 7:
7991
+ resolvedValues = _context.t0.map(function (entry) {
7992
+ return typeof entry === 'number' ? entry : entry.value;
7993
+ });
7994
+ return _context.abrupt("return", {
7995
+ values: resolvedValues
7996
+ });
7997
+ case 9:
7998
+ case "end":
7999
+ return _context.stop();
8000
+ }
8001
+ }, _callee);
8002
+ }));
8003
+ return function (_x) {
8004
+ return _ref.apply(this, arguments);
8005
+ };
8006
+ }()) : null;
8007
+ return {
8008
+ radiusData: radiusData
8009
+ };
8010
+ }
8011
+
8012
+ var MAIN_SOURCE_ID = 'main';
8013
+ function sources(viewSpec, allViewSpecs, context) {
8014
+ var tiles = viewSpec.tiles;
8015
+ return _defineProperty({}, MAIN_SOURCE_ID, {
8016
+ promoteId: 'id',
8017
+ type: 'vector',
8018
+ tiles: parseTiles(tiles, context)
8019
+ });
8020
+ }
8021
+
8022
+ var SIZE_MAX = 25;
8023
+ var SIZE_MIN = 6;
8024
+ function _validNumericalValues(values) {
8025
+ return values.filter(function (value) {
8026
+ return typeof value === 'number' && !Number.isNaN(value);
8027
+ });
8028
+ }
8029
+ var NO_DATA_COLOR = GEOREDUS_LABELED_RESTRICTED_USE_COLORS.cinza_claro.value;
8030
+ function _main_circle_legends(props, viewSpec, allViewSpecs, context) {
8031
+ var _legends = resolve.fn(function (ctx) {
8032
+ var _viewSpec$style;
8033
+ var _values = _validNumericalValues(ctx.view.metadata.radiusData.values);
8034
+ var _resolvedColor = resolveColor((_viewSpec$style = viewSpec.style) === null || _viewSpec$style === void 0 ? void 0 : _viewSpec$style.color) || schemeGeoReDUS.laranja;
8035
+ return [{
8036
+ type: 'CategoricalLegend',
8037
+ title: viewSpec.label,
8038
+ items: [{
8039
+ label: 'Com dados',
8040
+ color: _resolvedColor
8041
+ }, {
8042
+ label: 'Sem dados',
8043
+ color: NO_DATA_COLOR
8044
+ }]
8045
+ }, {
8046
+ type: 'ProportionalSymbolLegend',
8047
+ unit: viewSpec.measure_unit,
8048
+ title: viewSpec.label,
8049
+ min: Math.min.apply(Math, _toConsumableArray(_values)),
8050
+ max: Math.max.apply(Math, _toConsumableArray(_values)),
8051
+ sizeMin: SIZE_MIN * 2,
8052
+ sizeMax: SIZE_MAX * 2,
8053
+ numberFormat: ['pt-BR', {
8054
+ maximumFractionDigits: 0
8055
+ }]
8056
+ }];
8057
+ });
8058
+ return _legends;
8059
+ }
8060
+ function _main_circle(props, viewSpec, allViewSpecs, context) {
8061
+ _objectDestructuringEmpty(props);
8062
+ var source_layer = viewSpec.source_layer;
8063
+ return {
8064
+ zIndex: Z_OVERLAY_BASE_1000,
8065
+ source: MAIN_SOURCE_ID,
8066
+ 'source-layer': source_layer,
8067
+ interactive: true,
8068
+ type: 'circle',
8069
+ // 'circle-sort-key': resolve.fn((ctx) => {
8070
+ // if (!viewSpec.style.radius?.valueKey) {
8071
+ // return 0
8072
+ // }
8073
+
8074
+ // return ['coalesce', ['get', viewSpec.style.radius.valueKey], 0]
8075
+ // }),
8076
+ paint: {
8077
+ 'circle-color': resolve.fn(function (ctx) {
8078
+ var _viewSpec$style2, _viewSpec$style3;
8079
+ var _resolvedColor = resolveColor((_viewSpec$style2 = viewSpec.style) === null || _viewSpec$style2 === void 0 ? void 0 : _viewSpec$style2.color) || schemeGeoReDUS.laranja;
8080
+ if ((_viewSpec$style3 = viewSpec.style) !== null && _viewSpec$style3 !== void 0 && (_viewSpec$style3 = _viewSpec$style3.radius) !== null && _viewSpec$style3 !== void 0 && _viewSpec$style3.valueKey) {
8081
+ var _viewSpec$style4;
8082
+ return ['case', ['==', ['typeof', ['get', (_viewSpec$style4 = viewSpec.style) === null || _viewSpec$style4 === void 0 || (_viewSpec$style4 = _viewSpec$style4.radius) === null || _viewSpec$style4 === void 0 ? void 0 : _viewSpec$style4.valueKey]], 'number'], _resolvedColor, NO_DATA_COLOR];
8083
+ } else {
8084
+ return _resolvedColor;
8085
+ }
8086
+ }),
8087
+ 'circle-opacity': 1,
8088
+ 'circle-radius': resolve.fn(function (ctx) {
8089
+ var _viewSpec$style$radiu, _viewSpec$style5;
8090
+ if (!((_viewSpec$style$radiu = viewSpec.style.radius) !== null && _viewSpec$style$radiu !== void 0 && _viewSpec$style$radiu.valueKey)) {
8091
+ return 10;
8092
+ }
8093
+ var values = _validNumericalValues(ctx.view.metadata.radiusData.values);
8094
+ return zoomSensitiveLinearSizes({
8095
+ variable: ['get', (_viewSpec$style5 = viewSpec.style) === null || _viewSpec$style5 === void 0 || (_viewSpec$style5 = _viewSpec$style5.radius) === null || _viewSpec$style5 === void 0 ? void 0 : _viewSpec$style5.valueKey],
8096
+ minValue: Math.min.apply(Math, _toConsumableArray(values)),
8097
+ maxValue: Math.max.apply(Math, _toConsumableArray(values)),
8098
+ minSize: SIZE_MIN,
8099
+ maxSize: SIZE_MAX
8100
+ });
8101
+ })
8102
+ },
8103
+ legends: _main_circle_legends(props, viewSpec),
8104
+ tooltip: basicTooltip(viewSpec.tooltip)
8105
+ };
8106
+ }
8107
+ function layers(viewSpec, allViewSpecs, context) {
8108
+ var source_layer = viewSpec.source_layer;
8109
+ if (!source_layer) {
8110
+ throw new Error('source_layer must be defined');
8111
+ }
8112
+ return _defineProperty({}, "main_circle", _main_circle({}, viewSpec));
8113
+ }
8114
+
8115
+ function parseStyleSpec(styleInput) {
8116
+ return __assign({}, styleInput);
8117
+ }
8118
+
8119
+ function download(viewSpec, allViewSpecs, context) {
8120
+ return basicDownload({
8121
+ fileName: slugify(viewSpec.label),
8122
+ downloadUrl: interpolate(viewSpec.download_url || "", {
8123
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
8124
+ })
8125
+ });
8126
+ }
8127
+
8128
+ var _excluded$6 = ["style"];
8129
+ function vector_point_continuous(_ref, allViewSpecs, context) {
8130
+ var style = _ref.style,
8131
+ viewSpec = _objectWithoutProperties(_ref, _excluded$6);
8132
+ viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
8133
+ style: parseStyleSpec(style)
8134
+ });
8135
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel'])), {}, {
8136
+ // confSchema: confSchema(viewSpec, allViewSpecs, context),
8137
+ metadata: metadata(viewSpec, allViewSpecs, context),
8138
+ sources: sources(viewSpec, allViewSpecs, context),
8139
+ layers: layers(viewSpec),
8140
+ download: download(viewSpec, allViewSpecs, context)
8141
+ });
8142
+ }
8143
+
6512
8144
  var PRESETS = /*#__PURE__*/Object.freeze({
6513
8145
  __proto__: null,
6514
8146
  cem_censo_2010_2022: cem_censo_2010_2022,
@@ -6517,7 +8149,12 @@ var PRESETS = /*#__PURE__*/Object.freeze({
6517
8149
  cem_saude_2024: cem_saude_2024,
6518
8150
  vector_circle: vector_circle,
6519
8151
  vector_line: vector_line,
6520
- vector_polygon: vector_polygon
8152
+ vector_point_continuous: vector_point_continuous,
8153
+ vector_point_single: vector_point_single,
8154
+ vector_polygon: vector_polygon,
8155
+ vector_polygon_categorical: vector_polygon_categorical,
8156
+ vector_polygon_continuous: vector_polygon_continuous,
8157
+ vector_polygon_single: vector_polygon_single
6521
8158
  });
6522
8159
 
6523
8160
  function parseViewSpec(specInput, otherSpecInputs, context) {
@@ -6657,7 +8294,17 @@ function resolveConfSchema(viewSpec, partialView, viewResolutionContextBase) {
6657
8294
  });
6658
8295
  return resolveExpr(viewSpec.confSchema, resolveFinalContext);
6659
8296
  }
6660
- var resolveMetadata = _stageResolver('metadata');
8297
+ // export const resolveMetadata = _stageResolver<
8298
+ // Pick<ResolvedView, 'conf'>,
8299
+ // ResolvedView['metadata']
8300
+ // >('metadata')
8301
+ //Changed resolveMetadata to get sourceLabel from viewSpec
8302
+ var resolveMetadata = _stageResolver('metadata', function (metadata, _a) {
8303
+ var viewSpec = _a.viewSpec;
8304
+ return __assign(__assign({}, metadata), {
8305
+ sourceLabel: viewSpec.sourceLabel
8306
+ });
8307
+ });
6661
8308
  var resolveSources = _stageResolver('sources');
6662
8309
  var resolveLayers = _stageResolver('layers', function (layersBase, _a) {
6663
8310
  //
@@ -7128,8 +8775,8 @@ function br_divisao_territorial_views(conf) {
7128
8775
  ];
7129
8776
  }
7130
8777
 
7131
- var _templateObject$6;
7132
- var StyledIframe = styled.iframe(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n border: none;\n width: 100%;\n height: 100%;\n"])));
8778
+ var _templateObject$8;
8779
+ var StyledIframe = styled.iframe(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteral(["\n border: none;\n width: 100%;\n height: 100%;\n"])));
7133
8780
  function DocumentIframe(_ref) {
7134
8781
  var src = _ref.src;
7135
8782
  return /*#__PURE__*/React.createElement(AspectRatio, {
@@ -7590,8 +9237,8 @@ function overture_places_poc(_ref) {
7590
9237
  };
7591
9238
  }
7592
9239
 
7593
- var _templateObject$5, _templateObject2$3;
7594
- var AutoWrapContainer = styled.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n display: flex;\n direction: row;\n flex-wrap: wrap;\n margin-left: -10px;\n margin-top: -10px;\n\n > * {\n margin-left: 10px;\n margin-top: 10px;\n }\n"])));
9240
+ var _templateObject$7, _templateObject2$3;
9241
+ var AutoWrapContainer = styled.div(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteral(["\n display: flex;\n direction: row;\n flex-wrap: wrap;\n margin-left: -10px;\n margin-top: -10px;\n\n > * {\n margin-left: 10px;\n margin-top: 10px;\n }\n"])));
7595
9242
  var UnstyledList = styled.ul(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteral(["\n margin: 0;\n"])));
7596
9243
  var REDUS_MUTIRAO_COP_2025_ID = 'redus_mutirao_cop_2025.geom';
7597
9244
  var URL_RE = /^https?:\/\//;
@@ -8295,7 +9942,12 @@ var index = /*#__PURE__*/Object.freeze({
8295
9942
  temperatura_superficie: temperatura_superficie,
8296
9943
  vector_circle: vector_circle,
8297
9944
  vector_line: vector_line,
8298
- vector_polygon: vector_polygon
9945
+ vector_point_continuous: vector_point_continuous,
9946
+ vector_point_single: vector_point_single,
9947
+ vector_polygon: vector_polygon,
9948
+ vector_polygon_categorical: vector_polygon_categorical,
9949
+ vector_polygon_continuous: vector_polygon_continuous,
9950
+ vector_polygon_single: vector_polygon_single
8299
9951
  });
8300
9952
 
8301
9953
  var CollapsibleContent_slideDown = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n"], ["\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n"])));
@@ -8535,8 +10187,8 @@ function ViewConfTabs(_ref) {
8535
10187
  }
8536
10188
 
8537
10189
  var _excluded$4 = ["textSearch", "content", "maxLines"];
8538
- var _templateObject$4, _templateObject2$2;
8539
- var Container$1 = styled(Box)(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n --view-control-base-padding: 12px;\n box-shadow:\n rgba(0, 0, 0, 0.12) 0px 1px 3px,\n rgba(0, 0, 0, 0.24) 0px 1px 2px;\n\n border-radius: 2px;\n background-color: var(--redus-bege, white);\n // background-color: var(--accent-4, white);\n"])));
10190
+ var _templateObject$6, _templateObject2$2;
10191
+ var Container$1 = styled(Box)(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n --view-control-base-padding: 12px;\n box-shadow:\n rgba(0, 0, 0, 0.12) 0px 1px 3px,\n rgba(0, 0, 0, 0.24) 0px 1px 2px;\n\n border-radius: 2px;\n background-color: var(--redus-bege, white);\n // background-color: var(--accent-4, white);\n"])));
8540
10192
  var Summary = styled.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral(["\n // background-color: var(--redus-bege, white);\n background-color: ", ";\n padding: 0;\n\n transition: background-color 0.1s ease-out;\n\n display: flex;\n border: none;\n text-align: left;\n width: 100%;\n\n cursor: pointer;\n\n &:hover {\n // background-color: color-mix(in srgb, var(--redus-bege) 80%, white);\n background-color: ", ";\n }\n\n &:active {\n filter: brightness(96%);\n }\n"])), function (_ref) {
8541
10193
  var $active = _ref.$active;
8542
10194
  return $active ? 'var(--redus-bege, white)' : 'var(--accent-2)';
@@ -8686,7 +10338,7 @@ function ViewControl(_ref8) {
8686
10338
  }
8687
10339
 
8688
10340
  var _excluded$3 = ["viewSpecs", "viewConfState", "resolvedViews", "onSetView", "onDeactivateView", "style", "categoryIcons"];
8689
- var _templateObject$3, _templateObject2$1;
10341
+ var _templateObject$5, _templateObject2$1;
8690
10342
  var CATEGORY_ICONS = {
8691
10343
  'populacao-e-domicilios': /*#__PURE__*/React$1.createElement(Icon, {
8692
10344
  path: mdiAccountGroup
@@ -8715,7 +10367,7 @@ var ViewMenuContext = /*#__PURE__*/createContext({
8715
10367
  onSetView: errNoViewMenuContext,
8716
10368
  onDeactivateView: errNoViewMenuContext
8717
10369
  });
8718
- var ActiveCounter = styled.div(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n transform: translate(-30%, -30%);\n border-radius: 50%;\n border: 1px solid white;\n height: 20px;\n width: 20px;\n font-size: 12px;\n background-color: var(--accent-9);\n color: white;\n font-weight: bold;\n\n display: flex;\n align-items: center;\n justify-content: center;\n"])));
10370
+ var ActiveCounter = styled.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n transform: translate(-30%, -30%);\n border-radius: 50%;\n border: 1px solid white;\n height: 20px;\n width: 20px;\n font-size: 12px;\n background-color: var(--accent-9);\n color: white;\n font-weight: bold;\n\n display: flex;\n align-items: center;\n justify-content: center;\n"])));
8719
10371
  function Item(_ref) {
8720
10372
  var node = _ref.node;
8721
10373
  _ref.depth;
@@ -8875,6 +10527,76 @@ function ViewMenu(_ref4) {
8875
10527
  }, props))));
8876
10528
  }
8877
10529
 
10530
+ function GeoReDUSLogo(props) {
10531
+ var _props$color = props.color,
10532
+ color = _props$color === void 0 ? '#ffffff' : _props$color;
10533
+ return /*#__PURE__*/React$1.createElement("svg", {
10534
+ version: "1.1",
10535
+ id: "Layer_1",
10536
+ xmlns: "http://www.w3.org/2000/svg",
10537
+ x: "0px",
10538
+ y: "0px",
10539
+ viewBox: "0 0 419.41 149.65"
10540
+ }, /*#__PURE__*/React$1.createElement("g", null, /*#__PURE__*/React$1.createElement("g", null, /*#__PURE__*/React$1.createElement("path", {
10541
+ fill: color,
10542
+ d: "M182.02,70.21c-7.67,0-13.57-2.05-17.71-6.14c-4.14-4.09-6.21-10.45-6.21-19.06c0-5.73,0.99-10.45,2.98-14.16 c1.99-3.72,4.87-6.48,8.66-8.31c3.79-1.82,8.33-2.73,13.63-2.73c3.17,0,6.15,0.35,8.95,1.06s5.27,1.8,7.42,3.27 c2.15,1.47,3.83,3.3,5.04,5.5c1.21,2.2,1.81,4.82,1.81,7.85h-10.72c0-1.47-0.32-2.77-0.96-3.91c-0.64-1.14-1.53-2.08-2.66-2.84 c-1.14-0.76-2.44-1.32-3.9-1.7c-1.47-0.38-3.01-0.57-4.62-0.57c-2.46,0-4.61,0.32-6.46,0.96s-3.37,1.61-4.58,2.91 c-1.21,1.3-2.12,2.92-2.73,4.86c-0.62,1.94-0.92,4.19-0.92,6.75v2.13c0,3.55,0.52,6.46,1.56,8.73c1.04,2.27,2.6,3.96,4.69,5.08 c2.08,1.11,4.66,1.67,7.74,1.67c2.56,0,4.82-0.39,6.78-1.17c1.96-0.78,3.5-1.9,4.62-3.37c1.11-1.47,1.67-3.27,1.67-5.4v-0.5 h-14.56v-8.09h25.06v26.34h-6.96l-0.92-5.25c-1.42,1.37-2.95,2.51-4.58,3.41c-1.63,0.9-3.44,1.57-5.43,2.02 C186.7,69.99,184.48,70.21,182.02,70.21z"
10543
+ })), /*#__PURE__*/React$1.createElement("g", null, /*#__PURE__*/React$1.createElement("path", {
10544
+ fill: color,
10545
+ d: "M272.34,70.12c-3.84,0-7.1-0.66-9.78-1.98c-2.68-1.32-4.71-3.35-6.1-6.1c-1.38-2.75-2.08-6.2-2.08-10.35 c0-4.24,0.69-7.72,2.08-10.42c1.38-2.7,3.42-4.71,6.1-6.03c2.68-1.32,5.94-1.98,9.78-1.98c3.93,0,7.22,0.66,9.88,1.98 c2.66,1.32,4.68,3.33,6.06,6.03c1.38,2.7,2.08,6.18,2.08,10.42c0,4.15-0.69,7.6-2.08,10.35c-1.38,2.75-3.41,4.78-6.06,6.1 C279.56,69.46,276.27,70.12,272.34,70.12z M272.34,62.88c2.05,0,3.7-0.38,4.92-1.14c1.23-0.76,2.13-1.92,2.71-3.48 c0.58-1.56,0.87-3.48,0.87-5.76v-1.61c0-2.28-0.29-4.2-0.87-5.76c-0.58-1.56-1.49-2.74-2.71-3.52c-1.23-0.78-2.87-1.17-4.92-1.17 c-2.01,0-3.63,0.39-4.86,1.17c-1.23,0.78-2.13,1.95-2.71,3.52c-0.58,1.56-0.87,3.48-0.87,5.76v1.61c0,2.28,0.29,4.2,0.87,5.76 c0.58,1.56,1.48,2.73,2.71,3.48C268.71,62.5,270.33,62.88,272.34,62.88z"
10546
+ })), /*#__PURE__*/React$1.createElement("g", null, /*#__PURE__*/React$1.createElement("path", {
10547
+ fill: color,
10548
+ d: "M234.74,107.79c0-1.95-0.59-3.58-1.77-4.91c-1.18-1.33-3.02-1.99-5.53-1.99c-2.53,0-4.49,0.71-5.88,2.14 c-1.39,1.42-2.26,3.38-2.63,5.86l15.77-0.15C234.73,108.52,234.74,108.21,234.74,107.79L234.74,107.79z M236.92,95.29 c2.45,1.52,4.25,3.51,5.42,5.97c1.17,2.46,1.75,5.12,1.75,7.99c0,1.95-0.29,3.93-0.88,5.95l-23.98,0.18 c0.61,2.26,1.77,4.02,3.49,5.26c1.72,1.24,3.95,1.86,6.7,1.86c1.63,0,3.36-0.18,5.18-0.55c1.83-0.37,3.65-0.9,5.48-1.61l1.86,7.56 c-1.73,0.73-3.92,1.34-6.57,1.83c-2.65,0.49-5.06,0.73-7.23,0.73c-5.91,0-10.51-1.54-13.78-4.62c-3.27-3.08-4.91-7.82-4.91-14.22 c0-3.99,0.72-7.38,2.17-10.17c1.45-2.79,3.54-4.89,6.28-6.32c2.74-1.42,6.03-2.14,9.87-2.14 C231.42,93.01,234.47,93.77,236.92,95.29L236.92,95.29z"
10549
+ }), /*#__PURE__*/React$1.createElement("path", {
10550
+ fill: color,
10551
+ d: "M239.62,47.35c0-1.95-0.59-3.58-1.77-4.91c-1.18-1.33-3.02-1.99-5.53-1.99c-2.53,0-4.49,0.71-5.88,2.14 c-1.39,1.42-2.26,3.38-2.63,5.86l15.77-0.15C239.61,48.08,239.62,47.76,239.62,47.35L239.62,47.35z M241.8,34.84 c2.45,1.52,4.25,3.51,5.42,5.97c1.17,2.46,1.75,5.12,1.75,7.99c0,1.95-0.29,3.93-0.88,5.95l-23.98,0.18 c0.61,2.26,1.77,4.02,3.49,5.26c1.72,1.24,3.95,1.86,6.7,1.86c1.63,0,3.36-0.18,5.18-0.55c1.83-0.37,3.65-0.9,5.48-1.61l1.86,7.56 c-1.73,0.73-3.92,1.34-6.57,1.83c-2.65,0.49-5.06,0.73-7.23,0.73c-5.91,0-10.51-1.54-13.78-4.62c-3.27-3.08-4.91-7.82-4.91-14.22 c0-3.99,0.72-7.38,2.17-10.17c1.45-2.79,3.54-4.89,6.28-6.32c2.74-1.42,6.03-2.14,9.87-2.14C236.3,32.56,239.35,33.32,241.8,34.84 L241.8,34.84z"
10552
+ }), /*#__PURE__*/React$1.createElement("path", {
10553
+ fill: color,
10554
+ d: "M270.56,121.41c3.65,0,6.77-0.72,9.36-2.15c2.59-1.44,4.56-3.52,5.91-6.26c1.35-2.74,2.03-6.05,2.03-9.95 c0-5.91-1.43-10.33-4.29-13.23c-2.86-2.91-7.09-4.35-12.69-4.33l-8.4,0.07v35.85H270.56L270.56,121.41z M252.82,77.31h18.22 c8.83,0,15.5,2.09,20,6.28c4.5,4.19,6.75,10.6,6.75,19.24c0,5.45-1.13,10.19-3.39,14.22c-2.26,4.03-5.46,7.13-9.58,9.31 c-4.13,2.18-8.9,3.27-14.33,3.27l-17.67,0.07V77.31L252.82,77.31z"
10555
+ }), /*#__PURE__*/React$1.createElement("path", {
10556
+ fill: color,
10557
+ d: "M311.42,125.06c-3.37-3.63-5.06-8.88-5.06-15.77V77.27h9.71v31.36c0,8.81,3.84,13.22,11.54,13.22 c7.3,0,10.95-4.22,10.95-12.67V77.27h9.67v31.18c0,14.7-7.08,22.05-21.25,22.05C319.98,130.5,314.8,128.69,311.42,125.06 L311.42,125.06z"
10558
+ }), /*#__PURE__*/React$1.createElement("path", {
10559
+ fill: color,
10560
+ d: "M365.43,129.29c-2.51-0.66-5.38-1.74-8.62-3.25l3.36-8.62c2.85,1.44,5.24,2.42,7.19,2.96 c1.95,0.54,3.95,0.8,6.02,0.8c3.21,0,5.56-0.6,7.05-1.81c1.48-1.21,2.23-2.82,2.23-4.84c0-1.22-0.41-2.26-1.22-3.14 c-0.82-0.88-1.84-1.61-3.07-2.19c-1.23-0.58-2.96-1.3-5.2-2.15c-3.12-1.17-5.66-2.28-7.63-3.34c-1.97-1.06-3.66-2.55-5.06-4.47 c-1.4-1.92-2.1-4.37-2.1-7.34c0-3.46,0.85-6.34,2.56-8.65c1.7-2.31,3.95-4.01,6.75-5.09c2.8-1.08,5.89-1.62,9.27-1.62 c2.46,0,4.77,0.24,6.94,0.71c2.17,0.47,4.31,1.14,6.42,1.99l-3.1,8.4l-0.91-0.33c-1.51-0.58-2.92-1.03-4.23-1.35 c-1.31-0.32-2.9-0.47-4.75-0.47c-2.39,0-4.42,0.47-6.1,1.42c-1.68,0.95-2.52,2.43-2.52,4.45c0,1.05,0.36,1.96,1.08,2.74 c0.72,0.78,1.63,1.44,2.74,1.99c1.11,0.55,2.66,1.21,4.65,1.99c3.09,1.24,5.63,2.42,7.63,3.54c1.99,1.12,3.71,2.72,5.15,4.8 c1.44,2.08,2.15,4.72,2.15,7.9c0,3.26-0.74,6.09-2.21,8.49c-1.47,2.4-3.61,4.24-6.41,5.53c-2.8,1.29-6.17,1.93-10.11,1.93 C370.59,130.28,367.94,129.95,365.43,129.29L365.43,129.29z"
10561
+ }), /*#__PURE__*/React$1.createElement("path", {
10562
+ fill: color,
10563
+ d: "M191.16,105.78c3.07-1.17,5.48-2.91,7.25-5.24c1.76-2.32,2.66-5.08,2.68-8.27c0-3.21-0.71-5.94-2.12-8.18 c-1.41-2.24-3.41-3.94-6.01-5.09c-2.59-1.16-5.63-1.73-9.11-1.73h-18.47v52.35h9.71l-0.03-12.18l-0.01-32.65l5.99-0.04 c3.19-0.05,5.64,0.62,7.36,1.99c1.72,1.37,2.57,3.43,2.57,6.15c0,2.7-0.94,4.78-2.83,6.22c-1.77,1.36-4.22,2.08-7.32,2.16h-0.14 v5.79l14.52,22.56h11.57L191.16,105.78L191.16,105.78z"
10564
+ }), /*#__PURE__*/React$1.createElement("path", {
10565
+ fill: color,
10566
+ d: "M90.31,32.32l-3.1-0.07c0.06-2.71-0.94-5.28-2.81-7.23c-1.87-1.96-4.39-3.07-7.1-3.13l0.07-3.1 c3.54,0.08,6.83,1.53,9.27,4.08C89.08,25.43,90.38,28.78,90.31,32.32L90.31,32.32z"
10567
+ }), /*#__PURE__*/React$1.createElement("path", {
10568
+ fill: color,
10569
+ d: "M98.65,32.5l-3.1-0.07c0.22-10.18-7.88-18.65-18.07-18.87l0.07-3.1C89.45,10.72,98.91,20.6,98.65,32.5 L98.65,32.5z"
10570
+ }), /*#__PURE__*/React$1.createElement("path", {
10571
+ fill: color,
10572
+ d: "M76.98,35.82c2.47,0.05,4.51-1.9,4.56-4.37c0.05-2.47-1.9-4.51-4.37-4.56c-2.47-0.05-4.51,1.9-4.56,4.37 C72.56,33.73,74.51,35.77,76.98,35.82L76.98,35.82z"
10573
+ }), /*#__PURE__*/React$1.createElement("path", {
10574
+ fill: color,
10575
+ d: "M73.98,118.14c-3.84,0-6.97,3.13-6.97,6.97c0,3.84,3.13,6.97,6.97,6.97l0.23,0.02 c0.03,0.01,4.8,0.42,12.67-6.99c-7.86-7.49-12.62-6.99-12.67-6.98l-0.13,0.02L73.98,118.14L73.98,118.14z M74.44,135.2 c-0.24,0-0.43-0.01-0.55-0.03c-5.51-0.05-9.97-4.55-9.97-10.07c0-5.52,4.46-10.01,9.96-10.07c1.17-0.14,7.18-0.29,16.33,8.98 l1.08,1.1l-1.09,1.09C82.03,134.38,76.38,135.2,74.44,135.2L74.44,135.2z"
10576
+ }), /*#__PURE__*/React$1.createElement("path", {
10577
+ fill: color,
10578
+ d: "M77.22,80.53c3.15,0,5.71-2.56,5.71-5.71c0-3.15-2.56-5.71-5.71-5.71c-3.15,0-5.71,2.56-5.71,5.71 C71.51,77.98,74.06,80.53,77.22,80.53L77.22,80.53z"
10579
+ }), /*#__PURE__*/React$1.createElement("path", {
10580
+ fill: color,
10581
+ d: "M77.8,126.65c-23.03,0-41.76-18.73-41.76-41.76c0-23,18.7-41.71,41.69-41.71c23,0,41.71,18.71,41.71,41.71 h-3.1c0-21.29-17.32-38.61-38.61-38.61c-21.28,0-38.59,17.32-38.59,38.61c0,21.32,17.34,38.66,38.66,38.66V126.65L77.8,126.65z"
10582
+ }), /*#__PURE__*/React$1.createElement("path", {
10583
+ fill: color,
10584
+ d: "M77.71,139.79c-30.28,0-54.92-24.63-54.92-54.9c0-30.28,24.64-54.92,54.92-54.92v3.1 c-28.58,0-51.82,23.25-51.82,51.82c0,28.56,23.25,51.8,51.82,51.8c28.56,0,51.8-23.24,51.8-51.8h3.1 C132.6,115.16,107.98,139.79,77.71,139.79L77.71,139.79z"
10585
+ }), /*#__PURE__*/React$1.createElement("path", {
10586
+ fill: color,
10587
+ d: "M77.65,113.25c-4.64,0-8.27-1.37-10.8-4.07c-3.85-4.1-3.69-9.79-3.66-10.46v-6.47c0-4.73,3.85-8.57,8.57-8.57 h12.71c4.73,0,8.57,3.85,8.57,8.57l0,0.07c-0.01,0.11-0.7,11.23-15.96,11.23v-3.1c11.94,0,12.81-7.59,12.87-8.25 c-0.03-3-2.47-5.42-5.47-5.42H71.76c-3.02,0-5.47,2.46-5.47,5.47l0,6.61c0,0.05-0.25,4.94,2.84,8.22 c1.92,2.04,4.79,3.07,8.53,3.07c13.91,0,25.22-11.33,25.22-25.25c0-13.91-11.31-25.22-25.22-25.22 c-13.88,0-24.76,11.08-24.76,25.22h-3.1c0-15.88,12.24-28.32,27.86-28.32c15.62,0,28.32,12.7,28.32,28.32 C105.97,100.53,93.26,113.25,77.65,113.25L77.65,113.25z"
10588
+ }), /*#__PURE__*/React$1.createElement("path", {
10589
+ fill: color,
10590
+ d: "M131.1,66.21c-2.22,0-4.03-1.8-4.03-4.03c0-2.22,1.8-4.03,4.03-4.03c2.22,0,4.03,1.8,4.03,4.03 C135.12,64.41,133.32,66.21,131.1,66.21L131.1,66.21z M140.73,62.31c0-5.35-4.33-9.68-9.68-9.68c-5.35,0-9.68,4.33-9.68,9.68 c0,0-0.98,6.53,9.68,17.18C141.84,68.84,140.73,62.31,140.73,62.31L140.73,62.31z"
10591
+ }), /*#__PURE__*/React$1.createElement("polygon", {
10592
+ fill: color,
10593
+ points: "120.73,93.6 112.2,93.6 112.2,102.12 120.73,102.12 120.73,93.6 "
10594
+ }), /*#__PURE__*/React$1.createElement("polygon", {
10595
+ fill: color,
10596
+ points: "108.64,110.54 100.11,110.54 100.11,119.06 108.64,119.06 108.64,110.54 "
10597
+ }))));
10598
+ }
10599
+
8878
10600
  function GeoReDUSLogoSymbol() {
8879
10601
  var color = '#FFFFFF';
8880
10602
  return /*#__PURE__*/React$1.createElement("svg", {
@@ -9035,15 +10757,17 @@ function CopyToClipboardIconButton(_ref2) {
9035
10757
  }
9036
10758
 
9037
10759
  var _excluded$2 = ["url"];
9038
- var _templateObject$2;
9039
- var Container = styled(Flex)(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n > * {\n height: 32px;\n }\n"])));
10760
+ var _templateObject$4;
10761
+ var Container = styled(Flex)(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n > * {\n height: 32px;\n }\n"])));
9040
10762
  var ShareButtonBar = function ShareButtonBar(_ref) {
9041
10763
  var url = _ref.url,
9042
10764
  props = _objectWithoutProperties(_ref, _excluded$2);
9043
10765
  var _useLocation = useLocation(),
9044
10766
  href = _useLocation.href;
9045
10767
  var shareUrl = url ? url : href;
9046
- return /*#__PURE__*/React$1.createElement(Container, _extends({
10768
+ return /*#__PURE__*/React$1.createElement(Flex, {
10769
+ direction: "column"
10770
+ }, /*#__PURE__*/React$1.createElement(Text, null, "Compartilhar"), /*#__PURE__*/React$1.createElement(Container, _extends({
9047
10771
  direction: "row",
9048
10772
  gap: "3"
9049
10773
  }, props), /*#__PURE__*/React$1.createElement(CopyToClipboardIconButton, {
@@ -9078,49 +10802,751 @@ var ShareButtonBar = function ShareButtonBar(_ref) {
9078
10802
  }, /*#__PURE__*/React$1.createElement(WhatsappIcon, {
9079
10803
  size: 32,
9080
10804
  round: true
9081
- })));
10805
+ }))));
9082
10806
  };
9083
10807
 
9084
- //
9085
- // html2canvas does not support color functions
9086
- // radix uses: oklch and color(...)
9087
- //
9088
- // https://github.com/niklasvh/html2canvas/issues/2700
9089
- //
9090
- // import html2canvas from 'html2canvas-pro'
9091
- // import { useQuery } from '@tanstack/react-query'
10808
+ var SKY_STYLE = {
10809
+ 'sky-color': '#199EF3',
10810
+ 'sky-horizon-blend': 0.5,
10811
+ 'horizon-color': '#d3edfd',
10812
+ 'horizon-fog-blend': 0.5,
10813
+ 'fog-color': '#0000ff',
10814
+ 'fog-ground-blend': 0.5,
10815
+ 'atmosphere-blend': ['interpolate', ['linear'], ['zoom'], 0, 1, 10, 1, 12, 0]
10816
+ };
9092
10817
 
9093
- function SharePanel(_ref) {
9094
- _ref.syncedMapsRef;
9095
- _ref.mapContainerRef;
9096
- //
9097
- // Experimental image exporting
9098
- //
9099
- // const imageBlobQuery = useQuery({
9100
- // queryKey: ['a'],
9101
- // queryFn: async () => {
9102
- // // const canvas = await html2canvas(mapContainerRef.current)
9103
- // // const canvas = document.querySelector('canvas.maplibregl-canvas')
9104
- // const canvas = syncedMapsRef.current?.mapInstances?.[0].map.getCanvas()
9105
-
9106
- // return new Promise((resolve, reject) => {
9107
- // canvas.toBlob((blob) => {
9108
- // if (blob) {
9109
- // resolve(blob)
9110
- // } else {
9111
- // reject()
9112
- // }
9113
- // })
9114
- // })
9115
- // },
9116
- // retry: false,
9117
- // throwOnError: process.env.NODE_ENV !== 'production',
9118
- // })
10818
+ var _templateObject$3;
10819
+ var style = {
10820
+ border: 'none',
10821
+ borderRadius: '70px',
10822
+ backgroundColor: 'transparent'
10823
+ };
10824
+ var circleStyle = {
10825
+ border: '2px solid black',
10826
+ borderRadius: '70px',
10827
+ padding: '4px',
10828
+ width: '30px',
10829
+ height: '30px',
10830
+ cursor: 'pointer',
10831
+ display: 'flex',
10832
+ alignItems: 'center',
10833
+ justifyContent: 'center'
10834
+ };
10835
+ var ArrowIcon = styled(Icon)(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n transform: rotate(", "deg);\n"])), function (props) {
10836
+ return -props.bearing;
10837
+ });
10838
+
10839
+ /**
10840
+ * NorthArrow Control Component
10841
+ *
10842
+ * Displays a rotatable north arrow that syncs with the map's bearing.
10843
+ * Click to reset the map bearing to 0°.
10844
+ *
10845
+ * @param {Object} props
10846
+ * @param {string} [props.position='bottom-right'] - Position in MapLibre control bar
10847
+ * @param {React.CSSProperties} [props.style] - Additional styles for the container
10848
+ */
10849
+
10850
+ function NorthArrow(_ref) {
10851
+ var _ref$position = _ref.position,
10852
+ position = _ref$position === void 0 ? 'bottom-right' : _ref$position,
10853
+ className = _ref.className,
10854
+ _ref$hidden = _ref.hidden,
10855
+ hidden = _ref$hidden === void 0 ? false : _ref$hidden;
10856
+ var containerRef = useRef(null);
10857
+ var mapRef = useRef(null);
10858
+ var _useState = useState(null),
10859
+ _useState2 = _slicedToArray(_useState, 2),
10860
+ mountPoint = _useState2[0],
10861
+ setMountPoint = _useState2[1];
10862
+ var _useState3 = useState(0),
10863
+ _useState4 = _slicedToArray(_useState3, 2),
10864
+ bearing = _useState4[0],
10865
+ setBearing = _useState4[1];
10866
+ var mapContext = useMap();
10867
+
10868
+ // Register as a MapLibre control
10869
+ useControl(function () {
10870
+ var container = document.createElement('div');
10871
+ container.className = 'maplibregl-ctrl maplibregl-ctrl-group';
10872
+ var mount = document.createElement('div');
10873
+ container.appendChild(mount);
10874
+ containerRef.current = container;
10875
+ setMountPoint(mount);
10876
+ return {
10877
+ onAdd: function onAdd(map) {
10878
+ mapRef.current = map;
10879
+ return container;
10880
+ },
10881
+ onRemove: function onRemove() {
10882
+ if (containerRef.current) {
10883
+ containerRef.current.remove();
10884
+ }
10885
+ mapRef.current = null;
10886
+ }
10887
+ };
10888
+ }, {
10889
+ position: position
10890
+ });
10891
+
10892
+ // Listen to map bearing changes
10893
+ useEffect(function () {
10894
+ var _mapContext$current, _mapContext$current$g;
10895
+ var map = mapRef.current || (mapContext === null || mapContext === void 0 || (_mapContext$current = mapContext.current) === null || _mapContext$current === void 0 || (_mapContext$current$g = _mapContext$current.getMap) === null || _mapContext$current$g === void 0 ? void 0 : _mapContext$current$g.call(_mapContext$current));
10896
+ if (!map) return;
10897
+ var handleMove = function handleMove() {
10898
+ setBearing(map.getBearing());
10899
+ };
10900
+ setBearing(map.getBearing());
10901
+ map.on('move', handleMove);
10902
+ return function () {
10903
+ map.off('move', handleMove);
10904
+ };
10905
+ }, [mapContext]);
10906
+
10907
+ // Handle reset bearing on click
10908
+ var handleClick = function handleClick() {
10909
+ var _mapContext$current2, _mapContext$current2$;
10910
+ var map = mapRef.current || (mapContext === null || mapContext === void 0 || (_mapContext$current2 = mapContext.current) === null || _mapContext$current2 === void 0 || (_mapContext$current2$ = _mapContext$current2.getMap) === null || _mapContext$current2$ === void 0 ? void 0 : _mapContext$current2$.call(_mapContext$current2));
10911
+ if (map && map.getBearing() !== 0) {
10912
+ map.easeTo({
10913
+ bearing: 0
10914
+ });
10915
+ }
10916
+ };
10917
+ return mountPoint ? /*#__PURE__*/createPortal(/*#__PURE__*/React$1.createElement(ControlContainer, {
10918
+ onClick: handleClick,
10919
+ title: "Click to reset bearing to north",
10920
+ style: style,
10921
+ position: position
10922
+ }, /*#__PURE__*/React$1.createElement("div", {
10923
+ style: _objectSpread2(_objectSpread2({}, circleStyle), {}, {
10924
+ display: hidden ? 'none' : 'flex'
10925
+ }),
10926
+ className: className
10927
+ }, /*#__PURE__*/React$1.createElement(ArrowIcon, {
10928
+ path: mdiNavigation,
10929
+ size: "25px",
10930
+ bearing: bearing
10931
+ // style={{ marginTop: '3px' }}
10932
+ }))), mountPoint) : null;
10933
+ }
10934
+
10935
+ /**
10936
+ * Calculate all paper layout dimensions based on a given paper width
10937
+ * Uses A4 aspect ratio (1:√2) and derives all other constants
10938
+ *
10939
+ * @param {number} paperWidth - The width of the paper in pixels
10940
+ * @returns {Object} Object containing all calculated dimensions
10941
+ */
10942
+ function getPaperDimensions(paperWidth) {
10943
+ var PAPER_WIDTH = paperWidth;
10944
+ var PAPER_HEIGHT = Math.round(PAPER_WIDTH / Math.sqrt(2));
10945
+ var MARGIN = Math.round(PAPER_HEIGHT * 0.05);
10946
+ var PIXELRATIO = 4;
10947
+ var INSIDE_WIDTH = Math.round(PAPER_WIDTH - MARGIN * 2);
10948
+ var INSIDE_HEIGHT = Math.round(PAPER_HEIGHT - MARGIN * 2);
10949
+ var MAP_WIDTH = Math.round(INSIDE_WIDTH);
10950
+ var MAP_HEIGHT = Math.round(INSIDE_HEIGHT * 0.7 - MARGIN / 2);
10951
+ var BOTTOM_HEIGHT = Math.round(INSIDE_HEIGHT - MAP_HEIGHT - MARGIN / 2);
10952
+ var DESCRIPTION_WIDTH = Math.round(INSIDE_WIDTH * 0.25);
10953
+ var QRCODE_SIZE = Math.round(BOTTOM_HEIGHT);
10954
+ var MAPINFO_PADDING = Math.round(MARGIN * 0.4);
10955
+ var LOGO_HEIGHT = Math.round(MAP_HEIGHT * 0.15);
10956
+ var PROJECTION_HEIGHT = Math.round(MAP_HEIGHT * 0.1);
10957
+ var NORTH_SIZE = Math.round(PROJECTION_HEIGHT * 0.8);
10958
+ return {
10959
+ PAPER_WIDTH: PAPER_WIDTH,
10960
+ PAPER_HEIGHT: PAPER_HEIGHT,
10961
+ MARGIN: MARGIN,
10962
+ PIXELRATIO: PIXELRATIO,
10963
+ INSIDE_WIDTH: INSIDE_WIDTH,
10964
+ INSIDE_HEIGHT: INSIDE_HEIGHT,
10965
+ MAP_WIDTH: MAP_WIDTH,
10966
+ MAP_HEIGHT: MAP_HEIGHT,
10967
+ BOTTOM_HEIGHT: BOTTOM_HEIGHT,
10968
+ DESCRIPTION_WIDTH: DESCRIPTION_WIDTH,
10969
+ QRCODE_SIZE: QRCODE_SIZE,
10970
+ LOGO_HEIGHT: LOGO_HEIGHT,
10971
+ PROJECTION_HEIGHT: PROJECTION_HEIGHT,
10972
+ MAPINFO_PADDING: MAPINFO_PADDING,
10973
+ NORTH_SIZE: NORTH_SIZE
10974
+ };
10975
+ }
10976
+
10977
+ var PREVIEW_WIDTH_PX = 1200;
10978
+ var PAPER_WIDTH_PX = 3508;
10979
+
10980
+ var _getPaperDimensions$2 = getPaperDimensions(PAPER_WIDTH_PX),
10981
+ PIXELRATIO$2 = _getPaperDimensions$2.PIXELRATIO;
10982
+ var LEGEND_CLASS_NAME = 'LegendContainer';
10983
+ var IMAGE_DESCRIPTION_CLASS_NAME = 'ImageDescription';
10984
+ var QR_CODE_CLASS_NAME = 'QrCode';
10985
+ var LOGO_CLASS_NAME = 'Logo';
10986
+ var PROJECTION_CLASS_NAME = 'Projection';
10987
+ var NORTH_ARROW_CLASS_NAME = 'NorthArrow';
10988
+ var SCALE_CONTROL_CLASS_NAME = 'ScaleControl';
10989
+ function createBlob(_x, _x2) {
10990
+ return _createBlob.apply(this, arguments);
10991
+ }
10992
+ function _createBlob() {
10993
+ _createBlob = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(className, rootEl) {
10994
+ var backgroundColor,
10995
+ _args = arguments;
10996
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
10997
+ while (1) switch (_context.prev = _context.next) {
10998
+ case 0:
10999
+ backgroundColor = _args.length > 2 && _args[2] !== undefined ? _args[2] : '#ffffff';
11000
+ return _context.abrupt("return", toBlob(rootEl.querySelector(".".concat(className)), {
11001
+ cacheBust: true,
11002
+ pixelRatio: PIXELRATIO$2,
11003
+ fontEmbedCSS: false,
11004
+ backgroundColor: backgroundColor
11005
+ }));
11006
+ case 2:
11007
+ case "end":
11008
+ return _context.stop();
11009
+ }
11010
+ }, _callee);
11011
+ }));
11012
+ return _createBlob.apply(this, arguments);
11013
+ }
11014
+ function createScaleWrapper(map) {
11015
+ var scaleElement = map.getContainer().querySelector('.maplibregl-ctrl-scale');
11016
+ var scaleWrapper = document.createElement('div');
11017
+ scaleWrapper.style.padding = '0px';
11018
+ scaleWrapper.style.backgroundColor = 'transparent';
11019
+ scaleWrapper.style.display = 'block';
11020
+ scaleWrapper.style.position = 'relative';
11021
+ scaleWrapper.style.overflow = 'visible';
11022
+ var scaleClone = scaleElement.cloneNode(true);
11023
+ scaleClone.style.overflow = 'visible';
11024
+ // Force the internal SVG/lines to not be clipped
11025
+ scaleClone.style.position = 'relative';
11026
+ scaleWrapper.appendChild(scaleClone);
11027
+ document.body.appendChild(scaleWrapper);
11028
+ return scaleWrapper;
11029
+ }
11030
+
11031
+ // Extract all DOM elements to blobs FIRST (while DOM is visible)
11032
+ function extractMapImageBlobs(_x3) {
11033
+ return _extractMapImageBlobs.apply(this, arguments);
11034
+ }
11035
+ function _extractMapImageBlobs() {
11036
+ _extractMapImageBlobs = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
11037
+ var map, rootEl, blobLegend, blobDescription, blobQRCode, blobLogo, blobProjection, blobNorthArrow, scaleWrapper, blobScale;
11038
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11039
+ while (1) switch (_context2.prev = _context2.next) {
11040
+ case 0:
11041
+ map = _ref.map, rootEl = _ref.rootEl;
11042
+ _context2.next = 3;
11043
+ return createBlob(LEGEND_CLASS_NAME, rootEl);
11044
+ case 3:
11045
+ blobLegend = _context2.sent;
11046
+ _context2.next = 6;
11047
+ return createBlob(IMAGE_DESCRIPTION_CLASS_NAME, rootEl);
11048
+ case 6:
11049
+ blobDescription = _context2.sent;
11050
+ _context2.next = 9;
11051
+ return createBlob(QR_CODE_CLASS_NAME, rootEl);
11052
+ case 9:
11053
+ blobQRCode = _context2.sent;
11054
+ _context2.next = 12;
11055
+ return createBlob(LOGO_CLASS_NAME, rootEl, 'transparent');
11056
+ case 12:
11057
+ blobLogo = _context2.sent;
11058
+ _context2.next = 15;
11059
+ return createBlob(PROJECTION_CLASS_NAME, rootEl, 'transparent');
11060
+ case 15:
11061
+ blobProjection = _context2.sent;
11062
+ _context2.next = 18;
11063
+ return createBlob(NORTH_ARROW_CLASS_NAME, rootEl, 'transparent');
11064
+ case 18:
11065
+ blobNorthArrow = _context2.sent;
11066
+ scaleWrapper = createScaleWrapper(map);
11067
+ _context2.next = 22;
11068
+ return toBlob(scaleWrapper, {
11069
+ cacheBust: true,
11070
+ pixelRatio: PIXELRATIO$2,
11071
+ fontEmbedCSS: false,
11072
+ backgroundColor: 'transparent'
11073
+ });
11074
+ case 22:
11075
+ blobScale = _context2.sent;
11076
+ document.body.removeChild(scaleWrapper);
11077
+ return _context2.abrupt("return", {
11078
+ mapCanvas: map.getCanvas(),
11079
+ blobLegend: blobLegend,
11080
+ blobDescription: blobDescription,
11081
+ blobQRCode: blobQRCode,
11082
+ blobLogo: blobLogo,
11083
+ blobProjection: blobProjection,
11084
+ blobNorthArrow: blobNorthArrow,
11085
+ blobScale: blobScale
11086
+ });
11087
+ case 25:
11088
+ case "end":
11089
+ return _context2.stop();
11090
+ }
11091
+ }, _callee2);
11092
+ }));
11093
+ return _extractMapImageBlobs.apply(this, arguments);
11094
+ }
11095
+
11096
+ var _getPaperDimensions$1 = getPaperDimensions(PAPER_WIDTH_PX),
11097
+ PAPER_WIDTH = _getPaperDimensions$1.PAPER_WIDTH,
11098
+ PAPER_HEIGHT = _getPaperDimensions$1.PAPER_HEIGHT,
11099
+ MARGIN$1 = _getPaperDimensions$1.MARGIN,
11100
+ PIXELRATIO$1 = _getPaperDimensions$1.PIXELRATIO,
11101
+ MAP_WIDTH$1 = _getPaperDimensions$1.MAP_WIDTH,
11102
+ MAP_HEIGHT$1 = _getPaperDimensions$1.MAP_HEIGHT,
11103
+ BOTTOM_HEIGHT$1 = _getPaperDimensions$1.BOTTOM_HEIGHT,
11104
+ DESCRIPTION_WIDTH$1 = _getPaperDimensions$1.DESCRIPTION_WIDTH,
11105
+ QRCODE_SIZE = _getPaperDimensions$1.QRCODE_SIZE,
11106
+ LOGO_HEIGHT = _getPaperDimensions$1.LOGO_HEIGHT,
11107
+ PROJECTION_HEIGHT = _getPaperDimensions$1.PROJECTION_HEIGHT,
11108
+ MAPINFO_PADDING = _getPaperDimensions$1.MAPINFO_PADDING,
11109
+ NORTH_SIZE = _getPaperDimensions$1.NORTH_SIZE;
11110
+ function createImg(blob) {
11111
+ return new Promise(function (resolve) {
11112
+ if (!blob) {
11113
+ resolve(null);
11114
+ return;
11115
+ }
11116
+ try {
11117
+ var img = new Image();
11118
+ img.onload = function () {
11119
+ return resolve(img);
11120
+ };
11121
+ img.onerror = function () {
11122
+ console.warn('Failed to load image');
11123
+ resolve(null);
11124
+ };
11125
+ img.src = URL.createObjectURL(blob);
11126
+ } catch (error) {
11127
+ console.error('Error creating image from blob:', error);
11128
+ resolve(null);
11129
+ }
11130
+ });
11131
+ }
11132
+ function roundRect(ctx, x, y, width, height, radius) {
11133
+ ctx.beginPath();
11134
+ ctx.moveTo(x + radius, y);
11135
+ ctx.lineTo(x + width - radius, y);
11136
+ ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
11137
+ ctx.lineTo(x + width, y + height - radius);
11138
+ ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
11139
+ ctx.lineTo(x + radius, y + height);
11140
+ ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
11141
+ ctx.lineTo(x, y + radius);
11142
+ ctx.quadraticCurveTo(x, y, x + radius, y);
11143
+ ctx.closePath();
11144
+ }
11145
+
11146
+ // Compose canvas AFTER (using already-extracted blobs)
11147
+ function composeMapImageCanvas(_x) {
11148
+ return _composeMapImageCanvas.apply(this, arguments);
11149
+ }
11150
+ function _composeMapImageCanvas() {
11151
+ _composeMapImageCanvas = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(extractedBlobs) {
11152
+ var mapCanvas, blobLegend, blobDescription, blobQRCode, blobLogo, blobProjection, blobNorthArrow, blobScale, combinedCanvas, ctx, projectionImg, northArrowImg, scaleImg, projectionPosX, projectionPosY, projectionWidth, northPadding, northPosX, northPosY, scaleX, scaleY, scalePadding, scalePosX, scalePosY, scaleWidth, scaleHeight, backgroundX, backgroundY, backgroundWidth, backgroundHeight, logoImg, logoScale, logoPosX, logoPosY, logoWidth, bottomStartY, descriptionImg, legendImg, legendScale, legendHeight, legendWidth, qrCodeImg;
11153
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11154
+ while (1) switch (_context.prev = _context.next) {
11155
+ case 0:
11156
+ mapCanvas = extractedBlobs.mapCanvas, blobLegend = extractedBlobs.blobLegend, blobDescription = extractedBlobs.blobDescription, blobQRCode = extractedBlobs.blobQRCode, blobLogo = extractedBlobs.blobLogo, blobProjection = extractedBlobs.blobProjection, blobNorthArrow = extractedBlobs.blobNorthArrow, blobScale = extractedBlobs.blobScale; //0 - CREATE COMBINED CANVAS
11157
+ combinedCanvas = document.createElement('canvas');
11158
+ combinedCanvas.width = PAPER_WIDTH;
11159
+ combinedCanvas.height = PAPER_HEIGHT;
11160
+ ctx = combinedCanvas.getContext('2d'); // Fill background white
11161
+ ctx.fillStyle = '#ffffff';
11162
+ ctx.fillRect(0, 0, PAPER_WIDTH, PAPER_HEIGHT);
11163
+
11164
+ //1 - DRAW MAP ON CANVAS
11165
+ ctx.drawImage(mapCanvas, MARGIN$1, MARGIN$1, MAP_WIDTH$1, MAP_HEIGHT$1);
11166
+
11167
+ //2 - Draw Map Infos
11168
+ //2.1 - Create images from blobs (to get dimensions)
11169
+ _context.next = 10;
11170
+ return createImg(blobProjection);
11171
+ case 10:
11172
+ projectionImg = _context.sent;
11173
+ _context.next = 13;
11174
+ return createImg(blobNorthArrow);
11175
+ case 13:
11176
+ northArrowImg = _context.sent;
11177
+ _context.next = 16;
11178
+ return createImg(blobScale);
11179
+ case 16:
11180
+ scaleImg = _context.sent;
11181
+ projectionPosX = 0;
11182
+ projectionPosY = 0;
11183
+ projectionWidth = 0; //2.2 - Projection dimensions and position
11184
+ if (projectionImg && northArrowImg && scaleImg) {
11185
+ projectionPosX = MARGIN$1 + MAPINFO_PADDING;
11186
+ projectionPosY = MARGIN$1 + MAP_HEIGHT$1 - MAPINFO_PADDING - PROJECTION_HEIGHT;
11187
+ projectionWidth = Math.round(PROJECTION_HEIGHT * (projectionImg.width / projectionImg.height));
11188
+
11189
+ //2.3 - North dimensions and position (to the right of projection)
11190
+ northPadding = (PROJECTION_HEIGHT - NORTH_SIZE) / 2;
11191
+ northPosX = projectionPosX + projectionWidth + MAPINFO_PADDING;
11192
+ northPosY = projectionPosY + northPadding; //2.4 - Scale dimensions and position (below projection)
11193
+ scaleX = MAP_WIDTH$1 / mapCanvas.width;
11194
+ scaleY = MAP_HEIGHT$1 / mapCanvas.height;
11195
+ scalePadding = (PROJECTION_HEIGHT - scaleImg.height * scaleY) / 2;
11196
+ scalePosX = northPosX + NORTH_SIZE + MAPINFO_PADDING;
11197
+ scalePosY = projectionPosY + scalePadding;
11198
+ scaleWidth = Math.round(scaleImg.width * scaleX);
11199
+ scaleHeight = Math.round(scaleImg.height * scaleY); //2.5 - Background dimensions and position
11200
+ backgroundX = MARGIN$1 + MAPINFO_PADDING;
11201
+ backgroundY = projectionPosY;
11202
+ backgroundWidth = projectionWidth + NORTH_SIZE + scaleWidth / (PIXELRATIO$1 * PIXELRATIO$1) + 2 * MAPINFO_PADDING;
11203
+ backgroundHeight = PROJECTION_HEIGHT; //2.6 - Draw Map Info background
11204
+ ctx.fillStyle = '#ffffff80';
11205
+ roundRect(ctx, backgroundX, backgroundY, backgroundWidth, backgroundHeight, MAPINFO_PADDING / 2);
11206
+ ctx.fill();
11207
+
11208
+ //2.7 - Draw Map Infos
11209
+ ctx.drawImage(projectionImg, projectionPosX, projectionPosY, projectionWidth, PROJECTION_HEIGHT);
11210
+ ctx.drawImage(northArrowImg, northPosX, northPosY, NORTH_SIZE, NORTH_SIZE);
11211
+ ctx.drawImage(scaleImg, scalePosX, scalePosY, scaleWidth, scaleHeight);
11212
+ }
11213
+
11214
+ //3 - Draw logo on bottom left of map
11215
+ _context.next = 23;
11216
+ return createImg(blobLogo);
11217
+ case 23:
11218
+ logoImg = _context.sent;
11219
+ if (logoImg) {
11220
+ logoScale = logoImg.width / logoImg.height;
11221
+ logoPosX = MARGIN$1 + MAPINFO_PADDING;
11222
+ logoPosY = projectionPosY - MAPINFO_PADDING - LOGO_HEIGHT;
11223
+ logoWidth = Math.round(LOGO_HEIGHT * logoScale);
11224
+ ctx.fillStyle = '#ffffff80';
11225
+ roundRect(ctx, logoPosX, logoPosY, logoWidth, LOGO_HEIGHT, MAPINFO_PADDING / 2);
11226
+ ctx.fill();
11227
+ ctx.drawImage(logoImg, logoPosX, logoPosY, logoWidth, LOGO_HEIGHT);
11228
+ }
11229
+
11230
+ //3 - Calculate positions for bottom section elements and scale
11231
+ bottomStartY = MAP_HEIGHT$1 + MARGIN$1 * 1.5; //4 - DRAW DESCRIPTION
11232
+ _context.next = 28;
11233
+ return createImg(blobDescription);
11234
+ case 28:
11235
+ descriptionImg = _context.sent;
11236
+ if (descriptionImg) {
11237
+ ctx.drawImage(descriptionImg, MARGIN$1, bottomStartY, DESCRIPTION_WIDTH$1, BOTTOM_HEIGHT$1);
11238
+ }
11239
+
11240
+ //5 - DRAW LEGEND
11241
+ _context.next = 32;
11242
+ return createImg(blobLegend);
11243
+ case 32:
11244
+ legendImg = _context.sent;
11245
+ if (legendImg) {
11246
+ legendScale = legendImg.width / legendImg.height;
11247
+ legendHeight = BOTTOM_HEIGHT$1;
11248
+ legendWidth = legendHeight * legendScale;
11249
+ ctx.drawImage(legendImg, MARGIN$1 * 1.5 + DESCRIPTION_WIDTH$1, bottomStartY, legendWidth, legendHeight);
11250
+ }
11251
+
11252
+ //6 - DRAW QR CODE
11253
+ _context.next = 36;
11254
+ return createImg(blobQRCode);
11255
+ case 36:
11256
+ qrCodeImg = _context.sent;
11257
+ if (qrCodeImg) {
11258
+ ctx.drawImage(qrCodeImg, PAPER_WIDTH - MARGIN$1 - QRCODE_SIZE, PAPER_HEIGHT - MARGIN$1 - QRCODE_SIZE, QRCODE_SIZE, QRCODE_SIZE);
11259
+ }
11260
+ return _context.abrupt("return", new Promise(function (resolve) {
11261
+ combinedCanvas.toBlob(function (blob) {
11262
+ resolve(blob);
11263
+ });
11264
+ }));
11265
+ case 39:
11266
+ case "end":
11267
+ return _context.stop();
11268
+ }
11269
+ }, _callee);
11270
+ }));
11271
+ return _composeMapImageCanvas.apply(this, arguments);
11272
+ }
11273
+
11274
+ var _templateObject$2;
11275
+ var LegendContainer$1 = styled(Flex)(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n flex-wrap: wrap;\n background-color: white;\n border: none;\n box-shadow: none;\n"])));
11276
+ var _getPaperDimensions = getPaperDimensions(PREVIEW_WIDTH_PX),
11277
+ MARGIN = _getPaperDimensions.MARGIN,
11278
+ PIXELRATIO = _getPaperDimensions.PIXELRATIO,
11279
+ INSIDE_WIDTH = _getPaperDimensions.INSIDE_WIDTH,
11280
+ MAP_WIDTH = _getPaperDimensions.MAP_WIDTH,
11281
+ MAP_HEIGHT = _getPaperDimensions.MAP_HEIGHT,
11282
+ BOTTOM_HEIGHT = _getPaperDimensions.BOTTOM_HEIGHT,
11283
+ DESCRIPTION_WIDTH = _getPaperDimensions.DESCRIPTION_WIDTH;
11284
+ var ExportImage = /*#__PURE__*/forwardRef(function ExportImage(_ref, ref) {
11285
+ var _resolvedLayout$, _resolvedLayout$2, _layeredMapRef$curren, _resolvedLayout$3;
11286
+ var resolvedLayout = _ref.resolvedLayout,
11287
+ commitedViewState = _ref.commitedViewState,
11288
+ municipioId = _ref.municipioId,
11289
+ METADATA_API_ENDPOINT = _ref.METADATA_API_ENDPOINT,
11290
+ baseMapStyle = _ref.baseMapStyle,
11291
+ topViews = _ref.topViews;
11292
+ ExportImage.displayName = 'ExportImage';
11293
+ var dialogs = useDialogs();
11294
+ var rootRef = useRef(null);
11295
+ var layeredMapRef = useRef(null);
11296
+ var legends = (resolvedLayout === null || resolvedLayout === void 0 || (_resolvedLayout$ = resolvedLayout[0]) === null || _resolvedLayout$ === void 0 ? void 0 : _resolvedLayout$.legends) || [];
11297
+ var _useLocation = useLocation(),
11298
+ href = _useLocation.href;
11299
+
11300
+ //Retrieve municipality data
11301
+ var _useState = useState(null),
11302
+ _useState2 = _slicedToArray(_useState, 2),
11303
+ munName = _useState2[0],
11304
+ setMunName = _useState2[1];
11305
+ var _useState3 = useState(null),
11306
+ _useState4 = _slicedToArray(_useState3, 2),
11307
+ ufSigla = _useState4[0],
11308
+ setUfSigla = _useState4[1];
11309
+ useEffect(function () {
11310
+ var fetchMunicipalityData = /*#__PURE__*/function () {
11311
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11312
+ var _yield$fetch$then, _yield$fetch$then2, mun;
11313
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11314
+ while (1) switch (_context.prev = _context.next) {
11315
+ case 0:
11316
+ _context.next = 2;
11317
+ return fetch("".concat(METADATA_API_ENDPOINT, "/ibge_malha_br_municipio?select=nome,id,uf_sigla&id=eq.").concat(municipioId)).then(function (res) {
11318
+ return res.json();
11319
+ });
11320
+ case 2:
11321
+ _yield$fetch$then = _context.sent;
11322
+ _yield$fetch$then2 = _slicedToArray(_yield$fetch$then, 1);
11323
+ mun = _yield$fetch$then2[0];
11324
+ setMunName(mun.nome);
11325
+ setUfSigla(mun.uf_sigla);
11326
+ case 7:
11327
+ case "end":
11328
+ return _context.stop();
11329
+ }
11330
+ }, _callee);
11331
+ }));
11332
+ return function fetchMunicipalityData() {
11333
+ return _ref2.apply(this, arguments);
11334
+ };
11335
+ }();
11336
+ fetchMunicipalityData();
11337
+ }, [municipioId, METADATA_API_ENDPOINT]);
11338
+ var sourceLabels = uniq((resolvedLayout === null || resolvedLayout === void 0 || (_resolvedLayout$2 = resolvedLayout[0]) === null || _resolvedLayout$2 === void 0 || (_resolvedLayout$2 = _resolvedLayout$2.views) === null || _resolvedLayout$2 === void 0 ? void 0 : _resolvedLayout$2.map(function (view) {
11339
+ return view.metadata.sourceLabel || '';
11340
+ }).filter(Boolean)) || []).join(' + ') || '';
11341
+ var createImg = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
11342
+ var imageCanva;
11343
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
11344
+ while (1) switch (_context3.prev = _context3.next) {
11345
+ case 0:
11346
+ _context3.next = 2;
11347
+ return dialogs.loading(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
11348
+ var extractedBlobs;
11349
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11350
+ while (1) switch (_context2.prev = _context2.next) {
11351
+ case 0:
11352
+ _context2.next = 2;
11353
+ return extractMapImageBlobs({
11354
+ map: layeredMapRef.current.map,
11355
+ rootEl: rootRef.current
11356
+ });
11357
+ case 2:
11358
+ extractedBlobs = _context2.sent;
11359
+ return _context2.abrupt("return", composeMapImageCanvas(extractedBlobs));
11360
+ case 4:
11361
+ case "end":
11362
+ return _context2.stop();
11363
+ }
11364
+ }, _callee2);
11365
+ })));
11366
+ case 2:
11367
+ imageCanva = _context3.sent;
11368
+ saveAs$1(imageCanva, "".concat(slugify(munName, '_'), "_georedus.png"));
11369
+ case 4:
11370
+ case "end":
11371
+ return _context3.stop();
11372
+ }
11373
+ }, _callee3);
11374
+ })), [dialogs, (_layeredMapRef$curren = layeredMapRef.current) === null || _layeredMapRef$curren === void 0 ? void 0 : _layeredMapRef$curren.map, rootRef.current]);
11375
+ useImperativeHandle(ref, function () {
11376
+ return {
11377
+ createImg: createImg
11378
+ };
11379
+ }, [createImg]);
11380
+ function ImageDescription() {
11381
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Flex, {
11382
+ direction: "column",
11383
+ width: "".concat(DESCRIPTION_WIDTH, "px"),
11384
+ className: IMAGE_DESCRIPTION_CLASS_NAME
11385
+ }, /*#__PURE__*/React.createElement(Flex, {
11386
+ height: "100%",
11387
+ wrap: "wrap",
11388
+ gap: "2"
11389
+ }, /*#__PURE__*/React.createElement(Heading, {
11390
+ size: "4",
11391
+ color: "iris"
11392
+ }, munName, " - ", ufSigla, " / BR"), /*#__PURE__*/React.createElement(Heading, {
11393
+ size: "2",
11394
+ color: "iris"
11395
+ }, new Date().toLocaleDateString('pt-BR', {
11396
+ year: 'numeric',
11397
+ month: '2-digit',
11398
+ day: '2-digit'
11399
+ }).replace(/\//g, '.')), /*#__PURE__*/React.createElement(Text, {
11400
+ size: "2"
11401
+ }, /*#__PURE__*/React.createElement(Strong, null, "Fonte de dados: "), sourceLabels || ''), /*#__PURE__*/React.createElement(Text, {
11402
+ size: "2"
11403
+ }, /*#__PURE__*/React.createElement(Strong, null, "Outros dados: "), "\xA9 MapTiler | \xA9 OpenStreetMap contributors")), /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement("img", {
11404
+ style: {
11405
+ height: 33,
11406
+ width: 'auto'
11407
+ },
11408
+ src: "/georedus/assets/parcerias.png"
11409
+ }))));
11410
+ }
11411
+ return /*#__PURE__*/React.createElement(Flex, {
11412
+ direction: "column",
11413
+ ref: rootRef
11414
+ }, /*#__PURE__*/React.createElement(LayeredMap, {
11415
+ ref: layeredMapRef,
11416
+ sky: SKY_STYLE,
11417
+ maxPitch: 80,
11418
+ pixelRatio: PIXELRATIO,
11419
+ attributionControl: false,
11420
+ mapStyle: baseMapStyle,
11421
+ views: [].concat(_toConsumableArray(((resolvedLayout === null || resolvedLayout === void 0 || (_resolvedLayout$3 = resolvedLayout[0]) === null || _resolvedLayout$3 === void 0 ? void 0 : _resolvedLayout$3.views) || []).reverse()), _toConsumableArray(topViews || [])),
11422
+ initialViewState: commitedViewState,
11423
+ style: {
11424
+ height: "".concat(MAP_HEIGHT, "px"),
11425
+ width: "".concat(MAP_WIDTH, "px"),
11426
+ marginTop: '0'
11427
+ },
11428
+ canvasContextAttributes: {
11429
+ preserveDrawingBuffer: true
11430
+ }
11431
+ }, /*#__PURE__*/React.createElement(ControlContainer, {
11432
+ position: "bottom-left",
11433
+ style: {
11434
+ boxShadow: 'none',
11435
+ backgroundColor: '#ffffffd9',
11436
+ borderRadius: '10px'
11437
+ }
11438
+ }, /*#__PURE__*/React.createElement(Flex, {
11439
+ width: "150",
11440
+ p: "2",
11441
+ className: LOGO_CLASS_NAME
11442
+ }, /*#__PURE__*/React.createElement(GeoReDUSLogo, {
11443
+ color: "#384DA0"
11444
+ }))), /*#__PURE__*/React.createElement(AttributionControl, {
11445
+ position: "bottom-right",
11446
+ compact: false
11447
+ }), /*#__PURE__*/React.createElement(ControlContainer //tirar north arrow dentro do container
11448
+ , {
11449
+ position: "bottom-left",
11450
+ style: {
11451
+ boxShadow: 'none',
11452
+ backgroundColor: 'transparent',
11453
+ borderRadius: '10px'
11454
+ }
11455
+ }, /*#__PURE__*/React.createElement(Flex, {
11456
+ p: "2",
11457
+ className: PROJECTION_CLASS_NAME,
11458
+ width: "fit-content"
11459
+ }, /*#__PURE__*/React.createElement(Text, {
11460
+ weight: "bold"
11461
+ }, "Proje\xE7\xE3o universal "), /*#__PURE__*/React.createElement(Text, {
11462
+ style: {
11463
+ marginTop: 0
11464
+ }
11465
+ }, "Mercator (EPSG:3857)"))), /*#__PURE__*/React.createElement(NorthArrow, {
11466
+ position: "bottom-left",
11467
+ animationDuration: 300,
11468
+ className: NORTH_ARROW_CLASS_NAME
11469
+ }), /*#__PURE__*/React.createElement(ScaleControl, {
11470
+ position: "bottom-left",
11471
+ className: SCALE_CONTROL_CLASS_NAME
11472
+ })), /*#__PURE__*/React.createElement(Flex, null), /*#__PURE__*/React.createElement(Flex, {
11473
+ direction: "row",
11474
+ width: "".concat(INSIDE_WIDTH, "px"),
11475
+ height: "".concat(BOTTOM_HEIGHT, "px"),
11476
+ style: {
11477
+ justifyContent: 'space-between',
11478
+ marginTop: "".concat(MARGIN, "px !important")
11479
+ }
11480
+ }, /*#__PURE__*/React.createElement(ImageDescription, null), /*#__PURE__*/React.createElement(LegendContainer$1, {
11481
+ className: LEGEND_CLASS_NAME,
11482
+ direction: "column",
11483
+ gap: "3",
11484
+ p: "0",
11485
+ style: {
11486
+ margin: '0 !important'
11487
+ }
11488
+ }, legends.filter(function (legend) {
11489
+ return legend === null || legend === void 0 ? void 0 : legend.type;
11490
+ }).map(function (legend, i) {
11491
+ return /*#__PURE__*/React.createElement(Legend, _extends({
11492
+ key: legend.id || "".concat(legend.type, "-").concat(i)
11493
+ }, legend, {
11494
+ style: {
11495
+ marginTop: '0 !important',
11496
+ marginBottom: '10px',
11497
+ fontSize: '8px !important'
11498
+ }
11499
+ }));
11500
+ })), /*#__PURE__*/React.createElement(Flex, {
11501
+ style: {
11502
+ alignItems: 'end'
11503
+ }
11504
+ }, /*#__PURE__*/React.createElement(QRCode, {
11505
+ value: href,
11506
+ className: QR_CODE_CLASS_NAME
11507
+ }))));
11508
+ });
9119
11509
 
9120
- return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Dialog.Title, null, "Compartilhar"), /*#__PURE__*/React$1.createElement(Flex, {
11510
+ function SharePanel(_ref) {
11511
+ var resolvedLayout = _ref.resolvedLayout,
11512
+ commitedViewState = _ref.commitedViewState,
11513
+ municipioId = _ref.municipioId,
11514
+ METADATA_API_ENDPOINT = _ref.METADATA_API_ENDPOINT,
11515
+ baseMapStyle = _ref.baseMapStyle,
11516
+ topViews = _ref.topViews;
11517
+ var exportImageRef = useRef();
11518
+ var handleExportClick = function handleExportClick() {
11519
+ var _exportImageRef$curre;
11520
+ (_exportImageRef$curre = exportImageRef.current) === null || _exportImageRef$curre === void 0 || _exportImageRef$curre.createImg();
11521
+ };
11522
+ return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Flex, {
11523
+ direction: "column",
11524
+ gap: "1",
11525
+ alignItems: "center"
11526
+ }, /*#__PURE__*/React$1.createElement(ExportImage, {
11527
+ ref: exportImageRef,
11528
+ resolvedLayout: resolvedLayout,
11529
+ commitedViewState: commitedViewState,
11530
+ municipioId: municipioId,
11531
+ METADATA_API_ENDPOINT: METADATA_API_ENDPOINT,
11532
+ baseMapStyle: baseMapStyle,
11533
+ topViews: topViews
11534
+ }), /*#__PURE__*/React$1.createElement(Flex, {
9121
11535
  direction: "row",
9122
- gap: "4"
9123
- }, /*#__PURE__*/React$1.createElement(ShareButtonBar, null)));
11536
+ alignItems: "end",
11537
+ justifyContent: "space-between",
11538
+ width: "100%",
11539
+ pt: "4"
11540
+ }, /*#__PURE__*/React$1.createElement(ShareButtonBar, null), /*#__PURE__*/React$1.createElement(Button, {
11541
+ onClick: handleExportClick,
11542
+ style: {
11543
+ marginRight: '30px'
11544
+ },
11545
+ size: "2"
11546
+ }, /*#__PURE__*/React$1.createElement(Icon, {
11547
+ path: mdiDownload,
11548
+ size: "18px"
11549
+ }), "Baixar imagem"))));
9124
11550
  }
9125
11551
 
9126
11552
  var _templateObject$1;
@@ -9136,10 +11562,14 @@ function LeftPanelInner(_ref) {
9136
11562
  viewConfDispatch = _ref.viewConfDispatch,
9137
11563
  viewSpecs = _ref.viewSpecs,
9138
11564
  resolvedViews = _ref.resolvedViews,
11565
+ resolvedLayout = _ref.resolvedLayout,
9139
11566
  open = _ref.open,
9140
11567
  onSetOpen = _ref.onSetOpen,
9141
- syncedMapsRef = _ref.syncedMapsRef,
9142
- mapContainerRef = _ref.mapContainerRef,
11568
+ commitedViewState = _ref.commitedViewState,
11569
+ municipioId = _ref.municipioId,
11570
+ METADATA_API_ENDPOINT = _ref.METADATA_API_ENDPOINT,
11571
+ baseMapStyle = _ref.baseMapStyle,
11572
+ topViews = _ref.topViews,
9143
11573
  _ref$categoryIcons = _ref.categoryIcons,
9144
11574
  categoryIcons = _ref$categoryIcons === void 0 ? undefined : _ref$categoryIcons,
9145
11575
  _ref$header = _ref.header,
@@ -9152,6 +11582,7 @@ function LeftPanelInner(_ref) {
9152
11582
  py: "10px",
9153
11583
  height: HEADER_HEIGHT,
9154
11584
  alignItems: "center",
11585
+ justifyContent: "space-between",
9155
11586
  direction: "row",
9156
11587
  style: {
9157
11588
  backgroundColor: 'var(--accent-9)',
@@ -9167,7 +11598,57 @@ function LeftPanelInner(_ref) {
9167
11598
  transition: open ? 'opacity .7s ease-out' : 'opacity .1s ease-out',
9168
11599
  opacity: open ? 1 : 0
9169
11600
  }
9170
- }, /*#__PURE__*/React$1.createElement(GeoReDUSLogoText, null))));
11601
+ }, /*#__PURE__*/React$1.createElement(GeoReDUSLogoText, null))), /*#__PURE__*/React$1.createElement("div", null, /*#__PURE__*/React$1.createElement(IconButton, {
11602
+ variant: "soft",
11603
+ size: "3",
11604
+ asChild: true,
11605
+ style: {
11606
+ color: 'white'
11607
+ }
11608
+ }, /*#__PURE__*/React$1.createElement("a", {
11609
+ href: "https://www.redus.org.br/georedus-rede-de-dados-urbanos/formularios/cbf766bb-9a74-4bc5-897a-70b9151afbdb",
11610
+ target: "_blank",
11611
+ rel: "noreferrer nofollow"
11612
+ }, /*#__PURE__*/React$1.createElement(Tooltip, {
11613
+ content: "D\xFAvidas e sugest\xF5es"
11614
+ }, /*#__PURE__*/React$1.createElement(Icon, {
11615
+ path: mdiForumOutline,
11616
+ size: "24px"
11617
+ })))), /*#__PURE__*/React$1.createElement(IconButton, {
11618
+ variant: "soft",
11619
+ size: "3",
11620
+ style: {
11621
+ color: 'white'
11622
+ },
11623
+ onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11624
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11625
+ while (1) switch (_context.prev = _context.next) {
11626
+ case 0:
11627
+ _context.next = 2;
11628
+ return dialogs.view({
11629
+ maxWidth: '1500px',
11630
+ width: '1200px',
11631
+ children: /*#__PURE__*/React$1.createElement(SharePanel, {
11632
+ resolvedLayout: resolvedLayout,
11633
+ commitedViewState: commitedViewState,
11634
+ municipioId: municipioId,
11635
+ METADATA_API_ENDPOINT: METADATA_API_ENDPOINT,
11636
+ baseMapStyle: baseMapStyle,
11637
+ topViews: topViews
11638
+ })
11639
+ });
11640
+ case 2:
11641
+ case "end":
11642
+ return _context.stop();
11643
+ }
11644
+ }, _callee);
11645
+ }))
11646
+ }, /*#__PURE__*/React$1.createElement(Tooltip, {
11647
+ content: "Compartilhar"
11648
+ }, /*#__PURE__*/React$1.createElement(Icon, {
11649
+ path: mdiShareVariantOutline,
11650
+ size: "24px"
11651
+ })))));
9171
11652
  var footer = typeof customFooter !== 'undefined' ? customFooter : /*#__PURE__*/React$1.createElement(Flex, {
9172
11653
  p: "2",
9173
11654
  style: {
@@ -9299,43 +11780,7 @@ function LeftPanelInner(_ref) {
9299
11780
  gap: "3",
9300
11781
  justifyContent: "flex-end",
9301
11782
  alignItems: "center"
9302
- }, /*#__PURE__*/React$1.createElement(IconButton, {
9303
- variant: "soft",
9304
- size: "3",
9305
- onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9306
- return _regeneratorRuntime().wrap(function _callee$(_context) {
9307
- while (1) switch (_context.prev = _context.next) {
9308
- case 0:
9309
- _context.next = 2;
9310
- return dialogs.view(/*#__PURE__*/React$1.createElement(SharePanel, {
9311
- mapContainerRef: mapContainerRef,
9312
- syncedMapsRef: syncedMapsRef
9313
- }));
9314
- case 2:
9315
- case "end":
9316
- return _context.stop();
9317
- }
9318
- }, _callee);
9319
- }))
9320
- }, /*#__PURE__*/React$1.createElement(Tooltip, {
9321
- content: "Compartilhar"
9322
- }, /*#__PURE__*/React$1.createElement(Icon, {
9323
- path: mdiShareVariantOutline,
9324
- size: "24px"
9325
- }))), /*#__PURE__*/React$1.createElement(IconButton, {
9326
- variant: "soft",
9327
- size: "3",
9328
- asChild: true
9329
- }, /*#__PURE__*/React$1.createElement("a", {
9330
- href: "https://www.redus.org.br/georedus-rede-de-dados-urbanos/formularios/cbf766bb-9a74-4bc5-897a-70b9151afbdb",
9331
- target: "_blank",
9332
- rel: "noreferrer nofollow"
9333
- }, /*#__PURE__*/React$1.createElement(Tooltip, {
9334
- content: "D\xFAvidas e sugest\xF5es"
9335
- }, /*#__PURE__*/React$1.createElement(Icon, {
9336
- path: mdiForumOutline,
9337
- size: "24px"
9338
- })))))
11783
+ })
9339
11784
  }) : /*#__PURE__*/React$1.createElement("div", {
9340
11785
  style: {
9341
11786
  flexGrow: 1,
@@ -11679,15 +14124,6 @@ var BR_BBOX = {
11679
14124
  },
11680
14125
  properties: {}
11681
14126
  };
11682
- var SKY_STYLE = {
11683
- 'sky-color': '#199EF3',
11684
- 'sky-horizon-blend': 0.5,
11685
- 'horizon-color': '#d3edfd',
11686
- 'horizon-fog-blend': 0.5,
11687
- 'fog-color': '#0000ff',
11688
- 'fog-ground-blend': 0.5,
11689
- 'atmosphere-blend': ['interpolate', ['linear'], ['zoom'], 0, 1, 10, 1, 12, 0]
11690
- };
11691
14127
  var BASEMAPS = {
11692
14128
  dataviz: dataviz,
11693
14129
  satellite: satellite
@@ -12091,7 +14527,7 @@ function GeoReDUSInner(_ref2) {
12091
14527
  // Control map position focus
12092
14528
  //
12093
14529
  useEffect(function () {
12094
- var mainMap = get(syncedMapsRef.current, 'mapInstances[0].map');
14530
+ var mainMap = get$1(syncedMapsRef.current, 'mapInstances[0].map');
12095
14531
  if (!mainMap) {
12096
14532
  return;
12097
14533
  }
@@ -12156,6 +14592,10 @@ function GeoReDUSInner(_ref2) {
12156
14592
  }
12157
14593
  });
12158
14594
  }, []);
14595
+ var _useState7 = useState(null),
14596
+ _useState8 = _slicedToArray(_useState7, 2),
14597
+ commitedViewState = _useState8[0],
14598
+ setCommitedViewState = _useState8[1];
12159
14599
  return /*#__PURE__*/React$1.createElement(Flex, null, /*#__PURE__*/React$1.createElement(LeftPanel, _extends({
12160
14600
  open: leftPanelOpen,
12161
14601
  onSetOpen: setLeftPanelOpen,
@@ -12163,7 +14603,15 @@ function GeoReDUSInner(_ref2) {
12163
14603
  viewConfState: viewConfState,
12164
14604
  viewConfDispatch: viewConfDispatch,
12165
14605
  resolvedViews: resolvedViews,
12166
- syncedMapsRef: syncedMapsRef
14606
+ resolvedLayout: resolvedLayout
14607
+
14608
+ // props required for export image
14609
+ ,
14610
+ commitedViewState: commitedViewState,
14611
+ municipioId: municipioId,
14612
+ METADATA_API_ENDPOINT: METADATA_API_ENDPOINT,
14613
+ baseMapStyle: BASE_MAP_STYLE[baseMapStyle],
14614
+ topViews: TOP_VIEWS
12167
14615
  }, leftPanelProps)), /*#__PURE__*/React$1.createElement(Flex, {
12168
14616
  style: {
12169
14617
  position: 'fixed',
@@ -12215,6 +14663,7 @@ function GeoReDUSInner(_ref2) {
12215
14663
  //
12216
14664
  ,
12217
14665
  onMoveEnd: function onMoveEnd(e) {
14666
+ setCommitedViewState(e.viewState);
12218
14667
  var _e$viewState2 = e.viewState,
12219
14668
  latitude = _e$viewState2.latitude,
12220
14669
  longitude = _e$viewState2.longitude;
@@ -12310,15 +14759,16 @@ function GeoReDUSInner(_ref2) {
12310
14759
  size: "20px"
12311
14760
  }))), /*#__PURE__*/React$1.createElement(EvenSpacedList, {
12312
14761
  columns: legends.length > 1 ? 2 : 1,
12313
- gap: "10px"
14762
+ gap: "10px",
14763
+ style: {
14764
+ maxWidth: '300px'
14765
+ }
12314
14766
  }, legends.map(function (legend) {
12315
14767
  return /*#__PURE__*/React$1.createElement(HoverLegend, _extends({}, resolvedLayout.length > 1 ? {
12316
14768
  direction: 'row',
12317
- maxWidth: '300px',
12318
14769
  size: '1'
12319
14770
  } : {
12320
14771
  direction: 'column',
12321
- maxWidth: '150px',
12322
14772
  size: '2'
12323
14773
  }, {
12324
14774
  key: legend.id