@performant-software/geospatial 3.1.24-beta.0 → 3.1.24-beta.2

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 (154) 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.cjs197.js +1 -1
  9. package/dist/index.cjs20.js +1 -1
  10. package/dist/index.cjs21.js +1 -1
  11. package/dist/index.cjs212.js +1 -1
  12. package/dist/index.cjs213.js +1 -1
  13. package/dist/index.cjs214.js +1 -1
  14. package/dist/index.cjs22.js +1 -1
  15. package/dist/index.cjs23.js +1 -1
  16. package/dist/index.cjs232.js +1 -1
  17. package/dist/index.cjs237.js +7 -1
  18. package/dist/index.cjs237.js.map +1 -1
  19. package/dist/index.cjs238.js +1 -1
  20. package/dist/index.cjs238.js.map +1 -1
  21. package/dist/index.cjs239.js +1 -1
  22. package/dist/index.cjs239.js.map +1 -1
  23. package/dist/index.cjs24.js +1 -1
  24. package/dist/index.cjs240.js +1 -1
  25. package/dist/index.cjs240.js.map +1 -1
  26. package/dist/index.cjs241.js +1 -1
  27. package/dist/index.cjs241.js.map +1 -1
  28. package/dist/index.cjs242.js +1 -1
  29. package/dist/index.cjs242.js.map +1 -1
  30. package/dist/index.cjs243.js +1 -1
  31. package/dist/index.cjs243.js.map +1 -1
  32. package/dist/index.cjs244.js +1 -1
  33. package/dist/index.cjs244.js.map +1 -1
  34. package/dist/index.cjs245.js +1 -7
  35. package/dist/index.cjs245.js.map +1 -1
  36. package/dist/index.cjs246.js +1 -1
  37. package/dist/index.cjs246.js.map +1 -1
  38. package/dist/index.cjs248.js +1 -1
  39. package/dist/index.cjs248.js.map +1 -1
  40. package/dist/index.cjs249.js +1 -1
  41. package/dist/index.cjs249.js.map +1 -1
  42. package/dist/index.cjs25.js +1 -1
  43. package/dist/index.cjs257.js +1 -1
  44. package/dist/index.cjs26.js +1 -1
  45. package/dist/index.cjs261.js +1 -1
  46. package/dist/index.cjs262.js +1 -1
  47. package/dist/index.cjs265.js +1 -1
  48. package/dist/index.cjs268.js +1 -1
  49. package/dist/index.cjs27.js +1 -1
  50. package/dist/index.cjs271.js +1 -1
  51. package/dist/index.cjs271.js.map +1 -1
  52. package/dist/index.cjs272.js +1 -1
  53. package/dist/index.cjs272.js.map +1 -1
  54. package/dist/index.cjs273.js +1 -1
  55. package/dist/index.cjs273.js.map +1 -1
  56. package/dist/index.cjs29.js +1 -1
  57. package/dist/index.cjs32.js +1 -1
  58. package/dist/index.cjs7.js +1 -1
  59. package/dist/index.cjs7.js.map +1 -1
  60. package/dist/index.cjs79.js +743 -1
  61. package/dist/index.cjs79.js.map +1 -1
  62. package/dist/index.cjs80.js +1 -1
  63. package/dist/index.cjs81.js +1 -1
  64. package/dist/index.cjs81.js.map +1 -1
  65. package/dist/index.cjs82.js +1 -743
  66. package/dist/index.cjs82.js.map +1 -1
  67. package/dist/index.cjs83.js +9 -1
  68. package/dist/index.cjs83.js.map +1 -1
  69. package/dist/index.cjs84.js +17 -1
  70. package/dist/index.cjs84.js.map +1 -1
  71. package/dist/index.cjs85.js +1 -1
  72. package/dist/index.cjs85.js.map +1 -1
  73. package/dist/index.cjs86.js +1 -9
  74. package/dist/index.cjs86.js.map +1 -1
  75. package/dist/index.cjs87.js +1 -17
  76. package/dist/index.cjs87.js.map +1 -1
  77. package/dist/index.es13.js +77 -65
  78. package/dist/index.es13.js.map +1 -1
  79. package/dist/index.es15.js +1 -1
  80. package/dist/index.es16.js +4 -4
  81. package/dist/index.es17.js +3 -3
  82. package/dist/index.es18.js +3 -3
  83. package/dist/index.es19.js +1 -1
  84. package/dist/index.es197.js +2 -2
  85. package/dist/index.es20.js +1 -1
  86. package/dist/index.es21.js +1 -1
  87. package/dist/index.es212.js +1 -1
  88. package/dist/index.es213.js +1 -1
  89. package/dist/index.es214.js +1 -1
  90. package/dist/index.es22.js +1 -1
  91. package/dist/index.es23.js +1 -1
  92. package/dist/index.es232.js +1 -1
  93. package/dist/index.es237.js +7505 -241
  94. package/dist/index.es237.js.map +1 -1
  95. package/dist/index.es238.js +2 -43
  96. package/dist/index.es238.js.map +1 -1
  97. package/dist/index.es239.js +243 -3
  98. package/dist/index.es239.js.map +1 -1
  99. package/dist/index.es24.js +1 -1
  100. package/dist/index.es240.js +40 -8
  101. package/dist/index.es240.js.map +1 -1
  102. package/dist/index.es241.js +3 -11
  103. package/dist/index.es241.js.map +1 -1
  104. package/dist/index.es242.js +9 -29
  105. package/dist/index.es242.js.map +1 -1
  106. package/dist/index.es243.js +10 -13
  107. package/dist/index.es243.js.map +1 -1
  108. package/dist/index.es244.js +30 -4
  109. package/dist/index.es244.js.map +1 -1
  110. package/dist/index.es245.js +13 -7506
  111. package/dist/index.es245.js.map +1 -1
  112. package/dist/index.es246.js +5 -2
  113. package/dist/index.es246.js.map +1 -1
  114. package/dist/index.es248.js +6 -4
  115. package/dist/index.es248.js.map +1 -1
  116. package/dist/index.es249.js +4 -6
  117. package/dist/index.es249.js.map +1 -1
  118. package/dist/index.es25.js +1 -1
  119. package/dist/index.es257.js +1 -1
  120. package/dist/index.es26.js +2 -2
  121. package/dist/index.es261.js +1 -1
  122. package/dist/index.es262.js +2 -2
  123. package/dist/index.es265.js +1 -1
  124. package/dist/index.es268.js +1 -1
  125. package/dist/index.es27.js +2 -2
  126. package/dist/index.es271.js +4 -15
  127. package/dist/index.es271.js.map +1 -1
  128. package/dist/index.es272.js +15 -69
  129. package/dist/index.es272.js.map +1 -1
  130. package/dist/index.es273.js +69 -4
  131. package/dist/index.es273.js.map +1 -1
  132. package/dist/index.es29.js +2 -2
  133. package/dist/index.es32.js +2 -2
  134. package/dist/index.es7.js +9 -17
  135. package/dist/index.es7.js.map +1 -1
  136. package/dist/index.es79.js +21314 -1955
  137. package/dist/index.es79.js.map +1 -1
  138. package/dist/index.es80.js +2 -6
  139. package/dist/index.es80.js.map +1 -1
  140. package/dist/index.es81.js +8 -2
  141. package/dist/index.es81.js.map +1 -1
  142. package/dist/index.es82.js +2 -21352
  143. package/dist/index.es82.js.map +1 -1
  144. package/dist/index.es83.js +26 -2
  145. package/dist/index.es83.js.map +1 -1
  146. package/dist/index.es84.js +588 -7
  147. package/dist/index.es84.js.map +1 -1
  148. package/dist/index.es85.js +1993 -2
  149. package/dist/index.es85.js.map +1 -1
  150. package/dist/index.es86.js +5 -25
  151. package/dist/index.es86.js.map +1 -1
  152. package/dist/index.es87.js +2 -589
  153. package/dist/index.es87.js.map +1 -1
  154. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";const C=require("./index.cjs68.js"),q=require("./index.cjs69.js"),L=require("./index.cjs70.js"),_=require("./index.cjs71.js"),$=require("./index.cjs72.js"),M=require("./index.cjs73.js"),v=require("./index.cjs74.js"),A=require("./index.cjs75.js"),B=require("./index.cjs76.js"),I=require("./index.cjs77.js"),s=require("./index.cjs67.js"),F=require("./index.cjs78.js"),y=require("./index.cjs36.js");require("./index.cjs37.js");require("./index.cjs38.js");require("./index.cjs39.js");require("./index.cjs40.js");require("./index.cjs41.js");require("./index.cjs42.js");require("./index.cjs43.js");require("./index.cjs44.js");require("./index.cjs45.js");require("./index.cjs46.js");require("./index.cjs47.js");require("./index.cjs48.js");require("./index.cjs49.js");require("./index.cjs50.js");require("./index.cjs51.js");require("./index.cjs52.js");require("./index.cjs53.js");require("./index.cjs54.js");require("./index.cjs55.js");require("./index.cjs56.js");require("./index.cjs57.js");require("./index.cjs58.js");require("./index.cjs59.js");require("./index.cjs60.js");require("./index.cjs61.js");require("./index.cjs62.js");require("./index.cjs63.js");const G=-90,T=90,U=-180,h=180,d=(e,n)=>A.default(e.coordinates,n,{units:"kilometers",steps:32}),P=(e,n)=>{if(e.geometry?.type==="FeatureCollection"){let r=[];for(const t of e.geometry.features)if(t.geometry?.type==="Point"){const{geometry:o,type:i}=d(t.geometry,n);r.push({...t,geometry:o,type:i})}return s.featureCollection(r)}else{if(e.geometry?.type==="GeometryCollection")return s.featureCollection(e.geometry.geometries.map(r=>r.type==="Point"?d(r,n):s.feature(r)));if(e.geometry?.type==="Point"){const{geometry:r,type:t}=d(e.geometry,n);return{...e,geometry:r,type:t}}}return e},D=(e,n,r={})=>{const t=new C.WarpedMapLayer(n);e.addLayer(t),r.url?t.addGeoreferenceAnnotationByUrl(r.url):r.manifest&&t.addGeoreferenceAnnotation(r.manifest),r.opacity&&t.setOpacity(r.opacity)},E=(e,n=null)=>{const r=q.bbox(e);if(!f(r))return null;const t=L.bboxPolygon(r);let o;return n?o=M.buffer(t,n,{units:"miles"}):o=t,q.bbox(o)},N=(e,n)=>e&&e.removeLayer(n),O=(e,n,r,t)=>{const o={id:e.record_id,ccode:[],title:e.name,uuid:e.uuid,record_id:e.record_id,name:e.name,names:e.names?.map(u=>({toponym:u})),type:e.type,items:[n],url:e.url,originalProperties:t||{}},i=parseInt(e.record_id,10);return s.feature(r,o,{id:i})},w=e=>s.featureCollection(e),f=e=>y.every(e,y.isFinite),S=e=>{let n=!1;if(e){const[r,t]=e;n=r>=G&&r<=T&&t>=U&&t<=h}return n},X=(e,n={})=>{const{curvature:r=-.2}=n,t=e.map(i=>v.centroid(i).geometry.coordinates),o=[];for(let i=0;i<t.length-1;i+=1){const u=t[i],c=t[i+1],p=I.distance(u,c),g=F.midpoint(u,c),a=_.bearing(u,c),m=a+90>180?a+90-360:a+90,x=B.destination(g,p*r,m),b=s.lineString([u,x.geometry.coordinates,c]),l=$.bezierSpline(b);l.properties={...l.properties,index:i},o.push(l)}return s.featureCollection(o)},k={addGeoreferenceLayer:D,toCertaintyCircle:P,getBoundingBox:E,removeLayer:N,toArcs:X,toFeature:O,toFeatureCollection:w,validateBoundingBox:f,validateCoordinates:S};module.exports=k;
