@nova-lab/core 1.0.0-dev.19 → 1.1.0-dev.229

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 (501) hide show
  1. package/README.md +1035 -10
  2. package/THIRD_PARTY_NOTICES.md +26 -0
  3. package/dist/2d/accessibility.d.ts +2 -0
  4. package/dist/2d/accessibility.js +171 -0
  5. package/dist/2d/commands.d.ts +2 -0
  6. package/dist/2d/commands.js +80 -0
  7. package/dist/2d/effects.d.ts +10 -0
  8. package/dist/2d/effects.js +566 -0
  9. package/dist/2d/ktx2.d.ts +5 -0
  10. package/dist/2d/ktx2.js +542 -0
  11. package/dist/2d/lighting.d.ts +3 -0
  12. package/dist/2d/lighting.js +495 -0
  13. package/dist/2d/lottie.d.ts +3 -0
  14. package/dist/2d/lottie.js +254 -0
  15. package/dist/2d/meshes.d.ts +4 -0
  16. package/dist/2d/meshes.js +451 -0
  17. package/dist/2d/primitives.d.ts +3 -0
  18. package/dist/2d/primitives.js +85 -0
  19. package/dist/2d/render-textures.d.ts +3 -0
  20. package/dist/2d/render-textures.js +539 -0
  21. package/dist/2d/svg/documents.d.ts +5 -0
  22. package/dist/2d/svg/documents.js +7 -0
  23. package/dist/2d/svg/renderer.d.ts +3 -0
  24. package/dist/2d/svg/renderer.js +222 -0
  25. package/dist/2d/svg.d.ts +3 -0
  26. package/dist/2d/svg.js +4 -0
  27. package/dist/2d/tools.d.ts +2 -0
  28. package/dist/2d/tools.js +100 -0
  29. package/dist/2d/video.d.ts +5 -0
  30. package/dist/2d/video.js +90 -0
  31. package/dist/2d.d.ts +2 -0
  32. package/dist/2d.js +220 -0
  33. package/dist/3d/animation.d.ts +8 -0
  34. package/dist/3d/animation.js +1396 -0
  35. package/dist/3d/area-lights.d.ts +2 -0
  36. package/dist/3d/area-lights.js +19 -0
  37. package/dist/3d/audio.d.ts +4 -0
  38. package/dist/3d/audio.js +500 -0
  39. package/dist/3d/character.d.ts +2 -0
  40. package/dist/3d/character.js +136 -0
  41. package/dist/3d/collision.d.ts +3 -0
  42. package/dist/3d/collision.js +387 -0
  43. package/dist/3d/commands.d.ts +2 -0
  44. package/dist/3d/commands.js +108 -0
  45. package/dist/3d/controls.d.ts +8 -0
  46. package/dist/3d/controls.js +1041 -0
  47. package/dist/3d/documents.d.ts +5 -0
  48. package/dist/3d/documents.js +227 -0
  49. package/dist/3d/effects.d.ts +5 -0
  50. package/dist/3d/effects.js +1986 -0
  51. package/dist/3d/export.d.ts +4 -0
  52. package/dist/3d/export.js +347 -0
  53. package/dist/3d/fbx.d.ts +2 -0
  54. package/dist/3d/fbx.js +784 -0
  55. package/dist/3d/gltf.d.ts +2 -0
  56. package/dist/3d/gltf.js +5 -0
  57. package/dist/3d/helpers.d.ts +5 -0
  58. package/dist/3d/helpers.js +191 -0
  59. package/dist/3d/ik.d.ts +9 -0
  60. package/dist/3d/ik.js +777 -0
  61. package/dist/3d/loaders.d.ts +17 -0
  62. package/dist/3d/loaders.js +1406 -0
  63. package/dist/3d/nodes.d.ts +8 -0
  64. package/dist/3d/nodes.js +49 -0
  65. package/dist/3d/particles.d.ts +5 -0
  66. package/dist/3d/particles.js +1574 -0
  67. package/dist/3d/physics/backend.d.ts +7 -0
  68. package/dist/3d/physics/backend.js +1 -0
  69. package/dist/3d/physics/rapier.d.ts +3 -0
  70. package/dist/3d/physics/rapier.js +765 -0
  71. package/dist/3d/physics.d.ts +5 -0
  72. package/dist/3d/physics.js +3346 -0
  73. package/dist/3d/splats.d.ts +7 -0
  74. package/dist/3d/splats.js +862 -0
  75. package/dist/3d/text.d.ts +5 -0
  76. package/dist/3d/text.js +1043 -0
  77. package/dist/3d/tiles.d.ts +24 -0
  78. package/dist/3d/tiles.js +1705 -0
  79. package/dist/3d/tools.d.ts +12 -0
  80. package/dist/3d/tools.js +338 -0
  81. package/dist/3d/usdz.d.ts +2 -0
  82. package/dist/3d/usdz.js +634 -0
  83. package/dist/3d/xr.d.ts +2 -0
  84. package/dist/3d/xr.js +202 -0
  85. package/dist/3d-B4jWF8Qb.js +5591 -0
  86. package/dist/3d.d.ts +40 -0
  87. package/dist/3d.js +44 -0
  88. package/dist/Capsule-BFVpZfvc.js +44 -0
  89. package/dist/Clip-CAN7t03k.js +204 -0
  90. package/dist/Color-vuv9UnoY.js +34 -0
  91. package/dist/DeformedMesh-CPi0P_vc.js +280 -0
  92. package/dist/Document-DCVEZSvM.js +415 -0
  93. package/dist/Errors-B2ekO9bZ.js +30 -0
  94. package/dist/Features-BsjmePtc.js +557 -0
  95. package/dist/GLTFResourceIO-CYJyCUTt.js +124 -0
  96. package/dist/GPUParticleState-CQlNpoDa.js +545 -0
  97. package/dist/Geometry-DytO490z.js +227 -0
  98. package/dist/Inflate-DWw0V-Up.js +42 -0
  99. package/dist/InstancedMesh-DPrgrw5z.js +527 -0
  100. package/dist/Limits-Bw5XQdFr.js +20 -0
  101. package/dist/LineHelper-Ad0z9uDi.js +131 -0
  102. package/dist/LoaderIO-BwrM84OM.js +114 -0
  103. package/dist/Material-BpfLPmK9.js +777 -0
  104. package/dist/Mesh-BaRxAAJq.js +209 -0
  105. package/dist/Node-QfgAE2_v.js +877 -0
  106. package/dist/NovaAssetRegistry-p2QlCwvT.js +1168 -0
  107. package/dist/NovaNode-CBZ-Ol-W.js +2016 -0
  108. package/dist/NovaRenderCommandWriter-CWQRa42y.js +1949 -0
  109. package/dist/NovaTextSelectionService-CipuujCT.js +18526 -0
  110. package/dist/NovaWebGLProgram-BO250QNF.js +97 -0
  111. package/dist/Options-CajE7LLJ.js +15 -0
  112. package/dist/PolygonMesh-D4PnnfIo.js +657 -0
  113. package/dist/Ready-BzyhRtjD.js +21 -0
  114. package/dist/Scene-CDfNgf9I.js +911 -0
  115. package/dist/Shader-b6_HDndT.js +48 -0
  116. package/dist/SplatShader-wJ6GJ3vo.js +130 -0
  117. package/dist/Texture-dTKMlTpK.js +267 -0
  118. package/dist/TextureLoader-CfDzdy2m.js +411 -0
  119. package/dist/Textures-CGL4Kf-8.js +651 -0
  120. package/dist/ToneMapping-D9IWvN0u.js +46 -0
  121. package/dist/WebGPURenderer-DjD0IxVC.js +4921 -0
  122. package/dist/ZipReader-C-MSEsSr.js +84 -0
  123. package/dist/core.js +218 -24024
  124. package/dist/domain/types/base.types.d.ts +18 -9
  125. package/dist/domain/types/component.types.d.ts +5 -5
  126. package/dist/domain/types/cursor.types.d.ts +1 -1
  127. package/dist/domain/types/diagnostics.types.d.ts +2 -0
  128. package/dist/domain/types/export.types.d.ts +2 -2
  129. package/dist/domain/types/hit-test.types.d.ts +1 -1
  130. package/dist/domain/types/motion.types.d.ts +2 -2
  131. package/dist/domain/types/renderer.types.d.ts +88 -4
  132. package/dist/domain/types/rendering/index.d.ts +29 -4
  133. package/dist/domain/types/sound.types.d.ts +1 -1
  134. package/dist/domain/types/theme.types.d.ts +1 -1
  135. package/dist/domain/utils/bounds.d.ts +1 -1
  136. package/dist/domain/utils/nova-text.d.ts +9 -0
  137. package/dist/domain/utils/schemaBounds.d.ts +2 -2
  138. package/dist/export-svg-document-ChaNXMaG.js +668 -0
  139. package/dist/features/3d/Errors.d.ts +57 -0
  140. package/dist/features/3d/Nova3DApp.d.ts +429 -0
  141. package/dist/features/3d/animation/Animator.d.ts +260 -0
  142. package/dist/features/3d/animation/Clip.d.ts +74 -0
  143. package/dist/features/3d/animation/Graph.d.ts +158 -0
  144. package/dist/features/3d/animation/Mask.d.ts +40 -0
  145. package/dist/features/3d/audio/Audio.d.ts +114 -0
  146. package/dist/features/3d/audio/Sound.d.ts +133 -0
  147. package/dist/features/3d/character/CharacterController.d.ts +61 -0
  148. package/dist/features/3d/collision/Capsule.d.ts +25 -0
  149. package/dist/features/3d/collision/Octree.d.ts +94 -0
  150. package/dist/features/3d/controls/CameraMotionControls.d.ts +154 -0
  151. package/dist/features/3d/controls/CameraOrientation.d.ts +47 -0
  152. package/dist/features/3d/controls/OrbitControls.d.ts +73 -0
  153. package/dist/features/3d/controls/PointerGesture.d.ts +25 -0
  154. package/dist/features/3d/controls/PointerLock.d.ts +36 -0
  155. package/dist/features/3d/controls/Snapping.d.ts +32 -0
  156. package/dist/features/3d/controls/TransformGizmo.d.ts +79 -0
  157. package/dist/features/3d/deformation/DeformationGPU.d.ts +52 -0
  158. package/dist/features/3d/deformation/DeformationShader.d.ts +2 -0
  159. package/dist/features/3d/deformation/DeformedMesh.d.ts +36 -0
  160. package/dist/features/3d/deformation/GeometryDeformation.d.ts +25 -0
  161. package/dist/features/3d/documents/Document.d.ts +59 -0
  162. package/dist/features/3d/documents/DocumentCommands.d.ts +45 -0
  163. package/dist/features/3d/documents/DocumentSchema.d.ts +18 -0
  164. package/dist/features/3d/documents/DocumentTransform.d.ts +4 -0
  165. package/dist/features/3d/documents/DocumentTypes.d.ts +182 -0
  166. package/dist/features/3d/documents/DocumentValidation.d.ts +18 -0
  167. package/dist/features/3d/documents/Projection.d.ts +65 -0
  168. package/dist/features/3d/effects/CubeLUT.d.ts +24 -0
  169. package/dist/features/3d/effects/Effects.d.ts +32 -0
  170. package/dist/features/3d/effects/EffectsGPU.d.ts +80 -0
  171. package/dist/features/3d/effects/EffectsPlan.d.ts +268 -0
  172. package/dist/features/3d/effects/EffectsShaders.d.ts +35 -0
  173. package/dist/features/3d/export/GLTFExporter.d.ts +49 -0
  174. package/dist/features/3d/export/ThreeMFExporter.d.ts +19 -0
  175. package/dist/features/3d/export/ZipWriter.d.ts +9 -0
  176. package/dist/features/3d/fbx/FBXLoader.d.ts +26 -0
  177. package/dist/features/3d/fbx/FBXParser.d.ts +35 -0
  178. package/dist/features/3d/fbx/FBXScene.d.ts +20 -0
  179. package/dist/features/3d/gltf/GLTFLoader.d.ts +16 -0
  180. package/dist/features/3d/gltf/GLTFTypes.d.ts +64 -0
  181. package/dist/features/3d/gltf/services/GLTFBinary.d.ts +21 -0
  182. package/dist/features/3d/gltf/services/GLTFGeometry.d.ts +14 -0
  183. package/dist/features/3d/gltf/services/GLTFResourceIO.d.ts +64 -0
  184. package/dist/features/3d/helpers/LineHelper.d.ts +51 -0
  185. package/dist/features/3d/helpers/StaticHelpers.d.ts +47 -0
  186. package/dist/features/3d/helpers/TrackedHelpers.d.ts +84 -0
  187. package/dist/features/3d/ik/ChainIK.d.ts +44 -0
  188. package/dist/features/3d/ik/IKChain.d.ts +92 -0
  189. package/dist/features/3d/ik/IKMath.d.ts +49 -0
  190. package/dist/features/3d/ik/IKSolver.d.ts +97 -0
  191. package/dist/features/3d/ik/LookAtIK.d.ts +58 -0
  192. package/dist/features/3d/ik/TwoBoneIK.d.ts +57 -0
  193. package/dist/features/3d/import/ImportAnimation.d.ts +20 -0
  194. package/dist/features/3d/import/ImportMath.d.ts +42 -0
  195. package/dist/features/3d/import/ImportedModel.d.ts +135 -0
  196. package/dist/features/3d/import/Inflate.d.ts +5 -0
  197. package/dist/features/3d/import/ModelAsset.d.ts +149 -0
  198. package/dist/features/3d/import/PolygonMesh.d.ts +54 -0
  199. package/dist/features/3d/lights/AreaLightTables.d.ts +8 -0
  200. package/dist/features/3d/lights/AreaLights.d.ts +11 -0
  201. package/dist/features/3d/loaders/EXRCompression.d.ts +13 -0
  202. package/dist/features/3d/loaders/EXRLoader.d.ts +39 -0
  203. package/dist/features/3d/loaders/HDRLoader.d.ts +26 -0
  204. package/dist/features/3d/loaders/Limits.d.ts +70 -0
  205. package/dist/features/3d/loaders/LoaderBuffers.d.ts +42 -0
  206. package/dist/features/3d/loaders/LoaderIO.d.ts +81 -0
  207. package/dist/features/3d/loaders/LoaderModel.d.ts +80 -0
  208. package/dist/features/3d/loaders/LoaderText.d.ts +27 -0
  209. package/dist/features/3d/loaders/MTLLoader.d.ts +105 -0
  210. package/dist/features/3d/loaders/OBJLoader.d.ts +70 -0
  211. package/dist/features/3d/loaders/PLYLoader.d.ts +47 -0
  212. package/dist/features/3d/loaders/STLLoader.d.ts +27 -0
  213. package/dist/features/3d/model/Camera.d.ts +33 -0
  214. package/dist/features/3d/model/Environment.d.ts +31 -0
  215. package/dist/features/3d/model/Geometry.d.ts +59 -0
  216. package/dist/features/3d/model/InstancedMesh.d.ts +134 -0
  217. package/dist/features/3d/model/LOD.d.ts +31 -0
  218. package/dist/features/3d/model/Light.d.ts +200 -0
  219. package/dist/features/3d/model/Material.d.ts +308 -0
  220. package/dist/features/3d/model/MaterialExtensions.d.ts +200 -0
  221. package/dist/features/3d/model/Mesh.d.ts +92 -0
  222. package/dist/features/3d/model/Node.d.ts +87 -0
  223. package/dist/features/3d/model/ReflectionProbe.d.ts +45 -0
  224. package/dist/features/3d/model/RenderTarget.d.ts +41 -0
  225. package/dist/features/3d/model/Scene.d.ts +173 -0
  226. package/dist/features/3d/model/Texture.d.ts +143 -0
  227. package/dist/features/3d/nodes/Nodes.d.ts +8 -0
  228. package/dist/features/3d/nodes/ShaderNode.d.ts +240 -0
  229. package/dist/features/3d/particles/GPUParticleSchedule.d.ts +67 -0
  230. package/dist/features/3d/particles/GPUParticleShaders.d.ts +19 -0
  231. package/dist/features/3d/particles/GPUParticleState.d.ts +106 -0
  232. package/dist/features/3d/particles/GPUParticleSystem.d.ts +192 -0
  233. package/dist/features/3d/particles/ParticleCurves.d.ts +34 -0
  234. package/dist/features/3d/particles/ParticleOptions.d.ts +78 -0
  235. package/dist/features/3d/particles/ParticleSystem.d.ts +368 -0
  236. package/dist/features/3d/physics/PhysicsBackend.d.ts +352 -0
  237. package/dist/features/3d/physics/PhysicsDebug.d.ts +24 -0
  238. package/dist/features/3d/physics/PhysicsWorld.d.ts +352 -0
  239. package/dist/features/3d/physics/basic/BasicCollision.d.ts +75 -0
  240. package/dist/features/3d/physics/basic/BasicPhysics.d.ts +24 -0
  241. package/dist/features/3d/physics/basic/BasicShapes.d.ts +103 -0
  242. package/dist/features/3d/physics/rapier/ContactBuffer.d.ts +32 -0
  243. package/dist/features/3d/physics/rapier/RapierBackend.d.ts +17 -0
  244. package/dist/features/3d/physics/rapier/RapierShapes.d.ts +4 -0
  245. package/dist/features/3d/physics/rapier/RapierWorld.d.ts +198 -0
  246. package/dist/features/3d/physics/rapier/Validation.d.ts +8 -0
  247. package/dist/features/3d/services/Background.d.ts +22 -0
  248. package/dist/features/3d/services/BasicShader.d.ts +55 -0
  249. package/dist/features/3d/services/ClusteredLights.d.ts +69 -0
  250. package/dist/features/3d/services/DrawOrder.d.ts +37 -0
  251. package/dist/features/3d/services/EffectsProcessor.d.ts +38 -0
  252. package/dist/features/3d/services/EnvironmentBRDF.d.ts +35 -0
  253. package/dist/features/3d/services/EnvironmentMaps.d.ts +55 -0
  254. package/dist/features/3d/services/FogShader.d.ts +6 -0
  255. package/dist/features/3d/services/Frustum.d.ts +7 -0
  256. package/dist/features/3d/services/GLState.d.ts +86 -0
  257. package/dist/features/3d/services/GPUPicker.d.ts +31 -0
  258. package/dist/features/3d/services/InstanceShader.d.ts +3 -0
  259. package/dist/features/3d/services/LineProgram.d.ts +32 -0
  260. package/dist/features/3d/services/PBRProgram.d.ts +115 -0
  261. package/dist/features/3d/services/Renderer.d.ts +50 -0
  262. package/dist/features/3d/services/Shader.d.ts +22 -0
  263. package/dist/features/3d/services/ShaderProgram.d.ts +38 -0
  264. package/dist/features/3d/services/ShadowMaps.d.ts +97 -0
  265. package/dist/features/3d/services/SpatialIndex.d.ts +16 -0
  266. package/dist/features/3d/services/TextureLoader.d.ts +40 -0
  267. package/dist/features/3d/services/TextureMipmaps.d.ts +42 -0
  268. package/dist/features/3d/services/ToneMapping.d.ts +12 -0
  269. package/dist/features/3d/services/WebGLRenderer.d.ts +261 -0
  270. package/dist/features/3d/splats/SplatData.d.ts +136 -0
  271. package/dist/features/3d/splats/SplatLoaders.d.ts +64 -0
  272. package/dist/features/3d/splats/SplatShader.d.ts +14 -0
  273. package/dist/features/3d/splats/SplatSort.d.ts +69 -0
  274. package/dist/features/3d/splats/Splats.d.ts +116 -0
  275. package/dist/features/3d/text/FontAtlas.d.ts +246 -0
  276. package/dist/features/3d/text/SDF.d.ts +28 -0
  277. package/dist/features/3d/text/Text.d.ts +179 -0
  278. package/dist/features/3d/text/TextLayout.d.ts +73 -0
  279. package/dist/features/3d/text/TextShader.d.ts +12 -0
  280. package/dist/features/3d/tiles/BoundingVolume.d.ts +43 -0
  281. package/dist/features/3d/tiles/Geodesy.d.ts +106 -0
  282. package/dist/features/3d/tiles/GlobeControls.d.ts +147 -0
  283. package/dist/features/3d/tiles/TileContent.d.ts +35 -0
  284. package/dist/features/3d/tiles/TileFormats.d.ts +77 -0
  285. package/dist/features/3d/tiles/Tiles3D.d.ts +236 -0
  286. package/dist/features/3d/tiles/Tileset.d.ts +81 -0
  287. package/dist/features/3d/tools/BatchedMesh.d.ts +74 -0
  288. package/dist/features/3d/tools/CanvasSurface.d.ts +81 -0
  289. package/dist/features/3d/tools/Color.d.ts +11 -0
  290. package/dist/features/3d/tools/MergeGeometries.d.ts +22 -0
  291. package/dist/features/3d/tools/Options.d.ts +15 -0
  292. package/dist/features/3d/tools/Polyhedra.d.ts +30 -0
  293. package/dist/features/3d/tools/PrimitiveBuffers.d.ts +42 -0
  294. package/dist/features/3d/tools/Primitives.d.ts +164 -0
  295. package/dist/features/3d/tools/Ready.d.ts +12 -0
  296. package/dist/features/3d/tools/SpatialMath.d.ts +57 -0
  297. package/dist/features/3d/tools/SphericalHarmonics.d.ts +9 -0
  298. package/dist/features/3d/tools/math/mat3.d.ts +7 -0
  299. package/dist/features/3d/tools/math/mat4.d.ts +19 -0
  300. package/dist/features/3d/tools/math/quat.d.ts +6 -0
  301. package/dist/features/3d/tools/math/vec3.d.ts +16 -0
  302. package/dist/features/3d/tools/math/vec4.d.ts +5 -0
  303. package/dist/features/3d/types.d.ts +359 -0
  304. package/dist/features/3d/usdz/USDAParser.d.ts +50 -0
  305. package/dist/features/3d/usdz/USDScene.d.ts +20 -0
  306. package/dist/features/3d/usdz/USDZLoader.d.ts +27 -0
  307. package/dist/features/3d/usdz/ZipReader.d.ts +16 -0
  308. package/dist/features/3d/webgpu/Backend.d.ts +40 -0
  309. package/dist/features/3d/webgpu/BasicShader.d.ts +10 -0
  310. package/dist/features/3d/webgpu/Constants.d.ts +32 -0
  311. package/dist/features/3d/webgpu/Deformation.d.ts +71 -0
  312. package/dist/features/3d/webgpu/Environment.d.ts +66 -0
  313. package/dist/features/3d/webgpu/Features.d.ts +68 -0
  314. package/dist/features/3d/webgpu/Layouts.d.ts +27 -0
  315. package/dist/features/3d/webgpu/Lines.d.ts +40 -0
  316. package/dist/features/3d/webgpu/LitExtras.d.ts +46 -0
  317. package/dist/features/3d/webgpu/LitFeatures.d.ts +41 -0
  318. package/dist/features/3d/webgpu/LitScene.d.ts +60 -0
  319. package/dist/features/3d/webgpu/LitShader.d.ts +68 -0
  320. package/dist/features/3d/webgpu/Particles.d.ts +114 -0
  321. package/dist/features/3d/webgpu/Picking.d.ts +59 -0
  322. package/dist/features/3d/webgpu/PipelineKey.d.ts +33 -0
  323. package/dist/features/3d/webgpu/Points.d.ts +41 -0
  324. package/dist/features/3d/webgpu/Probes.d.ts +45 -0
  325. package/dist/features/3d/webgpu/ShaderChunks.d.ts +18 -0
  326. package/dist/features/3d/webgpu/ShaderMaterial.d.ts +57 -0
  327. package/dist/features/3d/webgpu/ShaderMaterialSource.d.ts +5 -0
  328. package/dist/features/3d/webgpu/Shadows.d.ts +49 -0
  329. package/dist/features/3d/webgpu/Splats.d.ts +47 -0
  330. package/dist/features/3d/webgpu/Textures.d.ts +52 -0
  331. package/dist/features/3d/webgpu/Transmission.d.ts +30 -0
  332. package/dist/features/3d/webgpu/UniformLayout.d.ts +30 -0
  333. package/dist/features/3d/webgpu/UtilityShaders.d.ts +38 -0
  334. package/dist/features/3d/webgpu/WebGPURenderer.d.ts +327 -0
  335. package/dist/features/3d/webgpu/effects/EffectsShaders.d.ts +74 -0
  336. package/dist/features/3d/webgpu/effects/WebGPUEffects.d.ts +140 -0
  337. package/dist/features/3d/xr/XR.d.ts +100 -0
  338. package/dist/gltf-By-n0qEg.js +960 -0
  339. package/dist/index.d.ts +86 -81
  340. package/dist/model/document-actions/document-commands.d.ts +18 -0
  341. package/dist/model/documents/svg/create-svg-document-renderer.d.ts +32 -0
  342. package/dist/model/documents/svg/export-svg-document.d.ts +5 -0
  343. package/dist/model/documents/svg/import-svg-document.d.ts +6 -0
  344. package/dist/model/documents/svg/svg-document.types.d.ts +111 -0
  345. package/dist/model/documents/svg/svg-values.d.ts +16 -0
  346. package/dist/model/documents/svg/svg-xml.d.ts +18 -0
  347. package/dist/model/input/NovaInputProxy_Adapter.d.ts +2 -1
  348. package/dist/model/input/NovaInputValidationController.d.ts +1 -1
  349. package/dist/model/input/NovaTextInputController.d.ts +1 -1
  350. package/dist/model/input/NovaTextLayoutEngine.d.ts +2 -6
  351. package/dist/model/input/index.d.ts +7 -7
  352. package/dist/model/input/nova-input.types.d.ts +1 -1
  353. package/dist/model/lighting/LightingRenderer2D.d.ts +58 -0
  354. package/dist/model/lighting/NovaLighting2D.d.ts +56 -0
  355. package/dist/model/lighting/lighting-shaders.d.ts +3 -0
  356. package/dist/model/lighting/lighting-state.d.ts +27 -0
  357. package/dist/model/lighting/lighting.types.d.ts +107 -0
  358. package/dist/model/lottie/LottieNode.d.ts +4 -0
  359. package/dist/model/lottie/lottie.types.d.ts +83 -0
  360. package/dist/model/lottie/prepare-lottie.d.ts +3 -0
  361. package/dist/model/lottie/sample-position.d.ts +9 -0
  362. package/dist/model/motion/NovaMotionEngine.d.ts +3 -3
  363. package/dist/model/motion/nova-motion-easing.d.ts +1 -1
  364. package/dist/model/motion/nova-motion-interpolation.d.ts +1 -1
  365. package/dist/model/motion/nova-motion-presets.d.ts +2 -2
  366. package/dist/model/motion/nova-motion-timeline.d.ts +1 -1
  367. package/dist/model/platform/NovaCanvas.d.ts +7 -6
  368. package/dist/model/primitives/NovaPrimitiveUnsupportedError.d.ts +13 -0
  369. package/dist/model/primitives/definePrimitive.d.ts +5 -0
  370. package/dist/model/primitives/primitive.types.d.ts +28 -0
  371. package/dist/model/render/backends/canvas2d/NovaCanvas2DTargetManager.d.ts +3 -3
  372. package/dist/model/render/backends/canvas2d/NovaRenderer2D.d.ts +61 -15
  373. package/dist/model/render/backends/canvas2d/nova-canvas-blend.d.ts +5 -0
  374. package/dist/model/render/backends/nova-render-backend-factory.d.ts +6 -6
  375. package/dist/model/render/backends/nova-render-backend.d.ts +8 -2
  376. package/dist/model/render/backends/webgl/NovaRendererWebGL.d.ts +32 -11
  377. package/dist/model/render/backends/webgl/NovaStreamCacheIdleLedger.d.ts +12 -1
  378. package/dist/model/render/backends/webgl/NovaWebGLBatcher.d.ts +1 -1
  379. package/dist/model/render/backends/webgl/NovaWebGLCircleImagePass.d.ts +23 -0
  380. package/dist/model/render/backends/webgl/NovaWebGLCompositionPass.d.ts +9 -0
  381. package/dist/model/render/backends/webgl/NovaWebGLDevice.d.ts +3 -1
  382. package/dist/model/render/backends/webgl/NovaWebGLDiagnostics.d.ts +1 -1
  383. package/dist/model/render/backends/webgl/NovaWebGLFrameRenderer.d.ts +162 -53
  384. package/dist/model/render/backends/webgl/NovaWebGLPathClipPass.d.ts +13 -0
  385. package/dist/model/render/backends/webgl/NovaWebGLPathUnion.d.ts +23 -0
  386. package/dist/model/render/compiler/NovaRenderBuilder.d.ts +24 -10
  387. package/dist/model/render/compiler/NovaRenderCommandWriter.d.ts +10 -5
  388. package/dist/model/render/compiler/NovaRenderCompiler.d.ts +7 -6
  389. package/dist/model/render/compiler/NovaRenderFrameBuilder.d.ts +4 -3
  390. package/dist/model/render/effects/blur.d.ts +8 -0
  391. package/dist/model/render/effects/color-matrix.d.ts +8 -0
  392. package/dist/model/render/effects/drop-shadow.d.ts +18 -0
  393. package/dist/model/render/effects/nova-effect-registry.d.ts +66 -0
  394. package/dist/model/render/effects/nova-gaussian-kernel.d.ts +7 -0
  395. package/dist/model/render/effects/nova-gaussian-textures.d.ts +11 -0
  396. package/dist/model/render/effects/shader-effect.d.ts +64 -0
  397. package/dist/model/render/geometry/nova-alpha-mask.d.ts +5 -0
  398. package/dist/model/render/geometry/nova-composition.d.ts +9 -0
  399. package/dist/model/render/geometry/nova-node-clip.d.ts +17 -0
  400. package/dist/model/render/geometry/nova-path-geometry.d.ts +24 -0
  401. package/dist/model/render/geometry/nova-path-tessellation.d.ts +7 -0
  402. package/dist/model/render/geometry/nova-polygon-triangulation.d.ts +1 -1
  403. package/dist/model/render/graph/NovaRectBatchBuffer.d.ts +58 -0
  404. package/dist/model/render/graph/NovaRenderGraph.d.ts +40 -6
  405. package/dist/model/render/graph/NovaRenderHitIndex.d.ts +1 -1
  406. package/dist/model/render/graph/nova-auto-rect.d.ts +1 -1
  407. package/dist/model/render/graph/nova-linear-rect-repack.d.ts +4 -4
  408. package/dist/model/render/graph/nova-linear-rect-transition.d.ts +2 -2
  409. package/dist/model/render/graph/nova-render-culling.d.ts +2 -2
  410. package/dist/model/render/graph/nova-render-dirty-items.d.ts +1 -1
  411. package/dist/model/render/graph/nova-render-group.d.ts +1 -1
  412. package/dist/model/render/graph/nova-render-item.d.ts +2 -2
  413. package/dist/model/render/graph/nova-render-layer.d.ts +1 -1
  414. package/dist/model/render/graph/nova-render-payload-snapshot.d.ts +3 -1
  415. package/dist/model/render/graph/nova-render-program.d.ts +5 -3
  416. package/dist/model/render/graph/nova-render-sequence.d.ts +1 -1
  417. package/dist/model/render/graph/nova-render-stream.d.ts +2 -2
  418. package/dist/model/render/ktx2/BasisSession.d.ts +45 -0
  419. package/dist/model/render/ktx2/KTX2Container.d.ts +26 -0
  420. package/dist/model/render/ktx2/KTX2Loader.d.ts +55 -0
  421. package/dist/model/render/meshes/MeshNode.d.ts +13 -0
  422. package/dist/model/render/meshes/NovaMeshWebGLDevice.d.ts +27 -0
  423. package/dist/model/render/meshes/geometry.d.ts +7 -0
  424. package/dist/model/render/meshes/mesh.d.ts +3 -0
  425. package/dist/model/render/meshes/mesh.types.d.ts +116 -0
  426. package/dist/model/render/meshes/nova-mesh-registry.d.ts +55 -0
  427. package/dist/model/render/orchestration/NovaRenderOrchestrator.d.ts +25 -3
  428. package/dist/model/render/policy/nova-render-policy.d.ts +1 -1
  429. package/dist/model/render/resources/NovaGlyphAtlasManager.d.ts +2 -2
  430. package/dist/model/render/resources/NovaTextAtlasManager.d.ts +3 -3
  431. package/dist/model/render/resources/NovaTextLayoutEngine.d.ts +1 -1
  432. package/dist/model/render/resources/nova-bitmap-upload.d.ts +10 -0
  433. package/dist/model/render/schema/NovaRenderContext.d.ts +6 -4
  434. package/dist/model/render/schema/nova-style-compiler.d.ts +5 -2
  435. package/dist/model/render/targets/NovaNodeRenderTextureSource.d.ts +29 -0
  436. package/dist/model/render/targets/NovaRenderTargetManager.d.ts +1 -1
  437. package/dist/model/render/targets/NovaRenderTexture.d.ts +57 -0
  438. package/dist/model/render/targets/nova-render-target-refs.d.ts +5 -0
  439. package/dist/model/render/targets/nova-render-target-resource.d.ts +1 -1
  440. package/dist/model/render/targets/nova-render-texture-runtime.d.ts +71 -0
  441. package/dist/model/render/textures/nova-compressed-image.d.ts +20 -0
  442. package/dist/model/render/utils/nova-icon-rendering.d.ts +3 -1
  443. package/dist/model/render/utils/nova-image-geometry.d.ts +11 -0
  444. package/dist/model/render/utils/nova-markdown-layout.d.ts +19 -0
  445. package/dist/model/render/utils/nova-text-paint.d.ts +26 -0
  446. package/dist/model/render/utils/nova-wrapped-text-layout.d.ts +19 -0
  447. package/dist/model/runtime/app/Nova.d.ts +35 -35
  448. package/dist/model/runtime/app/NovaApp.d.ts +58 -30
  449. package/dist/model/runtime/app/NovaRaphRuntime.d.ts +2 -2
  450. package/dist/model/runtime/app/createNovaRaphRuntime.d.ts +3 -3
  451. package/dist/model/runtime/assets/NovaAssetRegistry.d.ts +89 -2
  452. package/dist/model/runtime/assets/NovaVideoTexture.d.ts +38 -0
  453. package/dist/model/runtime/assets/nova-render-texture-image-identity.d.ts +4 -0
  454. package/dist/model/runtime/commands/NovaCommandBus.d.ts +1 -1
  455. package/dist/model/runtime/components/NovaComponentNode.d.ts +6 -6
  456. package/dist/model/runtime/components/NovaComponentRegistry.d.ts +1 -1
  457. package/dist/model/runtime/components/NovaSchemaRegistry.d.ts +7 -6
  458. package/dist/model/runtime/components/nova-component-metadata.d.ts +1 -1
  459. package/dist/model/runtime/components/nova-component.decorator.d.ts +2 -2
  460. package/dist/model/runtime/components/nova-defined-component.d.ts +3 -3
  461. package/dist/model/runtime/context/nova-context.d.ts +1 -1
  462. package/dist/model/runtime/cursor/NovaCursorManager.d.ts +3 -3
  463. package/dist/model/runtime/diagnostics/NovaDiagnostics_Module.d.ts +3 -3
  464. package/dist/model/runtime/interaction/NovaEvents.d.ts +16 -6
  465. package/dist/model/runtime/interaction/NovaHitIndex.d.ts +1 -1
  466. package/dist/model/runtime/interaction/NovaSpatialIndex.d.ts +2 -2
  467. package/dist/model/runtime/scene/NovaScene.d.ts +3 -3
  468. package/dist/model/runtime/scene/nova-scene-components.d.ts +6 -6
  469. package/dist/model/runtime/state/nova-store-decorators.d.ts +1 -1
  470. package/dist/model/runtime/state/nova-store-runtime.d.ts +1 -1
  471. package/dist/model/runtime/state/nova-store-tracking.d.ts +7 -3
  472. package/dist/model/runtime/sync/NovaSyncScope.d.ts +11 -2
  473. package/dist/model/runtime/sync/nova-sync-context.d.ts +2 -2
  474. package/dist/model/runtime/sync/nova-sync-ports.d.ts +2 -2
  475. package/dist/model/runtime/sync/nova-sync.types.d.ts +15 -3
  476. package/dist/model/runtime/template/NovaTemplateRuntime.d.ts +6 -6
  477. package/dist/model/runtime/tree/NovaContainer.d.ts +4 -4
  478. package/dist/model/runtime/tree/NovaNode.d.ts +58 -18
  479. package/dist/model/runtime/tree/NovaRaphNode.d.ts +8 -2
  480. package/dist/model/runtime/tree/NovaSurface.d.ts +32 -10
  481. package/dist/model/runtime/tree/nova-node-capture-invalidation.d.ts +11 -0
  482. package/dist/model/semantic/NovaSemanticService.d.ts +1 -1
  483. package/dist/model/semantic/browser/createAccessibilityBridge.d.ts +29 -0
  484. package/dist/model/sound/NovaSoundEngine.d.ts +3 -2
  485. package/dist/model/text-selection/NovaTextSelectionService.d.ts +2 -2
  486. package/dist/model/text-selection/index.d.ts +2 -2
  487. package/dist/model/text-selection/nova-text-selection.types.d.ts +1 -1
  488. package/dist/model/theme/NovaGlobalThemeRegistry.d.ts +2 -2
  489. package/dist/model/theme/NovaThemeService.d.ts +5 -3
  490. package/dist/model/theme/createTokenTheme.d.ts +15 -0
  491. package/dist/model/tools/transform-tools.d.ts +43 -0
  492. package/dist/nodes--Ds4IS2h.js +621 -0
  493. package/dist/nova-color-parser-BCN_rFRN.js +250 -0
  494. package/dist/nova-compressed-image-CE2Ya9Xa.js +46 -0
  495. package/dist/nova-mesh-registry-B7Xz5mhU.js +24 -0
  496. package/dist/nova-render-texture-image-identity-DQ09XFKs.js +15 -0
  497. package/dist/nova-text-paint-CcntsRjI.js +48 -0
  498. package/dist/tokens.d.ts +2 -0
  499. package/dist/tokens.js +50 -0
  500. package/dist/vec4-BTNv1fUp.js +20 -0
  501. package/package.json +223 -4
