@anov/3d-ability 0.0.142 → 0.0.143

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 (256) hide show
  1. package/dist/business/Animation/motion/index.js +56 -35
  2. package/dist/business/Animation/motion/index.js.map +1 -1
  3. package/dist/business/Animation/type.js +2 -2
  4. package/dist/business/Area/Fence/FenceBase.js +187 -146
  5. package/dist/business/Area/Fence/FenceBase.js.map +1 -1
  6. package/dist/business/Area/Fence/fence_base_01.js +112 -120
  7. package/dist/business/Area/Fence/fence_base_01.js.map +1 -1
  8. package/dist/business/Area/Fence/fence_feeting_01.js +130 -218
  9. package/dist/business/Area/Fence/fence_feeting_01.js.map +1 -1
  10. package/dist/business/Area/Fence/fence_roll_01.js +130 -140
  11. package/dist/business/Area/Fence/fence_roll_01.js.map +1 -1
  12. package/dist/business/Area/FillArea/FillAreaBase.js +126 -87
  13. package/dist/business/Area/FillArea/FillAreaBase.js.map +1 -1
  14. package/dist/business/Area/FillArea/fillArea_face_01.js +98 -72
  15. package/dist/business/Area/FillArea/fillArea_face_01.js.map +1 -1
  16. package/dist/business/Area/FillArea/fillArea_line_01.js +94 -66
  17. package/dist/business/Area/FillArea/fillArea_line_01.js.map +1 -1
  18. package/dist/business/Area/index.js +483 -267
  19. package/dist/business/Area/index.js.map +1 -1
  20. package/dist/business/Area/tool.js +26 -14
  21. package/dist/business/Area/tool.js.map +1 -1
  22. package/dist/business/Base/ObjectLayer.js +46 -21
  23. package/dist/business/Base/ObjectLayer.js.map +1 -1
  24. package/dist/business/Batch/index.js +234 -189
  25. package/dist/business/Batch/index.js.map +1 -1
  26. package/dist/business/Box/index.js +81 -52
  27. package/dist/business/Box/index.js.map +1 -1
  28. package/dist/business/Cylinder/index.js +79 -51
  29. package/dist/business/Cylinder/index.js.map +1 -1
  30. package/dist/business/Flyline/bubble/CircleBubble.js +9 -1
  31. package/dist/business/Flyline/bubble/CircleBubble.js.map +1 -1
  32. package/dist/business/Flyline/bubble/index.js +21 -7
  33. package/dist/business/Flyline/bubble/index.js.map +1 -1
  34. package/dist/business/Flyline/index.js +162 -96
  35. package/dist/business/Flyline/index.js.map +1 -1
  36. package/dist/business/Flyline/line/ArcLine.js +291 -208
  37. package/dist/business/Flyline/line/ArcLine.js.map +1 -1
  38. package/dist/business/Flyline/line/index.js +22 -8
  39. package/dist/business/Flyline/line/index.js.map +1 -1
  40. package/dist/business/HeatMap/HeatMap.js +467 -380
  41. package/dist/business/HeatMap/HeatMap.js.map +1 -1
  42. package/dist/business/HeatMap/core.js +525 -405
  43. package/dist/business/HeatMap/core.js.map +1 -1
  44. package/dist/business/HeatMap/shader.js +3 -69
  45. package/dist/business/HeatMap/shader.js.map +1 -1
  46. package/dist/business/InfoPanel/index.js +242 -201
  47. package/dist/business/InfoPanel/index.js.map +1 -1
  48. package/dist/business/Line/index.js +88 -55
  49. package/dist/business/Line/index.js.map +1 -1
  50. package/dist/business/Mark/KeyframeAnimation.js +176 -145
  51. package/dist/business/Mark/KeyframeAnimation.js.map +1 -1
  52. package/dist/business/Mark/index.js +294 -196
  53. package/dist/business/Mark/index.js.map +1 -1
  54. package/dist/business/Mark/shader/tanhao.js +3 -36
  55. package/dist/business/Mark/shader/tanhao.js.map +1 -1
  56. package/dist/business/Mark/type.js +1 -1
  57. package/dist/business/MaterialSwitch/MaterialSwitchSystem.js +551 -377
  58. package/dist/business/MaterialSwitch/MaterialSwitchSystem.js.map +1 -1
  59. package/dist/business/MaterialSwitch/inject.js +58 -92
  60. package/dist/business/MaterialSwitch/inject.js.map +1 -1
  61. package/dist/business/MaterialSwitch/shader/finalFade.js +2 -74
  62. package/dist/business/MaterialSwitch/shader/finalFade.js.map +1 -1
  63. package/dist/business/MaterialSwitch/shader/ground.js +16 -95
  64. package/dist/business/MaterialSwitch/shader/ground.js.map +1 -1
  65. package/dist/business/MaterialSwitch/shader/groundBase64.js +3 -9
  66. package/dist/business/MaterialSwitch/shader/groundBase64.js.map +1 -1
  67. package/dist/business/MaterialSwitch/shader/realFade.js +9 -48
  68. package/dist/business/MaterialSwitch/shader/realFade.js.map +1 -1
  69. package/dist/business/Plane/index.js +78 -51
  70. package/dist/business/Plane/index.js.map +1 -1
  71. package/dist/business/Poi/index.js +336 -248
  72. package/dist/business/Poi/index.js.map +1 -1
  73. package/dist/business/Poi/link/Cylinder.js +89 -56
  74. package/dist/business/Poi/link/Cylinder.js.map +1 -1
  75. package/dist/business/Poi/link/Pyramid.js +165 -104
  76. package/dist/business/Poi/link/Pyramid.js.map +1 -1
  77. package/dist/business/Poi/link/index.js +114 -54
  78. package/dist/business/Poi/link/index.js.map +1 -1
  79. package/dist/business/Poi/panel/index.js +373 -315
  80. package/dist/business/Poi/panel/index.js.map +1 -1
  81. package/dist/business/Poi/panel/utils.js +10 -5
  82. package/dist/business/Poi/panel/utils.js.map +1 -1
  83. package/dist/business/Poi/particle/DoubleCircle.js +107 -71
  84. package/dist/business/Poi/particle/DoubleCircle.js.map +1 -1
  85. package/dist/business/Poi/particle/DynamicCircle.js +111 -75
  86. package/dist/business/Poi/particle/DynamicCircle.js.map +1 -1
  87. package/dist/business/Poi/particle/SingleCircle.js +98 -62
  88. package/dist/business/Poi/particle/SingleCircle.js.map +1 -1
  89. package/dist/business/Poi/particle/index.js +117 -49
  90. package/dist/business/Poi/particle/index.js.map +1 -1
  91. package/dist/business/Poi/shader/circle.js +3 -31
  92. package/dist/business/Poi/shader/circle.js.map +1 -1
  93. package/dist/business/Poi/shader/cylinder.js +3 -37
  94. package/dist/business/Poi/shader/cylinder.js.map +1 -1
  95. package/dist/business/Poi/shader/doubleCircle.js +3 -55
  96. package/dist/business/Poi/shader/doubleCircle.js.map +1 -1
  97. package/dist/business/Poi/shader/dynamicCircle.js +3 -67
  98. package/dist/business/Poi/shader/dynamicCircle.js.map +1 -1
  99. package/dist/business/Poi/title/Border.js +27 -7
  100. package/dist/business/Poi/title/Border.js.map +1 -1
  101. package/dist/business/Poi/title/Ellipse.js +27 -7
  102. package/dist/business/Poi/title/Ellipse.js.map +1 -1
  103. package/dist/business/Poi/title/index.js +292 -208
  104. package/dist/business/Poi/title/index.js.map +1 -1
  105. package/dist/business/Poi/tools.js +17 -18
  106. package/dist/business/Poi/tools.js.map +1 -1
  107. package/dist/business/Sphere/index.js +72 -47
  108. package/dist/business/Sphere/index.js.map +1 -1
  109. package/dist/business/Spline/index.js +245 -190
  110. package/dist/business/Spline/index.js.map +1 -1
  111. package/dist/business/SplitBuilding/index.js +536 -327
  112. package/dist/business/SplitBuilding/index.js.map +1 -1
  113. package/dist/business/SplitBuilding/type.js +2 -2
  114. package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js +275 -218
  115. package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js.map +1 -1
  116. package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js +177 -132
  117. package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js.map +1 -1
  118. package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js +1 -51
  119. package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js.map +1 -1
  120. package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js +1 -6
  121. package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js.map +1 -1
  122. package/dist/business/TrafficComponents/base.js +55 -32
  123. package/dist/business/TrafficComponents/base.js.map +1 -1
  124. package/dist/business/TrafficComponents/utils.js +24 -25
  125. package/dist/business/TrafficComponents/utils.js.map +1 -1
  126. package/dist/business/Utils/Curve.js +56 -40
  127. package/dist/business/Utils/Curve.js.map +1 -1
  128. package/dist/business/Utils/constant.js +1 -1
  129. package/dist/business/Utils/constant.js.map +1 -1
  130. package/dist/business/Utils/defineProps.js +14 -13
  131. package/dist/business/Utils/defineProps.js.map +1 -1
  132. package/dist/business/Utils/round-curve.js +153 -127
  133. package/dist/business/Utils/round-curve.js.map +1 -1
  134. package/dist/business/VideoPanel/index.js +319 -258
  135. package/dist/business/VideoPanel/index.js.map +1 -1
  136. package/dist/business/Water/index.js +108 -78
  137. package/dist/business/Water/index.js.map +1 -1
  138. package/dist/business/Water/types.js +1 -1
  139. package/dist/business/Water/types.js.map +1 -1
  140. package/dist/core/Camera/PerspectiveCamera/CameraExpand.js +449 -383
  141. package/dist/core/Camera/PerspectiveCamera/CameraExpand.js.map +1 -1
  142. package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js +142 -107
  143. package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js.map +1 -1
  144. package/dist/core/Controls/FirstViewControl/index.js +96 -84
  145. package/dist/core/Controls/FirstViewControl/index.js.map +1 -1
  146. package/dist/core/Controls/ThirdViewControl/action/input.js +98 -77
  147. package/dist/core/Controls/ThirdViewControl/action/input.js.map +1 -1
  148. package/dist/core/Controls/ThirdViewControl/config/constants.js +1 -1
  149. package/dist/core/Controls/ThirdViewControl/config/constants.js.map +1 -1
  150. package/dist/core/Controls/ThirdViewControl/index.js +28 -19
  151. package/dist/core/Controls/ThirdViewControl/index.js.map +1 -1
  152. package/dist/core/Controls/ThirdViewControl/player/animation.js +155 -126
  153. package/dist/core/Controls/ThirdViewControl/player/animation.js.map +1 -1
  154. package/dist/core/Controls/ThirdViewControl/player/camera.js +63 -47
  155. package/dist/core/Controls/ThirdViewControl/player/camera.js.map +1 -1
  156. package/dist/core/Controls/ThirdViewControl/player/control.js +49 -39
  157. package/dist/core/Controls/ThirdViewControl/player/control.js.map +1 -1
  158. package/dist/core/Controls/ThirdViewControl/player.js +91 -66
  159. package/dist/core/Controls/ThirdViewControl/player.js.map +1 -1
  160. package/dist/core/Controls/base.js +30 -14
  161. package/dist/core/Controls/base.js.map +1 -1
  162. package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js +131 -92
  163. package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js.map +1 -1
  164. package/dist/core/Debug/PerformanceInfo/Performance.js +47 -22
  165. package/dist/core/Debug/PerformanceInfo/Performance.js.map +1 -1
  166. package/dist/core/Light/PointLight/PointLightExt.js +21 -4
  167. package/dist/core/Light/PointLight/PointLightExt.js.map +1 -1
  168. package/dist/core/Material/FinirMaterial/FinirMaterial.js +57 -37
  169. package/dist/core/Material/FinirMaterial/FinirMaterial.js.map +1 -1
  170. package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js +153 -116
  171. package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js.map +1 -1
  172. package/dist/core/Material/PristineGridMaterial/shader/fragment.js +1 -95
  173. package/dist/core/Material/PristineGridMaterial/shader/fragment.js.map +1 -1
  174. package/dist/core/Material/PristineGridMaterial/shader/vertex.js +1 -26
  175. package/dist/core/Material/PristineGridMaterial/shader/vertex.js.map +1 -1
  176. package/dist/core/Material/SurfaceMaterial/index.js +172 -76
  177. package/dist/core/Material/SurfaceMaterial/index.js.map +1 -1
  178. package/dist/core/Material/decorators.js +11 -6
  179. package/dist/core/Material/decorators.js.map +1 -1
  180. package/dist/core/PostEffects/addACESFilmicToneMappingPass.js +12 -16
  181. package/dist/core/PostEffects/addACESFilmicToneMappingPass.js.map +1 -1
  182. package/dist/core/PostEffects/addBrightnessContrastPass.js +13 -17
  183. package/dist/core/PostEffects/addBrightnessContrastPass.js.map +1 -1
  184. package/dist/core/PostEffects/bloomPass.js +10 -17
  185. package/dist/core/PostEffects/bloomPass.js.map +1 -1
  186. package/dist/core/PostEffects/bloomSelect.js +43 -60
  187. package/dist/core/PostEffects/bloomSelect.js.map +1 -1
  188. package/dist/core/PostEffects/colorifyPass.js +13 -17
  189. package/dist/core/PostEffects/colorifyPass.js.map +1 -1
  190. package/dist/core/PostEffects/index.js +22 -28
  191. package/dist/core/PostEffects/index.js.map +1 -1
  192. package/dist/core/PostEffects/outlinePass.js +50 -37
  193. package/dist/core/PostEffects/outlinePass.js.map +1 -1
  194. package/dist/core/PostEffects/postprocessing.js +12 -14
  195. package/dist/core/PostEffects/postprocessing.js.map +1 -1
  196. package/dist/core/PostEffects/saoPass.js +10 -15
  197. package/dist/core/PostEffects/saoPass.js.map +1 -1
  198. package/dist/core/PostEffects/shader/colorify.js +3 -22
  199. package/dist/core/PostEffects/shader/colorify.js.map +1 -1
  200. package/dist/core/PostEffects/shader/gammaCorrectionShader.js +3 -27
  201. package/dist/core/PostEffects/shader/gammaCorrectionShader.js.map +1 -1
  202. package/dist/core/PostEffects/shader/mapping.js +3 -66
  203. package/dist/core/PostEffects/shader/mapping.js.map +1 -1
  204. package/dist/core/PostEffects/shader/thermalMaging.js +3 -28
  205. package/dist/core/PostEffects/shader/thermalMaging.js.map +1 -1
  206. package/dist/core/SceneEffect/grow/grow.js +101 -85
  207. package/dist/core/SceneEffect/grow/grow.js.map +1 -1
  208. package/dist/core/SceneEffect/grow/style_down.js +77 -60
  209. package/dist/core/SceneEffect/grow/style_down.js.map +1 -1
  210. package/dist/core/SceneEffect/grow/style_up.js +81 -64
  211. package/dist/core/SceneEffect/grow/style_up.js.map +1 -1
  212. package/dist/core/SceneEffect/grow/type.js +2 -2
  213. package/dist/core/SceneEffect/grow/type.js.map +1 -1
  214. package/dist/core/WeatherSystem/DynamicWeatherSystem.js +76 -51
  215. package/dist/core/WeatherSystem/DynamicWeatherSystem.js.map +1 -1
  216. package/dist/core/WeatherSystem/hdr/index.js +105 -69
  217. package/dist/core/WeatherSystem/hdr/index.js.map +1 -1
  218. package/dist/core/WeatherSystem/index.js +124 -77
  219. package/dist/core/WeatherSystem/index.js.map +1 -1
  220. package/dist/core/WeatherSystem/objects/fog/index.js +80 -52
  221. package/dist/core/WeatherSystem/objects/fog/index.js.map +1 -1
  222. package/dist/core/WeatherSystem/objects/rain/index.js +84 -72
  223. package/dist/core/WeatherSystem/objects/rain/index.js.map +1 -1
  224. package/dist/core/WeatherSystem/objects/rain/lineRain.js +118 -88
  225. package/dist/core/WeatherSystem/objects/rain/lineRain.js.map +1 -1
  226. package/dist/core/WeatherSystem/objects/rain/plane.js +146 -116
  227. package/dist/core/WeatherSystem/objects/rain/plane.js.map +1 -1
  228. package/dist/core/WeatherSystem/objects/rain/point.js +148 -100
  229. package/dist/core/WeatherSystem/objects/rain/point.js.map +1 -1
  230. package/dist/core/WeatherSystem/objects/sky/cloud.js +104 -71
  231. package/dist/core/WeatherSystem/objects/sky/cloud.js.map +1 -1
  232. package/dist/core/WeatherSystem/objects/sky/index.js +84 -66
  233. package/dist/core/WeatherSystem/objects/sky/index.js.map +1 -1
  234. package/dist/core/WeatherSystem/objects/sky/outline.js +45 -25
  235. package/dist/core/WeatherSystem/objects/sky/outline.js.map +1 -1
  236. package/dist/core/WeatherSystem/shaders/cloud.js +3 -74
  237. package/dist/core/WeatherSystem/shaders/cloud.js.map +1 -1
  238. package/dist/core/WeatherSystem/shaders/fog.js +3 -103
  239. package/dist/core/WeatherSystem/shaders/fog.js.map +1 -1
  240. package/dist/core/WeatherSystem/shaders/rain.js +7 -206
  241. package/dist/core/WeatherSystem/shaders/rain.js.map +1 -1
  242. package/dist/core/WeatherSystem/shaders/sky.js +3 -87
  243. package/dist/core/WeatherSystem/shaders/sky.js.map +1 -1
  244. package/dist/core/WeatherSystem/sky/index.js +135 -104
  245. package/dist/core/WeatherSystem/sky/index.js.map +1 -1
  246. package/dist/core/WeatherSystem/utils/constant.js +38 -44
  247. package/dist/core/WeatherSystem/utils/constant.js.map +1 -1
  248. package/dist/core/WeatherSystem/utils/math.js +25 -18
  249. package/dist/core/WeatherSystem/utils/math.js.map +1 -1
  250. package/dist/core/WeatherSystem/utils/type.js +1 -1
  251. package/dist/core/WeatherSystem/utils/type.js.map +1 -1
  252. package/dist/core/WeatherSystem/weather/index.js +141 -96
  253. package/dist/core/WeatherSystem/weather/index.js.map +1 -1
  254. package/dist/utils/index.js +1 -1
  255. package/dist/utils/index.js.map +1 -1
  256. package/package.json +3 -3
