@aguacerowx/react-native 0.0.7 → 0.0.9

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 (274) hide show
  1. package/android/build/.transforms/78b892a9dae44f36e51ff0649e9c6e36/transformed/classes/classes_dex/classes.dex +0 -0
  2. package/android/build/.transforms/f4de14556a82e99f0d27ddcab762b219/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.dex +0 -0
  3. package/android/build/.transforms/f4de14556a82e99f0d27ddcab762b219/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayer.dex +0 -0
  4. package/android/build/.transforms/f4de14556a82e99f0d27ddcab762b219/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayerView.dex +0 -0
  5. package/android/build/.transforms/f4de14556a82e99f0d27ddcab762b219/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/InspectorModule.dex +0 -0
  6. package/android/build/.transforms/f4de14556a82e99f0d27ddcab762b219/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/WeatherFrameProcessorModule.dex +0 -0
  7. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  8. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  9. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  10. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  11. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  12. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  13. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  14. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  15. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  16. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  17. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  18. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  19. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
  20. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/InspectorModule.class.uniqueId0 +0 -0
  21. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  22. package/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +126 -122
  23. package/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +3 -1
  24. package/android/src/main/java/com/aguacerowx/reactnative/InspectorModule.java +13 -5
  25. package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +4 -18
  26. package/ios/AguaceroPackage.m +19 -0
  27. package/ios/FragmentUniforms.swift +14 -0
  28. package/ios/GridRenderLayer.swift +959 -59
  29. package/ios/GridRenderLayerBridge.swift +30 -0
  30. package/ios/GridRenderLayerManager.mm +104 -98
  31. package/ios/GridRenderLayerView.h +23 -0
  32. package/ios/GridRenderLayerView.m +199 -0
  33. package/ios/InspectorDataCache.swift +66 -0
  34. package/ios/InspectorModule.m +10 -0
  35. package/ios/InspectorModule.swift +64 -0
  36. package/ios/Shaders.metal +131 -0
  37. package/ios/WeatherFrameProcessorModule.m +16 -0
  38. package/ios/WeatherFrameProcessorModule.swift +104 -0
  39. package/ios/aguacerowx-react-native.podspec +21 -14
  40. package/lib/commonjs/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  41. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  42. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  43. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  44. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  45. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  46. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  47. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  48. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  49. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  50. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  51. package/lib/commonjs/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  52. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
  53. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/InspectorModule.class.uniqueId0 +0 -0
  54. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  55. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +126 -122
  56. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +3 -1
  57. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/InspectorModule.java +13 -5
  58. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +4 -18
  59. package/lib/commonjs/ios/AguaceroPackage.m +19 -0
  60. package/lib/commonjs/ios/FragmentUniforms.swift +14 -0
  61. package/lib/commonjs/ios/GridRenderLayer.swift +962 -0
  62. package/lib/commonjs/ios/GridRenderLayerBridge.swift +30 -0
  63. package/lib/commonjs/ios/GridRenderLayerManager.mm +146 -0
  64. package/lib/commonjs/ios/GridRenderLayerView.h +23 -0
  65. package/lib/commonjs/ios/GridRenderLayerView.m +199 -0
  66. package/lib/commonjs/ios/InspectorDataCache.swift +66 -0
  67. package/lib/commonjs/ios/InspectorModule.m +10 -0
  68. package/lib/commonjs/ios/InspectorModule.swift +64 -0
  69. package/lib/commonjs/ios/Shaders.metal +131 -0
  70. package/lib/commonjs/ios/WeatherFrameProcessorModule.m +16 -0
  71. package/lib/commonjs/ios/WeatherFrameProcessorModule.swift +104 -0
  72. package/lib/commonjs/ios/aguacerowx-react-native.podspec +36 -0
  73. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +1003 -0
  74. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +1 -0
  75. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +381 -0
  76. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +1 -0
  77. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +1229 -0
  78. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +1 -0
  79. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +4023 -0
  80. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +1 -0
  81. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js +38 -0
  82. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +1 -0
  83. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +30 -0
  84. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +1 -0
  85. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +27 -0
  86. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +1 -0
  87. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js +47 -0
  88. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +1 -0
  89. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +301 -0
  90. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +1 -0
  91. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +126 -0
  92. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +1 -0
  93. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/package.json +48 -0
  94. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +1029 -0
  95. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +1 -0
  96. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +381 -0
  97. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +1 -0
  98. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +1229 -0
  99. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +1 -0
  100. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +4023 -0
  101. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +1 -0
  102. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js +38 -0
  103. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +1 -0
  104. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +30 -0
  105. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +1 -0
  106. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +27 -0
  107. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +1 -0
  108. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js +41 -0
  109. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +1 -0
  110. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +301 -0
  111. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +1 -0
  112. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +126 -0
  113. package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +1 -0
  114. package/lib/commonjs/package.json +9 -17
  115. package/lib/commonjs/src/GridRenderLayer.js +32 -7
  116. package/lib/commonjs/src/GridRenderLayer.js.map +1 -1
  117. package/lib/commonjs/src/MapManager.js +1 -4
  118. package/lib/commonjs/src/MapManager.js.map +1 -1
  119. package/lib/commonjs/src/WeatherLayerManager.js +236 -210
  120. package/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
  121. package/lib/module/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  122. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  123. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  124. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  125. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  126. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  127. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  128. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  129. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  130. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  131. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  132. package/lib/module/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  133. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
  134. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/InspectorModule.class.uniqueId0 +0 -0
  135. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  136. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +126 -122
  137. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +3 -1
  138. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/InspectorModule.java +13 -5
  139. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +4 -18
  140. package/lib/module/ios/AguaceroPackage.m +19 -0
  141. package/lib/module/ios/FragmentUniforms.swift +14 -0
  142. package/lib/module/ios/GridRenderLayer.swift +962 -0
  143. package/lib/module/ios/GridRenderLayerBridge.swift +30 -0
  144. package/lib/module/ios/GridRenderLayerManager.mm +146 -0
  145. package/lib/module/ios/GridRenderLayerView.h +23 -0
  146. package/lib/module/ios/GridRenderLayerView.m +199 -0
  147. package/lib/module/ios/InspectorDataCache.swift +66 -0
  148. package/lib/module/ios/InspectorModule.m +10 -0
  149. package/lib/module/ios/InspectorModule.swift +64 -0
  150. package/lib/module/ios/Shaders.metal +131 -0
  151. package/lib/module/ios/WeatherFrameProcessorModule.m +16 -0
  152. package/lib/module/ios/WeatherFrameProcessorModule.swift +104 -0
  153. package/lib/module/ios/aguacerowx-react-native.podspec +36 -0
  154. package/lib/module/lib/commonjs/ios/AguaceroPackage.m +19 -0
  155. package/lib/module/lib/commonjs/ios/FragmentUniforms.swift +14 -0
  156. package/lib/module/lib/commonjs/ios/GridRenderLayer.swift +962 -0
  157. package/lib/module/lib/commonjs/ios/GridRenderLayerBridge.swift +30 -0
  158. package/lib/module/lib/commonjs/ios/GridRenderLayerManager.mm +146 -0
  159. package/lib/module/lib/commonjs/ios/GridRenderLayerView.h +23 -0
  160. package/lib/module/lib/commonjs/ios/GridRenderLayerView.m +199 -0
  161. package/lib/module/lib/commonjs/ios/InspectorDataCache.swift +66 -0
  162. package/lib/module/lib/commonjs/ios/InspectorModule.m +10 -0
  163. package/lib/module/lib/commonjs/ios/InspectorModule.swift +64 -0
  164. package/lib/module/lib/commonjs/ios/Shaders.metal +131 -0
  165. package/lib/module/lib/commonjs/ios/WeatherFrameProcessorModule.m +16 -0
  166. package/lib/module/lib/commonjs/ios/WeatherFrameProcessorModule.swift +104 -0
  167. package/lib/module/lib/commonjs/ios/aguacerowx-react-native.podspec +36 -0
  168. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +1003 -0
  169. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +1 -0
  170. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +381 -0
  171. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +1 -0
  172. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +1229 -0
  173. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +1 -0
  174. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +4023 -0
  175. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +1 -0
  176. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js +38 -0
  177. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +1 -0
  178. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +30 -0
  179. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +1 -0
  180. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +27 -0
  181. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +1 -0
  182. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js +47 -0
  183. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +1 -0
  184. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +301 -0
  185. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +1 -0
  186. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +126 -0
  187. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +1 -0
  188. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/package.json +48 -0
  189. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +1033 -0
  190. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +1 -0
  191. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +381 -0
  192. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +1 -0
  193. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +1229 -0
  194. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +1 -0
  195. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +4023 -0
  196. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +1 -0
  197. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js +38 -0
  198. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +1 -0
  199. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +30 -0
  200. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +1 -0
  201. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +27 -0
  202. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +1 -0
  203. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js +41 -0
  204. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +1 -0
  205. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +301 -0
  206. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +1 -0
  207. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +126 -0
  208. package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +1 -0
  209. package/lib/module/lib/commonjs/package.json +9 -17
  210. package/lib/module/lib/commonjs/src/GridRenderLayer.js +32 -7
  211. package/lib/module/lib/commonjs/src/GridRenderLayer.js.map +1 -1
  212. package/lib/module/lib/commonjs/src/MapManager.js +1 -4
  213. package/lib/module/lib/commonjs/src/MapManager.js.map +1 -1
  214. package/lib/module/lib/commonjs/src/WeatherLayerManager.js +236 -210
  215. package/lib/module/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
  216. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +1003 -0
  217. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +1 -0
  218. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +381 -0
  219. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +1 -0
  220. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +1229 -0
  221. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +1 -0
  222. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +4023 -0
  223. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +1 -0
  224. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/events.js +38 -0
  225. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +1 -0
  226. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +30 -0
  227. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +1 -0
  228. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +27 -0
  229. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +1 -0
  230. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/index.js +47 -0
  231. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +1 -0
  232. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +301 -0
  233. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +1 -0
  234. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +126 -0
  235. package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +1 -0
  236. package/lib/module/node_modules/@aguacerowx/javascript-sdk/package.json +48 -0
  237. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +1021 -0
  238. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +1 -0
  239. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +375 -0
  240. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +1 -0
  241. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +1223 -0
  242. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +1 -0
  243. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +4017 -0
  244. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +1 -0
  245. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/events.js +31 -0
  246. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +1 -0
  247. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +29 -0
  248. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +1 -0
  249. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +21 -0
  250. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +1 -0
  251. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/index.js +12 -0
  252. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +1 -0
  253. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +295 -0
  254. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +1 -0
  255. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +119 -0
  256. package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +1 -0
  257. package/lib/module/package.json +9 -17
  258. package/lib/module/src/GridRenderLayer.js +32 -7
  259. package/lib/module/src/GridRenderLayer.js.map +1 -1
  260. package/lib/module/src/MapManager.js +1 -4
  261. package/lib/module/src/MapManager.js.map +1 -1
  262. package/lib/module/src/WeatherLayerManager.js +237 -211
  263. package/lib/module/src/WeatherLayerManager.js.map +1 -1
  264. package/lib/typescript/src/GridRenderLayer.d.ts.map +1 -1
  265. package/lib/typescript/src/MapManager.d.ts.map +1 -1
  266. package/lib/typescript/src/WeatherLayerManager.d.ts.map +1 -1
  267. package/package.json +9 -17
  268. package/src/AguaceroContext.js +4 -0
  269. package/src/GridRenderLayer.js +205 -0
  270. package/src/GridRenderLayerNativeComponent.ts +16 -0
  271. package/src/MapManager.js +156 -0
  272. package/src/MapRegistry.js +35 -0
  273. package/src/StyleApplicator.js +241 -0
  274. package/src/WeatherLayerManager.js +873 -0