1
+ "use strict";const G=require("./index.cjs68.js"),A=require("./index.cjs69.js"),I=require("./index.cjs70.js"),L=require("./index.cjs71.js"),M=require("./index.cjs72.js"),v=require("./index.cjs73.js"),E=require("./index.cjs74.js"),F=require("./index.cjs75.js"),b=require("./index.cjs76.js"),N=require("./index.cjs77.js"),u=require("./index.cjs67.js"),U=require("./index.cjs78.js"),$=require("./index.cjs36.js");require("./index.cjs37.js");require("./index.cjs38.js");require("./index.cjs39.js");require("./index.cjs40.js");require("./index.cjs41.js");require("./index.cjs42.js");require("./index.cjs43.js");require("./index.cjs44.js");require("./index.cjs45.js");require("./index.cjs46.js");require("./index.cjs47.js");require("./index.cjs48.js");require("./index.cjs49.js");require("./index.cjs50.js");require("./index.cjs51.js");require("./index.cjs52.js");require("./index.cjs53.js");require("./index.cjs54.js");require("./index.cjs55.js");require("./index.cjs56.js");require("./index.cjs57.js");require("./index.cjs58.js");require("./index.cjs59.js");require("./index.cjs60.js");require("./index.cjs61.js");require("./index.cjs62.js");require("./index.cjs63.js");const P=-90,D=90,O=-180,W=180,C=(e,n)=>F.default(e.coordinates,n,{units:"kilometers",steps:32}),w=(e,n)=>{if(e.geometry?.type==="FeatureCollection"){let r=[];for(const t of e.geometry.features)if(t.geometry?.type==="Point"){const{geometry:s,type:d}=C(t.geometry,n);r.push({...t,geometry:s,type:d})}return u.featureCollection(r)}else{if(e.geometry?.type==="GeometryCollection")return u.featureCollection(e.geometry.geometries.map(r=>r.type==="Point"?C(r,n):u.feature(r)));if(e.geometry?.type==="Point"){const{geometry:r,type:t}=C(e.geometry,n);return{...e,geometry:r,type:t}}}return e},R=(e,n,r={})=>{const t=new G.WarpedMapLayer(n);e.addLayer(t),r.url?t.addGeoreferenceAnnotationByUrl(r.url):r.manifest&&t.addGeoreferenceAnnotation(r.manifest),r.opacity&&t.setOpacity(r.opacity)},S=(e,n=null)=>{const r=A.bbox(e);if(!h(r))return null;const t=I.bboxPolygon(r);let s;return n?s=v.buffer(t,n,{units:"miles"}):s=t,A.bbox(s)},k=(e,n)=>e&&e.removeLayer(n),z=(e,n,r,t)=>{const s={id:e.record_id,ccode:[],title:e.name,uuid:e.uuid,record_id:e.record_id,name:e.name,names:e.names?.map(q=>({toponym:q})),type:e.type,items:[n],url:e.url,originalProperties:t||{}},d=parseInt(e.record_id,10);return u.feature(r,s,{id:d})},X=e=>u.featureCollection(e),h=e=>$.every(e,$.isFinite),j=e=>{let n=!1;if(e){const[r,t]=e;n=r>=P&&r<=D&&t>=O&&t<=W}return n},H=(e,n={})=>{const{curvature:r=-.2,arrows:t=!1}=n,s=30,d=.2,q=o=>{const i=(o%360+360)%360;return i>180?i-360:i},T=(o,i)=>{const c=o.geometry.coordinates,a=c[c.length-1],g=c[c.length-2],l=L.bearing(g,a)+180,m=b.destination(a,i,q(l-s)).geometry.coordinates,x=b.destination(a,i,q(l+s)).geometry.coordinates;return u.lineString([m,a,x])},p=e.map(o=>E.centroid(o).geometry.coordinates),f=[];for(let o=0;o<p.length-1;o+=1){const i=p[o],c=p[o+1],a=N.distance(i,c),g=U.midpoint(i,c),l=L.bearing(i,c),m=l+90>180?l+90-360:l+90,x=b.destination(g,a*r,m),B=u.lineString([i,x.geometry.coordinates,c]),y=M.bezierSpline(B);if(y.properties={...y.properties,index:o},f.push(y),t){const _=T(y,a*d);_.properties={index:o,arrow:!0},f.push(_)}}return u.featureCollection(f)},J={addGeoreferenceLayer:R,toCertaintyCircle:w,getBoundingBox:S,removeLayer:k,toArcs:H,toFeature:z,toFeatureCollection:X,validateBoundingBox:h,validateCoordinates:j};module.exports=J;
2
2
  //# sourceMappingURL=index.cjs13.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs13.js","sources":["../src/utils/Map.js"],"sourcesContent":["// @flow\n\nimport { WarpedMapLayer } from '@allmaps/maplibre';\nimport {\n bbox,\n bboxPolygon,\n bearing,\n bezierSpline,\n buffer,\n centroid,\n destination,\n distance,\n feature,\n featureCollection,\n lineString,\n midpoint\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 const { geometry, type } = buildCircle(childFeature.geometry, radius);\n children.push({\n ...childFeature,\n geometry,\n type\n });\n }\n }\n\n return featureCollection(children);\n } else if (item.geometry?.type === 'GeometryCollection') {\n return featureCollection(item.geometry.geometries.map((geometry) => geometry.type === 'Point'\n ? buildCircle(geometry, radius)\n : feature(geometry)));\n } else if (item.geometry?.type === 'Point') {\n const { geometry, type } = buildCircle(item.geometry, radius);\n return {\n ...item,\n geometry,\n type\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\n/**\n * Returns a GeoJSON FeatureCollection of LineStrings (arcs) for the passed coordinates.\n *\n * @param features\n * @param options\n *\n * @returns {FeatureCollection<LineString, GeoJsonProperties>}\n */\nconst toArcs = (features, options = {}) => {\n const { curvature = -0.2 } = options;\n\n const coordinates = features.map(feature => centroid(feature).geometry.coordinates);\n\n const arcFeatures = [];\n\n for (let i = 0; i < coordinates.length - 1; i += 1) {\n const start = coordinates[i];\n const end = coordinates[i + 1];\n\n const d = distance(start, end);\n const m = midpoint(start, end);\n const b = bearing(start, end);\n\n const offsetBearing = b + 90 > 180 ? b + 90 - 360 : b + 90;\n const dest = destination(m, d * curvature, offsetBearing);\n\n const line = lineString([start, dest.geometry.coordinates, end]);\n const arc = bezierSpline(line);\n\n arc.properties = {\n ...arc.properties,\n index: i\n };\n\n arcFeatures.push(arc);\n }\n\n return featureCollection(arcFeatures);\n};\n\nexport default {\n addGeoreferenceLayer,\n toCertaintyCircle,\n getBoundingBox,\n removeLayer,\n toArcs,\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","type","featureCollection","feature","addGeoreferenceLayer","map","layerId","options","warpedMapLayer","WarpedMapLayer","getBoundingBox","data","bufferDistance","box","bbox","validateBoundingBox","polygon","bboxPolygon","polygonBuffer","buffer","removeLayer","toFeature","record","originalProperties","properties","toponym","id","toFeatureCollection","features","boundingBox","_","validateCoordinates","coordinates","valid","latitude","longitude","toArcs","curvature","centroid","arcFeatures","start","end","d","distance","m","midpoint","b","bearing","offsetBearing","dest","destination","line","lineString","arc","bezierSpline","MapUtils"],"mappings":"6oCAoBA,MAAMA,EAAe,IACfC,EAAe,GACfC,EAAgB,KAChBC,EAAgB,IAQhBC,EAAc,CAACC,EAAOC,IAC1BC,EAAAA,QAAOF,EAAM,YAAaC,EAAQ,CAAE,MAAO,aAAc,MAAO,GAAI,EAGhEE,EA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EAAIC,EAAAA,SAASH,EAAOC,CAAG,EACvBG,EAAIC,EAAAA,SAASL,EAAOC,CAAG,EACvBK,EAAIC,EAAAA,QAAQP,EAAOC,CAAG,EAEtBO,EAAgBF,EAAI,GAAK,IAAMA,EAAI,GAAK,IAAMA,EAAI,GAClDG,EAAOC,EAAAA,YAAYN,EAAGF,EAAIL,EAAWW,CAAa,EAElDG,EAAOC,EAAAA,WAAW,CAACZ,EAAOS,EAAK,SAAS,YAAaR,CAAG,CAAC,EACzDY,EAAMC,EAAAA,aAAaH,CAAI,EAE7BE,EAAI,WAAa,CACf,GAAGA,EAAI,WACP,MAAO,CAAA,EAGTd,EAAY,KAAKc,CAAG,CACtB,CAEA,OAAOnD,EAAAA,kBAAkBqC,CAAW,CACtC,EAEAgB,EAAe,CACb,qBAAAnD,EACA,kBAAAR,EACA,eAAAc,EACA,YAAAU,EACA,OAAAgB,EACA,UAAAf,EACA,oBAAAM,EACA,oBAAAZ,EACA,oBAAAgB,CACF"}
