@nova-lab/core 1.0.0-dev.19 → 1.1.1-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 +229 -4
@@ -0,0 +1,1396 @@
1
+ import { N as it } from "../DeformedMesh-CPi0P_vc.js";
2
+ import { N as l } from "../Errors-B2ekO9bZ.js";
3
+ import { c as A, o as N } from "../Options-CajE7LLJ.js";
4
+ import { N as Q, z as J } from "../Node-QfgAE2_v.js";
5
+ import { N as Z, t as st, s as W } from "../Clip-CAN7t03k.js";
6
+ import { c as Ft, a as It } from "../Clip-CAN7t03k.js";
7
+ const nt = N({ mode: !0, nodes: !0, subtrees: !0, channels: !0 }), rt = ["position", "quaternion", "scale", "weights"];
8
+ function z(c, t) {
9
+ if (c === void 0)
10
+ return /* @__PURE__ */ new Set();
11
+ if (!Array.isArray(c) || c.length > 4096)
12
+ throw new l("invalid-option", `[Nova3D] Animation mask ${t} must be an array of at most4096 entries.`);
13
+ return new Set(c.map((e) => {
14
+ if (typeof e == "string" && e)
15
+ return e;
16
+ if (e instanceof Q)
17
+ return e.id;
18
+ throw new l("invalid-option", `[Nova3D] Animation mask ${t} must contain nodes or node ids.`);
19
+ }));
20
+ }
21
+ class q {
22
+ mode;
23
+ _nodes;
24
+ _subtrees;
25
+ _channels;
26
+ /** @internal */
27
+ constructor(t) {
28
+ if (this.mode = t.mode ?? "include", this.mode !== "include" && this.mode !== "exclude")
29
+ throw new l("invalid-option", "[Nova3D] Animation mask mode must be include or exclude.");
30
+ if (this._nodes = z(t.nodes, "nodes"), this._subtrees = z(t.subtrees, "subtrees"), t.channels !== void 0 && (!Array.isArray(t.channels) || !t.channels.every((e) => rt.includes(e))))
31
+ throw new l("invalid-option", "[Nova3D] Animation mask channels must be position, quaternion, scale or weights.");
32
+ this._channels = new Set(t.channels ?? []), Object.freeze(this);
33
+ }
34
+ /** Node ids listed exactly. */
35
+ get nodes() {
36
+ return [...this._nodes];
37
+ }
38
+ /** Subtree root ids. */
39
+ get subtrees() {
40
+ return [...this._subtrees];
41
+ }
42
+ /** Listed channels; empty means every channel. */
43
+ get channels() {
44
+ return [...this._channels];
45
+ }
46
+ /** Whether a binding of `channel` on `node` passes the mask. @internal */
47
+ _accepts(t, e) {
48
+ let i = this._channels.size === 0 || this._channels.has(e);
49
+ if (i && (this._nodes.size > 0 || this._subtrees.size > 0)) {
50
+ i = this._nodes.has(t.id);
51
+ let s = t;
52
+ for (; !i && s; ) {
53
+ i = this._subtrees.has(s.id);
54
+ const o = s.parent;
55
+ s = o instanceof Q ? o : void 0;
56
+ }
57
+ }
58
+ return this.mode === "include" ? i : !i;
59
+ }
60
+ }
61
+ function xt(c = {}) {
62
+ return A(c, nt, "animation mask"), new q(c);
63
+ }
64
+ const ot = N({ root: !0, clock: !0 }), at = N({ loop: !0, repetitions: !0, clampWhenFinished: !0, speed: !0, weight: !0, fadeIn: !0, layer: !0, blend: !0, mask: !0 }), ht = N({ warp: !0 }), lt = N({ fadeOut: !0 }), I = 0, L = 1, ct = 2, $ = 1, dt = 2, R = 34028235677973366e22, _t = { position: 0, quaternion: 1, scale: 2, weights: 3 };
65
+ function b(c, t, e = -1e9, i = 1e9) {
66
+ if (typeof c != "number" || !Number.isFinite(c) || c < e || c > i)
67
+ throw new l("invalid-option", `[Nova3D] Invalid animation ${t}.`);
68
+ return c;
69
+ }
70
+ function M(c, t) {
71
+ let e = t;
72
+ for (; e; ) {
73
+ if (e === c)
74
+ return !0;
75
+ const i = e.parent;
76
+ e = "parent" in i ? i : void 0;
77
+ }
78
+ return !1;
79
+ }
80
+ function G(c) {
81
+ if (c === void 0 || c === !0 || c === "repeat")
82
+ return L;
83
+ if (c === !1 || c === "once")
84
+ return I;
85
+ if (c === "ping-pong")
86
+ return ct;
87
+ throw new l("invalid-option", "[Nova3D] Animation loop must be boolean, once, repeat or ping-pong.");
88
+ }
89
+ function K(c, t) {
90
+ if (c === I) {
91
+ if (t !== void 0 && t !== 1)
92
+ throw new l("invalid-option", "[Nova3D] A once action has exactly one repetition.");
93
+ return 1;
94
+ }
95
+ if (t === void 0 || t === 1 / 0)
96
+ return 1 / 0;
97
+ if (!Number.isSafeInteger(t) || t < 1)
98
+ throw new l("invalid-option", "[Nova3D] Animation repetitions must be a positive integer or Infinity.");
99
+ return t;
100
+ }
101
+ function pt(c, t, e) {
102
+ const i = t[3] < 0 ? -1 : 1, s = t[0] * i, o = t[1] * i, a = t[2] * i, n = Math.min(1, t[3] * i);
103
+ let r = 1 - e, _ = e;
104
+ if (n < 0.9995) {
105
+ const w = Math.acos(n), v = Math.sin(w);
106
+ r = Math.sin((1 - e) * w) / v, _ = Math.sin(e * w) / v;
107
+ }
108
+ let d = _ * s, h = _ * o, p = _ * a, f = r + _ * n;
109
+ const m = J(d, h, p, f);
110
+ if (m < 1e-12)
111
+ throw new l("invalid-option", "[Nova3D] Additive quaternion is singular.");
112
+ d /= m, h /= m, p /= m, f /= m;
113
+ const u = c[0], g = c[1], y = c[2], D = c[3];
114
+ c[0] = D * d + u * f + g * p - y * h, c[1] = D * h - u * p + g * f + y * d, c[2] = D * p + u * h - g * d + y * f, c[3] = D * f - u * d - g * h - y * p, tt(c);
115
+ }
116
+ function tt(c) {
117
+ const t = J(c[0], c[1], c[2], c[3]);
118
+ if (t < 1e-12)
119
+ throw new l("invalid-option", "[Nova3D] Quaternion blend is singular.");
120
+ for (let e = 0; e < 4; e++)
121
+ c[e] /= t;
122
+ }
123
+ class U {
124
+ /** @internal */
125
+ constructor(t, e, i, s) {
126
+ if (this._animator = t, this._clip = e, this._bindings = i, this._speed = b(s.speed ?? 1, "speed", -1e6, 1e6), this._weight = b(s.weight ?? 1, "weight", 0, 1), this._loop = G(s.loop), this._repetitions = K(this._loop, s.repetitions), this._clamp = s.clampWhenFinished ?? !0, typeof this._clamp != "boolean")
127
+ throw new l("invalid-option", "[Nova3D] clampWhenFinished must be boolean.");
128
+ const o = s.layer ?? 0;
129
+ if (!Number.isInteger(o) || o < 0 || o > 1023)
130
+ throw new l("invalid-option", "[Nova3D] Animation layer must be an integer 0..1023.");
131
+ this._layer = o;
132
+ const a = s.blend ?? "overwrite";
133
+ if (a !== "overwrite" && a !== "additive")
134
+ throw new l("invalid-option", "[Nova3D] Animation blend must be overwrite or additive.");
135
+ this._additive = a === "additive";
136
+ const n = b(s.fadeIn ?? 0, "fadeIn", 0);
137
+ this._anchorTime = this._fadeStart = t._timeNow(), this._fadeFrom = n > 0 ? 0 : 1, this._fadeDuration = n;
138
+ }
139
+ _anchorTime;
140
+ _anchorClip = 0;
141
+ _paused;
142
+ _speed;
143
+ _weight;
144
+ _loop;
145
+ _repetitions;
146
+ _clamp;
147
+ _fadeFrom;
148
+ _fadeTo = 1;
149
+ _fadeStart;
150
+ _fadeDuration;
151
+ _terminal = !1;
152
+ _warping = !1;
153
+ _warpFrom = 1;
154
+ _warpTo = 1;
155
+ _warpStart = 0;
156
+ _warpDuration = 0;
157
+ _iteration = 0;
158
+ _finishedSeen = !1;
159
+ _loopListeners = [];
160
+ _finishedListeners = [];
161
+ _ended = !1;
162
+ /** @internal */
163
+ _layer;
164
+ /** @internal */
165
+ _additive;
166
+ /** Effective weight of the current evaluation. @internal */
167
+ _frameWeight = 0;
168
+ /** No two bindings share a slot: a lone full-weight action may write samples directly. @internal */
169
+ _distinct = !0;
170
+ /** Immutable clip played by this action. */
171
+ get clip() {
172
+ return this._clip;
173
+ }
174
+ /** Current clip time in seconds after loop mapping. */
175
+ get time() {
176
+ return this._sampleTime(this._animator._timeNow());
177
+ }
178
+ /** Requested weight before fades. */
179
+ get weight() {
180
+ return this._weight;
181
+ }
182
+ /** Weight after fades and finish handling at the animator time. */
183
+ get effectiveWeight() {
184
+ return this._effectiveWeight(this._animator._timeNow());
185
+ }
186
+ get speed() {
187
+ return this._speed;
188
+ }
189
+ get layer() {
190
+ return this._layer;
191
+ }
192
+ get blend() {
193
+ return this._additive ? "additive" : "overwrite";
194
+ }
195
+ get loop() {
196
+ return this._loop === I ? "once" : this._loop === L ? "repeat" : "ping-pong";
197
+ }
198
+ get repetitions() {
199
+ return this._repetitions;
200
+ }
201
+ get paused() {
202
+ return this._paused !== void 0;
203
+ }
204
+ /** Whether the final repetition has been reached at the animator time. */
205
+ get finished() {
206
+ return this._isFinished(this._rawTime(this._animator._timeNow()));
207
+ }
208
+ pause() {
209
+ this._assertAlive(), this._paused === void 0 && (this._paused = this._rawTime(this._animator._timeNow()), this._animator._refresh());
210
+ }
211
+ resume() {
212
+ this._assertAlive(), this._paused !== void 0 && (this._anchorClip = this._paused, this._anchorTime = this._animator._timeNow(), this._paused = void 0, this._animator._refresh());
213
+ }
214
+ /** Sets the unwrapped action time; repetitions count from 0. Events are re-synced silently. */
215
+ seek(t) {
216
+ this._assertAlive(), b(t, "action time", 0), this._anchorClip = t, this._anchorTime = this._animator._timeNow(), this._paused !== void 0 && (this._paused = t), this._syncEvents(t), this._animator._refresh();
217
+ }
218
+ setWeight(t) {
219
+ this._assertAlive(), this._weight = b(t, "weight", 0, 1), this._animator._refresh();
220
+ }
221
+ setSpeed(t) {
222
+ this._assertAlive(), b(t, "speed", -1e6, 1e6), this._reanchor(), this._speed = t, this._animator._refresh();
223
+ }
224
+ /**
225
+ * Changes loop mode and repetitions while keeping the unwrapped time.
226
+ * @experimental
227
+ */
228
+ setLoop(t, e) {
229
+ this._assertAlive();
230
+ const i = G(t);
231
+ this._repetitions = K(i, e), this._loop = i, this._syncEvents(this._rawTime(this._animator._timeNow())), this._animator._refresh();
232
+ }
233
+ /**
234
+ * Fades the envelope from its current value to 1 (non-terminal).
235
+ * @experimental
236
+ */
237
+ fadeIn(t) {
238
+ this._fade(1, t);
239
+ }
240
+ /**
241
+ * Fades the envelope to 0 but keeps the action and its channels (non-terminal).
242
+ * @experimental
243
+ */
244
+ fadeOut(t) {
245
+ this._fade(0, t);
246
+ }
247
+ /**
248
+ * Fades this action out (from its current envelope) and `next` in from zero over
249
+ * `duration` seconds on the animator clock; neither action is stopped. With `warp`, time scales
250
+ * meet as three.js `crossFadeTo(next, duration, true)`.
251
+ * @experimental
252
+ */
253
+ crossFadeTo(t, e, i = {}) {
254
+ if (A(i, ht, "animation cross-fade"), this._assertAlive(), !(t instanceof U) || t === this || t._animator !== this._animator)
255
+ throw new l("invalid-option", "[Nova3D] crossFadeTo requires another action of the same animator.");
256
+ if (t._assertAlive(), b(e, "cross-fade duration", 0), i.warp !== void 0 && typeof i.warp != "boolean")
257
+ throw new l("invalid-option", "[Nova3D] Cross-fade warp must be boolean.");
258
+ if (i.warp && (this._clip.duration === 0 || t._clip.duration === 0 || e === 0))
259
+ throw new l("invalid-option", "[Nova3D] Warped cross-fades require non-empty clips and a positive duration.");
260
+ if (this._terminal || t._terminal)
261
+ throw new l("state", "[Nova3D] Animation action is stopping.");
262
+ const s = this._animator._timeNow();
263
+ this._setFade(0, e, s), t._setFade(1, e, s), e > 0 && (t._fadeFrom = 0), i.warp && (this._setWarp(1, this._clip.duration / t._clip.duration, e, s), t._setWarp(t._clip.duration / this._clip.duration, 1, e, s)), this._animator._refresh();
264
+ }
265
+ /**
266
+ * Linearly changes the time-scale multiplier from `start` to `end` over `duration`.
267
+ * @experimental
268
+ */
269
+ warp(t, e, i) {
270
+ this._assertAlive(), b(t, "warp scale", 0, 1e6), b(e, "warp scale", 0, 1e6), b(i, "warp duration", 0), this._setWarp(t, e, i, this._animator._timeNow()), this._animator._refresh();
271
+ }
272
+ /**
273
+ * Freezes the current warp multiplier into the speed and ends the warp.
274
+ * @experimental
275
+ */
276
+ stopWarping() {
277
+ if (this._assertAlive(), !this._warping)
278
+ return;
279
+ const t = this._animator._timeNow();
280
+ this._reanchor(), this._speed *= this._warpScale(t), this._warping = !1, this._animator._refresh();
281
+ }
282
+ /**
283
+ * Each repetition change (`repeat` and `ping-pong` loops); returns unsubscribe.
284
+ * @experimental
285
+ */
286
+ onLoop(t) {
287
+ return this._listen("_loopListeners", t);
288
+ }
289
+ /**
290
+ * The action reached its end (`once`, or the last repetition); returns unsubscribe.
291
+ * @experimental
292
+ */
293
+ onFinished(t) {
294
+ return this._listen("_finishedListeners", t);
295
+ }
296
+ _listen(t, e) {
297
+ if (this._assertAlive(), typeof e != "function")
298
+ throw new l("invalid-option", "[Nova3D] Action listener must be a function.");
299
+ return this._hasListeners() || this._syncEvents(this._rawTime(this._animator._timeNow())), this[t] = [...this[t], e], () => {
300
+ this[t] = this[t].filter((i) => i !== e);
301
+ };
302
+ }
303
+ stop(t = {}) {
304
+ if (A(t, lt, "animation stop"), this._ended)
305
+ return;
306
+ this._assertAlive();
307
+ const e = b(t.fadeOut ?? 0, "fadeOut", 0);
308
+ if (e === 0) {
309
+ this._animator._remove(this);
310
+ return;
311
+ }
312
+ this._setFade(0, e, this._animator._timeNow()), this._terminal = !0, this._animator._refresh();
313
+ }
314
+ /** @internal */
315
+ _dispose() {
316
+ this._ended = !0;
317
+ }
318
+ /** @internal */
319
+ _alive() {
320
+ return !this._ended;
321
+ }
322
+ /** @internal */
323
+ _expired(t) {
324
+ return this._terminal && t >= this._fadeStart + this._fadeDuration;
325
+ }
326
+ /** @internal */
327
+ _effectiveWeight(t) {
328
+ return !this._clamp && this._isFinished(this._rawTime(t)) ? 0 : this._weight * this._envelope(t);
329
+ }
330
+ /** @internal */
331
+ _needsTick(t) {
332
+ return this._fadeDuration > 0 && t < this._fadeStart + this._fadeDuration ? !0 : this._paused !== void 0 || this._speed === 0 || this._clip.duration === 0 ? !1 : this._warping && t < this._warpStart + this._warpDuration ? !0 : !this._isFinished(this._rawTime(t));
333
+ }
334
+ /** @internal */
335
+ _sampleTime(t) {
336
+ return this._clipTime(this._rawTime(t));
337
+ }
338
+ /** Sets unwrapped time and weight of a graph-driven action without re-evaluating. @internal */
339
+ _drive(t, e) {
340
+ this._anchorClip = t, this._anchorTime = this._animator._timeNow(), this._weight = e;
341
+ }
342
+ /** @internal */
343
+ _hasListeners() {
344
+ return this._loopListeners.length > 0 || this._finishedListeners.length > 0;
345
+ }
346
+ /** Returns the pending event kind since the previous poll (0 when none). @internal */
347
+ _pollEvents(t) {
348
+ const e = this._rawTime(t), i = this._isFinished(e), s = this._iterationOf(e);
349
+ if (i) {
350
+ const o = !this._finishedSeen;
351
+ return this._finishedSeen = !0, this._iteration = s, o ? dt : 0;
352
+ }
353
+ return this._finishedSeen = !1, s !== this._iteration ? (this._iteration = s, $) : 0;
354
+ }
355
+ /** @internal */
356
+ _emit(t) {
357
+ const e = t === $ ? this._loopListeners : this._finishedListeners;
358
+ for (let i = 0; i < e.length; i++)
359
+ e[i](this);
360
+ }
361
+ _syncEvents(t) {
362
+ this._iteration = this._iterationOf(t), this._finishedSeen = this._isFinished(t);
363
+ }
364
+ _reanchor() {
365
+ const t = this._animator._timeNow();
366
+ this._anchorClip = this._rawTime(t), this._anchorTime = t;
367
+ }
368
+ _fade(t, e) {
369
+ if (this._assertAlive(), b(e, "fade duration", 0), this._terminal)
370
+ throw new l("state", "[Nova3D] Animation action is stopping.");
371
+ this._setFade(t, e, this._animator._timeNow()), this._animator._refresh();
372
+ }
373
+ _setFade(t, e, i) {
374
+ this._fadeFrom = e === 0 ? t : this._envelope(i), this._fadeTo = t, this._fadeStart = i, this._fadeDuration = e;
375
+ }
376
+ _setWarp(t, e, i, s) {
377
+ this._reanchor(), this._warping = !0, this._warpFrom = i === 0 ? e : t, this._warpTo = e, this._warpStart = s, this._warpDuration = i;
378
+ }
379
+ _envelope(t) {
380
+ if (this._fadeDuration === 0)
381
+ return this._fadeTo;
382
+ const e = Math.max(0, Math.min(1, (t - this._fadeStart) / this._fadeDuration));
383
+ return this._fadeFrom * (1 - e) + this._fadeTo * e;
384
+ }
385
+ _warpScale(t) {
386
+ const e = t - this._warpStart;
387
+ return e <= 0 || this._warpDuration === 0 ? e <= 0 ? this._warpFrom : this._warpTo : e >= this._warpDuration ? this._warpTo : this._warpFrom + (this._warpTo - this._warpFrom) * e / this._warpDuration;
388
+ }
389
+ /** Integral of the warp multiplier from the warp start to `time` (closed form, deterministic). */
390
+ _warpIntegral(t) {
391
+ const e = t - this._warpStart, i = this._warpFrom, s = this._warpTo, o = this._warpDuration;
392
+ return e <= 0 ? e * i : e >= o ? i * o + (s - i) * o / 2 + s * (e - o) : i * e + (s - i) * e * e / (2 * o);
393
+ }
394
+ _rawTime(t) {
395
+ return this._paused !== void 0 ? this._paused : this._warping ? this._anchorClip + (this._warpIntegral(t) - this._warpIntegral(this._anchorTime)) * this._speed : this._anchorClip + (t - this._anchorTime) * this._speed;
396
+ }
397
+ _clipTime(t) {
398
+ const e = this._clip.duration;
399
+ if (e === 0)
400
+ return 0;
401
+ if (this._loop === I)
402
+ return Math.max(0, Math.min(e, t));
403
+ const i = this._repetitions !== 1 / 0;
404
+ if (i && t >= this._repetitions * e)
405
+ return this._loop === L || this._repetitions % 2 === 1 ? e : 0;
406
+ if (i && t <= 0)
407
+ return 0;
408
+ const s = (t % e + e) % e;
409
+ return this._loop === L ? s : Math.abs(Math.floor(t / e) % 2) === 1 ? e - s : s;
410
+ }
411
+ _iterationOf(t) {
412
+ const e = this._clip.duration;
413
+ if (this._loop === I || e === 0)
414
+ return 0;
415
+ const i = Math.floor(t / e);
416
+ return this._repetitions === 1 / 0 ? i : Math.max(0, Math.min(this._repetitions - 1, i));
417
+ }
418
+ _isFinished(t) {
419
+ if (this._repetitions === 1 / 0)
420
+ return !1;
421
+ const e = this._clip.duration;
422
+ return e === 0 || t >= this._repetitions * e || this._speed < 0 && t <= 0;
423
+ }
424
+ _assertAlive() {
425
+ if (this._animator._assertUsable(), this._ended)
426
+ throw new l("state", "[Nova3D] Animation action has stopped.");
427
+ }
428
+ }
429
+ class et {
430
+ /** @internal */
431
+ constructor(t, e) {
432
+ this._app = t, A(e, ot, "animator");
433
+ const i = e.clock ?? "app";
434
+ if (i !== "app" && i !== "manual")
435
+ throw new l("invalid-option", "[Nova3D] Animator clock must be app or manual.");
436
+ if (!e.root || !t._ownsScene(e.root.scene) || e.root.destroyed)
437
+ throw new l("owner", "[Nova3D] Animator requires a live root of its app.");
438
+ this._root = e.root, this._clock = i, this._cleanup.push(t._own(() => this.destroy())), this._cleanup.push(t.onUpdate((s) => {
439
+ if (!this._destroyed) {
440
+ if (this._root.destroyed) {
441
+ this.destroy();
442
+ return;
443
+ }
444
+ if (this._clock === "app") {
445
+ const o = s.deltaTime * this._timeScale;
446
+ this._advance(b(this._time + o, "clock time", 0), o);
447
+ }
448
+ }
449
+ }));
450
+ }
451
+ _list = [];
452
+ _ordered = [];
453
+ _groupEnds = [];
454
+ _poses = [];
455
+ _morphSlots = [];
456
+ _touched = [];
457
+ _morphClaimed = /* @__PURE__ */ new Set();
458
+ _claimed = /* @__PURE__ */ new Map();
459
+ _drivers = [];
460
+ _eventActions = [];
461
+ _eventKinds = [];
462
+ _cleanup = [];
463
+ _lease;
464
+ _time = 0;
465
+ _timeScale = 1;
466
+ _stamp = 0;
467
+ _evaluation = 0;
468
+ /** Scene hierarchy version at which every evaluated target was last found inside the root. */
469
+ _checkedHierarchy = -1;
470
+ _destroyed = !1;
471
+ _root;
472
+ _clock;
473
+ _applyPoses = () => {
474
+ for (let t = 0; t < this._morphSlots.length; t++) {
475
+ const e = this._morphSlots[t];
476
+ e.node._applyMorph(this, e.contributed ? e.value : void 0);
477
+ }
478
+ for (let t = 0; t < this._poses.length; t++) {
479
+ const e = this._poses[t];
480
+ e.node._applyAnimationPose(this, e.pose);
481
+ }
482
+ };
483
+ /** 'app' advances with app frames; 'manual' waits for `update(deltaTime)`. */
484
+ get clock() {
485
+ return this._clock;
486
+ }
487
+ /** Global multiplier applied to every clock advance (`update` and app frames), not to `seek`. */
488
+ get timeScale() {
489
+ return this._timeScale;
490
+ }
491
+ /** Current animator time in seconds. */
492
+ get time() {
493
+ return this._time;
494
+ }
495
+ play(t, e = {}) {
496
+ if (A(e, at, "animation play"), this._assertUsable(), !(t instanceof Z))
497
+ throw new l("invalid-option", "[Nova3D] play requires an immutable animation clip.");
498
+ const i = e.mask;
499
+ if (i !== void 0 && !(i instanceof q))
500
+ throw new l("invalid-option", "[Nova3D] Animation mask must come from createAnimationMask.");
501
+ const s = [];
502
+ for (const n of t._readTracks()) {
503
+ const r = this._root.scene.getNode(n.target);
504
+ if (!r || r.destroyed || !M(this._root, r))
505
+ throw new l("owner", "[Nova3D] Animation target must belong to the animator subtree.");
506
+ if (!(i && !i._accepts(r, n.channel))) {
507
+ if (n.channel === "weights" && (!(r instanceof it) || !r._canClaimMorph(this) || r._readMorphBase().length !== n.size))
508
+ throw new l("owner", "[Nova3D] Weight track requires matching live morph targets without another owner.");
509
+ s.push({ node: r, track: n, sample: new Float64Array(n.size), cursor: st(n) });
510
+ }
511
+ }
512
+ const o = this._channelMap(s);
513
+ for (const [n, r] of o)
514
+ if (!n._canClaimAnimation(this, r))
515
+ throw new l("owner", "[Nova3D] Animated channel already has another owner.");
516
+ const a = new U(this, t, Object.freeze(s), e);
517
+ this._list.push(a);
518
+ try {
519
+ this._reconcile(), this._refresh(!1);
520
+ } catch (n) {
521
+ throw this._list.splice(this._list.indexOf(a), 1), a._dispose(), this._reconcile(), this._refresh(), n;
522
+ }
523
+ return a;
524
+ }
525
+ /**
526
+ * Sets the global time scale (0..1e6) used by `update` and the app clock.
527
+ * @experimental
528
+ */
529
+ setTimeScale(t) {
530
+ this._assertUsable(), this._timeScale = b(t, "time scale", 0, 1e6);
531
+ }
532
+ seek(t) {
533
+ this._assertUsable(), b(t, "seek time", 0), this._advance(t, Math.max(0, t - this._time));
534
+ }
535
+ update(t) {
536
+ if (this._assertUsable(), this._clock !== "manual")
537
+ throw new l("state", "[Nova3D] update is only available with manual clock.");
538
+ b(t, "deltaTime", 0);
539
+ const e = t * this._timeScale;
540
+ this._advance(b(this._time + e, "clock time", 0), e);
541
+ }
542
+ stopAll() {
543
+ this._assertUsable(), this._endAll();
544
+ }
545
+ get destroyed() {
546
+ return this._destroyed;
547
+ }
548
+ destroy() {
549
+ if (!this._destroyed) {
550
+ this._destroyed = !0, this._endAll();
551
+ for (const t of this._cleanup.splice(0))
552
+ t();
553
+ }
554
+ }
555
+ /** @internal */
556
+ _assertUsable() {
557
+ if (this._destroyed || this._app.destroyed || this._root.destroyed || this._root.scene.destroyed)
558
+ throw new l("destroyed", "[Nova3D] Animator is destroyed or its root is no longer live.");
559
+ }
560
+ /** @internal */
561
+ _timeNow() {
562
+ return this._time;
563
+ }
564
+ /** @internal */
565
+ _attachDriver(t) {
566
+ this._drivers.push(t);
567
+ }
568
+ /** @internal */
569
+ _detachDriver(t) {
570
+ const e = this._drivers.indexOf(t);
571
+ e >= 0 && this._drivers.splice(e, 1);
572
+ }
573
+ /** @internal */
574
+ _remove(t) {
575
+ this._removeMany([t]);
576
+ }
577
+ /** Removes several actions with one reconcile and evaluation. @internal */
578
+ _removeMany(t) {
579
+ for (const e of t) {
580
+ e._dispose();
581
+ const i = this._list.indexOf(e);
582
+ i >= 0 && this._list.splice(i, 1);
583
+ }
584
+ try {
585
+ this._reconcile(), this._refresh();
586
+ } catch (e) {
587
+ throw this._endAll(), e;
588
+ }
589
+ }
590
+ /** @internal */
591
+ _refresh(t = !0) {
592
+ try {
593
+ this._evaluate(), this._syncLease();
594
+ } catch (e) {
595
+ throw t && this._endAll(), e;
596
+ }
597
+ }
598
+ /** `delta` is the scaled step given to drivers; backward seeks give 0 (graphs never rewind). */
599
+ _advance(t, e) {
600
+ this._time = t;
601
+ try {
602
+ for (let s = 0; s < this._drivers.length; s++)
603
+ this._drivers[s]._drive(e);
604
+ let i = !1;
605
+ for (let s = this._list.length - 1; s >= 0; s--) {
606
+ const o = this._list[s];
607
+ o._expired(t) && (o._dispose(), this._list.splice(s, 1), i = !0);
608
+ }
609
+ i && this._reconcile(), this._evaluate(), this._syncLease();
610
+ } catch (i) {
611
+ throw this._endAll(), i;
612
+ }
613
+ this._dispatchEvents(t);
614
+ }
615
+ _dispatchEvents(t) {
616
+ let e = 0;
617
+ for (let i = 0; i < this._list.length; i++) {
618
+ const s = this._list[i];
619
+ if (s._hasListeners()) {
620
+ const o = s._pollEvents(t);
621
+ o !== 0 && (this._eventActions[e] = s, this._eventKinds[e] = o, e++);
622
+ }
623
+ }
624
+ for (let i = 0; i < e; i++) {
625
+ const s = this._eventActions[i];
626
+ this._eventActions[i] = void 0, s._alive() && s._emit(this._eventKinds[i]);
627
+ }
628
+ for (let i = this._drivers.length - 1; i >= 0; i--)
629
+ this._drivers[i]?._dispatchEvents();
630
+ }
631
+ _endAll() {
632
+ for (const t of this._list)
633
+ t._dispose();
634
+ this._list.length = 0, this._ordered = [], this._groupEnds = [], this._poses = [], this._morphSlots = [], this._touched = [];
635
+ for (const t of this._claimed.keys())
636
+ t._releaseAnimation(this);
637
+ this._claimed.clear();
638
+ for (const t of this._morphClaimed)
639
+ t._releaseMorph(this);
640
+ this._morphClaimed.clear(), this._lease?.release(), this._lease = void 0;
641
+ for (const t of this._drivers.splice(0))
642
+ t._animatorEnded();
643
+ }
644
+ _channelMap(t) {
645
+ const e = /* @__PURE__ */ new Map();
646
+ for (const { node: i, track: s } of t) {
647
+ if (s.channel === "weights")
648
+ continue;
649
+ const o = e.get(i) ?? /* @__PURE__ */ new Set();
650
+ o.add(s.channel), e.set(i, o);
651
+ }
652
+ return e;
653
+ }
654
+ /** Structural pass: claims channels and rebuilds the preallocated evaluation slots. */
655
+ _reconcile() {
656
+ const t = new Set(this._list.flatMap((n) => n._bindings.filter((r) => r.track.channel === "weights").map((r) => r.node)));
657
+ for (const n of t)
658
+ if (!n._canClaimMorph(this) || !M(this._root, n))
659
+ throw new l("destroyed", "[Nova3D] Morph target became unavailable or left its root.");
660
+ const e = this._channelMap(this._list.flatMap((n) => [...n._bindings]));
661
+ for (const [n, r] of e)
662
+ if (!n._canClaimAnimation(this, r) || !M(this._root, n))
663
+ throw new l("destroyed", "[Nova3D] Animated target became unavailable or left its root.");
664
+ for (const n of this._claimed.keys())
665
+ n._releaseAnimation(this, e.get(n));
666
+ for (const [n, r] of e)
667
+ n._claimAnimation(this, r);
668
+ for (const n of this._morphClaimed)
669
+ t.has(n) || n._releaseMorph(this);
670
+ this._morphClaimed.clear();
671
+ for (const n of t)
672
+ n._claimMorph(this), this._morphClaimed.add(n);
673
+ this._claimed.clear();
674
+ for (const [n, r] of e)
675
+ this._claimed.set(n, r);
676
+ const i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = [];
677
+ let a = 0;
678
+ for (const n of this._list) {
679
+ for (const _ of n._bindings) {
680
+ const { node: d, track: h } = _, p = i.get(d) ?? /* @__PURE__ */ new Map();
681
+ i.set(d, p);
682
+ let f = p.get(h.channel);
683
+ if (!f) {
684
+ const m = h.channel === "weights", u = m ? d._readMorphBase().length : h.size;
685
+ if (f = { node: d, channel: h.channel, code: _t[h.channel], value: new Float64Array(u), based: -1, sum: new Float64Array(u), morphBase: m ? d._readMorphBase() : void 0, weight: 0, stamp: 0, contributed: !1 }, p.set(h.channel, f), a++, m)
686
+ o.push(f);
687
+ else {
688
+ const g = s.get(d) ?? { node: d, slots: [], pose: { position: void 0, quaternion: void 0, scale: void 0 } };
689
+ g.slots.push(f), s.set(d, g);
690
+ }
691
+ }
692
+ _.slot = f;
693
+ }
694
+ const r = /* @__PURE__ */ new Set();
695
+ n._distinct = n._bindings.every((_) => !r.has(_.slot) && r.add(_.slot));
696
+ }
697
+ this._poses = [...s.values()], this._morphSlots = o, this._checkedHierarchy = -1, this._touched = Array.from({ length: a }), this._ordered = this._list.map((n, r) => ({ action: n, index: r })).sort((n, r) => n.action._layer - r.action._layer || Number(n.action._additive) - Number(r.action._additive) || n.index - r.index).map((n) => n.action), this._groupEnds = [];
698
+ for (let n = 1; n <= this._ordered.length; n++) {
699
+ const r = this._ordered[n - 1], _ = this._ordered[n];
700
+ (!_ || _._layer !== r._layer || _._additive !== r._additive) && this._groupEnds.push(n);
701
+ }
702
+ }
703
+ /** Allocation-free evaluation over the slots prepared by `_reconcile`. */
704
+ _evaluate() {
705
+ if (this._destroyed)
706
+ return;
707
+ const t = this._time, e = this._root.scene._hierarchyVersion, i = e !== this._checkedHierarchy, s = ++this._evaluation;
708
+ for (let a = 0; a < this._poses.length; a++) {
709
+ const n = this._poses[a];
710
+ if (n.node.destroyed || i && !M(this._root, n.node))
711
+ throw new l("destroyed", "[Nova3D] Animated target became unavailable.");
712
+ for (let r = 0; r < n.slots.length; r++)
713
+ n.slots[r].contributed = !1;
714
+ }
715
+ for (let a = 0; a < this._morphSlots.length; a++) {
716
+ const n = this._morphSlots[a];
717
+ if (n.node.destroyed || i && !M(this._root, n.node))
718
+ throw new l("destroyed", "[Nova3D] Animated target became unavailable.");
719
+ n.value.set(n.morphBase), n.based = s, n.contributed = !1;
720
+ }
721
+ this._checkedHierarchy = e;
722
+ let o = 0;
723
+ for (let a = 0; a < this._groupEnds.length; a++) {
724
+ const n = this._groupEnds[a];
725
+ this._ordered[o]._additive ? this._addGroup(o, n, t) : this._overwriteGroup(o, n, t), o = n;
726
+ }
727
+ for (let a = 0; a < this._poses.length; a++) {
728
+ const n = this._poses[a], r = n.pose;
729
+ for (let _ = 0; _ < n.slots.length; _++) {
730
+ const d = n.slots[_], h = d.value;
731
+ if (d.contributed) {
732
+ for (let f = 0; f < h.length; f++)
733
+ if (!(Math.abs(h[f]) < R))
734
+ throw new l("invalid-option", "[Nova3D] Animation blend exceeds Float32 range.");
735
+ }
736
+ const p = d.contributed ? h : void 0;
737
+ d.code === 1 ? r.quaternion = p : d.code === 0 ? r.position = p : r.scale = p;
738
+ }
739
+ }
740
+ for (let a = 0; a < this._morphSlots.length; a++) {
741
+ const n = this._morphSlots[a];
742
+ for (let r = 0; n.contributed && r < n.value.length; r++)
743
+ if (!(Math.abs(n.value[r]) < R))
744
+ throw new l("invalid-option", "[Nova3D] Morph blend exceeds finite Float32.");
745
+ }
746
+ this._app.batch(this._applyPoses);
747
+ }
748
+ /** Weighted overwrite blend of one layer: rest weight keeps the lower result, excess normalizes. */
749
+ _overwriteGroup(t, e, i) {
750
+ const s = this._evaluation;
751
+ if (e - t === 1) {
752
+ const n = this._ordered[t], r = n._effectiveWeight(i);
753
+ if (n._frameWeight = r, r <= 0)
754
+ return;
755
+ if (r === 1 && n._distinct) {
756
+ const _ = n._sampleTime(i);
757
+ for (let d = 0; d < n._bindings.length; d++) {
758
+ const h = n._bindings[d], p = h.slot;
759
+ W(h.track, _, p.value, h.cursor), p.contributed = !0, p.based = s;
760
+ }
761
+ return;
762
+ }
763
+ }
764
+ const o = ++this._stamp;
765
+ let a = 0;
766
+ for (let n = t; n < e; n++) {
767
+ const r = this._ordered[n], _ = r._effectiveWeight(i);
768
+ if (r._frameWeight = _, _ <= 0)
769
+ continue;
770
+ const d = r._sampleTime(i);
771
+ for (let h = 0; h < r._bindings.length; h++) {
772
+ const p = r._bindings[h];
773
+ W(p.track, d, p.sample, p.cursor);
774
+ const f = p.slot;
775
+ f.stamp !== o && (f.stamp = o, f.weight = 0, f.reference = p.sample, this._touched[a++] = f), f.weight += _;
776
+ }
777
+ }
778
+ for (let n = 0; n < a; n++) {
779
+ const r = this._touched[n], _ = Math.max(0, 1 - r.weight);
780
+ if (_ > 0) {
781
+ this._base(r), r.reference = r.value;
782
+ for (let d = 0; d < r.sum.length; d++)
783
+ r.sum[d] = r.value[d] * _;
784
+ } else
785
+ r.sum.fill(0);
786
+ }
787
+ for (let n = t; n < e; n++) {
788
+ const r = this._ordered[n], _ = r._frameWeight;
789
+ if (!(_ <= 0))
790
+ for (let d = 0; d < r._bindings.length; d++) {
791
+ const { sample: h, slot: p } = r._bindings[d], f = p.sum;
792
+ let m = 1;
793
+ if (p.code === 1) {
794
+ const u = p.reference;
795
+ u[0] * h[0] + u[1] * h[1] + u[2] * h[2] + u[3] * h[3] < 0 && (m = -1);
796
+ }
797
+ for (let u = 0; u < f.length; u++)
798
+ f[u] += h[u] * _ * m;
799
+ }
800
+ }
801
+ for (let n = 0; n < a; n++) {
802
+ const r = this._touched[n], _ = Math.max(1, r.weight);
803
+ for (let d = 0; d < r.value.length; d++)
804
+ r.value[d] = r.sum[d] / _;
805
+ r.code === 1 && tt(r.value), r.contributed = !0, r.based = s, r.reference = void 0;
806
+ }
807
+ }
808
+ /** Copies the node's logical base into `slot.value` once per evaluation, when a blend reads it. */
809
+ _base(t) {
810
+ if (t.based === this._evaluation)
811
+ return;
812
+ t.based = this._evaluation;
813
+ const e = t.node._baseChannel(t.channel), i = t.value;
814
+ for (let s = 0; s < i.length; s++)
815
+ i[s] = e[s];
816
+ }
817
+ /** Additive layer: vectors add weighted deltas, quaternions post-multiply slerp(identity, delta, weight). */
818
+ _addGroup(t, e, i) {
819
+ for (let s = t; s < e; s++) {
820
+ const o = this._ordered[s], a = o._effectiveWeight(i);
821
+ if (a <= 0)
822
+ continue;
823
+ const n = o._sampleTime(i);
824
+ for (let r = 0; r < o._bindings.length; r++) {
825
+ const _ = o._bindings[r], d = W(_.track, n, _.sample, _.cursor), h = _.slot;
826
+ if (this._base(h), h.code === 1)
827
+ pt(h.value, d, a);
828
+ else
829
+ for (let p = 0; p < h.value.length; p++)
830
+ h.value[p] += d[p] * a;
831
+ h.contributed = !0;
832
+ }
833
+ }
834
+ }
835
+ _syncLease() {
836
+ let t = !1;
837
+ if (this._clock === "app") {
838
+ for (let e = 0; !t && e < this._drivers.length; e++)
839
+ t = this._drivers[e]._drivesContinuously();
840
+ for (let e = 0; !t && e < this._list.length; e++) {
841
+ const i = this._list[e];
842
+ t = i._bindings.length > 0 && i._needsTick(this._time);
843
+ }
844
+ }
845
+ t ? this._lease ??= this._app._acquireLoop("nova3d.animation") : (this._lease?.release(), this._lease = void 0);
846
+ }
847
+ }
848
+ function Tt(c, t) {
849
+ return new et(c, t);
850
+ }
851
+ const ft = 0, B = 1, k = 2, F = 3, j = ["float", "int", "bool", "trigger"], mt = [">", ">=", "<", "<=", "==", "!="], ut = ["none", "current", "next"], H = 0, V = 1, E = 2, wt = 0, X = 1;
852
+ function x(c, t, e, i) {
853
+ if (typeof c != "number" || !Number.isFinite(c) || c < e || c > i)
854
+ throw new l("invalid-option", `[Nova3D] Invalid animation graph ${t}.`);
855
+ return c;
856
+ }
857
+ function P(c, t) {
858
+ if (typeof c != "string" || !c || c.startsWith("$"))
859
+ throw new l("invalid-option", `[Nova3D] Animation graph ${t} must be a non-empty string without a leading $.`);
860
+ return c;
861
+ }
862
+ function Y(c, t, e, i) {
863
+ return c === 0 && t === 0 || e === 0 && i === 0 ? 0 : Math.atan2(c * i - t * e, c * e + t * i);
864
+ }
865
+ const S = {
866
+ graph: N({ parameters: !0, layers: !0 }),
867
+ parameter: N({ type: !0, value: !0 }),
868
+ layer: N({ name: !0, weight: !0, blend: !0, mask: !0, entry: !0, states: !0, transitions: !0 }),
869
+ state: N({ name: !0, clip: !0, blendTree: !0, speed: !0, speedParameter: !0, loop: !0 }),
870
+ tree1d: /* @__PURE__ */ new Set(["type", "parameter", "children"]),
871
+ tree2d: /* @__PURE__ */ new Set(["type", "parameters", "children"]),
872
+ child1d: N({ clip: !0, threshold: !0 }),
873
+ child2d: N({ clip: !0, position: !0 }),
874
+ transition: N({ from: !0, to: !0, duration: !0, exitTime: !0, offset: !0, conditions: !0, interruptionSource: !0, priority: !0 }),
875
+ condition: N({ parameter: !0, operator: !0, value: !0 })
876
+ };
877
+ function vt(c) {
878
+ A(c, S.graph, "animation graph");
879
+ for (const t of Object.values(c.parameters ?? {}))
880
+ A(t, S.parameter, "animation parameter");
881
+ for (const t of Array.isArray(c.layers) ? c.layers : []) {
882
+ A(t, S.layer, "animation layer");
883
+ for (const e of Array.isArray(t.states) ? t.states : []) {
884
+ A(e, S.state, "animation state");
885
+ const i = e.blendTree;
886
+ if (i !== void 0) {
887
+ const s = i?.type === "2d-directional";
888
+ A(i, s ? S.tree2d : S.tree1d, "animation blend tree");
889
+ for (const o of Array.isArray(i.children) ? i.children : [])
890
+ A(o, s ? S.child2d : S.child1d, "animation blend child");
891
+ }
892
+ }
893
+ for (const e of Array.isArray(t.transitions) ? t.transitions : []) {
894
+ A(e, S.transition, "animation transition");
895
+ for (const i of Array.isArray(e.conditions) ? e.conditions : [])
896
+ A(i, S.condition, "animation condition");
897
+ }
898
+ }
899
+ }
900
+ class gt {
901
+ /** @internal */
902
+ constructor(t, e) {
903
+ if (this._animator = t, !(t instanceof et))
904
+ throw new l("invalid-option", "[Nova3D] Animation graph requires an animator.");
905
+ if (t._assertUsable(), vt(e), !Array.isArray(e.layers) || e.layers.length < 1 || e.layers.length > 64)
906
+ throw new l("invalid-option", "[Nova3D] Animation graph requires1..64 layers.");
907
+ const i = Object.entries(e.parameters ?? {});
908
+ if (i.length > 256)
909
+ throw new l("invalid-option", "[Nova3D] Animation graph supports at most256 parameters.");
910
+ this._parameterTypes = new Uint8Array(i.length), this._parameters = new Float64Array(i.length), i.forEach(([s, o], a) => {
911
+ P(s, "parameter name");
912
+ const n = j.indexOf(o?.type);
913
+ if (n < 0)
914
+ throw new l("invalid-option", "[Nova3D] Parameter type must be float, int, bool or trigger.");
915
+ this._parameterIndex.set(s, a), this._parameterTypes[a] = n, this._parameters[a] = this._coerce(a, o.value ?? (n >= k ? !1 : 0));
916
+ });
917
+ try {
918
+ e.layers.forEach((s, o) => this._layers.push(this._createLayer(s, o)));
919
+ } catch (s) {
920
+ throw this._actions.length && t._removeMany(this._actions), s;
921
+ }
922
+ this._events = new Int32Array(this._layers.length * 6), t._attachDriver(this), this._apply(), t._refresh();
923
+ }
924
+ _parameterIndex = /* @__PURE__ */ new Map();
925
+ _parameterTypes;
926
+ _parameters;
927
+ _layers = [];
928
+ _layerIndex = /* @__PURE__ */ new Map();
929
+ _actions = [];
930
+ _events;
931
+ _eventCount = 0;
932
+ _enterListeners = [];
933
+ _exitListeners = [];
934
+ _destroyed = !1;
935
+ get destroyed() {
936
+ return this._destroyed;
937
+ }
938
+ /** Layer names in evaluation order. */
939
+ get layers() {
940
+ return this._layers.map((t) => t.name);
941
+ }
942
+ setFloat(t, e) {
943
+ this._set(t, ft, e);
944
+ }
945
+ setInt(t, e) {
946
+ this._set(t, B, e);
947
+ }
948
+ setBool(t, e) {
949
+ this._set(t, k, e);
950
+ }
951
+ /** Sets a trigger until a transition that tests it fires (consumed once). */
952
+ setTrigger(t) {
953
+ this._set(t, F, !0);
954
+ }
955
+ resetTrigger(t) {
956
+ this._set(t, F, !1);
957
+ }
958
+ getParameter(t) {
959
+ const e = this._parameter(t);
960
+ return this._parameterTypes[e] >= k ? this._parameters[e] !== 0 : this._parameters[e];
961
+ }
962
+ setLayerWeight(t, e) {
963
+ this._layer(t).weight = x(e, "layer weight", 0, 1);
964
+ }
965
+ getLayerWeight(t) {
966
+ return this._layer(t).weight;
967
+ }
968
+ /** Active (destination) state of a layer. */
969
+ getCurrentState(t) {
970
+ const e = this._layer(t);
971
+ return e.states[e.current].name;
972
+ }
973
+ /** Whether the layer is cross-fading between two states. */
974
+ getTransitioning(t) {
975
+ return this._layer(t).transition >= 0;
976
+ }
977
+ /** Normalized weight of a state inside its layer (0..1, sums to 1 per layer). */
978
+ getStateWeight(t, e) {
979
+ const i = this._layer(t), s = i.stateIndex.get(e);
980
+ if (s === void 0)
981
+ throw new l("invalid-option", "[Nova3D] Unknown animation graph state.");
982
+ return i.states[s].weight;
983
+ }
984
+ /** Normalized time of the active state (cycles since entry, unwrapped). */
985
+ getStateTime(t) {
986
+ const e = this._layer(t);
987
+ return e.states[e.current].phase;
988
+ }
989
+ /** Subscribes to state entries (fired when a transition starts); returns unsubscribe. */
990
+ onStateEnter(t) {
991
+ return this._listen("_enterListeners", t);
992
+ }
993
+ /** Subscribes to state exits (fired when a transition leaves the active state); returns unsubscribe. */
994
+ onStateExit(t) {
995
+ return this._listen("_exitListeners", t);
996
+ }
997
+ /** Stops the graph actions and releases their channels. */
998
+ destroy() {
999
+ this._destroyed || (this._destroyed = !0, this._animator._detachDriver(this), this._enterListeners = [], this._exitListeners = [], this._animator._removeMany(this._actions));
1000
+ }
1001
+ /** @internal */
1002
+ _drive(t) {
1003
+ for (let e = 0; e < this._layers.length; e++)
1004
+ this._updateLayer(this._layers[e], t);
1005
+ this._apply();
1006
+ }
1007
+ /** @internal */
1008
+ _drivesContinuously() {
1009
+ return !this._destroyed;
1010
+ }
1011
+ /** @internal */
1012
+ _dispatchEvents() {
1013
+ const t = this._eventCount;
1014
+ this._eventCount = 0;
1015
+ for (let e = 0; e < t; e++) {
1016
+ const i = this._layers[this._events[e * 3]], s = i.states[this._events[e * 3 + 1]].name, o = this._events[e * 3 + 2] === X ? this._enterListeners : this._exitListeners;
1017
+ for (let a = 0; a < o.length; a++)
1018
+ o[a](i.name, s);
1019
+ }
1020
+ }
1021
+ /** @internal */
1022
+ _animatorEnded() {
1023
+ this._destroyed = !0, this._enterListeners = [], this._exitListeners = [];
1024
+ }
1025
+ _listen(t, e) {
1026
+ if (this._assertAlive(), typeof e != "function")
1027
+ throw new l("invalid-option", "[Nova3D] State listener must be a function.");
1028
+ return this[t] = [...this[t], e], () => {
1029
+ this[t] = this[t].filter((i) => i !== e);
1030
+ };
1031
+ }
1032
+ _assertAlive() {
1033
+ if (this._destroyed)
1034
+ throw new l("destroyed", "[Nova3D] Animation graph is destroyed.");
1035
+ }
1036
+ _parameter(t) {
1037
+ this._assertAlive();
1038
+ const e = this._parameterIndex.get(t);
1039
+ if (e === void 0)
1040
+ throw new l("invalid-option", `[Nova3D] Unknown animation graph parameter ${String(t)}.`);
1041
+ return e;
1042
+ }
1043
+ _layer(t) {
1044
+ this._assertAlive();
1045
+ const e = this._layerIndex.get(t);
1046
+ if (e === void 0)
1047
+ throw new l("invalid-option", "[Nova3D] Unknown animation graph layer.");
1048
+ return this._layers[e];
1049
+ }
1050
+ _set(t, e, i) {
1051
+ const s = this._parameter(t);
1052
+ if (this._parameterTypes[s] !== e)
1053
+ throw new l("invalid-option", `[Nova3D] Parameter ${t} is ${j[this._parameterTypes[s]]}.`);
1054
+ this._parameters[s] = this._coerce(s, i);
1055
+ }
1056
+ _coerce(t, e) {
1057
+ const i = this._parameterTypes[t];
1058
+ if (i >= k) {
1059
+ if (typeof e != "boolean")
1060
+ throw new l("invalid-option", "[Nova3D] Bool and trigger parameters take booleans.");
1061
+ return e ? 1 : 0;
1062
+ }
1063
+ if (x(e, "parameter value", -1e9, 1e9), i === B && !Number.isInteger(e))
1064
+ throw new l("invalid-option", "[Nova3D] Integer parameters take integers.");
1065
+ return e;
1066
+ }
1067
+ _createLayer(t, e) {
1068
+ const i = P(t?.name, "layer name");
1069
+ if (this._layerIndex.has(i))
1070
+ throw new l("invalid-option", "[Nova3D] Animation graph layer names must be unique.");
1071
+ const s = x(t.weight ?? 1, "layer weight", 0, 1), o = t.blend ?? "overwrite";
1072
+ if (o !== "overwrite" && o !== "additive")
1073
+ throw new l("invalid-option", "[Nova3D] Layer blend must be overwrite or additive.");
1074
+ if (t.mask !== void 0 && !(t.mask instanceof q))
1075
+ throw new l("invalid-option", "[Nova3D] Layer mask must come from createAnimationMask.");
1076
+ if (!Array.isArray(t.states) || t.states.length < 1 || t.states.length > 256)
1077
+ throw new l("invalid-option", "[Nova3D] A layer requires1..256 states.");
1078
+ const a = /* @__PURE__ */ new Map(), n = t.states.map((h, p) => {
1079
+ const f = P(h?.name, "state name");
1080
+ if (a.has(f))
1081
+ throw new l("invalid-option", "[Nova3D] State names must be unique within a layer.");
1082
+ return a.set(f, p), this._createState(h, f, e, o, t.mask);
1083
+ }), r = a.get(t.entry);
1084
+ if (r === void 0)
1085
+ throw new l("invalid-option", "[Nova3D] Layer entry must name one of its states.");
1086
+ const _ = t.transitions ?? [];
1087
+ if (!Array.isArray(_) || _.length > 1024)
1088
+ throw new l("invalid-option", "[Nova3D] A layer supports at most1024 transitions.");
1089
+ const d = _.map((h) => this._createTransition(h, a, r));
1090
+ return n.forEach((h, p) => {
1091
+ const f = d.map((m, u) => ({ transition: m, order: u })).filter(({ transition: m }) => (m.from === p || m.from === -1) && m.to !== p);
1092
+ f.sort((m, u) => m.transition.priority - u.transition.priority || +(m.transition.from !== -1) - +(u.transition.from !== -1) || m.order - u.order), h.transitions = Int32Array.from(f, (m) => m.order);
1093
+ }), n[r].weight = 1, this._layerIndex.set(i, e), { name: i, entry: r, states: n, stateIndex: a, transitions: d, weight: s, current: r, source: r, transition: -1, elapsed: 0 };
1094
+ }
1095
+ _createState(t, e, i, s, o) {
1096
+ if (t.clip === void 0 == (t.blendTree === void 0))
1097
+ throw new l("invalid-option", "[Nova3D] A state needs exactly one of clip or blendTree.");
1098
+ const a = x(t.speed ?? 1, "state speed", 0, 1e6), n = t.loop ?? !0;
1099
+ if (typeof n != "boolean")
1100
+ throw new l("invalid-option", "[Nova3D] State loop must be boolean.");
1101
+ const r = t.speedParameter === void 0 ? -1 : this._numericParameter(t.speedParameter);
1102
+ let _ = H, d, h = new Float64Array(0), p = -1, f = -1;
1103
+ const m = t.blendTree;
1104
+ if (m === void 0)
1105
+ d = [t.clip];
1106
+ else {
1107
+ if (!m || !Array.isArray(m.children) || m.children.length < 1 || m.children.length > 64)
1108
+ throw new l("invalid-option", "[Nova3D] A blend tree requires1..64 children.");
1109
+ if (m.type === "1d") {
1110
+ _ = V, p = this._numericParameter(m.parameter);
1111
+ const w = [...m.children].map((v) => ({ clip: v?.clip, threshold: x(v?.threshold, "blend threshold", -1e9, 1e9) })).sort((v, T) => v.threshold - T.threshold);
1112
+ for (let v = 1; v < w.length; v++)
1113
+ if (w[v].threshold === w[v - 1].threshold)
1114
+ throw new l("invalid-option", "[Nova3D] 1D blend thresholds must be distinct.");
1115
+ d = w.map((v) => v.clip), h = Float64Array.from(w, (v) => v.threshold);
1116
+ } else if (m.type === "2d-directional") {
1117
+ if (_ = E, !Array.isArray(m.parameters) || m.parameters.length !== 2)
1118
+ throw new l("invalid-option", "[Nova3D] A 2D blend tree needs two parameters.");
1119
+ p = this._numericParameter(m.parameters[0]), f = this._numericParameter(m.parameters[1]), d = m.children.map((w) => w?.clip), h = new Float64Array(m.children.length * 2), m.children.forEach((w, v) => {
1120
+ if (!Array.isArray(w?.position) || w.position.length !== 2)
1121
+ throw new l("invalid-option", "[Nova3D] 2D blend children need [x, y] positions.");
1122
+ h[v * 2] = x(w.position[0], "blend position", -1e9, 1e9), h[v * 2 + 1] = x(w.position[1], "blend position", -1e9, 1e9);
1123
+ for (let T = 0; T < v; T++)
1124
+ if (h[T * 2] === h[v * 2] && h[T * 2 + 1] === h[v * 2 + 1])
1125
+ throw new l("invalid-option", "[Nova3D] 2D blend positions must be distinct.");
1126
+ });
1127
+ } else
1128
+ throw new l("invalid-option", "[Nova3D] Blend tree type must be 1d or 2d-directional.");
1129
+ }
1130
+ for (const w of d)
1131
+ if (!(w instanceof Z))
1132
+ throw new l("invalid-option", "[Nova3D] Graph states require animation clips.");
1133
+ const u = d.length, g = new Float64Array(_ === E ? u : 0), y = new Float64Array(_ === E ? u * u * 3 : 0);
1134
+ if (_ === E) {
1135
+ for (let w = 0; w < u; w++)
1136
+ g[w] = Math.hypot(h[w * 2], h[w * 2 + 1]);
1137
+ for (let w = 0; w < u; w++)
1138
+ for (let v = 0; v < u; v++) {
1139
+ if (w === v)
1140
+ continue;
1141
+ const T = (g[v] - g[w]) / ((g[v] + g[w]) / 2), C = Y(h[w * 2], h[w * 2 + 1], h[v * 2], h[v * 2 + 1]) * 2, O = (w * u + v) * 3;
1142
+ y[O] = T, y[O + 1] = C, y[O + 2] = T * T + C * C;
1143
+ }
1144
+ }
1145
+ const D = d.map((w) => {
1146
+ const v = this._animator.play(w, { loop: n ? "repeat" : "once", speed: 0, weight: 0, layer: i, blend: s, mask: o });
1147
+ return this._actions.push(v), v;
1148
+ });
1149
+ return {
1150
+ name: e,
1151
+ kind: _,
1152
+ actions: D,
1153
+ durations: Float64Array.from(d, (w) => w.duration),
1154
+ weights: new Float64Array(u),
1155
+ parameterX: p,
1156
+ parameterY: f,
1157
+ points: h,
1158
+ lengths: g,
1159
+ bands: y,
1160
+ speed: a,
1161
+ speedParameter: r,
1162
+ loop: n,
1163
+ transitions: new Int32Array(0),
1164
+ phase: 0,
1165
+ previous: 0,
1166
+ weight: 0,
1167
+ fadeFrom: 0
1168
+ };
1169
+ }
1170
+ _numericParameter(t) {
1171
+ const e = this._parameterIndex.get(t);
1172
+ if (e === void 0 || this._parameterTypes[e] >= k)
1173
+ throw new l("invalid-option", "[Nova3D] Blend and speed parameters must be float or int parameters.");
1174
+ return e;
1175
+ }
1176
+ _createTransition(t, e, i) {
1177
+ const s = t?.from === "$any" ? -1 : e.get(t?.from), o = t?.to === "$exit" ? i : e.get(t?.to);
1178
+ if (s === void 0 || o === void 0)
1179
+ throw new l("invalid-option", "[Nova3D] Transitions must name states of their layer, $any or $exit.");
1180
+ if (s === o)
1181
+ throw new l("unsupported", "[Nova3D] Self transitions are not supported.");
1182
+ const a = ut.indexOf(t.interruptionSource ?? "none");
1183
+ if (a < 0)
1184
+ throw new l("invalid-option", "[Nova3D] interruptionSource must be none, current or next.");
1185
+ const n = t.priority ?? 0;
1186
+ if (!Number.isSafeInteger(n))
1187
+ throw new l("invalid-option", "[Nova3D] Transition priority must be an integer.");
1188
+ const r = t.conditions ?? [];
1189
+ if (!Array.isArray(r) || r.length > 32)
1190
+ throw new l("invalid-option", "[Nova3D] A transition supports at most32 conditions.");
1191
+ const _ = new Int32Array(r.length), d = new Uint8Array(r.length), h = new Float64Array(r.length), p = [];
1192
+ return r.forEach((f, m) => {
1193
+ const u = this._parameterIndex.get(f?.parameter);
1194
+ if (u === void 0)
1195
+ throw new l("invalid-option", "[Nova3D] Transition condition names an unknown parameter.");
1196
+ const g = this._parameterTypes[u], y = f.operator === void 0 ? g >= k ? 4 : -1 : mt.indexOf(f.operator);
1197
+ if (y < 0 || g >= k && y < 4 || g === F && y !== 4)
1198
+ throw new l("invalid-option", "[Nova3D] Invalid condition operator for this parameter type.");
1199
+ if (g >= k) {
1200
+ const D = f.value ?? !0;
1201
+ if (typeof D != "boolean" || g === F && !D)
1202
+ throw new l("invalid-option", "[Nova3D] Bool conditions compare booleans; trigger conditions test true.");
1203
+ h[m] = D ? 1 : 0;
1204
+ } else
1205
+ h[m] = x(f.value, "condition value", -1e9, 1e9);
1206
+ _[m] = u, d[m] = y, g === F && p.push(u);
1207
+ }), {
1208
+ from: s,
1209
+ to: o,
1210
+ duration: x(t.duration ?? 0, "transition duration", 0, 1e6),
1211
+ exitTime: t.exitTime === void 0 ? Number.NaN : x(t.exitTime, "exit time", 0, 1e6),
1212
+ offset: x(t.offset ?? 0, "transition offset", 0, 1e6),
1213
+ interruption: a,
1214
+ priority: n,
1215
+ parameters: _,
1216
+ operators: d,
1217
+ values: h,
1218
+ triggers: Int32Array.from(p)
1219
+ };
1220
+ }
1221
+ _updateLayer(t, e) {
1222
+ const i = t.states;
1223
+ for (let a = 0; a < i.length; a++) {
1224
+ const n = i[a];
1225
+ n.previous = n.phase, (n.weight > 0 || a === t.current) && (this._blend(n), n.phase += e * this._rate(n));
1226
+ }
1227
+ if (t.transition >= 0) {
1228
+ t.elapsed += e;
1229
+ const a = t.transitions[t.transition].duration, n = a > 0 ? Math.min(1, t.elapsed / a) : 1;
1230
+ for (let r = 0; r < i.length; r++) {
1231
+ const _ = i[r];
1232
+ _.weight = r === t.current ? _.fadeFrom + (1 - _.fadeFrom) * n : _.fadeFrom * (1 - n);
1233
+ }
1234
+ if (n >= 1) {
1235
+ t.transition = -1;
1236
+ for (let r = 0; r < i.length; r++)
1237
+ i[r].weight = r === t.current ? 1 : 0;
1238
+ }
1239
+ }
1240
+ let s = t.current;
1241
+ if (t.transition >= 0) {
1242
+ const a = t.transitions[t.transition].interruption;
1243
+ if (a === 0)
1244
+ return;
1245
+ s = a === 1 ? t.source : t.current;
1246
+ }
1247
+ const o = i[s].transitions;
1248
+ for (let a = 0; a < o.length; a++) {
1249
+ const n = o[a], r = t.transitions[n];
1250
+ if (!(n === t.transition || r.to === t.current) && this._exitReached(r, i[s]) && this._conditionsMet(r)) {
1251
+ this._start(t, n);
1252
+ return;
1253
+ }
1254
+ }
1255
+ }
1256
+ _exitReached(t, e) {
1257
+ const i = t.exitTime;
1258
+ if (Number.isNaN(i))
1259
+ return !0;
1260
+ const s = e.previous, o = e.phase;
1261
+ return o === s ? !1 : i < 1 && e.loop ? Math.floor(o - i) > Math.floor(s - i) : s < i && i <= o;
1262
+ }
1263
+ _conditionsMet(t) {
1264
+ for (let e = 0; e < t.parameters.length; e++) {
1265
+ const i = this._parameters[t.parameters[e]], s = t.values[e];
1266
+ let o;
1267
+ switch (t.operators[e]) {
1268
+ case 0:
1269
+ o = i > s;
1270
+ break;
1271
+ case 1:
1272
+ o = i >= s;
1273
+ break;
1274
+ case 2:
1275
+ o = i < s;
1276
+ break;
1277
+ case 3:
1278
+ o = i <= s;
1279
+ break;
1280
+ case 4:
1281
+ o = i === s;
1282
+ break;
1283
+ default:
1284
+ o = i !== s;
1285
+ }
1286
+ if (!o)
1287
+ return !1;
1288
+ }
1289
+ return !0;
1290
+ }
1291
+ _start(t, e) {
1292
+ const i = t.transitions[e];
1293
+ for (let r = 0; r < i.triggers.length; r++)
1294
+ this._parameters[i.triggers[r]] = 0;
1295
+ const s = t.states, o = s[i.to];
1296
+ o.weight <= 0 && (o.phase = i.offset, o.previous = i.offset);
1297
+ const a = t.current;
1298
+ if (i.duration > 0) {
1299
+ for (let r = 0; r < s.length; r++)
1300
+ s[r].fadeFrom = s[r].weight;
1301
+ t.transition = e, t.elapsed = 0, t.source = a;
1302
+ } else {
1303
+ for (let r = 0; r < s.length; r++)
1304
+ s[r].weight = 0;
1305
+ o.weight = 1, t.transition = -1;
1306
+ }
1307
+ t.current = i.to;
1308
+ const n = this._layerIndex.get(t.name);
1309
+ this._queue(n, a, wt), this._queue(n, i.to, X);
1310
+ }
1311
+ _queue(t, e, i) {
1312
+ const s = this._eventCount * 3;
1313
+ s + 3 > this._events.length || (this._events[s] = t, this._events[s + 1] = e, this._events[s + 2] = i, this._eventCount++);
1314
+ }
1315
+ /** Normalized cycles per second of a state from its weighted child durations. */
1316
+ _rate(t) {
1317
+ const e = t.speedParameter < 0 ? 1 : Math.max(0, this._parameters[t.speedParameter]), i = t.speed * e;
1318
+ let s = 0;
1319
+ for (let o = 0; o < t.durations.length; o++)
1320
+ s += t.weights[o] * t.durations[o];
1321
+ return s > 0 ? i / s : i;
1322
+ }
1323
+ _blend(t) {
1324
+ const e = t.weights, i = e.length;
1325
+ if (e.fill(0), t.kind === H || i === 1) {
1326
+ e[0] = 1;
1327
+ return;
1328
+ }
1329
+ const s = t.points;
1330
+ if (t.kind === V) {
1331
+ const h = this._parameters[t.parameterX];
1332
+ if (h <= s[0]) {
1333
+ e[0] = 1;
1334
+ return;
1335
+ }
1336
+ if (h >= s[i - 1]) {
1337
+ e[i - 1] = 1;
1338
+ return;
1339
+ }
1340
+ for (let p = 0; p < i - 1; p++)
1341
+ if (h < s[p + 1]) {
1342
+ const f = (h - s[p]) / (s[p + 1] - s[p]);
1343
+ e[p] = 1 - f, e[p + 1] = f;
1344
+ return;
1345
+ }
1346
+ return;
1347
+ }
1348
+ const o = this._parameters[t.parameterX], a = this._parameters[t.parameterY], n = Math.hypot(o, a);
1349
+ let r = 0, _ = 0, d = 1 / 0;
1350
+ for (let h = 0; h < i; h++) {
1351
+ const p = s[h * 2], f = s[h * 2 + 1], m = Math.hypot(o - p, a - f);
1352
+ m < d && (d = m, _ = h);
1353
+ let u = 1;
1354
+ for (let g = 0; g < i; g++) {
1355
+ if (h === g)
1356
+ continue;
1357
+ const y = (h * i + g) * 3, D = (n - t.lengths[h]) / ((t.lengths[g] + t.lengths[h]) / 2), w = Y(p, f, o, a) * 2, v = 1 - (D * t.bands[y] + w * t.bands[y + 1]) / t.bands[y + 2];
1358
+ u = Math.min(u, Math.max(0, v));
1359
+ }
1360
+ e[h] = u, r += u;
1361
+ }
1362
+ if (r <= 0) {
1363
+ e[_] = 1;
1364
+ return;
1365
+ }
1366
+ for (let h = 0; h < i; h++)
1367
+ e[h] /= r;
1368
+ }
1369
+ /** Writes state weights and times into the preallocated actions. */
1370
+ _apply() {
1371
+ for (let t = 0; t < this._layers.length; t++) {
1372
+ const e = this._layers[t];
1373
+ for (let i = 0; i < e.states.length; i++) {
1374
+ const s = e.states[i], o = s.weight * e.weight;
1375
+ o > 0 && this._blend(s);
1376
+ for (let a = 0; a < s.actions.length; a++)
1377
+ s.actions[a]._drive(s.phase * s.durations[a], o > 0 ? o * s.weights[a] : 0);
1378
+ }
1379
+ }
1380
+ }
1381
+ }
1382
+ function St(c, t) {
1383
+ return new gt(c, t);
1384
+ }
1385
+ export {
1386
+ U as Nova3DAnimationAction,
1387
+ Z as Nova3DAnimationClip,
1388
+ gt as Nova3DAnimationGraph,
1389
+ q as Nova3DAnimationMask,
1390
+ et as Nova3DAnimator,
1391
+ Ft as createAnimationClip,
1392
+ St as createAnimationGraph,
1393
+ xt as createAnimationMask,
1394
+ Tt as createAnimator,
1395
+ It as toAdditiveClip
1396
+ };