@performant-software/geospatial 3.1.18-beta.4 → 3.1.18-beta.6

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 (227) hide show
  1. package/dist/index.cjs13.js +1 -1
  2. package/dist/index.cjs13.js.map +1 -1
  3. package/dist/index.cjs15.js +1 -1
  4. package/dist/index.cjs16.js +1 -1
  5. package/dist/index.cjs17.js +1 -1
  6. package/dist/index.cjs18.js +1 -1
  7. package/dist/index.cjs19.js +1 -1
  8. package/dist/index.cjs190.js +1 -1
  9. package/dist/index.cjs190.js.map +1 -1
  10. package/dist/index.cjs191.js +1 -1
  11. package/dist/index.cjs191.js.map +1 -1
  12. package/dist/index.cjs192.js +1 -1
  13. package/dist/index.cjs192.js.map +1 -1
  14. package/dist/index.cjs193.js +1 -1
  15. package/dist/index.cjs193.js.map +1 -1
  16. package/dist/index.cjs194.js +1 -1
  17. package/dist/index.cjs194.js.map +1 -1
  18. package/dist/index.cjs195.js +1 -1
  19. package/dist/index.cjs195.js.map +1 -1
  20. package/dist/index.cjs196.js +1 -1
  21. package/dist/index.cjs196.js.map +1 -1
  22. package/dist/index.cjs197.js +1 -1
  23. package/dist/index.cjs197.js.map +1 -1
  24. package/dist/index.cjs198.js +1 -1
  25. package/dist/index.cjs198.js.map +1 -1
  26. package/dist/index.cjs199.js +1 -1
  27. package/dist/index.cjs199.js.map +1 -1
  28. package/dist/index.cjs2.js +1 -1
  29. package/dist/index.cjs2.js.map +1 -1
  30. package/dist/index.cjs20.js +1 -1
  31. package/dist/index.cjs200.js +1 -1
  32. package/dist/index.cjs200.js.map +1 -1
  33. package/dist/index.cjs201.js +1 -1
  34. package/dist/index.cjs201.js.map +1 -1
  35. package/dist/index.cjs202.js +1 -1
  36. package/dist/index.cjs202.js.map +1 -1
  37. package/dist/index.cjs203.js +1 -1
  38. package/dist/index.cjs203.js.map +1 -1
  39. package/dist/index.cjs204.js +1 -1
  40. package/dist/index.cjs204.js.map +1 -1
  41. package/dist/index.cjs205.js +1 -1
  42. package/dist/index.cjs205.js.map +1 -1
  43. package/dist/index.cjs206.js +1 -1
  44. package/dist/index.cjs206.js.map +1 -1
  45. package/dist/index.cjs207.js +1 -1
  46. package/dist/index.cjs207.js.map +1 -1
  47. package/dist/index.cjs208.js +1 -1
  48. package/dist/index.cjs208.js.map +1 -1
  49. package/dist/index.cjs209.js +1 -1
  50. package/dist/index.cjs209.js.map +1 -1
  51. package/dist/index.cjs21.js +1 -1
  52. package/dist/index.cjs210.js +1 -1
  53. package/dist/index.cjs210.js.map +1 -1
  54. package/dist/index.cjs211.js +1 -1
  55. package/dist/index.cjs211.js.map +1 -1
  56. package/dist/index.cjs212.js +1 -1
  57. package/dist/index.cjs212.js.map +1 -1
  58. package/dist/index.cjs215.js +1 -1
  59. package/dist/index.cjs22.js +1 -1
  60. package/dist/index.cjs23.js +1 -1
  61. package/dist/index.cjs235.js +1 -1
  62. package/dist/index.cjs24.js +1 -1
  63. package/dist/index.cjs240.js +7 -1
  64. package/dist/index.cjs240.js.map +1 -1
  65. package/dist/index.cjs241.js +1 -1
  66. package/dist/index.cjs241.js.map +1 -1
  67. package/dist/index.cjs242.js +1 -7
  68. package/dist/index.cjs242.js.map +1 -1
  69. package/dist/index.cjs243.js +1 -1
  70. package/dist/index.cjs243.js.map +1 -1
  71. package/dist/index.cjs244.js +1 -1
  72. package/dist/index.cjs244.js.map +1 -1
  73. package/dist/index.cjs246.js +1 -1
  74. package/dist/index.cjs246.js.map +1 -1
  75. package/dist/index.cjs248.js +1 -1
  76. package/dist/index.cjs25.js +1 -1
  77. package/dist/index.cjs251.js +1 -1
  78. package/dist/index.cjs252.js +1 -1
  79. package/dist/index.cjs257.js +1 -1
  80. package/dist/index.cjs258.js +1 -1
  81. package/dist/index.cjs259.js +1 -1
  82. package/dist/index.cjs26.js +1 -1
  83. package/dist/index.cjs262.js +1 -1
  84. package/dist/index.cjs263.js +1 -1
  85. package/dist/index.cjs265.js +1 -1
  86. package/dist/index.cjs265.js.map +1 -1
  87. package/dist/index.cjs266.js +1 -1
  88. package/dist/index.cjs266.js.map +1 -1
  89. package/dist/index.cjs268.js +1 -1
  90. package/dist/index.cjs268.js.map +1 -1
  91. package/dist/index.cjs27.js +1 -1
  92. package/dist/index.cjs32.js +1 -1
  93. package/dist/index.cjs34.js +1 -1
  94. package/dist/index.cjs35.js +1 -1
  95. package/dist/index.cjs39.js +1 -1
  96. package/dist/index.cjs69.js +1 -1
  97. package/dist/index.cjs71.js +1 -1
  98. package/dist/index.cjs73.js +1 -743
  99. package/dist/index.cjs73.js.map +1 -1
  100. package/dist/index.cjs75.js +9 -1
  101. package/dist/index.cjs75.js.map +1 -1
  102. package/dist/index.cjs76.js +17 -1
  103. package/dist/index.cjs76.js.map +1 -1
  104. package/dist/index.cjs77.js +1 -9
  105. package/dist/index.cjs77.js.map +1 -1
  106. package/dist/index.cjs78.js +1 -17
  107. package/dist/index.cjs78.js.map +1 -1
  108. package/dist/index.cjs82.js +743 -1
  109. package/dist/index.cjs82.js.map +1 -1
  110. package/dist/index.cjs83.js +1 -1
  111. package/dist/index.cjs83.js.map +1 -1
  112. package/dist/index.es13.js +64 -48
  113. package/dist/index.es13.js.map +1 -1
  114. package/dist/index.es15.js +1 -1
  115. package/dist/index.es16.js +4 -4
  116. package/dist/index.es17.js +3 -3
  117. package/dist/index.es18.js +3 -3
  118. package/dist/index.es19.js +1 -1
  119. package/dist/index.es190.js +144 -239
  120. package/dist/index.es190.js.map +1 -1
  121. package/dist/index.es191.js +6 -42
  122. package/dist/index.es191.js.map +1 -1
  123. package/dist/index.es192.js +5 -3
  124. package/dist/index.es192.js.map +1 -1
  125. package/dist/index.es193.js +3 -13
  126. package/dist/index.es193.js.map +1 -1
  127. package/dist/index.es194.js +3 -13
  128. package/dist/index.es194.js.map +1 -1
  129. package/dist/index.es195.js +33 -28
  130. package/dist/index.es195.js.map +1 -1
  131. package/dist/index.es196.js +3 -16
  132. package/dist/index.es196.js.map +1 -1
  133. package/dist/index.es197.js +22 -4
  134. package/dist/index.es197.js.map +1 -1
  135. package/dist/index.es198.js +2 -150
  136. package/dist/index.es198.js.map +1 -1
  137. package/dist/index.es199.js +3 -9
  138. package/dist/index.es199.js.map +1 -1
  139. package/dist/index.es2.js +3 -3
  140. package/dist/index.es2.js.map +1 -1
  141. package/dist/index.es20.js +1 -1
  142. package/dist/index.es200.js +2 -7
  143. package/dist/index.es200.js.map +1 -1
  144. package/dist/index.es201.js +33 -3
  145. package/dist/index.es201.js.map +1 -1
  146. package/dist/index.es202.js +14 -2
  147. package/dist/index.es202.js.map +1 -1
  148. package/dist/index.es203.js +13 -35
  149. package/dist/index.es203.js.map +1 -1
  150. package/dist/index.es204.js +11 -3
  151. package/dist/index.es204.js.map +1 -1
  152. package/dist/index.es205.js +242 -22
  153. package/dist/index.es205.js.map +1 -1
  154. package/dist/index.es206.js +45 -2
  155. package/dist/index.es206.js.map +1 -1
  156. package/dist/index.es207.js +5 -3
  157. package/dist/index.es207.js.map +1 -1
  158. package/dist/index.es208.js +13 -2
  159. package/dist/index.es208.js.map +1 -1
  160. package/dist/index.es209.js +10 -30
  161. package/dist/index.es209.js.map +1 -1
  162. package/dist/index.es21.js +1 -1
  163. package/dist/index.es210.js +31 -13
  164. package/dist/index.es210.js.map +1 -1
  165. package/dist/index.es211.js +13 -13
  166. package/dist/index.es211.js.map +1 -1
  167. package/dist/index.es212.js +4 -8
  168. package/dist/index.es212.js.map +1 -1
  169. package/dist/index.es215.js +1 -1
  170. package/dist/index.es22.js +1 -1
  171. package/dist/index.es23.js +1 -1
  172. package/dist/index.es235.js +1 -1
  173. package/dist/index.es24.js +1 -1
  174. package/dist/index.es240.js +7506 -20
  175. package/dist/index.es240.js.map +1 -1
  176. package/dist/index.es241.js +2 -23
  177. package/dist/index.es241.js.map +1 -1
  178. package/dist/index.es242.js +20 -7506
  179. package/dist/index.es242.js.map +1 -1
  180. package/dist/index.es243.js +23 -2
  181. package/dist/index.es243.js.map +1 -1
  182. package/dist/index.es244.js +3 -8
  183. package/dist/index.es244.js.map +1 -1
  184. package/dist/index.es246.js +8 -3
  185. package/dist/index.es246.js.map +1 -1
  186. package/dist/index.es248.js +1 -1
  187. package/dist/index.es25.js +1 -1
  188. package/dist/index.es251.js +1 -1
  189. package/dist/index.es252.js +1 -1
  190. package/dist/index.es257.js +2 -2
  191. package/dist/index.es258.js +1 -1
  192. package/dist/index.es259.js +1 -1
  193. package/dist/index.es26.js +2 -2
  194. package/dist/index.es262.js +1 -1
  195. package/dist/index.es263.js +1 -1
  196. package/dist/index.es265.js +15 -2
  197. package/dist/index.es265.js.map +1 -1
  198. package/dist/index.es266.js +2 -69
  199. package/dist/index.es266.js.map +1 -1
  200. package/dist/index.es268.js +69 -15
  201. package/dist/index.es268.js.map +1 -1
  202. package/dist/index.es27.js +2 -2
  203. package/dist/index.es32.js +1 -1
  204. package/dist/index.es34.js +2 -2
  205. package/dist/index.es35.js +2 -2
  206. package/dist/index.es39.js +1 -1
  207. package/dist/index.es69.js +1 -1
  208. package/dist/index.es71.js +12 -12
  209. package/dist/index.es73.js +7 -21351
  210. package/dist/index.es73.js.map +1 -1
  211. package/dist/index.es75.js +25 -7
  212. package/dist/index.es75.js.map +1 -1
  213. package/dist/index.es76.js +589 -2
  214. package/dist/index.es76.js.map +1 -1
  215. package/dist/index.es77.js +104 -24
  216. package/dist/index.es77.js.map +1 -1
  217. package/dist/index.es78.js +10 -589
  218. package/dist/index.es78.js.map +1 -1
  219. package/dist/index.es82.js +21350 -104
  220. package/dist/index.es82.js.map +1 -1
  221. package/dist/index.es83.js +2 -10
  222. package/dist/index.es83.js.map +1 -1
  223. package/package.json +1 -1
  224. package/src/components/CertaintyLayer.js +1 -1
  225. package/src/utils/Map.js +25 -6
  226. package/types/components/CertaintyLayer.js.flow +1 -1
  227. package/types/utils/Map.js.flow +25 -6
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");var t={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},n=e.createContext&&e.createContext(t);exports.DefaultContext=t;exports.IconContext=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
2
2
  //# sourceMappingURL=index.cjs83.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs83.js","sources":["../../../node_modules/react-icons/lib/iconContext.mjs"],"sourcesContent":["import React from \"react\";\nexport var DefaultContext = {\n color: undefined,\n size: undefined,\n className: undefined,\n style: undefined,\n attr: undefined\n};\nexport var IconContext = React.createContext && /*#__PURE__*/React.createContext(DefaultContext);"],"names":["DefaultContext","IconContext","React"],"mappings":"yGACU,IAACA,EAAiB,CAC1B,MAAO,OACP,KAAM,OACN,UAAW,OACX,MAAO,OACP,KAAM,MACR,EACWC,EAAcC,EAAM,eAA8BA,EAAM,cAAcF,CAAc","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.cjs83.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,8 +1,8 @@