1
+ {"version":3,"file":"index.cjs13.js","sources":["../src/utils/Map.js"],"sourcesContent":["// @flow\n\nimport { WarpedMapLayer } from '@allmaps/maplibre';\nimport {\n bbox,\n bboxPolygon,\n bearing,\n bezierSpline,\n buffer,\n centroid,\n destination,\n distance,\n feature,\n featureCollection,\n lineString,\n midpoint\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 const { geometry, type } = buildCircle(childFeature.geometry, radius);\n children.push({\n ...childFeature,\n geometry,\n type\n });\n }\n }\n\n return featureCollection(children);\n } else if (item.geometry?.type === 'GeometryCollection') {\n return featureCollection(item.geometry.geometries.map((geometry) => geometry.type === 'Point'\n ? buildCircle(geometry, radius)\n : feature(geometry)));\n } else if (item.geometry?.type === 'Point') {\n const { geometry, type } = buildCircle(item.geometry, radius);\n return {\n ...item,\n geometry,\n type\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\n/**\n * Returns a GeoJSON FeatureCollection of LineStrings (arcs) for the passed coordinates.\n *\n * @param features\n * @param options\n *\n * @returns {FeatureCollection<LineString, GeoJsonProperties>}\n */\nconst toArcs = (features, options = {}) => {\n const { curvature = -0.2, arrows = false } = options;\n\n const CARET_ANGLE = 30;\n const CARET_WING_FACTOR = 0.2;\n\n const normalizeBearing = deg => {\n const d = ((deg % 360) + 360) % 360;\n return d > 180 ? d - 360 : d;\n };\n\n const buildCaret = (arc, wingLength) => {\n const coords = arc.geometry.coordinates;\n const tip = coords[coords.length - 1];\n const behind = coords[coords.length - 2];\n const back = bearing(behind, tip) + 180;\n\n const leftWing = destination(tip, wingLength, normalizeBearing(back - CARET_ANGLE)).geometry.coordinates;\n const rightWing = destination(tip, wingLength, normalizeBearing(back + CARET_ANGLE)).geometry.coordinates;\n\n return lineString([leftWing, tip, rightWing]);\n };\n\n const coordinates = features.map(feature => centroid(feature).geometry.coordinates);\n\n const arcFeatures = [];\n\n for (let i = 0; i < coordinates.length - 1; i += 1) {\n const start = coordinates[i];\n const end = coordinates[i + 1];\n\n const d = distance(start, end);\n const m = midpoint(start, end);\n const b = bearing(start, end);\n\n const offsetBearing = b + 90 > 180 ? b + 90 - 360 : b + 90;\n const dest = destination(m, d * curvature, offsetBearing);\n\n const line = lineString([start, dest.geometry.coordinates, end]);\n const arc = bezierSpline(line);\n\n arc.properties = {\n ...arc.properties,\n index: i\n };\n\n arcFeatures.push(arc);\n\n if (arrows) {\n const caret = buildCaret(arc, d * CARET_WING_FACTOR);\n\n caret.properties = {\n index: i,\n arrow: true\n };\n\n arcFeatures.push(caret);\n }\n }\n\n return featureCollection(arcFeatures);\n};\n\nexport default {\n addGeoreferenceLayer,\n toCertaintyCircle,\n getBoundingBox,\n removeLayer,\n toArcs,\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","type","featureCollection","feature","addGeoreferenceLayer","map","layerId","options","warpedMapLayer","WarpedMapLayer","getBoundingBox","data","bufferDistance","box","bbox","validateBoundingBox","polygon","bboxPolygon","polygonBuffer","buffer","removeLayer","toFeature","record","originalProperties","properties","toponym","id","toFeatureCollection","features","boundingBox","_","validateCoordinates","coordinates","valid","latitude","longitude","toArcs","curvature","arrows","CARET_ANGLE","CARET_WING_FACTOR","normalizeBearing","deg","d","buildCaret","arc","wingLength","coords","tip","behind","back","bearing","leftWing","destination","rightWing","lineString","centroid","arcFeatures","i","start","end","distance","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KAAKZ,CAAG,EAEhBP,EAAQ,CACV,MAAM+B,EAAQzB,EAAWC,EAAKF,EAAIH,CAAiB,EAEnD6B,EAAM,WAAa,CACjB,MAAOX,EACP,MAAO,EAAA,EAGTD,EAAY,KAAKY,CAAK,CACxB,CACF,CAEA,OAAOnE,EAAAA,kBAAkBuD,CAAW,CACtC,EAEAa,EAAe,CACb,qBAAAlE,EACA,kBAAAR,EACA,eAAAc,EACA,YAAAU,EACA,OAAAgB,EACA,UAAAf,EACA,oBAAAM,EACA,oBAAAZ,EACA,oBAAAgB,CACF"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index.cjs84.js");var t=e.__require();exports.jsxRuntimeExports=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index.cjs81.js");var t=e.__require();exports.jsxRuntimeExports=t;
2
2
  //# sourceMappingURL=index.cjs15.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),g=require("./index.cjs28.js"),m=require("./index.cjs237.js"),v=require("./index.cjs238.js"),y=require("./index.cjs239.js"),E=require("./index.cjs240.js");function L(e){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(c,a,i.get?i:{enumerable:!0,get:()=>e[a]})}}return c.default=e,Object.freeze(c)}const s=L(r),d=s.createContext(null);function x(e,c){const a=r.useContext(g.MountedMapsContext),[i,M]=r.useState(null),u=r.useRef(),{current:l}=r.useRef({mapLib:null,map:null});r.useEffect(()=>{const h=e.mapLib;let f=!0,n;return Promise.resolve(h||Promise.resolve().then(()=>require("./index.cjs32.js")).then(t=>t.Li)).then(t=>{if(!f)return;if(!t)throw new Error("Invalid mapLib");const o="Map"in t?t:t.default;if(!o.Map)throw new Error("Invalid mapLib");E(o,e),e.reuseMaps&&(n=m.reuse(e,u.current)),n||(n=new m(o.Map,e,u.current)),l.map=v(n),l.mapLib=o,M(n),a?.onMapMount(l.map,e.id)}).catch(t=>{const{onError:o}=e;o?o({type:"error",target:null,originalEvent:null,error:t}):console.error(t)}),()=>{f=!1,n&&(a?.onMapUnmount(e.id),e.reuseMaps?n.recycle():n.destroy())}},[]),y(()=>{i&&i.setProps(e)}),r.useImperativeHandle(c,()=>l.map,[i]);const b=r.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),p={height:"100%"};return s.createElement("div",{id:e.id,ref:u,style:b},i&&s.createElement(d.Provider,{value:l},s.createElement("div",{"mapboxgl-children":"",style:p},e.children)))}const w=s.forwardRef(x);exports.Map=w;exports.MapContext=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),g=require("./index.cjs28.js"),m=require("./index.cjs239.js"),v=require("./index.cjs240.js"),y=require("./index.cjs241.js"),E=require("./index.cjs242.js");function L(e){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(c,a,i.get?i:{enumerable:!0,get:()=>e[a]})}}return c.default=e,Object.freeze(c)}const s=L(r),d=s.createContext(null);function x(e,c){const a=r.useContext(g.MountedMapsContext),[i,M]=r.useState(null),u=r.useRef(),{current:l}=r.useRef({mapLib:null,map:null});r.useEffect(()=>{const h=e.mapLib;let f=!0,n;return Promise.resolve(h||Promise.resolve().then(()=>require("./index.cjs32.js")).then(t=>t.Li)).then(t=>{if(!f)return;if(!t)throw new Error("Invalid mapLib");const o="Map"in t?t:t.default;if(!o.Map)throw new Error("Invalid mapLib");E(o,e),e.reuseMaps&&(n=m.reuse(e,u.current)),n||(n=new m(o.Map,e,u.current)),l.map=v(n),l.mapLib=o,M(n),a?.onMapMount(l.map,e.id)}).catch(t=>{const{onError:o}=e;o?o({type:"error",target:null,originalEvent:null,error:t}):console.error(t)}),()=>{f=!1,n&&(a?.onMapUnmount(e.id),e.reuseMaps?n.recycle():n.destroy())}},[]),y(()=>{i&&i.setProps(e)}),r.useImperativeHandle(c,()=>l.map,[i]);const b=r.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),p={height:"100%"};return s.createElement("div",{id:e.id,ref:u,style:b},i&&s.createElement(d.Provider,{value:l},s.createElement("div",{"mapboxgl-children":"",style:p},e.children)))}const w=s.forwardRef(x);exports.Map=w;exports.MapContext=d;
2
2
  //# sourceMappingURL=index.cjs16.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const a=require("react"),D=require("react-dom"),P=require("./index.cjs241.js"),q=require("./index.cjs16.js"),C=require("./index.cjs242.js"),k=require("./index.cjs243.js");function N(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const l=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(i,s,l.get?l:{enumerable:!0,get:()=>t[s]})}}return i.default=t,Object.freeze(i)}const O=N(a);a.memo(a.forwardRef((t,i)=>{const{map:s,mapLib:l}=a.useContext(q.MapContext),c=a.useRef({props:t}),e=a.useMemo(()=>{let g=!1;O.Children.forEach(t.children,n=>{n&&(g=!0)});const y={...t,element:g?document.createElement("div"):void 0},o=new l.Marker(y);return o.setLngLat([t.longitude,t.latitude]),o.getElement().addEventListener("click",n=>{c.current.props.onClick?.({type:"click",target:o,originalEvent:n})}),o.on("dragstart",n=>{const r=n;r.lngLat=e.getLngLat(),c.current.props.onDragStart?.(r)}),o.on("drag",n=>{const r=n;r.lngLat=e.getLngLat(),c.current.props.onDrag?.(r)}),o.on("dragend",n=>{const r=n;r.lngLat=e.getLngLat(),c.current.props.onDragEnd?.(r)}),o},[]);a.useEffect(()=>(e.addTo(s.getMap()),()=>{e.remove()}),[]);const{longitude:f,latitude:m,offset:u,style:d,draggable:p=!1,popup:L=null,rotation:E=0,rotationAlignment:R="auto",pitchAlignment:b="auto"}=t;a.useEffect(()=>{P.applyReactStyle(e.getElement(),d)},[d]),a.useImperativeHandle(i,()=>e,[]);const v=c.current.props;(e.getLngLat().lng!==f||e.getLngLat().lat!==m)&&e.setLngLat([f,m]),u&&!C.arePointsEqual(e.getOffset(),u)&&e.setOffset(u),e.isDraggable()!==p&&e.setDraggable(p),e.getRotation()!==E&&e.setRotation(E),e.getRotationAlignment()!==R&&e.setRotationAlignment(R),e.getPitchAlignment()!==b&&e.setPitchAlignment(b),e.getPopup()!==L&&e.setPopup(L);const h=k.compareClassNames(v.className,t.className);if(h)for(const g of h)e.toggleClassName(g);return c.current.props=t,D.createPortal(t.children,e.getElement())}));
1
+ "use strict";const a=require("react"),D=require("react-dom"),P=require("./index.cjs243.js"),q=require("./index.cjs16.js"),C=require("./index.cjs244.js"),k=require("./index.cjs245.js");function N(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const l=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(i,s,l.get?l:{enumerable:!0,get:()=>t[s]})}}return i.default=t,Object.freeze(i)}const O=N(a);a.memo(a.forwardRef((t,i)=>{const{map:s,mapLib:l}=a.useContext(q.MapContext),c=a.useRef({props:t}),e=a.useMemo(()=>{let g=!1;O.Children.forEach(t.children,n=>{n&&(g=!0)});const y={...t,element:g?document.createElement("div"):void 0},o=new l.Marker(y);return o.setLngLat([t.longitude,t.latitude]),o.getElement().addEventListener("click",n=>{c.current.props.onClick?.({type:"click",target:o,originalEvent:n})}),o.on("dragstart",n=>{const r=n;r.lngLat=e.getLngLat(),c.current.props.onDragStart?.(r)}),o.on("drag",n=>{const r=n;r.lngLat=e.getLngLat(),c.current.props.onDrag?.(r)}),o.on("dragend",n=>{const r=n;r.lngLat=e.getLngLat(),c.current.props.onDragEnd?.(r)}),o},[]);a.useEffect(()=>(e.addTo(s.getMap()),()=>{e.remove()}),[]);const{longitude:f,latitude:m,offset:u,style:d,draggable:p=!1,popup:L=null,rotation:E=0,rotationAlignment:R="auto",pitchAlignment:b="auto"}=t;a.useEffect(()=>{P.applyReactStyle(e.getElement(),d)},[d]),a.useImperativeHandle(i,()=>e,[]);const v=c.current.props;(e.getLngLat().lng!==f||e.getLngLat().lat!==m)&&e.setLngLat([f,m]),u&&!C.arePointsEqual(e.getOffset(),u)&&e.setOffset(u),e.isDraggable()!==p&&e.setDraggable(p),e.getRotation()!==E&&e.setRotation(E),e.getRotationAlignment()!==R&&e.setRotationAlignment(R),e.getPitchAlignment()!==b&&e.setPitchAlignment(b),e.getPopup()!==L&&e.setPopup(L);const h=k.compareClassNames(v.className,t.className);if(h)for(const g of h)e.toggleClassName(g);return c.current.props=t,D.createPortal(t.children,e.getElement())}));
2
2
  //# sourceMappingURL=index.cjs17.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const f=require("react-dom"),a=require("react"),m=require("./index.cjs241.js"),d=require("./index.cjs16.js"),g=require("./index.cjs242.js"),h=require("./index.cjs243.js");a.memo(a.forwardRef((e,l)=>{const{map:u,mapLib:r}=a.useContext(d.MapContext),i=a.useMemo(()=>document.createElement("div"),[]),s=a.useRef({props:e}),t=a.useMemo(()=>{const n={...e},o=new r.Popup(n);return o.setLngLat([e.longitude,e.latitude]),o.once("open",c=>{s.current.props.onOpen?.(c)}),o},[]);if(a.useEffect(()=>{const n=o=>{s.current.props.onClose?.(o)};return t.on("close",n),t.setDOMContent(i).addTo(u.getMap()),()=>{t.off("close",n),t.isOpen()&&t.remove()}},[]),a.useEffect(()=>{m.applyReactStyle(t.getElement(),e.style)},[e.style]),a.useImperativeHandle(l,()=>t,[]),t.isOpen()){const n=s.current.props;(t.getLngLat().lng!==e.longitude||t.getLngLat().lat!==e.latitude)&&t.setLngLat([e.longitude,e.latitude]),e.offset&&!g.deepEqual(n.offset,e.offset)&&t.setOffset(e.offset),(n.anchor!==e.anchor||n.maxWidth!==e.maxWidth)&&(t.options.anchor=e.anchor,t.setMaxWidth(e.maxWidth));const o=h.compareClassNames(n.className,e.className);if(o)for(const c of o)t.toggleClassName(c);s.current.props=e}return f.createPortal(e.children,i)}));
