@aguacerowx/react-native 0.0.52 → 0.0.54

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 (265) hide show
  1. package/LICENSE +21 -0
  2. package/android/src/main/cpp/satellite_ktx_jni.cpp +6 -1
  3. package/android/src/main/java/com/aguacerowx/reactnative/NexradRadarLayerView.java +14 -2
  4. package/android/src/main/java/com/aguacerowx/reactnative/SatelliteLayer.java +121 -1
  5. package/android/src/main/java/com/aguacerowx/reactnative/SatelliteLayerView.java +556 -392
  6. package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +77 -0
  7. package/index.js +1 -1
  8. package/ios/SatelliteLayerView.swift +517 -517
  9. package/ios/WeatherFrameProcessorModule.m +19 -15
  10. package/ios/WeatherFrameProcessorModule.swift +65 -0
  11. package/lib/commonjs/AguaceroContext.js +0 -4
  12. package/lib/commonjs/AguaceroContext.js.map +1 -1
  13. package/lib/commonjs/GridRenderLayer.js +62 -76
  14. package/lib/commonjs/GridRenderLayer.js.map +1 -1
  15. package/lib/commonjs/MapManager.js +110 -224
  16. package/lib/commonjs/MapManager.js.map +1 -1
  17. package/lib/commonjs/MapRegistry.js +21 -33
  18. package/lib/commonjs/MapRegistry.js.map +1 -1
  19. package/lib/commonjs/NexradRadarLayer.android.js +28 -100
  20. package/lib/commonjs/NexradRadarLayer.android.js.map +1 -1
  21. package/lib/commonjs/NexradRadarLayer.ios.js +26 -97
  22. package/lib/commonjs/NexradRadarLayer.ios.js.map +1 -1
  23. package/lib/commonjs/NexradSitesMapLayer.js +41 -61
  24. package/lib/commonjs/NexradSitesMapLayer.js.map +1 -1
  25. package/lib/commonjs/SatelliteLayer.android.js +26 -38
  26. package/lib/commonjs/SatelliteLayer.android.js.map +1 -1
  27. package/lib/commonjs/SatelliteLayer.ios.js +30 -42
  28. package/lib/commonjs/SatelliteLayer.ios.js.map +1 -1
  29. package/lib/commonjs/StyleApplicator.js +129 -175
  30. package/lib/commonjs/StyleApplicator.js.map +1 -1
  31. package/lib/commonjs/WeatherLayerManager.js +996 -1627
  32. package/lib/commonjs/WeatherLayerManager.js.map +1 -1
  33. package/lib/commonjs/aguaceroCoreDebugHooks.js +58 -130
  34. package/lib/commonjs/aguaceroCoreDebugHooks.js.map +1 -1
  35. package/lib/commonjs/aguaceroRnDebug.js +147 -287
  36. package/lib/commonjs/aguaceroRnDebug.js.map +1 -1
  37. package/lib/commonjs/cdnAuthenticatedFetch.js +104 -0
  38. package/lib/commonjs/cdnAuthenticatedFetch.js.map +1 -0
  39. package/lib/commonjs/dispatchViewManagerCommandCompat.js +51 -88
  40. package/lib/commonjs/dispatchViewManagerCommandCompat.js.map +1 -1
  41. package/lib/commonjs/gridCdnAuth.js +41 -50
  42. package/lib/commonjs/gridCdnAuth.js.map +1 -1
  43. package/lib/commonjs/index.js +51 -0
  44. package/lib/commonjs/index.js.map +1 -1
  45. package/lib/commonjs/nexrad/nexradAndroidController.js +851 -863
  46. package/lib/commonjs/nexrad/nexradAndroidController.js.map +1 -1
  47. package/lib/commonjs/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +62 -85
  48. package/lib/commonjs/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js.map +1 -1
  49. package/lib/commonjs/nexrad/nexradDiag.js +32 -148
  50. package/lib/commonjs/nexrad/nexradDiag.js.map +1 -1
  51. package/lib/commonjs/nexrad/nexradLevel2Keys.js +261 -0
  52. package/lib/commonjs/nexrad/nexradLevel2Keys.js.map +1 -0
  53. package/lib/commonjs/nexrad/nexradLutBuild.js +64 -111
  54. package/lib/commonjs/nexrad/nexradLutBuild.js.map +1 -1
  55. package/lib/commonjs/nexrad/nexradMapboxFrameOpts.bundled.js +136 -164
  56. package/lib/commonjs/nexrad/nexradMapboxFrameOpts.bundled.js.map +1 -1
  57. package/lib/commonjs/nexrad/nexradSdkImports.js +51 -0
  58. package/lib/commonjs/nexrad/nexradSdkImports.js.map +1 -0
  59. package/lib/commonjs/nexrad/radarArchiveCore.bundled.js +2848 -4455
  60. package/lib/commonjs/nexrad/radarArchiveCore.bundled.js.map +1 -1
  61. package/lib/commonjs/nexrad/radarDecode.worker.bundled.js +445 -648
  62. package/lib/commonjs/nexrad/radarDecode.worker.bundled.js.map +1 -1
  63. package/lib/commonjs/nexrad/radarFrameGpuMatch.bundled.js +52 -68
  64. package/lib/commonjs/nexrad/radarFrameGpuMatch.bundled.js.map +1 -1
  65. package/lib/commonjs/nexradNativeCommandIds.js +24 -0
  66. package/lib/commonjs/nexradNativeCommandIds.js.map +1 -0
  67. package/lib/commonjs/nws/NwsAlertsOverlay.android.js.map +1 -1
  68. package/lib/commonjs/nws/NwsAlertsOverlay.ios.js.map +1 -1
  69. package/lib/commonjs/nws/NwsAlertsOverlay.js +3 -3
  70. package/lib/commonjs/nws/NwsAlertsOverlay.js.map +1 -1
  71. package/lib/commonjs/nws/NwsAlertsOverlay.native.js +235 -361
  72. package/lib/commonjs/nws/NwsAlertsOverlay.native.js.map +1 -1
  73. package/lib/commonjs/nws/eventSourceRnPolyfill.js +92 -146
  74. package/lib/commonjs/nws/eventSourceRnPolyfill.js.map +1 -1
  75. package/lib/commonjs/nws/nwsAndroidConstants.js +2 -8
  76. package/lib/commonjs/nws/nwsAndroidConstants.js.map +1 -1
  77. package/lib/commonjs/satellite/satelliteAndroidController.js +122 -199
  78. package/lib/commonjs/satellite/satelliteAndroidController.js.map +1 -1
  79. package/lib/commonjs/satelliteBridgeDiag.js +3 -13
  80. package/lib/commonjs/satelliteBridgeDiag.js.map +1 -1
  81. package/lib/commonjs/satelliteRnDebug.js +160 -0
  82. package/lib/commonjs/satelliteRnDebug.js.map +1 -0
  83. package/lib/module/AguaceroContext.js +2 -7
  84. package/lib/module/AguaceroContext.js.map +1 -1
  85. package/lib/module/GridRenderLayer.js +66 -80
  86. package/lib/module/GridRenderLayer.js.map +1 -1
  87. package/lib/module/MapManager.js +125 -239
  88. package/lib/module/MapManager.js.map +1 -1
  89. package/lib/module/MapRegistry.js +21 -33
  90. package/lib/module/MapRegistry.js.map +1 -1
  91. package/lib/module/NexradRadarLayer.android.js +32 -104
  92. package/lib/module/NexradRadarLayer.android.js.map +1 -1
  93. package/lib/module/NexradRadarLayer.ios.js +30 -101
  94. package/lib/module/NexradRadarLayer.ios.js.map +1 -1
  95. package/lib/module/NexradSitesMapLayer.js +44 -63
  96. package/lib/module/NexradSitesMapLayer.js.map +1 -1
  97. package/lib/module/SatelliteLayer.android.js +32 -44
  98. package/lib/module/SatelliteLayer.android.js.map +1 -1
  99. package/lib/module/SatelliteLayer.ios.js +36 -48
  100. package/lib/module/SatelliteLayer.ios.js.map +1 -1
  101. package/lib/module/StyleApplicator.js +144 -191
  102. package/lib/module/StyleApplicator.js.map +1 -1
  103. package/lib/module/WeatherLayerManager.js +1024 -1655
  104. package/lib/module/WeatherLayerManager.js.map +1 -1
  105. package/lib/module/aguaceroCoreDebugHooks.js +59 -130
  106. package/lib/module/aguaceroCoreDebugHooks.js.map +1 -1
  107. package/lib/module/aguaceroRnDebug.js +151 -291
  108. package/lib/module/aguaceroRnDebug.js.map +1 -1
  109. package/lib/module/cdnAuthenticatedFetch.js +97 -0
  110. package/lib/module/cdnAuthenticatedFetch.js.map +1 -0
  111. package/lib/module/dispatchViewManagerCommandCompat.js +52 -90
  112. package/lib/module/dispatchViewManagerCommandCompat.js.map +1 -1
  113. package/lib/module/gridCdnAuth.js +38 -50
  114. package/lib/module/gridCdnAuth.js.map +1 -1
  115. package/lib/module/index.js +9 -6
  116. package/lib/module/index.js.map +1 -1
  117. package/lib/module/nexrad/nexradAndroidController.js +865 -876
  118. package/lib/module/nexrad/nexradAndroidController.js.map +1 -1
  119. package/lib/module/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +62 -85
  120. package/lib/module/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js.map +1 -1
  121. package/lib/module/nexrad/nexradDiag.js +31 -145
  122. package/lib/module/nexrad/nexradDiag.js.map +1 -1
  123. package/lib/module/nexrad/nexradLevel2Keys.js +245 -0
  124. package/lib/module/nexrad/nexradLevel2Keys.js.map +1 -0
  125. package/lib/module/nexrad/nexradLutBuild.js +64 -110
  126. package/lib/module/nexrad/nexradLutBuild.js.map +1 -1
  127. package/lib/module/nexrad/nexradMapboxFrameOpts.bundled.js +136 -163
  128. package/lib/module/nexrad/nexradMapboxFrameOpts.bundled.js.map +1 -1
  129. package/lib/module/nexrad/nexradSdkImports.js +4 -0
  130. package/lib/module/nexrad/nexradSdkImports.js.map +1 -0
  131. package/lib/module/nexrad/radarArchiveCore.bundled.js +2839 -4448
  132. package/lib/module/nexrad/radarArchiveCore.bundled.js.map +1 -1
  133. package/lib/module/nexrad/radarDecode.worker.bundled.js +445 -648
  134. package/lib/module/nexrad/radarDecode.worker.bundled.js.map +1 -1
  135. package/lib/module/nexrad/radarFrameGpuMatch.bundled.js +50 -66
  136. package/lib/module/nexrad/radarFrameGpuMatch.bundled.js.map +1 -1
  137. package/lib/module/nexradNativeCommandIds.js +18 -0
  138. package/lib/module/nexradNativeCommandIds.js.map +1 -0
  139. package/lib/module/nws/NwsAlertsOverlay.android.js +1 -1
  140. package/lib/module/nws/NwsAlertsOverlay.android.js.map +1 -1
  141. package/lib/module/nws/NwsAlertsOverlay.ios.js +1 -1
  142. package/lib/module/nws/NwsAlertsOverlay.ios.js.map +1 -1
  143. package/lib/module/nws/NwsAlertsOverlay.js +5 -5
  144. package/lib/module/nws/NwsAlertsOverlay.js.map +1 -1
  145. package/lib/module/nws/NwsAlertsOverlay.native.js +248 -373
  146. package/lib/module/nws/NwsAlertsOverlay.native.js.map +1 -1
  147. package/lib/module/nws/eventSourceRnPolyfill.js +92 -146
  148. package/lib/module/nws/eventSourceRnPolyfill.js.map +1 -1
  149. package/lib/module/nws/nwsAndroidConstants.js +2 -8
  150. package/lib/module/nws/nwsAndroidConstants.js.map +1 -1
  151. package/lib/module/satellite/satelliteAndroidController.js +125 -202
  152. package/lib/module/satellite/satelliteAndroidController.js.map +1 -1
  153. package/lib/module/satelliteBridgeDiag.js +3 -13
  154. package/lib/module/satelliteBridgeDiag.js.map +1 -1
  155. package/lib/module/satelliteRnDebug.js +148 -0
  156. package/lib/module/satelliteRnDebug.js.map +1 -0
  157. package/lib/typescript/AguaceroContext.d.ts +0 -4
  158. package/lib/typescript/AguaceroContext.d.ts.map +1 -1
  159. package/lib/typescript/GridRenderLayer.d.ts.map +1 -1
  160. package/lib/typescript/MapManager.d.ts +0 -12
  161. package/lib/typescript/MapManager.d.ts.map +1 -1
  162. package/lib/typescript/MapRegistry.d.ts +10 -12
  163. package/lib/typescript/MapRegistry.d.ts.map +1 -1
  164. package/lib/typescript/NexradRadarLayer.android.d.ts.map +1 -1
  165. package/lib/typescript/NexradRadarLayer.ios.d.ts.map +1 -1
  166. package/lib/typescript/NexradSitesMapLayer.d.ts +4 -10
  167. package/lib/typescript/NexradSitesMapLayer.d.ts.map +1 -1
  168. package/lib/typescript/SatelliteLayer.android.d.ts.map +1 -1
  169. package/lib/typescript/SatelliteLayer.ios.d.ts.map +1 -1
  170. package/lib/typescript/StyleApplicator.d.ts +1 -1
  171. package/lib/typescript/StyleApplicator.d.ts.map +1 -1
  172. package/lib/typescript/WeatherLayerManager.d.ts.map +1 -1
  173. package/lib/typescript/aguaceroCoreDebugHooks.d.ts +2 -9
  174. package/lib/typescript/aguaceroCoreDebugHooks.d.ts.map +1 -1
  175. package/lib/typescript/aguaceroRnDebug.d.ts +47 -66
  176. package/lib/typescript/aguaceroRnDebug.d.ts.map +1 -1
  177. package/lib/typescript/cdnAuthenticatedFetch.d.ts +10 -0
  178. package/lib/typescript/cdnAuthenticatedFetch.d.ts.map +1 -0
  179. package/lib/typescript/dispatchViewManagerCommandCompat.d.ts +1 -17
  180. package/lib/typescript/dispatchViewManagerCommandCompat.d.ts.map +1 -1
  181. package/lib/typescript/gridCdnAuth.d.ts +16 -21
  182. package/lib/typescript/gridCdnAuth.d.ts.map +1 -1
  183. package/lib/typescript/index.d.ts +2 -0
  184. package/lib/typescript/nexrad/nexradAndroidController.d.ts +39 -89
  185. package/lib/typescript/nexrad/nexradAndroidController.d.ts.map +1 -1
  186. package/lib/typescript/nexrad/nexradCrossSectionSampleAtLatLon.bundled.d.ts +2 -1
  187. package/lib/typescript/nexrad/nexradCrossSectionSampleAtLatLon.bundled.d.ts.map +1 -1
  188. package/lib/typescript/nexrad/nexradDiag.d.ts +13 -101
  189. package/lib/typescript/nexrad/nexradDiag.d.ts.map +1 -1
  190. package/lib/typescript/nexrad/nexradLevel2Keys.d.ts +36 -0
  191. package/lib/typescript/nexrad/nexradLevel2Keys.d.ts.map +1 -0
  192. package/lib/typescript/nexrad/nexradLutBuild.d.ts +3 -10
  193. package/lib/typescript/nexrad/nexradLutBuild.d.ts.map +1 -1
  194. package/lib/typescript/nexrad/nexradMapboxFrameOpts.bundled.d.ts +4 -3
  195. package/lib/typescript/nexrad/nexradMapboxFrameOpts.bundled.d.ts.map +1 -1
  196. package/lib/typescript/nexrad/nexradSdkImports.d.ts +2 -0
  197. package/lib/typescript/nexrad/nexradSdkImports.d.ts.map +1 -0
  198. package/lib/typescript/nexrad/radarArchiveCore.bundled.d.ts +12 -7
  199. package/lib/typescript/nexrad/radarArchiveCore.bundled.d.ts.map +1 -1
  200. package/lib/typescript/nexrad/radarDecode.worker.bundled.d.ts +20 -20
  201. package/lib/typescript/nexrad/radarDecode.worker.bundled.d.ts.map +1 -1
  202. package/lib/typescript/nexrad/radarFrameGpuMatch.bundled.d.ts +4 -3
  203. package/lib/typescript/nexrad/radarFrameGpuMatch.bundled.d.ts.map +1 -1
  204. package/lib/typescript/nexradNativeCommandIds.d.ts +2 -0
  205. package/lib/typescript/nexradNativeCommandIds.d.ts.map +1 -0
  206. package/lib/typescript/nws/NwsAlertsOverlay.native.d.ts +6 -17
  207. package/lib/typescript/nws/NwsAlertsOverlay.native.d.ts.map +1 -1
  208. package/lib/typescript/nws/eventSourceRnPolyfill.d.ts +0 -3
  209. package/lib/typescript/nws/eventSourceRnPolyfill.d.ts.map +1 -1
  210. package/lib/typescript/nws/nwsAndroidConstants.d.ts +0 -5
  211. package/lib/typescript/nws/nwsAndroidConstants.d.ts.map +1 -1
  212. package/lib/typescript/satellite/satelliteAndroidController.d.ts +9 -47
  213. package/lib/typescript/satellite/satelliteAndroidController.d.ts.map +1 -1
  214. package/lib/typescript/satelliteBridgeDiag.d.ts +1 -5
  215. package/lib/typescript/satelliteBridgeDiag.d.ts.map +1 -1
  216. package/lib/typescript/satelliteRnDebug.d.ts +75 -0
  217. package/lib/typescript/satelliteRnDebug.d.ts.map +1 -0
  218. package/package.json +75 -74
  219. package/src/AguaceroContext.js +1 -7
  220. package/src/GridRenderLayer.js +1 -128
  221. package/src/MapManager.js +1 -277
  222. package/src/MapRegistry.js +1 -56
  223. package/src/NexradRadarLayer.android.js +1 -121
  224. package/src/NexradRadarLayer.ios.js +1 -115
  225. package/src/NexradSitesMapLayer.js +1 -75
  226. package/src/SatelliteLayer.android.js +1 -63
  227. package/src/SatelliteLayer.ios.js +1 -70
  228. package/src/StyleApplicator.js +1 -241
  229. package/src/WeatherLayerManager.js +1 -2025
  230. package/src/aguaceroCoreDebugHooks.js +1 -142
  231. package/src/aguaceroRnDebug.js +1 -335
  232. package/src/cdnAuthenticatedFetch.js +1 -0
  233. package/src/dispatchViewManagerCommandCompat.js +1 -100
  234. package/src/gridCdnAuth.js +1 -56
  235. package/src/index.js +1 -19
  236. package/src/nexrad/nexradAndroidController.js +1 -1078
  237. package/src/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +1 -91
  238. package/src/nexrad/nexradDiag.js +1 -150
  239. package/src/nexrad/nexradLevel2Keys.js +1 -0
  240. package/src/nexrad/nexradLutBuild.js +1 -126
  241. package/src/nexrad/nexradMapboxFrameOpts.bundled.js +1 -245
  242. package/src/nexrad/nexradSdkImports.js +1 -0
  243. package/src/nexrad/radarArchiveCore.bundled.js +1 -7085
  244. package/src/nexrad/radarDecode.worker.bundled.js +1 -813
  245. package/src/nexrad/radarFrameGpuMatch.bundled.js +1 -79
  246. package/src/nexradNativeCommandIds.js +1 -0
  247. package/src/nws/NwsAlertsOverlay.android.js +1 -1
  248. package/src/nws/NwsAlertsOverlay.ios.js +1 -1
  249. package/src/nws/NwsAlertsOverlay.js +1 -7
  250. package/src/nws/NwsAlertsOverlay.native.js +1 -463
  251. package/src/nws/eventSourceRnPolyfill.js +7 -193
  252. package/src/nws/nwsAndroidConstants.js +1 -8
  253. package/src/satellite/satelliteAndroidController.js +1 -245
  254. package/src/satelliteBridgeDiag.js +1 -15
  255. package/src/satelliteRnDebug.js +1 -0
  256. package/lib/commonjs/nexrad/nexradNativeCommandIds.js +0 -51
  257. package/lib/commonjs/nexrad/nexradNativeCommandIds.js.map +0 -1
  258. package/lib/module/nexrad/nexradNativeCommandIds.js +0 -44
  259. package/lib/module/nexrad/nexradNativeCommandIds.js.map +0 -1
  260. package/lib/typescript/nexrad/nexradNativeCommandIds.d.ts +0 -9
  261. package/lib/typescript/nexrad/nexradNativeCommandIds.d.ts.map +0 -1
  262. package/src/nexrad/nexradNativeCommandIds.js +0 -44
  263. /package/lib/commonjs/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
  264. /package/lib/module/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
  265. /package/src/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.NexradAndroidController = void 0;