@@ -0,0 +1,1003 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AguaceroCore = void 0;
7
+ var _events = require("./events.js");
8
+ var _coordinate_configs = require("./coordinate_configs.js");
9
+ var _unitConversions = require("./unitConversions.js");
10
+ var _dictionaries = require("./dictionaries.js");
11
+ var _defaultColormaps = require("./default-colormaps.js");
12
+ var _proj = _interopRequireDefault(require("proj4"));
13
+ var _fzstd = require("fzstd");
14
+ var _getBundleId = require("./getBundleId");
15
+ function _interopRequireDefault(e) {
16
+ return e && e.__esModule ? e : {
17
+ default: e
18
+ };
19
+ }
20
+ // AguaceroCore.js - The Headless "Engine"
21
+
22
+ // --- Non-UI Imports ---
23
+
24
+ // --- Non-UI Helper Functions ---
25
+ function hrdpsObliqueTransform(rotated_lon, rotated_lat) {
26
+ const o_lat_p = 53.91148;
27
+ const o_lon_p = 245.305142;
28
+ const DEG_TO_RAD = Math.PI / 180.0;
29
+ const RAD_TO_DEG = 180.0 / Math.PI;
30
+ const o_lat_p_rad = o_lat_p * DEG_TO_RAD;
31
+ const rot_lon_rad = rotated_lon * DEG_TO_RAD;
32
+ const rot_lat_rad = rotated_lat * DEG_TO_RAD;
33
+ const sin_rot_lat = Math.sin(rot_lat_rad);
34
+ const cos_rot_lat = Math.cos(rot_lat_rad);
35
+ const sin_rot_lon = Math.sin(rot_lon_rad);
36
+ const cos_rot_lon = Math.cos(rot_lon_rad);
37
+ const sin_o_lat_p = Math.sin(o_lat_p_rad);
38
+ const cos_o_lat_p = Math.cos(o_lat_p_rad);
39
+ const sin_lat = cos_o_lat_p * sin_rot_lat + sin_o_lat_p * cos_rot_lat * cos_rot_lon;
40
+ let lat = Math.asin(sin_lat) * RAD_TO_DEG;
41
+ const sin_lon_num = cos_rot_lat * sin_rot_lon;
42
+ const sin_lon_den = -sin_o_lat_p * sin_rot_lat + cos_o_lat_p * cos_rot_lat * cos_rot_lon;
43
+ let lon = Math.atan2(sin_lon_num, sin_lon_den) * RAD_TO_DEG + o_lon_p;
44
+ if (lon > 180) lon -= 360;else if (lon < -180) lon += 360;
45
+ return [lon, lat];
46
+ }
47
+ function findLatestModelRun(modelsData, modelName) {
48
+ const model = modelsData === null || modelsData === void 0 ? void 0 : modelsData[modelName];
49
+ if (!model) return null;
50
+ const availableDates = Object.keys(model).sort((a, b) => b.localeCompare(a));
51
+ for (const date of availableDates) {
52
+ const runs = model[date];
53
+ if (!runs) continue;
54
+ const availableRuns = Object.keys(runs).sort((a, b) => b.localeCompare(a));
55
+ if (availableRuns.length > 0) return {
56
+ date: date,
57
+ run: availableRuns[0]
58
+ };
59
+ }
60
+ return null;
61
+ }
62
+ class AguaceroCore extends _events.EventEmitter {
63
+ constructor(options = {}) {
64
+ super();
65
+ this.isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
66
+ this.apiKey = options.apiKey;
67
+ this.bundleId = (0, _getBundleId.getBundleId)();
68
+ this.baseGridUrl = 'https://d3dc62msmxkrd7.cloudfront.net';
69
+ if (!this.isReactNative) {
70
+ this.worker = this.createWorker();
71
+ this.workerRequestId = 0;
72
+ this.workerResolvers = new Map();
73
+ this.worker.addEventListener('message', this._handleWorkerMessage.bind(this));
74
+ this.resultQueue = [];
75
+ this.isProcessingQueue = false;
76
+ } else {
77
+ this.worker = null;
78
+ }
79
+ this.statusUrl = 'https://d3dc62msmxkrd7.cloudfront.net/model-status';
80
+ this.modelStatus = null;
81
+ this.mrmsStatus = null;
82
+ this.dataCache = new Map();
83
+ this.abortControllers = new Map();
84
+ this.isPlaying = false;
85
+ this.playIntervalId = null;
86
+ this.playbackSpeed = options.playbackSpeed || 500;
87
+ this.customColormaps = options.customColormaps || {};
88
+ const userLayerOptions = options.layerOptions || {};
89
+ const initialVariable = userLayerOptions.variable || null;
90
+ this.state = {
91
+ model: userLayerOptions.model || 'gfs',
92
+ isMRMS: false,
93
+ mrmsTimestamp: null,
94
+ variable: initialVariable,
95
+ date: null,
96
+ run: null,
97
+ forecastHour: 0,
98
+ visible: true,
99
+ opacity: userLayerOptions.opacity ?? 0.85,
100
+ units: options.initialUnit || 'imperial',
101
+ shaderSmoothingEnabled: options.shaderSmoothingEnabled ?? true
102
+ };
103
+ this.autoRefreshEnabled = options.autoRefresh ?? false;
104
+ this.autoRefreshIntervalSeconds = options.autoRefreshInterval ?? 60;
105
+ this.autoRefreshIntervalId = null;
106
+ }
107
+ async setState(newState) {
108
+ Object.assign(this.state, newState);
109
+ this._emitStateChange();
110
+ }
111
+ _emitStateChange() {
112
+ var _this$modelStatus, _this$modelStatus2;
113
+ const {
114
+ colormap,
115
+ baseUnit
116
+ } = this._getColormapForVariable(this.state.variable);
117
+ const toUnit = this._getTargetUnit(baseUnit, this.state.units);
118
+ const displayColormap = this._convertColormapUnits(colormap, baseUnit, toUnit);
119
+ let availableTimestamps = [];
120
+ if (this.state.isMRMS && this.state.variable && this.mrmsStatus) {
121
+ const timestamps = this.mrmsStatus[this.state.variable] || [];
122
+ availableTimestamps = [...timestamps].reverse();
123
+ }
124
+ const eventPayload = {
125
+ ...this.state,
126
+ availableModels: this.modelStatus ? Object.keys(this.modelStatus).sort() : [],
127
+ availableRuns: ((_this$modelStatus = this.modelStatus) === null || _this$modelStatus === void 0 ? void 0 : _this$modelStatus[this.state.model]) || {},
128
+ availableHours: this.state.isMRMS ? [] : ((_this$modelStatus2 = this.modelStatus) === null || _this$modelStatus2 === void 0 || (_this$modelStatus2 = _this$modelStatus2[this.state.model]) === null || _this$modelStatus2 === void 0 || (_this$modelStatus2 = _this$modelStatus2[this.state.date]) === null || _this$modelStatus2 === void 0 ? void 0 : _this$modelStatus2[this.state.run]) || [],
129
+ availableVariables: this.getAvailableVariables(this.state.isMRMS ? 'mrms' : this.state.model),
130
+ // We need to confirm this line is working as expected.
131
+ availableMRMSVariables: this.getAvailableVariables('mrms'),
132
+ availableTimestamps: availableTimestamps,
133
+ isPlaying: this.isPlaying,
134
+ colormap: displayColormap,
135
+ colormapBaseUnit: toUnit
136
+ };
137
+ this.emit('state:change', eventPayload);
138
+ }
139
+ async initialize(options = {}) {
140
+ await this.fetchModelStatus(true);
141
+ await this.fetchMRMSStatus(true);
142
+ const latestRun = findLatestModelRun(this.modelStatus, this.state.model);
143
+ let initialState = this.state;
144
+ if (latestRun && !this.state.isMRMS) {
145
+ initialState = {
146
+ ...this.state,
147
+ ...latestRun,
148
+ forecastHour: 0
149
+ };
150
+ const availableVariables = this.getAvailableVariables(initialState.model);
151
+ if (availableVariables && availableVariables.length > 0) {
152
+ initialState.variable = availableVariables[0];
153
+ }
154
+ }
155
+ await this.setState(initialState);
156
+ if (options.autoRefresh ?? this.autoRefreshEnabled) {
157
+ this.startAutoRefresh(options.refreshInterval ?? this.autoRefreshIntervalSeconds);
158
+ }
159
+ }
160
+ destroy() {
161
+ this.pause();
162
+ this.stopAutoRefresh();
163
+ this.dataCache.clear();
164
+ if (this.worker) {
165
+ this.worker.terminate();
166
+ }
167
+ this.callbacks = {};
168
+ console.log(`AguaceroCore has been destroyed.`);
169
+ }
170
+
171
+ // --- Public API Methods ---
172
+
173
+ play() {
174
+ if (this.isPlaying) return;
175
+ this.isPlaying = true;
176
+ clearInterval(this.playIntervalId);
177
+ this.playIntervalId = setInterval(() => {
178
+ this.step(1);
179
+ }, this.playbackSpeed);
180
+ this.emit('playback:start', {
181
+ speed: this.playbackSpeed
182
+ });
183
+ this._emitStateChange(); // Notify UI that isPlaying is now true
184
+ }
185
+ pause() {
186
+ if (!this.isPlaying) return;
187
+ this.isPlaying = false;
188
+ clearInterval(this.playIntervalId);
189
+ this.playIntervalId = null;
190
+ this.emit('playback:stop');
191
+ this._emitStateChange(); // Notify UI that isPlaying is now false
192
+ }
193
+ togglePlay() {
194
+ this.isPlaying ? this.pause() : this.play();
195
+ }
196
+ step(direction = 1) {
197
+ var _this$modelStatus3;
198
+ const {
199
+ model,
200
+ date,
201
+ run,
202
+ forecastHour
203
+ } = this.state;
204
+ const forecastHours = (_this$modelStatus3 = this.modelStatus) === null || _this$modelStatus3 === void 0 || (_this$modelStatus3 = _this$modelStatus3[model]) === null || _this$modelStatus3 === void 0 || (_this$modelStatus3 = _this$modelStatus3[date]) === null || _this$modelStatus3 === void 0 ? void 0 : _this$modelStatus3[run];
205
+ if (!forecastHours || forecastHours.length === 0) return;
206
+ const currentIndex = forecastHours.indexOf(forecastHour);
207
+ if (currentIndex === -1) return;
208
+ const maxIndex = forecastHours.length - 1;
209
+ let nextIndex = currentIndex + direction;
210
+ if (nextIndex > maxIndex) nextIndex = 0;
211
+ if (nextIndex < 0) nextIndex = maxIndex;
212
+ this.setState({
213
+ forecastHour: forecastHours[nextIndex]
214
+ });
215
+ }
216
+ setPlaybackSpeed(speed) {
217
+ if (speed > 0) {
218
+ this.playbackSpeed = speed;
219
+ if (this.isPlaying) this.play();
220
+ }
221
+ }
222
+ async setShaderSmoothing(enabled) {
223
+ if (typeof enabled !== 'boolean' || enabled === this.state.shaderSmoothingEnabled) return;
224
+ await this.setState({
225
+ shaderSmoothingEnabled: enabled
226
+ });
227
+ }
228
+ async setOpacity(newOpacity) {
229
+ const clampedOpacity = Math.max(0, Math.min(1, newOpacity));
230
+ if (clampedOpacity === this.state.opacity) return;
231
+ await this.setState({
232
+ opacity: clampedOpacity
233
+ });
234
+ }
235
+ async setVariable(variable) {
236
+ await this.setState({
237
+ variable
238
+ });
239
+ }
240
+ async setModel(modelName) {
241
+ var _this$modelStatus4;
242
+ if (modelName === this.state.model || !((_this$modelStatus4 = this.modelStatus) !== null && _this$modelStatus4 !== void 0 && _this$modelStatus4[modelName])) return;
243
+ const latestRun = findLatestModelRun(this.modelStatus, modelName);
244
+ if (latestRun) {
245
+ await this.setState({
246
+ model: modelName,
247
+ date: latestRun.date,
248
+ run: latestRun.run,
249
+ forecastHour: 0
250
+ });
251
+ }
252
+ }
253
+ async setRun(runString) {
254
+ const [date, run] = runString.split(':');
255
+ if (date !== this.state.date || run !== this.state.run) {
256
+ await this.setState({
257
+ date,
258
+ run,
259
+ forecastHour: 0
260
+ });
261
+ }
262
+ }
263
+ async setUnits(newUnits) {
264
+ if (newUnits === this.state.units || !['metric', 'imperial'].includes(newUnits)) return;
265
+ await this.setState({
266
+ units: newUnits
267
+ });
268
+ }
269
+ async setMRMSVariable(variable) {
270
+ const sortedTimestamps = [...(this.mrmsStatus[variable] || [])].sort((a, b) => b - a);
271
+ const initialTimestamp = sortedTimestamps.length > 0 ? sortedTimestamps[0] : null;
272
+ await this.setState({
273
+ variable,
274
+ isMRMS: true,
275
+ mrmsTimestamp: initialTimestamp
276
+ });
277
+ }
278
+ async setMRMSTimestamp(timestamp) {
279
+ if (!this.state.isMRMS) return;
280
+ await this.setState({
281
+ mrmsTimestamp: timestamp
282
+ });
283
+ }
284
+ async switchMode(options) {
285
+ const {
286
+ mode,
287
+ variable,
288
+ model,
289
+ forecastHour,
290
+ mrmsTimestamp
291
+ } = options;
292
+ if (!mode || !variable) {
293
+ console.error("switchMode requires 'mode' ('mrms' | 'model') and 'variable' properties.");
294
+ return;
295
+ }
296
+ if (mode === 'model' && !model) {
297
+ console.error("switchMode with mode 'model' requires a 'model' property.");
298
+ return;
299
+ }
300
+ let targetState = {};
301
+ if (mode === 'mrms') {
302
+ let finalTimestamp = mrmsTimestamp;
303
+ if (finalTimestamp === undefined) {
304
+ const sortedTimestamps = [...(this.mrmsStatus[variable] || [])].sort((a, b) => b - a);
305
+ finalTimestamp = sortedTimestamps.length > 0 ? sortedTimestamps[0] : null;
306
+ }
307
+ targetState = {
308
+ isMRMS: true,
309
+ variable: variable,
310
+ mrmsTimestamp: finalTimestamp,
311
+ model: this.state.model,
312
+ date: null,
313
+ run: null,
314
+ forecastHour: 0
315
+ };
316
+ } else if (mode === 'model') {
317
+ const latestRun = findLatestModelRun(this.modelStatus, model);
318
+ if (!latestRun) {
319
+ console.error(`Could not find a valid run for model: ${model}`);
320
+ return;
321
+ }
322
+ targetState = {
323
+ isMRMS: false,
324
+ model: model,
325
+ variable: variable,
326
+ date: latestRun.date,
327
+ run: latestRun.run,
328
+ forecastHour: forecastHour !== undefined ? forecastHour : 0,
329
+ mrmsTimestamp: null
330
+ };
331
+ } else {
332
+ console.error(`Invalid mode specified in switchMode: '${mode}'`);
333
+ return;
334
+ }
335
+ await this.setState(targetState);
336
+ }
337
+
338
+ // --- Data and Calculation Methods ---
339
+
340
+ _reconstructData(decompressedDeltas, encoding) {
341
+ const expectedLength = encoding.length;
342
+ const reconstructedData = new Int8Array(expectedLength);
343
+ if (decompressedDeltas.length > 0 && expectedLength > 0) {
344
+ // First value is absolute
345
+ reconstructedData[0] = decompressedDeltas[0] > 127 ? decompressedDeltas[0] - 256 : decompressedDeltas[0];
346
+
347
+ // Subsequent values are deltas from the previous one
348
+ for (let i = 1; i < expectedLength; i++) {
349
+ const delta = decompressedDeltas[i] > 127 ? decompressedDeltas[i] - 256 : decompressedDeltas[i];
350
+ reconstructedData[i] = reconstructedData[i - 1] + delta;
351
+ }
352
+ }
353
+ // Return as a Uint8Array, which is what the rest of the code expects
354
+ return new Uint8Array(reconstructedData.buffer);
355
+ }
356
+ async _loadGridData(state) {
357
+ const {
358
+ model,
359
+ date,
360
+ run,
361
+ forecastHour,
362
+ variable,
363
+ isMRMS,
364
+ mrmsTimestamp
365
+ } = state;
366
+ let effectiveSmoothing = 0;
367
+ const customVariableSettings = this.customColormaps[variable];
368
+ if (customVariableSettings && typeof customVariableSettings.smoothing === 'number') {
369
+ effectiveSmoothing = customVariableSettings.smoothing;
370
+ }
371
+ let resourcePath;
372
+ let dataUrlIdentifier;
373
+ if (isMRMS) {
374
+ if (!mrmsTimestamp) return null;
375
+ const mrmsDate = new Date(mrmsTimestamp * 1000);
376
+ const y = mrmsDate.getUTCFullYear(),
377
+ m = (mrmsDate.getUTCMonth() + 1).toString().padStart(2, '0'),
378
+ d = mrmsDate.getUTCDate().toString().padStart(2, '0');
379
+ dataUrlIdentifier = `mrms-${mrmsTimestamp}-${variable}-${effectiveSmoothing}`;
380
+ resourcePath = `/grids/mrms/${y}${m}${d}/${mrmsTimestamp}/0/${variable}/${effectiveSmoothing}`;
381
+ } else {
382
+ dataUrlIdentifier = `${model}-${date}-${run}-${forecastHour}-${variable}-${effectiveSmoothing}`;
383
+ resourcePath = `/grids/${model}/${date}/${run}/${forecastHour}/${variable}/${effectiveSmoothing}`;
384
+ }
385
+ if (this.dataCache.has(dataUrlIdentifier)) {
386
+ return this.dataCache.get(dataUrlIdentifier);
387
+ }
388
+
389
+ // --- EDITED ---
390
+ // If we are in React Native, this function should NOT do any work.
391
+ // The native WeatherFrameProcessorModule is now responsible for all data loading.
392
+ // This function might still be called by a "cache miss" fallback, but it
393
+ // should not fetch data from JS anymore. We return null so the fallback knows
394
+ // that the native module is the only source of truth for new data.
395
+ if (this.isReactNative) {
396
+ console.warn(`_loadGridData was called in React Native for ${dataUrlIdentifier}. This should be handled by the native module. Returning null.`);
397
+ return null;
398
+ }
399
+ const abortController = new AbortController();
400
+ this.abortControllers.set(dataUrlIdentifier, abortController);
401
+ const loadPromise = (async () => {
402
+ if (!this.apiKey) {
403
+ throw new Error('API key is not configured.');
404
+ }
405
+ try {
406
+ const baseUrl = `${this.baseGridUrl}${resourcePath}`;
407
+ const urlWithApiKeyParam = `${baseUrl}?apiKey=${this.apiKey}`;
408
+ const headers = {
409
+ 'x-api-key': this.apiKey
410
+ };
411
+ if (this.bundleId) {
412
+ headers['x-app-identifier'] = this.bundleId;
413
+ }
414
+ const response = await fetch(urlWithApiKeyParam, {
415
+ headers: headers,
416
+ signal: abortController.signal
417
+ });
418
+ if (!response.ok) {
419
+ throw new Error(`Failed to fetch grid data: ${response.status} ${response.statusText}`);
420
+ }
421
+ const {
422
+ data: b64Data,
423
+ encoding
424
+ } = await response.json();
425
+ const compressedData = Uint8Array.from(atob(b64Data), c => c.charCodeAt(0));
426
+
427
+ // This path is now ONLY for the web worker
428
+ const requestId = this.workerRequestId++;
429
+ const workerPromise = new Promise((resolve, reject) => {
430
+ this.workerResolvers.set(requestId, {
431
+ resolve,
432
+ reject
433
+ });
434
+ });
435
+ this.worker.postMessage({
436
+ requestId,
437
+ compressedData,
438
+ encoding
439
+ }, [compressedData.buffer]);
440
+ const result = await workerPromise;
441
+ const finalData = result.data;
442
+ const transformedData = new Uint8Array(finalData.length);
443
+ for (let i = 0; i < finalData.length; i++) {
444
+ const signedValue = finalData[i] > 127 ? finalData[i] - 256 : finalData[i];
445
+ transformedData[i] = signedValue + 128;
446
+ }
447
+ this.abortControllers.delete(dataUrlIdentifier);
448
+ return {
449
+ data: transformedData,
450
+ encoding
451
+ };
452
+ } catch (error) {
453
+ if (error.name === 'AbortError') {
454
+ console.log(`Request cancelled for ${resourcePath}`);
455
+ } else {
456
+ console.error(`Failed to load data for path ${resourcePath}:`, error);
457
+ }
458
+ this.dataCache.delete(dataUrlIdentifier);
459
+ this.abortControllers.delete(dataUrlIdentifier);
460
+ return null;
461
+ }
462
+ })();
463
+ this.dataCache.set(dataUrlIdentifier, loadPromise);
464
+ return loadPromise;
465
+ }
466
+ cancelAllRequests() {
467
+ // Abort all in-flight requests
468
+ this.abortControllers.forEach((controller, key) => {
469
+ controller.abort();
470
+ });
471
+
472
+ // Clear both maps
473
+ this.abortControllers.clear();
474
+ this.dataCache.clear();
475
+ console.log('All pending requests cancelled');
476
+ }
477
+ async getValueAtLngLat(lng, lat) {
478
+ const {
479
+ variable,
480
+ isMRMS,
481
+ mrmsTimestamp,
482
+ model,
483
+ date,
484
+ run,
485
+ forecastHour,
486
+ units
487
+ } = this.state;
488
+ if (!variable) return null;
489
+ const gridIndices = this._getGridIndexFromLngLat(lng, lat);
490
+ if (!gridIndices) return null;
491
+ const {
492
+ i,
493
+ j
494
+ } = gridIndices;
495
+ const gridModel = isMRMS ? 'mrms' : model;
496
+ const normalizedGridModel = this._normalizeModelName(gridModel);
497
+ const {
498
+ nx
499
+ } = _coordinate_configs.COORDINATE_CONFIGS[normalizedGridModel].grid_params;
500
+ const customSettings = this.customColormaps[variable];
501
+ const effectiveSmoothing = customSettings && typeof customSettings.smoothing === 'number' ? customSettings.smoothing : 0;
502
+ const dataUrlIdentifier = isMRMS ? `mrms-${mrmsTimestamp}-${variable}-${effectiveSmoothing}` : `${model}-${date}-${run}-${forecastHour}-${variable}-${effectiveSmoothing}`;
503
+ const gridDataPromise = this.dataCache.get(dataUrlIdentifier);
504
+ if (!gridDataPromise) return null;
505
+ try {
506
+ const gridData = await gridDataPromise;
507
+ if (!gridData || !gridData.data) return null;
508
+ const index1D = j * nx + i;
509
+ const byteValue = gridData.data[index1D];
510
+ const signedQuantizedValue = byteValue - 128;
511
+ const {
512
+ scale,
513
+ offset,
514
+ missing_quantized
515
+ } = gridData.encoding;
516
+ if (signedQuantizedValue === missing_quantized) return null;
517
+ const nativeValue = signedQuantizedValue * scale + offset;
518
+ const {
519
+ baseUnit
520
+ } = this._getColormapForVariable(variable);
521
+ let dataNativeUnit = baseUnit || (_dictionaries.DICTIONARIES.fld[variable] || {}).defaultUnit || 'none';
522
+ const displayUnit = this._getTargetUnit(dataNativeUnit, units);
523
+ const conversionFunc = (0, _unitConversions.getUnitConversionFunction)(dataNativeUnit, displayUnit);
524
+ const displayValue = conversionFunc ? conversionFunc(nativeValue) : nativeValue;
525
+ return {
526
+ lngLat: {
527
+ lng,
528
+ lat
529
+ },
530
+ variable: {
531
+ code: variable,
532
+ name: this.getVariableDisplayName(variable)
533
+ },
534
+ value: displayValue,
535
+ unit: displayUnit
536
+ };
537
+ } catch (error) {
538
+ return null;
539
+ }
540
+ }
541
+ getAvailableVariables(modelName = null) {
542
+ var _MODEL_CONFIGS$model;
543
+ const model = modelName || this.state.model;
544
+ return ((_MODEL_CONFIGS$model = _dictionaries.MODEL_CONFIGS[model]) === null || _MODEL_CONFIGS$model === void 0 ? void 0 : _MODEL_CONFIGS$model.vars) || [];
545
+ }
546
+ getVariableDisplayName(variableCode) {
547
+ const varInfo = _dictionaries.DICTIONARIES.fld[variableCode];
548
+ return (varInfo === null || varInfo === void 0 ? void 0 : varInfo.displayName) || (varInfo === null || varInfo === void 0 ? void 0 : varInfo.name) || variableCode;
549
+ }
550
+ _getColormapForVariable(variable) {
551
+ if (!variable) return {
552
+ colormap: [],
553
+ baseUnit: ''
554
+ };
555
+
556
+ // This logic for user-provided custom colormaps is correct.
557
+ // If a user provides a custom map, it should always take top priority.
558
+ if (this.customColormaps[variable] && this.customColormaps[variable].colormap) {
559
+ return {
560
+ colormap: this.customColormaps[variable].colormap,
561
+ baseUnit: this.customColormaps[variable].baseUnit || ''
562
+ };
563
+ }
564
+ const colormapKey = _dictionaries.DICTIONARIES.variable_cmap[variable] || variable;
565
+ const customColormap = this.customColormaps[colormapKey];
566
+ if (customColormap && customColormap.colormap) {
567
+ return {
568
+ colormap: customColormap.colormap,
569
+ baseUnit: customColormap.baseUnit || ''
570
+ };
571
+ }
572
+ const defaultColormapData = _defaultColormaps.DEFAULT_COLORMAPS[colormapKey];
573
+
574
+ // --- START OF THE BUG FIX ---
575
+ // This block handles the "default" case when no custom colormap is provided.
576
+ if (defaultColormapData && defaultColormapData.units) {
577
+ var _DICTIONARIES$fld$var;
578
+ // 1. EDITED: Explicitly look up the CORRECT default unit from the main dictionary.
579
+ // This is the information source we were previously ignoring.
580
+ const preferredUnit = (_DICTIONARIES$fld$var = _dictionaries.DICTIONARIES.fld[variable]) === null || _DICTIONARIES$fld$var === void 0 ? void 0 : _DICTIONARIES$fld$var.defaultUnit; // e.g., '°C' for '2t_2'
581
+
582
+ // 2. EDITED: Check if that preferred unit exists in the colormap definitions.
583
+ if (preferredUnit && defaultColormapData.units[preferredUnit]) {
584
+ const unitData = defaultColormapData.units[preferredUnit];
585
+ if (unitData && unitData.colormap) {
586
+ // 3. EDITED: If it exists, return ITS data. This is the correct path.
587
+ console.log(`[AguaceroCore] Using dictionary default unit '${preferredUnit}' for variable '${variable}'.`);
588
+ return {
589
+ colormap: unitData.colormap,
590
+ baseUnit: preferredUnit
591
+ };
592
+ }
593
+ }
594
+
595
+ // 4. EDITED: The old, buggy logic now serves as a FALLBACK ONLY.
596
+ // This will only run if the specified defaultUnit is missing from the colormap data.
597
+ console.warn(`[AguaceroCore] Default unit for '${variable}' not found in colormap. Using fallback.`);
598
+ const availableUnits = Object.keys(defaultColormapData.units);
599
+ if (availableUnits.length > 0) {
600
+ const fallbackUnit = availableUnits[0]; // e.g., '°F'
601
+ const unitData = defaultColormapData.units[fallbackUnit];
602
+ if (unitData && unitData.colormap) {
603
+ return {
604
+ colormap: unitData.colormap,
605
+ baseUnit: fallbackUnit
606
+ };
607
+ }
608
+ }
609
+ }
610
+ // --- END OF THE BUG FIX ---
611
+
612
+ return {
613
+ colormap: [],
614
+ baseUnit: ''
615
+ };
616
+ }
617
+ _convertColormapUnits(colormap, fromUnits, toUnits) {
618
+ if (fromUnits === toUnits) return colormap;
619
+ const conversionFunc = (0, _unitConversions.getUnitConversionFunction)(fromUnits, toUnits);
620
+ if (!conversionFunc) return colormap;
621
+ const newColormap = [];
622
+ for (let i = 0; i < colormap.length; i += 2) {
623
+ newColormap.push(conversionFunc(colormap[i]), colormap[i + 1]);
624
+ }
625
+ return newColormap;
626
+ }
627
+ _normalizeModelName(modelName) {
628
+ const mapping = {
629
+ 'hrrr': ['mpashn', 'mpasrt', 'mpasht', 'hrrrsub', 'rrfs', 'namnest', 'mpasrn', 'mpasrn3', 'mpasht2'],
630
+ 'arw': ['arw2', 'fv3', 'href'],
631
+ 'rtma': ['nbm'],
632
+ 'ecmwf': ['ecmwfaifs'],
633
+ 'gfs': ['arpege', 'graphcastgfs']
634
+ };
635
+ for (const [normalized, aliases] of Object.entries(mapping)) {
636
+ if (aliases.includes(modelName)) return normalized;
637
+ }
638
+ return modelName;
639
+ }
640
+ _getGridCornersAndDef(model) {
641
+ const normalizedModel = this._normalizeModelName(model);
642
+ const gridDef = {
643
+ ..._coordinate_configs.COORDINATE_CONFIGS[normalizedModel],
644
+ modelName: model
645
+ };
646
+ if (!gridDef) return null;
647
+ const {
648
+ nx,
649
+ ny
650
+ } = gridDef.grid_params;
651
+ const gridType = gridDef.type;
652
+ let corners;
653
+ if (gridType === 'latlon') {
654
+ let {
655
+ lon_first,
656
+ lat_first,
657
+ lat_last,
658
+ lon_last,
659
+ dx_degrees,
660
+ dy_degrees
661
+ } = gridDef.grid_params;
662
+ corners = {
663
+ lon_tl: lon_first,
664
+ lat_tl: lat_first,
665
+ lon_tr: lon_last !== undefined ? lon_last : lon_first + (nx - 1) * dx_degrees,
666
+ lat_tr: lat_first,
667
+ lon_bl: lon_first,
668
+ lat_bl: lat_last !== undefined ? lat_last : lat_first + (ny - 1) * dy_degrees,
669
+ lon_br: lon_last !== undefined ? lon_last : lon_first + (nx - 1) * dx_degrees,
670
+ lat_br: lat_last !== undefined ? lat_last : lat_first + (ny - 1) * dy_degrees
671
+ };
672
+ } else if (gridType === 'rotated_latlon') {
673
+ const [lon_tl, lat_tl] = hrdpsObliqueTransform(gridDef.grid_params.lon_first, gridDef.grid_params.lat_first);
674
+ const [lon_tr, lat_tr] = hrdpsObliqueTransform(gridDef.grid_params.lon_first + (nx - 1) * gridDef.grid_params.dx_degrees, gridDef.grid_params.lat_first);
675
+ const [lon_bl, lat_bl] = hrdpsObliqueTransform(gridDef.grid_params.lon_first, gridDef.grid_params.lat_first + (ny - 1) * gridDef.grid_params.dy_degrees);
676
+ const [lon_br, lat_br] = hrdpsObliqueTransform(gridDef.grid_params.lon_first + (nx - 1) * gridDef.grid_params.dx_degrees, gridDef.grid_params.lat_first + (ny - 1) * gridDef.grid_params.dy_degrees);
677
+ corners = {
678
+ lon_tl,
679
+ lat_tl,
680
+ lon_tr,
681
+ lat_tr,
682
+ lon_bl,
683
+ lat_bl,
684
+ lon_br,
685
+ lat_br
686
+ };
687
+ } else if (gridType === 'lambert_conformal_conic' || gridType === 'polar_ stereographic') {
688
+ let projString = Object.entries(gridDef.proj_params).map(([k, v]) => `+${k}=${v}`).join(' ');
689
+ if (gridType === 'polar_stereographic') projString += ' +lat_0=90';
690
+ const {
691
+ x_origin,
692
+ y_origin,
693
+ dx,
694
+ dy
695
+ } = gridDef.grid_params;
696
+ const [lon_tl, lat_tl] = (0, _proj.default)(projString, 'EPSG:4326', [x_origin, y_origin]);
697
+ const [lon_tr, lat_tr] = (0, _proj.default)(projString, 'EPSG:4326', [x_origin + (nx - 1) * dx, y_origin]);
698
+ const [lon_bl, lat_bl] = (0, _proj.default)(projString, 'EPSG:4326', [x_origin, y_origin + (ny - 1) * dy]);
699
+ const [lon_br, lat_br] = (0, _proj.default)(projString, 'EPSG:4326', [x_origin + (nx - 1) * dx, y_origin + (ny - 1) * dy]);
700
+ corners = {
701
+ lon_tl,
702
+ lat_tl,
703
+ lon_tr,
704
+ lat_tr,
705
+ lon_bl,
706
+ lat_bl,
707
+ lon_br,
708
+ lat_br
709
+ };
710
+ } else {
711
+ return null;
712
+ }
713
+ return {
714
+ corners,
715
+ gridDef
716
+ };
717
+ }
718
+ _getTargetUnit(defaultUnit, system) {
719
+ if (system === 'metric') {
720
+ if (['°F', '°C'].includes(defaultUnit)) return 'celsius';
721
+ if (['kts', 'mph', 'm/s'].includes(defaultUnit)) return 'km/h';
722
+ if (['in', 'mm', 'cm'].includes(defaultUnit)) return 'mm';
723
+ }
724
+ if (['°F', '°C'].includes(defaultUnit)) return 'fahrenheit';
725
+ if (['kts', 'mph', 'm/s'].includes(defaultUnit)) return 'mph';
726
+ if (['in', 'mm', 'cm'].includes(defaultUnit)) return 'in';
727
+ return defaultUnit;
728
+ }
729
+ _getGridIndexFromLngLat(lng, lat) {
730
+ const gridModel = this.state.isMRMS ? 'mrms' : this.state.model;
731
+ const normalizedGridModel = this._normalizeModelName(gridModel);
732
+ const gridDef = _coordinate_configs.COORDINATE_CONFIGS[normalizedGridModel];
733
+ if (!gridDef) return null;
734
+ const {
735
+ nx,
736
+ ny
737
+ } = gridDef.grid_params;
738
+ const pixelCoords = this.latLonToGridPixel(lat, lng, gridDef, gridModel);
739
+ if (!pixelCoords || !isFinite(pixelCoords.x) || !isFinite(pixelCoords.y) || pixelCoords.x < 0 || pixelCoords.y < 0) return null;
740
+ const i = Math.round(pixelCoords.x);
741
+ const j = Math.round(pixelCoords.y);
742
+ if (i >= 0 && i < nx && j >= 0 && j < ny) return {
743
+ i,
744
+ j
745
+ };
746
+ return null;
747
+ }
748
+ latLonToProjected(lat, lon, gridDef) {
749
+ if (!isFinite(lat) || !isFinite(lon)) throw new Error(`Invalid coordinates: lat=${lat}, lon=${lon}`);
750
+ const gridType = gridDef.type;
751
+ if (gridType === 'latlon') return {
752
+ x: lon,
753
+ y: lat
754
+ };
755
+ let projString = Object.entries(gridDef.proj_params).map(([k, v]) => `+${k}=${v}`).join(' ');
756
+ if (gridType === 'polar_stereographic') projString += ' +lat_0=90';
757
+ const projected = (0, _proj.default)('EPSG:4326', projString, [lon, lat]);
758
+ return {
759
+ x: projected[0],
760
+ y: projected[1]
761
+ };
762
+ }
763
+ latLonToGridPixel(lat, lon, gridDef, modelName) {
764
+ if (!gridDef) return null;
765
+ if (modelName === 'rgem' && gridDef.type === 'polar_stereographic') return this.latLonToGridPixelPolarStereographic(lat, lon, gridDef);
766
+ const projected = this.latLonToProjected(lat, lon, gridDef);
767
+ let x, y;
768
+ const gridOrigin = {
769
+ x: gridDef.grid_params.lon_first,
770
+ y: gridDef.grid_params.lat_first
771
+ };
772
+ const gridPixelSize = {
773
+ x: gridDef.grid_params.dx_degrees,
774
+ y: gridDef.grid_params.dy_degrees
775
+ };
776
+ if (gridDef.type === 'latlon' || gridDef.type === 'rotated_latlon') {
777
+ let adjustedLon = projected.x;
778
+ if (modelName === 'mrms') {
779
+ if (adjustedLon < 0) adjustedLon += 360;
780
+ x = (adjustedLon - gridOrigin.x) / gridPixelSize.x;
781
+ y = (gridOrigin.y - projected.y) / gridPixelSize.y;
782
+ } else {
783
+ const isGFSType = gridDef.grid_params && gridDef.grid_params.lon_first === 0.0 && Math.abs(gridDef.grid_params.lat_first) === 90.0;
784
+ const isECMWFType = gridDef.grid_params && gridDef.grid_params.lon_first === 180.0 && gridDef.grid_params.lat_first === 90.0;
785
+ const isGEMType = modelName === 'gem' || gridDef.grid_params.lon_first === 180.0 && gridDef.grid_params.lat_first === -90.0 && gridDef.grid_params.lon_last === 179.85;
786
+ if (isGEMType) {
787
+ while (adjustedLon < gridOrigin.x) adjustedLon += 360;
788
+ x = (adjustedLon - gridOrigin.x) / gridPixelSize.x;
789
+ y = (projected.y - gridOrigin.y) / gridPixelSize.y;
790
+ return {
791
+ x,
792
+ y
793
+ };
794
+ }
795
+ let isFlippedGrid = isECMWFType ? true : gridDef.grid_params.lat_first < (gridDef.grid_params.lat_last || (gridDef.grid_params.ny - 1) * gridDef.grid_params.dy_degrees);
796
+ if (isGFSType) adjustedLon = projected.x + 180;else if (isECMWFType) {
797
+ if (adjustedLon < gridOrigin.x) adjustedLon += 360;
798
+ } else if (['arome1', 'arome25', 'arpegeeu', 'iconeu', 'icond2'].includes(modelName)) {
799
+ while (adjustedLon < 0) adjustedLon += 360;
800
+ while (adjustedLon >= 360) adjustedLon -= 360;
801
+ x = adjustedLon >= gridOrigin.x ? (adjustedLon - gridOrigin.x) / gridPixelSize.x : (adjustedLon + 360 - gridOrigin.x) / gridPixelSize.x;
802
+ if (['arome1', 'arome25', 'arpegeeu'].includes(modelName)) y = (gridOrigin.y - projected.y) / Math.abs(gridPixelSize.y);else if (['iconeu', 'icond2'].includes(modelName)) y = (projected.y - gridOrigin.y) / gridPixelSize.y;
803
+ return {
804
+ x,
805
+ y
806
+ };
807
+ } else {
808
+ const lonFirst = gridOrigin.x;
809
+ if (lonFirst > 180 && adjustedLon < 0) adjustedLon += 360;else if (lonFirst < 0 && adjustedLon > 180) adjustedLon -= 360;
810
+ }
811
+ x = (adjustedLon - gridOrigin.x) / gridPixelSize.x;
812
+ if (isFlippedGrid) {
813
+ if (isECMWFType) y = (gridOrigin.y - projected.y) / Math.abs(gridPixelSize.y);else {
814
+ const maxLat = gridDef.grid_params.lat_last || (gridDef.grid_params.ny - 1) * gridDef.grid_params.dy_degrees;
815
+ y = (maxLat - projected.y) / Math.abs(gridPixelSize.y);
816
+ }
817
+ } else y = (projected.y - gridOrigin.y) / gridPixelSize.y;
818
+ }
819
+ } else {
820
+ const projOrigin = {
821
+ x: gridDef.grid_params.x_origin,
822
+ y: gridDef.grid_params.y_origin
823
+ };
824
+ const projPixelSize = {
825
+ x: gridDef.grid_params.dx,
826
+ y: gridDef.grid_params.dy
827
+ };
828
+ x = (projected.x - projOrigin.x) / projPixelSize.x;
829
+ y = (projOrigin.y - projected.y) / Math.abs(projPixelSize.y);
830
+ }
831
+ return {
832
+ x,
833
+ y
834
+ };
835
+ }
836
+ latLonToGridPixelPolarStereographic(lat, lon, gridDef) {
837
+ try {
838
+ const projParams = gridDef.proj_params;
839
+ let projectionString = `+proj=${projParams.proj}`;
840
+ Object.keys(projParams).forEach(key => {
841
+ if (key !== 'proj') projectionString += ` +${key}=${projParams[key]}`;
842
+ });
843
+ projectionString += ' +lat_0=90 +no_defs';
844
+ const {
845
+ nx,
846
+ ny,
847
+ dx,
848
+ dy,
849
+ x_origin,
850
+ y_origin
851
+ } = gridDef.grid_params;
852
+ const x_min = x_origin;
853
+ const x_max = x_origin + (nx - 1) * dx;
854
+ const y_max = y_origin;
855
+ const y_min = y_origin + (ny - 1) * dy;
856
+ const [proj_x, proj_y] = (0, _proj.default)('EPSG:4326', projectionString, [lon, lat]);
857
+ if (!isFinite(proj_x) || !isFinite(proj_y)) return {
858
+ x: -1,
859
+ y: -1
860
+ };
861
+ const t_x = (proj_x - x_min) / (x_max - x_min);
862
+ const t_y = (proj_y - y_max) / (y_min - y_max);
863
+ const x = t_x * (nx - 1);
864
+ const y = t_y * (ny - 1);
865
+ return {
866
+ x,
867
+ y
868
+ };
869
+ } catch (error) {
870
+ console.warn(`[GridAccessor] RGEM polar stereographic conversion failed for ${lat}, ${lon}:`, error);
871
+ return {
872
+ x: -1,
873
+ y: -1
874
+ };
875
+ }
876
+ }
877
+
878
+ // --- Worker and Status Methods ---
879
+
880
+ createWorker() {
881
+ if (this.isReactNative) return null;
882
+ const workerCode = `
883
+ import { decompress } from 'https://cdn.skypack.dev/fzstd@0.1.1';
884
+
885
+ function _reconstructData(decompressedDeltas, encoding) {
886
+ const expectedLength = encoding.length;
887
+ const reconstructedData = new Int8Array(expectedLength);
888
+ if (decompressedDeltas.length > 0 && expectedLength > 0) {
889
+ reconstructedData[0] = decompressedDeltas[0] > 127 ? decompressedDeltas[0] - 256 : decompressedDeltas[0];
890
+ for (let i = 1; i < expectedLength; i++) {
891
+ const delta = decompressedDeltas[i] > 127 ? decompressedDeltas[i] - 256 : decompressedDeltas[i];
892
+ reconstructedData[i] = reconstructedData[i - 1] + delta;
893
+ }
894
+ }
895
+ return new Uint8Array(reconstructedData.buffer);
896
+ }
897
+
898
+ self.onmessage = async (e) => {
899
+ const { requestId, compressedData, encoding } = e.data;
900
+ try {
901
+ const decompressedDeltas = await decompress(compressedData);
902
+ const finalData = _reconstructData(decompressedDeltas, encoding);
903
+ self.postMessage({ success: true, requestId: requestId, decompressedData: finalData, encoding: encoding }, [finalData.buffer]);
904
+ } catch (error) {
905
+ self.postMessage({ success: false, requestId: requestId, error: error.message });
906
+ }
907
+ };
908
+ `;
909
+ const blob = new Blob([workerCode], {
910
+ type: 'application/javascript'
911
+ });
912
+ return new Worker(URL.createObjectURL(blob), {
913
+ type: 'module'
914
+ });
915
+ }
916
+ _processResultQueue() {
917
+ while (this.resultQueue.length > 0) {
918
+ const {
919
+ success,
920
+ requestId,
921
+ decompressedData,
922
+ encoding,
923
+ error
924
+ } = this.resultQueue.shift();
925
+ if (this.workerResolvers.has(requestId)) {
926
+ const {
927
+ resolve,
928
+ reject
929
+ } = this.workerResolvers.get(requestId);
930
+ if (success) {
931
+ resolve({
932
+ data: decompressedData
933
+ }); // Return as { data: ... }
934
+ } else {
935
+ reject(new Error(error));
936
+ }
937
+ this.workerResolvers.delete(requestId);
938
+ }
939
+ }
940
+ this.isProcessingQueue = false;
941
+ }
942
+ _handleWorkerMessage(e) {
943
+ if (this.isReactNative) return;
944
+ const {
945
+ success,
946
+ requestId,
947
+ decompressedData,
948
+ encoding,
949
+ error
950
+ } = e.data;
951
+ this.resultQueue.push({
952
+ success,
953
+ requestId,
954
+ decompressedData,
955
+ encoding,
956
+ error
957
+ });
958
+ if (!this.isProcessingQueue) {
959
+ this.isProcessingQueue = true;
960
+ requestAnimationFrame(() => this._processResultQueue());
961
+ }
962
+ }
963
+ async fetchModelStatus(force = false) {
964
+ if (!this.modelStatus || force) {
965
+ try {
966
+ const response = await fetch(this.statusUrl);
967
+ if (!response.ok) throw new Error(`HTTP error! Status: ${response.status}`);
968
+ this.modelStatus = (await response.json()).models;
969
+ } catch (error) {
970
+ this.modelStatus = null;
971
+ }
972
+ }
973
+ return this.modelStatus;
974
+ }
975
+ async fetchMRMSStatus(force = false) {
976
+ const mrmsStatusUrl = 'https://h3dfvh5pq6euq36ymlpz4zqiha0obqju.lambda-url.us-east-2.on.aws';
977
+ if (!this.mrmsStatus || force) {
978
+ try {
979
+ const response = await fetch(mrmsStatusUrl);
980
+ if (!response.ok) throw new Error(`HTTP error! Status: ${response.status}`);
981
+ this.mrmsStatus = await response.json();
982
+ } catch (error) {
983
+ this.mrmsStatus = null;
984
+ }
985
+ }
986
+ return this.mrmsStatus;
987
+ }
988
+ startAutoRefresh(intervalSeconds) {
989
+ this.stopAutoRefresh();
990
+ this.autoRefreshIntervalId = setInterval(async () => {
991
+ await this.fetchModelStatus(true);
992
+ this._emitStateChange();
993
+ }, (intervalSeconds || 60) * 1000);
994
+ }
995
+ stopAutoRefresh() {
996
+ if (this.autoRefreshIntervalId) {
997
+ clearInterval(this.autoRefreshIntervalId);
998
+ this.autoRefreshIntervalId = null;
999
+ }
1000
+ }
1001
+ }
1002
+ exports.AguaceroCore = AguaceroCore;
1003
+ //# sourceMappingURL=AguaceroCore.js.map