1
+ "use strict";const f=require("react-dom"),a=require("react"),m=require("./index.cjs243.js"),d=require("./index.cjs16.js"),g=require("./index.cjs244.js"),h=require("./index.cjs245.js");a.memo(a.forwardRef((e,l)=>{const{map:u,mapLib:r}=a.useContext(d.MapContext),i=a.useMemo(()=>document.createElement("div"),[]),s=a.useRef({props:e}),t=a.useMemo(()=>{const n={...e},o=new r.Popup(n);return o.setLngLat([e.longitude,e.latitude]),o.once("open",c=>{s.current.props.onOpen?.(c)}),o},[]);if(a.useEffect(()=>{const n=o=>{s.current.props.onClose?.(o)};return t.on("close",n),t.setDOMContent(i).addTo(u.getMap()),()=>{t.off("close",n),t.isOpen()&&t.remove()}},[]),a.useEffect(()=>{m.applyReactStyle(t.getElement(),e.style)},[e.style]),a.useImperativeHandle(l,()=>t,[]),t.isOpen()){const n=s.current.props;(t.getLngLat().lng!==e.longitude||t.getLngLat().lat!==e.latitude)&&t.setLngLat([e.longitude,e.latitude]),e.offset&&!g.deepEqual(n.offset,e.offset)&&t.setOffset(e.offset),(n.anchor!==e.anchor||n.maxWidth!==e.maxWidth)&&(t.options.anchor=e.anchor,t.setMaxWidth(e.maxWidth));const o=h.compareClassNames(n.className,e.className);if(o)for(const c of o)t.toggleClassName(c);s.current.props=e}return f.createPortal(e.children,i)}));
2
2
  //# sourceMappingURL=index.cjs18.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("react"),i=require("./index.cjs241.js"),r=require("./index.cjs30.js");function l(t){const n=r.useControl(({mapLib:o})=>new o.AttributionControl(t),{position:t.position});return e.useEffect(()=>{i.applyReactStyle(n._container,t.style)},[t.style]),null}e.memo(l);