1
- import { WarpedMapLayer as f } from "./index.es68.js";
1
+ import { WarpedMapLayer as y } from "./index.es68.js";
2
2
  import { bbox as m } from "./index.es69.js";
3
3
  import { bboxPolygon as c } from "./index.es70.js";
4
- import { buffer as u } from "./index.es71.js";
5
- import y from "./index.es72.js";
4
+ import { buffer as f } from "./index.es71.js";
5
+ import u from "./index.es72.js";
6
6
  import { featureCollection as d, feature as g } from "./index.es67.js";
7
7
  import p from "./index.es36.js";
8
8
  import "./index.es37.js";
@@ -32,61 +32,77 @@ import "./index.es60.js";
32
32
  import "./index.es61.js";
33
33
  import "./index.es62.js";
34
34
  import "./index.es63.js";
35
- const _ = -90, L = 90, C = -180, I = 180, n = (t, o) => y(t.coordinates, o, { units: "kilometers", steps: 32 }), M = (t, o) => {
36
- if (t.geometry?.type === "FeatureCollection") {
37
- for (const e of t.geometry.features)
38
- if (e.geometry?.type === "Point")
39
- return n(e.geometry, o);
40
- } else if (t.geometry?.type === "GeometryCollection") {
41
- for (const e of t.geometry.geometries)
42
- if (e.type === "Point")
43
- return n(e, o);
44
- } else if (t.geometry?.type === "Point")
45
- return n(t.geometry, o);
46
- return t.geometry;
47
- }, b = (t, o, e = {}) => {
48
- const r = new f(o);
49
- t.addLayer(r), e.url ? r.addGeoreferenceAnnotationByUrl(e.url) : e.manifest && r.addGeoreferenceAnnotation(e.manifest), e.opacity && r.setOpacity(e.opacity);
50
- }, v = (t, o = null) => {
51
- const e = m(t);
52
- if (!a(e))
35
+ const _ = -90, L = 90, C = -180, G = 180, n = (e, o) => u(e.coordinates, o, { units: "kilometers", steps: 32 }), I = (e, o) => {
36
+ if (e.geometry?.type === "FeatureCollection") {
37
+ let t = [];
38
+ for (const r of e.geometry.features)
39
+ r.geometry?.type === "Point" && t.push({
40
+ ...r,
41
+ geometry: n(r.geometry, o)
42
+ });
43
+ return {
44
+ ...e,
45
+ geometry: {
46
+ type: "GeometryCollection",
47
+ geometries: t
48
+ }
49
+ };
50
+ } else if (e.geometry?.type === "GeometryCollection") {
51
+ for (const t of e.geometry.geometries)
52
+ if (t.type === "Point")
53
+ return {
54
+ ...e,
55
+ geometry: n(t, o)
56
+ };
57
+ } else if (e.geometry?.type === "Point")
58
+ return {
59
+ ...e,
60
+ geometry: n(e.geometry, o)
61
+ };
62
+ return e;
63
+ }, M = (e, o, t = {}) => {
64
+ const r = new y(o);
65
+ e.addLayer(r), t.url ? r.addGeoreferenceAnnotationByUrl(t.url) : t.manifest && r.addGeoreferenceAnnotation(t.manifest), t.opacity && r.setOpacity(t.opacity);
66
+ }, b = (e, o = null) => {
67
+ const t = m(e);
68
+ if (!l(t))
53
69
  return null;
54
- const r = c(e);
70
+ const r = c(t);
55
71
  let i;
56
- return o ? i = u(r, o, { units: "miles" }) : i = r, m(i);
57
- }, x = (t, o) => t && t.removeLayer(o), A = (t, o, e, r) => {
72
+ return o ? i = f(r, o, { units: "miles" }) : i = r, m(i);
73
+ }, v = (e, o) => e && e.removeLayer(o), x = (e, o, t, r) => {
58
74
  const i = {
59
- id: t.record_id,
75
+ id: e.record_id,
60
76
  ccode: [],
61
- title: t.name,
62
- uuid: t.uuid,
63
- record_id: t.record_id,
64
- name: t.name,
65
- names: t.names?.map((s) => ({ toponym: s })),
66
- type: t.type,
77
+ title: e.name,
78
+ uuid: e.uuid,
79
+ record_id: e.record_id,
80
+ name: e.name,
81
+ names: e.names?.map((s) => ({ toponym: s })),
82
+ type: e.type,
67
83
  items: [o],
68
- url: t.url,
84
+ url: e.url,
69
85
  originalProperties: r || {}
70
- }, l = parseInt(t.record_id, 10);
71
- return g(e, i, { id: l });
72
- }, B = (t) => d(t), a = (t) => p.every(t, p.isFinite), G = (t) => {
86
+ }, a = parseInt(e.record_id, 10);
87
+ return g(t, i, { id: a });
88
+ }, A = (e) => d(e), l = (e) => p.every(e, p.isFinite), B = (e) => {
73
89
  let o = !1;
74
- if (t) {
75
- const [e, r] = t;
76
- o = e >= _ && e <= L && r >= C && r <= I;
90
+ if (e) {
91
+ const [t, r] = e;
92
+ o = t >= _ && t <= L && r >= C && r <= G;
77
93
  }
78
94
  return o;
79
- }, at = {
80
- addGeoreferenceLayer: b,
81
- getCertaintyCircle: M,
82
- getBoundingBox: v,
83
- removeLayer: x,
84
- toFeature: A,
85
- toFeatureCollection: B,
86
- validateBoundingBox: a,
87
- validateCoordinates: G
95
+ }, le = {
96
+ addGeoreferenceLayer: M,
97
+ toCertaintyCircle: I,
98
+ getBoundingBox: b,
99
+ removeLayer: v,
100
+ toFeature: x,
101
+ toFeatureCollection: A,
102
+ validateBoundingBox: l,
103
+ validateCoordinates: B
88
104
  };
89
105
  export {
90
- at as default
106
+ le as default
91
107
  };
92
108
  //# sourceMappingURL=index.es13.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es13.js","sources":["../src/utils/Map.js"],"sourcesContent":["// @flow\n\nimport { WarpedMapLayer } from '@allmaps/maplibre';\nimport {\n bbox,\n bboxPolygon,\n buffer,\n feature,\n featureCollection\n} from '@turf/turf';\nimport _ from 'underscore';\nimport circle from '@turf/circle';\n\nconst MIN_LATITUDE = -90;\nconst MAX_LATITUDE = 90;\nconst MIN_LONGITUDE = -180;\nconst MAX_LONGITUDE = 180;\n\n/**\n * Returns a GeoJSON circle feature with the given center point and radius.\n * @param point - The center point of the circle.\n * @param radius - The radius of the circle in kilometers.\n * @returns {Feature<Geometry, Properties>} - The GeoJSON circle feature.\n */\nconst buildCircle = (point, radius) => (\n circle(point.coordinates, radius, { units: 'kilometers', steps: 32 })\n);\n\nconst getCertaintyCircle = (item, radius: number) => {\n if (item.geometry?.type === 'FeatureCollection') {\n for (const childFeature of item.geometry.features) {\n if (childFeature.geometry?.type === 'Point') {\n return buildCircle(childFeature.geometry, radius);\n }\n }\n } else if (item.geometry?.type === 'GeometryCollection') {\n for (const geometry of item.geometry.geometries) {\n if (geometry.type === 'Point') {\n return buildCircle(geometry, radius);\n }\n }\n } else if (item.geometry?.type === 'Point') {\n return buildCircle(item.geometry, radius);\n }\n\n return item.geometry;\n};\n\n/**\n * Adds the geo-referenced image layer to the passed map.\n *\n * @param map\n * @param layerId\n * @param options\n */\nconst addGeoreferenceLayer = (map, layerId, options = {}) => {\n const warpedMapLayer = new WarpedMapLayer(layerId);\n map.addLayer(warpedMapLayer);\n\n if (options.url) {\n warpedMapLayer.addGeoreferenceAnnotationByUrl(options.url);\n } else if (options.manifest) {\n warpedMapLayer.addGeoreferenceAnnotation(options.manifest);\n }\n\n if (options.opacity) {\n warpedMapLayer.setOpacity(options.opacity);\n }\n};\n\n/**\n * Returns a bounding box for the passed geometry (with optional buffer).\n *\n * @param data\n * @param bufferDistance\n *\n * @returns {BBox}\n */\nconst getBoundingBox = (data, bufferDistance = null) => {\n // Convert the GeoJSON into a bounding box\n const box = bbox(data);\n\n if (!validateBoundingBox(box)) {\n return null;\n }\n\n // Convert the bounding box to a polygon\n const polygon = bboxPolygon(box);\n\n // Create a buffer around the polygon (if a distance is provided)\n let polygonBuffer;\n\n if (bufferDistance) {\n polygonBuffer = buffer(polygon, bufferDistance, { units: 'miles' });\n } else {\n polygonBuffer = polygon;\n }\n\n // Convert the buffer to a bounding box\n return bbox(polygonBuffer);\n};\n\n/**\n * Removes a layer from the passed map.\n *\n * @param map\n * @param layerId\n *\n * @returns {*}\n */\nconst removeLayer = (map, layerId) => map && map.removeLayer(layerId);\n\n/**\n * Wraps the passed record in a feature.\n *\n * @param record\n * @param item\n * @param geometry\n * @param originalProperties\n *\n * @returns {Feature<Geometry, {\n * id: *,\n * ccode: [],\n * title: *,\n * uuid: *,\n * record_id: *,\n * name: *,\n * names: *,\n * type: *,\n * items: [*],\n * url: *\n * }>}\n */\nconst toFeature = (record: any, item: any, geometry: any, originalProperties?: any) => {\n const properties = {\n id: record.record_id,\n ccode: [],\n title: record.name,\n uuid: record.uuid,\n record_id: record.record_id,\n name: record.name,\n names: record.names?.map((toponym: string) => ({ toponym })),\n type: record.type,\n items: [item],\n url: record.url,\n originalProperties: originalProperties || {}\n };\n\n const id = parseInt(record.record_id, 10);\n return feature(geometry, properties, { id });\n};\n\n/**\n * Returns a feature collection for the passed set of features.\n *\n * @param features\n *\n * @returns {FeatureCollection<Geometry, GeoJsonProperties>}\n */\nconst toFeatureCollection = (features: Array<any>) => featureCollection(features);\n\n/**\n * Validates that the passed bounding box contains finite coordinates.\n *\n * @param boundingBox\n *\n * @returns {*}\n */\nconst validateBoundingBox = (boundingBox: Array<number>) => _.every(boundingBox, _.isFinite);\n\n/**\n * Returns true if the passed coordinates are valid.\n *\n * @param coordinates\n *\n * @returns {boolean}\n */\nconst validateCoordinates = (coordinates) => {\n let valid = false;\n\n if (coordinates) {\n const [latitude, longitude] = coordinates;\n\n valid = latitude >= MIN_LATITUDE\n && latitude <= MAX_LATITUDE\n && longitude >= MIN_LONGITUDE\n && longitude <= MAX_LONGITUDE;\n }\n\n return valid;\n};\n\nexport default {\n addGeoreferenceLayer,\n getCertaintyCircle,\n getBoundingBox,\n removeLayer,\n toFeature,\n toFeatureCollection,\n validateBoundingBox,\n validateCoordinates\n};\n"],"names":["MIN_LATITUDE","MAX_LATITUDE","MIN_LONGITUDE","MAX_LONGITUDE","buildCircle","point","radius","circle","getCertaintyCircle","item","childFeature","geometry","addGeoreferenceLayer","map","layerId","options","warpedMapLayer","WarpedMapLayer","getBoundingBox","data","bufferDistance","box","bbox","validateBoundingBox","polygon","bboxPolygon","polygonBuffer","buffer","removeLayer","toFeature","record","originalProperties","properties","toponym","id","feature","toFeatureCollection","features","featureCollection","boundingBox","_","validateCoordinates","coordinates","valid","latitude","longitude","MapUtils"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAMA,IAAe,KACfC,IAAe,IACfC,IAAgB,MAChBC,IAAgB,KAQhBC,IAAc,CAACC,GAAOC,MAC1BC,EAAOF,EAAM,aAAaC,GAAQ,EAAE,OAAO,cAAc,OAAO,IAAI,GAGhEE,IAAqB,CAACC,GAAMH,MAAmB;AACnD,MAAIG,EAAK,UAAU,SAAS;AAC1B,eAAWC,KAAgBD,EAAK,SAAS;AACvC,UAAIC,EAAa,UAAU,SAAS;AAClC,eAAON,EAAYM,EAAa,UAAUJ,CAAM;AAAA,aAG3CG,EAAK,UAAU,SAAS;AACjC,eAAWE,KAAYF,EAAK,SAAS;AACnC,UAAIE,EAAS,SAAS;AACpB,eAAOP,EAAYO,GAAUL,CAAM;AAAA,aAG9BG,EAAK,UAAU,SAAS;AACjC,WAAOL,EAAYK,EAAK,UAAUH,CAAM;AAG1C,SAAOG,EAAK;AACd,GASMG,IAAuB,CAACC,GAAKC,GAASC,IAAU,CAAA,MAAO;AAC3D,QAAMC,IAAiB,IAAIC,EAAeH,CAAO;AACjD,EAAAD,EAAI,SAASG,CAAc,GAEvBD,EAAQ,MACVC,EAAe,+BAA+BD,EAAQ,GAAG,IAChDA,EAAQ,YACjBC,EAAe,0BAA0BD,EAAQ,QAAQ,GAGvDA,EAAQ,WACVC,EAAe,WAAWD,EAAQ,OAAO;AAE7C,GAUMG,IAAiB,CAACC,GAAMC,IAAiB,SAAS;AAEtD,QAAMC,IAAMC,EAAKH,CAAI;AAErB,MAAI,CAACI,EAAoBF,CAAG;AAC1B,WAAO;AAIT,QAAMG,IAAUC,EAAYJ,CAAG;AAG/B,MAAIK;AAEJ,SAAIN,IACFM,IAAgBC,EAAOH,GAASJ,GAAgB,EAAE,OAAO,SAAS,IAElEM,IAAgBF,GAIXF,EAAKI,CAAa;AAC3B,GAUME,IAAc,CAACf,GAAKC,MAAYD,KAAOA,EAAI,YAAYC,CAAO,GAuB9De,IAAY,CAACC,GAAarB,GAAWE,GAAeoB,MAA6B;AACrF,QAAMC,IAAa;AAAA,IACjB,IAAIF,EAAO;AAAA,IACX,OAAO,CAAA;AAAA,IACP,OAAOA,EAAO;AAAA,IACd,MAAMA,EAAO;AAAA,IACb,WAAWA,EAAO;AAAA,IAClB,MAAMA,EAAO;AAAA,IACb,OAAOA,EAAO,OAAO,IAAI,CAACG,OAAqB,EAAE,SAAAA,IAAU;AAAA,IAC3D,MAAMH,EAAO;AAAA,IACb,OAAO,CAACrB,CAAI;AAAA,IACZ,KAAKqB,EAAO;AAAA,IACZ,oBAAoBC,KAAsB,CAAA;AAAA,EAAC,GAGvCG,IAAK,SAASJ,EAAO,WAAW,EAAE;AACxC,SAAOK,EAAQxB,GAAUqB,GAAY,EAAE,IAAAE,GAAI;AAC7C,GASME,IAAsB,CAACC,MAAyBC,EAAkBD,CAAQ,GAS1Ed,IAAsB,CAACgB,MAA+BC,EAAE,MAAMD,GAAaC,EAAE,QAAQ,GASrFC,IAAsB,CAACC,MAAgB;AAC3C,MAAIC,IAAQ;AAEZ,MAAID,GAAa;AACf,UAAM,CAACE,GAAUC,CAAS,IAAIH;AAE9B,IAAAC,IAAQC,KAAY5C,KACf4C,KAAY3C,KACZ4C,KAAa3C,KACb2C,KAAa1C;AAAA,EACpB;AAEA,SAAOwC;AACT,GAEAG,KAAe;AAAA,EACb,sBAAAlC;AAAA,EACA,oBAAAJ;AAAA,EACA,gBAAAU;AAAA,EACA,aAAAU;AAAA,EACA,WAAAC;AAAA,EACA,qBAAAO;AAAA,EACA,qBAAAb;AAAA,EACA,qBAAAkB;AACF;"}
1
+ {"version":3,"file":"index.es13.js","sources":["../src/utils/Map.js"],"sourcesContent":["// @flow\n\nimport { WarpedMapLayer } from '@allmaps/maplibre';\nimport {\n bbox,\n bboxPolygon,\n buffer,\n feature,\n featureCollection\n} from '@turf/turf';\nimport _ from 'underscore';\nimport circle from '@turf/circle';\n\nconst MIN_LATITUDE = -90;\nconst MAX_LATITUDE = 90;\nconst MIN_LONGITUDE = -180;\nconst MAX_LONGITUDE = 180;\n\n/**\n * Returns a GeoJSON circle feature with the given center point and radius.\n * @param point - The center point of the circle.\n * @param radius - The radius of the circle in kilometers.\n * @returns {Feature<Geometry, Properties>} - The GeoJSON circle feature.\n */\nconst buildCircle = (point, radius) => (\n circle(point.coordinates, radius, { units: 'kilometers', steps: 32 })\n);\n\nconst toCertaintyCircle = (item, radius: number) => {\n if (item.geometry?.type === 'FeatureCollection') {\n let children = [];\n\n for (const childFeature of item.geometry.features) {\n if (childFeature.geometry?.type === 'Point') {\n children.push({\n ...childFeature,\n geometry: buildCircle(childFeature.geometry, radius)\n });\n }\n }\n\n return {\n ...item,\n geometry: {\n type: 'GeometryCollection',\n geometries: children\n }\n };\n } else if (item.geometry?.type === 'GeometryCollection') {\n for (const geometry of item.geometry.geometries) {\n if (geometry.type === 'Point') {\n return {\n ...item,\n geometry: buildCircle(geometry, radius)\n };\n }\n }\n } else if (item.geometry?.type === 'Point') {\n return {\n ...item,\n geometry: buildCircle(item.geometry, radius)\n };\n }\n\n return item;\n};\n\n/**\n * Adds the geo-referenced image layer to the passed map.\n *\n * @param map\n * @param layerId\n * @param options\n */\nconst addGeoreferenceLayer = (map, layerId, options = {}) => {\n const warpedMapLayer = new WarpedMapLayer(layerId);\n map.addLayer(warpedMapLayer);\n\n if (options.url) {\n warpedMapLayer.addGeoreferenceAnnotationByUrl(options.url);\n } else if (options.manifest) {\n warpedMapLayer.addGeoreferenceAnnotation(options.manifest);\n }\n\n if (options.opacity) {\n warpedMapLayer.setOpacity(options.opacity);\n }\n};\n\n/**\n * Returns a bounding box for the passed geometry (with optional buffer).\n *\n * @param data\n * @param bufferDistance\n *\n * @returns {BBox}\n */\nconst getBoundingBox = (data, bufferDistance = null) => {\n // Convert the GeoJSON into a bounding box\n const box = bbox(data);\n\n if (!validateBoundingBox(box)) {\n return null;\n }\n\n // Convert the bounding box to a polygon\n const polygon = bboxPolygon(box);\n\n // Create a buffer around the polygon (if a distance is provided)\n let polygonBuffer;\n\n if (bufferDistance) {\n polygonBuffer = buffer(polygon, bufferDistance, { units: 'miles' });\n } else {\n polygonBuffer = polygon;\n }\n\n // Convert the buffer to a bounding box\n return bbox(polygonBuffer);\n};\n\n/**\n * Removes a layer from the passed map.\n *\n * @param map\n * @param layerId\n *\n * @returns {*}\n */\nconst removeLayer = (map, layerId) => map && map.removeLayer(layerId);\n\n/**\n * Wraps the passed record in a feature.\n *\n * @param record\n * @param item\n * @param geometry\n * @param originalProperties\n *\n * @returns {Feature<Geometry, {\n * id: *,\n * ccode: [],\n * title: *,\n * uuid: *,\n * record_id: *,\n * name: *,\n * names: *,\n * type: *,\n * items: [*],\n * url: *\n * }>}\n */\nconst toFeature = (record: any, item: any, geometry: any, originalProperties?: any) => {\n const properties = {\n id: record.record_id,\n ccode: [],\n title: record.name,\n uuid: record.uuid,\n record_id: record.record_id,\n name: record.name,\n names: record.names?.map((toponym: string) => ({ toponym })),\n type: record.type,\n items: [item],\n url: record.url,\n originalProperties: originalProperties || {}\n };\n\n const id = parseInt(record.record_id, 10);\n return feature(geometry, properties, { id });\n};\n\n/**\n * Returns a feature collection for the passed set of features.\n *\n * @param features\n *\n * @returns {FeatureCollection<Geometry, GeoJsonProperties>}\n */\nconst toFeatureCollection = (features: Array<any>) => featureCollection(features);\n\n/**\n * Validates that the passed bounding box contains finite coordinates.\n *\n * @param boundingBox\n *\n * @returns {*}\n */\nconst validateBoundingBox = (boundingBox: Array<number>) => _.every(boundingBox, _.isFinite);\n\n/**\n * Returns true if the passed coordinates are valid.\n *\n * @param coordinates\n *\n * @returns {boolean}\n */\nconst validateCoordinates = (coordinates) => {\n let valid = false;\n\n if (coordinates) {\n const [latitude, longitude] = coordinates;\n\n valid = latitude >= MIN_LATITUDE\n && latitude <= MAX_LATITUDE\n && longitude >= MIN_LONGITUDE\n && longitude <= MAX_LONGITUDE;\n }\n\n return valid;\n};\n\nexport default {\n addGeoreferenceLayer,\n toCertaintyCircle,\n getBoundingBox,\n removeLayer,\n toFeature,\n toFeatureCollection,\n validateBoundingBox,\n validateCoordinates\n};\n"],"names":["MIN_LATITUDE","MAX_LATITUDE","MIN_LONGITUDE","MAX_LONGITUDE","buildCircle","point","radius","circle","toCertaintyCircle","item","children","childFeature","geometry","addGeoreferenceLayer","map","layerId","options","warpedMapLayer","WarpedMapLayer","getBoundingBox","data","bufferDistance","box","bbox","validateBoundingBox","polygon","bboxPolygon","polygonBuffer","buffer","removeLayer","toFeature","record","originalProperties","properties","toponym","id","feature","toFeatureCollection","features","featureCollection","boundingBox","_","validateCoordinates","coordinates","valid","latitude","longitude","MapUtils"],"mappings":"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"}
@@ -1,4 +1,4 @@
1
- import { __require as r } from "./index.es75.js";
1
+ import { __require as r } from "./index.es73.js";
2
2
  var i = r();
3
3
  export {
4
4
  i as j
@@ -1,10 +1,10 @@
1
1
  import * as i from "react";
2
2
  import { useContext as b, useState as E, useRef as s, useEffect as v, useImperativeHandle as L, useMemo as x } from "react";
3
3
  import { MountedMapsContext as y } from "./index.es28.js";
4
- import u from "./index.es190.js";
5
- import I from "./index.es191.js";
6
- import w from "./index.es192.js";
7
- import C from "./index.es193.js";
4
+ import u from "./index.es205.js";
5
+ import I from "./index.es206.js";
6
+ import w from "./index.es207.js";
7
+ import C from "./index.es208.js";
8
8
  const g = i.createContext(null);
9
9
  function R(e, f) {
10
10
  const c = b(y), [o, M] = E(null), l = s(), { current: a } = s({ mapLib: null, map: null });
@@ -1,10 +1,10 @@
1
1
  import * as k from "react";
2
2
  import { memo as A, forwardRef as D, useContext as N, useRef as b, useMemo as y, useEffect as h, useImperativeHandle as M } from "react";
3
3
  import { createPortal as w } from "react-dom";
4
- import { applyReactStyle as x } from "./index.es194.js";
4
+ import { applyReactStyle as x } from "./index.es209.js";
5
5
  import { MapContext as O } from "./index.es16.js";
6
- import { arePointsEqual as S } from "./index.es195.js";
7
- import { compareClassNames as q } from "./index.es196.js";
6
+ import { arePointsEqual as S } from "./index.es210.js";
7
+ import { compareClassNames as q } from "./index.es211.js";
8
8
  A(D((e, E) => {
9
9
  const { map: v, mapLib: R } = N(O), r = b({ props: e }), t = y(() => {
10
10
  let i = !1;
@@ -1,9 +1,9 @@
1
1
  import { createPortal as u } from "react-dom";
2
2
  import { memo as d, forwardRef as g, useContext as h, useMemo as i, useRef as L, useEffect as s, useImperativeHandle as C } from "react";
3
- import { applyReactStyle as x } from "./index.es194.js";
3
+ import { applyReactStyle as x } from "./index.es209.js";
4
4
  import { MapContext as M } from "./index.es16.js";
5
- import { deepEqual as N } from "./index.es195.js";
6
- import { compareClassNames as O } from "./index.es196.js";
5
+ import { deepEqual as N } from "./index.es210.js";
6
+ import { compareClassNames as O } from "./index.es211.js";
7
7
  d(g((e, m) => {
8
8
  const { map: l, mapLib: r } = h(M), c = i(() => document.createElement("div"), []), a = L({ props: e }), t = i(() => {
9
9
  const n = { ...e }, o = new r.Popup(n);
@@ -1,5 +1,5 @@
1
1
  import { memo as i, useEffect as r } from "react";
2
- import { applyReactStyle as e } from "./index.es194.js";
2
+ import { applyReactStyle as e } from "./index.es209.js";
3
3
  import { useControl as l } from "./index.es30.js";
4
4
  function m(t) {
5
5
  const o = l(({ mapLib: n }) => new n.AttributionControl(t), {
@@ -1,246 +1,151 @@
1
- import { transformToViewState as d, applyViewStateToTransform as p } from "./index.es240.js";
2
- import { normalizeStyle as l } from "./index.es241.js";
3
- import { deepEqual as i } from "./index.es195.js";
4
- const u = { version: 8, sources: {}, layers: [] }, h = {
5
- mousedown: "onMouseDown",
6
- mouseup: "onMouseUp",
7
- mouseover: "onMouseOver",
8
- mousemove: "onMouseMove",
9
- click: "onClick",
10
- dblclick: "onDblClick",
11
- mouseenter: "onMouseEnter",
12
- mouseleave: "onMouseLeave",
13
- mouseout: "onMouseOut",
14
- contextmenu: "onContextMenu",
15
- touchstart: "onTouchStart",
16
- touchend: "onTouchEnd",
17
- touchmove: "onTouchMove",
18
- touchcancel: "onTouchCancel"
19
- }, m = {
20
- movestart: "onMoveStart",
21
- move: "onMove",
22
- moveend: "onMoveEnd",
23
- dragstart: "onDragStart",
24
- drag: "onDrag",
25
- dragend: "onDragEnd",
26
- zoomstart: "onZoomStart",
27
- zoom: "onZoom",
28
- zoomend: "onZoomEnd",
29
- rotatestart: "onRotateStart",
30
- rotate: "onRotate",
31
- rotateend: "onRotateEnd",
32
- pitchstart: "onPitchStart",
33
- pitch: "onPitch",
34
- pitchend: "onPitchEnd"
35
- }, f = {
36
- wheel: "onWheel",
37
- boxzoomstart: "onBoxZoomStart",
38
- boxzoomend: "onBoxZoomEnd",
39
- boxzoomcancel: "onBoxZoomCancel",
40
- resize: "onResize",
41
- load: "onLoad",
42
- render: "onRender",
43
- idle: "onIdle",
44
- remove: "onRemove",
45
- data: "onData",
46
- styledata: "onStyleData",
47
- sourcedata: "onSourceData",
48
- error: "onError"
49
- }, v = [
50
- "minZoom",
51
- "maxZoom",
52
- "minPitch",
53
- "maxPitch",
54
- "maxBounds",
55
- "projection",
56
- "renderWorldCopies"
57
- ], _ = [
58
- "scrollZoom",
59
- "boxZoom",
60
- "dragRotate",
61
- "dragPan",
62
- "keyboard",
63
- "doubleClickZoom",
64
- "touchZoomRotate",
65
- "touchPitch"
66
- ];
67
- class c {
68
- constructor(t, o, a) {
69
- this._map = null, this._internalUpdate = !1, this._hoveredFeatures = null, this._propsedCameraUpdate = null, this._styleComponents = {}, this._onEvent = (e) => {
70
- const s = this.props[f[e.type]];
71
- s ? s(e) : e.type === "error" && console.error(e.error);
72
- }, this._onCameraEvent = (e) => {
73
- if (this._internalUpdate)
74
- return;
75
- e.viewState = this._propsedCameraUpdate || d(this._map.transform);
76
- const s = this.props[m[e.type]];
77
- s && s(e);
78
- }, this._onCameraUpdate = (e) => this._internalUpdate ? e : (this._propsedCameraUpdate = d(e), p(e, this.props)), this._onPointerEvent = (e) => {
79
- (e.type === "mousemove" || e.type === "mouseout") && this._updateHover(e);
80
- const s = this.props[h[e.type]];
81
- s && (this.props.interactiveLayerIds && e.type !== "mouseover" && e.type !== "mouseout" && (e.features = this._hoveredFeatures || this._queryRenderedFeatures(e.point)), s(e), delete e.features);
82
- }, this._MapClass = t, this.props = o, this._initialize(a);
83
- }
84
- get map() {
85
- return this._map;
86
- }
87
- setProps(t) {
88
- const o = this.props;
89
- this.props = t;
90
- const a = this._updateSettings(t, o), e = this._updateSize(t), s = this._updateViewState(t);
91
- this._updateStyle(t, o), this._updateStyleComponents(t), this._updateHandlers(t, o), (a || e || s && !this._map.isMoving()) && this.redraw();
92
- }
93
- static reuse(t, o) {
94
- const a = c.savedMaps.pop();
95
- if (!a)
96
- return null;
97
- const e = a.map, s = e.getContainer();
98
- for (o.className = s.className; s.childNodes.length > 0; )
99
- o.appendChild(s.childNodes[0]);
100
- e._container = o;
101
- const n = e._resizeObserver;
102
- n && (n.disconnect(), n.observe(o)), a.setProps({ ...t, styleDiffing: !1 }), e.resize();
103
- const { initialViewState: r } = t;
104
- return r && (r.bounds ? e.fitBounds(r.bounds, { ...r.fitBoundsOptions, duration: 0 }) : a._updateViewState(r)), e.isStyleLoaded() ? e.fire("load") : e.once("style.load", () => e.fire("load")), e._update(), a;
105
- }
106
- /* eslint-disable complexity,max-statements */
107
- _initialize(t) {
108
- const { props: o } = this, { mapStyle: a = u } = o, e = {
109
- ...o,
110
- ...o.initialViewState,
111
- container: t,
112
- style: l(a)
113
- }, s = e.initialViewState || e.viewState || e;
114
- if (Object.assign(e, {
115
- center: [s.longitude || 0, s.latitude || 0],
116
- zoom: s.zoom || 0,
117
- pitch: s.pitch || 0,
118
- bearing: s.bearing || 0
119
- }), o.gl) {
120
- const r = HTMLCanvasElement.prototype.getContext;
121
- HTMLCanvasElement.prototype.getContext = () => (HTMLCanvasElement.prototype.getContext = r, o.gl);
122
- }
123
- const n = new this._MapClass(e);
124
- s.padding && n.setPadding(s.padding), o.cursor && (n.getCanvas().style.cursor = o.cursor), n.transformCameraUpdate = this._onCameraUpdate, n.on("style.load", () => {
125
- this._styleComponents = {
126
- light: n.getLight(),
127
- sky: n.getSky(),
128
- // @ts-ignore getProjection() does not exist in v4
129
- projection: n.getProjection?.(),
130
- terrain: n.getTerrain()
131
- }, this._updateStyleComponents(this.props);
132
- }), n.on("sourcedata", () => {
133
- this._updateStyleComponents(this.props);
134
- });
135
- for (const r in h)
136
- n.on(r, this._onPointerEvent);
137
- for (const r in m)
138
- n.on(r, this._onCameraEvent);
139
- for (const r in f)
140
- n.on(r, this._onEvent);
141
- this._map = n;
142
- }
143
- /* eslint-enable complexity,max-statements */
144
- recycle() {
145
- this.map.getContainer().querySelector("[mapboxgl-children]")?.remove(), c.savedMaps.push(this);
146
- }
147
- destroy() {
148
- this._map.remove();
149
- }
150
- // Force redraw the map now. Typically resize() and jumpTo() is reflected in the next
151
- // render cycle, which is managed by Mapbox's animation loop.
152
- // This removes the synchronization issue caused by requestAnimationFrame.
153
- redraw() {
154
- const t = this._map;
155
- t.style && (t._frame && (t._frame.cancel(), t._frame = null), t._render());
156
- }
157
- /* Trigger map resize if size is controlled
158
- @param {object} nextProps
159
- @returns {bool} true if size has changed
160
- */
161
- _updateSize(t) {
162
- const { viewState: o } = t;
163
- if (o) {
164
- const a = this._map;
165
- if (o.width !== a.transform.width || o.height !== a.transform.height)
166
- return a.resize(), !0;
167
- }
168
- return !1;
169
- }
170
- // Adapted from map.jumpTo
171
- /* Update camera to match props
172
- @param {object} nextProps
173
- @param {bool} triggerEvents - should fire camera events
174
- @returns {bool} true if anything is changed
175
- */
176
- _updateViewState(t) {
177
- const o = this._map, a = o.transform;
178
- if (!o.isMoving()) {
179
- const s = p(a, t);
180
- if (Object.keys(s).length > 0)
181
- return this._internalUpdate = !0, o.jumpTo(s), this._internalUpdate = !1, !0;
1
+ function b(e, o, f) {
2
+ if (e !== null)
3
+ for (var r, i, a, u, c, t, s, y = 0, l = 0, h, p = e.type, C = p === "FeatureCollection", G = p === "Feature", w = C ? e.features.length : 1, P = 0; P < w; P++) {
4
+ s = C ? e.features[P].geometry : G ? e.geometry : e, h = s ? s.type === "GeometryCollection" : !1, c = h ? s.geometries.length : 1;
5
+ for (var M = 0; M < c; M++) {
6
+ var n = 0, g = 0;
7
+ if (u = h ? s.geometries[M] : s, u !== null) {
8
+ t = u.coordinates;
9
+ var v = u.type;
10
+ switch (y = 0, v) {
11
+ case null:
12
+ break;
13
+ case "Point":
14
+ if (o(
15
+ t,
16
+ l,
17
+ P,
18
+ n,
19
+ g
20
+ ) === !1)
21
+ return !1;
22
+ l++, n++;
23
+ break;
24
+ case "LineString":
25
+ case "MultiPoint":
26
+ for (r = 0; r < t.length; r++) {
27
+ if (o(
28
+ t[r],
29
+ l,
30
+ P,
31
+ n,
32
+ g
33
+ ) === !1)
34
+ return !1;
35
+ l++, v === "MultiPoint" && n++;
36
+ }
37
+ v === "LineString" && n++;
38
+ break;
39
+ case "Polygon":
40
+ case "MultiLineString":
41
+ for (r = 0; r < t.length; r++) {
42
+ for (i = 0; i < t[r].length - y; i++) {
43
+ if (o(
44
+ t[r][i],
45
+ l,
46
+ P,
47
+ n,
48
+ g
49
+ ) === !1)
50
+ return !1;
51
+ l++;
52
+ }
53
+ v === "MultiLineString" && n++, v === "Polygon" && g++;
54
+ }
55
+ v === "Polygon" && n++;
56
+ break;
57
+ case "MultiPolygon":
58
+ for (r = 0; r < t.length; r++) {
59
+ for (g = 0, i = 0; i < t[r].length; i++) {
60
+ for (a = 0; a < t[r][i].length - y; a++) {
61
+ if (o(
62
+ t[r][i][a],
63
+ l,
64
+ P,
65
+ n,
66
+ g
67
+ ) === !1)
68
+ return !1;
69
+ l++;
70
+ }
71
+ g++;
72
+ }
73
+ n++;
74
+ }
75
+ break;
76
+ case "GeometryCollection":
77
+ for (r = 0; r < u.geometries.length; r++)
78
+ if (b(u.geometries[r], o) === !1)
79
+ return !1;
80
+ break;
81
+ default:
82
+ throw new Error("Unknown Geometry Type");
83
+ }
84
+ }
85
+ }
182
86
  }
183
- return !1;
184
- }
185
- /* Update camera constraints and projection settings to match props
186
- @param {object} nextProps
187
- @param {object} currProps
188
- @returns {bool} true if anything is changed
189
- */
190
- _updateSettings(t, o) {
191
- const a = this._map;
192
- let e = !1;
193
- for (const s of v)
194
- s in t && !i(t[s], o[s]) && (e = !0, a[`set${s[0].toUpperCase()}${s.slice(1)}`]?.call(a, t[s]));
195
- return e;
196
- }
197
- /* Update map style to match props */
198
- _updateStyle(t, o) {
199
- if (t.cursor !== o.cursor && (this._map.getCanvas().style.cursor = t.cursor || ""), t.mapStyle !== o.mapStyle) {
200
- const { mapStyle: a = u, styleDiffing: e = !0 } = t, s = {
201
- diff: e
202
- };
203
- "localIdeographFontFamily" in t && (s.localIdeographFontFamily = t.localIdeographFontFamily), this._map.setStyle(l(a), s);
204
- }
205
- }
206
- /* Update fog, light, projection and terrain to match props
207
- * These props are special because
208
- * 1. They can not be applied right away. Certain conditions (style loaded, source loaded, etc.) must be met
209
- * 2. They can be overwritten by mapStyle
210
- */
211
- _updateStyleComponents({ light: t, projection: o, sky: a, terrain: e }) {
212
- const s = this._map, n = this._styleComponents;
213
- s.style._loaded && (t && !i(t, n.light) && (n.light = t, s.setLight(t)), o && !i(o, n.projection) && o !== n.projection?.type && (n.projection = typeof o == "string" ? { type: o } : o, s.setProjection?.(n.projection)), a && !i(a, n.sky) && (n.sky = a, s.setSky(a)), e !== void 0 && !i(e, n.terrain) && (!e || s.getSource(e.source)) && (n.terrain = e, s.setTerrain(e)));
214
- }
215
- /* Update interaction handlers to match props */
216
- _updateHandlers(t, o) {
217
- const a = this._map;
218
- for (const e of _) {
219
- const s = t[e] ?? !0, n = o[e] ?? !0;
220
- i(s, n) || (s ? a[e].enable(s) : a[e].disable());
221
- }
222
- }
223
- _queryRenderedFeatures(t) {
224
- const o = this._map, { interactiveLayerIds: a = [] } = this.props;
225
- try {
226
- return o.queryRenderedFeatures(t, {
227
- layers: a.filter(o.getLayer.bind(o))
228
- });
229
- } catch {
230
- return [];
87
+ }
88
+ function S(e, o) {
89
+ if (e.type === "Feature")
90
+ o(e, 0);
91
+ else if (e.type === "FeatureCollection")
92
+ for (var f = 0; f < e.features.length && o(e.features[f], f) !== !1; f++)
93
+ ;
94
+ }
95
+ function k(e, o) {
96
+ var f, r, i, a, u, c, t, s, y, l, h = 0, p = e.type === "FeatureCollection", C = e.type === "Feature", G = p ? e.features.length : 1;
97
+ for (f = 0; f < G; f++) {
98
+ for (c = p ? e.features[f].geometry : C ? e.geometry : e, s = p ? e.features[f].properties : C ? e.properties : {}, y = p ? e.features[f].bbox : C ? e.bbox : void 0, l = p ? e.features[f].id : C ? e.id : void 0, t = c ? c.type === "GeometryCollection" : !1, u = t ? c.geometries.length : 1, i = 0; i < u; i++) {
99
+ if (a = t ? c.geometries[i] : c, a === null) {
100
+ if (o(
101
+ null,
102
+ h,
103
+ s,
104
+ y,
105
+ l
106
+ ) === !1)
107
+ return !1;
108
+ continue;
109
+ }
110
+ switch (a.type) {
111
+ case "Point":
112
+ case "LineString":
113
+ case "MultiPoint":
114
+ case "Polygon":
115
+ case "MultiLineString":
116
+ case "MultiPolygon": {
117
+ if (o(
118
+ a,
119
+ h,
120
+ s,
121
+ y,
122
+ l
123
+ ) === !1)
124
+ return !1;
125
+ break;
126
+ }
127
+ case "GeometryCollection": {
128
+ for (r = 0; r < a.geometries.length; r++)
129
+ if (o(
130
+ a.geometries[r],
131
+ h,
132
+ s,
133
+ y,
134
+ l
135
+ ) === !1)
136
+ return !1;
137
+ break;
138
+ }
139
+ default:
140
+ throw new Error("Unknown Geometry Type");
141
+ }
231
142
  }
232
- }
233
- _updateHover(t) {
234
- const { props: o } = this;
235
- if (o.interactiveLayerIds && (o.onMouseMove || o.onMouseEnter || o.onMouseLeave)) {
236
- const e = t.type, s = this._hoveredFeatures?.length > 0, n = this._queryRenderedFeatures(t.point), r = n.length > 0;
237
- !r && s && (t.type = "mouseleave", this._onPointerEvent(t)), this._hoveredFeatures = n, r && !s && (t.type = "mouseenter", this._onPointerEvent(t)), t.type = e;
238
- } else
239
- this._hoveredFeatures = null;
143
+ h++;
240
144
  }
241
145
  }
242
- c.savedMaps = [];
243
146
  export {
244
- c as default
147
+ b as coordEach,
148
+ S as featureEach,
149
+ k as geomEach
245
150
  };
246
151
  //# sourceMappingURL=index.es190.js.map