@@ -1,22 +1,21 @@
1
1
  import { CanvasTexture, Vector3 } from '@anov/3d-core';
2
2
  // 获取文字的canvas
3
- export const createTextCanvas = option => {
4
- const {
5
- value: text,
6
- fontSize,
7
- color,
8
- fontWeight
9
- } = option || {};
10
- const pixelRatio = 1; // window.devicePixelRatio || 1
11
- const tempCanvas = document.createElement('canvas');
12
- const ctx = tempCanvas.getContext('2d');
13
- ctx.font = `${fontWeight} ${fontSize * pixelRatio}px Arial`;
14
- const textWidth = Math.ceil(ctx.measureText(text).width);
15
- const textHeight = Math.ceil(fontSize * pixelRatio * 1.1);
16
- const canvas = document.createElement('canvas');
3
+ export var createTextCanvas = function createTextCanvas(option) {
4
+ var _ref = option || {},
5
+ text = _ref.value,
6
+ fontSize = _ref.fontSize,
7
+ color = _ref.color,
8
+ fontWeight = _ref.fontWeight;
9
+ var pixelRatio = 1; // window.devicePixelRatio || 1
10
+ var tempCanvas = document.createElement('canvas');
11
+ var ctx = tempCanvas.getContext('2d');
12
+ ctx.font = "".concat(fontWeight, " ").concat(fontSize * pixelRatio, "px Arial");
13
+ var textWidth = Math.ceil(ctx.measureText(text).width);
14
+ var textHeight = Math.ceil(fontSize * pixelRatio * 1.1);
15
+ var canvas = document.createElement('canvas');
17
16
  canvas.width = textWidth;
18
17
  canvas.height = textHeight;
19
- const context = canvas.getContext('2d');
18
+ var context = canvas.getContext('2d');
20
19
  context.fillStyle = color;
21
20
  context.font = ctx.font;
22
21
  context.textAlign = 'center';
@@ -28,14 +27,14 @@ export const createTextCanvas = option => {
28
27
  texture: new CanvasTexture(canvas)
29
28
  };
30
29
  };
31
- export const lookAtOnYAxis = (mesh, targetPosition) => {
30
+ export var lookAtOnYAxis = function lookAtOnYAxis(mesh, targetPosition) {
32
31
  if (!mesh || !targetPosition || !mesh.position || !mesh.rotation) return;
33
- const direction = new Vector3().subVectors(targetPosition, mesh.position);
32
+ var direction = new Vector3().subVectors(targetPosition, mesh.position);
34
33
  direction.y = 0;
35
34
  direction.normalize();
36
35
  // 修正水平朝向计算:绕 Y 轴朝向相机
37
36
  // 标准做法:yaw = atan2(dx, dz)
38
- const yaw = Math.atan2(direction.x, direction.z);
37
+ var yaw = Math.atan2(direction.x, direction.z);
39
38
  mesh.rotation.y = yaw;
40
39
  };
41
40
  //# sourceMappingURL=tools.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CanvasTexture","Vector3","createTextCanvas","option","value","text","fontSize","color","fontWeight","pixelRatio","tempCanvas","document","createElement","ctx","getContext","font","textWidth","Math","ceil","measureText","width","textHeight","canvas","height","context","fillStyle","textAlign","textBaseline","fillText","texture","lookAtOnYAxis","mesh","targetPosition","position","rotation","direction","subVectors","y","normalize","yaw","atan2","x","z"],"sources":["../../../src/business/Poi/tools.ts"],"sourcesContent":["import { CanvasTexture, Vector3 } from '@anov/3d-core'\n\nexport interface TextOption {\n value?: string\n fontSize?: number\n color?: string\n fontWeight?: string\n}\n// 获取文字的canvas\nexport const createTextCanvas = (option: TextOption) => {\n const { value: text, fontSize, color, fontWeight } = option || {}\n\n const pixelRatio = 1// window.devicePixelRatio || 1\n const tempCanvas = document.createElement('canvas')\n const ctx = tempCanvas.getContext('2d')!\n ctx.font = `${fontWeight} ${fontSize * pixelRatio}px Arial`\n\n const textWidth = Math.ceil(ctx.measureText(text).width)\n const textHeight = Math.ceil(fontSize * pixelRatio * 1.1)\n\n const canvas = document.createElement('canvas')\n canvas.width = textWidth\n canvas.height = textHeight\n const context = canvas.getContext('2d')!\n context.fillStyle = color\n context.font = ctx.font\n context.textAlign = 'center'\n context.textBaseline = 'middle'\n context.fillText(text, textWidth / 2, textHeight / 2)\n\n return { width: textWidth, height: textHeight, texture: new CanvasTexture(canvas) }\n}\n\nexport const lookAtOnYAxis = (mesh, targetPosition) => {\n if (!mesh || !targetPosition || !mesh.position || !mesh.rotation)\n return\n const direction = new Vector3().subVectors(targetPosition, mesh.position)\n direction.y = 0\n direction.normalize()\n // 修正水平朝向计算:绕 Y 轴朝向相机\n // 标准做法:yaw = atan2(dx, dz)\n const yaw = Math.atan2(direction.x, direction.z)\n mesh.rotation.y = yaw\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,OAAO,QAAQ,eAAe;AAQtD;AACA,OAAO,MA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CAACC,IAAI,EAAEC,cAAc,KAAK;EACrD,IAAI,CAACD,IAAI,IAAI,CAACC,cAAc,IAAI,CAACD,IAAI,CAACE,QAAQ,IAAI,CAACF,IAAI,CAACG,QAAQ,EAC9D;EACF,MAAMC,SAAS,GAAG,IAAIlC,OAAO,CAAC,CAAC,CAACmC,UAAU,CAACJ,cAAc,EAAED,IAAI,CAACE,QAAQ,CAAC;EACzEE,SAAS,CAACE,CAAC,GAAG,CAAC;EACfF,SAAS,CAACG,SAAS,CAAC,CAAC;EACrB;EACA;EACA,MAAMC,GAAG,GAAGtB,IAAI,CAACuB,KAAK,CAACL,SAAS,CAACM,CAAC,EAAEN,SAAS,CAACO,CAAC,CAAC;EAChDX,IAAI,CAACG,QAAQ,CAACG,CAAC,GAAGE,GAAG;AACvB,CAAC"}
1
+ {"version":3,"names":["CanvasTexture","Vector3","createTextCanvas","option","_ref","text","value","fontSize","color","fontWeight","pixelRatio","tempCanvas","document","createElement","ctx","getContext","font","concat","textWidth","Math","ceil","measureText","width","textHeight","canvas","height","context","fillStyle","textAlign","textBaseline","fillText","texture","lookAtOnYAxis","mesh","targetPosition","position","rotation","direction","subVectors","y","normalize","yaw","atan2","x","z"],"sources":["../../../src/business/Poi/tools.ts"],"sourcesContent":["import { CanvasTexture, Vector3 } from '@anov/3d-core'\n\nexport interface TextOption {\n value?: string\n fontSize?: number\n color?: string\n fontWeight?: string\n}\n// 获取文字的canvas\nexport const createTextCanvas = (option: TextOption) => {\n const { value: text, fontSize, color, fontWeight } = option || {}\n\n const pixelRatio = 1// window.devicePixelRatio || 1\n const tempCanvas = document.createElement('canvas')\n const ctx = tempCanvas.getContext('2d')!\n ctx.font = `${fontWeight} ${fontSize * pixelRatio}px Arial`\n\n const textWidth = Math.ceil(ctx.measureText(text).width)\n const textHeight = Math.ceil(fontSize * pixelRatio * 1.1)\n\n const canvas = document.createElement('canvas')\n canvas.width = textWidth\n canvas.height = textHeight\n const context = canvas.getContext('2d')!\n context.fillStyle = color\n context.font = ctx.font\n context.textAlign = 'center'\n context.textBaseline = 'middle'\n context.fillText(text, textWidth / 2, textHeight / 2)\n\n return { width: textWidth, height: textHeight, texture: new CanvasTexture(canvas) }\n}\n\nexport const lookAtOnYAxis = (mesh, targetPosition) => {\n if (!mesh || !targetPosition || !mesh.position || !mesh.rotation)\n return\n const direction = new Vector3().subVectors(targetPosition, mesh.position)\n direction.y = 0\n direction.normalize()\n // 修正水平朝向计算:绕 Y 轴朝向相机\n // 标准做法:yaw = atan2(dx, dz)\n const yaw = Math.atan2(direction.x, direction.z)\n mesh.rotation.y = yaw\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,OAAO,QAAQ,eAAe;AAQtD;AACA,OAAO,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,MAAkB,EAAK;EACtD,IAAAC,IAAA,GAAqDD,MAAM,IAAI,CAAC,CAAC;IAAlDE,IAAI,GAAAD,IAAA,CAAXE,KAAK;IAAQC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IAAEC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IAAEC,UAAU,GAAAL,IAAA,CAAVK,UAAU;EAEhD,IAAMC,UAAU,GAAG,CAAC;EACpB,IAAMC,UAAU,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;EACnD,IAAMC,GAAG,GAAGH,UAAU,CAACI,UAAU,CAAC,IAAI,CAAE;EACxCD,GAAG,CAACE,IAAI,MAAAC,MAAA,CAAMR,UAAU,OAAAQ,MAAA,CAAIV,QAAQ,GAAGG,UAAU,aAAU;EAE3D,IAAMQ,SAAS,GAAGC,IAAI,CAACC,IAAI,CAACN,GAAG,CAACO,WAAW,CAAChB,IAAI,CAAC,CAACiB,KAAK,CAAC;EACxD,IAAMC,UAAU,GAAGJ,IAAI,CAACC,IAAI,CAACb,QAAQ,GAAGG,UAAU,GAAG,GAAG,CAAC;EAEzD,IAAMc,MAAM,GAAGZ,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;EAC/CW,MAAM,CAACF,KAAK,GAAGJ,SAAS;EACxBM,MAAM,CAACC,MAAM,GAAGF,UAAU;EAC1B,IAAMG,OAAO,GAAGF,MAAM,CAACT,UAAU,CAAC,IAAI,CAAE;EACxCW,OAAO,CAACC,SAAS,GAAGnB,KAAK;EACzBkB,OAAO,CAACV,IAAI,GAAGF,GAAG,CAACE,IAAI;EACvBU,OAAO,CAACE,SAAS,GAAG,QAAQ;EAC5BF,OAAO,CAACG,YAAY,GAAG,QAAQ;EAC/BH,OAAO,CAACI,QAAQ,CAACzB,IAAI,EAAEa,SAAS,GAAG,CAAC,EAAEK,UAAU,GAAG,CAAC,CAAC;EAErD,OAAO;IAAED,KAAK,EAAEJ,SAAS;IAAEO,MAAM,EAAEF,UAAU;IAAEQ,OAAO,EAAE,IAAI/B,aAAa,CAACwB,MAAM;EAAE,CAAC;AACrF,CAAC;AAED,OAAO,IAAMQ,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,IAAI,EAAEC,cAAc,EAAK;EACrD,IAAI,CAACD,IAAI,IAAI,CAACC,cAAc,IAAI,CAACD,IAAI,CAACE,QAAQ,IAAI,CAACF,IAAI,CAACG,QAAQ,EAC9D;EACF,IAAMC,SAAS,GAAG,IAAIpC,OAAO,CAAC,CAAC,CAACqC,UAAU,CAACJ,cAAc,EAAED,IAAI,CAACE,QAAQ,CAAC;EACzEE,SAAS,CAACE,CAAC,GAAG,CAAC;EACfF,SAAS,CAACG,SAAS,CAAC,CAAC;EACrB;EACA;EACA,IAAMC,GAAG,GAAGtB,IAAI,CAACuB,KAAK,CAACL,SAAS,CAACM,CAAC,EAAEN,SAAS,CAACO,CAAC,CAAC;EAChDX,IAAI,CAACG,QAAQ,CAACG,CAAC,GAAGE,GAAG;AACvB,CAAC"}
@@ -1,8 +1,19 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
1
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
8
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
9
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
11
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
12
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
3
14
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
5
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
16
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
17
  /*
7
18
  * @Descripttion: Box 封装
8
19
  * @version:
@@ -17,50 +28,64 @@ import ObjectLayer from "../Base/ObjectLayer";
17
28
  import { SphereGeometry, MeshBasicMaterial, Mesh } from '@anov/3d-core';
18
29
  import _ from 'lodash';
19
30
  import { defineProps } from "../Utils/defineProps";
20
- export class Sphere extends ObjectLayer {
21
- constructor(options) {
22
- super();
23
- _defineProperty(this, "mesh", void 0);
24
- _defineProperty(this, "currentOptions", void 0);
25
- this.currentOptions = options;
26
- this.mesh = this.createSphere(options);
27
- this.add(this.mesh);
28
- defineProps(this, ['radius', 'sphereSegments'], ['wireframe', 'color'], 'updateSphere');
31
+ export var Sphere = /*#__PURE__*/function (_ObjectLayer) {
32
+ _inherits(Sphere, _ObjectLayer);
33
+ var _super = _createSuper(Sphere);
34
+ function Sphere(options) {
35
+ var _this;
36
+ _classCallCheck(this, Sphere);
37
+ _this = _super.call(this);
38
+ _defineProperty(_assertThisInitialized(_this), "mesh", void 0);
39
+ _defineProperty(_assertThisInitialized(_this), "currentOptions", void 0);
40
+ _this.currentOptions = options;
41
+ _this.mesh = _this.createSphere(options);
42
+ _this.add(_this.mesh);
43
+ defineProps(_assertThisInitialized(_this), ['radius', 'sphereSegments'], ['wireframe', 'color'], 'updateSphere');
44
+ return _this;
29
45
  }
30
- createSphere(options) {
31
- const {
32
- radius = 1,
33
- sphereSegments = 16,
34
- material = {}
35
- } = options;
36
- const defaultMat = {
37
- color: 0xffffff,
38
- opacity: 1,
39
- transparent: false,
40
- wireframe: false,
41
- visible: true
42
- };
43
- const geometry = new SphereGeometry(radius, sphereSegments, sphereSegments);
44
- const mat = new MeshBasicMaterial(_objectSpread(_objectSpread({}, defaultMat), material));
45
- return new Mesh(geometry, mat);
46
- }
47
- updateSphere(options) {
48
- if (!this.mesh) return;
49
- _.mergeWith(this.currentOptions, options);
50
- this.remove(this.mesh);
51
- this.mesh.geometry.dispose();
52
- this.mesh.material.dispose();
53
- this.mesh = this.createSphere(this.currentOptions);
54
- this.add(this.mesh);
55
- }
56
- /** 销毁释放资源 */
57
- destroy() {
58
- if (!this.mesh) return;
59
- this.remove(this.mesh);
60
- this.mesh.geometry.dispose();
61
- this.mesh.material.dispose();
62
- // @ts-ignore
63
- this.mesh = null;
64
- }
65
- }
46
+ _createClass(Sphere, [{
47
+ key: "createSphere",
48
+ value: function createSphere(options) {
49
+ var _options$radius = options.radius,
50
+ radius = _options$radius === void 0 ? 1 : _options$radius,
51
+ _options$sphereSegmen = options.sphereSegments,
52
+ sphereSegments = _options$sphereSegmen === void 0 ? 16 : _options$sphereSegmen,
53
+ _options$material = options.material,
54
+ material = _options$material === void 0 ? {} : _options$material;
55
+ var defaultMat = {
56
+ color: 0xffffff,
57
+ opacity: 1,
58
+ transparent: false,
59
+ wireframe: false,
60
+ visible: true
61
+ };
62
+ var geometry = new SphereGeometry(radius, sphereSegments, sphereSegments);
63
+ var mat = new MeshBasicMaterial(_objectSpread(_objectSpread({}, defaultMat), material));
64
+ return new Mesh(geometry, mat);
65
+ }
66
+ }, {
67
+ key: "updateSphere",
68
+ value: function updateSphere(options) {
69
+ if (!this.mesh) return;
70
+ _.mergeWith(this.currentOptions, options);
71
+ this.remove(this.mesh);
72
+ this.mesh.geometry.dispose();
73
+ this.mesh.material.dispose();
74
+ this.mesh = this.createSphere(this.currentOptions);
75
+ this.add(this.mesh);
76
+ }
77
+ /** 销毁释放资源 */
78
+ }, {
79
+ key: "destroy",
80
+ value: function destroy() {
81
+ if (!this.mesh) return;
82
+ this.remove(this.mesh);
83
+ this.mesh.geometry.dispose();
84
+ this.mesh.material.dispose();
85
+ // @ts-ignore
86
+ this.mesh = null;
87
+ }
88
+ }]);
89
+ return Sphere;
90
+ }(ObjectLayer);
66
91
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ObjectLayer","SphereGeometry","MeshBasicMaterial","Mesh","_","defineProps","Sphere","constructor","options","_defineProperty","currentOptions","mesh","createSphere","add","radius","sphereSegments","material","defaultMat","color","opacity","transparent","wireframe","visible","geometry","mat","_objectSpread","updateSphere","mergeWith","remove","dispose","destroy"],"sources":["../../../src/business/Sphere/index.ts"],"sourcesContent":["\n/*\n * @Descripttion: Box 封装\n * @version: \n * @Author: 周志国\n * @Date: 2025-09-08\n * @LastEditors: 周志国\n * @LastEditTime: 2025-09-15 10:48:13\n * @changeLog: 实现立方体对象,支持默认参数、更新与销毁\n * @FilePath: /anov-3d-webgl/packages/anov-3d-ability/src/business/Sphere/index.ts\n */\nimport ObjectLayer from '../Base/ObjectLayer'\nimport type { options } from './types'\nimport {\n SphereGeometry,\n MeshBasicMaterial,\n MeshBasicMaterialParameters,\n Mesh,\n} from '@anov/3d-core'\nimport { ISphere } from './interface'\nimport _ from 'lodash'\nimport { defineProps } from '../Utils/defineProps'\nexport class Sphere extends ObjectLayer implements ISphere {\n private mesh!: Mesh\n private currentOptions!: options\n constructor(options: options) {\n super()\n this.currentOptions = options\n this.mesh = this.createSphere(options)\n this.add(this.mesh)\n defineProps(\n this,\n ['radius', 'sphereSegments'],\n ['wireframe', 'color'],\n 'updateSphere'\n )\n }\n createSphere(options: options): Mesh {\n const {\n radius = 1,\n sphereSegments = 16,\n material = {},\n } = options\n\n const defaultMat: MeshBasicMaterialParameters = {\n color: 0xffffff,\n opacity: 1,\n transparent: false,\n wireframe: false,\n visible: true,\n }\n const geometry = new SphereGeometry(radius, sphereSegments, sphereSegments)\n const mat = new MeshBasicMaterial({ ...defaultMat, ...material })\n return new Mesh(geometry, mat)\n }\n updateSphere(options: options): void {\n if (!this.mesh) return\n _.mergeWith(this.currentOptions, options)\n this.remove(this.mesh)\n this.mesh.geometry.dispose();\n (this.mesh.material as any).dispose()\n this.mesh = this.createSphere(this.currentOptions)\n this.add(this.mesh)\n }\n /** 销毁释放资源 */\n public destroy() {\n if (!this.mesh) return\n this.remove(this.mesh)\n this.mesh.geometry.dispose()\n ; (this.mesh.material as any).dispose()\n // @ts-ignore\n this.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IAAI,CAACG,IAAI,EAAE;IAChBP,CAAC,CAACuB,SAAS,CAAC,IAAI,CAACjB,cAAc,EAAEF,OAAO,CAAC;IACzC,IAAI,CAACoB,MAAM,CAAC,IAAI,CAACjB,IAAI,CAAC;IACtB,IAAI,CAACA,IAAI,CAACY,QAAQ,CAACM,OAAO,CAAC,CAAC;IAC3B,IAAI,CAAClB,IAAI,CAACK,QAAQ,CAASa,OAAO,CAAC,CAAC;IACrC,IAAI,CAAClB,IAAI,GAAG,IAAI,CAACC,YAAY,CAAC,IAAI,CAACF,cAAc,CAAC;IAClD,IAAI,CAACG,GAAG,CAAC,IAAI,CAACF,IAAI,CAAC;EACrB;EACA;EACOmB,OAAOA,CAAA,EAAG;IACf,IAAI,CAAC,IAAI,CAACnB,IAAI,EAAE;IAChB,IAAI,CAACiB,MAAM,CAAC,IAAI,CAACjB,IAAI,CAAC;IACtB,IAAI,CAACA,IAAI,CAACY,QAAQ,CAACM,OAAO,CAAC,CAAC;IACvB,IAAI,CAAClB,IAAI,CAACK,QAAQ,CAASa,OAAO,CAAC,CAAC;IACzC;IACA,IAAI,CAAClB,IAAI,GAAG,IAAI;EAClB;AACF"}
1
+ {"version":3,"names":["ObjectLayer","SphereGeometry","MeshBasicMaterial","Mesh","_","defineProps","Sphere","_ObjectLayer","_inherits","_super","_createSuper","options","_this","_classCallCheck","call","_defineProperty","_assertThisInitialized","currentOptions","mesh","createSphere","add","_createClass","key","value","_options$radius","radius","_options$sphereSegmen","sphereSegments","_options$material","material","defaultMat","color","opacity","transparent","wireframe","visible","geometry","mat","_objectSpread","updateSphere","mergeWith","remove","dispose","destroy"],"sources":["../../../src/business/Sphere/index.ts"],"sourcesContent":["\n/*\n * @Descripttion: Box 封装\n * @version: \n * @Author: 周志国\n * @Date: 2025-09-08\n * @LastEditors: 周志国\n * @LastEditTime: 2025-09-15 10:48:13\n * @changeLog: 实现立方体对象,支持默认参数、更新与销毁\n * @FilePath: /anov-3d-webgl/packages/anov-3d-ability/src/business/Sphere/index.ts\n */\nimport ObjectLayer from '../Base/ObjectLayer'\nimport type { options } from './types'\nimport {\n SphereGeometry,\n MeshBasicMaterial,\n MeshBasicMaterialParameters,\n Mesh,\n} from '@anov/3d-core'\nimport { ISphere } from './interface'\nimport _ from 'lodash'\nimport { defineProps } from '../Utils/defineProps'\nexport class Sphere extends ObjectLayer implements ISphere {\n private mesh!: Mesh\n private currentOptions!: options\n constructor(options: options) {\n super()\n this.currentOptions = options\n this.mesh = this.createSphere(options)\n this.add(this.mesh)\n defineProps(\n this,\n ['radius', 'sphereSegments'],\n ['wireframe', 'color'],\n 'updateSphere'\n )\n }\n createSphere(options: options): Mesh {\n const {\n radius = 1,\n sphereSegments = 16,\n material = {},\n } = options\n\n const defaultMat: MeshBasicMaterialParameters = {\n color: 0xffffff,\n opacity: 1,\n transparent: false,\n wireframe: false,\n visible: true,\n }\n const geometry = new SphereGeometry(radius, sphereSegments, sphereSegments)\n const mat = new MeshBasicMaterial({ ...defaultMat, ...material })\n return new Mesh(geometry, mat)\n }\n updateSphere(options: options): void {\n if (!this.mesh) return\n _.mergeWith(this.currentOptions, options)\n this.remove(this.mesh)\n this.mesh.geometry.dispose();\n (this.mesh.material as any).dispose()\n this.mesh = this.createSphere(this.currentOptions)\n this.add(this.mesh)\n }\n /** 销毁释放资源 */\n public destroy() {\n if (!this.mesh) return\n this.remove(this.mesh)\n this.mesh.geometry.dispose()\n ; (this.mesh.material as any).dispose()\n // @ts-ignore\n this.mesh = null\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,WAAW;AAElB,SACEC,cAAc,EACdC,iBAAiB,EAEjBC,IAAI,QACC,eAAe;AAEtB,OAAOC,CAAC,MAAM,QAAQ;AACtB,SAASC,WAAW;AACpB,WAAaC,MAAM,0BAAAC,YAAA;EAAAC,SAAA,CAAAF,MAAA,EAAAC,YAAA;EAAA,IAAAE,MAAA,GAAAC,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