1
+ "use strict";const e=require("react"),i=require("./index.cjs243.js"),r=require("./index.cjs30.js");function l(t){const n=r.useControl(({mapLib:o})=>new o.AttributionControl(t),{position:t.position});return e.useEffect(()=>{i.applyReactStyle(n._container,t.style)},[t.style]),null}e.memo(l);
2
2
  //# sourceMappingURL=index.cjs19.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const s=require("./index.cjs80.js"),r=require("./index.cjs245.js");var t=r.__require();const e=s.getDefaultExportFromCjs(t);module.exports=e;
1
+ "use strict";const s=require("./index.cjs86.js"),r=require("./index.cjs237.js");var t=r.__require();const e=s.getDefaultExportFromCjs(t);module.exports=e;
2
2
  //# sourceMappingURL=index.cjs197.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),l=require("./index.cjs241.js"),r=require("./index.cjs30.js");function c(e){const n=r.useControl(({mapLib:o})=>new o.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return t.useEffect(()=>{l.applyReactStyle(n._controlContainer,e.style)},[e.style]),null}const u=t.memo(c);exports.FullscreenControl=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),l=require("./index.cjs243.js"),r=require("./index.cjs30.js");function c(e){const n=r.useControl(({mapLib:o})=>new o.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return t.useEffect(()=>{l.applyReactStyle(n._controlContainer,e.style)},[e.style]),null}const u=t.memo(c);exports.FullscreenControl=u;