7
- var _javascriptSdk = require("@aguacerowx/javascript-sdk");
7
+ var _nexradSdkImports = require("./nexradSdkImports.js");
8
+ var _nexradLevel2Keys = require("./nexradLevel2Keys.js");
8
9
  var _base64Js = require("base64-js");
9
10
  var _radarArchiveCoreBundled = require("./radarArchiveCore.bundled.js");
11
+ var _gridCdnAuth = require("../gridCdnAuth");
10
12
  var _radarFrameGpuMatchBundled = require("./radarFrameGpuMatch.bundled.js");
11
13
  var _nexradMapboxFrameOptsBundled = require("./nexradMapboxFrameOpts.bundled.js");
12
14
  var _nexradCrossSectionSampleAtLatLonBundled = require("./nexradCrossSectionSampleAtLatLon.bundled.js");
@@ -14,10 +16,6 @@ var _nexradLutBuild = require("./nexradLutBuild.js");
14
16
  var _reactNative = require("react-native");
15
17
  var _nexradDiag = require("./nexradDiag.js");
16
18
  var _aguaceroRnDebug = require("../aguaceroRnDebug");
17
- /**
18
- * AguaceroCore NEXRAD → Android native custom layer (parity with mapsgl {@link NexradWeatherController}).
19
- */
20
-
21
19
  (0, _nexradDiag.nexradDiagBootSnapshot)({
22
20
  archiveExports: {
23
21
  setNexradArchiveApiKey: typeof _radarArchiveCoreBundled.setNexradArchiveApiKey,
@@ -26,1006 +24,996 @@ var _aguaceroRnDebug = require("../aguaceroRnDebug");
26
24
  fetchAndParseArchive: typeof _radarArchiveCoreBundled.fetchAndParseArchive
27
25
  }
28
26
  });
