@math.gl/geospatial 5.0.0-rc.2 → 5.0.1

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 (356) hide show
  1. package/README.md +6 -6
  2. package/dist/coordinates.cjs +2523 -0
  3. package/dist/coordinates.cjs.map +6 -0
  4. package/dist/coordinates.d.ts +4 -0
  5. package/dist/coordinates.d.ts.map +1 -1
  6. package/dist/coordinates.js +2 -0
  7. package/dist/coordinates.js.map +1 -1
  8. package/dist/entries/ellipsoid.cjs +1209 -0
  9. package/dist/entries/ellipsoid.cjs.map +6 -0
  10. package/dist/entries/ellipsoid.d.ts +3 -19
  11. package/dist/entries/ellipsoid.d.ts.map +1 -1
  12. package/dist/entries/ellipsoid.js +1 -9
  13. package/dist/entries/ellipsoid.js.map +1 -1
  14. package/dist/expressions.cjs +726 -0
  15. package/dist/expressions.cjs.map +6 -0
  16. package/dist/geodesics.cjs +3195 -0
  17. package/dist/geodesics.cjs.map +6 -0
  18. package/dist/geodesics.d.ts +18 -0
  19. package/dist/geodesics.d.ts.map +1 -0
  20. package/dist/geodesics.js +13 -0
  21. package/dist/geodesics.js.map +1 -0
  22. package/dist/geographic-atlas/sampling.d.ts +1 -1
  23. package/dist/geographic-atlas/sampling.d.ts.map +1 -1
  24. package/dist/geographic-atlas/sampling.js +1 -1
  25. package/dist/geographic-atlas/sampling.js.map +1 -1
  26. package/dist/geographic-cuts.cjs +4160 -0
  27. package/dist/geographic-cuts.cjs.map +6 -0
  28. package/dist/geographic-cuts.d.ts +2 -0
  29. package/dist/geographic-cuts.d.ts.map +1 -1
  30. package/dist/geographic-cuts.js +1 -0
  31. package/dist/geographic-cuts.js.map +1 -1
  32. package/dist/geographic-seams/subdivide-cut.d.ts +1 -1
  33. package/dist/geographic-seams/subdivide-cut.d.ts.map +1 -1
  34. package/dist/geographic-seams/subdivide-cut.js +1 -1
  35. package/dist/geographic-seams/subdivide-cut.js.map +1 -1
  36. package/dist/geographic-seams/types.shared.cjs +32 -0
  37. package/dist/geographic-seams/types.shared.cjs.map +6 -0
  38. package/dist/globe.cjs +4223 -0
  39. package/dist/globe.cjs.map +6 -0
  40. package/dist/index.d.ts +2 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +2 -0
  43. package/dist/index.js.map +1 -1
  44. package/dist/line-simplification.d.ts +7 -0
  45. package/dist/line-simplification.d.ts.map +1 -1
  46. package/dist/line-simplification.js +4 -13
  47. package/dist/line-simplification.js.map +1 -1
  48. package/dist/linear-referencing.d.ts +13 -1
  49. package/dist/linear-referencing.d.ts.map +1 -1
  50. package/dist/linear-referencing.js +29 -9
  51. package/dist/linear-referencing.js.map +1 -1
  52. package/dist/maps/map-transition.shared.cjs +364 -0
  53. package/dist/maps/map-transition.shared.cjs.map +6 -0
  54. package/dist/maps/myriahedral/unfold.d.ts +1 -1
  55. package/dist/maps/myriahedral/unfold.d.ts.map +1 -1
  56. package/dist/maps/myriahedral/unfold.js +1 -1
  57. package/dist/maps/myriahedral/unfold.js.map +1 -1
  58. package/dist/maps/presets.cjs +2 -2
  59. package/dist/maps/presets.cjs.map +2 -2
  60. package/dist/maps/transitions.cjs +3 -342
  61. package/dist/maps/transitions.cjs.map +3 -3
  62. package/dist/maps.cjs +15 -319
  63. package/dist/maps.cjs.map +3 -3
  64. package/dist/measure-referencing.d.ts +16 -0
  65. package/dist/measure-referencing.d.ts.map +1 -0
  66. package/dist/measure-referencing.js +143 -0
  67. package/dist/measure-referencing.js.map +1 -0
  68. package/dist/polygon-simplification.d.ts +6 -0
  69. package/dist/polygon-simplification.d.ts.map +1 -0
  70. package/dist/polygon-simplification.js +141 -0
  71. package/dist/polygon-simplification.js.map +1 -0
  72. package/dist/projection/experimental/core.cjs +63 -1317
  73. package/dist/projection/experimental/core.cjs.map +3 -3
  74. package/dist/projection/experimental/core.d.ts +1 -1
  75. package/dist/projection/experimental/core.d.ts.map +1 -1
  76. package/dist/projection/experimental/crs/projjson.cjs +26 -45
  77. package/dist/projection/experimental/crs/projjson.cjs.map +3 -3
  78. package/dist/projection/experimental/crs/types.shared.cjs +44 -0
  79. package/dist/projection/experimental/crs/types.shared.cjs.map +6 -0
  80. package/dist/projection/experimental/crs/wkt.cjs +36 -52
  81. package/dist/projection/experimental/crs/wkt.cjs.map +3 -3
  82. package/dist/projection/experimental/entries/projections/ob_tran.cjs +9 -23
  83. package/dist/projection/experimental/entries/projections/ob_tran.cjs.map +3 -3
  84. package/dist/projection/experimental/lazy-projections/aea.cjs +1 -1
  85. package/dist/projection/experimental/lazy-projections/aea.js +1 -1
  86. package/dist/projection/experimental/lazy-projections/aeqd.cjs +1 -1
  87. package/dist/projection/experimental/lazy-projections/aeqd.js +1 -1
  88. package/dist/projection/experimental/lazy-projections/bonne.cjs +1 -1
  89. package/dist/projection/experimental/lazy-projections/bonne.js +1 -1
  90. package/dist/projection/experimental/lazy-projections/cass.cjs +1 -1
  91. package/dist/projection/experimental/lazy-projections/cass.js +1 -1
  92. package/dist/projection/experimental/lazy-projections/cea.cjs +1 -1
  93. package/dist/projection/experimental/lazy-projections/cea.js +1 -1
  94. package/dist/projection/experimental/lazy-projections/eck6.cjs +1 -1
  95. package/dist/projection/experimental/lazy-projections/eck6.js +1 -1
  96. package/dist/projection/experimental/lazy-projections/eqc.cjs +1 -1
  97. package/dist/projection/experimental/lazy-projections/eqc.js +1 -1
  98. package/dist/projection/experimental/lazy-projections/eqdc.cjs +1 -1
  99. package/dist/projection/experimental/lazy-projections/eqdc.js +1 -1
  100. package/dist/projection/experimental/lazy-projections/eqearth.cjs +1 -1
  101. package/dist/projection/experimental/lazy-projections/eqearth.js +1 -1
  102. package/dist/projection/experimental/lazy-projections/equi.cjs +1 -1
  103. package/dist/projection/experimental/lazy-projections/equi.js +1 -1
  104. package/dist/projection/experimental/lazy-projections/etmerc.cjs +1 -1
  105. package/dist/projection/experimental/lazy-projections/etmerc.js +1 -1
  106. package/dist/projection/experimental/lazy-projections/geocent.cjs +1 -1
  107. package/dist/projection/experimental/lazy-projections/geocent.js +1 -1
  108. package/dist/projection/experimental/lazy-projections/geos.cjs +1 -1
  109. package/dist/projection/experimental/lazy-projections/geos.js +1 -1
  110. package/dist/projection/experimental/lazy-projections/gnom.cjs +1 -1
  111. package/dist/projection/experimental/lazy-projections/gnom.js +1 -1
  112. package/dist/projection/experimental/lazy-projections/gstmerc.cjs +1 -1
  113. package/dist/projection/experimental/lazy-projections/gstmerc.js +1 -1
  114. package/dist/projection/experimental/lazy-projections/index.cjs +60 -903
  115. package/dist/projection/experimental/lazy-projections/index.cjs.map +3 -3
  116. package/dist/projection/experimental/lazy-projections/krovak.cjs +1 -1
  117. package/dist/projection/experimental/lazy-projections/krovak.js +1 -1
  118. package/dist/projection/experimental/lazy-projections/laea.cjs +1 -1
  119. package/dist/projection/experimental/lazy-projections/laea.js +1 -1
  120. package/dist/projection/experimental/lazy-projections/lcc.cjs +1 -1
  121. package/dist/projection/experimental/lazy-projections/lcc.js +1 -1
  122. package/dist/projection/experimental/lazy-projections/merc.cjs +1 -1
  123. package/dist/projection/experimental/lazy-projections/merc.js +1 -1
  124. package/dist/projection/experimental/lazy-projections/mill.cjs +1 -1
  125. package/dist/projection/experimental/lazy-projections/mill.js +1 -1
  126. package/dist/projection/experimental/lazy-projections/moll.cjs +1 -1
  127. package/dist/projection/experimental/lazy-projections/moll.js +1 -1
  128. package/dist/projection/experimental/lazy-projections/nzmg.cjs +1 -1
  129. package/dist/projection/experimental/lazy-projections/nzmg.js +1 -1
  130. package/dist/projection/experimental/lazy-projections/ob_tran.cjs +1 -1
  131. package/dist/projection/experimental/lazy-projections/ob_tran.js +1 -1
  132. package/dist/projection/experimental/lazy-projections/omerc.cjs +1 -1
  133. package/dist/projection/experimental/lazy-projections/omerc.js +1 -1
  134. package/dist/projection/experimental/lazy-projections/ortho.cjs +1 -1
  135. package/dist/projection/experimental/lazy-projections/ortho.js +1 -1
  136. package/dist/projection/experimental/lazy-projections/poly.cjs +1 -1
  137. package/dist/projection/experimental/lazy-projections/poly.js +1 -1
  138. package/dist/projection/experimental/lazy-projections/qsc.cjs +1 -1
  139. package/dist/projection/experimental/lazy-projections/qsc.js +1 -1
  140. package/dist/projection/experimental/lazy-projections/robin.cjs +1 -1
  141. package/dist/projection/experimental/lazy-projections/robin.js +1 -1
  142. package/dist/projection/experimental/lazy-projections/sinu.cjs +1 -1
  143. package/dist/projection/experimental/lazy-projections/sinu.js +1 -1
  144. package/dist/projection/experimental/lazy-projections/somerc.cjs +1 -1
  145. package/dist/projection/experimental/lazy-projections/somerc.js +1 -1
  146. package/dist/projection/experimental/lazy-projections/stere.cjs +1 -1
  147. package/dist/projection/experimental/lazy-projections/stere.js +1 -1
  148. package/dist/projection/experimental/lazy-projections/sterea.cjs +1 -1
  149. package/dist/projection/experimental/lazy-projections/sterea.js +1 -1
  150. package/dist/projection/experimental/lazy-projections/tmerc.cjs +1 -1
  151. package/dist/projection/experimental/lazy-projections/tmerc.js +1 -1
  152. package/dist/projection/experimental/lazy-projections/tpers.cjs +1 -1
  153. package/dist/projection/experimental/lazy-projections/tpers.js +1 -1
  154. package/dist/projection/experimental/lazy-projections/utm.cjs +1 -1
  155. package/dist/projection/experimental/lazy-projections/utm.js +1 -1
  156. package/dist/projection/experimental/lazy-projections/vandg.cjs +1 -1
  157. package/dist/projection/experimental/lazy-projections/vandg.js +1 -1
  158. package/dist/projection/experimental/projection-engine.shared.cjs +1184 -0
  159. package/dist/projection/experimental/projection-engine.shared.cjs.map +6 -0
  160. package/dist/projection/experimental/typescript-projection.shared.cjs +1703 -0
  161. package/dist/projection/experimental/typescript-projection.shared.cjs.map +6 -0
  162. package/dist/projection/index.cjs +622 -1535
  163. package/dist/projection/index.cjs.map +3 -3
  164. package/dist/projection/pipeline.cjs +44 -58
  165. package/dist/projection/pipeline.cjs.map +3 -3
  166. package/dist/projection/transform-analysis.cjs +20 -936
  167. package/dist/projection/transform-analysis.cjs.map +3 -3
  168. package/dist/spatial-box-clipping.d.ts +9 -0
  169. package/dist/spatial-box-clipping.d.ts.map +1 -0
  170. package/dist/spatial-box-clipping.js +123 -0
  171. package/dist/spatial-box-clipping.js.map +1 -0
  172. package/dist/spatial-dwithin.d.ts +19 -0
  173. package/dist/spatial-dwithin.d.ts.map +1 -0
  174. package/dist/spatial-dwithin.js +107 -0
  175. package/dist/spatial-dwithin.js.map +1 -0
  176. package/dist/spatial-hulls.d.ts +6 -0
  177. package/dist/spatial-hulls.d.ts.map +1 -0
  178. package/dist/spatial-hulls.js +176 -0
  179. package/dist/spatial-hulls.js.map +1 -0
  180. package/dist/spatial-line-intersection-result.d.ts +4 -0
  181. package/dist/spatial-line-intersection-result.d.ts.map +1 -0
  182. package/dist/spatial-line-intersection-result.js +79 -0
  183. package/dist/spatial-line-intersection-result.js.map +1 -0
  184. package/dist/spatial-line-polygon-intersection.d.ts +4 -0
  185. package/dist/spatial-line-polygon-intersection.d.ts.map +1 -0
  186. package/dist/spatial-line-polygon-intersection.js +130 -0
  187. package/dist/spatial-line-polygon-intersection.js.map +1 -0
  188. package/dist/spatial-planar-intersects.d.ts +11 -0
  189. package/dist/spatial-planar-intersects.d.ts.map +1 -1
  190. package/dist/spatial-planar-intersects.js +20 -12
  191. package/dist/spatial-planar-intersects.js.map +1 -1
  192. package/dist/spatial-planar.d.ts +9 -0
  193. package/dist/spatial-planar.d.ts.map +1 -1
  194. package/dist/spatial-planar.js +13 -1
  195. package/dist/spatial-planar.js.map +1 -1
  196. package/dist/spatial-polygon-overlay.d.ts +5 -0
  197. package/dist/spatial-polygon-overlay.d.ts.map +1 -0
  198. package/dist/spatial-polygon-overlay.js +23 -0
  199. package/dist/spatial-polygon-overlay.js.map +1 -0
  200. package/dist/spatial-sql.d.ts +13 -2
  201. package/dist/spatial-sql.d.ts.map +1 -1
  202. package/dist/spatial-sql.js +30 -12
  203. package/dist/spatial-sql.js.map +1 -1
  204. package/dist/spatial-subdivision.d.ts +9 -0
  205. package/dist/spatial-subdivision.d.ts.map +1 -0
  206. package/dist/spatial-subdivision.js +61 -0
  207. package/dist/spatial-subdivision.js.map +1 -0
  208. package/dist/spatial-touches.d.ts +13 -0
  209. package/dist/spatial-touches.d.ts.map +1 -0
  210. package/dist/spatial-touches.js +192 -0
  211. package/dist/spatial-touches.js.map +1 -0
  212. package/dist/st-functions.cjs +2411 -112
  213. package/dist/st-functions.cjs.map +3 -3
  214. package/dist/st-functions.d.ts +67 -2
  215. package/dist/st-functions.d.ts.map +1 -1
  216. package/dist/st-functions.js +195 -12
  217. package/dist/st-functions.js.map +1 -1
  218. package/dist/st-geodesic-functions.d.ts +33 -0
  219. package/dist/st-geodesic-functions.d.ts.map +1 -0
  220. package/dist/st-geodesic-functions.js +84 -0
  221. package/dist/st-geodesic-functions.js.map +1 -0
  222. package/dist/st-hull-functions.cjs +386 -0
  223. package/dist/st-hull-functions.cjs.map +6 -0
  224. package/dist/st-hull-functions.d.ts +17 -0
  225. package/dist/st-hull-functions.d.ts.map +1 -0
  226. package/dist/st-hull-functions.js +14 -0
  227. package/dist/st-hull-functions.js.map +1 -0
  228. package/dist/st-overlay-functions.cjs +621 -0
  229. package/dist/st-overlay-functions.cjs.map +6 -0
  230. package/dist/st-overlay-functions.d.ts +36 -0
  231. package/dist/st-overlay-functions.d.ts.map +1 -0
  232. package/dist/st-overlay-functions.js +183 -0
  233. package/dist/st-overlay-functions.js.map +1 -0
  234. package/dist/st-viewport-functions.cjs +481 -0
  235. package/dist/st-viewport-functions.cjs.map +6 -0
  236. package/dist/st-viewport-functions.d.ts +13 -0
  237. package/dist/st-viewport-functions.d.ts.map +1 -0
  238. package/dist/st-viewport-functions.js +81 -0
  239. package/dist/st-viewport-functions.js.map +1 -0
  240. package/dist/subdivide-geodesic-polyline.d.ts +1 -1
  241. package/dist/subdivide-geodesic-polyline.d.ts.map +1 -1
  242. package/dist/subdivide-geodesic-polyline.js +1 -1
  243. package/dist/subdivide-geodesic-polyline.js.map +1 -1
  244. package/dist/subdivide-globe-mesh.d.ts +1 -1
  245. package/dist/subdivide-globe-mesh.d.ts.map +1 -1
  246. package/dist/subdivide-globe-mesh.js +1 -1
  247. package/dist/subdivide-globe-mesh.js.map +1 -1
  248. package/dist/subdivide-rhumb-polyline.d.ts +1 -1
  249. package/dist/subdivide-rhumb-polyline.d.ts.map +1 -1
  250. package/dist/subdivide-rhumb-polyline.js +1 -1
  251. package/dist/subdivide-rhumb-polyline.js.map +1 -1
  252. package/dist/tasks/index.cjs +808 -2993
  253. package/dist/tasks/index.cjs.map +3 -3
  254. package/dist/terrain/geometry.d.ts +1 -1
  255. package/dist/terrain/geometry.d.ts.map +1 -1
  256. package/dist/terrain/geometry.js +1 -1
  257. package/dist/terrain/geometry.js.map +1 -1
  258. package/dist/terrain/index.cjs +95 -22
  259. package/dist/terrain/index.cjs.map +3 -3
  260. package/dist/terrain/index.d.ts +1 -0
  261. package/dist/terrain/index.d.ts.map +1 -1
  262. package/dist/terrain/index.js +1 -0
  263. package/dist/terrain/index.js.map +1 -1
  264. package/dist/terrain/regional-watersheds.d.ts +44 -0
  265. package/dist/terrain/regional-watersheds.d.ts.map +1 -0
  266. package/dist/terrain/regional-watersheds.js +108 -0
  267. package/dist/terrain/regional-watersheds.js.map +1 -0
  268. package/dist/terrain/tile-cutout-update.d.ts.map +1 -1
  269. package/dist/terrain/tile-cutout-update.js +28 -22
  270. package/dist/terrain/tile-cutout-update.js.map +1 -1
  271. package/dist/tiles.cjs +354 -0
  272. package/dist/tiles.cjs.map +6 -0
  273. package/dist/turf-functions.cjs +16 -9
  274. package/dist/turf-functions.cjs.map +1 -1
  275. package/package.json +154 -117
  276. package/src/coordinates.ts +5 -0
  277. package/src/entries/ellipsoid.ts +7 -32
  278. package/src/geodesics.ts +40 -0
  279. package/src/geographic-atlas/sampling.ts +1 -1
  280. package/src/geographic-cuts.ts +21 -0
  281. package/src/geographic-seams/subdivide-cut.ts +1 -1
  282. package/src/index.ts +2 -0
  283. package/src/line-simplification.ts +4 -16
  284. package/src/linear-referencing.ts +44 -16
  285. package/src/maps/myriahedral/unfold.ts +1 -1
  286. package/src/measure-referencing.ts +165 -0
  287. package/src/polygon-simplification.ts +185 -0
  288. package/src/projection/experimental/core.ts +1 -1
  289. package/src/projection/experimental/lazy-projections/aea.ts +1 -1
  290. package/src/projection/experimental/lazy-projections/aeqd.ts +1 -1
  291. package/src/projection/experimental/lazy-projections/bonne.ts +1 -1
  292. package/src/projection/experimental/lazy-projections/cass.ts +1 -1
  293. package/src/projection/experimental/lazy-projections/cea.ts +1 -1
  294. package/src/projection/experimental/lazy-projections/eck6.ts +1 -1
  295. package/src/projection/experimental/lazy-projections/eqc.ts +1 -1
  296. package/src/projection/experimental/lazy-projections/eqdc.ts +1 -1
  297. package/src/projection/experimental/lazy-projections/eqearth.ts +1 -1
  298. package/src/projection/experimental/lazy-projections/equi.ts +1 -1
  299. package/src/projection/experimental/lazy-projections/etmerc.ts +1 -1
  300. package/src/projection/experimental/lazy-projections/geocent.ts +1 -1
  301. package/src/projection/experimental/lazy-projections/geos.ts +1 -1
  302. package/src/projection/experimental/lazy-projections/gnom.ts +1 -1
  303. package/src/projection/experimental/lazy-projections/gstmerc.ts +1 -1
  304. package/src/projection/experimental/lazy-projections/krovak.ts +1 -1
  305. package/src/projection/experimental/lazy-projections/laea.ts +1 -1
  306. package/src/projection/experimental/lazy-projections/lcc.ts +1 -1
  307. package/src/projection/experimental/lazy-projections/merc.ts +1 -1
  308. package/src/projection/experimental/lazy-projections/mill.ts +1 -1
  309. package/src/projection/experimental/lazy-projections/moll.ts +1 -1
  310. package/src/projection/experimental/lazy-projections/nzmg.ts +1 -1
  311. package/src/projection/experimental/lazy-projections/ob_tran.ts +1 -1
  312. package/src/projection/experimental/lazy-projections/omerc.ts +1 -1
  313. package/src/projection/experimental/lazy-projections/ortho.ts +1 -1
  314. package/src/projection/experimental/lazy-projections/poly.ts +1 -1
  315. package/src/projection/experimental/lazy-projections/qsc.ts +1 -1
  316. package/src/projection/experimental/lazy-projections/robin.ts +1 -1
  317. package/src/projection/experimental/lazy-projections/sinu.ts +1 -1
  318. package/src/projection/experimental/lazy-projections/somerc.ts +1 -1
  319. package/src/projection/experimental/lazy-projections/stere.ts +1 -1
  320. package/src/projection/experimental/lazy-projections/sterea.ts +1 -1
  321. package/src/projection/experimental/lazy-projections/tmerc.ts +1 -1
  322. package/src/projection/experimental/lazy-projections/tpers.ts +1 -1
  323. package/src/projection/experimental/lazy-projections/utm.ts +1 -1
  324. package/src/projection/experimental/lazy-projections/vandg.ts +1 -1
  325. package/src/spatial-box-clipping.ts +140 -0
  326. package/src/spatial-dwithin.ts +135 -0
  327. package/src/spatial-hulls.ts +203 -0
  328. package/src/spatial-line-intersection-result.ts +93 -0
  329. package/src/spatial-line-polygon-intersection.ts +147 -0
  330. package/src/spatial-planar-intersects.ts +21 -15
  331. package/src/spatial-planar.ts +20 -1
  332. package/src/spatial-polygon-overlay.ts +30 -0
  333. package/src/spatial-sql.ts +47 -12
  334. package/src/spatial-subdivision.ts +75 -0
  335. package/src/spatial-touches.ts +218 -0
  336. package/src/st-functions.ts +283 -15
  337. package/src/st-geodesic-functions.ts +121 -0
  338. package/src/st-hull-functions.ts +25 -0
  339. package/src/st-overlay-functions.ts +244 -0
  340. package/src/st-viewport-functions.ts +98 -0
  341. package/src/subdivide-geodesic-polyline.ts +2 -2
  342. package/src/subdivide-globe-mesh.ts +2 -2
  343. package/src/subdivide-rhumb-polyline.ts +2 -2
  344. package/src/terrain/geometry.ts +1 -1
  345. package/src/terrain/index.ts +7 -0
  346. package/src/terrain/regional-watersheds.ts +153 -0
  347. package/src/terrain/tile-cutout-update.ts +32 -26
  348. package/dist/index.cjs +0 -18674
  349. package/dist/index.cjs.map +0 -6
  350. package/dist/turf-expressions.cjs +0 -1997
  351. package/dist/turf-expressions.cjs.map +0 -6
  352. package/dist/turf-expressions.d.ts +0 -3
  353. package/dist/turf-expressions.d.ts.map +0 -1
  354. package/dist/turf-expressions.js +0 -7
  355. package/dist/turf-expressions.js.map +0 -1
  356. package/src/turf-expressions.ts +0 -7