2
2
  //# sourceMappingURL=index.cjs20.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const n=require("react"),l=require("./index.cjs241.js"),i=require("./index.cjs30.js");function p(t,s){const r=n.useRef({props:t}),c=i.useControl(({mapLib:u})=>{const o=new u.GeolocateControl(t),a=o._setupUI;return o._setupUI=()=>{o._container.hasChildNodes()||a()},o.on("geolocate",e=>{r.current.props.onGeolocate?.(e)}),o.on("error",e=>{r.current.props.onError?.(e)}),o.on("outofmaxbounds",e=>{r.current.props.onOutOfMaxBounds?.(e)}),o.on("trackuserlocationstart",e=>{r.current.props.onTrackUserLocationStart?.(e)}),o.on("trackuserlocationend",e=>{r.current.props.onTrackUserLocationEnd?.(e)}),o},{position:t.position});return r.current.props=t,n.useImperativeHandle(s,()=>c,[]),n.useEffect(()=>{l.applyReactStyle(c._container,t.style)},[t.style]),null}n.memo(n.forwardRef(p));
1
+ "use strict";const n=require("react"),l=require("./index.cjs243.js"),i=require("./index.cjs30.js");function p(t,s){const r=n.useRef({props:t}),c=i.useControl(({mapLib:u})=>{const o=new u.GeolocateControl(t),a=o._setupUI;return o._setupUI=()=>{o._container.hasChildNodes()||a()},o.on("geolocate",e=>{r.current.props.onGeolocate?.(e)}),o.on("error",e=>{r.current.props.onError?.(e)}),o.on("outofmaxbounds",e=>{r.current.props.onOutOfMaxBounds?.(e)}),o.on("trackuserlocationstart",e=>{r.current.props.onTrackUserLocationStart?.(e)}),o.on("trackuserlocationend",e=>{r.current.props.onTrackUserLocationEnd?.(e)}),o},{position:t.position});return r.current.props=t,n.useImperativeHandle(s,()=>c,[]),n.useEffect(()=>{l.applyReactStyle(c._container,t.style)},[t.style]),null}n.memo(n.forwardRef(p));
2
2
  //# sourceMappingURL=index.cjs21.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("./index.cjs249.js"),t=require("./index.cjs214.js"),r=e(t);module.exports=r;
