expo-gaode-map 1.1.8 → 2.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/README.en.md +32 -46
  2. package/README.md +51 -70
  3. package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapView.kt +98 -268
  4. package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapViewModule.kt +1 -49
  5. package/android/src/main/java/expo/modules/gaodemap/managers/CameraManager.kt +30 -7
  6. package/android/src/main/java/expo/modules/gaodemap/managers/UIManager.kt +1 -0
  7. package/android/src/main/java/expo/modules/gaodemap/modules/LocationManager.kt +10 -1
  8. package/android/src/main/java/expo/modules/gaodemap/overlays/CircleView.kt +38 -14
  9. package/android/src/main/java/expo/modules/gaodemap/overlays/CircleViewModule.kt +3 -3
  10. package/android/src/main/java/expo/modules/gaodemap/overlays/ClusterView.kt +8 -1
  11. package/android/src/main/java/expo/modules/gaodemap/overlays/HeatMapView.kt +4 -1
  12. package/android/src/main/java/expo/modules/gaodemap/overlays/MarkerView.kt +322 -93
  13. package/android/src/main/java/expo/modules/gaodemap/overlays/MarkerViewModule.kt +11 -3
  14. package/android/src/main/java/expo/modules/gaodemap/overlays/MultiPointView.kt +4 -1
  15. package/android/src/main/java/expo/modules/gaodemap/overlays/PolygonView.kt +25 -11
  16. package/android/src/main/java/expo/modules/gaodemap/overlays/PolygonViewModule.kt +3 -3
  17. package/android/src/main/java/expo/modules/gaodemap/overlays/PolylineView.kt +20 -10
  18. package/android/src/main/java/expo/modules/gaodemap/overlays/PolylineViewModule.kt +6 -2
  19. package/build/ExpoGaodeMap.types.d.ts +27 -6
  20. package/build/ExpoGaodeMap.types.d.ts.map +1 -1
  21. package/build/ExpoGaodeMap.types.js +3 -0
  22. package/build/ExpoGaodeMap.types.js.map +1 -1
  23. package/build/ExpoGaodeMapModule.d.ts +157 -10
  24. package/build/ExpoGaodeMapModule.d.ts.map +1 -1
  25. package/build/ExpoGaodeMapModule.js +4 -0
  26. package/build/ExpoGaodeMapModule.js.map +1 -1
  27. package/build/ExpoGaodeMapView.d.ts +1 -17
  28. package/build/ExpoGaodeMapView.d.ts.map +1 -1
  29. package/build/ExpoGaodeMapView.js +4 -221
  30. package/build/ExpoGaodeMapView.js.map +1 -1
  31. package/build/components/overlays/Circle.d.ts +11 -1
  32. package/build/components/overlays/Circle.d.ts.map +1 -1
  33. package/build/components/overlays/Circle.js +12 -58
  34. package/build/components/overlays/Circle.js.map +1 -1
  35. package/build/components/overlays/Cluster.d.ts.map +1 -1
  36. package/build/components/overlays/Cluster.js.map +1 -1
  37. package/build/components/overlays/Marker.d.ts +13 -1
  38. package/build/components/overlays/Marker.d.ts.map +1 -1
  39. package/build/components/overlays/Marker.js +51 -115
  40. package/build/components/overlays/Marker.js.map +1 -1
  41. package/build/components/overlays/Polygon.d.ts +7 -15
  42. package/build/components/overlays/Polygon.d.ts.map +1 -1
  43. package/build/components/overlays/Polygon.js +10 -80
  44. package/build/components/overlays/Polygon.js.map +1 -1
  45. package/build/components/overlays/Polyline.d.ts +7 -14
  46. package/build/components/overlays/Polyline.d.ts.map +1 -1
  47. package/build/components/overlays/Polyline.js +9 -66
  48. package/build/components/overlays/Polyline.js.map +1 -1
  49. package/build/index.d.ts +1 -4
  50. package/build/index.d.ts.map +1 -1
  51. package/build/index.js +2 -10
  52. package/build/index.js.map +1 -1
  53. package/build/types/map-view.types.d.ts +0 -90
  54. package/build/types/map-view.types.d.ts.map +1 -1
  55. package/build/types/map-view.types.js.map +1 -1
  56. package/build/types/overlays.types.d.ts +9 -9
  57. package/build/types/overlays.types.d.ts.map +1 -1
  58. package/build/types/overlays.types.js.map +1 -1
  59. package/docs/API.en.md +1 -21
  60. package/docs/API.md +84 -56
  61. package/docs/EXAMPLES.en.md +0 -48
  62. package/docs/EXAMPLES.md +49 -102
  63. package/docs/INITIALIZATION.md +59 -71
  64. package/docs/MIGRATION.md +423 -0
  65. package/ios/ExpoGaodeMapModule.swift +4 -0
  66. package/ios/ExpoGaodeMapView.swift +365 -258
  67. package/ios/ExpoGaodeMapViewModule.swift +3 -50
  68. package/ios/managers/CameraManager.swift +23 -2
  69. package/ios/managers/UIManager.swift +10 -5
  70. package/ios/modules/LocationManager.swift +10 -0
  71. package/ios/overlays/CircleView.swift +98 -19
  72. package/ios/overlays/CircleViewModule.swift +21 -0
  73. package/ios/overlays/ClusterView.swift +33 -4
  74. package/ios/overlays/HeatMapView.swift +16 -4
  75. package/ios/overlays/MarkerView.swift +235 -146
  76. package/ios/overlays/MarkerViewModule.swift +7 -3
  77. package/ios/overlays/MultiPointView.swift +30 -1
  78. package/ios/overlays/PolygonView.swift +63 -12
  79. package/ios/overlays/PolygonViewModule.swift +17 -0
  80. package/ios/overlays/PolylineView.swift +95 -25
  81. package/ios/overlays/PolylineViewModule.swift +17 -8
  82. package/ios/utils/PermissionManager.swift +9 -14
  83. package/package.json +4 -3
  84. package/src/ExpoGaodeMap.types.ts +28 -3
  85. package/src/ExpoGaodeMapModule.ts +201 -12
  86. package/src/ExpoGaodeMapView.tsx +9 -234
  87. package/src/components/overlays/Circle.tsx +14 -70
  88. package/src/components/overlays/Cluster.tsx +0 -1
  89. package/src/components/overlays/Marker.tsx +63 -138
  90. package/src/components/overlays/Polygon.tsx +12 -92
  91. package/src/components/overlays/Polyline.tsx +11 -77
  92. package/src/index.ts +4 -29
  93. package/src/types/map-view.types.ts +1 -85
  94. package/src/types/overlays.types.ts +9 -9
  95. package/android/src/main/java/expo/modules/gaodemap/managers/OverlayManager.kt +0 -574
  96. package/build/modules/AMapLocation.d.ts +0 -78
  97. package/build/modules/AMapLocation.d.ts.map +0 -1
  98. package/build/modules/AMapLocation.js +0 -132
  99. package/build/modules/AMapLocation.js.map +0 -1
  100. package/build/modules/AMapPermissions.d.ts +0 -29
  101. package/build/modules/AMapPermissions.d.ts.map +0 -1
  102. package/build/modules/AMapPermissions.js +0 -23
  103. package/build/modules/AMapPermissions.js.map +0 -1
  104. package/build/modules/AMapSDK.d.ts +0 -22
  105. package/build/modules/AMapSDK.d.ts.map +0 -1
  106. package/build/modules/AMapSDK.js +0 -25
  107. package/build/modules/AMapSDK.js.map +0 -1
  108. package/build/modules/AMapView.d.ts +0 -44
  109. package/build/modules/AMapView.d.ts.map +0 -1
  110. package/build/modules/AMapView.js +0 -65
  111. package/build/modules/AMapView.js.map +0 -1
  112. package/ios/managers/OverlayManager.swift +0 -522
  113. package/src/modules/AMapLocation.ts +0 -165
  114. package/src/modules/AMapPermissions.ts +0 -41
  115. package/src/modules/AMapSDK.ts +0 -31
  116. package/src/modules/AMapView.ts +0 -72