29
-
30
- /** @returns {boolean} */
31
- function ensureRadarArchiveBindings(label) {
32
- const ok = typeof _radarArchiveCoreBundled.setNexradArchiveApiKey === 'function' && typeof _radarArchiveCoreBundled.setNexradArchiveBundleId === 'function' && typeof _radarArchiveCoreBundled.objectKeyToUrl === 'function' && typeof _radarArchiveCoreBundled.fetchAndParseArchive === 'function';
33
- return ok;
27
+ function q(c) {
28
+ return typeof _radarArchiveCoreBundled.setNexradArchiveApiKey == "function" && typeof _radarArchiveCoreBundled.setNexradArchiveBundleId == "function" && typeof _radarArchiveCoreBundled.objectKeyToUrl == "function" && typeof _radarArchiveCoreBundled.fetchAndParseArchive == "function";
34
29
  }
35
- function pickNearestLevel3ObjectKey(unixTime, timeToKeyMap, maxDeltaSec = 600) {
36
- const direct = timeToKeyMap[String(unixTime)];
37
- if (direct) return direct;
38
- const entries = Object.entries(timeToKeyMap || {});
39
- if (entries.length === 0) return null;
40
- let bestKey = null;
41
- let bestDelta = Infinity;
42
- for (const [tStr, key] of entries) {
43
- const t = Number(tStr);
44
- if (!Number.isFinite(t)) continue;
45
- const d = Math.abs(t - unixTime);
46
- if (d < bestDelta) {
47
- bestDelta = d;
48
- bestKey = key;
49
- }
50
- }
51
- if (bestKey == null) return null;
52
- if (bestDelta > maxDeltaSec && Number.isFinite(maxDeltaSec)) return null;
53
- return bestKey;
30
+ function me(c, e, t = 600) {
31
+ const a = e[String(c)];
32
+ if (a) return a;
33
+ const n = Object.entries(e || {});
34
+ if (n.length === 0) return null;
35
+ let i = null,
36
+ r = 1 / 0;
37
+ for (const [s, l] of n) {
38
+ const o = Number(s);
39
+ if (!Number.isFinite(o)) continue;
40
+ const m = Math.abs(o - c);
41
+ m < r && (r = m, i = l);
42
+ }
43
+ return i == null || r > t && Number.isFinite(t) ? null : i;
54
44
  }
55
- function isVelocityStyleRadarVar(radarVariable) {
56
- return radarVariable === 'VEL' || radarVariable === 'SW' || radarVariable === 'N0G' || radarVariable === 'N0W';
45
+ function U(c) {
46
+ return c === "VEL" || c === "SW" || c === "N0G" || c === "N0W";
57
47
  }
58
- function velocityRangeToMs(rangeMin, rangeMax, displayUnit) {
59
- if (rangeMin == null || rangeMax == null || !displayUnit || displayUnit.toLowerCase() === 'm/s' || displayUnit.toLowerCase() === 'ms') {
60
- return [rangeMin, rangeMax];
61
- }
62
- const toMs = (0, _javascriptSdk.getUnitConversionFunction)(displayUnit, 'm/s', 'nexrad_vel');
63
- if (!toMs) return [rangeMin, rangeMax];
64
- return [toMs(rangeMin), toMs(rangeMax)];
48
+ function pe(c, e, t) {
49
+ if (c == null || e == null || !t || t.toLowerCase() === "m/s" || t.toLowerCase() === "ms") return [c, e];
50
+ const a = (0, _nexradSdkImports.getUnitConversionFunction)(t, "m/s", "nexrad_vel");
51
+ return a ? [a(c), a(e)] : [c, e];
65
52
  }
66
- function colormapToMs(colormap, radarVariable, displayUnit) {
67
- if (!colormap || !Array.isArray(colormap) || colormap.length < 2) return colormap;
68
- if (!isVelocityStyleRadarVar(radarVariable)) return colormap;
69
- if (!displayUnit || displayUnit.toLowerCase() === 'm/s' || displayUnit.toLowerCase() === 'ms') return colormap;
70
- const toMs = (0, _javascriptSdk.getUnitConversionFunction)(displayUnit, 'm/s', radarVariable === 'SW' || radarVariable === 'N0W' ? 'nexrad_sw' : 'nexrad_vel');
71
- if (!toMs) return colormap;
72
- const out = [...colormap];
73
- for (let i = 0; i < out.length; i += 2) {
74
- const v = out[i];
75
- if (typeof v === 'number' && Number.isFinite(v)) out[i] = toMs(v);
76
- }
77
- return out;
53
+ function ye(c, e, t) {
54
+ if (!c || !Array.isArray(c) || c.length < 2 || !U(e) || !t || t.toLowerCase() === "m/s" || t.toLowerCase() === "ms") return c;
55
+ const a = (0, _nexradSdkImports.getUnitConversionFunction)(t, "m/s", e === "SW" || e === "N0W" ? "nexrad_sw" : "nexrad_vel");
56
+ if (!a) return c;
57
+ const n = [...c];
58
+ for (let i = 0; i < n.length; i += 2) {
59
+ const r = n[i];
60
+ typeof r == "number" && Number.isFinite(r) && (n[i] = a(r));
61
+ }
62
+ return n;
78
63
  }
79
- function radarShaderValueRange(rangeMin, rangeMax, radarVariable, units, nexradDataSource) {
80
- const v = (radarVariable || '').toUpperCase();
81
- if (isVelocityStyleRadarVar(v)) {
82
- const [vmin, vmax] = velocityRangeToMs(rangeMin, rangeMax, units);
83
- return [vmin ?? 0, vmax ?? 80];
84
- }
85
- if (nexradDataSource === 'level3' && (v === 'N0H' || v === 'HHC')) {
86
- const lo = rangeMin ?? 0;
87
- let hi = rangeMax ?? 11;
88
- if (hi > 11) hi = 11;
89
- if (hi < lo) hi = lo;
90
- return [lo, hi];
91
- }
92
- if (v === 'KDP') {
93
- const lo = rangeMin ?? -2;
94
- let hi = rangeMax ?? 8;
95
- if (hi < lo) hi = lo;
96
- return [lo, hi];
97
- }
98
- return [rangeMin ?? 0, rangeMax ?? 80];
64
+ function ge(c, e, t, a, n) {
65
+ const i = (t || "").toUpperCase();
66
+ if (U(i)) {
67
+ const [r, s] = pe(c, e, a);
68
+ return [r ?? 0, s ?? 80];
69
+ }
70
+ if (n === "level3" && (i === "N0H" || i === "HHC")) {
71
+ const r = c ?? 0;
72
+ let s = e ?? 11;
73
+ return s > 11 && (s = 11), s < r && (s = r), [r, s];
74
+ }
75
+ if (i === "KDP") {
76
+ const r = c ?? -2;
77
+ let s = e ?? 8;
78
+ return s < r && (s = r), [r, s];
79
+ }
80
+ return [c ?? 0, e ?? 80];
99
81
  }
100
- function nexradLevel3IsHydrometeorClassification(radarVariable) {
101
- const v = (radarVariable || '').toUpperCase();
102
- return v === 'N0H' || v === 'HHC';
82
+ function fe(c) {
83
+ const e = (c || "").toUpperCase();
84
+ return e === "N0H" || e === "HHC";
103
85
  }
104
- const NEXRAD_HYDROMETEOR_CLASS_LABELS = ['Biological', 'Ground clutter', 'Ice crystals', 'Dry snow', 'Wet snow', 'Light rain', 'Heavy rain', 'Big drops', 'Graupel', 'Hail/rain', 'Large hail', 'Giant hail'];
105
- function nexradHydrometeorLabelForClassIndex(value) {
106
- const idx = Math.round(Number(value));
107
- if (idx >= 12) return null;
108
- if (idx >= 0 && idx < NEXRAD_HYDROMETEOR_CLASS_LABELS.length) {
109
- return NEXRAD_HYDROMETEOR_CLASS_LABELS[idx];
110
- }
111
- return `Class ${idx}`;
86
+ const Y = ["Biological", "Ground clutter", "Ice crystals", "Dry snow", "Wet snow", "Light rain", "Heavy rain", "Big drops", "Graupel", "Hail/rain", "Large hail", "Giant hail"];
87
+ function xe(c) {
88
+ const e = Math.round(Number(c));
89
+ return e >= 12 ? null : e >= 0 && e < Y.length ? Y[e] : `Class ${e}`;
112
90
  }
113
- function velocityMsToDisplay(valueMs, displayUnit) {
114
- if (!displayUnit || displayUnit.toLowerCase() === 'm/s' || displayUnit.toLowerCase() === 'ms') {
115
- return valueMs;
116
- }
117
- const fromMs = (0, _javascriptSdk.getUnitConversionFunction)('m/s', displayUnit, 'nexrad_vel');
118
- return fromMs ? fromMs(valueMs) : valueMs;
91
+ function ve(c, e) {
92
+ if (!e || e.toLowerCase() === "m/s" || e.toLowerCase() === "ms") return c;
93
+ const t = (0, _nexradSdkImports.getUnitConversionFunction)("m/s", e, "nexrad_vel");
94
+ return t ? t(c) : c;
119
95
  }
120
- function beamHeightKm(slantRangeKm, elevDeg) {
121
- const el = elevDeg * Math.PI / 180;
122
- const ReKm = 6371000 * 4 / (3 * 1000);
123
- const cosEl = Math.max(Math.cos(el), 0.05);
124
- const s = slantRangeKm / cosEl;
125
- return Math.sqrt(s * s + ReKm * ReKm + 2 * s * ReKm * Math.sin(el)) - ReKm;
96
+ function _e(c, e) {
97
+ const t = e * Math.PI / 180,
98
+ a = 6371e3 * 4 / (3 * 1e3),
99
+ n = Math.max(Math.cos(t), .05),
100
+ i = c / n;
101
+ return Math.sqrt(i * i + a * a + 2 * i * a * Math.sin(t)) - a;
126
102
  }
127
- function formatNexradInspectNumeric(raw, radarVariable) {
128
- const vu = (radarVariable || '').toUpperCase();
129
- const vl = radarVariable || '';
130
- if (vu.includes('RATE') || vl.toLowerCase().includes('rate')) {
131
- return Number(raw.toFixed(3).replace(/\.?0+$/, ''));
132
- }
133
- if (vu === 'RHO' || vu === 'ZDR' || vl.includes('RhoHV') || vl.includes('Zdr')) {
134
- return Number(raw.toFixed(2));
135
- }
136
- if (Math.abs(raw) < 10) return Number(raw.toFixed(1));
137
- return Math.round(raw);
103
+ function Se(c, e) {
104
+ const t = (e || "").toUpperCase(),
105
+ a = e || "";
106
+ return t.includes("RATE") || a.toLowerCase().includes("rate") ? Number(c.toFixed(3).replace(/\.?0+$/, "")) : t === "RHO" || t === "ZDR" || a.includes("RhoHV") || a.includes("Zdr") ? Number(c.toFixed(2)) : Math.abs(c) < 10 ? Number(c.toFixed(1)) : Math.round(c);
138
107
  }
139
-
140
- /** Keep low so Level-2 decode stays off the critical path for touches/animations (was 4). */
141
- /** iOS Metal uploads benefit from overlapping fetches; keep Android at 1 for steadier radio/CPU. */
142
- const PRELOAD_CONCURRENCY = _reactNative.Platform.OS === 'ios' ? 2 : 1;
143
- function yieldToJsEventLoop() {
144
- return new Promise(resolve => setTimeout(resolve, 0));
108
+ const be = _reactNative.Platform.OS === "ios" ? 2 : 1;
109
+ function M() {
110
+ return new Promise(c => setTimeout(c, 0));
145
111
  }
146
-
147
- /** Match mapsgl {@link MapboxRadarLayer} geometry LRU — reuse serialized native payloads when scrubbing. */
148
- const NATIVE_UPLOAD_JSON_LRU_MAX = 12;
149
- function rleCompressGateData(gateData) {
150
- const len = gateData.length;
151
- const out = new Uint8Array(len * 2);
152
- let outIdx = 0;
153
- let i = 0;
154
- while (i < len) {
155
- let val0 = gateData[i];
156
- let val1 = gateData[i + 1];
157
- let count = 1;
158
- let maxCount = len - i >> 1;
159
- if (maxCount > 65535) maxCount = 65535;
160
- let j = i + 2;
161
- while (count < maxCount && gateData[j] === val0 && gateData[j + 1] === val1) {
162
- count++;
163
- j += 2;
164
- }
165
- out[outIdx++] = count & 0xFF;
166
- out[outIdx++] = count >> 8 & 0xFF;
167
- out[outIdx++] = val0;
168
- out[outIdx++] = val1;
169
- i = j;
170
- }
171
- return out.subarray(0, outIdx);
112
+ const Ne = 12;
113
+ function Te(c) {
114
+ const e = c.length,
115
+ t = new Uint8Array(e * 2);
116
+ let a = 0,
117
+ n = 0;
118
+ for (; n < e;) {
119
+ let i = c[n],
120
+ r = c[n + 1],
121
+ s = 1,
122
+ l = e - n >> 1;
123
+ l > 65535 && (l = 65535);
124
+ let o = n + 2;
125
+ for (; s < l && c[o] === i && c[o + 1] === r;) s++, o += 2;
126
+ t[a++] = s & 255, t[a++] = s >> 8 & 255, t[a++] = i, t[a++] = r, n = o;
127
+ }
128
+ return t.subarray(0, a);
172
129
  }
173
130
  class NexradAndroidController {
174
- /**
175
- * @param {*} core - AguaceroCore instance
176
- * @param {React.MutableRefObject<{ uploadNexradFrame?: (s: string) => void; uploadNexradStyleOnly?: (s: string) => void; clearNexrad?: () => void; activateNexradCachedFrame?: (k: string) => void } | null>} layerRef
177
- * @param {object} [options]
178
- */
179
- constructor(core, layerRef, options = {}) {
180
- this.core = core;
181
- this._layerRef = layerRef;
182
- this._lastSyncKey = null;
183
- this._abort = null;
184
- this._interpolateColormap = options.interpolateNexradColormap !== false;
185
- this._gateSmoothing = options.nexradGateSmoothing === true;
186
- this._frameCache = new Map();
187
- /** WeakMap: decoded frame → Map(uploadOptsKey → prepared frame). Avoids O(n²) canonical re-bin every map move. */
188
- this._gpuReadoutPrep = new WeakMap();
189
- this._preloadAbort = null;
190
- this._preloadTimelineSig = null;
191
- this._nativeFrameUploaded = false;
192
- /** @type {{ valueScale: number; valueOffset: number } | null} */
193
- this._lastUploadMeta = null;
194
- /** @type {Map<string, { json: string; valueScale: number; valueOffset: number }>} */
195
- this._nativeUploadJsonLru = new Map();
196
- /** @type {Set<string>} Sync keys with gate texture registered in Android GL cache (AguaceroNexradGpuFrameReady). */
197
- this._nativeGpuReadyKeys = new Set();
198
- /** @type {Map<string, { valueScale: number; valueOffset: number }>} */
199
- this._uploadMetaBySyncKey = new Map();
200
- /** @type {{ remove: () => void } | null} */
201
- this._gpuReadyEventSub = null;
131
+ constructor(e, t, a = {}) {
132
+ this.core = e, this._layerRef = t, this._lastSyncKey = null, this._abort = null, this._interpolateColormap = a.interpolateNexradColormap !== !1, this._gateSmoothing = a.nexradGateSmoothing === !0, this._frameCache = new Map(), this._gpuReadoutPrep = new WeakMap(), this._preloadAbort = null, this._preloadTimelineSig = null, this._listingRefreshPromise = null, this._nativeFrameUploaded = !1, this._lastUploadMeta = null, this._nativeUploadJsonLru = new Map(), this._nativeGpuReadyKeys = new Set(), this._uploadMetaBySyncKey = new Map(), this._gpuReadyEventSub = null;
202
133
  try {
203
134
  const {
204
- DeviceEventEmitter
205
- } = require('react-native');
206
- if (DeviceEventEmitter && typeof DeviceEventEmitter.addListener === 'function') {
207
- this._gpuReadyEventSub = DeviceEventEmitter.addListener('AguaceroNexradGpuFrameReady', e => {
208
- const k = e && e.nativeGpuCacheKey;
209
- if (typeof k === 'string' && k.length > 0) {
210
- this._nativeGpuReadyKeys.add(k);
211
- this._trimNativeGpuReadyKeys(96);
212
- }
213
- });
214
- }
215
- } catch (err) {
216
- /* ignore */
217
- }
218
- const base = typeof core?.baseGridUrl === 'string' ? core.baseGridUrl.replace(/\/$/, '') : '';
219
- if (base && typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
220
- (0, _radarArchiveCoreBundled.setNexradSitesJsonUrl)(`${base}/data/nexrad.json`);
221
- (0, _radarArchiveCoreBundled.setNexradSitesFetchAuth)(core.apiKey || '', core.bundleId || '');
222
- }
223
- (0, _radarArchiveCoreBundled.setNexradArchiveSiteOrigin)(core.gridRequestSiteOrigin || 'https://localhost');
224
- if ((0, _aguaceroRnDebug.isAguaceroRnDebugEnabled)()) {
225
- (0, _aguaceroRnDebug.aguaceroDebug)('nexrad.authConfigured', (0, _aguaceroRnDebug.getAguaceroAuthDiagnosticSnapshot)(core, {
226
- phase: 'NexradAndroidController.constructor'
135
+ DeviceEventEmitter: i
136
+ } = require("react-native");
137
+ i && typeof i.addListener == "function" && (this._gpuReadyEventSub = i.addListener("AguaceroNexradGpuFrameReady", r => {
138
+ const s = r && r.nativeGpuCacheKey;
139
+ typeof s == "string" && s.length > 0 && (this._nativeGpuReadyKeys.add(s), this._trimNativeGpuReadyKeys(96));
227
140
  }));
228
- }
141
+ } catch {}
142
+ const n = typeof e?.baseGridUrl == "string" ? e.baseGridUrl.replace(/\/$/, "") : "";
143
+ n && typeof navigator < "u" && navigator.product === "ReactNative" && ((0, _radarArchiveCoreBundled.setNexradSitesJsonUrl)(`${n}/data/nexrad.json`), (0, _radarArchiveCoreBundled.setNexradSitesFetchAuth)(e.apiKey || "", e.bundleId || "")), (0, _radarArchiveCoreBundled.setNexradArchiveApiKey)(e.apiKey || ""), (0, _radarArchiveCoreBundled.setNexradArchiveBundleId)(e.bundleId || ""), (0, _radarArchiveCoreBundled.setNexradArchiveSiteOrigin)(e.gridRequestSiteOrigin || _gridCdnAuth.RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN), (0, _radarArchiveCoreBundled.setNexradArchiveUserId)(e.nexradUserId || "sdk-user"), (0, _aguaceroRnDebug.isAguaceroRnDebugEnabled)() && (0, _aguaceroRnDebug.aguaceroDebug)("nexrad.authConfigured", {
144
+ ...(0, _radarArchiveCoreBundled.getNexradArchiveAuthSnapshot)({
145
+ phase: "NexradAndroidController.constructor"
146
+ }),
147
+ ...(0, _aguaceroRnDebug.getAguaceroAuthDiagnosticSnapshot)(e, {
148
+ phase: "NexradAndroidController.constructor"
149
+ })
150
+ });
229
151
  }
230
- _trimNativeGpuReadyKeys(max) {
231
- while (this._nativeGpuReadyKeys.size > max) {
232
- const first = this._nativeGpuReadyKeys.values().next().value;
233
- if (first === undefined) break;
234
- this._nativeGpuReadyKeys.delete(first);
152
+ _trimNativeGpuReadyKeys(e) {
153
+ for (; this._nativeGpuReadyKeys.size > e;) {
154
+ const t = this._nativeGpuReadyKeys.values().next().value;
155
+ if (t === void 0) break;
156
+ this._nativeGpuReadyKeys.delete(t);
235
157
  }
236
158
  }
237
- _rememberUploadMetaForSyncKey(syncKey, valueScale, valueOffset) {
238
- this._uploadMetaBySyncKey.set(syncKey, {
239
- valueScale,
240
- valueOffset
241
- });
242
- while (this._uploadMetaBySyncKey.size > 40) {
243
- const k = this._uploadMetaBySyncKey.keys().next().value;
244
- if (k === undefined) break;
245
- this._uploadMetaBySyncKey.delete(k);
159
+ _rememberUploadMetaForSyncKey(e, t, a) {
160
+ for (this._uploadMetaBySyncKey.set(e, {
161
+ valueScale: t,
162
+ valueOffset: a
163
+ }); this._uploadMetaBySyncKey.size > 40;) {
164
+ const n = this._uploadMetaBySyncKey.keys().next().value;
165
+ if (n === void 0) break;
166
+ this._uploadMetaBySyncKey.delete(n);
246
167
  }
247
168
  }
248
- updateStyleOptions(options) {
249
- if (options.interpolateNexradColormap != null) {
250
- this._interpolateColormap = options.interpolateNexradColormap !== false;
251
- }
252
- if (options.nexradGateSmoothing != null) {
253
- this._gateSmoothing = options.nexradGateSmoothing === true;
254
- }
169
+ updateStyleOptions(e) {
170
+ e.interpolateNexradColormap != null && (this._interpolateColormap = e.interpolateNexradColormap !== !1), e.nexradGateSmoothing != null && (this._gateSmoothing = e.nexradGateSmoothing === !0);
255
171
  }
256
172
  destroy() {
257
173
  try {
258
174
  this._gpuReadyEventSub?.remove();
259
- } catch (_) {
260
- /* ignore */
261
- }
262
- this._gpuReadyEventSub = null;
263
- this._nativeGpuReadyKeys.clear();
264
- this._uploadMetaBySyncKey.clear();
265
- this._abort?.abort();
266
- this._abort = null;
267
- this._preloadAbort?.abort();
268
- this._preloadAbort = null;
269
- this._frameCache.clear();
270
- this._gpuReadoutPrep = new WeakMap();
271
- this._preloadTimelineSig = null;
272
- this._lastSyncKey = null;
273
- this._nativeFrameUploaded = false;
274
- this._lastUploadMeta = null;
275
- this._nativeUploadJsonLru.clear();
276
- this._layerRef?.current?.clearNexrad?.();
175
+ } catch {}
176
+ this._gpuReadyEventSub = null, this._nativeGpuReadyKeys.clear(), this._uploadMetaBySyncKey.clear(), this._abort?.abort(), this._abort = null, this._preloadAbort?.abort(), this._preloadAbort = null, this._frameCache.clear(), this._gpuReadoutPrep = new WeakMap(), this._preloadTimelineSig = null, this._lastSyncKey = null, this._nativeFrameUploaded = !1, this._lastUploadMeta = null, this._nativeUploadJsonLru.clear(), this._layerRef?.current?.clearNexrad?.();
277
177
  }
278
- _getPreparedReadoutFrame(frame, uploadOpts) {
279
- let byOpts = this._gpuReadoutPrep.get(frame);
280
- if (!byOpts) {
281
- byOpts = new Map();
282
- this._gpuReadoutPrep.set(frame, byOpts);
283
- }
284
- const optKey = uploadOpts && typeof uploadOpts === 'object' ? JSON.stringify(uploadOpts) : String(uploadOpts);
285
- let prepared = byOpts.get(optKey);
286
- if (!prepared) {
287
- prepared = (0, _radarFrameGpuMatchBundled.prepareRadarFrameForGpuReadout)(frame, uploadOpts);
288
- byOpts.set(optKey, prepared);
289
- }
290
- return prepared;
178
+ _getPreparedReadoutFrame(e, t) {
179
+ let a = this._gpuReadoutPrep.get(e);
180
+ a || (a = new Map(), this._gpuReadoutPrep.set(e, a));
181
+ const n = t && typeof t == "object" ? JSON.stringify(t) : String(t);
182
+ let i = a.get(n);
183
+ return i || (i = (0, _radarFrameGpuMatchBundled.prepareRadarFrameForGpuReadout)(e, t), a.set(n, i)), i;
291
184
  }
292
185
  _native() {
293
186
  return this._layerRef?.current;
294
187
  }
295
- _lutPack(state) {
296
- const radarVar = (state.nexradProduct || 'REF').toUpperCase();
297
- const colormapFlat = state.colormap;
298
- const colormapForShader = colormapToMs(colormapFlat, radarVar, state.units);
299
- const [shaderMin, shaderMax] = radarShaderValueRange(colormapFlat?.[0], colormapFlat?.[colormapFlat.length - 2], radarVar, state.units, state.nexradDataSource);
300
- const {
301
- bytes,
302
- discreteIntegerLut
303
- } = (0, _nexradLutBuild.buildNexradLutRgba)(colormapForShader, shaderMin, shaderMax, this._interpolateColormap);
188
+ _lutPack(e) {
189
+ const t = (e.nexradProduct || "REF").toUpperCase(),
190
+ a = e.colormap,
191
+ n = ye(a, t, e.units),
192
+ [i, r] = ge(a?.[0], a?.[a.length - 2], t, e.units, e.nexradDataSource),
193
+ {
194
+ bytes: s,
195
+ discreteIntegerLut: l
196
+ } = (0, _nexradLutBuild.buildNexradLutRgba)(n, i, r, this._interpolateColormap);
304
197
  return {
305
- lutB64: (0, _base64Js.fromByteArray)(bytes),
306
- lutMin: shaderMin,
307
- lutMax: shaderMax,
308
- discreteIntegerLut
198
+ lutB64: (0, _base64Js.fromByteArray)(s),
199
+ lutMin: i,
200
+ lutMax: r,
201
+ discreteIntegerLut: l
309
202
  };
310
203
  }
311
-
312
- /**
313
- * LRU for full native JSON payloads (parity with mapsgl gate-texture reuse — avoids base64 + stringify on repeat scrubs).
314
- * @param {string} syncKey
315
- * @returns {{ json: string; valueScale: number; valueOffset: number } | null}
316
- */
317
- _nativeUploadJsonLruTouch(syncKey) {
318
- const ent = this._nativeUploadJsonLru.get(syncKey);
319
- if (!ent) return null;
320
- this._nativeUploadJsonLru.delete(syncKey);
321
- this._nativeUploadJsonLru.set(syncKey, ent);
322
- return ent;
323
- }
324
-
325
- /** @param {string} syncKey @param {{ json: string; valueScale: number; valueOffset: number }} entry */
326
- _nativeUploadJsonLruPut(syncKey, entry) {
327
- if (this._nativeUploadJsonLru.has(syncKey)) this._nativeUploadJsonLru.delete(syncKey);
328
- this._nativeUploadJsonLru.set(syncKey, entry);
329
- while (this._nativeUploadJsonLru.size > NATIVE_UPLOAD_JSON_LRU_MAX) {
330
- const oldest = this._nativeUploadJsonLru.keys().next().value;
331
- if (oldest === undefined) break;
332
- this._nativeUploadJsonLru.delete(oldest);
333
- }
334
- }
335
-
336
- /**
337
- * Full-frame JSON includes LUT + opacity + shader toggles; keep LRU key aligned so scrubbing
338
- * cannot resurrect an outdated style after the user changes only presentation options.
339
- */
340
- _nativeUploadLruKey(state, syncKey) {
341
- return `${syncKey}|o:${state.opacity ?? 1}|g:${this._gateSmoothing ? 1 : 0}|i:${this._interpolateColormap ? 1 : 0}`;
342
- }
343
-
344
- /**
345
- * After JS decoded a frame into `_frameCache`, optionally push it through the native bridge.
346
- * During timeline preload we **only** upload the **currently displayed** unix to Metal; other
347
- * volumes stay in the JS cache until {@link sync} needs them (avoids 40+ full decodes on load).
348
- */
349
- _primeNativeGpuUploadIfNeeded(snapshot, unix, p, frame, abortSignal) {
350
- if (!frame || !p || abortSignal && abortSignal.aborted) return;
351
- try {
352
- const displayUx = snapshot.nexradTimestamp != null && Number.isFinite(Number(snapshot.nexradTimestamp)) ? Number(snapshot.nexradTimestamp) : NaN;
353
- if (Number.isFinite(displayUx) && Number(unix) !== displayUx) {
354
- return;
355
- }
356
- const syncKey = this._syncIdentity(snapshot, p, unix);
357
- if (this._nativeGpuReadyKeys.has(syncKey)) {
358
- return;
359
- }
360
- if (!this._native()?.uploadNexradFrame) {
361
- return;
362
- }
363
- this._uploadFrameToNative(snapshot, frame, p, unix);
364
- } catch (err) {
365
- /* ignore */
366
- }
367
- }
368
-
369
- /**
370
- * @param {*} state
371
- * @param {*} frame - decoded archive frame
372
- * @param {{ fetchKey: string }} p - from {@link _buildFetchParamsForUnix}
373
- * @param {number} unix
374
- */
375
- _uploadFrameToNative(state, frame, p, unix) {
376
- const uploadTotal = (0, _nexradDiag.nexradPerfSpan)(`uploadFrame.total site=${state.nexradSite} unix=${unix} var=${p?.radarVar ?? state.nexradProduct}`);
377
- const n = this._native();
378
- if (!n?.uploadNexradFrame) {
379
- uploadTotal.end({
380
- outcome: 'skippedNoNative'
204
+ _nativeUploadJsonLruTouch(e) {
205
+ const t = this._nativeUploadJsonLru.get(e);
206
+ return t ? (this._nativeUploadJsonLru.delete(e), this._nativeUploadJsonLru.set(e, t), t) : null;
207
+ }
208
+ _nativeUploadJsonLruPut(e, t) {
209
+ for (this._nativeUploadJsonLru.has(e) && this._nativeUploadJsonLru.delete(e), this._nativeUploadJsonLru.set(e, t); this._nativeUploadJsonLru.size > Ne;) {
210
+ const a = this._nativeUploadJsonLru.keys().next().value;
211
+ if (a === void 0) break;
212
+ this._nativeUploadJsonLru.delete(a);
213
+ }
214
+ }
215
+ _nativeUploadLruKey(e, t) {
216
+ return `${t}|o:${e.opacity ?? 1}|g:${this._gateSmoothing ? 1 : 0}|i:${this._interpolateColormap ? 1 : 0}`;
217
+ }
218
+ _primeNativeGpuUploadIfNeeded(e, t, a, n, i) {
219
+ if (!(!n || !a || i && i.aborted)) try {
220
+ const r = e.nexradTimestamp != null && Number.isFinite(Number(e.nexradTimestamp)) ? Number(e.nexradTimestamp) : NaN;
221
+ if (Number.isFinite(r) && Number(t) !== r) return;
222
+ const s = this._syncIdentity(e, a, t);
223
+ if (this._nativeGpuReadyKeys.has(s) || !this._native()?.uploadNexradFrame) return;
224
+ this._uploadFrameToNative(e, n, a, t);
225
+ } catch {}
226
+ }
227
+ _uploadFrameToNative(e, t, a, n) {
228
+ const i = (0, _nexradDiag.nexradPerfSpan)(`uploadFrame.total site=${e.nexradSite} unix=${n} var=${a?.radarVar ?? e.nexradProduct}`),
229
+ r = this._native();
230
+ if (!r?.uploadNexradFrame) {
231
+ (0, _nexradDiag.nexradPipelineLog)("upload.skip", {
232
+ reason: "noNativeUploadMethod",
233
+ site: e.nexradSite,
234
+ unix: n,
235
+ layerRefSet: !!this._layerRef?.current
236
+ }), i.end({
237
+ outcome: "skippedNoNative"
381
238
  });
382
239
  return;
383
240
  }
384
- const syncKey = this._syncIdentity(state, p, unix);
385
- const lruKey = this._nativeUploadLruKey(state, syncKey);
386
- const lruHit = this._nativeUploadJsonLruTouch(lruKey);
387
- if (lruHit) {
388
- this._lastUploadMeta = {
389
- valueScale: lruHit.valueScale,
390
- valueOffset: lruHit.valueOffset
391
- };
392
- this._rememberUploadMetaForSyncKey(syncKey, lruHit.valueScale, lruHit.valueOffset);
393
- if (n.activateNexradCachedFrame && this._nativeGpuReadyKeys.has(syncKey)) {
394
- const tAct = (0, _nexradDiag.nexradPerfSpan)('uploadFrame.nativeGpuActivateOnly');
395
- n.activateNexradCachedFrame(syncKey);
396
- tAct.end({
397
- keyLen: syncKey.length
241
+ const s = this._syncIdentity(e, a, n),
242
+ l = this._nativeUploadLruKey(e, s),
243
+ o = this._nativeUploadJsonLruTouch(l);
244
+ if (o) {
245
+ if (this._lastUploadMeta = {
246
+ valueScale: o.valueScale,
247
+ valueOffset: o.valueOffset
248
+ }, this._rememberUploadMetaForSyncKey(s, o.valueScale, o.valueOffset), r.activateNexradCachedFrame && this._nativeGpuReadyKeys.has(s)) {
249
+ const K = (0, _nexradDiag.nexradPerfSpan)("uploadFrame.nativeGpuActivateOnly");
250
+ r.activateNexradCachedFrame(s), K.end({
251
+ keyLen: s.length
398
252
  });
399
- const tStyle = (0, _nexradDiag.nexradPerfSpan)('uploadFrame.styleAfterGpuActivate');
400
- this.applyStyleFromState(state);
401
- tStyle.end({});
402
- this._nativeFrameUploaded = true;
403
- uploadTotal.end({
404
- outcome: 'gpuActivateOnly',
405
- jsonCharsSkipped: lruHit.json.length
253
+ const Z = (0, _nexradDiag.nexradPerfSpan)("uploadFrame.styleAfterGpuActivate");
254
+ this.applyStyleFromState(e), Z.end({}), this._nativeFrameUploaded = !0, i.end({
255
+ outcome: "gpuActivateOnly",
256
+ jsonCharsSkipped: o.json.length
406
257
  });
407
258
  return;
408
259
  }
409
- const bridge = (0, _nexradDiag.nexradPerfSpan)('uploadFrame.nativeJsonLru.bridgeDispatch');
410
- n.uploadNexradFrame(lruHit.json);
411
- bridge.end({
412
- jsonChars: lruHit.json.length,
413
- path: 'jsonLruHit'
414
- });
415
- this._nativeFrameUploaded = true;
416
- uploadTotal.end({
417
- outcome: 'jsonLruHit',
418
- jsonChars: lruHit.json.length
260
+ const A = (0, _nexradDiag.nexradPerfSpan)("uploadFrame.nativeJsonLru.bridgeDispatch");
261
+ r.uploadNexradFrame(o.json), A.end({
262
+ jsonChars: o.json.length,
263
+ path: "jsonLruHit"
264
+ }), this._nativeFrameUploaded = !0, i.end({
265
+ outcome: "jsonLruHit",
266
+ jsonChars: o.json.length
419
267
  });
420
268
  return;
421
269
  }
422
- const tOpts = (0, _nexradDiag.nexradPerfSpan)('uploadFrame.mapboxFrameUploadOptions');
423
- const uploadOpts = (0, _nexradMapboxFrameOptsBundled.mapboxFrameUploadOptionsForNexradState)(state);
424
- tOpts.end({});
425
-
426
- // Skip JS sorting for Android native upload
427
- // We pass the raw frame and let Android do the sorting/canonicalization
428
- const rawFrame = frame;
270
+ const m = (0, _nexradDiag.nexradPerfSpan)("uploadFrame.mapboxFrameUploadOptions"),
271
+ u = (0, _nexradMapboxFrameOptsBundled.mapboxFrameUploadOptionsForNexradState)(e);
272
+ m.end({});
273
+ const d = t;
429
274
  this._lastUploadMeta = {
430
- valueScale: rawFrame.valueScale,
431
- valueOffset: rawFrame.valueOffset
275
+ valueScale: d.valueScale,
276
+ valueOffset: d.valueOffset
432
277
  };
433
- const tLut = (0, _nexradDiag.nexradPerfSpan)('uploadFrame.lutPack_buildNexradLutRgba');
434
- const style = this._lutPack(state);
435
- tLut.end({
436
- lutB64Chars: style.lutB64?.length ?? 0,
437
- discreteIntegerLut: style.discreteIntegerLut,
438
- lutMin: style.lutMin,
439
- lutMax: style.lutMax
278
+ const N = (0, _nexradDiag.nexradPerfSpan)("uploadFrame.lutPack_buildNexradLutRgba"),
279
+ p = this._lutPack(e);
280
+ N.end({
281
+ lutB64Chars: p.lutB64?.length ?? 0,
282
+ discreteIntegerLut: p.discreteIntegerLut,
283
+ lutMin: p.lutMin,
284
+ lutMax: p.lutMax
440
285
  });
441
- const tRay = (0, _nexradDiag.nexradPerfSpan)('uploadFrame.rayBoundariesToJsArray');
442
- const rayBoundaries = rawFrame.rayBoundariesDeg?.slice ? Array.from(rawFrame.rayBoundariesDeg) : [...(rawFrame.rayBoundariesDeg || [])];
443
- tRay.end({
444
- len: rayBoundaries.length
286
+ const F = (0, _nexradDiag.nexradPerfSpan)("uploadFrame.rayBoundariesToJsArray"),
287
+ g = d.rayBoundariesDeg?.slice ? Array.from(d.rayBoundariesDeg) : [...(d.rayBoundariesDeg || [])];
288
+ F.end({
289
+ len: g.length
445
290
  });
446
- const tB64 = (0, _nexradDiag.nexradPerfSpan)('uploadFrame.gateData_toBase64');
447
- const rleGateData = rleCompressGateData(rawFrame.gateData);
448
- const gateB64 = (0, _base64Js.fromByteArray)(rleGateData);
449
- tB64.end({
450
- gateB64Chars: gateB64.length,
451
- rleBytes: rleGateData.length,
452
- rawBytes: rawFrame.gateData.length
453
- });
454
- const payload = {
455
- gateB64,
456
- gateIsRle: true,
457
- nGates: rawFrame.nGates,
458
- nRays: rawFrame.nRays,
459
- stationLat: rawFrame.stationLat,
460
- stationLon: rawFrame.stationLon,
461
- firstGateKm: rawFrame.firstGateKm,
462
- gateWidthKm: rawFrame.gateWidthKm,
463
- rayBoundaries,
464
- lutB64: style.lutB64,
465
- valueScale: rawFrame.valueScale,
466
- valueOffset: rawFrame.valueOffset,
467
- lutMin: style.lutMin,
468
- lutMax: style.lutMax,
469
- discreteIntegerLut: style.discreteIntegerLut,
470
- opacity: state.opacity ?? 1,
471
- gateSmoothPolar: this._gateSmoothing ? 1 : 0,
472
- interpolateLut: this._interpolateColormap ? 1 : 0,
473
- nativeGpuCacheKey: syncKey,
474
- uploadOpts: uploadOpts
475
- };
476
- const tJson = (0, _nexradDiag.nexradPerfSpan)('uploadFrame.JSON_stringify_payload');
477
- const json = JSON.stringify(payload);
478
- tJson.end({
479
- jsonChars: json.length,
480
- rayBoundaryLen: rayBoundaries.length
291
+ const f = (0, _nexradDiag.nexradPerfSpan)("uploadFrame.gateData_toBase64"),
292
+ _ = Te(d.gateData),
293
+ C = (0, _base64Js.fromByteArray)(_);
294
+ f.end({
295
+ gateB64Chars: C.length,
296
+ rleBytes: _.length,
297
+ rawBytes: d.gateData.length
481
298
  });
482
- const tLruPut = (0, _nexradDiag.nexradPerfSpan)('uploadFrame.nativeUploadJsonLruPut');
483
- this._nativeUploadJsonLruPut(lruKey, {
484
- json,
485
- valueScale: rawFrame.valueScale,
486
- valueOffset: rawFrame.valueOffset
299
+ const x = {
300
+ gateB64: C,
301
+ gateIsRle: !0,
302
+ nGates: d.nGates,
303
+ nRays: d.nRays,
304
+ stationLat: d.stationLat,
305
+ stationLon: d.stationLon,
306
+ firstGateKm: d.firstGateKm,
307
+ gateWidthKm: d.gateWidthKm,
308
+ rayBoundaries: g,
309
+ lutB64: p.lutB64,
310
+ valueScale: d.valueScale,
311
+ valueOffset: d.valueOffset,
312
+ lutMin: p.lutMin,
313
+ lutMax: p.lutMax,
314
+ discreteIntegerLut: p.discreteIntegerLut ? 1 : 0,
315
+ opacity: e.opacity ?? 1,
316
+ gateSmoothPolar: this._gateSmoothing ? 1 : 0,
317
+ interpolateLut: this._interpolateColormap ? 1 : 0,
318
+ nativeGpuCacheKey: s,
319
+ uploadOpts: u
320
+ },
321
+ S = (0, _nexradDiag.nexradPerfSpan)("uploadFrame.JSON_stringify_payload"),
322
+ v = JSON.stringify(x);
323
+ S.end({
324
+ jsonChars: v.length,
325
+ rayBoundaryLen: g.length
487
326
  });
488
- tLruPut.end({
489
- lruKeyTail: lruKey.slice(-96),
327
+ const b = (0, _nexradDiag.nexradPerfSpan)("uploadFrame.nativeUploadJsonLruPut");
328
+ this._nativeUploadJsonLruPut(l, {
329
+ json: v,
330
+ valueScale: d.valueScale,
331
+ valueOffset: d.valueOffset
332
+ }), b.end({
333
+ lruKeyTail: l.slice(-96),
490
334
  lruSize: this._nativeUploadJsonLru.size
491
335
  });
492
- const gateSummary = (0, _nexradDiag.nexradDiagGateTextureSummary)(rawFrame.gateData, rawFrame.nGates, rawFrame.nRays, rawFrame.valueScale, rawFrame.valueOffset, style.lutMin, style.lutMax);
493
- const tBridge = (0, _nexradDiag.nexradPerfSpan)('uploadFrame.nativeBridge_uploadNexradFrame');
494
- n.uploadNexradFrame(json);
495
- tBridge.end({
496
- jsonChars: json.length,
497
- path: 'fullRebuild'
498
- });
499
- this._rememberUploadMetaForSyncKey(syncKey, rawFrame.valueScale, rawFrame.valueOffset);
500
- this._nativeFrameUploaded = true;
501
- uploadTotal.end({
502
- outcome: 'fullPipeline',
503
- jsonChars: json.length,
504
- nGates: rawFrame.nGates,
505
- nRays: rawFrame.nRays
336
+ const T = (0, _nexradDiag.nexradDiagGateTextureSummary)(d.gateData, d.nGates, d.nRays, d.valueScale, d.valueOffset, p.lutMin, p.lutMax),
337
+ P = (0, _nexradDiag.nexradPerfSpan)("uploadFrame.nativeBridge_uploadNexradFrame");
338
+ r.uploadNexradFrame(v), P.end({
339
+ jsonChars: v.length,
340
+ path: "fullRebuild"
341
+ }), this._rememberUploadMetaForSyncKey(s, d.valueScale, d.valueOffset), this._nativeFrameUploaded = !0, i.end({
342
+ outcome: "fullPipeline",
343
+ jsonChars: v.length,
344
+ nGates: d.nGates,
345
+ nRays: d.nRays
506
346
  });
507
347
  }
508
- applyStyleFromState(state) {
509
- const perf = (0, _nexradDiag.nexradPerfSpan)(`applyStyleFromState site=${state.nexradSite} product=${state.nexradProduct} tilt=${state.nexradTilt}`);
510
- const n = this._native();
511
- if (!this._nativeFrameUploaded || !this._lastUploadMeta || !n?.uploadNexradStyleOnly) {
512
- perf.end({
513
- outcome: 'skipped',
348
+ applyStyleFromState(e) {
349
+ const t = (0, _nexradDiag.nexradPerfSpan)(`applyStyleFromState site=${e.nexradSite} product=${e.nexradProduct} tilt=${e.nexradTilt}`),
350
+ a = this._native();
351
+ if (!this._nativeFrameUploaded || !this._lastUploadMeta || !a?.uploadNexradStyleOnly) {
352
+ t.end({
353
+ outcome: "skipped",
514
354
  nativeFrameUploaded: this._nativeFrameUploaded,
515
355
  hasUploadMeta: !!this._lastUploadMeta,
516
- hasStyleMethod: !!n?.uploadNexradStyleOnly
356
+ hasStyleMethod: !!a?.uploadNexradStyleOnly
517
357
  });
518
358
  return;
519
359
  }
520
- const tLut = (0, _nexradDiag.nexradPerfSpan)('applyStyleFromState.lutPack');
521
- const style = this._lutPack(state);
522
- tLut.end({
523
- lutB64Chars: style.lutB64?.length ?? 0
524
- });
525
- const payload = {
526
- lutB64: style.lutB64,
527
- valueScale: this._lastUploadMeta.valueScale,
528
- valueOffset: this._lastUploadMeta.valueOffset,
529
- lutMin: style.lutMin,
530
- lutMax: style.lutMax,
531
- discreteIntegerLut: style.discreteIntegerLut,
532
- opacity: state.opacity ?? 1,
533
- gateSmoothPolar: this._gateSmoothing ? 1 : 0,
534
- interpolateLut: this._interpolateColormap ? 1 : 0
535
- };
536
- const tJson = (0, _nexradDiag.nexradPerfSpan)('applyStyleFromState.JSON_stringify');
537
- const json = JSON.stringify(payload);
538
- tJson.end({
539
- jsonChars: json.length
360
+ const n = (0, _nexradDiag.nexradPerfSpan)("applyStyleFromState.lutPack"),
361
+ i = this._lutPack(e);
362
+ n.end({
363
+ lutB64Chars: i.lutB64?.length ?? 0
540
364
  });
541
- const tBridge = (0, _nexradDiag.nexradPerfSpan)('applyStyleFromState.nativeBridge');
542
- n.uploadNexradStyleOnly(json);
543
- tBridge.end({
544
- jsonChars: json.length
365
+ const r = {
366
+ lutB64: i.lutB64,
367
+ valueScale: this._lastUploadMeta.valueScale,
368
+ valueOffset: this._lastUploadMeta.valueOffset,
369
+ lutMin: i.lutMin,
370
+ lutMax: i.lutMax,
371
+ discreteIntegerLut: i.discreteIntegerLut ? 1 : 0,
372
+ opacity: e.opacity ?? 1,
373
+ gateSmoothPolar: this._gateSmoothing ? 1 : 0,
374
+ interpolateLut: this._interpolateColormap ? 1 : 0
375
+ },
376
+ s = (0, _nexradDiag.nexradPerfSpan)("applyStyleFromState.JSON_stringify"),
377
+ l = JSON.stringify(r);
378
+ s.end({
379
+ jsonChars: l.length
545
380
  });
546
- perf.end({
547
- outcome: 'dispatched'
381
+ const o = (0, _nexradDiag.nexradPerfSpan)("applyStyleFromState.nativeBridge");
382
+ a.uploadNexradStyleOnly(l), o.end({
383
+ jsonChars: l.length
384
+ }), t.end({
385
+ outcome: "dispatched"
548
386
  });
549
387
  }
550
- _resolveListingContext(state) {
551
- const nk = this.core._nexradTimesCacheKey?.();
552
- const ent = nk ? this.core.nexradTimesByStation?.[nk] : null;
553
- // Merge so we still resolve object keys if the last state event omitted maps but the core cache is populated.
554
- const timeToKeyMap = {
555
- ...(ent?.timeToKeyMap || {}),
556
- ...(state.nexradTimeToKeyMap || {})
557
- };
558
- const motionMap = {
559
- ...(ent?.level3MotionTimeToKeyMap || {}),
560
- ...(state.nexradLevel3MotionTimeToKeyMap || {})
388
+ _resolveListingContext(e) {
389
+ const {
390
+ site: t,
391
+ elevNorm: a,
392
+ group: n
393
+ } = (0, _nexradLevel2Keys.listingContextParams)(e),
394
+ i = (e?.nexradDataSource || "level2") !== "level3" && t ? `${t}_${n}_${a}` : this.core._nexradTimesCacheKey?.(),
395
+ r = i ? this.core.nexradTimesByStation?.[i] : null,
396
+ s = e?.nexradTimeToKeyMap && typeof e.nexradTimeToKeyMap == "object" ? e.nexradTimeToKeyMap : {};
397
+ let l = r?.timeToKeyMap && typeof r.timeToKeyMap == "object" ? {
398
+ ...s,
399
+ ...r.timeToKeyMap
400
+ } : {
401
+ ...s
561
402
  };
403
+ const o = r?.level2Clens,
404
+ m = Array.isArray(r?.unixTimes) && r.unixTimes.length > 0 ? r.unixTimes : Array.isArray(e?.availableNexradTimestamps) && e.availableNexradTimestamps.length > 0 ? e.availableNexradTimestamps : void 0;
405
+ if (this._nexradRadarSource(e) === "level2" && o && typeof o == "object" && Object.keys(o).length > 0) {
406
+ const d = (0, _nexradLevel2Keys.rebuildLevel2TimeToKeyMap)({
407
+ stationId: t,
408
+ elevNorm: a,
409
+ group: n,
410
+ timeToKeyMap: l,
411
+ level2Clens: o,
412
+ unixTimes: m
413
+ });
414
+ Object.keys(d).length > 0 ? l = d : Object.keys(l).length > 0 && (l = Object.fromEntries(Object.entries(l).filter(([, N]) => (0, _nexradLevel2Keys.isValidLevel2SweepObjectKey)(N))));
415
+ } else this._nexradRadarSource(e) === "level2" && (l = Object.fromEntries(Object.entries(l).filter(([, d]) => (0, _nexradLevel2Keys.isValidLevel2SweepObjectKey)(d))));
416
+ const u = r?.level3MotionTimeToKeyMap || {};
562
417
  return {
563
- nk,
564
- ent,
565
- timeToKeyMap,
566
- motionMap
418
+ nk: i,
419
+ ent: r,
420
+ timeToKeyMap: l,
421
+ motionMap: u
567
422
  };
568
423
  }
569
- _buildFetchParamsForUnix(state, unix) {
570
- const radarVar = (state.nexradProduct || 'REF').toUpperCase();
571
- const radarSource = state.nexradDataSource === 'level3' ? 'level3' : 'level2';
572
- const groupId = (0, _javascriptSdk.nexradBinGroupIdForKey)((0, _javascriptSdk.variableToNexradGroup)(radarVar));
424
+ _nexradStateWithCoreListing(e) {
573
425
  const {
574
- timeToKeyMap,
575
- motionMap
576
- } = this._resolveListingContext(state);
577
- const objectKey = timeToKeyMap[String(unix)];
578
- if (!objectKey) {
579
- return null;
580
- }
581
- let motionObjectKey = null;
582
- if (radarVar === 'VEL' && state.nexradStormRelative) {
583
- motionObjectKey = pickNearestLevel3ObjectKey(unix, motionMap);
426
+ site: t,
427
+ elevNorm: a,
428
+ group: n
429
+ } = (0, _nexradLevel2Keys.listingContextParams)(e),
430
+ i = (e?.nexradDataSource || "level2") !== "level3" && t ? `${t}_${n}_${a}` : this.core._nexradTimesCacheKey?.(),
431
+ r = i ? this.core.nexradTimesByStation?.[i] : null;
432
+ if (!r) return e;
433
+ const s = Array.isArray(r.unixTimes) ? r.unixTimes : [],
434
+ {
435
+ timeToKeyMap: l
436
+ } = this._resolveListingContext(e),
437
+ o = this.core._getFilteredNexradTimestampsForVariable(s),
438
+ m = this._nexradRadarSource(e) === "level2" ? o.filter(d => (0, _nexradLevel2Keys.isValidLevel2SweepObjectKey)(l[String(d)])) : o.filter(d => typeof l[String(d)] == "string" && l[String(d)].length > 0);
439
+ let u = e.nexradTimestamp != null ? e.nexradTimestamp : this.core.state.nexradTimestamp != null ? this.core.state.nexradTimestamp : null;
440
+ return u == null && m.length > 0 && (u = m[m.length - 1]), {
441
+ ...e,
442
+ availableNexradTimestamps: m,
443
+ nexradTimeToKeyMap: l,
444
+ nexradLevel3MotionTimeToKeyMap: r.level3MotionTimeToKeyMap || {},
445
+ nexradTimestamp: u
446
+ };
447
+ }
448
+ async _ensureLevel2ListingReady(e) {
449
+ if (this._nexradRadarSource(e) !== "level2") return;
450
+ if (this._listingRefreshPromise) {
451
+ await this._listingRefreshPromise;
452
+ return;
584
453
  }
585
- const url = (0, _radarArchiveCoreBundled.objectKeyToUrl)(objectKey, radarSource);
586
- const fetchKey = `${url}|${radarVar}|${radarSource}|${motionObjectKey || ''}`;
454
+ const t = () => this.core._nexradTimesCacheKey?.(),
455
+ a = () => t() ? this.core.nexradTimesByStation?.[t()] : null;
456
+ (0, _nexradLevel2Keys.level2ListingCacheNeedsRefresh)(a()) && (this._listingRefreshPromise = (async () => {
457
+ try {
458
+ await this.core.refreshNexradTimes();
459
+ let n = a();
460
+ if ((0, _nexradLevel2Keys.level2ListingCacheNeedsRefresh)(n)) {
461
+ const s = await (0, _nexradLevel2Keys.fetchAndApplyLevel2ListingToCore)(this.core, this.core.state, {
462
+ siteOrigin: this.core.gridRequestSiteOrigin || ""
463
+ });
464
+ if (n = a(), !s) {
465
+ (0, _nexradDiag.nexradPipelineLog)("listing.patchFailed", {
466
+ site: e.nexradSite,
467
+ cacheKey: t()
468
+ });
469
+ return;
470
+ }
471
+ if (n?.level2ListingEmpty) {
472
+ (0, _nexradDiag.nexradPipelineLog)("listing.empty", {
473
+ site: e.nexradSite,
474
+ cacheKey: t(),
475
+ hint: (0, _nexradLevel2Keys.level2ListingEmptyHint)(e.nexradSite)
476
+ });
477
+ return;
478
+ }
479
+ }
480
+ const i = n?.timeToKeyMap || {},
481
+ r = Object.values(i).find(s => typeof s == "string" && s.length > 0);
482
+ (0, _nexradDiag.nexradPipelineLog)("listing.refreshed", {
483
+ site: e.nexradSite,
484
+ product: e.nexradProduct,
485
+ tilt: e.nexradTilt,
486
+ cacheKey: t(),
487
+ clensEntries: Object.keys(n?.level2Clens || {}).length,
488
+ mappedTimes: Object.keys(i).length,
489
+ sampleKeyTail: typeof r == "string" ? r.slice(-72) : r
490
+ });
491
+ } catch (n) {
492
+ (0, _nexradDiag.nexradPipelineLog)("listing.refreshFailed", {
493
+ site: e.nexradSite,
494
+ message: n?.message || String(n)
495
+ });
496
+ } finally {
497
+ this._listingRefreshPromise = null;
498
+ }
499
+ })(), await this._listingRefreshPromise);
500
+ }
501
+ _logListingDiag(e, t, a, n = {}) {
502
+ const {
503
+ nk: i,
504
+ ent: r,
505
+ timeToKeyMap: s,
506
+ motionMap: l
507
+ } = this._resolveListingContext(t),
508
+ o = Object.keys(s || {}),
509
+ m = a != null ? s[String(a)] : void 0;
510
+ (0, _nexradDiag.nexradPipelineLog)(e, {
511
+ site: t.nexradSite,
512
+ product: t.nexradProduct,
513
+ tilt: t.nexradTilt,
514
+ radarSource: this._nexradRadarSource(t),
515
+ unix: a,
516
+ listingCacheKey: i,
517
+ coreListingPresent: !!r,
518
+ stateMapEntries: Object.keys(t.nexradTimeToKeyMap || {}).length,
519
+ mergedMapEntries: o.length,
520
+ motionMapEntries: Object.keys(l || {}).length,
521
+ availableUnixCount: Array.isArray(t.availableNexradTimestamps) ? t.availableNexradTimestamps.length : 0,
522
+ hasObjectKeyForUnix: a != null && Object.prototype.hasOwnProperty.call(s, String(a)),
523
+ objectKeyTail: typeof m == "string" ? m.slice(-72) : m,
524
+ sampleMapEntries: o.slice(0, 4).map(u => ({
525
+ unix: u,
526
+ keyTail: String(s[u] || "").slice(-56)
527
+ })),
528
+ nativeLayerReady: !!this._native()?.uploadNexradFrame,
529
+ ...n
530
+ });
531
+ }
532
+ _nexradRadarSource(e) {
533
+ return e.nexradDataSource === "level3" ? "level3" : "level2";
534
+ }
535
+ _buildFetchParamsForUnix(e, t, a = {}) {
536
+ const n = a.logDiag !== !1,
537
+ i = (e.nexradProduct || "REF").toUpperCase(),
538
+ r = this._nexradRadarSource(e),
539
+ s = (0, _nexradSdkImports.nexradBinGroupIdForKey)((0, _nexradSdkImports.variableToNexradGroup)(i)),
540
+ {
541
+ ent: l,
542
+ timeToKeyMap: o,
543
+ motionMap: m
544
+ } = this._resolveListingContext(e),
545
+ u = o[String(t)];
546
+ if (!u) return n && this._logListingDiag("fetchParams.missingObjectKey", e, t, {
547
+ radarVar: i
548
+ }), null;
549
+ const d = r === "level2" ? (0, _nexradLevel2Keys.resolveLevel2ObjectKeyForFetch)({
550
+ state: e,
551
+ listingEntry: l,
552
+ unix: t,
553
+ radarVar: i,
554
+ rawKey: u
555
+ }) : u;
556
+ if (!d) return n && (0, _nexradDiag.nexradPipelineLog)("fetchParams.invalidLevel2ObjectKey", {
557
+ site: e.nexradSite,
558
+ unix: t,
559
+ rawKeyTail: String(u).slice(-72),
560
+ hasLevel2Clens: !!(l?.level2Clens && Object.keys(l.level2Clens).length)
561
+ }), null;
562
+ let N = null;
563
+ i === "VEL" && e.nexradStormRelative && (N = me(t, m));
564
+ const p = (0, _radarArchiveCoreBundled.objectKeyToUrl)(d, r),
565
+ F = `${p}|${i}|${r}|${N || ""}`;
587
566
  return {
588
- objectKey,
589
- url,
590
- fetchKey,
591
- motionObjectKey,
592
- radarVar,
593
- radarSource,
594
- groupId
567
+ objectKey: d,
568
+ url: p,
569
+ fetchKey: F,
570
+ motionObjectKey: N,
571
+ radarVar: i,
572
+ radarSource: r,
573
+ groupId: s
595
574
  };
596
575
  }
597
- async _fetchFrame(state, unix, {
598
- signal,
599
- priority
576
+ async _fetchFrame(e, t, {
577
+ signal: a,
578
+ priority: n
600
579
  }) {
601
- const fetchPerf = (0, _nexradDiag.nexradPerfSpan)(`fetchAndParseArchive priority=${priority} site=${state.nexradSite} unix=${unix} product=${state.nexradProduct}`);
602
- const p = this._buildFetchParamsForUnix(state, unix);
603
- if (!p) {
604
- fetchPerf.end({
605
- ok: false,
606
- reason: 'noFetchParams'
607
- });
608
- return null;
609
- }
580
+ const i = (0, _nexradDiag.nexradPerfSpan)(`fetchAndParseArchive priority=${n} site=${e.nexradSite} unix=${t} product=${e.nexradProduct}`),
581
+ r = this._buildFetchParamsForUnix(e, t);
582
+ if (!r) return i.end({
583
+ ok: !1,
584
+ reason: "noFetchParams"
585
+ }), null;
586
+ (0, _nexradDiag.nexradPipelineLog)("fetch.start", {
587
+ priority: n,
588
+ site: e.nexradSite,
589
+ unix: t,
590
+ radarVar: r.radarVar,
591
+ radarSource: r.radarSource,
592
+ url: r.url?.replace(/([?&])apiKey=[^&]*/gi, "$1apiKey=(redacted)"),
593
+ objectKeyTail: (r.objectKey || "").slice(-72),
594
+ motionKeyTail: (r.motionObjectKey || "").slice(-48)
595
+ });
610
596
  try {
611
- const frame = await (0, _radarArchiveCoreBundled.fetchAndParseArchive)(p.url, p.objectKey, p.radarVar, p.groupId, p.radarSource, {
612
- signal,
613
- priority,
614
- level3MotionObjectKey: p.motionObjectKey
615
- });
616
- fetchPerf.end({
617
- ok: !!frame,
618
- radarVar: p.radarVar,
619
- radarSource: p.radarSource,
620
- objectKeyTail: (p.objectKey || '').slice(-48),
621
- motionKeyTail: (p.motionObjectKey || '').slice(-48)
622
- });
623
- return frame;
624
- } catch (err) {
625
- fetchPerf.end({
626
- ok: false,
627
- error: err?.message || String(err),
628
- radarVar: p.radarVar,
629
- radarSource: p.radarSource
630
- });
631
- throw err;
597
+ const s = await (0, _radarArchiveCoreBundled.fetchAndParseArchive)(r.url, r.objectKey, r.radarVar, r.groupId, r.radarSource, {
598
+ signal: a,
599
+ priority: n,
600
+ level3MotionObjectKey: r.motionObjectKey
601
+ }),
602
+ l = {
603
+ ok: !!s,
604
+ radarVar: r.radarVar,
605
+ radarSource: r.radarSource,
606
+ objectKeyTail: (r.objectKey || "").slice(-48),
607
+ motionKeyTail: (r.motionObjectKey || "").slice(-48)
608
+ };
609
+ return s && (l.nGates = s.nGates, l.nRays = s.nRays, l.gateBytes = s.gateData?.length ?? 0), i.end(l), (0, _nexradDiag.nexradPipelineLog)(s ? "fetch.ok" : "fetch.emptyFrame", l), s;
610
+ } catch (s) {
611
+ const l = {
612
+ ok: !1,
613
+ error: s?.message || String(s),
614
+ radarVar: r.radarVar,
615
+ radarSource: r.radarSource,
616
+ objectKeyTail: (r.objectKey || "").slice(-48)
617
+ };
618
+ throw i.end(l), (0, _nexradDiag.nexradPipelineLog)("fetch.error", l), s;
632
619
  }
633
620
  }
634
- _preloadTimelineSignature(state) {
635
- const nk = this.core._nexradTimesCacheKey?.() || '';
636
- const ts = [...(state.availableNexradTimestamps || [])].map(Number).filter(t => Number.isFinite(t)).sort((a, b) => a - b).join(',');
637
- const tilt = state.nexradTilt != null && Number.isFinite(Number(state.nexradTilt)) ? Number(state.nexradTilt).toFixed(3) : '';
638
- return `${nk}|${ts}|sr:${state.nexradStormRelative ? 1 : 0}|tilt:${tilt}`;
621
+ _preloadTimelineSignature(e) {
622
+ const t = this.core._nexradTimesCacheKey?.() || "",
623
+ a = [...(e.availableNexradTimestamps || [])].map(Number).filter(i => Number.isFinite(i)).sort((i, r) => i - r).join(","),
624
+ n = e.nexradTilt != null && Number.isFinite(Number(e.nexradTilt)) ? Number(e.nexradTilt).toFixed(3) : "";
625
+ return `${t}|${a}|sr:${e.nexradStormRelative ? 1 : 0}|tilt:${n}`;
639
626
  }
640
- _syncIdentity(state, p, unix) {
641
- const tilt = state.nexradTilt != null && Number.isFinite(Number(state.nexradTilt)) ? Number(state.nexradTilt).toFixed(3) : '';
642
- return `${p.fetchKey}|tilt:${tilt}|u:${unix}`;
627
+ _syncIdentity(e, t, a) {
628
+ const n = e.nexradTilt != null && Number.isFinite(Number(e.nexradTilt)) ? Number(e.nexradTilt).toFixed(3) : "";
629
+ return `${t.fetchKey}|tilt:${n}|u:${a}`;
643
630
  }
644
- preloadAllAvailable(state) {
645
- if (!state.isNexrad || !state.nexradSite) return;
646
- if (!ensureRadarArchiveBindings('preloadAllAvailable')) return;
647
- const times = [...(state.availableNexradTimestamps || [])].map(Number).filter(t => Number.isFinite(t));
648
- if (!times.length) {
649
- // Important: do not touch `_preloadTimelineSig` or the frame cache here — callers
650
- // sometimes pass `core.state` before `availableNexradTimestamps` is committed; an
651
- // empty list must not poison the signature or wipe the LRU (see WeatherLayerManager
652
- // preload kick merging subscription snapshot).
631
+ async preloadAllAvailable(e) {
632
+ if (!e.isNexrad || !e.nexradSite) {
633
+ (0, _nexradDiag.nexradPipelineLog)("preload.skip", {
634
+ reason: "notNexradOrNoSite",
635
+ isNexrad: e.isNexrad,
636
+ site: e.nexradSite
637
+ });
653
638
  return;
654
639
  }
655
- const sig = this._preloadTimelineSignature(state);
656
- if (sig === this._preloadTimelineSig) {
640
+ if (!q("preloadAllAvailable")) {
641
+ (0, _nexradDiag.nexradPipelineLog)("preload.skip", {
642
+ reason: "missingArchiveBindings",
643
+ site: e.nexradSite
644
+ });
657
645
  return;
658
646
  }
659
- this._preloadTimelineSig = sig;
660
- this._preloadAbort?.abort();
661
- this._preloadAbort = new AbortController();
662
- const signal = this._preloadAbort.signal;
663
-
664
- // Keep the volume currently on screen in the JS cache so getInspectPayload (mapsgl parity readouts)
665
- // still works while we clear and rebuild the prefetch LRU — otherwise readouts stay null until
666
- // this unix is fetched again (often last in the timeline).
667
- const curUnix = state.nexradTimestamp != null && Number.isFinite(Number(state.nexradTimestamp)) ? Number(state.nexradTimestamp) : NaN;
668
-
669
- // Keep frames that are still in the new timeline (or the currently displayed one)
670
- // to avoid re-fetching them when expanding the duration window.
671
- const validFetchKeys = new Set();
672
- for (const unix of times) {
673
- const p = this._buildFetchParamsForUnix(state, unix);
674
- if (p) validFetchKeys.add(p.fetchKey);
647
+ let t = e;
648
+ if ([...(t.availableNexradTimestamps || [])].length || (await this._ensureLevel2ListingReady(t), t = this._nexradStateWithCoreListing(t)), ![...(t.availableNexradTimestamps || [])].length) {
649
+ (0, _nexradDiag.nexradPipelineLog)("preload.skip", {
650
+ reason: "noAvailableTimestamps",
651
+ site: t.nexradSite,
652
+ product: t.nexradProduct,
653
+ hint: "Listing empty after refreshNexradTimes"
654
+ });
655
+ return;
675
656
  }
676
- const curP = Number.isFinite(curUnix) ? this._buildFetchParamsForUnix(state, curUnix) : null;
677
- if (curP) validFetchKeys.add(curP.fetchKey);
678
- for (const key of this._frameCache.keys()) {
679
- if (!validFetchKeys.has(key)) {
680
- this._frameCache.delete(key);
681
- }
657
+ await this._ensureLevel2ListingReady(t), t = this._nexradStateWithCoreListing(t);
658
+ const a = [...(t.availableNexradTimestamps || [])].map(Number).filter(g => Number.isFinite(g));
659
+ if (!a.length) {
660
+ (0, _nexradDiag.nexradPipelineLog)("preload.skip", {
661
+ reason: "noValidListingAfterRefresh",
662
+ site: e.nexradSite,
663
+ product: e.nexradProduct
664
+ });
665
+ return;
682
666
  }
683
- // Do NOT clear `_nativeGpuReadyKeys` / JSON LRU / upload meta here: that forced a full
684
- // ~1MB JSON parse + native decode on every timeline scrub after prefetch. GPU cache keys
685
- // stay valid while Metal still holds the slot; `sync` falls back to full upload if needed.
686
- // (Controller `destroy()` still clears everything on site/mode teardown.)
687
-
688
- (0, _radarArchiveCoreBundled.setNexradArchiveApiKey)(this.core.apiKey || '');
689
- (0, _radarArchiveCoreBundled.setNexradArchiveBundleId)(this.core.bundleId || '');
690
- (0, _radarArchiveCoreBundled.setNexradArchiveSiteOrigin)(this.core.gridRequestSiteOrigin || 'https://localhost');
691
- (0, _radarArchiveCoreBundled.setNexradSitesFetchAuth)(this.core.apiKey || '', this.core.bundleId || '');
692
- if ((0, _aguaceroRnDebug.isAguaceroRnDebugEnabled)()) {
693
- (0, _aguaceroRnDebug.aguaceroDebug)('nexrad.authConfigured', (0, _aguaceroRnDebug.getAguaceroAuthDiagnosticSnapshot)(this.core, {
694
- phase: 'NexradAndroidController.preload',
695
- site: state.nexradSite,
696
- product: state.nexradProduct
697
- }));
667
+ const n = this._preloadTimelineSignature(t);
668
+ if (n === this._preloadTimelineSig) {
669
+ (0, _nexradDiag.nexradPipelineLog)("preload.skip", {
670
+ reason: "sameTimelineSig",
671
+ site: e.nexradSite,
672
+ times: a.length
673
+ });
674
+ return;
698
675
  }
699
- const snapshot = {
700
- ...state
701
- };
702
- const preloadBatch = (0, _nexradDiag.nexradPerfSpan)(`preload.batch site=${state.nexradSite} times=${times.length}`);
703
- let preloadCompleted = 0;
704
- let preloadFailed = 0;
705
- let preloadSkippedCached = 0;
706
- const run = async () => {
707
- // Prime the visible unix first so the active frame hits GPU before background slots.
708
- const curUx = snapshot.nexradTimestamp != null && Number.isFinite(Number(snapshot.nexradTimestamp)) ? Number(snapshot.nexradTimestamp) : NaN;
709
- if (Number.isFinite(curUx)) {
710
- const p0 = this._buildFetchParamsForUnix(snapshot, curUx);
711
- if (p0) {
712
- const fr0 = this._frameCache.get(p0.fetchKey);
713
- if (fr0) {
714
- this._primeNativeGpuUploadIfNeeded(snapshot, curUx, p0, fr0, signal);
715
- await yieldToJsEventLoop();
716
- }
676
+ this._preloadTimelineSig = n, this._preloadAbort?.abort(), this._preloadAbort = new AbortController();
677
+ const i = this._preloadAbort.signal;
678
+ let r = 0,
679
+ s = 0;
680
+ for (const g of a) this._buildFetchParamsForUnix(t, g, {
681
+ logDiag: !1
682
+ }) ? r++ : s++;
683
+ if ((0, _nexradDiag.nexradPipelineLog)("preload.start", {
684
+ site: t.nexradSite,
685
+ product: t.nexradProduct,
686
+ dataSource: t.nexradDataSource,
687
+ tilt: t.nexradTilt,
688
+ times: a.length,
689
+ validFetchParams: r,
690
+ invalidFetchParams: s,
691
+ displayUnix: t.nexradTimestamp,
692
+ timelineSigTail: n.slice(-80)
693
+ }), r === 0) {
694
+ this._logListingDiag("preload.allFetchParamsInvalid", t, t.nexradTimestamp, {
695
+ times: a.length
696
+ });
697
+ return;
698
+ }
699
+ const l = t.nexradTimestamp != null && Number.isFinite(Number(t.nexradTimestamp)) ? Number(t.nexradTimestamp) : NaN,
700
+ o = new Set();
701
+ for (const g of a) {
702
+ const f = this._buildFetchParamsForUnix(t, g);
703
+ f && o.add(f.fetchKey);
704
+ }
705
+ const m = Number.isFinite(l) ? this._buildFetchParamsForUnix(t, l) : null;
706
+ m && o.add(m.fetchKey);
707
+ for (const g of this._frameCache.keys()) o.has(g) || this._frameCache.delete(g);
708
+ (0, _radarArchiveCoreBundled.setNexradArchiveApiKey)(this.core.apiKey || ""), (0, _radarArchiveCoreBundled.setNexradArchiveBundleId)(this.core.bundleId || ""), (0, _radarArchiveCoreBundled.setNexradArchiveSiteOrigin)(this.core.gridRequestSiteOrigin || _gridCdnAuth.RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN), (0, _radarArchiveCoreBundled.setNexradArchiveUserId)(this.core.nexradUserId || "sdk-user"), (0, _radarArchiveCoreBundled.setNexradSitesFetchAuth)(this.core.apiKey || "", this.core.bundleId || ""), (0, _aguaceroRnDebug.isAguaceroRnDebugEnabled)() && (0, _aguaceroRnDebug.aguaceroDebug)("nexrad.authConfigured", (0, _aguaceroRnDebug.getAguaceroAuthDiagnosticSnapshot)(this.core, {
709
+ phase: "NexradAndroidController.preload",
710
+ site: t.nexradSite,
711
+ product: t.nexradProduct
712
+ }));
713
+ const u = {
714
+ ...t
715
+ },
716
+ d = (0, _nexradDiag.nexradPerfSpan)(`preload.batch site=${t.nexradSite} times=${a.length}`);
717
+ let N = 0,
718
+ p = 0,
719
+ F = 0;
720
+ await (async () => {
721
+ const g = u.nexradTimestamp != null && Number.isFinite(Number(u.nexradTimestamp)) ? Number(u.nexradTimestamp) : NaN;
722
+ if (Number.isFinite(g)) {
723
+ const x = this._buildFetchParamsForUnix(u, g);
724
+ if (x) {
725
+ const S = this._frameCache.get(x.fetchKey);
726
+ S && (this._primeNativeGpuUploadIfNeeded(u, g, x, S, i), await M());
717
727
  }
718
728
  }
719
- let cursor = 0;
720
- const work = async () => {
721
- while (cursor < times.length && !signal.aborted) {
722
- const i = cursor++;
723
- const unix = times[i];
724
- const slot = (0, _nexradDiag.nexradPerfSpan)(`preload.slot idx=${i + 1}/${times.length} unix=${unix}`);
725
- const p = this._buildFetchParamsForUnix(snapshot, unix);
726
- if (!p || signal.aborted) {
727
- slot.end({
728
- outcome: 'noParamsOrAborted'
729
+ let f = 0;
730
+ const _ = async () => {
731
+ for (; f < a.length && !i.aborted;) {
732
+ const x = f++,
733
+ S = a[x],
734
+ v = (0, _nexradDiag.nexradPerfSpan)(`preload.slot idx=${x + 1}/${a.length} unix=${S}`),
735
+ b = this._buildFetchParamsForUnix(u, S);
736
+ if (!b || i.aborted) v.end({
737
+ outcome: "noParamsOrAborted"
738
+ });else if (this._frameCache.has(b.fetchKey)) {
739
+ F++;
740
+ const T = this._frameCache.get(b.fetchKey);
741
+ this._primeNativeGpuUploadIfNeeded(u, S, b, T, i), await M(), v.end({
742
+ outcome: "alreadyCached",
743
+ fetchKeyTail: b.fetchKey.slice(-64)
744
+ });
745
+ } else try {
746
+ const T = await this._fetchFrame(u, S, {
747
+ signal: i,
748
+ priority: "prefetch"
729
749
  });
730
- } else if (this._frameCache.has(p.fetchKey)) {
731
- preloadSkippedCached++;
732
- const cachedFrame = this._frameCache.get(p.fetchKey);
733
- this._primeNativeGpuUploadIfNeeded(snapshot, unix, p, cachedFrame, signal);
734
- await yieldToJsEventLoop();
735
- slot.end({
736
- outcome: 'alreadyCached',
737
- fetchKeyTail: p.fetchKey.slice(-64)
750
+ T && !i.aborted ? (this._frameCache.set(b.fetchKey, T), N++, this._primeNativeGpuUploadIfNeeded(u, S, b, T, i), await M(), v.end({
751
+ outcome: "cachedFrame",
752
+ fetchKeyTail: b.fetchKey.slice(-64),
753
+ cacheSizeAfter: this._frameCache.size
754
+ })) : v.end({
755
+ outcome: "noFrame",
756
+ aborted: i.aborted
757
+ });
758
+ } catch (T) {
759
+ p++, v.end({
760
+ outcome: "error",
761
+ message: T?.message || String(T)
738
762
  });
739
- } else {
740
- try {
741
- const frame = await this._fetchFrame(snapshot, unix, {
742
- signal,
743
- priority: 'prefetch'
744
- });
745
- if (frame && !signal.aborted) {
746
- this._frameCache.set(p.fetchKey, frame);
747
- preloadCompleted++;
748
- this._primeNativeGpuUploadIfNeeded(snapshot, unix, p, frame, signal);
749
- await yieldToJsEventLoop();
750
- slot.end({
751
- outcome: 'cachedFrame',
752
- fetchKeyTail: p.fetchKey.slice(-64),
753
- cacheSizeAfter: this._frameCache.size
754
- });
755
- } else {
756
- slot.end({
757
- outcome: 'noFrame',
758
- aborted: signal.aborted
759
- });
760
- }
761
- } catch (err) {
762
- preloadFailed++;
763
- slot.end({
764
- outcome: 'error',
765
- message: err?.message || String(err)
766
- });
767
- }
768
763
  }
769
- await yieldToJsEventLoop();
764
+ await M();
770
765
  }
771
766
  };
772
- await Promise.all(Array.from({
773
- length: PRELOAD_CONCURRENCY
774
- }, () => work()));
775
-
776
- // Catch-up: any unix still missing a GPU slot (e.g. layer mounted mid-preload) gets one upload pass.
777
- if (!signal.aborted) {
778
- for (let i = 0; i < times.length && !signal.aborted; i++) {
779
- const unix = times[i];
780
- const p = this._buildFetchParamsForUnix(snapshot, unix);
781
- if (!p) continue;
782
- const frame = this._frameCache.get(p.fetchKey);
783
- if (!frame) continue;
784
- const syncKey = this._syncIdentity(snapshot, p, unix);
785
- if (this._nativeGpuReadyKeys.has(syncKey)) continue;
786
- this._primeNativeGpuUploadIfNeeded(snapshot, unix, p, frame, signal);
787
- await yieldToJsEventLoop();
788
- }
767
+ if (await Promise.all(Array.from({
768
+ length: be
769
+ }, () => _())), !i.aborted) for (let x = 0; x < a.length && !i.aborted; x++) {
770
+ const S = a[x],
771
+ v = this._buildFetchParamsForUnix(u, S);
772
+ if (!v) continue;
773
+ const b = this._frameCache.get(v.fetchKey);
774
+ if (!b) continue;
775
+ const T = this._syncIdentity(u, v, S);
776
+ this._nativeGpuReadyKeys.has(T) || (this._primeNativeGpuUploadIfNeeded(u, S, v, b, i), await M());
789
777
  }
790
- preloadBatch.end({
791
- outcome: signal.aborted ? 'aborted' : 'complete',
792
- completed: preloadCompleted,
793
- failed: preloadFailed,
794
- skippedCached: preloadSkippedCached,
778
+ const C = {
779
+ outcome: i.aborted ? "aborted" : "complete",
780
+ completed: N,
781
+ failed: p,
782
+ skippedCached: F,
795
783
  finalCacheSize: this._frameCache.size,
796
784
  gpuReadyCount: this._nativeGpuReadyKeys.size
785
+ };
786
+ d.end(C), (0, _nexradDiag.nexradPipelineLog)("preload.done", C);
787
+ })();
788
+ }
789
+ async sync(e) {
790
+ const t = e.nexradTimestamp != null ? Number(e.nexradTimestamp) : NaN,
791
+ a = (0, _nexradDiag.nexradPerfSpan)(`sync.total site=${e.nexradSite} unix=${t} product=${e.nexradProduct} source=${e.nexradDataSource} tilt=${e.nexradTilt}`);
792
+ if (!e.isNexrad || !e.nexradSite) {
793
+ (0, _nexradDiag.nexradPipelineLog)("sync.skip", {
794
+ reason: "notNexradOrNoSite",
795
+ isNexrad: e.isNexrad,
796
+ site: e.nexradSite
797
+ }), this.destroy(), a.end({
798
+ outcome: "skippedNotNexradOrNoSite"
797
799
  });
798
- };
799
- void run();
800
- }
801
- async sync(state) {
802
- const unixEarly = state.nexradTimestamp != null ? Number(state.nexradTimestamp) : NaN;
803
- const syncTotal = (0, _nexradDiag.nexradPerfSpan)(`sync.total site=${state.nexradSite} unix=${unixEarly} product=${state.nexradProduct} source=${state.nexradDataSource} tilt=${state.nexradTilt}`);
804
- if (!state.isNexrad || !state.nexradSite || state.nexradTimestamp == null) {
805
- this.destroy();
806
- syncTotal.end({
807
- outcome: 'skippedNotNexradOrMissing'
800
+ return;
801
+ }
802
+ if (!q("sync")) {
803
+ (0, _nexradDiag.nexradPipelineLog)("sync.skip", {
804
+ reason: "missingArchiveBindings",
805
+ site: e.nexradSite
806
+ }), a.end({
807
+ outcome: "skippedMissingArchiveBindings"
808
808
  });
809
809
  return;
810
810
  }
811
- if (!ensureRadarArchiveBindings('sync')) {
812
- syncTotal.end({
813
- outcome: 'skippedMissingArchiveBindings'
811
+ await this._ensureLevel2ListingReady(e), e = this._nexradStateWithCoreListing(e);
812
+ let n = e.nexradTimestamp != null ? Number(e.nexradTimestamp) : NaN;
813
+ if (!Number.isFinite(n) && this.core.state.nexradTimestamp != null && (n = Number(this.core.state.nexradTimestamp), e = {
814
+ ...e,
815
+ nexradTimestamp: n
816
+ }), !Number.isFinite(n) && Array.isArray(e.availableNexradTimestamps) && e.availableNexradTimestamps.length > 0 && (n = Number(e.availableNexradTimestamps[e.availableNexradTimestamps.length - 1]), e = {
817
+ ...e,
818
+ nexradTimestamp: n
819
+ }, this.core.state.nexradTimestamp == null && (this.core.state.nexradTimestamp = n, typeof this.core._emitStateChange == "function" && this.core._emitStateChange())), !Number.isFinite(n)) {
820
+ (0, _nexradDiag.nexradPipelineLog)("sync.skip", {
821
+ reason: "noTimestampYet",
822
+ site: e.nexradSite,
823
+ availableUnixCount: Array.isArray(e.availableNexradTimestamps) ? e.availableNexradTimestamps.length : 0
824
+ }), a.end({
825
+ outcome: "skippedNoTimestampYet"
814
826
  });
815
827
  return;
816
828
  }
817
- const tAuth = (0, _nexradDiag.nexradPerfSpan)('sync.setArchiveAuth');
818
- (0, _radarArchiveCoreBundled.setNexradArchiveApiKey)(this.core.apiKey || '');
819
- (0, _radarArchiveCoreBundled.setNexradArchiveBundleId)(this.core.bundleId || '');
820
- (0, _radarArchiveCoreBundled.setNexradArchiveSiteOrigin)(this.core.gridRequestSiteOrigin || 'https://localhost');
821
- (0, _radarArchiveCoreBundled.setNexradSitesFetchAuth)(this.core.apiKey || '', this.core.bundleId || '');
822
- tAuth.end({});
823
- const unix = Number(state.nexradTimestamp);
824
- const tParams = (0, _nexradDiag.nexradPerfSpan)('sync.buildFetchParams');
825
- const p = this._buildFetchParamsForUnix(state, unix);
826
- tParams.end({
827
- ok: !!p
829
+ (0, _nexradDiag.nexradPipelineLog)("sync.start", {
830
+ site: e.nexradSite,
831
+ product: e.nexradProduct,
832
+ dataSource: e.nexradDataSource,
833
+ tilt: e.nexradTilt,
834
+ unix: e.nexradTimestamp,
835
+ nativeLayerReady: !!this._native()?.uploadNexradFrame
828
836
  });
829
- if (!p) {
830
- const ctx = this._resolveListingContext(state);
831
- syncTotal.end({
832
- outcome: 'noFetchParams'
837
+ const i = (0, _nexradDiag.nexradPerfSpan)("sync.setArchiveAuth");
838
+ (0, _radarArchiveCoreBundled.setNexradArchiveApiKey)(this.core.apiKey || ""), (0, _radarArchiveCoreBundled.setNexradArchiveBundleId)(this.core.bundleId || ""), (0, _radarArchiveCoreBundled.setNexradArchiveSiteOrigin)(this.core.gridRequestSiteOrigin || _gridCdnAuth.RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN), (0, _radarArchiveCoreBundled.setNexradArchiveUserId)(this.core.nexradUserId || "sdk-user"), (0, _radarArchiveCoreBundled.setNexradSitesFetchAuth)(this.core.apiKey || "", this.core.bundleId || ""), i.end({});
839
+ const r = (0, _nexradDiag.nexradPerfSpan)("sync.buildFetchParams"),
840
+ s = this._buildFetchParamsForUnix(e, n);
841
+ if (r.end({
842
+ ok: !!s
843
+ }), !s) {
844
+ this._logListingDiag("sync.noFetchParams", e, n), a.end({
845
+ outcome: "noFetchParams"
846
+ }), (0, _nexradDiag.nexradPipelineLog)("sync.done", {
847
+ outcome: "noFetchParams",
848
+ site: e.nexradSite,
849
+ unix: n
833
850
  });
834
851
  return;
835
852
  }
836
- const tIdentity = (0, _nexradDiag.nexradPerfSpan)('sync.syncIdentity');
837
- const syncKey = this._syncIdentity(state, p, unix);
838
- tIdentity.end({
839
- syncKeyTail: syncKey.slice(-96),
840
- lastSyncKeyMatch: syncKey === this._lastSyncKey
853
+ const l = (0, _nexradDiag.nexradPerfSpan)("sync.syncIdentity"),
854
+ o = this._syncIdentity(e, s, n);
855
+ l.end({
856
+ syncKeyTail: o.slice(-96),
857
+ lastSyncKeyMatch: o === this._lastSyncKey
841
858
  });
842
- const jsCachedForShortCircuit = this._frameCache.get(p.fetchKey);
843
- if (syncKey === this._lastSyncKey && this._nativeFrameUploaded && jsCachedForShortCircuit) {
844
- const tStyle = (0, _nexradDiag.nexradPerfSpan)('sync.shortCircuit_styleOnly');
845
- this.applyStyleFromState(state);
846
- tStyle.end({});
847
- syncTotal.end({
848
- outcome: 'styleOnlyShortCircuit'
859
+ const m = this._frameCache.get(s.fetchKey);
860
+ if (o === this._lastSyncKey && this._nativeFrameUploaded && m) {
861
+ const f = (0, _nexradDiag.nexradPerfSpan)("sync.shortCircuit_styleOnly");
862
+ this.applyStyleFromState(e), f.end({}), a.end({
863
+ outcome: "styleOnlyShortCircuit"
849
864
  });
850
865
  return;
851
866
  }
852
- const tCacheLookup = (0, _nexradDiag.nexradPerfSpan)('sync.memoryCacheLookup');
853
- const cached = this._frameCache.get(p.fetchKey);
854
- tCacheLookup.end({
855
- hit: !!cached,
867
+ const u = (0, _nexradDiag.nexradPerfSpan)("sync.memoryCacheLookup"),
868
+ d = this._frameCache.get(s.fetchKey);
869
+ u.end({
870
+ hit: !!d,
856
871
  cacheSize: this._frameCache.size,
857
- fetchKeyTail: p.fetchKey.slice(-80)
872
+ fetchKeyTail: s.fetchKey.slice(-80)
858
873
  });
859
- const tGpuTry = (0, _nexradDiag.nexradPerfSpan)('sync.tryGpuCacheActivate');
860
- if (cached && this._nativeGpuReadyKeys.has(syncKey)) {
861
- const n = this._native();
862
- if (n?.activateNexradCachedFrame) {
863
- const tAct = (0, _nexradDiag.nexradPerfSpan)('sync.dispatchActivateCachedFrame');
864
- n.activateNexradCachedFrame(syncKey);
865
- tAct.end({
866
- keyLen: syncKey.length
874
+ const N = (0, _nexradDiag.nexradPerfSpan)("sync.tryGpuCacheActivate");
875
+ if (d && this._nativeGpuReadyKeys.has(o)) {
876
+ const f = this._native();
877
+ if (f?.activateNexradCachedFrame) {
878
+ const _ = (0, _nexradDiag.nexradPerfSpan)("sync.dispatchActivateCachedFrame");
879
+ f.activateNexradCachedFrame(o), _.end({
880
+ keyLen: o.length
867
881
  });
868
- const tStyle = (0, _nexradDiag.nexradPerfSpan)('sync.applyStyleAfterGpuActivate');
869
- this.applyStyleFromState(state);
870
- tStyle.end({});
871
- const meta = this._uploadMetaBySyncKey.get(syncKey);
872
- if (meta) {
873
- this._lastUploadMeta = {
874
- valueScale: meta.valueScale,
875
- valueOffset: meta.valueOffset
876
- };
877
- }
878
- this._lastSyncKey = syncKey;
879
- this._nativeFrameUploaded = true;
880
- tGpuTry.end({
881
- outcome: 'gpuCacheActivate',
882
+ const C = (0, _nexradDiag.nexradPerfSpan)("sync.applyStyleAfterGpuActivate");
883
+ this.applyStyleFromState(e), C.end({});
884
+ const x = this._uploadMetaBySyncKey.get(o);
885
+ x && (this._lastUploadMeta = {
886
+ valueScale: x.valueScale,
887
+ valueOffset: x.valueOffset
888
+ }), this._lastSyncKey = o, this._nativeFrameUploaded = !0, N.end({
889
+ outcome: "gpuCacheActivate",
882
890
  gpuReadySetSize: this._nativeGpuReadyKeys.size
883
- });
884
- syncTotal.end({
885
- outcome: 'gpuCacheActivate'
891
+ }), a.end({
892
+ outcome: "gpuCacheActivate"
886
893
  });
887
894
  return;
888
895
  }
889
896
  }
890
- tGpuTry.end({
891
- outcome: 'noGpuActivate',
892
- hasJsCachedFrame: !!cached,
893
- gpuReadyForSyncKey: this._nativeGpuReadyKeys.has(syncKey),
897
+ if (N.end({
898
+ outcome: "noGpuActivate",
899
+ hasJsCachedFrame: !!d,
900
+ gpuReadyForSyncKey: this._nativeGpuReadyKeys.has(o),
894
901
  hasActivateMethod: !!this._native()?.activateNexradCachedFrame
895
- });
896
- if (cached) {
897
- const tUpload = (0, _nexradDiag.nexradPerfSpan)('sync.uploadFromMemoryCache_toNative');
898
- this._uploadFrameToNative(state, cached, p, unix);
899
- tUpload.end({});
900
- this._lastSyncKey = syncKey;
901
- syncTotal.end({
902
- outcome: 'memoryCacheHit'
902
+ }), d) {
903
+ const f = (0, _nexradDiag.nexradPerfSpan)("sync.uploadFromMemoryCache_toNative");
904
+ this._uploadFrameToNative(e, d, s, n), f.end({}), this._lastSyncKey = o, a.end({
905
+ outcome: "memoryCacheHit"
903
906
  });
904
907
  return;
905
908
  }
906
- this._abort?.abort();
907
- this._abort = new AbortController();
908
- let frame;
909
+ this._abort?.abort(), this._abort = new AbortController();
910
+ let p;
909
911
  try {
910
- frame = await this._fetchFrame(state, unix, {
912
+ p = await this._fetchFrame(e, n, {
911
913
  signal: this._abort.signal,
912
- priority: 'display'
914
+ priority: "display"
913
915
  });
914
- } catch (err) {
915
- syncTotal.end({
916
- outcome: 'fetchThrew',
917
- message: err?.message || String(err)
916
+ } catch (f) {
917
+ const _ = f?.message || String(f);
918
+ a.end({
919
+ outcome: "fetchThrew",
920
+ message: _
921
+ }), (0, _nexradDiag.nexradPipelineLog)("sync.done", {
922
+ outcome: "fetchThrew",
923
+ site: e.nexradSite,
924
+ unix: n,
925
+ message: _
918
926
  });
919
927
  return;
920
928
  }
921
- if (!frame || this._abort.signal.aborted) {
922
- syncTotal.end({
923
- outcome: 'fetchNoFrame',
929
+ if (!p || this._abort.signal.aborted) {
930
+ const f = {
931
+ outcome: "fetchNoFrame",
924
932
  aborted: this._abort.signal.aborted,
925
- hadFrame: !!frame
933
+ hadFrame: !!p
934
+ };
935
+ a.end(f), (0, _nexradDiag.nexradPipelineLog)("sync.done", {
936
+ ...f,
937
+ site: e.nexradSite,
938
+ unix: n
926
939
  });
927
940
  return;
928
941
  }
929
- const tPut = (0, _nexradDiag.nexradPerfSpan)('sync.frameCacheSet');
930
- this._frameCache.set(p.fetchKey, frame);
931
- tPut.end({
942
+ const F = (0, _nexradDiag.nexradPerfSpan)("sync.frameCacheSet");
943
+ this._frameCache.set(s.fetchKey, p), F.end({
932
944
  cacheSizeAfter: this._frameCache.size
933
945
  });
934
- const tUploadFetched = (0, _nexradDiag.nexradPerfSpan)('sync.uploadFetchedFrame_toNative');
935
- this._uploadFrameToNative(state, frame, p, unix);
936
- tUploadFetched.end({});
937
- this._lastSyncKey = syncKey;
938
- syncTotal.end({
939
- outcome: 'fetchedAndUploaded'
946
+ const g = (0, _nexradDiag.nexradPerfSpan)("sync.uploadFetchedFrame_toNative");
947
+ this._uploadFrameToNative(e, p, s, n), g.end({}), this._lastSyncKey = o, a.end({
948
+ outcome: "fetchedAndUploaded"
949
+ }), (0, _nexradDiag.nexradPipelineLog)("sync.done", {
950
+ outcome: "fetchedAndUploaded",
951
+ site: e.nexradSite,
952
+ unix: n,
953
+ nGates: p.nGates,
954
+ nRays: p.nRays,
955
+ nativeFrameUploaded: this._nativeFrameUploaded
940
956
  });
941
957
  }
942
- getInspectPayload(lng, lat, state) {
943
- if (!state?.isNexrad || !state.nexradSite || state.nexradTimestamp == null) {
944
- return null;
945
- }
946
- if (state.visible === false || (state.opacity ?? 1) <= 0) {
947
- return null;
948
- }
949
- const unix = Number(state.nexradTimestamp);
950
- const p = this._buildFetchParamsForUnix(state, unix);
951
- if (!p) {
952
- return null;
953
- }
954
- const frame = this._frameCache.get(p.fetchKey);
955
- if (!frame) {
956
- return null;
957
- }
958
- const colormapFlat = state.colormap;
959
- if (!colormapFlat || colormapFlat.length < 2) {
960
- return null;
961
- }
962
- const rangeMin = colormapFlat[0];
963
- const rangeMax = colormapFlat[colormapFlat.length - 2];
964
- const radarVariable = (state.nexradProduct || 'REF').toUpperCase();
965
- const radarSource = state.nexradDataSource === 'level3' ? 'level3' : 'level2';
966
- const displayUnits = state.units && String(state.units).toLowerCase() !== 'none' ? state.units : isVelocityStyleRadarVar(radarVariable) ? 'm/s' : '';
967
- const uploadOptsForReadout = (0, _nexradMapboxFrameOptsBundled.mapboxFrameUploadOptionsForNexradState)(state);
968
- const gpuFrame = this._getPreparedReadoutFrame(frame, uploadOptsForReadout);
969
- const sample = (0, _nexradCrossSectionSampleAtLatLonBundled.sampleNexradFrameAtLatLon)(gpuFrame, lat, lng, {
970
- smoothPolar: this._gateSmoothing
971
- });
972
- if (!sample) {
973
- return null;
974
- }
975
- const valueMs = sample.value;
976
- const isHydro = radarSource === 'level3' && nexradLevel3IsHydrometeorClassification(radarVariable);
977
- let valueOut;
978
- let unitOut = displayUnits || '';
979
- if (isVelocityStyleRadarVar(radarVariable)) {
980
- valueOut = velocityMsToDisplay(valueMs, displayUnits);
981
- } else if (isHydro) {
982
- const label = nexradHydrometeorLabelForClassIndex(valueMs);
983
- if (label == null) {
984
- return null;
985
- }
986
- valueOut = label;
987
- unitOut = '';
988
- } else {
989
- valueOut = formatNexradInspectNumeric(valueMs, radarVariable);
990
- const bu = state.colormapBaseUnit;
991
- if (bu != null && String(bu).length > 0 && String(bu).toLowerCase() !== 'none') {
992
- unitOut = bu;
993
- }
994
- }
995
- let inRange;
996
- if (isHydro) {
997
- const idx = Math.round(Number(valueMs));
998
- inRange = (rangeMin == null || idx >= rangeMin) && (rangeMax == null || idx <= rangeMax);
999
- } else if (isVelocityStyleRadarVar(radarVariable)) {
1000
- inRange = (rangeMin == null || valueOut >= rangeMin) && (rangeMax == null || valueOut <= rangeMax);
958
+ getInspectPayload(e, t, a) {
959
+ if (!a?.isNexrad || !a.nexradSite || a.nexradTimestamp == null || a.visible === !1 || (a.opacity ?? 1) <= 0) return null;
960
+ const n = Number(a.nexradTimestamp),
961
+ i = this._buildFetchParamsForUnix(a, n);
962
+ if (!i) return null;
963
+ const r = this._frameCache.get(i.fetchKey);
964
+ if (!r) return null;
965
+ const s = a.colormap;
966
+ if (!s || s.length < 2) return null;
967
+ const l = s[0],
968
+ o = s[s.length - 2],
969
+ m = (a.nexradProduct || "REF").toUpperCase(),
970
+ u = this._nexradRadarSource(a) || "level3",
971
+ d = a.units && String(a.units).toLowerCase() !== "none" ? a.units : U(m) ? "m/s" : "",
972
+ N = (0, _nexradMapboxFrameOptsBundled.mapboxFrameUploadOptionsForNexradState)(a),
973
+ p = this._getPreparedReadoutFrame(r, N),
974
+ F = (0, _nexradCrossSectionSampleAtLatLonBundled.sampleNexradFrameAtLatLon)(p, t, e, {
975
+ smoothPolar: this._gateSmoothing
976
+ });
977
+ if (!F) return null;
978
+ const g = F.value,
979
+ f = u === "level3" && fe(m);
980
+ let _,
981
+ C = d || "";
982
+ if (U(m)) _ = ve(g, d);else if (f) {
983
+ const K = xe(g);
984
+ if (K == null) return null;
985
+ _ = K, C = "";
1001
986
  } else {
1002
- // Do not apply the colormap *lower* stop as a hard readout floor: weak echoes below the first
1003
- // legend tick can still be drawn (LUT / GL), and users expect a number there.
1004
- inRange = rangeMax == null || valueOut <= rangeMax;
1005
- }
1006
- if (!inRange) {
1007
- return null;
1008
- }
1009
- const tiltDeg = Number.isFinite(state.nexradTilt) ? state.nexradTilt : (0, _javascriptSdk.getDefaultRadarTilt)(state.nexradSite);
1010
- const bhKm = beamHeightKm(sample.groundRangeKm, tiltDeg);
1011
- const metric = state.units === 'metric';
1012
- const beamHeightDisplay = metric ? bhKm : bhKm * 3.280839895013123;
1013
- const beamUnit = metric ? 'km' : 'kft';
1014
- const fldKey = state.variable;
987
+ _ = Se(g, m);
988
+ const K = a.colormapBaseUnit;
989
+ K != null && String(K).length > 0 && String(K).toLowerCase() !== "none" && (C = K);
990
+ }
991
+ let x;
992
+ if (f) {
993
+ const K = Math.round(Number(g));
994
+ x = (l == null || K >= l) && (o == null || K <= o);
995
+ } else U(m) ? x = (l == null || _ >= l) && (o == null || _ <= o) : x = o == null || _ <= o;
996
+ if (!x) return null;
997
+ const S = Number.isFinite(a.nexradTilt) ? a.nexradTilt : (0, _nexradSdkImports.getDefaultRadarTilt)(a.nexradSite),
998
+ v = _e(F.groundRangeKm, S),
999
+ b = a.units === "metric",
1000
+ T = b ? v : v * 3.280839895013123,
1001
+ P = b ? "km" : "kft",
1002
+ A = a.variable;
1015
1003
  return {
1016
1004
  lngLat: {
1017
- lng,
1018
- lat
1005
+ lng: e,
1006
+ lat: t
1019
1007
  },
1020
1008
  variable: {
1021
- code: fldKey,
1022
- name: this.core.getVariableDisplayName(fldKey)
1009
+ code: A,
1010
+ name: this.core.getVariableDisplayName(A)
1023
1011
  },
1024
- value: valueOut,
1025
- unit: unitOut,
1026
- beamHeight: Number.isFinite(beamHeightDisplay) && Number.isFinite(bhKm) ? {
1027
- value: beamHeightDisplay,
1028
- unit: beamUnit
1012
+ value: _,
1013
+ unit: C,
1014
+ beamHeight: Number.isFinite(T) && Number.isFinite(v) ? {
1015
+ value: T,
1016
+ unit: P
1029
1017
  } : null
1030
1018
  };
1031
1019
  }