1
+ "use strict";const e=require("./index.cjs248.js"),t=require("./index.cjs214.js"),r=e(t);module.exports=r;
2
2
  //# sourceMappingURL=index.cjs212.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const t=require("./index.cjs248.js"),e=t("length");module.exports=e;
1
+ "use strict";const t=require("./index.cjs249.js"),e=t("length");module.exports=e;
2
2
  //# sourceMappingURL=index.cjs213.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const t=require("./index.cjs248.js"),e=t("byteLength");module.exports=e;
1
+ "use strict";const t=require("./index.cjs249.js"),e=t("byteLength");module.exports=e;
2
2
  //# sourceMappingURL=index.cjs214.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),i=require("./index.cjs241.js"),l=require("./index.cjs30.js");function r(t){const e=l.useControl(({mapLib:n})=>new n.NavigationControl(t),{position:t.position});return o.useEffect(()=>{i.applyReactStyle(e._container,t.style)},[t.style]),null}const a=o.memo(r);exports.NavigationControl=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),i=require("./index.cjs243.js"),l=require("./index.cjs30.js");function r(t){const e=l.useControl(({mapLib:n})=>new n.NavigationControl(t),{position:t.position});return o.useEffect(()=>{i.applyReactStyle(e._container,t.style)},[t.style]),null}const a=o.memo(r);exports.NavigationControl=a;