@@ -6,18 +6,25 @@ import com.amap.api.maps.AMap
6
6
  import com.amap.api.maps.model.LatLng
7
7
  import com.amap.api.maps.model.Polygon
8
8
  import com.amap.api.maps.model.PolygonOptions
9
+ import expo.modules.gaodemap.utils.ColorParser
9
10
  import expo.modules.kotlin.AppContext
10
11
  import expo.modules.kotlin.viewevent.EventDispatcher
11
12
  import expo.modules.kotlin.views.ExpoView
12
13
 
13
14
  class PolygonView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
14
15
 
15
- private val onPress by EventDispatcher()
16
+ private val onPolygonPress by EventDispatcher()
16
17
 
17
18
  private var polygon: Polygon? = null
18
19
  private var aMap: AMap? = null
19
20
  private var points: List<LatLng> = emptyList()
20
21
  private var strokeWidth: Float = 10f
22
+
23
+ private var fillColor: Int = Color.argb(50, 0, 0, 255)
24
+
25
+ private var strokeColor: Int = Color.BLUE
26
+
27
+ private var _zIndex: Float = 0f
21
28
 
22
29
  /**
23
30
  * 设置地图实例
@@ -25,7 +32,8 @@ class PolygonView(context: Context, appContext: AppContext) : ExpoView(context,
25
32
  @Suppress("unused")
26
33
  fun setMap(map: AMap) {
27
34
  aMap = map
28
- createOrUpdatePolygon()
35
+ post { createOrUpdatePolygon() }
36
+
29
37
  }
30
38
 
31
39
  /**
@@ -35,7 +43,8 @@ class PolygonView(context: Context, appContext: AppContext) : ExpoView(context,
35
43
  points = pointsList.mapNotNull { point ->
36
44
  val lat = point["latitude"]
37
45
  val lng = point["longitude"]
38
- if (lat != null && lng != null) {
46
+ // 坐标验证
47
+ if (lat != null && lng != null && lat >= -90 && lat <= 90 && lng >= -180 && lng <= 180) {
39
48
  LatLng(lat, lng)
40
49
  } else null
41
50
  }
@@ -47,18 +56,20 @@ class PolygonView(context: Context, appContext: AppContext) : ExpoView(context,
47
56
  /**
48
57
  * 设置填充颜色
49
58
  */
