@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
@@ -1,193 +1,7 @@
1
- /**
2
- * Minimal Server-Sent Events client for React Native (no native EventSource).
3
- * Enough for {@link NwsWatchesWarningsOverlay} SSE: GET stream, parse `event:` / `data:` blocks,
4
- * dispatch named events, reconnect on close (handled by overlay).
5
- */
6
-
7
- /** @type {typeof EventSource | undefined} */
8
- let ImplClass;
9
-
10
- function dispatch(es, type, dataStr) {
11
- const ev = { type, data: dataStr };
12
- const list = es._listeners.get(type);
13
- if (!list) return;
14
- for (const fn of list) {
15
- try {
16
- fn(ev);
17
- } catch {
18
- /* ignore */
19
- }
20
- }
21
- }
22
-
23
- function parseBlocks(es, incoming) {
24
- es._buf += incoming;
25
- while (true) {
26
- const sep = es._buf.indexOf('\n\n');
27
- if (sep === -1) break;
28
- const block = es._buf.slice(0, sep);
29
- es._buf = es._buf.slice(sep + 2);
30
-
31
- let eventName = 'message';
32
- const dataLines = [];
33
- for (const rawLine of block.split('\n')) {
34
- const line = rawLine.replace(/\r$/, '');
35
- if (line.startsWith(':') || line === '') continue;
36
- if (line.startsWith('event:')) {
37
- eventName = line.slice(6).trim() || 'message';
38
- } else if (line.startsWith('data:')) {
39
- dataLines.push(line.slice(5).startsWith(' ') ? line.slice(6) : line.slice(5));
40
- }
41
- }
42
- const data = dataLines.join('\n');
43
- if (data.length || block.includes('data:')) {
44
- dispatch(es, eventName, data);
45
- }
46
- }
47
- }
48
-
49
- class ReactNativeEventSource {
50
- /** @param {string} url */
51
- constructor(url) {
52
- this.url = url;
53
- this.readyState = ReactNativeEventSource.CONNECTING;
54
- /** @type {Map<string, Set<(ev: { type: string; data: string }) => void>>} */
55
- this._listeners = new Map();
56
- this.onopen = null;
57
- this.onerror = null;
58
- this._buf = '';
59
- /** @type {XMLHttpRequest | null} */
60
- this._xhr = null;
61
- this._opened = false;
62
- this._closed = false;
63
-
64
- const xhr = new XMLHttpRequest();
65
- this._xhr = xhr;
66
- xhr.open('GET', url);
67
- xhr.setRequestHeader('Accept', 'text/event-stream');
68
- xhr.responseType = 'text';
69
-
70
- let lastLen = 0;
71
-
72
- xhr.onreadystatechange = () => {
73
- if (this._closed) return;
74
- if (xhr.readyState >= XMLHttpRequest.HEADERS_RECEIVED && xhr.status >= 400) {
75
- if (!this._opened) {
76
- this._fail();
77
- }
78
- }
79
- };
80
-
81
- xhr.onprogress = () => {
82
- if (this._closed) return;
83
- const t = xhr.responseText || '';
84
- const chunk = t.slice(lastLen);
85
- lastLen = t.length;
86
- if (!chunk) return;
87
- if (!this._opened && xhr.status === 200) {
88
- this._opened = true;
89
- this.readyState = ReactNativeEventSource.OPEN;
90
- try {
91
- if (typeof this.onopen === 'function') this.onopen();
92
- } catch {
93
- /* ignore */
94
- }
95
- }
96
- parseBlocks(this, chunk);
97
- };
98
-
99
- xhr.onload = () => {
100
- if (this._closed) return;
101
- const t = xhr.responseText || '';
102
- const chunk = t.slice(lastLen);
103
- lastLen = t.length;
104
- if (chunk) parseBlocks(this, chunk);
105
- if (this._buf.length) {
106
- parseBlocks(this, '\n\n');
107
- }
108
- if (!this._opened && xhr.status === 200) {
109
- this._opened = true;
110
- this.readyState = ReactNativeEventSource.OPEN;
111
- try {
112
- if (typeof this.onopen === 'function') this.onopen();
113
- } catch {
114
- /* ignore */
115
- }
116
- }
117
- this._close();
118
- };
119
-
120
- xhr.onerror = () => {
121
- if (!this._closed) this._fail();
122
- };
123
-
124
- try {
125
- xhr.send();
126
- } catch {
127
- this._fail();
128
- }
129
- }
130
-
131
- static CONNECTING = 0;
132
- static OPEN = 1;
133
- static CLOSED = 2;
134
-
135
- addEventListener(type, fn) {
136
- if (!this._listeners.has(type)) this._listeners.set(type, new Set());
137
- this._listeners.get(type).add(fn);
138
- }
139
-
140
- removeEventListener(type, fn) {
141
- this._listeners.get(type)?.delete(fn);
142
- }
143
-
144
- close() {
145
- if (this._closed) return;
146
- try {
147
- this._xhr?.abort();
148
- } catch {
149
- /* ignore */
150
- }
151
- this._close();
152
- }
153
-
154
- _close() {
155
- if (this._closed) return;
156
- this._closed = true;
157
- this.readyState = ReactNativeEventSource.CLOSED;
158
- this._xhr = null;
159
- try {
160
- if (typeof this.onerror === 'function') this.onerror({});
161
- } catch {
162
- /* ignore */
163
- }
164
- }
165
-
166
- _fail() {
167
- if (this._closed) return;
168
- try {
169
- this._xhr?.abort();
170
- } catch {
171
- /* ignore */
172
- }
173
- this._closed = true;
174
- this.readyState = ReactNativeEventSource.CLOSED;
175
- try {
176
- if (typeof this.onerror === 'function') this.onerror({});
177
- } catch {
178
- /* ignore */
179
- }
180
- }
181
- }
182
-
183
- ImplClass = ReactNativeEventSource;
184
-
185
- /**
186
- * Install `global.EventSource` when missing (Hermes / RN).
187
- */
188
- export function ensureReactNativeEventSource() {
189
- if (typeof global.EventSource !== 'undefined') return;
190
- global.EventSource = ImplClass;
191
- }
192
-
193
- ensureReactNativeEventSource();
1
+ var _=Object.defineProperty,p=(s,e,t)=>e in s?_(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,a=(s,e,t)=>p(s,typeof e!="symbol"?e+"":e,t);let u;function y(s,e,t){const n={type:e,data:t},i=s._listeners.get(e);if(i)for(const o of i)try{o(n)}catch{}}function l(s,e){for(s._buf+=e;;){const t=s._buf.indexOf(`
2
+
3
+ `);if(t===-1)break;const n=s._buf.slice(0,t);s._buf=s._buf.slice(t+2);let i="message";const o=[];for(const d of n.split(`
4
+ `)){const r=d.replace(/\r$/,"");r.startsWith(":")||r===""||(r.startsWith("event:")?i=r.slice(6).trim()||"message":r.startsWith("data:")&&o.push(r.slice(5).startsWith(" ")?r.slice(6):r.slice(5)))}const f=o.join(`
5
+ `);(f.length||n.includes("data:"))&&y(s,i,f)}}const c=class h{constructor(e){this.url=e,this.readyState=h.CONNECTING,this._listeners=new Map,this.onopen=null,this.onerror=null,this._buf="",this._xhr=null,this._opened=!1,this._closed=!1;const t=new XMLHttpRequest;this._xhr=t,t.open("GET",e),t.setRequestHeader("Accept","text/event-stream"),t.responseType="text";let n=0;t.onreadystatechange=()=>{this._closed||t.readyState>=XMLHttpRequest.HEADERS_RECEIVED&&t.status>=400&&(this._opened||this._fail())},t.onprogress=()=>{if(this._closed)return;const i=t.responseText||"",o=i.slice(n);if(n=i.length,!!o){if(!this._opened&&t.status===200){this._opened=!0,this.readyState=h.OPEN;try{typeof this.onopen=="function"&&this.onopen()}catch{}}l(this,o)}},t.onload=()=>{if(this._closed)return;const i=t.responseText||"",o=i.slice(n);if(n=i.length,o&&l(this,o),this._buf.length&&l(this,`
6
+
7
+ `),!this._opened&&t.status===200){this._opened=!0,this.readyState=h.OPEN;try{typeof this.onopen=="function"&&this.onopen()}catch{}}this._close()},t.onerror=()=>{this._closed||this._fail()};try{t.send()}catch{this._fail()}}addEventListener(e,t){this._listeners.has(e)||this._listeners.set(e,new Set),this._listeners.get(e).add(t)}removeEventListener(e,t){this._listeners.get(e)?.delete(t)}close(){if(!this._closed){try{this._xhr?.abort()}catch{}this._close()}}_close(){if(!this._closed){this._closed=!0,this.readyState=h.CLOSED,this._xhr=null;try{typeof this.onerror=="function"&&this.onerror({})}catch{}}}_fail(){if(!this._closed){try{this._xhr?.abort()}catch{}this._closed=!0,this.readyState=h.CLOSED;try{typeof this.onerror=="function"&&this.onerror({})}catch{}}}};a(c,"CONNECTING",0),a(c,"OPEN",1),a(c,"CLOSED",2);let E=c;u=E;export function ensureReactNativeEventSource(){typeof global.EventSource<"u"||(global.EventSource=u)}ensureReactNativeEventSource();
@@ -1,8 +1 @@
1
- /**
2
- * Stable Mapbox custom layer id for Android {@link NexradRadarLayerView} — must match Java
3
- * {@code NexradRadarLayerView.NEXRAD_LAYER_ID} so NWS alert fill can anchor under radar like mapsgl.
4
- */
5
- export const AGUACERO_NEXRAD_MAP_LAYER_ID = 'aguacero-nexrad-custom-layer';
6
-
7
- /** Must match {@link AguaceroStyleLayerIds#SATELLITE_CUSTOM_LAYER} and mapsgl default satellite layer id. */
8
- export const AGUACERO_SATELLITE_MAP_LAYER_ID = 'aguacero-satellite-layer';
1
+ export const AGUACERO_NEXRAD_MAP_LAYER_ID="aguacero-nexrad-custom-layer",AGUACERO_SATELLITE_MAP_LAYER_ID="aguacero-satellite-layer";
@@ -1,245 +1 @@
1
- /**
2
- * AguaceroCore satellite mode → Android native {@link SatelliteLayerView} (parity with mapsgl
3
- * {@link WeatherLayerManager} satellite paths — preload timeline + scrub via {@code targetUnix}).
4
- */
5
- import { resolveSatelliteS3FileName } from '@aguacerowx/javascript-sdk';
6
- import { satBridgeWarn } from '../satelliteBridgeDiag';
7
- import { aguaceroDebug, getAguaceroAuthDiagnosticSnapshot, isAguaceroRnDebugEnabled, redactApiKeyFromUrl } from '../aguaceroRnDebug';
8
-
9
- /**
10
- * Target frame first, then remaining frames by increasing temporal distance to {@code targetUnix}.
11
- * @param {{ unix: number; url: string; shaderFileName: string }[]} frames
12
- * @param {number | null} targetUnix
13
- */
14
- export function sortFramesByTargetProximity(frames, targetUnix) {
15
- if (!frames.length) return frames;
16
- if (targetUnix == null || !Number.isFinite(targetUnix)) {
17
- return frames;
18
- }
19
- const withDistance = frames.map((f) => ({
20
- ...f,
21
- _d: Math.abs(f.unix - targetUnix),
22
- }));
23
- withDistance.sort((a, b) => {
24
- if (a._d !== b._d) return a._d - b._d;
25
- return a.unix - b.unix;
26
- });
27
- return withDistance.map(({ _d, ...rest }) => rest);
28
- }
29
-
30
- /**
31
- * @param {import('@aguacerowx/javascript-sdk').AguaceroCoreState} state
32
- * @param {number} satelliteTimestamp
33
- */
34
- export function buildSatelliteFetchParts(state, satelliteTimestamp) {
35
- const fileName = resolveSatelliteS3FileName(
36
- state.satelliteChannel,
37
- state.satelliteTimeToFileMap,
38
- satelliteTimestamp,
39
- );
40
- if (!fileName) {
41
- return null;
42
- }
43
- const channelName = state.satelliteChannel || state.variable;
44
- const channelNameUpper = String(channelName).toUpperCase();
45
- let s3FileName = fileName.replace('MULTI', channelNameUpper);
46
- if (!s3FileName.endsWith('.ktx2')) {
47
- s3FileName += '.ktx2';
48
- }
49
- let shaderFileName = s3FileName;
50
- if (!channelNameUpper.startsWith('C') || channelNameUpper.length > 3) {
51
- const token = channelNameUpper.toLowerCase().replace(/_/g, '');
52
- shaderFileName = `${s3FileName}_${token}_`;
53
- }
54
- const apiKey = state.apiKey;
55
- if (!apiKey) {
56
- return null;
57
- }
58
- const url = `https://d3dc62msmxkrd7.cloudfront.net/satellite/${s3FileName}?userId=${encodeURIComponent('sdk-user')}&apiKey=${encodeURIComponent(apiKey)}`;
59
- return { url, shaderFileName, frameKey: Number(satelliteTimestamp), apiKey };
60
- }
61
-
62
- export class SatelliteAndroidController {
63
- /**
64
- * @param {import('@aguacerowx/javascript-sdk').AguaceroCore} core
65
- * @param {React.RefObject<{ syncSatellite?: (json: string) => void; clearSatellite?: () => void; activateSatelliteCachedUnix?: (unix: number) => void; updateSatelliteStyle?: (json: string) => void }>} satelliteLayerRef
66
- */
67
- constructor(core, satelliteLayerRef) {
68
- this.core = core;
69
- this.satelliteLayerRef = satelliteLayerRef;
70
- this._destroyed = false;
71
- /** @type {string | undefined} */
72
- this._cachedRunKey = undefined;
73
- /** @type {string | undefined} */
74
- this._cachedTimelineSig = undefined;
75
- /** @type {number | null | undefined} */
76
- this._lastTargetUnix = undefined;
77
- /** @type {string | undefined} */
78
- this._lastStyleJson = undefined;
79
- }
80
-
81
- destroy() {
82
- this._destroyed = true;
83
- this._cachedRunKey = undefined;
84
- this._cachedTimelineSig = undefined;
85
- this._lastTargetUnix = undefined;
86
- this._lastStyleJson = undefined;
87
- const native = this.satelliteLayerRef?.current;
88
- native?.clearSatellite?.();
89
- }
90
-
91
- /**
92
- * @param {import('@aguacerowx/javascript-sdk').AguaceroCoreState} state
93
- */
94
- sync(state) {
95
- satBridgeWarn('SatelliteAndroidController.sync enter', {
96
- destroyed: this._destroyed,
97
- isSatellite: Boolean(state?.isSatellite),
98
- instrumentId: state?.satelliteInstrumentId ?? null,
99
- sector: state?.satelliteSectorLabel ?? null,
100
- channel: state?.satelliteChannel ?? null,
101
- tlMapSize:
102
- state?.satelliteTimeToFileMap && typeof state.satelliteTimeToFileMap === 'object'
103
- ? Object.keys(state.satelliteTimeToFileMap).length
104
- : 0,
105
- });
106
-
107
- if (this._destroyed || !state?.isSatellite) {
108
- satBridgeWarn('SatelliteAndroidController.sync early-exit', {
109
- destroyed: this._destroyed,
110
- isSatellite: state?.isSatellite,
111
- });
112
- return;
113
- }
114
-
115
- const native = this.satelliteLayerRef?.current;
116
- if (!native?.syncSatellite) {
117
- satBridgeWarn('SatelliteAndroidController.sync abort: no native.syncSatellite', {
118
- refExists: Boolean(this.satelliteLayerRef?.current),
119
- keys: this.satelliteLayerRef?.current ? Object.keys(this.satelliteLayerRef.current) : [],
120
- });
121
- return;
122
- }
123
-
124
- const keys = Object.keys(state.satelliteTimeToFileMap || {}).sort((a, b) => Number(a) - Number(b));
125
- const satRunKey = `${state.satelliteInstrumentId}|${state.satelliteSectorLabel}|${state.satelliteChannel}|${state.variable || ''}`;
126
- const timelineSig = keys.join(',');
127
-
128
- const mergedState = {
129
- ...state,
130
- apiKey: state.apiKey || this.core.apiKey,
131
- };
132
-
133
- const frames = [];
134
- for (const k of keys) {
135
- const ts = Number(k);
136
- if (!Number.isFinite(ts)) continue;
137
- const parts = buildSatelliteFetchParts(mergedState, ts);
138
- if (!parts) continue;
139
- frames.push({
140
- unix: ts,
141
- url: parts.url,
142
- shaderFileName: parts.shaderFileName,
143
- });
144
- }
145
-
146
- if (frames.length === 0) {
147
- console.warn('[AguaceroWX][satellite][satelliteSyncNoFrames]', {
148
- satRunKey,
149
- timelineKeyCount: keys.length,
150
- hasApiKey: Boolean(mergedState.apiKey),
151
- satelliteChannel: mergedState.satelliteChannel,
152
- mapKeys:
153
- mergedState.satelliteTimeToFileMap &&
154
- typeof mergedState.satelliteTimeToFileMap === 'object'
155
- ? Object.keys(mergedState.satelliteTimeToFileMap).length
156
- : 0,
157
- });
158
- }
159
-
160
- let targetUnix =
161
- state.satelliteTimestamp == null || state.satelliteTimestamp === undefined
162
- ? null
163
- : Number(state.satelliteTimestamp);
164
-
165
- // Core often omits satelliteTimestamp on the first satellite emit; without targetUnix the native
166
- // layer never promotes uploads to activeUnix until a later activateSatelliteCachedUnix — blank map.
167
- if (targetUnix == null || !Number.isFinite(targetUnix)) {
168
- const nk = keys.map((k) => Number(k)).filter((n) => Number.isFinite(n));
169
- if (nk.length > 0) {
170
- targetUnix = Math.max(...nk);
171
- }
172
- }
173
-
174
- const stylePayload = {
175
- visible: state.visible !== false,
176
- opacity: state.opacity ?? 1,
177
- fillSmoothing: 0,
178
- };
179
- const styleJson = JSON.stringify(stylePayload);
180
-
181
- const runKeyChanged = satRunKey !== this._cachedRunKey;
182
- const timelineChanged = timelineSig !== this._cachedTimelineSig;
183
-
184
- if (runKeyChanged || timelineChanged) {
185
- if (isAguaceroRnDebugEnabled()) {
186
- aguaceroDebug('satellite.sync.payload', {
187
- auth: getAguaceroAuthDiagnosticSnapshot(this.core),
188
- frameCount: frames.length,
189
- sampleFrameUrl: frames[0] ? redactApiKeyFromUrl(frames[0].url) : null,
190
- gridRequestSiteOrigin: mergedState.gridRequestSiteOrigin ?? this.core.gridRequestSiteOrigin ?? null,
191
- });
192
- }
193
- const sortedFrames = sortFramesByTargetProximity(frames, targetUnix);
194
- const payload = {
195
- runKey: satRunKey,
196
- // Must match query params on each frame URL (same merge as buildSatelliteFetchParts) and mapsgl fetch headers.
197
- apiKey: mergedState.apiKey || '',
198
- userId: 'sdk-user',
199
- // RN has no browser default Origin; native satellite fetch must mirror WeatherFrameProcessor / AguaceroCore grid headers.
200
- gridRequestSiteOrigin:
201
- typeof this.core.gridRequestSiteOrigin === 'string' ? this.core.gridRequestSiteOrigin : '',
202
- bundleId: this.core.bundleId || '',
203
- visible: stylePayload.visible,
204
- opacity: stylePayload.opacity,
205
- fillSmoothing: stylePayload.fillSmoothing,
206
- frames: sortedFrames,
207
- };
208
- if (targetUnix != null && Number.isFinite(targetUnix)) {
209
- payload.targetUnix = targetUnix;
210
- }
211
-
212
- const payloadJson = JSON.stringify(payload);
213
- native.syncSatellite(payloadJson);
214
- satBridgeWarn('SatelliteAndroidController.sync full payload sent', {
215
- runKey: satRunKey,
216
- timelineChanged,
217
- frameCount: sortedFrames.length,
218
- targetUnix: payload.targetUnix ?? null,
219
- jsonChars: payloadJson.length,
220
- });
221
- this._cachedRunKey = satRunKey;
222
- this._cachedTimelineSig = timelineSig;
223
- this._lastTargetUnix = targetUnix != null && Number.isFinite(targetUnix) ? targetUnix : null;
224
- this._lastStyleJson = styleJson;
225
- return;
226
- }
227
-
228
- // Same timeline: avoid large JSON over the bridge — scrub + style deltas only.
229
- const finiteTarget =
230
- targetUnix != null && Number.isFinite(targetUnix) ? targetUnix : null;
231
- if (finiteTarget !== this._lastTargetUnix) {
232
- if (finiteTarget != null && native.activateSatelliteCachedUnix) {
233
- native.activateSatelliteCachedUnix(finiteTarget);
234
- satBridgeWarn('SatelliteAndroidController.activateSatelliteCachedUnix', { unix: finiteTarget });
235
- }
236
- this._lastTargetUnix = finiteTarget;
237
- }
238
-
239
- if (styleJson !== this._lastStyleJson && native.updateSatelliteStyle) {
240
- native.updateSatelliteStyle(styleJson);
241
- satBridgeWarn('SatelliteAndroidController.updateSatelliteStyle', { jsonChars: styleJson.length });
242
- this._lastStyleJson = styleJson;
243
- }
244
- }
245
- }
1
+ import{resolveSatelliteS3FileName as f}from"@aguacerowx/javascript-sdk";import{satBridgeWarn as h}from"../satelliteBridgeDiag";import{isAguaceroRnDebugEnabled as b}from"../aguaceroRnDebug";import{logSatelliteSyncReport as T}from"../satelliteRnDebug";export function sortFramesByTargetProximity(r,e){if(!r.length||e==null||!Number.isFinite(e))return r;const n=r.map(i=>({...i,_d:Math.abs(i.unix-e)}));return n.sort((i,t)=>i._d!==t._d?i._d-t._d:i.unix-t.unix),n.map(({_d:i,...t})=>t)}export function buildSatelliteFetchParts(r,e){const n=f(r.satelliteChannel,r.satelliteTimeToFileMap,e);if(!n)return null;const i=r.satelliteChannel||r.variable,t=String(i).toUpperCase();let c=n.replace("MULTI",t);c.endsWith(".ktx2")||(c+=".ktx2");let a=c;if(!t.startsWith("C")||t.length>3){const l=t.toLowerCase().replace(/_/g,"");a=`${c}_${l}_`}const d=r.apiKey;return d?{url:`https://d3dc62msmxkrd7.cloudfront.net/satellite/${c}?userId=${encodeURIComponent("sdk-user")}&apiKey=${encodeURIComponent(d)}`,shaderFileName:a,frameKey:Number(e),apiKey:d}:null}export class SatelliteAndroidController{constructor(e,n){this.core=e,this.satelliteLayerRef=n,this._destroyed=!1,this._cachedRunKey=void 0,this._cachedTimelineSig=void 0,this._lastTargetUnix=void 0,this._lastStyleJson=void 0}destroy(){this._destroyed=!0,this._cachedRunKey=void 0,this._cachedTimelineSig=void 0,this._lastTargetUnix=void 0,this._lastStyleJson=void 0,this.satelliteLayerRef?.current?.clearSatellite?.()}sync(e){if(h("SatelliteAndroidController.sync enter",{destroyed:this._destroyed,isSatellite:!!e?.isSatellite,instrumentId:e?.satelliteInstrumentId??null,sector:e?.satelliteSectorLabel??null,channel:e?.satelliteChannel??null,tlMapSize:e?.satelliteTimeToFileMap&&typeof e.satelliteTimeToFileMap=="object"?Object.keys(e.satelliteTimeToFileMap).length:0}),this._destroyed||!e?.isSatellite){h("SatelliteAndroidController.sync early-exit",{destroyed:this._destroyed,isSatellite:e?.isSatellite});return}const n=this.satelliteLayerRef?.current;if(!n?.syncSatellite){h("SatelliteAndroidController.sync abort: no native.syncSatellite",{refExists:!!this.satelliteLayerRef?.current,keys:this.satelliteLayerRef?.current?Object.keys(this.satelliteLayerRef.current):[]});return}const i=Object.keys(e.satelliteTimeToFileMap||{}).sort((o,s)=>Number(o)-Number(s)),t=`${e.satelliteInstrumentId}|${e.satelliteSectorLabel}|${e.satelliteChannel}|${e.variable||""}`,c=i.join(","),a={...e,apiKey:e.apiKey||this.core.apiKey},d=[];for(const o of i){const s=Number(o);if(!Number.isFinite(s))continue;const u=buildSatelliteFetchParts(a,s);u&&d.push({unix:s,url:u.url,shaderFileName:u.shaderFileName})}d.length===0&&console.warn("[AguaceroWX][satellite][satelliteSyncNoFrames]",{satRunKey:t,timelineKeyCount:i.length,hasApiKey:!!a.apiKey,satelliteChannel:a.satelliteChannel,gridRequestSiteOrigin:a.gridRequestSiteOrigin??this.core.gridRequestSiteOrigin??null,bundleId:this.core.bundleId??null,mapKeys:a.satelliteTimeToFileMap&&typeof a.satelliteTimeToFileMap=="object"?Object.keys(a.satelliteTimeToFileMap).length:0,hint:i.length===0?"Timeline empty \u2014 wait for core.initialize / listing, or check satelliteId/sector/product.":"Timeline has keys but no resolvable frame URLs \u2014 check satelliteChannel vs listing (e.g. geocolor needs MULTI on CONUS)."});let l=e.satelliteTimestamp==null||e.satelliteTimestamp===void 0?null:Number(e.satelliteTimestamp);if(l==null||!Number.isFinite(l)){const o=i.map(s=>Number(s)).filter(s=>Number.isFinite(s));o.length>0&&(l=Math.max(...o))}const y={visible:e.visible!==!1,opacity:e.opacity??1,fillSmoothing:0},m=JSON.stringify(y),p=t!==this._cachedRunKey,S=c!==this._cachedTimelineSig;if(p||S){const o=sortFramesByTargetProximity(d,l);T({state:a,core:this.core,frames:o,targetUnix:l,runKey:t,timelineKeyCount:i.length,runKeyChanged:p,timelineChanged:S,stylePayload:y});const s={runKey:t,apiKey:a.apiKey||"",userId:"sdk-user",gridRequestSiteOrigin:typeof this.core.gridRequestSiteOrigin=="string"?this.core.gridRequestSiteOrigin:"",bundleId:this.core.bundleId||"",visible:y.visible,opacity:y.opacity,fillSmoothing:y.fillSmoothing,debug:b(),frames:o};l!=null&&Number.isFinite(l)&&(s.targetUnix=l);const u=JSON.stringify(s);n.syncSatellite(u),h("SatelliteAndroidController.sync full payload sent",{runKey:t,timelineChanged:S,frameCount:o.length,targetUnix:s.targetUnix??null,jsonChars:u.length}),this._cachedRunKey=t,this._cachedTimelineSig=c,this._lastTargetUnix=l!=null&&Number.isFinite(l)?l:null,this._lastStyleJson=m;return}const g=l!=null&&Number.isFinite(l)?l:null;g!==this._lastTargetUnix&&(g!=null&&n.activateSatelliteCachedUnix&&(n.activateSatelliteCachedUnix(g),h("SatelliteAndroidController.activateSatelliteCachedUnix",{unix:g})),this._lastTargetUnix=g),m!==this._lastStyleJson&&n.updateSatelliteStyle&&(n.updateSatelliteStyle(m),h("SatelliteAndroidController.updateSatelliteStyle",{jsonChars:m.length}),this._lastStyleJson=m)}}
@@ -1,15 +1 @@
1
- /**
2
- * Always-on warnings for satellite bridge debugging (Metro + many device log sinks).
3
- * Filter Xcode / Metro: `sat-bridge` or `AguaceroWX`.
4
- */
5
- export function satBridgeWarn(tag, detail) {
6
- try {
7
- if (detail !== undefined) {
8
- console.warn(`[AguaceroWX][sat-bridge] ${tag}`, detail);
9
- } else {
10
- console.warn(`[AguaceroWX][sat-bridge] ${tag}`);
11
- }
12
- } catch {
13
- /* ignore */
14
- }
15
- }
1
+ export function satBridgeWarn(a,o){try{o!==void 0?console.warn(`[AguaceroWX][sat-bridge] ${a}`,o):console.warn(`[AguaceroWX][sat-bridge] ${a}`)}catch{}}
@@ -0,0 +1 @@
1
+ import{NativeEventEmitter as S,Platform as p,UIManager as b}from"react-native";import{aguaceroDebug as c,aguaceroDebugWarn as h,getAguaceroAuthDiagnosticSnapshot as v,isAguaceroRnDebugEnabled as g,redactApiKeyFromUrl as N}from"./aguaceroRnDebug";export const SATELLITE_DIAGNOSTIC_EVENT="AguaceroSatelliteDiagnostic";const I="[AguaceroRN][satellite]";let d=null;const x={1:"ETC2_RGBA (preferred Android)",10:"ASTC_LDR_4x4 (black tiles if GPU cannot sample ASTC)",13:"RGBA32 (universal fallback)"};export function basisFormatLabel(t){return t==null||Number.isNaN(Number(t))?"unknown":x[Number(t)]??`ordinal_${t}`}export function interpretSatelliteBlackScreenHints(t){const e=[],a=Number(t.frameCount??0),n=Number(t.nativeCachedFrames??t.cachedFrameCount??NaN),i=t.targetUnix,o=t.activeUnix,r=t.visible,l=t.opacity,u=t.basisFormatOrdinal??t.transcodeFormatOrdinal;return a===0&&e.push("JS built zero frame URLs \u2014 check satellite listing, channel (geocolor), and sector."),r===!1&&e.push("Layer visible=false \u2014 imagery is hidden by state/UI."),typeof l=="number"&&l<=0&&e.push("Layer opacity=0 \u2014 increase opacity in WeatherLayerManager state."),i!=null&&n===0&&!Number.isNaN(n)&&e.push("targetUnix is set but native GPU cache is empty \u2014 KTX fetch/decode/upload failed; check native diagnostic events or logcat (AguaceroSatelliteView)."),o==null&&i!=null&&e.push("targetUnix set but no active frame on GPU yet \u2014 wait for decode or prior frame failed upload (ASTC on unsupported GPU is common)."),Number(u)===10&&e.push("Transcoded to ASTC \u2014 if the map footprint is black, rebuild SDK with ETC2-first transcode or check AguaceroSatellite for GPU upload GL errors."),t.bundleIdPresent===!1&&e.push("bundleId missing \u2014 install react-native-device-info; some keys require x-app-identifier (usually 403, not black tiles)."),t.mapLayerAdded===!1&&e.push("Mapbox custom satellite layer not attached \u2014 ensure WeatherLayerManager is a child of MapManager."),t.satelliteNativeMissing===!0&&e.push("SatelliteLayer native view manager not registered \u2014 rebuild app / link @aguacerowx/react-native android."),e.length===0&&e.push("JS pipeline looks healthy \u2014 inspect native events below (fetch bytes, transcode format, GPU upload). Filter logcat: AguaceroSatelliteView AguaceroSatellite AguaceroSatKtx"),e}export function auditSatelliteIntegration(t={}){if(!g())return;const{core:e,satelliteLayerRef:a}=t;let n=[],i=[],o=null;try{n=Object.keys(b.getViewManagerConfig?.("SatelliteLayer")?.Commands??{})}catch(s){o=String(s?.message??s),n=[]}try{i=Object.keys(b.getViewManagerConfig?.("GridRenderLayer")?.Commands??{})}catch{i=[]}let r=!1,l=null;try{const s=require("react-native-device-info");r=!0;try{l=s.getBundleId?.()??null}catch{l=null}}catch{r=!1}const u={platform:p.OS,satelliteNativeCommands:n,satelliteNativeMissing:n.length===0,satelliteManagerError:o,gridNativeCommands:i,satelliteRefAttached:!!a?.current,satelliteRefMethods:a?.current?Object.keys(a.current):[],reactNativeDeviceInfo:r?{installed:!0,bundleId:l}:{installed:!1,hint:"npm install react-native-device-info \u2014 required for core.bundleId / x-app-identifier"},mapboxNote:"Requires @rnmapbox/maps v11; WeatherLayerManager must be nested inside MapManager",nativeLibraries:["aguacero_satellite_ktx (KTX2 Basis transcoder JNI)"],auth:e?v(e):void 0};return c("integration.audit",u),n.length===0&&h("integration.satelliteNativeMissing",{hint:"SatelliteLayer ViewManager has no commands \u2014 satellite will never render on Android."}),e&&!e.bundleId&&p.OS!=="web"&&h("integration.bundleIdMissing",{hint:"core.bundleId is null \u2014 CDN may still work; some API keys require react-native-device-info.",deviceInfoInstalled:r}),u}export function logSatelliteSyncReport(t){if(!g())return;const{state:e,core:a,frames:n,targetUnix:i,runKey:o,timelineKeyCount:r,runKeyChanged:l,timelineChanged:u,stylePayload:s}=t,m=n?.[0],f=n?.length?n[n.length-1]:null,y={runKey:o,runKeyChanged:l,timelineChanged:u,timelineKeyCount:r,builtFrameCount:n?.length??0,targetUnix:i,satelliteTimestamp:e?.satelliteTimestamp??null,style:s,instrument:e?.satelliteInstrumentId,sector:e?.satelliteSectorLabel,channel:e?.satelliteChannel,availableSatelliteTimestamps:e?.availableSatelliteTimestamps?.length??0,sampleShaderFileName:m?.shaderFileName??null,sampleFrameUrl:m?.url?N(m.url):null,firstUnix:m?.unix??null,lastUnix:f?.unix??null,auth:a?v(a):void 0,blackScreenHints:interpretSatelliteBlackScreenHints({frameCount:n?.length??0,targetUnix:i,visible:s?.visible,opacity:s?.opacity,bundleIdPresent:!!a?.bundleId})};c("sync.report",y)}export function installSatelliteDiagnosticListener(){return g()?p.OS!=="android"?(c("nativeEvents.skipped",{reason:"only Android emits AguaceroSatelliteDiagnostic today"}),()=>{}):(d&&(d.remove(),d=null),d=new S().addListener(SATELLITE_DIAGNOSTIC_EVENT,t=>{if(!t||typeof t!="object")return;const e=t.phase??"unknown",a={...t};delete a.phase,a.basisFormatOrdinal!=null&&(a.basisFormat=basisFormatLabel(a.basisFormatOrdinal)),a.transcodeFormatOrdinal!=null&&(a.transcodeFormat=basisFormatLabel(a.transcodeFormatOrdinal)),e.includes("fail")||e.includes("error")||e==="render.noDraw"||e==="render.poll"&&(a.cachedFrameCount===0||a.activeUnix==null)?(a.blackScreenHints=interpretSatelliteBlackScreenHints(a),h(`native.${e}`,a)):c(`native.${e}`,a)}),c("nativeEvents.installed",{event:SATELLITE_DIAGNOSTIC_EVENT,hint:"Native fetch/decode/GPU logs will appear here when debug=true on WeatherLayerManager"}),()=>{d?.remove(),d=null}):()=>{}}export function logSatelliteNativeDiagnostic(t){if(!g()||!t)return;const e=t.phase??"event";c(`native.${e}`,t)}
@@ -1,51 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.resolveNexradCommandId = resolveNexradCommandId;
7
- var _reactNative = require("react-native");
8
- /**
9
- * Resolves the second argument to {@code UIManager.dispatchViewManagerCommand}.
10
- *
11
- * - **Android**: prefers {@code UIManager.getViewManagerConfig('NexradRadarLayer').Commands}
12
- * then numeric fallback matching {@code NexradRadarManager.java} {@code getCommandsMap}.
13
- *
14
- * - **iOS New Architecture (Fabric)**: numeric IDs do **not** map to {@code receiveCommand:}.
15
- * {@code RCTLegacyViewManagerInteropCoordinator} indexes {@code RCT_EXPORT_METHOD} by
16
- * integer **or** resolves by **string name**. NexradRadarLayer uses {@code codegenNativeComponent};
17
- * we dispatch **string command names** so native resolves via {@code methodsByName} (see
18
- * {@code NexradRadarManager.mm} {@code RCT_EXPORT_METHOD} entries).
19
- */
20
-
21
- const COMPONENT_NAME = 'NexradRadarLayer';
22
-
23
- /** @type {Record<string, number>} */
24
- const ANDROID_COMMAND_FALLBACK = Object.freeze({
25
- uploadNexradFrame: 1,
26
- uploadNexradStyleOnly: 2,
27
- clearNexrad: 3,
28
- activateNexradCachedFrame: 4
29
- });
30
-
31
- /**
32
- * @param {keyof typeof ANDROID_COMMAND_FALLBACK} commandName
33
- * @returns {number | string | null}
34
- */
35
- function resolveNexradCommandId(commandName) {
36
- if (_reactNative.Platform.OS === 'ios') {
37
- return commandName;
38
- }
39
- try {
40
- const config = _reactNative.UIManager.getViewManagerConfig(COMPONENT_NAME);
41
- const fromRegistry = config?.Commands?.[commandName];
42
- if (fromRegistry != null && fromRegistry !== undefined) {
43
- return fromRegistry;
44
- }
45
- } catch {
46
- /* bridge not ready */
47
- }
48
- const fb = ANDROID_COMMAND_FALLBACK[commandName];
49
- return fb !== undefined ? fb : null;
50
- }
51
- //# sourceMappingURL=nexradNativeCommandIds.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNative","require","COMPONENT_NAME","ANDROID_COMMAND_FALLBACK","Object","freeze","uploadNexradFrame","uploadNexradStyleOnly","clearNexrad","activateNexradCachedFrame","resolveNexradCommandId","commandName","Platform","OS","config","UIManager","getViewManagerConfig","fromRegistry","Commands","undefined","fb"],"sourceRoot":"..\\..\\..\\src","sources":["nexrad/nexradNativeCommandIds.js"],"mappings":";;;;;;AAYA,IAAAA,YAAA,GAAAC,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,MAAMC,cAAc,GAAG,kBAAkB;;AAEzC;AACA,MAAMC,wBAAwB,GAAGC,MAAM,CAACC,MAAM,CAAC;EAC3CC,iBAAiB,EAAE,CAAC;EACpBC,qBAAqB,EAAE,CAAC;EACxBC,WAAW,EAAE,CAAC;EACdC,yBAAyB,EAAE;AAC/B,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACO,SAASC,sBAAsBA,CAACC,WAAW,EAAE;EAChD,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACvB,OAAOF,WAAW;EACtB;EACA,IAAI;IACA,MAAMG,MAAM,GAAGC,sBAAS,CAACC,oBAAoB,CAACd,cAAc,CAAC;IAC7D,MAAMe,YAAY,GAAGH,MAAM,EAAEI,QAAQ,GAAGP,WAAW,CAAC;IACpD,IAAIM,YAAY,IAAI,IAAI,IAAIA,YAAY,KAAKE,SAAS,EAAE;MACpD,OAAOF,YAAY;IACvB;EACJ,CAAC,CAAC,MAAM;IACJ;EAAA;EAEJ,MAAMG,EAAE,GAAGjB,wBAAwB,CAACQ,WAAW,CAAC;EAChD,OAAOS,EAAE,KAAKD,SAAS,GAAGC,EAAE,GAAG,IAAI;AACvC","ignoreList":[]}
@@ -1,44 +0,0 @@
1
- /**
2
- * Resolves the second argument to {@code UIManager.dispatchViewManagerCommand}.
3
- *
4
- * - **Android**: prefers {@code UIManager.getViewManagerConfig('NexradRadarLayer').Commands}
5
- * then numeric fallback matching {@code NexradRadarManager.java} {@code getCommandsMap}.
6
- *
7
- * - **iOS New Architecture (Fabric)**: numeric IDs do **not** map to {@code receiveCommand:}.
8
- * {@code RCTLegacyViewManagerInteropCoordinator} indexes {@code RCT_EXPORT_METHOD} by
9
- * integer **or** resolves by **string name**. NexradRadarLayer uses {@code codegenNativeComponent};
10
- * we dispatch **string command names** so native resolves via {@code methodsByName} (see
11
- * {@code NexradRadarManager.mm} {@code RCT_EXPORT_METHOD} entries).
12
- */
13
- import { Platform, UIManager } from 'react-native';
14
- const COMPONENT_NAME = 'NexradRadarLayer';
15
-
16
- /** @type {Record<string, number>} */
17
- const ANDROID_COMMAND_FALLBACK = Object.freeze({
18
- uploadNexradFrame: 1,
19
- uploadNexradStyleOnly: 2,
20
- clearNexrad: 3,
21
- activateNexradCachedFrame: 4
22
- });
23
-
24
- /**
25
- * @param {keyof typeof ANDROID_COMMAND_FALLBACK} commandName
26
- * @returns {number | string | null}
27
- */
28
- export function resolveNexradCommandId(commandName) {
29
- if (Platform.OS === 'ios') {
30
- return commandName;
31
- }
32
- try {
33
- const config = UIManager.getViewManagerConfig(COMPONENT_NAME);
34
- const fromRegistry = config?.Commands?.[commandName];
35
- if (fromRegistry != null && fromRegistry !== undefined) {
36
- return fromRegistry;
37
- }
38
- } catch {
39
- /* bridge not ready */
40
- }
41
- const fb = ANDROID_COMMAND_FALLBACK[commandName];
42
- return fb !== undefined ? fb : null;
43
- }
44
- //# sourceMappingURL=nexradNativeCommandIds.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["Platform","UIManager","COMPONENT_NAME","ANDROID_COMMAND_FALLBACK","Object","freeze","uploadNexradFrame","uploadNexradStyleOnly","clearNexrad","activateNexradCachedFrame","resolveNexradCommandId","commandName","OS","config","getViewManagerConfig","fromRegistry","Commands","undefined","fb"],"sourceRoot":"..\\..\\..\\src","sources":["nexrad/nexradNativeCommandIds.js"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,cAAc;AAElD,MAAMC,cAAc,GAAG,kBAAkB;;AAEzC;AACA,MAAMC,wBAAwB,GAAGC,MAAM,CAACC,MAAM,CAAC;EAC3CC,iBAAiB,EAAE,CAAC;EACpBC,qBAAqB,EAAE,CAAC;EACxBC,WAAW,EAAE,CAAC;EACdC,yBAAyB,EAAE;AAC/B,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAACC,WAAW,EAAE;EAChD,IAAIX,QAAQ,CAACY,EAAE,KAAK,KAAK,EAAE;IACvB,OAAOD,WAAW;EACtB;EACA,IAAI;IACA,MAAME,MAAM,GAAGZ,SAAS,CAACa,oBAAoB,CAACZ,cAAc,CAAC;IAC7D,MAAMa,YAAY,GAAGF,MAAM,EAAEG,QAAQ,GAAGL,WAAW,CAAC;IACpD,IAAII,YAAY,IAAI,IAAI,IAAIA,YAAY,KAAKE,SAAS,EAAE;MACpD,OAAOF,YAAY;IACvB;EACJ,CAAC,CAAC,MAAM;IACJ;EAAA;EAEJ,MAAMG,EAAE,GAAGf,wBAAwB,CAACQ,WAAW,CAAC;EAChD,OAAOO,EAAE,KAAKD,SAAS,GAAGC,EAAE,GAAG,IAAI;AACvC","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- /**
2
- * @param {keyof typeof ANDROID_COMMAND_FALLBACK} commandName
3
- * @returns {number | string | null}
4
- */
5
- export function resolveNexradCommandId(commandName: keyof typeof ANDROID_COMMAND_FALLBACK): number | string | null;
6
- /** @type {Record<string, number>} */
7
- declare const ANDROID_COMMAND_FALLBACK: Record<string, number>;
8
- export {};
9
- //# sourceMappingURL=nexradNativeCommandIds.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nexradNativeCommandIds.d.ts","sourceRoot":"","sources":["../../../src/nexrad/nexradNativeCommandIds.js"],"names":[],"mappings":"AAwBA;;;GAGG;AACH,oDAHW,MAAM,OAAO,wBAAwB,GACnC,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBlC;AA3BD,qCAAqC;AACrC,wCADW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAM9B"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Resolves the second argument to {@code UIManager.dispatchViewManagerCommand}.
3
- *
4
- * - **Android**: prefers {@code UIManager.getViewManagerConfig('NexradRadarLayer').Commands}
5
- * then numeric fallback matching {@code NexradRadarManager.java} {@code getCommandsMap}.
6
- *
7
- * - **iOS New Architecture (Fabric)**: numeric IDs do **not** map to {@code receiveCommand:}.
8
- * {@code RCTLegacyViewManagerInteropCoordinator} indexes {@code RCT_EXPORT_METHOD} by
9
- * integer **or** resolves by **string name**. NexradRadarLayer uses {@code codegenNativeComponent};
10
- * we dispatch **string command names** so native resolves via {@code methodsByName} (see
11
- * {@code NexradRadarManager.mm} {@code RCT_EXPORT_METHOD} entries).
12
- */
13
- import { Platform, UIManager } from 'react-native';
14
-
15
- const COMPONENT_NAME = 'NexradRadarLayer';
16
-
17
- /** @type {Record<string, number>} */
18
- const ANDROID_COMMAND_FALLBACK = Object.freeze({
19
- uploadNexradFrame: 1,
20
- uploadNexradStyleOnly: 2,
21
- clearNexrad: 3,
22
- activateNexradCachedFrame: 4,
23
- });
24
-
25
- /**
26
- * @param {keyof typeof ANDROID_COMMAND_FALLBACK} commandName
27
- * @returns {number | string | null}
28
- */
29
- export function resolveNexradCommandId(commandName) {
30
- if (Platform.OS === 'ios') {
31
- return commandName;
32
- }
33
- try {
34
- const config = UIManager.getViewManagerConfig(COMPONENT_NAME);
35
- const fromRegistry = config?.Commands?.[commandName];
36
- if (fromRegistry != null && fromRegistry !== undefined) {
37
- return fromRegistry;
38
- }
39
- } catch {
40
- /* bridge not ready */
41
- }
42
- const fb = ANDROID_COMMAND_FALLBACK[commandName];
43
- return fb !== undefined ? fb : null;
44
- }