2
2
  //# sourceMappingURL=index.cjs22.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const n=require("react"),l=require("./index.cjs241.js"),a=require("./index.cjs30.js");function r(t){const e=a.useControl(({mapLib:u})=>new u.ScaleControl(t),{position:t.position}),i=n.useRef(t),c=i.current;i.current=t;const{style:o}=t;return t.maxWidth!==void 0&&t.maxWidth!==c.maxWidth&&(e.options.maxWidth=t.maxWidth),t.unit!==void 0&&t.unit!==c.unit&&e.setUnit(t.unit),n.useEffect(()=>{l.applyReactStyle(e._container,o)},[o]),null}n.memo(r);
1
+ "use strict";const n=require("react"),l=require("./index.cjs243.js"),a=require("./index.cjs30.js");function r(t){const e=a.useControl(({mapLib:u})=>new u.ScaleControl(t),{position:t.position}),i=n.useRef(t),c=i.current;i.current=t;const{style:o}=t;return t.maxWidth!==void 0&&t.maxWidth!==c.maxWidth&&(e.options.maxWidth=t.maxWidth),t.unit!==void 0&&t.unit!==c.unit&&e.setUnit(t.unit),n.useEffect(()=>{l.applyReactStyle(e._container,o)},[o]),null}n.memo(r);
2
2
  //# sourceMappingURL=index.cjs23.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("./index.cjs249.js"),r=require("./index.cjs213.js"),t=e(r);module.exports=t;
1
+ "use strict";const e=require("./index.cjs248.js"),r=require("./index.cjs213.js"),t=e(r);module.exports=t;
2
2
  //# sourceMappingURL=index.cjs232.js.map