50
- fun setFillColor(color: Int) {
59
+ fun setFillColor(color: Any) {
60
+ fillColor = ColorParser.parseColor(color)
51
61
  polygon?.let {
52
- it.fillColor = color
62
+ it.fillColor = fillColor
53
63
  } ?: createOrUpdatePolygon()
54
64
  }
55
65
 
56
66
  /**
57
67
  * 设置边框颜色
58
68
  */
59
- fun setStrokeColor(color: Int) {
69
+ fun setStrokeColor(color: Any) {
70
+ strokeColor = ColorParser.parseColor(color)
60
71
  polygon?.let {
61
- it.strokeColor = color
72
+ it.strokeColor = strokeColor
62
73
  } ?: createOrUpdatePolygon()
63
74
  }
64
75
 
@@ -78,8 +89,9 @@ class PolygonView(context: Context, appContext: AppContext) : ExpoView(context,
78
89
  * 设置 z-index
79
90
  */
80
91
  fun setZIndex(zIndex: Float) {
92
+ _zIndex = zIndex
81
93
  polygon?.let {
82
- it.zIndex = zIndex
94
+ it.zIndex = _zIndex
83
95
  } ?: createOrUpdatePolygon()
84
96
  }
85
97
 
@@ -91,9 +103,10 @@ class PolygonView(context: Context, appContext: AppContext) : ExpoView(context,
91
103
  if (polygon == null && points.isNotEmpty()) {
92
104
  val options = PolygonOptions()
93
105
  .addAll(points)
94
- .fillColor(Color.argb(50, 0, 0, 255))
95
- .strokeColor(Color.BLUE)
106
+ .fillColor(fillColor)
107
+ .strokeColor(strokeColor)
96
108
  .strokeWidth(strokeWidth)
109
+ .zIndex(_zIndex)
97
110
 
98
111
  polygon = map.addPolygon(options)
99
112
 
@@ -109,7 +122,7 @@ class PolygonView(context: Context, appContext: AppContext) : ExpoView(context,
109
122
  fun checkPress(latLng: LatLng): Boolean {
110
123
  polygon?.let { poly ->
111
124
  if (poly.contains(latLng)) {
112
- onPress(mapOf(
125
+ onPolygonPress(mapOf(
113
126
  "latitude" to latLng.latitude,
114
127
  "longitude" to latLng.longitude
115
128
  ))
@@ -130,5 +143,6 @@ class PolygonView(context: Context, appContext: AppContext) : ExpoView(context,
130
143
  override fun onDetachedFromWindow() {
131
144
  super.onDetachedFromWindow()
132
145
  removePolygon()
146
+ aMap = null
133
147
  }
134
148
  }
@@ -11,17 +11,17 @@ class PolygonViewModule : Module() {
11
11
  Name("PolygonView")
12
12
 
13
13
  View(PolygonView::class) {
14
- Events("onPress")
14
+ Events("onPolygonPress")
15
15
 
16
16
  Prop<List<Map<String, Double>>>("points") { view: PolygonView, points ->
17
17
  view.setPoints(points)
18
18
  }
19
19
 
20
- Prop<Int>("fillColor") { view: PolygonView, color ->
20
+ Prop<Any>("fillColor") { view: PolygonView, color ->
21
21
  view.setFillColor(color)
22
22
  }
23
23
 
24
- Prop<Int>("strokeColor") { view: PolygonView, color ->
24
+ Prop<Any>("strokeColor") { view: PolygonView, color ->
25
25
  view.setStrokeColor(color)
26
26
  }
27
27
 
@@ -7,8 +7,8 @@ import com.amap.api.maps.model.BitmapDescriptorFactory
7
7
  import com.amap.api.maps.model.LatLng
8
8
  import com.amap.api.maps.model.Polyline
9
9
  import com.amap.api.maps.model.PolylineOptions
10
- import com.amap.api.maps.model.PolylineOptions.LineCapType
11
- import com.amap.api.maps.model.PolylineOptions.LineJoinType
10
+
11
+ import expo.modules.gaodemap.utils.ColorParser
12
12
  import expo.modules.kotlin.AppContext
13
13
  import expo.modules.kotlin.viewevent.EventDispatcher
14
14
  import expo.modules.kotlin.views.ExpoView
@@ -16,7 +16,7 @@ import java.net.URL
16
16
 
17
17
  class PolylineView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
18
18
 
19
- private val onPress by EventDispatcher()
19
+ private val onPolylinePress by EventDispatcher()
20
20
 
21
21
  private var polyline: Polyline? = null
22
22
  private var aMap: AMap? = null
@@ -33,7 +33,10 @@ class PolylineView(context: Context, appContext: AppContext) : ExpoView(context,
33
33
  @Suppress("unused")
34
34
  fun setMap(map: AMap) {
35
35
  aMap = map
36
- createOrUpdatePolyline()
36
+ post {
37
+ createOrUpdatePolyline()
38
+ }
39
+
37
40
  }
38
41
 
39
42
  /**
@@ -43,7 +46,8 @@ class PolylineView(context: Context, appContext: AppContext) : ExpoView(context,
43
46
  points = pointsList.mapNotNull { point ->
44
47
  val lat = point["latitude"]
45
48
  val lng = point["longitude"]
46
- if (lat != null && lng != null) {
49
+ // 坐标验证
50
+ if (lat != null && lng != null && lat >= -90 && lat <= 90 && lng >= -180 && lng <= 180) {
47
51
  LatLng(lat, lng)
48
52
  } else null
49
53
  }
@@ -67,10 +71,10 @@ class PolylineView(context: Context, appContext: AppContext) : ExpoView(context,
67
71
  /**
68
72
  * 设置线条颜色
69
73
  */
70
- fun setStrokeColor(color: Int) {
71
- strokeColor = color
74
+ fun setStrokeColor(color: Any) {
75
+ strokeColor = ColorParser.parseColor(color)
72
76
  polyline?.let {
73
- it.color = color
77
+ it.color = strokeColor
74
78
  } ?: createOrUpdatePolyline()
75
79
  }
76
80
 
@@ -98,7 +102,11 @@ class PolylineView(context: Context, appContext: AppContext) : ExpoView(context,
98
102
  it.zIndex = zIndex
99
103
  } ?: createOrUpdatePolyline()
100
104
  }
101
-
105
+
106
+ fun setGradient(gradient: Boolean){
107
+
108
+ }
109
+
102
110
  /**
103
111
  * 设置透明度
104
112
  */
@@ -133,6 +141,7 @@ class PolylineView(context: Context, appContext: AppContext) : ExpoView(context,
133
141
  .width(strokeWidth)
134
142
  .color(strokeColor)
135
143
  .geodesic(isGeodesic)
144
+
136
145
 
137
146
  // 设置虚线样式
138
147
  if (isDotted) {
@@ -196,7 +205,7 @@ class PolylineView(context: Context, appContext: AppContext) : ExpoView(context,
196
205
  for (i in 0 until linePoints.size - 1) {
197
206
  val distance = distanceToSegment(latLng, linePoints[i], linePoints[i + 1])
198
207
  if (distance <= threshold) {
199
- onPress(mapOf(
208
+ onPolylinePress(mapOf(
200
209
  "latitude" to latLng.latitude,
201
210
  "longitude" to latLng.longitude
202
211
  ))
@@ -253,5 +262,6 @@ class PolylineView(context: Context, appContext: AppContext) : ExpoView(context,
253
262
  override fun onDetachedFromWindow() {
254
263
  super.onDetachedFromWindow()
255
264
  removePolyline()
265
+ aMap = null
256
266
  }
257
267
  }
@@ -11,7 +11,7 @@ class PolylineViewModule : Module() {
11
11
  Name("PolylineView")
12
12
 
13
13
  View(PolylineView::class) {
14
- Events("onPress")
14
+ Events("onPolylinePress")
15
15
 
16
16
  Prop<List<Map<String, Double>>>("points") { view: PolylineView, points ->
17
17
  view.setPoints(points)
@@ -21,7 +21,7 @@ class PolylineViewModule : Module() {
21
21
  view.setStrokeWidth(width)
22
22
  }
23
23
 
24
- Prop<Int>("strokeColor") { view: PolylineView, color ->
24
+ Prop<Any>("strokeColor") { view: PolylineView, color ->
25
25
  view.setStrokeColor(color)
26
26
  }
27
27
 
@@ -40,6 +40,10 @@ class PolylineViewModule : Module() {
40
40
  Prop<Float>("zIndex") { view: PolylineView, zIndex ->
41
41
  view.setZIndex(zIndex)
42
42
  }
43
+
44
+ Prop<Boolean>("gradient") { view: PolylineView, gradient ->
45
+ view.setGradient(gradient)
46
+ }
43
47
  }
44
48
  }
45
49
  }
@@ -1,20 +1,41 @@
1
+ /**
2
+ * 高德地图 Expo 模块类型定义
3
+ */
4
+ import type { Coordinates, ReGeocode } from './types';
1
5
  export * from './types';
2
- export type { LatLng, Point, CameraPosition, LatLngBounds, MapPoi, MapViewProps, CameraEvent, Coordinates, ReGeocode, LocationOptions, MarkerProps, PolylineProps, PolygonProps, CircleProps, HeatMapProps, MultiPointProps, ClusterProps, } from './types';
6
+ export type { LatLng, Point, CameraPosition, LatLngBounds, MapPoi, MapViewProps, CameraEvent, Coordinates, ReGeocode, LocationOptions, LocationListener, MarkerProps, PolylineProps, PolygonProps, CircleProps, HeatMapProps, MultiPointProps, ClusterProps, } from './types';
3
7
  export { MapType, LocationMode, LocationAccuracy, CoordinateType, } from './types';
4
8
  /**
5
9
  * Expo 模块事件类型
10
+ * 定义了原生模块可以触发的事件
6
11
  */
7
12
  export type ExpoGaodeMapModuleEvents = {
8
13
  /**
9
14
  * 定位更新事件
15
+ * 当位置发生变化时触发
16
+ * @param location 位置信息,包含坐标和可选的逆地理编码信息
10
17
  */
11
- onLocationUpdate: (location: any) => void;
18
+ onLocationUpdate: (location: Coordinates | ReGeocode) => void;
12
19
  /**
13
- * 定位错误事件
20
+ * 方向更新事件(iOS)
21
+ * 当设备方向发生变化时触发
22
+ * @param heading 方向信息
14
23
  */
15
- onLocationError: (error: {
16
- code: number;
17
- message: string;
24
+ onHeadingUpdate: (heading: {
25
+ /** 磁北方向角度 (0-359.9) */
26
+ magneticHeading: number;
27
+ /** 真北方向角度 (0-359.9) */
28
+ trueHeading: number;
29
+ /** 方向精度 */
30
+ headingAccuracy: number;
31
+ /** X 轴原始数据 */
32
+ x: number;
33
+ /** Y 轴原始数据 */
34
+ y: number;
35
+ /** Z 轴原始数据 */
36
+ z: number;
37
+ /** 时间戳 */
38
+ timestamp: number;
18
39
  }) => void;
19
40
  };
20
41
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoGaodeMap.types.d.ts","sourceRoot":"","sources":["../src/ExpoGaodeMap.types.ts"],"names":[],"mappings":"AAGA,cAAc,SAAS,CAAC;AAGxB,YAAY,EAEV,MAAM,EACN,KAAK,EACL,cAAc,EACd,YAAY,EACZ,MAAM,EAGN,YAAY,EACZ,WAAW,EAGX,WAAW,EACX,SAAS,EACT,eAAe,EAGf,WAAW,EACX,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,eAAe,EACf,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,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,CAAC,EAAE,MAAM,CAAC;QACV,cAAc;QACd,CAAC,EAAE,MAAM,CAAC;QACV,cAAc;QACd,CAAC,EAAE,MAAM,CAAC;QACV,UAAU;QACV,SAAS,EAAE,MAAM,CAAC;KACnB,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF;;GAEG;AACH,YAAY,EAAE,YAAY,IAAI,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
@@ -1,3 +1,6 @@
1
+ /**
2
+ * 高德地图 Expo 模块类型定义
3
+ */
1
4
  // 导出所有类型定义
2
5
  export * from './types';
3
6
  export { MapType, LocationMode, LocationAccuracy, CoordinateType, } from './types';
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoGaodeMap.types.js","sourceRoot":"","sources":["../src/ExpoGaodeMap.types.ts"],"names":[],"mappings":"AAEA,WAAW;AACX,cAAc,SAAS,CAAC;AA8BxB,OAAO,EACL,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,cAAc,GACf,MAAM,SAAS,CAAC","sourcesContent":["\n\n// 导出所有类型定义\nexport * from './types';\n\n// 重新导出常用类型,方便直接从主模块导入\nexport type {\n // 通用类型\n LatLng,\n Point,\n CameraPosition,\n LatLngBounds,\n MapPoi,\n \n // 地图视图\n MapViewProps,\n CameraEvent,\n \n // 定位\n Coordinates,\n ReGeocode,\n LocationOptions,\n \n // 覆盖物\n MarkerProps,\n PolylineProps,\n PolygonProps,\n CircleProps,\n HeatMapProps,\n MultiPointProps,\n ClusterProps,\n} from './types';\n\nexport {\n MapType,\n LocationMode,\n LocationAccuracy,\n CoordinateType,\n} from './types';\n\n/**\n * Expo 模块事件类型\n */\nexport type ExpoGaodeMapModuleEvents = {\n /**\n * 定位更新事件\n */\n onLocationUpdate: (location: any) => void;\n \n /**\n * 定位错误事件\n */\n onLocationError: (error: { code: number; message: string }) => void;\n};\n\n/**\n * Expo 地图视图属性(用于主视图组件)\n */\nexport type { MapViewProps as ExpoGaodeMapViewProps } from './types';\n"]}
1
+ {"version":3,"file":"ExpoGaodeMap.types.js","sourceRoot":"","sources":["../src/ExpoGaodeMap.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,WAAW;AACX,cAAc,SAAS,CAAC;AA+BxB,OAAO,EACL,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,cAAc,GACf,MAAM,SAAS,CAAC","sourcesContent":["/**\n * 高德地图 Expo 模块类型定义\n */\n\nimport type { Coordinates, ReGeocode } from './types';\n\n// 导出所有类型定义\nexport * from './types';\n\n// 重新导出常用类型,方便直接从主模块导入\nexport type {\n // 通用类型\n LatLng,\n Point,\n CameraPosition,\n LatLngBounds,\n MapPoi,\n \n // 地图视图\n MapViewProps,\n CameraEvent,\n \n // 定位\n Coordinates,\n ReGeocode,\n LocationOptions,\n LocationListener,\n \n // 覆盖物\n MarkerProps,\n PolylineProps,\n PolygonProps,\n CircleProps,\n HeatMapProps,\n MultiPointProps,\n ClusterProps,\n} from './types';\n\nexport {\n MapType,\n LocationMode,\n LocationAccuracy,\n CoordinateType,\n} from './types';\n\n/**\n * Expo 模块事件类型\n * 定义了原生模块可以触发的事件\n */\nexport type ExpoGaodeMapModuleEvents = {\n /**\n * 定位更新事件\n * 当位置发生变化时触发\n * @param location 位置信息,包含坐标和可选的逆地理编码信息\n */\n onLocationUpdate: (location: Coordinates | ReGeocode) => void;\n \n /**\n * 方向更新事件(iOS)\n * 当设备方向发生变化时触发\n * @param heading 方向信息\n */\n onHeadingUpdate: (heading: {\n /** 磁北方向角度 (0-359.9) */\n magneticHeading: number;\n /** 真北方向角度 (0-359.9) */\n trueHeading: number;\n /** 方向精度 */\n headingAccuracy: number;\n /** X 轴原始数据 */\n x: number;\n /** Y 轴原始数据 */\n y: number;\n /** Z 轴原始数据 */\n z: number;\n /** 时间戳 */\n timestamp: number;\n }) => void;\n};\n\n/**\n * Expo 地图视图属性(用于主视图组件)\n */\nexport type { MapViewProps as ExpoGaodeMapViewProps } from './types';\n"]}
@@ -1,39 +1,186 @@
1
+ /**
2
+ * 高德地图原生模块
3
+ * 提供 SDK 初始化、定位、权限管理等功能
4
+ */
1
5
  import { NativeModule } from 'expo';
2
6
  import type { ExpoGaodeMapModuleEvents } from './ExpoGaodeMap.types';
3
- import type { LatLng, CoordinateType } from './types';
7
+ import type { LatLng, CoordinateType, Coordinates, ReGeocode, LocationMode, LocationAccuracy } from './types';
8
+ /**
9
+ * SDK 配置参数
10
+ */
11
+ export interface SDKConfig {
12
+ /** Android 平台的高德地图 API Key */
13
+ androidKey?: string;
14
+ /** iOS 平台的高德地图 API Key */
15
+ iosKey?: string;
16
+ }
17
+ /**
18
+ * 权限状态
19
+ */
20
+ export interface PermissionStatus {
21
+ /** 是否已授权 */
22
+ granted: boolean;
23
+ /** iOS 权限状态字符串 */
24
+ status?: 'notDetermined' | 'restricted' | 'denied' | 'authorizedAlways' | 'authorizedWhenInUse' | 'unknown';
25
+ /** Android 精确位置权限 */
26
+ fineLocation?: boolean;
27
+ /** Android 粗略位置权限 */
28
+ coarseLocation?: boolean;
29
+ }
30
+ /**
31
+ * 高德地图原生模块类声明
32
+ */
4
33
  declare class ExpoGaodeMapModule extends NativeModule<ExpoGaodeMapModuleEvents> {
5
- initSDK(config: {
6
- androidKey?: string;
7
- iosKey?: string;
8
- }): void;
34
+ /**
35
+ * 初始化高德地图 SDK
36
+ * @param config SDK 配置参数,包含 Android 和 iOS 的 API Key
37
+ */
38
+ initSDK(config: SDKConfig): void;
39
+ /**
40
+ * 获取高德地图 SDK 版本号
41
+ * @returns SDK 版本字符串
42
+ */
9
43
  getVersion(): string;
44
+ /**
45
+ * 开始连续定位
46
+ * 启动后会持续接收位置更新,通过 onLocationUpdate 事件回调
47
+ */
10
48
  start(): void;
49
+ /**
50
+ * 停止定位
51
+ * 停止接收位置更新
52
+ */
11
53
  stop(): void;
54
+ /**
55
+ * 检查是否正在定位
56
+ * @returns Promise<boolean> 是否正在定位
57
+ */
12
58
  isStarted(): Promise<boolean>;
13
- getCurrentLocation(): Promise<any>;
59
+ /**
60
+ * 获取当前位置(单次定位)
61
+ * @returns Promise<Coordinates | ReGeocode> 位置信息,包含坐标和可选的逆地理编码信息
62
+ */
63
+ getCurrentLocation(): Promise<Coordinates | ReGeocode>;
64
+ /**
65
+ * 坐标转换
66
+ * 将其他坐标系的坐标转换为高德地图使用的 GCJ-02 坐标系
67
+ * @param coordinate 需要转换的坐标
68
+ * @param type 原坐标系类型
69
+ * @returns Promise<LatLng> 转换后的 GCJ-02 坐标
70
+ */
14
71
  coordinateConvert(coordinate: LatLng, type: CoordinateType): Promise<LatLng>;
72
+ /**
73
+ * 设置是否返回逆地理编码信息
74
+ * @param isReGeocode true: 返回地址信息; false: 只返回坐标
75
+ */
15
76
  setLocatingWithReGeocode(isReGeocode: boolean): void;
16
- setLocationMode(mode: number): void;
77
+ /**
78
+ * 设置定位模式(Android)
79
+ * @param mode 定位模式:0-低功耗, 1-仅设备, 2-高精度
80
+ */
81
+ setLocationMode(mode: LocationMode): void;
82
+ /**
83
+ * 设置定位间隔(毫秒)
84
+ * @param interval 定位间隔时间,单位毫秒,默认 2000ms
85
+ */
17
86
  setInterval(interval: number): void;
87
+ /**
88
+ * 设置是否单次定位(Android)
89
+ * @param isOnceLocation true: 单次定位; false: 连续定位
90
+ */
18
91
  setOnceLocation(isOnceLocation: boolean): void;
92
+ /**
93
+ * 设置是否使用设备传感器(Android)
94
+ * @param sensorEnable true: 使用传感器; false: 不使用
95
+ */
19
96
  setSensorEnable(sensorEnable: boolean): void;
97
+ /**
98
+ * 设置是否允许 WiFi 扫描(Android)
99
+ * @param wifiScan true: 允许; false: 不允许
100
+ */
20
101
  setWifiScan(wifiScan: boolean): void;
102
+ /**
103
+ * 设置是否 GPS 优先(Android)
104
+ * @param gpsFirst true: GPS 优先; false: 网络优先
105
+ */
21
106
  setGpsFirst(gpsFirst: boolean): void;
107
+ /**
108
+ * 设置是否等待 WiFi 列表刷新(Android)
109
+ * @param onceLocationLatest true: 等待; false: 不等待
110
+ */
22
111
  setOnceLocationLatest(onceLocationLatest: boolean): void;
112
+ /**
113
+ * 设置逆地理编码语言
114
+ * @param language 语言代码,如 "zh-CN", "en"
115
+ */
23
116
  setGeoLanguage(language: string): void;
117
+ /**
118
+ * 设置是否使用缓存策略(Android)
119
+ * @param locationCacheEnable true: 使用缓存; false: 不使用
120
+ */
24
121
  setLocationCacheEnable(locationCacheEnable: boolean): void;
122
+ /**
123
+ * 设置网络请求超时时间(Android)
124
+ * @param httpTimeOut 超时时间,单位毫秒
125
+ */
25
126
  setHttpTimeOut(httpTimeOut: number): void;
26
- setDesiredAccuracy(accuracy: number): void;
127
+ /**
128
+ * 设置期望的定位精度(iOS)
129
+ * @param accuracy 精度级别:0-最佳, 1-10米, 2-100米, 3-1公里, 4-3公里
130
+ */
131
+ setDesiredAccuracy(accuracy: LocationAccuracy): void;
132
+ /**
133
+ * 设置定位超时时间(秒)
134
+ * @param timeout 超时时间,单位秒,默认 10 秒
135
+ */
27
136
  setLocationTimeout(timeout: number): void;
137
+ /**
138
+ * 设置逆地理编码超时时间(秒)
139
+ * @param timeout 超时时间,单位秒,默认 5 秒
140
+ */
28
141
  setReGeocodeTimeout(timeout: number): void;
142
+ /**
143
+ * 设置距离过滤器(米)(iOS)
144
+ * 只有移动超过指定距离才会更新位置
145
+ * @param distance 距离阈值,单位米
146
+ */
29
147
  setDistanceFilter(distance: number): void;
148
+ /**
149
+ * 设置是否自动暂停位置更新(iOS)
150
+ * @param pauses true: 自动暂停; false: 不暂停
151
+ */
30
152
  setPausesLocationUpdatesAutomatically(pauses: boolean): void;
153
+ /**
154
+ * 设置是否允许后台定位(iOS)
155
+ * @param allows true: 允许; false: 不允许
156
+ */
31
157
  setAllowsBackgroundLocationUpdates(allows: boolean): void;
158
+ /**
159
+ * 设置定位协议
160
+ * @param protocol 协议类型
161
+ */
32
162
  setLocationProtocol(protocol: string): void;
163
+ /**
164
+ * 开始更新设备方向(罗盘朝向)
165
+ * 通过 onHeadingUpdate 事件接收方向更新
166
+ * @platform ios
167
+ */
33
168
  startUpdatingHeading(): void;
169
+ /**
170
+ * 停止更新设备方向
171
+ * @platform ios
172
+ */
34
173
  stopUpdatingHeading(): void;
35
- checkLocationPermission(): Promise<any>;
36
- requestLocationPermission(): Promise<any>;
174
+ /**
175
+ * 检查位置权限状态
176
+ * @returns Promise<PermissionStatus> 权限状态
177
+ */
178
+ checkLocationPermission(): Promise<PermissionStatus>;
179
+ /**
180
+ * 请求位置权限
181
+ * @returns Promise<PermissionStatus> 请求后的权限状态
182
+ */
183
+ requestLocationPermission(): Promise<PermissionStatus>;
37
184
  }
38
185
  declare const _default: ExpoGaodeMapModule;
39
186
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoGaodeMapModule.d.ts","sourceRoot":"","sources":["../src/ExpoGaodeMapModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AACzD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEtD,OAAO,OAAO,kBAAmB,SAAQ,YAAY,CAAC,wBAAwB,CAAC;IAE7E,OAAO,CAAC,MAAM,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAC/D,UAAU,IAAI,MAAM;IAGpB,KAAK,IAAI,IAAI;IACb,IAAI,IAAI,IAAI;IACZ,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAC7B,kBAAkB,IAAI,OAAO,CAAC,GAAG,CAAC;IAClC,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAG5E,wBAAwB,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI;IACpD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IACnC,WAAW,CA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权限管理等功能
4
+ */
1
5
  import { requireNativeModule } from 'expo';
2
6
  export default requireNativeModule('ExpoGaodeMap');
3
7
  //# sourceMappingURL=ExpoGaodeMapModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoGaodeMapModule.js","sourceRoot":"","sources":["../src/ExpoGaodeMapModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AA6CzD,eAAe,mBAAmB,CAAqB,cAAc,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\nimport type { ExpoGaodeMapModuleEvents } from './ExpoGaodeMap.types';\nimport type { LatLng, CoordinateType } from './types';\n\ndeclare class ExpoGaodeMapModule extends NativeModule<ExpoGaodeMapModuleEvents> {\n // SDK 初始化\n initSDK(config: { androidKey?: string; iosKey?: string }): void;\n getVersion(): string;\n \n // 定位控制\n start(): void;\n stop(): void;\n isStarted(): Promise<boolean>;\n getCurrentLocation(): Promise<any>;\n coordinateConvert(coordinate: LatLng, type: CoordinateType): Promise<LatLng>;\n \n // 定位配置\n setLocatingWithReGeocode(isReGeocode: boolean): void;\n setLocationMode(mode: number): void;\n setInterval(interval: number): void;\n setOnceLocation(isOnceLocation: boolean): void;\n setSensorEnable(sensorEnable: boolean): void;\n setWifiScan(wifiScan: boolean): void;\n setGpsFirst(gpsFirst: boolean): void;\n setOnceLocationLatest(onceLocationLatest: boolean): void;\n setGeoLanguage(language: string): void;\n setLocationCacheEnable(locationCacheEnable: boolean): void;\n setHttpTimeOut(httpTimeOut: number): void;\n setDesiredAccuracy(accuracy: number): void;\n setLocationTimeout(timeout: number): void;\n setReGeocodeTimeout(timeout: number): void;\n setDistanceFilter(distance: number): void;\n setPausesLocationUpdatesAutomatically(pauses: boolean): void;\n setAllowsBackgroundLocationUpdates(allows: boolean): void;\n setLocationProtocol(protocol: string): void;\n \n // 方向更新 (iOS)\n startUpdatingHeading(): void;\n stopUpdatingHeading(): void;\n \n // 权限\n checkLocationPermission(): Promise<any>;\n requestLocationPermission(): Promise<any>;\n}\n\nexport default requireNativeModule<ExpoGaodeMapModule>('ExpoGaodeMap');\n"]}
1
+ {"version":3,"file":"ExpoGaodeMapModule.js","sourceRoot":"","sources":["../src/ExpoGaodeMapModule.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAqOzD,eAAe,mBAAmB,CAAqB,cAAc,CAAC,CAAC","sourcesContent":["/**\n * 高德地图原生模块\n * 提供 SDK 初始化、定位、权限管理等功能\n */\n\nimport { NativeModule, requireNativeModule } from 'expo';\nimport type { ExpoGaodeMapModuleEvents } from './ExpoGaodeMap.types';\nimport type {\n LatLng,\n CoordinateType,\n Coordinates,\n ReGeocode,\n LocationMode,\n LocationAccuracy,\n} from './types';\n\n/**\n * SDK 配置参数\n */\nexport interface SDKConfig {\n /** Android 平台的高德地图 API Key */\n androidKey?: string;\n /** iOS 平台的高德地图 API Key */\n iosKey?: string;\n}\n\n/**\n * 权限状态\n */\nexport interface PermissionStatus {\n /** 是否已授权 */\n granted: boolean;\n /** iOS 权限状态字符串 */\n status?: 'notDetermined' | 'restricted' | 'denied' | 'authorizedAlways' | 'authorizedWhenInUse' | 'unknown';\n /** Android 精确位置权限 */\n fineLocation?: boolean;\n /** Android 粗略位置权限 */\n coarseLocation?: boolean;\n}\n\n/**\n * 高德地图原生模块类声明\n */\ndeclare class ExpoGaodeMapModule extends NativeModule<ExpoGaodeMapModuleEvents> {\n // ==================== SDK 初始化 ====================\n \n /**\n * 初始化高德地图 SDK\n * @param config SDK 配置参数,包含 Android iOS 的 API Key\n */\n initSDK(config: SDKConfig): void;\n \n /**\n * 获取高德地图 SDK 版本号\n * @returns SDK 版本字符串\n */\n getVersion(): string;\n \n // ==================== 定位控制 ====================\n \n /**\n * 开始连续定位\n * 启动后会持续接收位置更新,通过 onLocationUpdate 事件回调\n */\n start(): void;\n \n /**\n * 停止定位\n * 停止接收位置更新\n */\n stop(): void;\n \n /**\n * 检查是否正在定位\n * @returns Promise<boolean> 是否正在定位\n */\n isStarted(): Promise<boolean>;\n \n /**\n * 获取当前位置(单次定位)\n * @returns Promise<Coordinates | ReGeocode> 位置信息,包含坐标和可选的逆地理编码信息\n */\n getCurrentLocation(): Promise<Coordinates | ReGeocode>;\n \n /**\n * 坐标转换\n * 将其他坐标系的坐标转换为高德地图使用的 GCJ-02 坐标系\n * @param coordinate 需要转换的坐标\n * @param type 原坐标系类型\n * @returns Promise<LatLng> 转换后的 GCJ-02 坐标\n */\n coordinateConvert(coordinate: LatLng, type: CoordinateType): Promise<LatLng>;\n \n // ==================== 定位配置 ====================\n \n /**\n * 设置是否返回逆地理编码信息\n * @param isReGeocode true: 返回地址信息; false: 只返回坐标\n */\n setLocatingWithReGeocode(isReGeocode: boolean): void;\n \n /**\n * 设置定位模式(Android)\n * @param mode 定位模式:0-低功耗, 1-仅设备, 2-高精度\n */\n setLocationMode(mode: LocationMode): void;\n \n /**\n * 设置定位间隔(毫秒)\n * @param interval 定位间隔时间,单位毫秒,默认 2000ms\n */\n setInterval(interval: number): void;\n \n /**\n * 设置是否单次定位(Android)\n * @param isOnceLocation true: 单次定位; false: 连续定位\n */\n setOnceLocation(isOnceLocation: boolean): void;\n \n /**\n * 设置是否使用设备传感器(Android)\n * @param sensorEnable true: 使用传感器; false: 不使用\n */\n setSensorEnable(sensorEnable: boolean): void;\n \n /**\n * 设置是否允许 WiFi 扫描(Android)\n * @param wifiScan true: 允许; false: 不允许\n */\n setWifiScan(wifiScan: boolean): void;\n \n /**\n * 设置是否 GPS 优先(Android)\n * @param gpsFirst true: GPS 优先; false: 网络优先\n */\n setGpsFirst(gpsFirst: boolean): void;\n \n /**\n * 设置是否等待 WiFi 列表刷新(Android)\n * @param onceLocationLatest true: 等待; false: 不等待\n */\n setOnceLocationLatest(onceLocationLatest: boolean): void;\n \n /**\n * 设置逆地理编码语言\n * @param language 语言代码,如 \"zh-CN\", \"en\"\n */\n setGeoLanguage(language: string): void;\n \n /**\n * 设置是否使用缓存策略(Android)\n * @param locationCacheEnable true: 使用缓存; false: 不使用\n */\n setLocationCacheEnable(locationCacheEnable: boolean): void;\n \n /**\n * 设置网络请求超时时间(Android)\n * @param httpTimeOut 超时时间,单位毫秒\n */\n setHttpTimeOut(httpTimeOut: number): void;\n \n /**\n * 设置期望的定位精度(iOS)\n * @param accuracy 精度级别:0-最佳, 1-10米, 2-100米, 3-1公里, 4-3公里\n */\n setDesiredAccuracy(accuracy: LocationAccuracy): void;\n \n /**\n * 设置定位超时时间(秒)\n * @param timeout 超时时间,单位秒,默认 10 秒\n */\n setLocationTimeout(timeout: number): void;\n \n /**\n * 设置逆地理编码超时时间(秒)\n * @param timeout 超时时间,单位秒,默认 5 秒\n */\n setReGeocodeTimeout(timeout: number): void;\n \n /**\n * 设置距离过滤器(米)(iOS)\n * 只有移动超过指定距离才会更新位置\n * @param distance 距离阈值,单位米\n */\n setDistanceFilter(distance: number): void;\n \n /**\n * 设置是否自动暂停位置更新(iOS)\n * @param pauses true: 自动暂停; false: 不暂停\n */\n setPausesLocationUpdatesAutomatically(pauses: boolean): void;\n \n /**\n * 设置是否允许后台定位(iOS)\n * @param allows true: 允许; false: 不允许\n */\n setAllowsBackgroundLocationUpdates(allows: boolean): void;\n \n /**\n * 设置定位协议\n * @param protocol 协议类型\n */\n setLocationProtocol(protocol: string): void;\n \n // ==================== 方向更新 (iOS) ====================\n \n /**\n * 开始更新设备方向(罗盘朝向)\n * 通过 onHeadingUpdate 事件接收方向更新\n * @platform ios\n */\n startUpdatingHeading(): void;\n \n /**\n * 停止更新设备方向\n * @platform ios\n */\n stopUpdatingHeading(): void;\n \n // ==================== 权限管理 ====================\n \n /**\n * 检查位置权限状态\n * @returns Promise<PermissionStatus> 权限状态\n */\n checkLocationPermission(): Promise<PermissionStatus>;\n \n /**\n * 请求位置权限\n * @returns Promise<PermissionStatus> 请求后的权限状态\n */\n requestLocationPermission(): Promise<PermissionStatus>;\n}\n\nexport default requireNativeModule<ExpoGaodeMapModule>('ExpoGaodeMap');\n"]}
@@ -1,22 +1,6 @@
1
1
  import * as React from 'react';
2
- import { NativeSyntheticEvent } from 'react-native';
3
- import { EventManager } from './utils/EventManager';
4
- import type { MapViewProps, MapViewRef, LatLng } from './types';
2
+ import type { MapViewProps, MapViewRef } from './types';
5
3
  export type { MapViewRef } from './types';
6
- export declare const MapContext: React.Context<React.RefObject<MapViewRef | null> | null>;
7
- type MarkerEventCallbacks = {
8
- onPress?: (event: NativeSyntheticEvent<{}>) => void;
9
- onDragStart?: (event: NativeSyntheticEvent<LatLng>) => void;
10
- onDrag?: (event: NativeSyntheticEvent<LatLng>) => void;
11
- onDragEnd?: (event: NativeSyntheticEvent<LatLng>) => void;
12
- };
13
- type OverlayEventCallbacks = {
14
- onPress?: (event: NativeSyntheticEvent<{}>) => void;
15
- };
16
- export declare const MarkerEventContext: React.Context<EventManager<MarkerEventCallbacks> | null>;
17
- export declare const CircleEventContext: React.Context<EventManager<OverlayEventCallbacks> | null>;
18
- export declare const PolygonEventContext: React.Context<EventManager<OverlayEventCallbacks> | null>;
19
- export declare const PolylineEventContext: React.Context<EventManager<OverlayEventCallbacks> | null>;
20
4
  /**
21
5
  * 高德地图视图组件,提供地图操作API和覆盖物管理功能
22
6
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoGaodeMapView.d.ts","sourceRoot":"","sources":["../src/ExpoGaodeMapView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EAEV,MAAM,EAMP,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,eAAO,MAAM,UAAU,0DAAuE,CAAC;AAE/F,K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