@@ -0,0 +1,765 @@
1
+ class V {
2
+ constructor(t, i) {
3
+ this._limit = t, this._stay = i;
4
+ let e = 2;
5
+ for (; e < t * 2; )
6
+ e *= 2;
7
+ this._mask = e - 1, this._state = new Uint8Array(e), this._seen = new Uint8Array(e), this._phase = new Uint8Array(e), this._a = new Uint32Array(e), this._b = new Uint32Array(e), this._data = new Float64Array(e * 7), this._sensor = new Uint8Array(e), this._order = new Uint32Array(t), this._active = new Uint32Array(t);
8
+ }
9
+ _state;
10
+ _seen;
11
+ _phase;
12
+ _a;
13
+ _b;
14
+ _data;
15
+ _sensor;
16
+ _order;
17
+ _active;
18
+ _activeCount = 0;
19
+ _point = new Float64Array(3);
20
+ _normal = new Float64Array(3);
21
+ _event = { phase: "begin", bodyA: 0, bodyB: 0, point: this._point, normal: this._normal, impulse: 0, sensor: !1 };
22
+ _count = 0;
23
+ _events = 0;
24
+ _overflow = !1;
25
+ _mask;
26
+ beginStep() {
27
+ this._events = 0, this._overflow = !1;
28
+ let t = 0;
29
+ for (let i = 0; i < this._activeCount; i++) {
30
+ const e = this._active[i];
31
+ this._state[e] === 2 ? (this._state[e] = 3, this._count--) : this._state[e] === 1 && (this._seen[e] = 0, this._phase[e] = 0, this._active[t++] = e);
32
+ }
33
+ this._activeCount = t;
34
+ }
35
+ touch(t, i, e, s, r, n, a, h, _, c) {
36
+ let l = (Math.imul(t, 73856093) ^ Math.imul(i, 19349663)) & this._mask, d = -1;
37
+ for (let m = 0; m <= this._mask; m++) {
38
+ const b = this._state[l];
39
+ if (b === 0) {
40
+ l = d < 0 ? l : d;
41
+ break;
42
+ }
43
+ if (b === 3)
44
+ d < 0 && (d = l);
45
+ else if (this._a[l] === t && this._b[l] === i)
46
+ break;
47
+ l = l + 1 & this._mask, m === this._mask && (l = d);
48
+ }
49
+ if (l < 0 || this._state[l] !== 1 && this._count >= this._limit) {
50
+ this._overflow = !0;
51
+ return;
52
+ }
53
+ const y = this._state[l] !== 1;
54
+ y && (this._count++, this._a[l] = t, this._b[l] = i, this._state[l] = 1, this._active[this._activeCount++] = l), this._seen[l] = 1, this._phase[l] = y ? 1 : this._stay ? 2 : 0;
55
+ const p = l * 7;
56
+ this._data[p] = e, this._data[p + 1] = s, this._data[p + 2] = r, this._data[p + 3] = n, this._data[p + 4] = a, this._data[p + 5] = h, this._data[p + 6] = _, this._sensor[l] = c ? 1 : 0;
57
+ }
58
+ finishStep() {
59
+ if (this._overflow)
60
+ throw new RangeError("[Nova Rapier] Переполнен maxContactPairs; увеличьте вместимость при создании бэкенда.");
61
+ for (let t = 0; t < this._activeCount; t++) {
62
+ const i = this._active[t];
63
+ this._state[i] === 1 && (this._seen[i] || (this._state[i] = 2, this._phase[i] = 3, this._data[i * 7 + 6] = 0), this._phase[i] && (this._order[this._events++] = i));
64
+ }
65
+ for (let t = Math.floor(this._events / 2) - 1; t >= 0; t--)
66
+ this._sink(t, this._events);
67
+ for (let t = this._events - 1; t > 0; t--)
68
+ this._swap(0, t), this._sink(0, t);
69
+ }
70
+ drain(t) {
71
+ const i = this._events;
72
+ this._events = 0;
73
+ for (let e = 0; e < i; e++) {
74
+ const s = this._order[e];
75
+ if (this._state[s] !== 1 && this._state[s] !== 2)
76
+ continue;
77
+ const r = s * 7, n = this._event;
78
+ n.phase = this._phase[s] === 1 ? "begin" : this._phase[s] === 2 ? "stay" : "end", n.bodyA = this._a[s], n.bodyB = this._b[s], n.impulse = this._data[r + 6], n.sensor = !!this._sensor[s];
79
+ for (let a = 0; a < 3; a++)
80
+ this._point[a] = this._data[r + a], this._normal[a] = this._data[r + 3 + a];
81
+ t(n);
82
+ }
83
+ }
84
+ removeBody(t) {
85
+ for (let i = 0; i < this._activeCount; i++) {
86
+ const e = this._active[i];
87
+ (this._state[e] === 1 || this._state[e] === 2) && (this._a[e] === t || this._b[e] === t) && (this._state[e] = 3, this._count--);
88
+ }
89
+ }
90
+ get size() {
91
+ return this._count;
92
+ }
93
+ _greater(t, i) {
94
+ const e = this._order[t], s = this._order[i];
95
+ return this._a[e] > this._a[s] || this._a[e] === this._a[s] && this._b[e] > this._b[s];
96
+ }
97
+ _swap(t, i) {
98
+ const e = this._order[t];
99
+ this._order[t] = this._order[i], this._order[i] = e;
100
+ }
101
+ _sink(t, i) {
102
+ for (; t * 2 + 1 < i; ) {
103
+ let e = t * 2 + 1;
104
+ if (e + 1 < i && this._greater(e + 1, e) && e++, !this._greater(e, t))
105
+ return;
106
+ this._swap(t, e), t = e;
107
+ }
108
+ }
109
+ }
110
+ function f(o, t) {
111
+ if (!Number.isFinite(o) || Math.abs(o) > 34028234663852886e22)
112
+ throw new RangeError(`[Nova Rapier] ${t}: требуется конечное число.`);
113
+ return o;
114
+ }
115
+ function u(o, t) {
116
+ if (Math.fround(f(o, t)) <= 0)
117
+ throw new RangeError(`[Nova Rapier] ${t}: требуется положительное число.`);
118
+ return o;
119
+ }
120
+ function g(o, t) {
121
+ if (f(o, t) < 0)
122
+ throw new RangeError(`[Nova Rapier] ${t}: требуется неотрицательное число.`);
123
+ return o;
124
+ }
125
+ function w(o, t) {
126
+ if (!o || o.length !== 3)
127
+ throw new RangeError(`[Nova Rapier] ${t}: требуется вектор из трёх чисел.`);
128
+ f(o[0], t), f(o[1], t), f(o[2], t);
129
+ }
130
+ function R(o) {
131
+ if (!o || o.length !== 4)
132
+ throw new RangeError("[Nova Rapier] Требуется кватернион [x, y, z, w].");
133
+ for (let t = 0; t < 4; t++)
134
+ f(o[t], "quaternion");
135
+ if (Math.abs(Math.hypot(o[0], o[1], o[2], o[3]) - 1) > 1e-4)
136
+ throw new RangeError("[Nova Rapier] Требуется единичный кватернион.");
137
+ }
138
+ function x(o, t) {
139
+ if (!Number.isInteger(o) || o < -2147483648 || o > 4294967295)
140
+ throw new RangeError(`[Nova Rapier] ${t}: требуется 32-битная маска.`);
141
+ return o >>> 0;
142
+ }
143
+ function v(o, t, i = 0) {
144
+ if (!Number.isInteger(i) || i < 0 || o.length < i + t)
145
+ throw new RangeError("[Nova Rapier] Недостаточная длина выходного массива.");
146
+ }
147
+ function P(o, t, i) {
148
+ if (!t || typeof t != "object")
149
+ throw new TypeError("[Nova Rapier] Требуется описатель формы.");
150
+ switch (t.type) {
151
+ case "sphere":
152
+ return o.ColliderDesc.ball(u(t.radius, "radius"));
153
+ case "box":
154
+ return w(t.halfExtents, "halfExtents"), o.ColliderDesc.cuboid(u(t.halfExtents[0], "halfExtents"), u(t.halfExtents[1], "halfExtents"), u(t.halfExtents[2], "halfExtents"));
155
+ case "capsule":
156
+ return o.ColliderDesc.capsule(g(t.halfHeight, "halfHeight"), u(t.radius, "radius"));
157
+ case "cylinder":
158
+ return o.ColliderDesc.cylinder(u(t.halfHeight, "halfHeight"), u(t.radius, "radius"));
159
+ case "plane": {
160
+ if (i)
161
+ throw new RangeError("[Nova Rapier] Plane допускается только на static body.");
162
+ const e = t.normal ?? [0, 1, 0];
163
+ w(e, "plane.normal");
164
+ const s = u(Math.hypot(e[0], e[1], e[2]), "plane.normal"), r = { x: e[0] / s, y: e[1] / s, z: e[2] / s }, n = f(t.offset ?? 0, "plane.offset") / s;
165
+ return new o.ColliderDesc(new o.HalfSpace(r)).setTranslation(r.x * n, r.y * n, r.z * n);
166
+ }
167
+ case "convex-hull": {
168
+ const e = A(t.points, 4, "convex-hull"), s = o.ColliderDesc.convexHull(e);
169
+ if (!s)
170
+ throw new RangeError("[Nova Rapier] Convex hull должен охватывать объём.");
171
+ return s;
172
+ }
173
+ case "triangle-mesh": {
174
+ if (i)
175
+ throw new RangeError("[Nova Rapier] Triangle mesh допускается только на static body.");
176
+ const e = A(t.positions, 3, "triangle-mesh"), s = e.length / 3, r = t.indices;
177
+ if ((r?.length ?? s) % 3 !== 0 || r && r.length === 0)
178
+ throw new RangeError("[Nova Rapier] Triangle mesh требует целые треугольники.");
179
+ const n = new Uint32Array(r?.length ?? s);
180
+ for (let a = 0; a < n.length; a++) {
181
+ const h = r ? r[a] : a;
182
+ if (!Number.isInteger(h) || h < 0 || h >= s)
183
+ throw new RangeError("[Nova Rapier] Некорректный индекс triangle mesh.");
184
+ n[a] = h;
185
+ }
186
+ return o.ColliderDesc.trimesh(e, n);
187
+ }
188
+ case "compound": {
189
+ if (!Array.isArray(t.children) || t.children.length === 0)
190
+ throw new RangeError("[Nova Rapier] Compound требует хотя бы одну дочернюю форму.");
191
+ const e = [], s = [], r = [];
192
+ for (const n of t.children) {
193
+ if (n.shape.type === "plane" || n.shape.type === "compound")
194
+ throw new RangeError("[Nova Rapier] Compound не поддерживает вложенные compound и plane.");
195
+ const a = P(o, n.shape, i), h = n.position ?? [0, 0, 0], _ = n.quaternion ?? [0, 0, 0, 1];
196
+ w(h, "compound.position"), R(_), e.push(a.shape), s.push({ x: h[0], y: h[1], z: h[2] }), r.push({ x: _[0], y: _[1], z: _[2], w: _[3] });
197
+ }
198
+ return o.ColliderDesc.compound(e, s, r);
199
+ }
200
+ default:
201
+ throw new RangeError("[Nova Rapier] Неподдерживаемая форма.");
202
+ }
203
+ }
204
+ function A(o, t, i) {
205
+ if (!o || o.length < t * 3 || o.length % 3 !== 0)
206
+ throw new RangeError(`[Nova Rapier] ${i}: требуется массив xyz.`);
207
+ const e = new Float32Array(o.length);
208
+ for (let s = 0; s < o.length; s++)
209
+ e[s] = f(o[s], i), f(e[s], i);
210
+ return e;
211
+ }
212
+ let M = 1;
213
+ function k() {
214
+ if (M >= 2 ** 30)
215
+ throw new RangeError("[Nova Rapier] Исчерпано пространство handles.");
216
+ return M++;
217
+ }
218
+ class B {
219
+ constructor(t, i, e, s, r) {
220
+ if (this._api = t, this.backend = i, this._ccd = r, w(e.gravity, "gravity"), e.contactStay !== void 0 && typeof e.contactStay != "boolean")
221
+ throw new TypeError("[Nova Rapier] contactStay: требуется boolean.");
222
+ this._world = new t.World({ x: e.gravity[0], y: e.gravity[1], z: e.gravity[2] }), this._contacts = new V(s, e.contactStay ?? !1), this._events = new t.EventQueue(!0), this._rawGravity = t.VectorOps.intoRaw(this._world.gravity), this._rawVector = t.VectorOps.intoRaw(this._position), this._rawPoint = t.VectorOps.intoRaw(this._position), this._ray = new t.Ray({ x: 0, y: 0, z: 0 }, { x: 0, y: 0, z: 0 }), this._rayHit = new t.RayIntersection(0, { x: 0, y: 0, z: 0 }), this._hooks = {
223
+ filterContactPair: (n, a) => this._allows(n, a) ? t.SolverFlags.COMPUTE_IMPULSE : null,
224
+ filterIntersectionPair: (n, a) => this._allows(n, a)
225
+ };
226
+ }
227
+ _world;
228
+ _anchor = null;
229
+ _bodies = /* @__PURE__ */ new Map();
230
+ _colliders = /* @__PURE__ */ new Map();
231
+ _slots = [];
232
+ _freeSlots = [];
233
+ _joints = /* @__PURE__ */ new Map();
234
+ _contacts;
235
+ _events;
236
+ _position = { x: 0, y: 0, z: 0 };
237
+ _quaternion = { x: 0, y: 0, z: 0, w: 1 };
238
+ _normal = { x: 0, y: 0, z: 0 };
239
+ _point = { x: 0, y: 0, z: 0 };
240
+ _local = { x: 0, y: 0, z: 0 };
241
+ _ray;
242
+ _rayHit;
243
+ _rawGravity;
244
+ _rawVector;
245
+ _rawPoint;
246
+ _hooks;
247
+ _destroyed = !1;
248
+ _draining = !1;
249
+ _stepping = !1;
250
+ _source;
251
+ _other;
252
+ _depth = 1 / 0;
253
+ _impulse = 0;
254
+ _found = !1;
255
+ _steps = 0;
256
+ _visitSolid = (t) => this._visitPair(t, !1);
257
+ _visitSensor = (t) => this._visitPair(t, !0);
258
+ _visitManifold = (t, i) => this._readManifold(t, i);
259
+ // ---------------------------------------------
260
+ // PUBLIC API
261
+ // ---------------------------------------------
262
+ /**
263
+ * Освобождает принадлежащие миру WASM-ресурсы; повторный вызов безопасен.
264
+ */
265
+ destroy() {
266
+ this._destroyed || (this._mutable(), this._destroyed = !0, this._events.free(), this._rawGravity.free(), this._rawVector.free(), this._rawPoint.free(), this._world.free(), this._bodies.clear(), this._colliders.clear(), this._joints.clear(), this._slots.length = 0, this._freeSlots.length = 0, this._source = void 0, this._other = void 0, this._contacts = null);
267
+ }
268
+ /**
269
+ * Задаёт гравитацию без изменения scheduler приложения.
270
+ */
271
+ setGravity(t) {
272
+ this._mutable(), w(t, "gravity");
273
+ const i = this._world.gravity;
274
+ i.x = this._rawGravity.x = t[0], i.y = this._rawGravity.y = t[1], i.z = this._rawGravity.z = t[2];
275
+ for (let e = 0; e < this._slots.length; e++)
276
+ this._slots[e]?.body.wakeUp();
277
+ }
278
+ /**
279
+ * Копирует гравитацию в массив вызывающего.
280
+ */
281
+ getGravity(t) {
282
+ this._alive(), v(t, 3);
283
+ const i = this._world.gravity;
284
+ return t[0] = i.x, t[1] = i.y, t[2] = i.z, t;
285
+ }
286
+ /**
287
+ * Выполняет ровно один шаг, обновляет контакты и очищает одношаговые силы.
288
+ */
289
+ step(t) {
290
+ this._mutable(), u(t, "dt");
291
+ const i = this._world;
292
+ this._stepping = !0;
293
+ try {
294
+ i.timestep = t, i.physicsPipeline.raw.stepWithEvents(this._rawGravity, i.integrationParameters.raw, i.islands.raw, i.broadPhase.raw, i.narrowPhase.raw, i.bodies.raw, i.colliders.raw, i.softBodies.raw, i.impulseJoints.raw, i.multibodyJoints.raw, i.ccdSolver.raw, this._events.raw, this._hooks, this._hooks.filterContactPair, this._hooks.filterIntersectionPair), this._steps++;
295
+ for (let e = 0; e < this._slots.length; e++) {
296
+ const s = this._slots[e];
297
+ s && (s.force && (s.body.resetForces(!1), s.force = !1), s.torque && (s.body.resetTorques(!1), s.torque = !1));
298
+ }
299
+ this._contacts.beginStep();
300
+ for (let e = 0; e < this._slots.length; e++) {
301
+ const s = this._slots[e];
302
+ s && (this._source = s, i.narrowPhase.contactPairsWith(s.collider.handle, this._visitSolid), i.narrowPhase.intersectionPairsWith(s.collider.handle, this._visitSensor));
303
+ }
304
+ this._contacts.finishStep();
305
+ } finally {
306
+ this._stepping = !1;
307
+ }
308
+ }
309
+ /**
310
+ * Создаёт тело и коллайдер; наружу возвращает независимый от Rapier handle.
311
+ */
312
+ createBody(t) {
313
+ this._mutable();
314
+ const i = this._motion(t.type), e = P(this._api, t.shape, t.type !== "static"), s = t.position ?? [0, 0, 0], r = t.quaternion ?? [0, 0, 0, 1], n = t.linearVelocity ?? [0, 0, 0], a = t.angularVelocity ?? [0, 0, 0];
315
+ w(s, "position"), R(r), w(n, "linearVelocity"), w(a, "angularVelocity");
316
+ const h = u(t.mass ?? 1, "mass"), _ = g(t.friction ?? 0.5, "friction"), c = this._restitution(t.restitution ?? 0), l = x(t.collisionGroup ?? 1, "collisionGroup"), d = x(t.collisionMask ?? 4294967295, "collisionMask");
317
+ if (t.sensor !== void 0 && typeof t.sensor != "boolean" || t.canSleep !== void 0 && typeof t.canSleep != "boolean")
318
+ throw new TypeError("[Nova Rapier] sensor и canSleep требуют boolean.");
319
+ const y = new this._api.RigidBodyDesc(i).setTranslation(s[0], s[1], s[2]).setRotation({ x: r[0], y: r[1], z: r[2], w: r[3] }).setLinvel(n[0], n[1], n[2]).setAngvel({ x: a[0], y: a[1], z: a[2] }).setLinearDamping(g(t.linearDamping ?? 0, "linearDamping")).setAngularDamping(g(t.angularDamping ?? 0, "angularDamping")).setGravityScale(f(t.gravityScale ?? 1, "gravityScale")).setCanSleep(t.canSleep ?? !0).setCcdEnabled(this._ccd);
320
+ e.setMass(h).setSensor(t.sensor ?? !1).setFriction(Math.sqrt(_)).setFrictionCombineRule(this._api.CoefficientCombineRule.Multiply).setRestitution(c).setRestitutionCombineRule(this._api.CoefficientCombineRule.Max).setCollisionGroups(4294967295).setActiveCollisionTypes(this._api.ActiveCollisionTypes.ALL).setActiveHooks(this._api.ActiveHooks.FILTER_CONTACT_PAIRS | this._api.ActiveHooks.FILTER_INTERSECTION_PAIRS);
321
+ const p = k(), m = this._world.createRigidBody(y);
322
+ try {
323
+ const b = this._world.createCollider(e, m), C = this._freeSlots.pop() ?? this._slots.length, E = { handle: p, body: m, collider: b, type: t.type, group: l, mask: d, staticOnly: t.shape.type === "plane" || t.shape.type === "triangle-mesh" || t.shape.type === "compound" && t.shape.children.some((T) => T.shape.type === "triangle-mesh"), force: !1, torque: !1, index: C };
324
+ return this._bodies.set(p, E), this._colliders.set(b.handle, E), this._slots[C] = E, p;
325
+ } catch (b) {
326
+ throw this._world.removeRigidBody(m), b;
327
+ }
328
+ }
329
+ /**
330
+ * Удаляет тело, его соединения и ожидающие контакты без события end.
331
+ */
332
+ destroyBody(t) {
333
+ this._mutable();
334
+ const i = this._body(t);
335
+ for (const [e, s] of this._joints)
336
+ (s.a === t || s.b === t) && (this._world.removeImpulseJoint(s.joint, !0), this._joints.delete(e));
337
+ this._world.removeRigidBody(i.body), this._contacts.removeBody(t), this._bodies.delete(t), this._colliders.delete(i.collider.handle), this._slots[i.index] = null, this._freeSlots.push(i.index), this._source === i && (this._source = void 0), this._other === i && (this._other = void 0);
338
+ }
339
+ /**
340
+ * Проверяет принадлежность handle живому миру.
341
+ */
342
+ hasBody(t) {
343
+ return this._alive(), this._bodies.has(t);
344
+ }
345
+ /**
346
+ * Возвращает тип движения тела.
347
+ */
348
+ getBodyType(t) {
349
+ return this._body(t).type;
350
+ }
351
+ /**
352
+ * Меняет тип движения, сохраняя массу формы и запрещая движущийся trimesh/plane.
353
+ */
354
+ setBodyType(t, i) {
355
+ this._mutable();
356
+ const e = this._body(t), s = this._motion(i);
357
+ if (i !== "static" && e.staticOnly)
358
+ throw new RangeError("[Nova Rapier] Эта форма допускает только static body.");
359
+ e.body.setBodyType(s, !0), e.type = i;
360
+ }
361
+ /**
362
+ * Меняет массу и вычисляемую по форме инерцию.
363
+ */
364
+ setMass(t, i) {
365
+ this._mutable();
366
+ const e = this._body(t);
367
+ e.collider.setMass(u(i, "mass")), e.body.recomputeMassPropertiesFromColliders(), e.body.wakeUp();
368
+ }
369
+ /**
370
+ * Задаёт линейное и угловое затухание.
371
+ */
372
+ setDamping(t, i, e) {
373
+ this._mutable();
374
+ const s = this._body(t).body;
375
+ g(i, "linearDamping"), g(e, "angularDamping"), s.setLinearDamping(i), s.setAngularDamping(e), s.wakeUp();
376
+ }
377
+ /**
378
+ * Сохраняет сочетание friction=sqrt(a*b), restitution=max(a,b) контракта basic.
379
+ */
380
+ setMaterial(t, i, e) {
381
+ this._mutable();
382
+ const s = this._body(t);
383
+ g(i, "friction"), this._restitution(e), s.collider.setFriction(Math.sqrt(i)), s.collider.setRestitution(e), s.body.wakeUp();
384
+ }
385
+ /**
386
+ * Меняет действие гравитации на отдельное тело.
387
+ */
388
+ setGravityScale(t, i) {
389
+ this._mutable(), this._body(t).body.setGravityScale(f(i, "gravityScale"), !0);
390
+ }
391
+ /**
392
+ * Задаёт полный 32-битный фильтр и инвалидирует кеш пар Rapier.
393
+ */
394
+ setCollisionFilter(t, i, e) {
395
+ this._mutable();
396
+ const s = this._body(t), r = x(i, "group"), n = x(e, "mask");
397
+ s.group = r, s.mask = n, s.collider.setCollisionGroups(0), s.collider.setCollisionGroups(4294967295), s.body.wakeUp();
398
+ }
399
+ /**
400
+ * Читает мировую позу в массив вызывающего.
401
+ */
402
+ getTransform(t, i, e = 0) {
403
+ const s = this._body(t).body;
404
+ v(i, 7, e);
405
+ const r = s.translation(this._position), n = s.rotation(this._quaternion);
406
+ return i[e] = r.x, i[e + 1] = r.y, i[e + 2] = r.z, i[e + 3] = n.x, i[e + 4] = n.y, i[e + 5] = n.z, i[e + 6] = n.w, i;
407
+ }
408
+ /**
409
+ * Телепортирует тело, сохраняя его скорости.
410
+ */
411
+ setTransform(t, i, e) {
412
+ this._mutable();
413
+ const s = this._body(t).body;
414
+ w(i, "position"), R(e), s.setTranslation(this._copyVector(i), !0), this._world.bodies.raw.rbSetRotation(s.handle, e[0], e[1], e[2], e[3], !0), s.isKinematic() && (this._world.bodies.raw.rbSetNextKinematicTranslation(s.handle, i[0], i[1], i[2]), this._world.bodies.raw.rbSetNextKinematicRotation(s.handle, e[0], e[1], e[2], e[3]));
415
+ }
416
+ /**
417
+ * Задаёт цель position-based kinematic на следующий фиксированный шаг.
418
+ */
419
+ setKinematicTarget(t, i, e) {
420
+ this._mutable();
421
+ const s = this._body(t);
422
+ if (s.type !== "kinematic")
423
+ throw new RangeError("[Nova Rapier] Kinematic target требует kinematic body.");
424
+ w(i, "position"), R(e);
425
+ const r = this._world.bodies.raw;
426
+ r.rbSetNextKinematicTranslation(s.body.handle, i[0], i[1], i[2]), r.rbSetNextKinematicRotation(s.body.handle, e[0], e[1], e[2], e[3]);
427
+ }
428
+ /**
429
+ * Читает линейную скорость без нового вектора.
430
+ */
431
+ getLinearVelocity(t, i) {
432
+ const e = this._body(t).body.linvel(this._position);
433
+ return this._writeVector(e, i);
434
+ }
435
+ /**
436
+ * Задаёт линейную скорость и будит тело.
437
+ */
438
+ setLinearVelocity(t, i) {
439
+ this._mutable();
440
+ const e = this._body(t).body;
441
+ this._raw(i), this._world.bodies.raw.rbSetLinvel(e.handle, this._rawVector, !0);
442
+ }
443
+ /**
444
+ * Читает угловую скорость без нового вектора.
445
+ */
446
+ getAngularVelocity(t, i) {
447
+ const e = this._body(t).body.angvel(this._position);
448
+ return this._writeVector(e, i);
449
+ }
450
+ /**
451
+ * Задаёт угловую скорость и будит тело.
452
+ */
453
+ setAngularVelocity(t, i) {
454
+ this._mutable();
455
+ const e = this._body(t).body;
456
+ this._raw(i), this._world.bodies.raw.rbSetAngvel(e.handle, this._rawVector, !0);
457
+ }
458
+ /**
459
+ * Добавляет силу на один следующий шаг в мировой точке либо начале тела.
460
+ */
461
+ applyForce(t, i, e) {
462
+ this._mutable();
463
+ const s = this._body(t);
464
+ this._raw(i), this._forcePoint(s, e), this._world.bodies.raw.rbAddForceAtPoint(s.body.handle, this._rawVector, this._rawPoint, !0), s.force = s.torque = !0;
465
+ }
466
+ /**
467
+ * Немедленно изменяет импульс тела в мировой точке либо его начале.
468
+ */
469
+ applyImpulse(t, i, e) {
470
+ this._mutable();
471
+ const s = this._body(t);
472
+ this._raw(i), this._forcePoint(s, e), this._world.bodies.raw.rbApplyImpulseAtPoint(s.body.handle, this._rawVector, this._rawPoint, !0);
473
+ }
474
+ /**
475
+ * Добавляет момент сил на один следующий шаг.
476
+ */
477
+ applyTorque(t, i) {
478
+ this._mutable();
479
+ const e = this._body(t);
480
+ this._raw(i), this._world.bodies.raw.rbAddTorque(e.body.handle, this._rawVector, !0), e.torque = !0;
481
+ }
482
+ /**
483
+ * Немедленно изменяет угловой импульс.
484
+ */
485
+ applyTorqueImpulse(t, i) {
486
+ this._mutable();
487
+ const e = this._body(t).body;
488
+ this._raw(i), this._world.bodies.raw.rbApplyTorqueImpulse(e.handle, this._rawVector, !0);
489
+ }
490
+ /**
491
+ * Возвращает состояние сна.
492
+ */
493
+ getSleeping(t) {
494
+ return this._body(t).body.isSleeping();
495
+ }
496
+ /**
497
+ * Будит тело после внешнего действия.
498
+ */
499
+ wake(t) {
500
+ this._mutable(), this._body(t).body.wakeUp();
501
+ }
502
+ /**
503
+ * Создаёт joint с локальными frames и отдельным handle Nova.
504
+ */
505
+ createJoint(t) {
506
+ if (this._mutable(), t.type === "distance")
507
+ throw new RangeError("[Nova Rapier] Distance min/max не поддерживается: rope Rapier ограничивает только maxDistance.");
508
+ const i = this._body(t.bodyA), e = t.bodyB === null ? null : this._body(t.bodyB);
509
+ if (i === e)
510
+ throw new RangeError("[Nova Rapier] Joint требует разные тела.");
511
+ const s = e?.body ?? this._worldAnchor(), r = this._vectorValue(t.anchorA ?? [0, 0, 0]), n = this._vectorValue(t.anchorB ?? [0, 0, 0]);
512
+ let a;
513
+ if (t.type === "fixed")
514
+ a = this._api.JointData.fixed(r, { x: 0, y: 0, z: 0, w: 1 }, n, this._relativeRotation(i.body, s));
515
+ else if (t.type === "ball")
516
+ a = this._api.JointData.spherical(r, n);
517
+ else if (t.type === "hinge" || t.type === "slider") {
518
+ const l = this._axis(t.axisA), d = this._axis(t.axisB);
519
+ if (a = t.type === "hinge" ? this._api.JointData.revoluteWithAxes(r, n, l, d) : this._api.JointData.prismatic(r, n, l), t.limits && (f(t.limits[0], "limits"), f(t.limits[1], "limits"), t.limits[0] > t.limits[1]))
520
+ throw new RangeError("[Nova Rapier] Некорректные limits.");
521
+ t.motor && this._checkMotor(t.motor);
522
+ } else
523
+ throw new RangeError("[Nova Rapier] Неизвестный тип joint.");
524
+ const h = k(), _ = this._world.createImpulseJoint(a, i.body, s, !0), c = { joint: _, a: i.handle, b: e?.handle ?? null, type: t.type };
525
+ try {
526
+ if (_.setContactsEnabled(t.collideConnected ?? !1), t.type === "hinge" || t.type === "slider") {
527
+ const l = this._frames(i.body, s, t.axisA, t.axisB);
528
+ _.setLocalFrame1(r, l[0]), _.setLocalFrame2(n, l[1]);
529
+ const d = _;
530
+ if (t.limits) {
531
+ const y = t.type === "slider" ? this._sliderOffset(i.body, s, r, n, t.axisA) : 0;
532
+ d.setLimits(t.limits[0] + y, t.limits[1] + y);
533
+ }
534
+ t.motor && this._motor(c, t.motor);
535
+ }
536
+ return this._joints.set(h, c), h;
537
+ } catch (l) {
538
+ throw this._world.removeImpulseJoint(_, !0), l;
539
+ }
540
+ }
541
+ /**
542
+ * Удаляет соединение и инвалидирует handle.
543
+ */
544
+ destroyJoint(t) {
545
+ this._mutable();
546
+ const i = this._joint(t);
547
+ this._world.removeImpulseJoint(i.joint, !0), this._joints.delete(t);
548
+ }
549
+ /**
550
+ * Настраивает или отключает мотор hinge/slider.
551
+ */
552
+ setJointMotor(t, i) {
553
+ this._mutable(), this._motor(this._joint(t), i);
554
+ }
555
+ /**
556
+ * Ищет ближайшее попадание, включая ещё не прошедшие первый step коллайдеры.
557
+ */
558
+ raycast(t, i, e, s, r) {
559
+ this._alive(), w(t, "ray.origin"), w(i, "ray.direction"), e !== 1 / 0 && g(e, "maxDistance");
560
+ const n = x(s, "ray.mask"), a = u(Math.hypot(i[0], i[1], i[2]), "ray.direction");
561
+ v(r.point, 3), v(r.normal, 3);
562
+ const h = this._ray;
563
+ h.origin.x = t[0], h.origin.y = t[1], h.origin.z = t[2], h.dir.x = i[0] / a, h.dir.y = i[1] / a, h.dir.z = i[2] / a, this._world.propagateModifiedBodyPositionsToColliders();
564
+ let _ = e, c = !1;
565
+ for (let l = 0; l < this._slots.length; l++) {
566
+ const d = this._slots[l];
567
+ if (!d || d.collider.isSensor() || !(d.group & n))
568
+ continue;
569
+ const y = d.collider.castRayAndGetNormal(h, _, !0, this._rayHit);
570
+ if (y && (!c || y.timeOfImpact < _)) {
571
+ _ = y.timeOfImpact, c = !0, r.body = d.handle, r.distance = _, r.point[0] = t[0] + h.dir.x * _, r.point[1] = t[1] + h.dir.y * _, r.point[2] = t[2] + h.dir.z * _;
572
+ const p = Math.hypot(y.normal.x, y.normal.y, y.normal.z), m = y.normal.x * h.dir.x + y.normal.y * h.dir.y + y.normal.z * h.dir.z > 0 ? -1 : 1, b = Number.isFinite(p) && p > 0;
573
+ r.normal[0] = b ? m * y.normal.x / p : -h.dir.x, r.normal[1] = b ? m * y.normal.y / p : -h.dir.y, r.normal[2] = b ? m * y.normal.z / p : -h.dir.z;
574
+ }
575
+ }
576
+ return c;
577
+ }
578
+ /**
579
+ * Доставляет стабильную очередь переиспользуемым event; повторный drain пуст.
580
+ */
581
+ drainContacts(t) {
582
+ if (this._alive(), this._draining || this._stepping)
583
+ throw new Error("[Nova Rapier] Вложенный drainContacts запрещён.");
584
+ this._draining = !0;
585
+ try {
586
+ this._contacts.drain(t);
587
+ } finally {
588
+ this._draining = !1;
589
+ }
590
+ }
591
+ /**
592
+ * Создаёт диагностический снимок по запросу инструмента, вне hot path.
593
+ */
594
+ diagnostics() {
595
+ return this._alive(), Object.freeze({ bodies: this._bodies.size, bodySlots: this._slots.length, joints: this._joints.size, contacts: this._contacts.size, steps: this._steps });
596
+ }
597
+ // ---------------------------------------------
598
+ // PRIVATE
599
+ // ---------------------------------------------
600
+ _alive() {
601
+ if (this._destroyed)
602
+ throw new Error("[Nova Rapier] Мир уничтожен.");
603
+ }
604
+ _mutable() {
605
+ if (this._alive(), this._draining || this._stepping)
606
+ throw new Error("[Nova Rapier] Из callback контакта разрешены только чтения.");
607
+ }
608
+ _body(t) {
609
+ this._alive();
610
+ const i = this._bodies.get(t);
611
+ if (!i)
612
+ throw new RangeError("[Nova Rapier] Устаревший или чужой body handle.");
613
+ return i;
614
+ }
615
+ _joint(t) {
616
+ this._alive();
617
+ const i = this._joints.get(t);
618
+ if (!i)
619
+ throw new RangeError("[Nova Rapier] Устаревший или чужой joint handle.");
620
+ return i;
621
+ }
622
+ _worldAnchor() {
623
+ return this._anchor ??= this._world.createRigidBody(this._api.RigidBodyDesc.fixed()), this._anchor;
624
+ }
625
+ _motion(t) {
626
+ switch (t) {
627
+ case "static":
628
+ return this._api.RigidBodyType.Fixed;
629
+ case "dynamic":
630
+ return this._api.RigidBodyType.Dynamic;
631
+ case "kinematic":
632
+ return this._api.RigidBodyType.KinematicPositionBased;
633
+ default:
634
+ throw new RangeError("[Nova Rapier] Неизвестный тип тела.");
635
+ }
636
+ }
637
+ _copyVector(t) {
638
+ return this._position.x = t[0], this._position.y = t[1], this._position.z = t[2], this._position;
639
+ }
640
+ _raw(t) {
641
+ w(t, "vector"), this._rawVector.x = t[0], this._rawVector.y = t[1], this._rawVector.z = t[2];
642
+ }
643
+ _forcePoint(t, i) {
644
+ i ? (w(i, "point"), this._rawPoint.x = i[0], this._rawPoint.y = i[1], this._rawPoint.z = i[2]) : (t.body.translation(this._position), this._rawPoint.x = this._position.x, this._rawPoint.y = this._position.y, this._rawPoint.z = this._position.z);
645
+ }
646
+ _writeVector(t, i) {
647
+ return v(i, 3), i[0] = t.x, i[1] = t.y, i[2] = t.z, i;
648
+ }
649
+ _restitution(t) {
650
+ if (g(t, "restitution") > 1)
651
+ throw new RangeError("[Nova Rapier] Restitution должна быть в [0, 1].");
652
+ return t;
653
+ }
654
+ _allows(t, i) {
655
+ const e = this._colliders.get(t), s = this._colliders.get(i);
656
+ return !!e && !!s && !!(e.group & s.mask) && !!(s.group & e.mask);
657
+ }
658
+ _visitPair(t, i) {
659
+ const e = this._source, s = this._colliders.get(t);
660
+ if (!(!s || s.handle <= e.handle || !this._allows(e.collider.handle, t))) {
661
+ if (this._other = s, i) {
662
+ if (!this._world.narrowPhase.intersectionPair(e.collider.handle, t))
663
+ return;
664
+ const r = e.body.translation(this._position), n = s.body.translation(this._point), a = n.x - r.x, h = n.y - r.y, _ = n.z - r.z, c = Math.hypot(a, h, _);
665
+ this._contacts.touch(e.handle, s.handle, (r.x + n.x) / 2, (r.y + n.y) / 2, (r.z + n.z) / 2, c ? a / c : 0, c ? h / c : 1, c ? _ / c : 0, 0, !0);
666
+ return;
667
+ }
668
+ this._depth = 1 / 0, this._impulse = 0, this._found = !1, this._world.contactPair(e.collider, s.collider, this._visitManifold), this._found && this._contacts.touch(e.handle, s.handle, this._point.x, this._point.y, this._point.z, this._normal.x, this._normal.y, this._normal.z, this._impulse, !1);
669
+ }
670
+ }
671
+ _readManifold(t, i) {
672
+ for (let e = 0; e < t.numContacts(); e++) {
673
+ const s = t.contactDist(e);
674
+ if (s > 2e-3 || (this._found = !0, this._impulse += t.contactImpulse(e), s >= this._depth))
675
+ continue;
676
+ this._depth = s, t.normal(this._normal), i && (this._normal.x *= -1, this._normal.y *= -1, this._normal.z *= -1);
677
+ const r = t.localContactPoint1(e, this._local);
678
+ if (r) {
679
+ const n = i ? this._other.collider : this._source.collider, a = n.translation(this._position), h = n.rotation(this._quaternion);
680
+ z(r, h, this._point), this._point.x += a.x, this._point.y += a.y, this._point.z += a.z;
681
+ }
682
+ }
683
+ }
684
+ _checkMotor(t) {
685
+ f(t.targetVelocity, "motor.targetVelocity"), g(t.maxForce, "motor.maxForce");
686
+ }
687
+ _motor(t, i) {
688
+ if (t.type !== "hinge" && t.type !== "slider")
689
+ throw new RangeError("[Nova Rapier] Motor требует hinge или slider.");
690
+ i && this._checkMotor(i);
691
+ const e = t.joint;
692
+ e.configureMotorModel(this._api.MotorModel.ForceBased), e.configureMotorVelocity(i?.targetVelocity ?? 0, 1), e.setMotorMaxForce(i?.maxForce ?? 0), this._body(t.a).body.wakeUp(), t.b !== null && this._body(t.b).body.wakeUp();
693
+ }
694
+ _vectorValue(t) {
695
+ return w(t, "joint.vector"), { x: t[0], y: t[1], z: t[2] };
696
+ }
697
+ _axis(t) {
698
+ const i = this._vectorValue(t), e = u(Math.hypot(i.x, i.y, i.z), "joint.axis");
699
+ return i.x /= e, i.y /= e, i.z /= e, i;
700
+ }
701
+ _relativeRotation(t, i) {
702
+ const e = t.rotation({ x: 0, y: 0, z: 0, w: 1 }), s = i.rotation({ x: 0, y: 0, z: 0, w: 1 });
703
+ return N({ x: -s.x, y: -s.y, z: -s.z, w: s.w }, e);
704
+ }
705
+ _frames(t, i, e, s) {
706
+ const r = this._axis(e), n = this._axis(s), a = j(r), h = this._relativeRotation(t, i), _ = N(h, a), c = { x: 0, y: 0, z: 0 };
707
+ return z({ x: 1, y: 0, z: 0 }, _, c), [a, N(S(c, n), _)];
708
+ }
709
+ _sliderOffset(t, i, e, s, r) {
710
+ const n = t.translation({ x: 0, y: 0, z: 0 }), a = i.translation({ x: 0, y: 0, z: 0 }), h = t.rotation({ x: 0, y: 0, z: 0, w: 1 }), _ = i.rotation({ x: 0, y: 0, z: 0, w: 1 }), c = { x: 0, y: 0, z: 0 }, l = { x: 0, y: 0, z: 0 }, d = this._axis(r);
711
+ return z(e, h, c), z(s, _, l), z(d, h, this._normal), (a.x + l.x - n.x - c.x) * this._normal.x + (a.y + l.y - n.y - c.y) * this._normal.y + (a.z + l.z - n.z - c.z) * this._normal.z;
712
+ }
713
+ // ---------------------------------------------
714
+ // ACCESS
715
+ // ---------------------------------------------
716
+ get destroyed() {
717
+ return this._destroyed;
718
+ }
719
+ }
720
+ function z(o, t, i) {
721
+ const e = 2 * (t.y * o.z - t.z * o.y), s = 2 * (t.z * o.x - t.x * o.z), r = 2 * (t.x * o.y - t.y * o.x);
722
+ i.x = o.x + t.w * e + t.y * r - t.z * s, i.y = o.y + t.w * s + t.z * e - t.x * r, i.z = o.z + t.w * r + t.x * s - t.y * e;
723
+ }
724
+ function N(o, t) {
725
+ return { x: o.w * t.x + o.x * t.w + o.y * t.z - o.z * t.y, y: o.w * t.y - o.x * t.z + o.y * t.w + o.z * t.x, z: o.w * t.z + o.x * t.y - o.y * t.x + o.z * t.w, w: o.w * t.w - o.x * t.x - o.y * t.y - o.z * t.z };
726
+ }
727
+ function j(o) {
728
+ return S({ x: 1, y: 0, z: 0 }, o);
729
+ }
730
+ function S(o, t) {
731
+ const i = o.x * t.x + o.y * t.y + o.z * t.z;
732
+ if (i < -0.999999) {
733
+ const h = Math.abs(o.x) < 0.9 ? 0 : -o.z, _ = Math.abs(o.x) < 0.9 ? -o.z : 0, c = Math.abs(o.x) < 0.9 ? o.y : o.x, l = Math.hypot(h, _, c);
734
+ return { x: h / l, y: _ / l, z: c / l, w: 0 };
735
+ }
736
+ const e = o.y * t.z - o.z * t.y, s = o.z * t.x - o.x * t.z, r = o.x * t.y - o.y * t.x, n = 1 + i, a = Math.hypot(e, s, r, n);
737
+ return { x: e / a, y: s / a, z: r / a, w: n / a };
738
+ }
739
+ async function D(o = {}) {
740
+ for (const n of Object.keys(o))
741
+ if (n !== "maxContactPairs" && n !== "ccd")
742
+ throw new TypeError(`[Nova Rapier] Неизвестная настройка ${n}.`);
743
+ const t = o.maxContactPairs ?? 8192;
744
+ if (!Number.isInteger(t) || t < 1 || t > 1048576)
745
+ throw new RangeError("[Nova Rapier] maxContactPairs: требуется целое число от 1 до 1048576.");
746
+ if (o.ccd !== void 0 && typeof o.ccd != "boolean")
747
+ throw new TypeError("[Nova Rapier] ccd: требуется boolean.");
748
+ const i = o.ccd ?? !0, e = await import("@dimforge/rapier3d-compat");
749
+ await e.init();
750
+ const s = Object.freeze({
751
+ shapes: Object.freeze(["sphere", "box", "capsule", "cylinder", "plane", "convex-hull", "triangle-mesh", "compound"]),
752
+ movingShapes: Object.freeze(["sphere", "box", "capsule", "cylinder", "convex-hull", "compound"]),
753
+ joints: Object.freeze(["fixed", "ball", "hinge", "slider"]),
754
+ sleeping: !0,
755
+ deterministic: !0
756
+ }), r = Object.freeze({
757
+ name: "rapier",
758
+ capabilities: s,
759
+ createWorld: (n) => new B(e, r, n, t, i)
760
+ });
761
+ return r;
762
+ }
763
+ export {
764
+ D as createRapierBackend
765
+ };