@@ -0,0 +1,386 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // dist/st-hull-functions.js
30
+ var st_hull_functions_exports = {};
31
+ __export(st_hull_functions_exports, {
32
+ ST_CONCAVEHULL: () => ST_CONCAVEHULL,
33
+ ST_CONVEXHULL: () => ST_CONVEXHULL
34
+ });
35
+ module.exports = __toCommonJS(st_hull_functions_exports);
36
+ var import_apache_arrow2 = require("apache-arrow");
37
+ var import_arrow2 = require("@math.gl/core/arrow");
38
+
39
+ // dist/spatial-hulls.js
40
+ var import_cdt2d = __toESM(require("cdt2d"), 1);
41
+ var import_robust_predicates = require("robust-predicates");
42
+
43
+ // dist/spatial-planar.js
44
+ function isPresentPoint(position) {
45
+ return Number.isFinite(position[0]) && Number.isFinite(position[1]);
46
+ }
47
+ function visitPaths(geometry, visit) {
48
+ switch (geometry.type) {
49
+ case "Point":
50
+ if (isPresentPoint(geometry.coordinates))
51
+ visit([geometry.coordinates]);
52
+ break;
53
+ case "MultiPoint":
54
+ visit(geometry.coordinates.filter(isPresentPoint));
55
+ break;
56
+ case "LineString":
57
+ visit(geometry.coordinates);
58
+ break;
59
+ case "MultiLineString":
60
+ case "Polygon":
61
+ geometry.coordinates.forEach(visit);
62
+ break;
63
+ case "MultiPolygon":
64
+ geometry.coordinates.forEach((polygon) => polygon.forEach(visit));
65
+ break;
66
+ case "GeometryCollection":
67
+ geometry.geometries.forEach((child) => visitPaths(child, visit));
68
+ break;
69
+ }
70
+ }
71
+
72
+ // dist/spatial-hulls.js
73
+ function collectSites(geometry) {
74
+ const sites = [];
75
+ visitPaths(geometry, (path) => {
76
+ for (const [x, y] of path) {
77
+ if (Number.isFinite(x) && Number.isFinite(y))
78
+ sites.push([x, y]);
79
+ }
80
+ });
81
+ sites.sort((a, b) => a[0] - b[0] || a[1] - b[1]);
82
+ return sites.filter((p, i) => !i || p[0] !== sites[i - 1][0] || p[1] !== sites[i - 1][1]);
83
+ }
84
+ function buildChain(sites) {
85
+ const chain = [];
86
+ for (const point of sites) {
87
+ while (chain.length > 1) {
88
+ const a = chain[chain.length - 2];
89
+ const b = chain[chain.length - 1];
90
+ if ((0, import_robust_predicates.orient2d)(...a, ...b, ...point) < 0)
91
+ break;
92
+ chain.pop();
93
+ }
94
+ chain.push(point);
95
+ }
96
+ return chain;
97
+ }
98
+ function hullFromSites(sites) {
99
+ if (!sites.length)
100
+ return { type: "GeometryCollection", geometries: [] };
101
+ if (sites.length === 1)
102
+ return { type: "Point", coordinates: sites[0] };
103
+ const lower = buildChain(sites);
104
+ const upper = buildChain([...sites].reverse());
105
+ const ring = [...lower.slice(0, -1), ...upper.slice(0, -1)];
106
+ return ring.length === 2 ? { type: "LineString", coordinates: ring } : { type: "Polygon", coordinates: [[...ring, ring[0]]] };
107
+ }
108
+ function convexHull(geometry) {
109
+ return hullFromSites(collectSites(geometry));
110
+ }
111
+ function pushCandidate(heap, candidate) {
112
+ let index = heap.length;
113
+ heap.push(candidate);
114
+ while (index > 0) {
115
+ const parent = index - 1 >>> 1;
116
+ if (heap[parent].edge.length >= candidate.edge.length)
117
+ break;
118
+ heap[index] = heap[parent];
119
+ index = parent;
120
+ }
121
+ heap[index] = candidate;
122
+ }
123
+ function popCandidate(heap) {
124
+ const first = heap[0];
125
+ const last = heap.pop();
126
+ if (!heap.length)
127
+ return first;
128
+ let index = 0;
129
+ while (index * 2 + 1 < heap.length) {
130
+ const left = index * 2 + 1;
131
+ const right = left + 1;
132
+ const child = right < heap.length && heap[right].edge.length > heap[left].edge.length ? right : left;
133
+ if (heap[child].edge.length <= last.edge.length)
134
+ break;
135
+ heap[index] = heap[child];
136
+ index = child;
137
+ }
138
+ heap[index] = last;
139
+ return first;
140
+ }
141
+ function triangulateSites(sites) {
142
+ const triangles = [];
143
+ const edgeOwners = /* @__PURE__ */ new Map();
144
+ let minimum = Infinity;
145
+ let maximum = 0;
146
+ for (const cell of (0, import_cdt2d.default)(sites, [])) {
147
+ const [a, b, c] = cell;
148
+ const order = (0, import_robust_predicates.orient2d)(...sites[a], ...sites[b], ...sites[c]) < 0 ? [a, b, c] : [a, c, b];
149
+ const triangle = { edges: [], removed: false };
150
+ for (let i = 0; i < 3; i++) {
151
+ const start = order[i];
152
+ const end = order[(i + 1) % 3];
153
+ const p = sites[start];
154
+ const q = sites[end];
155
+ const length = Math.hypot(p[0] - q[0], p[1] - q[1]);
156
+ const edge = { start, end, length };
157
+ const key = start < end ? start + ":" + end : end + ":" + start;
158
+ const owner = edgeOwners.get(key);
159
+ if (owner) {
160
+ owner.edge.neighbor = triangle;
161
+ edge.neighbor = owner.triangle;
162
+ } else {
163
+ edgeOwners.set(key, { edge, triangle });
164
+ minimum = Math.min(minimum, length);
165
+ maximum = Math.max(maximum, length);
166
+ }
167
+ triangle.edges.push(edge);
168
+ }
169
+ triangles.push(triangle);
170
+ }
171
+ return { triangles, minimum, maximum };
172
+ }
173
+ function exteriorEdges(triangle) {
174
+ return triangle.edges.filter((edge) => !edge.neighbor || edge.neighbor.removed);
175
+ }
176
+ function concaveHull(geometry, ratio) {
177
+ if (!(ratio >= 0 && ratio <= 1))
178
+ throw new Error("ST_ConcaveHull ratio must be between 0 and 1");
179
+ const sites = collectSites(geometry);
180
+ const convex = hullFromSites(sites);
181
+ if (ratio === 1 || convex.type !== "Polygon")
182
+ return convex;
183
+ const { triangles, minimum, maximum } = triangulateSites(sites);
184
+ const limit = (1 - ratio) * minimum + ratio * maximum;
185
+ const boundary = /* @__PURE__ */ new Map();
186
+ const heap = [];
187
+ for (const triangle of triangles) {
188
+ for (const edge of exteriorEdges(triangle)) {
189
+ boundary.set(edge.start, edge.end);
190
+ if (edge.length > limit)
191
+ pushCandidate(heap, { triangle, edge });
192
+ }
193
+ }
194
+ while (heap.length) {
195
+ const { triangle, edge } = popCandidate(heap);
196
+ if (triangle.removed || exteriorEdges(triangle).length !== 1)
197
+ continue;
198
+ const first = triangle.edges.find((side) => side.start === edge.end);
199
+ const tip = first.end;
200
+ if (boundary.has(tip))
201
+ continue;
202
+ triangle.removed = true;
203
+ boundary.set(edge.start, tip);
204
+ boundary.set(tip, edge.end);
205
+ for (const side of triangle.edges) {
206
+ const neighbor = side.neighbor;
207
+ if (!neighbor || neighbor.removed || side.length <= limit)
208
+ continue;
209
+ const reverse = neighbor.edges.find((candidate) => candidate.neighbor === triangle);
210
+ pushCandidate(heap, { triangle: neighbor, edge: reverse });
211
+ }
212
+ }
213
+ const start = boundary.keys().next().value;
214
+ if (start === void 0)
215
+ return convex;
216
+ const coordinates = [sites[start]];
217
+ let site = boundary.get(start);
218
+ while (site !== start && coordinates.length < boundary.size) {
219
+ coordinates.push(sites[site]);
220
+ site = boundary.get(site);
221
+ }
222
+ if (site !== start || coordinates.length !== boundary.size) {
223
+ throw new Error("ST_ConcaveHull could not construct a single outer ring");
224
+ }
225
+ coordinates.push(sites[start]);
226
+ return { type: "Polygon", coordinates: [coordinates] };
227
+ }
228
+
229
+ // dist/spatial-sql.js
230
+ var import_apache_arrow = require("apache-arrow");
231
+ var import_arrow = require("@math.gl/core/arrow");
232
+ var EXTENSION_NAME = "ARROW:extension:name";
233
+ var EXTENSION_METADATA = "ARROW:extension:metadata";
234
+ var geometryTypes = [
235
+ "Point",
236
+ "MultiPoint",
237
+ "LineString",
238
+ "MultiLineString",
239
+ "Polygon",
240
+ "MultiPolygon"
241
+ ];
242
+ function readGeometryValue(vector, field, active, value, captureMembers = false) {
243
+ if (import_apache_arrow.DataType.isBinary(field.type) || import_apache_arrow.DataType.isLargeBinary(field.type)) {
244
+ return (row) => {
245
+ const { geometry, dimension, srid, members } = (0, import_arrow.parseWKB)(vector.get(row), {
246
+ captureMembers
247
+ });
248
+ if (srid)
249
+ throw new Error("Use GeoArrow field metadata for CRS information instead of EWKB SRIDs");
250
+ return value(geometry.type === "Point" && geometry.coordinates.every(Number.isNaN) ? { type: "Point", coordinates: [] } : geometry, dimension, members);
251
+ };
252
+ }
253
+ const column = readActiveGeoArrowColumn(vector, field, active);
254
+ const geometries = (0, import_arrow.materializeGeoArrowRows)(column);
255
+ return (row) => value(geometries[row], column.dimension);
256
+ }
257
+ function readActiveGeoArrowColumn(vector, field, active) {
258
+ const column = (0, import_arrow.makeGeoArrowColumnFromArrowVector)(vector, { field });
259
+ let offset = 0;
260
+ const chunks = column.chunks.map((chunk) => {
261
+ const start = offset;
262
+ offset += chunk.length;
263
+ let needsMask = false;
264
+ for (let row = 0; row < chunk.length; row++) {
265
+ if (!active[start + row] && (0, import_arrow.isGeoArrowValueValid)(chunk.validity, row)) {
266
+ needsMask = true;
267
+ break;
268
+ }
269
+ }
270
+ if (!needsMask)
271
+ return chunk;
272
+ const values = new Uint8Array(Math.ceil(chunk.length / 8));
273
+ for (let row = 0; row < chunk.length; row++) {
274
+ if (active[start + row] && (0, import_arrow.isGeoArrowValueValid)(chunk.validity, row)) {
275
+ values[row >> 3] |= 1 << (row & 7);
276
+ }
277
+ }
278
+ return { ...chunk, validity: { values } };
279
+ });
280
+ return { ...column, chunks };
281
+ }
282
+ function planarGeometry(geometry, dimension) {
283
+ if (dimension !== "xy")
284
+ throw new Error("Spatial SQL functions require 2D geometry");
285
+ return geometry;
286
+ }
287
+ function spatialFunction(name, signatures, output, evaluate, numericArguments = 0, allDimensions = false, skipNullGeometries = false, validateCRS) {
288
+ const type = "encoding" in output ? output.type : output;
289
+ return {
290
+ kind: "scalar",
291
+ name,
292
+ prototypes: [],
293
+ /** Binds the allowed geometry types and result metadata to a call. */
294
+ resolvePrototype(fields) {
295
+ var _a;
296
+ if (fields.length !== signatures.length + numericArguments)
297
+ return void 0;
298
+ const geometryFields = fields.slice(0, signatures.length);
299
+ const numberFields = fields.slice(signatures.length).map((field) => {
300
+ if (field && !import_apache_arrow.DataType.isInt(field.type) && !import_apache_arrow.DataType.isFloat(field.type))
301
+ throw new Error(`${name} requires numeric arguments`);
302
+ return field ?? new import_apache_arrow.Field("number", new import_apache_arrow.Float64(), true);
303
+ });
304
+ const extensions = geometryFields.map((field, index) => {
305
+ if (!field)
306
+ return void 0;
307
+ const extension = (0, import_arrow.getGeoArrowFieldInfo)(field);
308
+ const encoding = extension == null ? void 0 : extension.encoding;
309
+ const kinds = signatures[index];
310
+ if (encoding === "geoarrow.wkb" && (import_apache_arrow.DataType.isBinary(field.type) || import_apache_arrow.DataType.isLargeBinary(field.type))) {
311
+ } else if (encoding === "geoarrow.geometry" && extension.dimension === "xy") {
312
+ } else if (kinds.some((kind) => encoding === "geoarrow." + kind.toLowerCase())) {
313
+ if (!allDimensions && (extension == null ? void 0 : extension.dimension) !== "xy")
314
+ throw new Error(`${name} requires 2D geometry`);
315
+ } else {
316
+ throw new Error(`${name} argument ${index + 1} requires GeoArrow ${kinds.join(" or ")}`);
317
+ }
318
+ validateCRS == null ? void 0 : validateCRS(extension == null ? void 0 : extension.metadata["crs"], name);
319
+ if (!validateCRS && name.startsWith("ST_") && name !== "ST_SRID" && name !== "ST_SetSRID" && (extension == null ? void 0 : extension.metadata["edges"]) === "spherical")
320
+ throw new Error(`${name} requires planar geometry`);
321
+ return extension;
322
+ });
323
+ const crsValues = extensions.map((extension) => extension == null ? void 0 : extension.metadata["crs"]).filter((crs) => crs !== void 0 && crs !== null);
324
+ if (!validateCRS && name.startsWith("ST_") && crsValues.some((crs) => JSON.stringify(crs) !== JSON.stringify(crsValues[0]))) {
325
+ throw new Error(`${name} requires arguments in the same CRS`);
326
+ }
327
+ const metadata = /* @__PURE__ */ new Map();
328
+ if ("encoding" in output || import_apache_arrow.DataType.isBinary(type)) {
329
+ metadata.set(EXTENSION_NAME, "encoding" in output ? output.encoding : "geoarrow.wkb");
330
+ const inputMetadata = (_a = extensions[0]) == null ? void 0 : _a.metadata;
331
+ const crs = inputMetadata == null ? void 0 : inputMetadata["crs"];
332
+ const crsType = crs === void 0 ? void 0 : inputMetadata == null ? void 0 : inputMetadata["crs_type"];
333
+ const edges = inputMetadata == null ? void 0 : inputMetadata["edges"];
334
+ if (crs !== void 0 || edges !== void 0) {
335
+ metadata.set(EXTENSION_METADATA, JSON.stringify({ crs, crs_type: crsType, edges }));
336
+ }
337
+ }
338
+ const arguments_ = [
339
+ ...geometryFields.map((field) => field ?? new import_apache_arrow.Field("geometry", new import_apache_arrow.Binary(), true)),
340
+ ...numberFields
341
+ ];
342
+ return {
343
+ arguments: arguments_,
344
+ nullHandling: skipNullGeometries ? "call" : "propagate",
345
+ result: new import_apache_arrow.Field(name, type, true, metadata),
346
+ /** Evaluates active rows and retains their positions in the output batch. */
347
+ evaluate(vectors, { activeRows, length: rowCount }) {
348
+ const numbers = vectors.slice(signatures.length);
349
+ const readers = vectors.slice(0, signatures.length).map((vector, index) => readGeometryValue(vector, arguments_[index], activeRows, allDimensions ? (g, dimension, members) => ({ ...g, dimension, members }) : planarGeometry, name === "ST_GeometryN"));
350
+ const values = new Array(rowCount).fill(null);
351
+ for (let row = 0; row < rowCount; row++) {
352
+ if (!activeRows[row])
353
+ continue;
354
+ const geometries = [];
355
+ for (let index = 0; index < readers.length; index++) {
356
+ if (skipNullGeometries && !vectors[index].isValid(row))
357
+ continue;
358
+ const geometry = readers[index](row);
359
+ if (!signatures[index].includes(geometry.type))
360
+ throw new Error(`${name} argument ${index + 1} does not support ${geometry.type} at row ${row}`);
361
+ geometries.push(geometry);
362
+ }
363
+ values[row] = evaluate(geometries, ...numbers.map((vector) => Number(vector.get(row))));
364
+ }
365
+ return "encoding" in output ? output.build(values) : (0, import_apache_arrow.vectorFromArray)(values, output);
366
+ }
367
+ };
368
+ }
369
+ };
370
+ }
371
+
372
+ // dist/st-hull-functions.js
373
+ var ST_CONVEXHULL = /* @__PURE__ */ spatialFunction(
374
+ "ST_ConvexHull",
375
+ [[...geometryTypes, "GeometryCollection"]],
376
+ /* @__PURE__ */ new import_apache_arrow2.Binary(),
377
+ ([geometry]) => (0, import_arrow2.writeWKB)(convexHull(geometry), "xy")
378
+ );
379
+ var ST_CONCAVEHULL = /* @__PURE__ */ spatialFunction(
380
+ "ST_ConcaveHull",
381
+ [["Point", "MultiPoint"]],
382
+ /* @__PURE__ */ new import_apache_arrow2.Binary(),
383
+ ([geometry], ratio) => (0, import_arrow2.writeWKB)(concaveHull(geometry, ratio), "xy"),
384
+ 1
385
+ );
386
+ //# sourceMappingURL=st-hull-functions.cjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/st-hull-functions.ts", "../src/spatial-hulls.ts", "../src/spatial-planar.ts", "../src/spatial-sql.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAIA,IAAAA,uBAAqB;AACrB,IAAAC,gBAAuB;;;ACAvB,mBAAwB;AACxB,+BAAuB;;;AC4CvB,SAAS,eAAe,UAAkB;AACxC,SAA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AAG;AAAG;AACtB,kBAAM,aAAkC,CAAA;AACxC,qBAAS,QAAQ,GAAG,QAAQ,QAAQ,QAAQ,SAAS;AACnD,kBAAI,sBAAsB,CAAC,QAAQ,KAAK,EAAG,QAAQ,GAAG;AAAG;AACzD,oBAAM,WAAW,QAAQ,KAAK,EAAG,GAAG;AACpC,kBAAI,CAAC,WAAW,KAAK,EAAG,SAAS,SAAS,IAAI;AAC5C,sBAAM,IAAI,MACR,GAAG,IAAI,aAAa,QAAQ,CAAC,qBAAqB,SAAS,IAAI,WAAW,GAAG,EAAE;AAEnF,yBAAW,KAAK,QAAQ;YAC1B;AACA,mBAAO,GAAG,IAAI,SAAS,YAAY,GAAG,QAAQ,IAAI,YAAU,OAAO,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC;UACtF;AACA,iBAAO,cAAc,SACjB,OAAO,MAAM,MAAsC,QACnD,qCAAgB,QAA0B,MAAM;QACtD;;IAEJ;;AAEJ;;;AH9QO,IAAM,gBAAgC;EAC3C;EACA,CAAC,CAAC,GAAG,eAAe,oBAAoB,CAAC;EACzB,oBAAI,4BAAM;EAC1B,CAAC,CAAC,QAAQ,UAAM,wBAAS,WAAW,QAAS,GAAG,IAAI;AAAC;AAIhD,IAAM,iBAAiC;EAC5C;EACA,CAAC,CAAC,SAAS,YAAY,CAAC;EACR,oBAAI,4BAAM;EAC1B,CAAC,CAAC,QAAQ,GAAG,cAAU,wBAAS,YAAY,UAAW,KAAM,GAAG,IAAI;EACpE;AAAC;",
5
+ "names": ["import_apache_arrow", "import_arrow", "triangulate"]
6
+ }
@@ -0,0 +1,17 @@
1
+ /** Returns the smallest convex footprint enclosing the input vertices. */
2
+ export declare const ST_CONVEXHULL: Readonly<{
3
+ name: string;
4
+ prototypes: readonly import("@math.gl/sql/arrow").ArrowTableFunctionPrototype[];
5
+ resolvePrototype?(fields: readonly (import("apache-arrow").Field | undefined)[], numericLiterals?: readonly (number | undefined)[]): import("@math.gl/sql/arrow").ArrowTableFunctionPrototype | undefined;
6
+ }> & {
7
+ readonly kind: "scalar";
8
+ };
9
+ /** Returns a hole-free concave footprint around a planar point cloud. */
10
+ export declare const ST_CONCAVEHULL: Readonly<{
11
+ name: string;
12
+ prototypes: readonly import("@math.gl/sql/arrow").ArrowTableFunctionPrototype[];
13
+ resolvePrototype?(fields: readonly (import("apache-arrow").Field | undefined)[], numericLiterals?: readonly (number | undefined)[]): import("@math.gl/sql/arrow").ArrowTableFunctionPrototype | undefined;
14
+ }> & {
15
+ readonly kind: "scalar";
16
+ };
17
+ //# sourceMappingURL=st-hull-functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"st-hull-functions.d.ts","sourceRoot":"","sources":["../src/st-hull-functions.ts"],"names":[],"mappings":"AASA,0EAA0E;AAC1E,eAAO,MAAM,aAAa;;;;;;CAKzB,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,cAAc;;;;;;CAM1B,CAAC"}
@@ -0,0 +1,14 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ import { Binary } from 'apache-arrow';
5
+ import { writeWKB } from '@math.gl/core/arrow';
6
+ import { concaveHull, convexHull } from "./spatial-hulls.js";
7
+ import { geometryTypes, spatialFunction } from "./spatial-sql.js";
8
+ /** Returns the smallest convex footprint enclosing the input vertices. */
9
+ export const ST_CONVEXHULL = /* @__PURE__ */ spatialFunction('ST_ConvexHull', [[...geometryTypes, 'GeometryCollection']],
10
+ /* @__PURE__ */ new Binary(), ([geometry]) => writeWKB(convexHull(geometry), 'xy'));
11
+ /** Returns a hole-free concave footprint around a planar point cloud. */
12
+ export const ST_CONCAVEHULL = /* @__PURE__ */ spatialFunction('ST_ConcaveHull', [['Point', 'MultiPoint']],
13
+ /* @__PURE__ */ new Binary(), ([geometry], ratio) => writeWKB(concaveHull(geometry, ratio), 'xy'), 1);
14
+ //# sourceMappingURL=st-hull-functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"st-hull-functions.js","sourceRoot":"","sources":["../src/st-hull-functions.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,2BAAwB;AACxD,OAAO,EAAC,aAAa,EAAE,eAAe,EAAC,yBAAsB;AAE7D,0EAA0E;AAC1E,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC,eAAe,CAC1D,eAAe,EACf,CAAC,CAAC,GAAG,aAAa,EAAE,oBAAoB,CAAC,CAAC;AAC1C,eAAe,CAAC,IAAI,MAAM,EAAE,EAC5B,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAS,CAAC,EAAE,IAAI,CAAC,CACtD,CAAC;AAEF,yEAAyE;AACzE,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC,eAAe,CAC3D,gBAAgB,EAChB,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACzB,eAAe,CAAC,IAAI,MAAM,EAAE,EAC5B,CAAC,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAS,EAAE,KAAM,CAAC,EAAE,IAAI,CAAC,EACrE,CAAC,CACF,CAAC"}